mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
libs/vkd3d-shader: Implement sample_l.
This commit is contained in:
parent
5b8d1fbdd5
commit
99b72d4db1
@ -1246,13 +1246,18 @@ static uint32_t vkd3d_spirv_build_op_image(struct vkd3d_spirv_builder *builder,
|
||||
SpvOpImage, result_type, sampled_image_id);
|
||||
}
|
||||
|
||||
static uint32_t vkd3d_spirv_build_op_image_sample_implicit_lod(struct vkd3d_spirv_builder *builder,
|
||||
uint32_t result_type, uint32_t sampled_image_id, uint32_t coordinate_id,
|
||||
static uint32_t vkd3d_spirv_build_op_image_sample(struct vkd3d_spirv_builder *builder,
|
||||
SpvOp op, uint32_t result_type, uint32_t sampled_image_id, uint32_t coordinate_id,
|
||||
uint32_t image_operands, const uint32_t *operands, unsigned int operand_count)
|
||||
{
|
||||
unsigned int i = 0, j;
|
||||
uint32_t w[10];
|
||||
|
||||
if (op == SpvOpImageSampleExplicitLod)
|
||||
assert(image_operands & SpvImageOperandsLodMask);
|
||||
else
|
||||
assert(op == SpvOpImageSampleImplicitLod);
|
||||
|
||||
w[i++] = sampled_image_id;
|
||||
w[i++] = coordinate_id;
|
||||
if (image_operands)
|
||||
@ -1263,7 +1268,7 @@ static uint32_t vkd3d_spirv_build_op_image_sample_implicit_lod(struct vkd3d_spir
|
||||
w[i++] = operands[j];
|
||||
}
|
||||
return vkd3d_spirv_build_op_trv(builder, &builder->function_stream,
|
||||
SpvOpImageSampleImplicitLod, result_type, w, i);
|
||||
op, result_type, w, i);
|
||||
}
|
||||
|
||||
static uint32_t vkd3d_spirv_build_op_image_sample_dref(struct vkd3d_spirv_builder *builder,
|
||||
@ -4390,7 +4395,27 @@ static void vkd3d_dxbc_compiler_emit_sample(struct vkd3d_dxbc_compiler *compiler
|
||||
const struct vkd3d_shader_src_param *src = instruction->src;
|
||||
struct vkd3d_shader_dst_param dst = *instruction->dst;
|
||||
uint32_t sampled_type_id, coordinate_id, val_id;
|
||||
SpvImageOperandsMask operands_mask = 0;
|
||||
unsigned int image_operand_count = 0;
|
||||
struct vkd3d_shader_image image;
|
||||
uint32_t image_operands[1];
|
||||
SpvOp op;
|
||||
|
||||
switch (instruction->handler_idx)
|
||||
{
|
||||
case VKD3DSIH_SAMPLE:
|
||||
op = SpvOpImageSampleImplicitLod;
|
||||
break;
|
||||
case VKD3DSIH_SAMPLE_LOD:
|
||||
op = SpvOpImageSampleExplicitLod;
|
||||
operands_mask |= SpvImageOperandsLodMask;
|
||||
image_operands[image_operand_count++] = vkd3d_dxbc_compiler_emit_load_src(compiler,
|
||||
&src[3], VKD3DSP_WRITEMASK_0);
|
||||
break;
|
||||
default:
|
||||
ERR("Unexpected instruction %#x.\n", instruction->handler_idx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vkd3d_shader_instruction_has_texel_offset(instruction))
|
||||
FIXME("Texel offset not supported.\n");
|
||||
@ -4399,8 +4424,8 @@ static void vkd3d_dxbc_compiler_emit_sample(struct vkd3d_dxbc_compiler *compiler
|
||||
&src[1].reg, &src[2].reg, VKD3D_IMAGE_FLAG_NONE);
|
||||
sampled_type_id = vkd3d_spirv_get_type_id(builder, image.sampled_type, VKD3D_VEC4_SIZE);
|
||||
coordinate_id = vkd3d_dxbc_compiler_emit_load_src(compiler, &src[0], VKD3DSP_WRITEMASK_ALL);
|
||||
val_id = vkd3d_spirv_build_op_image_sample_implicit_lod(builder, sampled_type_id,
|
||||
image.sampled_image_id, coordinate_id, SpvImageOperandsMaskNone, NULL, 0);
|
||||
val_id = vkd3d_spirv_build_op_image_sample(builder, op, sampled_type_id,
|
||||
image.sampled_image_id, coordinate_id, operands_mask, image_operands, image_operand_count);
|
||||
|
||||
val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler,
|
||||
val_id, image.sampled_type, src[1].swizzle, dst.write_mask);
|
||||
@ -5181,6 +5206,7 @@ void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler
|
||||
vkd3d_dxbc_compiler_emit_ld(compiler, instruction);
|
||||
break;
|
||||
case VKD3DSIH_SAMPLE:
|
||||
case VKD3DSIH_SAMPLE_LOD:
|
||||
vkd3d_dxbc_compiler_emit_sample(compiler, instruction);
|
||||
break;
|
||||
case VKD3DSIH_SAMPLE_C:
|
||||
|
Loading…
x
Reference in New Issue
Block a user