move ellipse component type to specialization

This commit is contained in:
jacekpoz 2024-08-08 22:16:24 +02:00
parent e420ab1ef7
commit e86f4cdd45
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
2 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,6 @@
#version 450 #version 450
int PTK_COMPONENT_TYPE_ELLIPSE = 3; layout(constant_id = 0) const int PTK_COMPONENT_TYPE_ELLIPSE = 0;
layout(location = 0) in vec3 fragColor; layout(location = 0) in vec3 fragColor;
layout(location = 1) flat in int shapeType; layout(location = 1) flat in int shapeType;

View file

@ -756,6 +756,17 @@ bool create_graphics_pipeline(void) {
return false; return false;
} }
VkSpecializationInfo spec_info = {
.mapEntryCount = 1,
.pMapEntries = &(VkSpecializationMapEntry){
.constantID = 0,
.offset = 0,
.size = sizeof(int),
},
.dataSize = sizeof(int),
.pData = &(int){PTK_COMPONENT_TYPE_ELLIPSE},
};
VkPipelineShaderStageCreateInfo shader_stages[] = { VkPipelineShaderStageCreateInfo shader_stages[] = {
(VkPipelineShaderStageCreateInfo){ (VkPipelineShaderStageCreateInfo){
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
@ -773,7 +784,7 @@ bool create_graphics_pipeline(void) {
.stage = VK_SHADER_STAGE_FRAGMENT_BIT, .stage = VK_SHADER_STAGE_FRAGMENT_BIT,
.module = frag_shader_module.value, .module = frag_shader_module.value,
.pName = "main", .pName = "main",
.pSpecializationInfo = NULL, .pSpecializationInfo = &spec_info,
}, },
}; };