forked from MoonsideGames/Refresh
draw functions
parent
6e7f6ef1ec
commit
4233c7767e
|
@ -628,43 +628,22 @@ REFRESHAPI void REFRESH_Clear(
|
||||||
int32_t stencil
|
int32_t stencil
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Draws data from vertex/index buffers.
|
|
||||||
*
|
|
||||||
* primitiveType: The primitive topology of the vertex data.
|
|
||||||
* baseVertex: The starting offset to read from the vertex buffer.
|
|
||||||
* minVertexIndex: The lowest index value expected from the index buffer.
|
|
||||||
* numVertices: The highest offset expected from the index buffer.
|
|
||||||
* startIndex: The starting offset to read from the index buffer.
|
|
||||||
* primitiveCount: The number of primitives to draw.
|
|
||||||
* indices: The index buffer to bind for this draw call.
|
|
||||||
* indexElementSize: The size of the index type for this index buffer.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void REFRESH_DrawIndexedPrimitives(
|
|
||||||
REFRESH_Device *device,
|
|
||||||
REFRESH_PrimitiveType primitiveType,
|
|
||||||
uint32_t baseVertex,
|
|
||||||
uint32_t minVertexIndex,
|
|
||||||
uint32_t numVertices,
|
|
||||||
uint32_t startIndex,
|
|
||||||
uint32_t primitiveCount,
|
|
||||||
REFRESH_Buffer *indices,
|
|
||||||
REFRESH_IndexElementSize indexElementSize
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Draws data from vertex/index buffers with instancing enabled.
|
/* Draws data from vertex/index buffers with instancing enabled.
|
||||||
*
|
*
|
||||||
* primitiveType: The primitive topology of the vertex data.
|
* graphicsPipeline: The graphics pipeline through which to draw.
|
||||||
* baseVertex: The starting offset to read from the vertex buffer.
|
* primitiveType: The primitive topology of the vertex data.
|
||||||
* minVertexIndex: The lowest index value expected from the index buffer.
|
* baseVertex: The starting offset to read from the vertex buffer.
|
||||||
* numVertices: The highest offset expected from the index buffer.
|
* minVertexIndex: The lowest index value expected from the index buffer.
|
||||||
* startIndex: The starting offset to read from the index buffer.
|
* numVertices: The highest offset expected from the index buffer.
|
||||||
* primitiveCount: The number of primitives to draw.
|
* startIndex: The starting offset to read from the index buffer.
|
||||||
* instanceCount: The number of instances that will be drawn.
|
* primitiveCount: The number of primitives to draw.
|
||||||
* indices: The index buffer to bind for this draw call.
|
* instanceCount: The number of instances that will be drawn.
|
||||||
|
* indices: The index buffer to bind for this draw call.
|
||||||
* indexElementSize: The size of the index type for this index buffer.
|
* indexElementSize: The size of the index type for this index buffer.
|
||||||
*/
|
*/
|
||||||
REFRESHAPI void REFRESH_DrawInstancedPrimitives(
|
REFRESHAPI void REFRESH_DrawInstancedPrimitives(
|
||||||
REFRESH_Device *device,
|
REFRESH_Device *device,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
REFRESH_PrimitiveType primitiveType,
|
REFRESH_PrimitiveType primitiveType,
|
||||||
uint32_t baseVertex,
|
uint32_t baseVertex,
|
||||||
uint32_t minVertexIndex,
|
uint32_t minVertexIndex,
|
||||||
|
@ -676,13 +655,41 @@ REFRESHAPI void REFRESH_DrawInstancedPrimitives(
|
||||||
REFRESH_IndexElementSize indexElementSize
|
REFRESH_IndexElementSize indexElementSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* Draws data from vertex/index buffers.
|
||||||
|
*
|
||||||
|
* graphicsPipeline: The graphics pipeline through which to draw.
|
||||||
|
* primitiveType: The primitive topology of the vertex data.
|
||||||
|
* baseVertex: The starting offset to read from the vertex buffer.
|
||||||
|
* minVertexIndex: The lowest index value expected from the index buffer.
|
||||||
|
* numVertices: The highest offset expected from the index buffer.
|
||||||
|
* startIndex: The starting offset to read from the index buffer.
|
||||||
|
* primitiveCount: The number of primitives to draw.
|
||||||
|
* indices: The index buffer to bind for this draw call.
|
||||||
|
* indexElementSize: The size of the index type for this index buffer.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void REFRESH_DrawIndexedPrimitives(
|
||||||
|
REFRESH_Device *device,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
|
REFRESH_PrimitiveType primitiveType,
|
||||||
|
uint32_t baseVertex,
|
||||||
|
uint32_t minVertexIndex,
|
||||||
|
uint32_t numVertices,
|
||||||
|
uint32_t startIndex,
|
||||||
|
uint32_t primitiveCount,
|
||||||
|
REFRESH_Buffer *indices,
|
||||||
|
REFRESH_IndexElementSize indexElementSize
|
||||||
|
);
|
||||||
|
|
||||||
/* Draws data from vertex buffers.
|
/* Draws data from vertex buffers.
|
||||||
* primitiveType: The primitive topology of the vertex data.
|
*
|
||||||
* vertexStart: The starting offset to read from the vertex buffer.
|
* graphicsPipeline: The graphics pipeline through which to draw.
|
||||||
* primitiveCount: The number of primitives to draw.
|
* primitiveType: The primitive topology of the vertex data.
|
||||||
|
* vertexStart: The starting offset to read from the vertex buffer.
|
||||||
|
* primitiveCount: The number of primitives to draw.
|
||||||
*/
|
*/
|
||||||
REFRESHAPI void REFRESH_DrawPrimitives(
|
REFRESHAPI void REFRESH_DrawPrimitives(
|
||||||
REFRESH_Device *device,
|
REFRESH_Device *device,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
REFRESH_PrimitiveType primitiveType,
|
REFRESH_PrimitiveType primitiveType,
|
||||||
uint32_t vertexStart,
|
uint32_t vertexStart,
|
||||||
uint32_t primitiveCount
|
uint32_t primitiveCount
|
||||||
|
|
|
@ -161,6 +161,7 @@ void REFRESH_Clear(
|
||||||
|
|
||||||
void REFRESH_DrawIndexedPrimitives(
|
void REFRESH_DrawIndexedPrimitives(
|
||||||
REFRESH_Device *device,
|
REFRESH_Device *device,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
REFRESH_PrimitiveType primitiveType,
|
REFRESH_PrimitiveType primitiveType,
|
||||||
uint32_t baseVertex,
|
uint32_t baseVertex,
|
||||||
uint32_t minVertexIndex,
|
uint32_t minVertexIndex,
|
||||||
|
@ -173,6 +174,7 @@ void REFRESH_DrawIndexedPrimitives(
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->DrawIndexedPrimitives(
|
device->DrawIndexedPrimitives(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
|
graphicsPipeline,
|
||||||
primitiveType,
|
primitiveType,
|
||||||
baseVertex,
|
baseVertex,
|
||||||
minVertexIndex,
|
minVertexIndex,
|
||||||
|
@ -186,6 +188,7 @@ void REFRESH_DrawIndexedPrimitives(
|
||||||
|
|
||||||
void REFRESH_DrawInstancedPrimitives(
|
void REFRESH_DrawInstancedPrimitives(
|
||||||
REFRESH_Device *device,
|
REFRESH_Device *device,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
REFRESH_PrimitiveType primitiveType,
|
REFRESH_PrimitiveType primitiveType,
|
||||||
uint32_t baseVertex,
|
uint32_t baseVertex,
|
||||||
uint32_t minVertexIndex,
|
uint32_t minVertexIndex,
|
||||||
|
@ -199,6 +202,7 @@ void REFRESH_DrawInstancedPrimitives(
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->DrawInstancedPrimitives(
|
device->DrawInstancedPrimitives(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
|
graphicsPipeline,
|
||||||
primitiveType,
|
primitiveType,
|
||||||
baseVertex,
|
baseVertex,
|
||||||
minVertexIndex,
|
minVertexIndex,
|
||||||
|
@ -213,6 +217,7 @@ void REFRESH_DrawInstancedPrimitives(
|
||||||
|
|
||||||
void REFRESH_DrawPrimitives(
|
void REFRESH_DrawPrimitives(
|
||||||
REFRESH_Device *device,
|
REFRESH_Device *device,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
REFRESH_PrimitiveType primitiveType,
|
REFRESH_PrimitiveType primitiveType,
|
||||||
uint32_t vertexStart,
|
uint32_t vertexStart,
|
||||||
uint32_t primitiveCount
|
uint32_t primitiveCount
|
||||||
|
@ -220,6 +225,7 @@ void REFRESH_DrawPrimitives(
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->DrawPrimitives(
|
device->DrawPrimitives(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
|
graphicsPipeline,
|
||||||
primitiveType,
|
primitiveType,
|
||||||
vertexStart,
|
vertexStart,
|
||||||
primitiveCount
|
primitiveCount
|
||||||
|
|
|
@ -177,19 +177,9 @@ struct REFRESH_Device
|
||||||
int32_t stencil
|
int32_t stencil
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*DrawIndexedPrimitives)(
|
|
||||||
REFRESH_Renderer *driverData,
|
|
||||||
REFRESH_PrimitiveType primitiveType,
|
|
||||||
uint32_t baseVertex,
|
|
||||||
uint32_t minVertexIndex,
|
|
||||||
uint32_t numVertices,
|
|
||||||
uint32_t startIndex,
|
|
||||||
uint32_t primitiveCount,
|
|
||||||
REFRESH_Buffer *indices,
|
|
||||||
REFRESH_IndexElementSize indexElementSize
|
|
||||||
);
|
|
||||||
void (*DrawInstancedPrimitives)(
|
void (*DrawInstancedPrimitives)(
|
||||||
REFRESH_Renderer *driverData,
|
REFRESH_Renderer *driverData,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
REFRESH_PrimitiveType primitiveType,
|
REFRESH_PrimitiveType primitiveType,
|
||||||
uint32_t baseVertex,
|
uint32_t baseVertex,
|
||||||
uint32_t minVertexIndex,
|
uint32_t minVertexIndex,
|
||||||
|
@ -200,8 +190,23 @@ struct REFRESH_Device
|
||||||
REFRESH_Buffer *indices,
|
REFRESH_Buffer *indices,
|
||||||
REFRESH_IndexElementSize indexElementSize
|
REFRESH_IndexElementSize indexElementSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void (*DrawIndexedPrimitives)(
|
||||||
|
REFRESH_Renderer *driverData,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
|
REFRESH_PrimitiveType primitiveType,
|
||||||
|
uint32_t baseVertex,
|
||||||
|
uint32_t minVertexIndex,
|
||||||
|
uint32_t numVertices,
|
||||||
|
uint32_t startIndex,
|
||||||
|
uint32_t primitiveCount,
|
||||||
|
REFRESH_Buffer *indices,
|
||||||
|
REFRESH_IndexElementSize indexElementSize
|
||||||
|
);
|
||||||
|
|
||||||
void (*DrawPrimitives)(
|
void (*DrawPrimitives)(
|
||||||
REFRESH_Renderer *driverData,
|
REFRESH_Renderer *driverData,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
REFRESH_PrimitiveType primitiveType,
|
REFRESH_PrimitiveType primitiveType,
|
||||||
uint32_t vertexStart,
|
uint32_t vertexStart,
|
||||||
uint32_t primitiveCount
|
uint32_t primitiveCount
|
||||||
|
|
|
@ -683,8 +683,11 @@ typedef struct VulkanRenderer
|
||||||
VkDescriptorPool *descriptorPools;
|
VkDescriptorPool *descriptorPools;
|
||||||
uint32_t descriptorPoolCount;
|
uint32_t descriptorPoolCount;
|
||||||
|
|
||||||
|
VkDescriptorPool UBODescriptorPool;
|
||||||
VkDescriptorSetLayout vertexParamLayout;
|
VkDescriptorSetLayout vertexParamLayout;
|
||||||
VkDescriptorSetLayout fragmentParamLayout;
|
VkDescriptorSetLayout fragmentParamLayout;
|
||||||
|
VkDescriptorSet vertexUBODescriptorSet;
|
||||||
|
VkDescriptorSet fragmentUBODescriptorSet;
|
||||||
|
|
||||||
VulkanBuffer *textureStagingBuffer;
|
VulkanBuffer *textureStagingBuffer;
|
||||||
VulkanBuffer *vertexUBO;
|
VulkanBuffer *vertexUBO;
|
||||||
|
@ -750,11 +753,16 @@ typedef struct VulkanDepthStencilTarget
|
||||||
typedef struct VulkanGraphicsPipeline
|
typedef struct VulkanGraphicsPipeline
|
||||||
{
|
{
|
||||||
VkPipeline pipeline;
|
VkPipeline pipeline;
|
||||||
|
VkPipelineLayout layout;
|
||||||
VkDescriptorPool descriptorPool;
|
VkDescriptorPool descriptorPool;
|
||||||
VkDescriptorSetLayout vertexSamplerLayout;
|
VkDescriptorSetLayout vertexSamplerLayout;
|
||||||
uint32_t vertexSamplerBindingCount;
|
uint32_t vertexSamplerBindingCount;
|
||||||
VkDescriptorSetLayout fragmentSamplerLayout;
|
VkDescriptorSetLayout fragmentSamplerLayout;
|
||||||
uint32_t fragmentSamplerBindingCount;
|
uint32_t fragmentSamplerBindingCount;
|
||||||
|
VkDescriptorSet vertexSamplerDescriptorSet; /* updated by SetVertexSamplers */
|
||||||
|
VkDescriptorSet fragmentSamplerDescriptorSet; /* updated by SetFragmentSamplers */
|
||||||
|
uint32_t vertexUBOOffset; /* updated by PushVertexShaderParams */
|
||||||
|
uint32_t fragmentUBOOffset; /* updated by PushFragmentShaderParams */
|
||||||
} VulkanGraphicsPipeline;
|
} VulkanGraphicsPipeline;
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
|
@ -1707,22 +1715,9 @@ static void VULKAN_Clear(
|
||||||
SDL_assert(0);
|
SDL_assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_DrawIndexedPrimitives(
|
|
||||||
REFRESH_Renderer *driverData,
|
|
||||||
REFRESH_PrimitiveType primitiveType,
|
|
||||||
uint32_t baseVertex,
|
|
||||||
uint32_t minVertexIndex,
|
|
||||||
uint32_t numVertices,
|
|
||||||
uint32_t startIndex,
|
|
||||||
uint32_t primitiveCount,
|
|
||||||
REFRESH_Buffer *indices,
|
|
||||||
REFRESH_IndexElementSize indexElementSize
|
|
||||||
) {
|
|
||||||
SDL_assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void VULKAN_DrawInstancedPrimitives(
|
static void VULKAN_DrawInstancedPrimitives(
|
||||||
REFRESH_Renderer *driverData,
|
REFRESH_Renderer *driverData,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
REFRESH_PrimitiveType primitiveType,
|
REFRESH_PrimitiveType primitiveType,
|
||||||
uint32_t baseVertex,
|
uint32_t baseVertex,
|
||||||
uint32_t minVertexIndex,
|
uint32_t minVertexIndex,
|
||||||
|
@ -1733,16 +1728,108 @@ static void VULKAN_DrawInstancedPrimitives(
|
||||||
REFRESH_Buffer *indices,
|
REFRESH_Buffer *indices,
|
||||||
REFRESH_IndexElementSize indexElementSize
|
REFRESH_IndexElementSize indexElementSize
|
||||||
) {
|
) {
|
||||||
SDL_assert(0);
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
|
VulkanGraphicsPipeline *pipeline = (VulkanGraphicsPipeline*) graphicsPipeline;
|
||||||
|
VkDescriptorSet descriptorSets[4];
|
||||||
|
uint32_t dynamicOffsets[2];
|
||||||
|
|
||||||
|
descriptorSets[0] = pipeline->vertexSamplerDescriptorSet;
|
||||||
|
descriptorSets[1] = pipeline->fragmentSamplerDescriptorSet;
|
||||||
|
descriptorSets[2] = renderer->vertexUBODescriptorSet;
|
||||||
|
descriptorSets[3] = renderer->fragmentUBODescriptorSet;
|
||||||
|
|
||||||
|
dynamicOffsets[0] = pipeline->vertexUBOOffset;
|
||||||
|
dynamicOffsets[1] = pipeline->fragmentUBOOffset;
|
||||||
|
|
||||||
|
RECORD_CMD(renderer->vkCmdBindDescriptorSets(
|
||||||
|
renderer->currentCommandBuffer,
|
||||||
|
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||||
|
pipeline->layout,
|
||||||
|
0,
|
||||||
|
4,
|
||||||
|
descriptorSets,
|
||||||
|
2,
|
||||||
|
dynamicOffsets
|
||||||
|
));
|
||||||
|
|
||||||
|
RECORD_CMD(renderer->vkCmdDrawIndexed(
|
||||||
|
renderer->currentCommandBuffer,
|
||||||
|
PrimitiveVerts(primitiveType, primitiveCount),
|
||||||
|
instanceCount,
|
||||||
|
startIndex,
|
||||||
|
baseVertex,
|
||||||
|
0
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VULKAN_DrawIndexedPrimitives(
|
||||||
|
REFRESH_Renderer *driverData,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
|
REFRESH_PrimitiveType primitiveType,
|
||||||
|
uint32_t baseVertex,
|
||||||
|
uint32_t minVertexIndex,
|
||||||
|
uint32_t numVertices,
|
||||||
|
uint32_t startIndex,
|
||||||
|
uint32_t primitiveCount,
|
||||||
|
REFRESH_Buffer *indices,
|
||||||
|
REFRESH_IndexElementSize indexElementSize
|
||||||
|
) {
|
||||||
|
VULKAN_DrawInstancedPrimitives(
|
||||||
|
driverData,
|
||||||
|
graphicsPipeline,
|
||||||
|
primitiveType,
|
||||||
|
baseVertex,
|
||||||
|
minVertexIndex,
|
||||||
|
numVertices,
|
||||||
|
startIndex,
|
||||||
|
primitiveCount,
|
||||||
|
1,
|
||||||
|
indices,
|
||||||
|
indexElementSize
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_DrawPrimitives(
|
static void VULKAN_DrawPrimitives(
|
||||||
REFRESH_Renderer *driverData,
|
REFRESH_Renderer *driverData,
|
||||||
|
REFRESH_GraphicsPipeline *graphicsPipeline,
|
||||||
REFRESH_PrimitiveType primitiveType,
|
REFRESH_PrimitiveType primitiveType,
|
||||||
uint32_t vertexStart,
|
uint32_t vertexStart,
|
||||||
uint32_t primitiveCount
|
uint32_t primitiveCount
|
||||||
) {
|
) {
|
||||||
SDL_assert(0);
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
|
VulkanGraphicsPipeline *pipeline = (VulkanGraphicsPipeline*) graphicsPipeline;
|
||||||
|
VkDescriptorSet descriptorSets[4];
|
||||||
|
uint32_t dynamicOffsets[2];
|
||||||
|
|
||||||
|
descriptorSets[0] = pipeline->vertexSamplerDescriptorSet;
|
||||||
|
descriptorSets[1] = pipeline->fragmentSamplerDescriptorSet;
|
||||||
|
descriptorSets[2] = renderer->vertexUBODescriptorSet;
|
||||||
|
descriptorSets[3] = renderer->fragmentUBODescriptorSet;
|
||||||
|
|
||||||
|
dynamicOffsets[0] = pipeline->vertexUBOOffset;
|
||||||
|
dynamicOffsets[1] = pipeline->fragmentUBOOffset;
|
||||||
|
|
||||||
|
RECORD_CMD(renderer->vkCmdBindDescriptorSets(
|
||||||
|
renderer->currentCommandBuffer,
|
||||||
|
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||||
|
pipeline->layout,
|
||||||
|
0,
|
||||||
|
4,
|
||||||
|
descriptorSets,
|
||||||
|
2,
|
||||||
|
dynamicOffsets
|
||||||
|
));
|
||||||
|
|
||||||
|
RECORD_CMD(renderer->vkCmdDraw(
|
||||||
|
renderer->currentCommandBuffer,
|
||||||
|
PrimitiveVerts(
|
||||||
|
primitiveType,
|
||||||
|
primitiveCount
|
||||||
|
),
|
||||||
|
1,
|
||||||
|
vertexStart,
|
||||||
|
0
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
static REFRESH_RenderPass* VULKAN_CreateRenderPass(
|
static REFRESH_RenderPass* VULKAN_CreateRenderPass(
|
||||||
|
@ -1938,7 +2025,7 @@ static REFRESH_RenderPass* VULKAN_CreateRenderPass(
|
||||||
return (REFRESH_RenderPass*) renderPass;
|
return (REFRESH_RenderPass*) renderPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t VULKAN_INTERNAL_CreateDescriptorPool(
|
static uint8_t VULKAN_INTERNAL_CreateSamplerDescriptorPool(
|
||||||
VulkanRenderer *renderer,
|
VulkanRenderer *renderer,
|
||||||
REFRESH_PipelineLayoutCreateInfo *pipelineLayoutCreateInfo,
|
REFRESH_PipelineLayoutCreateInfo *pipelineLayoutCreateInfo,
|
||||||
VkDescriptorPool *pDescriptorPool
|
VkDescriptorPool *pDescriptorPool
|
||||||
|
@ -2367,6 +2454,7 @@ static REFRESH_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
|
||||||
graphicsPipeline->fragmentSamplerLayout = setLayouts[1];
|
graphicsPipeline->fragmentSamplerLayout = setLayouts[1];
|
||||||
graphicsPipeline->vertexSamplerBindingCount = pipelineCreateInfo->pipelineLayoutCreateInfo.vertexSamplerBindingCount;
|
graphicsPipeline->vertexSamplerBindingCount = pipelineCreateInfo->pipelineLayoutCreateInfo.vertexSamplerBindingCount;
|
||||||
graphicsPipeline->fragmentSamplerBindingCount = pipelineCreateInfo->pipelineLayoutCreateInfo.fragmentSamplerBindingCount;
|
graphicsPipeline->fragmentSamplerBindingCount = pipelineCreateInfo->pipelineLayoutCreateInfo.fragmentSamplerBindingCount;
|
||||||
|
graphicsPipeline->layout = pipelineLayout;
|
||||||
|
|
||||||
/* Pipeline */
|
/* Pipeline */
|
||||||
|
|
||||||
|
@ -2422,7 +2510,7 @@ static REFRESH_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
|
||||||
SDL_stack_free(vertexSamplerLayoutBindings);
|
SDL_stack_free(vertexSamplerLayoutBindings);
|
||||||
SDL_stack_free(fragmentSamplerLayoutBindings);
|
SDL_stack_free(fragmentSamplerLayoutBindings);
|
||||||
|
|
||||||
if (!VULKAN_INTERNAL_CreateDescriptorPool(
|
if (!VULKAN_INTERNAL_CreateSamplerDescriptorPool(
|
||||||
renderer,
|
renderer,
|
||||||
&pipelineCreateInfo->pipelineLayoutCreateInfo,
|
&pipelineCreateInfo->pipelineLayoutCreateInfo,
|
||||||
&graphicsPipeline->descriptorPool
|
&graphicsPipeline->descriptorPool
|
||||||
|
@ -3686,6 +3774,8 @@ static void VULKAN_SetVertexSamplers(
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
graphicsPipeline->vertexSamplerDescriptorSet = descriptorSet;
|
||||||
|
|
||||||
SDL_stack_free(writeDescriptorSets);
|
SDL_stack_free(writeDescriptorSets);
|
||||||
SDL_stack_free(descriptorImageInfos);
|
SDL_stack_free(descriptorImageInfos);
|
||||||
}
|
}
|
||||||
|
@ -3751,6 +3841,8 @@ static void VULKAN_SetFragmentSamplers(
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
graphicsPipeline->fragmentSamplerDescriptorSet = descriptorSet;
|
||||||
|
|
||||||
SDL_stack_free(writeDescriptorSets);
|
SDL_stack_free(writeDescriptorSets);
|
||||||
SDL_stack_free(descriptorImageInfos);
|
SDL_stack_free(descriptorImageInfos);
|
||||||
}
|
}
|
||||||
|
@ -5003,6 +5095,12 @@ static REFRESH_Device* VULKAN_CreateDevice(
|
||||||
VkDescriptorSetLayoutBinding vertexParamLayoutBinding;
|
VkDescriptorSetLayoutBinding vertexParamLayoutBinding;
|
||||||
VkDescriptorSetLayoutBinding fragmentParamLayoutBinding;
|
VkDescriptorSetLayoutBinding fragmentParamLayoutBinding;
|
||||||
|
|
||||||
|
/* Variables: UBO Creation */
|
||||||
|
VkDescriptorPoolCreateInfo uboDescriptorPoolInfo;
|
||||||
|
VkDescriptorPoolSize uboPoolSize;
|
||||||
|
VkDescriptorSetAllocateInfo vertexUBODescriptorAllocateInfo;
|
||||||
|
VkDescriptorSetAllocateInfo fragmentUBODescriptorAllocateInfo;
|
||||||
|
|
||||||
result = (REFRESH_Device*) SDL_malloc(sizeof(REFRESH_Device));
|
result = (REFRESH_Device*) SDL_malloc(sizeof(REFRESH_Device));
|
||||||
ASSIGN_DRIVER(VULKAN)
|
ASSIGN_DRIVER(VULKAN)
|
||||||
|
|
||||||
|
@ -5253,6 +5351,51 @@ static REFRESH_Device* VULKAN_CreateDevice(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* UBO Descriptors */
|
||||||
|
|
||||||
|
uboPoolSize.descriptorCount = 2;
|
||||||
|
uboPoolSize.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
|
||||||
|
|
||||||
|
uboDescriptorPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||||
|
uboDescriptorPoolInfo.pNext = NULL;
|
||||||
|
uboDescriptorPoolInfo.flags = 0;
|
||||||
|
uboDescriptorPoolInfo.maxSets = 2;
|
||||||
|
uboDescriptorPoolInfo.poolSizeCount = 1;
|
||||||
|
uboDescriptorPoolInfo.pPoolSizes = &uboPoolSize;
|
||||||
|
|
||||||
|
renderer->vkCreateDescriptorPool(
|
||||||
|
renderer->logicalDevice,
|
||||||
|
&uboDescriptorPoolInfo,
|
||||||
|
NULL,
|
||||||
|
&renderer->UBODescriptorPool
|
||||||
|
);
|
||||||
|
|
||||||
|
vertexUBODescriptorAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
||||||
|
vertexUBODescriptorAllocateInfo.pNext = NULL;
|
||||||
|
vertexUBODescriptorAllocateInfo.descriptorPool = renderer->UBODescriptorPool;
|
||||||
|
vertexUBODescriptorAllocateInfo.descriptorSetCount = 1;
|
||||||
|
vertexUBODescriptorAllocateInfo.pSetLayouts = &renderer->vertexParamLayout;
|
||||||
|
|
||||||
|
renderer->vkAllocateDescriptorSets(
|
||||||
|
renderer->logicalDevice,
|
||||||
|
&vertexUBODescriptorAllocateInfo,
|
||||||
|
&renderer->vertexUBODescriptorSet
|
||||||
|
);
|
||||||
|
|
||||||
|
fragmentUBODescriptorAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
||||||
|
fragmentUBODescriptorAllocateInfo.pNext = NULL;
|
||||||
|
fragmentUBODescriptorAllocateInfo.descriptorPool = renderer->UBODescriptorPool;
|
||||||
|
fragmentUBODescriptorAllocateInfo.descriptorSetCount = 1;
|
||||||
|
fragmentUBODescriptorAllocateInfo.pSetLayouts = &renderer->fragmentParamLayout;
|
||||||
|
|
||||||
|
renderer->vkAllocateDescriptorSets(
|
||||||
|
renderer->logicalDevice,
|
||||||
|
&fragmentUBODescriptorAllocateInfo,
|
||||||
|
&renderer->fragmentUBODescriptorSet
|
||||||
|
);
|
||||||
|
|
||||||
|
/* UBO Data */
|
||||||
|
|
||||||
renderer->vertexUBO = (VulkanBuffer*) SDL_malloc(sizeof(VulkanBuffer));
|
renderer->vertexUBO = (VulkanBuffer*) SDL_malloc(sizeof(VulkanBuffer));
|
||||||
|
|
||||||
if (!VULKAN_INTERNAL_CreateBuffer(
|
if (!VULKAN_INTERNAL_CreateBuffer(
|
||||||
|
|
Loading…
Reference in New Issue