Commit 48ef11b2 by Jamie Madill Committed by Commit Bot

Rename gl::Framebuffer::Data to gl::FramebufferState.

Moving this out of the Framebuffer class allows us to forward- declare it. BUG=angleproject:1363 Change-Id: I91971c37a92151df508cdf7f0eb8c3e93506d112 Reviewed-on: https://chromium-review.googlesource.com/340741Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 3d63bc79
...@@ -35,6 +35,7 @@ class Surface; ...@@ -35,6 +35,7 @@ class Surface;
namespace gl namespace gl
{ {
class Context; class Context;
class Framebuffer;
class Renderbuffer; class Renderbuffer;
class State; class State;
class Texture; class Texture;
...@@ -45,46 +46,48 @@ struct Extensions; ...@@ -45,46 +46,48 @@ struct Extensions;
struct ImageIndex; struct ImageIndex;
struct Rectangle; struct Rectangle;
class Framebuffer final : public LabeledObject class FramebufferState final : angle::NonCopyable
{ {
public: public:
FramebufferState();
class Data final : angle::NonCopyable explicit FramebufferState(const Caps &caps);
~FramebufferState();
const std::string &getLabel();
const FramebufferAttachment *getReadAttachment() const;
const FramebufferAttachment *getFirstColorAttachment() const;
const FramebufferAttachment *getDepthOrStencilAttachment() const;
const FramebufferAttachment *getColorAttachment(size_t colorAttachment) const;
const FramebufferAttachment *getDepthAttachment() const;
const FramebufferAttachment *getStencilAttachment() const;
const FramebufferAttachment *getDepthStencilAttachment() const;
const std::vector<GLenum> &getDrawBufferStates() const { return mDrawBufferStates; }
GLenum getReadBufferState() const { return mReadBufferState; }
const std::vector<FramebufferAttachment> &getColorAttachments() const
{ {
public: return mColorAttachments;
explicit Data(); }
explicit Data(const Caps &caps);
~Data();
const std::string &getLabel();
const FramebufferAttachment *getReadAttachment() const;
const FramebufferAttachment *getFirstColorAttachment() const;
const FramebufferAttachment *getDepthOrStencilAttachment() const;
const FramebufferAttachment *getColorAttachment(size_t colorAttachment) const;
const FramebufferAttachment *getDepthAttachment() const;
const FramebufferAttachment *getStencilAttachment() const;
const FramebufferAttachment *getDepthStencilAttachment() const;
const std::vector<GLenum> &getDrawBufferStates() const { return mDrawBufferStates; }
GLenum getReadBufferState() const { return mReadBufferState; }
const std::vector<FramebufferAttachment> &getColorAttachments() const { return mColorAttachments; }
bool attachmentsHaveSameDimensions() const; bool attachmentsHaveSameDimensions() const;
private: private:
friend class Framebuffer; friend class Framebuffer;
std::string mLabel; std::string mLabel;
std::vector<FramebufferAttachment> mColorAttachments; std::vector<FramebufferAttachment> mColorAttachments;
FramebufferAttachment mDepthAttachment; FramebufferAttachment mDepthAttachment;
FramebufferAttachment mStencilAttachment; FramebufferAttachment mStencilAttachment;
std::vector<GLenum> mDrawBufferStates; std::vector<GLenum> mDrawBufferStates;
GLenum mReadBufferState; GLenum mReadBufferState;
}; };
class Framebuffer final : public LabeledObject
{
public:
Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id); Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id);
Framebuffer(rx::SurfaceImpl *surface); Framebuffer(rx::SurfaceImpl *surface);
virtual ~Framebuffer(); virtual ~Framebuffer();
...@@ -195,7 +198,7 @@ class Framebuffer final : public LabeledObject ...@@ -195,7 +198,7 @@ class Framebuffer final : public LabeledObject
protected: protected:
void detachResourceById(GLenum resourceType, GLuint resourceId); void detachResourceById(GLenum resourceType, GLuint resourceId);
Data mData; FramebufferState mState;
rx::FramebufferImpl *mImpl; rx::FramebufferImpl *mImpl;
GLuint mId; GLuint mId;
......
...@@ -137,86 +137,80 @@ struct VariableLocation ...@@ -137,86 +137,80 @@ struct VariableLocation
bool ignored; bool ignored;
}; };
class Program final : angle::NonCopyable, public LabeledObject class ProgramState final : angle::NonCopyable
{ {
public: public:
class Data final : angle::NonCopyable ProgramState();
{ ~ProgramState();
public:
Data();
~Data();
const std::string &getLabel(); const std::string &getLabel();
const Shader *getAttachedVertexShader() const { return mAttachedVertexShader; } const Shader *getAttachedVertexShader() const { return mAttachedVertexShader; }
const Shader *getAttachedFragmentShader() const { return mAttachedFragmentShader; } const Shader *getAttachedFragmentShader() const { return mAttachedFragmentShader; }
const std::vector<std::string> &getTransformFeedbackVaryingNames() const const std::vector<std::string> &getTransformFeedbackVaryingNames() const
{ {
return mTransformFeedbackVaryingNames; return mTransformFeedbackVaryingNames;
} }
GLint getTransformFeedbackBufferMode() const { return mTransformFeedbackBufferMode; } GLint getTransformFeedbackBufferMode() const { return mTransformFeedbackBufferMode; }
GLuint getUniformBlockBinding(GLuint uniformBlockIndex) const GLuint getUniformBlockBinding(GLuint uniformBlockIndex) const
{ {
ASSERT(uniformBlockIndex < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS); ASSERT(uniformBlockIndex < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS);
return mUniformBlockBindings[uniformBlockIndex]; return mUniformBlockBindings[uniformBlockIndex];
} }
const UniformBlockBindingMask &getActiveUniformBlockBindingsMask() const const UniformBlockBindingMask &getActiveUniformBlockBindingsMask() const
{ {
return mActiveUniformBlockBindings; return mActiveUniformBlockBindings;
} }
const std::vector<sh::Attribute> &getAttributes() const { return mAttributes; } const std::vector<sh::Attribute> &getAttributes() const { return mAttributes; }
const AttributesMask &getActiveAttribLocationsMask() const const AttributesMask &getActiveAttribLocationsMask() const
{ {
return mActiveAttribLocationsMask; return mActiveAttribLocationsMask;
} }
const std::map<int, VariableLocation> &getOutputVariables() const const std::map<int, VariableLocation> &getOutputVariables() const { return mOutputVariables; }
{ const std::vector<LinkedUniform> &getUniforms() const { return mUniforms; }
return mOutputVariables; const std::vector<VariableLocation> &getUniformLocations() const { return mUniformLocations; }
} const std::vector<UniformBlock> &getUniformBlocks() const { return mUniformBlocks; }
const std::vector<LinkedUniform> &getUniforms() const { return mUniforms; }
const std::vector<VariableLocation> &getUniformLocations() const
{
return mUniformLocations;
}
const std::vector<UniformBlock> &getUniformBlocks() const { return mUniformBlocks; }
const LinkedUniform *getUniformByName(const std::string &name) const; const LinkedUniform *getUniformByName(const std::string &name) const;
GLint getUniformLocation(const std::string &name) const; GLint getUniformLocation(const std::string &name) const;
GLuint getUniformIndex(const std::string &name) const; GLuint getUniformIndex(const std::string &name) const;
private: private:
friend class Program; friend class Program;
std::string mLabel; std::string mLabel;
Shader *mAttachedFragmentShader; Shader *mAttachedFragmentShader;
Shader *mAttachedVertexShader; Shader *mAttachedVertexShader;
std::vector<std::string> mTransformFeedbackVaryingNames; std::vector<std::string> mTransformFeedbackVaryingNames;
std::vector<sh::Varying> mTransformFeedbackVaryingVars; std::vector<sh::Varying> mTransformFeedbackVaryingVars;
GLenum mTransformFeedbackBufferMode; GLenum mTransformFeedbackBufferMode;
GLuint mUniformBlockBindings[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS]; GLuint mUniformBlockBindings[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
UniformBlockBindingMask mActiveUniformBlockBindings; UniformBlockBindingMask mActiveUniformBlockBindings;
std::vector<sh::Attribute> mAttributes; std::vector<sh::Attribute> mAttributes;
std::bitset<MAX_VERTEX_ATTRIBS> mActiveAttribLocationsMask; std::bitset<MAX_VERTEX_ATTRIBS> mActiveAttribLocationsMask;
// Uniforms are sorted in order: // Uniforms are sorted in order:
// 1. Non-sampler uniforms // 1. Non-sampler uniforms
// 2. Sampler uniforms // 2. Sampler uniforms
// 3. Uniform block uniforms // 3. Uniform block uniforms
// This makes sampler validation easier, since we don't need a separate list. // This makes sampler validation easier, since we don't need a separate list.
std::vector<LinkedUniform> mUniforms; std::vector<LinkedUniform> mUniforms;
std::vector<VariableLocation> mUniformLocations; std::vector<VariableLocation> mUniformLocations;
std::vector<UniformBlock> mUniformBlocks; std::vector<UniformBlock> mUniformBlocks;
// TODO(jmadill): use unordered/hash map when available // TODO(jmadill): use unordered/hash map when available
std::map<int, VariableLocation> mOutputVariables; std::map<int, VariableLocation> mOutputVariables;
bool mBinaryRetrieveableHint; bool mBinaryRetrieveableHint;
}; };
class Program final : angle::NonCopyable, public LabeledObject
{
public:
Program(rx::ImplFactory *factory, ResourceManager *manager, GLuint handle); Program(rx::ImplFactory *factory, ResourceManager *manager, GLuint handle);
~Program(); ~Program();
...@@ -254,7 +248,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -254,7 +248,7 @@ class Program final : angle::NonCopyable, public LabeledObject
void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
GLint getActiveAttributeCount() const; GLint getActiveAttributeCount() const;
GLint getActiveAttributeMaxLength() const; GLint getActiveAttributeMaxLength() const;
const std::vector<sh::Attribute> &getAttributes() const { return mData.mAttributes; } const std::vector<sh::Attribute> &getAttributes() const { return mState.mAttributes; }
GLint getFragDataLocation(const std::string &name) const; GLint getFragDataLocation(const std::string &name) const;
...@@ -332,7 +326,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -332,7 +326,7 @@ class Program final : angle::NonCopyable, public LabeledObject
const AttributesMask &getActiveAttribLocationsMask() const const AttributesMask &getActiveAttribLocationsMask() const
{ {
return mData.mActiveAttribLocationsMask; return mState.mActiveAttribLocationsMask;
} }
private: private:
...@@ -424,7 +418,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -424,7 +418,7 @@ class Program final : angle::NonCopyable, public LabeledObject
template <typename DestT> template <typename DestT>
void getUniformInternal(GLint location, DestT *dataOut) const; void getUniformInternal(GLint location, DestT *dataOut) const;
Data mData; ProgramState mState;
rx::ProgramImpl *mProgram; rx::ProgramImpl *mProgram;
bool mValidated; bool mValidated;
......
...@@ -26,8 +26,7 @@ class MockSurfaceImpl : public rx::SurfaceImpl ...@@ -26,8 +26,7 @@ class MockSurfaceImpl : public rx::SurfaceImpl
virtual ~MockSurfaceImpl() { destroy(); } virtual ~MockSurfaceImpl() { destroy(); }
MOCK_METHOD0(initialize, egl::Error()); MOCK_METHOD0(initialize, egl::Error());
MOCK_METHOD1(createDefaultFramebuffer, MOCK_METHOD1(createDefaultFramebuffer, rx::FramebufferImpl *(const gl::FramebufferState &data));
rx::FramebufferImpl *(const gl::Framebuffer::Data &data));
MOCK_METHOD0(swap, egl::Error()); MOCK_METHOD0(swap, egl::Error());
MOCK_METHOD4(postSubBuffer, egl::Error(EGLint, EGLint, EGLint, EGLint)); MOCK_METHOD4(postSubBuffer, egl::Error(EGLint, EGLint, EGLint, EGLint));
MOCK_METHOD2(querySurfacePointerANGLE, egl::Error(EGLint, void**)); MOCK_METHOD2(querySurfacePointerANGLE, egl::Error(EGLint, void**));
......
...@@ -28,7 +28,7 @@ namespace rx ...@@ -28,7 +28,7 @@ namespace rx
class FramebufferImpl : angle::NonCopyable class FramebufferImpl : angle::NonCopyable
{ {
public: public:
explicit FramebufferImpl(const gl::Framebuffer::Data &data) : mData(data) { } explicit FramebufferImpl(const gl::FramebufferState &state) : mState(state) {}
virtual ~FramebufferImpl() { } virtual ~FramebufferImpl() { }
virtual gl::Error discard(size_t count, const GLenum *attachments) = 0; virtual gl::Error discard(size_t count, const GLenum *attachments) = 0;
...@@ -65,10 +65,10 @@ class FramebufferImpl : angle::NonCopyable ...@@ -65,10 +65,10 @@ class FramebufferImpl : angle::NonCopyable
virtual void syncState(const gl::Framebuffer::DirtyBits &dirtyBits) = 0; virtual void syncState(const gl::Framebuffer::DirtyBits &dirtyBits) = 0;
const gl::Framebuffer::Data &getData() const { return mData; } const gl::FramebufferState &getState() const { return mState; }
protected: protected:
const gl::Framebuffer::Data &mData; const gl::FramebufferState &mState;
}; };
} }
......
...@@ -20,7 +20,7 @@ namespace rx ...@@ -20,7 +20,7 @@ namespace rx
class MockFramebufferImpl : public rx::FramebufferImpl class MockFramebufferImpl : public rx::FramebufferImpl
{ {
public: public:
MockFramebufferImpl() : rx::FramebufferImpl(gl::Framebuffer::Data()) {} MockFramebufferImpl() : rx::FramebufferImpl(gl::FramebufferState()) {}
virtual ~MockFramebufferImpl() { destroy(); } virtual ~MockFramebufferImpl() { destroy(); }
MOCK_METHOD2(discard, gl::Error(size_t, const GLenum *)); MOCK_METHOD2(discard, gl::Error(size_t, const GLenum *));
......
...@@ -41,10 +41,10 @@ class ImplFactory : angle::NonCopyable ...@@ -41,10 +41,10 @@ class ImplFactory : angle::NonCopyable
// Shader creation // Shader creation
virtual CompilerImpl *createCompiler() = 0; virtual CompilerImpl *createCompiler() = 0;
virtual ShaderImpl *createShader(const gl::Shader::Data &data) = 0; virtual ShaderImpl *createShader(const gl::Shader::Data &data) = 0;
virtual ProgramImpl *createProgram(const gl::Program::Data &data) = 0; virtual ProgramImpl *createProgram(const gl::ProgramState &data) = 0;
// Framebuffer creation // Framebuffer creation
virtual FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) = 0; virtual FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) = 0;
// Texture creation // Texture creation
virtual TextureImpl *createTexture(GLenum target) = 0; virtual TextureImpl *createTexture(GLenum target) = 0;
......
...@@ -32,7 +32,7 @@ struct LinkResult ...@@ -32,7 +32,7 @@ struct LinkResult
class ProgramImpl : angle::NonCopyable class ProgramImpl : angle::NonCopyable
{ {
public: public:
ProgramImpl(const gl::Program::Data &data) : mData(data) {} ProgramImpl(const gl::ProgramState &state) : mState(state) {}
virtual ~ProgramImpl() {} virtual ~ProgramImpl() {}
virtual LinkResult load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) = 0; virtual LinkResult load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) = 0;
...@@ -77,7 +77,7 @@ class ProgramImpl : angle::NonCopyable ...@@ -77,7 +77,7 @@ class ProgramImpl : angle::NonCopyable
sh::BlockMemberInfo *memberInfoOut) const = 0; sh::BlockMemberInfo *memberInfoOut) const = 0;
protected: protected:
const gl::Program::Data &mData; const gl::ProgramState &mState;
}; };
} }
......
...@@ -20,7 +20,7 @@ namespace rx ...@@ -20,7 +20,7 @@ namespace rx
class MockProgramImpl : public rx::ProgramImpl class MockProgramImpl : public rx::ProgramImpl
{ {
public: public:
MockProgramImpl() : ProgramImpl(gl::Program::Data()) {} MockProgramImpl() : ProgramImpl(gl::ProgramState()) {}
virtual ~MockProgramImpl() { destroy(); } virtual ~MockProgramImpl() { destroy(); }
MOCK_METHOD2(load, LinkResult(gl::InfoLog &, gl::BinaryInputStream *)); MOCK_METHOD2(load, LinkResult(gl::InfoLog &, gl::BinaryInputStream *));
......
...@@ -11,9 +11,13 @@ ...@@ -11,9 +11,13 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
namespace gl
{
class FramebufferState;
}
namespace egl namespace egl
{ {
class Display; class Display;
...@@ -22,7 +26,6 @@ struct Config; ...@@ -22,7 +26,6 @@ struct Config;
namespace rx namespace rx
{ {
class FramebufferImpl; class FramebufferImpl;
class SurfaceImpl : public FramebufferAttachmentObjectImpl class SurfaceImpl : public FramebufferAttachmentObjectImpl
...@@ -32,7 +35,7 @@ class SurfaceImpl : public FramebufferAttachmentObjectImpl ...@@ -32,7 +35,7 @@ class SurfaceImpl : public FramebufferAttachmentObjectImpl
virtual ~SurfaceImpl(); virtual ~SurfaceImpl();
virtual egl::Error initialize() = 0; virtual egl::Error initialize() = 0;
virtual FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) = 0; virtual FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) = 0;
virtual egl::Error swap() = 0; virtual egl::Error swap() = 0;
virtual egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) = 0; virtual egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) = 0;
virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0; virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0;
......
...@@ -403,7 +403,7 @@ void DynamicHLSL::generateVaryingLinkHLSL(ShaderType shaderType, ...@@ -403,7 +403,7 @@ void DynamicHLSL::generateVaryingLinkHLSL(ShaderType shaderType,
} }
bool DynamicHLSL::generateShaderLinkHLSL(const gl::ContextState &data, bool DynamicHLSL::generateShaderLinkHLSL(const gl::ContextState &data,
const gl::Program::Data &programData, const gl::ProgramState &programData,
const ProgramD3DMetadata &programMetadata, const ProgramD3DMetadata &programMetadata,
const VaryingPacking &varyingPacking, const VaryingPacking &varyingPacking,
std::string *pixelHLSL, std::string *pixelHLSL,
...@@ -826,7 +826,7 @@ std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &va ...@@ -826,7 +826,7 @@ std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &va
std::string DynamicHLSL::generateGeometryShaderHLSL(gl::PrimitiveType primitiveType, std::string DynamicHLSL::generateGeometryShaderHLSL(gl::PrimitiveType primitiveType,
const gl::ContextState &data, const gl::ContextState &data,
const gl::Program::Data &programData, const gl::ProgramState &programData,
const bool useViewScale, const bool useViewScale,
const std::string &preambleString) const const std::string &preambleString) const
{ {
...@@ -1030,7 +1030,7 @@ std::string DynamicHLSL::generateAttributeConversionHLSL( ...@@ -1030,7 +1030,7 @@ std::string DynamicHLSL::generateAttributeConversionHLSL(
} }
void DynamicHLSL::getPixelShaderOutputKey(const gl::ContextState &data, void DynamicHLSL::getPixelShaderOutputKey(const gl::ContextState &data,
const gl::Program::Data &programData, const gl::ProgramState &programData,
const ProgramD3DMetadata &metadata, const ProgramD3DMetadata &metadata,
std::vector<PixelShaderOutputVariable> *outPixelShaderKey) std::vector<PixelShaderOutputVariable> *outPixelShaderKey)
{ {
......
...@@ -62,7 +62,7 @@ class DynamicHLSL : angle::NonCopyable ...@@ -62,7 +62,7 @@ class DynamicHLSL : angle::NonCopyable
bool usesFragDepth, bool usesFragDepth,
const std::vector<GLenum> &outputLayout) const; const std::vector<GLenum> &outputLayout) const;
bool generateShaderLinkHLSL(const gl::ContextState &data, bool generateShaderLinkHLSL(const gl::ContextState &data,
const gl::Program::Data &programData, const gl::ProgramState &programData,
const ProgramD3DMetadata &programMetadata, const ProgramD3DMetadata &programMetadata,
const VaryingPacking &varyingPacking, const VaryingPacking &varyingPacking,
std::string *pixelHLSL, std::string *pixelHLSL,
...@@ -72,12 +72,12 @@ class DynamicHLSL : angle::NonCopyable ...@@ -72,12 +72,12 @@ class DynamicHLSL : angle::NonCopyable
std::string generateGeometryShaderHLSL(gl::PrimitiveType primitiveType, std::string generateGeometryShaderHLSL(gl::PrimitiveType primitiveType,
const gl::ContextState &data, const gl::ContextState &data,
const gl::Program::Data &programData, const gl::ProgramState &programData,
const bool useViewScale, const bool useViewScale,
const std::string &preambleString) const; const std::string &preambleString) const;
void getPixelShaderOutputKey(const gl::ContextState &data, void getPixelShaderOutputKey(const gl::ContextState &data,
const gl::Program::Data &programData, const gl::ProgramState &programData,
const ProgramD3DMetadata &metadata, const ProgramD3DMetadata &metadata,
std::vector<PixelShaderOutputVariable> *outPixelShaderKey); std::vector<PixelShaderOutputVariable> *outPixelShaderKey);
......
...@@ -85,7 +85,7 @@ ClearParameters GetClearParameters(const gl::State &state, GLbitfield mask) ...@@ -85,7 +85,7 @@ ClearParameters GetClearParameters(const gl::State &state, GLbitfield mask)
} }
FramebufferD3D::FramebufferD3D(const gl::Framebuffer::Data &data, RendererD3D *renderer) FramebufferD3D::FramebufferD3D(const gl::FramebufferState &data, RendererD3D *renderer)
: FramebufferImpl(data), mRenderer(renderer) : FramebufferImpl(data), mRenderer(renderer)
{ {
} }
...@@ -190,7 +190,7 @@ gl::Error FramebufferD3D::clearBufferfi(const gl::ContextState &data, ...@@ -190,7 +190,7 @@ gl::Error FramebufferD3D::clearBufferfi(const gl::ContextState &data,
GLenum FramebufferD3D::getImplementationColorReadFormat() const GLenum FramebufferD3D::getImplementationColorReadFormat() const
{ {
const gl::FramebufferAttachment *readAttachment = mData.getReadAttachment(); const gl::FramebufferAttachment *readAttachment = mState.getReadAttachment();
if (readAttachment == nullptr) if (readAttachment == nullptr)
{ {
...@@ -212,7 +212,7 @@ GLenum FramebufferD3D::getImplementationColorReadFormat() const ...@@ -212,7 +212,7 @@ GLenum FramebufferD3D::getImplementationColorReadFormat() const
GLenum FramebufferD3D::getImplementationColorReadType() const GLenum FramebufferD3D::getImplementationColorReadType() const
{ {
const gl::FramebufferAttachment *readAttachment = mData.getReadAttachment(); const gl::FramebufferAttachment *readAttachment = mState.getReadAttachment();
if (readAttachment == nullptr) if (readAttachment == nullptr)
{ {
...@@ -251,25 +251,22 @@ gl::Error FramebufferD3D::blit(const gl::State &state, const gl::Rectangle &sour ...@@ -251,25 +251,22 @@ gl::Error FramebufferD3D::blit(const gl::State &state, const gl::Rectangle &sour
GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer) GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer)
{ {
bool blitRenderTarget = false; bool blitRenderTarget = false;
if ((mask & GL_COLOR_BUFFER_BIT) && if ((mask & GL_COLOR_BUFFER_BIT) && sourceFramebuffer->getReadColorbuffer() != nullptr &&
sourceFramebuffer->getReadColorbuffer() != nullptr && mState.getFirstColorAttachment() != nullptr)
mData.getFirstColorAttachment() != nullptr)
{ {
blitRenderTarget = true; blitRenderTarget = true;
} }
bool blitStencil = false; bool blitStencil = false;
if ((mask & GL_STENCIL_BUFFER_BIT) && if ((mask & GL_STENCIL_BUFFER_BIT) && sourceFramebuffer->getStencilbuffer() != nullptr &&
sourceFramebuffer->getStencilbuffer() != nullptr && mState.getStencilAttachment() != nullptr)
mData.getStencilAttachment() != nullptr)
{ {
blitStencil = true; blitStencil = true;
} }
bool blitDepth = false; bool blitDepth = false;
if ((mask & GL_DEPTH_BUFFER_BIT) && if ((mask & GL_DEPTH_BUFFER_BIT) && sourceFramebuffer->getDepthbuffer() != nullptr &&
sourceFramebuffer->getDepthbuffer() != nullptr && mState.getDepthAttachment() != nullptr)
mData.getDepthAttachment() != nullptr)
{ {
blitDepth = true; blitDepth = true;
} }
...@@ -292,14 +289,14 @@ bool FramebufferD3D::checkStatus() const ...@@ -292,14 +289,14 @@ bool FramebufferD3D::checkStatus() const
{ {
// if we have both a depth and stencil buffer, they must refer to the same object // if we have both a depth and stencil buffer, they must refer to the same object
// since we only support packed_depth_stencil and not separate depth and stencil // since we only support packed_depth_stencil and not separate depth and stencil
if (mData.getDepthAttachment() != nullptr && mData.getStencilAttachment() != nullptr && if (mState.getDepthAttachment() != nullptr && mState.getStencilAttachment() != nullptr &&
mData.getDepthStencilAttachment() == nullptr) mState.getDepthStencilAttachment() == nullptr)
{ {
return false; return false;
} }
// D3D11 does not allow for overlapping RenderTargetViews, so ensure uniqueness // D3D11 does not allow for overlapping RenderTargetViews, so ensure uniqueness
const auto &colorAttachments = mData.getColorAttachments(); const auto &colorAttachments = mState.getColorAttachments();
for (size_t colorAttachment = 0; colorAttachment < colorAttachments.size(); colorAttachment++) for (size_t colorAttachment = 0; colorAttachment < colorAttachments.size(); colorAttachment++)
{ {
const gl::FramebufferAttachment &attachment = colorAttachments[colorAttachment]; const gl::FramebufferAttachment &attachment = colorAttachments[colorAttachment];
...@@ -319,7 +316,7 @@ bool FramebufferD3D::checkStatus() const ...@@ -319,7 +316,7 @@ bool FramebufferD3D::checkStatus() const
} }
// D3D requires all render targets to have the same dimensions. // D3D requires all render targets to have the same dimensions.
if (!mData.attachmentsHaveSameDimensions()) if (!mState.attachmentsHaveSameDimensions())
{ {
return false; return false;
} }
...@@ -354,8 +351,8 @@ void FramebufferD3D::syncState(const gl::Framebuffer::DirtyBits &dirtyBits) ...@@ -354,8 +351,8 @@ void FramebufferD3D::syncState(const gl::Framebuffer::DirtyBits &dirtyBits)
// Does not actually free memory // Does not actually free memory
gl::AttachmentList colorAttachmentsForRender; gl::AttachmentList colorAttachmentsForRender;
const auto &colorAttachments = mData.getColorAttachments(); const auto &colorAttachments = mState.getColorAttachments();
const auto &drawBufferStates = mData.getDrawBufferStates(); const auto &drawBufferStates = mState.getDrawBufferStates();
const auto &workarounds = mRenderer->getWorkarounds(); const auto &workarounds = mRenderer->getWorkarounds();
for (size_t attachmentIndex = 0; attachmentIndex < colorAttachments.size(); ++attachmentIndex) for (size_t attachmentIndex = 0; attachmentIndex < colorAttachments.size(); ++attachmentIndex)
......
...@@ -57,7 +57,7 @@ struct ClearParameters ...@@ -57,7 +57,7 @@ struct ClearParameters
class FramebufferD3D : public FramebufferImpl class FramebufferD3D : public FramebufferImpl
{ {
public: public:
FramebufferD3D(const gl::Framebuffer::Data &data, RendererD3D *renderer); FramebufferD3D(const gl::FramebufferState &data, RendererD3D *renderer);
virtual ~FramebufferD3D(); virtual ~FramebufferD3D();
gl::Error clear(const gl::ContextState &data, GLbitfield mask) override; gl::Error clear(const gl::ContextState &data, GLbitfield mask) override;
......
...@@ -109,7 +109,7 @@ class ProgramD3DMetadata : angle::NonCopyable ...@@ -109,7 +109,7 @@ class ProgramD3DMetadata : angle::NonCopyable
int getRendererMajorShaderModel() const; int getRendererMajorShaderModel() const;
bool usesBroadcast(const gl::ContextState &data) const; bool usesBroadcast(const gl::ContextState &data) const;
bool usesFragDepth(const gl::Program::Data &programData) const; bool usesFragDepth() const;
bool usesPointCoord() const; bool usesPointCoord() const;
bool usesFragCoord() const; bool usesFragCoord() const;
bool usesPointSize() const; bool usesPointSize() const;
...@@ -134,7 +134,7 @@ class ProgramD3DMetadata : angle::NonCopyable ...@@ -134,7 +134,7 @@ class ProgramD3DMetadata : angle::NonCopyable
class ProgramD3D : public ProgramImpl class ProgramD3D : public ProgramImpl
{ {
public: public:
ProgramD3D(const gl::Program::Data &data, RendererD3D *renderer); ProgramD3D(const gl::ProgramState &data, RendererD3D *renderer);
virtual ~ProgramD3D(); virtual ~ProgramD3D();
const std::vector<PixelShaderOutputVariable> &getPixelShaderKey() { return mPixelShaderKey; } const std::vector<PixelShaderOutputVariable> &getPixelShaderKey() { return mPixelShaderKey; }
......
...@@ -99,7 +99,7 @@ egl::Error SurfaceD3D::initialize() ...@@ -99,7 +99,7 @@ egl::Error SurfaceD3D::initialize()
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
FramebufferImpl *SurfaceD3D::createDefaultFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *SurfaceD3D::createDefaultFramebuffer(const gl::FramebufferState &data)
{ {
return mRenderer->createFramebuffer(data); return mRenderer->createFramebuffer(data);
} }
......
...@@ -39,7 +39,7 @@ class SurfaceD3D : public SurfaceImpl ...@@ -39,7 +39,7 @@ class SurfaceD3D : public SurfaceImpl
void releaseSwapChain(); void releaseSwapChain();
egl::Error initialize() override; egl::Error initialize() override;
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override;
egl::Error swap() override; egl::Error swap() override;
egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override; egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override;
......
...@@ -196,7 +196,8 @@ Clear11::~Clear11() ...@@ -196,7 +196,8 @@ Clear11::~Clear11()
SafeRelease(mRasterizerState); SafeRelease(mRasterizerState);
} }
gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl::Framebuffer::Data &fboData) gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
const gl::FramebufferState &fboData)
{ {
const auto &colorAttachments = fboData.getColorAttachments(); const auto &colorAttachments = fboData.getColorAttachments();
const auto &drawBufferStates = fboData.getDrawBufferStates(); const auto &drawBufferStates = fboData.getDrawBufferStates();
......
...@@ -30,7 +30,8 @@ class Clear11 : angle::NonCopyable ...@@ -30,7 +30,8 @@ class Clear11 : angle::NonCopyable
~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 ClearParameters &clearParams, const gl::Framebuffer::Data &fboData); gl::Error clearFramebuffer(const ClearParameters &clearParams,
const gl::FramebufferState &fboData);
private: private:
struct MaskedRenderTarget struct MaskedRenderTarget
......
...@@ -80,7 +80,7 @@ void UpdateCachedRenderTarget(const gl::FramebufferAttachment *attachment, ...@@ -80,7 +80,7 @@ void UpdateCachedRenderTarget(const gl::FramebufferAttachment *attachment,
} }
} // anonymous namespace } // anonymous namespace
Framebuffer11::Framebuffer11(const gl::Framebuffer::Data &data, Renderer11 *renderer) Framebuffer11::Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer)
: FramebufferD3D(data, renderer), mRenderer(renderer), mCachedDepthStencilRenderTarget(nullptr) : FramebufferD3D(data, renderer), mRenderer(renderer), mCachedDepthStencilRenderTarget(nullptr)
{ {
ASSERT(mRenderer != nullptr); ASSERT(mRenderer != nullptr);
...@@ -117,7 +117,7 @@ Framebuffer11::~Framebuffer11() ...@@ -117,7 +117,7 @@ Framebuffer11::~Framebuffer11()
gl::Error Framebuffer11::invalidateSwizzles() const gl::Error Framebuffer11::invalidateSwizzles() const
{ {
for (const auto &colorAttachment : mData.getColorAttachments()) for (const auto &colorAttachment : mState.getColorAttachments())
{ {
if (colorAttachment.isAttached()) if (colorAttachment.isAttached())
{ {
...@@ -129,13 +129,13 @@ gl::Error Framebuffer11::invalidateSwizzles() const ...@@ -129,13 +129,13 @@ gl::Error Framebuffer11::invalidateSwizzles() const
} }
} }
gl::Error error = InvalidateAttachmentSwizzles(mData.getDepthAttachment()); gl::Error error = InvalidateAttachmentSwizzles(mState.getDepthAttachment());
if (error.isError()) if (error.isError())
{ {
return error; return error;
} }
error = InvalidateAttachmentSwizzles(mData.getStencilAttachment()); error = InvalidateAttachmentSwizzles(mState.getStencilAttachment());
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -149,7 +149,7 @@ gl::Error Framebuffer11::clear(const gl::ContextState &data, const ClearParamete ...@@ -149,7 +149,7 @@ gl::Error Framebuffer11::clear(const gl::ContextState &data, const ClearParamete
Clear11 *clearer = mRenderer->getClearer(); Clear11 *clearer = mRenderer->getClearer();
gl::Error error(GL_NO_ERROR); gl::Error error(GL_NO_ERROR);
const gl::FramebufferAttachment *colorAttachment = mData.getFirstColorAttachment(); const gl::FramebufferAttachment *colorAttachment = mState.getFirstColorAttachment();
if (clearParams.scissorEnabled == true && colorAttachment != nullptr && if (clearParams.scissorEnabled == true && colorAttachment != nullptr &&
UsePresentPathFast(mRenderer, colorAttachment)) UsePresentPathFast(mRenderer, colorAttachment))
{ {
...@@ -161,11 +161,11 @@ gl::Error Framebuffer11::clear(const gl::ContextState &data, const ClearParamete ...@@ -161,11 +161,11 @@ gl::Error Framebuffer11::clear(const gl::ContextState &data, const ClearParamete
presentPathFastClearParams.scissor.y = framebufferSize.height - presentPathFastClearParams.scissor.y = framebufferSize.height -
presentPathFastClearParams.scissor.y - presentPathFastClearParams.scissor.y -
presentPathFastClearParams.scissor.height; presentPathFastClearParams.scissor.height;
error = clearer->clearFramebuffer(presentPathFastClearParams, mData); error = clearer->clearFramebuffer(presentPathFastClearParams, mState);
} }
else else
{ {
error = clearer->clearFramebuffer(clearParams, mData); error = clearer->clearFramebuffer(clearParams, mState);
} }
if (error.isError()) if (error.isError())
...@@ -242,9 +242,9 @@ gl::Error Framebuffer11::invalidateBase(size_t count, const GLenum *attachments, ...@@ -242,9 +242,9 @@ gl::Error Framebuffer11::invalidateBase(size_t count, const GLenum *attachments,
colorAttachmentID = attachments[i] - GL_COLOR_ATTACHMENT0; colorAttachmentID = attachments[i] - GL_COLOR_ATTACHMENT0;
} }
if (mData.getColorAttachment(static_cast<unsigned int>(colorAttachmentID))) if (mState.getColorAttachment(static_cast<unsigned int>(colorAttachmentID)))
{ {
error = mData.getColorAttachment(static_cast<unsigned int>(colorAttachmentID)) error = mState.getColorAttachment(static_cast<unsigned int>(colorAttachmentID))
->getRenderTarget(&renderTarget); ->getRenderTarget(&renderTarget);
if (error.isError()) if (error.isError())
{ {
...@@ -275,7 +275,7 @@ gl::Error Framebuffer11::invalidateBase(size_t count, const GLenum *attachments, ...@@ -275,7 +275,7 @@ gl::Error Framebuffer11::invalidateBase(size_t count, const GLenum *attachments,
discardDepth = foundDepth; discardDepth = foundDepth;
// Don't bother discarding the stencil buffer if the depth buffer will already do it // Don't bother discarding the stencil buffer if the depth buffer will already do it
discardStencil = foundStencil && (!discardDepth || mData.getDepthAttachment() == nullptr); discardStencil = foundStencil && (!discardDepth || mState.getDepthAttachment() == nullptr);
} }
else else
{ {
...@@ -283,17 +283,18 @@ gl::Error Framebuffer11::invalidateBase(size_t count, const GLenum *attachments, ...@@ -283,17 +283,18 @@ gl::Error Framebuffer11::invalidateBase(size_t count, const GLenum *attachments,
// attachments list does not include DEPTH_STENCIL_ATTACHMENT or both DEPTH_ATTACHMENT and // attachments list does not include DEPTH_STENCIL_ATTACHMENT or both DEPTH_ATTACHMENT and
// STENCIL_ATTACHMENT, then only the specified portion of every pixel in the subregion of pixels // STENCIL_ATTACHMENT, then only the specified portion of every pixel in the subregion of pixels
// of the DEPTH_STENCIL buffer may be invalidated, and the other portion must be preserved. // of the DEPTH_STENCIL buffer may be invalidated, and the other portion must be preserved.
discardDepth = (foundDepth && foundStencil) || (foundDepth && (mData.getStencilAttachment() == nullptr)); discardDepth = (foundDepth && foundStencil) ||
discardStencil = (foundStencil && (mData.getDepthAttachment() == nullptr)); (foundDepth && (mState.getStencilAttachment() == nullptr));
discardStencil = (foundStencil && (mState.getDepthAttachment() == nullptr));
} }
if (discardDepth && mData.getDepthAttachment()) if (discardDepth && mState.getDepthAttachment())
{ {
RenderTarget11 *renderTarget = nullptr; RenderTarget11 *renderTarget = nullptr;
ID3D11View *depthView = nullptr; ID3D11View *depthView = nullptr;
gl::Error error(GL_NO_ERROR); gl::Error error(GL_NO_ERROR);
error = mData.getDepthAttachment()->getRenderTarget(&renderTarget); error = mState.getDepthAttachment()->getRenderTarget(&renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -307,13 +308,13 @@ gl::Error Framebuffer11::invalidateBase(size_t count, const GLenum *attachments, ...@@ -307,13 +308,13 @@ gl::Error Framebuffer11::invalidateBase(size_t count, const GLenum *attachments,
} }
} }
if (discardStencil && mData.getStencilAttachment()) if (discardStencil && mState.getStencilAttachment())
{ {
RenderTarget11 *renderTarget = nullptr; RenderTarget11 *renderTarget = nullptr;
ID3D11View *stencilView = nullptr; ID3D11View *stencilView = nullptr;
gl::Error error(GL_NO_ERROR); gl::Error error(GL_NO_ERROR);
error = mData.getStencilAttachment()->getRenderTarget(&renderTarget); error = mState.getStencilAttachment()->getRenderTarget(&renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -343,7 +344,7 @@ gl::Error Framebuffer11::readPixelsImpl(const gl::Rectangle &area, ...@@ -343,7 +344,7 @@ gl::Error Framebuffer11::readPixelsImpl(const gl::Rectangle &area,
const gl::PixelPackState &pack, const gl::PixelPackState &pack,
uint8_t *pixels) const uint8_t *pixels) const
{ {
const gl::FramebufferAttachment *readAttachment = mData.getReadAttachment(); const gl::FramebufferAttachment *readAttachment = mState.getReadAttachment();
ASSERT(readAttachment); ASSERT(readAttachment);
gl::Buffer *packBuffer = pack.pixelBuffer.get(); gl::Buffer *packBuffer = pack.pixelBuffer.get();
...@@ -384,8 +385,8 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang ...@@ -384,8 +385,8 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
} }
ASSERT(readRenderTarget); ASSERT(readRenderTarget);
const auto &colorAttachments = mData.getColorAttachments(); const auto &colorAttachments = mState.getColorAttachments();
const auto &drawBufferStates = mData.getDrawBufferStates(); const auto &drawBufferStates = mState.getDrawBufferStates();
for (size_t colorAttachment = 0; colorAttachment < colorAttachments.size(); colorAttachment++) for (size_t colorAttachment = 0; colorAttachment < colorAttachments.size(); colorAttachment++)
{ {
...@@ -444,7 +445,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang ...@@ -444,7 +445,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
} }
ASSERT(readRenderTarget); ASSERT(readRenderTarget);
const gl::FramebufferAttachment *drawBuffer = mData.getDepthOrStencilAttachment(); const gl::FramebufferAttachment *drawBuffer = mState.getDepthOrStencilAttachment();
ASSERT(drawBuffer); ASSERT(drawBuffer);
RenderTargetD3D *drawRenderTarget = nullptr; RenderTargetD3D *drawRenderTarget = nullptr;
...@@ -480,14 +481,14 @@ GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *rende ...@@ -480,14 +481,14 @@ GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *rende
void Framebuffer11::updateColorRenderTarget(size_t colorIndex) void Framebuffer11::updateColorRenderTarget(size_t colorIndex)
{ {
UpdateCachedRenderTarget(mData.getColorAttachment(colorIndex), UpdateCachedRenderTarget(mState.getColorAttachment(colorIndex),
mCachedColorRenderTargets[colorIndex], mCachedColorRenderTargets[colorIndex],
mColorRenderTargetsDirty[colorIndex]); mColorRenderTargetsDirty[colorIndex]);
} }
void Framebuffer11::updateDepthStencilRenderTarget() void Framebuffer11::updateDepthStencilRenderTarget()
{ {
UpdateCachedRenderTarget(mData.getDepthOrStencilAttachment(), mCachedDepthStencilRenderTarget, UpdateCachedRenderTarget(mState.getDepthOrStencilAttachment(), mCachedDepthStencilRenderTarget,
mDepthStencilRenderTargetDirty); mDepthStencilRenderTargetDirty);
} }
......
...@@ -19,7 +19,7 @@ class Renderer11; ...@@ -19,7 +19,7 @@ class Renderer11;
class Framebuffer11 : public FramebufferD3D class Framebuffer11 : public FramebufferD3D
{ {
public: public:
Framebuffer11(const gl::Framebuffer::Data &data, Renderer11 *renderer); Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer);
virtual ~Framebuffer11(); virtual ~Framebuffer11();
gl::Error discard(size_t count, const GLenum *attachments) override; gl::Error discard(size_t count, const GLenum *attachments) override;
......
...@@ -3340,7 +3340,7 @@ gl::Error Renderer11::createRenderTargetCopy(RenderTargetD3D *source, RenderTarg ...@@ -3340,7 +3340,7 @@ gl::Error Renderer11::createRenderTargetCopy(RenderTargetD3D *source, RenderTarg
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
FramebufferImpl *Renderer11::createFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *Renderer11::createFramebuffer(const gl::FramebufferState &data)
{ {
return new Framebuffer11(data, this); return new Framebuffer11(data, this);
} }
...@@ -3350,7 +3350,7 @@ ShaderImpl *Renderer11::createShader(const gl::Shader::Data &data) ...@@ -3350,7 +3350,7 @@ ShaderImpl *Renderer11::createShader(const gl::Shader::Data &data)
return new ShaderD3D(data); return new ShaderD3D(data);
} }
ProgramImpl *Renderer11::createProgram(const gl::Program::Data &data) ProgramImpl *Renderer11::createProgram(const gl::ProgramState &data)
{ {
return new ProgramD3D(data, this); return new ProgramD3D(data, this);
} }
......
...@@ -188,11 +188,11 @@ class Renderer11 : public RendererD3D ...@@ -188,11 +188,11 @@ class Renderer11 : public RendererD3D
gl::Error createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT) override; gl::Error createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT) override;
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) override;
// Shader creation // Shader creation
ShaderImpl *createShader(const gl::Shader::Data &data) override; ShaderImpl *createShader(const gl::Shader::Data &data) override;
ProgramImpl *createProgram(const gl::Program::Data &data) override; ProgramImpl *createProgram(const gl::ProgramState &data) override;
// Shader operations // Shader operations
gl::Error loadExecutable(const void *function, gl::Error loadExecutable(const void *function,
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
namespace rx namespace rx
{ {
Framebuffer9::Framebuffer9(const gl::Framebuffer::Data &data, Renderer9 *renderer) Framebuffer9::Framebuffer9(const gl::FramebufferState &data, Renderer9 *renderer)
: FramebufferD3D(data, renderer), mRenderer(renderer) : FramebufferD3D(data, renderer), mRenderer(renderer)
{ {
ASSERT(mRenderer != nullptr); ASSERT(mRenderer != nullptr);
...@@ -54,8 +54,8 @@ gl::Error Framebuffer9::invalidateSub(size_t, const GLenum *, const gl::Rectangl ...@@ -54,8 +54,8 @@ gl::Error Framebuffer9::invalidateSub(size_t, const GLenum *, const gl::Rectangl
gl::Error Framebuffer9::clear(const gl::ContextState &data, const ClearParameters &clearParams) gl::Error Framebuffer9::clear(const gl::ContextState &data, const ClearParameters &clearParams)
{ {
const gl::FramebufferAttachment *colorAttachment = mData.getColorAttachment(0); const gl::FramebufferAttachment *colorAttachment = mState.getColorAttachment(0);
const gl::FramebufferAttachment *depthStencilAttachment = mData.getDepthOrStencilAttachment(); const gl::FramebufferAttachment *depthStencilAttachment = mState.getDepthOrStencilAttachment();
gl::Error error = mRenderer->applyRenderTarget(colorAttachment, depthStencilAttachment); gl::Error error = mRenderer->applyRenderTarget(colorAttachment, depthStencilAttachment);
if (error.isError()) if (error.isError())
...@@ -82,7 +82,7 @@ gl::Error Framebuffer9::readPixelsImpl(const gl::Rectangle &area, ...@@ -82,7 +82,7 @@ gl::Error Framebuffer9::readPixelsImpl(const gl::Rectangle &area,
{ {
ASSERT(pack.pixelBuffer.get() == nullptr); ASSERT(pack.pixelBuffer.get() == nullptr);
const gl::FramebufferAttachment *colorbuffer = mData.getColorAttachment(0); const gl::FramebufferAttachment *colorbuffer = mState.getColorAttachment(0);
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget9 *renderTarget = nullptr; RenderTarget9 *renderTarget = nullptr;
...@@ -280,7 +280,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl ...@@ -280,7 +280,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl
} }
ASSERT(readRenderTarget); ASSERT(readRenderTarget);
const gl::FramebufferAttachment *drawBuffer = mData.getColorAttachment(0); const gl::FramebufferAttachment *drawBuffer = mState.getColorAttachment(0);
ASSERT(drawBuffer); ASSERT(drawBuffer);
RenderTarget9 *drawRenderTarget = nullptr; RenderTarget9 *drawRenderTarget = nullptr;
...@@ -406,7 +406,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl ...@@ -406,7 +406,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl
} }
ASSERT(readDepthStencil); ASSERT(readDepthStencil);
const gl::FramebufferAttachment *drawBuffer = mData.getDepthOrStencilAttachment(); const gl::FramebufferAttachment *drawBuffer = mState.getDepthOrStencilAttachment();
ASSERT(drawBuffer); ASSERT(drawBuffer);
RenderTarget9 *drawDepthStencil = nullptr; RenderTarget9 *drawDepthStencil = nullptr;
......
...@@ -18,7 +18,7 @@ class Renderer9; ...@@ -18,7 +18,7 @@ class Renderer9;
class Framebuffer9 : public FramebufferD3D class Framebuffer9 : public FramebufferD3D
{ {
public: public:
Framebuffer9(const gl::Framebuffer::Data &data, Renderer9 *renderer); Framebuffer9(const gl::FramebufferState &data, Renderer9 *renderer);
virtual ~Framebuffer9(); virtual ~Framebuffer9();
gl::Error discard(size_t count, const GLenum *attachments) override; gl::Error discard(size_t count, const GLenum *attachments) override;
......
...@@ -2472,7 +2472,7 @@ gl::Error Renderer9::createRenderTargetCopy(RenderTargetD3D *source, RenderTarge ...@@ -2472,7 +2472,7 @@ gl::Error Renderer9::createRenderTargetCopy(RenderTargetD3D *source, RenderTarge
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
FramebufferImpl *Renderer9::createFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *Renderer9::createFramebuffer(const gl::FramebufferState &data)
{ {
return new Framebuffer9(data, this); return new Framebuffer9(data, this);
} }
...@@ -2482,7 +2482,7 @@ ShaderImpl *Renderer9::createShader(const gl::Shader::Data &data) ...@@ -2482,7 +2482,7 @@ ShaderImpl *Renderer9::createShader(const gl::Shader::Data &data)
return new ShaderD3D(data); return new ShaderD3D(data);
} }
ProgramImpl *Renderer9::createProgram(const gl::Program::Data &data) ProgramImpl *Renderer9::createProgram(const gl::ProgramState &data)
{ {
return new ProgramD3D(data, this); return new ProgramD3D(data, this);
} }
......
...@@ -186,11 +186,11 @@ class Renderer9 : public RendererD3D ...@@ -186,11 +186,11 @@ class Renderer9 : public RendererD3D
gl::Error createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT) override; gl::Error createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT) override;
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) override;
// Shader creation // Shader creation
ShaderImpl *createShader(const gl::Shader::Data &data) override; ShaderImpl *createShader(const gl::Shader::Data &data) override;
ProgramImpl *createProgram(const gl::Program::Data &data) override; ProgramImpl *createProgram(const gl::ProgramState &data) override;
// Shader operations // Shader operations
gl::Error loadExecutable(const void *function, gl::Error loadExecutable(const void *function,
......
...@@ -27,12 +27,12 @@ using namespace gl; ...@@ -27,12 +27,12 @@ using namespace gl;
namespace rx namespace rx
{ {
FramebufferGL::FramebufferGL(const Framebuffer::Data &data, FramebufferGL::FramebufferGL(const FramebufferState &state,
const FunctionsGL *functions, const FunctionsGL *functions,
StateManagerGL *stateManager, StateManagerGL *stateManager,
const WorkaroundsGL &workarounds, const WorkaroundsGL &workarounds,
bool isDefault) bool isDefault)
: FramebufferImpl(data), : FramebufferImpl(state),
mFunctions(functions), mFunctions(functions),
mStateManager(stateManager), mStateManager(stateManager),
mWorkarounds(workarounds), mWorkarounds(workarounds),
...@@ -46,11 +46,11 @@ FramebufferGL::FramebufferGL(const Framebuffer::Data &data, ...@@ -46,11 +46,11 @@ FramebufferGL::FramebufferGL(const Framebuffer::Data &data,
} }
FramebufferGL::FramebufferGL(GLuint id, FramebufferGL::FramebufferGL(GLuint id,
const Framebuffer::Data &data, const FramebufferState &state,
const FunctionsGL *functions, const FunctionsGL *functions,
const WorkaroundsGL &workarounds, const WorkaroundsGL &workarounds,
StateManagerGL *stateManager) StateManagerGL *stateManager)
: FramebufferImpl(data), : FramebufferImpl(state),
mFunctions(functions), mFunctions(functions),
mStateManager(stateManager), mStateManager(stateManager),
mWorkarounds(workarounds), mWorkarounds(workarounds),
...@@ -209,7 +209,7 @@ Error FramebufferGL::clearBufferfi(const ContextState &data, ...@@ -209,7 +209,7 @@ Error FramebufferGL::clearBufferfi(const ContextState &data,
GLenum FramebufferGL::getImplementationColorReadFormat() const GLenum FramebufferGL::getImplementationColorReadFormat() const
{ {
const FramebufferAttachment *readAttachment = getData().getReadAttachment(); const FramebufferAttachment *readAttachment = mState.getReadAttachment();
GLenum internalFormat = readAttachment->getInternalFormat(); GLenum internalFormat = readAttachment->getInternalFormat();
const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat); const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat);
return internalFormatInfo.format; return internalFormatInfo.format;
...@@ -217,7 +217,7 @@ GLenum FramebufferGL::getImplementationColorReadFormat() const ...@@ -217,7 +217,7 @@ GLenum FramebufferGL::getImplementationColorReadFormat() const
GLenum FramebufferGL::getImplementationColorReadType() const GLenum FramebufferGL::getImplementationColorReadType() const
{ {
const FramebufferAttachment *readAttachment = getData().getReadAttachment(); const FramebufferAttachment *readAttachment = mState.getReadAttachment();
GLenum internalFormat = readAttachment->getInternalFormat(); GLenum internalFormat = readAttachment->getInternalFormat();
const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat); const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat);
return internalFormatInfo.type; return internalFormatInfo.type;
...@@ -285,21 +285,21 @@ void FramebufferGL::syncState(const Framebuffer::DirtyBits &dirtyBits) ...@@ -285,21 +285,21 @@ void FramebufferGL::syncState(const Framebuffer::DirtyBits &dirtyBits)
{ {
case Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT: case Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT:
BindFramebufferAttachment(mFunctions, GL_DEPTH_ATTACHMENT, BindFramebufferAttachment(mFunctions, GL_DEPTH_ATTACHMENT,
mData.getDepthAttachment()); mState.getDepthAttachment());
break; break;
case Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT: case Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT:
BindFramebufferAttachment(mFunctions, GL_STENCIL_ATTACHMENT, BindFramebufferAttachment(mFunctions, GL_STENCIL_ATTACHMENT,
mData.getStencilAttachment()); mState.getStencilAttachment());
break; break;
case Framebuffer::DIRTY_BIT_DRAW_BUFFERS: case Framebuffer::DIRTY_BIT_DRAW_BUFFERS:
{ {
const auto &drawBuffers = mData.getDrawBufferStates(); const auto &drawBuffers = mState.getDrawBufferStates();
mFunctions->drawBuffers(static_cast<GLsizei>(drawBuffers.size()), mFunctions->drawBuffers(static_cast<GLsizei>(drawBuffers.size()),
drawBuffers.data()); drawBuffers.data());
break; break;
} }
case Framebuffer::DIRTY_BIT_READ_BUFFER: case Framebuffer::DIRTY_BIT_READ_BUFFER:
mFunctions->readBuffer(mData.getReadBufferState()); mFunctions->readBuffer(mState.getReadBufferState());
break; break;
default: default:
{ {
...@@ -309,7 +309,7 @@ void FramebufferGL::syncState(const Framebuffer::DirtyBits &dirtyBits) ...@@ -309,7 +309,7 @@ void FramebufferGL::syncState(const Framebuffer::DirtyBits &dirtyBits)
static_cast<size_t>(dirtyBit - Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0); static_cast<size_t>(dirtyBit - Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0);
BindFramebufferAttachment(mFunctions, BindFramebufferAttachment(mFunctions,
static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + index), static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + index),
mData.getColorAttachment(index)); mState.getColorAttachment(index));
break; break;
} }
} }
...@@ -342,7 +342,7 @@ void FramebufferGL::syncClearState(GLbitfield mask) ...@@ -342,7 +342,7 @@ void FramebufferGL::syncClearState(GLbitfield mask)
(mask & GL_COLOR_BUFFER_BIT) != 0 && !mIsDefault) (mask & GL_COLOR_BUFFER_BIT) != 0 && !mIsDefault)
{ {
bool hasSRBAttachment = false; bool hasSRBAttachment = false;
for (const auto &attachment : mData.getColorAttachments()) for (const auto &attachment : mState.getColorAttachments())
{ {
if (attachment.isAttached() && attachment.getColorEncoding() == GL_SRGB) if (attachment.isAttached() && attachment.getColorEncoding() == GL_SRGB)
{ {
...@@ -369,8 +369,8 @@ void FramebufferGL::syncClearBufferState(GLenum buffer, GLint drawBuffer) ...@@ -369,8 +369,8 @@ void FramebufferGL::syncClearBufferState(GLenum buffer, GLint drawBuffer)
{ {
// If doing a clear on a color buffer, set SRGB blend enabled only if the color buffer // If doing a clear on a color buffer, set SRGB blend enabled only if the color buffer
// is an SRGB format. // is an SRGB format.
const auto &drawbufferState = mData.getDrawBufferStates(); const auto &drawbufferState = mState.getDrawBufferStates();
const auto &colorAttachments = mData.getColorAttachments(); const auto &colorAttachments = mState.getColorAttachments();
const FramebufferAttachment *attachment = nullptr; const FramebufferAttachment *attachment = nullptr;
if (drawbufferState[drawBuffer] >= GL_COLOR_ATTACHMENT0 && if (drawbufferState[drawBuffer] >= GL_COLOR_ATTACHMENT0 &&
......
...@@ -21,7 +21,7 @@ struct WorkaroundsGL; ...@@ -21,7 +21,7 @@ struct WorkaroundsGL;
class FramebufferGL : public FramebufferImpl class FramebufferGL : public FramebufferImpl
{ {
public: public:
FramebufferGL(const gl::Framebuffer::Data &data, FramebufferGL(const gl::FramebufferState &data,
const FunctionsGL *functions, const FunctionsGL *functions,
StateManagerGL *stateManager, StateManagerGL *stateManager,
const WorkaroundsGL &workarounds, const WorkaroundsGL &workarounds,
...@@ -30,7 +30,7 @@ class FramebufferGL : public FramebufferImpl ...@@ -30,7 +30,7 @@ class FramebufferGL : public FramebufferImpl
// existing framebuffer name, for example for the default framebuffer // existing framebuffer name, for example for the default framebuffer
// on the Mac EGL CGL backend. // on the Mac EGL CGL backend.
FramebufferGL(GLuint id, FramebufferGL(GLuint id,
const gl::Framebuffer::Data &data, const gl::FramebufferState &data,
const FunctionsGL *functions, const FunctionsGL *functions,
const WorkaroundsGL &workarounds, const WorkaroundsGL &workarounds,
StateManagerGL *stateManager); StateManagerGL *stateManager);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
namespace rx namespace rx
{ {
ProgramGL::ProgramGL(const gl::Program::Data &data, ProgramGL::ProgramGL(const gl::ProgramState &data,
const FunctionsGL *functions, const FunctionsGL *functions,
const WorkaroundsGL &workarounds, const WorkaroundsGL &workarounds,
StateManagerGL *stateManager) StateManagerGL *stateManager)
...@@ -98,7 +98,7 @@ LinkResult ProgramGL::link(const gl::ContextState &data, gl::InfoLog &infoLog) ...@@ -98,7 +98,7 @@ LinkResult ProgramGL::link(const gl::ContextState &data, gl::InfoLog &infoLog)
// Set the transform feedback state // Set the transform feedback state
std::vector<const GLchar *> transformFeedbackVaryings; std::vector<const GLchar *> transformFeedbackVaryings;
for (const auto &tfVarying : mData.getTransformFeedbackVaryingNames()) for (const auto &tfVarying : mState.getTransformFeedbackVaryingNames())
{ {
transformFeedbackVaryings.push_back(tfVarying.c_str()); transformFeedbackVaryings.push_back(tfVarying.c_str());
} }
...@@ -108,7 +108,7 @@ LinkResult ProgramGL::link(const gl::ContextState &data, gl::InfoLog &infoLog) ...@@ -108,7 +108,7 @@ LinkResult ProgramGL::link(const gl::ContextState &data, gl::InfoLog &infoLog)
if (mFunctions->transformFeedbackVaryings) if (mFunctions->transformFeedbackVaryings)
{ {
mFunctions->transformFeedbackVaryings(mProgramID, 0, nullptr, mFunctions->transformFeedbackVaryings(mProgramID, 0, nullptr,
mData.getTransformFeedbackBufferMode()); mState.getTransformFeedbackBufferMode());
} }
} }
else else
...@@ -116,18 +116,18 @@ LinkResult ProgramGL::link(const gl::ContextState &data, gl::InfoLog &infoLog) ...@@ -116,18 +116,18 @@ LinkResult ProgramGL::link(const gl::ContextState &data, gl::InfoLog &infoLog)
ASSERT(mFunctions->transformFeedbackVaryings); ASSERT(mFunctions->transformFeedbackVaryings);
mFunctions->transformFeedbackVaryings( mFunctions->transformFeedbackVaryings(
mProgramID, static_cast<GLsizei>(transformFeedbackVaryings.size()), mProgramID, static_cast<GLsizei>(transformFeedbackVaryings.size()),
&transformFeedbackVaryings[0], mData.getTransformFeedbackBufferMode()); &transformFeedbackVaryings[0], mState.getTransformFeedbackBufferMode());
} }
const ShaderGL *vertexShaderGL = GetImplAs<ShaderGL>(mData.getAttachedVertexShader()); const ShaderGL *vertexShaderGL = GetImplAs<ShaderGL>(mState.getAttachedVertexShader());
const ShaderGL *fragmentShaderGL = GetImplAs<ShaderGL>(mData.getAttachedFragmentShader()); const ShaderGL *fragmentShaderGL = GetImplAs<ShaderGL>(mState.getAttachedFragmentShader());
// Attach the shaders // Attach the shaders
mFunctions->attachShader(mProgramID, vertexShaderGL->getShaderID()); mFunctions->attachShader(mProgramID, vertexShaderGL->getShaderID());
mFunctions->attachShader(mProgramID, fragmentShaderGL->getShaderID()); mFunctions->attachShader(mProgramID, fragmentShaderGL->getShaderID());
// Bind attribute locations to match the GL layer. // Bind attribute locations to match the GL layer.
for (const sh::Attribute &attribute : mData.getAttributes()) for (const sh::Attribute &attribute : mState.getAttributes())
{ {
if (!attribute.staticUse) if (!attribute.staticUse)
{ {
...@@ -195,7 +195,7 @@ void ProgramGL::setUniform1iv(GLint location, GLsizei count, const GLint *v) ...@@ -195,7 +195,7 @@ void ProgramGL::setUniform1iv(GLint location, GLsizei count, const GLint *v)
mStateManager->useProgram(mProgramID); mStateManager->useProgram(mProgramID);
mFunctions->uniform1iv(uniLoc(location), count, v); mFunctions->uniform1iv(uniLoc(location), count, v);
const gl::VariableLocation &locationEntry = mData.getUniformLocations()[location]; const gl::VariableLocation &locationEntry = mState.getUniformLocations()[location];
size_t samplerIndex = mUniformIndexToSamplerIndex[locationEntry.index]; size_t samplerIndex = mUniformIndexToSamplerIndex[locationEntry.index];
if (samplerIndex != GL_INVALID_INDEX) if (samplerIndex != GL_INVALID_INDEX)
...@@ -309,8 +309,8 @@ void ProgramGL::setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformB ...@@ -309,8 +309,8 @@ void ProgramGL::setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformB
// Lazy init // Lazy init
if (mUniformBlockRealLocationMap.empty()) if (mUniformBlockRealLocationMap.empty())
{ {
mUniformBlockRealLocationMap.reserve(mData.getUniformBlocks().size()); mUniformBlockRealLocationMap.reserve(mState.getUniformBlocks().size());
for (const gl::UniformBlock &uniformBlock : mData.getUniformBlocks()) for (const gl::UniformBlock &uniformBlock : mState.getUniformBlocks())
{ {
const std::string &nameWithIndex = uniformBlock.nameWithArrayIndex(); const std::string &nameWithIndex = uniformBlock.nameWithArrayIndex();
GLuint blockIndex = mFunctions->getUniformBlockIndex(mProgramID, nameWithIndex.c_str()); GLuint blockIndex = mFunctions->getUniformBlockIndex(mProgramID, nameWithIndex.c_str());
...@@ -434,8 +434,8 @@ void ProgramGL::postLink() ...@@ -434,8 +434,8 @@ void ProgramGL::postLink()
{ {
// Query the uniform information // Query the uniform information
ASSERT(mUniformRealLocationMap.empty()); ASSERT(mUniformRealLocationMap.empty());
const auto &uniformLocations = mData.getUniformLocations(); const auto &uniformLocations = mState.getUniformLocations();
const auto &uniforms = mData.getUniforms(); const auto &uniforms = mState.getUniforms();
mUniformRealLocationMap.resize(uniformLocations.size(), GL_INVALID_INDEX); mUniformRealLocationMap.resize(uniformLocations.size(), GL_INVALID_INDEX);
for (size_t uniformLocation = 0; uniformLocation < uniformLocations.size(); uniformLocation++) for (size_t uniformLocation = 0; uniformLocation < uniformLocations.size(); uniformLocation++)
{ {
...@@ -460,7 +460,7 @@ void ProgramGL::postLink() ...@@ -460,7 +460,7 @@ void ProgramGL::postLink()
mUniformRealLocationMap[uniformLocation] = realLocation; mUniformRealLocationMap[uniformLocation] = realLocation;
} }
mUniformIndexToSamplerIndex.resize(mData.getUniforms().size(), GL_INVALID_INDEX); mUniformIndexToSamplerIndex.resize(mState.getUniforms().size(), GL_INVALID_INDEX);
for (size_t uniformId = 0; uniformId < uniforms.size(); ++uniformId) for (size_t uniformId = 0; uniformId < uniforms.size(); ++uniformId)
{ {
......
...@@ -27,7 +27,7 @@ struct SamplerBindingGL ...@@ -27,7 +27,7 @@ struct SamplerBindingGL
class ProgramGL : public ProgramImpl class ProgramGL : public ProgramImpl
{ {
public: public:
ProgramGL(const gl::Program::Data &data, ProgramGL(const gl::ProgramState &data,
const FunctionsGL *functions, const FunctionsGL *functions,
const WorkaroundsGL &workarounds, const WorkaroundsGL &workarounds,
StateManagerGL *stateManager); StateManagerGL *stateManager);
......
...@@ -272,12 +272,12 @@ ShaderImpl *RendererGL::createShader(const gl::Shader::Data &data) ...@@ -272,12 +272,12 @@ ShaderImpl *RendererGL::createShader(const gl::Shader::Data &data)
return new ShaderGL(data, mFunctions, mWorkarounds); return new ShaderGL(data, mFunctions, mWorkarounds);
} }
ProgramImpl *RendererGL::createProgram(const gl::Program::Data &data) ProgramImpl *RendererGL::createProgram(const gl::ProgramState &data)
{ {
return new ProgramGL(data, mFunctions, mWorkarounds, mStateManager); return new ProgramGL(data, mFunctions, mWorkarounds, mStateManager);
} }
FramebufferImpl *RendererGL::createFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *RendererGL::createFramebuffer(const gl::FramebufferState &data)
{ {
return new FramebufferGL(data, mFunctions, mStateManager, mWorkarounds, false); return new FramebufferGL(data, mFunctions, mStateManager, mWorkarounds, false);
} }
......
...@@ -63,10 +63,10 @@ class RendererGL : public Renderer ...@@ -63,10 +63,10 @@ class RendererGL : public Renderer
// Shader creation // Shader creation
CompilerImpl *createCompiler() override; CompilerImpl *createCompiler() override;
ShaderImpl *createShader(const gl::Shader::Data &data) override; ShaderImpl *createShader(const gl::Shader::Data &data) override;
ProgramImpl *createProgram(const gl::Program::Data &data) override; ProgramImpl *createProgram(const gl::ProgramState &data) override;
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) override;
// Texture creation // Texture creation
TextureImpl *createTexture(GLenum target) override; TextureImpl *createTexture(GLenum target) override;
......
...@@ -22,7 +22,7 @@ SurfaceGL::~SurfaceGL() ...@@ -22,7 +22,7 @@ SurfaceGL::~SurfaceGL()
{ {
} }
FramebufferImpl *SurfaceGL::createDefaultFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *SurfaceGL::createDefaultFramebuffer(const gl::FramebufferState &data)
{ {
return new FramebufferGL(data, mRenderer->getFunctions(), mRenderer->getStateManager(), return new FramebufferGL(data, mRenderer->getFunctions(), mRenderer->getStateManager(),
mRenderer->getWorkarounds(), true); mRenderer->getWorkarounds(), true);
......
...@@ -28,7 +28,7 @@ class SurfaceGL : public SurfaceImpl ...@@ -28,7 +28,7 @@ class SurfaceGL : public SurfaceImpl
return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL"); return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL");
} }
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &data) override;
virtual egl::Error makeCurrent() = 0; virtual egl::Error makeCurrent() = 0;
......
...@@ -44,7 +44,7 @@ class PbufferSurfaceCGL : public SurfaceGL ...@@ -44,7 +44,7 @@ class PbufferSurfaceCGL : public SurfaceGL
EGLint isPostSubBufferSupported() const override; EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override; EGLint getSwapBehavior() const override;
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override;
private: private:
unsigned mWidth; unsigned mWidth;
......
...@@ -132,10 +132,10 @@ EGLint PbufferSurfaceCGL::getSwapBehavior() const ...@@ -132,10 +132,10 @@ EGLint PbufferSurfaceCGL::getSwapBehavior() const
return EGL_BUFFER_PRESERVED; return EGL_BUFFER_PRESERVED;
} }
FramebufferImpl *PbufferSurfaceCGL::createDefaultFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *PbufferSurfaceCGL::createDefaultFramebuffer(const gl::FramebufferState &state)
{ {
// TODO(cwallez) assert it happens only once? // TODO(cwallez) assert it happens only once?
return new FramebufferGL(mFramebuffer, data, mFunctions, mWorkarounds, mStateManager); return new FramebufferGL(mFramebuffer, state, mFunctions, mWorkarounds, mStateManager);
} }
} }
...@@ -76,7 +76,7 @@ class WindowSurfaceCGL : public SurfaceGL ...@@ -76,7 +76,7 @@ class WindowSurfaceCGL : public SurfaceGL
EGLint isPostSubBufferSupported() const override; EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override; EGLint getSwapBehavior() const override;
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override;
private: private:
SwapLayer *mSwapLayer; SwapLayer *mSwapLayer;
......
...@@ -320,10 +320,10 @@ EGLint WindowSurfaceCGL::getSwapBehavior() const ...@@ -320,10 +320,10 @@ EGLint WindowSurfaceCGL::getSwapBehavior() const
return EGL_BUFFER_DESTROYED; return EGL_BUFFER_DESTROYED;
} }
FramebufferImpl *WindowSurfaceCGL::createDefaultFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *WindowSurfaceCGL::createDefaultFramebuffer(const gl::FramebufferState &state)
{ {
// TODO(cwallez) assert it happens only once? // TODO(cwallez) assert it happens only once?
return new FramebufferGL(mFramebuffer, data, mFunctions, mWorkarounds, mStateManager); return new FramebufferGL(mFramebuffer, state, mFunctions, mWorkarounds, mStateManager);
} }
} }
...@@ -289,7 +289,7 @@ EGLint DXGISwapChainWindowSurfaceWGL::getSwapBehavior() const ...@@ -289,7 +289,7 @@ EGLint DXGISwapChainWindowSurfaceWGL::getSwapBehavior() const
} }
FramebufferImpl *DXGISwapChainWindowSurfaceWGL::createDefaultFramebuffer( FramebufferImpl *DXGISwapChainWindowSurfaceWGL::createDefaultFramebuffer(
const gl::Framebuffer::Data &data) const gl::FramebufferState &data)
{ {
return new FramebufferGL(mFramebufferID, data, mFunctionsGL, mWorkarounds, mStateManager); return new FramebufferGL(mFramebufferID, data, mFunctionsGL, mWorkarounds, mStateManager);
} }
......
...@@ -53,7 +53,7 @@ class DXGISwapChainWindowSurfaceWGL : public SurfaceGL ...@@ -53,7 +53,7 @@ class DXGISwapChainWindowSurfaceWGL : public SurfaceGL
EGLint isPostSubBufferSupported() const override; EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override; EGLint getSwapBehavior() const override;
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &data) override;
private: private:
egl::Error setObjectsLocked(bool locked); egl::Error setObjectsLocked(bool locked);
......
...@@ -23,10 +23,13 @@ class NullFactory : public ImplFactory ...@@ -23,10 +23,13 @@ class NullFactory : public ImplFactory
// Shader creation // Shader creation
CompilerImpl *createCompiler() override { return nullptr; } CompilerImpl *createCompiler() override { return nullptr; }
ShaderImpl *createShader(const gl::Shader::Data &data) override { return nullptr; } ShaderImpl *createShader(const gl::Shader::Data &data) override { return nullptr; }
ProgramImpl *createProgram(const gl::Program::Data &data) override { return nullptr; } ProgramImpl *createProgram(const gl::ProgramState &data) override { return nullptr; }
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override { return nullptr; } FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) override
{
return nullptr;
}
// Texture creation // Texture creation
TextureImpl *createTexture(GLenum target) override { return nullptr; } TextureImpl *createTexture(GLenum target) override { return nullptr; }
...@@ -58,8 +61,8 @@ class MockFactory : public ImplFactory ...@@ -58,8 +61,8 @@ class MockFactory : public ImplFactory
public: public:
MOCK_METHOD0(createCompiler, CompilerImpl *()); MOCK_METHOD0(createCompiler, CompilerImpl *());
MOCK_METHOD1(createShader, ShaderImpl *(const gl::Shader::Data &)); MOCK_METHOD1(createShader, ShaderImpl *(const gl::Shader::Data &));
MOCK_METHOD1(createProgram, ProgramImpl *(const gl::Program::Data &)); MOCK_METHOD1(createProgram, ProgramImpl *(const gl::ProgramState &));
MOCK_METHOD1(createFramebuffer, FramebufferImpl *(const gl::Framebuffer::Data &)); MOCK_METHOD1(createFramebuffer, FramebufferImpl *(const gl::FramebufferState &));
MOCK_METHOD1(createTexture, TextureImpl *(GLenum target)); MOCK_METHOD1(createTexture, TextureImpl *(GLenum target));
MOCK_METHOD0(createRenderbuffer, RenderbufferImpl *()); MOCK_METHOD0(createRenderbuffer, RenderbufferImpl *());
MOCK_METHOD0(createBuffer, BufferImpl *()); MOCK_METHOD0(createBuffer, BufferImpl *());
......
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