From ad343ec6c4a24cc50ddc4ceedad10301022f6408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 5 Nov 2015 09:13:23 -0800 Subject: [PATCH] Metal: Fixed occlusion query offsets. --- src/renderer_mtl.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/renderer_mtl.mm b/src/renderer_mtl.mm index 8b30376f6..7ce2933df 100644 --- a/src/renderer_mtl.mm +++ b/src/renderer_mtl.mm @@ -2113,7 +2113,7 @@ namespace bgfx { namespace mtl void OcclusionQueryMTL::preReset() { - m_buffer = s_renderMtl->m_device.newBufferWithLength(BX_COUNTOF(m_query)*8, 0); + m_buffer = s_renderMtl->m_device.newBufferWithLength(BX_COUNTOF(m_query) * 8, 0); } void OcclusionQueryMTL::begin(RenderCommandEncoder& _rce, Frame* _render, OcclusionQueryHandle _handle) @@ -2125,13 +2125,15 @@ namespace bgfx { namespace mtl Query& query = m_query[m_control.m_current]; query.m_handle = _handle; - _rce.setVisibilityResultMode(MTLVisibilityResultModeBoolean, _handle.idx); + uint32_t offset = _handle.idx * 8; + _rce.setVisibilityResultMode(MTLVisibilityResultModeBoolean, offset); } void OcclusionQueryMTL::end(RenderCommandEncoder& _rce) { Query& query = m_query[m_control.m_current]; - _rce.setVisibilityResultMode(MTLVisibilityResultModeDisabled, query.m_handle.idx); + uint32_t offset = query.m_handle.idx * 8; + _rce.setVisibilityResultMode(MTLVisibilityResultModeDisabled, offset); m_control.commit(1); }