|
|
|
|
|
|
#define TEXTURE_CACHE_BORDER 2 |
|
|
|
#define TEXTURE_CACHE_SIZE_1D (GROUP_SIZE_1D + 2 * TEXTURE_CACHE_BORDER) |
|
|
|
|
|
|
|
// Check for support of typed UAV loads from FORMAT_R16G16B16A16_FLOAT. |
|
|
|
#if defined(SHADER_API_PSSL) || defined(SHADER_API_XBOXONE) |
|
|
|
#define TYPED_UAV_LOAD_FORMAT_R16G16B16A16_FLOAT |
|
|
|
#if !(defined(SHADER_API_PSSL) || defined(SHADER_API_XBOXONE)) |
|
|
|
#define USE_INTERMEDIATE_BUFFER |
|
|
|
#endif |
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------------------------- |
|
|
|
|
|
|
TEXTURE2D(_HTile); // DXGI_FORMAT_R8_UINT is not supported by Unity |
|
|
|
TEXTURE2D(_IrradianceSource); // Includes transmitted light |
|
|
|
|
|
|
|
#ifdef TYPED_UAV_LOAD_FORMAT_R16G16B16A16_FLOAT |
|
|
|
RW_TEXTURE2D(float4, _CameraColorTexture); // Target texture |
|
|
|
#else |
|
|
|
#ifdef USE_INTERMEDIATE_BUFFER |
|
|
|
#else |
|
|
|
RW_TEXTURE2D(float4, _CameraColorTexture); // Target texture |
|
|
|
#endif |
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
void WriteResult(uint2 pixelCoord, float3 irradiance) |
|
|
|
{ |
|
|
|
#ifdef TYPED_UAV_LOAD_FORMAT_R16G16B16A16_FLOAT |
|
|
|
_CameraColorTexture[pixelCoord] += float4(irradiance, 0); |
|
|
|
#else |
|
|
|
#ifdef USE_INTERMEDIATE_BUFFER |
|
|
|
#else |
|
|
|
_CameraColorTexture[pixelCoord] += float4(irradiance, 0); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|