From 616465b6321e38b6ece408ec4c9e3872e405f531 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 3 Jul 2023 19:23:42 +0200 Subject: [PATCH] use textureSize() in shadows-sapp.glsl instead passing from cpu side --- sapp/shadows-sapp.c | 1 - sapp/shadows-sapp.glsl | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sapp/shadows-sapp.c b/sapp/shadows-sapp.c index 7f0b7836..dcedf735 100644 --- a/sapp/shadows-sapp.c +++ b/sapp/shadows-sapp.c @@ -277,7 +277,6 @@ void frame(void) { const fs_display_params_t fs_display_params = { .light_dir = HMM_NormalizeVec3(light_pos.XYZ), .eye_pos = eye_pos, - .sm_size = HMM_Vec2(2048.0f, 2048.0f), }; const vs_display_params_t plane_vs_display_params = { diff --git a/sapp/shadows-sapp.glsl b/sapp/shadows-sapp.glsl index 96130e58..01eeafbe 100644 --- a/sapp/shadows-sapp.glsl +++ b/sapp/shadows-sapp.glsl @@ -105,7 +105,6 @@ void main() { uniform fs_display_params { vec3 light_dir; vec3 eye_pos; - vec2 sm_size; }; uniform texture2D shadow_map; @@ -124,6 +123,7 @@ vec4 gamma(vec4 c) { } void main() { + vec2 sm_size = textureSize(sampler2D(shadow_map, shadow_sampler), 0); float spec_power = 2.2; float ambient_intensity = 0.25; vec3 l = normalize(light_dir);