Split Renderbuffer::setStorage into two functions to match the API.
BUG=angleproject:886
Change-Id: I74375351339464b450c2f058adbeed7a1ba18cdd
Reviewed-on: https://chromium-review.googlesource.com/262125
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Renderbuffer.cpp b/src/libANGLE/Renderbuffer.cpp
index 252357d..f37c023 100644
--- a/src/libANGLE/Renderbuffer.cpp
+++ b/src/libANGLE/Renderbuffer.cpp
@@ -34,9 +34,25 @@
SafeDelete(mRenderbuffer);
}
-Error Renderbuffer::setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples)
+Error Renderbuffer::setStorage(GLenum internalformat, size_t width, size_t height)
{
- Error error = mRenderbuffer->setStorage(width, height, internalformat, samples);
+ Error error = mRenderbuffer->setStorage(internalformat, width, height);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ mWidth = width;
+ mHeight = height;
+ mInternalFormat = internalformat;
+ mSamples = 0;
+
+ return Error(GL_NO_ERROR);
+}
+
+Error Renderbuffer::setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height)
+{
+ Error error = mRenderbuffer->setStorageMultisample(samples, internalformat, width, height);
if (error.isError())
{
return error;
diff --git a/src/libANGLE/Renderbuffer.h b/src/libANGLE/Renderbuffer.h
index f9e28cb..8517c41 100644
--- a/src/libANGLE/Renderbuffer.h
+++ b/src/libANGLE/Renderbuffer.h
@@ -38,7 +38,8 @@
Renderbuffer(rx::RenderbufferImpl *impl, GLuint id);
virtual ~Renderbuffer();
- Error setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
+ Error setStorage(GLenum internalformat, size_t width, size_t height);
+ Error setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height);
rx::RenderbufferImpl *getImplementation();
diff --git a/src/libANGLE/renderer/RenderbufferImpl.h b/src/libANGLE/renderer/RenderbufferImpl.h
index 7cff205..50368dd 100644
--- a/src/libANGLE/renderer/RenderbufferImpl.h
+++ b/src/libANGLE/renderer/RenderbufferImpl.h
@@ -24,7 +24,8 @@
RenderbufferImpl();
virtual ~RenderbufferImpl() = 0;
- virtual gl::Error setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples) = 0;
+ virtual gl::Error setStorage(GLenum internalformat, size_t width, size_t height) = 0;
+ virtual gl::Error setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferImpl);
diff --git a/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp b/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
index b503fbd..c91fedf 100644
--- a/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
+++ b/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
@@ -30,7 +30,12 @@
return static_cast<RenderbufferD3D*>(renderbuffer);
}
-gl::Error RenderbufferD3D::setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples)
+gl::Error RenderbufferD3D::setStorage(GLenum internalformat, size_t width, size_t height)
+{
+ return setStorageMultisample(0, internalformat, width, height);
+}
+
+gl::Error RenderbufferD3D::setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height)
{
// If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in
diff --git a/src/libANGLE/renderer/d3d/RenderbufferD3D.h b/src/libANGLE/renderer/d3d/RenderbufferD3D.h
index d919f3b..4559d7e 100644
--- a/src/libANGLE/renderer/d3d/RenderbufferD3D.h
+++ b/src/libANGLE/renderer/d3d/RenderbufferD3D.h
@@ -28,7 +28,8 @@
static RenderbufferD3D *makeRenderbufferD3D(RenderbufferImpl *renderbuffer);
- virtual gl::Error setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples) override;
+ virtual gl::Error setStorage(GLenum internalformat, size_t width, size_t height) override;
+ virtual gl::Error setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height) override;
RenderTargetD3D *getRenderTarget();
unsigned int getRenderTargetSerial() const;
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index a826146..0caf7d4 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -1273,7 +1273,7 @@
}
gl::Renderbuffer *nullRenderbuffer = new gl::Renderbuffer(createRenderbuffer(), 0);
- gl::Error error = nullRenderbuffer->setStorage(width, height, GL_NONE, 0);
+ gl::Error error = nullRenderbuffer->setStorage(GL_NONE, width, height);
if (error.isError())
{
SafeDelete(nullRenderbuffer);
diff --git a/src/libANGLE/renderer/gl/RenderbufferGL.cpp b/src/libANGLE/renderer/gl/RenderbufferGL.cpp
index b082ad7..88d4789 100644
--- a/src/libANGLE/renderer/gl/RenderbufferGL.cpp
+++ b/src/libANGLE/renderer/gl/RenderbufferGL.cpp
@@ -20,7 +20,13 @@
RenderbufferGL::~RenderbufferGL()
{}
-gl::Error RenderbufferGL::setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples)
+gl::Error RenderbufferGL::setStorage(GLenum internalformat, size_t width, size_t height)
+{
+ UNIMPLEMENTED();
+ return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error RenderbufferGL::setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
diff --git a/src/libANGLE/renderer/gl/RenderbufferGL.h b/src/libANGLE/renderer/gl/RenderbufferGL.h
index 741a2f1..1dd76ba 100644
--- a/src/libANGLE/renderer/gl/RenderbufferGL.h
+++ b/src/libANGLE/renderer/gl/RenderbufferGL.h
@@ -20,7 +20,8 @@
RenderbufferGL();
~RenderbufferGL() override;
- gl::Error setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples) override;
+ virtual gl::Error setStorage(GLenum internalformat, size_t width, size_t height) override;
+ virtual gl::Error setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height) override;
private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferGL);
diff --git a/src/libGLESv2/entry_points_gles_2_0.cpp b/src/libGLESv2/entry_points_gles_2_0.cpp
index 938bd2a..b45d267 100644
--- a/src/libGLESv2/entry_points_gles_2_0.cpp
+++ b/src/libGLESv2/entry_points_gles_2_0.cpp
@@ -3332,7 +3332,7 @@
}
Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer();
- Error error = renderbuffer->setStorage(width, height, internalformat, 0);
+ Error error = renderbuffer->setStorage(internalformat, width, height);
if (error.isError())
{
context->recordError(error);
diff --git a/src/libGLESv2/entry_points_gles_2_0_ext.cpp b/src/libGLESv2/entry_points_gles_2_0_ext.cpp
index e34242e..8be6ae7 100644
--- a/src/libGLESv2/entry_points_gles_2_0_ext.cpp
+++ b/src/libGLESv2/entry_points_gles_2_0_ext.cpp
@@ -518,7 +518,7 @@
}
Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer();
- Error error = renderbuffer->setStorage(width, height, internalformat, samples);
+ Error error = renderbuffer->setStorageMultisample(samples, internalformat, width, height);
if (error.isError())
{
context->recordError(error);
diff --git a/src/libGLESv2/entry_points_gles_3_0.cpp b/src/libGLESv2/entry_points_gles_3_0.cpp
index 5300282..6510131 100644
--- a/src/libGLESv2/entry_points_gles_3_0.cpp
+++ b/src/libGLESv2/entry_points_gles_3_0.cpp
@@ -706,7 +706,7 @@
}
Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer();
- renderbuffer->setStorage(width, height, internalformat, samples);
+ renderbuffer->setStorageMultisample(samples, internalformat, width, height);
}
}