Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/wined3d/context_vk.c | 21 ++++++++++++++++----- dlls/wined3d/shader_spirv.c | 5 +++-- dlls/wined3d/wined3d_private.h | 5 ++++- 3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 8df416851f2..88d8080f5dd 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -1746,7 +1746,10 @@ static int wined3d_pipeline_layout_vk_compare(const void *key, const struct wine
if (a->binding_count != b->binding_count) return a->binding_count - b->binding_count; - return memcmp(a->bindings, b->bindings, a->binding_count * sizeof(*a->bindings)); + if (a->push_constant_count != b->push_constant_count) + return a->push_constant_count - b->push_constant_count; + return memcmp(a->bindings, b->bindings, a->binding_count * sizeof(*a->bindings)) || + memcmp(a->push_constants, b->push_constants, a->push_constant_count * sizeof(*a->push_constants)); }
static int wined3d_graphics_pipeline_vk_compare(const void *key, const struct wine_rb_entry *entry) @@ -2946,7 +2949,8 @@ static VkResult wined3d_context_vk_create_vk_descriptor_set_layout(struct wined3 }
struct wined3d_pipeline_layout_vk *wined3d_context_vk_get_pipeline_layout( - struct wined3d_context_vk *context_vk, VkDescriptorSetLayoutBinding *bindings, SIZE_T binding_count) + struct wined3d_context_vk *context_vk, VkDescriptorSetLayoutBinding *bindings, SIZE_T binding_count, + VkPushConstantRange *push_constants, SIZE_T push_constant_count) { struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device); const struct wined3d_vk_info *vk_info = context_vk->vk_info; @@ -2958,19 +2962,26 @@ struct wined3d_pipeline_layout_vk *wined3d_context_vk_get_pipeline_layout(
key.bindings = bindings; key.binding_count = binding_count; + key.push_constants = push_constants; + key.push_constant_count = push_constant_count; if ((entry = wine_rb_get(&context_vk->pipeline_layouts, &key))) return WINE_RB_ENTRY_VALUE(entry, struct wined3d_pipeline_layout_vk, entry);
if (!(layout = heap_alloc(sizeof(*layout)))) return NULL;
- if (!(layout->key.bindings = heap_alloc(sizeof(*layout->key.bindings) * key.binding_count))) + if (!(layout->key.bindings = heap_alloc(sizeof(*layout->key.bindings) * key.binding_count + + sizeof(*layout->key.push_constants) * key.push_constant_count))) { heap_free(layout); return NULL; } memcpy(layout->key.bindings, key.bindings, sizeof(*layout->key.bindings) * key.binding_count); layout->key.binding_count = key.binding_count; + layout->key.push_constants = (VkPushConstantRange *)(layout->key.bindings + key.binding_count); + memcpy(layout->key.push_constants, key.push_constants, + sizeof(*layout->key.push_constants) * key.push_constant_count); + layout->key.push_constant_count = key.push_constant_count;
if ((vr = wined3d_context_vk_create_vk_descriptor_set_layout(device_vk, vk_info, &key, &layout->vk_set_layout))) { @@ -2983,8 +2994,8 @@ struct wined3d_pipeline_layout_vk *wined3d_context_vk_get_pipeline_layout( layout_desc.flags = 0; layout_desc.setLayoutCount = 1; layout_desc.pSetLayouts = &layout->vk_set_layout; - layout_desc.pushConstantRangeCount = 0; - layout_desc.pPushConstantRanges = NULL; + layout_desc.pushConstantRangeCount = push_constant_count; + layout_desc.pPushConstantRanges = push_constants;
if ((vr = VK_CALL(vkCreatePipelineLayout(device_vk->vk_device, &layout_desc, NULL, &layout->vk_pipeline_layout))) < 0) diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index 7617ee9d6ef..185c5f78556 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -441,7 +441,7 @@ static struct shader_spirv_compute_program_vk *shader_spirv_find_compute_program return NULL;
if (!(layout = wined3d_context_vk_get_pipeline_layout(context_vk, - bindings->vk_bindings, bindings->vk_binding_count))) + bindings->vk_bindings, bindings->vk_binding_count, NULL, 0))) { VK_CALL(vkDestroyShaderModule(device_vk->vk_device, program->vk_module, NULL)); program->vk_module = VK_NULL_HANDLE; @@ -842,7 +842,8 @@ static void shader_spirv_select(void *shader_priv, struct wined3d_context *conte if (context->shader_update_mask & (1u << WINED3D_SHADER_TYPE_GEOMETRY)) context->shader_update_mask |= 1u << bindings->so_stage;
- layout_vk = wined3d_context_vk_get_pipeline_layout(context_vk, bindings->vk_bindings, bindings->vk_binding_count); + layout_vk = wined3d_context_vk_get_pipeline_layout(context_vk, bindings->vk_bindings, bindings->vk_binding_count, + NULL, 0); context_vk->graphics.vk_set_layout = layout_vk->vk_set_layout; context_vk->graphics.vk_pipeline_layout = layout_vk->vk_pipeline_layout;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 86eae149306..f7a8812c2bd 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2444,6 +2444,8 @@ struct wined3d_pipeline_layout_key_vk { VkDescriptorSetLayoutBinding *bindings; SIZE_T binding_count; + VkPushConstantRange *push_constants; + SIZE_T push_constant_count; };
struct wined3d_pipeline_layout_vk @@ -2646,7 +2648,8 @@ void wined3d_context_vk_destroy_vk_sampler(struct wined3d_context_vk *context_vk void wined3d_context_vk_end_current_render_pass(struct wined3d_context_vk *context_vk) DECLSPEC_HIDDEN; VkCommandBuffer wined3d_context_vk_get_command_buffer(struct wined3d_context_vk *context_vk) DECLSPEC_HIDDEN; struct wined3d_pipeline_layout_vk *wined3d_context_vk_get_pipeline_layout(struct wined3d_context_vk *context_vk, - VkDescriptorSetLayoutBinding *bindings, SIZE_T binding_count) DECLSPEC_HIDDEN; + VkDescriptorSetLayoutBinding *bindings, SIZE_T binding_count, VkPushConstantRange *push_constants, + SIZE_T push_constant_count) DECLSPEC_HIDDEN; VkRenderPass wined3d_context_vk_get_render_pass(struct wined3d_context_vk *context_vk, const struct wined3d_fb_state *fb, unsigned int rt_count, bool depth_stencil, uint32_t clear_flags) DECLSPEC_HIDDEN;