aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2020-01-03 13:55:35 +0100
committerMarge Bot <[email protected]>2020-01-18 10:45:38 +0000
commit3e1acff56039d2f78c563be8131666e811e0b562 (patch)
tree08ce84e5c5cb2d7569bc06e41f30b21f32b73e0c /src/gallium
parent5fc1562a7215c63b40f22f0320f458387e61e9b5 (diff)
zink: store image-type per texture
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3275>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index bb916cf7a98..3c0f2260288 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -38,6 +38,7 @@ struct ntv_context {
SpvId ubos[128];
size_t num_ubos;
+ SpvId image_types[PIPE_MAX_SAMPLERS];
SpvId samplers[PIPE_MAX_SAMPLERS];
size_t num_samplers;
SpvId entry_ifaces[PIPE_MAX_SHADER_INPUTS * 4 + PIPE_MAX_SHADER_OUTPUTS * 4];
@@ -403,6 +404,9 @@ emit_sampler(struct ntv_context *ctx, struct nir_variable *var)
if (var->name)
spirv_builder_emit_name(&ctx->builder, var_id, var->name);
+ assert(ctx->num_samplers < ARRAY_SIZE(ctx->image_types));
+ ctx->image_types[ctx->num_samplers] = image_type;
+
assert(ctx->num_samplers < ARRAY_SIZE(ctx->samplers));
ctx->samplers[ctx->num_samplers++] = var_id;
@@ -1438,12 +1442,7 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
assert(lod != 0);
}
- bool is_ms;
- SpvDim dimension = type_to_dim(tex->sampler_dim, &is_ms);
- SpvId float_type = spirv_builder_type_float(&ctx->builder, 32);
- SpvId image_type = spirv_builder_type_image(&ctx->builder, float_type,
- dimension, false, tex->is_array, is_ms, 1,
- SpvImageFormatUnknown);
+ SpvId image_type = ctx->image_types[tex->texture_index];
SpvId sampled_type = spirv_builder_type_sampled_image(&ctx->builder,
image_type);
@@ -1487,7 +1486,7 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
SpvId actual_dest_type = dest_type;
if (dref)
- actual_dest_type = float_type;
+ actual_dest_type = spirv_builder_type_float(&ctx->builder, 32);
SpvId result;
if (tex->op == nir_texop_txf) {