Browse Source

vulkan: remove unnecessary getDevice() calls

niki 2 years ago
parent
commit
9f452474c7
1 changed files with 2 additions and 4 deletions
  1. 2 4
      src/modules/graphics/vulkan/Shader.cpp

+ 2 - 4
src/modules/graphics/vulkan/Shader.cpp

@@ -249,6 +249,8 @@ Shader::Shader(StrongRef<love::graphics::ShaderStage> stages[])
 
 
 bool Shader::loadVolatile()
 bool Shader::loadVolatile()
 {
 {
+	device = vgfx->getDevice();
+
 	computePipeline = VK_NULL_HANDLE;
 	computePipeline = VK_NULL_HANDLE;
 
 
 	for (int i = 0; i < BUILTIN_MAX_ENUM; i++)
 	for (int i = 0; i < BUILTIN_MAX_ENUM; i++)
@@ -738,8 +740,6 @@ void Shader::compileShaders()
 
 
 	auto program = std::make_unique<TProgram>();
 	auto program = std::make_unique<TProgram>();
 
 
-	device = vgfx->getDevice();
-
 	const auto &enabledExtensions = vgfx->getEnabledOptionalDeviceExtensions();
 	const auto &enabledExtensions = vgfx->getEnabledOptionalDeviceExtensions();
 
 
 	for (int i = 0; i < SHADERSTAGE_MAX_ENUM; i++)
 	for (int i = 0; i < SHADERSTAGE_MAX_ENUM; i++)
@@ -983,8 +983,6 @@ void Shader::compileShaders()
 		createInfo.codeSize = spirv.size() * sizeof(uint32_t);
 		createInfo.codeSize = spirv.size() * sizeof(uint32_t);
 		createInfo.pCode = spirv.data();
 		createInfo.pCode = spirv.data();
 
 
-		auto device = vgfx->getDevice();
-
 		VkShaderModule shaderModule;
 		VkShaderModule shaderModule;
 
 
 		if (vkCreateShaderModule(device, &createInfo, nullptr, &shaderModule) != VK_SUCCESS)
 		if (vkCreateShaderModule(device, &createInfo, nullptr, &shaderModule) != VK_SUCCESS)