[Mesa-dev] [PATCH 2/7] spirv: Add support for MinLod
Jason Ekstrand
jason at jlekstrand.net
Thu Oct 11 21:32:53 UTC 2018
---
src/compiler/nir/nir.h | 1 +
src/compiler/nir/nir_print.c | 3 +++
src/compiler/shader_info.h | 1 +
src/compiler/spirv/spirv_to_nir.c | 12 +++++++++++-
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 9527079a9ef..2896de58743 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1328,6 +1328,7 @@ typedef enum {
nir_tex_src_offset,
nir_tex_src_bias,
nir_tex_src_lod,
+ nir_tex_src_min_lod,
nir_tex_src_ms_index, /* MSAA sample index */
nir_tex_src_ms_mcs, /* MSAA compression value */
nir_tex_src_ddx,
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 19f26f46405..2a4f1370e2e 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -844,6 +844,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
case nir_tex_src_lod:
fprintf(fp, "(lod)");
break;
+ case nir_tex_src_min_lod:
+ fprintf(fp, "(min_lod)");
+ break;
case nir_tex_src_ms_index:
fprintf(fp, "(ms_index)");
break;
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 65bc0588d67..b8b2fe03d42 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -41,6 +41,7 @@ struct spirv_supported_capabilities {
bool image_read_without_format;
bool image_write_without_format;
bool int64;
+ bool min_lod;
bool multiview;
bool variable_pointers;
bool storage_16bit;
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 2ad83196e46..9b0b65b9fcb 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2120,6 +2120,13 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
texop = nir_texop_txf_ms;
(*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_ms_index);
}
+
+ if (operands & SpvImageOperandsMinLodMask) {
+ vtn_assert(texop == nir_texop_tex ||
+ texop == nir_texop_txb ||
+ texop == nir_texop_txd);
+ (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_min_lod);
+ }
}
/* We should have now consumed exactly all of the arguments */
vtn_assert(idx == count);
@@ -3364,11 +3371,14 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvCapabilityStorageImageMultisample:
case SpvCapabilityInt8:
case SpvCapabilitySparseResidency:
- case SpvCapabilityMinLod:
vtn_warn("Unsupported SPIR-V capability: %s",
spirv_capability_to_string(cap));
break;
+ case SpvCapabilityMinLod:
+ spv_check_supported(min_lod, cap);
+ break;
+
case SpvCapabilityAtomicStorage:
spv_check_supported(atomic_storage, cap);
break;
--
2.19.1
More information about the mesa-dev
mailing list