RetroArch
sprite_sm4.hlsl.h
Go to the documentation of this file.
1 
2 #define SRC(...) #__VA_ARGS__
3 SRC(
4 
5  struct VSInput
6  {
7  float4 position : POSITION;
8  float4 texcoord : TEXCOORD0;
9  float4 color0 : COLOR0;
10  float4 color1 : COLOR1;
11  float4 color2 : COLOR2;
12  float4 color3 : COLOR3;
13  float2 params : PARAMS;
14  };
15  struct GSInput
16  {
17  float4 position : POSITION;
18  float4 texcoord : TEXCOORD0;
19  float4 color0 : COLOR0;
20  float4 color1 : COLOR1;
21  float4 color2 : COLOR2;
22  float4 color3 : COLOR3;
23  };
24  struct PSInput
25  {
26  float4 position : SV_POSITION;
27  float2 texcoord : TEXCOORD0;
28  float4 color : COLOR;
29  };
30 
31  GSInput VSMain(VSInput input)
32  {
33  GSInput output;
34  output.position = input.position * 2.0;
35  output.position.xy += output.position.zw * (1.0 - input.params.x) * 0.5f;
36  output.position.zw *= input.params.x;
37  output.position.w *= -1.0;
38  output.position.x = output.position.x - 1.0;
39  output.position.y = 1.0 - output.position.y;
40  output.texcoord = input.texcoord;
41  output.color0 = input.color0;
42  output.color1 = input.color1;
43  output.color2 = input.color2;
44  output.color3 = input.color3;
45  return output;
46  }
47 
48  [maxvertexcount(4)]
49  void GSMain(point GSInput input[1], inout TriangleStream<PSInput> triStream)
50  {
51  PSInput output;
52  output.position.zw = float2(0.0f, 1.0f);
53 
54  output.position.xy = input[0].position.xy + input[0].position.zw * float2(1.0, 0.0);
55  output.texcoord = input[0].texcoord.xy + input[0].texcoord.zw * float2(1.0, 0.0);
56  output.color = input[0].color0;
57  triStream.Append(output);
58 
59  output.position.xy = input[0].position.xy + input[0].position.zw * float2(0.0, 0.0);
60  output.texcoord = input[0].texcoord.xy + input[0].texcoord.zw * float2(0.0, 0.0);
61  output.color = input[0].color1;
62  triStream.Append(output);
63 
64  output.position.xy = input[0].position.xy + input[0].position.zw * float2(1.0, 1.0);
65  output.texcoord = input[0].texcoord.xy + input[0].texcoord.zw * float2(1.0, 1.0);
66  output.color = input[0].color2;
67  triStream.Append(output);
68 
69  output.position.xy = input[0].position.xy + input[0].position.zw * float2(0.0, 1.0);
70  output.texcoord = input[0].texcoord.xy + input[0].texcoord.zw * float2(0.0, 1.0);
71  output.color = input[0].color3;
72  triStream.Append(output);
73  }
74 
75  uniform sampler s0;
76  uniform Texture2D <float4> t0;
77  float4 PSMain(PSInput input) : SV_TARGET
78  {
79  return input.color * t0.Sample(s0, input.texcoord);
80  };
81  float4 PSMainA8(PSInput input) : SV_TARGET
82  {
83  return float4(input.color.rgb , input.color.a * t0.Sample(s0, input.texcoord).a);
84  };
85 
86 
87 )
GLenum const GLfloat * params
Definition: glext.h:6297
GLfloat f
Definition: glext.h:8207
GLenum GLenum GLenum input
Definition: glext.h:9938
std::string output
Definition: Config.FromFile.cpp:44
GLuint color
Definition: glext.h:6883
#define SRC(...)
Definition: sprite_sm4.hlsl.h:2
GLuint sampler
Definition: glext.h:7950