/* Set image access qualifiers */
const GLenum access =
- (current_var->data.memory_read_only ? GL_READ_ONLY :
- current_var->data.memory_write_only ? GL_WRITE_ONLY :
- GL_READ_WRITE);
+ current_var->data.memory_read_only ?
+ (current_var->data.memory_write_only ? GL_NONE :
+ GL_READ_ONLY) :
+ (current_var->data.memory_write_only ? GL_WRITE_ONLY :
+ GL_READ_WRITE);
if (current_var->data.bindless) {
if (!set_opaque_indices(base_type, uniform, name,
{
const struct gen_device_info *devinfo = &brw->screen->devinfo;
enum isl_format hw_format = brw_isl_format_for_mesa_format(format);
- if (access == GL_WRITE_ONLY) {
+ if (access == GL_WRITE_ONLY || access == GL_NONE) {
return hw_format;
} else if (isl_has_matching_typed_storage_image_format(devinfo, hw_format)) {
/* Typed surface reads support a very limited subset of the shader
if (_mesa_is_image_unit_valid(&brw->ctx, u)) {
struct gl_texture_object *obj = u->TexObj;
const unsigned format = get_image_format(brw, u->_ActualFormat, access);
+ const bool written = (access != GL_READ_ONLY && access != GL_NONE);
if (obj->Target == GL_TEXTURE_BUFFER) {
const unsigned texel_size = (format == ISL_FORMAT_RAW ? 1 :
const unsigned buffer_size = buffer_texture_range_size(brw, obj);
struct brw_bo *const bo = !obj->BufferObject ? NULL :
intel_bufferobj_buffer(brw, intel_buffer_object(obj->BufferObject),
- obj->BufferOffset, buffer_size,
- access != GL_READ_ONLY);
+ obj->BufferOffset, buffer_size, written);
brw_emit_buffer_surface_state(
brw, surf_offset, bo, obj->BufferOffset,
format, buffer_size, texel_size,
- access != GL_READ_ONLY ? RELOC_WRITE : 0);
+ written ? RELOC_WRITE : 0);
update_buffer_image_param(brw, u, surface_idx, param);
brw_emit_buffer_surface_state(
brw, surf_offset, mt->bo, mt->offset,
format, mt->bo->size - mt->offset, 1 /* pitch */,
- access != GL_READ_ONLY ? RELOC_WRITE : 0);
+ written ? RELOC_WRITE : 0);
} else {
const int surf_index = surf_offset - &brw->wm.base.surf_offset[0];
brw_emit_surface_state(brw, mt, mt->target, view,
ISL_AUX_USAGE_NONE,
surf_offset, surf_index,
- access == GL_READ_ONLY ? 0 : RELOC_WRITE);
+ written ? RELOC_WRITE : 0);
}
isl_surf_fill_image_param(&brw->isl_dev, param, &mt->surf, &view);
/** Whether this bindless image is bound to a unit. */
GLboolean bound;
- /** Access qualifier (GL_READ_WRITE, GL_READ_ONLY, GL_WRITE_ONLY) */
+ /** Access qualifier (GL_READ_WRITE, GL_READ_ONLY, GL_WRITE_ONLY, or
+ * GL_NONE to indicate both read-only and write-only)
+ */
GLenum16 access;
/** Pointer to the base of the data. */
/**
* Access qualifier specified in the shader for each image uniform
- * index. Either \c GL_READ_ONLY, \c GL_WRITE_ONLY or \c
- * GL_READ_WRITE.
+ * index. Either \c GL_READ_ONLY, \c GL_WRITE_ONLY, \c
+ * GL_READ_WRITE, or \c GL_NONE to indicate both read-only and
+ * write-only.
*
* It may be different, though only more strict than the value of
* \c gl_image_unit::Access for the corresponding image unit.