This reverts commit 58f96be2c4.
This caused material files to increase in size significantly. It turns
out that glslang has to generate a copy for each parameter that is
passed to a function as a non-const parameter.
This revert will break IMG devices again, but that should be the case
only on debug builds. Release builds lose the const qualifier by
virtue of going through spirv. We'll try to address this some other
way later.
27 lines
951 B
GLSL
27 lines
951 B
GLSL
//------------------------------------------------------------------------------
|
|
// Shadowing
|
|
//------------------------------------------------------------------------------
|
|
|
|
#if defined(VARIANT_HAS_SHADOWING)
|
|
/**
|
|
* Computes the light space position of the specified world space point.
|
|
* The returned point may contain a bias to attempt to eliminate common
|
|
* shadowing artifacts such as "acne". To achieve this, the world space
|
|
* normal at the point must also be passed to this function.
|
|
* Normal bias is not used for VSM.
|
|
*/
|
|
|
|
highp vec4 computeLightSpacePosition(highp vec3 p, const highp vec3 n,
|
|
const highp vec3 dir, const float b, highp_mat4 lightFromWorldMatrix) {
|
|
|
|
#if !defined(VARIANT_HAS_VSM)
|
|
highp float cosTheta = saturate(dot(n, dir));
|
|
highp float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
|
|
p += n * (sinTheta * b);
|
|
#endif
|
|
|
|
return mulMat4x4Float3(lightFromWorldMatrix, p);
|
|
}
|
|
|
|
#endif // VARIANT_HAS_SHADOWING
|