From: Philip Rebohle philip.rebohle@tu-dortmund.de
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- v2: Rebase of patch 215486.
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 58bf3d9c..f9124fc4 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 93cd56db..c73e15bc 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,