diff options
author | Jason Ekstrand <[email protected]> | 2016-02-09 12:13:32 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-09 16:48:36 -0800 |
commit | 09b3e30dc672d38e60aac1d279eb1db94c9b048e (patch) | |
tree | 50b745e0d7e820a848a300390ffaed63dfdb6036 /src/vulkan | |
parent | b14f4c1fd33e13c48a8fd81a9bc77c6df60108dd (diff) |
anv: Fix up spirv for new texture/sampler split stuff
Diffstat (limited to 'src/vulkan')
-rw-r--r-- | src/vulkan/anv_meta.c | 1 | ||||
-rw-r--r-- | src/vulkan/anv_meta_resolve.c | 1 | ||||
-rw-r--r-- | src/vulkan/anv_nir_apply_pipeline_layout.c | 38 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c index 2867e471a32..46227c3407e 100644 --- a/src/vulkan/anv_meta.c +++ b/src/vulkan/anv_meta.c @@ -106,6 +106,7 @@ build_nir_copy_fragment_shader(enum glsl_sampler_dim tex_dim) tex->dest_type = nir_type_float; /* TODO */ tex->is_array = glsl_sampler_type_is_array(sampler_type); tex->coord_components = tex_pos->num_components; + tex->texture = nir_deref_var_create(tex, sampler); tex->sampler = nir_deref_var_create(tex, sampler); nir_ssa_dest_init(&tex->instr, &tex->dest, 4, "tex"); diff --git a/src/vulkan/anv_meta_resolve.c b/src/vulkan/anv_meta_resolve.c index f1c985e04cf..5aa2fef76bd 100644 --- a/src/vulkan/anv_meta_resolve.c +++ b/src/vulkan/anv_meta_resolve.c @@ -152,6 +152,7 @@ build_nir_fs(uint32_t num_samples) nir_tex_instr *tex; tex = nir_tex_instr_create(b.shader, /*num_srcs*/ 2); + tex->texture = nir_deref_var_create(tex, u_tex); tex->sampler = nir_deref_var_create(tex, u_tex); tex->sampler_dim = GLSL_SAMPLER_DIM_MS; tex->op = nir_texop_txf_ms; diff --git a/src/vulkan/anv_nir_apply_pipeline_layout.c b/src/vulkan/anv_nir_apply_pipeline_layout.c index 61dcf1d4c1b..ee93e40e76c 100644 --- a/src/vulkan/anv_nir_apply_pipeline_layout.c +++ b/src/vulkan/anv_nir_apply_pipeline_layout.c @@ -58,21 +58,18 @@ get_surface_index(unsigned set, unsigned binding, } static uint32_t -get_sampler_index(unsigned set, unsigned binding, nir_texop tex_op, +get_sampler_index(unsigned set, unsigned binding, struct apply_pipeline_layout_state *state) { assert(set < state->layout->num_sets); struct anv_descriptor_set_layout *set_layout = state->layout->set[set].layout; - assert(binding < set_layout->binding_count); - gl_shader_stage stage = state->shader->stage; - if (set_layout->binding[binding].stage[stage].sampler_index < 0) { - assert(tex_op == nir_texop_txf); - return 0; - } + assert(binding < set_layout->binding_count); + + assert(set_layout->binding[binding].stage[stage].sampler_index >= 0); uint32_t sampler_index = state->layout->set[set].stage[stage].sampler_start + @@ -188,29 +185,30 @@ static void lower_tex(nir_tex_instr *tex, struct apply_pipeline_layout_state *state) { /* No one should have come by and lowered it already */ - assert(tex->sampler); + assert(tex->texture); - nir_deref_var *tex_deref = tex->texture ? tex->texture : tex->sampler; tex->texture_index = - get_surface_index(tex_deref->var->data.descriptor_set, - tex_deref->var->data.binding, state); - lower_tex_deref(tex, tex_deref, &tex->texture_index, + get_surface_index(tex->texture->var->data.descriptor_set, + tex->texture->var->data.binding, state); + lower_tex_deref(tex, tex->texture, &tex->texture_index, nir_tex_src_texture_offset, state); - tex->sampler_index = - get_sampler_index(tex->sampler->var->data.descriptor_set, - tex->sampler->var->data.binding, tex->op, state); - lower_tex_deref(tex, tex->sampler, &tex->sampler_index, - nir_tex_src_sampler_offset, state); + if (tex->sampler) { + tex->sampler_index = + get_sampler_index(tex->sampler->var->data.descriptor_set, + tex->sampler->var->data.binding, state); + lower_tex_deref(tex, tex->sampler, &tex->sampler_index, + nir_tex_src_sampler_offset, state); + } /* The backend only ever uses this to mark used surfaces. We don't care * about that little optimization so it just needs to be non-zero. */ tex->texture_array_size = 1; - if (tex->texture) - cleanup_tex_deref(tex, tex->texture); - cleanup_tex_deref(tex, tex->sampler); + cleanup_tex_deref(tex, tex->texture); + if (tex->sampler) + cleanup_tex_deref(tex, tex->sampler); tex->texture = NULL; tex->sampler = NULL; } |