Implement RenderbufferGL.
BUG=angleproject:886
Change-Id: I7480943d678b2cdf6e997c3f8316acdef32f5f0d
Reviewed-on: https://chromium-review.googlesource.com/260889
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/gl/RenderbufferGL.cpp b/src/libANGLE/renderer/gl/RenderbufferGL.cpp
index 88d4789..b580ea8 100644
--- a/src/libANGLE/renderer/gl/RenderbufferGL.cpp
+++ b/src/libANGLE/renderer/gl/RenderbufferGL.cpp
@@ -9,27 +9,48 @@
#include "libANGLE/renderer/gl/RenderbufferGL.h"
#include "common/debug.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/gl/FunctionsGL.h"
+#include "libANGLE/renderer/gl/StateManagerGL.h"
namespace rx
{
-RenderbufferGL::RenderbufferGL()
- : RenderbufferImpl()
-{}
+RenderbufferGL::RenderbufferGL(const FunctionsGL *functions, StateManagerGL *stateManager)
+ : RenderbufferImpl(),
+ mFunctions(functions),
+ mStateManager(stateManager),
+ mRenderbufferID(0)
+{
+ mFunctions->genRenderbuffers(1, &mRenderbufferID);
+}
RenderbufferGL::~RenderbufferGL()
-{}
+{
+ if (mRenderbufferID != 0)
+ {
+ mFunctions->deleteRenderbuffers(1, &mRenderbufferID);
+ mRenderbufferID = 0;
+ }
+}
gl::Error RenderbufferGL::setStorage(GLenum internalformat, size_t width, size_t height)
{
- UNIMPLEMENTED();
- return gl::Error(GL_INVALID_OPERATION);
+ mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mRenderbufferID);
+ mFunctions->renderbufferStorage(GL_RENDERBUFFER, internalformat, width, height);
+ return gl::Error(GL_NO_ERROR);
}
gl::Error RenderbufferGL::setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height)
{
- UNIMPLEMENTED();
- return gl::Error(GL_INVALID_OPERATION);
+ mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mRenderbufferID);
+ mFunctions->renderbufferStorageMultisample(GL_RENDERBUFFER, samples, internalformat, width, height);
+ return gl::Error(GL_NO_ERROR);
+}
+
+GLuint RenderbufferGL::getRenderbufferID() const
+{
+ return mRenderbufferID;
}
}