summaryrefslogtreecommitdiffstats
path: root/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-09 11:34:21 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-09 13:44:59 -0700
commitfcf83dbf9effab3bd98bad2b83b2468b7eb05cfd (patch)
tree41047c94883b86ec085a81597391ce3ef557cd43 /tests/hlsl/dxsdk/Direct3D11TutorialsDXUT
parent52e8d4b9a27ab0060f874c3a63ab531847be35c0 (diff)
Initial import of code.
Diffstat (limited to 'tests/hlsl/dxsdk/Direct3D11TutorialsDXUT')
-rw-r--r--tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial08/Tutorial08.fx56
-rw-r--r--tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial09/Tutorial09.fx69
-rw-r--r--tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial10/Tutorial10.fx73
3 files changed, 198 insertions, 0 deletions
diff --git a/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial08/Tutorial08.fx b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial08/Tutorial08.fx
new file mode 100644
index 000000000..6ff313b97
--- /dev/null
+++ b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial08/Tutorial08.fx
@@ -0,0 +1,56 @@
+//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
+//--------------------------------------------------------------------------------------
+// File: Tutorial08.fx
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// Constant Buffer Variables
+//--------------------------------------------------------------------------------------
+Texture2D txDiffuse : register( t0 );
+SamplerState samLinear : register( s0 );
+
+cbuffer cbChangesEveryFrame : register( b0 )
+{
+ matrix WorldViewProj;
+ matrix World;
+ float4 vMeshColor;
+};
+
+
+//--------------------------------------------------------------------------------------
+struct VS_INPUT
+{
+ float4 Pos : POSITION;
+ float2 Tex : TEXCOORD;
+};
+
+struct PS_INPUT
+{
+ float4 Pos : SV_POSITION;
+ float2 Tex : TEXCOORD0;
+};
+
+
+//--------------------------------------------------------------------------------------
+// Vertex Shader
+//--------------------------------------------------------------------------------------
+PS_INPUT VS( VS_INPUT input )
+{
+ PS_INPUT output = (PS_INPUT)0;
+ output.Pos = mul( input.Pos, WorldViewProj );
+ output.Tex = input.Tex;
+
+ return output;
+}
+
+
+//--------------------------------------------------------------------------------------
+// Pixel Shader
+//--------------------------------------------------------------------------------------
+float4 PS( PS_INPUT input) : SV_Target
+{
+ return txDiffuse.Sample( samLinear, input.Tex ) * vMeshColor;
+}
diff --git a/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial09/Tutorial09.fx b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial09/Tutorial09.fx
new file mode 100644
index 000000000..04a395588
--- /dev/null
+++ b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial09/Tutorial09.fx
@@ -0,0 +1,69 @@
+//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
+//--------------------------------------------------------------------------------------
+// File: Tutorial09.fx
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// Constant Buffer Variables
+//--------------------------------------------------------------------------------------
+Texture2D txDiffuse : register( t0 );
+SamplerState samLinear : register( s0 );
+
+cbuffer cbNeverChanges : register( b0 )
+{
+ float3 vLightDir;
+};
+
+cbuffer cbChangesEveryFrame : register( b1 )
+{
+ matrix WorldViewProj;
+ matrix World;
+};
+
+struct VS_INPUT
+{
+ float3 Pos : POSITION; //position
+ float3 Norm : NORMAL; //normal
+ float2 Tex : TEXCOORD0; //texture coordinate
+};
+
+struct PS_INPUT
+{
+ float4 Pos : SV_POSITION;
+ float4 Diffuse : COLOR0;
+ float2 Tex : TEXCOORD1;
+};
+
+
+//--------------------------------------------------------------------------------------
+// Vertex Shader
+//--------------------------------------------------------------------------------------
+PS_INPUT VS( VS_INPUT input )
+{
+ PS_INPUT output = (PS_INPUT)0;
+ output.Pos = mul( float4(input.Pos,1), WorldViewProj );
+ float3 vNormalWorldSpace = normalize( mul( input.Norm, (float3x3)World ) );
+
+ float fLighting = saturate( dot( vNormalWorldSpace, vLightDir ) );
+ output.Diffuse.rgb = fLighting;
+ output.Diffuse.a = 1.0f;
+
+ output.Tex = input.Tex;
+
+ return output;
+}
+
+
+//--------------------------------------------------------------------------------------
+// Pixel Shader
+//--------------------------------------------------------------------------------------
+float4 PS( PS_INPUT input) : SV_Target
+{
+ //calculate lighting assuming light color is <1,1,1,1>
+ float4 outputColor = txDiffuse.Sample( samLinear, input.Tex ) * input.Diffuse;
+ outputColor.a = 1;
+ return outputColor;
+}
diff --git a/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial10/Tutorial10.fx b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial10/Tutorial10.fx
new file mode 100644
index 000000000..e9bded408
--- /dev/null
+++ b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial10/Tutorial10.fx
@@ -0,0 +1,73 @@
+//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
+//--------------------------------------------------------------------------------------
+// File: Tutorial10.fx
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// Constant Buffer Variables
+//--------------------------------------------------------------------------------------
+Texture2D txDiffuse : register( t0 );
+SamplerState samLinear : register( s0 );
+
+cbuffer cbNeverChanges : register( b0 )
+{
+ float3 vLightDir;
+};
+
+cbuffer cbChangesEveryFrame : register( b1 )
+{
+ matrix WorldViewProj;
+ matrix World;
+ float Puffiness;
+};
+
+struct VS_INPUT
+{
+ float3 Pos : POSITION; //position
+ float3 Norm : NORMAL; //normal
+ float2 Tex : TEXCOORD0; //texture coordinate
+};
+
+struct PS_INPUT
+{
+ float4 Pos : SV_POSITION;
+ float4 Diffuse : COLOR0;
+ float2 Tex : TEXCOORD1;
+};
+
+
+//--------------------------------------------------------------------------------------
+// Vertex Shader
+//--------------------------------------------------------------------------------------
+PS_INPUT VS( VS_INPUT input )
+{
+ PS_INPUT output = (PS_INPUT)0;
+
+ input.Pos += input.Norm * Puffiness;
+
+ output.Pos = mul( float4(input.Pos,1), WorldViewProj );
+ float3 vNormalWorldSpace = normalize( mul( input.Norm, (float3x3)World ) );
+
+ float fLighting = saturate( dot( vNormalWorldSpace, vLightDir ) );
+ output.Diffuse.rgb = fLighting;
+ output.Diffuse.a = 1.0f;
+
+ output.Tex = input.Tex;
+
+ return output;
+}
+
+
+//--------------------------------------------------------------------------------------
+// Pixel Shader
+//--------------------------------------------------------------------------------------
+float4 PS( PS_INPUT input) : SV_Target
+{
+ //calculate lighting assuming light color is <1,1,1,1>
+ float4 outputColor = txDiffuse.Sample( samLinear, input.Tex ) * input.Diffuse;
+ outputColor.a = 1;
+ return outputColor;
+}