radv: Fix the shader info pass for not having the variable.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 23 Jan 2019 21:41:46 +0000 (22:41 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 6 Feb 2019 21:35:45 +0000 (22:35 +0100)
For example with VK_EXT_buffer_device_address or
 VK_KHR_variable_pointers.

Fixes: a2b5cc3c399 "radv: enable variable pointers"
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_shader_info.c

index 7e5a3789af2b0619942e31d0e22b12cee0e15e83..e17b0e54e6903044d2261d8090600680ea2ecb54 100644 (file)
@@ -101,7 +101,7 @@ gather_intrinsic_load_deref_info(const nir_shader *nir,
        case MESA_SHADER_VERTEX: {
                nir_variable *var = nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr));
 
-               if (var->data.mode == nir_var_shader_in) {
+               if (var && var->data.mode == nir_var_shader_in) {
                        unsigned idx = var->data.location;
                        uint8_t mask = nir_ssa_def_components_read(&instr->dest.ssa);
 
@@ -150,7 +150,7 @@ gather_intrinsic_store_deref_info(const nir_shader *nir,
 {
        nir_variable *var = nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr));
 
-       if (var->data.mode == nir_var_shader_out) {
+       if (var && var->data.mode == nir_var_shader_out) {
                unsigned idx = var->data.location;
 
                switch (nir->info.stage) {