Initial compute support.

This commit is contained in:
Branimir Karadžić
2014-07-20 20:27:13 -07:00
parent 2db00e3351
commit 62b620a1a0
17 changed files with 1618 additions and 441 deletions

View File

@@ -49,6 +49,18 @@ namespace bgfx
};
};
struct Access
{
enum Enum
{
Read,
Write,
ReadWrite,
Count
};
};
struct Attrib
{
enum Enum // corresponds to vertex shader attribute:
@@ -1082,7 +1094,16 @@ namespace bgfx
///
uint32_t submitMask(uint32_t _viewMask, int32_t _depth = 0);
/// Discard all previously set state for draw call.
///
void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access);
///
void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, TextureFormat::Enum _format, Access::Enum _access);
/// Dispatch compute.
void dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX = 1, uint16_t _numY = 1, uint16_t _numZ = 1);
/// Discard all previously set state for draw or compute call.
void discard();
/// Request screen shot.

View File

@@ -236,6 +236,7 @@
#define BGFX_TEXTURE_COMPARE_ALWAYS UINT32_C(0x00080000)
#define BGFX_TEXTURE_COMPARE_SHIFT 16
#define BGFX_TEXTURE_COMPARE_MASK UINT32_C(0x000f0000)
#define BGFX_TEXTURE_COMPUTE_WRITE UINT32_C(0x00100000)
#define BGFX_TEXTURE_RESERVED_SHIFT 24
#define BGFX_TEXTURE_RESERVED_MASK UINT32_C(0xff000000)
@@ -295,6 +296,7 @@
#define BGFX_CAPS_RENDERER_MULTITHREADED UINT64_C(0x0000000020000000)
#define BGFX_CAPS_FRAGMENT_DEPTH UINT64_C(0x0000000040000000)
#define BGFX_CAPS_BLEND_INDEPENDENT UINT64_C(0x0000000080000000)
#define BGFX_CAPS_COMPUTE UINT64_C(0x0000000100000000)
#define BGFX_CAPS_TEXTURE_DEPTH_MASK (0 \
| BGFX_CAPS_TEXTURE_FORMAT_D16 \