X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fcompiler%2Fnir%2Fnir_lower_uniforms_to_ubo.c;h=bdee9e927cbf11f4e2cbd04033096c8d2ff6ecb8;hb=00b28a50b2c492eee25ef3f75538aabe1e569ff1;hp=565410cf0cc0cef79bc9237b8aed993a8d78207a;hpb=f5b14d983e5afa1b8f75e6f3692830a1ee46d1df;p=mesa.git diff --git a/src/compiler/nir/nir_lower_uniforms_to_ubo.c b/src/compiler/nir/nir_lower_uniforms_to_ubo.c index 565410cf0cc..bdee9e927cb 100644 --- a/src/compiler/nir/nir_lower_uniforms_to_ubo.c +++ b/src/compiler/nir/nir_lower_uniforms_to_ubo.c @@ -103,8 +103,31 @@ nir_lower_uniforms_to_ubo(nir_shader *shader, int multiplier) } } + if (progress) { + if (!shader->info.first_ubo_is_default_ubo) { + nir_foreach_variable_with_modes(var, shader, nir_var_mem_ubo) + var->data.binding++; + } + shader->info.num_ubos++; + + if (shader->num_uniforms > 0) { + const struct glsl_type *type = glsl_array_type(glsl_vec4_type(), + shader->num_uniforms, 0); + nir_variable *ubo = nir_variable_create(shader, nir_var_mem_ubo, type, + "uniform_0"); + ubo->data.binding = 0; + + struct glsl_struct_field field = { + .type = type, + .name = "data", + .location = -1, + }; + ubo->interface_type = + glsl_interface_type(&field, 1, GLSL_INTERFACE_PACKING_STD430, + false, "__ubo0_interface"); + } + } + shader->info.first_ubo_is_default_ubo = true; return progress; } - -