|
@@ -630,11 +630,11 @@ typedef struct VulkanSampler
|
|
|
typedef struct VulkanShader
|
|
|
{
|
|
|
VkShaderModule shaderModule;
|
|
|
- const char *entryPointName;
|
|
|
- Uint32 samplerCount;
|
|
|
- Uint32 storageTextureCount;
|
|
|
- Uint32 storageBufferCount;
|
|
|
- Uint32 uniformBufferCount;
|
|
|
+ const char *entrypointName;
|
|
|
+ Uint32 numSamplers;
|
|
|
+ Uint32 numStorageTextures;
|
|
|
+ Uint32 numStorageBuffers;
|
|
|
+ Uint32 numUniformBuffers;
|
|
|
SDL_AtomicInt referenceCount;
|
|
|
} VulkanShader;
|
|
|
|
|
@@ -675,7 +675,7 @@ struct VulkanTexture
|
|
|
|
|
|
Uint32 depth;
|
|
|
Uint32 layerCount;
|
|
|
- Uint32 levelCount;
|
|
|
+ Uint32 numLevels;
|
|
|
VkSampleCountFlagBits sampleCount; // NOTE: This refers to the sample count of a render target pass using this texture, not the actual sample count of the texture
|
|
|
VkFormat format;
|
|
|
VkComponentMapping swizzle;
|
|
@@ -886,11 +886,11 @@ typedef struct VulkanComputePipelineResourceLayout
|
|
|
*/
|
|
|
DescriptorSetPool descriptorSetPools[3];
|
|
|
|
|
|
- Uint32 readOnlyStorageTextureCount;
|
|
|
- Uint32 readOnlyStorageBufferCount;
|
|
|
- Uint32 writeOnlyStorageTextureCount;
|
|
|
- Uint32 writeOnlyStorageBufferCount;
|
|
|
- Uint32 uniformBufferCount;
|
|
|
+ Uint32 numReadonlyStorageTextures;
|
|
|
+ Uint32 numReadonlyStorageBuffers;
|
|
|
+ Uint32 numWriteonlyStorageTextures;
|
|
|
+ Uint32 numWriteonlyStorageBuffers;
|
|
|
+ Uint32 numUniformBuffers;
|
|
|
} VulkanComputePipelineResourceLayout;
|
|
|
|
|
|
typedef struct VulkanComputePipeline
|
|
@@ -925,7 +925,7 @@ typedef struct CommandPoolHashTableKey
|
|
|
typedef struct RenderPassHashTableKey
|
|
|
{
|
|
|
RenderPassColorTargetDescription colorTargetDescriptions[MAX_COLOR_TARGET_BINDINGS];
|
|
|
- Uint32 colorAttachmentCount;
|
|
|
+ Uint32 numColorTargets;
|
|
|
RenderPassDepthStencilTargetDescription depthStencilTargetDescription;
|
|
|
VkSampleCountFlagBits colorAttachmentSampleCount;
|
|
|
} RenderPassHashTableKey;
|
|
@@ -939,7 +939,7 @@ typedef struct FramebufferHashTableKey
|
|
|
{
|
|
|
VkImageView colorAttachmentViews[MAX_COLOR_TARGET_BINDINGS];
|
|
|
VkImageView colorMultiSampleAttachmentViews[MAX_COLOR_TARGET_BINDINGS];
|
|
|
- Uint32 colorAttachmentCount;
|
|
|
+ Uint32 numColorTargets;
|
|
|
VkImageView depthStencilAttachmentView;
|
|
|
Uint32 width;
|
|
|
Uint32 height;
|
|
@@ -1208,7 +1208,7 @@ static Uint8 VULKAN_INTERNAL_DefragmentMemory(VulkanRenderer *renderer);
|
|
|
static void VULKAN_INTERNAL_BeginCommandBuffer(VulkanRenderer *renderer, VulkanCommandBuffer *commandBuffer);
|
|
|
static void VULKAN_ReleaseWindow(SDL_GPURenderer *driverData, SDL_Window *window);
|
|
|
static void VULKAN_Wait(SDL_GPURenderer *driverData);
|
|
|
-static void VULKAN_WaitForFences(SDL_GPURenderer *driverData, bool waitAll, SDL_GPUFence *const *pFences, Uint32 fenceCount);
|
|
|
+static void VULKAN_WaitForFences(SDL_GPURenderer *driverData, bool waitAll, SDL_GPUFence *const *fences, Uint32 numFences);
|
|
|
static void VULKAN_Submit(SDL_GPUCommandBuffer *commandBuffer);
|
|
|
static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
|
|
|
VulkanRenderer *renderer,
|
|
@@ -1217,7 +1217,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
|
|
|
Uint32 depth,
|
|
|
SDL_GPUTextureType type,
|
|
|
Uint32 layerCount,
|
|
|
- Uint32 levelCount,
|
|
|
+ Uint32 numLevels,
|
|
|
VkSampleCountFlagBits sampleCount,
|
|
|
VkFormat format,
|
|
|
VkComponentMapping swizzle,
|
|
@@ -2953,7 +2953,7 @@ static void VULKAN_INTERNAL_RemoveFramebuffersContainingView(
|
|
|
|
|
|
while (SDL_IterateHashTable(renderer->framebufferHashTable, (const void **)&key, (const void **)&value, &iter)) {
|
|
|
bool remove = false;
|
|
|
- for (Uint32 i = 0; i < key->colorAttachmentCount; i += 1) {
|
|
|
+ for (Uint32 i = 0; i < key->numColorTargets; i += 1) {
|
|
|
if (key->colorAttachmentViews[i] == view) {
|
|
|
remove = true;
|
|
|
}
|
|
@@ -3192,7 +3192,7 @@ static void VULKAN_INTERNAL_DestroyShader(
|
|
|
vulkanShader->shaderModule,
|
|
|
NULL);
|
|
|
|
|
|
- SDL_free((void *)vulkanShader->entryPointName);
|
|
|
+ SDL_free((void *)vulkanShader->entrypointName);
|
|
|
SDL_free(vulkanShader);
|
|
|
}
|
|
|
|
|
@@ -3300,22 +3300,22 @@ static Uint32 VULKAN_INTERNAL_RenderPassHashFunction(
|
|
|
* is taken from Josh Bloch's "Effective Java".
|
|
|
* (https://stackoverflow.com/a/113600/12492383)
|
|
|
*/
|
|
|
- const Uint32 HASH_FACTOR = 31;
|
|
|
+ const Uint32 hashFactor = 31;
|
|
|
Uint32 result = 1;
|
|
|
|
|
|
- for (Uint32 i = 0; i < hashTableKey->colorAttachmentCount; i += 1) {
|
|
|
- result = result * HASH_FACTOR + hashTableKey->colorTargetDescriptions[i].loadOp;
|
|
|
- result = result * HASH_FACTOR + hashTableKey->colorTargetDescriptions[i].storeOp;
|
|
|
- result = result * HASH_FACTOR + hashTableKey->colorTargetDescriptions[i].format;
|
|
|
+ for (Uint32 i = 0; i < hashTableKey->numColorTargets; i += 1) {
|
|
|
+ result = result * hashFactor + hashTableKey->colorTargetDescriptions[i].loadOp;
|
|
|
+ result = result * hashFactor + hashTableKey->colorTargetDescriptions[i].storeOp;
|
|
|
+ result = result * hashFactor + hashTableKey->colorTargetDescriptions[i].format;
|
|
|
}
|
|
|
|
|
|
- result = result * HASH_FACTOR + hashTableKey->depthStencilTargetDescription.loadOp;
|
|
|
- result = result * HASH_FACTOR + hashTableKey->depthStencilTargetDescription.storeOp;
|
|
|
- result = result * HASH_FACTOR + hashTableKey->depthStencilTargetDescription.stencilLoadOp;
|
|
|
- result = result * HASH_FACTOR + hashTableKey->depthStencilTargetDescription.stencilStoreOp;
|
|
|
- result = result * HASH_FACTOR + hashTableKey->depthStencilTargetDescription.format;
|
|
|
+ result = result * hashFactor + hashTableKey->depthStencilTargetDescription.loadOp;
|
|
|
+ result = result * hashFactor + hashTableKey->depthStencilTargetDescription.storeOp;
|
|
|
+ result = result * hashFactor + hashTableKey->depthStencilTargetDescription.stencilLoadOp;
|
|
|
+ result = result * hashFactor + hashTableKey->depthStencilTargetDescription.stencilStoreOp;
|
|
|
+ result = result * hashFactor + hashTableKey->depthStencilTargetDescription.format;
|
|
|
|
|
|
- result = result * HASH_FACTOR + hashTableKey->colorAttachmentSampleCount;
|
|
|
+ result = result * hashFactor + hashTableKey->colorAttachmentSampleCount;
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@@ -3328,7 +3328,7 @@ static bool VULKAN_INTERNAL_RenderPassHashKeyMatch(
|
|
|
RenderPassHashTableKey *a = (RenderPassHashTableKey *)aKey;
|
|
|
RenderPassHashTableKey *b = (RenderPassHashTableKey *)bKey;
|
|
|
|
|
|
- if (a->colorAttachmentCount != b->colorAttachmentCount) {
|
|
|
+ if (a->numColorTargets != b->numColorTargets) {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -3336,7 +3336,7 @@ static bool VULKAN_INTERNAL_RenderPassHashKeyMatch(
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- for (Uint32 i = 0; i < a->colorAttachmentCount; i += 1) {
|
|
|
+ for (Uint32 i = 0; i < a->numColorTargets; i += 1) {
|
|
|
if (a->colorTargetDescriptions[i].format != b->colorTargetDescriptions[i].format) {
|
|
|
return 0;
|
|
|
}
|
|
@@ -3395,17 +3395,17 @@ static Uint32 VULKAN_INTERNAL_FramebufferHashFunction(
|
|
|
* is taken from Josh Bloch's "Effective Java".
|
|
|
* (https://stackoverflow.com/a/113600/12492383)
|
|
|
*/
|
|
|
- const Uint32 HASH_FACTOR = 31;
|
|
|
+ const Uint32 hashFactor = 31;
|
|
|
Uint32 result = 1;
|
|
|
|
|
|
- for (Uint32 i = 0; i < hashTableKey->colorAttachmentCount; i += 1) {
|
|
|
- result = result * HASH_FACTOR + (Uint32)(uintptr_t)hashTableKey->colorAttachmentViews[i];
|
|
|
- result = result * HASH_FACTOR + (Uint32)(uintptr_t)hashTableKey->colorMultiSampleAttachmentViews[i];
|
|
|
+ for (Uint32 i = 0; i < hashTableKey->numColorTargets; i += 1) {
|
|
|
+ result = result * hashFactor + (Uint32)(uintptr_t)hashTableKey->colorAttachmentViews[i];
|
|
|
+ result = result * hashFactor + (Uint32)(uintptr_t)hashTableKey->colorMultiSampleAttachmentViews[i];
|
|
|
}
|
|
|
|
|
|
- result = result * HASH_FACTOR + (Uint32)(uintptr_t)hashTableKey->depthStencilAttachmentView;
|
|
|
- result = result * HASH_FACTOR + hashTableKey->width;
|
|
|
- result = result * HASH_FACTOR + hashTableKey->height;
|
|
|
+ result = result * hashFactor + (Uint32)(uintptr_t)hashTableKey->depthStencilAttachmentView;
|
|
|
+ result = result * hashFactor + hashTableKey->width;
|
|
|
+ result = result * hashFactor + hashTableKey->height;
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@@ -3418,11 +3418,11 @@ static bool VULKAN_INTERNAL_FramebufferHashKeyMatch(
|
|
|
FramebufferHashTableKey *a = (FramebufferHashTableKey *)aKey;
|
|
|
FramebufferHashTableKey *b = (FramebufferHashTableKey *)bKey;
|
|
|
|
|
|
- if (a->colorAttachmentCount != b->colorAttachmentCount) {
|
|
|
+ if (a->numColorTargets != b->numColorTargets) {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- for (Uint32 i = 0; i < a->colorAttachmentCount; i += 1) {
|
|
|
+ for (Uint32 i = 0; i < a->numColorTargets; i += 1) {
|
|
|
if (a->colorAttachmentViews[i] != b->colorAttachmentViews[i]) {
|
|
|
return 0;
|
|
|
}
|
|
@@ -3586,15 +3586,15 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
VkResult vulkanResult;
|
|
|
Uint32 i;
|
|
|
|
|
|
- pipelineResourceLayout->vertexSamplerCount = vertexShader->samplerCount;
|
|
|
- pipelineResourceLayout->vertexStorageTextureCount = vertexShader->storageTextureCount;
|
|
|
- pipelineResourceLayout->vertexStorageBufferCount = vertexShader->storageBufferCount;
|
|
|
- pipelineResourceLayout->vertexUniformBufferCount = vertexShader->uniformBufferCount;
|
|
|
+ pipelineResourceLayout->vertexSamplerCount = vertexShader->numSamplers;
|
|
|
+ pipelineResourceLayout->vertexStorageTextureCount = vertexShader->numStorageTextures;
|
|
|
+ pipelineResourceLayout->vertexStorageBufferCount = vertexShader->numStorageBuffers;
|
|
|
+ pipelineResourceLayout->vertexUniformBufferCount = vertexShader->numUniformBuffers;
|
|
|
|
|
|
- pipelineResourceLayout->fragmentSamplerCount = fragmentShader->samplerCount;
|
|
|
- pipelineResourceLayout->fragmentStorageTextureCount = fragmentShader->storageTextureCount;
|
|
|
- pipelineResourceLayout->fragmentStorageBufferCount = fragmentShader->storageBufferCount;
|
|
|
- pipelineResourceLayout->fragmentUniformBufferCount = fragmentShader->uniformBufferCount;
|
|
|
+ pipelineResourceLayout->fragmentSamplerCount = fragmentShader->numSamplers;
|
|
|
+ pipelineResourceLayout->fragmentStorageTextureCount = fragmentShader->numStorageTextures;
|
|
|
+ pipelineResourceLayout->fragmentStorageBufferCount = fragmentShader->numStorageBuffers;
|
|
|
+ pipelineResourceLayout->fragmentUniformBufferCount = fragmentShader->numUniformBuffers;
|
|
|
|
|
|
// Vertex Resources
|
|
|
|
|
@@ -3603,9 +3603,9 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetLayoutCreateInfo.flags = 0;
|
|
|
descriptorSetLayoutCreateInfo.pBindings = NULL;
|
|
|
descriptorSetLayoutCreateInfo.bindingCount =
|
|
|
- vertexShader->samplerCount +
|
|
|
- vertexShader->storageTextureCount +
|
|
|
- vertexShader->storageBufferCount;
|
|
|
+ vertexShader->numSamplers +
|
|
|
+ vertexShader->numStorageTextures +
|
|
|
+ vertexShader->numStorageBuffers;
|
|
|
|
|
|
descriptorSetPool = &pipelineResourceLayout->descriptorSetPools[0];
|
|
|
|
|
@@ -3616,7 +3616,7 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos = SDL_malloc(
|
|
|
descriptorSetPool->descriptorInfoCount * sizeof(VulkanDescriptorInfo));
|
|
|
|
|
|
- for (i = 0; i < vertexShader->samplerCount; i += 1) {
|
|
|
+ for (i = 0; i < vertexShader->numSamplers; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
|
@@ -3627,7 +3627,7 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos[i].stageFlag = VK_SHADER_STAGE_VERTEX_BIT;
|
|
|
}
|
|
|
|
|
|
- for (i = vertexShader->samplerCount; i < vertexShader->samplerCount + vertexShader->storageTextureCount; i += 1) {
|
|
|
+ for (i = vertexShader->numSamplers; i < vertexShader->numSamplers + vertexShader->numStorageTextures; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
@@ -3638,7 +3638,7 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos[i].stageFlag = VK_SHADER_STAGE_VERTEX_BIT;
|
|
|
}
|
|
|
|
|
|
- for (i = vertexShader->samplerCount + vertexShader->storageTextureCount; i < descriptorSetLayoutCreateInfo.bindingCount; i += 1) {
|
|
|
+ for (i = vertexShader->numSamplers + vertexShader->numStorageTextures; i < descriptorSetLayoutCreateInfo.bindingCount; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
|
@@ -3679,7 +3679,7 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos = SDL_malloc(
|
|
|
descriptorSetPool->descriptorInfoCount * sizeof(VulkanDescriptorInfo));
|
|
|
|
|
|
- for (i = 0; i < vertexShader->uniformBufferCount; i += 1) {
|
|
|
+ for (i = 0; i < vertexShader->numUniformBuffers; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
|
|
@@ -3711,9 +3711,9 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetPool = &pipelineResourceLayout->descriptorSetPools[2];
|
|
|
|
|
|
descriptorSetLayoutCreateInfo.bindingCount =
|
|
|
- fragmentShader->samplerCount +
|
|
|
- fragmentShader->storageTextureCount +
|
|
|
- fragmentShader->storageBufferCount;
|
|
|
+ fragmentShader->numSamplers +
|
|
|
+ fragmentShader->numStorageTextures +
|
|
|
+ fragmentShader->numStorageBuffers;
|
|
|
|
|
|
descriptorSetLayoutCreateInfo.pBindings = NULL;
|
|
|
|
|
@@ -3724,7 +3724,7 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos = SDL_malloc(
|
|
|
descriptorSetPool->descriptorInfoCount * sizeof(VulkanDescriptorInfo));
|
|
|
|
|
|
- for (i = 0; i < fragmentShader->samplerCount; i += 1) {
|
|
|
+ for (i = 0; i < fragmentShader->numSamplers; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
|
@@ -3735,7 +3735,7 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos[i].stageFlag = VK_SHADER_STAGE_FRAGMENT_BIT;
|
|
|
}
|
|
|
|
|
|
- for (i = fragmentShader->samplerCount; i < fragmentShader->samplerCount + fragmentShader->storageTextureCount; i += 1) {
|
|
|
+ for (i = fragmentShader->numSamplers; i < fragmentShader->numSamplers + fragmentShader->numStorageTextures; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
@@ -3746,7 +3746,7 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos[i].stageFlag = VK_SHADER_STAGE_FRAGMENT_BIT;
|
|
|
}
|
|
|
|
|
|
- for (i = fragmentShader->samplerCount + fragmentShader->storageTextureCount; i < descriptorSetLayoutCreateInfo.bindingCount; i += 1) {
|
|
|
+ for (i = fragmentShader->numSamplers + fragmentShader->numStorageTextures; i < descriptorSetLayoutCreateInfo.bindingCount; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
|
@@ -3789,7 +3789,7 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos = SDL_malloc(
|
|
|
descriptorSetPool->descriptorInfoCount * sizeof(VulkanDescriptorInfo));
|
|
|
|
|
|
- for (i = 0; i < fragmentShader->uniformBufferCount; i += 1) {
|
|
|
+ for (i = 0; i < fragmentShader->numUniformBuffers; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
|
|
@@ -3848,7 +3848,7 @@ static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout(
|
|
|
|
|
|
static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
VulkanRenderer *renderer,
|
|
|
- const SDL_GPUComputePipelineCreateInfo *pipelineCreateInfo,
|
|
|
+ const SDL_GPUComputePipelineCreateInfo *createinfo,
|
|
|
VulkanComputePipelineResourceLayout *pipelineResourceLayout)
|
|
|
{
|
|
|
VkDescriptorSetLayoutBinding descriptorSetLayoutBindings[MAX_UNIFORM_BUFFERS_PER_STAGE];
|
|
@@ -3859,11 +3859,11 @@ static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
VkResult vulkanResult;
|
|
|
Uint32 i;
|
|
|
|
|
|
- pipelineResourceLayout->readOnlyStorageTextureCount = pipelineCreateInfo->readOnlyStorageTextureCount;
|
|
|
- pipelineResourceLayout->readOnlyStorageBufferCount = pipelineCreateInfo->readOnlyStorageBufferCount;
|
|
|
- pipelineResourceLayout->writeOnlyStorageTextureCount = pipelineCreateInfo->writeOnlyStorageTextureCount;
|
|
|
- pipelineResourceLayout->writeOnlyStorageBufferCount = pipelineCreateInfo->writeOnlyStorageBufferCount;
|
|
|
- pipelineResourceLayout->uniformBufferCount = pipelineCreateInfo->uniformBufferCount;
|
|
|
+ pipelineResourceLayout->numReadonlyStorageTextures = createinfo->num_readonly_storage_textures;
|
|
|
+ pipelineResourceLayout->numReadonlyStorageBuffers = createinfo->num_readonly_storage_buffers;
|
|
|
+ pipelineResourceLayout->numWriteonlyStorageTextures = createinfo->num_writeonly_storage_textures;
|
|
|
+ pipelineResourceLayout->numWriteonlyStorageBuffers = createinfo->num_writeonly_storage_buffers;
|
|
|
+ pipelineResourceLayout->numUniformBuffers = createinfo->num_uniform_buffers;
|
|
|
|
|
|
// Read-only resources
|
|
|
|
|
@@ -3872,8 +3872,8 @@ static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
descriptorSetLayoutCreateInfo.flags = 0;
|
|
|
descriptorSetLayoutCreateInfo.pBindings = NULL;
|
|
|
descriptorSetLayoutCreateInfo.bindingCount =
|
|
|
- pipelineCreateInfo->readOnlyStorageTextureCount +
|
|
|
- pipelineCreateInfo->readOnlyStorageBufferCount;
|
|
|
+ createinfo->num_readonly_storage_textures +
|
|
|
+ createinfo->num_readonly_storage_buffers;
|
|
|
|
|
|
descriptorSetPool = &pipelineResourceLayout->descriptorSetPools[0];
|
|
|
|
|
@@ -3884,7 +3884,7 @@ static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos = SDL_malloc(
|
|
|
descriptorSetPool->descriptorInfoCount * sizeof(VulkanDescriptorInfo));
|
|
|
|
|
|
- for (i = 0; i < pipelineCreateInfo->readOnlyStorageTextureCount; i += 1) {
|
|
|
+ for (i = 0; i < createinfo->num_readonly_storage_textures; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
@@ -3895,7 +3895,7 @@ static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos[i].stageFlag = VK_SHADER_STAGE_COMPUTE_BIT;
|
|
|
}
|
|
|
|
|
|
- for (i = pipelineCreateInfo->readOnlyStorageTextureCount; i < descriptorSetLayoutCreateInfo.bindingCount; i += 1) {
|
|
|
+ for (i = createinfo->num_readonly_storage_textures; i < descriptorSetLayoutCreateInfo.bindingCount; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
|
@@ -3925,8 +3925,8 @@ static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
// Write-only resources
|
|
|
|
|
|
descriptorSetLayoutCreateInfo.bindingCount =
|
|
|
- pipelineCreateInfo->writeOnlyStorageTextureCount +
|
|
|
- pipelineCreateInfo->writeOnlyStorageBufferCount;
|
|
|
+ createinfo->num_writeonly_storage_textures +
|
|
|
+ createinfo->num_writeonly_storage_buffers;
|
|
|
|
|
|
descriptorSetLayoutCreateInfo.pBindings = NULL;
|
|
|
|
|
@@ -3939,7 +3939,7 @@ static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos = SDL_malloc(
|
|
|
descriptorSetPool->descriptorInfoCount * sizeof(VulkanDescriptorInfo));
|
|
|
|
|
|
- for (i = 0; i < pipelineCreateInfo->writeOnlyStorageTextureCount; i += 1) {
|
|
|
+ for (i = 0; i < createinfo->num_writeonly_storage_textures; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
@@ -3950,7 +3950,7 @@ static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos[i].stageFlag = VK_SHADER_STAGE_COMPUTE_BIT;
|
|
|
}
|
|
|
|
|
|
- for (i = pipelineCreateInfo->writeOnlyStorageTextureCount; i < descriptorSetLayoutCreateInfo.bindingCount; i += 1) {
|
|
|
+ for (i = createinfo->num_writeonly_storage_textures; i < descriptorSetLayoutCreateInfo.bindingCount; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
|
@@ -3981,7 +3981,7 @@ static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
|
|
|
descriptorSetPool = &pipelineResourceLayout->descriptorSetPools[2];
|
|
|
|
|
|
- descriptorSetLayoutCreateInfo.bindingCount = pipelineCreateInfo->uniformBufferCount;
|
|
|
+ descriptorSetLayoutCreateInfo.bindingCount = createinfo->num_uniform_buffers;
|
|
|
descriptorSetLayoutCreateInfo.pBindings = NULL;
|
|
|
|
|
|
descriptorSetPool->descriptorInfoCount = descriptorSetLayoutCreateInfo.bindingCount;
|
|
@@ -3991,7 +3991,7 @@ static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
descriptorSetPool->descriptorInfos = SDL_malloc(
|
|
|
descriptorSetPool->descriptorInfoCount * sizeof(VulkanDescriptorInfo));
|
|
|
|
|
|
- for (i = 0; i < pipelineCreateInfo->uniformBufferCount; i += 1) {
|
|
|
+ for (i = 0; i < createinfo->num_uniform_buffers; i += 1) {
|
|
|
descriptorSetLayoutBindings[i].binding = i;
|
|
|
descriptorSetLayoutBindings[i].descriptorCount = 1;
|
|
|
descriptorSetLayoutBindings[i].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
|
|
@@ -4058,7 +4058,7 @@ static VulkanBuffer *VULKAN_INTERNAL_CreateBuffer(
|
|
|
{
|
|
|
VulkanBuffer *buffer;
|
|
|
VkResult vulkanResult;
|
|
|
- VkBufferCreateInfo bufferCreateInfo;
|
|
|
+ VkBufferCreateInfo createinfo;
|
|
|
VkBufferUsageFlags vulkanUsageFlags = 0;
|
|
|
Uint8 bindResult;
|
|
|
|
|
@@ -4095,21 +4095,21 @@ static VulkanBuffer *VULKAN_INTERNAL_CreateBuffer(
|
|
|
buffer->markedForDestroy = 0;
|
|
|
buffer->transitioned = false;
|
|
|
|
|
|
- bufferCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
|
|
- bufferCreateInfo.pNext = NULL;
|
|
|
- bufferCreateInfo.flags = 0;
|
|
|
- bufferCreateInfo.size = size;
|
|
|
- bufferCreateInfo.usage = vulkanUsageFlags;
|
|
|
- bufferCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
|
|
- bufferCreateInfo.queueFamilyIndexCount = 1;
|
|
|
- bufferCreateInfo.pQueueFamilyIndices = &renderer->queueFamilyIndex;
|
|
|
+ createinfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
|
|
+ createinfo.pNext = NULL;
|
|
|
+ createinfo.flags = 0;
|
|
|
+ createinfo.size = size;
|
|
|
+ createinfo.usage = vulkanUsageFlags;
|
|
|
+ createinfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
|
|
+ createinfo.queueFamilyIndexCount = 1;
|
|
|
+ createinfo.pQueueFamilyIndices = &renderer->queueFamilyIndex;
|
|
|
|
|
|
// Set transfer bits so we can defrag
|
|
|
- bufferCreateInfo.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
|
|
+ createinfo.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
|
|
|
|
|
vulkanResult = renderer->vkCreateBuffer(
|
|
|
renderer->logicalDevice,
|
|
|
- &bufferCreateInfo,
|
|
|
+ &createinfo,
|
|
|
NULL,
|
|
|
&buffer->buffer);
|
|
|
VULKAN_ERROR_CHECK(vulkanResult, vkCreateBuffer, 0)
|
|
@@ -4141,7 +4141,7 @@ static VulkanBuffer *VULKAN_INTERNAL_CreateBuffer(
|
|
|
// Indirection so we can cleanly defrag buffers
|
|
|
static VulkanBufferHandle *VULKAN_INTERNAL_CreateBufferHandle(
|
|
|
VulkanRenderer *renderer,
|
|
|
- VkDeviceSize sizeInBytes,
|
|
|
+ VkDeviceSize size,
|
|
|
SDL_GPUBufferUsageFlags usageFlags,
|
|
|
VulkanBufferType type)
|
|
|
{
|
|
@@ -4150,7 +4150,7 @@ static VulkanBufferHandle *VULKAN_INTERNAL_CreateBufferHandle(
|
|
|
|
|
|
buffer = VULKAN_INTERNAL_CreateBuffer(
|
|
|
renderer,
|
|
|
- sizeInBytes,
|
|
|
+ size,
|
|
|
usageFlags,
|
|
|
type);
|
|
|
|
|
@@ -4170,7 +4170,7 @@ static VulkanBufferHandle *VULKAN_INTERNAL_CreateBufferHandle(
|
|
|
|
|
|
static VulkanBufferContainer *VULKAN_INTERNAL_CreateBufferContainer(
|
|
|
VulkanRenderer *renderer,
|
|
|
- VkDeviceSize sizeInBytes,
|
|
|
+ VkDeviceSize size,
|
|
|
SDL_GPUBufferUsageFlags usageFlags,
|
|
|
VulkanBufferType type)
|
|
|
{
|
|
@@ -4179,7 +4179,7 @@ static VulkanBufferContainer *VULKAN_INTERNAL_CreateBufferContainer(
|
|
|
|
|
|
bufferHandle = VULKAN_INTERNAL_CreateBufferHandle(
|
|
|
renderer,
|
|
|
- sizeInBytes,
|
|
|
+ size,
|
|
|
usageFlags,
|
|
|
type);
|
|
|
|
|
@@ -4221,7 +4221,7 @@ static VulkanTextureSubresource *VULKAN_INTERNAL_FetchTextureSubresource(
|
|
|
Uint32 index = VULKAN_INTERNAL_GetTextureSubresourceIndex(
|
|
|
level,
|
|
|
layer,
|
|
|
- textureContainer->header.info.levelCount);
|
|
|
+ textureContainer->header.info.num_levels);
|
|
|
|
|
|
return &textureContainer->activeTextureHandle->vulkanTexture->subresources[index];
|
|
|
}
|
|
@@ -4461,17 +4461,17 @@ static bool VULKAN_INTERNAL_CreateSwapchain(
|
|
|
bool hasValidSwapchainComposition, hasValidPresentMode;
|
|
|
Sint32 drawableWidth, drawableHeight;
|
|
|
Uint32 i;
|
|
|
- SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
|
|
+ SDL_VideoDevice *this = SDL_GetVideoDevice();
|
|
|
|
|
|
- SDL_assert(_this && _this->Vulkan_CreateSurface);
|
|
|
+ SDL_assert(this && this->Vulkan_CreateSurface);
|
|
|
|
|
|
swapchainData = SDL_malloc(sizeof(VulkanSwapchainData));
|
|
|
swapchainData->frameCounter = 0;
|
|
|
|
|
|
// Each swapchain must have its own surface.
|
|
|
|
|
|
- if (!_this->Vulkan_CreateSurface(
|
|
|
- _this,
|
|
|
+ if (!this->Vulkan_CreateSurface(
|
|
|
+ this,
|
|
|
windowData->window,
|
|
|
renderer->instance,
|
|
|
NULL, // FIXME: VAllocationCallbacks
|
|
@@ -4571,7 +4571,7 @@ static bool VULKAN_INTERNAL_CreateSwapchain(
|
|
|
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Device does not support requested swapchain composition!");
|
|
|
}
|
|
|
if (!hasValidPresentMode) {
|
|
|
- SDL_LogError(SDL_LOG_CATEGORY_GPU, "Device does not support requested presentMode!");
|
|
|
+ SDL_LogError(SDL_LOG_CATEGORY_GPU, "Device does not support requested present_mode!");
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -4712,14 +4712,14 @@ static bool VULKAN_INTERNAL_CreateSwapchain(
|
|
|
swapchainData->textureContainers[i].canBeCycled = false;
|
|
|
swapchainData->textureContainers[i].header.info.width = drawableWidth;
|
|
|
swapchainData->textureContainers[i].header.info.height = drawableHeight;
|
|
|
- swapchainData->textureContainers[i].header.info.layerCountOrDepth = 1;
|
|
|
+ swapchainData->textureContainers[i].header.info.layer_count_or_depth = 1;
|
|
|
swapchainData->textureContainers[i].header.info.format = SwapchainCompositionToSDLFormat(
|
|
|
windowData->swapchainComposition,
|
|
|
swapchainData->usingFallbackFormat);
|
|
|
swapchainData->textureContainers[i].header.info.type = SDL_GPU_TEXTURETYPE_2D;
|
|
|
- swapchainData->textureContainers[i].header.info.levelCount = 1;
|
|
|
- swapchainData->textureContainers[i].header.info.sampleCount = SDL_GPU_SAMPLECOUNT_1;
|
|
|
- swapchainData->textureContainers[i].header.info.usageFlags = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET;
|
|
|
+ swapchainData->textureContainers[i].header.info.num_levels = 1;
|
|
|
+ swapchainData->textureContainers[i].header.info.sample_count = SDL_GPU_SAMPLECOUNT_1;
|
|
|
+ swapchainData->textureContainers[i].header.info.usage = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET;
|
|
|
|
|
|
swapchainData->textureContainers[i].activeTextureHandle = SDL_malloc(sizeof(VulkanTextureHandle));
|
|
|
|
|
@@ -4737,7 +4737,7 @@ static bool VULKAN_INTERNAL_CreateSwapchain(
|
|
|
swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->type = SDL_GPU_TEXTURETYPE_2D;
|
|
|
swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->depth = 1;
|
|
|
swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->layerCount = 1;
|
|
|
- swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->levelCount = 1;
|
|
|
+ swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->numLevels = 1;
|
|
|
swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->sampleCount = VK_SAMPLE_COUNT_1_BIT;
|
|
|
swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->usageFlags =
|
|
|
SDL_GPU_TEXTUREUSAGE_COLOR_TARGET;
|
|
@@ -5351,8 +5351,8 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets(
|
|
|
|
|
|
static void VULKAN_DrawIndexedPrimitives(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
- Uint32 indexCount,
|
|
|
- Uint32 instanceCount,
|
|
|
+ Uint32 numIndices,
|
|
|
+ Uint32 numInstances,
|
|
|
Uint32 firstIndex,
|
|
|
Sint32 vertexOffset,
|
|
|
Uint32 firstInstance)
|
|
@@ -5364,8 +5364,8 @@ static void VULKAN_DrawIndexedPrimitives(
|
|
|
|
|
|
renderer->vkCmdDrawIndexed(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
- indexCount,
|
|
|
- instanceCount,
|
|
|
+ numIndices,
|
|
|
+ numInstances,
|
|
|
firstIndex,
|
|
|
vertexOffset,
|
|
|
firstInstance);
|
|
@@ -5373,8 +5373,8 @@ static void VULKAN_DrawIndexedPrimitives(
|
|
|
|
|
|
static void VULKAN_DrawPrimitives(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
- Uint32 vertexCount,
|
|
|
- Uint32 instanceCount,
|
|
|
+ Uint32 numVertices,
|
|
|
+ Uint32 numInstances,
|
|
|
Uint32 firstVertex,
|
|
|
Uint32 firstInstance)
|
|
|
{
|
|
@@ -5385,8 +5385,8 @@ static void VULKAN_DrawPrimitives(
|
|
|
|
|
|
renderer->vkCmdDraw(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
- vertexCount,
|
|
|
- instanceCount,
|
|
|
+ numVertices,
|
|
|
+ numInstances,
|
|
|
firstVertex,
|
|
|
firstInstance);
|
|
|
}
|
|
@@ -5394,9 +5394,9 @@ static void VULKAN_DrawPrimitives(
|
|
|
static void VULKAN_DrawPrimitivesIndirect(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
SDL_GPUBuffer *buffer,
|
|
|
- Uint32 offsetInBytes,
|
|
|
+ Uint32 offset,
|
|
|
Uint32 drawCount,
|
|
|
- Uint32 stride)
|
|
|
+ Uint32 pitch)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
@@ -5410,18 +5410,18 @@ static void VULKAN_DrawPrimitivesIndirect(
|
|
|
renderer->vkCmdDrawIndirect(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
vulkanBuffer->buffer,
|
|
|
- offsetInBytes,
|
|
|
+ offset,
|
|
|
drawCount,
|
|
|
- stride);
|
|
|
+ pitch);
|
|
|
} else {
|
|
|
// Fake multi-draw...
|
|
|
for (i = 0; i < drawCount; i += 1) {
|
|
|
renderer->vkCmdDrawIndirect(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
vulkanBuffer->buffer,
|
|
|
- offsetInBytes + (stride * i),
|
|
|
+ offset + (pitch * i),
|
|
|
1,
|
|
|
- stride);
|
|
|
+ pitch);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -5431,9 +5431,9 @@ static void VULKAN_DrawPrimitivesIndirect(
|
|
|
static void VULKAN_DrawIndexedPrimitivesIndirect(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
SDL_GPUBuffer *buffer,
|
|
|
- Uint32 offsetInBytes,
|
|
|
+ Uint32 offset,
|
|
|
Uint32 drawCount,
|
|
|
- Uint32 stride)
|
|
|
+ Uint32 pitch)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
@@ -5447,18 +5447,18 @@ static void VULKAN_DrawIndexedPrimitivesIndirect(
|
|
|
renderer->vkCmdDrawIndexedIndirect(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
vulkanBuffer->buffer,
|
|
|
- offsetInBytes,
|
|
|
+ offset,
|
|
|
drawCount,
|
|
|
- stride);
|
|
|
+ pitch);
|
|
|
} else {
|
|
|
// Fake multi-draw...
|
|
|
for (i = 0; i < drawCount; i += 1) {
|
|
|
renderer->vkCmdDrawIndexedIndirect(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
vulkanBuffer->buffer,
|
|
|
- offsetInBytes + (stride * i),
|
|
|
+ offset + (pitch * i),
|
|
|
1,
|
|
|
- stride);
|
|
|
+ pitch);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -5619,7 +5619,7 @@ static VulkanTextureHandle *VULKAN_INTERNAL_CreateTextureHandle(
|
|
|
Uint32 depth,
|
|
|
SDL_GPUTextureType type,
|
|
|
Uint32 layerCount,
|
|
|
- Uint32 levelCount,
|
|
|
+ Uint32 numLevels,
|
|
|
VkSampleCountFlagBits sampleCount,
|
|
|
VkFormat format,
|
|
|
VkComponentMapping swizzle,
|
|
@@ -5637,7 +5637,7 @@ static VulkanTextureHandle *VULKAN_INTERNAL_CreateTextureHandle(
|
|
|
depth,
|
|
|
type,
|
|
|
layerCount,
|
|
|
- levelCount,
|
|
|
+ numLevels,
|
|
|
sampleCount,
|
|
|
format,
|
|
|
swizzle,
|
|
@@ -5666,7 +5666,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
|
|
|
Uint32 depth,
|
|
|
SDL_GPUTextureType type,
|
|
|
Uint32 layerCount,
|
|
|
- Uint32 levelCount,
|
|
|
+ Uint32 numLevels,
|
|
|
VkSampleCountFlagBits sampleCount,
|
|
|
VkFormat format,
|
|
|
VkComponentMapping swizzle,
|
|
@@ -5718,7 +5718,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
|
|
|
imageCreateInfo.extent.width = width;
|
|
|
imageCreateInfo.extent.height = height;
|
|
|
imageCreateInfo.extent.depth = depth;
|
|
|
- imageCreateInfo.mipLevels = levelCount;
|
|
|
+ imageCreateInfo.mipLevels = numLevels;
|
|
|
imageCreateInfo.arrayLayers = layerCount;
|
|
|
imageCreateInfo.samples = isMSAAColorTarget || VULKAN_INTERNAL_IsVulkanDepthFormat(format) ? sampleCount : VK_SAMPLE_COUNT_1_BIT;
|
|
|
imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
|
@@ -5767,7 +5767,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
|
|
|
imageViewCreateInfo.components = swizzle;
|
|
|
imageViewCreateInfo.subresourceRange.aspectMask = aspectMask;
|
|
|
imageViewCreateInfo.subresourceRange.baseMipLevel = 0;
|
|
|
- imageViewCreateInfo.subresourceRange.levelCount = levelCount;
|
|
|
+ imageViewCreateInfo.subresourceRange.levelCount = numLevels;
|
|
|
imageViewCreateInfo.subresourceRange.baseArrayLayer = 0;
|
|
|
imageViewCreateInfo.subresourceRange.layerCount = layerCount;
|
|
|
|
|
@@ -5799,7 +5799,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
|
|
|
texture->depth = depth;
|
|
|
texture->format = format;
|
|
|
texture->swizzle = swizzle;
|
|
|
- texture->levelCount = levelCount;
|
|
|
+ texture->numLevels = numLevels;
|
|
|
texture->layerCount = layerCount;
|
|
|
texture->sampleCount = sampleCount;
|
|
|
texture->usageFlags = textureUsageFlags;
|
|
@@ -5809,17 +5809,17 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
|
|
|
// Define slices
|
|
|
texture->subresourceCount =
|
|
|
texture->layerCount *
|
|
|
- texture->levelCount;
|
|
|
+ texture->numLevels;
|
|
|
|
|
|
texture->subresources = SDL_malloc(
|
|
|
texture->subresourceCount * sizeof(VulkanTextureSubresource));
|
|
|
|
|
|
for (Uint32 i = 0; i < texture->layerCount; i += 1) {
|
|
|
- for (Uint32 j = 0; j < texture->levelCount; j += 1) {
|
|
|
+ for (Uint32 j = 0; j < texture->numLevels; j += 1) {
|
|
|
Uint32 subresourceIndex = VULKAN_INTERNAL_GetTextureSubresourceIndex(
|
|
|
j,
|
|
|
i,
|
|
|
- texture->levelCount);
|
|
|
+ texture->numLevels);
|
|
|
|
|
|
texture->subresources[subresourceIndex].renderTargetViews = NULL;
|
|
|
texture->subresources[subresourceIndex].computeWriteView = VK_NULL_HANDLE;
|
|
@@ -5970,7 +5970,7 @@ static void VULKAN_INTERNAL_CycleActiveTexture(
|
|
|
textureContainer->activeTextureHandle->vulkanTexture->depth,
|
|
|
textureContainer->activeTextureHandle->vulkanTexture->type,
|
|
|
textureContainer->activeTextureHandle->vulkanTexture->layerCount,
|
|
|
- textureContainer->activeTextureHandle->vulkanTexture->levelCount,
|
|
|
+ textureContainer->activeTextureHandle->vulkanTexture->numLevels,
|
|
|
textureContainer->activeTextureHandle->vulkanTexture->sampleCount,
|
|
|
textureContainer->activeTextureHandle->vulkanTexture->format,
|
|
|
textureContainer->activeTextureHandle->vulkanTexture->swizzle,
|
|
@@ -6066,9 +6066,9 @@ static VulkanTextureSubresource *VULKAN_INTERNAL_PrepareTextureSubresourceForWri
|
|
|
static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
VulkanRenderer *renderer,
|
|
|
VulkanCommandBuffer *commandBuffer,
|
|
|
- const SDL_GPUColorAttachmentInfo *colorAttachmentInfos,
|
|
|
- Uint32 colorAttachmentCount,
|
|
|
- const SDL_GPUDepthStencilAttachmentInfo *depthStencilAttachmentInfo)
|
|
|
+ const SDL_GPUColorTargetInfo *colorTargetInfos,
|
|
|
+ Uint32 numColorTargets,
|
|
|
+ const SDL_GPUDepthStencilTargetInfo *depthStencilTargetInfo)
|
|
|
{
|
|
|
VkResult vulkanResult;
|
|
|
VkAttachmentDescription attachmentDescriptions[2 * MAX_COLOR_TARGET_BINDINGS + 1];
|
|
@@ -6086,8 +6086,8 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
|
|
VulkanTexture *texture = NULL;
|
|
|
|
|
|
- for (i = 0; i < colorAttachmentCount; i += 1) {
|
|
|
- texture = ((VulkanTextureContainer *)colorAttachmentInfos[i].texture)->activeTextureHandle->vulkanTexture;
|
|
|
+ for (i = 0; i < numColorTargets; i += 1) {
|
|
|
+ texture = ((VulkanTextureContainer *)colorTargetInfos[i].texture)->activeTextureHandle->vulkanTexture;
|
|
|
|
|
|
if (texture->sampleCount > VK_SAMPLE_COUNT_1_BIT) {
|
|
|
// Resolve attachment and multisample attachment
|
|
@@ -6096,7 +6096,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
attachmentDescriptions[attachmentDescriptionCount].format = texture->format;
|
|
|
attachmentDescriptions[attachmentDescriptionCount].samples =
|
|
|
VK_SAMPLE_COUNT_1_BIT;
|
|
|
- attachmentDescriptions[attachmentDescriptionCount].loadOp = SDLToVK_LoadOp[colorAttachmentInfos[i].loadOp];
|
|
|
+ attachmentDescriptions[attachmentDescriptionCount].loadOp = SDLToVK_LoadOp[colorTargetInfos[i].load_op];
|
|
|
attachmentDescriptions[attachmentDescriptionCount].storeOp =
|
|
|
VK_ATTACHMENT_STORE_OP_STORE; // Always store the resolve texture
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
|
@@ -6119,8 +6119,8 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
|
|
attachmentDescriptions[attachmentDescriptionCount].format = texture->format;
|
|
|
attachmentDescriptions[attachmentDescriptionCount].samples = texture->sampleCount;
|
|
|
- attachmentDescriptions[attachmentDescriptionCount].loadOp = SDLToVK_LoadOp[colorAttachmentInfos[i].loadOp];
|
|
|
- attachmentDescriptions[attachmentDescriptionCount].storeOp = SDLToVK_StoreOp[colorAttachmentInfos[i].storeOp];
|
|
|
+ attachmentDescriptions[attachmentDescriptionCount].loadOp = SDLToVK_LoadOp[colorTargetInfos[i].load_op];
|
|
|
+ attachmentDescriptions[attachmentDescriptionCount].storeOp = SDLToVK_StoreOp[colorTargetInfos[i].store_op];
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
|
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
|
@@ -6142,7 +6142,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
attachmentDescriptions[attachmentDescriptionCount].format = texture->format;
|
|
|
attachmentDescriptions[attachmentDescriptionCount].samples =
|
|
|
VK_SAMPLE_COUNT_1_BIT;
|
|
|
- attachmentDescriptions[attachmentDescriptionCount].loadOp = SDLToVK_LoadOp[colorAttachmentInfos[i].loadOp];
|
|
|
+ attachmentDescriptions[attachmentDescriptionCount].loadOp = SDLToVK_LoadOp[colorTargetInfos[i].load_op];
|
|
|
attachmentDescriptions[attachmentDescriptionCount].storeOp =
|
|
|
VK_ATTACHMENT_STORE_OP_STORE; // Always store non-MSAA textures
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
|
@@ -6167,24 +6167,24 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
subpass.flags = 0;
|
|
|
subpass.inputAttachmentCount = 0;
|
|
|
subpass.pInputAttachments = NULL;
|
|
|
- subpass.colorAttachmentCount = colorAttachmentCount;
|
|
|
+ subpass.colorAttachmentCount = numColorTargets;
|
|
|
subpass.pColorAttachments = colorAttachmentReferences;
|
|
|
subpass.preserveAttachmentCount = 0;
|
|
|
subpass.pPreserveAttachments = NULL;
|
|
|
|
|
|
- if (depthStencilAttachmentInfo == NULL) {
|
|
|
+ if (depthStencilTargetInfo == NULL) {
|
|
|
subpass.pDepthStencilAttachment = NULL;
|
|
|
} else {
|
|
|
- texture = ((VulkanTextureContainer *)depthStencilAttachmentInfo->texture)->activeTextureHandle->vulkanTexture;
|
|
|
+ texture = ((VulkanTextureContainer *)depthStencilTargetInfo->texture)->activeTextureHandle->vulkanTexture;
|
|
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
|
|
attachmentDescriptions[attachmentDescriptionCount].format = texture->format;
|
|
|
attachmentDescriptions[attachmentDescriptionCount].samples = texture->sampleCount;
|
|
|
|
|
|
- attachmentDescriptions[attachmentDescriptionCount].loadOp = SDLToVK_LoadOp[depthStencilAttachmentInfo->loadOp];
|
|
|
- attachmentDescriptions[attachmentDescriptionCount].storeOp = SDLToVK_StoreOp[depthStencilAttachmentInfo->storeOp];
|
|
|
- attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = SDLToVK_LoadOp[depthStencilAttachmentInfo->stencilLoadOp];
|
|
|
- attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp = SDLToVK_StoreOp[depthStencilAttachmentInfo->stencilStoreOp];
|
|
|
+ attachmentDescriptions[attachmentDescriptionCount].loadOp = SDLToVK_LoadOp[depthStencilTargetInfo->load_op];
|
|
|
+ attachmentDescriptions[attachmentDescriptionCount].storeOp = SDLToVK_StoreOp[depthStencilTargetInfo->store_op];
|
|
|
+ attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = SDLToVK_LoadOp[depthStencilTargetInfo->stencil_load_op];
|
|
|
+ attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp = SDLToVK_StoreOp[depthStencilTargetInfo->stencil_store_op];
|
|
|
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
|
|
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
|
|
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
|
@@ -6233,14 +6233,14 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
|
|
static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
VulkanRenderer *renderer,
|
|
|
- SDL_GPUGraphicsPipelineAttachmentInfo attachmentInfo,
|
|
|
+ SDL_GpuGraphicsPipelineTargetInfo attachmentInfo,
|
|
|
VkSampleCountFlagBits sampleCount)
|
|
|
{
|
|
|
VkAttachmentDescription attachmentDescriptions[2 * MAX_COLOR_TARGET_BINDINGS + 1];
|
|
|
VkAttachmentReference colorAttachmentReferences[MAX_COLOR_TARGET_BINDINGS];
|
|
|
VkAttachmentReference resolveReferences[MAX_COLOR_TARGET_BINDINGS + 1];
|
|
|
VkAttachmentReference depthStencilAttachmentReference;
|
|
|
- SDL_GPUColorAttachmentDescription attachmentDescription;
|
|
|
+ SDL_GPUColorTargetDescription attachmentDescription;
|
|
|
VkSubpassDescription subpass;
|
|
|
VkRenderPassCreateInfo renderPassCreateInfo;
|
|
|
VkRenderPass renderPass;
|
|
@@ -6252,8 +6252,8 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
Uint32 resolveReferenceCount = 0;
|
|
|
Uint32 i;
|
|
|
|
|
|
- for (i = 0; i < attachmentInfo.colorAttachmentCount; i += 1) {
|
|
|
- attachmentDescription = attachmentInfo.colorAttachmentDescriptions[i];
|
|
|
+ for (i = 0; i < attachmentInfo.num_color_targets; i += 1) {
|
|
|
+ attachmentDescription = attachmentInfo.color_target_descriptions[i];
|
|
|
|
|
|
if (sampleCount > VK_SAMPLE_COUNT_1_BIT) {
|
|
|
multisampling = 1;
|
|
@@ -6325,15 +6325,15 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
subpass.flags = 0;
|
|
|
subpass.inputAttachmentCount = 0;
|
|
|
subpass.pInputAttachments = NULL;
|
|
|
- subpass.colorAttachmentCount = attachmentInfo.colorAttachmentCount;
|
|
|
+ subpass.colorAttachmentCount = attachmentInfo.num_color_targets;
|
|
|
subpass.pColorAttachments = colorAttachmentReferences;
|
|
|
subpass.preserveAttachmentCount = 0;
|
|
|
subpass.pPreserveAttachments = NULL;
|
|
|
|
|
|
- if (attachmentInfo.hasDepthStencilAttachment) {
|
|
|
+ if (attachmentInfo.has_depth_stencil_target) {
|
|
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
|
|
attachmentDescriptions[attachmentDescriptionCount].format =
|
|
|
- SDLToVK_SurfaceFormat[attachmentInfo.depthStencilFormat];
|
|
|
+ SDLToVK_SurfaceFormat[attachmentInfo.depth_stencil_format];
|
|
|
attachmentDescriptions[attachmentDescriptionCount].samples = sampleCount;
|
|
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
|
@@ -6390,7 +6390,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
|
|
|
static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
SDL_GPURenderer *driverData,
|
|
|
- const SDL_GPUGraphicsPipelineCreateInfo *pipelineCreateInfo)
|
|
|
+ const SDL_GPUGraphicsPipelineCreateInfo *createinfo)
|
|
|
{
|
|
|
VkResult vulkanResult;
|
|
|
Uint32 i;
|
|
@@ -6403,9 +6403,9 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
|
|
|
VkPipelineVertexInputStateCreateInfo vertexInputStateCreateInfo;
|
|
|
VkPipelineVertexInputDivisorStateCreateInfoEXT divisorStateCreateInfo;
|
|
|
- VkVertexInputBindingDescription *vertexInputBindingDescriptions = SDL_stack_alloc(VkVertexInputBindingDescription, pipelineCreateInfo->vertexInputState.vertexBindingCount);
|
|
|
- VkVertexInputAttributeDescription *vertexInputAttributeDescriptions = SDL_stack_alloc(VkVertexInputAttributeDescription, pipelineCreateInfo->vertexInputState.vertexAttributeCount);
|
|
|
- VkVertexInputBindingDivisorDescriptionEXT *divisorDescriptions = SDL_stack_alloc(VkVertexInputBindingDivisorDescriptionEXT, pipelineCreateInfo->vertexInputState.vertexBindingCount);
|
|
|
+ VkVertexInputBindingDescription *vertexInputBindingDescriptions = SDL_stack_alloc(VkVertexInputBindingDescription, createinfo->vertex_input_state.num_vertex_bindings);
|
|
|
+ VkVertexInputAttributeDescription *vertexInputAttributeDescriptions = SDL_stack_alloc(VkVertexInputAttributeDescription, createinfo->vertex_input_state.num_vertex_attributes);
|
|
|
+ VkVertexInputBindingDivisorDescriptionEXT *divisorDescriptions = SDL_stack_alloc(VkVertexInputBindingDivisorDescriptionEXT, createinfo->vertex_input_state.num_vertex_bindings);
|
|
|
Uint32 divisorDescriptionCount = 0;
|
|
|
|
|
|
VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCreateInfo;
|
|
@@ -6423,7 +6423,7 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
VkPipelineColorBlendStateCreateInfo colorBlendStateCreateInfo;
|
|
|
VkPipelineColorBlendAttachmentState *colorBlendAttachmentStates = SDL_stack_alloc(
|
|
|
VkPipelineColorBlendAttachmentState,
|
|
|
- pipelineCreateInfo->attachmentInfo.colorAttachmentCount);
|
|
|
+ createinfo->target_info.num_color_targets);
|
|
|
|
|
|
static const VkDynamicState dynamicStates[] = {
|
|
|
VK_DYNAMIC_STATE_VIEWPORT,
|
|
@@ -6439,13 +6439,13 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
|
|
|
actualSampleCount = VULKAN_INTERNAL_GetMaxMultiSampleCount(
|
|
|
renderer,
|
|
|
- SDLToVK_SampleCount[pipelineCreateInfo->multisampleState.sampleCount]);
|
|
|
+ SDLToVK_SampleCount[createinfo->multisample_state.sample_count]);
|
|
|
|
|
|
// Create a "compatible" render pass
|
|
|
|
|
|
VkRenderPass transientRenderPass = VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
renderer,
|
|
|
- pipelineCreateInfo->attachmentInfo,
|
|
|
+ createinfo->target_info,
|
|
|
actualSampleCount);
|
|
|
|
|
|
// Dynamic state
|
|
@@ -6458,7 +6458,7 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
|
|
|
// Shader stages
|
|
|
|
|
|
- graphicsPipeline->vertexShader = (VulkanShader *)pipelineCreateInfo->vertexShader;
|
|
|
+ graphicsPipeline->vertexShader = (VulkanShader *)createinfo->vertex_shader;
|
|
|
SDL_AtomicIncRef(&graphicsPipeline->vertexShader->referenceCount);
|
|
|
|
|
|
shaderStageCreateInfos[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
|
@@ -6466,10 +6466,10 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
shaderStageCreateInfos[0].flags = 0;
|
|
|
shaderStageCreateInfos[0].stage = VK_SHADER_STAGE_VERTEX_BIT;
|
|
|
shaderStageCreateInfos[0].module = graphicsPipeline->vertexShader->shaderModule;
|
|
|
- shaderStageCreateInfos[0].pName = graphicsPipeline->vertexShader->entryPointName;
|
|
|
+ shaderStageCreateInfos[0].pName = graphicsPipeline->vertexShader->entrypointName;
|
|
|
shaderStageCreateInfos[0].pSpecializationInfo = NULL;
|
|
|
|
|
|
- graphicsPipeline->fragmentShader = (VulkanShader *)pipelineCreateInfo->fragmentShader;
|
|
|
+ graphicsPipeline->fragmentShader = (VulkanShader *)createinfo->fragment_shader;
|
|
|
SDL_AtomicIncRef(&graphicsPipeline->fragmentShader->referenceCount);
|
|
|
|
|
|
shaderStageCreateInfos[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
|
@@ -6477,43 +6477,43 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
shaderStageCreateInfos[1].flags = 0;
|
|
|
shaderStageCreateInfos[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
|
|
|
shaderStageCreateInfos[1].module = graphicsPipeline->fragmentShader->shaderModule;
|
|
|
- shaderStageCreateInfos[1].pName = graphicsPipeline->fragmentShader->entryPointName;
|
|
|
+ shaderStageCreateInfos[1].pName = graphicsPipeline->fragmentShader->entrypointName;
|
|
|
shaderStageCreateInfos[1].pSpecializationInfo = NULL;
|
|
|
|
|
|
// Vertex input
|
|
|
|
|
|
- for (i = 0; i < pipelineCreateInfo->vertexInputState.vertexBindingCount; i += 1) {
|
|
|
- vertexInputBindingDescriptions[i].binding = pipelineCreateInfo->vertexInputState.vertexBindings[i].binding;
|
|
|
- vertexInputBindingDescriptions[i].inputRate = SDLToVK_VertexInputRate[pipelineCreateInfo->vertexInputState.vertexBindings[i].inputRate];
|
|
|
- vertexInputBindingDescriptions[i].stride = pipelineCreateInfo->vertexInputState.vertexBindings[i].stride;
|
|
|
+ for (i = 0; i < createinfo->vertex_input_state.num_vertex_bindings; i += 1) {
|
|
|
+ vertexInputBindingDescriptions[i].binding = createinfo->vertex_input_state.vertex_bindings[i].binding;
|
|
|
+ vertexInputBindingDescriptions[i].inputRate = SDLToVK_VertexInputRate[createinfo->vertex_input_state.vertex_bindings[i].input_rate];
|
|
|
+ vertexInputBindingDescriptions[i].stride = createinfo->vertex_input_state.vertex_bindings[i].pitch;
|
|
|
|
|
|
- if (pipelineCreateInfo->vertexInputState.vertexBindings[i].inputRate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) {
|
|
|
+ if (createinfo->vertex_input_state.vertex_bindings[i].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) {
|
|
|
divisorDescriptionCount += 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (i = 0; i < pipelineCreateInfo->vertexInputState.vertexAttributeCount; i += 1) {
|
|
|
- vertexInputAttributeDescriptions[i].binding = pipelineCreateInfo->vertexInputState.vertexAttributes[i].binding;
|
|
|
- vertexInputAttributeDescriptions[i].format = SDLToVK_VertexFormat[pipelineCreateInfo->vertexInputState.vertexAttributes[i].format];
|
|
|
- vertexInputAttributeDescriptions[i].location = pipelineCreateInfo->vertexInputState.vertexAttributes[i].location;
|
|
|
- vertexInputAttributeDescriptions[i].offset = pipelineCreateInfo->vertexInputState.vertexAttributes[i].offset;
|
|
|
+ for (i = 0; i < createinfo->vertex_input_state.num_vertex_attributes; i += 1) {
|
|
|
+ vertexInputAttributeDescriptions[i].binding = createinfo->vertex_input_state.vertex_attributes[i].binding;
|
|
|
+ vertexInputAttributeDescriptions[i].format = SDLToVK_VertexFormat[createinfo->vertex_input_state.vertex_attributes[i].format];
|
|
|
+ vertexInputAttributeDescriptions[i].location = createinfo->vertex_input_state.vertex_attributes[i].location;
|
|
|
+ vertexInputAttributeDescriptions[i].offset = createinfo->vertex_input_state.vertex_attributes[i].offset;
|
|
|
}
|
|
|
|
|
|
vertexInputStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
|
|
|
vertexInputStateCreateInfo.pNext = NULL;
|
|
|
vertexInputStateCreateInfo.flags = 0;
|
|
|
- vertexInputStateCreateInfo.vertexBindingDescriptionCount = pipelineCreateInfo->vertexInputState.vertexBindingCount;
|
|
|
+ vertexInputStateCreateInfo.vertexBindingDescriptionCount = createinfo->vertex_input_state.num_vertex_bindings;
|
|
|
vertexInputStateCreateInfo.pVertexBindingDescriptions = vertexInputBindingDescriptions;
|
|
|
- vertexInputStateCreateInfo.vertexAttributeDescriptionCount = pipelineCreateInfo->vertexInputState.vertexAttributeCount;
|
|
|
+ vertexInputStateCreateInfo.vertexAttributeDescriptionCount = createinfo->vertex_input_state.num_vertex_attributes;
|
|
|
vertexInputStateCreateInfo.pVertexAttributeDescriptions = vertexInputAttributeDescriptions;
|
|
|
|
|
|
if (divisorDescriptionCount > 0) {
|
|
|
divisorDescriptionCount = 0;
|
|
|
|
|
|
- for (i = 0; i < pipelineCreateInfo->vertexInputState.vertexBindingCount; i += 1) {
|
|
|
- if (pipelineCreateInfo->vertexInputState.vertexBindings[i].inputRate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) {
|
|
|
- divisorDescriptions[divisorDescriptionCount].binding = pipelineCreateInfo->vertexInputState.vertexBindings[i].binding;
|
|
|
- divisorDescriptions[divisorDescriptionCount].divisor = pipelineCreateInfo->vertexInputState.vertexBindings[i].instanceStepRate;
|
|
|
+ for (i = 0; i < createinfo->vertex_input_state.num_vertex_bindings; i += 1) {
|
|
|
+ if (createinfo->vertex_input_state.vertex_bindings[i].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) {
|
|
|
+ divisorDescriptions[divisorDescriptionCount].binding = createinfo->vertex_input_state.vertex_bindings[i].binding;
|
|
|
+ divisorDescriptions[divisorDescriptionCount].divisor = createinfo->vertex_input_state.vertex_bindings[i].instance_step_rate;
|
|
|
|
|
|
divisorDescriptionCount += 1;
|
|
|
}
|
|
@@ -6533,9 +6533,9 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
inputAssemblyStateCreateInfo.pNext = NULL;
|
|
|
inputAssemblyStateCreateInfo.flags = 0;
|
|
|
inputAssemblyStateCreateInfo.primitiveRestartEnable = VK_FALSE;
|
|
|
- inputAssemblyStateCreateInfo.topology = SDLToVK_PrimitiveType[pipelineCreateInfo->primitiveType];
|
|
|
+ inputAssemblyStateCreateInfo.topology = SDLToVK_PrimitiveType[createinfo->primitive_type];
|
|
|
|
|
|
- graphicsPipeline->primitiveType = pipelineCreateInfo->primitiveType;
|
|
|
+ graphicsPipeline->primitiveType = createinfo->primitive_type;
|
|
|
|
|
|
// Viewport
|
|
|
|
|
@@ -6558,17 +6558,17 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
rasterizationStateCreateInfo.rasterizerDiscardEnable = VK_FALSE;
|
|
|
rasterizationStateCreateInfo.polygonMode = SDLToVK_PolygonMode(
|
|
|
renderer,
|
|
|
- pipelineCreateInfo->rasterizerState.fillMode);
|
|
|
- rasterizationStateCreateInfo.cullMode = SDLToVK_CullMode[pipelineCreateInfo->rasterizerState.cullMode];
|
|
|
- rasterizationStateCreateInfo.frontFace = SDLToVK_FrontFace[pipelineCreateInfo->rasterizerState.frontFace];
|
|
|
+ createinfo->rasterizer_state.fill_mode);
|
|
|
+ rasterizationStateCreateInfo.cullMode = SDLToVK_CullMode[createinfo->rasterizer_state.cull_mode];
|
|
|
+ rasterizationStateCreateInfo.frontFace = SDLToVK_FrontFace[createinfo->rasterizer_state.front_face];
|
|
|
rasterizationStateCreateInfo.depthBiasEnable =
|
|
|
- pipelineCreateInfo->rasterizerState.depthBiasEnable;
|
|
|
+ createinfo->rasterizer_state.enable_depth_bias;
|
|
|
rasterizationStateCreateInfo.depthBiasConstantFactor =
|
|
|
- pipelineCreateInfo->rasterizerState.depthBiasConstantFactor;
|
|
|
+ createinfo->rasterizer_state.depth_bias_constant_factor;
|
|
|
rasterizationStateCreateInfo.depthBiasClamp =
|
|
|
- pipelineCreateInfo->rasterizerState.depthBiasClamp;
|
|
|
+ createinfo->rasterizer_state.depth_bias_clamp;
|
|
|
rasterizationStateCreateInfo.depthBiasSlopeFactor =
|
|
|
- pipelineCreateInfo->rasterizerState.depthBiasSlopeFactor;
|
|
|
+ createinfo->rasterizer_state.depth_bias_slope_factor;
|
|
|
rasterizationStateCreateInfo.lineWidth = 1.0f;
|
|
|
|
|
|
// Multisample
|
|
@@ -6580,43 +6580,43 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
multisampleStateCreateInfo.sampleShadingEnable = VK_FALSE;
|
|
|
multisampleStateCreateInfo.minSampleShading = 1.0f;
|
|
|
multisampleStateCreateInfo.pSampleMask =
|
|
|
- &pipelineCreateInfo->multisampleState.sampleMask;
|
|
|
+ &createinfo->multisample_state.sample_mask;
|
|
|
multisampleStateCreateInfo.alphaToCoverageEnable = VK_FALSE;
|
|
|
multisampleStateCreateInfo.alphaToOneEnable = VK_FALSE;
|
|
|
|
|
|
// Depth Stencil State
|
|
|
|
|
|
- frontStencilState.failOp = SDLToVK_StencilOp[pipelineCreateInfo->depthStencilState.frontStencilState.failOp];
|
|
|
- frontStencilState.passOp = SDLToVK_StencilOp[pipelineCreateInfo->depthStencilState.frontStencilState.passOp];
|
|
|
- frontStencilState.depthFailOp = SDLToVK_StencilOp[pipelineCreateInfo->depthStencilState.frontStencilState.depthFailOp];
|
|
|
- frontStencilState.compareOp = SDLToVK_CompareOp[pipelineCreateInfo->depthStencilState.frontStencilState.compareOp];
|
|
|
+ frontStencilState.failOp = SDLToVK_StencilOp[createinfo->depth_stencil_state.front_stencil_state.fail_op];
|
|
|
+ frontStencilState.passOp = SDLToVK_StencilOp[createinfo->depth_stencil_state.front_stencil_state.pass_op];
|
|
|
+ frontStencilState.depthFailOp = SDLToVK_StencilOp[createinfo->depth_stencil_state.front_stencil_state.depth_fail_op];
|
|
|
+ frontStencilState.compareOp = SDLToVK_CompareOp[createinfo->depth_stencil_state.front_stencil_state.compare_op];
|
|
|
frontStencilState.compareMask =
|
|
|
- pipelineCreateInfo->depthStencilState.compareMask;
|
|
|
+ createinfo->depth_stencil_state.compare_mask;
|
|
|
frontStencilState.writeMask =
|
|
|
- pipelineCreateInfo->depthStencilState.writeMask;
|
|
|
+ createinfo->depth_stencil_state.write_mask;
|
|
|
frontStencilState.reference = 0;
|
|
|
|
|
|
- backStencilState.failOp = SDLToVK_StencilOp[pipelineCreateInfo->depthStencilState.backStencilState.failOp];
|
|
|
- backStencilState.passOp = SDLToVK_StencilOp[pipelineCreateInfo->depthStencilState.backStencilState.passOp];
|
|
|
- backStencilState.depthFailOp = SDLToVK_StencilOp[pipelineCreateInfo->depthStencilState.backStencilState.depthFailOp];
|
|
|
- backStencilState.compareOp = SDLToVK_CompareOp[pipelineCreateInfo->depthStencilState.backStencilState.compareOp];
|
|
|
+ backStencilState.failOp = SDLToVK_StencilOp[createinfo->depth_stencil_state.back_stencil_state.fail_op];
|
|
|
+ backStencilState.passOp = SDLToVK_StencilOp[createinfo->depth_stencil_state.back_stencil_state.pass_op];
|
|
|
+ backStencilState.depthFailOp = SDLToVK_StencilOp[createinfo->depth_stencil_state.back_stencil_state.depth_fail_op];
|
|
|
+ backStencilState.compareOp = SDLToVK_CompareOp[createinfo->depth_stencil_state.back_stencil_state.compare_op];
|
|
|
backStencilState.compareMask =
|
|
|
- pipelineCreateInfo->depthStencilState.compareMask;
|
|
|
+ createinfo->depth_stencil_state.compare_mask;
|
|
|
backStencilState.writeMask =
|
|
|
- pipelineCreateInfo->depthStencilState.writeMask;
|
|
|
+ createinfo->depth_stencil_state.write_mask;
|
|
|
backStencilState.reference = 0;
|
|
|
|
|
|
depthStencilStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
|
|
|
depthStencilStateCreateInfo.pNext = NULL;
|
|
|
depthStencilStateCreateInfo.flags = 0;
|
|
|
depthStencilStateCreateInfo.depthTestEnable =
|
|
|
- pipelineCreateInfo->depthStencilState.depthTestEnable;
|
|
|
+ createinfo->depth_stencil_state.enable_depth_test;
|
|
|
depthStencilStateCreateInfo.depthWriteEnable =
|
|
|
- pipelineCreateInfo->depthStencilState.depthWriteEnable;
|
|
|
- depthStencilStateCreateInfo.depthCompareOp = SDLToVK_CompareOp[pipelineCreateInfo->depthStencilState.compareOp];
|
|
|
+ createinfo->depth_stencil_state.enable_depth_write;
|
|
|
+ depthStencilStateCreateInfo.depthCompareOp = SDLToVK_CompareOp[createinfo->depth_stencil_state.compare_op];
|
|
|
depthStencilStateCreateInfo.depthBoundsTestEnable = VK_FALSE;
|
|
|
depthStencilStateCreateInfo.stencilTestEnable =
|
|
|
- pipelineCreateInfo->depthStencilState.stencilTestEnable;
|
|
|
+ createinfo->depth_stencil_state.enable_stencil_test;
|
|
|
depthStencilStateCreateInfo.front = frontStencilState;
|
|
|
depthStencilStateCreateInfo.back = backStencilState;
|
|
|
depthStencilStateCreateInfo.minDepthBounds = 0; // unused
|
|
@@ -6624,26 +6624,26 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
|
|
|
// Color Blend
|
|
|
|
|
|
- for (i = 0; i < pipelineCreateInfo->attachmentInfo.colorAttachmentCount; i += 1) {
|
|
|
- SDL_GPUColorAttachmentBlendState blendState = pipelineCreateInfo->attachmentInfo.colorAttachmentDescriptions[i].blendState;
|
|
|
+ for (i = 0; i < createinfo->target_info.num_color_targets; i += 1) {
|
|
|
+ SDL_GPUColorTargetBlendState blendState = createinfo->target_info.color_target_descriptions[i].blend_state;
|
|
|
|
|
|
colorBlendAttachmentStates[i].blendEnable =
|
|
|
- blendState.blendEnable;
|
|
|
- colorBlendAttachmentStates[i].srcColorBlendFactor = SDLToVK_BlendFactor[blendState.srcColorBlendFactor];
|
|
|
- colorBlendAttachmentStates[i].dstColorBlendFactor = SDLToVK_BlendFactor[blendState.dstColorBlendFactor];
|
|
|
- colorBlendAttachmentStates[i].colorBlendOp = SDLToVK_BlendOp[blendState.colorBlendOp];
|
|
|
- colorBlendAttachmentStates[i].srcAlphaBlendFactor = SDLToVK_BlendFactor[blendState.srcAlphaBlendFactor];
|
|
|
- colorBlendAttachmentStates[i].dstAlphaBlendFactor = SDLToVK_BlendFactor[blendState.dstAlphaBlendFactor];
|
|
|
- colorBlendAttachmentStates[i].alphaBlendOp = SDLToVK_BlendOp[blendState.alphaBlendOp];
|
|
|
+ blendState.enable_blend;
|
|
|
+ colorBlendAttachmentStates[i].srcColorBlendFactor = SDLToVK_BlendFactor[blendState.src_color_blendfactor];
|
|
|
+ colorBlendAttachmentStates[i].dstColorBlendFactor = SDLToVK_BlendFactor[blendState.dst_color_blendfactor];
|
|
|
+ colorBlendAttachmentStates[i].colorBlendOp = SDLToVK_BlendOp[blendState.color_blend_op];
|
|
|
+ colorBlendAttachmentStates[i].srcAlphaBlendFactor = SDLToVK_BlendFactor[blendState.src_alpha_blendfactor];
|
|
|
+ colorBlendAttachmentStates[i].dstAlphaBlendFactor = SDLToVK_BlendFactor[blendState.dst_alpha_blendfactor];
|
|
|
+ colorBlendAttachmentStates[i].alphaBlendOp = SDLToVK_BlendOp[blendState.alpha_blend_op];
|
|
|
colorBlendAttachmentStates[i].colorWriteMask =
|
|
|
- blendState.colorWriteMask;
|
|
|
+ blendState.color_write_mask;
|
|
|
}
|
|
|
|
|
|
colorBlendStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
|
|
|
colorBlendStateCreateInfo.pNext = NULL;
|
|
|
colorBlendStateCreateInfo.flags = 0;
|
|
|
colorBlendStateCreateInfo.attachmentCount =
|
|
|
- pipelineCreateInfo->attachmentInfo.colorAttachmentCount;
|
|
|
+ createinfo->target_info.num_color_targets;
|
|
|
colorBlendStateCreateInfo.pAttachments =
|
|
|
colorBlendAttachmentStates;
|
|
|
colorBlendStateCreateInfo.blendConstants[0] = 1.0f;
|
|
@@ -6726,17 +6726,17 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
|
|
|
|
|
static SDL_GPUComputePipeline *VULKAN_CreateComputePipeline(
|
|
|
SDL_GPURenderer *driverData,
|
|
|
- const SDL_GPUComputePipelineCreateInfo *pipelineCreateInfo)
|
|
|
+ const SDL_GPUComputePipelineCreateInfo *createinfo)
|
|
|
{
|
|
|
VkShaderModuleCreateInfo shaderModuleCreateInfo;
|
|
|
- VkComputePipelineCreateInfo computePipelineCreateInfo;
|
|
|
+ VkComputePipelineCreateInfo vkShaderCreateInfo;
|
|
|
VkPipelineShaderStageCreateInfo pipelineShaderStageCreateInfo;
|
|
|
VkResult vulkanResult;
|
|
|
Uint32 i;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)driverData;
|
|
|
VulkanComputePipeline *vulkanComputePipeline;
|
|
|
|
|
|
- if (pipelineCreateInfo->format != SDL_GPU_SHADERFORMAT_SPIRV) {
|
|
|
+ if (createinfo->format != SDL_GPU_SHADERFORMAT_SPIRV) {
|
|
|
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Incompatible shader format for Vulkan!");
|
|
|
return NULL;
|
|
|
}
|
|
@@ -6745,8 +6745,8 @@ static SDL_GPUComputePipeline *VULKAN_CreateComputePipeline(
|
|
|
shaderModuleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
|
|
shaderModuleCreateInfo.pNext = NULL;
|
|
|
shaderModuleCreateInfo.flags = 0;
|
|
|
- shaderModuleCreateInfo.codeSize = pipelineCreateInfo->codeSize;
|
|
|
- shaderModuleCreateInfo.pCode = (Uint32 *)pipelineCreateInfo->code;
|
|
|
+ shaderModuleCreateInfo.codeSize = createinfo->code_size;
|
|
|
+ shaderModuleCreateInfo.pCode = (Uint32 *)createinfo->code;
|
|
|
|
|
|
vulkanResult = renderer->vkCreateShaderModule(
|
|
|
renderer->logicalDevice,
|
|
@@ -6766,12 +6766,12 @@ static SDL_GPUComputePipeline *VULKAN_CreateComputePipeline(
|
|
|
pipelineShaderStageCreateInfo.flags = 0;
|
|
|
pipelineShaderStageCreateInfo.stage = VK_SHADER_STAGE_COMPUTE_BIT;
|
|
|
pipelineShaderStageCreateInfo.module = vulkanComputePipeline->shaderModule;
|
|
|
- pipelineShaderStageCreateInfo.pName = pipelineCreateInfo->entryPointName;
|
|
|
+ pipelineShaderStageCreateInfo.pName = createinfo->entrypoint;
|
|
|
pipelineShaderStageCreateInfo.pSpecializationInfo = NULL;
|
|
|
|
|
|
if (!VULKAN_INTERNAL_InitializeComputePipelineResourceLayout(
|
|
|
renderer,
|
|
|
- pipelineCreateInfo,
|
|
|
+ createinfo,
|
|
|
&vulkanComputePipeline->resourceLayout)) {
|
|
|
renderer->vkDestroyShaderModule(
|
|
|
renderer->logicalDevice,
|
|
@@ -6781,20 +6781,20 @@ static SDL_GPUComputePipeline *VULKAN_CreateComputePipeline(
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
- computePipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
|
|
|
- computePipelineCreateInfo.pNext = NULL;
|
|
|
- computePipelineCreateInfo.flags = 0;
|
|
|
- computePipelineCreateInfo.stage = pipelineShaderStageCreateInfo;
|
|
|
- computePipelineCreateInfo.layout =
|
|
|
+ vkShaderCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
|
|
|
+ vkShaderCreateInfo.pNext = NULL;
|
|
|
+ vkShaderCreateInfo.flags = 0;
|
|
|
+ vkShaderCreateInfo.stage = pipelineShaderStageCreateInfo;
|
|
|
+ vkShaderCreateInfo.layout =
|
|
|
vulkanComputePipeline->resourceLayout.pipelineLayout;
|
|
|
- computePipelineCreateInfo.basePipelineHandle = (VkPipeline)VK_NULL_HANDLE;
|
|
|
- computePipelineCreateInfo.basePipelineIndex = 0;
|
|
|
+ vkShaderCreateInfo.basePipelineHandle = (VkPipeline)VK_NULL_HANDLE;
|
|
|
+ vkShaderCreateInfo.basePipelineIndex = 0;
|
|
|
|
|
|
vulkanResult = renderer->vkCreateComputePipelines(
|
|
|
renderer->logicalDevice,
|
|
|
(VkPipelineCache)VK_NULL_HANDLE,
|
|
|
1,
|
|
|
- &computePipelineCreateInfo,
|
|
|
+ &vkShaderCreateInfo,
|
|
|
NULL,
|
|
|
&vulkanComputePipeline->pipeline);
|
|
|
|
|
@@ -6827,7 +6827,7 @@ static SDL_GPUComputePipeline *VULKAN_CreateComputePipeline(
|
|
|
|
|
|
static SDL_GPUSampler *VULKAN_CreateSampler(
|
|
|
SDL_GPURenderer *driverData,
|
|
|
- const SDL_GPUSamplerCreateInfo *samplerCreateInfo)
|
|
|
+ const SDL_GPUSamplerCreateInfo *createinfo)
|
|
|
{
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)driverData;
|
|
|
VulkanSampler *vulkanSampler = SDL_malloc(sizeof(VulkanSampler));
|
|
@@ -6837,19 +6837,19 @@ static SDL_GPUSampler *VULKAN_CreateSampler(
|
|
|
vkSamplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
|
|
vkSamplerCreateInfo.pNext = NULL;
|
|
|
vkSamplerCreateInfo.flags = 0;
|
|
|
- vkSamplerCreateInfo.magFilter = SDLToVK_Filter[samplerCreateInfo->magFilter];
|
|
|
- vkSamplerCreateInfo.minFilter = SDLToVK_Filter[samplerCreateInfo->minFilter];
|
|
|
- vkSamplerCreateInfo.mipmapMode = SDLToVK_SamplerMipmapMode[samplerCreateInfo->mipmapMode];
|
|
|
- vkSamplerCreateInfo.addressModeU = SDLToVK_SamplerAddressMode[samplerCreateInfo->addressModeU];
|
|
|
- vkSamplerCreateInfo.addressModeV = SDLToVK_SamplerAddressMode[samplerCreateInfo->addressModeV];
|
|
|
- vkSamplerCreateInfo.addressModeW = SDLToVK_SamplerAddressMode[samplerCreateInfo->addressModeW];
|
|
|
- vkSamplerCreateInfo.mipLodBias = samplerCreateInfo->mipLodBias;
|
|
|
- vkSamplerCreateInfo.anisotropyEnable = samplerCreateInfo->anisotropyEnable;
|
|
|
- vkSamplerCreateInfo.maxAnisotropy = samplerCreateInfo->maxAnisotropy;
|
|
|
- vkSamplerCreateInfo.compareEnable = samplerCreateInfo->compareEnable;
|
|
|
- vkSamplerCreateInfo.compareOp = SDLToVK_CompareOp[samplerCreateInfo->compareOp];
|
|
|
- vkSamplerCreateInfo.minLod = samplerCreateInfo->minLod;
|
|
|
- vkSamplerCreateInfo.maxLod = samplerCreateInfo->maxLod;
|
|
|
+ vkSamplerCreateInfo.magFilter = SDLToVK_Filter[createinfo->mag_filter];
|
|
|
+ vkSamplerCreateInfo.minFilter = SDLToVK_Filter[createinfo->min_filter];
|
|
|
+ vkSamplerCreateInfo.mipmapMode = SDLToVK_SamplerMipmapMode[createinfo->mipmap_mode];
|
|
|
+ vkSamplerCreateInfo.addressModeU = SDLToVK_SamplerAddressMode[createinfo->address_mode_u];
|
|
|
+ vkSamplerCreateInfo.addressModeV = SDLToVK_SamplerAddressMode[createinfo->address_mode_v];
|
|
|
+ vkSamplerCreateInfo.addressModeW = SDLToVK_SamplerAddressMode[createinfo->address_mode_w];
|
|
|
+ vkSamplerCreateInfo.mipLodBias = createinfo->mip_lod_bias;
|
|
|
+ vkSamplerCreateInfo.anisotropyEnable = createinfo->enable_anisotropy;
|
|
|
+ vkSamplerCreateInfo.maxAnisotropy = createinfo->max_anisotropy;
|
|
|
+ vkSamplerCreateInfo.compareEnable = createinfo->enable_compare;
|
|
|
+ vkSamplerCreateInfo.compareOp = SDLToVK_CompareOp[createinfo->compare_op];
|
|
|
+ vkSamplerCreateInfo.minLod = createinfo->min_lod;
|
|
|
+ vkSamplerCreateInfo.maxLod = createinfo->max_lod;
|
|
|
vkSamplerCreateInfo.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; // arbitrary, unused
|
|
|
vkSamplerCreateInfo.unnormalizedCoordinates = VK_FALSE;
|
|
|
|
|
@@ -6872,7 +6872,7 @@ static SDL_GPUSampler *VULKAN_CreateSampler(
|
|
|
|
|
|
static SDL_GPUShader *VULKAN_CreateShader(
|
|
|
SDL_GPURenderer *driverData,
|
|
|
- const SDL_GPUShaderCreateInfo *shaderCreateInfo)
|
|
|
+ const SDL_GPUShaderCreateInfo *createinfo)
|
|
|
{
|
|
|
VulkanShader *vulkanShader;
|
|
|
VkResult vulkanResult;
|
|
@@ -6884,8 +6884,8 @@ static SDL_GPUShader *VULKAN_CreateShader(
|
|
|
vkShaderModuleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
|
|
vkShaderModuleCreateInfo.pNext = NULL;
|
|
|
vkShaderModuleCreateInfo.flags = 0;
|
|
|
- vkShaderModuleCreateInfo.codeSize = shaderCreateInfo->codeSize;
|
|
|
- vkShaderModuleCreateInfo.pCode = (Uint32 *)shaderCreateInfo->code;
|
|
|
+ vkShaderModuleCreateInfo.codeSize = createinfo->code_size;
|
|
|
+ vkShaderModuleCreateInfo.pCode = (Uint32 *)createinfo->code;
|
|
|
|
|
|
vulkanResult = renderer->vkCreateShaderModule(
|
|
|
renderer->logicalDevice,
|
|
@@ -6900,14 +6900,14 @@ static SDL_GPUShader *VULKAN_CreateShader(
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
- entryPointNameLength = SDL_strlen(shaderCreateInfo->entryPointName) + 1;
|
|
|
- vulkanShader->entryPointName = SDL_malloc(entryPointNameLength);
|
|
|
- SDL_utf8strlcpy((char *)vulkanShader->entryPointName, shaderCreateInfo->entryPointName, entryPointNameLength);
|
|
|
+ entryPointNameLength = SDL_strlen(createinfo->entrypoint) + 1;
|
|
|
+ vulkanShader->entrypointName = SDL_malloc(entryPointNameLength);
|
|
|
+ SDL_utf8strlcpy((char *)vulkanShader->entrypointName, createinfo->entrypoint, entryPointNameLength);
|
|
|
|
|
|
- vulkanShader->samplerCount = shaderCreateInfo->samplerCount;
|
|
|
- vulkanShader->storageTextureCount = shaderCreateInfo->storageTextureCount;
|
|
|
- vulkanShader->storageBufferCount = shaderCreateInfo->storageBufferCount;
|
|
|
- vulkanShader->uniformBufferCount = shaderCreateInfo->uniformBufferCount;
|
|
|
+ vulkanShader->numSamplers = createinfo->num_samplers;
|
|
|
+ vulkanShader->numStorageTextures = createinfo->num_storage_textures;
|
|
|
+ vulkanShader->numStorageBuffers = createinfo->num_storage_buffers;
|
|
|
+ vulkanShader->numUniformBuffers = createinfo->num_uniform_buffers;
|
|
|
|
|
|
SDL_AtomicSet(&vulkanShader->referenceCount, 0);
|
|
|
|
|
@@ -6927,23 +6927,23 @@ static bool VULKAN_SupportsSampleCount(
|
|
|
|
|
|
static SDL_GPUTexture *VULKAN_CreateTexture(
|
|
|
SDL_GPURenderer *driverData,
|
|
|
- const SDL_GPUTextureCreateInfo *textureCreateInfo)
|
|
|
+ const SDL_GPUTextureCreateInfo *createinfo)
|
|
|
{
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)driverData;
|
|
|
VkImageAspectFlags imageAspectFlags;
|
|
|
- Uint8 isDepthFormat = IsDepthFormat(textureCreateInfo->format);
|
|
|
+ Uint8 isDepthFormat = IsDepthFormat(createinfo->format);
|
|
|
VkFormat format;
|
|
|
VkComponentMapping swizzle;
|
|
|
VulkanTextureContainer *container;
|
|
|
VulkanTextureHandle *textureHandle;
|
|
|
|
|
|
- format = SDLToVK_SurfaceFormat[textureCreateInfo->format];
|
|
|
- swizzle = SDLToVK_SurfaceSwizzle[textureCreateInfo->format];
|
|
|
+ format = SDLToVK_SurfaceFormat[createinfo->format];
|
|
|
+ swizzle = SDLToVK_SurfaceSwizzle[createinfo->format];
|
|
|
|
|
|
if (isDepthFormat) {
|
|
|
imageAspectFlags = VK_IMAGE_ASPECT_DEPTH_BIT;
|
|
|
|
|
|
- if (IsStencilFormat(textureCreateInfo->format)) {
|
|
|
+ if (IsStencilFormat(createinfo->format)) {
|
|
|
imageAspectFlags |= VK_IMAGE_ASPECT_STENCIL_BIT;
|
|
|
}
|
|
|
} else {
|
|
@@ -6952,17 +6952,17 @@ static SDL_GPUTexture *VULKAN_CreateTexture(
|
|
|
|
|
|
textureHandle = VULKAN_INTERNAL_CreateTextureHandle(
|
|
|
renderer,
|
|
|
- textureCreateInfo->width,
|
|
|
- textureCreateInfo->height,
|
|
|
- textureCreateInfo->type == SDL_GPU_TEXTURETYPE_3D ? textureCreateInfo->layerCountOrDepth : 1,
|
|
|
- textureCreateInfo->type,
|
|
|
- textureCreateInfo->type == SDL_GPU_TEXTURETYPE_3D ? 1 : textureCreateInfo->layerCountOrDepth,
|
|
|
- textureCreateInfo->levelCount,
|
|
|
- SDLToVK_SampleCount[textureCreateInfo->sampleCount],
|
|
|
+ createinfo->width,
|
|
|
+ createinfo->height,
|
|
|
+ createinfo->type == SDL_GPU_TEXTURETYPE_3D ? createinfo->layer_count_or_depth : 1,
|
|
|
+ createinfo->type,
|
|
|
+ createinfo->type == SDL_GPU_TEXTURETYPE_3D ? 1 : createinfo->layer_count_or_depth,
|
|
|
+ createinfo->num_levels,
|
|
|
+ SDLToVK_SampleCount[createinfo->sample_count],
|
|
|
format,
|
|
|
swizzle,
|
|
|
imageAspectFlags,
|
|
|
- textureCreateInfo->usageFlags,
|
|
|
+ createinfo->usage,
|
|
|
false);
|
|
|
|
|
|
if (textureHandle == NULL) {
|
|
@@ -6971,7 +6971,7 @@ static SDL_GPUTexture *VULKAN_CreateTexture(
|
|
|
}
|
|
|
|
|
|
container = SDL_malloc(sizeof(VulkanTextureContainer));
|
|
|
- container->header.info = *textureCreateInfo;
|
|
|
+ container->header.info = *createinfo;
|
|
|
container->canBeCycled = 1;
|
|
|
container->activeTextureHandle = textureHandle;
|
|
|
container->textureCapacity = 1;
|
|
@@ -6989,24 +6989,24 @@ static SDL_GPUTexture *VULKAN_CreateTexture(
|
|
|
static SDL_GPUBuffer *VULKAN_CreateBuffer(
|
|
|
SDL_GPURenderer *driverData,
|
|
|
SDL_GPUBufferUsageFlags usageFlags,
|
|
|
- Uint32 sizeInBytes)
|
|
|
+ Uint32 size)
|
|
|
{
|
|
|
return (SDL_GPUBuffer *)VULKAN_INTERNAL_CreateBufferContainer(
|
|
|
(VulkanRenderer *)driverData,
|
|
|
- (VkDeviceSize)sizeInBytes,
|
|
|
+ (VkDeviceSize)size,
|
|
|
usageFlags,
|
|
|
VULKAN_BUFFER_TYPE_GPU);
|
|
|
}
|
|
|
|
|
|
static VulkanUniformBuffer *VULKAN_INTERNAL_CreateUniformBuffer(
|
|
|
VulkanRenderer *renderer,
|
|
|
- Uint32 sizeInBytes)
|
|
|
+ Uint32 size)
|
|
|
{
|
|
|
VulkanUniformBuffer *uniformBuffer = SDL_malloc(sizeof(VulkanUniformBuffer));
|
|
|
|
|
|
uniformBuffer->bufferHandle = VULKAN_INTERNAL_CreateBufferHandle(
|
|
|
renderer,
|
|
|
- (VkDeviceSize)sizeInBytes,
|
|
|
+ (VkDeviceSize)size,
|
|
|
0,
|
|
|
VULKAN_BUFFER_TYPE_UNIFORM);
|
|
|
|
|
@@ -7019,11 +7019,11 @@ static VulkanUniformBuffer *VULKAN_INTERNAL_CreateUniformBuffer(
|
|
|
static SDL_GPUTransferBuffer *VULKAN_CreateTransferBuffer(
|
|
|
SDL_GPURenderer *driverData,
|
|
|
SDL_GPUTransferBufferUsage usage, // ignored on Vulkan
|
|
|
- Uint32 sizeInBytes)
|
|
|
+ Uint32 size)
|
|
|
{
|
|
|
return (SDL_GPUTransferBuffer *)VULKAN_INTERNAL_CreateBufferContainer(
|
|
|
(VulkanRenderer *)driverData,
|
|
|
- (VkDeviceSize)sizeInBytes,
|
|
|
+ (VkDeviceSize)size,
|
|
|
0,
|
|
|
VULKAN_BUFFER_TYPE_TRANSFER);
|
|
|
}
|
|
@@ -7243,40 +7243,40 @@ static void VULKAN_ReleaseGraphicsPipeline(
|
|
|
static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|
|
VulkanRenderer *renderer,
|
|
|
VulkanCommandBuffer *commandBuffer,
|
|
|
- const SDL_GPUColorAttachmentInfo *colorAttachmentInfos,
|
|
|
- Uint32 colorAttachmentCount,
|
|
|
- const SDL_GPUDepthStencilAttachmentInfo *depthStencilAttachmentInfo)
|
|
|
+ const SDL_GPUColorTargetInfo *colorTargetInfos,
|
|
|
+ Uint32 numColorTargets,
|
|
|
+ const SDL_GPUDepthStencilTargetInfo *depthStencilTargetInfo)
|
|
|
{
|
|
|
VulkanRenderPassHashTableValue *renderPassWrapper = NULL;
|
|
|
VkRenderPass renderPassHandle;
|
|
|
RenderPassHashTableKey key;
|
|
|
Uint32 i;
|
|
|
|
|
|
- for (i = 0; i < colorAttachmentCount; i += 1) {
|
|
|
- key.colorTargetDescriptions[i].format = ((VulkanTextureContainer *)colorAttachmentInfos[i].texture)->activeTextureHandle->vulkanTexture->format;
|
|
|
- key.colorTargetDescriptions[i].loadOp = colorAttachmentInfos[i].loadOp;
|
|
|
- key.colorTargetDescriptions[i].storeOp = colorAttachmentInfos[i].storeOp;
|
|
|
+ for (i = 0; i < numColorTargets; i += 1) {
|
|
|
+ key.colorTargetDescriptions[i].format = ((VulkanTextureContainer *)colorTargetInfos[i].texture)->activeTextureHandle->vulkanTexture->format;
|
|
|
+ key.colorTargetDescriptions[i].loadOp = colorTargetInfos[i].load_op;
|
|
|
+ key.colorTargetDescriptions[i].storeOp = colorTargetInfos[i].store_op;
|
|
|
}
|
|
|
|
|
|
key.colorAttachmentSampleCount = VK_SAMPLE_COUNT_1_BIT;
|
|
|
- if (colorAttachmentCount > 0) {
|
|
|
- key.colorAttachmentSampleCount = ((VulkanTextureContainer *)colorAttachmentInfos[0].texture)->activeTextureHandle->vulkanTexture->sampleCount;
|
|
|
+ if (numColorTargets > 0) {
|
|
|
+ key.colorAttachmentSampleCount = ((VulkanTextureContainer *)colorTargetInfos[0].texture)->activeTextureHandle->vulkanTexture->sampleCount;
|
|
|
}
|
|
|
|
|
|
- key.colorAttachmentCount = colorAttachmentCount;
|
|
|
+ key.numColorTargets = numColorTargets;
|
|
|
|
|
|
- if (depthStencilAttachmentInfo == NULL) {
|
|
|
+ if (depthStencilTargetInfo == NULL) {
|
|
|
key.depthStencilTargetDescription.format = 0;
|
|
|
key.depthStencilTargetDescription.loadOp = SDL_GPU_LOADOP_DONT_CARE;
|
|
|
key.depthStencilTargetDescription.storeOp = SDL_GPU_STOREOP_DONT_CARE;
|
|
|
key.depthStencilTargetDescription.stencilLoadOp = SDL_GPU_LOADOP_DONT_CARE;
|
|
|
key.depthStencilTargetDescription.stencilStoreOp = SDL_GPU_STOREOP_DONT_CARE;
|
|
|
} else {
|
|
|
- key.depthStencilTargetDescription.format = ((VulkanTextureContainer *)depthStencilAttachmentInfo->texture)->activeTextureHandle->vulkanTexture->format;
|
|
|
- key.depthStencilTargetDescription.loadOp = depthStencilAttachmentInfo->loadOp;
|
|
|
- key.depthStencilTargetDescription.storeOp = depthStencilAttachmentInfo->storeOp;
|
|
|
- key.depthStencilTargetDescription.stencilLoadOp = depthStencilAttachmentInfo->stencilLoadOp;
|
|
|
- key.depthStencilTargetDescription.stencilStoreOp = depthStencilAttachmentInfo->stencilStoreOp;
|
|
|
+ key.depthStencilTargetDescription.format = ((VulkanTextureContainer *)depthStencilTargetInfo->texture)->activeTextureHandle->vulkanTexture->format;
|
|
|
+ key.depthStencilTargetDescription.loadOp = depthStencilTargetInfo->load_op;
|
|
|
+ key.depthStencilTargetDescription.storeOp = depthStencilTargetInfo->store_op;
|
|
|
+ key.depthStencilTargetDescription.stencilLoadOp = depthStencilTargetInfo->stencil_load_op;
|
|
|
+ key.depthStencilTargetDescription.stencilStoreOp = depthStencilTargetInfo->stencil_store_op;
|
|
|
}
|
|
|
|
|
|
SDL_LockMutex(renderer->renderPassFetchLock);
|
|
@@ -7295,9 +7295,9 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|
|
renderPassHandle = VULKAN_INTERNAL_CreateRenderPass(
|
|
|
renderer,
|
|
|
commandBuffer,
|
|
|
- colorAttachmentInfos,
|
|
|
- colorAttachmentCount,
|
|
|
- depthStencilAttachmentInfo);
|
|
|
+ colorTargetInfos,
|
|
|
+ numColorTargets,
|
|
|
+ depthStencilTargetInfo);
|
|
|
|
|
|
if (renderPassHandle == VK_NULL_HANDLE) {
|
|
|
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to create VkRenderPass!");
|
|
@@ -7325,9 +7325,9 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|
|
static VulkanFramebuffer *VULKAN_INTERNAL_FetchFramebuffer(
|
|
|
VulkanRenderer *renderer,
|
|
|
VkRenderPass renderPass,
|
|
|
- const SDL_GPUColorAttachmentInfo *colorAttachmentInfos,
|
|
|
- Uint32 colorAttachmentCount,
|
|
|
- const SDL_GPUDepthStencilAttachmentInfo *depthStencilAttachmentInfo,
|
|
|
+ const SDL_GPUColorTargetInfo *colorTargetInfos,
|
|
|
+ Uint32 numColorTargets,
|
|
|
+ const SDL_GPUDepthStencilTargetInfo *depthStencilTargetInfo,
|
|
|
Uint32 width,
|
|
|
Uint32 height)
|
|
|
{
|
|
@@ -7344,17 +7344,17 @@ static VulkanFramebuffer *VULKAN_INTERNAL_FetchFramebuffer(
|
|
|
key.colorMultiSampleAttachmentViews[i] = VK_NULL_HANDLE;
|
|
|
}
|
|
|
|
|
|
- key.colorAttachmentCount = colorAttachmentCount;
|
|
|
+ key.numColorTargets = numColorTargets;
|
|
|
|
|
|
- for (i = 0; i < colorAttachmentCount; i += 1) {
|
|
|
- VulkanTextureContainer *container = (VulkanTextureContainer *)colorAttachmentInfos[i].texture;
|
|
|
+ for (i = 0; i < numColorTargets; i += 1) {
|
|
|
+ VulkanTextureContainer *container = (VulkanTextureContainer *)colorTargetInfos[i].texture;
|
|
|
VulkanTextureSubresource *subresource = VULKAN_INTERNAL_FetchTextureSubresource(
|
|
|
container,
|
|
|
- container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorAttachmentInfos[i].layerOrDepthPlane,
|
|
|
- colorAttachmentInfos[i].mipLevel);
|
|
|
+ container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorTargetInfos[i].layer_or_depth_plane,
|
|
|
+ colorTargetInfos[i].mip_level);
|
|
|
|
|
|
Uint32 rtvIndex =
|
|
|
- container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? colorAttachmentInfos[i].layerOrDepthPlane : 0;
|
|
|
+ container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? colorTargetInfos[i].layer_or_depth_plane : 0;
|
|
|
key.colorAttachmentViews[i] = subresource->renderTargetViews[rtvIndex];
|
|
|
|
|
|
if (subresource->msaaTexHandle != NULL) {
|
|
@@ -7362,11 +7362,11 @@ static VulkanFramebuffer *VULKAN_INTERNAL_FetchFramebuffer(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (depthStencilAttachmentInfo == NULL) {
|
|
|
+ if (depthStencilTargetInfo == NULL) {
|
|
|
key.depthStencilAttachmentView = VK_NULL_HANDLE;
|
|
|
} else {
|
|
|
VulkanTextureSubresource *subresource = VULKAN_INTERNAL_FetchTextureSubresource(
|
|
|
- (VulkanTextureContainer *)depthStencilAttachmentInfo->texture,
|
|
|
+ (VulkanTextureContainer *)depthStencilTargetInfo->texture,
|
|
|
0,
|
|
|
0);
|
|
|
key.depthStencilAttachmentView = subresource->depthStencilView;
|
|
@@ -7394,15 +7394,15 @@ static VulkanFramebuffer *VULKAN_INTERNAL_FetchFramebuffer(
|
|
|
|
|
|
// Create a new framebuffer
|
|
|
|
|
|
- for (i = 0; i < colorAttachmentCount; i += 1) {
|
|
|
- VulkanTextureContainer *container = (VulkanTextureContainer *)colorAttachmentInfos[i].texture;
|
|
|
+ for (i = 0; i < numColorTargets; i += 1) {
|
|
|
+ VulkanTextureContainer *container = (VulkanTextureContainer *)colorTargetInfos[i].texture;
|
|
|
VulkanTextureSubresource *subresource = VULKAN_INTERNAL_FetchTextureSubresource(
|
|
|
container,
|
|
|
- container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorAttachmentInfos[i].layerOrDepthPlane,
|
|
|
- colorAttachmentInfos[i].mipLevel);
|
|
|
+ container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorTargetInfos[i].layer_or_depth_plane,
|
|
|
+ colorTargetInfos[i].mip_level);
|
|
|
|
|
|
Uint32 rtvIndex =
|
|
|
- container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? colorAttachmentInfos[i].layerOrDepthPlane : 0;
|
|
|
+ container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? colorTargetInfos[i].layer_or_depth_plane : 0;
|
|
|
|
|
|
imageViewAttachments[attachmentCount] =
|
|
|
subresource->renderTargetViews[rtvIndex];
|
|
@@ -7417,9 +7417,9 @@ static VulkanFramebuffer *VULKAN_INTERNAL_FetchFramebuffer(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (depthStencilAttachmentInfo != NULL) {
|
|
|
+ if (depthStencilTargetInfo != NULL) {
|
|
|
VulkanTextureSubresource *subresource = VULKAN_INTERNAL_FetchTextureSubresource(
|
|
|
- (VulkanTextureContainer *)depthStencilAttachmentInfo->texture,
|
|
|
+ (VulkanTextureContainer *)depthStencilTargetInfo->texture,
|
|
|
0,
|
|
|
0);
|
|
|
imageViewAttachments[attachmentCount] = subresource->depthStencilView;
|
|
@@ -7473,8 +7473,8 @@ static void VULKAN_INTERNAL_SetCurrentViewport(
|
|
|
|
|
|
vulkanCommandBuffer->currentViewport.x = viewport->x;
|
|
|
vulkanCommandBuffer->currentViewport.width = viewport->w;
|
|
|
- vulkanCommandBuffer->currentViewport.minDepth = viewport->minDepth;
|
|
|
- vulkanCommandBuffer->currentViewport.maxDepth = viewport->maxDepth;
|
|
|
+ vulkanCommandBuffer->currentViewport.minDepth = viewport->min_depth;
|
|
|
+ vulkanCommandBuffer->currentViewport.maxDepth = viewport->max_depth;
|
|
|
|
|
|
// Viewport flip for consistency with other backends
|
|
|
// FIXME: need moltenVK hack
|
|
@@ -7582,11 +7582,11 @@ static void VULKAN_BindVertexSamplers(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 firstSlot,
|
|
|
const SDL_GPUTextureSamplerBinding *textureSamplerBindings,
|
|
|
- Uint32 bindingCount)
|
|
|
+ Uint32 numBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
|
|
|
- for (Uint32 i = 0; i < bindingCount; i += 1) {
|
|
|
+ for (Uint32 i = 0; i < numBindings; i += 1) {
|
|
|
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)textureSamplerBindings[i].texture;
|
|
|
vulkanCommandBuffer->vertexSamplerTextures[firstSlot + i] = textureContainer->activeTextureHandle->vulkanTexture;
|
|
|
vulkanCommandBuffer->vertexSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler;
|
|
@@ -7607,11 +7607,11 @@ static void VULKAN_BindVertexStorageTextures(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 firstSlot,
|
|
|
SDL_GPUTexture *const *storageTextures,
|
|
|
- Uint32 bindingCount)
|
|
|
+ Uint32 numBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
|
|
|
- for (Uint32 i = 0; i < bindingCount; i += 1) {
|
|
|
+ for (Uint32 i = 0; i < numBindings; i += 1) {
|
|
|
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i];
|
|
|
|
|
|
vulkanCommandBuffer->vertexStorageTextures[firstSlot + i] = textureContainer->activeTextureHandle->vulkanTexture;
|
|
@@ -7628,13 +7628,13 @@ static void VULKAN_BindVertexStorageBuffers(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 firstSlot,
|
|
|
SDL_GPUBuffer *const *storageBuffers,
|
|
|
- Uint32 bindingCount)
|
|
|
+ Uint32 numBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanBufferContainer *bufferContainer;
|
|
|
Uint32 i;
|
|
|
|
|
|
- for (i = 0; i < bindingCount; i += 1) {
|
|
|
+ for (i = 0; i < numBindings; i += 1) {
|
|
|
bufferContainer = (VulkanBufferContainer *)storageBuffers[i];
|
|
|
|
|
|
vulkanCommandBuffer->vertexStorageBuffers[firstSlot + i] = bufferContainer->activeBufferHandle->vulkanBuffer;
|
|
@@ -7651,11 +7651,11 @@ static void VULKAN_BindFragmentSamplers(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 firstSlot,
|
|
|
const SDL_GPUTextureSamplerBinding *textureSamplerBindings,
|
|
|
- Uint32 bindingCount)
|
|
|
+ Uint32 numBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
|
|
|
- for (Uint32 i = 0; i < bindingCount; i += 1) {
|
|
|
+ for (Uint32 i = 0; i < numBindings; i += 1) {
|
|
|
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)textureSamplerBindings[i].texture;
|
|
|
vulkanCommandBuffer->fragmentSamplerTextures[firstSlot + i] = textureContainer->activeTextureHandle->vulkanTexture;
|
|
|
vulkanCommandBuffer->fragmentSamplers[firstSlot + i] = (VulkanSampler *)textureSamplerBindings[i].sampler;
|
|
@@ -7676,11 +7676,11 @@ static void VULKAN_BindFragmentStorageTextures(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 firstSlot,
|
|
|
SDL_GPUTexture *const *storageTextures,
|
|
|
- Uint32 bindingCount)
|
|
|
+ Uint32 numBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
|
|
|
- for (Uint32 i = 0; i < bindingCount; i += 1) {
|
|
|
+ for (Uint32 i = 0; i < numBindings; i += 1) {
|
|
|
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextures[i];
|
|
|
|
|
|
vulkanCommandBuffer->fragmentStorageTextures[firstSlot + i] =
|
|
@@ -7698,13 +7698,13 @@ static void VULKAN_BindFragmentStorageBuffers(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 firstSlot,
|
|
|
SDL_GPUBuffer *const *storageBuffers,
|
|
|
- Uint32 bindingCount)
|
|
|
+ Uint32 numBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanBufferContainer *bufferContainer;
|
|
|
Uint32 i;
|
|
|
|
|
|
- for (i = 0; i < bindingCount; i += 1) {
|
|
|
+ for (i = 0; i < numBindings; i += 1) {
|
|
|
bufferContainer = (VulkanBufferContainer *)storageBuffers[i];
|
|
|
|
|
|
vulkanCommandBuffer->fragmentStorageBuffers[firstSlot + i] = bufferContainer->activeBufferHandle->vulkanBuffer;
|
|
@@ -7764,11 +7764,11 @@ static void VULKAN_INTERNAL_PushUniformData(
|
|
|
VulkanUniformBufferStage uniformBufferStage,
|
|
|
Uint32 slotIndex,
|
|
|
const void *data,
|
|
|
- Uint32 dataLengthInBytes)
|
|
|
+ Uint32 length)
|
|
|
{
|
|
|
Uint32 blockSize =
|
|
|
VULKAN_INTERNAL_NextHighestAlignment32(
|
|
|
- dataLengthInBytes,
|
|
|
+ length,
|
|
|
commandBuffer->renderer->minUBOAlignment);
|
|
|
|
|
|
VulkanUniformBuffer *uniformBuffer;
|
|
@@ -7828,7 +7828,7 @@ static void VULKAN_INTERNAL_PushUniformData(
|
|
|
SDL_memcpy(
|
|
|
dst,
|
|
|
data,
|
|
|
- dataLengthInBytes);
|
|
|
+ length);
|
|
|
|
|
|
uniformBuffer->writeOffset += blockSize;
|
|
|
|
|
@@ -7846,9 +7846,9 @@ static void VULKAN_INTERNAL_PushUniformData(
|
|
|
|
|
|
static void VULKAN_BeginRenderPass(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
- const SDL_GPUColorAttachmentInfo *colorAttachmentInfos,
|
|
|
- Uint32 colorAttachmentCount,
|
|
|
- const SDL_GPUDepthStencilAttachmentInfo *depthStencilAttachmentInfo)
|
|
|
+ const SDL_GPUColorTargetInfo *colorTargetInfos,
|
|
|
+ Uint32 numColorTargets,
|
|
|
+ const SDL_GPUDepthStencilTargetInfo *depthStencilTargetInfo)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
@@ -7857,7 +7857,7 @@ static void VULKAN_BeginRenderPass(
|
|
|
|
|
|
Uint32 w, h;
|
|
|
VkClearValue *clearValues;
|
|
|
- Uint32 clearCount = colorAttachmentCount;
|
|
|
+ Uint32 clearCount = numColorTargets;
|
|
|
Uint32 multisampleAttachmentCount = 0;
|
|
|
Uint32 totalColorAttachmentCount = 0;
|
|
|
Uint32 i;
|
|
@@ -7866,11 +7866,11 @@ static void VULKAN_BeginRenderPass(
|
|
|
Uint32 framebufferWidth = UINT32_MAX;
|
|
|
Uint32 framebufferHeight = UINT32_MAX;
|
|
|
|
|
|
- for (i = 0; i < colorAttachmentCount; i += 1) {
|
|
|
- VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)colorAttachmentInfos[i].texture;
|
|
|
+ for (i = 0; i < numColorTargets; i += 1) {
|
|
|
+ VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)colorTargetInfos[i].texture;
|
|
|
|
|
|
- w = textureContainer->activeTextureHandle->vulkanTexture->dimensions.width >> colorAttachmentInfos[i].mipLevel;
|
|
|
- h = textureContainer->activeTextureHandle->vulkanTexture->dimensions.height >> colorAttachmentInfos[i].mipLevel;
|
|
|
+ w = textureContainer->activeTextureHandle->vulkanTexture->dimensions.width >> colorTargetInfos[i].mip_level;
|
|
|
+ h = textureContainer->activeTextureHandle->vulkanTexture->dimensions.height >> colorTargetInfos[i].mip_level;
|
|
|
|
|
|
// The framebuffer cannot be larger than the smallest attachment.
|
|
|
|
|
@@ -7883,14 +7883,14 @@ static void VULKAN_BeginRenderPass(
|
|
|
}
|
|
|
|
|
|
// FIXME: validate this in gpu.c
|
|
|
- if (!(textureContainer->header.info.usageFlags & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET)) {
|
|
|
+ if (!(textureContainer->header.info.usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET)) {
|
|
|
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Color attachment texture was not designated as a target!");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (depthStencilAttachmentInfo != NULL) {
|
|
|
- VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)depthStencilAttachmentInfo->texture;
|
|
|
+ if (depthStencilTargetInfo != NULL) {
|
|
|
+ VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)depthStencilTargetInfo->texture;
|
|
|
|
|
|
w = textureContainer->activeTextureHandle->vulkanTexture->dimensions.width;
|
|
|
h = textureContainer->activeTextureHandle->vulkanTexture->dimensions.height;
|
|
@@ -7906,21 +7906,21 @@ static void VULKAN_BeginRenderPass(
|
|
|
}
|
|
|
|
|
|
// FIXME: validate this in gpu.c
|
|
|
- if (!(textureContainer->header.info.usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET)) {
|
|
|
+ if (!(textureContainer->header.info.usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET)) {
|
|
|
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Depth stencil attachment texture was not designated as a target!");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (i = 0; i < colorAttachmentCount; i += 1) {
|
|
|
- VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)colorAttachmentInfos[i].texture;
|
|
|
+ for (i = 0; i < numColorTargets; i += 1) {
|
|
|
+ VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)colorTargetInfos[i].texture;
|
|
|
VulkanTextureSubresource *subresource = VULKAN_INTERNAL_PrepareTextureSubresourceForWrite(
|
|
|
renderer,
|
|
|
vulkanCommandBuffer,
|
|
|
textureContainer,
|
|
|
- textureContainer->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorAttachmentInfos[i].layerOrDepthPlane,
|
|
|
- colorAttachmentInfos[i].mipLevel,
|
|
|
- colorAttachmentInfos[i].cycle,
|
|
|
+ textureContainer->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorTargetInfos[i].layer_or_depth_plane,
|
|
|
+ colorTargetInfos[i].mip_level,
|
|
|
+ colorTargetInfos[i].cycle,
|
|
|
VULKAN_TEXTURE_USAGE_MODE_COLOR_ATTACHMENT);
|
|
|
|
|
|
if (subresource->msaaTexHandle != NULL) {
|
|
@@ -7941,17 +7941,17 @@ static void VULKAN_BeginRenderPass(
|
|
|
// TODO: do we need to track the msaa texture? or is it implicitly only used when the regular texture is used?
|
|
|
}
|
|
|
|
|
|
- vulkanCommandBuffer->colorAttachmentSubresourceCount = colorAttachmentCount;
|
|
|
+ vulkanCommandBuffer->colorAttachmentSubresourceCount = numColorTargets;
|
|
|
|
|
|
- if (depthStencilAttachmentInfo != NULL) {
|
|
|
- VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)depthStencilAttachmentInfo->texture;
|
|
|
+ if (depthStencilTargetInfo != NULL) {
|
|
|
+ VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)depthStencilTargetInfo->texture;
|
|
|
VulkanTextureSubresource *subresource = VULKAN_INTERNAL_PrepareTextureSubresourceForWrite(
|
|
|
renderer,
|
|
|
vulkanCommandBuffer,
|
|
|
textureContainer,
|
|
|
0,
|
|
|
0,
|
|
|
- depthStencilAttachmentInfo->cycle,
|
|
|
+ depthStencilTargetInfo->cycle,
|
|
|
VULKAN_TEXTURE_USAGE_MODE_DEPTH_STENCIL_ATTACHMENT);
|
|
|
|
|
|
clearCount += 1;
|
|
@@ -7966,16 +7966,16 @@ static void VULKAN_BeginRenderPass(
|
|
|
renderPass = VULKAN_INTERNAL_FetchRenderPass(
|
|
|
renderer,
|
|
|
vulkanCommandBuffer,
|
|
|
- colorAttachmentInfos,
|
|
|
- colorAttachmentCount,
|
|
|
- depthStencilAttachmentInfo);
|
|
|
+ colorTargetInfos,
|
|
|
+ numColorTargets,
|
|
|
+ depthStencilTargetInfo);
|
|
|
|
|
|
framebuffer = VULKAN_INTERNAL_FetchFramebuffer(
|
|
|
renderer,
|
|
|
renderPass,
|
|
|
- colorAttachmentInfos,
|
|
|
- colorAttachmentCount,
|
|
|
- depthStencilAttachmentInfo,
|
|
|
+ colorTargetInfos,
|
|
|
+ numColorTargets,
|
|
|
+ depthStencilTargetInfo,
|
|
|
framebufferWidth,
|
|
|
framebufferHeight);
|
|
|
|
|
@@ -7985,34 +7985,34 @@ static void VULKAN_BeginRenderPass(
|
|
|
|
|
|
clearValues = SDL_stack_alloc(VkClearValue, clearCount);
|
|
|
|
|
|
- totalColorAttachmentCount = colorAttachmentCount + multisampleAttachmentCount;
|
|
|
+ totalColorAttachmentCount = numColorTargets + multisampleAttachmentCount;
|
|
|
|
|
|
for (i = 0; i < totalColorAttachmentCount; i += 1) {
|
|
|
- clearValues[i].color.float32[0] = colorAttachmentInfos[i].clearColor.r;
|
|
|
- clearValues[i].color.float32[1] = colorAttachmentInfos[i].clearColor.g;
|
|
|
- clearValues[i].color.float32[2] = colorAttachmentInfos[i].clearColor.b;
|
|
|
- clearValues[i].color.float32[3] = colorAttachmentInfos[i].clearColor.a;
|
|
|
+ clearValues[i].color.float32[0] = colorTargetInfos[i].clear_color.r;
|
|
|
+ clearValues[i].color.float32[1] = colorTargetInfos[i].clear_color.g;
|
|
|
+ clearValues[i].color.float32[2] = colorTargetInfos[i].clear_color.b;
|
|
|
+ clearValues[i].color.float32[3] = colorTargetInfos[i].clear_color.a;
|
|
|
|
|
|
- VulkanTextureContainer *container = (VulkanTextureContainer *)colorAttachmentInfos[i].texture;
|
|
|
+ VulkanTextureContainer *container = (VulkanTextureContainer *)colorTargetInfos[i].texture;
|
|
|
VulkanTextureSubresource *subresource = VULKAN_INTERNAL_FetchTextureSubresource(
|
|
|
container,
|
|
|
- container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorAttachmentInfos[i].layerOrDepthPlane,
|
|
|
- colorAttachmentInfos[i].mipLevel);
|
|
|
+ container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorTargetInfos[i].layer_or_depth_plane,
|
|
|
+ colorTargetInfos[i].mip_level);
|
|
|
|
|
|
if (subresource->parent->sampleCount > VK_SAMPLE_COUNT_1_BIT) {
|
|
|
- clearValues[i + 1].color.float32[0] = colorAttachmentInfos[i].clearColor.r;
|
|
|
- clearValues[i + 1].color.float32[1] = colorAttachmentInfos[i].clearColor.g;
|
|
|
- clearValues[i + 1].color.float32[2] = colorAttachmentInfos[i].clearColor.b;
|
|
|
- clearValues[i + 1].color.float32[3] = colorAttachmentInfos[i].clearColor.a;
|
|
|
+ clearValues[i + 1].color.float32[0] = colorTargetInfos[i].clear_color.r;
|
|
|
+ clearValues[i + 1].color.float32[1] = colorTargetInfos[i].clear_color.g;
|
|
|
+ clearValues[i + 1].color.float32[2] = colorTargetInfos[i].clear_color.b;
|
|
|
+ clearValues[i + 1].color.float32[3] = colorTargetInfos[i].clear_color.a;
|
|
|
i += 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (depthStencilAttachmentInfo != NULL) {
|
|
|
+ if (depthStencilTargetInfo != NULL) {
|
|
|
clearValues[totalColorAttachmentCount].depthStencil.depth =
|
|
|
- depthStencilAttachmentInfo->depthStencilClearValue.depth;
|
|
|
+ depthStencilTargetInfo->clear_value.depth;
|
|
|
clearValues[totalColorAttachmentCount].depthStencil.stencil =
|
|
|
- depthStencilAttachmentInfo->depthStencilClearValue.stencil;
|
|
|
+ depthStencilTargetInfo->clear_value.stencil;
|
|
|
}
|
|
|
|
|
|
VkRenderPassBeginInfo renderPassBeginInfo;
|
|
@@ -8040,8 +8040,8 @@ static void VULKAN_BeginRenderPass(
|
|
|
defaultViewport.y = 0;
|
|
|
defaultViewport.w = (float)framebufferWidth;
|
|
|
defaultViewport.h = (float)framebufferHeight;
|
|
|
- defaultViewport.minDepth = 0;
|
|
|
- defaultViewport.maxDepth = 1;
|
|
|
+ defaultViewport.min_depth = 0;
|
|
|
+ defaultViewport.max_depth = 1;
|
|
|
|
|
|
VULKAN_INTERNAL_SetCurrentViewport(
|
|
|
vulkanCommandBuffer,
|
|
@@ -8130,27 +8130,27 @@ static void VULKAN_BindGraphicsPipeline(
|
|
|
static void VULKAN_BindVertexBuffers(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 firstBinding,
|
|
|
- const SDL_GPUBufferBinding *pBindings,
|
|
|
- Uint32 bindingCount)
|
|
|
+ const SDL_GPUBufferBinding *bindings,
|
|
|
+ Uint32 numBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
|
VulkanBuffer *currentVulkanBuffer;
|
|
|
- VkBuffer *buffers = SDL_stack_alloc(VkBuffer, bindingCount);
|
|
|
- VkDeviceSize *offsets = SDL_stack_alloc(VkDeviceSize, bindingCount);
|
|
|
+ VkBuffer *buffers = SDL_stack_alloc(VkBuffer, numBindings);
|
|
|
+ VkDeviceSize *offsets = SDL_stack_alloc(VkDeviceSize, numBindings);
|
|
|
Uint32 i;
|
|
|
|
|
|
- for (i = 0; i < bindingCount; i += 1) {
|
|
|
- currentVulkanBuffer = ((VulkanBufferContainer *)pBindings[i].buffer)->activeBufferHandle->vulkanBuffer;
|
|
|
+ for (i = 0; i < numBindings; i += 1) {
|
|
|
+ currentVulkanBuffer = ((VulkanBufferContainer *)bindings[i].buffer)->activeBufferHandle->vulkanBuffer;
|
|
|
buffers[i] = currentVulkanBuffer->buffer;
|
|
|
- offsets[i] = (VkDeviceSize)pBindings[i].offset;
|
|
|
+ offsets[i] = (VkDeviceSize)bindings[i].offset;
|
|
|
VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, currentVulkanBuffer);
|
|
|
}
|
|
|
|
|
|
renderer->vkCmdBindVertexBuffers(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
firstBinding,
|
|
|
- bindingCount,
|
|
|
+ numBindings,
|
|
|
buffers,
|
|
|
offsets);
|
|
|
|
|
@@ -8160,19 +8160,19 @@ static void VULKAN_BindVertexBuffers(
|
|
|
|
|
|
static void VULKAN_BindIndexBuffer(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
- const SDL_GPUBufferBinding *pBinding,
|
|
|
+ const SDL_GPUBufferBinding *binding,
|
|
|
SDL_GPUIndexElementSize indexElementSize)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
|
- VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer *)pBinding->buffer)->activeBufferHandle->vulkanBuffer;
|
|
|
+ VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer *)binding->buffer)->activeBufferHandle->vulkanBuffer;
|
|
|
|
|
|
VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, vulkanBuffer);
|
|
|
|
|
|
renderer->vkCmdBindIndexBuffer(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
vulkanBuffer->buffer,
|
|
|
- (VkDeviceSize)pBinding->offset,
|
|
|
+ (VkDeviceSize)binding->offset,
|
|
|
SDLToVK_IndexType[indexElementSize]);
|
|
|
}
|
|
|
|
|
@@ -8180,7 +8180,7 @@ static void VULKAN_PushVertexUniformData(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 slotIndex,
|
|
|
const void *data,
|
|
|
- Uint32 dataLengthInBytes)
|
|
|
+ Uint32 length)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
|
|
@@ -8189,14 +8189,14 @@ static void VULKAN_PushVertexUniformData(
|
|
|
VULKAN_UNIFORM_BUFFER_STAGE_VERTEX,
|
|
|
slotIndex,
|
|
|
data,
|
|
|
- dataLengthInBytes);
|
|
|
+ length);
|
|
|
}
|
|
|
|
|
|
static void VULKAN_PushFragmentUniformData(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 slotIndex,
|
|
|
const void *data,
|
|
|
- Uint32 dataLengthInBytes)
|
|
|
+ Uint32 length)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
|
|
@@ -8205,7 +8205,7 @@ static void VULKAN_PushFragmentUniformData(
|
|
|
VULKAN_UNIFORM_BUFFER_STAGE_FRAGMENT,
|
|
|
slotIndex,
|
|
|
data,
|
|
|
- dataLengthInBytes);
|
|
|
+ length);
|
|
|
}
|
|
|
|
|
|
static void VULKAN_EndRenderPass(
|
|
@@ -8261,9 +8261,9 @@ static void VULKAN_EndRenderPass(
|
|
|
static void VULKAN_BeginComputePass(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
const SDL_GPUStorageTextureWriteOnlyBinding *storageTextureBindings,
|
|
|
- Uint32 storageTextureBindingCount,
|
|
|
+ Uint32 numStorageTextureBindings,
|
|
|
const SDL_GPUStorageBufferWriteOnlyBinding *storageBufferBindings,
|
|
|
- Uint32 storageBufferBindingCount)
|
|
|
+ Uint32 numStorageBufferBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
|
|
@@ -8271,9 +8271,9 @@ static void VULKAN_BeginComputePass(
|
|
|
VulkanBuffer *buffer;
|
|
|
Uint32 i;
|
|
|
|
|
|
- vulkanCommandBuffer->writeOnlyComputeStorageTextureSubresourceCount = storageTextureBindingCount;
|
|
|
+ vulkanCommandBuffer->writeOnlyComputeStorageTextureSubresourceCount = numStorageTextureBindings;
|
|
|
|
|
|
- for (i = 0; i < storageTextureBindingCount; i += 1) {
|
|
|
+ for (i = 0; i < numStorageTextureBindings; i += 1) {
|
|
|
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)storageTextureBindings[i].texture;
|
|
|
if (!(textureContainer->activeTextureHandle->vulkanTexture->usageFlags & SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE)) {
|
|
|
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Attempted to bind read-only texture as compute write texture");
|
|
@@ -8284,7 +8284,7 @@ static void VULKAN_BeginComputePass(
|
|
|
vulkanCommandBuffer,
|
|
|
textureContainer,
|
|
|
storageTextureBindings[i].layer,
|
|
|
- storageTextureBindings[i].mipLevel,
|
|
|
+ storageTextureBindings[i].mip_level,
|
|
|
storageTextureBindings[i].cycle,
|
|
|
VULKAN_TEXTURE_USAGE_MODE_COMPUTE_STORAGE_READ_WRITE);
|
|
|
|
|
@@ -8295,7 +8295,7 @@ static void VULKAN_BeginComputePass(
|
|
|
subresource->parent);
|
|
|
}
|
|
|
|
|
|
- for (i = 0; i < storageBufferBindingCount; i += 1) {
|
|
|
+ for (i = 0; i < numStorageBufferBindings; i += 1) {
|
|
|
bufferContainer = (VulkanBufferContainer *)storageBufferBindings[i].buffer;
|
|
|
buffer = VULKAN_INTERNAL_PrepareBufferForWrite(
|
|
|
renderer,
|
|
@@ -8330,7 +8330,7 @@ static void VULKAN_BindComputePipeline(
|
|
|
VULKAN_INTERNAL_TrackComputePipeline(vulkanCommandBuffer, vulkanComputePipeline);
|
|
|
|
|
|
// Acquire uniform buffers if necessary
|
|
|
- for (Uint32 i = 0; i < vulkanComputePipeline->resourceLayout.uniformBufferCount; i += 1) {
|
|
|
+ for (Uint32 i = 0; i < vulkanComputePipeline->resourceLayout.numUniformBuffers; i += 1) {
|
|
|
if (vulkanCommandBuffer->computeUniformBuffers[i] == NULL) {
|
|
|
vulkanCommandBuffer->computeUniformBuffers[i] = VULKAN_INTERNAL_AcquireUniformBufferFromPool(
|
|
|
vulkanCommandBuffer);
|
|
@@ -8348,12 +8348,12 @@ static void VULKAN_BindComputeStorageTextures(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 firstSlot,
|
|
|
SDL_GPUTexture *const *storageTextures,
|
|
|
- Uint32 bindingCount)
|
|
|
+ Uint32 numBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
|
|
|
|
|
|
- for (Uint32 i = 0; i < bindingCount; i += 1) {
|
|
|
+ for (Uint32 i = 0; i < numBindings; i += 1) {
|
|
|
if (vulkanCommandBuffer->readOnlyComputeStorageTextures[firstSlot + i] != NULL) {
|
|
|
VULKAN_INTERNAL_TextureTransitionToDefaultUsage(
|
|
|
renderer,
|
|
@@ -8385,14 +8385,14 @@ static void VULKAN_BindComputeStorageBuffers(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 firstSlot,
|
|
|
SDL_GPUBuffer *const *storageBuffers,
|
|
|
- Uint32 bindingCount)
|
|
|
+ Uint32 numBindings)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
|
|
|
VulkanBufferContainer *bufferContainer;
|
|
|
Uint32 i;
|
|
|
|
|
|
- for (i = 0; i < bindingCount; i += 1) {
|
|
|
+ for (i = 0; i < numBindings; i += 1) {
|
|
|
if (vulkanCommandBuffer->readOnlyComputeStorageBuffers[firstSlot + i] != NULL) {
|
|
|
VULKAN_INTERNAL_BufferTransitionToDefaultUsage(
|
|
|
renderer,
|
|
@@ -8423,7 +8423,7 @@ static void VULKAN_PushComputeUniformData(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
Uint32 slotIndex,
|
|
|
const void *data,
|
|
|
- Uint32 dataLengthInBytes)
|
|
|
+ Uint32 length)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
|
|
@@ -8432,7 +8432,7 @@ static void VULKAN_PushComputeUniformData(
|
|
|
VULKAN_UNIFORM_BUFFER_STAGE_COMPUTE,
|
|
|
slotIndex,
|
|
|
data,
|
|
|
- dataLengthInBytes);
|
|
|
+ length);
|
|
|
}
|
|
|
|
|
|
static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
@@ -8462,10 +8462,10 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
|
|
|
writeDescriptorSets = SDL_stack_alloc(
|
|
|
VkWriteDescriptorSet,
|
|
|
- resourceLayout->readOnlyStorageTextureCount +
|
|
|
- resourceLayout->readOnlyStorageBufferCount);
|
|
|
+ resourceLayout->numReadonlyStorageTextures +
|
|
|
+ resourceLayout->numReadonlyStorageBuffers);
|
|
|
|
|
|
- for (i = 0; i < resourceLayout->readOnlyStorageTextureCount; i += 1) {
|
|
|
+ for (i = 0; i < resourceLayout->numReadonlyStorageTextures; i += 1) {
|
|
|
currentWriteDescriptorSet = &writeDescriptorSets[i];
|
|
|
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
|
currentWriteDescriptorSet->pNext = NULL;
|
|
@@ -8486,15 +8486,15 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
imageInfoCount += 1;
|
|
|
}
|
|
|
|
|
|
- for (i = 0; i < resourceLayout->readOnlyStorageBufferCount; i += 1) {
|
|
|
- currentWriteDescriptorSet = &writeDescriptorSets[resourceLayout->readOnlyStorageTextureCount + i];
|
|
|
+ for (i = 0; i < resourceLayout->numReadonlyStorageBuffers; i += 1) {
|
|
|
+ currentWriteDescriptorSet = &writeDescriptorSets[resourceLayout->numReadonlyStorageTextures + i];
|
|
|
|
|
|
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
|
currentWriteDescriptorSet->pNext = NULL;
|
|
|
currentWriteDescriptorSet->descriptorCount = 1;
|
|
|
currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
|
|
currentWriteDescriptorSet->dstArrayElement = 0;
|
|
|
- currentWriteDescriptorSet->dstBinding = resourceLayout->readOnlyStorageTextureCount + i;
|
|
|
+ currentWriteDescriptorSet->dstBinding = resourceLayout->numReadonlyStorageTextures + i;
|
|
|
currentWriteDescriptorSet->dstSet = commandBuffer->computeReadOnlyDescriptorSet;
|
|
|
currentWriteDescriptorSet->pTexelBufferView = NULL;
|
|
|
currentWriteDescriptorSet->pImageInfo = NULL;
|
|
@@ -8510,7 +8510,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
|
|
|
renderer->vkUpdateDescriptorSets(
|
|
|
renderer->logicalDevice,
|
|
|
- resourceLayout->readOnlyStorageTextureCount + resourceLayout->readOnlyStorageBufferCount,
|
|
|
+ resourceLayout->numReadonlyStorageTextures + resourceLayout->numReadonlyStorageBuffers,
|
|
|
writeDescriptorSets,
|
|
|
0,
|
|
|
NULL);
|
|
@@ -8542,10 +8542,10 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
|
|
|
writeDescriptorSets = SDL_stack_alloc(
|
|
|
VkWriteDescriptorSet,
|
|
|
- resourceLayout->writeOnlyStorageTextureCount +
|
|
|
- resourceLayout->writeOnlyStorageBufferCount);
|
|
|
+ resourceLayout->numWriteonlyStorageTextures +
|
|
|
+ resourceLayout->numWriteonlyStorageBuffers);
|
|
|
|
|
|
- for (i = 0; i < resourceLayout->writeOnlyStorageTextureCount; i += 1) {
|
|
|
+ for (i = 0; i < resourceLayout->numWriteonlyStorageTextures; i += 1) {
|
|
|
currentWriteDescriptorSet = &writeDescriptorSets[i];
|
|
|
|
|
|
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
@@ -8567,15 +8567,15 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
imageInfoCount += 1;
|
|
|
}
|
|
|
|
|
|
- for (i = 0; i < resourceLayout->writeOnlyStorageBufferCount; i += 1) {
|
|
|
- currentWriteDescriptorSet = &writeDescriptorSets[resourceLayout->writeOnlyStorageTextureCount + i];
|
|
|
+ for (i = 0; i < resourceLayout->numWriteonlyStorageBuffers; i += 1) {
|
|
|
+ currentWriteDescriptorSet = &writeDescriptorSets[resourceLayout->numWriteonlyStorageTextures + i];
|
|
|
|
|
|
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
|
currentWriteDescriptorSet->pNext = NULL;
|
|
|
currentWriteDescriptorSet->descriptorCount = 1;
|
|
|
currentWriteDescriptorSet->descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
|
|
currentWriteDescriptorSet->dstArrayElement = 0;
|
|
|
- currentWriteDescriptorSet->dstBinding = resourceLayout->writeOnlyStorageTextureCount + i;
|
|
|
+ currentWriteDescriptorSet->dstBinding = resourceLayout->numWriteonlyStorageTextures + i;
|
|
|
currentWriteDescriptorSet->dstSet = commandBuffer->computeWriteOnlyDescriptorSet;
|
|
|
currentWriteDescriptorSet->pTexelBufferView = NULL;
|
|
|
currentWriteDescriptorSet->pImageInfo = NULL;
|
|
@@ -8591,7 +8591,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
|
|
|
renderer->vkUpdateDescriptorSets(
|
|
|
renderer->logicalDevice,
|
|
|
- resourceLayout->writeOnlyStorageTextureCount + resourceLayout->writeOnlyStorageBufferCount,
|
|
|
+ resourceLayout->numWriteonlyStorageTextures + resourceLayout->numWriteonlyStorageBuffers,
|
|
|
writeDescriptorSets,
|
|
|
0,
|
|
|
NULL);
|
|
@@ -8623,9 +8623,9 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
|
|
|
writeDescriptorSets = SDL_stack_alloc(
|
|
|
VkWriteDescriptorSet,
|
|
|
- resourceLayout->uniformBufferCount);
|
|
|
+ resourceLayout->numUniformBuffers);
|
|
|
|
|
|
- for (i = 0; i < resourceLayout->uniformBufferCount; i += 1) {
|
|
|
+ for (i = 0; i < resourceLayout->numUniformBuffers; i += 1) {
|
|
|
currentWriteDescriptorSet = &writeDescriptorSets[i];
|
|
|
|
|
|
currentWriteDescriptorSet->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
@@ -8649,7 +8649,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
|
|
|
renderer->vkUpdateDescriptorSets(
|
|
|
renderer->logicalDevice,
|
|
|
- resourceLayout->uniformBufferCount,
|
|
|
+ resourceLayout->numUniformBuffers,
|
|
|
writeDescriptorSets,
|
|
|
0,
|
|
|
NULL);
|
|
@@ -8663,7 +8663,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
}
|
|
|
|
|
|
if (commandBuffer->needNewComputeUniformOffsets) {
|
|
|
- for (i = 0; i < resourceLayout->uniformBufferCount; i += 1) {
|
|
|
+ for (i = 0; i < resourceLayout->numUniformBuffers; i += 1) {
|
|
|
dynamicOffsets[i] = commandBuffer->computeUniformBuffers[i]->drawOffset;
|
|
|
}
|
|
|
|
|
@@ -8674,7 +8674,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
2,
|
|
|
1,
|
|
|
&commandBuffer->computeUniformDescriptorSet,
|
|
|
- resourceLayout->uniformBufferCount,
|
|
|
+ resourceLayout->numUniformBuffers,
|
|
|
dynamicOffsets);
|
|
|
|
|
|
commandBuffer->needNewComputeUniformOffsets = false;
|
|
@@ -8683,9 +8683,9 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets(
|
|
|
|
|
|
static void VULKAN_DispatchCompute(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
- Uint32 groupCountX,
|
|
|
- Uint32 groupCountY,
|
|
|
- Uint32 groupCountZ)
|
|
|
+ Uint32 groupcountX,
|
|
|
+ Uint32 groupcountY,
|
|
|
+ Uint32 groupcountZ)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
@@ -8694,15 +8694,15 @@ static void VULKAN_DispatchCompute(
|
|
|
|
|
|
renderer->vkCmdDispatch(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
- groupCountX,
|
|
|
- groupCountY,
|
|
|
- groupCountZ);
|
|
|
+ groupcountX,
|
|
|
+ groupcountY,
|
|
|
+ groupcountZ);
|
|
|
}
|
|
|
|
|
|
static void VULKAN_DispatchComputeIndirect(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
SDL_GPUBuffer *buffer,
|
|
|
- Uint32 offsetInBytes)
|
|
|
+ Uint32 offset)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
@@ -8713,7 +8713,7 @@ static void VULKAN_DispatchComputeIndirect(
|
|
|
renderer->vkCmdDispatchIndirect(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
vulkanBuffer->buffer,
|
|
|
- offsetInBytes);
|
|
|
+ offset);
|
|
|
|
|
|
VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, vulkanBuffer);
|
|
|
}
|
|
@@ -8824,7 +8824,7 @@ static void VULKAN_UploadToTexture(
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
|
- VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)source->transferBuffer;
|
|
|
+ VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)source->transfer_buffer;
|
|
|
VulkanTextureContainer *vulkanTextureContainer = (VulkanTextureContainer *)destination->texture;
|
|
|
VulkanTextureSubresource *vulkanTextureSubresource;
|
|
|
VkBufferImageCopy imageCopy;
|
|
@@ -8836,7 +8836,7 @@ static void VULKAN_UploadToTexture(
|
|
|
vulkanCommandBuffer,
|
|
|
vulkanTextureContainer,
|
|
|
destination->layer,
|
|
|
- destination->mipLevel,
|
|
|
+ destination->mip_level,
|
|
|
cycle,
|
|
|
VULKAN_TEXTURE_USAGE_MODE_COPY_DESTINATION);
|
|
|
|
|
@@ -8849,10 +8849,10 @@ static void VULKAN_UploadToTexture(
|
|
|
imageCopy.imageSubresource.aspectMask = vulkanTextureSubresource->parent->aspectFlags;
|
|
|
imageCopy.imageSubresource.baseArrayLayer = destination->layer;
|
|
|
imageCopy.imageSubresource.layerCount = 1;
|
|
|
- imageCopy.imageSubresource.mipLevel = destination->mipLevel;
|
|
|
+ imageCopy.imageSubresource.mipLevel = destination->mip_level;
|
|
|
imageCopy.bufferOffset = source->offset;
|
|
|
- imageCopy.bufferRowLength = source->imagePitch;
|
|
|
- imageCopy.bufferImageHeight = source->imageHeight;
|
|
|
+ imageCopy.bufferRowLength = source->pixels_per_row;
|
|
|
+ imageCopy.bufferImageHeight = source->rows_per_layer;
|
|
|
|
|
|
renderer->vkCmdCopyBufferToImage(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
@@ -8880,7 +8880,7 @@ static void VULKAN_UploadToBuffer(
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
|
- VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)source->transferBuffer;
|
|
|
+ VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)source->transfer_buffer;
|
|
|
VulkanBufferContainer *bufferContainer = (VulkanBufferContainer *)destination->buffer;
|
|
|
VkBufferCopy bufferCopy;
|
|
|
|
|
@@ -8925,12 +8925,12 @@ static void VULKAN_DownloadFromTexture(
|
|
|
VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
|
|
|
VulkanTextureContainer *textureContainer = (VulkanTextureContainer *)source->texture;
|
|
|
VulkanTextureSubresource *vulkanTextureSubresource;
|
|
|
- VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)destination->transferBuffer;
|
|
|
+ VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)destination->transfer_buffer;
|
|
|
VkBufferImageCopy imageCopy;
|
|
|
vulkanTextureSubresource = VULKAN_INTERNAL_FetchTextureSubresource(
|
|
|
textureContainer,
|
|
|
source->layer,
|
|
|
- source->mipLevel);
|
|
|
+ source->mip_level);
|
|
|
|
|
|
// Note that the transfer buffer does not need a barrier, as it is synced by the client
|
|
|
|
|
@@ -8949,10 +8949,10 @@ static void VULKAN_DownloadFromTexture(
|
|
|
imageCopy.imageSubresource.aspectMask = vulkanTextureSubresource->parent->aspectFlags;
|
|
|
imageCopy.imageSubresource.baseArrayLayer = source->layer;
|
|
|
imageCopy.imageSubresource.layerCount = 1;
|
|
|
- imageCopy.imageSubresource.mipLevel = source->mipLevel;
|
|
|
+ imageCopy.imageSubresource.mipLevel = source->mip_level;
|
|
|
imageCopy.bufferOffset = destination->offset;
|
|
|
- imageCopy.bufferRowLength = destination->imagePitch;
|
|
|
- imageCopy.bufferImageHeight = destination->imageHeight;
|
|
|
+ imageCopy.bufferRowLength = destination->pixels_per_row;
|
|
|
+ imageCopy.bufferImageHeight = destination->rows_per_layer;
|
|
|
|
|
|
renderer->vkCmdCopyImageToBuffer(
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
@@ -8980,7 +8980,7 @@ static void VULKAN_DownloadFromBuffer(
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = vulkanCommandBuffer->renderer;
|
|
|
VulkanBufferContainer *bufferContainer = (VulkanBufferContainer *)source->buffer;
|
|
|
- VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)destination->transferBuffer;
|
|
|
+ VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)destination->transfer_buffer;
|
|
|
VkBufferCopy bufferCopy;
|
|
|
|
|
|
// Note that transfer buffer does not need a barrier, as it is synced by the client
|
|
@@ -9030,14 +9030,14 @@ static void VULKAN_CopyTextureToTexture(
|
|
|
srcSubresource = VULKAN_INTERNAL_FetchTextureSubresource(
|
|
|
(VulkanTextureContainer *)source->texture,
|
|
|
source->layer,
|
|
|
- source->mipLevel);
|
|
|
+ source->mip_level);
|
|
|
|
|
|
dstSubresource = VULKAN_INTERNAL_PrepareTextureSubresourceForWrite(
|
|
|
renderer,
|
|
|
vulkanCommandBuffer,
|
|
|
(VulkanTextureContainer *)destination->texture,
|
|
|
destination->layer,
|
|
|
- destination->mipLevel,
|
|
|
+ destination->mip_level,
|
|
|
cycle,
|
|
|
VULKAN_TEXTURE_USAGE_MODE_COPY_DESTINATION);
|
|
|
|
|
@@ -9053,14 +9053,14 @@ static void VULKAN_CopyTextureToTexture(
|
|
|
imageCopy.srcSubresource.aspectMask = srcSubresource->parent->aspectFlags;
|
|
|
imageCopy.srcSubresource.baseArrayLayer = source->layer;
|
|
|
imageCopy.srcSubresource.layerCount = 1;
|
|
|
- imageCopy.srcSubresource.mipLevel = source->mipLevel;
|
|
|
+ imageCopy.srcSubresource.mipLevel = source->mip_level;
|
|
|
imageCopy.dstOffset.x = destination->x;
|
|
|
imageCopy.dstOffset.y = destination->y;
|
|
|
imageCopy.dstOffset.z = destination->z;
|
|
|
imageCopy.dstSubresource.aspectMask = dstSubresource->parent->aspectFlags;
|
|
|
imageCopy.dstSubresource.baseArrayLayer = destination->layer;
|
|
|
imageCopy.dstSubresource.layerCount = 1;
|
|
|
- imageCopy.dstSubresource.mipLevel = destination->mipLevel;
|
|
|
+ imageCopy.dstSubresource.mipLevel = destination->mip_level;
|
|
|
imageCopy.extent.width = w;
|
|
|
imageCopy.extent.height = h;
|
|
|
imageCopy.extent.depth = d;
|
|
@@ -9156,18 +9156,18 @@ static void VULKAN_GenerateMipmaps(
|
|
|
|
|
|
// Blit each slice sequentially. Barriers, barriers everywhere!
|
|
|
for (Uint32 layerOrDepthIndex = 0; layerOrDepthIndex < vulkanTexture->layerCount; layerOrDepthIndex += 1)
|
|
|
- for (Uint32 level = 1; level < vulkanTexture->levelCount; level += 1) {
|
|
|
+ for (Uint32 level = 1; level < vulkanTexture->numLevels; level += 1) {
|
|
|
Uint32 layer = vulkanTexture->type == SDL_GPU_TEXTURETYPE_3D ? 0 : layerOrDepthIndex;
|
|
|
Uint32 depth = vulkanTexture->type == SDL_GPU_TEXTURETYPE_3D ? layerOrDepthIndex : 0;
|
|
|
|
|
|
Uint32 srcSubresourceIndex = VULKAN_INTERNAL_GetTextureSubresourceIndex(
|
|
|
level - 1,
|
|
|
layer,
|
|
|
- vulkanTexture->levelCount);
|
|
|
+ vulkanTexture->numLevels);
|
|
|
Uint32 dstSubresourceIndex = VULKAN_INTERNAL_GetTextureSubresourceIndex(
|
|
|
level,
|
|
|
layer,
|
|
|
- vulkanTexture->levelCount);
|
|
|
+ vulkanTexture->numLevels);
|
|
|
|
|
|
srcTextureSubresource = &vulkanTexture->subresources[srcSubresourceIndex];
|
|
|
dstTextureSubresource = &vulkanTexture->subresources[dstSubresourceIndex];
|
|
@@ -9249,7 +9249,7 @@ static void VULKAN_Blit(
|
|
|
const SDL_GPUBlitRegion *source,
|
|
|
const SDL_GPUBlitRegion *destination,
|
|
|
SDL_FlipMode flipMode,
|
|
|
- SDL_GPUFilter filterMode,
|
|
|
+ SDL_GPUFilter filter,
|
|
|
bool cycle)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
@@ -9257,23 +9257,23 @@ static void VULKAN_Blit(
|
|
|
TextureCommonHeader *srcHeader = (TextureCommonHeader *)source->texture;
|
|
|
TextureCommonHeader *dstHeader = (TextureCommonHeader *)destination->texture;
|
|
|
VkImageBlit region;
|
|
|
- Uint32 srcLayer = srcHeader->info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : source->layerOrDepthPlane;
|
|
|
- Uint32 srcDepth = srcHeader->info.type == SDL_GPU_TEXTURETYPE_3D ? source->layerOrDepthPlane : 0;
|
|
|
- Uint32 dstLayer = dstHeader->info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : destination->layerOrDepthPlane;
|
|
|
- Uint32 dstDepth = dstHeader->info.type == SDL_GPU_TEXTURETYPE_3D ? destination->layerOrDepthPlane : 0;
|
|
|
+ Uint32 srcLayer = srcHeader->info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : source->layer_or_depth_plane;
|
|
|
+ Uint32 srcDepth = srcHeader->info.type == SDL_GPU_TEXTURETYPE_3D ? source->layer_or_depth_plane : 0;
|
|
|
+ Uint32 dstLayer = dstHeader->info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : destination->layer_or_depth_plane;
|
|
|
+ Uint32 dstDepth = dstHeader->info.type == SDL_GPU_TEXTURETYPE_3D ? destination->layer_or_depth_plane : 0;
|
|
|
int32_t swap;
|
|
|
|
|
|
VulkanTextureSubresource *srcSubresource = VULKAN_INTERNAL_FetchTextureSubresource(
|
|
|
(VulkanTextureContainer *)source->texture,
|
|
|
srcLayer,
|
|
|
- source->mipLevel);
|
|
|
+ source->mip_level);
|
|
|
|
|
|
VulkanTextureSubresource *dstSubresource = VULKAN_INTERNAL_PrepareTextureSubresourceForWrite(
|
|
|
renderer,
|
|
|
vulkanCommandBuffer,
|
|
|
(VulkanTextureContainer *)destination->texture,
|
|
|
dstLayer,
|
|
|
- destination->mipLevel,
|
|
|
+ destination->mip_level,
|
|
|
cycle,
|
|
|
VULKAN_TEXTURE_USAGE_MODE_COPY_DESTINATION);
|
|
|
|
|
@@ -9327,7 +9327,7 @@ static void VULKAN_Blit(
|
|
|
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
|
|
1,
|
|
|
®ion,
|
|
|
- SDLToVK_Filter[filterMode]);
|
|
|
+ SDLToVK_Filter[filter]);
|
|
|
|
|
|
VULKAN_INTERNAL_TextureSubresourceTransitionToDefaultUsage(
|
|
|
renderer,
|
|
@@ -9920,8 +9920,8 @@ static bool VULKAN_INTERNAL_RecreateSwapchain(
|
|
|
static SDL_GPUTexture *VULKAN_AcquireSwapchainTexture(
|
|
|
SDL_GPUCommandBuffer *commandBuffer,
|
|
|
SDL_Window *window,
|
|
|
- Uint32 *pWidth,
|
|
|
- Uint32 *pHeight)
|
|
|
+ Uint32 *w,
|
|
|
+ Uint32 *h)
|
|
|
{
|
|
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer;
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer;
|
|
@@ -10098,8 +10098,8 @@ static SDL_GPUTexture *VULKAN_AcquireSwapchainTexture(
|
|
|
swapchainData->renderFinishedSemaphore[swapchainData->frameCounter];
|
|
|
vulkanCommandBuffer->signalSemaphoreCount += 1;
|
|
|
|
|
|
- *pWidth = swapchainData->textureContainers[swapchainData->frameCounter].header.info.width;
|
|
|
- *pHeight = swapchainData->textureContainers[swapchainData->frameCounter].header.info.height;
|
|
|
+ *w = swapchainData->textureContainers[swapchainData->frameCounter].header.info.width;
|
|
|
+ *h = swapchainData->textureContainers[swapchainData->frameCounter].header.info.height;
|
|
|
|
|
|
return (SDL_GPUTexture *)swapchainTextureContainer;
|
|
|
}
|
|
@@ -10415,21 +10415,21 @@ static void VULKAN_INTERNAL_CleanCommandBuffer(
|
|
|
static void VULKAN_WaitForFences(
|
|
|
SDL_GPURenderer *driverData,
|
|
|
bool waitAll,
|
|
|
- SDL_GPUFence *const *pFences,
|
|
|
- Uint32 fenceCount)
|
|
|
+ SDL_GPUFence *const *fences,
|
|
|
+ Uint32 numFences)
|
|
|
{
|
|
|
VulkanRenderer *renderer = (VulkanRenderer *)driverData;
|
|
|
- VkFence *fences = SDL_stack_alloc(VkFence, fenceCount);
|
|
|
+ VkFence *vkFences = SDL_stack_alloc(VkFence, numFences);
|
|
|
VkResult result;
|
|
|
|
|
|
- for (Uint32 i = 0; i < fenceCount; i += 1) {
|
|
|
- fences[i] = ((VulkanFenceHandle *)pFences[i])->fence;
|
|
|
+ for (Uint32 i = 0; i < numFences; i += 1) {
|
|
|
+ vkFences[i] = ((VulkanFenceHandle *)fences[i])->fence;
|
|
|
}
|
|
|
|
|
|
result = renderer->vkWaitForFences(
|
|
|
renderer->logicalDevice,
|
|
|
- fenceCount,
|
|
|
- fences,
|
|
|
+ numFences,
|
|
|
+ vkFences,
|
|
|
waitAll,
|
|
|
UINT64_MAX);
|
|
|
|
|
@@ -10437,7 +10437,7 @@ static void VULKAN_WaitForFences(
|
|
|
LogVulkanResultAsError("vkWaitForFences", result);
|
|
|
}
|
|
|
|
|
|
- SDL_stack_free(fences);
|
|
|
+ SDL_stack_free(vkFences);
|
|
|
|
|
|
SDL_LockMutex(renderer->submitLock);
|
|
|
|
|
@@ -10774,7 +10774,7 @@ static Uint8 VULKAN_INTERNAL_DefragmentMemory(
|
|
|
currentRegion->vulkanTexture->depth,
|
|
|
currentRegion->vulkanTexture->type,
|
|
|
currentRegion->vulkanTexture->layerCount,
|
|
|
- currentRegion->vulkanTexture->levelCount,
|
|
|
+ currentRegion->vulkanTexture->numLevels,
|
|
|
currentRegion->vulkanTexture->sampleCount,
|
|
|
currentRegion->vulkanTexture->format,
|
|
|
currentRegion->vulkanTexture->swizzle,
|
|
@@ -11623,13 +11623,13 @@ static bool VULKAN_INTERNAL_PrepareVulkan(
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-static bool VULKAN_PrepareDriver(SDL_VideoDevice *_this)
|
|
|
+static bool VULKAN_PrepareDriver(SDL_VideoDevice *this)
|
|
|
{
|
|
|
// Set up dummy VulkanRenderer
|
|
|
VulkanRenderer *renderer;
|
|
|
Uint8 result;
|
|
|
|
|
|
- if (_this->Vulkan_CreateSurface == NULL) {
|
|
|
+ if (this->Vulkan_CreateSurface == NULL) {
|
|
|
return false;
|
|
|
}
|
|
|
|