glsl/st: vectorise interfaces of SSO shader programs
For example the SSO program may consist of just tcs -> gs or even just a vs. In these cases we want to vectorise the externally facing shader interfaces just like we would in non SSO programs. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15941>
This commit is contained in:

committed by
Marge Bot

parent
04bd007757
commit
3dae5442ef
@@ -562,9 +562,14 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
|
||||
static void
|
||||
st_nir_vectorize_io(nir_shader *producer, nir_shader *consumer)
|
||||
{
|
||||
if (consumer)
|
||||
NIR_PASS_V(consumer, nir_lower_io_to_vector, nir_var_shader_in);
|
||||
|
||||
if (!producer)
|
||||
return;
|
||||
|
||||
NIR_PASS_V(producer, nir_lower_io_to_vector, nir_var_shader_out);
|
||||
NIR_PASS_V(producer, nir_opt_combine_stores, nir_var_shader_out);
|
||||
NIR_PASS_V(consumer, nir_lower_io_to_vector, nir_var_shader_in);
|
||||
|
||||
if ((producer)->info.stage != MESA_SHADER_TESS_CTRL) {
|
||||
/* Calling lower_io_to_vector creates output variable writes with
|
||||
@@ -868,6 +873,23 @@ st_link_nir(struct gl_context *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
/* If the program is a separate shader program check if we need to vectorise
|
||||
* the first and last program interfaces too.
|
||||
*/
|
||||
if (shader_program->SeparateShader && num_shaders > 0) {
|
||||
struct gl_linked_shader *first_shader = linked_shader[0];
|
||||
struct gl_linked_shader *last_shader = linked_shader[num_shaders - 1];
|
||||
if (first_shader->Stage != MESA_SHADER_COMPUTE) {
|
||||
if (ctx->Const.ShaderCompilerOptions[first_shader->Stage].NirOptions->vectorize_io &&
|
||||
first_shader->Stage > MESA_SHADER_VERTEX)
|
||||
st_nir_vectorize_io(NULL, first_shader->Program->nir);
|
||||
|
||||
if (ctx->Const.ShaderCompilerOptions[last_shader->Stage].NirOptions->vectorize_io &&
|
||||
last_shader->Stage < MESA_SHADER_FRAGMENT)
|
||||
st_nir_vectorize_io(last_shader->Program->nir, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
struct shader_info *prev_info = NULL;
|
||||
|
||||
for (unsigned i = 0; i < num_shaders; i++) {
|
||||
|
Reference in New Issue
Block a user