Commit 2f6d6a84 authored by Laszlo Agocs's avatar Laszlo Agocs

gl: Add support for depth textures

parent 7188859e
...@@ -1310,13 +1310,13 @@ void QRhiD3D11::beginPass(QRhiCommandBuffer *cb, ...@@ -1310,13 +1310,13 @@ void QRhiD3D11::beginPass(QRhiCommandBuffer *cb,
enqueueResourceUpdates(cb, resourceUpdates); enqueueResourceUpdates(cb, resourceUpdates);
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb); QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
bool needsColorClear = true; bool wantsColorClear = true;
bool needsDsClear = true; bool wantsDsClear = true;
QD3D11RenderTargetData *rtD = rtData(rt); QD3D11RenderTargetData *rtD = rtData(rt);
if (rt->type() == QRhiRenderTarget::RtTexture) { if (rt->type() == QRhiRenderTarget::RtTexture) {
QD3D11TextureRenderTarget *rtTex = QRHI_RES(QD3D11TextureRenderTarget, rt); QD3D11TextureRenderTarget *rtTex = QRHI_RES(QD3D11TextureRenderTarget, rt);
needsColorClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents); wantsColorClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents);
needsDsClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents); wantsDsClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents);
} }
cbD->currentTarget = rt; cbD->currentTarget = rt;
...@@ -1330,9 +1330,9 @@ void QRhiD3D11::beginPass(QRhiCommandBuffer *cb, ...@@ -1330,9 +1330,9 @@ void QRhiD3D11::beginPass(QRhiCommandBuffer *cb,
clearCmd.cmd = QD3D11CommandBuffer::Command::Clear; clearCmd.cmd = QD3D11CommandBuffer::Command::Clear;
clearCmd.args.clear.rt = rt; clearCmd.args.clear.rt = rt;
clearCmd.args.clear.mask = 0; clearCmd.args.clear.mask = 0;
if (rtD->colorAttCount && needsColorClear) if (rtD->colorAttCount && wantsColorClear)
clearCmd.args.clear.mask |= QD3D11CommandBuffer::Command::Color; clearCmd.args.clear.mask |= QD3D11CommandBuffer::Command::Color;
if (rtD->dsAttCount && needsDsClear) if (rtD->dsAttCount && wantsDsClear)
clearCmd.args.clear.mask |= QD3D11CommandBuffer::Command::Depth | QD3D11CommandBuffer::Command::Stencil; clearCmd.args.clear.mask |= QD3D11CommandBuffer::Command::Depth | QD3D11CommandBuffer::Command::Stencil;
const QVector4D rgba = colorClearValue.rgba(); const QVector4D rgba = colorClearValue.rgba();
......
This diff is collapsed.
...@@ -132,7 +132,8 @@ struct QGles2RenderTargetData ...@@ -132,7 +132,8 @@ struct QGles2RenderTargetData
QSize pixelSize; QSize pixelSize;
float dpr = 1; float dpr = 1;
int sampleCount = 1; int sampleCount = 1;
int attCount = 0; int colorAttCount = 0;
int dsAttCount = 0;
bool srgbUpdateAndBlend = false; bool srgbUpdateAndBlend = false;
}; };
...@@ -562,6 +563,7 @@ public: ...@@ -562,6 +563,7 @@ public:
r8Format(false), r8Format(false),
r16Format(false), r16Format(false),
floatFormats(false), floatFormats(false),
depthTexture(false),
srgbCapableDefaultFramebuffer(false) srgbCapableDefaultFramebuffer(false)
{ } { }
int maxTextureSize; int maxTextureSize;
...@@ -576,6 +578,7 @@ public: ...@@ -576,6 +578,7 @@ public:
uint r8Format : 1; uint r8Format : 1;
uint r16Format : 1; uint r16Format : 1;
uint floatFormats : 1; uint floatFormats : 1;
uint depthTexture : 1;
uint srgbCapableDefaultFramebuffer : 1; uint srgbCapableDefaultFramebuffer : 1;
} caps; } caps;
bool inFrame = false; bool inFrame = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment