Ensure previous pipeline state is rebound on metal after copying render texture

This commit is contained in:
Jack Andersen 2019-02-03 15:37:19 -10:00
parent 2135f4e4dc
commit 3e1da36f39
1 changed files with 10 additions and 4 deletions

View File

@ -1189,14 +1189,18 @@ struct MetalCommandQueue : IGraphicsCommandQueue {
MetalShaderDataBinding* m_boundData = nullptr; MetalShaderDataBinding* m_boundData = nullptr;
void setShaderDataBinding(const ObjToken<IShaderDataBinding>& binding) { void _setShaderDataBinding(MetalShaderDataBinding* cbind) {
@autoreleasepool {
MetalShaderDataBinding* cbind = binding.cast<MetalShaderDataBinding>();
cbind->bind(m_enc, m_fillBuf); cbind->bind(m_enc, m_fillBuf);
m_boundData = cbind; m_boundData = cbind;
[m_enc setFragmentSamplerStates:m_samplers withRange:NSMakeRange(0, 5)]; [m_enc setFragmentSamplerStates:m_samplers withRange:NSMakeRange(0, 5)];
[m_enc setVertexSamplerStates:m_samplers withRange:NSMakeRange(0, 5)]; [m_enc setVertexSamplerStates:m_samplers withRange:NSMakeRange(0, 5)];
} }
void setShaderDataBinding(const ObjToken<IShaderDataBinding>& binding) {
@autoreleasepool {
MetalShaderDataBinding* cbind = binding.cast<MetalShaderDataBinding>();
_setShaderDataBinding(cbind);
}
} }
ObjToken<ITextureR> m_boundTarget; ObjToken<ITextureR> m_boundTarget;
@ -1347,6 +1351,8 @@ struct MetalCommandQueue : IGraphicsCommandQueue {
m_enc = [m_cmdBuf renderCommandEncoderWithDescriptor:clearDepth ? tex->m_clearDepthPassDesc : tex->m_passDesc]; m_enc = [m_cmdBuf renderCommandEncoderWithDescriptor:clearDepth ? tex->m_clearDepthPassDesc : tex->m_passDesc];
[m_enc setFrontFacingWinding:MTLWindingCounterClockwise]; [m_enc setFrontFacingWinding:MTLWindingCounterClockwise];
if (m_boundData)
_setShaderDataBinding(m_boundData);
if (m_boundVp.width || m_boundVp.height) if (m_boundVp.width || m_boundVp.height)
[m_enc setViewport:m_boundVp]; [m_enc setViewport:m_boundVp];
if (m_boundScissor.width || m_boundScissor.height) if (m_boundScissor.width || m_boundScissor.height)