Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
HlslDeclarations.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------------------------
2 // Shader Model 4.0 / 4.1
3 // ---------------------------------------------------------------------------------------
4 
5 // CalculateLevelOfDetail (DirectX HLSL Texture Object)
6 // http://msdn.microsoft.com/en-us/library/windows/desktop/bb944001%28v=vs.85%29.aspx
7 
8 // Gather (DirectX HLSL Texture Object)
9 // http://msdn.microsoft.com/en-us/library/windows/desktop/bb944003%28v=VS.85%29.aspx
10 
11 // GetDimensions (DirectX HLSL Texture Object)
12 // http://msdn.microsoft.com/en-us/library/bb509693%28v=VS.85%29.aspx
13 
14 // GetSamplePosition (DirectX HLSL Texture Object)
15 // http://msdn.microsoft.com/en-us/library/bb944004%28v=VS.85%29.aspx
16 
17 // Load (DirectX HLSL Texture Object)
18 // http://msdn.microsoft.com/en-us/library/bb509694%28v=VS.85%29.aspx
19 
20 // Sample (DirectX HLSL Texture Object)
21 // http://msdn.microsoft.com/en-us/library/bb509695%28v=VS.85%29.aspx
22 
23 // SampleBias (DirectX HLSL Texture Object)
24 // http://msdn.microsoft.com/en-us/library/bb944005%28v=VS.85%29.aspx
25 
26 // SampleCmp (DirectX HLSL Texture Object)
27 // http://msdn.microsoft.com/en-us/library/bb509696%28v=VS.85%29.aspx
28 
29 // SampleGrad (DirectX HLSL Texture Object)
30 // http://msdn.microsoft.com/en-us/library/bb509698%28v=VS.85%29.aspx
31 
32 // SampleLevel (DirectX HLSL Texture Object)
33 // http://msdn.microsoft.com/en-us/library/bb509699%28v=VS.85%29.aspx
34 
35 class __Texture1D<T> {
36  // SM 4.0
37  float CalculateLevelOfDetail( sampler_state s, float1 x);
38  void GetDimensions( uint MipLevel, out uint Width, out uint NumberOfLevels);
39  void GetDimensions( out uint Width);
40  void GetDimensions( uint MipLevel, out float Width, out float NumberOfLevels);
41  void GetDimensions( out float Width);
42  T Load(int2 Location);
43  T Load(int2 Location, int Offset);
44  float4 Sample(sampler_state S, float Location);
45  float4 Sample(sampler_state S, float Location, int Offset);
46  float4 SampleBias(sampler_state S, float Location, float Bias);
47  float4 SampleBias(sampler_state S, float Location, float Bias, int Offset);
48  uint SampleCmp(sampler_state S, float Location, float Bias);
49  uint SampleCmp(sampler_state S, float Location, float Bias, int Offset);
50  float4 SampleGrad(sampler_state S, float Location, float DDX, float DDY);
51  float4 SampleGrad(sampler_state S, float Location, float DDX, float DDY, int Offset);
52  float4 SampleLevel( sampler_state S, float Location, float LOD);
53  float4 SampleLevel( sampler_state S, float Location, float LOD, int Offset);
54 
55  // SM 5.0
56  T mips.operator[][](in uint mipSlice,in uint pos);
57 
58  T operator[](in uint pos);
59 };
60 
61 class __Texture1DArray<T> {
62  // SM 4.0
63  float CalculateLevelOfDetail( sampler_state s, float1 x);
64  void GetDimensions( uint MipLevel, out uint Width, out uint Elements, out uint NumberOfLevels);
65  void GetDimensions( out uint Width, out uint Elements);
66  void GetDimensions( uint MipLevel, out float Width, out float Elements, out float NumberOfLevels);
67  void GetDimensions( out float Width, out float Elements);
68  T Load(int3 Location);
69  T Load(int3 Location, int Offset);
70  float4 Sample(sampler_state S, float2 Location);
71  float4 Sample(sampler_state S, float2 Location, int Offset);
72  float4 SampleBias(sampler_state S, float2 Location, float Bias);
73  float4 SampleBias(sampler_state S, float2 Location, float Bias, int Offset);
74  uint SampleCmp(sampler_state S, float2 Location, float Bias);
75  uint SampleCmp(sampler_state S, float2 Location, float Bias, int Offset);
76  float4 SampleGrad(sampler_state S, float2 Location, float DDX, float DDY);
77  float4 SampleGrad(sampler_state S, float2 Location, float DDX, float DDY, int Offset);
78  float4 SampleLevel( sampler_state S, float2 Location, float LOD);
79  float4 SampleLevel( sampler_state S, float2 Location, float LOD, int Offset);
80 
81  // SM 5.0
82  T mips.operator[][](in uint mipSlice,in uint2 pos);
83 
84  T operator[](in uint2 pos);
85 };
86 
87 class __Texture2D<T> {
88  // SM 4.0
89  float CalculateLevelOfDetail( sampler_state s, float2 x);
90  vector<__T_base,4> Gather( sampler_state S, float2 Location);
91  vector<__T_base,4> Gather( sampler_state S, float2 Location, int2 Offset );
92  void GetDimensions( uint MipLevel, out uint Width, out uint Height, out uint NumberOfLevels);
93  void GetDimensions( out uint Width, out uint Height);
94  void GetDimensions( uint MipLevel, out float Width, out float Height, out float NumberOfLevels);
95  void GetDimensions( out float Width, out float Height);
96  T Load(int3 Location);
97  T Load(int3 Location, int2 Offset);
98  float4 Sample(sampler_state S, float2 Location);
99  float4 Sample(sampler_state S, float2 Location, int2 Offset);
100  float4 SampleBias(sampler_state S, float2 Location, float Bias);
101  float4 SampleBias(sampler_state S, float2 Location, float Bias, int2 Offset);
102  uint SampleCmp(sampler_state S, float2 Location, float Bias);
103  uint SampleCmp(sampler_state S, float2 Location, float Bias, int2 Offset);
104  float4 SampleGrad(sampler_state S, float2 Location, float2 DDX, float2 DDY);
105  float4 SampleGrad(sampler_state S, float2 Location, float2 DDX, float2 DDY, int2 Offset);
106  float4 SampleLevel( sampler_state S, float2 Location, float LOD);
107  float4 SampleLevel( sampler_state S, float2 Location, float LOD, int2 Offset);
108 
109  // SM 5.0
110  T Gather(
111  in sampler s,
112  in float2 location,
113  in int2 offset
114  );
115 
116  T GatherRed(
117  in sampler s,
118  in float2 location,
119  in int2 offset
120  );
121 
122  T GatherGreen(
123  in sampler s,
124  in float2 location,
125  in int2 offset
126  );
127 
128  T GatherBlue(
129  in sampler s,
130  in float2 location,
131  in int2 offset
132  );
133 
134  T GatherAlpha(
135  in sampler s,
136  in float2 location,
137  in int2 offset
138  );
139 
140  float4 GatherCmp(
141  in SamplerComparisonState s,
142  in float2 location,
143  in float compare_value,
144  in int2 offset
145  );
146 
147  float4 GatherCmpRed(
148  in SamplerComparisonState s,
149  in float2 location,
150  in float compare_value,
151  in int2 offset
152  );
153 
154  float4 GatherCmpGreen(
155  in SamplerComparisonState s,
156  in float2 location,
157  in float compare_value,
158  in int2 offset
159  );
160 
161  float4 GatherCmpBlue(
162  in SamplerComparisonState s,
163  in float2 location,
164  in float compare_value,
165  in int2 offset
166  );
167 
168  float4 GatherCmpAlpha(
169  in SamplerComparisonState s,
170  in float2 location,
171  in float compare_value,
172  in int2 offset
173  );
174 
175  T mips.operator[][](in uint mipSlice, in uint2 pos);
176 
177  T operator[](in uint2 pos);
178 };
179 
180 class __Texture2DArray<T> {
181  // SM 4.0
182  float CalculateLevelOfDetail( sampler_state s, float2 x);
183  vector<__T_base,4> Gather( sampler_state S, float3 Location, int2 Offset );
184  void GetDimensions( uint MipLevel, out uint Width, out uint Height, out uint Elements, out uint NumberOfLevels);
185  void GetDimensions( out uint Width, out uint Height, out uint Elements);
186  void GetDimensions( uint MipLevel, out float Width, out float Height, out float Elements, out float NumberOfLevels);
187  void GetDimensions( out float Width, out float Height, out float Elements);
188  T Load(int4 Location);
189  T Load(int4 Location, int2 Offset);
190  T Load(int4 Location, int3 Offset);
191  float4 Sample(sampler_state S, float3 Location);
192  float4 Sample(sampler_state S, float3 Location, int2 Offset);
193  float4 SampleBias(sampler_state S, float3 Location, float Bias);
194  float4 SampleBias(sampler_state S, float3 Location, float Bias, int2 Offset);
195  uint SampleCmp(sampler_state S, float3 Location, float Bias);
196  uint SampleCmp(sampler_state S, float3 Location, float Bias, int2 Offset);
197  float4 SampleGrad(sampler_state S, float3 Location, float2 DDX, float2 DDY);
198  float4 SampleGrad(sampler_state S, float3 Location, float2 DDX, float2 DDY, int2 Offset);
199  float4 SampleLevel( sampler_state S, float3 Location, float LOD);
200  float4 SampleLevel( sampler_state S, float3 Location, float LOD, int2 Offset);
201 
202  // SM 5.0
203  T Gather(
204  in sampler s,
205  in float3 location,
206  in int2 offset
207  );
208 
209  T GatherRed(
210  in sampler s,
211  in float3 location,
212  in int2 offset
213  );
214 
215  T GatherGreen(
216  in sampler s,
217  in float3 location,
218  in int2 offset
219  );
220 
221  T GatherBlue(
222  in sampler s,
223  in float3 location,
224  in int2 offset
225  );
226 
227  T GatherAlpha(
228  in sampler s,
229  in float3 location,
230  in int2 offset
231  );
232 
233  float4 GatherCmp(
234  in SamplerComparisonState s,
235  in float3 location,
236  in float compare_value,
237  in int2 offset
238  );
239 
240  float4 GatherCmpRed(
241  in SamplerComparisonState s,
242  in float3 location,
243  in float compare_value,
244  in int2 offset
245  );
246 
247  float4 GatherCmpGreen(
248  in SamplerComparisonState s,
249  in float3 location,
250  in float compare_value,
251  in int2 offset
252  );
253 
254  float4 GatherCmpBlue(
255  in SamplerComparisonState s,
256  in float3 location,
257  in float compare_value,
258  in int2 offset
259  );
260 
261  float4 GatherCmpAlpha(
262  in SamplerComparisonState s,
263  in float3 location,
264  in float compare_value,
265  in int2 offset
266  );
267 
268  T mips.operator[][](in uint mipSlice, in uint3 pos);
269 
270  T operator[](in uint3 pos);
271 };
272 
273 
274 class __Texture3D<T> {
275  // SM 4.0
276  float CalculateLevelOfDetail( sampler_state s, float3 x);
277  void GetDimensions( uint MipLevel, out uint Width, out uint Height, out uint Depth, out uint NumberOfLevels);
278  void GetDimensions( out uint Width, out uint Height, out uint Depth);
279  void GetDimensions( uint MipLevel, out float Width, out float Height, out float Depth, out float NumberOfLevels);
280  void GetDimensions( out float Width, out float Height, out float Depth);
281  T Load(int4 Location);
282  T Load(int4 Location, int3 Offset);
283  float4 Sample(sampler_state S, float3 Location);
284  float4 Sample(sampler_state S, float3 Location, int3 Offset);
285  float4 SampleBias(sampler_state S, float3 Location, float Bias);
286  float4 SampleBias(sampler_state S, float3 Location, float Bias, int3 Offset);
287  uint SampleCmp(sampler_state S, float3 Location, float Bias);
288  uint SampleCmp(sampler_state S, float3 Location, float Bias, int3 Offset);
289  float4 SampleGrad(sampler_state S, float3 Location, float3 DDX, float3 DDY);
290  float4 SampleGrad(sampler_state S, float3 Location, float3 DDX, float3 DDY, int3 Offset);
291  float4 SampleLevel( sampler_state S, float3 Location, float LOD);
292  float4 SampleLevel( sampler_state S, float3 Location, float LOD, int3 Offset);
293 
294  // SM 5.0
295  T mips.operator[][](in uint mipSlice,in uint3 pos);
296 
297  T operator[](in uint3 pos);
298 };
299 
300 class __TextureCube<T> {
301  // SM 4.0
302  float CalculateLevelOfDetail( sampler_state s, float3 x);
303  vector<__T_base,4> Gather( sampler_state S, float3 Location);
304  void GetDimensions( uint MipLevel, out uint Width, out uint Height, out uint NumberOfLevels);
305  void GetDimensions( out uint Width, out uint Height);
306  void GetDimensions( uint MipLevel, out float Width, out float Height, out uint NumberOfLevels);
307  void GetDimensions( out float Width, out float Height);
308  float4 Sample(sampler_state S, float3 Location);
309  float4 SampleBias(sampler_state S, float3 Location, float Bias);
310  uint SampleCmp(sampler_state S, float3 Location, float Bias);
311  float4 SampleGrad(sampler_state S, float3 Location, float3 DDX, float3 DDY);
312  float4 SampleLevel( sampler_state S, float3 Location, float LOD);
313 };
314 
315 class __TextureCubeArray<T> {
316  // SM 4.0
317  float CalculateLevelOfDetail( sampler_state s, float3 x);
318  vector<__T_base,4> Gather( sampler_state S, float4 Location);
319  void GetDimensions( uint MipLevel, out uint Width, out uint Height, out uint Elements, out uint NumberOfLevels);
320  void GetDimensions( out uint Width, out uint Height, out uint Elements);
321  void GetDimensions( uint MipLevel, out float Width, out float Height, out float Elements, out float NumberOfLevels);
322  void GetDimensions( out float Width, out float Height, out float Elements);
323  float4 Sample(sampler_state S, float4 Location);
324  float4 SampleBias(sampler_state S, float4 Location, float Bias);
325  uint SampleCmp(sampler_state S, float4 Location, float Bias);
326  uint SampleCmp(sampler_state S, float4 Location, float Bias, int3 Offset);
327  float4 SampleGrad(sampler_state S, float4 Location, float3 DDX, float3 DDY);
328  float4 SampleLevel( sampler_state S, float4 Location, float LOD);
329 };
330 
331 class __Texture2DMS<T> {
332  // SM 4.0
333  void GetDimensions( out uint Width, out uint Height, out uint Samples);
334  void GetDimensions( out float Width, out float Height, out float Samples);
335  float2 GetSamplePosition(int s);
336  T Load(int2 Location);
337  T Load(int2 Location, int2 Offset);
338  T Load(int2 Location, int2 Offset, int SampleIndex);
339 
340 
341  // SM 5.0
342  float2 GetSamplePosition(
343  in int sampleindex
344  );
345 
346  T Load(
347  in int2 coord,
348  in int sampleindex
349  );
350 
351  T sample.operator[][]( in uint sampleSlice, in uint3 pos);
352 };
353 
354 class __Texture2DMSArray<T> {
355  // SM 4.0
356  void GetDimensions( out uint Width, out uint Height, out uint Elements, out uint Samples);
357  void GetDimensions( out float Width, out float Height, out float Elements, out float Samples);
358  float2 GetSamplePosition(int s);
359  T Load(int3 Location);
360  T Load(int3 Location, int2 Offset);
361  T Load(int3 Location, int2 Offset, int SampleIndex);
362 
363  // SM 5.0
364  float2 GetSamplePosition(
365  in int sampleindex
366  );
367 
368  T Load(
369  in int3 coord,
370  in int sampleindex
371  );
372 
373  T sample.operator[][]( in uint sampleSlice, in uint3 pos);
374 };
375 
376 class __Buffer<T> {
377  // SM 4.0
378  T Load(int Location);
379 
380  void GetDimensions(out uint dim);
381 
382  T operator[](in uint pos);
383 };
384 
385 // Stream-Output Object (DirectX HLSL)
386 // http://msdn.microsoft.com/en-us/library/bb509661%28v=VS.85%29.aspx
387 // StreamOutputObject <T> Name
388 // StreamOutputObject: PointStream, LineStream, TriangleStream
389 class __PointStream<T> {
390  void Append(T StreamDataType);
391  void RestartStrip();
392 };
393 
394 class __LineStream<T> {
395  void Append(T StreamDataType);
396  void RestartStrip();
397 };
398 
399 class __TriangleStream<T> {
400  void Append(T StreamDataType);
401  void RestartStrip();
402 };
403 
404 // ---------------------------------------------------------------------------------------
405 // Shader Model 5.0
406 // ---------------------------------------------------------------------------------------
407 
408 // AppendStructuredBuffer<T>
409 // http://msdn.microsoft.com/en-us/library/ff471448%28v=VS.85%29.aspx
410 class __AppendStructuredBuffer<T> {
411  void Append(T value);
412  void GetDimensions(out uint numStructs, out uint stride);
413 };
414 
415 // ByteAddressBuffer
416 // http://msdn.microsoft.com/en-us/library/ff471453%28v=VS.85%29.aspx
418  void GetDimensions(out uint dim);
419  uint Load(in uint address);
420  uint2 Load2(in uint address);
421  uint3 Load3(in uint address);
422  uint4 Load4(in uint address);
423 };
424 
425 // ConsumeStructuredBuffer<T>
426 // http://msdn.microsoft.com/en-us/library/ff471459%28v=VS.85%29.aspx
427 class __ConsumeStructuredBuffer<T> {
428  T Consume(void);
429  void GetDimensions(out uint numStructs, out uint stride);
430 };
431 
432 // InputPatch<T,N>
433 // http://msdn.microsoft.com/en-us/library/ff471462%28v=VS.85%29.aspx
434 class __InputPatch<T,N> {
435  uint Length;
436  T operator[](in uint n);
437 };
438 
439 // OutputPatch<T,N>
440 // http://msdn.microsoft.com/en-us/library/ff471464%28v=VS.85%29.aspx
441 class __OutputPatch<T,N> {
442  uint Length;
443  T operator[](in uint n);
444 };
445 
446 // RWBuffer<T>
447 // http://msdn.microsoft.com/en-us/library/ff471472%28v=VS.85%29.aspx
448 class __RWBuffer<T> {
449  void GetDimensions(out uint dim);
450  T operator []( in uint pos);
451 };
452 
453 // RWByteAddressBuffer
454 // http://msdn.microsoft.com/en-us/library/ff471475%28v=VS.85%29.aspx
456  void GetDimensions(out uint dim);
457  void InterlockedAdd(in uint dest, in uint value, out uint original_value);
458  void InterlockedAnd(
459  in uint dest,
460  in uint value,
461  out uint original_value
462  );
463  void InterlockedCompareExchange(
464  in uint dest,
465  in uint compare_value,
466  in uint value,
467  out uint original_value
468  );
469  void InterlockedCompareStore(
470  in uint dest,
471  in uint compare_value,
472  in uint value
473  );
474  void InterlockedExchange(
475  in uint dest,
476  in uint value,
477  out uint original_value
478  );
479  void InterlockedMax(
480  in uint dest,
481  in uint value,
482  out uint original_value
483  );
484  void InterlockedMin(
485  in uint dest,
486  in uint value,
487  out uint original_value
488  );
489  void InterlockedOr(
490  in uint dest,
491  in uint value,
492  out uint original_value
493  );
494  void InterlockedXor(
495  in uint dest,
496  in uint value,
497  out uint original_value
498  );
499  uint Load(
500  in uint address
501  );
502  uint2 Load2(
503  in uint address
504  );
505  uint3 Load3(
506  in uint address
507  );
508  uint4 Load4(
509  in uint address
510  );
511  void Store(
512  in uint address,
513  in uint value
514  );
515  void Store2(
516  in uint address,
517  in uint2 values
518  );
519  void Store3(
520  in uint address,
521  in uint3 values
522  );
523  void Store4(
524  in uint address,
525  in uint4 values
526  );
527 };
528 
529 // RWStructuredBuffer<T>
530 // http://msdn.microsoft.com/en-us/library/ff471494%28v=VS.85%29.aspx
531 class __RWStructuredBuffer<T> {
532 
533  uint DecrementCounter(void);
534 
535  void GetDimensions(
536  out uint numStructs,
537  out uint stride
538  );
539 
540  uint IncrementCounter(void);
541 
542  T operator[](in uint pos);
543 };
544 
545 // RWTexture1D<T>
546 // http://msdn.microsoft.com/en-us/library/ff471499%28v=VS.85%29.aspx
547 class __RWTexture1D<T> {
548  void GetDimensions(
549  out uint Width
550  );
551  T operator[](in uint pos);
552 };
553 
554 // RWTexture1DArray<T>
555 // http://msdn.microsoft.com/en-us/library/ff471500%28v=VS.85%29.aspx
556 class __RWTexture1DArray<T> {
557  void GetDimensions(
558  out uint Width,
559  out uint Elements
560  );
561 
562  T operator[](in uint2 pos);
563 };
564 
565 // RWTexture2D<T>
566 // http://msdn.microsoft.com/en-us/library/ff471505%28v=VS.85%29.aspx
567 class __RWTexture2D<T> {
568  void GetDimensions(
569  out uint Width,
570  out uint Height
571  );
572 
573  T operator[](in uint2 pos);
574 };
575 
576 // RWTexture2DArray<T>
577 // http://msdn.microsoft.com/en-us/library/ff471506%28v=VS.85%29.aspx
578 class __RWTexture2DArray<T> {
579  void GetDimensions(
580  out uint Width,
581  out uint Height,
582  out uint Elements
583  );
584  T operator[](in uint3 pos);
585 };
586 
587 // RWTexture3D<T>
588 // http://msdn.microsoft.com/en-us/library/ff471511%28v=VS.85%29.aspx
589 class __RWTexture3D<T> {
590  void GetDimensions(
591  out uint Width,
592  out uint Height,
593  out uint Depth
594  );
595 
596  T operator[](in uint3 pos);
597 };
598 
599 // StructuredBuffer<T>
600 // http://msdn.microsoft.com/en-us/library/ff471514%28v=VS.85%29.aspx
601 class __StructuredBuffer<T> {
602  void GetDimensions(
603  out uint numStructs,
604  out uint stride
605  );
606 
607  T operator[](in uint pos);
608 };
function s(a)
char * dest
Definition: lz4.h:61