mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Fixed compute unsigned image.
This commit is contained in:
parent
f07a7aa56e
commit
5a4afee0ea
3 changed files with 41 additions and 12 deletions
|
@ -16,15 +16,22 @@ float uintBitsToFloat(uint _x) { return asfloat(_x); }
|
||||||
vec2 uintBitsToFloat(uint2 _x) { return asfloat(_x); }
|
vec2 uintBitsToFloat(uint2 _x) { return asfloat(_x); }
|
||||||
vec3 uintBitsToFloat(uint3 _x) { return asfloat(_x); }
|
vec3 uintBitsToFloat(uint3 _x) { return asfloat(_x); }
|
||||||
vec4 uintBitsToFloat(uint4 _x) { return asfloat(_x); }
|
vec4 uintBitsToFloat(uint4 _x) { return asfloat(_x); }
|
||||||
|
|
||||||
uint floatBitsToUint(float _x) { return asuint(_x); }
|
uint floatBitsToUint(float _x) { return asuint(_x); }
|
||||||
uvec2 floatBitsToUint(vec2 _x) { return asuint(_x); }
|
uvec2 floatBitsToUint(vec2 _x) { return asuint(_x); }
|
||||||
uvec3 floatBitsToUint(vec3 _x) { return asuint(_x); }
|
uvec3 floatBitsToUint(vec3 _x) { return asuint(_x); }
|
||||||
uvec4 floatBitsToUint(vec4 _x) { return asuint(_x); }
|
uvec4 floatBitsToUint(vec4 _x) { return asuint(_x); }
|
||||||
|
|
||||||
int floatBitsToInt(float _x) { return asint(_x); }
|
int floatBitsToInt(float _x) { return asint(_x); }
|
||||||
ivec2 floatBitsToInt(vec2 _x) { return asint(_x); }
|
ivec2 floatBitsToInt(vec2 _x) { return asint(_x); }
|
||||||
ivec3 floatBitsToInt(vec3 _x) { return asint(_x); }
|
ivec3 floatBitsToInt(vec3 _x) { return asint(_x); }
|
||||||
ivec4 floatBitsToInt(vec4 _x) { return asint(_x); }
|
ivec4 floatBitsToInt(vec4 _x) { return asint(_x); }
|
||||||
|
|
||||||
|
uint bitfieldReverse(uint _x) { return reversebits(_x); }
|
||||||
|
uint2 bitfieldReverse(uint2 _x) { return reversebits(_x); }
|
||||||
|
uint3 bitfieldReverse(uint3 _x) { return reversebits(_x); }
|
||||||
|
uint4 bitfieldReverse(uint4 _x) { return reversebits(_x); }
|
||||||
|
|
||||||
uint packHalf2x16(vec2 _x)
|
uint packHalf2x16(vec2 _x)
|
||||||
{
|
{
|
||||||
return (f32tof16(_x.x)<<16) | f32tof16(_x.y);
|
return (f32tof16(_x.x)<<16) | f32tof16(_x.y);
|
||||||
|
@ -52,14 +59,16 @@ vec4 imageLoad(Texture2D _image, ivec2 _uv)
|
||||||
return _image.Load(uint3(_uv.xy, 0) );
|
return _image.Load(uint3(_uv.xy, 0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint imageLoad(Texture2D<uint> _image, ivec2 _uv)
|
uint4 imageLoad(Texture2D<uint> _image, ivec2 _uv)
|
||||||
{
|
{
|
||||||
return _image.Load(uint3(_uv.xy, 0) );
|
uint rr = _image.Load(uint3(_uv.xy, 0) );
|
||||||
|
return uint4(rr, rr, rr, rr);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint imageLoad(RWTexture2D<uint> _image, ivec2 _uv)
|
uint4 imageLoad(RWTexture2D<uint> _image, ivec2 _uv)
|
||||||
{
|
{
|
||||||
return _image[_uv.xy];
|
uint rr = _image[_uv.xy];
|
||||||
|
return uint4(rr, rr, rr, rr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ivec2 imageSize(Texture2D _image)
|
ivec2 imageSize(Texture2D _image)
|
||||||
|
|
|
@ -2554,6 +2554,10 @@ namespace bgfx
|
||||||
GLSL_TYPE(GL_IMAGE_2D);
|
GLSL_TYPE(GL_IMAGE_2D);
|
||||||
GLSL_TYPE(GL_IMAGE_3D);
|
GLSL_TYPE(GL_IMAGE_3D);
|
||||||
GLSL_TYPE(GL_IMAGE_CUBE);
|
GLSL_TYPE(GL_IMAGE_CUBE);
|
||||||
|
GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_1D);
|
||||||
|
GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_2D);
|
||||||
|
GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_3D);
|
||||||
|
GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_CUBE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef GLSL_TYPE
|
#undef GLSL_TYPE
|
||||||
|
|
|
@ -472,6 +472,22 @@ typedef uint64_t GLuint64;
|
||||||
# define GL_IMAGE_CUBE 0x9050
|
# define GL_IMAGE_CUBE 0x9050
|
||||||
#endif // GL_IMAGE_CUBE
|
#endif // GL_IMAGE_CUBE
|
||||||
|
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_1D
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_1D 0x9062
|
||||||
|
#endif // GL_UNSIGNED_INT_IMAGE_1D
|
||||||
|
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_2D
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_2D 0x9063
|
||||||
|
#endif // GL_UNSIGNED_INT_IMAGE_2D
|
||||||
|
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_3D
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_3D 0x9064
|
||||||
|
#endif // GL_UNSIGNED_INT_IMAGE_3D
|
||||||
|
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_CUBE
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
|
||||||
|
#endif // GL_UNSIGNED_INT_IMAGE_CUBE
|
||||||
|
|
||||||
#ifndef GL_PROGRAM_INPUT
|
#ifndef GL_PROGRAM_INPUT
|
||||||
# define GL_PROGRAM_INPUT 0x92E3
|
# define GL_PROGRAM_INPUT 0x92E3
|
||||||
#endif // GL_PROGRAM_INPUT
|
#endif // GL_PROGRAM_INPUT
|
||||||
|
|
Loading…
Reference in a new issue