Commit 3cb4894c by Jamie Madill Committed by Commit Bot

Make TextureD3D::clearLevel work with depth/stencil.

Although we only used this method in one place that didn't need to clear depth or stencil, the method itself doesn't seem like it should be limited. It will become useful in later patches which initialize depth and stencil textures robustly. BUG=angleproject:2107 Change-Id: I7dc67608972f2b31c0cb4d309941be10f47d1d47 Reviewed-on: https://chromium-review.googlesource.com/585600Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 977ee7eb
......@@ -170,7 +170,7 @@ gl::Texture *RendererD3D::getIncompleteTexture(const gl::Context *context, GLenu
{
gl::ColorF clearValue(0, 0, 0, 1);
gl::ImageIndex index = gl::ImageIndex::Make2DMultisample();
GetImplAs<TextureD3D>(t)->clearLevel(context, index, clearValue);
GetImplAs<TextureD3D>(t)->clearLevel(context, index, clearValue, 1.0f, 0);
}
else
{
......
......@@ -295,7 +295,9 @@ class RendererD3D : public BufferFactoryD3D
GLint64 getTimestamp();
virtual gl::Error clearRenderTarget(RenderTargetD3D *renderTarget,
const gl::ColorF &clearValues) = 0;
const gl::ColorF &clearColorValue,
const float clearDepthValue,
const unsigned int clearStencilValue) = 0;
virtual egl::Error getEGLDevice(DeviceImpl **device) = 0;
......
......@@ -635,14 +635,17 @@ void TextureD3D::syncState(const gl::Texture::DirtyBits &dirtyBits)
gl::Error TextureD3D::clearLevel(const gl::Context *context,
const gl::ImageIndex &index,
const gl::ColorF &clearValues)
const gl::ColorF &clearColorValue,
const float clearDepthValue,
const unsigned int clearStencilValue)
{
TextureStorage *storage = nullptr;
ANGLE_TRY(getNativeTexture(context, &storage));
RenderTargetD3D *renderTargetD3D = nullptr;
ANGLE_TRY(storage->getRenderTarget(context, index, &renderTargetD3D));
mRenderer->clearRenderTarget(renderTargetD3D, clearValues);
mRenderer->clearRenderTarget(renderTargetD3D, clearColorValue, clearDepthValue,
clearStencilValue);
return gl::NoError();
}
......
......@@ -102,7 +102,9 @@ class TextureD3D : public TextureImpl
gl::Error clearLevel(const gl::Context *context,
const gl::ImageIndex &index,
const gl::ColorF &clearValues);
const gl::ColorF &clearColorValue,
const float clearDepthValue,
const unsigned int clearStencilValue);
protected:
gl::Error setImageImpl(const gl::Context *context,
......
......@@ -4606,12 +4606,15 @@ gl::Error Renderer11::getSamplerState(const gl::SamplerState &samplerState,
}
gl::Error Renderer11::clearRenderTarget(RenderTargetD3D *renderTarget,
const gl::ColorF &clearValues)
const gl::ColorF &clearColorValue,
const float clearDepthValue,
const unsigned int clearStencilValue)
{
RenderTarget11 *renderTarget11 = GetAs<RenderTarget11>(renderTarget);
const d3d11::RenderTargetView &rtv = renderTarget11->getRenderTargetView();
ASSERT(rtv.valid());
mDeviceContext->ClearRenderTargetView(rtv.get(), &clearValues.red);
mDeviceContext->ClearRenderTargetView(rtv.get(), &clearColorValue.red);
return gl::NoError();
}
......
......@@ -468,7 +468,9 @@ class Renderer11 : public RendererD3D
TextureHelper11 *textureOut);
gl::Error clearRenderTarget(RenderTargetD3D *renderTarget,
const gl::ColorF &clearValues) override;
const gl::ColorF &clearColorValue,
const float clearDepthValue,
const unsigned int clearStencilValue) override;
private:
gl::Error drawArraysImpl(const gl::Context *context,
......
......@@ -3214,7 +3214,10 @@ gl::Error Renderer9::applyComputeUniforms(const ProgramD3D &programD3D,
return gl::InternalError() << "Compute shader is not implemented on D3D9";
}
gl::Error Renderer9::clearRenderTarget(RenderTargetD3D *renderTarget, const gl::ColorF &clearValues)
gl::Error Renderer9::clearRenderTarget(RenderTargetD3D *renderTarget,
const gl::ColorF &clearColorValue,
const float clearDepthValue,
const unsigned int clearStencilValue)
{
UNIMPLEMENTED();
return gl::InternalError() << "clearRenderTarget is not implemented on D3D9";
......
......@@ -395,7 +395,9 @@ class Renderer9 : public RendererD3D
const std::vector<D3DUniform *> &uniformArray) override;
gl::Error clearRenderTarget(RenderTargetD3D *renderTarget,
const gl::ColorF &clearValues) override;
const gl::ColorF &clearColorValue,
const float clearDepthValue,
const unsigned int clearStencilValue) override;
private:
gl::Error drawArraysImpl(const gl::ContextState &data,
......
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