mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/msl: Access resources as non-multisampled if the sample count is 1.
This commit is contained in:
committed by
Henri Verbeet
parent
6607b94ad7
commit
26c51f53b7
Notes:
Henri Verbeet
2025-09-09 15:10:03 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1702
@@ -943,8 +943,8 @@ static void msl_print_texel_offset(struct vkd3d_string_buffer *buffer, struct ms
|
||||
|
||||
static void msl_ld(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
unsigned int resource_id, resource_idx, resource_space, sample_count;
|
||||
const struct msl_resource_type_info *resource_type_info;
|
||||
unsigned int resource_id, resource_idx, resource_space;
|
||||
const struct vkd3d_shader_descriptor_info1 *descriptor;
|
||||
const struct vkd3d_shader_descriptor_binding *binding;
|
||||
enum vkd3d_shader_resource_type resource_type;
|
||||
@@ -969,6 +969,7 @@ static void msl_ld(struct msl_generator *gen, const struct vkd3d_shader_instruct
|
||||
{
|
||||
resource_type = descriptor->resource_type;
|
||||
resource_space = descriptor->register_space;
|
||||
sample_count = descriptor->sample_count;
|
||||
data_type = descriptor->resource_data_type;
|
||||
}
|
||||
else
|
||||
@@ -977,6 +978,7 @@ static void msl_ld(struct msl_generator *gen, const struct vkd3d_shader_instruct
|
||||
"Internal compiler error: Undeclared resource descriptor %u.", resource_id);
|
||||
resource_space = 0;
|
||||
resource_type = VKD3D_SHADER_RESOURCE_TEXTURE_2D;
|
||||
sample_count = 1;
|
||||
data_type = VSIR_DATA_F32;
|
||||
}
|
||||
|
||||
@@ -988,6 +990,16 @@ static void msl_ld(struct msl_generator *gen, const struct vkd3d_shader_instruct
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_UNSUPPORTED,
|
||||
"Texel fetches from resource type %#x are not supported.", resource_type);
|
||||
|
||||
if (sample_count == 1)
|
||||
{
|
||||
/* Similar to the SPIR-V and GLSL targets, we map multi-sample
|
||||
* textures with sample count 1 to their single-sample equivalents. */
|
||||
if (resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_2DMS)
|
||||
resource_type = VKD3D_SHADER_RESOURCE_TEXTURE_2D;
|
||||
else if (resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY)
|
||||
resource_type = VKD3D_SHADER_RESOURCE_TEXTURE_2DARRAY;
|
||||
}
|
||||
|
||||
if (!(resource_type_info = msl_get_resource_type_info(resource_type)))
|
||||
{
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
@@ -1030,6 +1042,10 @@ static void msl_ld(struct msl_generator *gen, const struct vkd3d_shader_instruct
|
||||
vkd3d_string_buffer_printf(read, ", ");
|
||||
if (ins->opcode != VSIR_OP_LD2DMS)
|
||||
msl_print_src_with_type(read, gen, &ins->src[0], VKD3DSP_WRITEMASK_3, VSIR_DATA_U32);
|
||||
else if (sample_count == 1)
|
||||
/* If the resource isn't a true multisample resource, this is the
|
||||
* "lod" parameter instead of the "sample" parameter. */
|
||||
vkd3d_string_buffer_printf(read, "0");
|
||||
else
|
||||
msl_print_src_with_type(read, gen, &ins->src[2], VKD3DSP_WRITEMASK_0, VSIR_DATA_U32);
|
||||
}
|
||||
|
Reference in New Issue
Block a user