mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/msl: Implement VKD3DSIH_SAMPLE_B.
This commit is contained in:
Notes:
Henri Verbeet
2025-06-23 20:18:16 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1565
@@ -967,6 +967,9 @@ static void msl_sample(struct msl_generator *gen, const struct vkd3d_shader_inst
|
||||
enum vkd3d_data_type data_type;
|
||||
uint32_t coord_mask;
|
||||
struct msl_dst dst;
|
||||
bool bias;
|
||||
|
||||
bias = ins->opcode == VKD3DSIH_SAMPLE_B;
|
||||
|
||||
if (vkd3d_shader_instruction_has_texel_offset(ins))
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
@@ -1001,6 +1004,11 @@ static void msl_sample(struct msl_generator *gen, const struct vkd3d_shader_inst
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_UNSUPPORTED,
|
||||
"Sampling resource type %#x is not supported.", resource_type);
|
||||
|
||||
if ((resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_1D || resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_1DARRAY)
|
||||
&& bias)
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_UNSUPPORTED,
|
||||
"Resource type %#x does not support mipmapping.", resource_type);
|
||||
|
||||
if (!(resource_type_info = msl_get_resource_type_info(resource_type)))
|
||||
{
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
@@ -1062,6 +1070,12 @@ static void msl_sample(struct msl_generator *gen, const struct vkd3d_shader_inst
|
||||
msl_print_src_with_type(sample, gen, &ins->src[0], coord_mask + 1, ins->src[0].reg.data_type);
|
||||
vkd3d_string_buffer_printf(sample, ")");
|
||||
}
|
||||
if (bias)
|
||||
{
|
||||
vkd3d_string_buffer_printf(sample, ", bias(");
|
||||
msl_print_src_with_type(sample, gen, &ins->src[3], VKD3DSP_WRITEMASK_0, ins->src[3].reg.data_type);
|
||||
vkd3d_string_buffer_printf(sample, ")");
|
||||
}
|
||||
vkd3d_string_buffer_printf(sample, "))");
|
||||
msl_print_swizzle(sample, ins->src[1].swizzle, ins->dst[0].write_mask);
|
||||
|
||||
@@ -1238,6 +1252,7 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
msl_cast(gen, ins, "uint");
|
||||
break;
|
||||
case VKD3DSIH_SAMPLE:
|
||||
case VKD3DSIH_SAMPLE_B:
|
||||
msl_sample(gen, ins);
|
||||
break;
|
||||
case VKD3DSIH_GEO:
|
||||
|
Reference in New Issue
Block a user