diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-06-09 11:34:21 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-06-09 13:44:59 -0700 |
| commit | fcf83dbf9effab3bd98bad2b83b2468b7eb05cfd (patch) | |
| tree | 41047c94883b86ec085a81597391ce3ef557cd43 /tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl | |
| parent | 52e8d4b9a27ab0060f874c3a63ab531847be35c0 (diff) | |
Initial import of code.
Diffstat (limited to 'tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl')
| -rw-r--r-- | tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl new file mode 100644 index 000000000..78fff9eeb --- /dev/null +++ b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl @@ -0,0 +1,51 @@ +//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PSMain +//-------------------------------------------------------------------------------------- +// 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; +} + |
