Skip to content

Commit

Permalink
Merge pull request #80843 from lawnjelly/fix_gles3_wrapper_init
Browse files Browse the repository at this point in the history
[3.x] Initialize `GLWrapper` earlier in `Storage::initialize()`
  • Loading branch information
akien-mga authored Aug 21, 2023
2 parents 840fdb7 + 857d884 commit 17b403a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions drivers/gles2/rasterizer_storage_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6315,6 +6315,10 @@ void RasterizerStorageGLES2::initialize() {
config.depth_internalformat = GL_DEPTH_COMPONENT;
config.depth_type = GL_UNSIGNED_INT;

// Initialize GLWrapper early on, as required for any calls to glActiveTexture.
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &config.max_texture_image_units);
gl_wrapper.initialize(config.max_texture_image_units);

#ifdef GLES_OVER_GL
config.float_texture_supported = true;
config.s3tc_supported = true;
Expand Down Expand Up @@ -6506,8 +6510,6 @@ void RasterizerStorageGLES2::initialize() {
frame.clear_request = false;

glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &config.max_vertex_texture_image_units);
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &config.max_texture_image_units);
gl_wrapper.initialize(config.max_texture_image_units);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &config.max_texture_size);
glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &config.max_cubemap_texture_size);
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, config.max_viewport_dimensions);
Expand Down
6 changes: 4 additions & 2 deletions drivers/gles3/rasterizer_storage_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8157,6 +8157,10 @@ void RasterizerStorageGLES3::initialize() {
config.shrink_textures_x2 = false;
config.use_fast_texture_filter = int(ProjectSettings::get_singleton()->get("rendering/quality/filters/use_nearest_mipmap_filter"));

// Initialize GLWrapper early on, as required for any calls to glActiveTexture.
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &config.max_texture_image_units);
gl_wrapper.initialize(config.max_texture_image_units);

config.etc_supported = config.extensions.has("GL_OES_compressed_ETC1_RGB8_texture");
config.latc_supported = config.extensions.has("GL_EXT_texture_compression_latc");
config.bptc_supported = config.extensions.has("GL_ARB_texture_compression_bptc");
Expand Down Expand Up @@ -8388,8 +8392,6 @@ void RasterizerStorageGLES3::initialize() {
glBindTexture(GL_TEXTURE_2D, 0);
}

glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &config.max_texture_image_units);
gl_wrapper.initialize(config.max_texture_image_units);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &config.max_texture_size);
glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &config.max_cubemap_texture_size);

Expand Down

0 comments on commit 17b403a

Please sign in to comment.