File: shadow2.hlsl

package info (click to toggle)
qtdeclarative-opensource-src-gles 5.15.15%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 258,796 kB
  • sloc: javascript: 512,412; cpp: 497,152; xml: 8,892; python: 3,304; ansic: 2,764; sh: 206; makefile: 46; php: 27
file content (22 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
cbuffer ConstantBuffer : register(b0)
{
    float4x4 qt_Matrix;
    float qt_Opacity;
    float2 offset;
    float darkness;
    float2 delta;
};

Texture2D source : register(t0);
Texture2D shadow : register(t1);
SamplerState samp : register(s0);
// Use the same sampler for both textures. In fact the engine will create an extra static sampler
// in any case (to match the number of textures) due to some internals, but that won't hurt, the
// shader works either way.

float4 PS_Shadow2(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
{
    float4 fg = source.Sample(samp, coord);
    float4 bg = shadow.Sample(samp, coord + delta);
    return (fg + float4(0.0, 0.0, 0.0, darkness * bg.a) * (1.0 - fg.a)) * qt_Opacity;
}