0ad/binaries/data/mods/mod/shaders/glsl/common/compute.h
Vladislav Belov b3165505b6
Fixes possible artifacts with GPU skinning on GL
std140 requires 16 bytes alignment and it makes alignment of uvec2 in
SkinData be equal to 16 bytes instead of 8 bytes.
2026-07-28 18:12:21 +02:00

31 lines
874 B
C

#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
#if USE_DESCRIPTOR_INDEXING
#define STORAGE_BUFFER(LOCATION) \
layout(std430, set = 2, binding = LOCATION)
#else
#define STORAGE_BUFFER(LOCATION) \
layout(std430, set = 1, binding = LOCATION)
#endif
#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
#define STORAGE_BUFFER(LOCATION) \
layout(std430, binding = LOCATION)
#endif
#endif // STAGE_COMPUTE
#endif // INCLUDED_COMMON_COMPUTE