glsl: Add built-in constants for ARB_shader_image_load_store.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 12 Feb 2014 16:15:21 +0000 (17:15 +0100)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 12 Feb 2014 17:44:05 +0000 (18:44 +0100)
v2: Add them on GLSL version 4.20 too.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/glsl/builtin_variables.cpp
src/glsl/glsl_parser_extras.cpp
src/glsl/glsl_parser_extras.h

index cc423383df8d4c505aeea092980f6a28108ac1ea..2fa509f27658b99cda240f396711d4fc59232869 100644 (file)
@@ -711,6 +711,26 @@ builtin_variable_generator::generate_constants()
        * in ast_cs_input_layout::hir().
        */
    }
+
+   if (state->is_version(420, 0) ||
+       state->ARB_shader_image_load_store_enable) {
+      add_const("gl_MaxImageUnits",
+                state->Const.MaxImageUnits);
+      add_const("gl_MaxCombinedImageUnitsAndFragmentOutputs",
+                state->Const.MaxCombinedImageUnitsAndFragmentOutputs);
+      add_const("gl_MaxImageSamples",
+                state->Const.MaxImageSamples);
+      add_const("gl_MaxVertexImageUniforms",
+                state->Const.MaxVertexImageUniforms);
+      add_const("gl_MaxTessControlImageUniforms", 0);
+      add_const("gl_MaxTessEvaluationImageUniforms", 0);
+      add_const("gl_MaxGeometryImageUniforms",
+                state->Const.MaxGeometryImageUniforms);
+      add_const("gl_MaxFragmentImageUniforms",
+                state->Const.MaxFragmentImageUniforms);
+      add_const("gl_MaxCombinedImageUniforms",
+                state->Const.MaxCombinedImageUniforms);
+   }
 }
 
 
index 8bab7a981f2c1718d65b801256df502c9cecf75d..901124d2c396033b4941fc5cd46644668ade49d8 100644 (file)
@@ -130,6 +130,14 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
    for (unsigned i = 0; i < Elements(this->Const.MaxComputeWorkGroupSize); i++)
       this->Const.MaxComputeWorkGroupSize[i] = ctx->Const.MaxComputeWorkGroupSize[i];
 
+   this->Const.MaxImageUnits = ctx->Const.MaxImageUnits;
+   this->Const.MaxCombinedImageUnitsAndFragmentOutputs = ctx->Const.MaxCombinedImageUnitsAndFragmentOutputs;
+   this->Const.MaxImageSamples = ctx->Const.MaxImageSamples;
+   this->Const.MaxVertexImageUniforms = ctx->Const.Program[MESA_SHADER_VERTEX].MaxImageUniforms;
+   this->Const.MaxGeometryImageUniforms = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxImageUniforms;
+   this->Const.MaxFragmentImageUniforms = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms;
+   this->Const.MaxCombinedImageUniforms = ctx->Const.MaxCombinedImageUniforms;
+
    this->current_function = NULL;
    this->toplevel_ir = NULL;
    this->found_return = false;
index ba32c086e3a4d135efbfe32c0a290b0099710871..ad4ef0146874e124fccd565fd171f1bb269bac28 100644 (file)
@@ -269,6 +269,15 @@ struct _mesa_glsl_parse_state {
       /* ARB_compute_shader */
       unsigned MaxComputeWorkGroupCount[3];
       unsigned MaxComputeWorkGroupSize[3];
+
+      /* ARB_shader_image_load_store */
+      unsigned MaxImageUnits;
+      unsigned MaxCombinedImageUnitsAndFragmentOutputs;
+      unsigned MaxImageSamples;
+      unsigned MaxVertexImageUniforms;
+      unsigned MaxGeometryImageUniforms;
+      unsigned MaxFragmentImageUniforms;
+      unsigned MaxCombinedImageUniforms;
    } Const;
 
    /**