Fix integer value for GL_MAX_UNIFORM_BLOCK_SIZE overflowing

This commit is contained in:
Adam Scott 2023-08-22 19:32:37 -04:00
parent 6f90b23702
commit 9c7db7397f
No known key found for this signature in database
GPG Key ID: 1352C2919D96DDDF
4 changed files with 18 additions and 18 deletions

View File

@ -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) {

View File

@ -154,7 +154,7 @@ private:
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,

View File

@ -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;
@ -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) {

View File

@ -58,14 +58,14 @@ public:
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;