summaryrefslogtreecommitdiffstats
path: root/src/freedreno/vulkan/tu_shader.c
diff options
context:
space:
mode:
authorJonathan Marek <jonathan@marek.ca>2019-09-24 14:36:53 -0400
committerJonathan Marek <jonathan@marek.ca>2019-09-24 22:32:09 -0400
commitf510901dc247b038715c1397b1c99746d5ed8df4 (patch)
treeebef50285861c9fed871a7487acd8c3eeca43613 /src/freedreno/vulkan/tu_shader.c
parent12372d60fff676c458c7a54a934f619548337f0e (diff)
turnip: fix binning shader compilation
ir3 segfaults if nonbinning is NULL for the bininng pass shader. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Diffstat (limited to 'src/freedreno/vulkan/tu_shader.c')
-rw-r--r--src/freedreno/vulkan/tu_shader.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c
index f6e13d7c42f..f3d81675bb1 100644
--- a/src/freedreno/vulkan/tu_shader.c
+++ b/src/freedreno/vulkan/tu_shader.c
@@ -222,13 +222,14 @@ tu_shader_compile_options_init(
static uint32_t *
tu_compile_shader_variant(struct ir3_shader *shader,
const struct ir3_shader_key *key,
- bool binning_pass,
+ struct ir3_shader_variant *nonbinning,
struct ir3_shader_variant *variant)
{
variant->shader = shader;
variant->type = shader->type;
variant->key = *key;
- variant->binning_pass = binning_pass;
+ variant->binning_pass = !!nonbinning;
+ variant->nonbinning = nonbinning;
int ret = ir3_compile_shader_nir(shader->compiler, variant);
if (ret)
@@ -259,7 +260,7 @@ tu_shader_compile(struct tu_device *dev,
}
shader->binary = tu_compile_shader_variant(
- &shader->ir3_shader, &options->key, false, &shader->variants[0]);
+ &shader->ir3_shader, &options->key, NULL, &shader->variants[0]);
if (!shader->binary)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -267,7 +268,8 @@ tu_shader_compile(struct tu_device *dev,
if (options->include_binning_pass &&
shader->ir3_shader.type == MESA_SHADER_VERTEX) {
shader->binning_binary = tu_compile_shader_variant(
- &shader->ir3_shader, &options->key, true, &shader->variants[1]);
+ &shader->ir3_shader, &options->key, &shader->variants[0],
+ &shader->variants[1]);
if (!shader->binning_binary)
return VK_ERROR_OUT_OF_HOST_MEMORY;