mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Updated vkd3d-latest patchset
This commit is contained in:
parent
593249dcde
commit
a7df377561
@ -1,53 +0,0 @@
|
||||
From 30c7eb4c615cea3965b2f77c32cbbeff3b6749a2 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 7 Mar 2024 10:40:41 +1100
|
||||
Subject: [PATCH] Updated vkd3d to 36c123c0056abd227ddfaac37a2a0902ac2f4bc5.
|
||||
|
||||
1.12 Release
|
||||
---
|
||||
libs/vkd3d/include/private/vkd3d_common.h | 2 +-
|
||||
libs/vkd3d/libs/vkd3d-common/blob.c | 1 +
|
||||
libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c | 2 ++
|
||||
3 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libs/vkd3d/include/private/vkd3d_common.h b/libs/vkd3d/include/private/vkd3d_common.h
|
||||
index a9d709d10fe..2d950b4f7aa 100644
|
||||
--- a/libs/vkd3d/include/private/vkd3d_common.h
|
||||
+++ b/libs/vkd3d/include/private/vkd3d_common.h
|
||||
@@ -233,7 +233,7 @@ static inline unsigned int vkd3d_popcount(unsigned int v)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return __popcnt(v);
|
||||
-#elif defined(__MINGW32__)
|
||||
+#elif defined(HAVE_BUILTIN_POPCOUNT)
|
||||
return __builtin_popcount(v);
|
||||
#else
|
||||
v -= (v >> 1) & 0x55555555;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-common/blob.c b/libs/vkd3d/libs/vkd3d-common/blob.c
|
||||
index f60ef7db769..c2c6ad67804 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-common/blob.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-common/blob.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#define WIDL_C_INLINE_WRAPPERS
|
||||
#endif
|
||||
#define COBJMACROS
|
||||
+
|
||||
#define CONST_VTABLE
|
||||
#include "vkd3d.h"
|
||||
#include "vkd3d_blob.h"
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
||||
index 14a3fa778e5..46c0da2a2d7 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
+/* VKD3D_DEBUG_ENV_NAME("VKD3D_SHADER_DEBUG"); */
|
||||
+
|
||||
static inline int char_to_int(char c)
|
||||
{
|
||||
if ('0' <= c && c <= '9')
|
||||
--
|
||||
2.43.0
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,206 @@
|
||||
From 0b6ce29e931e2b02b75a4d76c3810a1049e56d67 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sun, 23 Jun 2024 15:40:43 +1000
|
||||
Subject: [PATCH] Updated vkd3d to ccb6150aabc7cce9e26a39366c611f5a7da789e4.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 2 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 110 ++++++++++++++++++--
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 4 +-
|
||||
3 files changed, 108 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
index 2290385da76..3665b99aed7 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
@@ -2582,7 +2582,7 @@ static void write_sm1_resource_load(struct hlsl_ctx *ctx, struct vkd3d_bytecode_
|
||||
|
||||
.srcs[0].type = D3DSPR_TEMP,
|
||||
.srcs[0].reg = coords->reg.id,
|
||||
- .srcs[0].swizzle = hlsl_swizzle_from_writemask(VKD3DSP_WRITEMASK_ALL),
|
||||
+ .srcs[0].swizzle = hlsl_swizzle_from_writemask(coords->reg.writemask),
|
||||
|
||||
.srcs[1].type = D3DSPR_SAMPLER,
|
||||
.srcs[1].reg = reg_id,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
index a2c89b15e4a..9c75c87d36e 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
@@ -1878,12 +1878,57 @@ static bool invert_swizzle(uint32_t *swizzle, unsigned int *writemask, unsigned
|
||||
return true;
|
||||
}
|
||||
|
||||
+static bool invert_swizzle_matrix(uint32_t *swizzle, unsigned int *writemask, unsigned int *ret_width)
|
||||
+{
|
||||
+ /* swizzle is 8 bits per component, each component is (from LSB) 4 bits X, then 4 bits Y.
|
||||
+ * components are indexed by their sources. i.e. the first component comes from the first
|
||||
+ * component of the rhs. */
|
||||
+ unsigned int i, j, bit = 0, inverted = 0, width, new_writemask = 0, new_swizzle = 0;
|
||||
+
|
||||
+ /* First, we filter the swizzle to remove components that aren't enabled by writemask. */
|
||||
+ for (i = 0; i < 4; ++i)
|
||||
+ {
|
||||
+ if (*writemask & (1 << i))
|
||||
+ {
|
||||
+ unsigned int s = (*swizzle >> (i * 8)) & 0xff;
|
||||
+ unsigned int x = s & 0xf, y = (s >> 4) & 0xf;
|
||||
+ unsigned int idx = x + y * 4;
|
||||
+ new_swizzle |= s << (bit++ * 8);
|
||||
+ if (new_writemask & (1 << idx))
|
||||
+ return false;
|
||||
+ new_writemask |= 1 << idx;
|
||||
+ }
|
||||
+ }
|
||||
+ width = bit;
|
||||
+
|
||||
+ /* Then we invert the swizzle. The resulting swizzle has 2 bits per component, because it's for the
|
||||
+ * incoming vector. */
|
||||
+ bit = 0;
|
||||
+ for (i = 0; i < 16; ++i)
|
||||
+ {
|
||||
+ for (j = 0; j < width; ++j)
|
||||
+ {
|
||||
+ unsigned int s = (new_swizzle >> (j * 8)) & 0xff;
|
||||
+ unsigned int x = s & 0xf, y = (s >> 4) & 0xf;
|
||||
+ unsigned int idx = x + y * 4;
|
||||
+ if (idx == i)
|
||||
+ inverted |= j << (bit++ * 2);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ *swizzle = inverted;
|
||||
+ *writemask = new_writemask;
|
||||
+ *ret_width = width;
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_node *lhs,
|
||||
enum parse_assign_op assign_op, struct hlsl_ir_node *rhs)
|
||||
{
|
||||
struct hlsl_type *lhs_type = lhs->data_type;
|
||||
struct hlsl_ir_node *copy;
|
||||
- unsigned int writemask = 0;
|
||||
+ unsigned int writemask = 0, width = 0;
|
||||
+ bool matrix_writemask = false;
|
||||
|
||||
if (assign_op == ASSIGN_OP_SUB)
|
||||
{
|
||||
@@ -1901,7 +1946,10 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct hlsl_blo
|
||||
}
|
||||
|
||||
if (hlsl_is_numeric_type(lhs_type))
|
||||
+ {
|
||||
writemask = (1 << lhs_type->dimx) - 1;
|
||||
+ width = lhs_type->dimx;
|
||||
+ }
|
||||
|
||||
if (!(rhs = add_implicit_conversion(ctx, block, rhs, lhs_type, &rhs->loc)))
|
||||
return NULL;
|
||||
@@ -1918,12 +1966,24 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct hlsl_blo
|
||||
struct hlsl_ir_swizzle *swizzle = hlsl_ir_swizzle(lhs);
|
||||
struct hlsl_ir_node *new_swizzle;
|
||||
uint32_t s = swizzle->swizzle;
|
||||
- unsigned int width;
|
||||
|
||||
- if (lhs->data_type->class == HLSL_CLASS_MATRIX)
|
||||
- hlsl_fixme(ctx, &lhs->loc, "Matrix assignment with a writemask.");
|
||||
+ assert(!matrix_writemask);
|
||||
|
||||
- if (!invert_swizzle(&s, &writemask, &width))
|
||||
+ if (swizzle->val.node->data_type->class == HLSL_CLASS_MATRIX)
|
||||
+ {
|
||||
+ if (swizzle->val.node->type != HLSL_IR_LOAD && swizzle->val.node->type != HLSL_IR_INDEX)
|
||||
+ {
|
||||
+ hlsl_fixme(ctx, &lhs->loc, "Unhandled source of matrix swizzle.");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if (!invert_swizzle_matrix(&s, &writemask, &width))
|
||||
+ {
|
||||
+ hlsl_error(ctx, &lhs->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_WRITEMASK, "Invalid writemask for matrix.");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ matrix_writemask = true;
|
||||
+ }
|
||||
+ else if (!invert_swizzle(&s, &writemask, &width))
|
||||
{
|
||||
hlsl_error(ctx, &lhs->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_WRITEMASK, "Invalid writemask.");
|
||||
return NULL;
|
||||
@@ -1971,7 +2031,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct hlsl_blo
|
||||
|
||||
dim_count = hlsl_sampler_dim_count(resource_type->sampler_dim);
|
||||
|
||||
- if (writemask != ((1u << resource_type->e.resource.format->dimx) - 1))
|
||||
+ if (width != resource_type->e.resource.format->dimx * resource_type->e.resource.format->dimy)
|
||||
hlsl_error(ctx, &lhs->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_WRITEMASK,
|
||||
"Resource store expressions must write to all components.");
|
||||
|
||||
@@ -1987,12 +2047,50 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct hlsl_blo
|
||||
hlsl_block_add_instr(block, store);
|
||||
hlsl_cleanup_deref(&resource_deref);
|
||||
}
|
||||
+ else if (matrix_writemask)
|
||||
+ {
|
||||
+ struct hlsl_deref deref;
|
||||
+ unsigned int i, j, k = 0;
|
||||
+
|
||||
+ hlsl_init_deref_from_index_chain(ctx, &deref, lhs);
|
||||
+
|
||||
+ for (i = 0; i < lhs->data_type->dimy; ++i)
|
||||
+ {
|
||||
+ for (j = 0; j < lhs->data_type->dimx; ++j)
|
||||
+ {
|
||||
+ struct hlsl_ir_node *load;
|
||||
+ struct hlsl_block store_block;
|
||||
+ const unsigned int idx = i * 4 + j;
|
||||
+ const unsigned int component = i * lhs->data_type->dimx + j;
|
||||
+
|
||||
+ if (!(writemask & (1 << idx)))
|
||||
+ continue;
|
||||
+
|
||||
+ if (!(load = hlsl_add_load_component(ctx, block, rhs, k++, &rhs->loc)))
|
||||
+ {
|
||||
+ hlsl_cleanup_deref(&deref);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (!hlsl_new_store_component(ctx, &store_block, &deref, component, load))
|
||||
+ {
|
||||
+ hlsl_cleanup_deref(&deref);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ hlsl_block_add_block(block, &store_block);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ hlsl_cleanup_deref(&deref);
|
||||
+ }
|
||||
else if (lhs->type == HLSL_IR_INDEX && hlsl_index_is_noncontiguous(hlsl_ir_index(lhs)))
|
||||
{
|
||||
struct hlsl_ir_index *row = hlsl_ir_index(lhs);
|
||||
struct hlsl_ir_node *mat = row->val.node;
|
||||
unsigned int i, k = 0;
|
||||
|
||||
+ assert(!matrix_writemask);
|
||||
+
|
||||
for (i = 0; i < mat->data_type->dimx; ++i)
|
||||
{
|
||||
struct hlsl_ir_node *cell, *load, *store, *c;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
index 09066a6191a..36270b159a5 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
@@ -4188,8 +4188,10 @@ static struct hlsl_reg allocate_numeric_registers_for_type(struct hlsl_ctx *ctx,
|
||||
{
|
||||
unsigned int reg_size = type->reg_size[HLSL_REGSET_NUMERIC];
|
||||
|
||||
+ /* FIXME: We could potentially pack structs or arrays more efficiently... */
|
||||
+
|
||||
if (type->class <= HLSL_CLASS_VECTOR)
|
||||
- return allocate_register(ctx, allocator, first_write, last_read, reg_size, type->dimx);
|
||||
+ return allocate_register(ctx, allocator, first_write, last_read, type->dimx, type->dimx);
|
||||
else
|
||||
return allocate_range(ctx, allocator, first_write, last_read, reg_size);
|
||||
}
|
||||
--
|
||||
2.43.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,355 +0,0 @@
|
||||
From ff5cec233618d8feefafc6d551634c080150ebd8 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 15 Jun 2024 08:36:52 +1000
|
||||
Subject: [PATCH] Updated vkd3d to d3ba810c98b4d2df260a527f74586a0b31408510.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/fx.c | 5 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.h | 1 +
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 2 +
|
||||
libs/vkd3d/libs/vkd3d/command.c | 128 ++++++++++++--------
|
||||
libs/vkd3d/libs/vkd3d/device.c | 12 +-
|
||||
libs/vkd3d/libs/vkd3d/vkd3d_private.h | 2 +
|
||||
6 files changed, 97 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/fx.c b/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
index bd3bba6a3d5..3ba0a9ba994 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
@@ -989,8 +989,7 @@ static void write_fx_4_numeric_variable(struct hlsl_ir_var *var, bool shared, st
|
||||
};
|
||||
struct hlsl_ctx *ctx = fx->ctx;
|
||||
|
||||
- /* Explicit bind point. */
|
||||
- if (var->reg_reservation.reg_type)
|
||||
+ if (var->has_explicit_bind_point)
|
||||
flags |= HAS_EXPLICIT_BIND_POINT;
|
||||
|
||||
type_offset = write_type(var->data_type, fx);
|
||||
@@ -1001,7 +1000,7 @@ static void write_fx_4_numeric_variable(struct hlsl_ir_var *var, bool shared, st
|
||||
put_u32(buffer, type_offset);
|
||||
|
||||
semantic_offset = put_u32(buffer, semantic_offset); /* Semantic */
|
||||
- put_u32(buffer, var->buffer_offset); /* Offset in the constant buffer */
|
||||
+ put_u32(buffer, var->buffer_offset * 4); /* Offset in the constant buffer, in bytes. */
|
||||
value_offset = put_u32(buffer, 0); /* Default value offset */
|
||||
put_u32(buffer, flags); /* Flags */
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.h b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
index 46042745f40..179cc219e68 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
@@ -492,6 +492,7 @@ struct hlsl_ir_var
|
||||
uint32_t is_param : 1;
|
||||
uint32_t is_separated_resource : 1;
|
||||
uint32_t is_synthetic : 1;
|
||||
+ uint32_t has_explicit_bind_point : 1;
|
||||
};
|
||||
|
||||
/* This struct is used to represent assignments in state block entries:
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
index fb108ad939f..09066a6191a 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
@@ -4791,6 +4791,7 @@ static void hlsl_calculate_buffer_offset(struct hlsl_ctx *ctx, struct hlsl_ir_va
|
||||
if (register_reservation)
|
||||
{
|
||||
var->buffer_offset = 4 * var->reg_reservation.reg_index;
|
||||
+ var->has_explicit_bind_point = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4823,6 +4824,7 @@ static void hlsl_calculate_buffer_offset(struct hlsl_ctx *ctx, struct hlsl_ir_va
|
||||
}
|
||||
}
|
||||
var->buffer_offset = var->reg_reservation.offset_index;
|
||||
+ var->has_explicit_bind_point = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/command.c b/libs/vkd3d/libs/vkd3d/command.c
|
||||
index 6e37209cb1a..6c463be8d60 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/command.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/command.c
|
||||
@@ -2025,7 +2025,8 @@ static void d3d12_command_list_invalidate_root_parameters(struct d3d12_command_l
|
||||
|
||||
static bool vk_barrier_parameters_from_d3d12_resource_state(unsigned int state, unsigned int stencil_state,
|
||||
const struct d3d12_resource *resource, VkQueueFlags vk_queue_flags, const struct vkd3d_vulkan_info *vk_info,
|
||||
- VkAccessFlags *access_mask, VkPipelineStageFlags *stage_flags, VkImageLayout *image_layout)
|
||||
+ VkAccessFlags *access_mask, VkPipelineStageFlags *stage_flags, VkImageLayout *image_layout,
|
||||
+ struct d3d12_device *device)
|
||||
{
|
||||
bool is_swapchain_image = resource && (resource->flags & VKD3D_RESOURCE_PRESENT_STATE_TRANSITION);
|
||||
VkPipelineStageFlags queue_shader_stages = 0;
|
||||
@@ -2035,8 +2036,9 @@ static bool vk_barrier_parameters_from_d3d12_resource_state(unsigned int state,
|
||||
queue_shader_stages |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT
|
||||
| VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT
|
||||
| VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT
|
||||
- | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT
|
||||
| VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
|
||||
+ if (device->vk_info.geometry_shaders)
|
||||
+ queue_shader_stages |= VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT;
|
||||
}
|
||||
if (vk_queue_flags & VK_QUEUE_COMPUTE_BIT)
|
||||
queue_shader_stages |= VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||
@@ -2054,7 +2056,7 @@ static bool vk_barrier_parameters_from_d3d12_resource_state(unsigned int state,
|
||||
{
|
||||
if (resource->present_state != D3D12_RESOURCE_STATE_PRESENT)
|
||||
return vk_barrier_parameters_from_d3d12_resource_state(resource->present_state, 0,
|
||||
- resource, vk_queue_flags, vk_info, access_mask, stage_flags, image_layout);
|
||||
+ resource, vk_queue_flags, vk_info, access_mask, stage_flags, image_layout, device);
|
||||
|
||||
*access_mask = VK_ACCESS_MEMORY_READ_BIT;
|
||||
*stage_flags = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||
@@ -2251,7 +2253,8 @@ static void d3d12_command_list_transition_resource_to_initial_state(struct d3d12
|
||||
VK_IMAGE_LAYOUT_PREINITIALIZED : VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
|
||||
if (!vk_barrier_parameters_from_d3d12_resource_state(resource->initial_state, 0,
|
||||
- resource, list->vk_queue_flags, vk_info, &barrier.dstAccessMask, &dst_stage_mask, &barrier.newLayout))
|
||||
+ resource, list->vk_queue_flags, vk_info, &barrier.dstAccessMask,
|
||||
+ &dst_stage_mask, &barrier.newLayout, list->device))
|
||||
{
|
||||
FIXME("Unhandled state %#x.\n", resource->initial_state);
|
||||
return;
|
||||
@@ -4277,13 +4280,15 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResourceBarrier(ID3D12GraphicsC
|
||||
}
|
||||
|
||||
if (!vk_barrier_parameters_from_d3d12_resource_state(state_before, stencil_state_before,
|
||||
- resource, list->vk_queue_flags, vk_info, &src_access_mask, &src_stage_mask, &layout_before))
|
||||
+ resource, list->vk_queue_flags, vk_info, &src_access_mask,
|
||||
+ &src_stage_mask, &layout_before, list->device))
|
||||
{
|
||||
FIXME("Unhandled state %#x.\n", state_before);
|
||||
continue;
|
||||
}
|
||||
if (!vk_barrier_parameters_from_d3d12_resource_state(state_after, stencil_state_after,
|
||||
- resource, list->vk_queue_flags, vk_info, &dst_access_mask, &dst_stage_mask, &layout_after))
|
||||
+ resource, list->vk_queue_flags, vk_info, &dst_access_mask,
|
||||
+ &dst_stage_mask, &layout_after, list->device))
|
||||
{
|
||||
FIXME("Unhandled state %#x.\n", state_after);
|
||||
continue;
|
||||
@@ -4303,7 +4308,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResourceBarrier(ID3D12GraphicsC
|
||||
|
||||
resource = unsafe_impl_from_ID3D12Resource(uav->pResource);
|
||||
vk_barrier_parameters_from_d3d12_resource_state(D3D12_RESOURCE_STATE_UNORDERED_ACCESS, 0,
|
||||
- resource, list->vk_queue_flags, vk_info, &access_mask, &stage_mask, &image_layout);
|
||||
+ resource, list->vk_queue_flags, vk_info, &access_mask,
|
||||
+ &stage_mask, &image_layout, list->device);
|
||||
src_access_mask = dst_access_mask = access_mask;
|
||||
src_stage_mask = dst_stage_mask = stage_mask;
|
||||
layout_before = layout_after = image_layout;
|
||||
@@ -5428,6 +5434,52 @@ static const struct vkd3d_format *vkd3d_fixup_clear_uav_uint_colour(struct d3d12
|
||||
}
|
||||
}
|
||||
|
||||
+static struct vkd3d_view *create_uint_view(struct d3d12_device *device, const struct vkd3d_resource_view *view,
|
||||
+ struct d3d12_resource *resource, VkClearColorValue *colour)
|
||||
+{
|
||||
+ struct vkd3d_texture_view_desc view_desc;
|
||||
+ const struct vkd3d_format *uint_format;
|
||||
+ struct vkd3d_view *uint_view;
|
||||
+
|
||||
+ if (!(uint_format = vkd3d_find_uint_format(device, view->format->dxgi_format))
|
||||
+ && !(uint_format = vkd3d_fixup_clear_uav_uint_colour(device, view->format->dxgi_format, colour)))
|
||||
+ {
|
||||
+ ERR("Unhandled format %#x.\n", view->format->dxgi_format);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (d3d12_resource_is_buffer(resource))
|
||||
+ {
|
||||
+ if (!vkd3d_create_buffer_view(device, VKD3D_DESCRIPTOR_MAGIC_UAV, resource->u.vk_buffer,
|
||||
+ uint_format, view->info.buffer.offset, view->info.buffer.size, &uint_view))
|
||||
+ {
|
||||
+ ERR("Failed to create buffer view.\n");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return uint_view;
|
||||
+ }
|
||||
+
|
||||
+ memset(&view_desc, 0, sizeof(view_desc));
|
||||
+ view_desc.view_type = view->info.texture.vk_view_type;
|
||||
+ view_desc.format = uint_format;
|
||||
+ view_desc.miplevel_idx = view->info.texture.miplevel_idx;
|
||||
+ view_desc.miplevel_count = 1;
|
||||
+ view_desc.layer_idx = view->info.texture.layer_idx;
|
||||
+ view_desc.layer_count = view->info.texture.layer_count;
|
||||
+ view_desc.vk_image_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
+ view_desc.usage = VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
+
|
||||
+ if (!vkd3d_create_texture_view(device, VKD3D_DESCRIPTOR_MAGIC_UAV,
|
||||
+ resource->u.vk_image, &view_desc, &uint_view))
|
||||
+ {
|
||||
+ ERR("Failed to create image view.\n");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return uint_view;
|
||||
+}
|
||||
+
|
||||
static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID3D12GraphicsCommandList5 *iface,
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE gpu_handle, D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle, ID3D12Resource *resource,
|
||||
const UINT values[4], UINT rect_count, const D3D12_RECT *rects)
|
||||
@@ -5435,8 +5487,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
|
||||
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList5(iface);
|
||||
struct vkd3d_view *descriptor, *uint_view = NULL;
|
||||
struct d3d12_device *device = list->device;
|
||||
- struct vkd3d_texture_view_desc view_desc;
|
||||
- const struct vkd3d_format *uint_format;
|
||||
const struct vkd3d_resource_view *view;
|
||||
struct d3d12_resource *resource_impl;
|
||||
VkClearColorValue colour;
|
||||
@@ -5450,44 +5500,11 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
|
||||
view = &descriptor->v;
|
||||
memcpy(colour.uint32, values, sizeof(colour.uint32));
|
||||
|
||||
- if (view->format->type != VKD3D_FORMAT_TYPE_UINT)
|
||||
+ if (view->format->type != VKD3D_FORMAT_TYPE_UINT
|
||||
+ && !(descriptor = uint_view = create_uint_view(device, view, resource_impl, &colour)))
|
||||
{
|
||||
- if (!(uint_format = vkd3d_find_uint_format(device, view->format->dxgi_format))
|
||||
- && !(uint_format = vkd3d_fixup_clear_uav_uint_colour(device, view->format->dxgi_format, &colour)))
|
||||
- {
|
||||
- ERR("Unhandled format %#x.\n", view->format->dxgi_format);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (d3d12_resource_is_buffer(resource_impl))
|
||||
- {
|
||||
- if (!vkd3d_create_buffer_view(device, VKD3D_DESCRIPTOR_MAGIC_UAV, resource_impl->u.vk_buffer,
|
||||
- uint_format, view->info.buffer.offset, view->info.buffer.size, &uint_view))
|
||||
- {
|
||||
- ERR("Failed to create buffer view.\n");
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- memset(&view_desc, 0, sizeof(view_desc));
|
||||
- view_desc.view_type = view->info.texture.vk_view_type;
|
||||
- view_desc.format = uint_format;
|
||||
- view_desc.miplevel_idx = view->info.texture.miplevel_idx;
|
||||
- view_desc.miplevel_count = 1;
|
||||
- view_desc.layer_idx = view->info.texture.layer_idx;
|
||||
- view_desc.layer_count = view->info.texture.layer_count;
|
||||
- view_desc.vk_image_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
- view_desc.usage = VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
-
|
||||
- if (!vkd3d_create_texture_view(device, VKD3D_DESCRIPTOR_MAGIC_UAV, resource_impl->u.vk_image, &view_desc,
|
||||
- &uint_view))
|
||||
- {
|
||||
- ERR("Failed to create image view.\n");
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
- descriptor = uint_view;
|
||||
+ ERR("Failed to create UINT view.\n");
|
||||
+ return;
|
||||
}
|
||||
|
||||
d3d12_command_list_clear_uav(list, resource_impl, descriptor, &colour, rect_count, rects);
|
||||
@@ -5501,19 +5518,32 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewFloat(I
|
||||
const float values[4], UINT rect_count, const D3D12_RECT *rects)
|
||||
{
|
||||
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList5(iface);
|
||||
+ struct vkd3d_view *descriptor, *uint_view = NULL;
|
||||
+ struct d3d12_device *device = list->device;
|
||||
+ const struct vkd3d_resource_view *view;
|
||||
struct d3d12_resource *resource_impl;
|
||||
VkClearColorValue colour;
|
||||
- struct vkd3d_view *view;
|
||||
|
||||
TRACE("iface %p, gpu_handle %s, cpu_handle %s, resource %p, values %p, rect_count %u, rects %p.\n",
|
||||
iface, debug_gpu_handle(gpu_handle), debug_cpu_handle(cpu_handle), resource, values, rect_count, rects);
|
||||
|
||||
resource_impl = unsafe_impl_from_ID3D12Resource(resource);
|
||||
- if (!(view = d3d12_desc_from_cpu_handle(cpu_handle)->s.u.view))
|
||||
+ if (!(descriptor = d3d12_desc_from_cpu_handle(cpu_handle)->s.u.view))
|
||||
return;
|
||||
+ view = &descriptor->v;
|
||||
memcpy(colour.float32, values, sizeof(colour.float32));
|
||||
|
||||
- d3d12_command_list_clear_uav(list, resource_impl, view, &colour, rect_count, rects);
|
||||
+ if (view->format->type == VKD3D_FORMAT_TYPE_SINT
|
||||
+ && !(descriptor = uint_view = create_uint_view(device, view, resource_impl, &colour)))
|
||||
+ {
|
||||
+ ERR("Failed to create UINT view.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ d3d12_command_list_clear_uav(list, resource_impl, descriptor, &colour, rect_count, rects);
|
||||
+
|
||||
+ if (uint_view)
|
||||
+ vkd3d_view_decref(uint_view, device);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d12_command_list_DiscardResource(ID3D12GraphicsCommandList5 *iface,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c
|
||||
index c27a96e2df8..674e46fe5c5 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/device.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/device.c
|
||||
@@ -76,6 +76,14 @@ static const char * const required_device_extensions[] =
|
||||
VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME,
|
||||
};
|
||||
|
||||
+/* In general we don't want to enable Vulkan beta extensions, but make an
|
||||
+ * exception for VK_KHR_portability_subset because we draw no real feature from
|
||||
+ * it, but it's still useful to be able to develop for MoltenVK without being
|
||||
+ * spammed with validation errors. */
|
||||
+#ifndef VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME
|
||||
+#define VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME "VK_KHR_portability_subset"
|
||||
+#endif
|
||||
+
|
||||
static const struct vkd3d_optional_extension_info optional_device_extensions[] =
|
||||
{
|
||||
/* KHR extensions */
|
||||
@@ -85,6 +93,7 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] =
|
||||
VK_EXTENSION(KHR_IMAGE_FORMAT_LIST, KHR_image_format_list),
|
||||
VK_EXTENSION(KHR_MAINTENANCE2, KHR_maintenance2),
|
||||
VK_EXTENSION(KHR_MAINTENANCE3, KHR_maintenance3),
|
||||
+ VK_EXTENSION(KHR_PORTABILITY_SUBSET, KHR_portability_subset),
|
||||
VK_EXTENSION(KHR_PUSH_DESCRIPTOR, KHR_push_descriptor),
|
||||
VK_EXTENSION(KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE, KHR_sampler_mirror_clamp_to_edge),
|
||||
VK_EXTENSION(KHR_TIMELINE_SEMAPHORE, KHR_timeline_semaphore),
|
||||
@@ -92,7 +101,7 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] =
|
||||
VK_EXTENSION(EXT_4444_FORMATS, EXT_4444_formats),
|
||||
VK_EXTENSION(EXT_CALIBRATED_TIMESTAMPS, EXT_calibrated_timestamps),
|
||||
VK_EXTENSION(EXT_CONDITIONAL_RENDERING, EXT_conditional_rendering),
|
||||
- VK_EXTENSION(EXT_DEBUG_MARKER, EXT_debug_marker),
|
||||
+ VK_DEBUG_EXTENSION(EXT_DEBUG_MARKER, EXT_debug_marker),
|
||||
VK_EXTENSION(EXT_DEPTH_CLIP_ENABLE, EXT_depth_clip_enable),
|
||||
VK_EXTENSION(EXT_DESCRIPTOR_INDEXING, EXT_descriptor_indexing),
|
||||
VK_EXTENSION(EXT_FRAGMENT_SHADER_INTERLOCK, EXT_fragment_shader_interlock),
|
||||
@@ -1634,6 +1643,7 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
|
||||
|
||||
vulkan_info->device_limits = physical_device_info->properties2.properties.limits;
|
||||
vulkan_info->sparse_properties = physical_device_info->properties2.properties.sparseProperties;
|
||||
+ vulkan_info->geometry_shaders = physical_device_info->features2.features.geometryShader;
|
||||
vulkan_info->sparse_binding = features->sparseBinding;
|
||||
vulkan_info->sparse_residency_3d = features->sparseResidencyImage3D;
|
||||
vulkan_info->rasterization_stream = physical_device_info->xfb_properties.transformFeedbackRasterizationStreamSelect;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
index d1fa866d9e3..a55e967cdfc 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
@@ -123,6 +123,7 @@ struct vkd3d_vulkan_info
|
||||
bool KHR_image_format_list;
|
||||
bool KHR_maintenance2;
|
||||
bool KHR_maintenance3;
|
||||
+ bool KHR_portability_subset;
|
||||
bool KHR_push_descriptor;
|
||||
bool KHR_sampler_mirror_clamp_to_edge;
|
||||
bool KHR_timeline_semaphore;
|
||||
@@ -145,6 +146,7 @@ struct vkd3d_vulkan_info
|
||||
|
||||
bool rasterization_stream;
|
||||
bool transform_feedback_queries;
|
||||
+ bool geometry_shaders;
|
||||
|
||||
bool uav_read_without_format;
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
Loading…
Reference in New Issue
Block a user