separate shader types
continuous-integration/drone/push Build is passing Details

pull/18/head
cosmonaut 2022-03-02 11:22:52 -08:00
parent 61e83cfba8
commit 057a48e96f
4 changed files with 33 additions and 30 deletions

View File

@ -460,13 +460,22 @@ typedef struct Refresh_TextureCreateInfo
/* Pipeline state structures */
typedef struct Refresh_ShaderStageState
typedef struct Refresh_GraphicsShaderInfo
{
Refresh_ShaderModule *shaderModule;
const char* entryPointName;
uint64_t uniformBufferSize;
uint32_t samplerBindingCount;
} Refresh_ShaderStageState;
} Refresh_GraphicsShaderInfo;
typedef struct Refresh_ComputeShaderInfo
{
Refresh_ShaderModule* shaderModule;
const char* entryPointName;
uint64_t uniformBufferSize;
uint32_t bufferBindingCount;
uint32_t imageBindingCount;
} Refresh_ComputeShaderInfo;
typedef struct Refresh_ViewportState
{
@ -508,12 +517,6 @@ typedef struct Refresh_DepthStencilState
float maxDepthBounds;
} Refresh_DepthStencilState;
typedef struct Refresh_ComputePipelineCreateInfo
{
Refresh_ShaderStageState computeShaderState;
Refresh_ComputePipelineLayoutCreateInfo pipelineLayoutCreateInfo;
} Refresh_ComputePipelineCreateInfo;
typedef struct Refresh_ColorAttachmentDescription
{
Refresh_TextureFormat format;
@ -531,8 +534,8 @@ typedef struct Refresh_GraphicsPipelineAttachmentInfo
typedef struct Refresh_GraphicsPipelineCreateInfo
{
Refresh_ShaderStageState vertexShaderState;
Refresh_ShaderStageState fragmentShaderState;
Refresh_GraphicsShaderInfo vertexShaderInfo;
Refresh_GraphicsShaderInfo fragmentShaderInfo;
Refresh_VertexInputState vertexInputState;
Refresh_PrimitiveType primitiveType;
Refresh_ViewportState viewportState;
@ -771,7 +774,7 @@ REFRESHAPI void Refresh_DispatchCompute(
/* Returns an allocated ComputePipeline* object. */
REFRESHAPI Refresh_ComputePipeline* Refresh_CreateComputePipeline(
Refresh_Device *device,
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
Refresh_ComputeShaderInfo *computeShaderInfo
);
/* Returns an allocated GraphicsPipeline* object. */

View File

@ -1,4 +1,4 @@
/* Refresh - XNA-inspired 3D Graphics Library with modern capabilities
/* Refresh - XNA-inspired 3D Graphics Library with modern capabilities
*
* Copyright (c) 2020 Evan Hemsley
*
@ -252,12 +252,12 @@ void Refresh_DispatchCompute(
Refresh_ComputePipeline* Refresh_CreateComputePipeline(
Refresh_Device *device,
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
Refresh_ComputeShaderInfo *computeShaderInfo
) {
NULL_RETURN_NULL(device);
return device->CreateComputePipeline(
device->driverData,
pipelineCreateInfo
computeShaderInfo
);
}

View File

@ -1,4 +1,4 @@
/* Refresh - XNA-inspired 3D Graphics Library with modern capabilities
/* Refresh - XNA-inspired 3D Graphics Library with modern capabilities
*
* Copyright (c) 2020 Evan Hemsley
*
@ -221,7 +221,7 @@ struct Refresh_Device
Refresh_ComputePipeline* (*CreateComputePipeline)(
Refresh_Renderer *driverData,
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
Refresh_ComputeShaderInfo *computeShaderInfo
);
Refresh_GraphicsPipeline* (*CreateGraphicsPipeline)(

View File

@ -5664,13 +5664,13 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
shaderStageCreateInfos[0].pNext = NULL;
shaderStageCreateInfos[0].flags = 0;
shaderStageCreateInfos[0].stage = VK_SHADER_STAGE_VERTEX_BIT;
shaderStageCreateInfos[0].module = (VkShaderModule) pipelineCreateInfo->vertexShaderState.shaderModule;
shaderStageCreateInfos[0].pName = pipelineCreateInfo->vertexShaderState.entryPointName;
shaderStageCreateInfos[0].module = (VkShaderModule) pipelineCreateInfo->vertexShaderInfo.shaderModule;
shaderStageCreateInfos[0].pName = pipelineCreateInfo->vertexShaderInfo.entryPointName;
shaderStageCreateInfos[0].pSpecializationInfo = NULL;
graphicsPipeline->vertexUniformBlockSize =
VULKAN_INTERNAL_NextHighestAlignment(
pipelineCreateInfo->vertexShaderState.uniformBufferSize,
pipelineCreateInfo->vertexShaderInfo.uniformBufferSize,
renderer->minUBOAlignment
);
@ -5678,13 +5678,13 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
shaderStageCreateInfos[1].pNext = NULL;
shaderStageCreateInfos[1].flags = 0;
shaderStageCreateInfos[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shaderStageCreateInfos[1].module = (VkShaderModule) pipelineCreateInfo->fragmentShaderState.shaderModule;
shaderStageCreateInfos[1].pName = pipelineCreateInfo->fragmentShaderState.entryPointName;
shaderStageCreateInfos[1].module = (VkShaderModule) pipelineCreateInfo->fragmentShaderInfo.shaderModule;
shaderStageCreateInfos[1].pName = pipelineCreateInfo->fragmentShaderInfo.entryPointName;
shaderStageCreateInfos[1].pSpecializationInfo = NULL;
graphicsPipeline->fragmentUniformBlockSize =
VULKAN_INTERNAL_NextHighestAlignment(
pipelineCreateInfo->fragmentShaderState.uniformBufferSize,
pipelineCreateInfo->fragmentShaderInfo.uniformBufferSize,
renderer->minUBOAlignment
);
@ -5915,8 +5915,8 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
graphicsPipeline->pipelineLayout = VULKAN_INTERNAL_FetchGraphicsPipelineLayout(
renderer,
pipelineCreateInfo->vertexShaderState.samplerBindingCount,
pipelineCreateInfo->fragmentShaderState.samplerBindingCount
pipelineCreateInfo->vertexShaderInfo.samplerBindingCount,
pipelineCreateInfo->fragmentShaderInfo.samplerBindingCount
);
/* Pipeline */
@ -6083,7 +6083,7 @@ static VulkanComputePipelineLayout* VULKAN_INTERNAL_FetchComputePipelineLayout(
static Refresh_ComputePipeline* VULKAN_CreateComputePipeline(
Refresh_Renderer *driverData,
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
Refresh_ComputeShaderInfo *computeShaderInfo
) {
VkComputePipelineCreateInfo computePipelineCreateInfo;
VkPipelineShaderStageCreateInfo pipelineShaderStageCreateInfo;
@ -6095,14 +6095,14 @@ static Refresh_ComputePipeline* VULKAN_CreateComputePipeline(
pipelineShaderStageCreateInfo.pNext = NULL;
pipelineShaderStageCreateInfo.flags = 0;
pipelineShaderStageCreateInfo.stage = VK_SHADER_STAGE_COMPUTE_BIT;
pipelineShaderStageCreateInfo.module = (VkShaderModule) pipelineCreateInfo->computeShaderState.shaderModule;
pipelineShaderStageCreateInfo.pName = pipelineCreateInfo->computeShaderState.entryPointName;
pipelineShaderStageCreateInfo.module = (VkShaderModule)computeShaderInfo->shaderModule;
pipelineShaderStageCreateInfo.pName = computeShaderInfo->entryPointName;
pipelineShaderStageCreateInfo.pSpecializationInfo = NULL;
vulkanComputePipeline->pipelineLayout = VULKAN_INTERNAL_FetchComputePipelineLayout(
renderer,
pipelineCreateInfo->pipelineLayoutCreateInfo.bufferBindingCount,
pipelineCreateInfo->pipelineLayoutCreateInfo.imageBindingCount
computeShaderInfo->bufferBindingCount,
computeShaderInfo->imageBindingCount
);
computePipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
@ -6125,7 +6125,7 @@ static Refresh_ComputePipeline* VULKAN_CreateComputePipeline(
vulkanComputePipeline->uniformBlockSize =
VULKAN_INTERNAL_NextHighestAlignment(
pipelineCreateInfo->computeShaderState.uniformBufferSize,
computeShaderInfo->uniformBufferSize,
renderer->minUBOAlignment
);