Commit f75ab350 by Jamie Madill

Make ClearParameters an rx-only type.

This legacy struct duplicates some methods in the gl::State. We can restrict its use to D3D and on newer back-ends use the State directly. BUG=angleproject:930 Change-Id: I2c298e76b072ee73f2b3e17f6696693031ce1f91 Reviewed-on: https://chromium-review.googlesource.com/258070Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 14fc83b6
...@@ -35,7 +35,7 @@ void State::initialize(const Caps& caps, GLuint clientVersion) ...@@ -35,7 +35,7 @@ void State::initialize(const Caps& caps, GLuint clientVersion)
mMaxDrawBuffers = caps.maxDrawBuffers; mMaxDrawBuffers = caps.maxDrawBuffers;
mMaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits; mMaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits;
setClearColor(0.0f, 0.0f, 0.0f, 0.0f); setColorClearValue(0.0f, 0.0f, 0.0f, 0.0f);
mDepthClearValue = 1.0f; mDepthClearValue = 1.0f;
mStencilClearValue = 0; mStencilClearValue = 0;
...@@ -212,7 +212,7 @@ const DepthStencilState &State::getDepthStencilState() const ...@@ -212,7 +212,7 @@ const DepthStencilState &State::getDepthStencilState() const
return mDepthStencil; return mDepthStencil;
} }
void State::setClearColor(float red, float green, float blue, float alpha) void State::setColorClearValue(float red, float green, float blue, float alpha)
{ {
mColorClearValue.red = red; mColorClearValue.red = red;
mColorClearValue.green = green; mColorClearValue.green = green;
...@@ -220,70 +220,16 @@ void State::setClearColor(float red, float green, float blue, float alpha) ...@@ -220,70 +220,16 @@ void State::setClearColor(float red, float green, float blue, float alpha)
mColorClearValue.alpha = alpha; mColorClearValue.alpha = alpha;
} }
void State::setClearDepth(float depth) void State::setDepthClearValue(float depth)
{ {
mDepthClearValue = depth; mDepthClearValue = depth;
} }
void State::setClearStencil(int stencil) void State::setStencilClearValue(int stencil)
{ {
mStencilClearValue = stencil; mStencilClearValue = stencil;
} }
ClearParameters State::getClearParameters(GLbitfield mask) const
{
ClearParameters clearParams;
memset(&clearParams, 0, sizeof(ClearParameters));
for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
{
clearParams.clearColor[i] = false;
}
clearParams.colorFClearValue = mColorClearValue;
clearParams.colorClearType = GL_FLOAT;
clearParams.colorMaskRed = mBlend.colorMaskRed;
clearParams.colorMaskGreen = mBlend.colorMaskGreen;
clearParams.colorMaskBlue = mBlend.colorMaskBlue;
clearParams.colorMaskAlpha = mBlend.colorMaskAlpha;
clearParams.clearDepth = false;
clearParams.depthClearValue = mDepthClearValue;
clearParams.clearStencil = false;
clearParams.stencilClearValue = mStencilClearValue;
clearParams.stencilWriteMask = mDepthStencil.stencilWritemask;
clearParams.scissorEnabled = mScissorTest;
clearParams.scissor = mScissor;
const Framebuffer *framebufferObject = getDrawFramebuffer();
if (mask & GL_COLOR_BUFFER_BIT)
{
if (framebufferObject->hasEnabledColorAttachment())
{
for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
{
clearParams.clearColor[i] = true;
}
}
}
if (mask & GL_DEPTH_BUFFER_BIT)
{
if (mDepthStencil.depthMask && framebufferObject->getDepthbuffer() != NULL)
{
clearParams.clearDepth = true;
}
}
if (mask & GL_STENCIL_BUFFER_BIT)
{
if (framebufferObject->getStencilbuffer() != NULL &&
framebufferObject->getStencilbuffer()->getStencilSize() > 0)
{
clearParams.clearStencil = true;
}
}
return clearParams;
}
void State::setColorMask(bool red, bool green, bool blue, bool alpha) void State::setColorMask(bool red, bool green, bool blue, bool alpha)
{ {
mBlend.colorMaskRed = red; mBlend.colorMaskRed = red;
......
...@@ -44,10 +44,13 @@ class State ...@@ -44,10 +44,13 @@ class State
const DepthStencilState &getDepthStencilState() const; const DepthStencilState &getDepthStencilState() const;
// Clear behavior setters & state parameter block generation function // Clear behavior setters & state parameter block generation function
void setClearColor(float red, float green, float blue, float alpha); void setColorClearValue(float red, float green, float blue, float alpha);
void setClearDepth(float depth); void setDepthClearValue(float depth);
void setClearStencil(int stencil); void setStencilClearValue(int stencil);
ClearParameters getClearParameters(GLbitfield mask) const;
const ColorF &getColorClearValue() const { return mColorClearValue; }
float getDepthClearValue() const { return mDepthClearValue; }
int getStencilClearValue() const { return mStencilClearValue; }
// Write mask manipulation // Write mask manipulation
void setColorMask(bool red, bool green, bool blue, bool alpha); void setColorMask(bool red, bool green, bool blue, bool alpha);
......
...@@ -183,29 +183,6 @@ struct SamplerState ...@@ -183,29 +183,6 @@ struct SamplerState
bool operator!=(const SamplerState &other) const; bool operator!=(const SamplerState &other) const;
}; };
struct ClearParameters
{
bool clearColor[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS];
ColorF colorFClearValue;
ColorI colorIClearValue;
ColorUI colorUIClearValue;
GLenum colorClearType;
bool colorMaskRed;
bool colorMaskGreen;
bool colorMaskBlue;
bool colorMaskAlpha;
bool clearDepth;
float depthClearValue;
bool clearStencil;
GLint stencilClearValue;
GLuint stencilWriteMask;
bool scissorEnabled;
Rectangle scissor;
};
struct PixelUnpackState struct PixelUnpackState
{ {
BindingPointer<Buffer> pixelBuffer; BindingPointer<Buffer> pixelBuffer;
......
...@@ -18,6 +18,68 @@ ...@@ -18,6 +18,68 @@
namespace rx namespace rx
{ {
namespace
{
ClearParameters GetClearParameters(const gl::State &state, GLbitfield mask)
{
ClearParameters clearParams;
memset(&clearParams, 0, sizeof(ClearParameters));
const auto &blendState = state.getBlendState();
for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
{
clearParams.clearColor[i] = false;
}
clearParams.colorFClearValue = state.getColorClearValue();
clearParams.colorClearType = GL_FLOAT;
clearParams.colorMaskRed = blendState.colorMaskRed;
clearParams.colorMaskGreen = blendState.colorMaskGreen;
clearParams.colorMaskBlue = blendState.colorMaskBlue;
clearParams.colorMaskAlpha = blendState.colorMaskAlpha;
clearParams.clearDepth = false;
clearParams.depthClearValue = state.getDepthClearValue();
clearParams.clearStencil = false;
clearParams.stencilClearValue = state.getStencilClearValue();
clearParams.stencilWriteMask = state.getDepthStencilState().stencilWritemask;
clearParams.scissorEnabled = state.isScissorTestEnabled();
clearParams.scissor = state.getScissor();
const gl::Framebuffer *framebufferObject = state.getDrawFramebuffer();
if (mask & GL_COLOR_BUFFER_BIT)
{
if (framebufferObject->hasEnabledColorAttachment())
{
for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
{
clearParams.clearColor[i] = true;
}
}
}
if (mask & GL_DEPTH_BUFFER_BIT)
{
if (state.getDepthStencilState().depthMask && framebufferObject->getDepthbuffer() != NULL)
{
clearParams.clearDepth = true;
}
}
if (mask & GL_STENCIL_BUFFER_BIT)
{
if (framebufferObject->getStencilbuffer() != NULL &&
framebufferObject->getStencilbuffer()->getStencilSize() > 0)
{
clearParams.clearStencil = true;
}
}
return clearParams;
}
}
DefaultAttachmentD3D::DefaultAttachmentD3D(RenderTargetD3D *renderTarget) DefaultAttachmentD3D::DefaultAttachmentD3D(RenderTargetD3D *renderTarget)
: mRenderTarget(renderTarget) : mRenderTarget(renderTarget)
{ {
...@@ -113,14 +175,14 @@ gl::Error FramebufferD3D::invalidateSub(size_t, const GLenum *, const gl::Rectan ...@@ -113,14 +175,14 @@ gl::Error FramebufferD3D::invalidateSub(size_t, const GLenum *, const gl::Rectan
gl::Error FramebufferD3D::clear(const gl::State &state, GLbitfield mask) gl::Error FramebufferD3D::clear(const gl::State &state, GLbitfield mask)
{ {
gl::ClearParameters clearParams = state.getClearParameters(mask); ClearParameters clearParams = GetClearParameters(state, mask);
return clear(state, clearParams); return clear(state, clearParams);
} }
gl::Error FramebufferD3D::clearBufferfv(const gl::State &state, GLenum buffer, GLint drawbuffer, const GLfloat *values) gl::Error FramebufferD3D::clearBufferfv(const gl::State &state, GLenum buffer, GLint drawbuffer, const GLfloat *values)
{ {
// glClearBufferfv can be called to clear the color buffer or depth buffer // glClearBufferfv can be called to clear the color buffer or depth buffer
gl::ClearParameters clearParams = state.getClearParameters(0); ClearParameters clearParams = GetClearParameters(state, 0);
if (buffer == GL_COLOR) if (buffer == GL_COLOR)
{ {
...@@ -144,7 +206,7 @@ gl::Error FramebufferD3D::clearBufferfv(const gl::State &state, GLenum buffer, G ...@@ -144,7 +206,7 @@ gl::Error FramebufferD3D::clearBufferfv(const gl::State &state, GLenum buffer, G
gl::Error FramebufferD3D::clearBufferuiv(const gl::State &state, GLenum buffer, GLint drawbuffer, const GLuint *values) gl::Error FramebufferD3D::clearBufferuiv(const gl::State &state, GLenum buffer, GLint drawbuffer, const GLuint *values)
{ {
// glClearBufferuiv can only be called to clear a color buffer // glClearBufferuiv can only be called to clear a color buffer
gl::ClearParameters clearParams = state.getClearParameters(0); ClearParameters clearParams = GetClearParameters(state, 0);
for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++) for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
{ {
clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i)); clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
...@@ -158,7 +220,7 @@ gl::Error FramebufferD3D::clearBufferuiv(const gl::State &state, GLenum buffer, ...@@ -158,7 +220,7 @@ gl::Error FramebufferD3D::clearBufferuiv(const gl::State &state, GLenum buffer,
gl::Error FramebufferD3D::clearBufferiv(const gl::State &state, GLenum buffer, GLint drawbuffer, const GLint *values) gl::Error FramebufferD3D::clearBufferiv(const gl::State &state, GLenum buffer, GLint drawbuffer, const GLint *values)
{ {
// glClearBufferiv can be called to clear the color buffer or stencil buffer // glClearBufferiv can be called to clear the color buffer or stencil buffer
gl::ClearParameters clearParams = state.getClearParameters(0); ClearParameters clearParams = GetClearParameters(state, 0);
if (buffer == GL_COLOR) if (buffer == GL_COLOR)
{ {
...@@ -182,7 +244,7 @@ gl::Error FramebufferD3D::clearBufferiv(const gl::State &state, GLenum buffer, G ...@@ -182,7 +244,7 @@ gl::Error FramebufferD3D::clearBufferiv(const gl::State &state, GLenum buffer, G
gl::Error FramebufferD3D::clearBufferfi(const gl::State &state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) gl::Error FramebufferD3D::clearBufferfi(const gl::State &state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
{ {
// glClearBufferfi can only be called to clear a depth stencil buffer // glClearBufferfi can only be called to clear a depth stencil buffer
gl::ClearParameters clearParams = state.getClearParameters(0); ClearParameters clearParams = GetClearParameters(state, 0);
clearParams.clearDepth = true; clearParams.clearDepth = true;
clearParams.depthClearValue = depth; clearParams.depthClearValue = depth;
clearParams.clearStencil = true; clearParams.clearStencil = true;
......
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
#ifndef LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_ #ifndef LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
#define LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_ #define LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
#include "libANGLE/renderer/DefaultAttachmentImpl.h"
#include "libANGLE/renderer/FramebufferImpl.h"
#include <vector> #include <vector>
#include <cstdint> #include <cstdint>
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/DefaultAttachmentImpl.h"
#include "libANGLE/renderer/FramebufferImpl.h"
namespace gl namespace gl
{ {
struct ClearParameters;
class FramebufferAttachment; class FramebufferAttachment;
struct PixelPackState; struct PixelPackState;
} }
...@@ -27,6 +27,29 @@ namespace rx ...@@ -27,6 +27,29 @@ namespace rx
class RenderTargetD3D; class RenderTargetD3D;
class RendererD3D; class RendererD3D;
struct ClearParameters
{
bool clearColor[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS];
gl::ColorF colorFClearValue;
gl::ColorI colorIClearValue;
gl::ColorUI colorUIClearValue;
GLenum colorClearType;
bool colorMaskRed;
bool colorMaskGreen;
bool colorMaskBlue;
bool colorMaskAlpha;
bool clearDepth;
float depthClearValue;
bool clearStencil;
GLint stencilClearValue;
GLuint stencilWriteMask;
bool scissorEnabled;
gl::Rectangle scissor;
};
class DefaultAttachmentD3D : public DefaultAttachmentImpl class DefaultAttachmentD3D : public DefaultAttachmentImpl
{ {
public: public:
...@@ -92,7 +115,7 @@ class FramebufferD3D : public FramebufferImpl ...@@ -92,7 +115,7 @@ class FramebufferD3D : public FramebufferImpl
RendererD3D *const mRenderer; RendererD3D *const mRenderer;
virtual gl::Error clear(const gl::State &state, const gl::ClearParameters &clearParams) = 0; virtual gl::Error clear(const gl::State &state, const ClearParameters &clearParams) = 0;
virtual gl::Error readPixels(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch, virtual gl::Error readPixels(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch,
const gl::PixelPackState &pack, uint8_t *pixels) const = 0; const gl::PixelPackState &pack, uint8_t *pixels) const = 0;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h" #include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
...@@ -173,7 +174,7 @@ Clear11::~Clear11() ...@@ -173,7 +174,7 @@ Clear11::~Clear11()
SafeRelease(mRasterizerState); SafeRelease(mRasterizerState);
} }
gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, const gl::Framebuffer::Data &fboData) gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl::Framebuffer::Data &fboData)
{ {
const auto &colorAttachments = fboData.mColorAttachments; const auto &colorAttachments = fboData.mColorAttachments;
const auto &drawBufferStates = fboData.mDrawBufferStates; const auto &drawBufferStates = fboData.mDrawBufferStates;
...@@ -561,7 +562,7 @@ ID3D11BlendState *Clear11::getBlendState(const std::vector<MaskedRenderTarget>& ...@@ -561,7 +562,7 @@ ID3D11BlendState *Clear11::getBlendState(const std::vector<MaskedRenderTarget>&
} }
} }
ID3D11DepthStencilState *Clear11::getDepthStencilState(const gl::ClearParameters &clearParams) ID3D11DepthStencilState *Clear11::getDepthStencilState(const ClearParameters &clearParams)
{ {
ClearDepthStencilInfo dsKey = { 0 }; ClearDepthStencilInfo dsKey = { 0 };
dsKey.clearDepth = clearParams.clearDepth; dsKey.clearDepth = clearParams.clearDepth;
......
...@@ -9,17 +9,18 @@ ...@@ -9,17 +9,18 @@
#ifndef LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_ #ifndef LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
#define LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_ #define LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
#include <map>
#include <vector>
#include "libANGLE/angletypes.h" #include "libANGLE/angletypes.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include <map>
#include <vector>
namespace rx namespace rx
{ {
class Renderer11; class Renderer11;
class RenderTarget11; class RenderTarget11;
struct ClearParameters;
class Clear11 class Clear11
{ {
...@@ -28,18 +29,10 @@ class Clear11 ...@@ -28,18 +29,10 @@ class Clear11
~Clear11(); ~Clear11();
// Clears the framebuffer with the supplied clear parameters, assumes that the framebuffer is currently applied. // Clears the framebuffer with the supplied clear parameters, assumes that the framebuffer is currently applied.
gl::Error clearFramebuffer(const gl::ClearParameters &clearParams, const gl::Framebuffer::Data &fboData); gl::Error clearFramebuffer(const ClearParameters &clearParams, const gl::Framebuffer::Data &fboData);
private: private:
Renderer11 *mRenderer; DISALLOW_COPY_AND_ASSIGN(Clear11);
struct ClearBlendInfo
{
bool maskChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
};
typedef bool (*ClearBlendInfoComparisonFunction)(const ClearBlendInfo&, const ClearBlendInfo &);
typedef std::map<ClearBlendInfo, ID3D11BlendState*, ClearBlendInfoComparisonFunction> ClearBlendStateMap;
ClearBlendStateMap mClearBlendStates;
struct MaskedRenderTarget struct MaskedRenderTarget
{ {
...@@ -48,6 +41,7 @@ class Clear11 ...@@ -48,6 +41,7 @@ class Clear11
}; };
ID3D11BlendState *getBlendState(const std::vector<MaskedRenderTarget> &rts); ID3D11BlendState *getBlendState(const std::vector<MaskedRenderTarget> &rts);
ID3D11DepthStencilState *getDepthStencilState(const ClearParameters &clearParams);
struct ClearShader struct ClearShader
{ {
...@@ -55,13 +49,24 @@ class Clear11 ...@@ -55,13 +49,24 @@ class Clear11
ID3D11VertexShader *vertexShader; ID3D11VertexShader *vertexShader;
ID3D11PixelShader *pixelShader; ID3D11PixelShader *pixelShader;
}; };
template <unsigned int vsSize, unsigned int psSize>
static ClearShader CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE(&vsByteCode)[vsSize], const BYTE(&psByteCode)[psSize]);
Renderer11 *mRenderer;
struct ClearBlendInfo
{
bool maskChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
};
typedef bool(*ClearBlendInfoComparisonFunction)(const ClearBlendInfo&, const ClearBlendInfo &);
typedef std::map<ClearBlendInfo, ID3D11BlendState*, ClearBlendInfoComparisonFunction> ClearBlendStateMap;
ClearBlendStateMap mClearBlendStates;
ClearShader mFloatClearShader; ClearShader mFloatClearShader;
ClearShader mUintClearShader; ClearShader mUintClearShader;
ClearShader mIntClearShader; ClearShader mIntClearShader;
template <unsigned int vsSize, unsigned int psSize>
static ClearShader CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE (&vsByteCode)[vsSize], const BYTE (&psByteCode)[psSize]);
struct ClearDepthStencilInfo struct ClearDepthStencilInfo
{ {
bool clearDepth; bool clearDepth;
...@@ -72,8 +77,6 @@ class Clear11 ...@@ -72,8 +77,6 @@ class Clear11
typedef std::map<ClearDepthStencilInfo, ID3D11DepthStencilState*, ClearDepthStencilInfoComparisonFunction> ClearDepthStencilStateMap; typedef std::map<ClearDepthStencilInfo, ID3D11DepthStencilState*, ClearDepthStencilInfoComparisonFunction> ClearDepthStencilStateMap;
ClearDepthStencilStateMap mClearDepthStencilStates; ClearDepthStencilStateMap mClearDepthStencilStates;
ID3D11DepthStencilState *getDepthStencilState(const gl::ClearParameters &clearParams);
ID3D11Buffer *mVertexBuffer; ID3D11Buffer *mVertexBuffer;
ID3D11RasterizerState *mRasterizerState; ID3D11RasterizerState *mRasterizerState;
......
...@@ -88,7 +88,7 @@ gl::Error Framebuffer11::invalidateSwizzles() const ...@@ -88,7 +88,7 @@ gl::Error Framebuffer11::invalidateSwizzles() const
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
gl::Error Framebuffer11::clear(const gl::State &state, const gl::ClearParameters &clearParams) gl::Error Framebuffer11::clear(const gl::State &state, const ClearParameters &clearParams)
{ {
Clear11 *clearer = mRenderer->getClearer(); Clear11 *clearer = mRenderer->getClearer();
gl::Error error = clearer->clearFramebuffer(clearParams, mData); gl::Error error = clearer->clearFramebuffer(clearParams, mData);
......
...@@ -25,7 +25,7 @@ class Framebuffer11 : public FramebufferD3D ...@@ -25,7 +25,7 @@ class Framebuffer11 : public FramebufferD3D
gl::Error invalidateSwizzles() const; gl::Error invalidateSwizzles() const;
private: private:
gl::Error clear(const gl::State &state, const gl::ClearParameters &clearParams) override; gl::Error clear(const gl::State &state, const ClearParameters &clearParams) override;
gl::Error readPixels(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch, gl::Error readPixels(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch,
const gl::PixelPackState &pack, uint8_t *pixels) const override; const gl::PixelPackState &pack, uint8_t *pixels) const override;
......
...@@ -32,7 +32,7 @@ Framebuffer9::~Framebuffer9() ...@@ -32,7 +32,7 @@ Framebuffer9::~Framebuffer9()
{ {
} }
gl::Error Framebuffer9::clear(const gl::State &state, const gl::ClearParameters &clearParams) gl::Error Framebuffer9::clear(const gl::State &state, const ClearParameters &clearParams)
{ {
const gl::FramebufferAttachment *colorAttachment = mData.mColorAttachments[0]; const gl::FramebufferAttachment *colorAttachment = mData.mColorAttachments[0];
const gl::FramebufferAttachment *depthStencilAttachment = mData.getDepthOrStencilAttachment(); const gl::FramebufferAttachment *depthStencilAttachment = mData.getDepthOrStencilAttachment();
......
...@@ -22,7 +22,7 @@ class Framebuffer9 : public FramebufferD3D ...@@ -22,7 +22,7 @@ class Framebuffer9 : public FramebufferD3D
virtual ~Framebuffer9(); virtual ~Framebuffer9();
private: private:
gl::Error clear(const gl::State &state, const gl::ClearParameters &clearParams) override; gl::Error clear(const gl::State &state, const ClearParameters &clearParams) override;
gl::Error readPixels(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch, gl::Error readPixels(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch,
const gl::PixelPackState &pack, uint8_t *pixels) const override; const gl::PixelPackState &pack, uint8_t *pixels) const override;
......
...@@ -1969,7 +1969,8 @@ void Renderer9::applyUniformnbv(gl::LinkedUniform *targetUniform, const GLint *v ...@@ -1969,7 +1969,8 @@ void Renderer9::applyUniformnbv(gl::LinkedUniform *targetUniform, const GLint *v
applyUniformnfv(targetUniform, (GLfloat*)vector); applyUniformnfv(targetUniform, (GLfloat*)vector);
} }
gl::Error Renderer9::clear(const gl::ClearParameters &clearParams, const gl::FramebufferAttachment *colorBuffer, gl::Error Renderer9::clear(const ClearParameters &clearParams,
const gl::FramebufferAttachment *colorBuffer,
const gl::FramebufferAttachment *depthStencilBuffer) const gl::FramebufferAttachment *depthStencilBuffer)
{ {
if (clearParams.colorClearType != GL_FLOAT) if (clearParams.colorClearType != GL_FLOAT)
......
...@@ -29,12 +29,13 @@ class AttributeMap; ...@@ -29,12 +29,13 @@ class AttributeMap;
namespace rx namespace rx
{ {
class VertexDataManager; class Blit9;
class IndexDataManager; class IndexDataManager;
class StreamingIndexBufferInterface; class StreamingIndexBufferInterface;
class StaticIndexBufferInterface; class StaticIndexBufferInterface;
class VertexDataManager;
struct ClearParameters;
struct TranslatedAttribute; struct TranslatedAttribute;
class Blit9;
enum D3D9InitError enum D3D9InitError
{ {
...@@ -116,7 +117,8 @@ class Renderer9 : public RendererD3D ...@@ -116,7 +117,8 @@ class Renderer9 : public RendererD3D
virtual gl::Error drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, virtual gl::Error drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances); gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances);
gl::Error clear(const gl::ClearParameters &clearParams, const gl::FramebufferAttachment *colorBuffer, gl::Error clear(const ClearParameters &clearParams,
const gl::FramebufferAttachment *colorBuffer,
const gl::FramebufferAttachment *depthStencilBuffer); const gl::FramebufferAttachment *depthStencilBuffer);
virtual void markAllStateDirty(); virtual void markAllStateDirty();
......
...@@ -645,7 +645,7 @@ void GL_APIENTRY ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclamp ...@@ -645,7 +645,7 @@ void GL_APIENTRY ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclamp
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
context->getState().setClearColor(red, green, blue, alpha); context->getState().setColorClearValue(red, green, blue, alpha);
} }
} }
...@@ -656,7 +656,7 @@ void GL_APIENTRY ClearDepthf(GLclampf depth) ...@@ -656,7 +656,7 @@ void GL_APIENTRY ClearDepthf(GLclampf depth)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
context->getState().setClearDepth(depth); context->getState().setDepthClearValue(depth);
} }
} }
...@@ -667,7 +667,7 @@ void GL_APIENTRY ClearStencil(GLint s) ...@@ -667,7 +667,7 @@ void GL_APIENTRY ClearStencil(GLint s)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
context->getState().setClearStencil(s); context->getState().setStencilClearValue(s);
} }
} }
......
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