aboutsummaryrefslogtreecommitdiffstats
path: root/src/freedreno/vulkan
diff options
context:
space:
mode:
authorEduardo Lima Mitev <[email protected]>2020-02-09 21:07:03 +0000
committerMarge Bot <[email protected]>2020-02-24 12:20:20 +0000
commit99f2b6144b5c3c4f48096ed0de4b15d1d13afd96 (patch)
treeffd84f446ede8f86f6d3fd7cd64d25fc7d868132 /src/freedreno/vulkan
parent12a22da6834f21cb089bf9ecd44c483bd264ccd3 (diff)
turnip/pipeline: Don't assume tu_shader is a valid object
Fixes a crash in tu6_emit_fs_config() when 'shader' argument is assumed to be non-null, which is possible. Fixes dEQP test: dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.graphics Reviewed-by: Jonathan Marek <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3756> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3756>
Diffstat (limited to 'src/freedreno/vulkan')
-rw-r--r--src/freedreno/vulkan/tu_pipeline.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c
index 5519cfe7139..3d7278a4c89 100644
--- a/src/freedreno/vulkan/tu_pipeline.c
+++ b/src/freedreno/vulkan/tu_pipeline.c
@@ -468,9 +468,15 @@ tu6_emit_fs_config(struct tu_cs *cs, struct tu_shader *shader,
if (fs->need_fine_derivatives)
sp_fs_ctrl |= A6XX_SP_FS_CTRL_REG0_DIFF_FINE;
- uint32_t sp_fs_config = A6XX_SP_FS_CONFIG_NTEX(shader->texture_map.num_desc) |
- A6XX_SP_FS_CONFIG_NSAMP(shader->sampler_map.num_desc) |
- A6XX_SP_FS_CONFIG_NIBO(tu_shader_nibo(shader));
+ uint32_t sp_fs_config = 0;
+ unsigned shader_nibo = 0;
+ if (shader) {
+ shader_nibo = tu_shader_nibo(shader);
+ sp_fs_config = A6XX_SP_FS_CONFIG_NTEX(shader->texture_map.num_desc) |
+ A6XX_SP_FS_CONFIG_NSAMP(shader->sampler_map.num_desc) |
+ A6XX_SP_FS_CONFIG_NIBO(shader_nibo);
+ }
+
if (fs->instrlen)
sp_fs_config |= A6XX_SP_FS_CONFIG_ENABLED;
@@ -492,7 +498,7 @@ tu6_emit_fs_config(struct tu_cs *cs, struct tu_shader *shader,
A6XX_HLSQ_FS_CNTL_ENABLED);
tu_cs_emit_pkt4(cs, REG_A6XX_SP_IBO_COUNT, 1);
- tu_cs_emit(cs, tu_shader_nibo(shader));
+ tu_cs_emit(cs, shader_nibo);
}
static void