diff --git a/shaders/shader.frag.glsl b/shaders/shader.frag.glsl index 7314dba..b53836c 100644 --- a/shaders/shader.frag.glsl +++ b/shaders/shader.frag.glsl @@ -1,6 +1,6 @@ #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 = 1) flat in int shapeType; diff --git a/src/ptk_vk/init.c b/src/ptk_vk/init.c index b484932..b645d9e 100644 --- a/src/ptk_vk/init.c +++ b/src/ptk_vk/init.c @@ -756,6 +756,17 @@ bool create_graphics_pipeline(void) { 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){ .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, @@ -773,7 +784,7 @@ bool create_graphics_pipeline(void) { .stage = VK_SHADER_STAGE_FRAGMENT_BIT, .module = frag_shader_module.value, .pName = "main", - .pSpecializationInfo = NULL, + .pSpecializationInfo = &spec_info, }, };