summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glsl_parser.yy
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2016-11-03 17:18:45 +0000
committerLionel Landwerlin <[email protected]>2016-11-18 13:27:28 +0000
commit9a806d2d15d9ec9e11087e4bd7dd390e4263309c (patch)
tree0874912cd052e0893552ceb959530185765af993 /src/compiler/glsl/glsl_parser.yy
parent88fe2c308ec0902b8f3980f9ce6ab6241ba74c14 (diff)
mesa: add NV_image_formats extension support
This extension can be enabled automatically as it is a subset of ARB_shader_image_load_store. v2: Replace helper function by qualifier struct field (Ilia) Enable NV_image_formats using ARB_shader_image_load_store (Ilia) v3: Drop extension field from gl_extensions (Ilia) Release notes (Ilia) Signed-off-by: Lionel Landwerlin <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98480 Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glsl_parser.yy')
-rw-r--r--src/compiler/glsl/glsl_parser.yy86
1 files changed, 45 insertions, 41 deletions
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 7d709c78c57..a48dc68b00e 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -1296,51 +1296,55 @@ layout_qualifier_id:
unsigned required_glsl;
/** Minimum GLSL ES version required for the image format. */
unsigned required_essl;
+ /* NV_image_formats */
+ bool nv_image_formats;
} map[] = {
- { "rgba32f", GL_RGBA32F, GLSL_TYPE_FLOAT, 130, 310 },
- { "rgba16f", GL_RGBA16F, GLSL_TYPE_FLOAT, 130, 310 },
- { "rg32f", GL_RG32F, GLSL_TYPE_FLOAT, 130, 0 },
- { "rg16f", GL_RG16F, GLSL_TYPE_FLOAT, 130, 0 },
- { "r11f_g11f_b10f", GL_R11F_G11F_B10F, GLSL_TYPE_FLOAT, 130, 0 },
- { "r32f", GL_R32F, GLSL_TYPE_FLOAT, 130, 310 },
- { "r16f", GL_R16F, GLSL_TYPE_FLOAT, 130, 0 },
- { "rgba32ui", GL_RGBA32UI, GLSL_TYPE_UINT, 130, 310 },
- { "rgba16ui", GL_RGBA16UI, GLSL_TYPE_UINT, 130, 310 },
- { "rgb10_a2ui", GL_RGB10_A2UI, GLSL_TYPE_UINT, 130, 0 },
- { "rgba8ui", GL_RGBA8UI, GLSL_TYPE_UINT, 130, 310 },
- { "rg32ui", GL_RG32UI, GLSL_TYPE_UINT, 130, 0 },
- { "rg16ui", GL_RG16UI, GLSL_TYPE_UINT, 130, 0 },
- { "rg8ui", GL_RG8UI, GLSL_TYPE_UINT, 130, 0 },
- { "r32ui", GL_R32UI, GLSL_TYPE_UINT, 130, 310 },
- { "r16ui", GL_R16UI, GLSL_TYPE_UINT, 130, 0 },
- { "r8ui", GL_R8UI, GLSL_TYPE_UINT, 130, 0 },
- { "rgba32i", GL_RGBA32I, GLSL_TYPE_INT, 130, 310 },
- { "rgba16i", GL_RGBA16I, GLSL_TYPE_INT, 130, 310 },
- { "rgba8i", GL_RGBA8I, GLSL_TYPE_INT, 130, 310 },
- { "rg32i", GL_RG32I, GLSL_TYPE_INT, 130, 0 },
- { "rg16i", GL_RG16I, GLSL_TYPE_INT, 130, 0 },
- { "rg8i", GL_RG8I, GLSL_TYPE_INT, 130, 0 },
- { "r32i", GL_R32I, GLSL_TYPE_INT, 130, 310 },
- { "r16i", GL_R16I, GLSL_TYPE_INT, 130, 0 },
- { "r8i", GL_R8I, GLSL_TYPE_INT, 130, 0 },
- { "rgba16", GL_RGBA16, GLSL_TYPE_FLOAT, 130, 0 },
- { "rgb10_a2", GL_RGB10_A2, GLSL_TYPE_FLOAT, 130, 0 },
- { "rgba8", GL_RGBA8, GLSL_TYPE_FLOAT, 130, 310 },
- { "rg16", GL_RG16, GLSL_TYPE_FLOAT, 130, 0 },
- { "rg8", GL_RG8, GLSL_TYPE_FLOAT, 130, 0 },
- { "r16", GL_R16, GLSL_TYPE_FLOAT, 130, 0 },
- { "r8", GL_R8, GLSL_TYPE_FLOAT, 130, 0 },
- { "rgba16_snorm", GL_RGBA16_SNORM, GLSL_TYPE_FLOAT, 130, 0 },
- { "rgba8_snorm", GL_RGBA8_SNORM, GLSL_TYPE_FLOAT, 130, 310 },
- { "rg16_snorm", GL_RG16_SNORM, GLSL_TYPE_FLOAT, 130, 0 },
- { "rg8_snorm", GL_RG8_SNORM, GLSL_TYPE_FLOAT, 130, 0 },
- { "r16_snorm", GL_R16_SNORM, GLSL_TYPE_FLOAT, 130, 0 },
- { "r8_snorm", GL_R8_SNORM, GLSL_TYPE_FLOAT, 130, 0 }
+ { "rgba32f", GL_RGBA32F, GLSL_TYPE_FLOAT, 130, 310, false },
+ { "rgba16f", GL_RGBA16F, GLSL_TYPE_FLOAT, 130, 310, false },
+ { "rg32f", GL_RG32F, GLSL_TYPE_FLOAT, 130, 0, true },
+ { "rg16f", GL_RG16F, GLSL_TYPE_FLOAT, 130, 0, true },
+ { "r11f_g11f_b10f", GL_R11F_G11F_B10F, GLSL_TYPE_FLOAT, 130, 0, true },
+ { "r32f", GL_R32F, GLSL_TYPE_FLOAT, 130, 310, false },
+ { "r16f", GL_R16F, GLSL_TYPE_FLOAT, 130, 0, true },
+ { "rgba32ui", GL_RGBA32UI, GLSL_TYPE_UINT, 130, 310, false },
+ { "rgba16ui", GL_RGBA16UI, GLSL_TYPE_UINT, 130, 310, false },
+ { "rgb10_a2ui", GL_RGB10_A2UI, GLSL_TYPE_UINT, 130, 0, true },
+ { "rgba8ui", GL_RGBA8UI, GLSL_TYPE_UINT, 130, 310, false },
+ { "rg32ui", GL_RG32UI, GLSL_TYPE_UINT, 130, 0, true },
+ { "rg16ui", GL_RG16UI, GLSL_TYPE_UINT, 130, 0, true },
+ { "rg8ui", GL_RG8UI, GLSL_TYPE_UINT, 130, 0, true },
+ { "r32ui", GL_R32UI, GLSL_TYPE_UINT, 130, 310, false },
+ { "r16ui", GL_R16UI, GLSL_TYPE_UINT, 130, 0, true },
+ { "r8ui", GL_R8UI, GLSL_TYPE_UINT, 130, 0, true },
+ { "rgba32i", GL_RGBA32I, GLSL_TYPE_INT, 130, 310, false },
+ { "rgba16i", GL_RGBA16I, GLSL_TYPE_INT, 130, 310, false },
+ { "rgba8i", GL_RGBA8I, GLSL_TYPE_INT, 130, 310, false },
+ { "rg32i", GL_RG32I, GLSL_TYPE_INT, 130, 0, true },
+ { "rg16i", GL_RG16I, GLSL_TYPE_INT, 130, 0, true },
+ { "rg8i", GL_RG8I, GLSL_TYPE_INT, 130, 0, true },
+ { "r32i", GL_R32I, GLSL_TYPE_INT, 130, 310, false },
+ { "r16i", GL_R16I, GLSL_TYPE_INT, 130, 0, true },
+ { "r8i", GL_R8I, GLSL_TYPE_INT, 130, 0, true },
+ { "rgba16", GL_RGBA16, GLSL_TYPE_FLOAT, 130, 0, false },
+ { "rgb10_a2", GL_RGB10_A2, GLSL_TYPE_FLOAT, 130, 0, true },
+ { "rgba8", GL_RGBA8, GLSL_TYPE_FLOAT, 130, 310, false },
+ { "rg16", GL_RG16, GLSL_TYPE_FLOAT, 130, 0, false },
+ { "rg8", GL_RG8, GLSL_TYPE_FLOAT, 130, 0, true },
+ { "r16", GL_R16, GLSL_TYPE_FLOAT, 130, 0, false },
+ { "r8", GL_R8, GLSL_TYPE_FLOAT, 130, 0, true },
+ { "rgba16_snorm", GL_RGBA16_SNORM, GLSL_TYPE_FLOAT, 130, 0, false },
+ { "rgba8_snorm", GL_RGBA8_SNORM, GLSL_TYPE_FLOAT, 130, 310, false },
+ { "rg16_snorm", GL_RG16_SNORM, GLSL_TYPE_FLOAT, 130, 0, false },
+ { "rg8_snorm", GL_RG8_SNORM, GLSL_TYPE_FLOAT, 130, 0, true },
+ { "r16_snorm", GL_R16_SNORM, GLSL_TYPE_FLOAT, 130, 0, false },
+ { "r8_snorm", GL_R8_SNORM, GLSL_TYPE_FLOAT, 130, 0, true }
};
for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
- if (state->is_version(map[i].required_glsl,
- map[i].required_essl) &&
+ if ((state->is_version(map[i].required_glsl,
+ map[i].required_essl) ||
+ (state->NV_image_formats_enable &&
+ map[i].nv_image_formats)) &&
match_layout_qualifier($1, map[i].name, state) == 0) {
$$.flags.q.explicit_image_format = 1;
$$.image_format = map[i].format;