Tiny optimization in PipelineDesc

This commit is contained in:
Henrik Rydgård 2022-12-13 15:16:11 +01:00
parent 841dc1366e
commit 73cd9fac7d
5 changed files with 10 additions and 9 deletions

View file

@ -86,12 +86,15 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR
ms.minSampleShading = 1.0f;
}
VkPipelineInputAssemblyStateCreateInfo inputAssembly{ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO };
inputAssembly.topology = desc->topology;
// We will use dynamic viewport state.
pipe.pVertexInputState = &desc->vis;
pipe.pViewportState = &desc->views;
pipe.pTessellationState = nullptr;
pipe.pDynamicState = &desc->ds;
pipe.pInputAssemblyState = &desc->inputAssembly;
pipe.pInputAssemblyState = &inputAssembly;
pipe.pMultisampleState = &ms;
pipe.layout = desc->pipelineLayout;
pipe.basePipelineHandle = VK_NULL_HANDLE;

View file

@ -75,6 +75,7 @@ struct BoundingRect {
};
// All the data needed to create a graphics pipeline.
// TODO: Compress this down greatly.
struct VKRGraphicsPipelineDesc : Draw::RefCountedObject {
VkPipelineCache pipelineCache = VK_NULL_HANDLE;
VkPipelineColorBlendStateCreateInfo cbs{ VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO };
@ -95,7 +96,7 @@ struct VKRGraphicsPipelineDesc : Draw::RefCountedObject {
std::string fragmentShaderSource;
std::string geometryShaderSource;
VkPipelineInputAssemblyStateCreateInfo inputAssembly{ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO };
VkPrimitiveTopology topology;
VkVertexInputAttributeDescription attrs[8]{};
VkVertexInputBindingDescription ibd{};
VkPipelineVertexInputStateCreateInfo vis{ VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO };

View file

@ -1216,7 +1216,7 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char
raster->ToVulkan(&gDesc.rs);
// Copy bindings from input layout.
gDesc.inputAssembly.topology = primToVK[(int)desc.prim];
gDesc.topology = primToVK[(int)desc.prim];
// We treat the three stencil states as a unit in other places, so let's do that here too.
const VkDynamicState dynamics[] = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK, VK_DYNAMIC_STATE_STENCIL_REFERENCE, VK_DYNAMIC_STATE_STENCIL_WRITE_MASK };

View file

@ -121,7 +121,7 @@ void GPU_Vulkan::CancelReady() {
void GPU_Vulkan::LoadCache(const Path &filename) {
if (!g_Config.bShaderCache) {
INFO_LOG(G3D, "Shader cache disabled. Not loading.");
WARN_LOG(G3D, "!!!! Shader cache disabled. Not loading.");
return;
}

View file

@ -266,12 +266,9 @@ static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager,
desc->geometryShaderSource = gs->GetShaderString(SHADER_STRING_SOURCE_CODE);
}
VkPipelineInputAssemblyStateCreateInfo &inputAssembly = desc->inputAssembly;
inputAssembly.flags = 0;
inputAssembly.topology = (VkPrimitiveTopology)key.topology;
inputAssembly.primitiveRestartEnable = false;
int vertexStride = 0;
desc->topology = (VkPrimitiveTopology)key.topology;
int vertexStride = 0;
VkVertexInputAttributeDescription *attrs = &desc->attrs[0];
int attributeCount;