DirectXTK12/Src/Shaders/SpriteEffect.fx

47 строки
1.1 KiB
HLSL

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=615561
#include "Structures.fxh"
#include "RootSig.fxh"
Texture2D<float4> Texture : register(t0);
sampler TextureSampler : register(s0);
cbuffer Parameters : register(b0)
{
row_major float4x4 MatrixTransform;
};
[RootSignature(SpriteStaticRS)]
void SpriteVertexShader(inout float4 color : COLOR0,
inout float2 texCoord : TEXCOORD0,
inout float4 position : SV_Position)
{
position = mul(position, MatrixTransform);
}
[RootSignature(SpriteStaticRS)]
float4 SpritePixelShader(float4 color : COLOR0,
float2 texCoord : TEXCOORD0) : SV_Target0
{
return Texture.Sample(TextureSampler, texCoord) * color;
}
[RootSignature(SpriteHeapRS)]
void SpriteVertexShaderHeap(inout float4 color : COLOR0,
inout float2 texCoord : TEXCOORD0,
inout float4 position : SV_Position)
{
position = mul(position, MatrixTransform);
}
[RootSignature(SpriteHeapRS)]
float4 SpritePixelShaderHeap(float4 color : COLOR0,
float2 texCoord : TEXCOORD0) : SV_Target0
{
return Texture.Sample(TextureSampler, texCoord) * color;
}