mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 15:50:11 +01:00
glsl: Also update implicit sizes of varyings at link time.
Otherwise, we'll often end up with gl_TexCoord being 0 length, for example. With ir_to_mesa, things ended up working out anyway, as long as multiple implicitly-sized arrays weren't involved.
This commit is contained in:
parent
b9a59f0358
commit
586b4b500f
1 changed files with 7 additions and 4 deletions
|
|
@ -857,13 +857,15 @@ struct uniform_node {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
update_uniform_array_sizes(struct gl_shader_program *prog)
|
update_array_sizes(struct gl_shader_program *prog)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
|
for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
|
||||||
foreach_list(node, prog->_LinkedShaders[i]->ir) {
|
foreach_list(node, prog->_LinkedShaders[i]->ir) {
|
||||||
ir_variable *const var = ((ir_instruction *) node)->as_variable();
|
ir_variable *const var = ((ir_instruction *) node)->as_variable();
|
||||||
|
|
||||||
if ((var == NULL) || (var->mode != ir_var_uniform) ||
|
if ((var == NULL) || (var->mode != ir_var_uniform &&
|
||||||
|
var->mode != ir_var_in &&
|
||||||
|
var->mode != ir_var_out) ||
|
||||||
!var->type->is_array())
|
!var->type->is_array())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -880,6 +882,7 @@ update_uniform_array_sizes(struct gl_shader_program *prog)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size + 1 != var->type->fields.array->length) {
|
if (size + 1 != var->type->fields.array->length) {
|
||||||
var->type = glsl_type::get_array_instance(var->type->fields.array,
|
var->type = glsl_type::get_array_instance(var->type->fields.array,
|
||||||
size + 1);
|
size + 1);
|
||||||
|
|
@ -979,8 +982,6 @@ assign_uniform_locations(struct gl_shader_program *prog)
|
||||||
hash_table_string_compare);
|
hash_table_string_compare);
|
||||||
void *mem_ctx = talloc_new(NULL);
|
void *mem_ctx = talloc_new(NULL);
|
||||||
|
|
||||||
update_uniform_array_sizes(prog);
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
|
for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
|
||||||
unsigned next_position = 0;
|
unsigned next_position = 0;
|
||||||
|
|
||||||
|
|
@ -1475,6 +1476,8 @@ link_shaders(GLcontext *ctx, struct gl_shader_program *prog)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_array_sizes(prog);
|
||||||
|
|
||||||
assign_uniform_locations(prog);
|
assign_uniform_locations(prog);
|
||||||
|
|
||||||
if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) {
|
if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue