diff options
Diffstat (limited to 'tests/hlsl/dxsdk/DynamicShaderLinkage11')
5 files changed, 0 insertions, 473 deletions
diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_LightPSH.h b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_LightPSH.h deleted file mode 100644 index b44251829..000000000 --- a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_LightPSH.h +++ /dev/null @@ -1,84 +0,0 @@ -//-------------------------------------------------------------------------------------- -// File: DynamicShaderLinkage11_LightPSH.h -// -// The pixel shader light header file for the DynamicShaderLinkage11 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/DynamicShaderLinkage11/DynamicShaderLinkage11_MaterialPSH.h b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_MaterialPSH.h deleted file mode 100644 index 7f6bc3d22..000000000 --- a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_MaterialPSH.h +++ /dev/null @@ -1,103 +0,0 @@ -//-------------------------------------------------------------------------------------- -// File: DynamicShaderLinkage11_MATERIALPSH.h -// -// The pixel shader material header file for the DynamicShaderLinkage11 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/DynamicShaderLinkage11/DynamicShaderLinkage11_PS.hlsl b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PS.hlsl deleted file mode 100644 index 6850ad9cb..000000000 --- a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PS.hlsl +++ /dev/null @@ -1,84 +0,0 @@ -//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues. -//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PSMain -//-------------------------------------------------------------------------------------- -// File: DynamicShaderLinkage11.psh -// -// The pixel shader header file for the DynamicShaderLinkage11 sample. -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -//-------------------------------------------------------------------------------------- -// Header Includes -//-------------------------------------------------------------------------------------- -#include "DynamicShaderLinkage11_PSBuffers.h" - -// Defines for default static permutated setting -#if defined( STATIC_PERMUTE ) - #define HEMI_AMBIENT //CONST_AMBIENT //HEMI_AMBIENT - #define TEXTURE_ENABLE - #define SPECULAR_ENABLE -#endif - -//-------------------------------------------------------------------------------------- -// Input / Output structures -//-------------------------------------------------------------------------------------- -struct PS_INPUT -{ - float4 vPosition : SV_POSITION; - float3 vNormal : NORMAL; - float2 vTexcoord : TEXCOORD0; - float4 vMatrix : TEXCOORD1; -}; - -//-------------------------------------------------------------------------------------- -// Abstract Interface Instances for dyamic linkage / permutation -//-------------------------------------------------------------------------------------- -#if !defined( STATIC_PERMUTE ) - iBaseLight g_abstractAmbientLighting; - iBaseLight g_abstractDirectLighting; - iBaseLight g_abstractEnvironmentLighting; - iBaseMaterial g_abstractMaterial; -#else -//-------------------------------------------------------------------------------------- -// Concrete Instances for STATIC_PERMUTE - static permutation -//-------------------------------------------------------------------------------------- - #if defined( HEMI_AMBIENT ) - #define g_abstractAmbientLighting g_hemiAmbientLight - #else - // CONST_AMBIENT - #define g_abstractAmbientLighting g_ambientLight - #endif - #define g_abstractDirectLighting g_directionalLight - #define g_abstractEnvironmentLighting g_environmentLight - #if defined( TEXTURE_ENABLE ) - #define g_abstractMaterial g_plasticTexturedMaterial - #else - #define g_abstractMaterial g_plasticMaterial - #endif -#endif - -//-------------------------------------------------------------------------------------- -// Pixel Shader -//-------------------------------------------------------------------------------------- -float4 PSMain( PS_INPUT Input ) : SV_TARGET -{ - // Compute the Ambient term - float3 Ambient = (float3)0.0f; - Ambient = g_abstractMaterial.GetAmbientColor( Input.vTexcoord ) * g_abstractAmbientLighting.IlluminateAmbient( Input.vNormal ); - - // Accumulate the Diffuse contribution - float3 Diffuse = (float3)0.0f; - - Diffuse += g_abstractMaterial.GetDiffuseColor( Input.vTexcoord ) * g_abstractDirectLighting.IlluminateDiffuse( Input.vNormal ); - - // Compute the Specular contribution - float3 Specular = (float3)0.0f; - Specular += g_abstractDirectLighting.IlluminateSpecular( Input.vNormal, g_abstractMaterial.GetSpecularPower() ); - Specular += g_abstractEnvironmentLighting.IlluminateSpecular( Input.vNormal, g_abstractMaterial.GetSpecularPower() ); - - // Accumulate the lighting with saturation - float3 Lighting = saturate( Ambient + Diffuse + Specular ); - - return float4(Lighting,1.0f); -} diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PSBuffers.h b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PSBuffers.h deleted file mode 100644 index e2263b832..000000000 --- a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PSBuffers.h +++ /dev/null @@ -1,129 +0,0 @@ -//-------------------------------------------------------------------------------------- -// File: DynamicShaderLinkage11_LightPSH.hlsl -// -// The pixel shader light source module file for the DynamicShaderLinkage11 sample. -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -#include "DynamicShaderLinkage11_LightPSH.h" -#include "DynamicShaderLinkage11_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 ); - -//-------------------------------------------------------------------------------------- -// Lighting Class Methods -//-------------------------------------------------------------------------------------- -// Ambient Lighting Class Methods -float3 cAmbientLight::IlluminateAmbient(float3 vNormal) -{ - return float4( m_vLightColor * m_bEnable, 1.0f); -} - -float3 cHemiAmbientLight::IlluminateAmbient(float3 vNormal) -{ - float thetha = (dot( vNormal, m_vDirUp ) + 1.0f) / 2.0f; - - return lerp( m_vGroundColor, m_vLightColor, thetha) * m_bEnable; -} - -// Directional Light class -float3 cDirectionalLight::IlluminateDiffuse( float3 vNormal ) -{ - float lambert = saturate(dot( vNormal, m_vLightDir )); - return ((float3)lambert * m_vLightColor * m_bEnable); -} - -float3 cDirectionalLight::IlluminateSpecular( float3 vNormal, int specularPower ) -{ - float3 H = -normalize(g_vEyeDir) + m_vLightDir; - 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); - float3 R = reflect( E, N ); - float fresnel = 1 - dot( -E, N ); - fresnel = (fresnel * fresnel * fresnel ); - - float3 specular = g_txEnvironmentMap.Sample( g_samLinear, R ) * 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; -} - -float3 cPlasticTexturedMaterial::GetDiffuseColor(float2 vTexcoord) -{ - float4 vDiffuse = (float4)1.0f; - vDiffuse = g_txDiffuse.Sample( g_samLinear, vTexcoord ); - return m_vColor * vDiffuse; -} - -// Rough Material Methods -float3 cRoughTexturedMaterial::GetAmbientColor(float2 vTexcoord) -{ - float4 vDiffuse = (float4)1.0f; - vDiffuse = g_txDiffuse.Sample( g_samLinear, vTexcoord ); - return m_vColor * vDiffuse; -} - -float3 cRoughTexturedMaterial::GetDiffuseColor(float2 vTexcoord) -{ - float4 vDiffuse = (float4)1.0f; - vDiffuse = g_txDiffuse.Sample( g_samLinear, vTexcoord ); - return m_vColor * vDiffuse; -} diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl deleted file mode 100644 index d47f20c23..000000000 --- a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl +++ /dev/null @@ -1,73 +0,0 @@ -//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VSMain - -#ifndef __SLANG__ -#define cbPerObject cbPerObject_0 -#define g_mWorldViewProjection g_mWorldViewProjection_0 -#define g_mWorld g_mWorld_0 -#endif - -//-------------------------------------------------------------------------------------- -// File: DynamicShaderLinkage11_VS.hlsl -// -// The vertex shader file for the DynamicShaderLinkage11 sample. -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//-------------------------------------------------------------------------------------- - -//-------------------------------------------------------------------------------------- -// Globals -//-------------------------------------------------------------------------------------- -cbuffer cbPerObject : register( b0 ) -{ - float4x4 g_mWorldViewProjection ;//SLANG: : packoffset( c0 ); - float4x4 g_mWorld ;//SLANG: : 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; -} - |
