diff --git a/projects/msvc12/GLideN64.vcxproj b/projects/msvc12/GLideN64.vcxproj
index 92514769..e7012682 100644
--- a/projects/msvc12/GLideN64.vcxproj
+++ b/projects/msvc12/GLideN64.vcxproj
@@ -292,6 +292,7 @@
+
diff --git a/projects/msvc12/GLideN64.vcxproj.filters b/projects/msvc12/GLideN64.vcxproj.filters
index 04514d22..869a53f7 100644
--- a/projects/msvc12/GLideN64.vcxproj.filters
+++ b/projects/msvc12/GLideN64.vcxproj.filters
@@ -341,6 +341,9 @@
Source Files
+
+ Source Files\Graphics
+
diff --git a/src/BufferCopy/ColorBufferToRDRAM.cpp b/src/BufferCopy/ColorBufferToRDRAM.cpp
index 12711bf2..91d7d7be 100644
--- a/src/BufferCopy/ColorBufferToRDRAM.cpp
+++ b/src/BufferCopy/ColorBufferToRDRAM.cpp
@@ -112,7 +112,7 @@ void ColorBufferToRDRAM::_initFBTexture(void)
// check if everything is OK
assert(!gfxContext.isFramebufferError());
- gfxContext.bindFramebuffer(graphics::bufferTarget::DRAW_FRAMEBUFFER, graphics::ObjectHandle());
+ gfxContext.bindFramebuffer(graphics::bufferTarget::DRAW_FRAMEBUFFER, graphics::ObjectHandle::null);
m_bufferReader.reset(gfxContext.createColorBufferReader(m_pTexture));
}
diff --git a/src/BufferCopy/DepthBufferToRDRAM.cpp b/src/BufferCopy/DepthBufferToRDRAM.cpp
index 4a69f941..40650fed 100644
--- a/src/BufferCopy/DepthBufferToRDRAM.cpp
+++ b/src/BufferCopy/DepthBufferToRDRAM.cpp
@@ -114,7 +114,7 @@ void DepthBufferToRDRAM::init()
// check if everything is OK
assert(!gfxContext.isFramebufferError());
assert(!gfxContext.isError());
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
// Generate and initialize Pixel Buffer Objects
m_pbuf.reset(gfxContext.createPixelReadBuffer(m_pDepthTexture->textureBytes));
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a1ecbff5..f932d2eb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -65,6 +65,7 @@ set(GLideN64_SOURCES
common/CommonAPIImpl_common.cpp
Graphics/Context.cpp
Graphics/CombinerProgram.cpp
+ Graphics/ObjectHandle.cpp
Graphics/OpenGLContext/GLFunctions.cpp
Graphics/OpenGLContext/opengl_Attributes.cpp
Graphics/OpenGLContext/opengl_BufferedDrawer.cpp
diff --git a/src/DepthBuffer.cpp b/src/DepthBuffer.cpp
index cab68ff2..85d40397 100644
--- a/src/DepthBuffer.cpp
+++ b/src/DepthBuffer.cpp
@@ -38,7 +38,7 @@ DepthBuffer::DepthBuffer(DepthBuffer && _other) :
_other.m_pDepthImageZTexture = nullptr;
_other.m_pDepthImageDeltaZTexture = nullptr;
_other.m_pDepthBufferTexture = nullptr;
- _other.m_depthRenderbuffer = ObjectHandle();
+ _other.m_depthRenderbuffer = ObjectHandle::null;
_other.m_pResolveDepthBufferTexture = nullptr;
_other.m_resolved = false;
_other.m_pDepthBufferCopyTexture = nullptr;
@@ -273,7 +273,7 @@ CachedTexture * DepthBuffer::resolveDepthBufferTexture(FrameBuffer * _pBuffer)
gfxContext.blitFramebuffers(blitParams);
- gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::null);
gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, _pBuffer->m_FBO);
m_resolved = true;
@@ -324,7 +324,7 @@ CachedTexture * DepthBuffer::copyDepthBufferTexture(FrameBuffer * _pBuffer)
gfxContext.blitFramebuffers(blitParams);
- gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::null);
gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, _pBuffer->m_FBO);
m_copied = true;
diff --git a/src/FrameBuffer.cpp b/src/FrameBuffer.cpp
index c923ce93..0fc952c6 100644
--- a/src/FrameBuffer.cpp
+++ b/src/FrameBuffer.cpp
@@ -320,7 +320,7 @@ void FrameBuffer::resolveMultisampledTexture(bool _bForce)
gfxContext.blitFramebuffers(blitParams);
- gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::null);
frameBufferList().setCurrentDrawBuffer();
m_resolved = true;
@@ -399,7 +399,7 @@ CachedTexture * FrameBuffer::_getSubTexture(u32 _t)
gfxContext.blitFramebuffers(blitParams);
- gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::null);
frameBufferList().setCurrentDrawBuffer();
@@ -470,7 +470,7 @@ void FrameBufferList::init()
{
m_pCurrent = nullptr;
m_pCopy = nullptr;
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
m_prevColorImageHeight = 0;
}
@@ -478,7 +478,7 @@ void FrameBufferList::destroy() {
m_list.clear();
m_pCurrent = nullptr;
m_pCopy = nullptr;
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
}
void FrameBufferList::setBufferChanged()
@@ -577,7 +577,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
if (VI.width == 0 || _height == 0) {
m_pCurrent = nullptr;
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
return;
}
@@ -697,7 +697,7 @@ void FrameBufferList::removeAux()
while (iter->m_width != VI.width && iter->m_height != VI.height) {
if (&(*iter) == m_pCurrent) {
m_pCurrent = nullptr;
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
}
iter = m_list.erase(iter);
if (iter == m_list.end())
@@ -712,7 +712,7 @@ void FrameBufferList::removeBuffer(u32 _address )
if (iter->m_startAddress == _address) {
if (&(*iter) == m_pCurrent) {
m_pCurrent = nullptr;
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
}
m_list.erase(iter);
return;
@@ -726,7 +726,7 @@ void FrameBufferList::removeBuffers(u32 _width)
while (iter->m_width == _width) {
if (&(*iter) == m_pCurrent) {
m_pCurrent = nullptr;
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
}
iter = m_list.erase(iter);
if (iter == m_list.end())
@@ -924,7 +924,7 @@ void FrameBufferList::renderBuffer(u32 _address)
hOffset + X1,
vOffset + (s32)(dstY1*dstScaleY) };
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
float clearColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
drawer.clearColorBuffer(clearColor);
@@ -1006,7 +1006,7 @@ void FrameBufferList::renderBuffer(u32 _address)
}
}
- gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::null);
wnd.swapBuffers();
if (m_pCurrent != nullptr) {
diff --git a/src/Graphics/ObjectHandle.cpp b/src/Graphics/ObjectHandle.cpp
new file mode 100644
index 00000000..ff609563
--- /dev/null
+++ b/src/Graphics/ObjectHandle.cpp
@@ -0,0 +1,7 @@
+#include "ObjectHandle.h"
+
+namespace graphics {
+
+ObjectHandle ObjectHandle::null;
+
+}
diff --git a/src/Graphics/ObjectHandle.h b/src/Graphics/ObjectHandle.h
index 4a503f00..7e6311af 100644
--- a/src/Graphics/ObjectHandle.h
+++ b/src/Graphics/ObjectHandle.h
@@ -17,6 +17,7 @@ namespace graphics {
void reset() { m_name = 0; }
+ static ObjectHandle null;
private:
u32 m_name;
};
diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.cpp
index 7a167091..aeb567c9 100644
--- a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.cpp
+++ b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramImpl.cpp
@@ -26,7 +26,7 @@ CombinerProgramImpl::CombinerProgramImpl(const CombinerKey & _key,
CombinerProgramImpl::~CombinerProgramImpl()
{
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
glDeleteProgram(GLuint(m_program));
}
diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.cpp
index 370dc993..bb8d68ce 100644
--- a/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.cpp
+++ b/src/Graphics/OpenGLContext/GLSL/glsl_SpecialShadersFactory.cpp
@@ -464,7 +464,7 @@ namespace glsl {
~SpecialShader()
{
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
glDeleteProgram(GLuint(m_program));
}
@@ -494,7 +494,7 @@ namespace glsl {
{
m_useProgram->useProgram(m_program);
m_loc = glGetUniformLocation(GLuint(m_program), "uFogColor");
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
}
void activate() override {
@@ -529,7 +529,7 @@ namespace glsl {
glUniform1i(samplesLoc, config.video.multisampling);
} else
glUniform1i(texLoc, u32(graphics::textureIndices::Tex[0]));
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
}
};
@@ -575,12 +575,12 @@ namespace glsl {
m_textureBoundsLoc = glGetUniformLocation(GLuint(m_program), "uTextureBounds");
assert(m_textureBoundsLoc >= 0);
m_enableAlphaTestLoc = glGetUniformLocation(GLuint(m_program), "uEnableAlphaTest");
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
}
~TexrectDrawerShaderDraw()
{
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
glDeleteProgram(GLuint(m_program));
}
@@ -640,7 +640,7 @@ namespace glsl {
m_useProgram->useProgram(m_program);
const int texLoc = glGetUniformLocation(GLuint(m_program), "uTex0");
glUniform1i(texLoc, 0);
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
}
};
@@ -665,7 +665,7 @@ namespace glsl {
assert(levelLoc >= 0);
const f32 gammaLevel = (config.gammaCorrection.force != 0) ? config.gammaCorrection.level : 2.0f;
glUniform1f(levelLoc, gammaLevel);
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
}
};
@@ -684,7 +684,7 @@ namespace glsl {
m_useProgram->useProgram(m_program);
const int texLoc = glGetUniformLocation(GLuint(m_program), "uTex0");
glUniform1i(texLoc, 0);
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
}
};
@@ -707,7 +707,7 @@ namespace glsl {
glUniform1i(texLoc, 0);
const int colorLoc = glGetUniformLocation(GLuint(m_program), "uColor");
glUniform4fv(colorLoc, 1, config.font.colorf);
- m_useProgram->useProgram(graphics::ObjectHandle());
+ m_useProgram->useProgram(graphics::ObjectHandle::null);
}
};
diff --git a/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.cpp b/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.cpp
index 82f598f8..b36c3a03 100644
--- a/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.cpp
+++ b/src/Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.cpp
@@ -132,7 +132,7 @@ public:
glGenBuffers(1, &m_PBO);
m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle(m_PBO));
glBufferData(GL_PIXEL_UNPACK_BUFFER, m_size, nullptr, GL_DYNAMIC_DRAW);
- m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle());
+ m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle::null);
}
~PBOWriteBuffer() {
@@ -161,7 +161,7 @@ public:
}
void unbind() override {
- m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle());
+ m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle::null);
}
private:
@@ -182,7 +182,7 @@ public:
glBufferStorage(GL_PIXEL_UNPACK_BUFFER, m_size * 32, nullptr, m_bufAccessBits);
m_bufferData = glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_size * 32, m_bufMapBits);
m_bufferOffset = 0;
- m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle());
+ m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle::null);
}
~PersistentWriteBuffer() {
@@ -216,7 +216,7 @@ public:
}
void unbind() override {
- m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle());
+ m_bind->bind(graphics::Parameter(GL_PIXEL_UNPACK_BUFFER), graphics::ObjectHandle::null);
}
private:
@@ -299,7 +299,7 @@ public:
glGenBuffers(1, &m_PBO);
m_bind->bind(graphics::Parameter(GL_PIXEL_PACK_BUFFER), graphics::ObjectHandle(m_PBO));
glBufferData(GL_PIXEL_PACK_BUFFER, m_size, nullptr, GL_DYNAMIC_READ);
- m_bind->bind(graphics::Parameter(GL_PIXEL_PACK_BUFFER), graphics::ObjectHandle());
+ m_bind->bind(graphics::Parameter(GL_PIXEL_PACK_BUFFER), graphics::ObjectHandle::null);
}
~PBOReadBuffer() {
@@ -330,7 +330,7 @@ public:
}
void unbind() override {
- m_bind->bind(graphics::Parameter(GL_PIXEL_PACK_BUFFER), graphics::ObjectHandle());
+ m_bind->bind(graphics::Parameter(GL_PIXEL_PACK_BUFFER), graphics::ObjectHandle::null);
}
private:
diff --git a/src/Graphics/OpenGLContext/opengl_BufferedDrawer.cpp b/src/Graphics/OpenGLContext/opengl_BufferedDrawer.cpp
index 7fe094c6..d89be383 100644
--- a/src/Graphics/OpenGLContext/opengl_BufferedDrawer.cpp
+++ b/src/Graphics/OpenGLContext/opengl_BufferedDrawer.cpp
@@ -64,8 +64,8 @@ void BufferedDrawer::_initBuffer(Buffer & _buffer, GLuint _bufSize)
BufferedDrawer::~BufferedDrawer()
{
- m_bindBuffer->bind(Parameter(GL_ARRAY_BUFFER), ObjectHandle());
- m_bindBuffer->bind(Parameter(GL_ELEMENT_ARRAY_BUFFER), ObjectHandle());
+ m_bindBuffer->bind(Parameter(GL_ARRAY_BUFFER), ObjectHandle::null);
+ m_bindBuffer->bind(Parameter(GL_ELEMENT_ARRAY_BUFFER), ObjectHandle::null);
GLuint buffers[3] = { m_rectsBuffers.vbo.handle, m_trisBuffers.vbo.handle, m_trisBuffers.ebo.handle };
glDeleteBuffers(3, buffers);
glBindVertexArray(0);
diff --git a/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.cpp b/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.cpp
index 0fc00ba6..956feca9 100644
--- a/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.cpp
+++ b/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithBufferStorage.cpp
@@ -30,7 +30,7 @@ void ColorBufferReaderWithBufferStorage::_initBuffers()
m_PBOData[index] = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, m_pTexture->textureBytes, GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT);
}
- m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle());
+ m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle::null);
}
void ColorBufferReaderWithBufferStorage::_destroyBuffers()
@@ -90,5 +90,5 @@ u8 * ColorBufferReaderWithBufferStorage::readPixels(s32 _x0, s32 _y0, u32 _width
void ColorBufferReaderWithBufferStorage::cleanUp()
{
- m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle());
+ m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle::null);
}
diff --git a/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.cpp b/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.cpp
index 725458cf..6a9e5898 100644
--- a/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.cpp
+++ b/src/Graphics/OpenGLContext/opengl_ColorBufferReaderWithPixelBuffer.cpp
@@ -36,7 +36,7 @@ void ColorBufferReaderWithPixelBuffer::_initBuffers()
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_PBO[i]);
glBufferData(GL_PIXEL_PACK_BUFFER, m_pTexture->textureBytes, nullptr, GL_DYNAMIC_READ);
}
- m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle());
+ m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle::null);
}
u8 * ColorBufferReaderWithPixelBuffer::readPixels(s32 _x0, s32 _y0, u32 _width, u32 _height, u32 _size, bool _sync)
@@ -83,5 +83,5 @@ u8 * ColorBufferReaderWithPixelBuffer::readPixels(s32 _x0, s32 _y0, u32 _width,
void ColorBufferReaderWithPixelBuffer::cleanUp()
{
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
- m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle());
+ m_bindBuffer->bind(Parameter(GL_PIXEL_PACK_BUFFER), ObjectHandle::null);
}
diff --git a/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp b/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp
index 4bdbedf4..05422517 100644
--- a/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp
+++ b/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp
@@ -373,7 +373,7 @@ graphics::ShaderProgram * ContextImpl::createTextDrawerShader()
void ContextImpl::resetShaderProgram()
{
- m_cachedFunctions->getCachedUseProgram()->useProgram(graphics::ObjectHandle());
+ m_cachedFunctions->getCachedUseProgram()->useProgram(graphics::ObjectHandle::null);
}
void ContextImpl::drawTriangles(const graphics::Context::DrawTriangleParameters & _params)
diff --git a/src/GraphicsDrawer.cpp b/src/GraphicsDrawer.cpp
index 85b69adb..f8892b58 100644
--- a/src/GraphicsDrawer.cpp
+++ b/src/GraphicsDrawer.cpp
@@ -1326,7 +1326,7 @@ void GraphicsDrawer::drawOSD()
if ((config.onScreenDisplay.fps | config.onScreenDisplay.vis | config.onScreenDisplay.percent) == 0)
return;
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
DisplayWindow & wnd = DisplayWindow::get();
const s32 X = (wnd.getScreenWidth() - wnd.getWidth()) / 2;
diff --git a/src/PaletteTexture.cpp b/src/PaletteTexture.cpp
index d22f16b3..ff5b5424 100644
--- a/src/PaletteTexture.cpp
+++ b/src/PaletteTexture.cpp
@@ -72,7 +72,7 @@ void PaletteTexture::destroy()
Context::BindImageTextureParameters bindParams;
bindParams.imageUnit = textureImageUnits::Tlut;
- bindParams.texture = ObjectHandle();
+ bindParams.texture = ObjectHandle::null;
bindParams.accessMode = textureImageAccessMode::READ_ONLY;
bindParams.textureFormat = fbTexFormats.lutInternalFormat;
diff --git a/src/PostProcessor.cpp b/src/PostProcessor.cpp
index 88a6d8a6..491babcb 100644
--- a/src/PostProcessor.cpp
+++ b/src/PostProcessor.cpp
@@ -315,7 +315,7 @@ void PostProcessor::_initCommon()
_initFBO(ObjectHandle(m_pResultBuffer->m_FBO), m_pResultBuffer->m_pTexture);
gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER,
- ObjectHandle());
+ ObjectHandle::null);
}
void PostProcessor::_initGammaCorrection()
@@ -480,13 +480,13 @@ void PostProcessor::_preDraw(FrameBuffer * _pBuffer)
m_pTextureOriginal = _pBuffer->m_pTexture;
gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER,
- ObjectHandle());
+ ObjectHandle::null);
}
void PostProcessor::_postDraw()
{
gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER,
- ObjectHandle());
+ ObjectHandle::null);
gfxContext.resetShaderProgram();
}
diff --git a/src/TexrectDrawer.cpp b/src/TexrectDrawer.cpp
index 30df1b6f..982d11d6 100644
--- a/src/TexrectDrawer.cpp
+++ b/src/TexrectDrawer.cpp
@@ -77,7 +77,7 @@ void TexrectDrawer::init()
// check if everything is OK
assert(!gfxContext.isFramebufferError());
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
m_programTex.reset(gfxContext.createTexrectDrawerDrawShader());
m_programClear.reset(gfxContext.createTexrectDrawerClearShader());
@@ -282,7 +282,7 @@ bool TexrectDrawer::draw()
rect[3].t0 = t1;
drawer.updateScissor(m_pBuffer);
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_pBuffer != nullptr ? m_pBuffer->m_FBO : ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_pBuffer != nullptr ? m_pBuffer->m_FBO : ObjectHandle::null);
Context::DrawRectParameters rectParams;
rectParams.mode = drawmode::TRIANGLE_STRIP;
@@ -312,7 +312,7 @@ bool TexrectDrawer::draw()
gfxContext.enable(enable::SCISSOR_TEST, true);
m_pBuffer = frameBufferList().getCurrent();
- gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_pBuffer != nullptr ? m_pBuffer->m_FBO : ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, m_pBuffer != nullptr ? m_pBuffer->m_FBO : ObjectHandle::null);
m_numRects = 0;
m_vecRectCoords.clear();
diff --git a/src/TextureFilterHandler.cpp b/src/TextureFilterHandler.cpp
index 2a9728ec..b69ee72c 100644
--- a/src/TextureFilterHandler.cpp
+++ b/src/TextureFilterHandler.cpp
@@ -67,7 +67,7 @@ void displayLoadProgress(const wchar_t *format, ...)
FrameBuffer* pBuffer = frameBufferList().getCurrent();
if (pBuffer != nullptr)
- gfxContext.bindFramebuffer(graphics::bufferTarget::DRAW_FRAMEBUFFER, graphics::ObjectHandle());
+ gfxContext.bindFramebuffer(graphics::bufferTarget::DRAW_FRAMEBUFFER, graphics::ObjectHandle::null);
GraphicsDrawer & drawer = dwnd().getDrawer();
drawer.clearColorBuffer(nullptr);
diff --git a/src/ZlutTexture.cpp b/src/ZlutTexture.cpp
index 4277c084..dbf3544c 100644
--- a/src/ZlutTexture.cpp
+++ b/src/ZlutTexture.cpp
@@ -70,7 +70,7 @@ void ZlutTexture::destroy() {
Context::BindImageTextureParameters bindParams;
bindParams.imageUnit = textureImageUnits::Zlut;
- bindParams.texture = ObjectHandle();
+ bindParams.texture = ObjectHandle::null;
bindParams.accessMode = textureImageAccessMode::READ_ONLY;
bindParams.textureFormat = fbTexFormats.lutInternalFormat;
diff --git a/src/gSP.cpp b/src/gSP.cpp
index 4bc6db8a..bfb00b49 100644
--- a/src/gSP.cpp
+++ b/src/gSP.cpp
@@ -2178,7 +2178,7 @@ void _copyDepthBuffer()
// Restore objects
if (pTmpBuffer->m_pDepthBuffer != nullptr)
pTmpBuffer->m_pDepthBuffer->setDepthAttachment(fbList.getCurrent()->m_FBO, bufferTarget::READ_FRAMEBUFFER);
- gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle());
+ gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::null);
// Set back current depth buffer
dbList.saveBuffer(gDP.depthImageAddress);
diff --git a/src/mupen64plus-video-gliden64.mk b/src/mupen64plus-video-gliden64.mk
index c0115b63..9b942ed3 100644
--- a/src/mupen64plus-video-gliden64.mk
+++ b/src/mupen64plus-video-gliden64.mk
@@ -80,6 +80,7 @@ MY_LOCAL_SRC_FILES := \
$(SRCDIR)/BufferCopy/RDRAMtoColorBuffer.cpp \
$(SRCDIR)/Graphics/Context.cpp \
$(SRCDIR)/Graphics/CombinerProgram.cpp \
+ $(SRCDIR)/Graphics/ObjectHandle.cpp \
$(SRCDIR)/Graphics/OpenGLContext/GLFunctions.cpp \
$(SRCDIR)/Graphics/OpenGLContext/opengl_Attributes.cpp \
$(SRCDIR)/Graphics/OpenGLContext/opengl_BufferedDrawer.cpp \