mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +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_BUFFER_TEXBUF_TEX_UNIT { 34 };
|
||||
static const GLint RESOURCE_BUFFER_SLOT0_TEX_UNIT { 35 };
|
||||
|
||||
static bool supportedTextureFormat(const gpu::Element& format);
|
||||
explicit GLESBackend(bool syncCache) : Parent(syncCache) {}
|
||||
GLESBackend() : Parent() {}
|
||||
virtual ~GLESBackend() {
|
||||
|
|
|
@ -19,6 +19,12 @@ using namespace gpu;
|
|||
using namespace gpu::gl;
|
||||
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) {
|
||||
if (!texturePointer) {
|
||||
return nullptr;
|
||||
|
@ -34,6 +40,12 @@ GLTexture* GLESBackend::syncGPUObject(const TexturePointer& texturePointer) {
|
|||
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);
|
||||
if (!object) {
|
||||
switch (texture.getUsageType()) {
|
||||
|
|
Loading…
Reference in a new issue