summaryrefslogtreecommitdiff
path: root/tests/hlsl/dxsdk/DynamicShaderLinkageFX11
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/DynamicShaderLinkageFX11
parent52e8d4b9a27ab0060f874c3a63ab531847be35c0 (diff)
Initial import of code.
Diffstat (limited to 'tests/hlsl/dxsdk/DynamicShaderLinkageFX11')
-rw-r--r--tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11.fx192
-rw-r--r--tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_LightPSH.h82
-rw-r--r--tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_MaterialPSH.h103
-rw-r--r--tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_PSBuffers.h152
-rw-r--r--tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_ps.hlsl113
-rw-r--r--tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_vs.hlsl65
6 files changed, 707 insertions, 0 deletions
diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11.fx b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11.fx
new file mode 100644
index 000000000..c72b98843
--- /dev/null
+++ b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11.fx
@@ -0,0 +1,192 @@
+//TEST_IGNORE_FILE:
+//--------------------------------------------------------------------------------------
+// File: DynamicShaderLinkageFX11.fx
+//
+// The effect file for the DynamicShaderLinkageFX11 sample.
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+#include "DynamicShaderLinkageFX11_VS.hlsl"
+#include "DynamicShaderLinkageFX11_PS.hlsl"
+
+//
+// Settings for static permutations.
+// All of the pre-5.0 targets need static specialization
+// since they don't support late binding. The below
+// just selects a single specialization but you could
+// create any number of them, each one representing
+// a new shader with the interfaces compiled out
+// due to the compile-time class references.
+//
+
+#define StaticMaterial g_plasticTexturedMaterial
+#define StaticAmbientLight g_ambientLight
+#define StaticDirectLight g_directionalLight
+#define StaticEnvironmentLight g_environmentLight
+
+technique11 FeatureLevel10
+{
+ pass
+ {
+ SetRasterizerState(g_rasterizerState[g_fillMode]);
+ SetVertexShader(CompileShader(vs_4_0,
+ VSMain()));
+ SetPixelShader(CompileShader(ps_4_0,
+ PSMainUniform(StaticAmbientLight,
+ StaticDirectLight,
+ StaticEnvironmentLight,
+ StaticMaterial)));
+ }
+}
+
+technique11 FeatureLevel10_1
+{
+ pass
+ {
+ SetRasterizerState(g_rasterizerState[g_fillMode]);
+ SetVertexShader(CompileShader(vs_4_1,
+ VSMain()));
+ SetPixelShader(CompileShader(ps_4_1,
+ PSMainUniform(StaticAmbientLight,
+ StaticDirectLight,
+ StaticEnvironmentLight,
+ StaticMaterial)));
+ }
+}
+
+//
+// Variables for dynamic shader linkage.
+// There are two variations here for dynamic usage.
+// In the first we use the uniform entry point
+// and pass in global interface variables. This
+// creates a shader which refers to the global
+// interface variables when running and we can bind
+// concrete instances in our C++ code by using
+// ID3DX11EffectInterfaceVariable::SetClassInstance.
+// This approach works well when you have several
+// independent variations and want to bind them
+// individually in your C++ code, such as the
+// different lighting and material parameters in
+// this sample.
+//
+
+iBaseLight g_abstractAmbientLighting;
+iBaseLight g_abstractDirectLighting;
+iBaseLight g_abstractEnvironmentLighting;
+iBaseMaterial g_abstractMaterial;
+
+technique11 FeatureLevel11
+{
+ pass
+ {
+ SetRasterizerState(g_rasterizerState[g_fillMode]);
+ SetVertexShader(CompileShader(vs_5_0,
+ VSMain()));
+ SetPixelShader(CompileShader(ps_5_0,
+ PSMainUniform(g_abstractAmbientLighting,
+ g_abstractDirectLighting,
+ g_abstractEnvironmentLighting,
+ g_abstractMaterial)));
+ }
+}
+
+//
+// In this second variation we use the non-uniform
+// entry point so that we don't have to specify
+// any interfaces when compiling the shader. We
+// then reuse the compiled shader with different
+// BindInterfaces calls so that all bindings are
+// handled automatically by the effect runtime.
+// Below we have multiple techniques where
+// we've given a concrete binding for the material.
+// Lighting parameters are left as interfaces for
+// binding via effect variables, but could also
+// be specified concretely if the number of variations
+// is manageable.
+// This approach works well for a small number of variations
+// that are known in advance, as you can just list them
+// in your effect and you don't need to do the
+// binding work explicitly in your C++ code.
+//
+
+VertexShader g_NonUniVS = CompileShader(vs_5_0, VSMain());
+PixelShader g_NonUniPS = CompileShader(ps_5_0, PSMainNonUniform());
+
+technique11 FeatureLevel11_g_plasticMaterial
+{
+ pass
+ {
+ SetVertexShader(g_NonUniVS);
+ SetPixelShader(BindInterfaces(g_NonUniPS,
+ g_abstractAmbientLighting,
+ g_abstractDirectLighting,
+ g_abstractEnvironmentLighting,
+ g_plasticMaterial));
+ }
+}
+
+technique11 FeatureLevel11_g_plasticTexturedMaterial
+{
+ pass
+ {
+ SetVertexShader(g_NonUniVS);
+ SetPixelShader(BindInterfaces(g_NonUniPS,
+ g_abstractAmbientLighting,
+ g_abstractDirectLighting,
+ g_abstractEnvironmentLighting,
+ g_plasticTexturedMaterial));
+ }
+}
+
+technique11 FeatureLevel11_g_plasticLightingOnlyMaterial
+{
+ pass
+ {
+ SetVertexShader(g_NonUniVS);
+ SetPixelShader(BindInterfaces(g_NonUniPS,
+ g_abstractAmbientLighting,
+ g_abstractDirectLighting,
+ g_abstractEnvironmentLighting,
+ g_plasticLightingOnlyMaterial));
+ }
+}
+
+technique11 FeatureLevel11_g_roughMaterial
+{
+ pass
+ {
+ SetVertexShader(g_NonUniVS);
+ SetPixelShader(BindInterfaces(g_NonUniPS,
+ g_abstractAmbientLighting,
+ g_abstractDirectLighting,
+ g_abstractEnvironmentLighting,
+ g_roughMaterial));
+ }
+}
+
+technique11 FeatureLevel11_g_roughTexturedMaterial
+{
+ pass
+ {
+ SetVertexShader(g_NonUniVS);
+ SetPixelShader(BindInterfaces(g_NonUniPS,
+ g_abstractAmbientLighting,
+ g_abstractDirectLighting,
+ g_abstractEnvironmentLighting,
+ g_roughTexturedMaterial));
+ }
+}
+
+technique11 FeatureLevel11_g_roughLightingOnlyMaterial
+{
+ pass
+ {
+ SetVertexShader(g_NonUniVS);
+ SetPixelShader(BindInterfaces(g_NonUniPS,
+ g_abstractAmbientLighting,
+ g_abstractDirectLighting,
+ g_abstractEnvironmentLighting,
+ g_roughLightingOnlyMaterial));
+ }
+}
diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_LightPSH.h b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_LightPSH.h
new file mode 100644
index 000000000..6f9a0f4d8
--- /dev/null
+++ b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_LightPSH.h
@@ -0,0 +1,82 @@
+//--------------------------------------------------------------------------------------
+// File: DynamicShaderLinkageFX11_LightPSH.h
+//
+// The pixel shader light header file for the DynamicShaderLinkageFX11 sample.
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// Interfaces
+//--------------------------------------------------------------------------------------
+interface iBaseLight
+{
+ float3 IlluminateAmbient(float3 vNormal);
+
+ float3 IlluminateDiffuse(float3 vNormal);
+
+ float3 IlluminateSpecular(float3 vNormal, int specularPower );
+
+};
+
+//--------------------------------------------------------------------------------------
+// Classes
+//--------------------------------------------------------------------------------------
+class cAmbientLight : iBaseLight
+{
+ float3 m_vLightColor;
+ bool m_bEnable;
+
+ float3 IlluminateAmbient(float3 vNormal);
+
+ float3 IlluminateDiffuse(float3 vNormal)
+ {
+ return (float3)0;
+ }
+
+ float3 IlluminateSpecular(float3 vNormal, int specularPower )
+ {
+ return (float3)0;
+ }
+};
+
+class cHemiAmbientLight : cAmbientLight
+{
+ // inherited float4 m_vLightColor is the SkyColor
+ float4 m_vGroundColor;
+ float4 m_vDirUp;
+
+ float3 IlluminateAmbient(float3 vNormal);
+
+};
+
+class cDirectionalLight : cAmbientLight
+{
+ // inherited float4 m_vLightColor is the LightColor
+ float4 m_vLightDir;
+
+ float3 IlluminateDiffuse( float3 vNormal );
+
+ float3 IlluminateSpecular( float3 vNormal, int specularPower );
+
+};
+
+class cOmniLight : cAmbientLight
+{
+ float3 m_vLightPosition;
+ float radius;
+
+ float3 IlluminateDiffuse( float3 vNormal );
+
+};
+
+class cSpotLight : cAmbientLight
+{
+ float3 m_vLightPosition;
+ float3 m_vLightDir;
+};
+
+class cEnvironmentLight : cAmbientLight
+{
+ float3 IlluminateSpecular( float3 vNormal, int specularPower );
+};
diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_MaterialPSH.h b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_MaterialPSH.h
new file mode 100644
index 000000000..cd54a283d
--- /dev/null
+++ b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_MaterialPSH.h
@@ -0,0 +1,103 @@
+//--------------------------------------------------------------------------------------
+// File: DynamicShaderLinkageFX11_MaterialPSH.h
+//
+// The pixel shader material header file for the DynamicShaderLinkageFX11 sample.
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// Interfaces
+//--------------------------------------------------------------------------------------
+interface iBaseMaterial
+{
+ float3 GetAmbientColor(float2 vTexcoord);
+
+ float3 GetDiffuseColor(float2 vTexcoord);
+
+ int GetSpecularPower();
+
+};
+
+//--------------------------------------------------------------------------------------
+// Classes
+//--------------------------------------------------------------------------------------
+class cBaseMaterial : iBaseMaterial
+{
+ float3 m_vColor;
+ int m_iSpecPower;
+
+ float3 GetAmbientColor(float2 vTexcoord)
+ {
+ return m_vColor;
+ }
+
+ float3 GetDiffuseColor(float2 vTexcoord)
+ {
+ return (float3)m_vColor;
+ }
+
+ int GetSpecularPower()
+ {
+ return m_iSpecPower;
+ }
+
+};
+
+class cPlasticMaterial : cBaseMaterial
+{
+
+};
+
+class cPlasticTexturedMaterial : cPlasticMaterial
+{
+ float3 GetAmbientColor(float2 vTexcoord);
+
+ float3 GetDiffuseColor(float2 vTexcoord);
+
+};
+
+class cPlasticLightingOnlyMaterial : cBaseMaterial
+{
+ float3 GetAmbientColor(float2 vTexcoord)
+ {
+ return (float3)1.0f;
+ }
+
+ float3 GetDiffuseColor(float2 vTexcoord)
+ {
+ return (float3)1.0f;
+ }
+
+};
+
+class cRoughMaterial : cBaseMaterial
+{
+ int GetSpecularPower()
+ {
+ return m_iSpecPower;
+ }
+};
+
+class cRoughTexturedMaterial : cRoughMaterial
+{
+ float3 GetAmbientColor(float2 vTexcoord);
+
+ float3 GetDiffuseColor(float2 vTexcoord);
+
+};
+
+
+class cRoughLightingOnlyMaterial : cRoughMaterial
+{
+ float3 GetAmbientColor(float2 vTexcoord)
+ {
+ return (float3)1.0f;
+ }
+
+ float3 GetDiffuseColor(float2 vTexcoord)
+ {
+ return (float3)1.0f;
+ }
+
+};
diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_PSBuffers.h b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_PSBuffers.h
new file mode 100644
index 000000000..3b4c528be
--- /dev/null
+++ b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_PSBuffers.h
@@ -0,0 +1,152 @@
+//--------------------------------------------------------------------------------------
+// File: DynamicShaderLinkageFX11_LightPSH.hlsl
+//
+// The pixel shader light source module file for the DynamicShaderLinkageFX11 sample.
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+#include "DynamicShaderLinkageFX11_LightPSH.h"
+#include "DynamicShaderLinkageFX11_MaterialPSH.h"
+
+//--------------------------------------------------------------------------------------
+// Constant Buffers
+//--------------------------------------------------------------------------------------
+cbuffer cbPerFrame : register( b0 )
+{
+ cAmbientLight g_ambientLight;
+ cHemiAmbientLight g_hemiAmbientLight;
+ cDirectionalLight g_directionalLight;
+ cEnvironmentLight g_environmentLight;
+ float4 g_vEyeDir;
+};
+
+cbuffer cbPerPrimitive : register( b1 )
+{
+ cPlasticMaterial g_plasticMaterial;
+ cPlasticTexturedMaterial g_plasticTexturedMaterial;
+ cPlasticLightingOnlyMaterial g_plasticLightingOnlyMaterial;
+ cRoughMaterial g_roughMaterial;
+ cRoughTexturedMaterial g_roughTexturedMaterial;
+ cRoughLightingOnlyMaterial g_roughLightingOnlyMaterial;
+};
+
+//--------------------------------------------------------------------------------------
+// Textures and Samplers
+//--------------------------------------------------------------------------------------
+Texture2D g_txDiffuse : register( t0 );
+Texture2D g_txNormalMap : register( t1 );
+TextureCube g_txEnvironmentMap : register( t2 );
+
+SamplerState g_samLinear : register( s0 )
+{
+ Filter = MIN_MAG_MIP_LINEAR;
+ AddressU = WRAP;
+ AddressV = WRAP;
+ AddressW = WRAP;
+};
+
+//--------------------------------------------------------------------------------------
+// Rasterization State
+//--------------------------------------------------------------------------------------
+uint g_fillMode = 0;
+
+RasterizerState g_rasterizerState[2]
+{
+{
+ FillMode = SOLID;
+ MultisampleEnable = true;
+},
+{
+ FillMode = WIREFRAME;
+ MultisampleEnable = true;
+}
+};
+
+//--------------------------------------------------------------------------------------
+// Lighting Class Methods
+//--------------------------------------------------------------------------------------
+// Ambient Lighting Class Methods
+float3 cAmbientLight::IlluminateAmbient(float3 vNormal)
+{
+ return m_vLightColor * m_bEnable;
+}
+
+float3 cHemiAmbientLight::IlluminateAmbient(float3 vNormal)
+{
+ float thetha = (dot( vNormal, m_vDirUp.xyz ) + 1.0f) / 2.0f;
+
+ return lerp( m_vGroundColor.xyz, m_vLightColor, thetha) * m_bEnable;
+}
+
+// Directional Light class
+float3 cDirectionalLight::IlluminateDiffuse( float3 vNormal )
+{
+ float lambert = saturate(dot( vNormal, m_vLightDir.xyz ));
+ return ((float3)lambert * m_vLightColor * m_bEnable);
+}
+
+float3 cDirectionalLight::IlluminateSpecular( float3 vNormal, int specularPower )
+{
+ float3 H = -normalize(g_vEyeDir.xyz) + m_vLightDir.xyz;
+ float3 halfAngle = normalize( H );
+ float specular = pow( max(0,dot( halfAngle, normalize(vNormal) )), specularPower );
+
+ return ((float3)specular * m_vLightColor * m_bEnable);
+}
+
+// Omni Light Class
+float3 cOmniLight::IlluminateDiffuse( float3 vNormal )
+{
+ return (float3)0.0f; // TO DO!
+}
+
+// Environment Lighting
+float3 cEnvironmentLight::IlluminateSpecular( float3 vNormal, int specularPower )
+{
+ // compute reflection vector taking into account a cheap fresnel falloff;
+ float3 N = normalize(vNormal);
+ float3 E = normalize(g_vEyeDir.xyz);
+ float3 R = reflect( E, N );
+ float fresnel = 1 - dot( -E, N );
+ fresnel = (fresnel * fresnel * fresnel );
+
+ float3 specular = g_txEnvironmentMap.Sample( g_samLinear, R ).xyz * fresnel;
+
+ return (specular * (float3)m_bEnable);
+// return ((float3)fresnel);
+
+}
+
+//--------------------------------------------------------------------------------------
+// Material Class Methods
+//--------------------------------------------------------------------------------------
+// Plastic Material Methods
+float3 cPlasticTexturedMaterial::GetAmbientColor(float2 vTexcoord)
+{
+ float4 vDiffuse = (float4)1.0f;
+ vDiffuse = g_txDiffuse.Sample( g_samLinear, vTexcoord );
+ return m_vColor * vDiffuse.xyz;
+}
+
+float3 cPlasticTexturedMaterial::GetDiffuseColor(float2 vTexcoord)
+{
+ float4 vDiffuse = (float4)1.0f;
+ vDiffuse = g_txDiffuse.Sample( g_samLinear, vTexcoord );
+ return m_vColor * vDiffuse.xyz;
+}
+
+// Rough Material Methods
+float3 cRoughTexturedMaterial::GetAmbientColor(float2 vTexcoord)
+{
+ float4 vDiffuse = (float4)1.0f;
+ vDiffuse = g_txDiffuse.Sample( g_samLinear, vTexcoord );
+ return m_vColor * vDiffuse.xyz;
+}
+
+float3 cRoughTexturedMaterial::GetDiffuseColor(float2 vTexcoord)
+{
+ float4 vDiffuse = (float4)1.0f;
+ vDiffuse = g_txDiffuse.Sample( g_samLinear, vTexcoord );
+ return m_vColor * vDiffuse.xyz;
+}
diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_ps.hlsl b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_ps.hlsl
new file mode 100644
index 000000000..55d206259
--- /dev/null
+++ b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_ps.hlsl
@@ -0,0 +1,113 @@
+//TEST_IGNORE_FILE:
+//--------------------------------------------------------------------------------------
+// File: DynamicShaderLinkageFX11.psh
+//
+// The pixel shader header file for the DynamicShaderLinkageFX11 sample.
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// Header Includes
+//--------------------------------------------------------------------------------------
+#include "DynamicShaderLinkageFX11_PSBuffers.h"
+
+//--------------------------------------------------------------------------------------
+// Input / Output structures
+//--------------------------------------------------------------------------------------
+struct PS_INPUT
+{
+ float4 vPosition : SV_POSITION;
+ float3 vNormal : NORMAL;
+ float2 vTexcoord : TEXCOORD0;
+ float4 vMatrix : TEXCOORD1;
+};
+
+//--------------------------------------------------------------------------------------
+// Pixel Shader
+//--------------------------------------------------------------------------------------
+
+// This pixel shader uses several interfaces during its
+// work. We show three different ways of providing interface
+// bindings for the PS and those have two different
+// entry points so we've separated the base PS code
+// into a worker routine that's called by the entry
+// points. Normally only one technique would be used
+// and this layering of entry point and worker would
+// not be necessary.
+float4 PSMainWorker( iBaseLight ambientLighting,
+ iBaseLight directLighting,
+ iBaseLight environmentLighting,
+ iBaseMaterial material,
+ PS_INPUT Input )
+{
+ // Compute the Ambient term
+ float3 Ambient = (float3)0.0f;
+ Ambient = material.GetAmbientColor( Input.vTexcoord ) * ambientLighting.IlluminateAmbient( Input.vNormal );
+
+ // Accumulate the Diffuse contribution
+ float3 Diffuse = (float3)0.0f;
+
+ Diffuse += material.GetDiffuseColor( Input.vTexcoord ) * directLighting.IlluminateDiffuse( Input.vNormal );
+
+ // Compute the Specular contribution
+ float3 Specular = (float3)0.0f;
+ Specular += directLighting.IlluminateSpecular( Input.vNormal, material.GetSpecularPower() );
+ Specular += environmentLighting.IlluminateSpecular( Input.vNormal, material.GetSpecularPower() );
+
+ // Accumulate the lighting with saturation
+ float3 Lighting = saturate( Ambient + Diffuse + Specular);
+
+ return float4(Lighting,1.0f);
+}
+
+// One way to provide bindings for shaders in Effects 11 is
+// to use uniform interface parameters. As with non-interface
+// uniform parameters you must specify a value for these
+// parameters in your CompileShader invocations in the effect.
+// You can provide concrete class instances if you want
+// to statically specialize your shaders, such as for targets
+// that don't support abstract interfaces; or you can provide
+// other interfaces that you bind using effect variables.
+// Both are shown in this sample's technique passes.
+float4 PSMainUniform( uniform iBaseLight ambientLighting,
+ uniform iBaseLight directLighting,
+ uniform iBaseLight environmentLighting,
+ uniform iBaseMaterial material,
+ PS_INPUT Input ) : SV_Target
+{
+ return PSMainWorker(ambientLighting,
+ directLighting,
+ environmentLighting,
+ material,
+ Input);
+}
+
+// Another way to use Effects 11 with interfaces is
+// to have non-uniform parameters, which then are
+// bound with a BindInterfaces in a technique pass.
+// BindInterfaces gives concrete instances to use
+// with a shader but does not do static specialization,
+// it just saves information for the effect runtime
+// to use when setting up the shader to run.
+// This lets you share a single shader, compiled with
+// interface usage, while still getting the convenience
+// of declaring concrete bindings in the effect and
+// not needed explicit binding in code via effect
+// variable updates. If you have many different
+// variations it may be simpler to use bindings
+// through effect variables, as then you don't
+// need to list every possible binding set in your
+// techniques.
+float4 PSMainNonUniform( iBaseLight ambientLighting,
+ iBaseLight directLighting,
+ iBaseLight environmentLighting,
+ iBaseMaterial material,
+ PS_INPUT Input ) : SV_Target
+{
+ return PSMainWorker(ambientLighting,
+ directLighting,
+ environmentLighting,
+ material,
+ Input);
+}
diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_vs.hlsl b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_vs.hlsl
new file mode 100644
index 000000000..4791e5786
--- /dev/null
+++ b/tests/hlsl/dxsdk/DynamicShaderLinkageFX11/DynamicShaderLinkageFX11_vs.hlsl
@@ -0,0 +1,65 @@
+//TEST_IGNORE_FILE:
+//--------------------------------------------------------------------------------------
+// File: DynamicShaderLinkageFX11_VS.hlsl
+//
+// The vertex shader file for the DynamicShaderLinkageFX11 sample.
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// Globals
+//--------------------------------------------------------------------------------------
+cbuffer cbPerObject : register( b0 )
+{
+ float4x4 g_mWorldViewProjection : packoffset( c0 );
+ float4x4 g_mWorld : packoffset( c4 );
+};
+
+//--------------------------------------------------------------------------------------
+// Input / Output structures
+//--------------------------------------------------------------------------------------
+struct VS_INPUT
+{
+ float4 vPosition : POSITION;
+ float3 vNormal : NORMAL;
+ float2 vTexcoord : TEXCOORD0;
+};
+
+struct VS_OUTPUT
+{
+ float4 vPosition : SV_POSITION;
+ float3 vNormal : NORMAL;
+ float2 vTexcoord0 : TEXCOORD0;
+ float4 vMatrix : TEXCOORD1; // DEBUG
+};
+
+//--------------------------------------------------------------------------------------
+// Vertex Shader
+//--------------------------------------------------------------------------------------
+// We aliased signed vectors as a unsigned format.
+// Need to recover signed values. The values 1.0 and 2.0
+// are slightly inaccurate here.
+float3 R10G10B10A2_UNORM_TO_R32G32B32_FLOAT( in float3 vVec )
+{
+ vVec *= 2.0f;
+ return vVec >= 1.0f ? ( vVec - 2.0f ) : vVec;
+}
+
+VS_OUTPUT VSMain( VS_INPUT Input )
+{
+
+ VS_OUTPUT Output;
+ float3 tmpNormal;
+
+ Output.vPosition = mul( Input.vPosition, g_mWorldViewProjection );
+
+ // Expand compressed vectors
+ tmpNormal = R10G10B10A2_UNORM_TO_R32G32B32_FLOAT( Input.vNormal );
+ Output.vNormal = mul( tmpNormal, (float3x3)g_mWorld );
+
+ Output.vTexcoord0 = Input.vTexcoord;
+
+ Output.vMatrix = (float4)g_mWorld[0]; // DEBUG
+ return Output;
+}