st/mesa/glsl/nir/i965: make use of new gl_shader_program_data in gl_shader_program
authorTimothy Arceri <timothy.arceri@collabora.com>
Mon, 7 Nov 2016 03:47:18 +0000 (14:47 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Sat, 19 Nov 2016 04:45:46 +0000 (15:45 +1100)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
32 files changed:
src/compiler/glsl/link_atomics.cpp
src/compiler/glsl/link_uniform_initializers.cpp
src/compiler/glsl/link_uniforms.cpp
src/compiler/glsl/linker.cpp
src/compiler/glsl/standalone.cpp
src/compiler/glsl/standalone_scaffolding.cpp
src/compiler/glsl/tests/set_uniform_initializer_tests.cpp
src/compiler/nir/nir_lower_atomics.c
src/compiler/nir/nir_lower_samplers.c
src/mesa/drivers/common/meta.c
src/mesa/drivers/dri/i965/brw_cs.c
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp
src/mesa/drivers/dri/i965/brw_tcs.c
src/mesa/drivers/dri/i965/brw_tes.c
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/gen7_l3_state.c
src/mesa/main/ff_fragment_shader.cpp
src/mesa/main/mtypes.h
src/mesa/main/pipelineobj.c
src/mesa/main/program_resource.c
src/mesa/main/shader_query.cpp
src/mesa/main/shaderapi.c
src/mesa/main/shaderobj.c
src/mesa/main/state.c
src/mesa/main/texstate.c
src/mesa/main/uniform_query.cpp
src/mesa/main/uniforms.c
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_atom_atomicbuf.c
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 46a8843d2cbe0cedd7137951e159b110240c9c9f..d26e62a35b389df7cc5ff6af414484392d8f9604 100644 (file)
@@ -118,7 +118,7 @@ namespace {
       } else {
          active_atomic_buffer *buf = &buffers[var->data.binding];
          gl_uniform_storage *const storage =
-            &prog->UniformStorage[*uniform_loc];
+            &prog->data->UniformStorage[*uniform_loc];
 
          /* If this is the first time the buffer is used, increment
           * the counter of buffers used.
@@ -207,9 +207,9 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
    active_atomic_buffer *abs =
       find_active_atomic_counters(ctx, prog, &num_buffers);
 
-   prog->AtomicBuffers = rzalloc_array(prog, gl_active_atomic_buffer,
-                                       num_buffers);
-   prog->NumAtomicBuffers = num_buffers;
+   prog->data->AtomicBuffers = rzalloc_array(prog, gl_active_atomic_buffer,
+                                             num_buffers);
+   prog->data->NumAtomicBuffers = num_buffers;
 
    unsigned i = 0;
    for (unsigned binding = 0;
@@ -222,12 +222,12 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
          continue;
 
       active_atomic_buffer &ab = abs[binding];
-      gl_active_atomic_buffer &mab = prog->AtomicBuffers[i];
+      gl_active_atomic_buffer &mab = prog->data->AtomicBuffers[i];
 
       /* Assign buffer-specific fields. */
       mab.Binding = binding;
       mab.MinimumSize = ab.size;
-      mab.Uniforms = rzalloc_array(prog->AtomicBuffers, GLuint,
+      mab.Uniforms = rzalloc_array(prog->data->AtomicBuffers, GLuint,
                                    ab.num_uniforms);
       mab.NumUniforms = ab.num_uniforms;
 
@@ -235,7 +235,7 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
       for (unsigned j = 0; j < ab.num_uniforms; j++) {
          ir_variable *const var = ab.uniforms[j].var;
          gl_uniform_storage *const storage =
-            &prog->UniformStorage[ab.uniforms[j].uniform_loc];
+            &prog->data->UniformStorage[ab.uniforms[j].uniform_loc];
 
          mab.Uniforms[j] = ab.uniforms[j].uniform_loc;
          if (!var->data.explicit_binding)
@@ -276,14 +276,14 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
          unsigned intra_stage_idx = 0;
          for (unsigned i = 0; i < num_buffers; i++) {
             struct gl_active_atomic_buffer *atomic_buffer =
-               &prog->AtomicBuffers[i];
+               &prog->data->AtomicBuffers[i];
             if (atomic_buffer->StageReferences[j]) {
                gl_prog->sh.AtomicBuffers[intra_stage_idx] = atomic_buffer;
 
                for (unsigned u = 0; u < atomic_buffer->NumUniforms; u++) {
-                  prog->UniformStorage[atomic_buffer->Uniforms[u]].opaque[j].index =
+                  prog->data->UniformStorage[atomic_buffer->Uniforms[u]].opaque[j].index =
                      intra_stage_idx;
-                  prog->UniformStorage[atomic_buffer->Uniforms[u]].opaque[j].active =
+                  prog->data->UniformStorage[atomic_buffer->Uniforms[u]].opaque[j].active =
                      true;
                }
 
index 68ba167e4785cd91f0c6e672550d37590b0ff884..93340baf61f4f46091b7387c4f6acdbb5dd6c080 100644 (file)
@@ -38,7 +38,7 @@ get_storage(struct gl_shader_program *prog, const char *name)
 {
    unsigned id;
    if (prog->UniformHash->get(id, name))
-      return &prog->UniformStorage[id];
+      return &prog->data->UniformStorage[id];
 
    assert(!"No uniform storage found!");
    return NULL;
@@ -155,10 +155,11 @@ void
 set_block_binding(gl_shader_program *prog, const char *block_name,
                   unsigned mode, int binding)
 {
-   unsigned num_blocks = mode == ir_var_uniform ? prog->NumUniformBlocks :
-      prog->NumShaderStorageBlocks;
+   unsigned num_blocks = mode == ir_var_uniform ?
+      prog->data->NumUniformBlocks :
+      prog->data->NumShaderStorageBlocks;
    struct gl_uniform_block *blks = mode == ir_var_uniform ?
-      prog->UniformBlocks : prog->ShaderStorageBlocks;
+      prog->data->UniformBlocks : prog->data->ShaderStorageBlocks;
 
    for (unsigned i = 0; i < num_blocks; i++) {
       if (!strcmp(blks[i].Name, block_name)) {
index 8e411f7d58f30326ad1bc45f7fd21cacc715a4b6..f27109398ed1f85b46ed832ee0ad06f6076e7dbd 100644 (file)
@@ -454,9 +454,9 @@ public:
       buffer_block_index = -1;
       if (var->is_in_buffer_block()) {
          struct gl_uniform_block *blks = var->is_in_shader_storage_block() ?
-            prog->ShaderStorageBlocks : prog->UniformBlocks;
+            prog->data->ShaderStorageBlocks : prog->data->UniformBlocks;
          unsigned num_blks = var->is_in_shader_storage_block() ?
-            prog->NumShaderStorageBlocks : prog->NumUniformBlocks;
+            prog->data->NumShaderStorageBlocks : prog->data->NumUniformBlocks;
 
          if (var->is_interface_instance() && var->type->is_array()) {
             unsigned l = strlen(var->get_interface_type()->name);
@@ -1042,49 +1042,53 @@ link_setup_uniform_remap_tables(struct gl_context *ctx,
       prog->NumUniformRemapTable - num_explicit_uniform_locs;
 
    /* Reserve all the explicit locations of the active uniforms. */
-   for (unsigned i = 0; i < prog->NumUniformStorage; i++) {
-      if (prog->UniformStorage[i].type->is_subroutine() ||
-          prog->UniformStorage[i].is_shader_storage)
+   for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
+      if (prog->data->UniformStorage[i].type->is_subroutine() ||
+          prog->data->UniformStorage[i].is_shader_storage)
          continue;
 
-      if (prog->UniformStorage[i].remap_location != UNMAPPED_UNIFORM_LOC) {
+      if (prog->data->UniformStorage[i].remap_location !=
+          UNMAPPED_UNIFORM_LOC) {
          /* How many new entries for this uniform? */
          const unsigned entries =
-            MAX2(1, prog->UniformStorage[i].array_elements);
+            MAX2(1, prog->data->UniformStorage[i].array_elements);
 
          /* Set remap table entries point to correct gl_uniform_storage. */
          for (unsigned j = 0; j < entries; j++) {
-            unsigned element_loc = prog->UniformStorage[i].remap_location + j;
+            unsigned element_loc =
+               prog->data->UniformStorage[i].remap_location + j;
             assert(prog->UniformRemapTable[element_loc] ==
                    INACTIVE_UNIFORM_EXPLICIT_LOCATION);
-            prog->UniformRemapTable[element_loc] = &prog->UniformStorage[i];
+            prog->UniformRemapTable[element_loc] =
+               &prog->data->UniformStorage[i];
          }
       }
    }
 
    /* Reserve locations for rest of the uniforms. */
-   for (unsigned i = 0; i < prog->NumUniformStorage; i++) {
+   for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
 
-      if (prog->UniformStorage[i].type->is_subroutine() ||
-          prog->UniformStorage[i].is_shader_storage)
+      if (prog->data->UniformStorage[i].type->is_subroutine() ||
+          prog->data->UniformStorage[i].is_shader_storage)
          continue;
 
       /* Built-in uniforms should not get any location. */
-      if (prog->UniformStorage[i].builtin)
+      if (prog->data->UniformStorage[i].builtin)
          continue;
 
       /* Explicit ones have been set already. */
-      if (prog->UniformStorage[i].remap_location != UNMAPPED_UNIFORM_LOC)
+      if (prog->data->UniformStorage[i].remap_location != UNMAPPED_UNIFORM_LOC)
          continue;
 
       /* how many new entries for this uniform? */
-      const unsigned entries = MAX2(1, prog->UniformStorage[i].array_elements);
+      const unsigned entries =
+         MAX2(1, prog->data->UniformStorage[i].array_elements);
 
       /* Find UniformRemapTable for empty blocks where we can fit this uniform. */
       int chosen_location = -1;
 
       if (empty_locs)
-         chosen_location = find_empty_block(prog, &prog->UniformStorage[i]);
+         chosen_location = find_empty_block(prog, &prog->data->UniformStorage[i]);
 
       /* Add new entries to the total amount of entries. */
       total_entries += entries;
@@ -1106,10 +1110,10 @@ link_setup_uniform_remap_tables(struct gl_context *ctx,
       /* set pointers for this uniform */
       for (unsigned j = 0; j < entries; j++)
          prog->UniformRemapTable[chosen_location + j] =
-            &prog->UniformStorage[i];
+            &prog->data->UniformStorage[i];
 
       /* set the base location in remap table for the uniform */
-      prog->UniformStorage[i].remap_location = chosen_location;
+      prog->data->UniformStorage[i].remap_location = chosen_location;
    }
 
    /* Verify that total amount of entries for explicit and implicit locations
@@ -1123,53 +1127,55 @@ link_setup_uniform_remap_tables(struct gl_context *ctx,
    }
 
    /* Reserve all the explicit locations of the active subroutine uniforms. */
-   for (unsigned i = 0; i < prog->NumUniformStorage; i++) {
-      if (!prog->UniformStorage[i].type->is_subroutine())
+   for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
+      if (!prog->data->UniformStorage[i].type->is_subroutine())
          continue;
 
-      if (prog->UniformStorage[i].remap_location == UNMAPPED_UNIFORM_LOC)
+      if (prog->data->UniformStorage[i].remap_location == UNMAPPED_UNIFORM_LOC)
          continue;
 
       /* How many new entries for this uniform? */
       const unsigned entries =
-         MAX2(1, prog->UniformStorage[i].array_elements);
+         MAX2(1, prog->data->UniformStorage[i].array_elements);
 
       for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) {
          struct gl_linked_shader *sh = prog->_LinkedShaders[j];
          if (!sh)
             continue;
 
-         if (!prog->UniformStorage[i].opaque[j].active)
+         if (!prog->data->UniformStorage[i].opaque[j].active)
             continue;
 
          /* Set remap table entries point to correct gl_uniform_storage. */
          for (unsigned k = 0; k < entries; k++) {
-            unsigned element_loc = prog->UniformStorage[i].remap_location + k;
+            unsigned element_loc =
+               prog->data->UniformStorage[i].remap_location + k;
             assert(sh->SubroutineUniformRemapTable[element_loc] ==
                    INACTIVE_UNIFORM_EXPLICIT_LOCATION);
             sh->SubroutineUniformRemapTable[element_loc] =
-               &prog->UniformStorage[i];
+               &prog->data->UniformStorage[i];
          }
       }
    }
 
    /* reserve subroutine locations */
-   for (unsigned i = 0; i < prog->NumUniformStorage; i++) {
-      if (!prog->UniformStorage[i].type->is_subroutine())
+   for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
+      if (!prog->data->UniformStorage[i].type->is_subroutine())
          continue;
 
-      if (prog->UniformStorage[i].remap_location != UNMAPPED_UNIFORM_LOC)
+      if (prog->data->UniformStorage[i].remap_location !=
+          UNMAPPED_UNIFORM_LOC)
          continue;
 
       const unsigned entries =
-         MAX2(1, prog->UniformStorage[i].array_elements);
+         MAX2(1, prog->data->UniformStorage[i].array_elements);
 
       for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) {
          struct gl_linked_shader *sh = prog->_LinkedShaders[j];
          if (!sh)
             continue;
 
-         if (!prog->UniformStorage[i].opaque[j].active)
+         if (!prog->data->UniformStorage[i].opaque[j].active)
             continue;
 
          sh->SubroutineUniformRemapTable =
@@ -1180,9 +1186,9 @@ link_setup_uniform_remap_tables(struct gl_context *ctx,
 
          for (unsigned k = 0; k < entries; k++) {
             sh->SubroutineUniformRemapTable[sh->NumSubroutineUniformRemapTable + k] =
-               &prog->UniformStorage[i];
+               &prog->data->UniformStorage[i];
          }
-         prog->UniformStorage[i].remap_location =
+         prog->data->UniformStorage[i].remap_location =
             sh->NumSubroutineUniformRemapTable;
          sh->NumSubroutineUniformRemapTable += entries;
       }
@@ -1197,14 +1203,14 @@ link_assign_uniform_storage(struct gl_context *ctx,
 {
    /* On the outside chance that there were no uniforms, bail out.
     */
-   if (prog->NumUniformStorage == 0)
+   if (prog->data->NumUniformStorage == 0)
       return;
 
    unsigned int boolean_true = ctx->Const.UniformBooleanTrue;
 
-   prog->UniformStorage = rzalloc_array(prog, struct gl_uniform_storage,
-                                        prog->NumUniformStorage);
-   union gl_constant_value *data = rzalloc_array(prog->UniformStorage,
+   prog->data->UniformStorage = rzalloc_array(prog, struct gl_uniform_storage,
+                                              prog->data->NumUniformStorage);
+   union gl_constant_value *data = rzalloc_array(prog->data->UniformStorage,
                                                  union gl_constant_value,
                                                  num_data_slots);
 #ifndef NDEBUG
@@ -1212,7 +1218,7 @@ link_assign_uniform_storage(struct gl_context *ctx,
 #endif
 
    parcel_out_uniform_storage parcel(prog, prog->UniformHash,
-                                     prog->UniformStorage, data);
+                                     prog->data->UniformStorage, data);
 
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)
@@ -1240,11 +1246,11 @@ link_assign_uniform_storage(struct gl_context *ctx,
    }
 
 #ifndef NDEBUG
-   for (unsigned i = 0; i < prog->NumUniformStorage; i++) {
-      assert(prog->UniformStorage[i].storage != NULL ||
-             prog->UniformStorage[i].builtin ||
-             prog->UniformStorage[i].is_shader_storage ||
-             prog->UniformStorage[i].block_index != -1);
+   for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) {
+      assert(prog->data->UniformStorage[i].storage != NULL ||
+             prog->data->UniformStorage[i].builtin ||
+             prog->data->UniformStorage[i].is_shader_storage ||
+             prog->data->UniformStorage[i].block_index != -1);
    }
 
    assert(parcel.values == data_end);
@@ -1260,9 +1266,9 @@ link_assign_uniform_locations(struct gl_shader_program *prog,
                               struct gl_context *ctx,
                               unsigned int num_explicit_uniform_locs)
 {
-   ralloc_free(prog->UniformStorage);
-   prog->UniformStorage = NULL;
-   prog->NumUniformStorage = 0;
+   ralloc_free(prog->data->UniformStorage);
+   prog->data->UniformStorage = NULL;
+   prog->data->NumUniformStorage = 0;
 
    if (prog->UniformHash != NULL) {
       prog->UniformHash->clear();
@@ -1324,8 +1330,8 @@ link_assign_uniform_locations(struct gl_shader_program *prog,
       }
    }
 
-   prog->NumUniformStorage = uniform_size.num_active_uniforms;
-   prog->NumHiddenUniforms = uniform_size.num_hidden_uniforms;
+   prog->data->NumUniformStorage = uniform_size.num_active_uniforms;
+   prog->data->NumHiddenUniforms = uniform_size.num_hidden_uniforms;
 
    /* assign hidden uniforms a slot id */
    hiddenUniforms->iterate(assign_hidden_uniform_slot_id, &uniform_size);
index e34cf286b54ead594bc6d0b6b59cbf02b327dc12..61a029c6c56a8293522b594cdba89f7cb9f4a336 100644 (file)
@@ -415,12 +415,12 @@ linker_error(gl_shader_program *prog, const char *fmt, ...)
 {
    va_list ap;
 
-   ralloc_strcat(&prog->InfoLog, "error: ");
+   ralloc_strcat(&prog->data->InfoLog, "error: ");
    va_start(ap, fmt);
-   ralloc_vasprintf_append(&prog->InfoLog, fmt, ap);
+   ralloc_vasprintf_append(&prog->data->InfoLog, fmt, ap);
    va_end(ap);
 
-   prog->LinkStatus = false;
+   prog->data->LinkStatus = false;
 }
 
 
@@ -429,9 +429,9 @@ linker_warning(gl_shader_program *prog, const char *fmt, ...)
 {
    va_list ap;
 
-   ralloc_strcat(&prog->InfoLog, "warning: ");
+   ralloc_strcat(&prog->data->InfoLog, "warning: ");
    va_start(ap, fmt);
-   ralloc_vasprintf_append(&prog->InfoLog, fmt, ap);
+   ralloc_vasprintf_append(&prog->data->InfoLog, fmt, ap);
    va_end(ap);
 
 }
@@ -1128,8 +1128,8 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog,
 {
    int *InterfaceBlockStageIndex[MESA_SHADER_STAGES];
    struct gl_uniform_block *blks = NULL;
-   unsigned *num_blks = validate_ssbo ? &prog->NumShaderStorageBlocks :
-      &prog->NumUniformBlocks;
+   unsigned *num_blks = validate_ssbo ? &prog->data->NumShaderStorageBlocks :
+      &prog->data->NumUniformBlocks;
 
    unsigned max_num_buffer_blocks = 0;
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
@@ -1206,9 +1206,9 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog,
    }
 
    if (validate_ssbo)
-      prog->ShaderStorageBlocks = blks;
+      prog->data->ShaderStorageBlocks = blks;
    else
-      prog->UniformBlocks = blks;
+      prog->data->UniformBlocks = blks;
 
    return true;
 }
@@ -2116,14 +2116,14 @@ link_intrastage_shaders(void *mem_ctx,
       cross_validate_globals(prog, shader_list[i]->ir, &variables, false);
    }
 
-   if (!prog->LinkStatus)
+   if (!prog->data->LinkStatus)
       return NULL;
 
    /* Check that interface blocks defined in multiple shaders are consistent.
     */
    validate_intrastage_interface_blocks(prog, (const gl_shader **)shader_list,
                                         num_shaders);
-   if (!prog->LinkStatus)
+   if (!prog->data->LinkStatus)
       return NULL;
 
    /* Check that there is only a single definition of each function signature
@@ -2195,7 +2195,7 @@ link_intrastage_shaders(void *mem_ctx,
                              _mesa_shader_stage_to_program(shader_list[0]->Stage),
                              prog->Name);
    if (!prog) {
-      prog->LinkStatus = false;
+      prog->data->LinkStatus = false;
       _mesa_delete_linked_shader(ctx, linked);
       return NULL;
    }
@@ -2256,7 +2256,7 @@ link_intrastage_shaders(void *mem_ctx,
    link_uniform_blocks(mem_ctx, ctx, prog, linked, &ubo_blocks,
                        &num_ubo_blocks, &ssbo_blocks, &num_ssbo_blocks);
 
-   if (!prog->LinkStatus) {
+   if (!prog->data->LinkStatus) {
       _mesa_delete_linked_shader(ctx, linked);
       return NULL;
    }
@@ -3110,22 +3110,22 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
                    ctx->Const.MaxCombinedShaderStorageBlocks);
    }
 
-   for (unsigned i = 0; i < prog->NumUniformBlocks; i++) {
-      if (prog->UniformBlocks[i].UniformBufferSize >
+   for (unsigned i = 0; i < prog->data->NumUniformBlocks; i++) {
+      if (prog->data->UniformBlocks[i].UniformBufferSize >
           ctx->Const.MaxUniformBlockSize) {
          linker_error(prog, "Uniform block %s too big (%d/%d)\n",
-                      prog->UniformBlocks[i].Name,
-                      prog->UniformBlocks[i].UniformBufferSize,
+                      prog->data->UniformBlocks[i].Name,
+                      prog->data->UniformBlocks[i].UniformBufferSize,
                       ctx->Const.MaxUniformBlockSize);
       }
    }
 
-   for (unsigned i = 0; i < prog->NumShaderStorageBlocks; i++) {
-      if (prog->ShaderStorageBlocks[i].UniformBufferSize >
+   for (unsigned i = 0; i < prog->data->NumShaderStorageBlocks; i++) {
+      if (prog->data->ShaderStorageBlocks[i].UniformBufferSize >
           ctx->Const.MaxShaderStorageBlockSize) {
          linker_error(prog, "Shader storage block %s too big (%d/%d)\n",
-                      prog->ShaderStorageBlocks[i].Name,
-                      prog->ShaderStorageBlocks[i].UniformBufferSize,
+                      prog->data->ShaderStorageBlocks[i].Name,
+                      prog->data->ShaderStorageBlocks[i].UniformBufferSize,
                       ctx->Const.MaxShaderStorageBlockSize);
       }
    }
@@ -3441,8 +3441,8 @@ should_add_buffer_variable(struct gl_shader_program *shProg,
    if (type != GL_BUFFER_VARIABLE)
       return true;
 
-   for (unsigned i = 0; i < shProg->NumShaderStorageBlocks; i++) {
-      const char *block_name = shProg->ShaderStorageBlocks[i].Name;
+   for (unsigned i = 0; i < shProg->data->NumShaderStorageBlocks; i++) {
+      const char *block_name = shProg->data->ShaderStorageBlocks[i].Name;
       block_name_len = strlen(block_name);
 
       const char *block_square_bracket = strchr(block_name, '[');
@@ -4097,8 +4097,8 @@ calculate_array_size_and_stride(struct gl_shader_program *shProg,
    char *var_name = get_top_level_name(uni->name);
    char *interface_name =
       get_top_level_name(uni->is_shader_storage ?
-                         shProg->ShaderStorageBlocks[block_index].Name :
-                         shProg->UniformBlocks[block_index].Name);
+                         shProg->data->ShaderStorageBlocks[block_index].Name :
+                         shProg->data->UniformBlocks[block_index].Name);
 
    if (strcmp(var_name, interface_name) == 0) {
       /* Deal with instanced array of SSBOs */
@@ -4235,73 +4235,75 @@ build_program_resource_list(struct gl_context *ctx,
    }
 
    /* Add uniforms from uniform storage. */
-   for (unsigned i = 0; i < shProg->NumUniformStorage; i++) {
+   for (unsigned i = 0; i < shProg->data->NumUniformStorage; i++) {
       /* Do not add uniforms internally used by Mesa. */
-      if (shProg->UniformStorage[i].hidden)
+      if (shProg->data->UniformStorage[i].hidden)
          continue;
 
       uint8_t stageref =
-         build_stageref(shProg, shProg->UniformStorage[i].name,
+         build_stageref(shProg, shProg->data->UniformStorage[i].name,
                         ir_var_uniform);
 
       /* Add stagereferences for uniforms in a uniform block. */
-      bool is_shader_storage =  shProg->UniformStorage[i].is_shader_storage;
-      int block_index = shProg->UniformStorage[i].block_index;
+      bool is_shader_storage =
+        shProg->data->UniformStorage[i].is_shader_storage;
+      int block_index = shProg->data->UniformStorage[i].block_index;
       if (block_index != -1) {
          stageref |= is_shader_storage ?
-            shProg->ShaderStorageBlocks[block_index].stageref :
-            shProg->UniformBlocks[block_index].stageref;
+            shProg->data->ShaderStorageBlocks[block_index].stageref :
+            shProg->data->UniformBlocks[block_index].stageref;
       }
 
       GLenum type = is_shader_storage ? GL_BUFFER_VARIABLE : GL_UNIFORM;
       if (!should_add_buffer_variable(shProg, type,
-                                      shProg->UniformStorage[i].name))
+                                      shProg->data->UniformStorage[i].name))
          continue;
 
       if (is_shader_storage) {
-         calculate_array_size_and_stride(shProg, &shProg->UniformStorage[i]);
+         calculate_array_size_and_stride(shProg,
+                                         &shProg->data->UniformStorage[i]);
       }
 
       if (!add_program_resource(shProg, resource_set, type,
-                                &shProg->UniformStorage[i], stageref))
+                                &shProg->data->UniformStorage[i], stageref))
          return;
    }
 
    /* Add program uniform blocks. */
-   for (unsigned i = 0; i < shProg->NumUniformBlocks; i++) {
+   for (unsigned i = 0; i < shProg->data->NumUniformBlocks; i++) {
       if (!add_program_resource(shProg, resource_set, GL_UNIFORM_BLOCK,
-          &shProg->UniformBlocks[i], 0))
+          &shProg->data->UniformBlocks[i], 0))
          return;
    }
 
    /* Add program shader storage blocks. */
-   for (unsigned i = 0; i < shProg->NumShaderStorageBlocks; i++) {
+   for (unsigned i = 0; i < shProg->data->NumShaderStorageBlocks; i++) {
       if (!add_program_resource(shProg, resource_set, GL_SHADER_STORAGE_BLOCK,
-          &shProg->ShaderStorageBlocks[i], 0))
+          &shProg->data->ShaderStorageBlocks[i], 0))
          return;
    }
 
    /* Add atomic counter buffers. */
-   for (unsigned i = 0; i < shProg->NumAtomicBuffers; i++) {
+   for (unsigned i = 0; i < shProg->data->NumAtomicBuffers; i++) {
       if (!add_program_resource(shProg, resource_set, GL_ATOMIC_COUNTER_BUFFER,
-                                &shProg->AtomicBuffers[i], 0))
+                                &shProg->data->AtomicBuffers[i], 0))
          return;
    }
 
-   for (unsigned i = 0; i < shProg->NumUniformStorage; i++) {
+   for (unsigned i = 0; i < shProg->data->NumUniformStorage; i++) {
       GLenum type;
-      if (!shProg->UniformStorage[i].hidden)
+      if (!shProg->data->UniformStorage[i].hidden)
          continue;
 
       for (int j = MESA_SHADER_VERTEX; j < MESA_SHADER_STAGES; j++) {
-         if (!shProg->UniformStorage[i].opaque[j].active ||
-             !shProg->UniformStorage[i].type->is_subroutine())
+         if (!shProg->data->UniformStorage[i].opaque[j].active ||
+             !shProg->data->UniformStorage[i].type->is_subroutine())
             continue;
 
          type = _mesa_shader_stage_to_subroutine_uniform((gl_shader_stage)j);
          /* add shader subroutines */
          if (!add_program_resource(shProg, resource_set,
-                                   type, &shProg->UniformStorage[i], 0))
+                                   type, &shProg->data->UniformStorage[i], 0))
             return;
       }
    }
@@ -4686,7 +4688,7 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
    check_image_resources(ctx, prog);
    link_check_atomic_counter_resources(ctx, prog);
 
-   if (!prog->LinkStatus)
+   if (!prog->data->LinkStatus)
       return false;
 
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
@@ -4714,8 +4716,8 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
 void
 link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
 {
-   prog->LinkStatus = true; /* All error paths will set this to false */
-   prog->Validated = false;
+   prog->data->LinkStatus = true; /* All error paths will set this to false */
+   prog->data->Validated = false;
    prog->_Used = false;
 
    /* Section 7.3 (Program Objects) of the OpenGL 4.5 Core Profile spec says:
@@ -4848,7 +4850,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
             link_intrastage_shaders(mem_ctx, ctx, prog, shader_list[stage],
                                     num_shaders[stage], false);
 
-         if (!prog->LinkStatus) {
+         if (!prog->data->LinkStatus) {
             if (sh)
                _mesa_delete_linked_shader(ctx, sh);
             goto done;
@@ -4871,7 +4873,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
             validate_fragment_shader_executable(prog, sh);
             break;
          }
-         if (!prog->LinkStatus) {
+         if (!prog->data->LinkStatus) {
             if (sh)
                _mesa_delete_linked_shader(ctx, sh);
             goto done;
@@ -4900,7 +4902,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
     * varyings.
     */
    cross_validate_uniforms(prog);
-   if (!prog->LinkStatus)
+   if (!prog->data->LinkStatus)
       goto done;
 
    unsigned first, last, prev;
@@ -4920,7 +4922,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
    num_explicit_uniform_locs = check_explicit_uniform_locations(ctx, prog);
    link_assign_subroutine_types(prog);
 
-   if (!prog->LinkStatus)
+   if (!prog->data->LinkStatus)
       goto done;
 
    resize_tes_inputs(ctx, prog);
@@ -4935,13 +4937,13 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
 
       validate_interstage_inout_blocks(prog, prog->_LinkedShaders[prev],
                                        prog->_LinkedShaders[i]);
-      if (!prog->LinkStatus)
+      if (!prog->data->LinkStatus)
          goto done;
 
       cross_validate_outputs_to_inputs(prog,
                                        prog->_LinkedShaders[prev],
                                        prog->_LinkedShaders[i]);
-      if (!prog->LinkStatus)
+      if (!prog->data->LinkStatus)
          goto done;
 
       prev = i;
@@ -4949,7 +4951,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
 
    /* Cross-validate uniform blocks between shader stages */
    validate_interstage_uniform_blocks(prog, prog->_LinkedShaders);
-   if (!prog->LinkStatus)
+   if (!prog->data->LinkStatus)
       goto done;
 
    for (unsigned int i = 0; i < MESA_SHADER_STAGES; i++) {
@@ -4990,7 +4992,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
          continue;
 
       detect_recursion_linked(prog, prog->_LinkedShaders[i]->ir);
-      if (!prog->LinkStatus)
+      if (!prog->data->LinkStatus)
          goto done;
 
       if (ctx->Const.ShaderCompilerOptions[i].LowerCombinedClipCullDistance) {
index 41f122af566509ca7f5779273ec383a869b65d05..00c9500d871753e07d3256422404d4ecbc7eca86 100644 (file)
@@ -439,7 +439,9 @@ standalone_compile_shader(const struct standalone_options *_options,
 
    whole_program = rzalloc (NULL, struct gl_shader_program);
    assert(whole_program != NULL);
-   whole_program->InfoLog = ralloc_strdup(whole_program, "");
+   whole_program->data = rzalloc(whole_program, struct gl_shader_program_data);
+   assert(whole_program->data != NULL);
+   whole_program->data->InfoLog = ralloc_strdup(whole_program->data, "");
 
    /* Created just to avoid segmentation faults */
    whole_program->AttributeBindings = new string_to_uint_map;
@@ -510,7 +512,7 @@ standalone_compile_shader(const struct standalone_options *_options,
       } else {
          const gl_shader_stage stage = whole_program->Shaders[0]->Stage;
 
-         whole_program->LinkStatus = GL_TRUE;
+         whole_program->data->LinkStatus = GL_TRUE;
          whole_program->_LinkedShaders[stage] =
             link_intrastage_shaders(whole_program /* mem_ctx */,
                                     ctx,
@@ -523,7 +525,7 @@ standalone_compile_shader(const struct standalone_options *_options,
           * references.
           */
          if (whole_program->_LinkedShaders[stage] != NULL) {
-            assert(whole_program->LinkStatus);
+            assert(whole_program->data->LinkStatus);
 
             struct gl_shader_compiler_options *const compiler_options =
                &ctx->Const.ShaderCompilerOptions[stage];
@@ -545,13 +547,13 @@ standalone_compile_shader(const struct standalone_options *_options,
          }
       }
 
-      status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
+      status = (whole_program->data->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
 
-      if (strlen(whole_program->InfoLog) > 0) {
+      if (strlen(whole_program->data->InfoLog) > 0) {
          printf("\n");
          if (!options->just_log)
             printf("Info log for linking:\n");
-         printf("%s", whole_program->InfoLog);
+         printf("%s", whole_program->data->InfoLog);
          if (!options->just_log)
             printf("\n");
       }
index 6d17e387785c1ada53b500a86acfec050fafa351..11134269c901a16dc4aa6ef1eef6085214d3d646 100644 (file)
@@ -141,26 +141,26 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
       }
    }
 
-   shProg->NumUniformStorage = 0;
-   shProg->UniformStorage = NULL;
+   shProg->data->NumUniformStorage = 0;
+   shProg->data->UniformStorage = NULL;
    shProg->NumUniformRemapTable = 0;
    shProg->UniformRemapTable = NULL;
    shProg->UniformHash = NULL;
 
-   ralloc_free(shProg->InfoLog);
-   shProg->InfoLog = ralloc_strdup(shProg, "");
+   ralloc_free(shProg->data->InfoLog);
+   shProg->data->InfoLog = ralloc_strdup(shProg->data, "");
 
-   ralloc_free(shProg->UniformBlocks);
-   shProg->UniformBlocks = NULL;
-   shProg->NumUniformBlocks = 0;
+   ralloc_free(shProg->data->UniformBlocks);
+   shProg->data->UniformBlocks = NULL;
+   shProg->data->NumUniformBlocks = 0;
 
-   ralloc_free(shProg->ShaderStorageBlocks);
-   shProg->ShaderStorageBlocks = NULL;
-   shProg->NumShaderStorageBlocks = 0;
+   ralloc_free(shProg->data->ShaderStorageBlocks);
+   shProg->data->ShaderStorageBlocks = NULL;
+   shProg->data->NumShaderStorageBlocks = 0;
 
-   ralloc_free(shProg->AtomicBuffers);
-   shProg->AtomicBuffers = NULL;
-   shProg->NumAtomicBuffers = 0;
+   ralloc_free(shProg->data->AtomicBuffers);
+   shProg->data->AtomicBuffers = NULL;
+   shProg->data->NumAtomicBuffers = 0;
 }
 
 void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
index 245494c739b8affa5cfd7da2c2f2650426e22de5..d30abc320b361b440337b068b00e4970e122169f 100644 (file)
@@ -70,6 +70,7 @@ set_uniform_initializer::SetUp()
 {
    this->mem_ctx = ralloc_context(NULL);
    this->prog = rzalloc(NULL, struct gl_shader_program);
+   this->prog->data = rzalloc(this->prog, struct gl_shader_program_data);
 
    /* Set default values used by the test cases.
     */
@@ -110,43 +111,43 @@ establish_uniform_storage(struct gl_shader_program *prog, unsigned num_storage,
    const unsigned red_zone_components = total_components - data_components;
 
    prog->UniformHash = new string_to_uint_map;
-   prog->UniformStorage = rzalloc_array(prog, struct gl_uniform_storage,
-                                       num_storage);
-   prog->NumUniformStorage = num_storage;
+   prog->data->UniformStorage = rzalloc_array(prog, struct gl_uniform_storage,
+                                              num_storage);
+   prog->data->NumUniformStorage = num_storage;
 
-   prog->UniformStorage[index_to_set].name = (char *) name;
-   prog->UniformStorage[index_to_set].type = type;
-   prog->UniformStorage[index_to_set].array_elements = array_size;
+   prog->data->UniformStorage[index_to_set].name = (char *) name;
+   prog->data->UniformStorage[index_to_set].type = type;
+   prog->data->UniformStorage[index_to_set].array_elements = array_size;
    for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
-      prog->UniformStorage[index_to_set].opaque[sh].index = ~0;
-      prog->UniformStorage[index_to_set].opaque[sh].active = false;
+      prog->data->UniformStorage[index_to_set].opaque[sh].index = ~0;
+      prog->data->UniformStorage[index_to_set].opaque[sh].active = false;
    }
-   prog->UniformStorage[index_to_set].num_driver_storage = 0;
-   prog->UniformStorage[index_to_set].driver_storage = NULL;
-   prog->UniformStorage[index_to_set].storage =
+   prog->data->UniformStorage[index_to_set].num_driver_storage = 0;
+   prog->data->UniformStorage[index_to_set].driver_storage = NULL;
+   prog->data->UniformStorage[index_to_set].storage =
       rzalloc_array(prog, union gl_constant_value, total_components);
 
-   fill_storage_array_with_sentinels(prog->UniformStorage[index_to_set].storage,
+   fill_storage_array_with_sentinels(prog->data->UniformStorage[index_to_set].storage,
                                     data_components,
                                     red_zone_components);
 
    prog->UniformHash->put(index_to_set,
-                          prog->UniformStorage[index_to_set].name);
+                          prog->data->UniformStorage[index_to_set].name);
 
    for (unsigned i = 0; i < num_storage; i++) {
       if (i == index_to_set)
         continue;
 
-      prog->UniformStorage[i].name = (char *) "invalid slot";
-      prog->UniformStorage[i].type = glsl_type::void_type;
-      prog->UniformStorage[i].array_elements = 0;
+      prog->data->UniformStorage[i].name = (char *) "invalid slot";
+      prog->data->UniformStorage[i].type = glsl_type::void_type;
+      prog->data->UniformStorage[i].array_elements = 0;
       for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
-         prog->UniformStorage[i].opaque[sh].index = ~0;
-         prog->UniformStorage[i].opaque[sh].active = false;
+         prog->data->UniformStorage[i].opaque[sh].index = ~0;
+         prog->data->UniformStorage[i].opaque[sh].active = false;
       }
-      prog->UniformStorage[i].num_driver_storage = 0;
-      prog->UniformStorage[i].driver_storage = NULL;
-      prog->UniformStorage[i].storage = NULL;
+      prog->data->UniformStorage[i].num_driver_storage = 0;
+      prog->data->UniformStorage[i].driver_storage = NULL;
+      prog->data->UniformStorage[i].storage = NULL;
    }
 
    return red_zone_components;
@@ -169,7 +170,7 @@ non_array_test(void *mem_ctx, struct gl_shader_program *prog,
 
    linker::set_uniform_initializer(mem_ctx, prog, name, type, val, 0xF00F);
 
-   verify_data(prog->UniformStorage[actual_index].storage, 0, val,
+   verify_data(prog->data->UniformStorage[actual_index].storage, 0, val,
               red_zone_components, 0xF00F);
 }
 
@@ -325,7 +326,7 @@ array_test(void *mem_ctx, struct gl_shader_program *prog,
    linker::set_uniform_initializer(mem_ctx, prog, name, element_type, val,
                                    0xF00F);
 
-   verify_data(prog->UniformStorage[actual_index].storage, array_size,
+   verify_data(prog->data->UniformStorage[actual_index].storage, array_size,
               val, red_zone_components, 0xF00F);
 }
 
index 6fea8f468f2c99b0663ed2f7badd3fb1cd3a351c..7a213fcb46e5af367d7e553d28d831f5cc6caff8 100644 (file)
@@ -100,7 +100,7 @@ lower_instr(nir_intrinsic_instr *instr,
 
    nir_intrinsic_instr *new_instr = nir_intrinsic_instr_create(mem_ctx, op);
    nir_intrinsic_set_base(new_instr,
-      shader_program->UniformStorage[uniform_loc].opaque[shader->stage].index);
+      shader_program->data->UniformStorage[uniform_loc].opaque[shader->stage].index);
 
    nir_load_const_instr *offset_const =
       nir_load_const_instr_create(mem_ctx, 1, 32);
index e878edd9b54b6ba4dd8fb17744cd524c63a6f1a9..9debfb2eaf96d5ac6b2b13ac9c42bf6f1e430d6c 100644 (file)
@@ -140,14 +140,14 @@ lower_sampler(nir_tex_instr *instr, const struct gl_shader_program *shader_progr
       instr->texture_array_size = array_elements;
    }
 
-   if (location > shader_program->NumUniformStorage - 1 ||
-       !shader_program->UniformStorage[location].opaque[stage].active) {
+   if (location > shader_program->data->NumUniformStorage - 1 ||
+       !shader_program->data->UniformStorage[location].opaque[stage].active) {
       assert(!"cannot return a sampler");
       return;
    }
 
    instr->texture_index +=
-      shader_program->UniformStorage[location].opaque[stage].index;
+      shader_program->data->UniformStorage[location].opaque[stage].index;
 
    instr->sampler_index = instr->texture_index;
 
index 99c85cff17b314d1ac0ae65dcce001600cd45578..0d5661ba06284a87c4ffe25a7024d6b08ec3690b 100644 (file)
@@ -153,8 +153,9 @@ _mesa_meta_link_program_with_debug(struct gl_context *ctx,
 {
    _mesa_link_program(ctx, sh_prog);
 
-   if (!sh_prog->LinkStatus) {
-      _mesa_problem(ctx, "meta program link failed:\n%s", sh_prog->InfoLog);
+   if (!sh_prog->data->LinkStatus) {
+      _mesa_problem(ctx, "meta program link failed:\n%s",
+                    sh_prog->data->InfoLog);
    }
 }
 
index 72b2dbee51c4815825438111a8a1f04c25b25b59..4516f1f33a2471757887b87c9d37baa53cc93775 100644 (file)
@@ -73,10 +73,10 @@ brw_codegen_cs_prog(struct brw_context *brw,
    memset(&prog_data, 0, sizeof(prog_data));
 
    if (prog->Comp.SharedSize > 64 * 1024) {
-      prog->LinkStatus = false;
+      prog->data->LinkStatus = false;
       const char *error_str =
          "Compute shader used more than 64KB of shared variables";
-      ralloc_strcat(&prog->InfoLog, error_str);
+      ralloc_strcat(&prog->data->InfoLog, error_str);
       _mesa_problem(NULL, "Failed to link compute shader: %s\n", error_str);
 
       ralloc_free(mem_ctx);
@@ -126,8 +126,8 @@ brw_codegen_cs_prog(struct brw_context *brw,
                             &prog_data, cp->program.nir, st_index,
                             &program_size, &error_str);
    if (program == NULL) {
-      prog->LinkStatus = false;
-      ralloc_strcat(&prog->InfoLog, error_str);
+      prog->data->LinkStatus = false;
+      ralloc_strcat(&prog->data->InfoLog, error_str);
       _mesa_problem(NULL, "Failed to compile compute shader: %s\n", error_str);
 
       ralloc_free(mem_ctx);
index 6bdedb96574007b9120bc3e4ec3bb1a3683631d4..b83fdb4bae82e2535d234547bdda2aa0a2305e30 100644 (file)
@@ -161,7 +161,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
                      &prog_data, gs->Program->nir, prog,
                      st_index, &program_size, &error_str);
    if (program == NULL) {
-      ralloc_strcat(&prog->InfoLog, error_str);
+      ralloc_strcat(&prog->data->InfoLog, error_str);
       _mesa_problem(NULL, "Failed to compile geometry shader: %s\n", error_str);
 
       ralloc_free(mem_ctx);
index b752ad5610b78a362e33c89f48de0eace3b54184..15a608c857a022e94acdeaecef22852330730af9 100644 (file)
@@ -81,8 +81,9 @@ brw_nir_setup_glsl_uniform(gl_shader_stage stage, nir_variable *var,
     * with our name, or the prefix of a component that starts with our name.
     */
    unsigned uniform_index = var->data.driver_location / 4;
-   for (unsigned u = 0; u < shader_prog->NumUniformStorage; u++) {
-      struct gl_uniform_storage *storage = &shader_prog->UniformStorage[u];
+   for (unsigned u = 0; u < shader_prog->data->NumUniformStorage; u++) {
+      struct gl_uniform_storage *storage =
+         &shader_prog->data->UniformStorage[u];
 
       if (storage->builtin)
          continue;
index 87a956faf5093ec3bd78dbfc8c0961bb05f8f898..95926dbe1a6b1184d945e387b0207ab706553880 100644 (file)
@@ -265,8 +265,8 @@ brw_codegen_tcs_prog(struct brw_context *brw,
                       &program_size, &error_str);
    if (program == NULL) {
       if (shader_prog) {
-         shader_prog->LinkStatus = false;
-         ralloc_strcat(&shader_prog->InfoLog, error_str);
+         shader_prog->data->LinkStatus = false;
+         ralloc_strcat(&shader_prog->data->InfoLog, error_str);
       }
 
       _mesa_problem(NULL, "Failed to compile tessellation control shader: "
index b2d41c15557ba128b754efd08f09426426f61c98..414e90f09d26c0556ea2c13f731e635a86b2f963 100644 (file)
@@ -187,8 +187,8 @@ brw_codegen_tes_prog(struct brw_context *brw,
                       shader_prog, st_index, &program_size, &error_str);
    if (program == NULL) {
       if (shader_prog) {
-         shader_prog->LinkStatus = false;
-         ralloc_strcat(&shader_prog->InfoLog, error_str);
+         shader_prog->data->LinkStatus = false;
+         ralloc_strcat(&shader_prog->data->InfoLog, error_str);
       }
 
       _mesa_problem(NULL, "Failed to compile tessellation evaluation shader: "
index 86cd1bf8bcae8ac5cd5aedecedf22b29ae96dce9..a6ffa835066ecf3ca223977f076f1b0ca32bf828 100644 (file)
@@ -198,8 +198,8 @@ brw_codegen_vs_prog(struct brw_context *brw,
                             st_index, &program_size, &error_str);
    if (program == NULL) {
       if (prog) {
-         prog->LinkStatus = false;
-         ralloc_strcat(&prog->InfoLog, error_str);
+         prog->data->LinkStatus = false;
+         ralloc_strcat(&prog->data->InfoLog, error_str);
       }
 
       _mesa_problem(NULL, "Failed to compile vertex shader: %s\n", error_str);
index dab2e3305836b31d0dc86a3de34c5c14da8a9a0b..a3a0fd24788b9525baa84a316af086eeddf52339 100644 (file)
@@ -151,8 +151,8 @@ brw_codegen_wm_prog(struct brw_context *brw,
 
    if (program == NULL) {
       if (prog) {
-         prog->LinkStatus = false;
-         ralloc_strcat(&prog->InfoLog, error_str);
+         prog->data->LinkStatus = false;
+         ralloc_strcat(&prog->data->InfoLog, error_str);
       }
 
       _mesa_problem(NULL, "Failed to compile fragment shader: %s\n", error_str);
index 0692b081b834a6036120fedb386f8c99ac2a216b..e746b995c1e66ccb3c6bb06da04a6ee2e0fb9930 100644 (file)
@@ -53,8 +53,8 @@ get_pipeline_state_l3_weights(const struct brw_context *brw)
          brw->ctx._Shader->CurrentProgram[stage_states[i]->stage];
       const struct brw_stage_prog_data *prog_data = stage_states[i]->prog_data;
 
-      needs_dc |= (prog && (prog->NumAtomicBuffers ||
-                            prog->NumShaderStorageBlocks)) ||
+      needs_dc |= (prog && (prog->data->NumAtomicBuffers ||
+                            prog->data->NumShaderStorageBlocks)) ||
          (prog_data && (prog_data->total_scratch || prog_data->nr_image_params));
       needs_slm |= prog_data && prog_data->total_shared;
    }
index 9aa1dc15cdc46003a413e894a61d5e458b0ec38c..e00eac55bebd55deb627e89fa43f88a566923719 100644 (file)
@@ -301,7 +301,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
    /* _NEW_PROGRAM */
    const GLboolean vertexShader =
       (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] &&
-       ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->LinkStatus &&
+       ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->data->LinkStatus &&
        ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]);
    const GLboolean vertexProgram = ctx->VertexProgram._Enabled;
    GLbitfield fp_inputs = 0x0;
@@ -1266,9 +1266,9 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
 
    _mesa_glsl_link_shader(ctx, p.shader_program);
 
-   if (!p.shader_program->LinkStatus)
+   if (!p.shader_program->data->LinkStatus)
       _mesa_problem(ctx, "Failed to link fixed function fragment shader: %s\n",
-                   p.shader_program->InfoLog);
+                    p.shader_program->data->InfoLog);
 
    ralloc_free(p.mem_ctx);
    return p.shader_program;
index aa4d1d5e8f02d2663a4393f9e908b97cc3fb0d66..e87005326b636e92d430d7d63927de5348a9a8c5 100644 (file)
@@ -2781,10 +2781,8 @@ struct gl_shader_program
       bool LocalSizeVariable;
    } Comp;
 
-   /* post-link info: */
-   unsigned NumUniformStorage;
-   unsigned NumHiddenUniforms;
-   struct gl_uniform_storage *UniformStorage;
+   /** Data shared by gl_program and gl_shader_program */
+   struct gl_shader_program_data *data;
 
    /**
     * Mapping from GL uniform locations returned by \c glUniformLocation to
@@ -2808,12 +2806,6 @@ struct gl_shader_program
    unsigned LastClipDistanceArraySize;
    unsigned LastCullDistanceArraySize;
 
-   unsigned NumUniformBlocks;
-   struct gl_uniform_block *UniformBlocks;
-
-   unsigned NumShaderStorageBlocks;
-   struct gl_uniform_block *ShaderStorageBlocks;
-
    /**
     * Map of active uniform names to locations
     *
@@ -2824,14 +2816,8 @@ struct gl_shader_program
     */
    struct string_to_uint_map *UniformHash;
 
-   struct gl_active_atomic_buffer *AtomicBuffers;
-   unsigned NumAtomicBuffers;
-
-   GLboolean LinkStatus;   /**< GL_LINK_STATUS */
-   GLboolean Validated;
    GLboolean _Used;        /**< Ever used for drawing? */
    GLboolean SamplersValidated; /**< Samplers validated against texture units? */
-   GLchar *InfoLog;
 
    unsigned Version;       /**< GLSL version used for linking */
    bool IsES;              /**< True if this program uses GLSL ES */
index 310b745ebc8f0d9e9613c18031f707e391f72088..35d416dc9dfdf21b4ec1811964f90627c507b1fc 100644 (file)
@@ -297,7 +297,7 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
        *     shader stages in the pipeline program pipeline object are not
        *     modified."
        */
-      if (!shProg->LinkStatus) {
+      if (!shProg->data->LinkStatus) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glUseProgramStages(program not linked)");
          return;
@@ -376,7 +376,7 @@ _mesa_ActiveShaderProgram(GLuint pipeline, GLuint program)
     */
    pipe->EverBound = GL_TRUE;
 
-   if ((shProg != NULL) && !shProg->LinkStatus) {
+   if ((shProg != NULL) && !shProg->data->LinkStatus) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
             "glActiveShaderProgram(program %u not linked)", shProg->Name);
       return;
index 19aaf48f984cd233fc8944e691c5c829931bdd71..859bda2c4dd115d05b17b8b81a44c4003a0746a7 100644 (file)
@@ -78,7 +78,7 @@ lookup_linked_program(GLuint program,
    if (!prog)
       return NULL;
 
-   if (prog->LinkStatus == GL_FALSE) {
+   if (prog->data->LinkStatus == GL_FALSE) {
       if (raise_link_error)
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)",
                      caller);
index 5c42006b5dc69a04cc95606e3f09fb17374b102f..e4a8773e09ce56e87f97f5783017fb655f5919fd 100644 (file)
@@ -118,7 +118,7 @@ _mesa_GetActiveAttrib(GLuint program, GLuint desired_index,
    if (!shProg)
       return;
 
-   if (!shProg->LinkStatus) {
+   if (!shProg->data->LinkStatus) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                   "glGetActiveAttrib(program not linked)");
       return;
@@ -165,7 +165,7 @@ _mesa_GetAttribLocation(GLuint program, const GLchar * name)
       return -1;
    }
 
-   if (!shProg->LinkStatus) {
+   if (!shProg->data->LinkStatus) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "glGetAttribLocation(program not linked)");
       return -1;
@@ -193,7 +193,7 @@ _mesa_GetAttribLocation(GLuint program, const GLchar * name)
 unsigned
 _mesa_count_active_attribs(struct gl_shader_program *shProg)
 {
-   if (!shProg->LinkStatus
+   if (!shProg->data->LinkStatus
        || shProg->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) {
       return 0;
    }
@@ -212,7 +212,7 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
 size_t
 _mesa_longest_attribute_name_length(struct gl_shader_program *shProg)
 {
-   if (!shProg->LinkStatus
+   if (!shProg->data->LinkStatus
        || shProg->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) {
       return 0;
    }
@@ -297,7 +297,7 @@ _mesa_GetFragDataIndex(GLuint program, const GLchar *name)
       return -1;
    }
 
-   if (!shProg->LinkStatus) {
+   if (!shProg->data->LinkStatus) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "glGetFragDataIndex(program not linked)");
       return -1;
@@ -332,7 +332,7 @@ _mesa_GetFragDataLocation(GLuint program, const GLchar *name)
       return -1;
    }
 
-   if (!shProg->LinkStatus) {
+   if (!shProg->data->LinkStatus) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "glGetFragDataLocation(program not linked)");
       return -1;
@@ -591,7 +591,7 @@ _mesa_program_resource_index(struct gl_shader_program *shProg,
 
    switch (res->Type) {
    case GL_ATOMIC_COUNTER_BUFFER:
-      return RESOURCE_ATC(res) - shProg->AtomicBuffers;
+      return RESOURCE_ATC(res) - shProg->data->AtomicBuffers;
    case GL_VERTEX_SUBROUTINE:
    case GL_GEOMETRY_SUBROUTINE:
    case GL_FRAGMENT_SUBROUTINE:
@@ -931,10 +931,10 @@ is_resource_referenced(struct gl_shader_program *shProg,
       return RESOURCE_ATC(res)->StageReferences[stage];
 
    if (res->Type == GL_UNIFORM_BLOCK)
-      return shProg->UniformBlocks[index].stageref & (1 << stage);
+      return shProg->data->UniformBlocks[index].stageref & (1 << stage);
 
    if (res->Type == GL_SHADER_STORAGE_BLOCK)
-      return shProg->ShaderStorageBlocks[index].stageref & (1 << stage);
+      return shProg->data->ShaderStorageBlocks[index].stageref & (1 << stage);
 
    return res->StageReferences & (1 << stage);
 }
@@ -1043,7 +1043,7 @@ get_buffer_property(struct gl_shader_program *shProg,
             unsigned idx = RESOURCE_ATC(res)->Uniforms[i];
             struct gl_program_resource *uni =
                program_resource_find_data(shProg,
-                                          &shProg->UniformStorage[idx]);
+                                          &shProg->data->UniformStorage[idx]);
             assert(uni);
             *val++ = _mesa_program_resource_index(shProg, uni);
          }
index aebd81214e7cd2a3ae2c7b7689d03002a03dac74..ab153009e27f7e731b22d4144b8897d9b260c602 100644 (file)
@@ -532,7 +532,7 @@ get_handle(struct gl_context *ctx, GLenum pname)
 static bool
 check_gs_query(struct gl_context *ctx, const struct gl_shader_program *shProg)
 {
-   if (shProg->LinkStatus &&
+   if (shProg->data->LinkStatus &&
        shProg->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) {
       return true;
    }
@@ -557,7 +557,7 @@ check_gs_query(struct gl_context *ctx, const struct gl_shader_program *shProg)
 static bool
 check_tcs_query(struct gl_context *ctx, const struct gl_shader_program *shProg)
 {
-   if (shProg->LinkStatus &&
+   if (shProg->data->LinkStatus &&
        shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL] != NULL) {
       return true;
    }
@@ -583,7 +583,7 @@ check_tcs_query(struct gl_context *ctx, const struct gl_shader_program *shProg)
 static bool
 check_tes_query(struct gl_context *ctx, const struct gl_shader_program *shProg)
 {
-   if (shProg->LinkStatus &&
+   if (shProg->data->LinkStatus &&
        shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL] != NULL) {
       return true;
    }
@@ -636,14 +636,14 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
       *params = shProg->DeletePending;
       return;
    case GL_LINK_STATUS:
-      *params = shProg->LinkStatus;
+      *params = shProg->data->LinkStatus;
       return;
    case GL_VALIDATE_STATUS:
-      *params = shProg->Validated;
+      *params = shProg->data->Validated;
       return;
    case GL_INFO_LOG_LENGTH:
-      *params = (shProg->InfoLog && shProg->InfoLog[0] != '\0') ?
-         strlen(shProg->InfoLog) + 1 : 0;
+      *params = (shProg->data->InfoLog && shProg->data->InfoLog[0] != '\0') ?
+         strlen(shProg->data->InfoLog) + 1 : 0;
       return;
    case GL_ATTACHED_SHADERS:
       *params = shProg->NumShaders;
@@ -657,9 +657,9 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
    case GL_ACTIVE_UNIFORMS: {
       unsigned i;
       const unsigned num_uniforms =
-         shProg->NumUniformStorage - shProg->NumHiddenUniforms;
+         shProg->data->NumUniformStorage - shProg->data->NumHiddenUniforms;
       for (*params = 0, i = 0; i < num_uniforms; i++) {
-         if (!shProg->UniformStorage[i].is_shader_storage)
+         if (!shProg->data->UniformStorage[i].is_shader_storage)
             (*params)++;
       }
       return;
@@ -668,17 +668,17 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
       unsigned i;
       GLint max_len = 0;
       const unsigned num_uniforms =
-         shProg->NumUniformStorage - shProg->NumHiddenUniforms;
+         shProg->data->NumUniformStorage - shProg->data->NumHiddenUniforms;
 
       for (i = 0; i < num_uniforms; i++) {
-         if (shProg->UniformStorage[i].is_shader_storage)
+         if (shProg->data->UniformStorage[i].is_shader_storage)
             continue;
 
         /* Add one for the terminating NUL character for a non-array, and
          * 4 for the "[0]" and the NUL for an array.
          */
-        const GLint len = strlen(shProg->UniformStorage[i].name) + 1 +
-            ((shProg->UniformStorage[i].array_elements != 0) ? 3 : 0);
+         const GLint len = strlen(shProg->data->UniformStorage[i].name) + 1 +
+             ((shProg->data->UniformStorage[i].array_elements != 0) ? 3 : 0);
 
         if (len > max_len)
            max_len = len;
@@ -755,10 +755,10 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
       if (!has_ubo)
          break;
 
-      for (i = 0; i < shProg->NumUniformBlocks; i++) {
+      for (i = 0; i < shProg->data->NumUniformBlocks; i++) {
         /* Add one for the terminating NUL character.
          */
-        const GLint len = strlen(shProg->UniformBlocks[i].Name) + 1;
+         const GLint len = strlen(shProg->data->UniformBlocks[i].Name) + 1;
 
         if (len > max_len)
            max_len = len;
@@ -771,7 +771,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
       if (!has_ubo)
          break;
 
-      *params = shProg->NumUniformBlocks;
+      *params = shProg->data->NumUniformBlocks;
       return;
    case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
       /* This enum isn't part of the OES extension for OpenGL ES 2.0.  It is
@@ -792,13 +792,13 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
       if (!ctx->Extensions.ARB_shader_atomic_counters)
          break;
 
-      *params = shProg->NumAtomicBuffers;
+      *params = shProg->data->NumAtomicBuffers;
       return;
    case GL_COMPUTE_WORK_GROUP_SIZE: {
       int i;
       if (!_mesa_has_compute_shaders(ctx))
          break;
-      if (!shProg->LinkStatus) {
+      if (!shProg->data->LinkStatus) {
          _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramiv(program not "
                      "linked)");
          return;
@@ -814,7 +814,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
    }
    case GL_PROGRAM_SEPARABLE:
       /* If the program has not been linked, return initial value 0. */
-      *params = (shProg->LinkStatus == GL_FALSE) ? 0 : shProg->SeparateShader;
+      *params = (shProg->data->LinkStatus == GL_FALSE) ? 0 : shProg->SeparateShader;
       return;
 
    /* ARB_tessellation_shader */
@@ -927,7 +927,7 @@ get_program_info_log(struct gl_context *ctx, GLuint program, GLsizei bufSize,
       return;
    }
 
-   _mesa_copy_string(infoLog, bufSize, length, shProg->InfoLog);
+   _mesa_copy_string(infoLog, bufSize, length, shProg->data->InfoLog);
 }
 
 
@@ -1115,10 +1115,10 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
       ralloc_free(filename);
    }
 
-   if (shProg->LinkStatus == GL_FALSE &&
+   if (shProg->data->LinkStatus == GL_FALSE &&
        (ctx->_Shader->Flags & GLSL_REPORT_ERRORS)) {
       _mesa_debug(ctx, "Error linking program %u:\n%s\n",
-                  shProg->Name, shProg->InfoLog);
+                  shProg->Name, shProg->data->InfoLog);
    }
 
    /* debug code */
@@ -1127,7 +1127,7 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
 
       printf("Link %u shaders in program %u: %s\n",
                    shProg->NumShaders, shProg->Name,
-                   shProg->LinkStatus ? "Success" : "Failed");
+                   shProg->data->LinkStatus ? "Success" : "Failed");
 
       for (i = 0; i < shProg->NumShaders; i++) {
          printf(" shader %u, stage %u\n",
@@ -1178,7 +1178,7 @@ void
 _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
                     const char *caller)
 {
-   if ((shProg != NULL) && !shProg->LinkStatus) {
+   if ((shProg != NULL) && !shProg->data->LinkStatus) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                  "%s(program %u not linked)", caller, shProg->Name);
       return;
@@ -1259,7 +1259,7 @@ static GLboolean
 validate_shader_program(const struct gl_shader_program *shProg,
                         char *errMsg)
 {
-   if (!shProg->LinkStatus) {
+   if (!shProg->data->LinkStatus) {
       return GL_FALSE;
    }
 
@@ -1303,13 +1303,13 @@ validate_program(struct gl_context *ctx, GLuint program)
       return;
    }
 
-   shProg->Validated = validate_shader_program(shProg, errMsg);
-   if (!shProg->Validated) {
+   shProg->data->Validated = validate_shader_program(shProg, errMsg);
+   if (!shProg->data->Validated) {
       /* update info log */
-      if (shProg->InfoLog) {
-         ralloc_free(shProg->InfoLog);
+      if (shProg->data->InfoLog) {
+         ralloc_free(shProg->data->InfoLog);
       }
-      shProg->InfoLog = ralloc_strdup(shProg, errMsg);
+      shProg->data->InfoLog = ralloc_strdup(shProg->data, errMsg);
    }
 }
 
@@ -1815,7 +1815,7 @@ _mesa_UseProgram(GLuint program)
       if (!shProg) {
          return;
       }
-      if (!shProg->LinkStatus) {
+      if (!shProg->data->LinkStatus) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "glUseProgram(program %u not linked)", program);
          return;
@@ -1992,7 +1992,7 @@ _mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length,
     *     length is zero, and a call to GetProgramBinary will generate an
     *     INVALID_OPERATION error.
     */
-   if (!shProg->LinkStatus) {
+   if (!shProg->data->LinkStatus) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "glGetProgramBinary(program %u not linked)",
                   shProg->Name);
@@ -2044,7 +2044,7 @@ _mesa_ProgramBinary(GLuint program, GLenum binaryFormat,
     * Since any value of binaryFormat passed "is not one of those specified as
     * allowable for [this] command, an INVALID_ENUM error is generated."
     */
-   shProg->LinkStatus = GL_FALSE;
+   shProg->data->LinkStatus = GL_FALSE;
    _mesa_error(ctx, GL_INVALID_ENUM, "glProgramBinary");
 }
 
@@ -2246,12 +2246,12 @@ _mesa_CreateShaderProgramv(GLenum type, GLsizei count,
            /* Possibly... */
            if (active-user-defined-varyings-in-linked-program) {
               append-error-to-info-log;
-              shProg->LinkStatus = GL_FALSE;
+               shProg->data->LinkStatus = GL_FALSE;
            }
 #endif
         }
          if (sh->InfoLog)
-            ralloc_strcat(&shProg->InfoLog, sh->InfoLog);
+            ralloc_strcat(&shProg->data->InfoLog, sh->InfoLog);
       }
 
       delete_shader(ctx, shader);
index fe0b45f57e8d5e35ef34e510e177e7343664b68a..167431dfe67c6b3df50799a87f0c7e8bb6522af6 100644 (file)
@@ -307,7 +307,7 @@ init_shader_program(struct gl_shader_program *prog)
 
    exec_list_make_empty(&prog->EmptyUniformLocations);
 
-   prog->InfoLog = ralloc_strdup(prog, "");
+   prog->data->InfoLog = ralloc_strdup(prog->data, "");
 }
 
 /**
@@ -320,6 +320,11 @@ _mesa_new_shader_program(GLuint name)
    shProg = rzalloc(NULL, struct gl_shader_program);
    if (shProg) {
       shProg->Name = name;
+      shProg->data = create_shader_program_data();
+      if (!shProg->data) {
+         ralloc_free(shProg);
+         return NULL;
+      }
       init_shader_program(shProg);
    }
    return shProg;
@@ -340,12 +345,13 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
       }
    }
 
-   if (shProg->UniformStorage) {
-      for (unsigned i = 0; i < shProg->NumUniformStorage; ++i)
-         _mesa_uniform_detach_all_driver_storage(&shProg->UniformStorage[i]);
-      ralloc_free(shProg->UniformStorage);
-      shProg->NumUniformStorage = 0;
-      shProg->UniformStorage = NULL;
+   if (shProg->data->UniformStorage) {
+      for (unsigned i = 0; i < shProg->data->NumUniformStorage; ++i)
+         _mesa_uniform_detach_all_driver_storage(&shProg->data->
+                                                    UniformStorage[i]);
+      ralloc_free(shProg->data->UniformStorage);
+      shProg->data->NumUniformStorage = 0;
+      shProg->data->UniformStorage = NULL;
    }
 
    if (shProg->UniformRemapTable) {
@@ -359,21 +365,21 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
       shProg->UniformHash = NULL;
    }
 
-   assert(shProg->InfoLog != NULL);
-   ralloc_free(shProg->InfoLog);
-   shProg->InfoLog = ralloc_strdup(shProg, "");
+   assert(shProg->data->InfoLog != NULL);
+   ralloc_free(shProg->data->InfoLog);
+   shProg->data->InfoLog = ralloc_strdup(shProg->data, "");
 
-   ralloc_free(shProg->UniformBlocks);
-   shProg->UniformBlocks = NULL;
-   shProg->NumUniformBlocks = 0;
+   ralloc_free(shProg->data->UniformBlocks);
+   shProg->data->UniformBlocks = NULL;
+   shProg->data->NumUniformBlocks = 0;
 
-   ralloc_free(shProg->ShaderStorageBlocks);
-   shProg->ShaderStorageBlocks = NULL;
-   shProg->NumShaderStorageBlocks = 0;
+   ralloc_free(shProg->data->ShaderStorageBlocks);
+   shProg->data->ShaderStorageBlocks = NULL;
+   shProg->data->NumShaderStorageBlocks = 0;
 
-   ralloc_free(shProg->AtomicBuffers);
-   shProg->AtomicBuffers = NULL;
-   shProg->NumAtomicBuffers = 0;
+   ralloc_free(shProg->data->AtomicBuffers);
+   shProg->data->AtomicBuffers = NULL;
+   shProg->data->NumAtomicBuffers = 0;
 
    if (shProg->ProgramResourceList) {
       ralloc_free(shProg->ProgramResourceList);
@@ -442,7 +448,7 @@ _mesa_delete_shader_program(struct gl_context *ctx,
                             struct gl_shader_program *shProg)
 {
    _mesa_free_shader_program_data(ctx, shProg);
-
+   _mesa_reference_shader_program_data(ctx, &shProg->data, NULL);
    ralloc_free(shProg);
 }
 
index 42956fd5d91ea9262d9ca3ec18104241f2060bfd..e56f6e136d3b0fb216470ba90c53756e105a524b 100644 (file)
@@ -132,7 +132,7 @@ update_program(struct gl_context *ctx)
     * come up, or matter.
     */
 
-   if (fsProg && fsProg->LinkStatus
+   if (fsProg && fsProg->data->LinkStatus
        && fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
       /* Use GLSL fragment shader */
       _mesa_reference_shader_program(ctx,
@@ -183,7 +183,7 @@ update_program(struct gl_context *ctx)
                              NULL);
    }
 
-   if (gsProg && gsProg->LinkStatus
+   if (gsProg && gsProg->data->LinkStatus
        && gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
       /* Use GLSL geometry shader */
       _mesa_reference_program(ctx, &ctx->GeometryProgram._Current,
@@ -193,7 +193,7 @@ update_program(struct gl_context *ctx)
       _mesa_reference_program(ctx, &ctx->GeometryProgram._Current, NULL);
    }
 
-   if (tesProg && tesProg->LinkStatus
+   if (tesProg && tesProg->data->LinkStatus
        && tesProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]) {
       /* Use GLSL tessellation evaluation shader */
       _mesa_reference_program(ctx, &ctx->TessEvalProgram._Current,
@@ -204,7 +204,7 @@ update_program(struct gl_context *ctx)
       _mesa_reference_program(ctx, &ctx->TessEvalProgram._Current, NULL);
    }
 
-   if (tcsProg && tcsProg->LinkStatus
+   if (tcsProg && tcsProg->data->LinkStatus
        && tcsProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]) {
       /* Use GLSL tessellation control shader */
       _mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current,
@@ -219,7 +219,7 @@ update_program(struct gl_context *ctx)
     * _mesa_get_fixed_func_vertex_program() needs to know active
     * fragprog inputs.
     */
-   if (vsProg && vsProg->LinkStatus
+   if (vsProg && vsProg->data->LinkStatus
        && vsProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
       /* Use GLSL vertex shader */
       _mesa_reference_program(ctx, &ctx->VertexProgram._Current,
@@ -242,7 +242,7 @@ update_program(struct gl_context *ctx)
       _mesa_reference_program(ctx, &ctx->VertexProgram._Current, NULL);
    }
 
-   if (csProg && csProg->LinkStatus
+   if (csProg && csProg->data->LinkStatus
        && csProg->_LinkedShaders[MESA_SHADER_COMPUTE]) {
       /* Use GLSL compute shader */
       _mesa_reference_program(ctx, &ctx->ComputeProgram._Current,
index 56446c3af099d027cfc642051c841bcead291b7e..4676d4aa0d9289268f148ad8f169f536c7ac4945 100644 (file)
@@ -701,7 +701,7 @@ update_texture_state( struct gl_context *ctx )
 
    for (i = 0; i < MESA_SHADER_STAGES; i++) {
       if (ctx->_Shader->CurrentProgram[i] &&
-          ctx->_Shader->CurrentProgram[i]->LinkStatus) {
+          ctx->_Shader->CurrentProgram[i]->data->LinkStatus) {
          prog[i] = ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i]->Program;
       } else {
          if (i == MESA_SHADER_FRAGMENT && ctx->FragmentProgram._Enabled)
index db700df91e423f6bf2b5db33088b6806758246ef..3108d348d6fa90f88137c97cae6ef1419a331504 100644 (file)
@@ -179,10 +179,10 @@ validate_uniform_parameters(struct gl_context *ctx,
 
    /* Check that the given location is in bounds of uniform remap table.
     * Unlinked programs will have NumUniformRemapTable == 0, so we can take
-    * the shProg->LinkStatus check out of the main path.
+    * the shProg->data->LinkStatus check out of the main path.
     */
    if (unlikely(location >= (GLint) shProg->NumUniformRemapTable)) {
-      if (!shProg->LinkStatus)
+      if (!shProg->data->LinkStatus)
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)",
                      caller);
       else
@@ -193,7 +193,7 @@ validate_uniform_parameters(struct gl_context *ctx,
    }
 
    if (location == -1) {
-      if (!shProg->LinkStatus)
+      if (!shProg->data->LinkStatus)
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)",
                      caller);
 
@@ -1068,7 +1068,7 @@ _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,
                                 char *errMsg, size_t errMsgLength)
 {
    /* Shader does not have samplers. */
-   if (shProg->NumUniformStorage == 0)
+   if (shProg->data->NumUniformStorage == 0)
       return true;
 
    if (!shProg->SamplersValidated) {
index 3921644892c33aaf8c6ea51b816b25ec035d51ef..f26fd784e71a979db2f55af85a7cd752dbc41d27 100644 (file)
@@ -915,7 +915,7 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
     *     "If program has not been successfully linked, the error
     *     INVALID_OPERATION is generated."
     */
-   if (shProg->LinkStatus == GL_FALSE) {
+   if (shProg->data->LinkStatus == GL_FALSE) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                  "glGetUniformLocation(program not linked)");
       return -1;
@@ -1002,10 +1002,10 @@ _mesa_UniformBlockBinding(GLuint program,
    if (!shProg)
       return;
 
-   if (uniformBlockIndex >= shProg->NumUniformBlocks) {
+   if (uniformBlockIndex >= shProg->data->NumUniformBlocks) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                  "glUniformBlockBinding(block index %u >= %u)",
-                 uniformBlockIndex, shProg->NumUniformBlocks);
+                  uniformBlockIndex, shProg->data->NumUniformBlocks);
       return;
    }
 
@@ -1016,13 +1016,14 @@ _mesa_UniformBlockBinding(GLuint program,
       return;
    }
 
-   if (shProg->UniformBlocks[uniformBlockIndex].Binding !=
+   if (shProg->data->UniformBlocks[uniformBlockIndex].Binding !=
        uniformBlockBinding) {
 
       FLUSH_VERTICES(ctx, 0);
       ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
 
-      shProg->UniformBlocks[uniformBlockIndex].Binding = uniformBlockBinding;
+      shProg->data->UniformBlocks[uniformBlockIndex].Binding =
+         uniformBlockBinding;
    }
 }
 
@@ -1044,10 +1045,11 @@ _mesa_ShaderStorageBlockBinding(GLuint program,
    if (!shProg)
       return;
 
-   if (shaderStorageBlockIndex >= shProg->NumShaderStorageBlocks) {
+   if (shaderStorageBlockIndex >= shProg->data->NumShaderStorageBlocks) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                  "glShaderStorageBlockBinding(block index %u >= %u)",
-                 shaderStorageBlockIndex, shProg->NumShaderStorageBlocks);
+                  shaderStorageBlockIndex,
+                  shProg->data->NumShaderStorageBlocks);
       return;
    }
 
@@ -1059,13 +1061,13 @@ _mesa_ShaderStorageBlockBinding(GLuint program,
       return;
    }
 
-   if (shProg->ShaderStorageBlocks[shaderStorageBlockIndex].Binding !=
+   if (shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding !=
        shaderStorageBlockBinding) {
 
       FLUSH_VERTICES(ctx, 0);
       ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer;
 
-      shProg->ShaderStorageBlocks[shaderStorageBlockIndex].Binding =
+      shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding =
          shaderStorageBlockBinding;
    }
 }
index 88a7f368ee176d1bd2ef87c16a5fb6abfb4695da..558f0ea4f6892b1635776e301edd782062963c69 100644 (file)
@@ -1622,7 +1622,7 @@ calc_sampler_offsets(struct gl_shader_program *prog, ir_dereference *deref,
          * all that would work would be an unrolled loop counter that ends
          * up being constant above.
          */
-        ralloc_strcat(&prog->InfoLog,
+         ralloc_strcat(&prog->data->InfoLog,
                       "warning: Variable sampler array index unsupported.\n"
                       "This feature of the language was removed in GLSL 1.20 "
                       "and is unlikely to be supported for 1.10 in Mesa.\n");
@@ -1668,8 +1668,8 @@ get_sampler_uniform_value(class ir_dereference *sampler,
    calc_sampler_offsets(shader_program, sampler, &offset, &array_elements,
                         &location);
 
-   assert(shader_program->UniformStorage[location].opaque[shader].active);
-   return shader_program->UniformStorage[location].opaque[shader].index +
+   assert(shader_program->data->UniformStorage[location].opaque[shader].active);
+   return shader_program->data->UniformStorage[location].opaque[shader].index +
           offset;
 }
 
@@ -2441,7 +2441,7 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
            return;
 
         struct gl_uniform_storage *storage =
-           &this->shader_program->UniformStorage[location];
+            &this->shader_program->data->UniformStorage[location];
 
          assert(storage->type->is_sampler() &&
                 storage->opaque[shader_type].active);
@@ -2510,7 +2510,7 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
         continue;
 
       struct gl_uniform_storage *storage =
-         &shader_program->UniformStorage[location];
+         &shader_program->data->UniformStorage[location];
 
       /* Do not associate any uniform storage to built-in uniforms */
       if (storage->builtin)
@@ -2883,11 +2883,11 @@ get_mesa_program(struct gl_context *ctx,
       mesa_inst++;
       i++;
 
-      if (!shader_program->LinkStatus)
+      if (!shader_program->data->LinkStatus)
          break;
    }
 
-   if (!shader_program->LinkStatus) {
+   if (!shader_program->data->LinkStatus) {
       goto fail_exit;
    }
 
@@ -2936,7 +2936,7 @@ get_mesa_program(struct gl_context *ctx,
     * program constant) has to happen before creating this linkage.
     */
    _mesa_associate_uniform_storage(ctx, shader_program, prog->Parameters);
-   if (!shader_program->LinkStatus) {
+   if (!shader_program->data->LinkStatus) {
       goto fail_exit;
    }
 
@@ -2959,7 +2959,7 @@ extern "C" {
 GLboolean
 _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 {
-   assert(prog->LinkStatus);
+   assert(prog->data->LinkStatus);
 
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)
@@ -3037,7 +3037,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
    }
 
    build_program_resource_list(ctx, prog);
-   return prog->LinkStatus;
+   return prog->data->LinkStatus;
 }
 
 /**
@@ -3050,7 +3050,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 
    _mesa_clear_shader_program_data(ctx, prog);
 
-   prog->LinkStatus = GL_TRUE;
+   prog->data->LinkStatus = GL_TRUE;
 
    for (i = 0; i < prog->NumShaders; i++) {
       if (!prog->Shaders[i]->CompileStatus) {
@@ -3058,24 +3058,24 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
       }
    }
 
-   if (prog->LinkStatus) {
+   if (prog->data->LinkStatus) {
       link_shaders(ctx, prog);
    }
 
-   if (prog->LinkStatus) {
+   if (prog->data->LinkStatus) {
       if (!ctx->Driver.LinkShader(ctx, prog)) {
-        prog->LinkStatus = GL_FALSE;
+         prog->data->LinkStatus = GL_FALSE;
       }
    }
 
    if (ctx->_Shader->Flags & GLSL_DUMP) {
-      if (!prog->LinkStatus) {
+      if (!prog->data->LinkStatus) {
         fprintf(stderr, "GLSL shader program %d failed to link\n", prog->Name);
       }
 
-      if (prog->InfoLog && prog->InfoLog[0] != 0) {
+      if (prog->data->InfoLog && prog->data->InfoLog[0] != 0) {
         fprintf(stderr, "GLSL shader program %d info log:\n", prog->Name);
-        fprintf(stderr, "%s\n", prog->InfoLog);
+         fprintf(stderr, "%s\n", prog->data->InfoLog);
       }
    }
 }
index f48ae61377f6c430ac432e4ce46ec571e441292e..93538b567f1b5977e67d2707ae2a265a6f435113 100644 (file)
@@ -50,8 +50,8 @@ st_bind_atomics(struct st_context *st,
    if (!prog || !st->pipe->set_shader_buffers)
       return;
 
-   for (i = 0; i < prog->NumAtomicBuffers; i++) {
-      struct gl_active_atomic_buffer *atomic = &prog->AtomicBuffers[i];
+   for (i = 0; i < prog->data->NumAtomicBuffers; i++) {
+      struct gl_active_atomic_buffer *atomic = &prog->data->AtomicBuffers[i];
       struct gl_atomic_buffer_binding *binding =
          &st->ctx->AtomicBufferBindings[atomic->Binding];
       struct st_buffer_object *st_obj =
index 0cea32b764bd25d87927147a8fbb5a7c6dd95c48..978dc46401b192d706759ac4e11cfd3065eb2a91 100644 (file)
@@ -570,10 +570,10 @@ fail_link(struct gl_shader_program *prog, const char *fmt, ...)
 {
    va_list args;
    va_start(args, fmt);
-   ralloc_vasprintf_append(&prog->InfoLog, fmt, args);
+   ralloc_vasprintf_append(&prog->data->InfoLog, fmt, args);
    va_end(args);
 
-   prog->LinkStatus = GL_FALSE;
+   prog->data->LinkStatus = GL_FALSE;
 }
 
 static int
@@ -3880,8 +3880,8 @@ glsl_to_tgsi_visitor::get_deref_offsets(ir_dereference *ir,
 
    if (opaque) {
       assert(location != 0xffffffff);
-      *base += this->shader_program->UniformStorage[location].opaque[shader].index;
-      *index += this->shader_program->UniformStorage[location].opaque[shader].index;
+      *base += this->shader_program->data->UniformStorage[location].opaque[shader].index;
+      *index += this->shader_program->data->UniformStorage[location].opaque[shader].index;
    }
 }
 
@@ -6534,7 +6534,7 @@ get_mesa_program_tgsi(struct gl_context *ctx,
     * program constant) has to happen before creating this linkage.
     */
    _mesa_associate_uniform_storage(ctx, shader_program, prog->Parameters);
-   if (!shader_program->LinkStatus) {
+   if (!shader_program->data->LinkStatus) {
       free_glsl_to_tgsi_visitor(v);
       _mesa_reference_program(ctx, &shader->Program, NULL);
       return NULL;
@@ -6760,7 +6760,7 @@ GLboolean
 st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 {
    struct pipe_screen *pscreen = ctx->st->pipe->screen;
-   assert(prog->LinkStatus);
+   assert(prog->data->LinkStatus);
 
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] == NULL)