|
@@ -79,6 +79,9 @@ GLuint RasterizerStorageGLES2::system_fbo = 0;
|
|
|
|
|
|
#define _EXT_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
|
|
|
|
|
|
+#define _GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
|
|
+#define _GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
|
|
+
|
|
|
#define _RED_OES 0x1903
|
|
|
|
|
|
#define _DEPTH_COMPONENT24_OES 0x81A6
|
|
@@ -749,6 +752,16 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p
|
|
|
glTexParameterf(texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
}
|
|
|
|
|
|
+ if (config.use_anisotropic_filter) {
|
|
|
+
|
|
|
+ if (texture->flags & VS::TEXTURE_FLAG_ANISOTROPIC_FILTER) {
|
|
|
+
|
|
|
+ glTexParameterf(texture->target, _GL_TEXTURE_MAX_ANISOTROPY_EXT, config.anisotropic_level);
|
|
|
+ } else {
|
|
|
+ glTexParameterf(texture->target, _GL_TEXTURE_MAX_ANISOTROPY_EXT, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
int mipmaps = ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && img->has_mipmaps()) ? img->get_mipmap_count() + 1 : 1;
|
|
|
|
|
|
int w = img->get_width();
|
|
@@ -957,6 +970,16 @@ void RasterizerStorageGLES2::texture_set_flags(RID p_texture, uint32_t p_flags)
|
|
|
glTexParameterf(texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
}
|
|
|
|
|
|
+ if (config.use_anisotropic_filter) {
|
|
|
+
|
|
|
+ if (texture->flags & VS::TEXTURE_FLAG_ANISOTROPIC_FILTER) {
|
|
|
+
|
|
|
+ glTexParameterf(texture->target, _GL_TEXTURE_MAX_ANISOTROPY_EXT, config.anisotropic_level);
|
|
|
+ } else {
|
|
|
+ glTexParameterf(texture->target, _GL_TEXTURE_MAX_ANISOTROPY_EXT, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps) {
|
|
|
if (!had_mipmaps && texture->mipmaps == 1) {
|
|
|
glGenerateMipmap(texture->target);
|
|
@@ -6069,6 +6092,13 @@ void RasterizerStorageGLES2::initialize() {
|
|
|
config.rgtc_supported = config.extensions.has("GL_EXT_texture_compression_rgtc") || config.extensions.has("GL_ARB_texture_compression_rgtc") || config.extensions.has("EXT_texture_compression_rgtc");
|
|
|
config.bptc_supported = config.extensions.has("GL_ARB_texture_compression_bptc") || config.extensions.has("EXT_texture_compression_bptc");
|
|
|
|
|
|
+ config.anisotropic_level = 1.0;
|
|
|
+ config.use_anisotropic_filter = config.extensions.has("GL_EXT_texture_filter_anisotropic");
|
|
|
+ if (config.use_anisotropic_filter) {
|
|
|
+ glGetFloatv(_GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &config.anisotropic_level);
|
|
|
+ config.anisotropic_level = MIN(int(ProjectSettings::get_singleton()->get("rendering/quality/filters/anisotropic_filter_level")), config.anisotropic_level);
|
|
|
+ }
|
|
|
+
|
|
|
//determine formats for depth textures (or renderbuffers)
|
|
|
if (config.support_depth_texture) {
|
|
|
// Will use texture for depth
|