Skip to content

Commit

Permalink
Merge pull request #80909 from adamscott/web-fix-max-uniform-buffer-s…
Browse files Browse the repository at this point in the history
…ize-overflow

Fix integer value for `GL_MAX_UNIFORM_BLOCK_SIZE` overflowing
  • Loading branch information
akien-mga committed Aug 28, 2023
2 parents bcbe1fd + 9c7db73 commit fd7b27a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion drivers/gles3/shader_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ void ShaderGLES3::initialize(const String &p_general_defines, int p_base_texture
print_verbose("Shader '" + name + "' SHA256: " + base_sha256);
}

glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_image_units);
glGetInteger64v(GL_MAX_TEXTURE_IMAGE_UNITS, &max_image_units);
}

void ShaderGLES3::set_shader_cache_dir(const String &p_dir) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/shader_gles3.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class ShaderGLES3 {
static bool shader_cache_save_debug;
bool shader_cache_dir_valid = false;

GLint max_image_units = 0;
int64_t max_image_units = 0;

enum StageType {
STAGE_TYPE_VERTEX,
Expand Down
16 changes: 8 additions & 8 deletions drivers/gles3/storage/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Config::Config() {
singleton = this;

{
GLint max_extensions = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &max_extensions);
for (int i = 0; i < max_extensions; i++) {
int64_t max_extensions = 0;
glGetInteger64v(GL_NUM_EXTENSIONS, &max_extensions);
for (int64_t i = 0; i < max_extensions; i++) {
const GLubyte *s = glGetStringi(GL_EXTENSIONS, i);
if (!s) {
break;
Expand Down Expand Up @@ -88,11 +88,11 @@ Config::Config() {
rgtc_supported = extensions.has("GL_EXT_texture_compression_rgtc") || extensions.has("GL_ARB_texture_compression_rgtc") || extensions.has("EXT_texture_compression_rgtc");
#endif

glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &max_vertex_texture_image_units);
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_image_units);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &max_uniform_buffer_size);
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size);
glGetInteger64v(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &max_vertex_texture_image_units);
glGetInteger64v(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_image_units);
glGetInteger64v(GL_MAX_TEXTURE_SIZE, &max_texture_size);
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &max_uniform_buffer_size);
glGetInteger64v(GL_MAX_VIEWPORT_DIMS, max_viewport_size);

support_anisotropic_filter = extensions.has("GL_EXT_texture_filter_anisotropic");
if (support_anisotropic_filter) {
Expand Down
16 changes: 8 additions & 8 deletions drivers/gles3/storage/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ class Config {
bool use_nearest_mip_filter = false;
bool use_depth_prepass = true;

int max_vertex_texture_image_units = 0;
int max_texture_image_units = 0;
int max_texture_size = 0;
int max_viewport_size[2] = { 0, 0 };
int max_uniform_buffer_size = 0;
int max_renderable_elements = 0;
int max_renderable_lights = 0;
int max_lights_per_object = 0;
int64_t max_vertex_texture_image_units = 0;
int64_t max_texture_image_units = 0;
int64_t max_texture_size = 0;
int64_t max_viewport_size[2] = { 0, 0 };
int64_t max_uniform_buffer_size = 0;
int64_t max_renderable_elements = 0;
int64_t max_renderable_lights = 0;
int64_t max_lights_per_object = 0;

// TODO implement wireframe in OpenGL
// bool generate_wireframes;
Expand Down

0 comments on commit fd7b27a

Please sign in to comment.