2024-01-17 11:40:27 -08:00
|
|
|
#ifndef INCLUDED_COMMON_COMPUTE
|
|
|
|
|
#define INCLUDED_COMMON_COMPUTE
|
|
|
|
|
|
|
|
|
|
#include "common/descriptor_indexing.h"
|
|
|
|
|
#include "common/texture.h"
|
|
|
|
|
#include "common/uniform.h"
|
|
|
|
|
|
|
|
|
|
#if STAGE_COMPUTE
|
|
|
|
|
|
|
|
|
|
#if USE_SPIRV
|
|
|
|
|
#define STORAGE_2D(LOCATION, FORMAT, NAME) \
|
|
|
|
|
layout(set = 2, binding = LOCATION, FORMAT) uniform image2D NAME
|
2024-12-09 13:47:07 -08:00
|
|
|
#if USE_DESCRIPTOR_INDEXING
|
|
|
|
|
#define STORAGE_BUFFER(LOCATION) \
|
2026-07-28 09:12:21 -07:00
|
|
|
layout(std430, set = 2, binding = LOCATION)
|
2024-12-09 13:47:07 -08:00
|
|
|
#else
|
|
|
|
|
#define STORAGE_BUFFER(LOCATION) \
|
2026-07-28 09:12:21 -07:00
|
|
|
layout(std430, set = 1, binding = LOCATION)
|
2024-12-09 13:47:07 -08:00
|
|
|
#endif
|
2024-01-17 11:40:27 -08:00
|
|
|
#else
|
|
|
|
|
// We use offset to the binding slot for OpenGL to avoid overlapping with other
|
|
|
|
|
// textures as OpenGL doesn't have sets.
|
|
|
|
|
#define STORAGE_2D(LOCATION, FORMAT, NAME) \
|
|
|
|
|
layout(binding = LOCATION, FORMAT) uniform image2D NAME
|
2024-12-09 13:47:07 -08:00
|
|
|
#define STORAGE_BUFFER(LOCATION) \
|
2026-07-28 09:12:21 -07:00
|
|
|
layout(std430, binding = LOCATION)
|
2024-01-17 11:40:27 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // STAGE_COMPUTE
|
|
|
|
|
|
|
|
|
|
#endif // INCLUDED_COMMON_COMPUTE
|