#ifndef PIPELINE_RESOURCES_GLSL
#define PIPELINE_RESOURCES_GLSL

// Existing colortex ownership. Keep this list synchronized with
// docs/refactor/RESOURCE_MAP.md before changing shaders.properties.
#define FOXY_BUFFER_SCENE_COLOR 0
#define FOXY_BUFFER_CLOUD_SOURCE 1
#define FOXY_BUFFER_GBUFFER_DATA 2
#define FOXY_BUFFER_BLOOM_A 3
#define FOXY_BUFFER_BLOOM_B 4
#define FOXY_BUFFER_VL_SOURCE 5
#define FOXY_BUFFER_VL_RESOLVE 6
#define FOXY_BUFFER_SKY_LUT 7
#define FOXY_BUFFER_CLOUD_HISTORY 8
#define FOXY_BUFFER_CLOUD_META 9
#define FOXY_BUFFER_EXPOSURE_STATE FOXY_BUFFER_CLOUD_META
#define FOXY_BUFFER_CLOUD_SOURCE_META 10
#define FOXY_BUFFER_COMPOSED_SCENE 11
#define FOXY_BUFFER_TAA_SLOT_INPUT FOXY_BUFFER_COMPOSED_SCENE
#define FOXY_BUFFER_TAA_SLOT_OUTPUT FOXY_BUFFER_SCENE_COLOR
#define FOXY_BUFFER_TAA_SLOT_HISTORY 12
#define FOXY_BUFFER_WATER_SURFACE_PAYLOAD 13
#define FOXY_BUFFER_REFLECTION_HISTORY 15

#define FOXY_OWNER_NONE 0
#define FOXY_OWNER_SCENE 1
#define FOXY_OWNER_WATER 2
#define FOXY_OWNER_CLOUDS 3
#define FOXY_OWNER_BLOOM 4
#define FOXY_OWNER_VOLUMETRIC 5
#define FOXY_OWNER_SKY 6
#define FOXY_OWNER_POST_TEMPORAL 7
#define FOXY_OWNER_RAY_PIPELINE 8
#define FOXY_OWNER_VOXEL 9
#define FOXY_OWNER_MATERIAL_REFLECTION 10

#define FOXY_LIFETIME_FRAME 1
#define FOXY_LIFETIME_TRANSIENT 2
#define FOXY_LIFETIME_HISTORY 3
#define FOXY_LIFETIME_LUT 4

#define FOXY_BUFFER_SCENE_COLOR_OWNER FOXY_OWNER_SCENE
#define FOXY_BUFFER_CLOUD_SOURCE_OWNER FOXY_OWNER_CLOUDS
#define FOXY_BUFFER_GBUFFER_DATA_OWNER FOXY_OWNER_SCENE
#define FOXY_BUFFER_BLOOM_A_OWNER FOXY_OWNER_BLOOM
#define FOXY_BUFFER_BLOOM_B_OWNER FOXY_OWNER_BLOOM
#define FOXY_BUFFER_VL_SOURCE_OWNER FOXY_OWNER_VOLUMETRIC
#define FOXY_BUFFER_VL_RESOLVE_OWNER FOXY_OWNER_VOLUMETRIC
#define FOXY_BUFFER_SKY_LUT_OWNER FOXY_OWNER_SKY
#define FOXY_BUFFER_CLOUD_HISTORY_OWNER FOXY_OWNER_CLOUDS
#define FOXY_BUFFER_CLOUD_META_OWNER FOXY_OWNER_CLOUDS
#define FOXY_BUFFER_CLOUD_SOURCE_META_OWNER FOXY_OWNER_CLOUDS
#define FOXY_BUFFER_COMPOSED_SCENE_OWNER FOXY_OWNER_SCENE
#define FOXY_BUFFER_TAA_SLOT_INPUT_OWNER FOXY_BUFFER_COMPOSED_SCENE_OWNER
#define FOXY_BUFFER_TAA_SLOT_OUTPUT_OWNER FOXY_OWNER_POST_TEMPORAL
#define FOXY_BUFFER_TAA_SLOT_HISTORY_OWNER FOXY_OWNER_POST_TEMPORAL
#define FOXY_BUFFER_WATER_SURFACE_PAYLOAD_OWNER FOXY_OWNER_WATER
#define FOXY_BUFFER_REFLECTION_HISTORY_OWNER FOXY_OWNER_MATERIAL_REFLECTION

#define FOXY_BUFFER_SCENE_COLOR_LIFETIME FOXY_LIFETIME_FRAME
#define FOXY_BUFFER_CLOUD_SOURCE_LIFETIME FOXY_LIFETIME_TRANSIENT
#define FOXY_BUFFER_GBUFFER_DATA_LIFETIME FOXY_LIFETIME_FRAME
#define FOXY_BUFFER_BLOOM_A_LIFETIME FOXY_LIFETIME_TRANSIENT
#define FOXY_BUFFER_BLOOM_B_LIFETIME FOXY_LIFETIME_TRANSIENT
#define FOXY_BUFFER_VL_SOURCE_LIFETIME FOXY_LIFETIME_TRANSIENT
#define FOXY_BUFFER_VL_RESOLVE_LIFETIME FOXY_LIFETIME_HISTORY
#define FOXY_BUFFER_SKY_LUT_LIFETIME FOXY_LIFETIME_LUT
#define FOXY_BUFFER_CLOUD_HISTORY_LIFETIME FOXY_LIFETIME_HISTORY
#define FOXY_BUFFER_CLOUD_META_LIFETIME FOXY_LIFETIME_HISTORY
#define FOXY_BUFFER_CLOUD_SOURCE_META_LIFETIME FOXY_LIFETIME_TRANSIENT
#define FOXY_BUFFER_COMPOSED_SCENE_LIFETIME FOXY_LIFETIME_FRAME
#define FOXY_BUFFER_TAA_SLOT_INPUT_LIFETIME FOXY_BUFFER_COMPOSED_SCENE_LIFETIME
#define FOXY_BUFFER_TAA_SLOT_OUTPUT_LIFETIME FOXY_LIFETIME_FRAME
#define FOXY_BUFFER_TAA_SLOT_HISTORY_LIFETIME FOXY_LIFETIME_HISTORY
#define FOXY_BUFFER_WATER_SURFACE_PAYLOAD_LIFETIME FOXY_LIFETIME_TRANSIENT
#define FOXY_BUFFER_REFLECTION_HISTORY_LIFETIME FOXY_LIFETIME_HISTORY

