diff options
Diffstat (limited to 'source/blender')
13 files changed, 30 insertions, 20 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_mist_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_mist_frag.glsl index 7331f92ba6d..94b881b44f1 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_mist_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_mist_frag.glsl @@ -4,7 +4,7 @@ /* Convert depth to Mist factor */ uniform vec3 mistSettings; -uniform sampler2D depthBuffer; +uniform depth2D depthBuffer; #define mistStart mistSettings.x #define mistInvDistance mistSettings.y diff --git a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl index 0aa54715460..4f87cdf05d2 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl @@ -11,7 +11,7 @@ * by Jorge Jimenez */ uniform sampler2D colorBuffer; -uniform sampler2D depthBuffer; +uniform depth2D depthBuffer; uniform sampler2D velocityBuffer; uniform sampler2D tileMaxBuffer; diff --git a/source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl index 58bbb825043..1aff93e01f8 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl @@ -9,7 +9,7 @@ #define MAX_SSS_SAMPLES 65 layout(std140) uniform sssProfile { - vec4 kernel[MAX_SSS_SAMPLES]; + vec4 sss_kernel[MAX_SSS_SAMPLES]; vec4 radii_max_radius; int sss_samples; }; @@ -48,11 +48,11 @@ void main(void) float sss_radius_inv = 1.0 / max(1e-8, sss_radius); /* Center sample */ - vec3 accum = sss_irradiance * kernel[0].rgb; + vec3 accum = sss_irradiance * sss_kernel[0].rgb; for (int i = 1; i < sss_samples && i < MAX_SSS_SAMPLES; i++) { - vec2 sample_uv = uvs + kernel[i].a * finalStep * - ((abs(kernel[i].a) > sssJitterThreshold) ? dir : dir_rand); + vec2 sample_uv = uvs + sss_kernel[i].a * finalStep * + ((abs(sss_kernel[i].a) > sssJitterThreshold) ? dir : dir_rand); vec3 color = texture(sssIrradiance, sample_uv).rgb; float sample_depth = texture(depthBuffer, sample_uv).r; sample_depth = get_view_z_from_depth(sample_depth); @@ -66,8 +66,8 @@ void main(void) if (any(lessThan(sample_uv, vec2(0.0))) || any(greaterThan(sample_uv, vec2(1.0)))) { s = 0.0; } - /* Mix with first sample in failure case and apply kernel color. */ - accum += kernel[i].rgb * mix(sss_irradiance, color, s); + /* Mix with first sample in failure case and apply sss_kernel color. */ + accum += sss_kernel[i].rgb * mix(sss_irradiance, color, s); } #if defined(FIRST_PASS) diff --git a/source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl b/source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl index c54621f123d..b4ae8bd4405 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl @@ -3,7 +3,7 @@ #pragma BLENDER_REQUIRE(common_view_lib.glsl) uniform sampler2D colorBuffer; -uniform sampler2D depthBuffer; +uniform depth2D depthBuffer; uniform sampler2D colorHistoryBuffer; uniform mat4 prevViewProjectionMatrix; diff --git a/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl index 831ed0a119a..3cf21dc32d1 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl @@ -8,7 +8,7 @@ in vec4 uvcoordsvar; out vec4 FragColor; -uniform sampler2D depthBuffer; +uniform depth2D depthBuffer; uniform sampler1D sssTexProfile; uniform sampler2D sssRadius; uniform sampler2DArray sssShadowCubes; @@ -21,7 +21,7 @@ uniform sampler2DArray sssShadowCascades; layout(std140) uniform sssProfile { - vec4 kernel[MAX_SSS_SAMPLES]; + vec4 sss_kernel[MAX_SSS_SAMPLES]; vec4 radii_max_radius; int sss_samples; }; diff --git a/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl index 9182171bab4..87854dd3be2 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl @@ -1,7 +1,7 @@ #pragma BLENDER_REQUIRE(common_math_lib.glsl) -uniform sampler2D depthBuffer; +uniform depth2D depthBuffer; uniform mat4 prevViewProjMatrix; uniform mat4 currViewProjMatrixInv; diff --git a/source/blender/draw/engines/eevee/shaders/lights_lib.glsl b/source/blender/draw/engines/eevee/shaders/lights_lib.glsl index dc98a00a1cd..3d43ef9addd 100644 --- a/source/blender/draw/engines/eevee/shaders/lights_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/lights_lib.glsl @@ -89,8 +89,8 @@ layout(std140) uniform light_block LightData lights_data[MAX_LIGHT]; }; -uniform sampler2DArrayShadow shadowCubeTexture; -uniform sampler2DArrayShadow shadowCascadeTexture; +uniform depth2DArrayShadow shadowCubeTexture; +uniform depth2DArrayShadow shadowCascadeTexture; /** \} */ diff --git a/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl b/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl index 363b5cb978a..64ba8d44d39 100644 --- a/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/renderpass_postprocess_frag.glsl @@ -16,7 +16,7 @@ uniform int postProcessType; uniform int currentSample; -uniform sampler2D depthBuffer; +uniform depth2D depthBuffer; uniform sampler2D inputBuffer; uniform sampler2D inputSecondLightBuffer; uniform sampler2D inputColorBuffer; diff --git a/source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl b/source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl index ad0d682dcf4..2a7d7e38504 100644 --- a/source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl @@ -3,7 +3,7 @@ #pragma BLENDER_REQUIRE(common_utiltex_lib.glsl) #pragma BLENDER_REQUIRE(lights_lib.glsl) -uniform sampler2D depthBuffer; +uniform depth2D depthBuffer; out vec4 fragColor; diff --git a/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl b/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl index 67d172fbd01..2f4542343f7 100644 --- a/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl @@ -2,7 +2,7 @@ #pragma BLENDER_REQUIRE(common_math_lib.glsl) uniform sampler2D colorTex; -uniform sampler2D depthTex; +uniform depth2D depthTex; uniform sampler2D lineTex; uniform bool doSmoothLines; diff --git a/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl index 1f3a23324bb..19a3cd42bde 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl @@ -1,5 +1,5 @@ -uniform sampler2D depthBuffer; +uniform depth2D depthBuffer; uniform vec4 gridModelMatrix[4]; uniform bool isTransform; diff --git a/source/blender/draw/engines/overlay/shaders/grid_frag.glsl b/source/blender/draw/engines/overlay/shaders/grid_frag.glsl index 9feca644bd3..4a9b8d15528 100644 --- a/source/blender/draw/engines/overlay/shaders/grid_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/grid_frag.glsl @@ -12,7 +12,7 @@ uniform vec3 planeAxes; uniform float gridDistance; uniform vec3 gridSize; uniform float lineKernel = 0.0; -uniform sampler2D depthBuffer; +uniform depth2D depthBuffer; uniform int gridFlag; uniform float zoomFactor; @@ -49,7 +49,7 @@ float get_grid(vec2 co, vec2 fwidthCos, float grid_size) { float half_size = grid_size / 2.0; /* triangular wave pattern, amplitude is [0, half_size] */ - vec2 grid_domain = abs(mod(co + half_size, grid_size) - half_size); + vec2 grid_domain = abs(mod(co + half_size, vec2(grid_size)) - half_size); /* modulate by the absolute rate of change of the coordinates * (make lines have the same width under perspective) */ grid_domain /= fwidthCos; diff --git a/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl b/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl index a5fce2e71c3..0515a737e6e 100644 --- a/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl +++ b/source/blender/gpu/shaders/opengl/glsl_shader_defines.glsl @@ -1,3 +1,13 @@ + +/* Texture format tokens -- Type explictness required by other Graphics APIs. */ +#define depth2D sampler2D +#define depth2DArray sampler2DArray +#define depth2DMS sampler2DMS +#define depth2DMSArray sampler2DMSArray +#define depthCube samplerCube +#define depthCubeArray samplerCubeArray +#define depth2DArrayShadow sampler2DArrayShadow + /* Backend Functions. */ #define select(A, B, mask) mix(A, B, mask) |