Skip to content

Commit

Permalink
Take resolution into account when setting the max shadow cubemap size
Browse files Browse the repository at this point in the history
  • Loading branch information
puchik committed Mar 22, 2021
1 parent 15ff752 commit 04b3ad5
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/gles2/rasterizer_scene_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4006,7 +4006,7 @@ void RasterizerSceneGLES2::initialize() {

// cubemaps for shadows
if (storage->config.support_shadow_cubemaps) { //not going to be used
int max_shadow_cubemap_sampler_size = 512;
int max_shadow_cubemap_sampler_size = CLAMP(int(next_power_of_2(GLOBAL_GET("rendering/quality/shadow_atlas/size")) >> 3), 256, storage->config.max_cubemap_texture_size);

int cube_size = max_shadow_cubemap_sampler_size;

Expand Down
1 change: 1 addition & 0 deletions drivers/gles2/rasterizer_storage_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6217,6 +6217,7 @@ void RasterizerStorageGLES2::initialize() {
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);
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);

// the use skeleton software path should be used if either float texture is not supported,
Expand Down
1 change: 1 addition & 0 deletions drivers/gles2/rasterizer_storage_gles2.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class RasterizerStorageGLES2 : public RasterizerStorage {
int max_vertex_texture_image_units;
int max_texture_image_units;
int max_texture_size;
int max_cubemap_texture_size;
int max_viewport_dimensions[2];

// TODO implement wireframe in GLES2
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/rasterizer_scene_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5105,7 +5105,7 @@ void RasterizerSceneGLES3::initialize() {

shadow_atlas_realloc_tolerance_msec = 500;

int max_shadow_cubemap_sampler_size = 512;
int max_shadow_cubemap_sampler_size = CLAMP(int(next_power_of_2(GLOBAL_GET("rendering/quality/shadow_atlas/size")) >> 3), 256, storage->config.max_cubemap_texture_size);

int cube_size = max_shadow_cubemap_sampler_size;

Expand Down
1 change: 1 addition & 0 deletions drivers/gles3/rasterizer_storage_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8498,6 +8498,7 @@ void RasterizerStorageGLES3::initialize() {

glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &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);

config.use_rgba_2d_shadows = !config.framebuffer_float_supported;

Expand Down
1 change: 1 addition & 0 deletions drivers/gles3/rasterizer_storage_gles3.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class RasterizerStorageGLES3 : public RasterizerStorage {

int max_texture_image_units;
int max_texture_size;
int max_cubemap_texture_size;

bool generate_wireframes;

Expand Down

0 comments on commit 04b3ad5

Please sign in to comment.