-- v2: wined3d: Use VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_UNKNOWN if possible. wined3d: Invert gl_FragCoord w.
From: Elizabeth Figura zfigura@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57951 --- dlls/wined3d/glsl_shader.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 48943dbbe2a..1e3378ede1d 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -8043,6 +8043,7 @@ static GLuint shader_glsl_generate_fragment_shader(const struct wined3d_context_ shader_addline(buffer, "vpos = floor(gl_FragCoord);\n"); else shader_addline(buffer, "vpos = gl_FragCoord;\n"); + shader_addline(buffer, "vpos.w = 1 / vpos.w;\n"); }
if (reg_maps->shader_version.major < 3 || args->vp_mode != WINED3D_VP_MODE_SHADER)
From: Elizabeth Figura zfigura@codeweavers.com
Fixes red objects in Ultrakill. --- dlls/wined3d/adapter_vk.c | 1 + dlls/wined3d/shader_spirv.c | 29 +++++++++++++++++++---------- dlls/wined3d/wined3d_vk.h | 1 + 3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 8219c0728d4..ca11ec480d2 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -2366,6 +2366,7 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_ d3d_info->multisample_draw_location = WINED3D_LOCATION_TEXTURE_RGB;
vk_info->multiple_viewports = device_info.features2.features.multiViewport; + vk_info->uav_read_without_format = device_info.features2.features.shaderStorageImageReadWithoutFormat; vk_info->dynamic_state2 = device_info.dynamic_state2_features.extendedDynamicState2; vk_info->dynamic_patch_vertex_count = device_info.dynamic_state2_features.extendedDynamicState2PatchControlPoints;
diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index a033c69feec..8d6456d8956 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -24,12 +24,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
static const struct wined3d_shader_backend_ops spirv_shader_backend_vk;
-static const struct vkd3d_shader_compile_option spirv_compile_options[] = -{ - {VKD3D_SHADER_COMPILE_OPTION_API_VERSION, VKD3D_SHADER_API_VERSION_1_7}, - {VKD3D_SHADER_COMPILE_OPTION_WRITE_TESS_GEOM_POINT_SIZE, 0}, -}; - struct shader_spirv_resource_bindings { struct vkd3d_shader_resource_binding *bindings; @@ -53,6 +47,8 @@ struct shader_spirv_priv const struct wined3d_fragment_pipe_ops *fragment_pipe;
struct shader_spirv_resource_bindings bindings; + + struct vkd3d_shader_compile_option compile_options[3]; };
#define MAX_SM1_INTER_STAGE_VARYINGS 12 @@ -281,6 +277,7 @@ static VkShaderModule shader_spirv_compile_shader(struct wined3d_context_vk *con const struct shader_spirv_resource_bindings *bindings, const struct wined3d_stream_output_desc *so_desc) { struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device); + const struct shader_spirv_priv *priv = device_vk->d.shader_priv; const struct wined3d_vk_info *vk_info = &device_vk->vk_info; struct wined3d_shader_spirv_compile_args compile_args; struct wined3d_shader_spirv_shader_interface iface; @@ -302,8 +299,8 @@ static VkShaderModule shader_spirv_compile_shader(struct wined3d_context_vk *con info.source.size = shader_desc->byte_code_size; info.source_type = source_type; info.target_type = VKD3D_SHADER_TARGET_SPIRV_BINARY; - info.options = spirv_compile_options; - info.option_count = ARRAY_SIZE(spirv_compile_options); + info.options = priv->compile_options; + info.option_count = ARRAY_SIZE(priv->compile_options); info.log_level = VKD3D_SHADER_LOG_WARNING; info.source_name = NULL;
@@ -760,6 +757,7 @@ static void shader_spirv_scan_shader(struct wined3d_shader *shader, struct vkd3d_shader_scan_descriptor_info *descriptor_info, struct vkd3d_shader_scan_signature_info *signature_info) { + const struct shader_spirv_priv *priv = shader->device->shader_priv; struct vkd3d_shader_compile_info info; char *messages; int ret; @@ -788,8 +786,8 @@ static void shader_spirv_scan_shader(struct wined3d_shader *shader, } info.source_type = shader->source_type; info.target_type = VKD3D_SHADER_TARGET_SPIRV_BINARY; - info.options = spirv_compile_options; - info.option_count = ARRAY_SIZE(spirv_compile_options); + info.options = priv->compile_options; + info.option_count = ARRAY_SIZE(priv->compile_options); info.log_level = VKD3D_SHADER_LOG_WARNING; info.source_name = NULL;
@@ -1056,6 +1054,7 @@ static void shader_spirv_destroy(struct wined3d_shader *shader) static HRESULT shader_spirv_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe, const struct wined3d_fragment_pipe_ops *fragment_pipe) { + const struct wined3d_vk_info *vk_info = &wined3d_adapter_vk(device->adapter)->vk_info; void *vertex_priv, *fragment_priv; struct shader_spirv_priv *priv;
@@ -1085,6 +1084,16 @@ static HRESULT shader_spirv_alloc(struct wined3d_device *device, device->fragment_priv = fragment_priv; device->shader_priv = priv;
+ priv->compile_options[0].name = VKD3D_SHADER_COMPILE_OPTION_API_VERSION; + priv->compile_options[0].value = VKD3D_SHADER_API_VERSION_1_7; + priv->compile_options[1].name = VKD3D_SHADER_COMPILE_OPTION_WRITE_TESS_GEOM_POINT_SIZE; + priv->compile_options[1].value = 0; + priv->compile_options[2].name = VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV; + if (vk_info->uav_read_without_format) + priv->compile_options[2].value = VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_UNKNOWN; + else + priv->compile_options[2].value = VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_R32; + return WINED3D_OK; }
diff --git a/dlls/wined3d/wined3d_vk.h b/dlls/wined3d/wined3d_vk.h index fcc275490c7..f51acf8b0f4 100644 --- a/dlls/wined3d/wined3d_vk.h +++ b/dlls/wined3d/wined3d_vk.h @@ -277,6 +277,7 @@ struct wined3d_vk_info bool dynamic_multisample_state; bool dynamic_blend_state; bool dynamic_rasterizer_state; + bool uav_read_without_format; };
#define VK_CALL(f) (vk_info->vk_ops.f)
This merge request was approved by Jan Sikorski.