зеркало из https://github.com/AvaloniaUI/angle.git
Pass ContextImpl to Framebuffer methods instead of ContextState.
BUG=angleproject:1363 Change-Id: I7e7524d95f2ca31c35918f9fe5c0cb681ed93616 Reviewed-on: https://chromium-review.googlesource.com/340746 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
437fa654e3
Коммит
8415b5fd4a
|
@ -134,7 +134,7 @@ Context::Context(const egl::Config *config,
|
|||
nullptr,
|
||||
mLimitations,
|
||||
GetNoError(attribs)),
|
||||
mImplementation(renderer->createContext()),
|
||||
mImplementation(renderer->createContext(getData())),
|
||||
mCompiler(nullptr),
|
||||
mRenderer(renderer),
|
||||
mClientVersion(GetClientVersion(attribs)),
|
||||
|
@ -2158,9 +2158,6 @@ void Context::blitFramebuffer(GLint srcX0,
|
|||
GLbitfield mask,
|
||||
GLenum filter)
|
||||
{
|
||||
Framebuffer *readFramebuffer = mState.getReadFramebuffer();
|
||||
ASSERT(readFramebuffer);
|
||||
|
||||
Framebuffer *drawFramebuffer = mState.getDrawFramebuffer();
|
||||
ASSERT(drawFramebuffer);
|
||||
|
||||
|
@ -2169,31 +2166,34 @@ void Context::blitFramebuffer(GLint srcX0,
|
|||
|
||||
syncStateForBlit();
|
||||
|
||||
handleError(drawFramebuffer->blit(mState, srcArea, dstArea, mask, filter, readFramebuffer));
|
||||
handleError(drawFramebuffer->blit(mImplementation.get(), srcArea, dstArea, mask, filter));
|
||||
}
|
||||
|
||||
void Context::clear(GLbitfield mask)
|
||||
{
|
||||
syncStateForClear();
|
||||
handleError(mState.getDrawFramebuffer()->clear(mData, mask));
|
||||
handleError(mState.getDrawFramebuffer()->clear(mImplementation.get(), mask));
|
||||
}
|
||||
|
||||
void Context::clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values)
|
||||
{
|
||||
syncStateForClear();
|
||||
handleError(mState.getDrawFramebuffer()->clearBufferfv(mData, buffer, drawbuffer, values));
|
||||
handleError(mState.getDrawFramebuffer()->clearBufferfv(mImplementation.get(), buffer,
|
||||
drawbuffer, values));
|
||||
}
|
||||
|
||||
void Context::clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values)
|
||||
{
|
||||
syncStateForClear();
|
||||
handleError(mState.getDrawFramebuffer()->clearBufferuiv(mData, buffer, drawbuffer, values));
|
||||
handleError(mState.getDrawFramebuffer()->clearBufferuiv(mImplementation.get(), buffer,
|
||||
drawbuffer, values));
|
||||
}
|
||||
|
||||
void Context::clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values)
|
||||
{
|
||||
syncStateForClear();
|
||||
handleError(mState.getDrawFramebuffer()->clearBufferiv(mData, buffer, drawbuffer, values));
|
||||
handleError(mState.getDrawFramebuffer()->clearBufferiv(mImplementation.get(), buffer,
|
||||
drawbuffer, values));
|
||||
}
|
||||
|
||||
void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
|
||||
|
@ -2209,7 +2209,8 @@ void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLin
|
|||
}
|
||||
|
||||
syncStateForClear();
|
||||
handleError(framebufferObject->clearBufferfi(mData, buffer, drawbuffer, depth, stencil));
|
||||
handleError(framebufferObject->clearBufferfi(mImplementation.get(), buffer, drawbuffer, depth,
|
||||
stencil));
|
||||
}
|
||||
|
||||
void Context::readPixels(GLint x,
|
||||
|
@ -2226,7 +2227,7 @@ void Context::readPixels(GLint x,
|
|||
ASSERT(framebufferObject);
|
||||
|
||||
Rectangle area(x, y, width, height);
|
||||
handleError(framebufferObject->readPixels(mState, area, format, type, pixels));
|
||||
handleError(framebufferObject->readPixels(mImplementation.get(), area, format, type, pixels));
|
||||
}
|
||||
|
||||
void Context::copyTexImage2D(GLenum target,
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "libANGLE/Surface.h"
|
||||
#include "libANGLE/Texture.h"
|
||||
#include "libANGLE/formatutils.h"
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
#include "libANGLE/renderer/FramebufferImpl.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
#include "libANGLE/renderer/RenderbufferImpl.h"
|
||||
|
@ -613,67 +614,67 @@ Error Framebuffer::invalidateSub(size_t count, const GLenum *attachments, const
|
|||
return mImpl->invalidateSub(count, attachments, area);
|
||||
}
|
||||
|
||||
Error Framebuffer::clear(const ContextState &data, GLbitfield mask)
|
||||
Error Framebuffer::clear(rx::ContextImpl *context, GLbitfield mask)
|
||||
{
|
||||
if (data.state->isRasterizerDiscardEnabled())
|
||||
if (context->getState().isRasterizerDiscardEnabled())
|
||||
{
|
||||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
return mImpl->clear(data, mask);
|
||||
return mImpl->clear(context, mask);
|
||||
}
|
||||
|
||||
Error Framebuffer::clearBufferfv(const ContextState &data,
|
||||
Error Framebuffer::clearBufferfv(rx::ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLfloat *values)
|
||||
{
|
||||
if (data.state->isRasterizerDiscardEnabled())
|
||||
if (context->getState().isRasterizerDiscardEnabled())
|
||||
{
|
||||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
return mImpl->clearBufferfv(data, buffer, drawbuffer, values);
|
||||
return mImpl->clearBufferfv(context, buffer, drawbuffer, values);
|
||||
}
|
||||
|
||||
Error Framebuffer::clearBufferuiv(const ContextState &data,
|
||||
Error Framebuffer::clearBufferuiv(rx::ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLuint *values)
|
||||
{
|
||||
if (data.state->isRasterizerDiscardEnabled())
|
||||
if (context->getState().isRasterizerDiscardEnabled())
|
||||
{
|
||||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
return mImpl->clearBufferuiv(data, buffer, drawbuffer, values);
|
||||
return mImpl->clearBufferuiv(context, buffer, drawbuffer, values);
|
||||
}
|
||||
|
||||
Error Framebuffer::clearBufferiv(const ContextState &data,
|
||||
Error Framebuffer::clearBufferiv(rx::ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLint *values)
|
||||
{
|
||||
if (data.state->isRasterizerDiscardEnabled())
|
||||
if (context->getState().isRasterizerDiscardEnabled())
|
||||
{
|
||||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
return mImpl->clearBufferiv(data, buffer, drawbuffer, values);
|
||||
return mImpl->clearBufferiv(context, buffer, drawbuffer, values);
|
||||
}
|
||||
|
||||
Error Framebuffer::clearBufferfi(const ContextState &data,
|
||||
Error Framebuffer::clearBufferfi(rx::ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
GLfloat depth,
|
||||
GLint stencil)
|
||||
{
|
||||
if (data.state->isRasterizerDiscardEnabled())
|
||||
if (context->getState().isRasterizerDiscardEnabled())
|
||||
{
|
||||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
return mImpl->clearBufferfi(data, buffer, drawbuffer, depth, stencil);
|
||||
return mImpl->clearBufferfi(context, buffer, drawbuffer, depth, stencil);
|
||||
}
|
||||
|
||||
GLenum Framebuffer::getImplementationColorReadFormat() const
|
||||
|
@ -686,19 +687,19 @@ GLenum Framebuffer::getImplementationColorReadType() const
|
|||
return mImpl->getImplementationColorReadType();
|
||||
}
|
||||
|
||||
Error Framebuffer::readPixels(const State &state,
|
||||
Error Framebuffer::readPixels(rx::ContextImpl *context,
|
||||
const Rectangle &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
GLvoid *pixels) const
|
||||
{
|
||||
Error error = mImpl->readPixels(state, area, format, type, pixels);
|
||||
Error error = mImpl->readPixels(context, area, format, type, pixels);
|
||||
if (error.isError())
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
Buffer *unpackBuffer = state.getUnpackState().pixelBuffer.get();
|
||||
Buffer *unpackBuffer = context->getState().getUnpackState().pixelBuffer.get();
|
||||
if (unpackBuffer)
|
||||
{
|
||||
unpackBuffer->onPixelUnpack();
|
||||
|
@ -707,14 +708,13 @@ Error Framebuffer::readPixels(const State &state,
|
|||
return Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
Error Framebuffer::blit(const State &state,
|
||||
Error Framebuffer::blit(rx::ContextImpl *context,
|
||||
const Rectangle &sourceArea,
|
||||
const Rectangle &destArea,
|
||||
GLbitfield mask,
|
||||
GLenum filter,
|
||||
const Framebuffer *sourceFramebuffer)
|
||||
GLenum filter)
|
||||
{
|
||||
return mImpl->blit(state, sourceArea, destArea, mask, filter, sourceFramebuffer);
|
||||
return mImpl->blit(context, sourceArea, destArea, mask, filter);
|
||||
}
|
||||
|
||||
int Framebuffer::getSamples(const ContextState &data) const
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace rx
|
||||
{
|
||||
class ContextImpl;
|
||||
class ImplFactory;
|
||||
class FramebufferImpl;
|
||||
class RenderbufferImpl;
|
||||
|
@ -143,20 +144,20 @@ class Framebuffer final : public LabeledObject
|
|||
Error invalidate(size_t count, const GLenum *attachments);
|
||||
Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &area);
|
||||
|
||||
Error clear(const ContextState &data, GLbitfield mask);
|
||||
Error clearBufferfv(const ContextState &data,
|
||||
Error clear(rx::ContextImpl *context, GLbitfield mask);
|
||||
Error clearBufferfv(rx::ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLfloat *values);
|
||||
Error clearBufferuiv(const ContextState &data,
|
||||
Error clearBufferuiv(rx::ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLuint *values);
|
||||
Error clearBufferiv(const ContextState &data,
|
||||
Error clearBufferiv(rx::ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLint *values);
|
||||
Error clearBufferfi(const ContextState &data,
|
||||
Error clearBufferfi(rx::ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
GLfloat depth,
|
||||
|
@ -164,18 +165,17 @@ class Framebuffer final : public LabeledObject
|
|||
|
||||
GLenum getImplementationColorReadFormat() const;
|
||||
GLenum getImplementationColorReadType() const;
|
||||
Error readPixels(const gl::State &state,
|
||||
Error readPixels(rx::ContextImpl *context,
|
||||
const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
GLvoid *pixels) const;
|
||||
|
||||
Error blit(const State &state,
|
||||
Error blit(rx::ContextImpl *context,
|
||||
const Rectangle &sourceArea,
|
||||
const Rectangle &destArea,
|
||||
GLbitfield mask,
|
||||
GLenum filter,
|
||||
const Framebuffer *sourceFramebuffer);
|
||||
GLenum filter);
|
||||
|
||||
enum DirtyBitType
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define LIBANGLE_RENDERER_CONTEXTIMPL_H_
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "libANGLE/Error.h"
|
||||
#include "libANGLE/ContextState.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
@ -20,10 +20,20 @@ class Renderer;
|
|||
class ContextImpl : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
ContextImpl() {}
|
||||
ContextImpl(const gl::ContextState &state) : mState(state) {}
|
||||
virtual ~ContextImpl() {}
|
||||
|
||||
virtual gl::Error initialize(Renderer *renderer) = 0;
|
||||
|
||||
int getClientVersion() const { return mState.clientVersion; }
|
||||
const gl::State &getState() const { return *mState.state; }
|
||||
const gl::Caps &getCaps() const { return *mState.caps; }
|
||||
const gl::TextureCapsMap &getTextureCaps() const { return *mState.textureCaps; }
|
||||
const gl::Extensions &getExtensions() const { return *mState.extensions; }
|
||||
const gl::Limitations &getLimitations() const { return *mState.limitations; }
|
||||
|
||||
private:
|
||||
const gl::ContextState &mState;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
|
|
@ -35,20 +35,20 @@ class FramebufferImpl : angle::NonCopyable
|
|||
virtual gl::Error invalidate(size_t count, const GLenum *attachments) = 0;
|
||||
virtual gl::Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &area) = 0;
|
||||
|
||||
virtual gl::Error clear(const gl::ContextState &data, GLbitfield mask) = 0;
|
||||
virtual gl::Error clearBufferfv(const gl::ContextState &data,
|
||||
virtual gl::Error clear(ContextImpl *context, GLbitfield mask) = 0;
|
||||
virtual gl::Error clearBufferfv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLfloat *values) = 0;
|
||||
virtual gl::Error clearBufferuiv(const gl::ContextState &data,
|
||||
virtual gl::Error clearBufferuiv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLuint *values) = 0;
|
||||
virtual gl::Error clearBufferiv(const gl::ContextState &data,
|
||||
virtual gl::Error clearBufferiv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLint *values) = 0;
|
||||
virtual gl::Error clearBufferfi(const gl::ContextState &data,
|
||||
virtual gl::Error clearBufferfi(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
GLfloat depth,
|
||||
|
@ -56,10 +56,17 @@ class FramebufferImpl : angle::NonCopyable
|
|||
|
||||
virtual GLenum getImplementationColorReadFormat() const = 0;
|
||||
virtual GLenum getImplementationColorReadType() const = 0;
|
||||
virtual gl::Error readPixels(const gl::State &state, const gl::Rectangle &area, GLenum format, GLenum type, GLvoid *pixels) const = 0;
|
||||
virtual gl::Error readPixels(ContextImpl *context,
|
||||
const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
GLvoid *pixels) const = 0;
|
||||
|
||||
virtual gl::Error blit(const gl::State &state, const gl::Rectangle &sourceArea, const gl::Rectangle &destArea,
|
||||
GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer) = 0;
|
||||
virtual gl::Error blit(ContextImpl *context,
|
||||
const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
GLbitfield mask,
|
||||
GLenum filter) = 0;
|
||||
|
||||
virtual bool checkStatus() const = 0;
|
||||
|
||||
|
|
|
@ -27,27 +27,20 @@ class MockFramebufferImpl : public rx::FramebufferImpl
|
|||
MOCK_METHOD2(invalidate, gl::Error(size_t, const GLenum *));
|
||||
MOCK_METHOD3(invalidateSub, gl::Error(size_t, const GLenum *, const gl::Rectangle &));
|
||||
|
||||
MOCK_METHOD2(clear, gl::Error(const gl::ContextState &, GLbitfield));
|
||||
MOCK_METHOD4(clearBufferfv,
|
||||
gl::Error(const gl::ContextState &, GLenum, GLint, const GLfloat *));
|
||||
MOCK_METHOD4(clearBufferuiv,
|
||||
gl::Error(const gl::ContextState &, GLenum, GLint, const GLuint *));
|
||||
MOCK_METHOD4(clearBufferiv, gl::Error(const gl::ContextState &, GLenum, GLint, const GLint *));
|
||||
MOCK_METHOD5(clearBufferfi, gl::Error(const gl::ContextState &, GLenum, GLint, GLfloat, GLint));
|
||||
MOCK_METHOD2(clear, gl::Error(ContextImpl *, GLbitfield));
|
||||
MOCK_METHOD4(clearBufferfv, gl::Error(ContextImpl *, GLenum, GLint, const GLfloat *));
|
||||
MOCK_METHOD4(clearBufferuiv, gl::Error(ContextImpl *, GLenum, GLint, const GLuint *));
|
||||
MOCK_METHOD4(clearBufferiv, gl::Error(ContextImpl *, GLenum, GLint, const GLint *));
|
||||
MOCK_METHOD5(clearBufferfi, gl::Error(ContextImpl *, GLenum, GLint, GLfloat, GLint));
|
||||
|
||||
MOCK_CONST_METHOD0(getImplementationColorReadFormat, GLenum());
|
||||
MOCK_CONST_METHOD0(getImplementationColorReadType, GLenum());
|
||||
MOCK_CONST_METHOD5(
|
||||
readPixels,
|
||||
gl::Error(const gl::State &, const gl::Rectangle &, GLenum, GLenum, GLvoid *));
|
||||
MOCK_CONST_METHOD5(readPixels,
|
||||
gl::Error(ContextImpl *, const gl::Rectangle &, GLenum, GLenum, GLvoid *));
|
||||
|
||||
MOCK_METHOD6(blit,
|
||||
gl::Error(const gl::State &,
|
||||
const gl::Rectangle &,
|
||||
const gl::Rectangle &,
|
||||
GLbitfield,
|
||||
GLenum,
|
||||
const gl::Framebuffer *));
|
||||
MOCK_METHOD5(
|
||||
blit,
|
||||
gl::Error(ContextImpl *, const gl::Rectangle &, const gl::Rectangle &, GLbitfield, GLenum));
|
||||
|
||||
MOCK_CONST_METHOD0(checkStatus, bool());
|
||||
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
#include "libANGLE/Shader.h"
|
||||
#include "libANGLE/VertexArray.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
struct ContextState;
|
||||
}
|
||||
|
||||
namespace rx
|
||||
{
|
||||
class BufferImpl;
|
||||
|
@ -39,7 +44,7 @@ class ImplFactory : angle::NonCopyable
|
|||
virtual ~ImplFactory() {}
|
||||
|
||||
// Context creation
|
||||
virtual ContextImpl *createContext() = 0;
|
||||
virtual ContextImpl *createContext(const gl::ContextState &state) = 0;
|
||||
|
||||
// Shader creation
|
||||
virtual CompilerImpl *createCompiler() = 0;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "libANGLE/Framebuffer.h"
|
||||
#include "libANGLE/FramebufferAttachment.h"
|
||||
#include "libANGLE/Surface.h"
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
#include "libANGLE/renderer/d3d/RendererD3D.h"
|
||||
#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
|
||||
#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
|
||||
|
@ -94,20 +95,19 @@ FramebufferD3D::~FramebufferD3D()
|
|||
{
|
||||
}
|
||||
|
||||
gl::Error FramebufferD3D::clear(const gl::ContextState &data, GLbitfield mask)
|
||||
gl::Error FramebufferD3D::clear(ContextImpl *context, GLbitfield mask)
|
||||
{
|
||||
const gl::State &state = *data.state;
|
||||
ClearParameters clearParams = GetClearParameters(state, mask);
|
||||
return clear(data, clearParams);
|
||||
ClearParameters clearParams = GetClearParameters(context->getState(), mask);
|
||||
return clearImpl(context, clearParams);
|
||||
}
|
||||
|
||||
gl::Error FramebufferD3D::clearBufferfv(const gl::ContextState &data,
|
||||
gl::Error FramebufferD3D::clearBufferfv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLfloat *values)
|
||||
{
|
||||
// glClearBufferfv can be called to clear the color buffer or depth buffer
|
||||
ClearParameters clearParams = GetClearParameters(*data.state, 0);
|
||||
ClearParameters clearParams = GetClearParameters(context->getState(), 0);
|
||||
|
||||
if (buffer == GL_COLOR)
|
||||
{
|
||||
|
@ -125,16 +125,16 @@ gl::Error FramebufferD3D::clearBufferfv(const gl::ContextState &data,
|
|||
clearParams.depthClearValue = values[0];
|
||||
}
|
||||
|
||||
return clear(data, clearParams);
|
||||
return clearImpl(context, clearParams);
|
||||
}
|
||||
|
||||
gl::Error FramebufferD3D::clearBufferuiv(const gl::ContextState &data,
|
||||
gl::Error FramebufferD3D::clearBufferuiv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLuint *values)
|
||||
{
|
||||
// glClearBufferuiv can only be called to clear a color buffer
|
||||
ClearParameters clearParams = GetClearParameters(*data.state, 0);
|
||||
ClearParameters clearParams = GetClearParameters(context->getState(), 0);
|
||||
for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
|
||||
{
|
||||
clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
|
||||
|
@ -142,16 +142,16 @@ gl::Error FramebufferD3D::clearBufferuiv(const gl::ContextState &data,
|
|||
clearParams.colorUIClearValue = gl::ColorUI(values[0], values[1], values[2], values[3]);
|
||||
clearParams.colorClearType = GL_UNSIGNED_INT;
|
||||
|
||||
return clear(data, clearParams);
|
||||
return clearImpl(context, clearParams);
|
||||
}
|
||||
|
||||
gl::Error FramebufferD3D::clearBufferiv(const gl::ContextState &data,
|
||||
gl::Error FramebufferD3D::clearBufferiv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLint *values)
|
||||
{
|
||||
// glClearBufferiv can be called to clear the color buffer or stencil buffer
|
||||
ClearParameters clearParams = GetClearParameters(*data.state, 0);
|
||||
ClearParameters clearParams = GetClearParameters(context->getState(), 0);
|
||||
|
||||
if (buffer == GL_COLOR)
|
||||
{
|
||||
|
@ -169,23 +169,23 @@ gl::Error FramebufferD3D::clearBufferiv(const gl::ContextState &data,
|
|||
clearParams.stencilClearValue = values[1];
|
||||
}
|
||||
|
||||
return clear(data, clearParams);
|
||||
return clearImpl(context, clearParams);
|
||||
}
|
||||
|
||||
gl::Error FramebufferD3D::clearBufferfi(const gl::ContextState &data,
|
||||
gl::Error FramebufferD3D::clearBufferfi(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
GLfloat depth,
|
||||
GLint stencil)
|
||||
{
|
||||
// glClearBufferfi can only be called to clear a depth stencil buffer
|
||||
ClearParameters clearParams = GetClearParameters(*data.state, 0);
|
||||
ClearParameters clearParams = GetClearParameters(context->getState(), 0);
|
||||
clearParams.clearDepth = true;
|
||||
clearParams.depthClearValue = depth;
|
||||
clearParams.clearStencil = true;
|
||||
clearParams.stencilClearValue = stencil;
|
||||
|
||||
return clear(data, clearParams);
|
||||
return clearImpl(context, clearParams);
|
||||
}
|
||||
|
||||
GLenum FramebufferD3D::getImplementationColorReadFormat() const
|
||||
|
@ -232,9 +232,13 @@ GLenum FramebufferD3D::getImplementationColorReadType() const
|
|||
return implementationFormatInfo.type;
|
||||
}
|
||||
|
||||
gl::Error FramebufferD3D::readPixels(const gl::State &state, const gl::Rectangle &area, GLenum format, GLenum type, GLvoid *pixels) const
|
||||
gl::Error FramebufferD3D::readPixels(ContextImpl *context,
|
||||
const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
GLvoid *pixels) const
|
||||
{
|
||||
const gl::PixelPackState &packState = state.getPackState();
|
||||
const gl::PixelPackState &packState = context->getState().getPackState();
|
||||
|
||||
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(format, type);
|
||||
const gl::InternalFormat &sizedFormatInfo = gl::GetInternalFormatInfo(sizedInternalFormat);
|
||||
|
@ -247,9 +251,14 @@ gl::Error FramebufferD3D::readPixels(const gl::State &state, const gl::Rectangle
|
|||
reinterpret_cast<uint8_t *>(pixels) + outputSkipBytes);
|
||||
}
|
||||
|
||||
gl::Error FramebufferD3D::blit(const gl::State &state, const gl::Rectangle &sourceArea, const gl::Rectangle &destArea,
|
||||
GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer)
|
||||
gl::Error FramebufferD3D::blit(ContextImpl *context,
|
||||
const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
GLbitfield mask,
|
||||
GLenum filter)
|
||||
{
|
||||
const auto &glState = context->getState();
|
||||
const gl::Framebuffer *sourceFramebuffer = glState.getReadFramebuffer();
|
||||
bool blitRenderTarget = false;
|
||||
if ((mask & GL_COLOR_BUFFER_BIT) && sourceFramebuffer->getReadColorbuffer() != nullptr &&
|
||||
mState.getFirstColorAttachment() != nullptr)
|
||||
|
@ -273,9 +282,10 @@ gl::Error FramebufferD3D::blit(const gl::State &state, const gl::Rectangle &sour
|
|||
|
||||
if (blitRenderTarget || blitDepth || blitStencil)
|
||||
{
|
||||
const gl::Rectangle *scissor = state.isScissorTestEnabled() ? &state.getScissor() : NULL;
|
||||
gl::Error error = blit(sourceArea, destArea, scissor, blitRenderTarget, blitDepth, blitStencil,
|
||||
filter, sourceFramebuffer);
|
||||
const gl::Rectangle *scissor =
|
||||
glState.isScissorTestEnabled() ? &glState.getScissor() : nullptr;
|
||||
gl::Error error = blitImpl(sourceArea, destArea, scissor, blitRenderTarget, blitDepth,
|
||||
blitStencil, filter, sourceFramebuffer);
|
||||
if (error.isError())
|
||||
{
|
||||
return error;
|
||||
|
|
|
@ -60,20 +60,20 @@ class FramebufferD3D : public FramebufferImpl
|
|||
FramebufferD3D(const gl::FramebufferState &data, RendererD3D *renderer);
|
||||
virtual ~FramebufferD3D();
|
||||
|
||||
gl::Error clear(const gl::ContextState &data, GLbitfield mask) override;
|
||||
gl::Error clearBufferfv(const gl::ContextState &data,
|
||||
gl::Error clear(ContextImpl *impl, GLbitfield mask) override;
|
||||
gl::Error clearBufferfv(ContextImpl *impl,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLfloat *values) override;
|
||||
gl::Error clearBufferuiv(const gl::ContextState &data,
|
||||
gl::Error clearBufferuiv(ContextImpl *impl,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLuint *values) override;
|
||||
gl::Error clearBufferiv(const gl::ContextState &data,
|
||||
gl::Error clearBufferiv(ContextImpl *impl,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLint *values) override;
|
||||
gl::Error clearBufferfi(const gl::ContextState &data,
|
||||
gl::Error clearBufferfi(ContextImpl *impl,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
GLfloat depth,
|
||||
|
@ -81,10 +81,17 @@ class FramebufferD3D : public FramebufferImpl
|
|||
|
||||
GLenum getImplementationColorReadFormat() const override;
|
||||
GLenum getImplementationColorReadType() const override;
|
||||
gl::Error readPixels(const gl::State &state, const gl::Rectangle &area, GLenum format, GLenum type, GLvoid *pixels) const override;
|
||||
gl::Error readPixels(ContextImpl *impl,
|
||||
const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
GLvoid *pixels) const override;
|
||||
|
||||
gl::Error blit(const gl::State &state, const gl::Rectangle &sourceArea, const gl::Rectangle &destArea,
|
||||
GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer) override;
|
||||
gl::Error blit(ContextImpl *impl,
|
||||
const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
GLbitfield mask,
|
||||
GLenum filter) override;
|
||||
|
||||
bool checkStatus() const override;
|
||||
|
||||
|
@ -93,7 +100,7 @@ class FramebufferD3D : public FramebufferImpl
|
|||
const gl::AttachmentList &getColorAttachmentsForRender() const;
|
||||
|
||||
private:
|
||||
virtual gl::Error clear(const gl::ContextState &data, const ClearParameters &clearParams) = 0;
|
||||
virtual gl::Error clearImpl(ContextImpl *impl, const ClearParameters &clearParams) = 0;
|
||||
|
||||
virtual gl::Error readPixelsImpl(const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
|
@ -102,9 +109,14 @@ class FramebufferD3D : public FramebufferImpl
|
|||
const gl::PixelPackState &pack,
|
||||
uint8_t *pixels) const = 0;
|
||||
|
||||
virtual gl::Error blit(const gl::Rectangle &sourceArea, const gl::Rectangle &destArea, const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer) = 0;
|
||||
virtual gl::Error blitImpl(const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget,
|
||||
bool blitDepth,
|
||||
bool blitStencil,
|
||||
GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer) = 0;
|
||||
|
||||
virtual GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const = 0;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace rx
|
|||
class Context11 : public ContextImpl
|
||||
{
|
||||
public:
|
||||
Context11() {}
|
||||
Context11(const gl::ContextState &state) : ContextImpl(state) {}
|
||||
~Context11() override {}
|
||||
|
||||
gl::Error initialize(Renderer *renderer) override { return gl::NoError(); }
|
||||
|
|
|
@ -144,7 +144,7 @@ gl::Error Framebuffer11::invalidateSwizzles() const
|
|||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
gl::Error Framebuffer11::clear(const gl::ContextState &data, const ClearParameters &clearParams)
|
||||
gl::Error Framebuffer11::clearImpl(ContextImpl *context, const ClearParameters &clearParams)
|
||||
{
|
||||
Clear11 *clearer = mRenderer->getClearer();
|
||||
gl::Error error(GL_NO_ERROR);
|
||||
|
@ -368,9 +368,14 @@ gl::Error Framebuffer11::readPixelsImpl(const gl::Rectangle &area,
|
|||
static_cast<GLuint>(outputPitch), pack, pixels);
|
||||
}
|
||||
|
||||
gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectangle &destArea, const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer)
|
||||
gl::Error Framebuffer11::blitImpl(const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget,
|
||||
bool blitDepth,
|
||||
bool blitStencil,
|
||||
GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer)
|
||||
{
|
||||
if (blitRenderTarget)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ class Framebuffer11 : public FramebufferD3D
|
|||
void syncInternalState() const;
|
||||
|
||||
private:
|
||||
gl::Error clear(const gl::ContextState &data, const ClearParameters &clearParams) override;
|
||||
gl::Error clearImpl(ContextImpl *context, const ClearParameters &clearParams) override;
|
||||
|
||||
gl::Error readPixelsImpl(const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
|
@ -57,9 +57,14 @@ class Framebuffer11 : public FramebufferD3D
|
|||
const gl::PixelPackState &pack,
|
||||
uint8_t *pixels) const override;
|
||||
|
||||
gl::Error blit(const gl::Rectangle &sourceArea, const gl::Rectangle &destArea, const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer) override;
|
||||
gl::Error blitImpl(const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget,
|
||||
bool blitDepth,
|
||||
bool blitStencil,
|
||||
GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer) override;
|
||||
|
||||
gl::Error invalidateBase(size_t count, const GLenum *attachments, bool useEXTBehavior) const;
|
||||
|
||||
|
|
|
@ -1144,9 +1144,9 @@ SwapChainD3D *Renderer11::createSwapChain(NativeWindowD3D *nativeWindow,
|
|||
depthBufferFormat, orientation);
|
||||
}
|
||||
|
||||
ContextImpl *Renderer11::createContext()
|
||||
ContextImpl *Renderer11::createContext(const gl::ContextState &state)
|
||||
{
|
||||
return new Context11;
|
||||
return new Context11(state);
|
||||
}
|
||||
|
||||
CompilerImpl *Renderer11::createCompiler()
|
||||
|
|
|
@ -124,7 +124,7 @@ class Renderer11 : public RendererD3D
|
|||
GLenum depthBufferFormat,
|
||||
EGLint orientation) override;
|
||||
|
||||
ContextImpl *createContext() override;
|
||||
ContextImpl *createContext(const gl::ContextState &state) override;
|
||||
|
||||
CompilerImpl *createCompiler() override;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace rx
|
|||
class Context9 : public ContextImpl
|
||||
{
|
||||
public:
|
||||
Context9() {}
|
||||
Context9(const gl::ContextState &state) : ContextImpl(state) {}
|
||||
~Context9() override {}
|
||||
|
||||
gl::Error initialize(Renderer *renderer) override { return gl::NoError(); }
|
||||
|
|
|
@ -7,16 +7,18 @@
|
|||
// Framebuffer9.cpp: Implements the Framebuffer9 class.
|
||||
|
||||
#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
|
||||
#include "libANGLE/renderer/d3d/TextureD3D.h"
|
||||
#include "libANGLE/formatutils.h"
|
||||
|
||||
#include "libANGLE/Framebuffer.h"
|
||||
#include "libANGLE/FramebufferAttachment.h"
|
||||
#include "libANGLE/Texture.h"
|
||||
#include "libANGLE/formatutils.h"
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
#include "libANGLE/renderer/d3d/TextureD3D.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
|
||||
#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
@ -52,7 +54,7 @@ gl::Error Framebuffer9::invalidateSub(size_t, const GLenum *, const gl::Rectangl
|
|||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
gl::Error Framebuffer9::clear(const gl::ContextState &data, const ClearParameters &clearParams)
|
||||
gl::Error Framebuffer9::clearImpl(ContextImpl *context, const ClearParameters &clearParams)
|
||||
{
|
||||
const gl::FramebufferAttachment *colorAttachment = mState.getColorAttachment(0);
|
||||
const gl::FramebufferAttachment *depthStencilAttachment = mState.getDepthOrStencilAttachment();
|
||||
|
@ -63,12 +65,13 @@ gl::Error Framebuffer9::clear(const gl::ContextState &data, const ClearParameter
|
|||
return error;
|
||||
}
|
||||
|
||||
float nearZ = data.state->getNearPlane();
|
||||
float farZ = data.state->getFarPlane();
|
||||
mRenderer->setViewport(data.caps, data.state->getViewport(), nearZ, farZ, GL_TRIANGLES,
|
||||
data.state->getRasterizerState().frontFace, true);
|
||||
const gl::State &glState = context->getState();
|
||||
float nearZ = glState.getNearPlane();
|
||||
float farZ = glState.getFarPlane();
|
||||
mRenderer->setViewport(glState.getViewport(), nearZ, farZ, GL_TRIANGLES,
|
||||
glState.getRasterizerState().frontFace, true);
|
||||
|
||||
mRenderer->setScissorRectangle(data.state->getScissor(), data.state->isScissorTestEnabled());
|
||||
mRenderer->setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
|
||||
|
||||
return mRenderer->clear(clearParams, colorAttachment, depthStencilAttachment);
|
||||
}
|
||||
|
@ -256,9 +259,14 @@ gl::Error Framebuffer9::readPixelsImpl(const gl::Rectangle &area,
|
|||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangle &destArea, const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer)
|
||||
gl::Error Framebuffer9::blitImpl(const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget,
|
||||
bool blitDepth,
|
||||
bool blitStencil,
|
||||
GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer)
|
||||
{
|
||||
ASSERT(filter == GL_NEAREST);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class Framebuffer9 : public FramebufferD3D
|
|||
gl::Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &area) override;
|
||||
|
||||
private:
|
||||
gl::Error clear(const gl::ContextState &data, const ClearParameters &clearParams) override;
|
||||
gl::Error clearImpl(ContextImpl *context, const ClearParameters &clearParams) override;
|
||||
|
||||
gl::Error readPixelsImpl(const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
|
@ -35,9 +35,14 @@ class Framebuffer9 : public FramebufferD3D
|
|||
const gl::PixelPackState &pack,
|
||||
uint8_t *pixels) const override;
|
||||
|
||||
gl::Error blit(const gl::Rectangle &sourceArea, const gl::Rectangle &destArea, const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer) override;
|
||||
gl::Error blitImpl(const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
const gl::Rectangle *scissor,
|
||||
bool blitRenderTarget,
|
||||
bool blitDepth,
|
||||
bool blitStencil,
|
||||
GLenum filter,
|
||||
const gl::Framebuffer *sourceFramebuffer) override;
|
||||
|
||||
GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override;
|
||||
|
||||
|
|
|
@ -681,9 +681,9 @@ SwapChainD3D *Renderer9::createSwapChain(NativeWindowD3D *nativeWindow,
|
|||
depthBufferFormat, orientation);
|
||||
}
|
||||
|
||||
ContextImpl *Renderer9::createContext()
|
||||
ContextImpl *Renderer9::createContext(const gl::ContextState &state)
|
||||
{
|
||||
return new Context9;
|
||||
return new Context9(state);
|
||||
}
|
||||
|
||||
CompilerImpl *Renderer9::createCompiler()
|
||||
|
@ -949,9 +949,8 @@ gl::Error Renderer9::updateState(const gl::ContextState &data, GLenum drawMode)
|
|||
}
|
||||
|
||||
// Setting viewport state
|
||||
setViewport(data.caps, data.state->getViewport(), data.state->getNearPlane(),
|
||||
data.state->getFarPlane(), drawMode, data.state->getRasterizerState().frontFace,
|
||||
false);
|
||||
setViewport(data.state->getViewport(), data.state->getNearPlane(), data.state->getFarPlane(),
|
||||
drawMode, data.state->getRasterizerState().frontFace, false);
|
||||
|
||||
// Setting scissors state
|
||||
setScissorRectangle(data.state->getScissor(), data.state->isScissorTestEnabled());
|
||||
|
@ -991,16 +990,14 @@ gl::Error Renderer9::setBlendDepthRasterStates(const gl::ContextState &glData, G
|
|||
return mStateManager.setBlendDepthRasterStates(*glData.state, mask);
|
||||
}
|
||||
|
||||
void Renderer9::setViewport(const gl::Caps *caps,
|
||||
const gl::Rectangle &viewport,
|
||||
void Renderer9::setViewport(const gl::Rectangle &viewport,
|
||||
float zNear,
|
||||
float zFar,
|
||||
GLenum drawMode,
|
||||
GLenum frontFace,
|
||||
bool ignoreViewport)
|
||||
{
|
||||
mStateManager.setViewportState(caps, viewport, zNear, zFar, drawMode, frontFace,
|
||||
ignoreViewport);
|
||||
mStateManager.setViewportState(viewport, zNear, zFar, drawMode, frontFace, ignoreViewport);
|
||||
}
|
||||
|
||||
bool Renderer9::applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSize)
|
||||
|
|
|
@ -90,7 +90,7 @@ class Renderer9 : public RendererD3D
|
|||
GLenum depthBufferFormat,
|
||||
EGLint orientation) override;
|
||||
|
||||
ContextImpl *createContext() override;
|
||||
ContextImpl *createContext(const gl::ContextState &state) override;
|
||||
|
||||
CompilerImpl *createCompiler() override;
|
||||
|
||||
|
@ -113,8 +113,7 @@ class Renderer9 : public RendererD3D
|
|||
gl::Error updateState(const gl::ContextState &data, GLenum drawMode) override;
|
||||
|
||||
void setScissorRectangle(const gl::Rectangle &scissor, bool enabled);
|
||||
void setViewport(const gl::Caps *caps,
|
||||
const gl::Rectangle &viewport,
|
||||
void setViewport(const gl::Rectangle &viewport,
|
||||
float zNear,
|
||||
float zFar,
|
||||
GLenum drawMode,
|
||||
|
|
|
@ -473,8 +473,7 @@ gl::Error StateManager9::setBlendDepthRasterStates(const gl::State &glState,
|
|||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
void StateManager9::setViewportState(const gl::Caps *caps,
|
||||
const gl::Rectangle &viewport,
|
||||
void StateManager9::setViewportState(const gl::Rectangle &viewport,
|
||||
float zNear,
|
||||
float zFar,
|
||||
GLenum drawMode,
|
||||
|
|
|
@ -45,8 +45,7 @@ class StateManager9 final : angle::NonCopyable
|
|||
|
||||
gl::Error setBlendDepthRasterStates(const gl::State &glState, unsigned int sampleMask);
|
||||
void setScissorState(const gl::Rectangle &scissor, bool enabled);
|
||||
void setViewportState(const gl::Caps *caps,
|
||||
const gl::Rectangle &viewport,
|
||||
void setViewportState(const gl::Rectangle &viewport,
|
||||
float zNear,
|
||||
float zFar,
|
||||
GLenum drawMode,
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace rx
|
|||
class ContextGL : public ContextImpl
|
||||
{
|
||||
public:
|
||||
ContextGL() {}
|
||||
ContextGL(const gl::ContextState &state) : ContextImpl(state) {}
|
||||
~ContextGL() override {}
|
||||
|
||||
gl::Error initialize(Renderer *renderer) override { return gl::NoError(); }
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "libANGLE/FramebufferAttachment.h"
|
||||
#include "libANGLE/angletypes.h"
|
||||
#include "libANGLE/formatutils.h"
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
#include "libANGLE/renderer/gl/FunctionsGL.h"
|
||||
#include "libANGLE/renderer/gl/RenderbufferGL.h"
|
||||
#include "libANGLE/renderer/gl/StateManagerGL.h"
|
||||
|
@ -149,7 +150,7 @@ Error FramebufferGL::invalidateSub(size_t count,
|
|||
return Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
Error FramebufferGL::clear(const ContextState &data, GLbitfield mask)
|
||||
Error FramebufferGL::clear(ContextImpl *context, GLbitfield mask)
|
||||
{
|
||||
syncClearState(mask);
|
||||
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
|
||||
|
@ -158,7 +159,7 @@ Error FramebufferGL::clear(const ContextState &data, GLbitfield mask)
|
|||
return Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
Error FramebufferGL::clearBufferfv(const ContextState &data,
|
||||
Error FramebufferGL::clearBufferfv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLfloat *values)
|
||||
|
@ -170,7 +171,7 @@ Error FramebufferGL::clearBufferfv(const ContextState &data,
|
|||
return Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
Error FramebufferGL::clearBufferuiv(const ContextState &data,
|
||||
Error FramebufferGL::clearBufferuiv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLuint *values)
|
||||
|
@ -182,7 +183,7 @@ Error FramebufferGL::clearBufferuiv(const ContextState &data,
|
|||
return Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
Error FramebufferGL::clearBufferiv(const ContextState &data,
|
||||
Error FramebufferGL::clearBufferiv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLint *values)
|
||||
|
@ -194,7 +195,7 @@ Error FramebufferGL::clearBufferiv(const ContextState &data,
|
|||
return Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
Error FramebufferGL::clearBufferfi(const ContextState &data,
|
||||
Error FramebufferGL::clearBufferfi(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
GLfloat depth,
|
||||
|
@ -223,7 +224,7 @@ GLenum FramebufferGL::getImplementationColorReadType() const
|
|||
return internalFormatInfo.type;
|
||||
}
|
||||
|
||||
Error FramebufferGL::readPixels(const State &state,
|
||||
Error FramebufferGL::readPixels(ContextImpl *context,
|
||||
const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
|
@ -231,7 +232,7 @@ Error FramebufferGL::readPixels(const State &state,
|
|||
{
|
||||
// TODO: don't sync the pixel pack state here once the dirty bits contain the pixel pack buffer
|
||||
// binding
|
||||
const PixelPackState &packState = state.getPackState();
|
||||
const PixelPackState &packState = context->getState().getPackState();
|
||||
mStateManager->setPixelPackState(packState);
|
||||
|
||||
mStateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, mFramebufferID);
|
||||
|
@ -240,13 +241,13 @@ Error FramebufferGL::readPixels(const State &state,
|
|||
return Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
Error FramebufferGL::blit(const State &state,
|
||||
Error FramebufferGL::blit(ContextImpl *context,
|
||||
const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
GLbitfield mask,
|
||||
GLenum filter,
|
||||
const Framebuffer *sourceFramebuffer)
|
||||
GLenum filter)
|
||||
{
|
||||
const Framebuffer *sourceFramebuffer = context->getState().getReadFramebuffer();
|
||||
const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(sourceFramebuffer);
|
||||
|
||||
mStateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebufferGL->getFramebufferID());
|
||||
|
|
|
@ -40,20 +40,20 @@ class FramebufferGL : public FramebufferImpl
|
|||
gl::Error invalidate(size_t count, const GLenum *attachments) override;
|
||||
gl::Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &area) override;
|
||||
|
||||
gl::Error clear(const gl::ContextState &data, GLbitfield mask) override;
|
||||
gl::Error clearBufferfv(const gl::ContextState &data,
|
||||
gl::Error clear(ContextImpl *context, GLbitfield mask) override;
|
||||
gl::Error clearBufferfv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLfloat *values) override;
|
||||
gl::Error clearBufferuiv(const gl::ContextState &data,
|
||||
gl::Error clearBufferuiv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLuint *values) override;
|
||||
gl::Error clearBufferiv(const gl::ContextState &data,
|
||||
gl::Error clearBufferiv(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
const GLint *values) override;
|
||||
gl::Error clearBufferfi(const gl::ContextState &data,
|
||||
gl::Error clearBufferfi(ContextImpl *context,
|
||||
GLenum buffer,
|
||||
GLint drawbuffer,
|
||||
GLfloat depth,
|
||||
|
@ -61,10 +61,17 @@ class FramebufferGL : public FramebufferImpl
|
|||
|
||||
GLenum getImplementationColorReadFormat() const override;
|
||||
GLenum getImplementationColorReadType() const override;
|
||||
gl::Error readPixels(const gl::State &state, const gl::Rectangle &area, GLenum format, GLenum type, GLvoid *pixels) const override;
|
||||
gl::Error readPixels(ContextImpl *context,
|
||||
const gl::Rectangle &area,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
GLvoid *pixels) const override;
|
||||
|
||||
gl::Error blit(const gl::State &state, const gl::Rectangle &sourceArea, const gl::Rectangle &destArea,
|
||||
GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer) override;
|
||||
gl::Error blit(ContextImpl *context,
|
||||
const gl::Rectangle &sourceArea,
|
||||
const gl::Rectangle &destArea,
|
||||
GLbitfield mask,
|
||||
GLenum filter) override;
|
||||
|
||||
bool checkStatus() const override;
|
||||
|
||||
|
|
|
@ -263,9 +263,9 @@ gl::Error RendererGL::drawRangeElements(const gl::ContextState &data,
|
|||
return gl::Error(GL_NO_ERROR);
|
||||
}
|
||||
|
||||
ContextImpl *RendererGL::createContext()
|
||||
ContextImpl *RendererGL::createContext(const gl::ContextState &state)
|
||||
{
|
||||
return new ContextGL;
|
||||
return new ContextGL(state);
|
||||
}
|
||||
|
||||
CompilerImpl *RendererGL::createCompiler()
|
||||
|
|
|
@ -60,7 +60,7 @@ class RendererGL : public Renderer
|
|||
const GLvoid *indices,
|
||||
const gl::IndexRange &indexRange) override;
|
||||
|
||||
ContextImpl *createContext() override;
|
||||
ContextImpl *createContext(const gl::ContextState &state) override;
|
||||
|
||||
// Shader creation
|
||||
CompilerImpl *createCompiler() override;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#ifndef TESTS_ANGLE_UNITTESTS_UTILS_H_
|
||||
#define TESTS_ANGLE_UNITTESTS_UTILS_H_
|
||||
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
|
||||
namespace rx
|
||||
|
@ -62,7 +63,7 @@ class NullFactory : public ImplFactory
|
|||
class MockFactory : public ImplFactory
|
||||
{
|
||||
public:
|
||||
MOCK_METHOD0(createContext, ContextImpl *());
|
||||
MOCK_METHOD1(createContext, ContextImpl *(const gl::ContextState &));
|
||||
MOCK_METHOD0(createCompiler, CompilerImpl *());
|
||||
MOCK_METHOD1(createShader, ShaderImpl *(const gl::ShaderState &));
|
||||
MOCK_METHOD1(createProgram, ProgramImpl *(const gl::ProgramState &));
|
||||
|
|
Загрузка…
Ссылка в новой задаче