mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
Add support for 3D textures in compute shaders.
This commit is contained in:
parent
9c9dc90336
commit
933d59591b
1 changed files with 24 additions and 0 deletions
|
@ -57,6 +57,13 @@ vec2 unpackHalf2x16(uint _x)
|
|||
#define IMAGE2D_RW( _name, _reg) RWTexture2D<float> _name : register(u[_reg])
|
||||
#define UIMAGE2D_RW(_name, _reg) RWTexture2D<uint> _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<float> _name : register(u[_reg])
|
||||
#define UIMAGE3D_RW(_name, _reg) RWTexture3D<uint> _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 \
|
||||
{ \
|
||||
|
|
Loading…
Reference in a new issue