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 */ /* Pipeline state structures */
typedef struct Refresh_ShaderStageState typedef struct Refresh_GraphicsShaderInfo
{ {
Refresh_ShaderModule *shaderModule; Refresh_ShaderModule *shaderModule;
const char* entryPointName; const char* entryPointName;
uint64_t uniformBufferSize; uint64_t uniformBufferSize;
uint32_t samplerBindingCount; 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 typedef struct Refresh_ViewportState
{ {
@ -508,12 +517,6 @@ typedef struct Refresh_DepthStencilState
float maxDepthBounds; float maxDepthBounds;
} Refresh_DepthStencilState; } Refresh_DepthStencilState;
typedef struct Refresh_ComputePipelineCreateInfo
{
Refresh_ShaderStageState computeShaderState;
Refresh_ComputePipelineLayoutCreateInfo pipelineLayoutCreateInfo;
} Refresh_ComputePipelineCreateInfo;
typedef struct Refresh_ColorAttachmentDescription typedef struct Refresh_ColorAttachmentDescription
{ {
Refresh_TextureFormat format; Refresh_TextureFormat format;
@ -531,8 +534,8 @@ typedef struct Refresh_GraphicsPipelineAttachmentInfo
typedef struct Refresh_GraphicsPipelineCreateInfo typedef struct Refresh_GraphicsPipelineCreateInfo
{ {
Refresh_ShaderStageState vertexShaderState; Refresh_GraphicsShaderInfo vertexShaderInfo;
Refresh_ShaderStageState fragmentShaderState; Refresh_GraphicsShaderInfo fragmentShaderInfo;
Refresh_VertexInputState vertexInputState; Refresh_VertexInputState vertexInputState;
Refresh_PrimitiveType primitiveType; Refresh_PrimitiveType primitiveType;
Refresh_ViewportState viewportState; Refresh_ViewportState viewportState;
@ -771,7 +774,7 @@ REFRESHAPI void Refresh_DispatchCompute(
/* Returns an allocated ComputePipeline* object. */ /* Returns an allocated ComputePipeline* object. */
REFRESHAPI Refresh_ComputePipeline* Refresh_CreateComputePipeline( REFRESHAPI Refresh_ComputePipeline* Refresh_CreateComputePipeline(
Refresh_Device *device, Refresh_Device *device,
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo Refresh_ComputeShaderInfo *computeShaderInfo
); );
/* Returns an allocated GraphicsPipeline* object. */ /* 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 * Copyright (c) 2020 Evan Hemsley
* *
@ -252,12 +252,12 @@ void Refresh_DispatchCompute(
Refresh_ComputePipeline* Refresh_CreateComputePipeline( Refresh_ComputePipeline* Refresh_CreateComputePipeline(
Refresh_Device *device, Refresh_Device *device,
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo Refresh_ComputeShaderInfo *computeShaderInfo
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateComputePipeline( return device->CreateComputePipeline(
device->driverData, 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 * Copyright (c) 2020 Evan Hemsley
* *
@ -221,7 +221,7 @@ struct Refresh_Device
Refresh_ComputePipeline* (*CreateComputePipeline)( Refresh_ComputePipeline* (*CreateComputePipeline)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo Refresh_ComputeShaderInfo *computeShaderInfo
); );
Refresh_GraphicsPipeline* (*CreateGraphicsPipeline)( Refresh_GraphicsPipeline* (*CreateGraphicsPipeline)(

View File

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