mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
PR feedback
This commit is contained in:
parent
3cc08cdcfc
commit
7efcad38d2
16 changed files with 84 additions and 100 deletions
|
@ -16,7 +16,7 @@
|
|||
#include <functional>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#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();
|
||||
|
|
|
@ -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;
|
|
@ -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<GLuint&>(_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
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<GLuint&>(_id) = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
~GLTexture();
|
||||
|
||||
const GLuint& _texture { _id };
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#endif
|
||||
|
||||
#include "GLShared.h"
|
||||
#include "GLTexture.h"
|
||||
|
||||
using namespace gpu;
|
||||
using namespace gpu::gl;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <GenericQueueThread.h>
|
||||
|
||||
#include "GLShared.h"
|
||||
#include "GLTexture.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define THREADED_TEXTURE_TRANSFER
|
||||
|
|
|
@ -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 <mutex>
|
||||
#include <queue>
|
||||
|
@ -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];
|
|
@ -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 <gl/Config.h>
|
||||
|
||||
|
@ -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;
|
|
@ -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<GLBuffer>(buffer);
|
||||
GLuint GL41Backend::getBufferID(const Buffer& buffer) {
|
||||
return GL41Buffer::getId<GL41Buffer>(buffer);
|
||||
}
|
||||
|
||||
gl::GLBuffer* GLBackend::syncGPUObject(const Buffer& buffer) {
|
||||
return GLBuffer::sync<GLBuffer>(buffer);
|
||||
gl::GLBuffer* GL41Backend::syncGPUObject(const Buffer& buffer) {
|
||||
return GL41Buffer::sync<GL41Buffer>(buffer);
|
||||
}
|
|
@ -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);
|
|
@ -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 <QtGui/QImage>
|
||||
|
||||
|
@ -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<GLBackend::GLTexture>(surface, false); // Grab the gltexture and don't transfer
|
||||
gltexture = gl::GLTexture::sync<GL41Backend::GL41Texture>(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<GLBackend::GLTexture>(surface, false); // Grab the gltexture and don't transfer
|
||||
gltexture = gl::GLTexture::sync<GL41Backend::GL41Texture>(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<GLFramebuffer>(framebuffer);
|
||||
gl::GLFramebuffer* GL41Backend::syncGPUObject(const Framebuffer& framebuffer) {
|
||||
return GL41Framebuffer::sync<GL41Framebuffer>(framebuffer);
|
||||
}
|
||||
|
||||
GLuint GLBackend::getFramebufferID(const FramebufferPointer& framebuffer) {
|
||||
return framebuffer ? GLFramebuffer::getId<GLFramebuffer>(*framebuffer) : 0;
|
||||
GLuint GL41Backend::getFramebufferID(const FramebufferPointer& framebuffer) {
|
||||
return framebuffer ? GL41Framebuffer::getId<GL41Framebuffer>(*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) {
|
|
@ -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<GLQuery>(query);
|
||||
gl::GLQuery* GL41Backend::syncGPUObject(const Query& query) {
|
||||
return GL41Query::sync<GL41Query>(query);
|
||||
}
|
||||
|
||||
GLuint GLBackend::getQueryID(const QueryPointer& query) {
|
||||
return GLQuery::getId<GLQuery>(query);
|
||||
GLuint GL41Backend::getQueryID(const QueryPointer& query) {
|
||||
return GL41Query::getId<GL41Query>(query);
|
||||
}
|
|
@ -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 <unordered_set>
|
||||
#include <unordered_map>
|
||||
|
@ -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<GLTexture>(texture, transfer);
|
||||
GLuint GL41Backend::getTextureID(const TexturePointer& texture, bool transfer) {
|
||||
return GL41Texture::getId<GL41Texture>(texture, transfer);
|
||||
}
|
||||
|
||||
gl::GLTexture* GLBackend::syncGPUObject(const TexturePointer& texture, bool transfer) {
|
||||
return GLTexture::sync<GLTexture>(texture, transfer);
|
||||
gl::GLTexture* GL41Backend::syncGPUObject(const TexturePointer& texture, bool transfer) {
|
||||
return GL41Texture::sync<GL41Texture>(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<void()> f) const {
|
||||
void GL41Backend::GL41Texture::withPreservedTexture(std::function<void()> f) const {
|
||||
GLint boundTex = -1;
|
||||
switch (_target) {
|
||||
case GL_TEXTURE_2D:
|
||||
|
@ -63,14 +63,14 @@ void GLBackend::GLTexture::withPreservedTexture(std::function<void()> 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);
|
|
@ -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<uint8_t> bufferData;
|
||||
if (!_transform._cameras.empty()) {
|
|
@ -87,11 +87,11 @@ namespace gpu {
|
|||
}
|
||||
|
||||
namespace gl41 {
|
||||
class GLBackend;
|
||||
class GL41Backend;
|
||||
}
|
||||
|
||||
namespace gl45 {
|
||||
class GLBackend;
|
||||
class GL45Backend;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue