1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Implement support for array textures in GL driver

note: feature detection was not implemented in the legacy driver, but the code itself probably works.
This commit is contained in:
sfan5 2025-04-06 22:16:17 +02:00
parent d5bf094f9a
commit 46db688cc8
14 changed files with 111 additions and 72 deletions

View file

@ -267,6 +267,7 @@ bool COpenGL3DriverBase::genericDriverInit(const core::dimension2d<u32> &screenS
DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
DriverAttributes->setAttribute("MaxIndices", (s32)MaxIndices);
DriverAttributes->setAttribute("MaxTextureSize", (s32)MaxTextureSize);
DriverAttributes->setAttribute("MaxArrayTextureLayers", (s32)MaxArrayTextureLayers);
DriverAttributes->setAttribute("MaxTextureLODBias", MaxTextureLODBias);
DriverAttributes->setAttribute("Version", 100 * Version.Major + Version.Minor);
DriverAttributes->setAttribute("AntiAlias", AntiAlias);
@ -1072,20 +1073,9 @@ void COpenGL3DriverBase::endDraw(const VertexType &vertexType)
GL.DisableVertexAttribArray(attr.Index);
}
ITexture *COpenGL3DriverBase::createDeviceDependentTexture(const io::path &name, IImage *image)
ITexture *COpenGL3DriverBase::createDeviceDependentTexture(const io::path &name, E_TEXTURE_TYPE type, const std::vector<IImage*> &images)
{
std::vector<IImage*> tmp { image };
COpenGL3Texture *texture = new COpenGL3Texture(name, tmp, ETT_2D, this);
return texture;
}
ITexture *COpenGL3DriverBase::createDeviceDependentTextureCubemap(const io::path &name, const std::vector<IImage*> &image)
{
COpenGL3Texture *texture = new COpenGL3Texture(name, image, ETT_CUBEMAP, this);
return texture;
return new COpenGL3Texture(name, images, type, this);
}
// Same as COpenGLDriver::TextureFlipMatrix

View file

@ -267,9 +267,8 @@ protected:
void chooseMaterial2D();
ITexture *createDeviceDependentTexture(const io::path &name, IImage *image) override;
ITexture *createDeviceDependentTextureCubemap(const io::path &name, const std::vector<IImage*> &image) override;
ITexture *createDeviceDependentTexture(const io::path &name, E_TEXTURE_TYPE type,
const std::vector<IImage*> &images) override;
//! Map Irrlicht wrap mode to OpenGL enum
GLint getTextureWrapMode(u8 clamp) const;

View file

@ -76,6 +76,8 @@ public:
return StencilBuffer;
case EVDF_TEXTURE_MULTISAMPLE:
return TextureMultisampleSupported;
case EVDF_TEXTURE_2D_ARRAY:
return Texture2DArraySupported;
default:
return false;
};
@ -176,6 +178,7 @@ public:
bool AnisotropicFilterSupported = false;
bool BlendMinMaxSupported = false;
bool TextureMultisampleSupported = false;
bool Texture2DArraySupported = false;
bool KHRDebugSupported = false;
u32 MaxLabelLength = 0;
};