diff --git a/assets/shaders/default.vert b/assets/shaders/default.vert index ef1f5542..ae7d038b 100644 --- a/assets/shaders/default.vert +++ b/assets/shaders/default.vert @@ -52,15 +52,8 @@ main(void) vs_out.fDiffSampl = int(curInstanceData.texSamples.x); vs_out.fExtraSampl = int(curInstanceData.texSamples.y); - mat4 scaleMat = mat4( - vec4(1.1f, 0.0f, 0.0f, 0.0f), - vec4(0.0f, 1.1f, 0.0f, 0.0f), - vec4(0.0f, 0.0f, 1.0f, 0.0f), - vec4(0.0f, 0.0f, 0.0f, 1.0f) - ); - mat4 modelMat = curInstanceData.modelMat; - vec3 position = pushConstants.selectedIdx != drawID ? a_position : vec3(scaleMat * vec4(a_position.xyz, 1.0f)); + vec3 position = a_position; gl_Position = ubo.u_projectionMat * ubo.u_viewMat * modelMat * vec4(position.xyz, 1.0f); } diff --git a/assets/shaders/vert.spv b/assets/shaders/vert.spv index 9c0d4472..88d3ad91 100644 Binary files a/assets/shaders/vert.spv and b/assets/shaders/vert.spv differ diff --git a/engine/renderer/helpers.hpp b/engine/renderer/helpers.hpp index ee0a5f49..e8b4bdb1 100644 --- a/engine/renderer/helpers.hpp +++ b/engine/renderer/helpers.hpp @@ -237,7 +237,8 @@ IsDeviceSuitable(VkPhysicalDevice device, VkSurfaceKHR surface) auto isDiscrete = physicalDeviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU; return extensionsSupported && swapChainAdequate && isDiscrete - && supportedFeatures.samplerAnisotropy && supportedFeatures.multiDrawIndirect; + && supportedFeatures.samplerAnisotropy && supportedFeatures.multiDrawIndirect + && supportedFeatures.wideLines; } inline VkSampleCountFlagBits diff --git a/engine/renderer/renderer.cpp b/engine/renderer/renderer.cpp index 7e2df37b..d48e08f5 100644 --- a/engine/renderer/renderer.cpp +++ b/engine/renderer/renderer.cpp @@ -178,10 +178,20 @@ CreatePipeline(std::string_view vertexShader, std::string_view fragmentShader, P vkCreatePipelineLayout(Data::vk_device, &pipelineLayoutInfo, nullptr, &pipeLineLayout), "failed to create pipeline layout!"); + std::vector< VkDynamicState > dynamicStateEnables = {VK_DYNAMIC_STATE_LINE_WIDTH}; + + VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo{}; + pipelineDynamicStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; + pipelineDynamicStateCreateInfo.pDynamicStates = dynamicStateEnables.data(); + pipelineDynamicStateCreateInfo.dynamicStateCount = + static_cast< uint32_t >(dynamicStateEnables.size()); + pipelineDynamicStateCreateInfo.flags = 0; + VkGraphicsPipelineCreateInfo pipelineInfo{}; pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipelineInfo.stageCount = 2; pipelineInfo.pStages = shaderStages.data(); + pipelineInfo.pDynamicState = &pipelineDynamicStateCreateInfo; pipelineInfo.pVertexInputState = &vertexInputInfo; pipelineInfo.pInputAssemblyState = &inputAssembly; pipelineInfo.pViewportState = &viewportState; @@ -386,6 +396,7 @@ CreateDevice() VkPhysicalDeviceFeatures deviceFeatures = {}; deviceFeatures.samplerAnisotropy = VK_TRUE; deviceFeatures.multiDrawIndirect = VK_TRUE; + deviceFeatures.wideLines = VK_TRUE; VkDeviceCreateInfo createInfo = {}; createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; @@ -684,6 +695,7 @@ CreateCommandBuffers(Application* app, uint32_t imageIndex) vk_check_error(vkBeginCommandBuffer(Data::commandBuffers[Data::currentFrame_], &beginInfo), ""); + vkCmdSetLineWidth(Data::commandBuffers[Data::currentFrame_], 2.0f); vkCmdBeginRenderPass(Data::commandBuffers[Data::currentFrame_], &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);