Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/context_vk.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index d1a113d1f81..77c32b2efc1 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2650,6 +2650,28 @@ static bool wined3d_shader_resource_bindings_add_null_srv_binding(struct wined3d } }
+static bool wined3d_context_vk_update_cbv_binding(struct wined3d_context_vk *context_vk, + struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set, + const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding) +{ + struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device); + const VkDescriptorBufferInfo *buffer_info; + struct wined3d_buffer_vk *buffer_vk; + struct wined3d_buffer *buffer; + + if (!(buffer = state->cb[binding->shader_type][binding->resource_idx].buffer)) + return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, &device_vk->null_resources_vk.buffer_info, NULL, NULL); + + buffer_vk = wined3d_buffer_vk(buffer); + buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk); + if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, + binding->binding_idx, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, buffer_info, NULL, NULL)) + return false; + wined3d_context_vk_reference_bo(context_vk, &buffer_vk->bo); + return true; +} + static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, enum wined3d_pipeline pipeline) { @@ -2661,10 +2683,8 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con struct wined3d_unordered_access_view_vk *uav_vk; struct wined3d_shader_resource_view_vk *srv_vk; struct wined3d_unordered_access_view *uav; - const VkDescriptorBufferInfo *buffer_info; struct wined3d_shader_resource_view *srv; const VkDescriptorImageInfo *image_info; - struct wined3d_buffer_vk *buffer_vk; VkDescriptorSetLayout vk_set_layout; VkPipelineLayout vk_pipeline_layout; struct wined3d_resource *resource; @@ -2672,7 +2692,6 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con VkDescriptorSet vk_descriptor_set; struct wined3d_view_vk *view_vk; struct wined3d_sampler *sampler; - struct wined3d_buffer *buffer; VkBufferView *buffer_view; VkDescriptorType type; VkResult vr; @@ -2713,20 +2732,8 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con switch (binding->shader_descriptor_type) { case WINED3D_SHADER_DESCRIPTOR_TYPE_CBV: - if (!(buffer = state->cb[binding->shader_type][binding->resource_idx].buffer)) - { - if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, - binding->binding_idx, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, - &device_vk->null_resources_vk.buffer_info, NULL, NULL)) - return false; - break; - } - buffer_vk = wined3d_buffer_vk(buffer); - buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk); - if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, - binding->binding_idx, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, buffer_info, NULL, NULL)) + if (!wined3d_context_vk_update_cbv_binding(context_vk, writes, vk_descriptor_set, state, binding)) return false; - wined3d_context_vk_reference_bo(context_vk, &buffer_vk->bo); break;
case WINED3D_SHADER_DESCRIPTOR_TYPE_SRV:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/context_vk.c | 79 ++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 34 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 77c32b2efc1..78429de501b 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2672,6 +2672,50 @@ static bool wined3d_context_vk_update_cbv_binding(struct wined3d_context_vk *con return true; }
+static bool wined3d_context_vk_update_srv_binding(struct wined3d_context_vk *context_vk, + struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set, + const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding) +{ + struct wined3d_shader_resource_view_vk *srv_vk; + struct wined3d_shader_resource_view *srv; + const VkDescriptorImageInfo *image_info; + struct wined3d_resource *resource; + struct wined3d_view_vk *view_vk; + VkBufferView *buffer_view; + VkDescriptorType type; + + if (!(srv = state->shader_resource_view[binding->shader_type][binding->resource_idx])) + return wined3d_shader_resource_bindings_add_null_srv_binding(writes, vk_descriptor_set, + binding->binding_idx, binding->resource_type, binding->resource_data_type, context_vk); + + resource = srv->resource; + srv_vk = wined3d_shader_resource_view_vk(srv); + view_vk = &srv_vk->view_vk; + if (resource->type == WINED3D_RTYPE_BUFFER) + { + image_info = NULL; + buffer_view = &view_vk->u.vk_buffer_view; + type = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER; + } + else + { + struct wined3d_texture_vk *texture_vk = wined3d_texture_vk(texture_from_resource(resource)); + + if (view_vk->u.vk_image_info.imageView) + image_info = &view_vk->u.vk_image_info; + else + image_info = wined3d_texture_vk_get_default_image_info(texture_vk, context_vk); + buffer_view = NULL; + type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; + } + + if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, + binding->binding_idx, type, NULL, image_info, buffer_view)) + return false; + wined3d_context_vk_reference_shader_resource_view(context_vk, srv_vk); + return true; +} + static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, enum wined3d_pipeline pipeline) { @@ -2681,9 +2725,7 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con const struct wined3d_shader_resource_binding *binding; struct wined3d_shader_resource_bindings *bindings; struct wined3d_unordered_access_view_vk *uav_vk; - struct wined3d_shader_resource_view_vk *srv_vk; struct wined3d_unordered_access_view *uav; - struct wined3d_shader_resource_view *srv; const VkDescriptorImageInfo *image_info; VkDescriptorSetLayout vk_set_layout; VkPipelineLayout vk_pipeline_layout; @@ -2737,39 +2779,8 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con break;
case WINED3D_SHADER_DESCRIPTOR_TYPE_SRV: - if (!(srv = state->shader_resource_view[binding->shader_type][binding->resource_idx])) - { - if (!wined3d_shader_resource_bindings_add_null_srv_binding(writes, vk_descriptor_set, - binding->binding_idx, binding->resource_type, binding->resource_data_type, context_vk)) - return false; - break; - } - resource = srv->resource; - - srv_vk = wined3d_shader_resource_view_vk(srv); - view_vk = &srv_vk->view_vk; - if (resource->type == WINED3D_RTYPE_BUFFER) - { - image_info = NULL; - buffer_view = &view_vk->u.vk_buffer_view; - type = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER; - } - else - { - struct wined3d_texture_vk *texture_vk = wined3d_texture_vk(texture_from_resource(resource)); - - if (view_vk->u.vk_image_info.imageView) - image_info = &view_vk->u.vk_image_info; - else - image_info = wined3d_texture_vk_get_default_image_info(texture_vk, context_vk); - buffer_view = NULL; - type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; - } - - if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, - binding->binding_idx, type, NULL, image_info, buffer_view)) + if (!wined3d_context_vk_update_srv_binding(context_vk, writes, vk_descriptor_set, state, binding)) return false; - wined3d_context_vk_reference_shader_resource_view(context_vk, srv_vk); break;
case WINED3D_SHADER_DESCRIPTOR_TYPE_UAV:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/context_vk.c | 83 ++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 35 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 78429de501b..1f2c476b688 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2716,6 +2716,52 @@ static bool wined3d_context_vk_update_srv_binding(struct wined3d_context_vk *con return true; }
+static bool wined3d_context_vk_update_uav_binding(struct wined3d_context_vk *context_vk, enum wined3d_pipeline pipeline, + struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set, + const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding) +{ + struct wined3d_unordered_access_view_vk *uav_vk; + struct wined3d_unordered_access_view *uav; + const VkDescriptorImageInfo *image_info; + struct wined3d_resource *resource; + struct wined3d_view_vk *view_vk; + VkBufferView *buffer_view; + VkDescriptorType type; + + if (!(uav = state->unordered_access_view[pipeline][binding->resource_idx])) + { + FIXME("NULL unordered access views not implemented.\n"); + return false; + } + resource = uav->resource; + + uav_vk = wined3d_unordered_access_view_vk(uav); + view_vk = &uav_vk->view_vk; + if (resource->type == WINED3D_RTYPE_BUFFER) + { + image_info = NULL; + buffer_view = &view_vk->u.vk_buffer_view; + type = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER; + } + else + { + struct wined3d_texture_vk *texture_vk = wined3d_texture_vk(texture_from_resource(resource)); + + if (view_vk->u.vk_image_info.imageView) + image_info = &view_vk->u.vk_image_info; + else + image_info = wined3d_texture_vk_get_default_image_info(texture_vk, context_vk); + buffer_view = NULL; + type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + } + + if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, + binding->binding_idx, type, NULL, image_info, buffer_view)) + return false; + wined3d_context_vk_reference_unordered_access_view(context_vk, uav_vk); + return true; +} + static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, enum wined3d_pipeline pipeline) { @@ -2726,16 +2772,11 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con struct wined3d_shader_resource_bindings *bindings; struct wined3d_unordered_access_view_vk *uav_vk; struct wined3d_unordered_access_view *uav; - const VkDescriptorImageInfo *image_info; VkDescriptorSetLayout vk_set_layout; VkPipelineLayout vk_pipeline_layout; - struct wined3d_resource *resource; VkPipelineBindPoint vk_bind_point; VkDescriptorSet vk_descriptor_set; - struct wined3d_view_vk *view_vk; struct wined3d_sampler *sampler; - VkBufferView *buffer_view; - VkDescriptorType type; VkResult vr; size_t i;
@@ -2784,37 +2825,9 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con break;
case WINED3D_SHADER_DESCRIPTOR_TYPE_UAV: - if (!(uav = state->unordered_access_view[pipeline][binding->resource_idx])) - { - FIXME("NULL unordered access views not implemented.\n"); - return false; - } - resource = uav->resource; - - uav_vk = wined3d_unordered_access_view_vk(uav); - view_vk = &uav_vk->view_vk; - if (resource->type == WINED3D_RTYPE_BUFFER) - { - image_info = NULL; - buffer_view = &view_vk->u.vk_buffer_view; - type = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER; - } - else - { - struct wined3d_texture_vk *texture_vk = wined3d_texture_vk(texture_from_resource(resource)); - - if (view_vk->u.vk_image_info.imageView) - image_info = &view_vk->u.vk_image_info; - else - image_info = wined3d_texture_vk_get_default_image_info(texture_vk, context_vk); - buffer_view = NULL; - type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; - } - - if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, - binding->binding_idx, type, NULL, image_info, buffer_view)) + if (!wined3d_context_vk_update_uav_binding(context_vk, pipeline, + writes, vk_descriptor_set, state, binding)) return false; - wined3d_context_vk_reference_unordered_access_view(context_vk, uav_vk); break;
case WINED3D_SHADER_DESCRIPTOR_TYPE_UAV_COUNTER:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/context_vk.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 1f2c476b688..11fa82ffde7 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2762,6 +2762,28 @@ static bool wined3d_context_vk_update_uav_binding(struct wined3d_context_vk *con return true; }
+static bool wined3d_context_vk_update_uav_counter_binding(struct wined3d_context_vk *context_vk, + enum wined3d_pipeline pipeline, struct wined3d_shader_descriptor_writes_vk *writes, + VkDescriptorSet vk_descriptor_set, const struct wined3d_state *state, + const struct wined3d_shader_resource_binding *binding) +{ + struct wined3d_unordered_access_view_vk *uav_vk; + struct wined3d_unordered_access_view *uav; + + if (!(uav = state->unordered_access_view[pipeline][binding->resource_idx])) + { + FIXME("NULL unordered access view counters not implemented.\n"); + return false; + } + + uav_vk = wined3d_unordered_access_view_vk(uav); + if (!uav_vk->vk_counter_view) + return false; + + return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx, + VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, NULL, NULL, &uav_vk->vk_counter_view); +} + static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, enum wined3d_pipeline pipeline) { @@ -2770,8 +2792,6 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con const struct wined3d_vk_info *vk_info = context_vk->vk_info; const struct wined3d_shader_resource_binding *binding; struct wined3d_shader_resource_bindings *bindings; - struct wined3d_unordered_access_view_vk *uav_vk; - struct wined3d_unordered_access_view *uav; VkDescriptorSetLayout vk_set_layout; VkPipelineLayout vk_pipeline_layout; VkPipelineBindPoint vk_bind_point; @@ -2831,16 +2851,8 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con break;
case WINED3D_SHADER_DESCRIPTOR_TYPE_UAV_COUNTER: - if (!(uav = state->unordered_access_view[pipeline][binding->resource_idx])) - { - FIXME("NULL unordered access view counters not implemented.\n"); - return false; - } - - uav_vk = wined3d_unordered_access_view_vk(uav); - if (!uav_vk->vk_counter_view || !wined3d_shader_descriptor_writes_vk_add_write(writes, - vk_descriptor_set, binding->binding_idx, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, - NULL, NULL, &uav_vk->vk_counter_view)) + if (!wined3d_context_vk_update_uav_counter_binding(context_vk, pipeline, + writes, vk_descriptor_set, state, binding)) return false; break;
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/context_vk.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 11fa82ffde7..ca8409db639 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2784,6 +2784,21 @@ static bool wined3d_context_vk_update_uav_counter_binding(struct wined3d_context VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, NULL, NULL, &uav_vk->vk_counter_view); }
+static bool wined3d_context_vk_update_sampler_binding(struct wined3d_context_vk *context_vk, + struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set, + const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding) +{ + struct wined3d_sampler *sampler; + + if (!(sampler = state->sampler[binding->shader_type][binding->resource_idx])) + sampler = context_vk->c.device->null_sampler; + if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx, + VK_DESCRIPTOR_TYPE_SAMPLER, NULL, &wined3d_sampler_vk(sampler)->vk_image_info, NULL)) + return false; + wined3d_context_vk_reference_sampler(context_vk, wined3d_sampler_vk(sampler)); + return true; +} + static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, enum wined3d_pipeline pipeline) { @@ -2796,7 +2811,6 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con VkPipelineLayout vk_pipeline_layout; VkPipelineBindPoint vk_bind_point; VkDescriptorSet vk_descriptor_set; - struct wined3d_sampler *sampler; VkResult vr; size_t i;
@@ -2857,12 +2871,8 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con break;
case WINED3D_SHADER_DESCRIPTOR_TYPE_SAMPLER: - if (!(sampler = state->sampler[binding->shader_type][binding->resource_idx])) - sampler = context_vk->c.device->null_sampler; - if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx, - VK_DESCRIPTOR_TYPE_SAMPLER, NULL, &wined3d_sampler_vk(sampler)->vk_image_info, NULL)) + if (!wined3d_context_vk_update_sampler_binding(context_vk, writes, vk_descriptor_set, state, binding)) return false; - wined3d_context_vk_reference_sampler(context_vk, wined3d_sampler_vk(sampler)); break;
default:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/context_vk.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index ca8409db639..a326fae0e9c 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2652,19 +2652,22 @@ static bool wined3d_shader_resource_bindings_add_null_srv_binding(struct wined3d
static bool wined3d_context_vk_update_cbv_binding(struct wined3d_context_vk *context_vk, struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set, - const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding) + const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding, + VkDescriptorBufferInfo *buffer_info) { + const struct wined3d_constant_buffer_state *cb_state = &state->cb[binding->shader_type][binding->resource_idx]; struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device); - const VkDescriptorBufferInfo *buffer_info; struct wined3d_buffer_vk *buffer_vk; struct wined3d_buffer *buffer;
- if (!(buffer = state->cb[binding->shader_type][binding->resource_idx].buffer)) + if (!(buffer = cb_state->buffer)) return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, &device_vk->null_resources_vk.buffer_info, NULL, NULL);
buffer_vk = wined3d_buffer_vk(buffer); - buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk); + *buffer_info = *wined3d_buffer_vk_get_buffer_info(buffer_vk); + buffer_info->offset += cb_state->offset; + buffer_info->range = min(cb_state->size, buffer_info->range); if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, buffer_info, NULL, NULL)) return false; @@ -2803,6 +2806,7 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, enum wined3d_pipeline pipeline) { struct wined3d_shader_descriptor_writes_vk *writes = &context_vk->descriptor_writes; + VkDescriptorBufferInfo buffers[WINED3D_SHADER_TYPE_COUNT][MAX_CONSTANT_BUFFERS]; struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device); const struct wined3d_vk_info *vk_info = context_vk->vk_info; const struct wined3d_shader_resource_binding *binding; @@ -2849,7 +2853,8 @@ static bool wined3d_context_vk_update_descriptors(struct wined3d_context_vk *con switch (binding->shader_descriptor_type) { case WINED3D_SHADER_DESCRIPTOR_TYPE_CBV: - if (!wined3d_context_vk_update_cbv_binding(context_vk, writes, vk_descriptor_set, state, binding)) + if (!wined3d_context_vk_update_cbv_binding(context_vk, writes, vk_descriptor_set, + state, binding, &buffers[binding->shader_type][binding->resource_idx])) return false; break;
On Thu, 22 Jul 2021 at 03:46, Zebediah Figura zfigura@codeweavers.com wrote:
+static bool wined3d_context_vk_update_cbv_binding(struct wined3d_context_vk *context_vk,
struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set,
const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding)
+{
- struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
- const VkDescriptorBufferInfo *buffer_info;
- struct wined3d_buffer_vk *buffer_vk;
- struct wined3d_buffer *buffer;
- if (!(buffer = state->cb[binding->shader_type][binding->resource_idx].buffer))
return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, &device_vk->null_resources_vk.buffer_info, NULL, NULL);
- buffer_vk = wined3d_buffer_vk(buffer);
- buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk);
- if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
binding->binding_idx, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, buffer_info, NULL, NULL))
return false;
- wined3d_context_vk_reference_bo(context_vk, &buffer_vk->bo);
- return true;
+}
This doesn't actually update "binding" though; the main thing it does is appending a descriptor write to "writes". Would a name like "wined3d_shader_descriptor_writes_vk_add_cbv_write()" make sense to you?
On 7/22/21 7:49 AM, Henri Verbeet wrote:
On Thu, 22 Jul 2021 at 03:46, Zebediah Figura zfigura@codeweavers.com wrote:
+static bool wined3d_context_vk_update_cbv_binding(struct wined3d_context_vk *context_vk,
struct wined3d_shader_descriptor_writes_vk *writes, VkDescriptorSet vk_descriptor_set,
const struct wined3d_state *state, const struct wined3d_shader_resource_binding *binding)
+{
- struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
- const VkDescriptorBufferInfo *buffer_info;
- struct wined3d_buffer_vk *buffer_vk;
- struct wined3d_buffer *buffer;
- if (!(buffer = state->cb[binding->shader_type][binding->resource_idx].buffer))
return wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set, binding->binding_idx,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, &device_vk->null_resources_vk.buffer_info, NULL, NULL);
- buffer_vk = wined3d_buffer_vk(buffer);
- buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk);
- if (!wined3d_shader_descriptor_writes_vk_add_write(writes, vk_descriptor_set,
binding->binding_idx, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, buffer_info, NULL, NULL))
return false;
- wined3d_context_vk_reference_bo(context_vk, &buffer_vk->bo);
- return true;
+}
This doesn't actually update "binding" though; the main thing it does is appending a descriptor write to "writes". Would a name like "wined3d_shader_descriptor_writes_vk_add_cbv_write()" make sense to you?
I did have a hard time naming this function :-/
That one seems reasonable enough to me, though.