summaryrefslogtreecommitdiffstats
path: root/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx')
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx76
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx
new file mode 100644
index 000000000..7d839009d
--- /dev/null
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx
@@ -0,0 +1,76 @@
+//TEST_IGNORE_FILE: Currently failing due to Spire compiler issues.
+//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS -entry PSSolid
+//--------------------------------------------------------------------------------------
+// File: Tutorial06.fx
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------------------------
+// Constant Buffer Variables
+//--------------------------------------------------------------------------------------
+cbuffer ConstantBuffer : register( b0 )
+{
+ matrix World;
+ matrix View;
+ matrix Projection;
+ float4 vLightDir[2];
+ float4 vLightColor[2];
+ float4 vOutputColor;
+}
+
+
+//--------------------------------------------------------------------------------------
+struct VS_INPUT
+{
+ float4 Pos : POSITION;
+ float3 Norm : NORMAL;
+};
+
+struct PS_INPUT
+{
+ float4 Pos : SV_POSITION;
+ float3 Norm : TEXCOORD0;
+};
+
+
+//--------------------------------------------------------------------------------------
+// Vertex Shader
+//--------------------------------------------------------------------------------------
+PS_INPUT VS( VS_INPUT input )
+{
+ PS_INPUT output = (PS_INPUT)0;
+ output.Pos = mul( input.Pos, World );
+ output.Pos = mul( output.Pos, View );
+ output.Pos = mul( output.Pos, Projection );
+ output.Norm = mul( float4( input.Norm, 1 ), World ).xyz;
+
+ return output;
+}
+
+
+//--------------------------------------------------------------------------------------
+// Pixel Shader
+//--------------------------------------------------------------------------------------
+float4 PS( PS_INPUT input) : SV_Target
+{
+ float4 finalColor = 0;
+
+ //do NdotL lighting for 2 lights
+ for(int i=0; i<2; i++)
+ {
+ finalColor += saturate( dot( (float3)vLightDir[i],input.Norm) * vLightColor[i] );
+ }
+ finalColor.a = 1;
+ return finalColor;
+}
+
+
+//--------------------------------------------------------------------------------------
+// PSSolid - render a solid color
+//--------------------------------------------------------------------------------------
+float4 PSSolid( PS_INPUT input) : SV_Target
+{
+ return vOutputColor;
+}