Browse Source

materialsystem: fix(hack) flashlight. normalizedcubemap broken?

sanitize
nillerusr 2 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
#if NORMALMAP == 0 #if NORMALMAP == 0
float3 worldPosToLightVector = texCUBE( NormalizingCubemapSampler, i.worldPosToLightVector ) * 2.0f - 1.0f; float3 worldPosToLightVector = texCUBE( NormalizingCubemapSampler, i.worldPosToLightVector ) * 2.0f - 1.0f;
float nDotL = dot( worldPosToLightVector, vNormal.xyz ); float nDotL = 0.577350f;
#endif #endif
#if NORMALMAP == 1 #if NORMALMAP == 1
// flashlightfixme: wrap this! // flashlightfixme: wrap this!
float3 tangentPosToLightVector = texCUBE( NormalizingCubemapSampler, i.tangentPosToLightVector ) * 2.0f - 1.0f; float nDotL = 0.577350f;
float nDotL = dot( tangentPosToLightVector, vNormal.xyz );
#endif #endif
#if NORMALMAP == 2 #if NORMALMAP == 2
float3 tangentPosToLightVector = normalize( i.tangentPosToLightVector ); float nDotL = 0.577350f;
float nDotL =
vNormal.x*dot( tangentPosToLightVector, bumpBasis[0]) +
vNormal.y*dot( tangentPosToLightVector, bumpBasis[1]) +
vNormal.z*dot( tangentPosToLightVector, bumpBasis[2]);
#endif #endif
float3 outColor; 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
#endif #endif
float4 color : TEXCOORD2; // Vertex color (from lighting or unlit) float4 color : TEXCOORD2; // Vertex color (from lighting or unlit)
#if CUBEMAP || _X360
float3 worldVertToEyeVector : TEXCOORD3; // Necessary for cubemaps float3 worldVertToEyeVector : TEXCOORD3; // Necessary for cubemaps
#endif
float3 worldSpaceNormal : TEXCOORD4; // Necessary for cubemaps and flashlight float3 worldSpaceNormal : TEXCOORD4; // Necessary for cubemaps and flashlight

4
materialsystem/texturemanager.cpp

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

21
scripts/waifulib/compiler_optimizations.py

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

Loading…
Cancel
Save