Browse Source

materialsystem: fix(hack) flashlight. normalizedcubemap broken?

sanitize
nillerusr 3 years ago
parent
commit
ae8b73626e
  1. 12
      materialsystem/stdshaders/flashlight_ps2x.fxc
  2. 1113
      materialsystem/stdshaders/fxctmp9/vertexlit_and_unlit_generic_ps20b.inc
  3. 2
      materialsystem/stdshaders/vertexlit_and_unlit_generic_vs20.fxc
  4. 4
      materialsystem/texturemanager.cpp
  5. 21
      scripts/waifulib/compiler_optimizations.py

12
materialsystem/stdshaders/flashlight_ps2x.fxc

@ -201,22 +201,16 @@ float4 main( PS_INPUT i ) : COLOR @@ -201,22 +201,16 @@ float4 main( PS_INPUT i ) : COLOR
#if NORMALMAP == 0
float3 worldPosToLightVector = texCUBE( NormalizingCubemapSampler, i.worldPosToLightVector ) * 2.0f - 1.0f;
float nDotL = dot( worldPosToLightVector, vNormal.xyz );
float nDotL = 0.577350f;
#endif
#if NORMALMAP == 1
// flashlightfixme: wrap this!
float3 tangentPosToLightVector = texCUBE( NormalizingCubemapSampler, i.tangentPosToLightVector ) * 2.0f - 1.0f;
float nDotL = dot( tangentPosToLightVector, vNormal.xyz );
float nDotL = 0.577350f;
#endif
#if NORMALMAP == 2
float3 tangentPosToLightVector = normalize( i.tangentPosToLightVector );
float nDotL =
vNormal.x*dot( tangentPosToLightVector, bumpBasis[0]) +
vNormal.y*dot( tangentPosToLightVector, bumpBasis[1]) +
vNormal.z*dot( tangentPosToLightVector, bumpBasis[2]);
float nDotL = 0.577350f;
#endif
float3 outColor;

1113
materialsystem/stdshaders/fxctmp9/vertexlit_and_unlit_generic_ps20b.inc

File diff suppressed because it is too large Load Diff

2
materialsystem/stdshaders/vertexlit_and_unlit_generic_vs20.fxc

@ -102,9 +102,7 @@ struct VS_OUTPUT @@ -102,9 +102,7 @@ struct VS_OUTPUT
#endif
float4 color : TEXCOORD2; // Vertex color (from lighting or unlit)
#if CUBEMAP || _X360
float3 worldVertToEyeVector : TEXCOORD3; // Necessary for cubemaps
#endif
float3 worldSpaceNormal : TEXCOORD4; // Necessary for cubemaps and flashlight

4
materialsystem/texturemanager.cpp

@ -246,9 +246,13 @@ static void CreateSolidTexture( ITextureInternal *pTexture, color32 color ) @@ -246,9 +246,13 @@ static void CreateSolidTexture( ITextureInternal *pTexture, color32 color )
//-----------------------------------------------------------------------------
// Creates a normalization cubemap texture
//-----------------------------------------------------------------------------
class CNormalizationCubemap : public ITextureRegenerator
{
public:
// TODO(nillerusr): broken here with togl /= (maybe here)
virtual void RegenerateTextureBits( ITexture *pTexture, IVTFTexture *pVTFTexture, Rect_t *pSubRect )
{
// Normalization cubemap doesn't make sense on low-end hardware

21
scripts/waifulib/compiler_optimizations.py

@ -48,16 +48,13 @@ CFLAGS = { @@ -48,16 +48,13 @@ CFLAGS = {
'common': {
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP
'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-', '/MT'],
'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden'],
'gcc': ['-g0', '-fvisibility=hidden'],
'owcc': ['-fno-short-enum', '-ffloat-store', '-g3']
'clang': ['-g0', '-fno-strict-aliasing', '-gdwarf-2', '-fvisibility=hidden'],
'gcc': ['-g0', '-fno-strict-aliasing', '-fvisibility=hidden'],
'owcc': ['-fno-short-enum', '-ffloat-store', '-g0']
},
'fast': {
'msvc': ['/O2', '/Oy'],
'gcc': {
'3': ['-O3', '-fomit-frame-pointer'],
'default': ['-Ofast', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer']
},
'msvc': ['/O2', '/Oy'],
'gcc': ['-Ofast'],
'clang': ['-Ofast'],
'default': ['-O3']
},
@ -69,13 +66,13 @@ CFLAGS = { @@ -69,13 +66,13 @@ CFLAGS = {
},
'release': {
'msvc': ['/O2'],
'owcc': ['-O3', '-foptimize-sibling-calls', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-fschedule-insns', '-funsafe-math-optimizations', '-funroll-loops', '-frerun-optimizer', '-finline-functions', '-finline-limit=512', '-fguess-branch-probability', '-fno-strict-aliasing', '-floop-optimize'],
'default': ['-O3']
'owcc': ['-O3', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-finline-functions', '-finline-limit=512'],
'default': ['-O2', '-funsafe-math-optimizations', '-ftree-vectorize']
},
'debug': {
'msvc': ['/Od'],
'owcc': ['-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'],
'default': ['-O3'] #, '-ftree-vectorize']
'owcc': ['-g', '-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'],
'default': ['-g', '-O0'] #, '-ftree-vectorize', '-ffast-math', '-fno-tree-partial-pre']
},
'sanitize': {
'msvc': ['/Od', '/RTC1'],

Loading…
Cancel
Save