Treat all attributes & resources as used by shader when using pre-converted MSL.
This commit is contained in:
parent
519b594ae0
commit
1a334c191d
@ -224,6 +224,7 @@ MVKMTLFunction MVKShaderModule::getMTLFunction(SPIRVToMSLConverterContext* pCont
|
||||
const VkSpecializationInfo* pSpecializationInfo,
|
||||
MVKPipelineCache* pipelineCache) {
|
||||
lock_guard<mutex> lock(_accessLock);
|
||||
|
||||
MVKShaderLibrary* mvkLib = _defaultLibrary;
|
||||
if ( !mvkLib ) {
|
||||
uint64_t startTime = _device->getPerformanceTimestamp();
|
||||
@ -233,7 +234,10 @@ MVKMTLFunction MVKShaderModule::getMTLFunction(SPIRVToMSLConverterContext* pCont
|
||||
mvkLib = _shaderLibraryCache.getShaderLibrary(pContext, this);
|
||||
}
|
||||
_device->addActivityPerformance(_device->_performanceStatistics.shaderCompilation.shaderLibraryFromCache, startTime);
|
||||
} else {
|
||||
pContext->markAllAttributesAndResourcesUsed();
|
||||
}
|
||||
|
||||
return mvkLib ? mvkLib->getMTLFunction(pSpecializationInfo) : MVKMTLFunctionNull;
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,15 @@ MVK_PUBLIC_SYMBOL bool SPIRVToMSLConverterContext::isVertexBufferUsed(uint32_t m
|
||||
return false;
|
||||
}
|
||||
|
||||
MVK_PUBLIC_SYMBOL void SPIRVToMSLConverterContext::markAllAttributesAndResourcesUsed() {
|
||||
|
||||
if (options.entryPointStage == spv::ExecutionModelVertex) {
|
||||
for (auto& va : vertexAttributes) { va.isUsedByShader = true; }
|
||||
}
|
||||
|
||||
for (auto& rb : resourceBindings) { rb.isUsedByShader = true; }
|
||||
}
|
||||
|
||||
MVK_PUBLIC_SYMBOL bool SPIRVToMSLConverterContext::matches(const SPIRVToMSLConverterContext& other) const {
|
||||
|
||||
if ( !options.matches(other.options) ) { return false; }
|
||||
|
@ -143,6 +143,9 @@ namespace mvk {
|
||||
/** Returns whether the vertex buffer at the specified Metal binding index is used by the shader. */
|
||||
bool isVertexBufferUsed(uint32_t mslBuffer) const;
|
||||
|
||||
/** Marks all vertex attributes and resources as being used by the shader. */
|
||||
void markAllAttributesAndResourcesUsed();
|
||||
|
||||
/**
|
||||
* Returns whether this context matches the other context. It does if the respective
|
||||
* options match and any vertex attributes and resource bindings used by this context
|
||||
|
Loading…
x
Reference in New Issue
Block a user