mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader: Introduce a compile option to use Unknown format for typed UAV loads.
Specifying R32 for UAVs created with a vector format, e.g. R32G32B32A32_FLOAT, results in only the red being loaded/stored, potentially causing images to contain only the red component. Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
This commit is contained in:
committed by
Alexandre Julliard
parent
d7554accbc
commit
3dbd2ceca6
Notes:
Alexandre Julliard
2022-10-18 00:13:00 +02:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/2
@@ -2228,6 +2228,7 @@ struct vkd3d_dxbc_compiler
|
||||
|
||||
bool strip_debug;
|
||||
bool ssbo_uavs;
|
||||
bool uav_read_without_format;
|
||||
|
||||
struct rb_tree symbol_table;
|
||||
uint32_t temp_id;
|
||||
@@ -2379,6 +2380,15 @@ struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader
|
||||
|
||||
case VKD3D_SHADER_COMPILE_OPTION_API_VERSION:
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV:
|
||||
if (option->value == VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_R32)
|
||||
compiler->uav_read_without_format = false;
|
||||
else if (option->value == VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_UNKNOWN)
|
||||
compiler->uav_read_without_format = true;
|
||||
else
|
||||
WARN("Ignoring unrecognised value %#x for option %#x.\n", option->value, option->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5856,14 +5866,18 @@ static uint32_t vkd3d_dxbc_compiler_get_image_type_id(struct vkd3d_dxbc_compiler
|
||||
const struct vkd3d_shader_descriptor_info *d;
|
||||
uint32_t sampled_type_id;
|
||||
SpvImageFormat format;
|
||||
bool uav_read;
|
||||
|
||||
format = SpvImageFormatUnknown;
|
||||
if (reg->type == VKD3DSPR_UAV)
|
||||
{
|
||||
d = vkd3d_dxbc_compiler_get_descriptor_info(compiler,
|
||||
VKD3D_SHADER_DESCRIPTOR_TYPE_UAV, range);
|
||||
if (raw_structured || (d->flags & VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_READ))
|
||||
uav_read = !!(d->flags & VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_READ);
|
||||
if (raw_structured || (uav_read && !compiler->uav_read_without_format))
|
||||
format = image_format_for_image_read(data_type);
|
||||
else if (uav_read)
|
||||
vkd3d_spirv_enable_capability(builder, SpvCapabilityStorageImageReadWithoutFormat);
|
||||
}
|
||||
|
||||
sampled_type_id = vkd3d_spirv_get_type_id(builder, data_type, 1);
|
||||
|
Reference in New Issue
Block a user