diff options
author | Timothy Arceri <[email protected]> | 2016-11-07 14:47:18 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-11-19 15:45:46 +1100 |
commit | 203c8794a1debc0e45019fe945d1cc55459e6c6f (patch) | |
tree | 29eafc191c0fb98ebc28673e95d3d1918f883bb0 /src/mesa/main | |
parent | 65cd0a0d7f411eefac81408ebf7b704ccd1c9bf7 (diff) |
st/mesa/glsl/nir/i965: make use of new gl_shader_program_data in gl_shader_program
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 6 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 18 | ||||
-rw-r--r-- | src/mesa/main/pipelineobj.c | 4 | ||||
-rw-r--r-- | src/mesa/main/program_resource.c | 2 | ||||
-rw-r--r-- | src/mesa/main/shader_query.cpp | 20 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 70 | ||||
-rw-r--r-- | src/mesa/main/shaderobj.c | 46 | ||||
-rw-r--r-- | src/mesa/main/state.c | 12 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 2 | ||||
-rw-r--r-- | src/mesa/main/uniform_query.cpp | 8 | ||||
-rw-r--r-- | src/mesa/main/uniforms.c | 20 |
11 files changed, 101 insertions, 107 deletions
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 9aa1dc15cdc..e00eac55beb 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -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; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index aa4d1d5e8f0..e87005326b6 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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 */ diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index 310b745ebc8..35d416dc9df 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -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; diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c index 19aaf48f984..859bda2c4dd 100644 --- a/src/mesa/main/program_resource.c +++ b/src/mesa/main/program_resource.c @@ -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); diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 5c42006b5dc..e4a8773e09c 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -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); } diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index aebd81214e7..ab153009e27 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -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); diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index fe0b45f57e8..167431dfe67 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -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); } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 42956fd5d91..e56f6e136d3 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -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, diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 56446c3af09..4676d4aa0d9 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -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) diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index db700df91e4..3108d348d6f 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -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) { diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 3921644892c..f26fd784e71 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -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; } } |