Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50123 Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/utils.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 233cd49209f..22b893b8745 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -4142,7 +4142,7 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format, {WINED3DFMT_D32_FLOAT_S8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, }, {WINED3DFMT_R32_FLOAT_X8X24_TYPELESS, VK_FORMAT_D32_SFLOAT_S8_UINT, }, {WINED3DFMT_X32_TYPELESS_G8X24_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, }, - {WINED3DFMT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT, }, + {WINED3DFMT_D24_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, }, }; VkFormat vk_format = VK_FORMAT_UNDEFINED; VkImageFormatProperties image_properties; @@ -4182,6 +4182,16 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format, format->f.flags[WINED3D_GL_RES_TYPE_BUFFER] |= WINED3DFMT_FLAG_VERTEX_ATTRIBUTE; if (properties.bufferFeatures & VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT) format->f.flags[WINED3D_GL_RES_TYPE_BUFFER] |= WINED3DFMT_FLAG_TEXTURE; + if (vk_format == VK_FORMAT_D24_UNORM_S8_UINT) + { + if (~properties.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) + { + /* AMD doesn't support VK_FORMAT_D24_UNORM_S8_UINT. */ + WARN("Mapping VK_FORMAT_D24_UNORM_S8_UINT to VK_FORMAT_D32_SFLOAT_S8_UINT.\n"); + + format->vk_format = vk_format = VK_FORMAT_D32_SFLOAT_S8_UINT; + } + }
flags = 0; texture_flags = properties.linearTilingFeatures | properties.optimalTilingFeatures;
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50119 Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/swapchain.c | 32 ++++++++++++++++++++++++++++++-- dlls/wined3d/wined3d_private.h | 1 + 2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 72e17a6f833..ab04a771d68 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -998,6 +998,9 @@ static HRESULT wined3d_swapchain_vk_create_vulkan_swapchain(struct wined3d_swapc goto fail; }
+ swapchain_vk->width = width; + swapchain_vk->height = height; + return WINED3D_OK;
fail: @@ -1043,12 +1046,17 @@ static void wined3d_swapchain_vk_blit(struct wined3d_swapchain_vk *swapchain_vk, unsigned int present_idx; VkImageLayout vk_layout; uint32_t image_idx; + RECT dst_rect_tmp; VkImageBlit blit; + VkFilter filter; VkResult vr; HRESULT hr;
static const VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
+ TRACE("swapchain_vk %p, context_vk %p, src_rect %s, dst_rect %s, swap_interval %u.\n", + swapchain_vk, context_vk, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), swap_interval); + wined3d_swapchain_vk_set_swap_interval(swapchain_vk, swap_interval);
present_idx = swapchain_vk->current++ % swapchain_vk->image_count; @@ -1071,6 +1079,18 @@ static void wined3d_swapchain_vk_blit(struct wined3d_swapchain_vk *swapchain_vk, return; }
+ if (dst_rect->right >= swapchain_vk->width || dst_rect->bottom >= swapchain_vk->height) + { + dst_rect_tmp = *dst_rect; + if (dst_rect->right >= swapchain_vk->width) + dst_rect_tmp.right = swapchain_vk->width - 1; + if (dst_rect->bottom >= swapchain_vk->height) + dst_rect_tmp.bottom = swapchain_vk->height - 1; + dst_rect = &dst_rect_tmp; + } + filter = src_rect->right - src_rect->left != dst_rect->right - dst_rect->left + || src_rect->bottom - src_rect->top != dst_rect->bottom - dst_rect->top + ? VK_FILTER_LINEAR : VK_FILTER_NEAREST; vk_command_buffer = wined3d_context_vk_get_command_buffer(context_vk);
wined3d_context_vk_end_current_render_pass(context_vk); @@ -1108,7 +1128,7 @@ static void wined3d_swapchain_vk_blit(struct wined3d_swapchain_vk *swapchain_vk, VK_CALL(vkCmdBlitImage(vk_command_buffer, back_buffer_vk->vk_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, swapchain_vk->vk_images[image_idx], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, - 1, &blit, VK_FILTER_NEAREST)); + 1, &blit, filter));
wined3d_context_vk_reference_texture(context_vk, back_buffer_vk); wined3d_context_vk_image_barrier(context_vk, vk_command_buffer, @@ -1142,8 +1162,16 @@ static void wined3d_swapchain_vk_blit(struct wined3d_swapchain_vk *swapchain_vk, present_desc.pSwapchains = &swapchain_vk->vk_swapchain; present_desc.pImageIndices = &image_idx; present_desc.pResults = NULL; - if ((vr = VK_CALL(vkQueuePresentKHR(device_vk->vk_queue, &present_desc)))) + vr = VK_CALL(vkQueuePresentKHR(device_vk->vk_queue, &present_desc)); + if (vr == VK_ERROR_OUT_OF_DATE_KHR) + { + if (FAILED(hr = wined3d_swapchain_vk_recreate(swapchain_vk))) + ERR("Failed to recreate swapchain, hr %#x.\n", hr); + } + else if (vr) + { ERR("Present returned vr %s.\n", wined3d_debug_vkresult(vr)); + } }
static void wined3d_swapchain_vk_rotate(struct wined3d_swapchain *swapchain, struct wined3d_context_vk *context_vk) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 56d3ef8fea2..349a1766fba 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -5280,6 +5280,7 @@ struct wined3d_swapchain_vk uint64_t command_buffer_id; } *vk_semaphores; unsigned int current, image_count; + unsigned int width, height; };
static inline struct wined3d_swapchain_vk *wined3d_swapchain_vk(struct wined3d_swapchain *swapchain)
March 5, 2021 10:06 AM, "Matteo Bruni" mbruni@codeweavers.com wrote:
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 72e17a6f833..ab04a771d68 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1142,8 +1162,16 @@ static void wined3d_swapchain_vk_blit(struct wined3d_swapchain_vk *swapchain_vk, present_desc.pSwapchains = &swapchain_vk->vk_swapchain; present_desc.pImageIndices = &image_idx; present_desc.pResults = NULL;
- if ((vr = VK_CALL(vkQueuePresentKHR(device_vk->vk_queue, &present_desc))))
- vr = VK_CALL(vkQueuePresentKHR(device_vk->vk_queue, &present_desc));
- if (vr == VK_ERROR_OUT_OF_DATE_KHR)
What about VK_SUBOPTIMAL_KHR?
Chip
On Fri, 5 Mar 2021 at 17:06, Matteo Bruni mbruni@codeweavers.com wrote:
- if (dst_rect->right >= swapchain_vk->width || dst_rect->bottom >= swapchain_vk->height)
- {
dst_rect_tmp = *dst_rect;
if (dst_rect->right >= swapchain_vk->width)
dst_rect_tmp.right = swapchain_vk->width - 1;
if (dst_rect->bottom >= swapchain_vk->height)
dst_rect_tmp.bottom = swapchain_vk->height - 1;
dst_rect = &dst_rect_tmp;
- }
That's off by one. (And indeed, causes rows of missing pixels along the bottom and right of the window, as well as some blurriness.)
@@ -1142,8 +1162,16 @@ static void wined3d_swapchain_vk_blit(struct wined3d_swapchain_vk *swapchain_vk, present_desc.pSwapchains = &swapchain_vk->vk_swapchain; present_desc.pImageIndices = &image_idx; present_desc.pResults = NULL;
- if ((vr = VK_CALL(vkQueuePresentKHR(device_vk->vk_queue, &present_desc))))
- vr = VK_CALL(vkQueuePresentKHR(device_vk->vk_queue, &present_desc));
- if (vr == VK_ERROR_OUT_OF_DATE_KHR)
- {
if (FAILED(hr = wined3d_swapchain_vk_recreate(swapchain_vk)))
ERR("Failed to recreate swapchain, hr %#x.\n", hr);
- }
- else if (vr)
- { ERR("Present returned vr %s.\n", wined3d_debug_vkresult(vr));
- }
}
That's probably fine for typical games, but should we perhaps retry the blit for applications that present infrequently?
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/glsl_shader.c | 108 +++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 51 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 45eebcc2c20..9ba024ed3c7 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2541,9 +2541,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c shader_addline(buffer, "vec4 tmp0;\n"); shader_addline(buffer, "vec4 tmp1;\n"); if (gl_info->supported[ARB_GPU_SHADER5]) - shader_addline(buffer, "precise vec4 tmp_precise;\n"); + shader_addline(buffer, "precise vec4 tmp_precise[2];\n"); else - shader_addline(buffer, "/* precise */ vec4 tmp_precise;\n"); + shader_addline(buffer, "/* precise */ vec4 tmp_precise[2];\n");
if (!shader->load_local_constsF) { @@ -3270,7 +3270,7 @@ static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction * /* Append the destination part of the instruction to the buffer, return the effective write mask */ static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer, const struct wined3d_shader_instruction *ins, const struct wined3d_shader_dst_param *dst, - enum wined3d_data_type data_type) + unsigned int dst_idx, enum wined3d_data_type data_type) { struct glsl_dst_param glsl_dst; DWORD mask; @@ -3278,7 +3278,7 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer, if ((mask = shader_glsl_add_dst_param(ins, dst, &glsl_dst))) { if (ins->flags & WINED3DSI_PRECISE_XYZW) - sprintf(glsl_dst.reg_name, "tmp_precise"); + sprintf(glsl_dst.reg_name, "tmp_precise[%u]", dst_idx);
switch (data_type) { @@ -3312,44 +3312,50 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer, /* Append the destination part of the instruction to the buffer, return the effective write mask */ static DWORD shader_glsl_append_dst(struct wined3d_string_buffer *buffer, const struct wined3d_shader_instruction *ins) { - return shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], ins->dst[0].reg.data_type); + return shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], 0, ins->dst[0].reg.data_type); }
/** Process GLSL instruction modifiers */ static void shader_glsl_add_instruction_modifiers(const struct wined3d_shader_instruction *ins) { + const struct wined3d_shader_dst_param *dst; struct glsl_dst_param dst_param; DWORD modifiers; + unsigned int i;
- if (!ins->dst_count) return; - - if (ins->flags & WINED3DSI_PRECISE_XYZW) + for (i = 0; i < ins->dst_count; ++i) { - shader_glsl_add_dst_param(ins, &ins->dst[0], &dst_param); - shader_addline(ins->ctx->buffer, "%s%s = tmp_precise%s;\n", - dst_param.reg_name, dst_param.mask_str, dst_param.mask_str); - } + if ((dst = &ins->dst[i])->reg.type == WINED3DSPR_NULL) + continue;
- modifiers = ins->dst[0].modifiers; - if (!modifiers) return; + if (ins->flags & WINED3DSI_PRECISE_XYZW) + { + shader_glsl_add_dst_param(ins, dst, &dst_param); + shader_addline(ins->ctx->buffer, "%s%s = tmp_precise[%u]%s;\n", + dst_param.reg_name, dst_param.mask_str, i, dst_param.mask_str); + }
- shader_glsl_add_dst_param(ins, &ins->dst[0], &dst_param); + if (!(modifiers = dst->modifiers)) + continue;
- if (modifiers & WINED3DSPDM_SATURATE) - { - /* _SAT means to clamp the value of the register to between 0 and 1 */ - shader_addline(ins->ctx->buffer, "%s%s = clamp(%s%s, 0.0, 1.0);\n", dst_param.reg_name, - dst_param.mask_str, dst_param.reg_name, dst_param.mask_str); - } + shader_glsl_add_dst_param(ins, dst, &dst_param);
- if (modifiers & WINED3DSPDM_MSAMPCENTROID) - { - FIXME("_centroid modifier not handled\n"); - } + if (modifiers & WINED3DSPDM_SATURATE) + { + /* _SAT means to clamp the value of the register to between 0 and 1 */ + shader_addline(ins->ctx->buffer, "%s%s = clamp(%s%s, 0.0, 1.0);\n", dst_param.reg_name, + dst_param.mask_str, dst_param.reg_name, dst_param.mask_str); + }
- if (modifiers & WINED3DSPDM_PARTIALPRECISION) - { - /* MSDN says this modifier can be safely ignored, so that's what we'll do. */ + if (modifiers & WINED3DSPDM_MSAMPCENTROID) + { + FIXME("_centroid modifier not handled\n"); + } + + if (modifiers & WINED3DSPDM_PARTIALPRECISION) + { + /* MSDN says this modifier can be safely ignored, so that's what we'll do. */ + } } }
@@ -3606,7 +3612,7 @@ static void PRINTF_ATTR(9, 10) shader_glsl_gen_sample_code(const struct wined3d_ fixup = COLOR_FIXUP_IDENTITY; }
- shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &ins->dst[0], sample_function->data_type); + shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &ins->dst[0], 0, sample_function->data_type);
if (sample_function->output_single_component) shader_addline(ins->ctx->buffer, "vec4("); @@ -3837,7 +3843,7 @@ static void shader_glsl_mul_extended(const struct wined3d_shader_instruction *in
if (ins->dst[1].reg.type != WINED3DSPR_NULL) { - write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], ins->dst[1].reg.data_type); + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], 1, ins->dst[1].reg.data_type); shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param);
@@ -3864,17 +3870,17 @@ static void shader_glsl_udiv(const struct wined3d_shader_instruction *ins) shader_addline(buffer, "tmp0%s = uintBitsToFloat(%s / %s);\n", dst_mask, src0_param.param_str, src1_param.param_str);
- write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], ins->dst[1].reg.data_type); + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], 1, ins->dst[1].reg.data_type); shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); shader_addline(buffer, "%s %% %s);\n", src0_param.param_str, src1_param.param_str);
- shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_DATA_FLOAT); + shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], 0, WINED3D_DATA_FLOAT); shader_addline(buffer, "tmp0%s);\n", dst_mask); } else { - write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], ins->dst[0].reg.data_type); + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], 0, ins->dst[0].reg.data_type); shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); shader_addline(buffer, "%s / %s);\n", src0_param.param_str, src1_param.param_str); @@ -3882,7 +3888,7 @@ static void shader_glsl_udiv(const struct wined3d_shader_instruction *ins) } else if (ins->dst[1].reg.type != WINED3DSPR_NULL) { - write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], ins->dst[1].reg.data_type); + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], 1, ins->dst[1].reg.data_type); shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); shader_addline(buffer, "%s %% %s);\n", src0_param.param_str, src1_param.param_str); @@ -4106,7 +4112,7 @@ static void shader_glsl_float16(const struct wined3d_shader_instruction *ins) { dst.write_mask = ins->dst[0].write_mask & (WINED3DSP_WRITEMASK_0 << i); if (!(write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins, - &dst, dst.reg.data_type))) + &dst, 0, dst.reg.data_type))) continue;
shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src); @@ -4149,7 +4155,7 @@ static void shader_glsl_bitwise_op(const struct wined3d_shader_instruction *ins) if (tmp_dst && (write_mask = shader_glsl_get_write_mask(&dst, mask_char))) shader_addline(buffer, "tmp0%s = %sBitsToFloat(", mask_char, dst.reg.data_type == WINED3D_DATA_INT ? "int" : "uint"); - else if (!(write_mask = shader_glsl_append_dst_ext(buffer, ins, &dst, dst.reg.data_type))) + else if (!(write_mask = shader_glsl_append_dst_ext(buffer, ins, &dst, 0, dst.reg.data_type))) continue;
for (j = 0; j < ins->src_count; ++j) @@ -4162,7 +4168,7 @@ static void shader_glsl_bitwise_op(const struct wined3d_shader_instruction *ins)
if (tmp_dst) { - shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_DATA_FLOAT); + shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], 0, WINED3D_DATA_FLOAT); shader_glsl_get_write_mask(&ins->dst[0], mask_char); shader_addline(buffer, "tmp0%s);\n", mask_char); } @@ -4395,7 +4401,7 @@ static void shader_glsl_swapc(const struct wined3d_shader_instruction *ins) dst[j].write_mask = ins->dst[j].write_mask & (WINED3DSP_WRITEMASK_0 << i); if (tmp_dst[j] && (write_mask = shader_glsl_get_write_mask(&dst[j], mask_char))) shader_addline(buffer, "tmp%u%s = (", j, mask_char); - else if (!(write_mask = shader_glsl_append_dst_ext(buffer, ins, &dst[j], dst[j].reg.data_type))) + else if (!(write_mask = shader_glsl_append_dst_ext(buffer, ins, &dst[j], j, dst[j].reg.data_type))) continue;
for (k = 0; k < ARRAY_SIZE(src); ++k) @@ -4411,7 +4417,7 @@ static void shader_glsl_swapc(const struct wined3d_shader_instruction *ins) if (tmp_dst[i]) { shader_glsl_get_write_mask(&ins->dst[i], mask_char); - shader_glsl_append_dst_ext(buffer, ins, &ins->dst[i], ins->dst[i].reg.data_type); + shader_glsl_append_dst_ext(buffer, ins, &ins->dst[i], i, ins->dst[i].reg.data_type); shader_addline(buffer, "tmp%u%s);\n", i, mask_char); } } @@ -4501,7 +4507,7 @@ static void shader_glsl_conditional_move(const struct wined3d_shader_instruction continue; shader_addline(ins->ctx->buffer, "tmp0%s = (", mask_char); } - else if (!(write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst, dst.reg.data_type))) + else if (!(write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst, 0, dst.reg.data_type))) continue;
shader_glsl_add_src_param(ins, &ins->src[0], cmp_channel, &src0_param); @@ -4779,23 +4785,23 @@ static void shader_glsl_sincos(const struct wined3d_shader_instruction *ins) shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_addline(buffer, "tmp0%s = sin(%s);\n", dst_mask, src0_param.param_str);
- write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], ins->dst[1].reg.data_type); + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], 1, ins->dst[1].reg.data_type); shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_addline(buffer, "cos(%s));\n", src0_param.param_str);
- shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], ins->dst[0].reg.data_type); + shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], 0, ins->dst[0].reg.data_type); shader_addline(buffer, "tmp0%s);\n", dst_mask); } else { - write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], ins->dst[0].reg.data_type); + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], 0, ins->dst[0].reg.data_type); shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_addline(buffer, "sin(%s));\n", src0_param.param_str); } } else if (ins->dst[1].reg.type != WINED3DSPR_NULL) { - write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], ins->dst[1].reg.data_type); + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1], 1, ins->dst[1].reg.data_type); shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_addline(buffer, "cos(%s));\n", src0_param.param_str); } @@ -5461,7 +5467,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins) }
if (is_imm_instruction) - shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &ins->dst[0], data_type); + shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &ins->dst[0], 0, data_type);
if (is_tgsm) shader_addline(buffer, "%s(%s_%s%u[%s], ", @@ -5525,7 +5531,7 @@ static void shader_glsl_ld_uav(const struct wined3d_shader_instruction *ins) data_type = reg_maps->uav_resource_info[uav_idx].data_type; coord_mask = (1u << resource_type_info[resource_type].coord_size) - 1;
- write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &ins->dst[0], data_type); + write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &ins->dst[0], 0, data_type); shader_glsl_get_swizzle(&ins->src[1], FALSE, write_mask, dst_swizzle);
shader_glsl_add_src_param(ins, &ins->src[0], coord_mask, &image_coord_param); @@ -5605,7 +5611,7 @@ static void shader_glsl_ld_raw_structured(const struct wined3d_shader_instructio for (i = 0; i < 4; ++i) { dst.write_mask = ins->dst[0].write_mask & (WINED3DSP_WRITEMASK_0 << i); - if (!shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst, dst.reg.data_type)) + if (!shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst, 0, dst.reg.data_type)) continue;
swizzle = shader_glsl_swizzle_get_component(src->swizzle, i); @@ -5856,7 +5862,7 @@ static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins) return; }
- write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], dst_data_type); + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], 0, dst_data_type); shader_glsl_get_swizzle(&ins->src[1], FALSE, write_mask, dst_swizzle);
if (dst_data_type == WINED3D_DATA_UINT) @@ -5924,7 +5930,7 @@ static void shader_glsl_sample_info(const struct wined3d_shader_instruction *ins else if (ins->flags) FIXME("Unhandled flags %#x.\n", ins->flags);
- write_mask = shader_glsl_append_dst_ext(buffer, ins, dst, dst_data_type); + write_mask = shader_glsl_append_dst_ext(buffer, ins, dst, 0, dst_data_type); shader_glsl_get_swizzle(src, FALSE, write_mask, dst_swizzle);
if (dst_data_type == WINED3D_DATA_UINT) @@ -6093,7 +6099,7 @@ static void shader_glsl_gen_sample_c_lz_emulation(const struct wined3d_shader_in WARN("Emitting textureGrad() for sample_c_lz.\n");
shader_glsl_swizzle_to_str(WINED3DSP_NOSWIZZLE, FALSE, ins->dst[0].write_mask, dst_swizzle); - shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], sample_function->data_type); + shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], 0, sample_function->data_type); shader_addline(buffer, "vec4(textureGrad%s(%s_sampler%u, vec%u(%s, %s), vec%u(0.0), vec%u(0.0)", sample_function->offset_size ? "Offset" : "", shader_glsl_get_prefix(version->type), sampler_bind_idx, @@ -6197,7 +6203,7 @@ static void shader_glsl_gather4(const struct wined3d_shader_instruction *ins) shader_glsl_get_coord_size(resource_info->type, &coord_size, &offset_size);
shader_glsl_swizzle_to_str(ins->src[resource_param_idx].swizzle, FALSE, ins->dst[0].write_mask, dst_swizzle); - shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], resource_info->data_type); + shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], 0, resource_info->data_type);
shader_glsl_add_src_param(ins, &ins->src[0], (1u << coord_size) - 1, &coord_param);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/utils.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 22b893b8745..ec748c81013 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3134,6 +3134,9 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win && (format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_INTEGER)) continue;
+ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO && format->f.id == WINED3DFMT_D16_LOCKABLE) + continue; + format->internal = format_texture_info[i].gl_internal; format->srgb_internal = format_texture_info[i].gl_srgb_internal; format->rt_internal = format_texture_info[i].gl_rt_internal;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index ec748c81013..5fd3210022d 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3134,7 +3134,8 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win && (format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_INTEGER)) continue;
- if (wined3d_settings.offscreen_rendering_mode != ORM_FBO && format->f.id == WINED3DFMT_D16_LOCKABLE) + if (wined3d_settings.offscreen_rendering_mode != ORM_FBO + && (format->f.id == WINED3DFMT_D16_LOCKABLE || format->f.id == WINED3DFMT_NULL)) continue;
format->internal = format_texture_info[i].gl_internal;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
On Fri, 5 Mar 2021 at 17:06, Matteo Bruni mbruni@codeweavers.com wrote:
@@ -4182,6 +4182,16 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format, format->f.flags[WINED3D_GL_RES_TYPE_BUFFER] |= WINED3DFMT_FLAG_VERTEX_ATTRIBUTE; if (properties.bufferFeatures & VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT) format->f.flags[WINED3D_GL_RES_TYPE_BUFFER] |= WINED3DFMT_FLAG_TEXTURE;
- if (vk_format == VK_FORMAT_D24_UNORM_S8_UINT)
- {
if (~properties.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
{
/* AMD doesn't support VK_FORMAT_D24_UNORM_S8_UINT. */
WARN("Mapping VK_FORMAT_D24_UNORM_S8_UINT to VK_FORMAT_D32_SFLOAT_S8_UINT.\n");
format->vk_format = vk_format = VK_FORMAT_D32_SFLOAT_S8_UINT;
}
- }
This changes the Vulkan format, but doesn't re-query the properties of the new format.