diff options
author | Jason Ekstrand <[email protected]> | 2018-08-16 14:31:28 -0500 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-08-29 14:04:02 -0500 |
commit | 48e4fa7dd8c4b777989c4a731d6ac54cfe6c24eb (patch) | |
tree | 77c34d4c05d012072f410f406475f07db8428e57 /src/compiler | |
parent | 42891438990ce170a2ce08f71a1360842d5897a1 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/gl_nir_link_uniforms.c | 8 | ||||
-rw-r--r-- | src/compiler/glsl/link_uniforms.cpp | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index 1573e30c41e..159dfeca59f 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++ b/src/compiler/glsl/gl_nir_link_uniforms.c @@ -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++) { diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index 434ecefb289..63e688b19a7 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -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, |