aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/zink
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2020-01-02 11:26:38 +0100
committerMarge Bot <[email protected]>2020-01-18 10:45:38 +0000
commit8112240d2931be2d5d572914d159d769888cab2d (patch)
tree2166d681a55c45e1493dc9c5d40321e944e98121 /src/gallium/drivers/zink
parentf1a5bcdc16c8a3b2deec988e3e6db731998a0626 (diff)
zink: support offset-variants of texturing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3275>
Diffstat (limited to 'src/gallium/drivers/zink')
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c10
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c9
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h3
3 files changed, 17 insertions, 5 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 35c2fc4c0f3..5ed0d0ba6b8 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
@@ -1372,7 +1372,8 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
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;
+ SpvId coord = 0, proj = 0, bias = 0, lod = 0, dref = 0, dx = 0, dy = 0,
+ offset = 0;
unsigned coord_components = 0;
for (unsigned i = 0; i < tex->num_srcs; i++) {
switch (tex->src[i].src_type) {
@@ -1390,6 +1391,10 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
assert(proj != 0);
break;
+ case nir_tex_src_offset:
+ offset = get_src_int(ctx, &tex->src[i].src);
+ break;
+
case nir_tex_src_bias:
assert(tex->op == nir_texop_txb);
bias = get_src_float(ctx, &tex->src[i].src);
@@ -1494,7 +1499,8 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
actual_dest_type, load,
coord,
proj != 0,
- lod, bias, dref, dx, dy);
+ lod, bias, dref, dx, dy,
+ offset);
}
spirv_builder_emit_decoration(&ctx->builder, result,
diff --git a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c
index bae23c97d4c..bdb8b8a1179 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c
@@ -515,7 +515,8 @@ spirv_builder_emit_image_sample(struct spirv_builder *b,
SpvId bias,
SpvId dref,
SpvId dx,
- SpvId dy)
+ SpvId dy,
+ SpvId offset)
{
SpvId result = spirv_builder_new_id(b);
@@ -531,7 +532,7 @@ spirv_builder_emit_image_sample(struct spirv_builder *b,
}
SpvImageOperandsMask operand_mask = SpvImageOperandsMaskNone;
- SpvId extra_operands[4];
+ SpvId extra_operands[5];
int num_extra_operands = 0;
if (bias) {
extra_operands[++num_extra_operands] = bias;
@@ -545,6 +546,10 @@ spirv_builder_emit_image_sample(struct spirv_builder *b,
extra_operands[++num_extra_operands] = dy;
operand_mask |= SpvImageOperandsGradMask;
}
+ if (offset) {
+ extra_operands[++num_extra_operands] = offset;
+ operand_mask |= SpvImageOperandsOffsetMask;
+ }
/* finalize num_extra_operands / extra_operands */
if (num_extra_operands > 0) {
diff --git a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h
index 56db0a11cf5..bd19e74822c 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h
+++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h
@@ -215,7 +215,8 @@ spirv_builder_emit_image_sample(struct spirv_builder *b,
SpvId bias,
SpvId dref,
SpvId dx,
- SpvId dy);
+ SpvId dy,
+ SpvId offset);
SpvId
spirv_builder_emit_image(struct spirv_builder *b, SpvId result_type,