Philip Rebohle : vkd3d-shader/spirv: Implement texel offset support for sample_c instructions.
Alexandre Julliard
julliard at winehq.org
Fri Oct 15 15:39:49 CDT 2021
Module: vkd3d
Branch: master
Commit: ea1b01b1f80e5a5b4e2920be71a802d36347759e
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=ea1b01b1f80e5a5b4e2920be71a802d36347759e
Author: Philip Rebohle <philip.rebohle at tu-dortmund.de>
Date: Fri Oct 15 01:37:42 2021 +0200
vkd3d-shader/spirv: Implement texel offset support for sample_c instructions.
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d-shader/spirv.c | 13 +++++++++----
tests/d3d12.c | 3 +--
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 58bf3d9..f9124fc 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -8235,12 +8235,9 @@ static void vkd3d_dxbc_compiler_emit_sample_c(struct vkd3d_dxbc_compiler *compil
SpvImageOperandsMask operands_mask = 0;
unsigned int image_operand_count = 0;
struct vkd3d_shader_image image;
- uint32_t image_operands[1];
+ uint32_t image_operands[2];
SpvOp op;
- if (vkd3d_shader_instruction_has_texel_offset(instruction))
- FIXME("Texel offset not supported.\n");
-
if (instruction->handler_idx == VKD3DSIH_SAMPLE_C_LZ)
{
op = SpvOpImageSampleDrefExplicitLod;
@@ -8255,6 +8252,14 @@ static void vkd3d_dxbc_compiler_emit_sample_c(struct vkd3d_dxbc_compiler *compil
vkd3d_dxbc_compiler_prepare_image(compiler,
&image, &src[1].reg, &src[2].reg, VKD3D_IMAGE_FLAG_SAMPLED | VKD3D_IMAGE_FLAG_DEPTH);
+
+ if (vkd3d_shader_instruction_has_texel_offset(instruction))
+ {
+ operands_mask |= SpvImageOperandsConstOffsetMask;
+ image_operands[image_operand_count++] = vkd3d_dxbc_compiler_emit_texel_offset(compiler,
+ instruction, image.resource_type_info);
+ }
+
sampled_type_id = vkd3d_spirv_get_type_id(builder, image.sampled_type, 1);
coordinate_id = vkd3d_dxbc_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_ALL);
dref_id = vkd3d_dxbc_compiler_emit_load_src(compiler, &src[3], VKD3DSP_WRITEMASK_0);
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 93cd56d..c73e15b 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -14784,8 +14784,7 @@ static void test_sample_c_lz(void)
transition_resource_state(command_list, context.render_target,
D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
- todo_if(j && tests[i].d_ref > 0.0f)
- check_sub_resource_float(context.render_target, 0, queue, command_list, tests[i].expected, 2);
+ check_sub_resource_float(context.render_target, 0, queue, command_list, tests[i].expected, 2);
reset_command_list(command_list, context.allocator);
transition_resource_state(command_list, context.render_target,
More information about the wine-cvs
mailing list