@@ -180,11 +180,25 @@ static std::string CutFromMain(std::string str) {
180
180
static VulkanPipeline *CreateVulkanPipeline (VulkanRenderManager *renderManager, VkPipelineCache pipelineCache,
181
181
VkPipelineLayout layout, PipelineFlags pipelineFlags, VkSampleCountFlagBits sampleCount, const VulkanPipelineRasterStateKey &key,
182
182
const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, VulkanGeometryShader *gs, bool useHwTransform, u32 variantBitmask) {
183
+
184
+ if (!fs->GetModule ()) {
185
+ ERROR_LOG (G3D, " Fragment shader missing in CreateVulkanPipeline" );
186
+ return nullptr ;
187
+ }
188
+ if (!vs->GetModule ()) {
189
+ ERROR_LOG (G3D, " Vertex shader missing in CreateVulkanPipeline" );
190
+ return nullptr ;
191
+ }
192
+
183
193
VulkanPipeline *vulkanPipeline = new VulkanPipeline ();
184
194
vulkanPipeline->desc = new VKRGraphicsPipelineDesc ();
185
195
VKRGraphicsPipelineDesc *desc = vulkanPipeline->desc ;
186
196
desc->pipelineCache = pipelineCache;
187
197
198
+ desc->fragmentShader = fs->GetModule ();
199
+ desc->vertexShader = vs->GetModule ();
200
+ desc->geometryShader = gs ? gs->GetModule () : nullptr ;
201
+
188
202
PROFILE_THIS_SCOPE (" pipelinebuild" );
189
203
bool useBlendConstant = false ;
190
204
@@ -257,9 +271,6 @@ static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager,
257
271
rs.polygonMode = VK_POLYGON_MODE_FILL;
258
272
rs.depthClampEnable = key.depthClampEnable ;
259
273
260
- desc->fragmentShader = fs->GetModule ();
261
- desc->vertexShader = vs->GetModule ();
262
- desc->geometryShader = gs ? gs->GetModule () : nullptr ;
263
274
desc->fragmentShaderSource = fs->GetShaderString (SHADER_STRING_SOURCE_CODE);
264
275
desc->vertexShaderSource = vs->GetShaderString (SHADER_STRING_SOURCE_CODE);
265
276
if (gs) {
@@ -360,6 +371,8 @@ VulkanPipeline *PipelineManagerVulkan::GetOrCreatePipeline(VulkanRenderManager *
360
371
VulkanPipeline *pipeline = CreateVulkanPipeline (
361
372
renderManager, pipelineCache_, layout, pipelineFlags, sampleCount,
362
373
rasterKey, decFmt, vs, fs, gs, useHwTransform, variantBitmask);
374
+
375
+ // If the above failed, we got a null pipeline. We still insert it to keep track.
363
376
pipelines_.Insert (key, pipeline);
364
377
365
378
// Don't return placeholder null pipelines.
0 commit comments