mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d: Send typed UAV unknown format read support info to vkd3d-shader.
Fixes reflections in Control appearing with only their red component. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52146 Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
This commit is contained in:
parent
971ab01add
commit
4afe69d04a
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
@ -1464,6 +1464,7 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
|
||||
vulkan_info->sparse_properties = physical_device_info->properties2.properties.sparseProperties;
|
||||
vulkan_info->rasterization_stream = physical_device_info->xfb_properties.transformFeedbackRasterizationStreamSelect;
|
||||
vulkan_info->transform_feedback_queries = physical_device_info->xfb_properties.transformFeedbackQueries;
|
||||
vulkan_info->uav_read_without_format = features->shaderStorageImageReadWithoutFormat;
|
||||
vulkan_info->max_vertex_attrib_divisor = max(physical_device_info->vertex_divisor_properties.maxVertexAttribDivisor, 1);
|
||||
|
||||
device->feature_options.DoublePrecisionFloatShaderOps = features->shaderFloat64;
|
||||
|
@ -1944,6 +1944,13 @@ struct d3d12_pipeline_state *unsafe_impl_from_ID3D12PipelineState(ID3D12Pipeline
|
||||
return impl_from_ID3D12PipelineState(iface);
|
||||
}
|
||||
|
||||
static inline unsigned int typed_uav_compile_option(const struct d3d12_device *device)
|
||||
{
|
||||
return device->vk_info.uav_read_without_format
|
||||
? VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_UNKNOWN
|
||||
: VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_R32;
|
||||
}
|
||||
|
||||
static HRESULT create_shader_stage(struct d3d12_device *device,
|
||||
struct VkPipelineShaderStageCreateInfo *stage_desc, enum VkShaderStageFlagBits stage,
|
||||
const D3D12_SHADER_BYTECODE *code, const struct vkd3d_shader_interface_info *shader_interface)
|
||||
@ -1955,9 +1962,10 @@ static HRESULT create_shader_stage(struct d3d12_device *device,
|
||||
VkResult vr;
|
||||
int ret;
|
||||
|
||||
static const struct vkd3d_shader_compile_option options[] =
|
||||
const struct vkd3d_shader_compile_option options[] =
|
||||
{
|
||||
{VKD3D_SHADER_COMPILE_OPTION_API_VERSION, VKD3D_SHADER_API_VERSION_1_4},
|
||||
{VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV, typed_uav_compile_option(device)},
|
||||
};
|
||||
|
||||
stage_desc->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
@ -2001,14 +2009,15 @@ static HRESULT create_shader_stage(struct d3d12_device *device,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static int vkd3d_scan_dxbc(const D3D12_SHADER_BYTECODE *code,
|
||||
static int vkd3d_scan_dxbc(const struct d3d12_device *device, const D3D12_SHADER_BYTECODE *code,
|
||||
struct vkd3d_shader_scan_descriptor_info *descriptor_info)
|
||||
{
|
||||
struct vkd3d_shader_compile_info compile_info;
|
||||
|
||||
static const struct vkd3d_shader_compile_option options[] =
|
||||
const struct vkd3d_shader_compile_option options[] =
|
||||
{
|
||||
{VKD3D_SHADER_COMPILE_OPTION_API_VERSION, VKD3D_SHADER_API_VERSION_1_4},
|
||||
{VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV, typed_uav_compile_option(device)},
|
||||
};
|
||||
|
||||
compile_info.type = VKD3D_SHADER_STRUCTURE_TYPE_COMPILE_INFO;
|
||||
@ -2170,7 +2179,7 @@ static HRESULT d3d12_pipeline_state_find_and_init_uav_counters(struct d3d12_pipe
|
||||
|
||||
shader_info.type = VKD3D_SHADER_STRUCTURE_TYPE_SCAN_DESCRIPTOR_INFO;
|
||||
shader_info.next = NULL;
|
||||
if ((ret = vkd3d_scan_dxbc(code, &shader_info)) < 0)
|
||||
if ((ret = vkd3d_scan_dxbc(device, code, &shader_info)) < 0)
|
||||
{
|
||||
WARN("Failed to scan shader bytecode, stage %#x, vkd3d result %d.\n", stage_flags, ret);
|
||||
return hresult_from_vkd3d_result(ret);
|
||||
|
@ -143,6 +143,8 @@ struct vkd3d_vulkan_info
|
||||
bool rasterization_stream;
|
||||
bool transform_feedback_queries;
|
||||
|
||||
bool uav_read_without_format;
|
||||
|
||||
bool vertex_attrib_zero_divisor;
|
||||
unsigned int max_vertex_attrib_divisor;
|
||||
|
||||
|
@ -590,6 +590,21 @@ static bool is_stencil_ref_export_supported(ID3D12Device *device)
|
||||
return options.PSSpecifiedStencilRefSupported;
|
||||
}
|
||||
|
||||
static bool are_typed_uav_load_additional_formats_supported(ID3D12Device *device)
|
||||
{
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS options;
|
||||
HRESULT hr;
|
||||
|
||||
if (FAILED(hr = ID3D12Device_CheckFeatureSupport(device,
|
||||
D3D12_FEATURE_D3D12_OPTIONS, &options, sizeof(options))))
|
||||
{
|
||||
trace("Failed to check feature support, hr %#x.\n", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return options.TypedUAVLoadAdditionalFormats;
|
||||
}
|
||||
|
||||
#define create_cb_root_signature(a, b, c, e) create_cb_root_signature_(__LINE__, a, b, c, e)
|
||||
static ID3D12RootSignature *create_cb_root_signature_(unsigned int line,
|
||||
ID3D12Device *device, unsigned int reg_idx, D3D12_SHADER_VISIBILITY shader_visibility,
|
||||
@ -21094,7 +21109,8 @@ static void test_typed_buffer_uav(void)
|
||||
D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
|
||||
get_buffer_readback_with_command_list(resource, uav_desc.Format, &rb, queue, command_list);
|
||||
todo check_readback_data_vec4(&rb.rb, NULL, &expected_ld, 0);
|
||||
todo_if(!are_typed_uav_load_additional_formats_supported(device))
|
||||
check_readback_data_vec4(&rb.rb, NULL, &expected_ld, 0);
|
||||
release_resource_readback(&rb);
|
||||
|
||||
ID3D12Resource_Release(resource);
|
||||
|
Loading…
x
Reference in New Issue
Block a user