Files
filament/shaders/src/shading_reflections.fs
T
Mathias Agopian 66b78074de Revert "workaround another PowerVR compiler bug "
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.
2023-08-25 15:31:00 -07:00

24 lines
814 B
GLSL

/*
* screen-space reflection shading
*/
vec4 evaluateMaterial(const MaterialInputs material) {
#if defined(MATERIAL_HAS_REFLECTIONS)
PixelParams pixel;
getAnisotropyPixelParams(material, pixel);
vec4 color = vec4(0.0);
if (frameUniforms.ssrDistance > 0.0) {
vec3 r = getReflectedVector(pixel, shading_view, shading_normal);
// evaluateScreenSpaceReflections will set the value of color if there's a hit.
// color.a contains the reflection's contribution.
color = evaluateScreenSpaceReflections(r);
}
#else
// objects without reflections just erase the framebuffer, they need to be drawn in the
// reflection buffer because they could be partially occluding other objects with reflections.
const vec4 color = vec4(0.0);
#endif
return color;
}