Merge pull request #1255 from billhollings/vizbuff-index
Fix Metal validation error of duplicate visibility offsets.
This commit is contained in:
commit
54e5723ff7
@ -335,7 +335,7 @@ void MVKCommandEncoder::beginMetalRenderPass(bool loadOverride) {
|
||||
|
||||
MTLRenderPassDescriptor* mtlRPDesc = [MTLRenderPassDescriptor renderPassDescriptor];
|
||||
getSubpass()->populateMTLRenderPassDescriptor(mtlRPDesc, _multiviewPassIndex, _framebuffer, _clearValues.contents(), _isRenderingEntireAttachment, loadOverride);
|
||||
if (_occlusionQueryState.getNeedsVisibilityResultMTLBuffer()) {
|
||||
if (_cmdBuffer->_needsVisibilityResultMTLBuffer) {
|
||||
if (!_visibilityResultMTLBuffer) {
|
||||
_visibilityResultMTLBuffer = getTempMTLBuffer(_pDeviceMetalFeatures->maxQueryBufferSize, true);
|
||||
}
|
||||
|
@ -585,17 +585,12 @@ public:
|
||||
/** Ends an occlusion query. */
|
||||
void endOcclusionQuery(MVKOcclusionQueryPool* pQueryPool, uint32_t query);
|
||||
|
||||
/** Returns whether an MTLBuffer is needed to hold occlusion query results. */
|
||||
bool getNeedsVisibilityResultMTLBuffer();
|
||||
|
||||
/** Constructs this instance for the specified command encoder. */
|
||||
MVKOcclusionQueryCommandEncoderState(MVKCommandEncoder* cmdEncoder);
|
||||
MVKOcclusionQueryCommandEncoderState(MVKCommandEncoder* cmdEncoder) : MVKCommandEncoderState(cmdEncoder) {}
|
||||
|
||||
protected:
|
||||
void encodeImpl(uint32_t) override;
|
||||
void resetImpl() override;
|
||||
|
||||
bool _needsVisibilityResultMTLBuffer = false;
|
||||
MTLVisibilityResultMode _mtlVisibilityResultMode = MTLVisibilityResultModeDisabled;
|
||||
NSUInteger _mtlVisibilityResultOffset = 0;
|
||||
MVKSmallVector<std::pair<MVKQuerySpec, NSUInteger>> _mtlRenderPassQueries;
|
||||
|
@ -943,7 +943,7 @@ void MVKOcclusionQueryCommandEncoderState::beginOcclusionQuery(MVKOcclusionQuery
|
||||
|
||||
MVKQuerySpec querySpec;
|
||||
querySpec.set(pQueryPool, query);
|
||||
NSUInteger offset = _mtlRenderPassQueries.empty() ? 0 : _mtlVisibilityResultOffset + 8;
|
||||
NSUInteger offset = _mtlRenderPassQueries.empty() ? 0 : _mtlVisibilityResultOffset + kMVKQuerySlotSizeInBytes;
|
||||
NSUInteger maxOffset = _cmdEncoder->_pDeviceMetalFeatures->maxQueryBufferSize - kMVKQuerySlotSizeInBytes;
|
||||
offset = min(offset, maxOffset);
|
||||
_mtlRenderPassQueries.push_back(make_pair(querySpec, offset));
|
||||
@ -952,17 +952,14 @@ void MVKOcclusionQueryCommandEncoderState::beginOcclusionQuery(MVKOcclusionQuery
|
||||
_mtlVisibilityResultMode = shouldCount ? MTLVisibilityResultModeCounting : MTLVisibilityResultModeBoolean;
|
||||
_mtlVisibilityResultOffset = offset;
|
||||
|
||||
_needsVisibilityResultMTLBuffer = true;
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
void MVKOcclusionQueryCommandEncoderState::endOcclusionQuery(MVKOcclusionQueryPool* pQueryPool, uint32_t query) {
|
||||
reset();
|
||||
_mtlVisibilityResultMode = MTLVisibilityResultModeDisabled;
|
||||
markDirty();
|
||||
}
|
||||
|
||||
bool MVKOcclusionQueryCommandEncoderState::getNeedsVisibilityResultMTLBuffer() { return _needsVisibilityResultMTLBuffer; }
|
||||
|
||||
void MVKOcclusionQueryCommandEncoderState::encodeImpl(uint32_t stage) {
|
||||
if (stage != kMVKGraphicsStageRasterization) { return; }
|
||||
|
||||
@ -971,14 +968,7 @@ void MVKOcclusionQueryCommandEncoderState::encodeImpl(uint32_t stage) {
|
||||
}
|
||||
|
||||
void MVKOcclusionQueryCommandEncoderState::resetImpl() {
|
||||
_needsVisibilityResultMTLBuffer = _cmdEncoder->_cmdBuffer->_needsVisibilityResultMTLBuffer;
|
||||
_mtlVisibilityResultMode = MTLVisibilityResultModeDisabled;
|
||||
_mtlVisibilityResultOffset = 0;
|
||||
_mtlRenderPassQueries.clear();
|
||||
}
|
||||
|
||||
MVKOcclusionQueryCommandEncoderState::MVKOcclusionQueryCommandEncoderState(MVKCommandEncoder* cmdEncoder)
|
||||
: MVKCommandEncoderState(cmdEncoder) {
|
||||
resetImpl();
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +61,8 @@ MVK_PUBLIC_SYMBOL VkResult vkSetMoltenVKConfigurationMVK(
|
||||
const MVKConfiguration* pConfiguration,
|
||||
size_t* pConfigurationSize) {
|
||||
|
||||
MVKConfiguration mvkConfig = {}; // Ensure initialized in case not fully copied
|
||||
// Start with current config, in case incoming is not fully copied
|
||||
MVKConfiguration mvkConfig = *mvkGetMVKConfiguration();
|
||||
VkResult rslt = mvkCopy(&mvkConfig, pConfiguration, pConfigurationSize);
|
||||
mvkSetMVKConfiguration(&mvkConfig);
|
||||
return rslt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user