Updated vkd3d-latest patchset

This commit is contained in:
Alistair Leslie-Hughes 2024-08-20 07:49:47 +10:00
parent e780e2e62d
commit 41367bc540
8 changed files with 19238 additions and 18751 deletions

View File

@ -1,398 +0,0 @@
From fc4be1e672aa26b5eb27d1bfb280c23189664cb1 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 17 Jul 2024 08:43:16 +1000
Subject: [PATCH] Updated vkd3d to 0202393d41f00d8c9f20f59ec080b833b5436f5a.
---
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 20 +++
libs/vkd3d/libs/vkd3d-shader/hlsl.c | 1 +
libs/vkd3d/libs/vkd3d-shader/hlsl.h | 5 +-
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 174 +++++++++++++++++++-
libs/vkd3d/libs/vkd3d-shader/ir.c | 57 +++++++
5 files changed, 248 insertions(+), 9 deletions(-)
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
index abfbd461b33..492ad9b69fb 100644
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
@@ -2371,6 +2371,17 @@ static void d3dbc_write_per_component_unary_op(struct d3dbc_compiler *d3dbc,
}
}
+static void d3dbc_write_sincos(struct d3dbc_compiler *d3dbc, enum hlsl_ir_expr_op op,
+ const struct hlsl_reg *dst, const struct hlsl_reg *src)
+{
+ if (op == HLSL_OP1_COS_REDUCED)
+ assert(dst->writemask == VKD3DSP_WRITEMASK_0);
+ else /* HLSL_OP1_SIN_REDUCED */
+ assert(dst->writemask == VKD3DSP_WRITEMASK_1);
+
+ d3dbc_write_unary_op(d3dbc, D3DSIO_SINCOS, dst, src, 0, 0);
+}
+
static void d3dbc_write_expr(struct d3dbc_compiler *d3dbc, const struct hlsl_ir_node *instr)
{
const struct vkd3d_shader_version *version = &d3dbc->program->shader_version;
@@ -2439,6 +2450,11 @@ static void d3dbc_write_expr(struct d3dbc_compiler *d3dbc, const struct hlsl_ir_
d3dbc_write_per_component_unary_op(d3dbc, instr, D3DSIO_RSQ);
break;
+ case HLSL_OP1_COS_REDUCED:
+ case HLSL_OP1_SIN_REDUCED:
+ d3dbc_write_sincos(d3dbc, expr->op, &instr->reg, &arg1->reg);
+ break;
+
case HLSL_OP2_ADD:
d3dbc_write_binary_op(d3dbc, D3DSIO_ADD, &instr->reg, &arg1->reg, &arg2->reg);
break;
@@ -2499,6 +2515,10 @@ static void d3dbc_write_expr(struct d3dbc_compiler *d3dbc, const struct hlsl_ir_
d3dbc_write_dp2add(d3dbc, &instr->reg, &arg1->reg, &arg2->reg, &arg3->reg);
break;
+ case HLSL_OP3_MAD:
+ d3dbc_write_ternary_op(d3dbc, D3DSIO_MAD, &instr->reg, &arg1->reg, &arg2->reg, &arg3->reg);
+ break;
+
default:
hlsl_fixme(ctx, &instr->loc, "SM1 \"%s\" expression.", debug_hlsl_expr_op(expr->op));
break;
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.c b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
index acf50869a40..1526d7b02a9 100644
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
@@ -2849,6 +2849,7 @@ const char *debug_hlsl_expr_op(enum hlsl_ir_expr_op op)
[HLSL_OP3_CMP] = "cmp",
[HLSL_OP3_DP2ADD] = "dp2add",
[HLSL_OP3_TERNARY] = "ternary",
+ [HLSL_OP3_MAD] = "mad",
};
return op_names[op];
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.h b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
index 5832958712a..4411546e269 100644
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
@@ -645,7 +645,7 @@ enum hlsl_ir_expr_op
HLSL_OP1_CAST,
HLSL_OP1_CEIL,
HLSL_OP1_COS,
- HLSL_OP1_COS_REDUCED, /* Reduced range [-pi, pi] */
+ HLSL_OP1_COS_REDUCED, /* Reduced range [-pi, pi], writes to .x */
HLSL_OP1_DSX,
HLSL_OP1_DSX_COARSE,
HLSL_OP1_DSX_FINE,
@@ -666,7 +666,7 @@ enum hlsl_ir_expr_op
HLSL_OP1_SAT,
HLSL_OP1_SIGN,
HLSL_OP1_SIN,
- HLSL_OP1_SIN_REDUCED, /* Reduced range [-pi, pi] */
+ HLSL_OP1_SIN_REDUCED, /* Reduced range [-pi, pi], writes to .y */
HLSL_OP1_SQRT,
HLSL_OP1_TRUNC,
@@ -699,6 +699,7 @@ enum hlsl_ir_expr_op
* CMP(a, b, c) returns 'b' if 'a' >= 0, and 'c' otherwise. It's used only for SM1-SM3 targets. */
HLSL_OP3_CMP,
HLSL_OP3_TERNARY,
+ HLSL_OP3_MAD,
};
#define HLSL_MAX_OPERANDS 3
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
index 02884df9d76..26386c0b8df 100644
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
@@ -20,6 +20,7 @@
#include "hlsl.h"
#include <stdio.h>
+#include <math.h>
/* TODO: remove when no longer needed, only used for new_offset_instr_from_deref() */
static struct hlsl_ir_node *new_offset_from_path_index(struct hlsl_ctx *ctx, struct hlsl_block *block,
@@ -3016,6 +3017,108 @@ static bool lower_floor(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct
return true;
}
+/* Lower SIN/COS to SINCOS for SM1. */
+static bool lower_trig(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
+{
+ struct hlsl_ir_node *arg, *half, *two_pi, *reciprocal_two_pi, *neg_pi;
+ struct hlsl_constant_value half_value, two_pi_value, reciprocal_two_pi_value, neg_pi_value;
+ struct hlsl_ir_node *mad, *frc, *reduced;
+ struct hlsl_type *type;
+ struct hlsl_ir_expr *expr;
+ enum hlsl_ir_expr_op op;
+ struct hlsl_ir_node *sincos;
+ int i;
+
+ if (instr->type != HLSL_IR_EXPR)
+ return false;
+ expr = hlsl_ir_expr(instr);
+
+ if (expr->op == HLSL_OP1_SIN)
+ op = HLSL_OP1_SIN_REDUCED;
+ else if (expr->op == HLSL_OP1_COS)
+ op = HLSL_OP1_COS_REDUCED;
+ else
+ return false;
+
+ arg = expr->operands[0].node;
+ type = arg->data_type;
+
+ /* Reduce the range of the input angles to [-pi, pi]. */
+ for (i = 0; i < type->dimx; ++i)
+ {
+ half_value.u[i].f = 0.5;
+ two_pi_value.u[i].f = 2.0 * M_PI;
+ reciprocal_two_pi_value.u[i].f = 1.0 / (2.0 * M_PI);
+ neg_pi_value.u[i].f = -M_PI;
+ }
+
+ if (!(half = hlsl_new_constant(ctx, type, &half_value, &instr->loc))
+ || !(two_pi = hlsl_new_constant(ctx, type, &two_pi_value, &instr->loc))
+ || !(reciprocal_two_pi = hlsl_new_constant(ctx, type, &reciprocal_two_pi_value, &instr->loc))
+ || !(neg_pi = hlsl_new_constant(ctx, type, &neg_pi_value, &instr->loc)))
+ return false;
+ hlsl_block_add_instr(block, half);
+ hlsl_block_add_instr(block, two_pi);
+ hlsl_block_add_instr(block, reciprocal_two_pi);
+ hlsl_block_add_instr(block, neg_pi);
+
+ if (!(mad = hlsl_new_ternary_expr(ctx, HLSL_OP3_MAD, arg, reciprocal_two_pi, half)))
+ return false;
+ hlsl_block_add_instr(block, mad);
+ if (!(frc = hlsl_new_unary_expr(ctx, HLSL_OP1_FRACT, mad, &instr->loc)))
+ return false;
+ hlsl_block_add_instr(block, frc);
+ if (!(reduced = hlsl_new_ternary_expr(ctx, HLSL_OP3_MAD, frc, two_pi, neg_pi)))
+ return false;
+ hlsl_block_add_instr(block, reduced);
+
+ if (type->dimx == 1)
+ {
+ if (!(sincos = hlsl_new_unary_expr(ctx, op, reduced, &instr->loc)))
+ return false;
+ hlsl_block_add_instr(block, sincos);
+ }
+ else
+ {
+ struct hlsl_ir_node *comps[4] = {0};
+ struct hlsl_ir_var *var;
+ struct hlsl_deref var_deref;
+ struct hlsl_ir_load *var_load;
+
+ for (i = 0; i < type->dimx; ++i)
+ {
+ uint32_t s = hlsl_swizzle_from_writemask(1 << i);
+
+ if (!(comps[i] = hlsl_new_swizzle(ctx, s, 1, reduced, &instr->loc)))
+ return false;
+ hlsl_block_add_instr(block, comps[i]);
+ }
+
+ if (!(var = hlsl_new_synthetic_var(ctx, "sincos", type, &instr->loc)))
+ return false;
+ hlsl_init_simple_deref_from_var(&var_deref, var);
+
+ for (i = 0; i < type->dimx; ++i)
+ {
+ struct hlsl_block store_block;
+
+ if (!(sincos = hlsl_new_unary_expr(ctx, op, comps[i], &instr->loc)))
+ return false;
+ hlsl_block_add_instr(block, sincos);
+
+ if (!hlsl_new_store_component(ctx, &store_block, &var_deref, i, sincos))
+ return false;
+ hlsl_block_add_block(block, &store_block);
+ }
+
+ if (!(var_load = hlsl_new_load_index(ctx, &var_deref, NULL, &instr->loc)))
+ return false;
+ hlsl_block_add_instr(block, &var_load->node);
+ }
+
+ return true;
+}
+
static bool lower_logic_not(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
{
struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS];
@@ -4230,6 +4333,30 @@ static struct hlsl_reg allocate_register(struct hlsl_ctx *ctx, struct register_a
return ret;
}
+/* Allocate a register with writemask, while reserving reg_writemask. */
+static struct hlsl_reg allocate_register_with_masks(struct hlsl_ctx *ctx, struct register_allocator *allocator,
+ unsigned int first_write, unsigned int last_read, uint32_t reg_writemask, uint32_t writemask)
+{
+ struct hlsl_reg ret = {0};
+ uint32_t reg_idx;
+
+ assert((reg_writemask & writemask) == writemask);
+
+ for (reg_idx = 0;; ++reg_idx)
+ {
+ if ((get_available_writemask(allocator, first_write, last_read, reg_idx) & reg_writemask) == reg_writemask)
+ break;
+ }
+
+ record_allocation(ctx, allocator, reg_idx, reg_writemask, first_write, last_read);
+
+ ret.id = reg_idx;
+ ret.allocation_size = 1;
+ ret.writemask = writemask;
+ ret.allocated = true;
+ return ret;
+}
+
static bool is_range_available(const struct register_allocator *allocator,
unsigned int first_write, unsigned int last_read, uint32_t reg_idx, unsigned int reg_size)
{
@@ -4433,6 +4560,44 @@ static void calculate_resource_register_counts(struct hlsl_ctx *ctx)
}
}
+static void allocate_instr_temp_register(struct hlsl_ctx *ctx,
+ struct hlsl_ir_node *instr, struct register_allocator *allocator)
+{
+ unsigned int reg_writemask = 0, dst_writemask = 0;
+
+ if (instr->reg.allocated || !instr->last_read)
+ return;
+
+ if (instr->type == HLSL_IR_EXPR)
+ {
+ switch (hlsl_ir_expr(instr)->op)
+ {
+ case HLSL_OP1_COS_REDUCED:
+ dst_writemask = VKD3DSP_WRITEMASK_0;
+ reg_writemask = ctx->profile->major_version < 3 ? (1 << 3) - 1 : VKD3DSP_WRITEMASK_0;
+ break;
+
+ case HLSL_OP1_SIN_REDUCED:
+ dst_writemask = VKD3DSP_WRITEMASK_1;
+ reg_writemask = ctx->profile->major_version < 3 ? (1 << 3) - 1 : VKD3DSP_WRITEMASK_1;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (reg_writemask)
+ instr->reg = allocate_register_with_masks(ctx, allocator,
+ instr->index, instr->last_read, reg_writemask, dst_writemask);
+ else
+ instr->reg = allocate_numeric_registers_for_type(ctx, allocator,
+ instr->index, instr->last_read, instr->data_type);
+
+ TRACE("Allocated anonymous expression @%u to %s (liveness %u-%u).\n", instr->index,
+ debug_register('r', instr->reg, instr->data_type), instr->index, instr->last_read);
+}
+
static void allocate_variable_temp_register(struct hlsl_ctx *ctx,
struct hlsl_ir_var *var, struct register_allocator *allocator)
{
@@ -4472,13 +4637,7 @@ static void allocate_temp_registers_recurse(struct hlsl_ctx *ctx,
if (ctx->profile->major_version >= 4 && instr->type == HLSL_IR_CONSTANT)
continue;
- if (!instr->reg.allocated && instr->last_read)
- {
- instr->reg = allocate_numeric_registers_for_type(ctx, allocator, instr->index, instr->last_read,
- instr->data_type);
- TRACE("Allocated anonymous expression @%u to %s (liveness %u-%u).\n", instr->index,
- debug_register('r', instr->reg, instr->data_type), instr->index, instr->last_read);
- }
+ allocate_instr_temp_register(ctx, instr, allocator);
switch (instr->type)
{
@@ -6050,6 +6209,7 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
lower_ir(ctx, lower_round, body);
lower_ir(ctx, lower_ceil, body);
lower_ir(ctx, lower_floor, body);
+ lower_ir(ctx, lower_trig, body);
lower_ir(ctx, lower_comparison_operators, body);
lower_ir(ctx, lower_logic_not, body);
if (ctx->profile->type == VKD3D_SHADER_TYPE_PIXEL)
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
index be9e4219d6a..9202c77cadb 100644
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
@@ -377,6 +377,58 @@ static enum vkd3d_result vsir_program_lower_precise_mad(struct vsir_program *pro
return VKD3D_OK;
}
+static enum vkd3d_result vsir_program_lower_sm1_sincos(struct vsir_program *program,
+ struct vkd3d_shader_instruction *sincos)
+{
+ struct vkd3d_shader_instruction_array *instructions = &program->instructions;
+ size_t pos = sincos - instructions->elements;
+ struct vkd3d_shader_instruction *ins;
+ unsigned int s;
+
+ if (sincos->dst_count != 1)
+ return VKD3D_OK;
+
+ if (!shader_instruction_array_insert_at(instructions, pos + 1, 1))
+ return VKD3D_ERROR_OUT_OF_MEMORY;
+
+ ins = &instructions->elements[pos + 1];
+
+ if (!(vsir_instruction_init_with_params(program, ins, &sincos->location, VKD3DSIH_SINCOS, 2, 1)))
+ return VKD3D_ERROR_OUT_OF_MEMORY;
+
+ ins->flags = sincos->flags;
+
+ *ins->src = *sincos->src;
+ /* Set the source swizzle to replicate the first component. */
+ s = vsir_swizzle_get_component(sincos->src->swizzle, 0);
+ ins->src->swizzle = vkd3d_shader_create_swizzle(s, s, s, s);
+
+ if (sincos->dst->write_mask & VKD3DSP_WRITEMASK_1)
+ {
+ ins->dst[0] = *sincos->dst;
+ ins->dst[0].write_mask = VKD3DSP_WRITEMASK_1;
+ }
+ else
+ {
+ vsir_dst_param_init(&ins->dst[0], VKD3DSPR_NULL, VKD3D_DATA_UNUSED, 0);
+ }
+
+ if (sincos->dst->write_mask & VKD3DSP_WRITEMASK_0)
+ {
+ ins->dst[1] = *sincos->dst;
+ ins->dst[1].write_mask = VKD3DSP_WRITEMASK_0;
+ }
+ else
+ {
+ vsir_dst_param_init(&ins->dst[1], VKD3DSPR_NULL, VKD3D_DATA_UNUSED, 0);
+ }
+
+ /* Make the original instruction no-op */
+ vkd3d_shader_instruction_make_nop(sincos);
+
+ return VKD3D_OK;
+}
+
static enum vkd3d_result vsir_program_lower_instructions(struct vsir_program *program,
struct vkd3d_shader_message_context *message_context)
{
@@ -410,6 +462,11 @@ static enum vkd3d_result vsir_program_lower_instructions(struct vsir_program *pr
vkd3d_shader_instruction_make_nop(ins);
break;
+ case VKD3DSIH_SINCOS:
+ if ((ret = vsir_program_lower_sm1_sincos(program, ins)) < 0)
+ return ret;
+ break;
+
default:
break;
}
--
2.43.0

View File

@ -1,153 +0,0 @@
From 30a352b7adc39f9e6c120e90610663f253475b71 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 18 Jul 2024 10:01:10 +1000
Subject: [PATCH] Updated vkd3d to 7eb63a7c0d23a83bbdfcfa5ed83b943437051138.
---
libs/vkd3d/libs/vkd3d/command.c | 58 ++++++++++++++++-----------------
libs/vkd3d/libs/vkd3d/device.c | 4 ++-
2 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/libs/vkd3d/libs/vkd3d/command.c b/libs/vkd3d/libs/vkd3d/command.c
index 2354938c08d..a484da94092 100644
--- a/libs/vkd3d/libs/vkd3d/command.c
+++ b/libs/vkd3d/libs/vkd3d/command.c
@@ -2977,30 +2977,20 @@ static void d3d12_command_list_update_push_descriptors(struct d3d12_command_list
enum vkd3d_pipeline_bind_point bind_point)
{
struct vkd3d_pipeline_bindings *bindings = &list->pipeline_bindings[bind_point];
+ VkWriteDescriptorSet descriptor_writes[ARRAY_SIZE(bindings->push_descriptors)] = {0};
+ VkDescriptorBufferInfo buffer_infos[ARRAY_SIZE(bindings->push_descriptors)] = {0};
const struct d3d12_root_signature *root_signature = bindings->root_signature;
- VkWriteDescriptorSet *descriptor_writes = NULL, *current_descriptor_write;
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
- VkDescriptorBufferInfo *buffer_infos = NULL, *current_buffer_info;
const struct d3d12_root_parameter *root_parameter;
struct vkd3d_push_descriptor *push_descriptor;
struct d3d12_device *device = list->device;
VkDescriptorBufferInfo *vk_buffer_info;
- unsigned int i, descriptor_count;
+ unsigned int i, descriptor_count = 0;
VkBufferView *vk_buffer_view;
if (!bindings->push_descriptor_dirty_mask)
return;
- descriptor_count = vkd3d_popcount(bindings->push_descriptor_dirty_mask);
-
- if (!(descriptor_writes = vkd3d_calloc(descriptor_count, sizeof(*descriptor_writes))))
- return;
- if (!(buffer_infos = vkd3d_calloc(descriptor_count, sizeof(*buffer_infos))))
- goto done;
-
- descriptor_count = 0;
- current_buffer_info = buffer_infos;
- current_descriptor_write = descriptor_writes;
for (i = 0; i < ARRAY_SIZE(bindings->push_descriptors); ++i)
{
if (!(bindings->push_descriptor_dirty_mask & (1u << i)))
@@ -3012,7 +3002,7 @@ static void d3d12_command_list_update_push_descriptors(struct d3d12_command_list
if (root_parameter->parameter_type == D3D12_ROOT_PARAMETER_TYPE_CBV)
{
vk_buffer_view = NULL;
- vk_buffer_info = current_buffer_info;
+ vk_buffer_info = &buffer_infos[descriptor_count];
vk_buffer_info->buffer = push_descriptor->u.cbv.vk_buffer;
vk_buffer_info->offset = push_descriptor->u.cbv.offset;
vk_buffer_info->range = VK_WHOLE_SIZE;
@@ -3023,21 +3013,15 @@ static void d3d12_command_list_update_push_descriptors(struct d3d12_command_list
vk_buffer_info = NULL;
}
- if (!vk_write_descriptor_set_from_root_descriptor(current_descriptor_write,
+ if (!vk_write_descriptor_set_from_root_descriptor(&descriptor_writes[descriptor_count],
root_parameter, bindings->descriptor_sets[0], vk_buffer_view, vk_buffer_info))
continue;
++descriptor_count;
- ++current_descriptor_write;
- ++current_buffer_info;
}
VK_CALL(vkUpdateDescriptorSets(device->vk_device, descriptor_count, descriptor_writes, 0, NULL));
bindings->push_descriptor_dirty_mask = 0;
-
-done:
- vkd3d_free(descriptor_writes);
- vkd3d_free(buffer_infos);
}
static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_command_list *list,
@@ -5289,11 +5273,13 @@ static void d3d12_command_list_clear_uav(struct d3d12_command_list *list,
struct d3d12_resource *resource, struct vkd3d_view *descriptor, const VkClearColorValue *clear_colour,
unsigned int rect_count, const D3D12_RECT *rects)
{
+ const VkPhysicalDeviceLimits *device_limits = &list->device->vk_info.device_limits;
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
unsigned int i, miplevel_idx, layer_count;
struct vkd3d_uav_clear_pipeline pipeline;
struct vkd3d_uav_clear_args clear_args;
const struct vkd3d_resource_view *view;
+ uint32_t count_x, count_y, count_z;
VkDescriptorImageInfo image_info;
D3D12_RECT full_rect, curr_rect;
VkWriteDescriptorSet write_set;
@@ -5384,18 +5370,32 @@ static void d3d12_command_list_clear_uav(struct d3d12_command_list *list,
if (curr_rect.left >= curr_rect.right || curr_rect.top >= curr_rect.bottom)
continue;
- clear_args.offset.x = curr_rect.left;
clear_args.offset.y = curr_rect.top;
- clear_args.extent.width = curr_rect.right - curr_rect.left;
clear_args.extent.height = curr_rect.bottom - curr_rect.top;
- VK_CALL(vkCmdPushConstants(list->vk_command_buffer, pipeline.vk_pipeline_layout,
- VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(clear_args), &clear_args));
+ count_y = vkd3d_compute_workgroup_count(clear_args.extent.height, pipeline.group_size.height);
+ count_z = vkd3d_compute_workgroup_count(layer_count, pipeline.group_size.depth);
+ if (count_y > device_limits->maxComputeWorkGroupCount[1])
+ FIXME("Group Y count %u exceeds max %u.\n", count_y, device_limits->maxComputeWorkGroupCount[1]);
+ if (count_z > device_limits->maxComputeWorkGroupCount[2])
+ FIXME("Group Z count %u exceeds max %u.\n", count_z, device_limits->maxComputeWorkGroupCount[2]);
- VK_CALL(vkCmdDispatch(list->vk_command_buffer,
- vkd3d_compute_workgroup_count(clear_args.extent.width, pipeline.group_size.width),
- vkd3d_compute_workgroup_count(clear_args.extent.height, pipeline.group_size.height),
- vkd3d_compute_workgroup_count(layer_count, pipeline.group_size.depth)));
+ do
+ {
+ clear_args.offset.x = curr_rect.left;
+ clear_args.extent.width = curr_rect.right - curr_rect.left;
+
+ count_x = vkd3d_compute_workgroup_count(clear_args.extent.width, pipeline.group_size.width);
+ count_x = min(count_x, device_limits->maxComputeWorkGroupCount[0]);
+
+ VK_CALL(vkCmdPushConstants(list->vk_command_buffer, pipeline.vk_pipeline_layout,
+ VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(clear_args), &clear_args));
+
+ VK_CALL(vkCmdDispatch(list->vk_command_buffer, count_x, count_y, count_z));
+
+ curr_rect.left += count_x * pipeline.group_size.width;
+ }
+ while (curr_rect.right > curr_rect.left);
}
}
diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c
index 2bbc170504e..ff3e41e6b70 100644
--- a/libs/vkd3d/libs/vkd3d/device.c
+++ b/libs/vkd3d/libs/vkd3d/device.c
@@ -2563,7 +2563,9 @@ static void device_init_descriptor_pool_sizes(struct d3d12_device *device)
VKD3D_MAX_UAV_CLEAR_DESCRIPTORS_PER_TYPE);
pool_sizes[1].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
pool_sizes[1].descriptorCount = pool_sizes[0].descriptorCount;
- device->vk_pool_count = 2;
+ pool_sizes[2].type = VK_DESCRIPTOR_TYPE_SAMPLER;
+ pool_sizes[2].descriptorCount = min(limits->sampler_max_descriptors, D3D12_MAX_LIVE_STATIC_SAMPLERS);
+ device->vk_pool_count = 3;
return;
}
--
2.43.0