Merge pull request #355 from Azaezel/alpha40_glFixes

fix gl compilation
This commit is contained in:
Brian Roberts 2020-10-09 19:59:21 -05:00 committed by GitHub
commit 880c366eda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 23 additions and 24 deletions

View file

@ -296,10 +296,10 @@ singleton shaderData( PrefiterCubemapShader )
// //
singleton ShaderData( PFX_ReflectionProbeArray ) singleton ShaderData( PFX_ReflectionProbeArray )
{ {
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFx/postFxV.hlsl"; DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/reflectionProbeArrayP.hlsl"; DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/reflectionProbeArrayP.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFx/gl/postFxV.glsl"; OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/reflectionProbeArrayP.glsl"; OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/reflectionProbeArrayP.glsl";
samplerNames[0] = "$deferredBuffer"; samplerNames[0] = "$deferredBuffer";

View file

@ -1,6 +1,6 @@
singleton ShaderData( DeferredColorShader ) singleton ShaderData( DeferredColorShader )
{ {
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFx/postFxV.hlsl"; DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredColorShaderP.hlsl"; DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredColorShaderP.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";

View file

@ -22,7 +22,7 @@
#include "core/rendering/shaders/gl/hlslCompat.glsl" #include "core/rendering/shaders/gl/hlslCompat.glsl"
#include "core/rendering/shaders/gl/torque.glsl" #include "core/rendering/shaders/gl/torque.glsl"
#include "core/rendering/shaders/postFX/postFx.glsl" #include "core/rendering/shaders/postFX/gl/postFx.glsl"
#include "shadergen:/autogenConditioners.h" #include "shadergen:/autogenConditioners.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -6,11 +6,11 @@
singleton ShaderData( PFX_afxHighlightShader ) singleton ShaderData( PFX_afxHighlightShader )
{ {
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; DXVertexShaderFile = "shaders/common/postFX/postFxV.hlsl";
DXPixelShaderFile = "shaders/AFX/afxPostFX_Highlight_P.hlsl"; DXPixelShaderFile = "shaders/AFX/afxPostFX_Highlight_P.hlsl";
//OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl"; //OGLVertexShaderFile = "shaders/common/postFX/gl//postFxV.glsl";
//OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl"; //OGLPixelShaderFile = "shaders/common/postFX/gl/passthruP.glsl";
samplerNames[0] = "$inputTex"; samplerNames[0] = "$inputTex";

View file

@ -22,7 +22,6 @@
#include "./torque.glsl" #include "./torque.glsl"
#include "./brdf.glsl" #include "./brdf.glsl"
#include "./shaderModelAutoGen.glsl"
#ifndef TORQUE_SHADERGEN #ifndef TORQUE_SHADERGEN
#line 26 #line 26
@ -98,7 +97,7 @@ void updateSurface(inout Surface surface)
surface.linearRoughnessSq = surface.linearRoughness * surface.linearRoughness; surface.linearRoughnessSq = surface.linearRoughness * surface.linearRoughness;
surface.albedo = surface.baseColor.rgb * (1.0f - surface.metalness); surface.albedo = surface.baseColor.rgb * (1.0f - surface.metalness);
surface.f0 = mix(0.04f, surface.baseColor.rgb, surface.metalness); surface.f0 = mix(vec3(0.04f,0.04f,0.04f), surface.baseColor.rgb, surface.metalness);
surface.R = -reflect(surface.V, surface.N); surface.R = -reflect(surface.V, surface.N);
surface.f90 = saturate(50.0 * dot(surface.f0, vec3(0.33,0.33,0.33))); surface.f90 = saturate(50.0 * dot(surface.f0, vec3(0.33,0.33,0.33)));
@ -452,7 +451,7 @@ vec4 computeForwardProbes(Surface surface,
float contrib = contribution[i]; float contrib = contribution[i];
if (contrib > 0.0f) if (contrib > 0.0f)
{ {
int cubemapIdx = int(probeConfigData[i].a); float cubemapIdx = int(probeConfigData[i].a);
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz); vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz);
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib; irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
@ -473,7 +472,7 @@ vec4 computeForwardProbes(Surface surface,
kD *= 1.0f - surface.metalness; kD *= 1.0f - surface.metalness;
float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex) float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
vec2 envBRDF = texture(BRDFTexture, vec4(dfgNdotV, surface.roughness,0,0)).rg; vec2 envBRDF = textureLod(BRDFTexture, vec2(dfgNdotV, surface.roughness),0).rg;
specular *= F * envBRDF.x + surface.f90 * envBRDF.y; specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
irradiance *= kD * surface.baseColor.rgb; irradiance *= kD * surface.baseColor.rgb;
@ -492,7 +491,7 @@ vec4 computeForwardProbes(Surface surface,
vec4 debugVizForwardProbes(Surface surface, vec4 debugVizForwardProbes(Surface surface,
float cubeMips, int numProbes, mat4 worldToObjArray[MAX_FORWARD_PROBES], vec4 probeConfigData[MAX_FORWARD_PROBES], float cubeMips, int numProbes, mat4 worldToObjArray[MAX_FORWARD_PROBES], vec4 probeConfigData[MAX_FORWARD_PROBES],
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 refBoxMinArray[MAX_FORWARD_PROBES], vec4 refBoxMaxArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES], vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 refBoxMinArray[MAX_FORWARD_PROBES], vec4 refBoxMaxArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
float skylightCubemapIdx, sampler2D(BRDFTexture), float skylightCubemapIdx, sampler2D BRDFTexture,
samplerCubeArray irradianceCubemapAR, samplerCubeArray specularCubemapAR, int showAtten, int showContrib, int showSpec, int showDiff) samplerCubeArray irradianceCubemapAR, samplerCubeArray specularCubemapAR, int showAtten, int showContrib, int showSpec, int showDiff)
{ {
int i = 0; int i = 0;
@ -601,19 +600,19 @@ vec4 debugVizForwardProbes(Surface surface,
float contrib = contribution[i]; float contrib = contribution[i];
if (contrib > 0.0f) if (contrib > 0.0f)
{ {
int cubemapIdx = probeConfigData[i].a; float cubemapIdx = probeConfigData[i].a;
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz); vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz);
irradiance += textureLod(irradianceCubemapAR, dir, cubemapIdx, 0).xyz * contrib; irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
specular += textureLod(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib; specular += textureLod(specularCubemapAR, vec4(dir, cubemapIdx), lod).xyz * contrib;
alpha -= contrib; alpha -= contrib;
} }
} }
if(skylightCubemapIdx != -1 && alpha >= 0.001) if(skylightCubemapIdx != -1 && alpha >= 0.001)
{ {
irradiance = mix(irradiance,textureLod(irradianceCubemapAR, surface.R, skylightCubemapIdx, 0).xyz,alpha); irradiance = mix(irradiance,textureLod(irradianceCubemapAR, vec4(surface.R, skylightCubemapIdx), 0).xyz,alpha);
specular = mix(specular,textureLod(specularCubemapAR, surface.R, skylightCubemapIdx, lod).xyz,alpha); specular = mix(specular,textureLod(specularCubemapAR, vec4(surface.R, skylightCubemapIdx), lod).xyz,alpha);
} }
if(showSpec == 1) if(showSpec == 1)

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl" #include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h" #include "shadergen:/autogenConditioners.h"
#include "../../../postFx/gl/postFx.glsl" #include "../../../postFX/gl/postFx.glsl"
#include "../../../gl/torque.glsl" #include "../../../gl/torque.glsl"
uniform sampler2D colorBufferTex; uniform sampler2D colorBufferTex;

View file

@ -179,7 +179,7 @@ void main()
float contrib = contribution[i]; float contrib = contribution[i];
if (contrib > 0.0f) if (contrib > 0.0f)
{ {
int cubemapIdx = probeConfigData[i].a; float cubemapIdx = probeConfigData[i].a;
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz); vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz);
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib; irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
@ -191,8 +191,8 @@ void main()
if (skylightCubemapIdx != -1 && alpha > 0.001) if (skylightCubemapIdx != -1 && alpha > 0.001)
{ {
irradiance = lerp(irradiance,textureLod(irradianceCubemapAR, surface.R, skylightCubemapIdx, 0).xyz,alpha); irradiance = lerp(irradiance,textureLod(irradianceCubemapAR, vec4(surface.R, skylightCubemapIdx), 0).xyz,alpha);
specular = lerp(specular,textureLod(specularCubemapAR, surface.R, skylightCubemapIdx, lod).xyz,alpha); specular = lerp(specular,textureLod(specularCubemapAR, vec4(surface.R, skylightCubemapIdx), lod).xyz,alpha);
} }
#if DEBUGVIZ_SPECCUBEMAP == 1 && DEBUGVIZ_DIFFCUBEMAP == 0 #if DEBUGVIZ_SPECCUBEMAP == 1 && DEBUGVIZ_DIFFCUBEMAP == 0

View file

@ -1,4 +1,4 @@
#include "../../postFx/postFx.hlsl" #include "../../postFX/postFx.hlsl"
#include "../../shaderModel.hlsl" #include "../../shaderModel.hlsl"
#include "../../shaderModelAutoGen.hlsl" #include "../../shaderModelAutoGen.hlsl"
#include "../../lighting.hlsl" #include "../../lighting.hlsl"

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "../../postFx/postFx.hlsl" #include "../../postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0);

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "../../postFx/postFx.hlsl" #include "../../postFX/postFx.hlsl"
#include "../../torque.hlsl" #include "../../torque.hlsl"
float4 rtParams0; float4 rtParams0;