|
@@ -38,7 +38,7 @@ Known issues(driver problems??):
|
|
|
Only on this device ( no problem on iPad Air 2 with iOS9.3.1)
|
|
Only on this device ( no problem on iPad Air 2 with iOS9.3.1)
|
|
|
|
|
|
|
|
TODOs:
|
|
TODOs:
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
- texture msaa: 09-hdr
|
|
- texture msaa: 09-hdr
|
|
|
- texture blit support: 08-update, 09-hdr
|
|
- texture blit support: 08-update, 09-hdr
|
|
|
- texture read_back: 09-hdr
|
|
- texture read_back: 09-hdr
|
|
@@ -50,7 +50,7 @@ Known issues(driver problems??):
|
|
|
|
|
|
|
|
- 14-shadowvolumes: texture as stencil mode - columns are dark
|
|
- 14-shadowvolumes: texture as stencil mode - columns are dark
|
|
|
- backbuffer msaa color/depth/stencil is not saved. could have problem with views like: backbuffermsaa then rt then backbuffermsaa again
|
|
- backbuffer msaa color/depth/stencil is not saved. could have problem with views like: backbuffermsaa then rt then backbuffermsaa again
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
- finish savescreenshot with screenshotbegin/end
|
|
- finish savescreenshot with screenshotbegin/end
|
|
|
|
|
|
|
|
- support multiple windows: 22-windows
|
|
- support multiple windows: 22-windows
|
|
@@ -342,7 +342,7 @@ namespace bgfx { namespace mtl
|
|
|
BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) );
|
|
BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) );
|
|
|
|
|
|
|
|
int s_msaa[5] = { 1,2,4,8,16 };
|
|
int s_msaa[5] = { 1,2,4,8,16 };
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
#define SHADER_FUNCTION_NAME ("xlatMtlMain")
|
|
#define SHADER_FUNCTION_NAME ("xlatMtlMain")
|
|
|
#define SHADER_UNIFORM_NAME ("_mtl_u")
|
|
#define SHADER_UNIFORM_NAME ("_mtl_u")
|
|
|
|
|
|
|
@@ -466,7 +466,7 @@ namespace bgfx { namespace mtl
|
|
|
m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function;
|
|
m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function;
|
|
|
m_renderPipelineDescriptor.fragmentFunction = m_screenshotBlitProgram.m_fsh->m_function;
|
|
m_renderPipelineDescriptor.fragmentFunction = m_screenshotBlitProgram.m_fsh->m_function;
|
|
|
m_screenshotBlitRenderPipelineState = m_device.newRenderPipelineStateWithDescriptor(m_renderPipelineDescriptor);
|
|
m_screenshotBlitRenderPipelineState = m_device.newRenderPipelineStateWithDescriptor(m_renderPipelineDescriptor);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
g_caps.supported |= (0
|
|
g_caps.supported |= (0
|
|
|
| BGFX_CAPS_TEXTURE_COMPARE_LEQUAL //NOTE: on IOS Gpu Family 1/2 have to set compare in shader
|
|
| BGFX_CAPS_TEXTURE_COMPARE_LEQUAL //NOTE: on IOS Gpu Family 1/2 have to set compare in shader
|
|
|
| BGFX_CAPS_TEXTURE_COMPARE_ALL
|
|
| BGFX_CAPS_TEXTURE_COMPARE_ALL
|
|
@@ -599,7 +599,7 @@ namespace bgfx { namespace mtl
|
|
|
s_textureFormat[ii].m_fmtSrgb = MTLPixelFormatInvalid;
|
|
s_textureFormat[ii].m_fmtSrgb = MTLPixelFormatInvalid;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
for(uint32_t ii=1; ii<5; ++ii)
|
|
for(uint32_t ii=1; ii<5; ++ii)
|
|
|
{
|
|
{
|
|
|
if (!m_device.supportsTextureSampleCount(s_msaa[ii]))
|
|
if (!m_device.supportsTextureSampleCount(s_msaa[ii]))
|
|
@@ -1083,9 +1083,9 @@ namespace bgfx { namespace mtl
|
|
|
|| (m_resolution.m_flags&maskFlags) != (_resolution.m_flags&maskFlags) )
|
|
|| (m_resolution.m_flags&maskFlags) != (_resolution.m_flags&maskFlags) )
|
|
|
{
|
|
{
|
|
|
int sampleCount = s_msaa[(_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
|
|
int sampleCount = s_msaa[(_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
MTLPixelFormat prevMetalLayerPixelFormat = m_metalLayer.pixelFormat;
|
|
MTLPixelFormat prevMetalLayerPixelFormat = m_metalLayer.pixelFormat;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
m_metalLayer.drawableSize = CGSizeMake(_resolution.m_width, _resolution.m_height);
|
|
m_metalLayer.drawableSize = CGSizeMake(_resolution.m_width, _resolution.m_height);
|
|
|
m_metalLayer.pixelFormat = (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER)
|
|
m_metalLayer.pixelFormat = (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER)
|
|
|
? MTLPixelFormatBGRA8Unorm_sRGB
|
|
? MTLPixelFormatBGRA8Unorm_sRGB
|
|
@@ -1139,7 +1139,7 @@ namespace bgfx { namespace mtl
|
|
|
m_textureDescriptor.pixelFormat = m_metalLayer.pixelFormat;
|
|
m_textureDescriptor.pixelFormat = m_metalLayer.pixelFormat;
|
|
|
m_backBufferColorMSAA = m_device.newTextureWithDescriptor(m_textureDescriptor);
|
|
m_backBufferColorMSAA = m_device.newTextureWithDescriptor(m_textureDescriptor);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
bx::HashMurmur2A murmur;
|
|
bx::HashMurmur2A murmur;
|
|
|
murmur.begin();
|
|
murmur.begin();
|
|
|
murmur.add(1);
|
|
murmur.add(1);
|
|
@@ -1156,7 +1156,7 @@ namespace bgfx { namespace mtl
|
|
|
|
|
|
|
|
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
|
m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
|
|
|
m_textVideoMem.clear();
|
|
m_textVideoMem.clear();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ( prevMetalLayerPixelFormat != m_metalLayer.pixelFormat)
|
|
if ( prevMetalLayerPixelFormat != m_metalLayer.pixelFormat)
|
|
|
{
|
|
{
|
|
|
MTL_RELEASE(m_screenshotBlitRenderPipelineState)
|
|
MTL_RELEASE(m_screenshotBlitRenderPipelineState)
|
|
@@ -1275,7 +1275,7 @@ namespace bgfx { namespace mtl
|
|
|
{
|
|
{
|
|
|
uint32_t width;
|
|
uint32_t width;
|
|
|
uint32_t height;
|
|
uint32_t height;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (isValid(m_fbh) )
|
|
if (isValid(m_fbh) )
|
|
|
{
|
|
{
|
|
|
const FrameBufferMtl& fb = m_frameBuffers[m_fbh.idx];
|
|
const FrameBufferMtl& fb = m_frameBuffers[m_fbh.idx];
|
|
@@ -1287,12 +1287,12 @@ namespace bgfx { namespace mtl
|
|
|
width = getBufferWidth();
|
|
width = getBufferWidth();
|
|
|
height = getBufferHeight();
|
|
height = getBufferHeight();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
uint64_t state = 0;
|
|
uint64_t state = 0;
|
|
|
state |= _clear.m_flags & BGFX_CLEAR_COLOR ? BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE : 0;
|
|
state |= _clear.m_flags & BGFX_CLEAR_COLOR ? BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE : 0;
|
|
|
state |= _clear.m_flags & BGFX_CLEAR_DEPTH ? BGFX_STATE_DEPTH_TEST_ALWAYS|BGFX_STATE_DEPTH_WRITE : 0;
|
|
state |= _clear.m_flags & BGFX_CLEAR_DEPTH ? BGFX_STATE_DEPTH_TEST_ALWAYS|BGFX_STATE_DEPTH_WRITE : 0;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
uint64_t stencil = 0;
|
|
uint64_t stencil = 0;
|
|
|
stencil |= _clear.m_flags & BGFX_CLEAR_STENCIL ? 0
|
|
stencil |= _clear.m_flags & BGFX_CLEAR_STENCIL ? 0
|
|
|
| BGFX_STENCIL_TEST_ALWAYS
|
|
| BGFX_STENCIL_TEST_ALWAYS
|
|
@@ -1303,9 +1303,9 @@ namespace bgfx { namespace mtl
|
|
|
| BGFX_STENCIL_OP_PASS_Z_REPLACE
|
|
| BGFX_STENCIL_OP_PASS_Z_REPLACE
|
|
|
: 0
|
|
: 0
|
|
|
;
|
|
;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
setDepthStencilState(state, stencil);
|
|
setDepthStencilState(state, stencil);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
uint32_t numMrt = 1;
|
|
uint32_t numMrt = 1;
|
|
|
FrameBufferHandle fbh = m_fbh;
|
|
FrameBufferHandle fbh = m_fbh;
|
|
|
if (isValid(fbh) )
|
|
if (isValid(fbh) )
|
|
@@ -1313,12 +1313,12 @@ namespace bgfx { namespace mtl
|
|
|
const FrameBufferMtl& fb = m_frameBuffers[fbh.idx];
|
|
const FrameBufferMtl& fb = m_frameBuffers[fbh.idx];
|
|
|
numMrt = bx::uint32_max(1, fb.m_num);
|
|
numMrt = bx::uint32_max(1, fb.m_num);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
ProgramMtl& program = m_program[_clearQuad.m_program[numMrt-1].idx];
|
|
ProgramMtl& program = m_program[_clearQuad.m_program[numMrt-1].idx];
|
|
|
m_renderCommandEncoder.setRenderPipelineState(program.getRenderPipelineState(state, 0, fbh, _clearQuad.m_vb->decl, 0));
|
|
m_renderCommandEncoder.setRenderPipelineState(program.getRenderPipelineState(state, 0, fbh, _clearQuad.m_vb->decl, 0));
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
uint32_t fragmentUniformBufferSize = program.m_fshConstantBufferSize;
|
|
uint32_t fragmentUniformBufferSize = program.m_fshConstantBufferSize;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
m_uniformBufferFragmentOffset = m_uniformBufferVertexOffset;
|
|
m_uniformBufferFragmentOffset = m_uniformBufferVertexOffset;
|
|
|
if (fragmentUniformBufferSize)
|
|
if (fragmentUniformBufferSize)
|
|
|
{
|
|
{
|
|
@@ -1334,7 +1334,7 @@ namespace bgfx { namespace mtl
|
|
|
uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[ii]);
|
|
uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[ii]);
|
|
|
memcpy(mrtClear[ii], _palette[index], 16);
|
|
memcpy(mrtClear[ii], _palette[index], 16);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
memcpy((uint8_t*)m_uniformBuffer.contents() + m_uniformBufferFragmentOffset,
|
|
memcpy((uint8_t*)m_uniformBuffer.contents() + m_uniformBufferFragmentOffset,
|
|
|
mrtClear,
|
|
mrtClear,
|
|
|
bx::uint32_min(fragmentUniformBufferSize, sizeof(mrtClear)));
|
|
bx::uint32_min(fragmentUniformBufferSize, sizeof(mrtClear)));
|
|
@@ -1348,12 +1348,12 @@ namespace bgfx { namespace mtl
|
|
|
_clear.m_index[2]*1.0f/255.0f,
|
|
_clear.m_index[2]*1.0f/255.0f,
|
|
|
_clear.m_index[3]*1.0f/255.0f,
|
|
_clear.m_index[3]*1.0f/255.0f,
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
memcpy((uint8_t*)m_uniformBuffer.contents() + m_uniformBufferFragmentOffset,
|
|
memcpy((uint8_t*)m_uniformBuffer.contents() + m_uniformBufferFragmentOffset,
|
|
|
rgba,
|
|
rgba,
|
|
|
bx::uint32_min(fragmentUniformBufferSize, sizeof(rgba)));
|
|
bx::uint32_min(fragmentUniformBufferSize, sizeof(rgba)));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
m_uniformBufferFragmentOffset += fragmentUniformBufferSize;
|
|
m_uniformBufferFragmentOffset += fragmentUniformBufferSize;
|
|
|
m_uniformBufferVertexOffset = m_uniformBufferFragmentOffset;
|
|
m_uniformBufferVertexOffset = m_uniformBufferFragmentOffset;
|
|
|
|
|
|
|
@@ -1361,7 +1361,7 @@ namespace bgfx { namespace mtl
|
|
|
const VertexDecl& vertexDecl = m_vertexDecls[_clearQuad.m_vb->decl.idx];
|
|
const VertexDecl& vertexDecl = m_vertexDecls[_clearQuad.m_vb->decl.idx];
|
|
|
const uint32_t stride = vertexDecl.m_stride;
|
|
const uint32_t stride = vertexDecl.m_stride;
|
|
|
const uint32_t offset = 0;
|
|
const uint32_t offset = 0;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
{
|
|
{
|
|
|
struct Vertex
|
|
struct Vertex
|
|
|
{
|
|
{
|
|
@@ -1369,12 +1369,12 @@ namespace bgfx { namespace mtl
|
|
|
float m_y;
|
|
float m_y;
|
|
|
float m_z;
|
|
float m_z;
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Vertex* vertex = (Vertex*)_clearQuad.m_vb->data;
|
|
Vertex* vertex = (Vertex*)_clearQuad.m_vb->data;
|
|
|
BX_CHECK(stride == sizeof(Vertex), "Stride/Vertex mismatch (stride %d, sizeof(Vertex) %d)", stride, sizeof(Vertex) );
|
|
BX_CHECK(stride == sizeof(Vertex), "Stride/Vertex mismatch (stride %d, sizeof(Vertex) %d)", stride, sizeof(Vertex) );
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const float depth = _clear.m_depth;
|
|
const float depth = _clear.m_depth;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
vertex->m_x = -1.0f;
|
|
vertex->m_x = -1.0f;
|
|
|
vertex->m_y = -1.0f;
|
|
vertex->m_y = -1.0f;
|
|
|
vertex->m_z = depth;
|
|
vertex->m_z = depth;
|
|
@@ -1391,7 +1391,7 @@ namespace bgfx { namespace mtl
|
|
|
vertex->m_y = 1.0f;
|
|
vertex->m_y = 1.0f;
|
|
|
vertex->m_z = depth;
|
|
vertex->m_z = depth;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
m_vertexBuffers[_clearQuad.m_vb->handle.idx].update(0, 4*_clearQuad.m_decl.m_stride, _clearQuad.m_vb->data);
|
|
m_vertexBuffers[_clearQuad.m_vb->handle.idx].update(0, 4*_clearQuad.m_decl.m_stride, _clearQuad.m_vb->data);
|
|
|
m_renderCommandEncoder.setCullMode(MTLCullModeNone);
|
|
m_renderCommandEncoder.setCullMode(MTLCullModeNone);
|
|
|
m_renderCommandEncoder.setVertexBuffer(vb.getBuffer(), offset, 1);
|
|
m_renderCommandEncoder.setVertexBuffer(vb.getBuffer(), offset, 1);
|
|
@@ -2492,7 +2492,7 @@ namespace bgfx { namespace mtl
|
|
|
murmur.add((uint32_t)depthTexture.m_ptr.pixelFormat());
|
|
murmur.add((uint32_t)depthTexture.m_ptr.pixelFormat());
|
|
|
murmur.add((uint32_t)(NULL != depthTexture.m_ptrStencil ? depthTexture.m_ptrStencil.pixelFormat() : MTLPixelFormatInvalid));
|
|
murmur.add((uint32_t)(NULL != depthTexture.m_ptrStencil ? depthTexture.m_ptrStencil.pixelFormat() : MTLPixelFormatInvalid));
|
|
|
murmur.add(1); //SampleCount
|
|
murmur.add(1); //SampleCount
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
m_pixelFormatHash = murmur.end();
|
|
m_pixelFormatHash = murmur.end();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2631,7 +2631,7 @@ namespace bgfx { namespace mtl
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
updateResolution(_render->m_resolution);
|
|
updateResolution(_render->m_resolution);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ( m_saveScreenshot )
|
|
if ( m_saveScreenshot )
|
|
|
{
|
|
{
|
|
|
if ( m_screenshotTarget )
|
|
if ( m_screenshotTarget )
|
|
@@ -2810,16 +2810,16 @@ namespace bgfx { namespace mtl
|
|
|
{
|
|
{
|
|
|
RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor();
|
|
RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor();
|
|
|
renderPassDescriptor.visibilityResultBuffer = m_occlusionQuery.m_buffer;
|
|
renderPassDescriptor.visibilityResultBuffer = m_occlusionQuery.m_buffer;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
fbh = _render->m_fb[view];
|
|
fbh = _render->m_fb[view];
|
|
|
setFrameBuffer(renderPassDescriptor, fbh);
|
|
setFrameBuffer(renderPassDescriptor, fbh);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ( clearWithRenderPass )
|
|
if ( clearWithRenderPass )
|
|
|
{
|
|
{
|
|
|
for(uint32_t ii = 0; ii < g_caps.maxFBAttachments; ++ii)
|
|
for(uint32_t ii = 0; ii < g_caps.maxFBAttachments; ++ii)
|
|
|
{
|
|
{
|
|
|
MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii];
|
|
MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ( desc.texture != NULL)
|
|
if ( desc.texture != NULL)
|
|
|
{
|
|
{
|
|
|
if (0 != (BGFX_CLEAR_COLOR & clr.m_flags) )
|
|
if (0 != (BGFX_CLEAR_COLOR & clr.m_flags) )
|
|
@@ -2842,7 +2842,7 @@ namespace bgfx { namespace mtl
|
|
|
float aa = clr.m_index[3]*1.0f/255.0f;
|
|
float aa = clr.m_index[3]*1.0f/255.0f;
|
|
|
desc.clearColor = MTLClearColorMake(rr, gg, bb, aa);
|
|
desc.clearColor = MTLClearColorMake(rr, gg, bb, aa);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
desc.loadAction = MTLLoadActionClear;
|
|
desc.loadAction = MTLLoadActionClear;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -2852,7 +2852,7 @@ namespace bgfx { namespace mtl
|
|
|
desc.storeAction = NULL != m_backBufferColorMSAA ? MTLStoreActionMultisampleResolve : MTLStoreActionStore;
|
|
desc.storeAction = NULL != m_backBufferColorMSAA ? MTLStoreActionMultisampleResolve : MTLStoreActionStore;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//TODO: optimize store actions use discard flag
|
|
//TODO: optimize store actions use discard flag
|
|
|
RenderPassDepthAttachmentDescriptor depthAttachment = renderPassDescriptor.depthAttachment;
|
|
RenderPassDepthAttachmentDescriptor depthAttachment = renderPassDescriptor.depthAttachment;
|
|
|
if (NULL != depthAttachment.texture)
|
|
if (NULL != depthAttachment.texture)
|
|
@@ -2864,7 +2864,7 @@ namespace bgfx { namespace mtl
|
|
|
;
|
|
;
|
|
|
depthAttachment.storeAction = NULL != m_backBufferColorMSAA ? MTLStoreActionDontCare : MTLStoreActionStore;
|
|
depthAttachment.storeAction = NULL != m_backBufferColorMSAA ? MTLStoreActionDontCare : MTLStoreActionStore;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
RenderPassStencilAttachmentDescriptor stencilAttachment = renderPassDescriptor.stencilAttachment;
|
|
RenderPassStencilAttachmentDescriptor stencilAttachment = renderPassDescriptor.stencilAttachment;
|
|
|
if (NULL != stencilAttachment.texture)
|
|
if (NULL != stencilAttachment.texture)
|
|
|
{
|
|
{
|
|
@@ -2884,7 +2884,7 @@ namespace bgfx { namespace mtl
|
|
|
if ( desc.texture != NULL)
|
|
if ( desc.texture != NULL)
|
|
|
desc.loadAction = MTLLoadActionLoad;
|
|
desc.loadAction = MTLLoadActionLoad;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//TODO: optimize store actions use discard flag
|
|
//TODO: optimize store actions use discard flag
|
|
|
RenderPassDepthAttachmentDescriptor depthAttachment = renderPassDescriptor.depthAttachment;
|
|
RenderPassDepthAttachmentDescriptor depthAttachment = renderPassDescriptor.depthAttachment;
|
|
|
if (NULL != depthAttachment.texture)
|
|
if (NULL != depthAttachment.texture)
|
|
@@ -2892,7 +2892,7 @@ namespace bgfx { namespace mtl
|
|
|
depthAttachment.loadAction = MTLLoadActionLoad;
|
|
depthAttachment.loadAction = MTLLoadActionLoad;
|
|
|
depthAttachment.storeAction = MTLStoreActionStore;
|
|
depthAttachment.storeAction = MTLStoreActionStore;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
RenderPassStencilAttachmentDescriptor stencilAttachment = renderPassDescriptor.stencilAttachment;
|
|
RenderPassStencilAttachmentDescriptor stencilAttachment = renderPassDescriptor.stencilAttachment;
|
|
|
if (NULL != stencilAttachment.texture)
|
|
if (NULL != stencilAttachment.texture)
|
|
|
{
|
|
{
|
|
@@ -2901,12 +2901,12 @@ namespace bgfx { namespace mtl
|
|
|
stencilAttachment.storeAction = MTLStoreActionStore;
|
|
stencilAttachment.storeAction = MTLStoreActionStore;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (0 != m_renderCommandEncoder)
|
|
if (0 != m_renderCommandEncoder)
|
|
|
{
|
|
{
|
|
|
m_renderCommandEncoder.endEncoding();
|
|
m_renderCommandEncoder.endEncoding();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
rce = m_commandBuffer.renderCommandEncoderWithDescriptor(renderPassDescriptor);
|
|
rce = m_commandBuffer.renderCommandEncoderWithDescriptor(renderPassDescriptor);
|
|
|
m_renderCommandEncoder = rce;
|
|
m_renderCommandEncoder = rce;
|
|
|
m_renderCommandEncoderFrameBufferHandle = fbh;
|
|
m_renderCommandEncoderFrameBufferHandle = fbh;
|
|
@@ -3106,7 +3106,7 @@ namespace bgfx { namespace mtl
|
|
|
currentProgram = &program;
|
|
currentProgram = &program;
|
|
|
|
|
|
|
|
RenderPipelineState pipelineState = NULL;
|
|
RenderPipelineState pipelineState = NULL;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ( isValid(draw.m_vertexBuffer) )
|
|
if ( isValid(draw.m_vertexBuffer) )
|
|
|
{
|
|
{
|
|
|
uint16_t handle = draw.m_vertexBuffer.idx;
|
|
uint16_t handle = draw.m_vertexBuffer.idx;
|
|
@@ -3116,7 +3116,7 @@ namespace bgfx { namespace mtl
|
|
|
|
|
|
|
|
pipelineState = program.getRenderPipelineState(newFlags, draw.m_rgba, fbh, decl, draw.m_instanceDataStride/16);
|
|
pipelineState = program.getRenderPipelineState(newFlags, draw.m_rgba, fbh, decl, draw.m_instanceDataStride/16);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (NULL == pipelineState )
|
|
if (NULL == pipelineState )
|
|
|
{ //call with invalid program
|
|
{ //call with invalid program
|
|
|
currentProgram = NULL;
|
|
currentProgram = NULL;
|