Commit 2cb7f974 by Geoff Lang Committed by Commit Bot

GL: Refactor TextureGL to not hold renderer objects.

BUG=angleproject:2464 Change-Id: I24b07557d90988369bc8b7e4b2fe3a500ab7bc36 Reviewed-on: https://chromium-review.googlesource.com/1048115Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 8073a951
...@@ -138,7 +138,7 @@ Error Surface::destroyImpl(const Display *display) ...@@ -138,7 +138,7 @@ Error Surface::destroyImpl(const Display *display)
{ {
return Error(EGL_BAD_SURFACE); return Error(EGL_BAD_SURFACE);
} }
mTexture.set(nullptr, nullptr); mTexture.set(display->getProxyContext(), nullptr);
} }
if (mState.defaultFramebuffer) if (mState.defaultFramebuffer)
......
...@@ -523,10 +523,10 @@ gl::ErrorOrResult<bool> BlitGL::copySubTexture(const gl::Context *context, ...@@ -523,10 +523,10 @@ gl::ErrorOrResult<bool> BlitGL::copySubTexture(const gl::Context *context,
} }
GLint swizzle[4] = {luminance, luminance, luminance, alpha}; GLint swizzle[4] = {luminance, luminance, luminance, alpha};
source->setSwizzle(swizzle); source->setSwizzle(context, swizzle);
} }
source->setMinFilter(GL_NEAREST); source->setMinFilter(context, GL_NEAREST);
source->setMagFilter(GL_NEAREST); source->setMagFilter(context, GL_NEAREST);
ANGLE_TRY(source->setBaseLevel(context, static_cast<GLuint>(sourceLevel))); ANGLE_TRY(source->setBaseLevel(context, static_cast<GLuint>(sourceLevel)));
// Render to the destination texture, sampling from the source texture // Render to the destination texture, sampling from the source texture
......
...@@ -75,8 +75,14 @@ FramebufferImpl *ContextGL::createFramebuffer(const gl::FramebufferState &data) ...@@ -75,8 +75,14 @@ FramebufferImpl *ContextGL::createFramebuffer(const gl::FramebufferState &data)
TextureImpl *ContextGL::createTexture(const gl::TextureState &state) TextureImpl *ContextGL::createTexture(const gl::TextureState &state)
{ {
return new TextureGL(state, getFunctions(), getWorkaroundsGL(), getStateManager(), const FunctionsGL *functions = getFunctions();
mRenderer->getBlitter()); StateManagerGL *stateManager = getStateManager();
GLuint texture = 0;
functions->genTextures(1, &texture);
stateManager->bindTexture(state.getType(), texture);
return new TextureGL(state, texture);
} }
RenderbufferImpl *ContextGL::createRenderbuffer(const gl::RenderbufferState &state) RenderbufferImpl *ContextGL::createRenderbuffer(const gl::RenderbufferState &state)
......
...@@ -56,13 +56,11 @@ struct LevelInfoGL ...@@ -56,13 +56,11 @@ struct LevelInfoGL
class TextureGL : public TextureImpl class TextureGL : public TextureImpl
{ {
public: public:
TextureGL(const gl::TextureState &state, TextureGL(const gl::TextureState &state, GLuint id);
const FunctionsGL *functions,
const WorkaroundsGL &workarounds,
StateManagerGL *stateManager,
BlitGL *blitter);
~TextureGL() override; ~TextureGL() override;
gl::Error onDestroy(const gl::Context *context) override;
gl::Error setImage(const gl::Context *context, gl::Error setImage(const gl::Context *context,
const gl::ImageIndex &index, const gl::ImageIndex &index,
GLenum internalFormat, GLenum internalFormat,
...@@ -174,13 +172,14 @@ class TextureGL : public TextureImpl ...@@ -174,13 +172,14 @@ class TextureGL : public TextureImpl
gl::Error initializeContents(const gl::Context *context, gl::Error initializeContents(const gl::Context *context,
const gl::ImageIndex &imageIndex) override; const gl::ImageIndex &imageIndex) override;
void setMinFilter(GLenum filter); void setMinFilter(const gl::Context *context, GLenum filter);
void setMagFilter(GLenum filter); void setMagFilter(const gl::Context *context, GLenum filter);
void setSwizzle(GLint swizzle[4]); void setSwizzle(const gl::Context *context, GLint swizzle[4]);
private: private:
void setImageHelper(gl::TextureTarget target, void setImageHelper(const gl::Context *context,
gl::TextureTarget target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -188,7 +187,8 @@ class TextureGL : public TextureImpl ...@@ -188,7 +187,8 @@ class TextureGL : public TextureImpl
GLenum type, GLenum type,
const uint8_t *pixels); const uint8_t *pixels);
// This changes the current pixel unpack state that will have to be reapplied. // This changes the current pixel unpack state that will have to be reapplied.
void reserveTexImageToBeFilled(gl::TextureTarget target, void reserveTexImageToBeFilled(const gl::Context *context,
gl::TextureTarget target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -230,11 +230,6 @@ class TextureGL : public TextureImpl ...@@ -230,11 +230,6 @@ class TextureGL : public TextureImpl
const LevelInfoGL &getLevelInfo(gl::TextureTarget target, size_t level) const; const LevelInfoGL &getLevelInfo(gl::TextureTarget target, size_t level) const;
const LevelInfoGL &getBaseLevelInfo() const; const LevelInfoGL &getBaseLevelInfo() const;
const FunctionsGL *mFunctions;
const WorkaroundsGL &mWorkarounds;
StateManagerGL *mStateManager;
BlitGL *mBlitter;
std::vector<LevelInfoGL> mLevelInfo; std::vector<LevelInfoGL> mLevelInfo;
gl::Texture::DirtyBits mLocalDirtyBits; gl::Texture::DirtyBits mLocalDirtyBits;
......
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