mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:44:56 +00:00
Graphics debug groups and bug fixes
This commit is contained in:
@@ -309,7 +309,13 @@ vec4 PostFunc(vec4 colorIn) {
|
||||
#endif
|
||||
|
||||
#if defined(URDE_LIGHTING_CUBE_REFLECTION) || defined(URDE_LIGHTING_CUBE_REFLECTION_SHADOW)
|
||||
vec3 ReflectionFunc(float roughness) { return texture(reflectionTex, reflect(vtf.mvPos.xyz, vtf.mvNorm.xyz), roughness).rgb; }
|
||||
vec3 ReflectionFunc(float roughness) {
|
||||
vec3 coords = reflect(vtf.mvPos.xyz, vtf.mvNorm.xyz);
|
||||
#ifdef VULKAN
|
||||
coords = vec3(coords.x, -coords.y, coords.z);
|
||||
#endif
|
||||
return texture(reflectionTex, coords, roughness).rgb;
|
||||
}
|
||||
#elif defined(URDE_REFLECTION_SIMPLE)
|
||||
vec3 ReflectionFunc() { return texture(reflectionTex, vtf.dynReflectionUvs[1]).rgb * vtf.dynReflectionAlpha; }
|
||||
#elif defined(URDE_REFLECTION_INDIRECT)
|
||||
|
||||
@@ -308,7 +308,8 @@ float4 PostFunc(in VertToFrag vtf, float4 colorIn) {
|
||||
|
||||
#if defined(URDE_LIGHTING_CUBE_REFLECTION) || defined(URDE_LIGHTING_CUBE_REFLECTION_SHADOW)
|
||||
float3 ReflectionFunc(in VertToFrag vtf, float roughness) {
|
||||
return reflectionTex.SampleBias(reflectSamp, reflect(vtf.mvPos.xyz, vtf.mvNorm.xyz), roughness).rgb;
|
||||
float3 coords = reflect(vtf.mvPos.xyz, vtf.mvNorm.xyz);
|
||||
return reflectionTex.SampleBias(reflectSamp, float3(coords.x, -coords.y, coords.z), roughness).rgb;
|
||||
}
|
||||
#elif defined(URDE_REFLECTION_SIMPLE)
|
||||
float3 ReflectionFunc(in VertToFrag vtf)
|
||||
|
||||
@@ -303,7 +303,7 @@ float4 PostFunc(thread VertToFrag& vtf, constant LightingUniform& lu,
|
||||
|
||||
#if defined(URDE_LIGHTING_CUBE_REFLECTION) || defined(URDE_LIGHTING_CUBE_REFLECTION_SHADOW)
|
||||
#define ReflectionFunc(roughness) \
|
||||
(reflectionTex.sample(reflectSamp, reflect(vtf.mvPos.xyz, vtf.mvNorm.xyz), bias(roughness)).rgb)
|
||||
(reflectionTex.sample(reflectSamp, float3(reflectionCoords.x, -reflectionCoords.y, reflectionCoords.z), bias(roughness)).rgb)
|
||||
#elif defined(URDE_REFLECTION_SIMPLE)
|
||||
#define ReflectionFunc() \
|
||||
(reflectionTex.sample(reflectSamp, vtf.dynReflectionUvs1).rgb * vtf.dynReflectionAlpha)
|
||||
@@ -342,6 +342,7 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
|
||||
float3 lighting = LightingFunc(vtf, lu, extTex0, clampSamp);
|
||||
float4 tmp;
|
||||
#if defined(URDE_LIGHTING_CUBE_REFLECTION) || defined(URDE_LIGHTING_CUBE_REFLECTION_SHADOW)
|
||||
float3 reflectionCoords = reflect(vtf.mvPos.xyz, vtf.mvNorm.xyz);
|
||||
tmp.rgb = (SampleTexture_lightmap() * colorReg1.rgb + lighting) * SampleTexture_diffuse() +
|
||||
SampleTexture_emissive() + (SampleTexture_specular() + SampleTexture_extendedSpecular() * lighting) *
|
||||
(SampleTexture_reflection() * ReflectionFunc(saturate(0.5 - SampleTextureAlpha_specular())) * 2.0);
|
||||
|
||||
@@ -166,7 +166,7 @@ static const char* TessES =
|
||||
"SBINDING(0) patch in vec4 minMaxPos;\n"
|
||||
"SBINDING(0) out VertToFrag vtf;\n"
|
||||
"\n"
|
||||
"TBINDING##RIPPLE_TEXTURE_IDX uniform sampler2D RippleMap;\n"
|
||||
"RIPPLE_TEXTURE_BINDING uniform sampler2D RippleMap;\n"
|
||||
"\n"
|
||||
"const float PI_X2 = 6.283185307179586;\n"
|
||||
"\n"
|
||||
@@ -600,6 +600,7 @@ static void _BuildAdditionalTCGs(std::stringstream& out, const SFluidPlaneShader
|
||||
int nextTCG = 3;
|
||||
int nextMtx = 4;
|
||||
|
||||
out << "#define ADDITIONAL_TCGS ";
|
||||
if (info.m_hasBumpMap)
|
||||
fmt::print(out, fmt("vtf.uvs[{}] = (texMtxs[0] * pos).xy;"), nextTCG++);
|
||||
if (info.m_hasEnvBumpMap)
|
||||
@@ -687,7 +688,7 @@ static std::string BuildES(const SFluidPlaneShaderInfo& info) {
|
||||
|
||||
std::stringstream out;
|
||||
_BuildAdditionalTCGs(out, info);
|
||||
out << "#define RIPPLE_TEXTURE_IDX " << nextTex << '\n';
|
||||
out << "#define RIPPLE_TEXTURE_BINDING TBINDING" << nextTex << '\n';
|
||||
out << TessES;
|
||||
return out.str();
|
||||
}
|
||||
@@ -718,7 +719,7 @@ static std::string _BuildFS(const SFluidPlaneDoorShaderInfo& info) {
|
||||
int nextTex = 0;
|
||||
std::stringstream out;
|
||||
|
||||
out << "#define TEXTURE_PARAMS ";
|
||||
out << "#define TEXTURE_DECLS ";
|
||||
if (info.m_hasPatternTex1)
|
||||
fmt::print(out, fmt("TBINDING{} uniform sampler2D patternTex1;"), nextTex++);
|
||||
if (info.m_hasPatternTex2)
|
||||
|
||||
@@ -197,7 +197,7 @@ static const char* TessES =
|
||||
"struct ControlPoint\n"
|
||||
"{};\n"
|
||||
"\n"
|
||||
"Texture2D RippleMap : register(t##RIPPLE_TEXTURE_IDX);\n"
|
||||
"Texture2D RippleMap : register(RIPPLE_TEXTURE_REG);\n"
|
||||
"SamplerState samp : register(s2);\n"
|
||||
"\n"
|
||||
"static const float PI_X2 = 6.283185307179586;\n"
|
||||
@@ -703,7 +703,7 @@ static std::string BuildES(const SFluidPlaneShaderInfo& info) {
|
||||
|
||||
std::stringstream out;
|
||||
_BuildAdditionalTCGs(out, info);
|
||||
out << "#define RIPPLE_TEXTURE_IDX " << nextTex << '\n';
|
||||
out << "#define RIPPLE_TEXTURE_REG t" << nextTex << '\n';
|
||||
out << TessES;
|
||||
return out.str();
|
||||
}
|
||||
@@ -724,7 +724,7 @@ static std::string _BuildFS(const SFluidPlaneDoorShaderInfo& info) {
|
||||
int nextTex = 0;
|
||||
std::stringstream out;
|
||||
|
||||
out << "#define TEXTURE_PARAMS ";
|
||||
out << "#define TEXTURE_DECLS ";
|
||||
if (info.m_hasPatternTex1)
|
||||
fmt::print(out, fmt("Texture2D patternTex1 : register(t{});"), nextTex++);
|
||||
if (info.m_hasPatternTex2)
|
||||
|
||||
Reference in New Issue
Block a user