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,
enqueueResourceUpdates(cb, resourceUpdates);
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
bool needsColorClear = true;
bool needsDsClear = true;
bool wantsColorClear = true;
bool wantsDsClear = true;
QD3D11RenderTargetData *rtD = rtData(rt);
if (rt->type() == QRhiRenderTarget::RtTexture) {
QD3D11TextureRenderTarget *rtTex = QRHI_RES(QD3D11TextureRenderTarget, rt);
needsColorClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents);
needsDsClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents);
wantsColorClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveColorContents);
wantsDsClear = !rtTex->m_flags.testFlag(QRhiTextureRenderTarget::PreserveDepthStencilContents);
}
cbD->currentTarget = rt;
......@@ -1330,9 +1330,9 @@ void QRhiD3D11::beginPass(QRhiCommandBuffer *cb,
clearCmd.cmd = QD3D11CommandBuffer::Command::Clear;
clearCmd.args.clear.rt = rt;
clearCmd.args.clear.mask = 0;
if (rtD->colorAttCount && needsColorClear)
if (rtD->colorAttCount && wantsColorClear)
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;
const QVector4D rgba = colorClearValue.rgba();
......
This diff is collapsed.
......@@ -132,7 +132,8 @@ struct QGles2RenderTargetData
QSize pixelSize;
float dpr = 1;
int sampleCount = 1;
int attCount = 0;
int colorAttCount = 0;
int dsAttCount = 0;
bool srgbUpdateAndBlend = false;
};
......@@ -562,6 +563,7 @@ public:
r8Format(false),
r16Format(false),
floatFormats(false),
depthTexture(false),
srgbCapableDefaultFramebuffer(false)
{ }
int maxTextureSize;
......@@ -576,6 +578,7 @@ public:
uint r8Format : 1;
uint r16Format : 1;
uint floatFormats : 1;
uint depthTexture : 1;
uint srgbCapableDefaultFramebuffer : 1;
} caps;
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