use 32 bit block sizes

pull/50/head
cosmonaut 2024-02-16 18:29:05 -08:00
parent 695ad15b75
commit f5e25979f4
1 changed files with 15 additions and 8 deletions

View File

@ -872,8 +872,8 @@ typedef struct VulkanGraphicsPipeline
VkPipeline pipeline;
VulkanGraphicsPipelineLayout *pipelineLayout;
Refresh_PrimitiveType primitiveType;
VkDeviceSize vertexUniformBlockSize;
VkDeviceSize fragmentUniformBlockSize;
uint32_t vertexUniformBlockSize;
uint32_t fragmentUniformBlockSize;
VulkanShaderModule *vertexShaderModule;
VulkanShaderModule *fragmentShaderModule;
@ -892,7 +892,7 @@ typedef struct VulkanComputePipeline
{
VkPipeline pipeline;
VulkanComputePipelineLayout *pipelineLayout;
VkDeviceSize uniformBlockSize; /* permanently set in Create function */
uint32_t uniformBlockSize; /* permanently set in Create function */
VulkanShaderModule *computeShaderModule;
SDL_atomic_t referenceCount;
@ -1754,7 +1754,7 @@ typedef struct VulkanRenderer
VkDescriptorSetLayout fragmentUniformDescriptorSetLayout;
VkDescriptorSetLayout computeUniformDescriptorSetLayout;
VkDeviceSize minUBOAlignment;
uint32_t minUBOAlignment;
/* Some drivers don't support D16 for some reason. Fun! */
VkFormat D16Format;
@ -2078,6 +2078,13 @@ static inline VkDeviceSize VULKAN_INTERNAL_NextHighestAlignment(
return align * ((n + align - 1) / align);
}
static inline uint32_t VULKAN_INTERNAL_NextHighestAlignment32(
uint32_t n,
uint32_t align
) {
return align * ((n + align - 1) / align);
}
static void VULKAN_INTERNAL_MakeMemoryUnavailable(
VulkanRenderer* renderer,
VulkanMemoryAllocation *allocation
@ -6086,7 +6093,7 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
shaderStageCreateInfos[0].pSpecializationInfo = NULL;
graphicsPipeline->vertexUniformBlockSize =
VULKAN_INTERNAL_NextHighestAlignment(
VULKAN_INTERNAL_NextHighestAlignment32(
pipelineCreateInfo->vertexShaderInfo.uniformBufferSize,
renderer->minUBOAlignment
);
@ -6103,7 +6110,7 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
shaderStageCreateInfos[1].pSpecializationInfo = NULL;
graphicsPipeline->fragmentUniformBlockSize =
VULKAN_INTERNAL_NextHighestAlignment(
VULKAN_INTERNAL_NextHighestAlignment32(
pipelineCreateInfo->fragmentShaderInfo.uniformBufferSize,
renderer->minUBOAlignment
);
@ -6529,7 +6536,7 @@ static Refresh_ComputePipeline* VULKAN_CreateComputePipeline(
);
vulkanComputePipeline->uniformBlockSize =
VULKAN_INTERNAL_NextHighestAlignment(
VULKAN_INTERNAL_NextHighestAlignment32(
computeShaderInfo->uniformBufferSize,
renderer->minUBOAlignment
);
@ -11334,7 +11341,7 @@ static Refresh_Device* VULKAN_CreateDevice(
/* Set up UBO layouts */
renderer->minUBOAlignment = renderer->physicalDeviceProperties.properties.limits.minUniformBufferOffsetAlignment;
renderer->minUBOAlignment = (uint32_t) renderer->physicalDeviceProperties.properties.limits.minUniformBufferOffsetAlignment;
emptyVertexSamplerLayoutBinding.binding = 0;
emptyVertexSamplerLayoutBinding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;