aboutsummaryrefslogtreecommitdiff
path: root/mp/src/materialsystem/stdshaders/DebugTextureView_ps2x.fxc
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-12-23 14:58:45 -0800
committerJoe Ludwig <[email protected]>2013-12-23 15:00:03 -0800
commit7309a5f13f63fdcc7b1e090f6c176113a9d95061 (patch)
treead65c7fbe46a3c70bdc0a1426e88247ce1b0d7f5 /mp/src/materialsystem/stdshaders/DebugTextureView_ps2x.fxc
parentMerge pull request #182 from ardneran/master (diff)
downloadsource-sdk-2013-7309a5f13f63fdcc7b1e090f6c176113a9d95061.tar.xz
source-sdk-2013-7309a5f13f63fdcc7b1e090f6c176113a9d95061.zip
Added many shader source files
This should include the latest version of every shader that was in the 2007 SDK. It also includes a smattering of debug shaders, both VR distortion shaders, and other assorted shaders that will hopefully be useful. None of these new files are included in the game shader DLL project. If you need to modify one of these shaders for use in your mod you will need to rename it so that you don't collide with the version of that shader that lives in stdshader_dx9.dll.
Diffstat (limited to 'mp/src/materialsystem/stdshaders/DebugTextureView_ps2x.fxc')
-rw-r--r--mp/src/materialsystem/stdshaders/DebugTextureView_ps2x.fxc81
1 files changed, 81 insertions, 0 deletions
diff --git a/mp/src/materialsystem/stdshaders/DebugTextureView_ps2x.fxc b/mp/src/materialsystem/stdshaders/DebugTextureView_ps2x.fxc
new file mode 100644
index 00000000..4b22d55b
--- /dev/null
+++ b/mp/src/materialsystem/stdshaders/DebugTextureView_ps2x.fxc
@@ -0,0 +1,81 @@
+// STATIC: "CONVERT_TO_SRGB" "0..1" [ps20b][= g_pHardwareConfig->NeedsShaderSRGBConversion()] [PC]
+// STATIC: "CONVERT_TO_SRGB" "0..0" [= 0] [XBOX]
+// STATIC: "SHOWALPHA" "0..1"
+// DYNAMIC: "ISCUBEMAP" "0..1"
+
+#define HDRTYPE HDR_TYPE_NONE
+#include "common_ps_fxc.h"
+
+sampler g_tSampler : register( s0 );
+
+struct PS_INPUT
+{
+ float2 texCoord : TEXCOORD0;
+};
+
+const float3 g_vConst0 : register( c0 );
+#define g_flIsHdrCube g_vConst0.x
+#define g_flIsHdr2D g_vConst0.y
+
+float4 main( PS_INPUT i ) : COLOR
+{
+ float4 sample = tex2D( g_tSampler, i.texCoord );
+ float4 result = { 0.0f, 0.0f, 0.0f, 1.0f };
+
+ result.rgb = sample.rgb;
+ #if SHOWALPHA
+ result.rgb = sample.a;
+ #endif
+
+ if ( g_flIsHdr2D )
+ result.rgb *= MAX_HDR_OVERBRIGHT;
+
+ #if ISCUBEMAP
+ bool bNoDataForThisPixel = false;
+ float3 vec = float3( 0, 0, 0 );
+ float x = i.texCoord.x;
+ float y = i.texCoord.y;
+ float x2 = frac( ( i.texCoord.x ) * 3.0f ) * 2.0f - 1.0f;
+ float y2 = frac( ( i.texCoord.y ) * 4.0f ) * 2.0f - 1.0f;
+ if ( ( x >= 0.3333f ) && ( x <= 0.6666f ) ) //Center row
+ {
+ if ( y >= 0.75f )
+ vec = float3( x2, 1.0, y2 );
+ else if ( y >= 0.5f )
+ vec = float3( x2, y2, -1.0 );
+ else if ( y >= 0.25f )
+ vec = float3( x2, -1.0, -y2 );
+ else if ( y >= 0.0f )
+ vec = float3( x2, -y2, 1.0 );
+ }
+ else if ( ( y >= 0.25f ) && ( y <= 0.5f ) )
+ {
+ if ( x <= 0.3333f )
+ vec = float3( -1.0f, -x2, -y2 );
+ else if (x >= 0.6666f)
+ vec = float3( 1.0f, x2, -y2 );
+ else
+ bNoDataForThisPixel = true;
+ }
+ else
+ {
+ bNoDataForThisPixel = true;
+ }
+
+ float4 cBase = texCUBE( g_tSampler, vec );
+ #if SHOWALPHA
+ cBase.rgb = cBase.a;
+ #endif
+
+ if ( g_flIsHdrCube )
+ cBase.rgb *= ENV_MAP_SCALE;
+
+ if ( bNoDataForThisPixel == true )
+ cBase.rgb = float3( 0.9f, 0.4f, 0.15f );
+
+ result.rgb = cBase.rgb;
+ result.a = 1.0f; // - bNoDataForThisPixel;
+ #endif
+
+ return FinalOutput( result, 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE );
+}