diff --git a/src/bgfx_compute.sh b/src/bgfx_compute.sh index eb405e45..312e4ba9 100644 --- a/src/bgfx_compute.sh +++ b/src/bgfx_compute.sh @@ -57,6 +57,13 @@ vec2 unpackHalf2x16(uint _x) #define IMAGE2D_RW( _name, _reg) RWTexture2D _name : register(u[_reg]) #define UIMAGE2D_RW(_name, _reg) RWTexture2D _name : register(u[_reg]) +#define IMAGE3D_RO( _name, _format, _reg) Texture3D<_format> _name : register(t[_reg]) +#define UIMAGE3D_RO(_name, _format, _reg) Texture3D<_format> _name : register(t[_reg]) +#define IMAGE3D_WR( _name, _format, _reg) RWTexture3D<_format> _name : register(u[_reg]) +#define UIMAGE3D_WR(_name, _format, _reg) RWTexture3D<_format> _name : register(u[_reg]) +#define IMAGE3D_RW( _name, _reg) RWTexture3D _name : register(u[_reg]) +#define UIMAGE3D_RW(_name, _reg) RWTexture3D _name : register(u[_reg]) + #define BUFFER_RO(_name, _struct, _reg) Buffer<_struct> _name : register(t[_reg]) #define BUFFER_RW(_name, _struct, _reg) RWBuffer<_struct> _name : register(u[_reg]) #define BUFFER_WR(_name, _struct, _reg) BUFFER_RW(_name, _struct, _reg) @@ -70,6 +77,16 @@ vec2 unpackHalf2x16(uint _x) } \ \ void imageStore(RWTexture2D<_textureType> _image, ivec2 _uv, _type _value) \ + { \ + _image[_uv] = _value._storeComponents; \ + } \ + \ + _type imageLoad(Texture3D<_textureType> _image, ivec3 _uv) \ + { \ + return _image[_uv]._loadComponents; \ + } \ + \ + void imageStore(RWTexture3D<_textureType> _image, ivec3 _uv, _type _value) \ { \ _image[_uv] = _value._storeComponents; \ } @@ -180,6 +197,13 @@ uint atomicCompSwap(uint _mem, uint _compare, uint _data) #define IMAGE2D_RW( _name, _reg) __IMAGE_XX(_name, r32f, _reg, image2D, readwrite) #define UIMAGE2D_RW(_name, _reg) __IMAGE_XX(_name, r32ui, _reg, uimage2D, readwrite) +#define IMAGE3D_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image3D, readonly) +#define UIMAGE3D_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage3D, readonly) +#define IMAGE3D_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image3D, writeonly) +#define UIMAGE3D_WR(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage3D, writeonly) +#define IMAGE3D_RW( _name, _reg) __IMAGE_XX(_name, r32f, _reg, image2D, readwrite) +#define UIMAGE3D_RW(_name, _reg) __IMAGE_XX(_name, r32ui, _reg, uimage2D, readwrite) + #define __BUFFER_XX(_name, _type, _reg, _access) \ layout(std430, binding=_reg) _access buffer _name ## Buffer \ { \