#define FOXY_RESOURCE_UNALLOCATED -1
#define FOXY_RESOURCE_CUSTOM_IMAGE_BASE 100

// Semantic endpoint contracts.  These IDs are bookkeeping only; the actual
// bindings are declared in shaders.properties and images.glsl.
#define FOXY_SCENE_ENDPOINT_CURRENT (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 20)
#define FOXY_LAYER_ENDPOINT_CURRENT (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 21)
#define FOXY_LAYER_ENDPOINT_PREVIOUS (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 22)
#define FOXY_WATER_SEGMENT_CURRENT (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 23)
#define FOXY_MAIN_WATER_PRODUCER_CURRENT (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 24)
#define FOXY_LOD_WATER_PRODUCER_CURRENT (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 25)
#define FOXY_CLOUD_LAYER_CURRENT (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 26)
#define FOXY_SEMANTIC_IMAGE_COUNT 7
#define FOXY_ENDPOINT_OWNER FOXY_OWNER_SCENE
#define FOXY_ENDPOINT_LIFETIME FOXY_LIFETIME_FRAME
#define FOXY_ENDPOINT_HISTORY_OWNER FOXY_OWNER_SCENE
#define FOXY_ENDPOINT_HISTORY_LIFETIME FOXY_LIFETIME_HISTORY

#define FOXY_PT_GBUFFER_CUSTOM_IMAGE_COUNT 0
#define FOXY_PT_GBUFFER_OWNER FOXY_OWNER_RAY_PIPELINE
#define FOXY_PT_GBUFFER_LIFETIME FOXY_LIFETIME_FRAME
#define FOXY_PT_GBUFFER_SURFACE FOXY_BUFFER_GBUFFER_DATA
#define FOXY_PT_GBUFFER_SHADING FOXY_BUFFER_GBUFFER_DATA

#define FOXY_PT_TRACE_IMAGE (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 0)
#define FOXY_PT_TRACE_IMAGE_OWNER FOXY_OWNER_RAY_PIPELINE
#define FOXY_PT_TRACE_IMAGE_LIFETIME FOXY_LIFETIME_FRAME
#define FOXY_PT_TRACE_IMAGE_SCALE 0.5
#define FOXY_PT_HISTORY_SIGNAL_A (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 1)
#define FOXY_PT_HISTORY_SIGNAL_B (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 2)
#define FOXY_PT_HISTORY_META_A (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 3)
#define FOXY_PT_HISTORY_META_B (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 4)
#define FOXY_PT_MOMENTS_A (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 5)
#define FOXY_PT_MOMENTS_B (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 6)
#define FOXY_PT_FILTERED_A (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 7)
#define FOXY_PT_FILTERED (FOXY_RESOURCE_CUSTOM_IMAGE_BASE + 8)
#define FOXY_PT_CUSTOM_IMAGE_COUNT 9
#define FOXY_PT_HISTORY_OWNER FOXY_OWNER_RAY_PIPELINE
#define FOXY_PT_HISTORY_LIFETIME FOXY_LIFETIME_HISTORY
#define FOXY_PT_HISTORY_SCALE 0.5
#define FOXY_PT_FILTER_OWNER FOXY_OWNER_RAY_PIPELINE
#define FOXY_PT_FILTER_LIFETIME FOXY_LIFETIME_TRANSIENT
#define FOXY_PT_FILTER_SCALE 0.5
#define FOXY_RAY_SIGNAL_CURRENT FOXY_PT_TRACE_IMAGE
#define FOXY_RAY_SIGNAL_HISTORY FOXY_PT_HISTORY_SIGNAL_A
#define FOXY_RAY_MOMENTS FOXY_PT_MOMENTS_A

#define FOXY_REFLECTION_HISTORY FOXY_BUFFER_REFLECTION_HISTORY
#define FOXY_REFLECTION_CUSTOM_IMAGE_COUNT 0
#define FOXY_REFLECTION_HISTORY_OWNER FOXY_OWNER_MATERIAL_REFLECTION
#define FOXY_REFLECTION_HISTORY_LIFETIME FOXY_LIFETIME_HISTORY

// Geometry and two four-bit light levels share one 8 MiB SSBO cell payload.
#define FOXY_VOXEL_SSBO_BINDING 0
#define FOXY_VOXEL_SSBO_BYTES 8388608
#define FOXY_IRC_SSBO_BINDING_A 1
#define FOXY_IRC_SSBO_BINDING_B 2
#define FOXY_IRC_SSBO_BYTES_PER_SLOT 159383552
#define FOXY_IRC_EMITTER_FACE_BINDING 4
#define FOXY_IRC_EMITTER_FACE_BYTES 4194304
#define FOXY_IRC_RESOLUTION 128
#define FOXY_IRC_RESOURCE_CELL_SCALE 1
#define FOXY_VOXEL_RADIANCE FOXY_IRC_SSBO_BINDING_A
#define FOXY_VOXEL_OCCUPANCY FOXY_RESOURCE_UNALLOCATED

#endif
