glgsg: Fix issues with render-to-texture and cube map arrays

This commit is contained in:
rdb 2025-01-19 11:09:47 +01:00
parent eb5366b991
commit 271fa9d9c0
2 changed files with 13 additions and 5 deletions

View File

@ -459,15 +459,17 @@ rebuild_bitplanes() {
}
// If we can't bind this type of texture, punt it.
if ((tex->get_texture_type() != Texture::TT_2d_texture) &&
(tex->get_texture_type() != Texture::TT_3d_texture) &&
(tex->get_texture_type() != Texture::TT_2d_texture_array) &&
(tex->get_texture_type() != Texture::TT_cube_map)) {
Texture::TextureType texture_type = tex->get_texture_type();
if (texture_type != Texture::TT_2d_texture &&
texture_type != Texture::TT_3d_texture &&
texture_type != Texture::TT_2d_texture_array &&
texture_type != Texture::TT_cube_map &&
texture_type != Texture::TT_cube_map_array) {
((CData *)cdata.p())->_textures[i]._rtm_mode = RTM_copy_texture;
continue;
}
if (_rb_size_z > 1 && tex->get_texture_type() == Texture::TT_2d_texture) {
if (_rb_size_z > 1 && texture_type == Texture::TT_2d_texture) {
// We can't bind a 2D texture to a layered FBO. If the user happened
// to request RTM_bind_layered for a 2D texture, that's just silly,
// and we can't render to anything but the first layer anyway.
@ -1408,6 +1410,7 @@ attach_tex(GLenum attachpoint, CLP(TextureContext) *gtc, int view, int layer) {
target, index, 0, layer);
break;
case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_CUBE_MAP_ARRAY:
glgsg->_glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT, attachpoint,
index, 0, layer);
break;

View File

@ -7708,6 +7708,11 @@ framebuffer_copy_to_texture(Texture *tex, int view, int z,
return false;
}
} else if (tex->get_texture_type() == Texture::TT_cube_map_array) {
if (!_supports_cube_map_array) {
return false;
}
} else {
GLCAT.error()
<< "Don't know how to copy framebuffer to texture " << *tex << "\n";