mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 10:47:09 +02:00
Don't sync textures with unsupported formats to the GPU
This commit is contained in:
parent
17e9c3d00c
commit
aeb7ca17a5
2 changed files with 13 additions and 1 deletions
|
@ -32,7 +32,7 @@ public:
|
||||||
static const GLint RESOURCE_TRANSFER_EXTRA_TEX_UNIT { 33 };
|
static const GLint RESOURCE_TRANSFER_EXTRA_TEX_UNIT { 33 };
|
||||||
static const GLint RESOURCE_BUFFER_TEXBUF_TEX_UNIT { 34 };
|
static const GLint RESOURCE_BUFFER_TEXBUF_TEX_UNIT { 34 };
|
||||||
static const GLint RESOURCE_BUFFER_SLOT0_TEX_UNIT { 35 };
|
static const GLint RESOURCE_BUFFER_SLOT0_TEX_UNIT { 35 };
|
||||||
|
static bool supportedTextureFormat(const gpu::Element& format);
|
||||||
explicit GLESBackend(bool syncCache) : Parent(syncCache) {}
|
explicit GLESBackend(bool syncCache) : Parent(syncCache) {}
|
||||||
GLESBackend() : Parent() {}
|
GLESBackend() : Parent() {}
|
||||||
virtual ~GLESBackend() {
|
virtual ~GLESBackend() {
|
||||||
|
|
|
@ -19,6 +19,12 @@ using namespace gpu;
|
||||||
using namespace gpu::gl;
|
using namespace gpu::gl;
|
||||||
using namespace gpu::gles;
|
using namespace gpu::gles;
|
||||||
|
|
||||||
|
bool GLESBackend::supportedTextureFormat(const gpu::Element& format) {
|
||||||
|
// FIXME distinguish between GLES and GL compressed formats after support
|
||||||
|
// for the former is added to gpu::Element
|
||||||
|
return !format.isCompressed();
|
||||||
|
}
|
||||||
|
|
||||||
GLTexture* GLESBackend::syncGPUObject(const TexturePointer& texturePointer) {
|
GLTexture* GLESBackend::syncGPUObject(const TexturePointer& texturePointer) {
|
||||||
if (!texturePointer) {
|
if (!texturePointer) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -34,6 +40,12 @@ GLTexture* GLESBackend::syncGPUObject(const TexturePointer& texturePointer) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check whether the texture is in a format we can deal with
|
||||||
|
auto format = texture.getTexelFormat();
|
||||||
|
if (!supportedTextureFormat(format)) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
GLESTexture* object = Backend::getGPUObject<GLESTexture>(texture);
|
GLESTexture* object = Backend::getGPUObject<GLESTexture>(texture);
|
||||||
if (!object) {
|
if (!object) {
|
||||||
switch (texture.getUsageType()) {
|
switch (texture.getUsageType()) {
|
||||||
|
|
Loading…
Reference in a new issue