Skip to content

Commit

Permalink
Merge pull request #2244 from js6i/tess-info
Browse files Browse the repository at this point in the history
MVKGraphicsPipeline: Don't use _tessInfo to decide if pipeline is a tessellation pipeline.
  • Loading branch information
billhollings authored May 31, 2024
2 parents 72b42c1 + b0d20bb commit dc6d383
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class MVKGraphicsPipeline : public MVKPipeline {
bool isDynamicState(MVKRenderStateType state) { return _dynamicState.isEnabled(state); }

/** Returns whether this pipeline has tessellation shaders. */
bool isTessellationPipeline() { return _tessInfo.patchControlPoints > 0; }
bool isTessellationPipeline() { return _isTessellationPipeline; }

/** Returns the number of output tessellation patch control points. */
uint32_t getOutputControlPointCount() { return _outputControlPointCount; }
Expand Down Expand Up @@ -455,6 +455,7 @@ class MVKGraphicsPipeline : public MVKPipeline {
bool _isRasterizing = false;
bool _isRasterizingColor = false;
bool _sampleLocationsEnable = false;
bool _isTessellationPipeline = false;
};


Expand Down
4 changes: 3 additions & 1 deletion MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@
SPIRVTessReflectionData reflectData;
std::string reflectErrorLog;
if (pTessCtlSS && pTessEvalSS) {
_isTessellationPipeline = true;

if (!getTessReflectionData(((MVKShaderModule*)pTessCtlSS->module)->getSPIRV(), pTessCtlSS->pName, ((MVKShaderModule*)pTessEvalSS->module)->getSPIRV(), pTessEvalSS->pName, reflectData, reflectErrorLog) ) {
setConfigurationResult(reportError(VK_ERROR_INITIALIZATION_FAILED, "Failed to reflect tessellation shaders: %s", reflectErrorLog.c_str()));
return;
Expand All @@ -503,7 +505,7 @@

// Tessellation - must ignore allowed bad pTessellationState pointer if not tess pipeline
_outputControlPointCount = reflectData.numControlPoints;
mvkSetOrClear(&_tessInfo, (pTessCtlSS && pTessEvalSS) ? pCreateInfo->pTessellationState : nullptr);
mvkSetOrClear(&_tessInfo, _isTessellationPipeline ? pCreateInfo->pTessellationState : nullptr);

// Render pipeline state. Do this as early as possible, to fail fast if pipeline requires a fail on cache-miss.
initMTLRenderPipelineState(pCreateInfo, reflectData, pPipelineFB, pVertexSS, pVertexFB, pTessCtlSS, pTessCtlFB, pTessEvalSS, pTessEvalFB, pFragmentSS, pFragmentFB);
Expand Down

0 comments on commit dc6d383

Please sign in to comment.