aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg')
-rw-r--r--PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg144
1 files changed, 144 insertions, 0 deletions
diff --git a/PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg
new file mode 100644
index 00000000..a275fb90
--- /dev/null
+++ b/PhysX_3.4/Media/SampleRenderer/4/shaders/include/defines.cg
@@ -0,0 +1,144 @@
+#ifndef DEFINES_CG
+#define DEFINES_CG
+
+#define __in(argType, argName, argSemantic) argType argName : argSemantic
+
+#ifdef RENDERER_GNM
+#define JOIN2(a, b) a##b
+#define JOIN(a, b) JOIN2(a, b)
+
+#define BEGIN_CBUFFER(name)
+#define END_CBUFFER(name)
+#define CONST_TYPE
+#define DECLARE_TEXTURE(textureName) Texture2D textureName; SamplerState JOIN(textureName,SamplerState);
+#define DECLARE_TEXTURE_3D(textureName) Texture3D textureName; SamplerState JOIN(textureName,SamplerState);
+#define tex2D(textureName,textureCoord) textureName.Sample(JOIN(textureName,SamplerState), textureCoord)
+#define tex2Dproj(textureName,textureCoord) textureName.Sample(JOIN(textureName,SamplerState), textureCoord.xy).x <=
+
+#define __in_opt(argType, argName, argSemantic) , __in(argType, argName, argSemantic)
+
+#define COLOR0 S_TARGET_OUTPUT
+#define half3 float3
+#define half4 float4
+#define half float
+
+#elif !defined(RENDERER_D3D11)
+
+#define BEGIN_CBUFFER(name)
+#define END_CBUFFER(name)
+#define CONST_TYPE uniform const
+#define DECLARE_TEXTURE(name) uniform const sampler2D name;
+#define DECLARE_TEXTURE_3D(name) uniform const sampler3D name;
+
+#define __in_opt(argType, argName, argSemantic) , __in(argType, argName, argSemantic)
+
+#else /* !defined(RENDERER_D3D11) */
+
+#define JOIN2(a, b) a##b
+#define JOIN(a, b) JOIN2(a, b)
+
+#define BEGIN_CBUFFER(name) cbuffer name {
+#define END_CBUFFER(name) }
+#define CONST_TYPE
+#define DECLARE_TEXTURE(textureName) Texture2D textureName; SamplerState JOIN(textureName,SamplerState);
+#define DECLARE_TEXTURE_3D(textureName) Texture3D textureName; SamplerState JOIN(textureName,SamplerState);
+#define tex2D(textureName,textureCoord) textureName.Sample(JOIN(textureName,SamplerState), textureCoord)
+#define tex2Dproj(textureName,textureCoord) textureName.Sample(JOIN(textureName,SamplerState), textureCoord.xy).x <= textureCoord.z ? 0 : 1
+
+#define __in_opt2(argType, argName, argSemantic) JOIN(__in_,argSemantic) (argType, argName, argSemantic)
+#define __in_opt(argType, argName, argSemantic) __in_opt2(argType, argName, argSemantic)
+
+#if defined(USE_ALL) || defined(RENDERER_FRAGMENT)
+#define USE_POSITION 1
+#define USE_NORMAL 1
+#define USE_TANGENT 1
+#define USE_TEXCOORD0 1
+#define USE_TEXCOORD1 1
+#define USE_TEXCOORD2 1
+#define USE_TEXCOORD3 1
+#define USE_COLOR 1
+#define USE_BONE 1
+#endif
+
+#define __in_POSITION(a,b,c) __in(a, b, c)
+
+// These semantics are required, not optional, when specified in a shader argument list
+#define __in_TEXCOORD6(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD7(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD8(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD9(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD10(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD11(a,b,c) , __in(a, b, c)
+//#define __in_TEXCOORD12(a,b,c) , __in(a, b, c) // Optional instance semantic for uv offsets
+//#define __in_TEXCOORD13(a,b,c) , __in(a, b, c) // Optional instance semantic for local offsets
+#define __in_TEXCOORD14(a,b,c) , __in(a, b, c)
+//#define __in_TEXCOORD15(a,b,c) , __in(a, b, c) // Optional displacement semantic
+#define __in_TEXCOORD16(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD17(a,b,c) , __in(a, b, c)
+
+#if USE_NORMAL
+#define __in_NORMAL(a,b,c) , __in(a, b, c)
+#else
+#define __in_NORMAL(a,b,c)
+#define localSpaceNormal float3(1,0,0)
+#endif
+#if USE_TANGENT
+#define __in_TANGENT(a,b,c) , __in(a, b, c)
+#define __in_TEXCOORD5(a,b,c) , __in(a, b, c)
+#else
+#define __in_TANGENT(a,b,c)
+#define __in_TEXCOORD5(a,b,c)
+#define localSpaceTangent float4(1,0,0,1)
+#endif
+#if USE_TEXCOORD0
+#define __in_TEXCOORD0(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD0(a,b,c)
+#define vertexTexcoord0 float4(0,0,0,0)
+#endif
+#if USE_TEXCOORD1
+#define __in_TEXCOORD1(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD1(A,B,C)
+#define vertexTexcoord1 float4(0,0,0,0)
+#endif
+#if USE_TEXCOORD2
+#define __in_TEXCOORD2(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD2(a,b,c)
+#define vertexTexcoord2 float4(0,0,0,0)
+#endif
+#if USE_TEXCOORD3
+#define __in_TEXCOORD3(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD3(a,b,c)
+#define vertexTexcoord3 float4(0,0,0,0)
+#endif
+#if USE_COLOR
+#define __in_COLOR(a,b,c) , __in(a, b, c)
+#else
+#define __in_COLOR(a,b,c)
+#define vertexColor half4(0,0,0,0)
+#endif
+#if USE_TEXCOORD12
+#define __in_TEXCOORD12(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD12(a,b,c)
+#define instanceUVOffset float2(0,0)
+#endif
+#if USE_TEXCOORD13
+#define __in_TEXCOORD13(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD13(a,b,c)
+#define instanceLocalOffset float3(0,0,0)
+#endif
+#if USE_TEXCOORD15
+#define __in_TEXCOORD15(a,b,c) , __in(a, b, c)
+#else
+#define __in_TEXCOORD15(a,b,c)
+#define vertexFlagsDisp 0
+#endif
+
+#endif /* !defined(RENDERER_D3D11) */
+
+#endif