Commit cf4fc784 authored by Philip Trettner's avatar Philip Trettner

added unity builds

parent 912d4f58
......@@ -33,6 +33,7 @@ endif()
# ==================================
# Basics
include(cmake/basic-setup.cmake)
include(cmake/UnityBuild.cmake)
if (GLOW_CMAKE_REPORT)
message(STATUS "GLOW CMake Config")
message(STATUS " Operating System : ${OPERATING_SYSTEM}")
......@@ -55,6 +56,8 @@ if (GLOW_CHECK_CXX_STANDARD)
endif()
endif()
option(GLOW_ENABLE_UNITY_BUILD "If enabled, compiles this library as a single compilation unit" ON)
# ==================================
# Collect files
file(GLOB_RECURSE SOURCE_FILES "src/*.cc")
......@@ -65,6 +68,10 @@ if(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" FILES ${SOURCE_FILES} ${HEADER_FILES})
endif()
if (POLYMESH_ENABLE_UNITY_BUILD)
arcana_enable_unity_build(glow SOURCE_FILES 100 cc)
endif()
# ==================================
# Create GLOW target
add_library(glow ${GLOW_LINK_TYPE}
......
......@@ -4,7 +4,8 @@ from Cheetah.Template import Template
#outCodeDir = "/home/ptrettner/projects/glow-tests/libs/glow/src/glow/objects/"
#outTestDir = "/home/ptrettner/projects/glow-tests/src/objects/tex-gen/"
outCodeDir = "/home/ptrettner/projects/glow-minimal/extern/glow/src/glow/objects/"
#outCodeDir = "/home/ptrettner/projects/glow-minimal/extern/glow/src/glow/objects/"
outCodeDir = "/home/ptrettner/projects/tg-samples/extern/glow/src/glow/objects/"
outTestDir = None
#outCodeDir = "/mnt/c/Users/Kunstwald/workspace/glow-samples/glow/src/glow/objects/"
#outTestDir = "/mnt/c/Users/Kunstwald/workspace/glow-tex-tests/"
......
......@@ -18,11 +18,11 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL $class::Bound$class *sCurrentTexture = nullptr;
static GLOW_THREADLOCAL $class::Bound$class *sCurrent$class = nullptr;
$class::Bound$class *$class::getCurrentTexture()
{
return sCurrentTexture;
return sCurrent$class;
}
#if $hasMipmaps
......@@ -160,7 +160,7 @@ Shared$class $class::createFromData(const SharedTextureData &data, GLenum intern
bool $class::Bound$class::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentTexture == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
GLOW_RUNTIME_ASSERT(sCurrent$class == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
return true;
}
......@@ -834,8 +834,8 @@ $class::Bound$class::Bound$class ($class *texture) : texture(texture)
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, texture->mObjectName);
previousTexturePtr = sCurrentTexture;
sCurrentTexture = this;
previousTexturePtr = sCurrent$class;
sCurrent$class = this;
}
$class::Bound$class::Bound$class ($class::Bound$class &&rhs)
......@@ -843,7 +843,7 @@ $class::Bound$class::Bound$class ($class::Bound$class &&rhs)
{
// invalidate rhs
rhs.previousTexture = -1;
sCurrentTexture = this;
sCurrent$class = this;
}
$class::Bound$class::~Bound$class ()
......@@ -853,6 +853,6 @@ $class::Bound$class::~Bound$class ()
checkValidGLOW();
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, previousTexture);
sCurrentTexture = previousTexturePtr;
sCurrent$class = previousTexturePtr;
}
}
......@@ -13,9 +13,9 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL BoundArrayBuffer* sCurrentBuffer = nullptr;
static GLOW_THREADLOCAL BoundArrayBuffer* sCurrentArrayBuffer = nullptr;
BoundArrayBuffer* ArrayBuffer::getCurrentBuffer() { return sCurrentBuffer; }
BoundArrayBuffer* ArrayBuffer::getCurrentBuffer() { return sCurrentArrayBuffer; }
void ArrayBuffer::defineAttribute(const ArrayBufferAttribute& a)
{
......@@ -75,7 +75,7 @@ SharedArrayBuffer ArrayBuffer::create(const std::vector<ArrayBufferAttribute>& a
bool BoundArrayBuffer::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentBuffer == this, "Currently bound AB does NOT match represented buffer " << to_string(buffer), return false);
GLOW_RUNTIME_ASSERT(sCurrentArrayBuffer == this, "Currently bound AB does NOT match represented buffer " << to_string(buffer), return false);
return true;
}
......@@ -103,8 +103,8 @@ BoundArrayBuffer::BoundArrayBuffer(ArrayBuffer* buffer) : buffer(buffer)
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &previousBuffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer->getObjectName());
previousBufferPtr = sCurrentBuffer;
sCurrentBuffer = this;
previousBufferPtr = sCurrentArrayBuffer;
sCurrentArrayBuffer = this;
}
BoundArrayBuffer::BoundArrayBuffer(BoundArrayBuffer&& rhs)
......@@ -112,7 +112,7 @@ BoundArrayBuffer::BoundArrayBuffer(BoundArrayBuffer&& rhs)
{
// invalidate rhs
rhs.previousBuffer = -1;
sCurrentBuffer = this;
sCurrentArrayBuffer = this;
}
BoundArrayBuffer::~BoundArrayBuffer()
......@@ -120,7 +120,7 @@ BoundArrayBuffer::~BoundArrayBuffer()
if (previousBuffer != -1) // if valid
{
glBindBuffer(GL_ARRAY_BUFFER, previousBuffer);
sCurrentBuffer = previousBufferPtr;
sCurrentArrayBuffer = previousBufferPtr;
}
}
......
......@@ -8,9 +8,9 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL BoundAtomicCounterBuffer* sCurrentBuffer = nullptr;
static GLOW_THREADLOCAL BoundAtomicCounterBuffer* sCurrentAtomicCounterBuffer = nullptr;
BoundAtomicCounterBuffer* AtomicCounterBuffer::getCurrentBuffer() { return sCurrentBuffer; }
BoundAtomicCounterBuffer* AtomicCounterBuffer::getCurrentBuffer() { return sCurrentAtomicCounterBuffer; }
AtomicCounterBuffer::AtomicCounterBuffer() : Buffer(GL_SHADER_STORAGE_BUFFER) {}
......@@ -30,7 +30,7 @@ SharedAtomicCounterBuffer AtomicCounterBuffer::create(const std::vector<uint32_t
bool BoundAtomicCounterBuffer::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentBuffer == this, "Currently bound UB does NOT match represented buffer " << to_string(buffer), return false);
GLOW_RUNTIME_ASSERT(sCurrentAtomicCounterBuffer == this, "Currently bound UB does NOT match represented buffer " << to_string(buffer), return false);
return true;
}
......@@ -88,8 +88,8 @@ BoundAtomicCounterBuffer::BoundAtomicCounterBuffer(AtomicCounterBuffer* buffer)
glGetIntegerv(GL_SHADER_STORAGE_BUFFER_BINDING, &previousBuffer);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer->getObjectName());
previousBufferPtr = sCurrentBuffer;
sCurrentBuffer = this;
previousBufferPtr = sCurrentAtomicCounterBuffer;
sCurrentAtomicCounterBuffer = this;
}
BoundAtomicCounterBuffer::BoundAtomicCounterBuffer(BoundAtomicCounterBuffer&& rhs)
......@@ -97,7 +97,7 @@ BoundAtomicCounterBuffer::BoundAtomicCounterBuffer(BoundAtomicCounterBuffer&& rh
{
// invalidate rhs
rhs.previousBuffer = -1;
sCurrentBuffer = this;
sCurrentAtomicCounterBuffer = this;
}
BoundAtomicCounterBuffer::~BoundAtomicCounterBuffer()
......@@ -105,6 +105,6 @@ BoundAtomicCounterBuffer::~BoundAtomicCounterBuffer()
if (previousBuffer != -1) // if valid
{
glBindBuffer(GL_SHADER_STORAGE_BUFFER, previousBuffer);
sCurrentBuffer = previousBufferPtr;
sCurrentAtomicCounterBuffer = previousBufferPtr;
}
}
......@@ -12,9 +12,9 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL BoundElementArrayBuffer* sCurrentBuffer = nullptr;
static GLOW_THREADLOCAL BoundElementArrayBuffer* sCurrentElementArrayBuffer = nullptr;
BoundElementArrayBuffer* ElementArrayBuffer::getCurrentBuffer() { return sCurrentBuffer; }
BoundElementArrayBuffer* ElementArrayBuffer::getCurrentBuffer() { return sCurrentElementArrayBuffer; }
ElementArrayBuffer::ElementArrayBuffer() : Buffer(GL_ELEMENT_ARRAY_BUFFER) {}
......@@ -106,7 +106,7 @@ SharedElementArrayBuffer ElementArrayBuffer::create(int indexCount, const uint32
bool BoundElementArrayBuffer::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentBuffer == this, "Currently bound EAB does NOT match represented buffer " << to_string(buffer), return false);
GLOW_RUNTIME_ASSERT(sCurrentElementArrayBuffer == this, "Currently bound EAB does NOT match represented buffer " << to_string(buffer), return false);
return true;
}
......@@ -181,8 +181,8 @@ BoundElementArrayBuffer::BoundElementArrayBuffer(ElementArrayBuffer* buffer) : b
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &previousBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer->getObjectName());
previousBufferPtr = sCurrentBuffer;
sCurrentBuffer = this;
previousBufferPtr = sCurrentElementArrayBuffer;
sCurrentElementArrayBuffer = this;
}
BoundElementArrayBuffer::BoundElementArrayBuffer(BoundElementArrayBuffer&& rhs)
......@@ -190,7 +190,7 @@ BoundElementArrayBuffer::BoundElementArrayBuffer(BoundElementArrayBuffer&& rhs)
{
// invalidate rhs
rhs.previousBuffer = -1;
sCurrentBuffer = this;
sCurrentElementArrayBuffer = this;
}
BoundElementArrayBuffer::~BoundElementArrayBuffer()
......@@ -198,6 +198,6 @@ BoundElementArrayBuffer::~BoundElementArrayBuffer()
if (previousBuffer != -1) // if valid
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, previousBuffer);
sCurrentBuffer = previousBufferPtr;
sCurrentElementArrayBuffer = previousBufferPtr;
}
}
......@@ -20,7 +20,7 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL BoundFramebuffer* sCurrentBuffer = nullptr;
static GLOW_THREADLOCAL BoundFramebuffer* sCurrentFramebuffer = nullptr;
static void attachToFramebuffer(SharedTexture const& tex, GLenum attachment, int mipmapLevel, int layer)
{
......@@ -70,7 +70,7 @@ static void attachToFramebuffer(SharedTexture const& tex, GLenum attachment, int
void Framebuffer::internalReattach()
{
TG_ASSERT(sCurrentBuffer && sCurrentBuffer->buffer == this);
TG_ASSERT(sCurrentFramebuffer && sCurrentFramebuffer->buffer == this);
checkValidGLOW();
// clear attachments
......@@ -94,7 +94,7 @@ void Framebuffer::internalReattach()
bool Framebuffer::internalCheckComplete()
{
TG_ASSERT(sCurrentBuffer && sCurrentBuffer->buffer == this);
TG_ASSERT(sCurrentFramebuffer && sCurrentFramebuffer->buffer == this);
checkValidGLOW();
auto status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
......@@ -171,7 +171,7 @@ bool Framebuffer::internalCheckComplete()
return false;
}
BoundFramebuffer* Framebuffer::getCurrentBuffer() { return sCurrentBuffer; }
BoundFramebuffer* Framebuffer::getCurrentBuffer() { return sCurrentFramebuffer; }
void Framebuffer::notifyShaderExecuted()
{
......@@ -241,7 +241,7 @@ SharedFramebuffer Framebuffer::createDepthOnly(const SharedTexture& depth, const
bool BoundFramebuffer::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentBuffer == this, "Currently bound FBO does NOT match represented buffer " << to_string(buffer), return false);
GLOW_RUNTIME_ASSERT(sCurrentFramebuffer == this, "Currently bound FBO does NOT match represented buffer " << to_string(buffer), return false);
return true;
}
......@@ -414,8 +414,8 @@ BoundFramebuffer::BoundFramebuffer(Framebuffer* buffer) : buffer(buffer)
updateViewport();
}
previousBufferPtr = sCurrentBuffer;
sCurrentBuffer = this;
previousBufferPtr = sCurrentFramebuffer;
sCurrentFramebuffer = this;
}
BoundFramebuffer::BoundFramebuffer(BoundFramebuffer&& rhs)
......@@ -423,7 +423,7 @@ BoundFramebuffer::BoundFramebuffer(BoundFramebuffer&& rhs)
{
// invalidate rhs
rhs.previousBuffer = -1;
sCurrentBuffer = this;
sCurrentFramebuffer = this;
}
template <size_t N>
......@@ -443,7 +443,7 @@ BoundFramebuffer::~BoundFramebuffer()
checkValidGLOW();
glBindFramebuffer(GL_FRAMEBUFFER, previousBuffer);
sCurrentBuffer = previousBufferPtr;
sCurrentFramebuffer = previousBufferPtr;
// special behavior: GL_BACK can only appear in glDrawBuffer
// in general: optimized version for 0 or 1 buffers
......
......@@ -8,9 +8,9 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL BoundShaderStorageBuffer* sCurrentBuffer = nullptr;
static GLOW_THREADLOCAL BoundShaderStorageBuffer* sCurrentShaderStorageBuffer = nullptr;
BoundShaderStorageBuffer* ShaderStorageBuffer::getCurrentBuffer() { return sCurrentBuffer; }
BoundShaderStorageBuffer* ShaderStorageBuffer::getCurrentBuffer() { return sCurrentShaderStorageBuffer; }
ShaderStorageBuffer::ShaderStorageBuffer(const SharedBuffer& originalBuffer) : Buffer(GL_SHADER_STORAGE_BUFFER, originalBuffer) {}
......@@ -39,7 +39,7 @@ bool BoundShaderStorageBuffer::verifyStride(size_t size, size_t stride) const
bool BoundShaderStorageBuffer::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentBuffer == this, "Currently bound UB does NOT match represented buffer " << to_string(buffer), return false);
GLOW_RUNTIME_ASSERT(sCurrentShaderStorageBuffer == this, "Currently bound UB does NOT match represented buffer " << to_string(buffer), return false);
return true;
}
......@@ -115,8 +115,8 @@ BoundShaderStorageBuffer::BoundShaderStorageBuffer(ShaderStorageBuffer* buffer)
glGetIntegerv(GL_SHADER_STORAGE_BUFFER_BINDING, &previousBuffer);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer->getObjectName());
previousBufferPtr = sCurrentBuffer;
sCurrentBuffer = this;
previousBufferPtr = sCurrentShaderStorageBuffer;
sCurrentShaderStorageBuffer = this;
}
BoundShaderStorageBuffer::BoundShaderStorageBuffer(BoundShaderStorageBuffer&& rhs)
......@@ -124,7 +124,7 @@ BoundShaderStorageBuffer::BoundShaderStorageBuffer(BoundShaderStorageBuffer&& rh
{
// invalidate rhs
rhs.previousBuffer = -1;
sCurrentBuffer = this;
sCurrentShaderStorageBuffer = this;
}
BoundShaderStorageBuffer::~BoundShaderStorageBuffer()
......@@ -132,6 +132,6 @@ BoundShaderStorageBuffer::~BoundShaderStorageBuffer()
if (previousBuffer != -1) // if valid
{
glBindBuffer(GL_SHADER_STORAGE_BUFFER, previousBuffer);
sCurrentBuffer = previousBufferPtr;
sCurrentShaderStorageBuffer = previousBufferPtr;
}
}
......@@ -18,11 +18,11 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL Texture1D::BoundTexture1D *sCurrentTexture = nullptr;
static GLOW_THREADLOCAL Texture1D::BoundTexture1D *sCurrentTexture1D = nullptr;
Texture1D::BoundTexture1D *Texture1D::getCurrentTexture()
{
return sCurrentTexture;
return sCurrentTexture1D;
}
bool Texture1D::hasMipmapsEnabled() const
......@@ -139,7 +139,7 @@ SharedTexture1D Texture1D::createFromData(const SharedTextureData &data, GLenum
bool Texture1D::BoundTexture1D::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentTexture == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
GLOW_RUNTIME_ASSERT(sCurrentTexture1D == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
return true;
}
......@@ -618,8 +618,8 @@ Texture1D::BoundTexture1D::BoundTexture1D (Texture1D *texture) : texture(texture
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, texture->mObjectName);
previousTexturePtr = sCurrentTexture;
sCurrentTexture = this;
previousTexturePtr = sCurrentTexture1D;
sCurrentTexture1D = this;
}
Texture1D::BoundTexture1D::BoundTexture1D (Texture1D::BoundTexture1D &&rhs)
......@@ -627,7 +627,7 @@ Texture1D::BoundTexture1D::BoundTexture1D (Texture1D::BoundTexture1D &&rhs)
{
// invalidate rhs
rhs.previousTexture = -1;
sCurrentTexture = this;
sCurrentTexture1D = this;
}
Texture1D::BoundTexture1D::~BoundTexture1D ()
......@@ -637,6 +637,6 @@ Texture1D::BoundTexture1D::~BoundTexture1D ()
checkValidGLOW();
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, previousTexture);
sCurrentTexture = previousTexturePtr;
sCurrentTexture1D = previousTexturePtr;
}
}
......@@ -18,11 +18,11 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL Texture1DArray::BoundTexture1DArray *sCurrentTexture = nullptr;
static GLOW_THREADLOCAL Texture1DArray::BoundTexture1DArray *sCurrentTexture1DArray = nullptr;
Texture1DArray::BoundTexture1DArray *Texture1DArray::getCurrentTexture()
{
return sCurrentTexture;
return sCurrentTexture1DArray;
}
bool Texture1DArray::hasMipmapsEnabled() const
......@@ -140,7 +140,7 @@ SharedTexture1DArray Texture1DArray::createFromData(const SharedTextureData &dat
bool Texture1DArray::BoundTexture1DArray::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentTexture == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
GLOW_RUNTIME_ASSERT(sCurrentTexture1DArray == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
return true;
}
......@@ -627,8 +627,8 @@ Texture1DArray::BoundTexture1DArray::BoundTexture1DArray (Texture1DArray *textur
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, texture->mObjectName);
previousTexturePtr = sCurrentTexture;
sCurrentTexture = this;
previousTexturePtr = sCurrentTexture1DArray;
sCurrentTexture1DArray = this;
}
Texture1DArray::BoundTexture1DArray::BoundTexture1DArray (Texture1DArray::BoundTexture1DArray &&rhs)
......@@ -636,7 +636,7 @@ Texture1DArray::BoundTexture1DArray::BoundTexture1DArray (Texture1DArray::BoundT
{
// invalidate rhs
rhs.previousTexture = -1;
sCurrentTexture = this;
sCurrentTexture1DArray = this;
}
Texture1DArray::BoundTexture1DArray::~BoundTexture1DArray ()
......@@ -646,6 +646,6 @@ Texture1DArray::BoundTexture1DArray::~BoundTexture1DArray ()
checkValidGLOW();
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, previousTexture);
sCurrentTexture = previousTexturePtr;
sCurrentTexture1DArray = previousTexturePtr;
}
}
......@@ -18,11 +18,11 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL Texture2D::BoundTexture2D *sCurrentTexture = nullptr;
static GLOW_THREADLOCAL Texture2D::BoundTexture2D *sCurrentTexture2D = nullptr;
Texture2D::BoundTexture2D *Texture2D::getCurrentTexture()
{
return sCurrentTexture;
return sCurrentTexture2D;
}
bool Texture2D::hasMipmapsEnabled() const
......@@ -142,7 +142,7 @@ SharedTexture2D Texture2D::createFromData(const SharedTextureData &data, GLenum
bool Texture2D::BoundTexture2D::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentTexture == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
GLOW_RUNTIME_ASSERT(sCurrentTexture2D == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
return true;
}
......@@ -689,8 +689,8 @@ Texture2D::BoundTexture2D::BoundTexture2D (Texture2D *texture) : texture(texture
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, texture->mObjectName);
previousTexturePtr = sCurrentTexture;
sCurrentTexture = this;
previousTexturePtr = sCurrentTexture2D;
sCurrentTexture2D = this;
}
Texture2D::BoundTexture2D::BoundTexture2D (Texture2D::BoundTexture2D &&rhs)
......@@ -698,7 +698,7 @@ Texture2D::BoundTexture2D::BoundTexture2D (Texture2D::BoundTexture2D &&rhs)
{
// invalidate rhs
rhs.previousTexture = -1;
sCurrentTexture = this;
sCurrentTexture2D = this;
}
Texture2D::BoundTexture2D::~BoundTexture2D ()
......@@ -708,6 +708,6 @@ Texture2D::BoundTexture2D::~BoundTexture2D ()
checkValidGLOW();
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, previousTexture);
sCurrentTexture = previousTexturePtr;
sCurrentTexture2D = previousTexturePtr;
}
}
......@@ -18,11 +18,11 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL Texture2DArray::BoundTexture2DArray *sCurrentTexture = nullptr;
static GLOW_THREADLOCAL Texture2DArray::BoundTexture2DArray *sCurrentTexture2DArray = nullptr;
Texture2DArray::BoundTexture2DArray *Texture2DArray::getCurrentTexture()
{
return sCurrentTexture;
return sCurrentTexture2DArray;
}
bool Texture2DArray::hasMipmapsEnabled() const
......@@ -142,7 +142,7 @@ SharedTexture2DArray Texture2DArray::createFromData(const SharedTextureData &dat
bool Texture2DArray::BoundTexture2DArray::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentTexture == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
GLOW_RUNTIME_ASSERT(sCurrentTexture2DArray == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
return true;
}
......@@ -683,8 +683,8 @@ Texture2DArray::BoundTexture2DArray::BoundTexture2DArray (Texture2DArray *textur
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, texture->mObjectName);
previousTexturePtr = sCurrentTexture;
sCurrentTexture = this;
previousTexturePtr = sCurrentTexture2DArray;
sCurrentTexture2DArray = this;
}
Texture2DArray::BoundTexture2DArray::BoundTexture2DArray (Texture2DArray::BoundTexture2DArray &&rhs)
......@@ -692,7 +692,7 @@ Texture2DArray::BoundTexture2DArray::BoundTexture2DArray (Texture2DArray::BoundT
{
// invalidate rhs
rhs.previousTexture = -1;
sCurrentTexture = this;
sCurrentTexture2DArray = this;
}
Texture2DArray::BoundTexture2DArray::~BoundTexture2DArray ()
......@@ -702,6 +702,6 @@ Texture2DArray::BoundTexture2DArray::~BoundTexture2DArray ()
checkValidGLOW();
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, previousTexture);
sCurrentTexture = previousTexturePtr;
sCurrentTexture2DArray = previousTexturePtr;
}
}
......@@ -18,11 +18,11 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL Texture2DMultisample::BoundTexture2DMultisample *sCurrentTexture = nullptr;
static GLOW_THREADLOCAL Texture2DMultisample::BoundTexture2DMultisample *sCurrentTexture2DMultisample = nullptr;
Texture2DMultisample::BoundTexture2DMultisample *Texture2DMultisample::getCurrentTexture()
{
return sCurrentTexture;
return sCurrentTexture2DMultisample;
}
......@@ -80,7 +80,7 @@ SharedTexture2DMultisample Texture2DMultisample::createStorageImmutable(Shape co
bool Texture2DMultisample::BoundTexture2DMultisample::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentTexture == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
GLOW_RUNTIME_ASSERT(sCurrentTexture2DMultisample == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
return true;
}
......@@ -270,8 +270,8 @@ Texture2DMultisample::BoundTexture2DMultisample::BoundTexture2DMultisample (Text
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, texture->mObjectName);
previousTexturePtr = sCurrentTexture;
sCurrentTexture = this;
previousTexturePtr = sCurrentTexture2DMultisample;
sCurrentTexture2DMultisample = this;
}
Texture2DMultisample::BoundTexture2DMultisample::BoundTexture2DMultisample (Texture2DMultisample::BoundTexture2DMultisample &&rhs)
......@@ -279,7 +279,7 @@ Texture2DMultisample::BoundTexture2DMultisample::BoundTexture2DMultisample (Text
{
// invalidate rhs
rhs.previousTexture = -1;
sCurrentTexture = this;
sCurrentTexture2DMultisample = this;
}
Texture2DMultisample::BoundTexture2DMultisample::~BoundTexture2DMultisample ()
......@@ -289,6 +289,6 @@ Texture2DMultisample::BoundTexture2DMultisample::~BoundTexture2DMultisample ()
checkValidGLOW();
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, previousTexture);
sCurrentTexture = previousTexturePtr;
sCurrentTexture2DMultisample = previousTexturePtr;
}
}
......@@ -18,11 +18,11 @@
using namespace glow;
/// Currently bound buffer
static GLOW_THREADLOCAL Texture2DMultisampleArray::BoundTexture2DMultisampleArray *sCurrentTexture = nullptr;
static GLOW_THREADLOCAL Texture2DMultisampleArray::BoundTexture2DMultisampleArray *sCurrentTexture2DMultisampleArray = nullptr;
Texture2DMultisampleArray::BoundTexture2DMultisampleArray *Texture2DMultisampleArray::getCurrentTexture()
{
return sCurrentTexture;
return sCurrentTexture2DMultisampleArray;
}
......@@ -66,7 +66,7 @@ SharedTexture2DMultisampleArray Texture2DMultisampleArray::create(Texture2DMulti
bool Texture2DMultisampleArray::BoundTexture2DMultisampleArray::isCurrent() const
{
GLOW_RUNTIME_ASSERT(sCurrentTexture == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
GLOW_RUNTIME_ASSERT(sCurrentTexture2DMultisampleArray == this, "Currently bound FBO does NOT match represented Texture " << to_string(texture), return false);
return true;
}
......@@ -239,8 +239,8 @@ Texture2DMultisampleArray::BoundTexture2DMultisampleArray::BoundTexture2DMultisa
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, texture->mObjectName);
previousTexturePtr = sCurrentTexture;
sCurrentTexture = this;
previousTexturePtr = sCurrentTexture2DMultisampleArray;
sCurrentTexture2DMultisampleArray = this;
}
Texture2DMultisampleArray::BoundTexture2DMultisampleArray::BoundTexture2DMultisampleArray (Texture2DMultisampleArray::BoundTexture2DMultisampleArray &&rhs)
......@@ -248,7 +248,7 @@ Texture2DMultisampleArray::BoundTexture2DMultisampleArray::BoundTexture2DMultisa
{
// invalidate rhs
rhs.previousTexture = -1;
sCurrentTexture = this;
sCurrentTexture2DMultisampleArray = this;
}
Texture2DMultisampleArray::BoundTexture2DMultisampleArray::~BoundTexture2DMultisampleArray ()
......@@ -258,6 +258,6 @@ Texture2DMultisampleArray::BoundTexture2DMultisampleArray::~BoundTexture2DMultis
checkValidGLOW();
glActiveTexture(GL_TEXTURE0 + limits::maxCombinedTextureImageUnits - 1);
glBindTexture(texture->mTarget, previousTexture);
sCurrentTexture = previousTexturePtr;
sCurrentTexture2DMultisampleArray = previousTexturePtr;
}
}