Metal stubs for resolveBindTexture

This commit is contained in:
Jack Andersen 2016-02-24 19:06:13 -10:00
parent fec5218666
commit 7bdabb5ed3
5 changed files with 20 additions and 9 deletions

@ -1 +1 @@
Subproject commit c8720ad209ba609f80a736dc777887c805b7b2f5
Subproject commit cb9c7d7bd57c09fd73c5aadfc881c0140b64fcdb

View File

@ -32,7 +32,7 @@ struct IGraphicsCommandQueue
virtual void drawInstances(size_t start, size_t count, size_t instCount)=0;
virtual void drawInstancesIndexed(size_t start, size_t count, size_t instCount)=0;
virtual void resolveBindTexture(ITextureR* texture, const SWindowRect& rect, bool tlOrigin)=0;
virtual void resolveBindTexture(ITextureR* texture, const SWindowRect& rect, bool tlOrigin, bool color, bool depth)=0;
virtual void resolveDisplay(ITextureR* source)=0;
virtual void execute()=0;

View File

@ -49,7 +49,8 @@ public:
ITextureSA* newStaticArrayTexture(size_t width, size_t height, size_t layers, TextureFormat fmt,
const void* data, size_t sz);
ITextureD* newDynamicTexture(size_t width, size_t height, TextureFormat fmt);
ITextureR* newRenderTexture(size_t width, size_t height);
ITextureR* newRenderTexture(size_t width, size_t height,
bool enableShaderColorBinding, bool enableShaderDepthBinding);
bool bindingNeedsVertexFormat() const {return false;}
IVertexFormat* newVertexFormat(size_t elementCount, const VertexElementDescriptor* elements);

View File

@ -767,6 +767,8 @@ struct GLCommandQueue : IGraphicsCommandQueue
};
};
const ITextureR* resolveTex;
bool resolveColor : 1;
bool resolveDepth : 1;
Command(Op op) : m_op(op) {}
};
std::vector<Command> m_cmdBufs[3];
@ -980,15 +982,15 @@ struct GLCommandQueue : IGraphicsCommandQueue
const GLTextureR* tex = static_cast<const GLTextureR*>(cmd.resolveTex);
GLenum target = (tex->m_samples > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;
glBindFramebuffer(GL_READ_FRAMEBUFFER, tex->m_fbo);
glReadBuffer(GL_BACK);
//glReadBuffer(GL_FRONT);
glActiveTexture(GL_TEXTURE9);
if (tex->m_bindTexs[0])
if (cmd.resolveColor && tex->m_bindTexs[0])
{
glBindTexture(target, tex->m_bindTexs[0]);
glCopyTexSubImage2D(target, 0, cmd.rect.location[0], cmd.rect.location[1],
cmd.rect.location[0], cmd.rect.location[1], cmd.rect.size[0], cmd.rect.size[1]);
}
if (tex->m_bindTexs[1])
if (cmd.resolveDepth && tex->m_bindTexs[1])
{
glBindTexture(target, tex->m_bindTexs[1]);
glCopyTexSubImage2D(target, 0, cmd.rect.location[0], cmd.rect.location[1],
@ -1134,14 +1136,16 @@ struct GLCommandQueue : IGraphicsCommandQueue
cmds.back().instCount = instCount;
}
void resolveBindTexture(ITextureR* texture, const SWindowRect& rect, bool tlOrigin)
void resolveBindTexture(ITextureR* texture, const SWindowRect& rect, bool tlOrigin, bool color, bool depth)
{
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
cmds.emplace_back(Command::Op::ResolveBindTexture);
cmds.back().resolveTex = texture;
cmds.back().rect = rect;
cmds.back().resolveColor = color;
cmds.back().resolveDepth = depth;
if (tlOrigin)
cmds.back().rect.location[1] = static_cast<GLTextureR*>(texture)->m_height - rect.location[1];
cmds.back().rect.location[1] = static_cast<GLTextureR*>(texture)->m_height - rect.location[1] - rect.size[1];
}
void resolveDisplay(ITextureR* source)

View File

@ -678,6 +678,11 @@ struct MetalCommandQueue : IGraphicsCommandQueue
instanceCount:instCount];
}
void resolveBindTexture(ITextureR* texture, const SWindowRect& rect, bool tlOrigin, bool color, bool depth)
{
}
MetalTextureR* m_needsDisplay = nullptr;
void resolveDisplay(ITextureR* source)
{
@ -892,7 +897,8 @@ ITextureD* MetalDataFactory::newDynamicTexture(size_t width, size_t height, Text
m_deferredData->m_DTexs.emplace_back(retval);
return retval;
}
ITextureR* MetalDataFactory::newRenderTexture(size_t width, size_t height)
ITextureR* MetalDataFactory::newRenderTexture(size_t width, size_t height,
bool enableShaderColorBinding, bool enableShaderDepthBinding)
{
MetalTextureR* retval = new MetalTextureR(m_ctx, width, height, m_sampleCount);
if (!m_deferredData.get())