aboutsummaryrefslogtreecommitdiff
path: root/samples/DX_APIUsage/BasicHLSL11_PS.hlsl
diff options
context:
space:
mode:
authorDave Clark <[email protected]>2018-02-28 17:22:22 -0500
committerDave Clark <[email protected]>2018-02-28 17:22:22 -0500
commit25528fd230f5f4298c35123a833cdb112675808e (patch)
treef5aca3f5ee5a7734df41e7b974a04c37ddff528e /samples/DX_APIUsage/BasicHLSL11_PS.hlsl
parentPush GfeSDK #173 (diff)
downloadgfesdk-25528fd230f5f4298c35123a833cdb112675808e.tar.xz
gfesdk-25528fd230f5f4298c35123a833cdb112675808e.zip
Push SDK # 1.1.186
Documentation updates.
Diffstat (limited to 'samples/DX_APIUsage/BasicHLSL11_PS.hlsl')
-rw-r--r--samples/DX_APIUsage/BasicHLSL11_PS.hlsl50
1 files changed, 50 insertions, 0 deletions
diff --git a/samples/DX_APIUsage/BasicHLSL11_PS.hlsl b/samples/DX_APIUsage/BasicHLSL11_PS.hlsl
new file mode 100644
index 0000000..4c3fa6b
--- /dev/null
+++ b/samples/DX_APIUsage/BasicHLSL11_PS.hlsl
@@ -0,0 +1,50 @@
+//--------------------------------------------------------------------------------------
+// File: BasicHLSL11_PS.hlsl
+//
+// The pixel shader file for the BasicHLSL11 sample.
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// Globals
+//--------------------------------------------------------------------------------------
+cbuffer cbPerObject : register( b0 )
+{
+ float4 g_vObjectColor : packoffset( c0 );
+};
+
+cbuffer cbPerFrame : register( b1 )
+{
+ float3 g_vLightDir : packoffset( c0 );
+ float g_fAmbient : packoffset( c0.w );
+};
+
+//--------------------------------------------------------------------------------------
+// Textures and Samplers
+//--------------------------------------------------------------------------------------
+Texture2D g_txDiffuse : register( t0 );
+SamplerState g_samLinear : register( s0 );
+
+//--------------------------------------------------------------------------------------
+// Input / Output structures
+//--------------------------------------------------------------------------------------
+struct PS_INPUT
+{
+ float3 vNormal : NORMAL;
+ float2 vTexcoord : TEXCOORD0;
+};
+
+//--------------------------------------------------------------------------------------
+// Pixel Shader
+//--------------------------------------------------------------------------------------
+float4 PSMain( PS_INPUT Input ) : SV_TARGET
+{
+ float4 vDiffuse = g_txDiffuse.Sample( g_samLinear, Input.vTexcoord );
+
+ float fLighting = saturate( dot( g_vLightDir, Input.vNormal ) );
+ fLighting = max( fLighting, g_fAmbient );
+
+ return vDiffuse * fLighting;
+}
+