diff options
author | Erik Faye-Lund <[email protected]> | 2020-01-03 12:42:02 +0100 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-18 10:45:38 +0000 |
commit | a9023ec5665ae84f6d05d2d58e5950b79ebcf977 (patch) | |
tree | 6ac18d2a9399af74099ec0b266cd60e6a325324e /src/gallium/drivers/zink/nir_to_spirv | |
parent | 3e1acff56039d2f78c563be8131666e811e0b562 (diff) |
zink: support sampling non-float textures
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3275>
Diffstat (limited to 'src/gallium/drivers/zink/nir_to_spirv')
-rw-r--r-- | src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 13 |
1 files changed, 7 insertions, 6 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 3c0f2260288..922ed8c81f5 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 @@ -388,10 +388,13 @@ emit_sampler(struct ntv_context *ctx, struct nir_variable *var) { bool is_ms; SpvDim dimension = type_to_dim(glsl_get_sampler_dim(var->type), &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, glsl_sampler_type_is_array(var->type), is_ms, 1, - SpvImageFormatUnknown); + + SpvId result_type = get_glsl_basetype(ctx, glsl_get_sampler_result_type(var->type)); + SpvId image_type = spirv_builder_type_image(&ctx->builder, result_type, + dimension, false, + glsl_sampler_type_is_array(var->type), + is_ms, 1, + SpvImageFormatUnknown); SpvId sampled_type = spirv_builder_type_sampled_image(&ctx->builder, image_type); @@ -1372,8 +1375,6 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex) tex->op == nir_texop_txd || tex->op == nir_texop_txf || tex->op == nir_texop_txs); - assert(tex->op == nir_texop_txs || - nir_alu_type_get_base_type(tex->dest_type) == nir_type_float); assert(tex->texture_index == tex->sampler_index); SpvId coord = 0, proj = 0, bias = 0, lod = 0, dref = 0, dx = 0, dy = 0, |