|
|
|
|
|
|
out float4 MERGE_NAME(NAME, 2) : SV_Target2 |
|
|
|
|
|
|
|
#define DECLARE_GBUFFER_TEXTURE(NAME) \ |
|
|
|
Texture2D MERGE_NAME(NAME, 0); \ |
|
|
|
Texture2D MERGE_NAME(NAME, 1); \ |
|
|
|
Texture2D MERGE_NAME(NAME, 2); |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 0)); \ |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 1)); \ |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 2)); |
|
|
|
float4 MERGE_NAME(NAME, 0) = MERGE_NAME(TEX, 0).Load(uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 1) = MERGE_NAME(TEX, 1).Load(uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 2) = MERGE_NAME(TEX, 2).Load(uint3(UV, 0)); |
|
|
|
float4 MERGE_NAME(NAME, 0) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 0), uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 1) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 1), uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 2) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 2), uint3(UV, 0)); |
|
|
|
|
|
|
|
#define ENCODE_INTO_GBUFFER(SURFACE_DATA, NAME) EncodeIntoGBuffer(SURFACE_DATA, MERGE_NAME(NAME,0), MERGE_NAME(NAME,1), MERGE_NAME(NAME,2)) |
|
|
|
#define DECODE_FROM_GBUFFER(NAME) DecodeFromGBuffer(MERGE_NAME(NAME,0), MERGE_NAME(NAME,1), MERGE_NAME(NAME,2)) |
|
|
|
|
|
|
out float4 MERGE_NAME(NAME, 3) : SV_Target3 |
|
|
|
|
|
|
|
#define DECLARE_GBUFFER_TEXTURE(NAME) \ |
|
|
|
Texture2D MERGE_NAME(NAME, 0); \ |
|
|
|
Texture2D MERGE_NAME(NAME, 1); \ |
|
|
|
Texture2D MERGE_NAME(NAME, 2); \ |
|
|
|
Texture2D MERGE_NAME(NAME, 3); |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 0)); \ |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 1)); \ |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 2)); \ |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 3)); |
|
|
|
float4 MERGE_NAME(NAME, 0) = MERGE_NAME(TEX, 0).Load(uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 1) = MERGE_NAME(TEX, 1).Load(uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 2) = MERGE_NAME(TEX, 2).Load(uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 3) = MERGE_NAME(TEX, 3).Load(uint3(UV, 0)); |
|
|
|
float4 MERGE_NAME(NAME, 0) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 0), uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 1) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 1), uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 2) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 2), uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 3) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 3), uint3(UV, 0)); |
|
|
|
|
|
|
|
#define ENCODE_INTO_GBUFFER(SURFACE_DATA, NAME) EncodeIntoGBuffer(SURFACE_DATA, MERGE_NAME(NAME, 0), MERGE_NAME(NAME, 1), MERGE_NAME(NAME, 2), MERGE_NAME(NAME, 3)) |
|
|
|
#define DECODE_FROM_GBUFFER(NAME) DecodeFromGBuffer(MERGE_NAME(NAME, 0), MERGE_NAME(NAME, 1), MERGE_NAME(NAME, 2), MERGE_NAME(NAME, 3)) |
|
|
|
|
|
|
out float4 MERGE_NAME(NAME, 4) : SV_Target4 |
|
|
|
|
|
|
|
#define DECLARE_GBUFFER_TEXTURE(NAME) \ |
|
|
|
Texture2D MERGE_NAME(NAME, 0); \ |
|
|
|
Texture2D MERGE_NAME(NAME, 1); \ |
|
|
|
Texture2D MERGE_NAME(NAME, 2); \ |
|
|
|
Texture2D MERGE_NAME(NAME, 3); \ |
|
|
|
Texture2D MERGE_NAME(NAME, 4); |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 0)); \ |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 1)); \ |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 2)); \ |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 3)); \ |
|
|
|
TEXTURE2D(MERGE_NAME(NAME, 4)); |
|
|
|
float4 MERGE_NAME(NAME, 0) = MERGE_NAME(TEX, 0).Load(uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 1) = MERGE_NAME(TEX, 1).Load(uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 2) = MERGE_NAME(TEX, 2).Load(uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 3) = MERGE_NAME(TEX, 3).Load(uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 4) = MERGE_NAME(TEX, 4).Load(uint3(UV, 0)); |
|
|
|
float4 MERGE_NAME(NAME, 0) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 0), uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 1) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 1), uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 2) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 2), uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 3) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 3), uint3(UV, 0)); \ |
|
|
|
float4 MERGE_NAME(NAME, 4) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 4), uint3(UV, 0)); |
|
|
|
|
|
|
|
#define ENCODE_INTO_GBUFFER(SURFACE_DATA, NAME) EncodeIntoGBuffer(SURFACE_DATA, MERGE_NAME(NAME, 0), MERGE_NAME(NAME, 1), MERGE_NAME(NAME, 2), MERGE_NAME(NAME, 3), MERGE_NAME(NAME, 4)) |
|
|
|
#define DECODE_FROM_GBUFFER(NAME) DecodeFromGBuffer(MERGE_NAME(NAME, 0), MERGE_NAME(NAME, 1), MERGE_NAME(NAME, 2), MERGE_NAME(NAME, 3), MERGE_NAME(NAME, 4)) |
|
|
|
|
|
|
// Generic whatever the number of GBuffer |
|
|
|
#ifdef VELOCITY_IN_GBUFFER |
|
|
|
#define OUTPUT_GBUFFER_VELOCITY(NAME) out float4 GBUFFER_VELOCITY_NAME(NAME) : GBUFFER_VELOCITY_TARGET(SV_Target) |
|
|
|
#define DECLARE_GBUFFER_VELOCITY_TEXTURE(NAME) Texture2D GBUFFER_VELOCITY_NAME(NAME); |
|
|
|
#define DECLARE_GBUFFER_VELOCITY_TEXTURE(NAME) TEXTURE2D(GBUFFER_VELOCITY_NAME(NAME)); |
|
|
|
#define DECLARE_GBUFFER_BAKE_LIGHTING(NAME) Texture2D GBUFFER_BAKE_LIGHTING_NAME(NAME); |
|
|
|
#define DECLARE_GBUFFER_BAKE_LIGHTING(NAME) TEXTURE2D(GBUFFER_BAKE_LIGHTING_NAME(NAME)); |
|
|
|
#define ENCODE_BAKE_LIGHTING_INTO_GBUFFER(BAKE_DIFFUSE_LIGHTING, NAME) EncodeBakedDiffuseLigthingIntoGBuffer(BAKE_DIFFUSE_LIGHTING, GBUFFER_BAKE_LIGHTING_NAME(NAME)) |
|
|
|
#define FETCH_BAKE_LIGHTING_GBUFFER(NAME, TEX, UV) float4 GBUFFER_BAKE_LIGHTING_NAME(NAME) = GBUFFER_BAKE_LIGHTING_NAME(TEX).Load(uint3(UV, 0)); |
|
|
|
#define DECODE_BAKE_LIGHTING_FROM_GBUFFER(NAME) DecodeBakedDiffuseLigthingFromGBuffer(GBUFFER_BAKE_LIGHTING_NAME(NAME)) |
|
|
|