diff options
author | clayjohn <claynjohn@gmail.com> | 2020-01-16 11:28:14 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2020-01-16 11:28:14 -0800 |
commit | f3af81b0594437d3a25f808d1ba1ec7f2ad78bba (patch) | |
tree | c5b62a6a011592ca435b2f34f7be7979341a61ac | |
parent | f2aa99a8e2d33e534fa3adbff2981a9c902bbf32 (diff) |
Gracefully handle 3D textures in GLES2
-rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index b0b14ed413..3fd9ecd1ce 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -109,6 +109,7 @@ PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC glFramebufferTexture2DMultisampleEXT #define glFramebufferTexture2DMultisample glFramebufferTexture2DMultisampleANGLE #endif +#define GL_TEXTURE_3D 0x806F #define GL_MAX_SAMPLES 0x8D57 #endif //!GLES_OVER_GL @@ -565,11 +566,11 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_ texture->target = GL_TEXTURE_CUBE_MAP; texture->images.resize(6); } break; - case VS::TEXTURE_TYPE_2D_ARRAY: { - texture->images.resize(p_depth_3d); - } break; + case VS::TEXTURE_TYPE_2D_ARRAY: case VS::TEXTURE_TYPE_3D: { - texture->images.resize(p_depth_3d); + texture->target = GL_TEXTURE_3D; + ERR_PRINT("3D textures and Texture Arrays are not supported in GLES2. Please switch to the GLES3 backend."); + return; } break; default: { ERR_PRINT("Unknown texture type!"); @@ -626,6 +627,10 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p Texture *texture = texture_owner.getornull(p_texture); ERR_FAIL_COND(!texture); + if (texture->target == GL_TEXTURE_3D) { + // Target is set to a 3D texture or array texture, exit early to avoid spamming errors + return; + } ERR_FAIL_COND(!texture->active); ERR_FAIL_COND(texture->render_target); ERR_FAIL_COND(texture->format != p_image->get_format()); |