diff --git a/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp index e5460c6641..4d264995ae 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp @@ -16,7 +16,7 @@ #include #include -#include "../gl41/GLBackend.h" +#include "../gl41/GL41Backend.h" #if defined(NSIGHT_FOUND) #include "nvToolsExt.h" @@ -36,11 +36,11 @@ static const QString DEBUG_FLAG("HIFI_ENABLE_OPENGL_45"); static bool enableOpenGL45 = QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG); Backend* GLBackend::createBackend() { - auto version = QOpenGLContextWrapper::currentContextVersion(); +#if 0 // FIXME provide a mechanism to override the backend for testing // Where the gpuContext is initialized and where the TRUE Backend is created and assigned -#if 0 + auto version = QOpenGLContextWrapper::currentContextVersion(); GLBackend* result; if (enableOpenGL45 && version >= 0x0405) { result = new gpu::gl45::GLBackend; @@ -48,7 +48,7 @@ Backend* GLBackend::createBackend() { result = new gpu::gl41::GLBackend; } #else - GLBackend* result = new gpu::gl41::GLBackend; + GLBackend* result = new gpu::gl41::GL41Backend; #endif result->initInput(); result->initTransform(); diff --git a/libraries/gpu-gl/src/gpu/gl/GLQuery.cpp b/libraries/gpu-gl/src/gpu/gl/GLQuery.cpp deleted file mode 100644 index b358db40c9..0000000000 --- a/libraries/gpu-gl/src/gpu/gl/GLQuery.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// -// Created by Bradley Austin Davis on 2016/05/15 -// Copyright 2013-2016 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include "GLQuery.h" - -using namespace gpu; -using namespace gpu::gl; diff --git a/libraries/gpu-gl/src/gpu/gl/GLShared.h b/libraries/gpu-gl/src/gpu/gl/GLShared.h index 5d90badc1c..3220eafef4 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLShared.h +++ b/libraries/gpu-gl/src/gpu/gl/GLShared.h @@ -128,13 +128,6 @@ public: virtual ~GLObject() { } - // Used by derived classes and helpers to ensure the actual GL object exceeds the lifetime of `this` - GLuint takeOwnership() { - GLuint result = _id; - const_cast(_id) = 0; - return result; - } - const GPUType& _gpuObject; const GLuint _id; }; @@ -146,7 +139,6 @@ class GLQuery; class GLState; class GLShader; class GLTexture; -class GLTextureTransferHelper; } } // namespace gpu::gl diff --git a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp index 47fc583d77..ed931437b7 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp @@ -182,7 +182,7 @@ GLTexture::~GLTexture() { if (0 == numTexturesForMipCount) { _textureCountByMips.erase(mipCount); if (mipCount == _currentMaxMipCount) { - _currentMaxMipCount = _textureCountByMips.rbegin()->first; + _currentMaxMipCount = (_textureCountByMips.empty() ? 0 : _textureCountByMips.rbegin()->first); } } } diff --git a/libraries/gpu-gl/src/gpu/gl/GLTexture.h b/libraries/gpu-gl/src/gpu/gl/GLTexture.h index fa09fb49f2..df2d38e2f3 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTexture.h +++ b/libraries/gpu-gl/src/gpu/gl/GLTexture.h @@ -102,6 +102,13 @@ public: return result; } + // Used by derived classes and helpers to ensure the actual GL object exceeds the lifetime of `this` + GLuint takeOwnership() { + GLuint result = _id; + const_cast(_id) = 0; + return result; + } + ~GLTexture(); const GLuint& _texture { _id }; diff --git a/libraries/gpu-gl/src/gpu/gl/GLTextureTransfer.cpp b/libraries/gpu-gl/src/gpu/gl/GLTextureTransfer.cpp index ca2e7061f5..7acb736063 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTextureTransfer.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLTextureTransfer.cpp @@ -13,6 +13,7 @@ #endif #include "GLShared.h" +#include "GLTexture.h" using namespace gpu; using namespace gpu::gl; diff --git a/libraries/gpu-gl/src/gpu/gl/GLTextureTransfer.h b/libraries/gpu-gl/src/gpu/gl/GLTextureTransfer.h index deb470c572..078ab40ee3 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTextureTransfer.h +++ b/libraries/gpu-gl/src/gpu/gl/GLTextureTransfer.h @@ -14,7 +14,6 @@ #include #include "GLShared.h" -#include "GLTexture.h" #ifdef Q_OS_WIN #define THREADED_TEXTURE_TRANSFER diff --git a/libraries/gpu-gl/src/gpu/gl41/GLBackend.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41Backend.cpp similarity index 93% rename from libraries/gpu-gl/src/gpu/gl41/GLBackend.cpp rename to libraries/gpu-gl/src/gpu/gl41/GL41Backend.cpp index e46c739593..93d87ee6e4 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GLBackend.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41Backend.cpp @@ -5,7 +5,7 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GLBackend.h" +#include "GL41Backend.h" #include #include @@ -18,7 +18,7 @@ Q_LOGGING_CATEGORY(gpugl41logging, "hifi.gpu.gl41") using namespace gpu; using namespace gpu::gl41; -void GLBackend::do_draw(Batch& batch, size_t paramOffset) { +void GL41Backend::do_draw(Batch& batch, size_t paramOffset) { Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint; GLenum mode = gl::PRIMITIVE_TO_GL[primitiveType]; uint32 numVertices = batch._params[paramOffset + 1]._uint; @@ -43,7 +43,7 @@ void GLBackend::do_draw(Batch& batch, size_t paramOffset) { (void) CHECK_GL_ERROR(); } -void GLBackend::do_drawIndexed(Batch& batch, size_t paramOffset) { +void GL41Backend::do_drawIndexed(Batch& batch, size_t paramOffset) { Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint; GLenum mode = gl::PRIMITIVE_TO_GL[primitiveType]; uint32 numIndices = batch._params[paramOffset + 1]._uint; @@ -72,7 +72,7 @@ void GLBackend::do_drawIndexed(Batch& batch, size_t paramOffset) { (void) CHECK_GL_ERROR(); } -void GLBackend::do_drawInstanced(Batch& batch, size_t paramOffset) { +void GL41Backend::do_drawInstanced(Batch& batch, size_t paramOffset) { GLint numInstances = batch._params[paramOffset + 4]._uint; Primitive primitiveType = (Primitive)batch._params[paramOffset + 3]._uint; GLenum mode = gl::PRIMITIVE_TO_GL[primitiveType]; @@ -108,7 +108,7 @@ void glbackend_glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsize #endif } -void GLBackend::do_drawIndexedInstanced(Batch& batch, size_t paramOffset) { +void GL41Backend::do_drawIndexedInstanced(Batch& batch, size_t paramOffset) { GLint numInstances = batch._params[paramOffset + 4]._uint; GLenum mode = gl::PRIMITIVE_TO_GL[(Primitive)batch._params[paramOffset + 3]._uint]; uint32 numIndices = batch._params[paramOffset + 2]._uint; @@ -143,7 +143,7 @@ void GLBackend::do_drawIndexedInstanced(Batch& batch, size_t paramOffset) { } -void GLBackend::do_multiDrawIndirect(Batch& batch, size_t paramOffset) { +void GL41Backend::do_multiDrawIndirect(Batch& batch, size_t paramOffset) { #if (GPU_INPUT_PROFILE == GPU_CORE_43) uint commandCount = batch._params[paramOffset + 0]._uint; GLenum mode = gl::PRIMITIVE_TO_GL[(Primitive)batch._params[paramOffset + 1]._uint]; @@ -159,7 +159,7 @@ void GLBackend::do_multiDrawIndirect(Batch& batch, size_t paramOffset) { } -void GLBackend::do_multiDrawIndexedIndirect(Batch& batch, size_t paramOffset) { +void GL41Backend::do_multiDrawIndexedIndirect(Batch& batch, size_t paramOffset) { #if (GPU_INPUT_PROFILE == GPU_CORE_43) uint commandCount = batch._params[paramOffset + 0]._uint; GLenum mode = gl::PRIMITIVE_TO_GL[(Primitive)batch._params[paramOffset + 1]._uint]; diff --git a/libraries/gpu-gl/src/gpu/gl41/GLBackend.h b/libraries/gpu-gl/src/gpu/gl41/GL41Backend.h similarity index 86% rename from libraries/gpu-gl/src/gpu/gl41/GLBackend.h rename to libraries/gpu-gl/src/gpu/gl41/GL41Backend.h index 8a0f4bb912..5695ba080e 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GLBackend.h +++ b/libraries/gpu-gl/src/gpu/gl41/GL41Backend.h @@ -1,5 +1,5 @@ // -// GLBackend.h +// GL41Backend.h // libraries/gpu/src/gpu // // Created by Sam Gateau on 10/27/2014. @@ -8,8 +8,8 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#ifndef hifi_gpu_41_GLBackend_h -#define hifi_gpu_41_GLBackend_h +#ifndef hifi_gpu_41_GL41Backend_h +#define hifi_gpu_41_GL41Backend_h #include @@ -27,21 +27,21 @@ namespace gpu { namespace gl41 { -class GLBackend : public gl::GLBackend { +class GL41Backend : public gl::GLBackend { using Parent = gl::GLBackend; // Context Backend static interface required friend class Context; public: - explicit GLBackend(bool syncCache) : Parent(syncCache) {} - GLBackend() : Parent() {} + explicit GL41Backend(bool syncCache) : Parent(syncCache) {} + GL41Backend() : Parent() {} - class GLTexture : public gpu::gl::GLTexture { + class GL41Texture : public gpu::gl::GLTexture { using Parent = gpu::gl::GLTexture; GLuint allocate(); public: - GLTexture(const Texture& buffer, bool transferrable); - GLTexture(const Texture& buffer, GLTexture* original); + GL41Texture(const Texture& buffer, bool transferrable); + GL41Texture(const Texture& buffer, GL41Texture* original); protected: void transferMip(uint16_t mipLevel, uint8_t face = 0) const; diff --git a/libraries/gpu-gl/src/gpu/gl41/GLBackendBuffer.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendBuffer.cpp similarity index 81% rename from libraries/gpu-gl/src/gpu/gl41/GLBackendBuffer.cpp rename to libraries/gpu-gl/src/gpu/gl41/GL41BackendBuffer.cpp index 9c6b8b8124..e56d671891 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GLBackendBuffer.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendBuffer.cpp @@ -5,13 +5,13 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GLBackend.h" +#include "GL41Backend.h" #include "../gl/GLBuffer.h" using namespace gpu; using namespace gpu::gl41; -class GLBuffer : public gl::GLBuffer { +class GL41Buffer : public gl::GLBuffer { using Parent = gpu::gl::GLBuffer; static GLuint allocate() { GLuint result; @@ -20,7 +20,7 @@ class GLBuffer : public gl::GLBuffer { } public: - GLBuffer(const Buffer& buffer, GLBuffer* original) : Parent(buffer, allocate()) { + GL41Buffer(const Buffer& buffer, GL41Buffer* original) : Parent(buffer, allocate()) { glBindBuffer(GL_ARRAY_BUFFER, _buffer); glBufferData(GL_ARRAY_BUFFER, _size, nullptr, GL_DYNAMIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -53,10 +53,10 @@ public: } }; -GLuint GLBackend::getBufferID(const Buffer& buffer) { - return GLBuffer::getId(buffer); +GLuint GL41Backend::getBufferID(const Buffer& buffer) { + return GL41Buffer::getId(buffer); } -gl::GLBuffer* GLBackend::syncGPUObject(const Buffer& buffer) { - return GLBuffer::sync(buffer); +gl::GLBuffer* GL41Backend::syncGPUObject(const Buffer& buffer) { + return GL41Buffer::sync(buffer); } diff --git a/libraries/gpu-gl/src/gpu/gl41/GLBackendInput.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendInput.cpp similarity index 96% rename from libraries/gpu-gl/src/gpu/gl41/GLBackendInput.cpp rename to libraries/gpu-gl/src/gpu/gl41/GL41BackendInput.cpp index 0486d1cfd2..1b0caa7345 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GLBackendInput.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendInput.cpp @@ -1,5 +1,5 @@ // -// GLBackendInput.cpp +// GL41BackendInput.cpp // libraries/gpu/src/gpu // // Created by Sam Gateau on 3/8/2015. @@ -8,7 +8,7 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GLBackend.h" +#include "GL41Backend.h" using namespace gpu; using namespace gpu::gl41; @@ -22,7 +22,7 @@ using namespace gpu::gl41; #define SUPPORT_VERTEX_ATTRIB_FORMAT #endif -void GLBackend::updateInput() { +void GL41Backend::updateInput() { #if defined(SUPPORT_VERTEX_ATTRIB_FORMAT) if (_input._invalidFormat) { @@ -36,7 +36,7 @@ void GLBackend::updateInput() { GLuint slot = attrib._slot; GLuint count = attrib._element.getLocationScalarCount(); uint8_t locationCount = attrib._element.getLocationCount(); - GLenum type = _elementTypeToGLType[attrib._element.getType()]; + GLenum type = _elementTypeToGL41Type[attrib._element.getType()]; GLuint offset = attrib._offset;; GLboolean isNormalized = attrib._element.isNormalized(); @@ -142,7 +142,7 @@ void GLBackend::updateInput() { int bufferNum = (channelIt).first; if (_input._invalidBuffers.test(bufferNum) || _input._invalidFormat) { - // GLuint vbo = gpu::GLBackend::getBufferID((*buffers[bufferNum])); + // GLuint vbo = gpu::GL41Backend::getBufferID((*buffers[bufferNum])); GLuint vbo = _input._bufferVBOs[bufferNum]; if (boundVBO != vbo) { glBindBuffer(GL_ARRAY_BUFFER, vbo); diff --git a/libraries/gpu-gl/src/gpu/gl41/GLBackendOutput.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendOutput.cpp similarity index 86% rename from libraries/gpu-gl/src/gpu/gl41/GLBackendOutput.cpp rename to libraries/gpu-gl/src/gpu/gl41/GL41BackendOutput.cpp index a34a0aaebd..53c2c75394 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GLBackendOutput.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendOutput.cpp @@ -1,5 +1,5 @@ // -// GLBackendTexture.cpp +// GL41BackendTexture.cpp // libraries/gpu/src/gpu // // Created by Sam Gateau on 1/19/2015. @@ -8,7 +8,7 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GLBackend.h" +#include "GL41Backend.h" #include @@ -17,7 +17,7 @@ namespace gpu { namespace gl41 { -class GLFramebuffer : public gl::GLFramebuffer { +class GL41Framebuffer : public gl::GLFramebuffer { using Parent = gl::GLFramebuffer; static GLuint allocate() { GLuint result; @@ -56,7 +56,7 @@ public: for (auto& b : _gpuObject.getRenderBuffers()) { surface = b._texture; if (surface) { - gltexture = gl::GLTexture::sync(surface, false); // Grab the gltexture and don't transfer + gltexture = gl::GLTexture::sync(surface, false); // Grab the gltexture and don't transfer } else { gltexture = nullptr; } @@ -83,7 +83,7 @@ public: if (_gpuObject.getDepthStamp() != _depthStamp) { auto surface = _gpuObject.getDepthStencilBuffer(); if (_gpuObject.hasDepthStencil() && surface) { - gltexture = gl::GLTexture::sync(surface, false); // Grab the gltexture and don't transfer + gltexture = gl::GLTexture::sync(surface, false); // Grab the gltexture and don't transfer } if (gltexture) { @@ -115,19 +115,19 @@ public: public: - GLFramebuffer(const gpu::Framebuffer& framebuffer) + GL41Framebuffer(const gpu::Framebuffer& framebuffer) : Parent(framebuffer, allocate()) { } }; -gl::GLFramebuffer* GLBackend::syncGPUObject(const Framebuffer& framebuffer) { - return GLFramebuffer::sync(framebuffer); +gl::GLFramebuffer* GL41Backend::syncGPUObject(const Framebuffer& framebuffer) { + return GL41Framebuffer::sync(framebuffer); } -GLuint GLBackend::getFramebufferID(const FramebufferPointer& framebuffer) { - return framebuffer ? GLFramebuffer::getId(*framebuffer) : 0; +GLuint GL41Backend::getFramebufferID(const FramebufferPointer& framebuffer) { + return framebuffer ? GL41Framebuffer::getId(*framebuffer) : 0; } -void GLBackend::do_blit(Batch& batch, size_t paramOffset) { +void GL41Backend::do_blit(Batch& batch, size_t paramOffset) { auto srcframebuffer = batch._framebuffers.get(batch._params[paramOffset]._uint); Vec4i srcvp; for (auto i = 0; i < 4; ++i) { diff --git a/libraries/gpu-gl/src/gpu/gl41/GLBackendQuery.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendQuery.cpp similarity index 62% rename from libraries/gpu-gl/src/gpu/gl41/GLBackendQuery.cpp rename to libraries/gpu-gl/src/gpu/gl41/GL41BackendQuery.cpp index 4915adbc1d..3c6109bbdf 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GLBackendQuery.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendQuery.cpp @@ -1,5 +1,5 @@ // -// GLBackendQuery.cpp +// GL41BackendQuery.cpp // libraries/gpu/src/gpu // // Created by Sam Gateau on 7/7/2015. @@ -8,14 +8,14 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GLBackend.h" +#include "GL41Backend.h" #include "../gl/GLQuery.h" using namespace gpu; using namespace gpu::gl41; -class GLQuery : public gpu::gl::GLQuery { +class GL41Query : public gpu::gl::GLQuery { using Parent = gpu::gl::GLBuffer; public: static GLuint allocateQuery() { @@ -24,14 +24,14 @@ public: return result; } - GLQuery(const Query& query) + GL41Query(const Query& query) : gl::GLQuery(query, allocateQuery()) { } }; -gl::GLQuery* GLBackend::syncGPUObject(const Query& query) { - return GLQuery::sync(query); +gl::GLQuery* GL41Backend::syncGPUObject(const Query& query) { + return GL41Query::sync(query); } -GLuint GLBackend::getQueryID(const QueryPointer& query) { - return GLQuery::getId(query); +GLuint GL41Backend::getQueryID(const QueryPointer& query) { + return GL41Query::getId(query); } diff --git a/libraries/gpu-gl/src/gpu/gl41/GLBackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp similarity index 86% rename from libraries/gpu-gl/src/gpu/gl41/GLBackendTexture.cpp rename to libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp index f5e8531ddc..326a63c01a 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GLBackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp @@ -1,5 +1,5 @@ // -// GLBackendTexture.cpp +// GL41BackendTexture.cpp // libraries/gpu/src/gpu // // Created by Sam Gateau on 1/19/2015. @@ -8,7 +8,7 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GLBackend.h" +#include "GL41Backend.h" #include #include @@ -19,29 +19,29 @@ using namespace gpu; using namespace gpu::gl41; -using GLTexelFormat = gl::GLTexelFormat; -using GLTexture = GLBackend::GLTexture; +using GL41TexelFormat = gl::GLTexelFormat; +using GL41Texture = GL41Backend::GL41Texture; -GLuint GLTexture::allocate() { +GLuint GL41Texture::allocate() { Backend::incrementTextureGPUCount(); GLuint result; glGenTextures(1, &result); return result; } -GLuint GLBackend::getTextureID(const TexturePointer& texture, bool transfer) { - return GLTexture::getId(texture, transfer); +GLuint GL41Backend::getTextureID(const TexturePointer& texture, bool transfer) { + return GL41Texture::getId(texture, transfer); } -gl::GLTexture* GLBackend::syncGPUObject(const TexturePointer& texture, bool transfer) { - return GLTexture::sync(texture, transfer); +gl::GLTexture* GL41Backend::syncGPUObject(const TexturePointer& texture, bool transfer) { + return GL41Texture::sync(texture, transfer); } -GLTexture::GLTexture(const Texture& texture, bool transferrable) : gl::GLTexture(texture, allocate(), transferrable) {} +GL41Texture::GL41Texture(const Texture& texture, bool transferrable) : gl::GLTexture(texture, allocate(), transferrable) {} -GLTexture::GLTexture(const Texture& texture, GLTexture* original) : gl::GLTexture(texture, allocate(), original) {} +GL41Texture::GL41Texture(const Texture& texture, GL41Texture* original) : gl::GLTexture(texture, allocate(), original) {} -void GLBackend::GLTexture::withPreservedTexture(std::function f) const { +void GL41Backend::GL41Texture::withPreservedTexture(std::function f) const { GLint boundTex = -1; switch (_target) { case GL_TEXTURE_2D: @@ -63,14 +63,14 @@ void GLBackend::GLTexture::withPreservedTexture(std::function f) const (void)CHECK_GL_ERROR(); } -void GLBackend::GLTexture::generateMips() const { +void GL41Backend::GL41Texture::generateMips() const { withPreservedTexture([&] { glGenerateMipmap(_target); }); (void)CHECK_GL_ERROR(); } -void GLBackend::GLTexture::allocateStorage() const { +void GL41Backend::GL41Texture::allocateStorage() const { gl::GLTexelFormat texelFormat = gl::GLTexelFormat::evalGLTexelFormat(_gpuObject.getTexelFormat()); glTexParameteri(_target, GL_TEXTURE_BASE_LEVEL, 0); (void)CHECK_GL_ERROR(); @@ -93,7 +93,7 @@ void GLBackend::GLTexture::allocateStorage() const { } } -void GLBackend::GLTexture::updateSize() const { +void GL41Backend::GL41Texture::updateSize() const { setSize(_virtualSize); if (!_id) { return; @@ -129,7 +129,7 @@ void GLBackend::GLTexture::updateSize() const { } // Move content bits from the CPU to the GPU for a given mip / face -void GLBackend::GLTexture::transferMip(uint16_t mipLevel, uint8_t face) const { +void GL41Backend::GL41Texture::transferMip(uint16_t mipLevel, uint8_t face) const { auto mip = _gpuObject.accessStoredMipFace(mipLevel, face); gl::GLTexelFormat texelFormat = gl::GLTexelFormat::evalGLTexelFormat(_gpuObject.getTexelFormat(), mip->getFormat()); //GLenum target = getFaceTargets()[face]; @@ -141,7 +141,7 @@ void GLBackend::GLTexture::transferMip(uint16_t mipLevel, uint8_t face) const { // This should never happen on the main thread // Move content bits from the CPU to the GPU -void GLBackend::GLTexture::transfer() const { +void GL41Backend::GL41Texture::transfer() const { PROFILE_RANGE(__FUNCTION__); //qDebug() << "Transferring texture: " << _privateTexture; // Need to update the content of the GPU object from the source sysmem of the texture @@ -208,11 +208,8 @@ void GLBackend::GLTexture::transfer() const { } } -void GLBackend::GLTexture::syncSampler() const { +void GL41Backend::GL41Texture::syncSampler() const { const Sampler& sampler = _gpuObject.getSampler(); - Texture::Type type = _gpuObject.getType(); - auto object = this; - const auto& fm = FILTER_MODES[sampler.getFilter()]; glTexParameteri(_target, GL_TEXTURE_MIN_FILTER, fm.minFilter); glTexParameteri(_target, GL_TEXTURE_MAG_FILTER, fm.magFilter); diff --git a/libraries/gpu-gl/src/gpu/gl41/GLBackendTransform.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTransform.cpp similarity index 95% rename from libraries/gpu-gl/src/gpu/gl41/GLBackendTransform.cpp rename to libraries/gpu-gl/src/gpu/gl41/GL41BackendTransform.cpp index 6601eef86e..89b5db34c0 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GLBackendTransform.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTransform.cpp @@ -1,5 +1,5 @@ // -// GLBackendTransform.cpp +// GL41BackendTransform.cpp // libraries/gpu/src/gpu // // Created by Sam Gateau on 3/8/2015. @@ -8,12 +8,12 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GLBackend.h" +#include "GL41Backend.h" using namespace gpu; using namespace gpu::gl41; -void GLBackend::initTransform() { +void GL41Backend::initTransform() { glGenBuffers(1, &_transform._objectBuffer); glGenBuffers(1, &_transform._cameraBuffer); glGenBuffers(1, &_transform._drawCallInfoBuffer); @@ -24,7 +24,7 @@ void GLBackend::initTransform() { } } -void GLBackend::transferTransformState(const Batch& batch) const { +void GL41Backend::transferTransformState(const Batch& batch) const { // FIXME not thread safe static std::vector bufferData; if (!_transform._cameras.empty()) { diff --git a/libraries/gpu/src/gpu/Forward.h b/libraries/gpu/src/gpu/Forward.h index 83645f73e3..7fe6739ff7 100644 --- a/libraries/gpu/src/gpu/Forward.h +++ b/libraries/gpu/src/gpu/Forward.h @@ -87,11 +87,11 @@ namespace gpu { } namespace gl41 { - class GLBackend; + class GL41Backend; } namespace gl45 { - class GLBackend; + class GL45Backend; } }