mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 07:24:34 +00:00
Add a ShaderInfo class to simplify adding shaders
This commit is contained in:
parent
a8248e829b
commit
b688ff4456
@ -2240,7 +2240,7 @@ GraphicsPipelineBuilder& GraphicsPipelineBuilder::set_vertex_shader_module(VkSha
|
|||||||
info.vertex_shader.shader_module = shader_module;
|
info.vertex_shader.shader_module = shader_module;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
GraphicsPipelineBuilder& GraphicsPipelineBuilder::set_vertex_shader_name(const char* name) {
|
GraphicsPipelineBuilder& GraphicsPipelineBuilder::set_vertex_shader_entrypoint_name(const char* name) {
|
||||||
info.vertex_shader.name = name;
|
info.vertex_shader.name = name;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ class GraphicsPipelineBuilder {
|
|||||||
GraphicsPipelineBuilder& clear_vertex_shader_pNext();
|
GraphicsPipelineBuilder& clear_vertex_shader_pNext();
|
||||||
GraphicsPipelineBuilder& set_vertex_shader_flags(VkPipelineShaderStageCreateFlags flags);
|
GraphicsPipelineBuilder& set_vertex_shader_flags(VkPipelineShaderStageCreateFlags flags);
|
||||||
GraphicsPipelineBuilder& set_vertex_shader_module(VkShaderModule shader_module);
|
GraphicsPipelineBuilder& set_vertex_shader_module(VkShaderModule shader_module);
|
||||||
GraphicsPipelineBuilder& set_vertex_shader_name(const char* name);
|
GraphicsPipelineBuilder& set_vertex_shader_entrypoint_name(const char* name);
|
||||||
GraphicsPipelineBuilder& set_vertex_shader_specialization_info(VkSpecializationInfo& specialization_info);
|
GraphicsPipelineBuilder& set_vertex_shader_specialization_info(VkSpecializationInfo& specialization_info);
|
||||||
GraphicsPipelineBuilder& clear_vertex_shader();
|
GraphicsPipelineBuilder& clear_vertex_shader();
|
||||||
|
|
||||||
@ -253,6 +253,14 @@ class GraphicsPipelineBuilder {
|
|||||||
GraphicsPipelineBuilder& set_allocation_callbacks(VkAllocationCallbacks* callbacks);
|
GraphicsPipelineBuilder& set_allocation_callbacks(VkAllocationCallbacks* callbacks);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct ShaderInfo {
|
||||||
|
VkPipelineShaderStageCreateFlags flags = 0;
|
||||||
|
std::vector<VkBaseOutStructure*> pNext_chain;
|
||||||
|
VkShaderModule shader_module = VK_NULL_HANDLE;
|
||||||
|
const char* name = "main"; // assumed default is "main"
|
||||||
|
VkSpecializationInfo specialization_info = {};
|
||||||
|
};
|
||||||
|
|
||||||
struct GraphicsPipelineInfo {
|
struct GraphicsPipelineInfo {
|
||||||
VkDevice device = VK_NULL_HANDLE;
|
VkDevice device = VK_NULL_HANDLE;
|
||||||
VkPipelineCache pipeline_cache = VK_NULL_HANDLE;
|
VkPipelineCache pipeline_cache = VK_NULL_HANDLE;
|
||||||
@ -278,43 +286,17 @@ class GraphicsPipelineBuilder {
|
|||||||
VkBool32 primitiveRestartEnable = VK_FALSE;
|
VkBool32 primitiveRestartEnable = VK_FALSE;
|
||||||
} input_assembly;
|
} input_assembly;
|
||||||
|
|
||||||
// Vertex shader state
|
ShaderInfo vertex_shader;
|
||||||
struct VertexShader {
|
ShaderInfo fragment_shader;
|
||||||
VkPipelineShaderStageCreateFlags flags = 0;
|
ShaderInfo tessellation_control_shader;
|
||||||
std::vector<VkBaseOutStructure*> pNext_chain;
|
ShaderInfo tessellation_eval_shader;
|
||||||
VkShaderModule shader_module = VK_NULL_HANDLE;
|
ShaderInfo geometry_shader;
|
||||||
const char* name = "";
|
|
||||||
VkSpecializationInfo specialization_info = {};
|
|
||||||
} vertex_shader;
|
|
||||||
|
|
||||||
struct TessellationControlShader { // Tessellation shader stage
|
|
||||||
VkPipelineShaderStageCreateFlags flags = 0;
|
|
||||||
std::vector<VkBaseOutStructure*> pNext_chain;
|
|
||||||
VkShaderModule shader_module = VK_NULL_HANDLE;
|
|
||||||
const char* name = "";
|
|
||||||
VkSpecializationInfo specialization_info = {};
|
|
||||||
} tessellation_control_shader;
|
|
||||||
|
|
||||||
struct TessellationEvaluationShader { // Tessellation shader stage
|
|
||||||
VkPipelineShaderStageCreateFlags flags = 0;
|
|
||||||
std::vector<VkBaseOutStructure*> pNext_chain;
|
|
||||||
VkShaderModule shader_module = VK_NULL_HANDLE;
|
|
||||||
const char* name = "";
|
|
||||||
VkSpecializationInfo specialization_info = {};
|
|
||||||
} tessellation_eval_shader;
|
|
||||||
|
|
||||||
struct TessellationState {
|
struct TessellationState {
|
||||||
std::vector<VkBaseOutStructure*> pNext_chain;
|
std::vector<VkBaseOutStructure*> pNext_chain;
|
||||||
uint32_t patch_control_points;
|
uint32_t patch_control_points;
|
||||||
} tessellation_state;
|
} tessellation_state;
|
||||||
|
|
||||||
struct GeometryShader {
|
|
||||||
VkPipelineShaderStageCreateFlags flags = 0;
|
|
||||||
std::vector<VkBaseOutStructure*> pNext_chain;
|
|
||||||
VkShaderModule shader_module = VK_NULL_HANDLE;
|
|
||||||
const char* name = "";
|
|
||||||
VkSpecializationInfo specialization_info = {};
|
|
||||||
} geometry_shader;
|
|
||||||
|
|
||||||
struct ViewportState { // Viewport state
|
struct ViewportState { // Viewport state
|
||||||
std::vector<VkBaseOutStructure*> pNext_chain;
|
std::vector<VkBaseOutStructure*> pNext_chain;
|
||||||
@ -322,13 +304,6 @@ class GraphicsPipelineBuilder {
|
|||||||
std::vector<VkRect2D> scissors;
|
std::vector<VkRect2D> scissors;
|
||||||
} viewport_state;
|
} viewport_state;
|
||||||
|
|
||||||
struct FragmentShader {
|
|
||||||
VkPipelineShaderStageCreateFlags flags = 0;
|
|
||||||
std::vector<VkBaseOutStructure*> pNext_chain;
|
|
||||||
VkShaderModule shader_module = VK_NULL_HANDLE;
|
|
||||||
const char* name = "";
|
|
||||||
VkSpecializationInfo specialization_info = {};
|
|
||||||
} fragment_shader;
|
|
||||||
|
|
||||||
struct RasterizationState { // Rasterization state
|
struct RasterizationState { // Rasterization state
|
||||||
std::vector<VkBaseOutStructure*> pNext_chain;
|
std::vector<VkBaseOutStructure*> pNext_chain;
|
||||||
@ -377,9 +352,8 @@ class GraphicsPipelineBuilder {
|
|||||||
float blend_constants[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
float blend_constants[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||||
} color_blend_state;
|
} color_blend_state;
|
||||||
|
|
||||||
struct DynamicState {
|
std::vector<VkDynamicState> dynamic_states;
|
||||||
std::vector<VkDynamicState> dynamic_states;
|
|
||||||
} dynamic_state;
|
|
||||||
|
|
||||||
} info;
|
} info;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user