-
Notifications
You must be signed in to change notification settings - Fork 175
fix: X4500 overlapping registers for FACEGEN + TRUE_PBR #2030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -404,8 +404,10 @@ SamplerState SampEnvSampler : register(s4); | |
| SamplerState SampEnvMaskSampler : register(s5); | ||
| # endif | ||
|
|
||
| # if defined(TRUE_PBR) | ||
| # if defined(TRUE_PBR) && !defined(FACEGEN) | ||
| SamplerState SampParallaxSampler : register(s4); | ||
| # endif | ||
| # if defined(TRUE_PBR) | ||
| SamplerState SampRMAOSSampler : register(s5); | ||
| # endif | ||
|
|
||
|
|
@@ -503,8 +505,10 @@ TextureCube<float4> TexEnvSampler : register(t4); | |
| Texture2D<float4> TexEnvMaskSampler : register(t5); | ||
| # endif | ||
|
|
||
| # if defined(TRUE_PBR) | ||
| # if defined(TRUE_PBR) && !defined(FACEGEN) | ||
| Texture2D<float4> TexParallaxSampler : register(t4); | ||
| # endif | ||
| # if defined(TRUE_PBR) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question about elseif
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reasoning as the sampler block above — |
||
| Texture2D<float4> TexRMAOSSampler : register(t5); | ||
| # endif | ||
|
|
||
|
|
@@ -1110,6 +1114,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) | |
| sampledCoatColor.rgb *= Color::Diffuse(sampledCoatProperties.rgb); | ||
| sampledCoatColor.a *= sampledCoatProperties.a; | ||
| } | ||
| # if !defined(FACEGEN) | ||
| [branch] if (SharedData::extendedMaterialSettings.EnableParallax && (PBRFlags & PBR::Flags::HasDisplacement) != 0) | ||
| { | ||
| PBRParallax = true; | ||
|
|
@@ -1140,7 +1145,8 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) | |
| if (SharedData::extendedMaterialSettings.EnableShadows && (parallaxShadowQuality > 0.0f || SharedData::extendedMaterialSettings.ExtendShadows)) | ||
| sh0 = TexParallaxSampler.SampleLevel(SampParallaxSampler, uv, mipLevel).x; | ||
| } | ||
| # endif // TRUE_PBR | ||
| # endif // !FACEGEN | ||
| # endif // TRUE_PBR | ||
|
|
||
| # endif // EMAT | ||
|
|
||
|
|
@@ -2470,7 +2476,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) | |
| # elif defined(EMAT_ENVMAP) | ||
| [branch] if (complexMaterialParallax) | ||
| dirDetailedShadow *= ExtendedMaterials::GetParallaxSoftShadowMultiplier(uv, mipLevel, dirLightDirectionTS, sh0, TexEnvMaskSampler, SampEnvMaskSampler, 3, lerp(parallaxShadowQuality, 1.0, SharedData::extendedMaterialSettings.ExtendShadows), screenNoise, displacementParams); | ||
| # elif defined(TRUE_PBR) && !defined(LODLANDSCAPE) | ||
| # elif defined(TRUE_PBR) && !defined(LODLANDSCAPE) && !defined(FACEGEN) | ||
| [branch] if (PBRParallax) | ||
| dirDetailedShadow *= ExtendedMaterials::GetParallaxSoftShadowMultiplier(uv, mipLevel, dirLightDirectionTS, sh0, TexParallaxSampler, SampParallaxSampler, 0, lerp(parallaxShadowQuality, 1.0, SharedData::extendedMaterialSettings.ExtendShadows), screenNoise, displacementParams); | ||
| # endif // LANDSCAPE | ||
|
|
@@ -2672,7 +2678,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace : SV_IsFrontFace) | |
| # elif defined(EMAT_ENVMAP) | ||
| [branch] if (complexMaterialParallax) | ||
| parallaxShadow = ExtendedMaterials::GetParallaxSoftShadowMultiplier(uv, mipLevel, lightDirectionTS, sh0, TexEnvMaskSampler, SampEnvMaskSampler, 3, parallaxShadowQuality, screenNoise, displacementParams); | ||
| # elif defined(TRUE_PBR) && !defined(LODLANDSCAPE) | ||
| # elif defined(TRUE_PBR) && !defined(LODLANDSCAPE) && !defined(FACEGEN) | ||
| [branch] if (PBRParallax) | ||
| parallaxShadow = ExtendedMaterials::GetParallaxSoftShadowMultiplier(uv, mipLevel, lightDirectionTS, sh0, TexParallaxSampler, SampParallaxSampler, 0, parallaxShadowQuality, screenNoise, displacementParams); | ||
| # endif | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot shouldn't this be an elseif?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No — using
#elifhere would be incorrect. WhenTRUE_PBR && !FACEGEN, we need bothSampParallaxSamplerandSampRMAOSSamplerdeclared. If the second block were#elif defined(TRUE_PBR)instead of a fresh#if,SampRMAOSSamplerwould only be declared in theTRUE_PBR + FACEGENcase, not in the normalTRUE_PBR(non-FACEGEN) case — breaking the RMAOS sample at line 1794 (rawRMAOS = TexRMAOSSampler.SampleBias(SampRMAOSSampler, ...)) which has noFACEGENguard of its own. The two separate#ifblocks are necessary.