diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-05 22:48:55 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-05 22:48:55 +0200 |
commit | f02695cc046d8b360ded35609b4cbc12a44f6d1d (patch) | |
tree | 2ff830912284eeb21026bce2b9419b3996f5a3ea /drivers/vulkan | |
parent | 7ee2eb5c924d369b529005c73271e739fd208fb7 (diff) | |
parent | 51ed3aef63c0fdfc7666c004cc6d94dd15322d81 (diff) | |
download | redot-engine-f02695cc046d8b360ded35609b4cbc12a44f6d1d.tar.gz |
Merge pull request #81138 from clayjohn/attribute-compression
Vertex and attribute compression
Diffstat (limited to 'drivers/vulkan')
-rw-r--r-- | drivers/vulkan/rendering_device_vulkan.cpp | 11 | ||||
-rw-r--r-- | drivers/vulkan/rendering_device_vulkan.h | 4 |
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index e553b2b522..5c68149a5f 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -4499,6 +4499,7 @@ RID RenderingDeviceVulkan::vertex_array_create(uint32_t p_vertex_count, VertexFo if (atf.frequency == VERTEX_FREQUENCY_VERTEX) { // Validate size for regular drawing. uint64_t total_size = uint64_t(atf.stride) * (p_vertex_count - 1) + atf.offset + element_size; + ERR_FAIL_COND_V_MSG(total_size > buffer->size, RID(), "Attachment (" + itos(i) + ") will read past the end of the buffer."); @@ -4665,7 +4666,7 @@ struct RenderingDeviceVulkanShaderBinarySpecializationConstant { }; struct RenderingDeviceVulkanShaderBinaryData { - uint32_t vertex_input_mask; + uint64_t vertex_input_mask; uint32_t fragment_output_mask; uint32_t specialization_constants_count; uint32_t is_compute; @@ -4881,7 +4882,7 @@ RID RenderingDeviceVulkan::shader_create_from_bytecode(const Vector<uint8_t> &p_ push_constant.size = binary_data.push_constant_size; push_constant.vk_stages_mask = binary_data.push_constant_vk_stages_mask; - uint32_t vertex_input_mask = binary_data.vertex_input_mask; + uint64_t vertex_input_mask = binary_data.vertex_input_mask; uint32_t fragment_output_mask = binary_data.fragment_output_mask; @@ -5209,7 +5210,7 @@ RID RenderingDeviceVulkan::shader_create_placeholder() { return shader_owner.make_rid(shader); } -uint32_t RenderingDeviceVulkan::shader_get_vertex_input_attribute_mask(RID p_shader) { +uint64_t RenderingDeviceVulkan::shader_get_vertex_input_attribute_mask(RID p_shader) { _THREAD_SAFE_METHOD_ const Shader *shader = shader_owner.get_or_null(p_shader); @@ -6152,8 +6153,8 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma pipeline_vertex_input_state_create_info = vd.create_info; // Validate with inputs. - for (uint32_t i = 0; i < 32; i++) { - if (!(shader->vertex_input_mask & (1UL << i))) { + for (uint64_t i = 0; i < 64; i++) { + if (!(shader->vertex_input_mask & (1ULL << i))) { continue; } bool found = false; diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h index fd14449ee7..7c514c11f8 100644 --- a/drivers/vulkan/rendering_device_vulkan.h +++ b/drivers/vulkan/rendering_device_vulkan.h @@ -621,7 +621,7 @@ class RenderingDeviceVulkan : public RenderingDevice { VkDescriptorSetLayout descriptor_set_layout = VK_NULL_HANDLE; }; - uint32_t vertex_input_mask = 0; // Inputs used, this is mostly for validation. + uint64_t vertex_input_mask = 0; // Inputs used, this is mostly for validation. uint32_t fragment_output_mask = 0; struct PushConstant { @@ -1140,7 +1140,7 @@ public: virtual RID shader_create_from_bytecode(const Vector<uint8_t> &p_shader_binary, RID p_placeholder = RID()); virtual RID shader_create_placeholder(); - virtual uint32_t shader_get_vertex_input_attribute_mask(RID p_shader); + virtual uint64_t shader_get_vertex_input_attribute_mask(RID p_shader); /*****************/ /**** UNIFORM ****/ |