glsl/link,i965: Make ImageAccess four-state

The GLSL spec allows you to set both the "readonly" and "writeonly"
qualifiers on images to indicate that it can only be used with
imageSize.  However, we had no way of representing this int he linked
shader and flagged it as GL_READ_ONLY.  This is good from a "does it use
this buffer?" perspective but not from a format and access lowering
perspective.  By using GL_NONE for if "readonly" and "writeonly" are
both set, we can detect this case in the driver and handle it correctly.

Nothing currently relies on the type of surface in the "readonly" +
"writeonly" case but that's about to change.  i965 is the only drier
which uses the ImageAccess field and gl_bindless_image::access is
currently unused.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Jason Ekstrand
2018-08-16 14:31:28 -05:00
parent 4289143899
commit 48e4fa7dd8
4 changed files with 22 additions and 15 deletions

View File

@@ -425,9 +425,11 @@ nir_link_uniform(struct gl_context *ctx,
/* Set image access qualifiers */
const GLenum access =
(state->current_var->data.image.read_only ? GL_READ_ONLY :
state->current_var->data.image.write_only ? GL_WRITE_ONLY :
GL_READ_WRITE);
state->current_var->data.image.read_only ?
(state->current_var->data.image.write_only ? GL_NONE :
GL_READ_ONLY) :
(state->current_var->data.image.write_only ? GL_WRITE_ONLY :
GL_READ_WRITE);
for (unsigned i = image_index;
i < MIN2(state->next_image_index, MAX_IMAGE_UNIFORMS);
i++) {

View File

@@ -690,9 +690,11 @@ private:
/* 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,