summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering')
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp12
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp3
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl6
5 files changed, 14 insertions, 15 deletions
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index 38234cf0e7..e6fc50afbf 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -694,9 +694,9 @@ void RendererCanvasRenderRD::_render_item(RD::DrawListID p_draw_list, RID p_rend
_bind_canvas_texture(p_draw_list, RID(), current_filter, current_repeat, last_texture, push_constant, texpixel_size);
- RD::get_singleton()->draw_list_bind_index_array(p_draw_list, primitive_arrays.index_array[MIN(3, primitive->point_count) - 1]);
+ RD::get_singleton()->draw_list_bind_index_array(p_draw_list, primitive_arrays.index_array[MIN(3u, primitive->point_count) - 1]);
- for (uint32_t j = 0; j < MIN(3, primitive->point_count); j++) {
+ for (uint32_t j = 0; j < MIN(3u, primitive->point_count); j++) {
push_constant.points[j * 2 + 0] = primitive->points[j].x;
push_constant.points[j * 2 + 1] = primitive->points[j].y;
push_constant.uvs[j * 2 + 0] = primitive->uvs[j].x;
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index 6296e10962..14207c6620 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -1666,8 +1666,8 @@ void RendererSceneRenderRD::_allocate_blur_textures(RenderBuffers *rb) {
if (i == 1) {
// next 2 are half size
- tf.width = MAX(1, tf.width >> 1);
- tf.height = MAX(1, tf.height >> 1);
+ tf.width = MAX(1u, tf.width >> 1);
+ tf.height = MAX(1u, tf.height >> 1);
}
}
diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
index e8d2ff9c8a..45fc37bd02 100644
--- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
@@ -362,8 +362,8 @@ void RendererSceneSkyRD::ReflectionData::update_reflection_data(RendererStorageR
layer.views.write[j] = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_base_cube, p_base_layer + i * 6, j, 1, RD::TEXTURE_SLICE_CUBEMAP);
- mmw = MAX(1, mmw >> 1);
- mmh = MAX(1, mmh >> 1);
+ mmw = MAX(1u, mmw >> 1);
+ mmh = MAX(1u, mmh >> 1);
}
layers.push_back(layer);
@@ -390,8 +390,8 @@ void RendererSceneSkyRD::ReflectionData::update_reflection_data(RendererStorageR
layer.views.write[j] = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_base_cube, p_base_layer, j, 1, RD::TEXTURE_SLICE_CUBEMAP);
- mmw = MAX(1, mmw >> 1);
- mmh = MAX(1, mmh >> 1);
+ mmw = MAX(1u, mmw >> 1);
+ mmh = MAX(1u, mmh >> 1);
}
layers.push_back(layer);
@@ -432,8 +432,8 @@ void RendererSceneSkyRD::ReflectionData::update_reflection_data(RendererStorageR
}
}
- mmw = MAX(1, mmw >> 1);
- mmh = MAX(1, mmh >> 1);
+ mmw = MAX(1u, mmw >> 1);
+ mmh = MAX(1u, mmh >> 1);
}
}
}
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index e4ddc1b41f..f00931cf47 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -9510,8 +9510,7 @@ RendererStorageRD::RendererStorageRD() {
static_assert(sizeof(GlobalVariables::Value) == 16);
- global_variables.buffer_size = GLOBAL_GET("rendering/limits/global_shader_variables/buffer_size");
- global_variables.buffer_size = MAX(4096, global_variables.buffer_size);
+ global_variables.buffer_size = MAX(4096, (int)GLOBAL_GET("rendering/limits/global_shader_variables/buffer_size"));
global_variables.buffer_values = memnew_arr(GlobalVariables::Value, global_variables.buffer_size);
memset(global_variables.buffer_values, 0, sizeof(GlobalVariables::Value) * global_variables.buffer_size);
global_variables.buffer_usage = memnew_arr(GlobalVariables::ValueUsage, global_variables.buffer_size);
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
index 1c9b08b6d3..bd1c2b5758 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
@@ -1,9 +1,9 @@
// Functions related to lighting
float D_GGX(float cos_theta_m, float alpha) {
- float alpha2 = alpha * alpha;
- float d = 1.0 + (alpha2 - 1.0) * cos_theta_m * cos_theta_m;
- return alpha2 / (M_PI * d * d);
+ float a = cos_theta_m * alpha;
+ float k = alpha / (1.0 - cos_theta_m * cos_theta_m + a * a);
+ return k * k * (1.0 / M_PI);
}
// From Earl Hammon, Jr. "PBR Diffuse Lighting for GGX+Smith Microsurfaces" https://www.gdcvault.com/play/1024478/PBR-Diffuse-Lighting-for-GGX