|
|
|
|
|
|
// This file assume SHADER_API_GLES3 is defined |
|
|
|
// Same as GLCore |
|
|
|
|
|
|
|
#define UNITY_UV_STARTS_AT_TOP 0 |
|
|
|
#define UNITY_REVERSED_Z 0 |
|
|
|
|
|
|
#define FRONT_FACE_SEMATIC VFACE |
|
|
|
#define FRONT_FACE_TYPE float |
|
|
|
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL > 0.0) ? (FRONT) : (BACK)) |
|
|
|
|
|
|
|
#define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error ##funcName is not supported on GLES 3.0 |
|
|
|
|
|
|
|
#define CBUFFER_START(name) |
|
|
|
#define CBUFFER_END |
|
|
|
|
|
|
|
|
|
|
// Texture abstraction |
|
|
|
|
|
|
|
#define TEXTURE2D(textureName) Texture2D textureName |
|
|
|
#define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName |
|
|
|
#define TEXTURECUBE(textureName) TextureCube textureName |
|
|
|
#define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName |
|
|
|
#define TEXTURE3D(textureName) Texture3D textureName |
|
|
|
#define TEXTURE2D_SHADOW(textureName) Texture2D textureName |
|
|
|
#define TEXTURECUBE_SHADOW(textureName) TextureCube textureName |
|
|
|
#define RW_TEXTURE2D(type, textureNam) |
|
|
|
#define TEXTURE2D(textureName) Texture2D textureName |
|
|
|
#define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName |
|
|
|
#define TEXTURECUBE(textureName) TextureCube textureName |
|
|
|
#define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName |
|
|
|
#define TEXTURE3D(textureName) Texture3D textureName |
|
|
|
#define SAMPLER2D(samplerName) SamplerState samplerName |
|
|
|
#define SAMPLERCUBE(samplerName) SamplerState samplerName |
|
|
|
#define SAMPLER3D(samplerName) SamplerState samplerName |
|
|
|
#define SAMPLER2D_SHADOW(samplerName) SamplerComparisonState samplerName |
|
|
|
#define SAMPLERCUBE_SHADOW(samplerName) SamplerComparisonState samplerName |
|
|
|
#define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) |
|
|
|
#define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) |
|
|
|
#define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) |
|
|
|
#define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) |
|
|
|
#define TEXTURE2D_ARGS(textureName, samplerName) Texture2D textureName, SamplerState samplerName |
|
|
|
#define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) Texture2DArray textureName, SamplerState samplerName |
|
|
|
#define TEXTURECUBE_ARGS(textureName, samplerName) TextureCube textureName, SamplerState samplerName |
|
|
|
#define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) TextureCubeArray textureName, SamplerState samplerName |
|
|
|
#define TEXTURE3D_ARGS(textureName, samplerName) Texture3D textureName, SamplerState samplerName |
|
|
|
#define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) Texture2D textureName, SamplerComparisonState samplerName |
|
|
|
#define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) Texture2DArray textureName, SamplerComparisonState samplerName |
|
|
|
#define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) TextureCube textureName, SamplerComparisonState samplerName |
|
|
|
#define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) |
|
|
|
#define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) |
|
|
|
#define TEXTURE2D_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURECUBE_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURE3D_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define SAMPLER(samplerName) SamplerState samplerName |
|
|
|
#define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName |
|
|
|
|
|
|
|
#define TEXTURE2D_ARGS(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) |
|
|
|
#define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) |
|
|
|
#define TEXTURECUBE_ARGS(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) |
|
|
|
#define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) |
|
|
|
#define TEXTURE3D_ARGS(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) |
|
|
|
|
|
|
|
#define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) |
|
|
|
#define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) |
|
|
|
#define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) |
|
|
|
#define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) |
|
|
|
|
|
|
|
#define TEXTURE2D_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURECUBE_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURE3D_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
|
|
|
|
#define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) textureName, samplerName |
|
|
|
#define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) |
|
|
|
#define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) |
|
|
|
#define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) |
|
|
|
#define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) |
|
|
|
#define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) |
|
|
|
#define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) |
|
|
|
#define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) |
|
|
|
#define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) |
|
|
|
#define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) |
|
|
|
#define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) |
|
|
|
#define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) |
|
|
|
#define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) |
|
|
|
#define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) |
|
|
|
#define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) |
|
|
|
#define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) |
|
|
|
#define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) |
|
|
|
#define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) |
|
|
|
#define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) |
|
|
|
#define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) |
|
|
|
#define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) |
|
|
|
#define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) |
|
|
|
#define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) |
|
|
|
#define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) |
|
|
|
#define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) |
|
|
|
#define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) |
|
|
|
#define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) |
|
|
|
#define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) |
|
|
|
#define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord3).xyz, (coord3).w) |
|
|
|
#define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) |
|
|
|
#define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) |
|
|
|
#define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r |
|
|
|
#define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r |
|
|
|
#define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) |
|
|
|
#define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) |
|
|
|
#define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord3).xyz, (coord3).w) |
|
|
|
#define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) |
|
|
|
#define TEXTURE2D_HALF TEXTURE2D |
|
|
|
#define TEXTURE2D_FLOAT TEXTURE2D |
|
|
|
#define TEXTURE3D_HALF TEXTURE3D |
|
|
|
#define TEXTURE3D_FLOAT TEXTURE3D |
|
|
|
#define SAMPLER2D_HALF SAMPLER2D |
|
|
|
#define SAMPLER2D_FLOAT SAMPLER2D |
|
|
|
#define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r |
|
|
|
#define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r |
|
|
|
|
|
|
|
#define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) |
|
|
|
#define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) |
|
|
|
|
|
|
|
|
|
|
#if (SHADER_TARGET >= 45) |
|
|
|
#define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) |
|
|
|
#define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) |
|
|
|
#define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) |
|
|
|
#define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) |
|
|
|
#define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) |
|
|
|
#define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) |
|
|
|
#define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) |
|
|
|
#define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) |
|
|
|
#define GATHER_TEXTURE2D(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) |
|
|
|
#define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) |
|
|
|
#define GATHER_TEXTURECUBE(textureName, samplerName, coord3) SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) |
|
|
|
#define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) |
|
|
|
#define GATHER_TEXTURE2D(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) |
|
|
|
#define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) |
|
|
|
#define GATHER_TEXTURECUBE(textureName, samplerName, coord3) SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) |
|
|
|
#define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) |
|
|
|
#endif |
|
|
|
|