您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

43 行
930 B

#ifndef __SHADERBASE_H__
#define __SHADERBASE_H__
// can't use UNITY_REVERSED_Z since it's not enabled in compute shaders
#if !defined(SHADER_API_GLES3) && !defined(SHADER_API_GLCORE)
#define REVERSE_ZBUF
#endif
#ifdef SHADER_API_PSSL
#ifndef Texture2DMS
#define Texture2DMS MS_Texture2D
#endif
#ifndef SampleCmpLevelZero
#define SampleCmpLevelZero SampleCmpLOD0
#endif
#ifndef firstbithigh
#define firstbithigh FirstSetBit_Hi
#endif
#endif
float FetchDepth(Texture2D depthTexture, uint2 pixCoord)
{
float zdpth = LOAD_TEXTURE2D(depthTexture, pixCoord.xy).x;
#ifdef REVERSE_ZBUF
zdpth = 1.0 - zdpth;
#endif
return zdpth;
}
float FetchDepthMSAA(Texture2DMS<float> depthTexture, uint2 pixCoord, uint sampleIdx)
{
float zdpth = LOAD_TEXTURE2D_MSAA(depthTexture, pixCoord.xy, sampleIdx).x;
#ifdef REVERSE_ZBUF
zdpth = 1.0 - zdpth;
#endif
return zdpth;
}
#endif