zink: support offset-variants of texturing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3275>
This commit is contained in:

committed by
Marge Bot

parent
f1a5bcdc16
commit
8112240d29
@@ -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);
|
nir_alu_type_get_base_type(tex->dest_type) == nir_type_float);
|
||||||
assert(tex->texture_index == tex->sampler_index);
|
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;
|
unsigned coord_components = 0;
|
||||||
for (unsigned i = 0; i < tex->num_srcs; i++) {
|
for (unsigned i = 0; i < tex->num_srcs; i++) {
|
||||||
switch (tex->src[i].src_type) {
|
switch (tex->src[i].src_type) {
|
||||||
@@ -1390,6 +1391,10 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
|
|||||||
assert(proj != 0);
|
assert(proj != 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case nir_tex_src_offset:
|
||||||
|
offset = get_src_int(ctx, &tex->src[i].src);
|
||||||
|
break;
|
||||||
|
|
||||||
case nir_tex_src_bias:
|
case nir_tex_src_bias:
|
||||||
assert(tex->op == nir_texop_txb);
|
assert(tex->op == nir_texop_txb);
|
||||||
bias = get_src_float(ctx, &tex->src[i].src);
|
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,
|
actual_dest_type, load,
|
||||||
coord,
|
coord,
|
||||||
proj != 0,
|
proj != 0,
|
||||||
lod, bias, dref, dx, dy);
|
lod, bias, dref, dx, dy,
|
||||||
|
offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
spirv_builder_emit_decoration(&ctx->builder, result,
|
spirv_builder_emit_decoration(&ctx->builder, result,
|
||||||
|
@@ -515,7 +515,8 @@ spirv_builder_emit_image_sample(struct spirv_builder *b,
|
|||||||
SpvId bias,
|
SpvId bias,
|
||||||
SpvId dref,
|
SpvId dref,
|
||||||
SpvId dx,
|
SpvId dx,
|
||||||
SpvId dy)
|
SpvId dy,
|
||||||
|
SpvId offset)
|
||||||
{
|
{
|
||||||
SpvId result = spirv_builder_new_id(b);
|
SpvId result = spirv_builder_new_id(b);
|
||||||
|
|
||||||
@@ -531,7 +532,7 @@ spirv_builder_emit_image_sample(struct spirv_builder *b,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SpvImageOperandsMask operand_mask = SpvImageOperandsMaskNone;
|
SpvImageOperandsMask operand_mask = SpvImageOperandsMaskNone;
|
||||||
SpvId extra_operands[4];
|
SpvId extra_operands[5];
|
||||||
int num_extra_operands = 0;
|
int num_extra_operands = 0;
|
||||||
if (bias) {
|
if (bias) {
|
||||||
extra_operands[++num_extra_operands] = 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;
|
extra_operands[++num_extra_operands] = dy;
|
||||||
operand_mask |= SpvImageOperandsGradMask;
|
operand_mask |= SpvImageOperandsGradMask;
|
||||||
}
|
}
|
||||||
|
if (offset) {
|
||||||
|
extra_operands[++num_extra_operands] = offset;
|
||||||
|
operand_mask |= SpvImageOperandsOffsetMask;
|
||||||
|
}
|
||||||
|
|
||||||
/* finalize num_extra_operands / extra_operands */
|
/* finalize num_extra_operands / extra_operands */
|
||||||
if (num_extra_operands > 0) {
|
if (num_extra_operands > 0) {
|
||||||
|
@@ -215,7 +215,8 @@ spirv_builder_emit_image_sample(struct spirv_builder *b,
|
|||||||
SpvId bias,
|
SpvId bias,
|
||||||
SpvId dref,
|
SpvId dref,
|
||||||
SpvId dx,
|
SpvId dx,
|
||||||
SpvId dy);
|
SpvId dy,
|
||||||
|
SpvId offset);
|
||||||
|
|
||||||
SpvId
|
SpvId
|
||||||
spirv_builder_emit_image(struct spirv_builder *b, SpvId result_type,
|
spirv_builder_emit_image(struct spirv_builder *b, SpvId result_type,
|
||||||
|
Reference in New Issue
Block a user