summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArcady Goldmints-Orlov <[email protected]>2019-01-28 10:19:28 -0600
committerAlejandro PiƱeiro <[email protected]>2019-07-12 23:42:41 +0200
commit637b168470190507c89eca8a7d0479103fe236ae (patch)
tree4895842644b0fbbdf0e1c717523c99afa125c9a0 /src
parent761b0fe95f00a9a5adfd0369326eeffb23af449a (diff)
nir/linker: Initialize UniformDataDefaults when using SPIR-V
Allocate UniformDataDefaults and fill in the data defaults when linking a SPIR-V program. Among other things, this allows program serialization to work. It allows the following piglit test (when run on SPIR-V mode) to pass: spec/arb_get_program_binary/execution/uniform-after-restore.shader_test v2: use memcpy to initialize UniformDataDefaults Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/gl_nir_link_uniform_initializers.c3
-rw-r--r--src/compiler/glsl/gl_nir_link_uniforms.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/glsl/gl_nir_link_uniform_initializers.c b/src/compiler/glsl/gl_nir_link_uniform_initializers.c
index 53a3ab9a0a2..1c4529c9307 100644
--- a/src/compiler/glsl/gl_nir_link_uniform_initializers.c
+++ b/src/compiler/glsl/gl_nir_link_uniform_initializers.c
@@ -295,4 +295,7 @@ gl_nir_set_uniform_initializers(struct gl_context *ctx,
}
}
}
+ memcpy(prog->data->UniformDataDefaults, prog->data->UniformDataSlots,
+ sizeof(union gl_constant_value) * prog->data->NumUniformDataSlots);
+
}
diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c
index 1478046c183..ac97334e9cd 100644
--- a/src/compiler/glsl/gl_nir_link_uniforms.c
+++ b/src/compiler/glsl/gl_nir_link_uniforms.c
@@ -54,6 +54,10 @@ nir_setup_uniform_remap_tables(struct gl_context *ctx,
}
prog->data->UniformDataSlots = data;
+ prog->data->UniformDataDefaults =
+ rzalloc_array(prog->data->UniformStorage,
+ union gl_constant_value, prog->data->NumUniformDataSlots);
+
unsigned data_pos = 0;
/* Reserve all the explicit locations of the active uniforms. */