From db81928e08cb58d5f67908c6dfcf9433e572ffe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 11 Feb 2020 14:01:43 +0100 Subject: Vulkan: Move thirdparty code out of drivers, style fixes - `vk_enum_string_helper.h` is a generated file taken from the SDK (Vulkan-ValidationLayers). - `vk_mem_alloc.h` is a library from GPUOpen: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator --- .../rasterizer_rd/shaders/roughness_limiter.glsl | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'servers/visual/rasterizer_rd/shaders/roughness_limiter.glsl') diff --git a/servers/visual/rasterizer_rd/shaders/roughness_limiter.glsl b/servers/visual/rasterizer_rd/shaders/roughness_limiter.glsl index 5e0491c979..3637b1abb2 100644 --- a/servers/visual/rasterizer_rd/shaders/roughness_limiter.glsl +++ b/servers/visual/rasterizer_rd/shaders/roughness_limiter.glsl @@ -1,13 +1,12 @@ /* clang-format off */ [compute] -/* clang-format on */ #version 450 VERSION_DEFINES layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; - +/* clang-format on */ layout(set = 0, binding = 0) uniform sampler2D source_normal; layout(r8, set = 1, binding = 0) uniform restrict writeonly image2D dest_roughness; @@ -16,7 +15,8 @@ layout(push_constant, binding = 1, std430) uniform Params { ivec2 screen_size; float curve; uint pad; -} params; +} +params; #define HALF_PI 1.5707963267948966 @@ -24,16 +24,16 @@ void main() { // Pixel being shaded ivec2 pos = ivec2(gl_GlobalInvocationID.xy); - if (any(greaterThan(pos,params.screen_size))) { //too large, do nothing + if (any(greaterThan(pos, params.screen_size))) { //too large, do nothing return; } vec3 normal_accum = vec3(0.0); float accum = 0.0; - for(int i=0;i<=1;i++) { - for(int j=0;j<=1;j++) { - normal_accum += normalize(texelFetch(source_normal,pos+ivec2(i,j),0).xyz * 2.0 - 1.0); - accum+=1.0; + for (int i = 0; i <= 1; i++) { + for (int j = 0; j <= 1; j++) { + normal_accum += normalize(texelFetch(source_normal, pos + ivec2(i, j), 0).xyz * 2.0 - 1.0); + accum += 1.0; } } @@ -46,7 +46,7 @@ void main() { if (r < 1.0) { float threshold = 0.4; -/* + /* //Formula from Filament, does not make sense to me. float r2 = r * r; @@ -54,7 +54,7 @@ void main() { float variance = 0.25f / kappa; limit = sqrt(min(2.0f * variance, threshold * threshold)); //*/ -/* + /* //Formula based on probability distribution graph float width = acos(max(0.0,r)); // convert to angle (width) @@ -62,12 +62,12 @@ void main() { limit = min(sqrt(roughness), threshold); //convert to perceptual roughness and apply threshold //*/ - limit = min(sqrt(pow(acos(max(0.0,r)) / HALF_PI ,params.curve)), threshold); //convert to perceptual roughness and apply threshold + limit = min(sqrt(pow(acos(max(0.0, r)) / HALF_PI, params.curve)), threshold); //convert to perceptual roughness and apply threshold //limit = 0.5; } else { limit = 0.0; } - imageStore(dest_roughness,pos,vec4(limit)); + imageStore(dest_roughness, pos, vec4(limit)); } -- cgit v1.2.3