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