mirror of
https://gitea.windcorp.ru/Wind-Corporation/Progressia.git
synced 2025-04-21 23:20:45 +03:00
TMP / Fixed vulkan_{pick_device,pipeline}.cpp
This commit is contained in:
parent
54f73b2e44
commit
7c5f0406d0
@ -13,7 +13,7 @@ bool checkDeviceExtensions(VkPhysicalDevice device,
|
|||||||
CstrUtils::CstrHashSet toFind(deviceExtensions.cbegin(),
|
CstrUtils::CstrHashSet toFind(deviceExtensions.cbegin(),
|
||||||
deviceExtensions.cend());
|
deviceExtensions.cend());
|
||||||
|
|
||||||
uint32_t extensionCount;
|
uint32_t extensionCount = 0;
|
||||||
vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount,
|
vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
|
|
||||||
namespace progressia::desktop {
|
namespace progressia::desktop {
|
||||||
|
|
||||||
Pipeline::Pipeline(Vulkan &vulkan) : vulkan(vulkan) {
|
Pipeline::Pipeline(Vulkan &vulkan) : layout(), vk(), vulkan(vulkan) {
|
||||||
|
|
||||||
auto &adapter = vulkan.getAdapter();
|
auto &adapter = vulkan.getAdapter();
|
||||||
|
|
||||||
// Shaders
|
// Shaders
|
||||||
|
|
||||||
auto vertShader = createShaderModule(adapter.loadVertexShader());
|
auto *vertShader = createShaderModule(adapter.loadVertexShader());
|
||||||
auto fragShader = createShaderModule(adapter.loadFragmentShader());
|
auto *fragShader = createShaderModule(adapter.loadFragmentShader());
|
||||||
|
|
||||||
VkPipelineShaderStageCreateInfo vertShaderStageInfo{};
|
VkPipelineShaderStageCreateInfo vertShaderStageInfo{};
|
||||||
vertShaderStageInfo.sType =
|
vertShaderStageInfo.sType =
|
||||||
@ -80,13 +80,13 @@ Pipeline::Pipeline(Vulkan &vulkan) : vulkan(vulkan) {
|
|||||||
rasterizer.depthClampEnable = VK_FALSE;
|
rasterizer.depthClampEnable = VK_FALSE;
|
||||||
rasterizer.rasterizerDiscardEnable = VK_FALSE;
|
rasterizer.rasterizerDiscardEnable = VK_FALSE;
|
||||||
rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
|
rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
|
||||||
rasterizer.lineWidth = 1.0f;
|
rasterizer.lineWidth = 1.0F;
|
||||||
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
|
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||||
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||||
rasterizer.depthBiasEnable = VK_FALSE;
|
rasterizer.depthBiasEnable = VK_FALSE;
|
||||||
rasterizer.depthBiasConstantFactor = 0.0f; // Optional
|
rasterizer.depthBiasConstantFactor = 0.0F; // Optional
|
||||||
rasterizer.depthBiasClamp = 0.0f; // Optional
|
rasterizer.depthBiasClamp = 0.0F; // Optional
|
||||||
rasterizer.depthBiasSlopeFactor = 0.0f; // Optional
|
rasterizer.depthBiasSlopeFactor = 0.0F; // Optional
|
||||||
|
|
||||||
// Multisampling (disabled)
|
// Multisampling (disabled)
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ Pipeline::Pipeline(Vulkan &vulkan) : vulkan(vulkan) {
|
|||||||
VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
||||||
multisampling.sampleShadingEnable = VK_FALSE;
|
multisampling.sampleShadingEnable = VK_FALSE;
|
||||||
multisampling.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
|
multisampling.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
multisampling.minSampleShading = 1.0f; // Optional
|
multisampling.minSampleShading = 1.0F; // Optional
|
||||||
multisampling.pSampleMask = nullptr; // Optional
|
multisampling.pSampleMask = nullptr; // Optional
|
||||||
multisampling.alphaToCoverageEnable = VK_FALSE; // Optional
|
multisampling.alphaToCoverageEnable = VK_FALSE; // Optional
|
||||||
multisampling.alphaToOneEnable = VK_FALSE; // Optional
|
multisampling.alphaToOneEnable = VK_FALSE; // Optional
|
||||||
@ -137,10 +137,10 @@ Pipeline::Pipeline(Vulkan &vulkan) : vulkan(vulkan) {
|
|||||||
colorBlending.logicOp = VK_LOGIC_OP_COPY; // Optional
|
colorBlending.logicOp = VK_LOGIC_OP_COPY; // Optional
|
||||||
colorBlending.attachmentCount = 1;
|
colorBlending.attachmentCount = 1;
|
||||||
colorBlending.pAttachments = &colorBlendAttachment;
|
colorBlending.pAttachments = &colorBlendAttachment;
|
||||||
colorBlending.blendConstants[0] = 0.0f; // Optional
|
colorBlending.blendConstants[0] = 0.0F; // Optional
|
||||||
colorBlending.blendConstants[1] = 0.0f; // Optional
|
colorBlending.blendConstants[1] = 0.0F; // Optional
|
||||||
colorBlending.blendConstants[2] = 0.0f; // Optional
|
colorBlending.blendConstants[2] = 0.0F; // Optional
|
||||||
colorBlending.blendConstants[3] = 0.0f; // Optional
|
colorBlending.blendConstants[3] = 0.0F; // Optional
|
||||||
|
|
||||||
// Pipeline
|
// Pipeline
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ VkShaderModule Pipeline::createShaderModule(const std::vector<char> &bytecode) {
|
|||||||
// Important - the buffer must be aligned properly. std::vector does that.
|
// Important - the buffer must be aligned properly. std::vector does that.
|
||||||
createInfo.pCode = reinterpret_cast<const uint32_t *>(bytecode.data());
|
createInfo.pCode = reinterpret_cast<const uint32_t *>(bytecode.data());
|
||||||
|
|
||||||
VkShaderModule shaderModule;
|
VkShaderModule shaderModule = nullptr;
|
||||||
vulkan.handleVkResult("Could not load shader",
|
vulkan.handleVkResult("Could not load shader",
|
||||||
vkCreateShaderModule(vulkan.getDevice(), &createInfo,
|
vkCreateShaderModule(vulkan.getDevice(), &createInfo,
|
||||||
nullptr, &shaderModule));
|
nullptr, &shaderModule));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user