From 4cb7b7138a3f4b7ef8f1d3764b3fc9529bd01c61 Mon Sep 17 00:00:00 2001
From: IchorDev <15670465+ichordev@users.noreply.github.com>
Date: Wed, 13 Mar 2024 01:01:27 +1000
Subject: [PATCH] Fix `dispatch_indirect` still using `uint16_t` in bgfx.idl
(#3268)
* Fix error in dynamic version of D bindings
Dazed and confused but trying to continue
* Fix dispatch_indirect still using uint16_t in bgfx.idl
---
bindings/bf/bgfx.bf | 2 +-
bindings/cs/bgfx.cs | 2 +-
bindings/d/package.d | 2 +-
bindings/zig/bgfx.zig | 4 ++--
include/bgfx/c99/bgfx.h | 4 ++--
scripts/bgfx.idl | 4 ++--
src/bgfx.idl.inl | 2 +-
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/bindings/bf/bgfx.bf b/bindings/bf/bgfx.bf
index 6637141947..f1e634a8da 100644
--- a/bindings/bf/bgfx.bf
+++ b/bindings/bf/bgfx.bf
@@ -4672,7 +4672,7 @@ public static class bgfx
/// Discard or preserve states. See `BGFX_DISCARD_*`.
///
[LinkName("bgfx_dispatch_indirect")]
- public static extern void dispatch_indirect(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16 _start, uint16 _num, uint8 _flags);
+ public static extern void dispatch_indirect(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint32 _start, uint32 _num, uint8 _flags);
///
/// Discard previously set state for draw or compute call.
diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs
index f8a19b6f88..ed5430ff87 100644
--- a/bindings/cs/bgfx.cs
+++ b/bindings/cs/bgfx.cs
@@ -4628,7 +4628,7 @@ public struct VertexLayoutHandle {
/// Discard or preserve states. See `BGFX_DISCARD_*`.
///
[DllImport(DllName, EntryPoint="bgfx_dispatch_indirect", CallingConvention = CallingConvention.Cdecl)]
- public static extern unsafe void dispatch_indirect(ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, byte _flags);
+ public static extern unsafe void dispatch_indirect(ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint _start, uint _num, byte _flags);
///
/// Discard previously set state for draw or compute call.
diff --git a/bindings/d/package.d b/bindings/d/package.d
index 8fa5c0e0ba..5f7e5e7a02 100644
--- a/bindings/d/package.d
+++ b/bindings/d/package.d
@@ -3507,7 +3507,7 @@ mixin(joinFnBinds((){
num = Number of dispatches.
flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
- {q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, ushort start=0, ushort num=1, ubyte flags=Discard.all}, ext: `C++, "bgfx"`},
+ {q{void}, q{dispatch}, q{ViewID id, ProgramHandle program, IndirectBufferHandle indirectHandle, uint start=0, uint num=1, ubyte flags=Discard.all}, ext: `C++, "bgfx"`},
/**
* Discard previously set state for draw or compute call.
diff --git a/bindings/zig/bgfx.zig b/bindings/zig/bgfx.zig
index aa0fc0be7e..8114e0a253 100644
--- a/bindings/zig/bgfx.zig
+++ b/bindings/zig/bgfx.zig
@@ -3681,10 +3681,10 @@ extern fn bgfx_dispatch(_id: ViewId, _program: ProgramHandle, _numX: u32, _numY:
/// First element in indirect buffer.
/// Number of dispatches.
/// Discard or preserve states. See `BGFX_DISCARD_*`.
-pub inline fn dispatchIndirect(_id: ViewId, _program: ProgramHandle, _indirectHandle: IndirectBufferHandle, _start: u16, _num: u16, _flags: u8) void {
+pub inline fn dispatchIndirect(_id: ViewId, _program: ProgramHandle, _indirectHandle: IndirectBufferHandle, _start: u32, _num: u32, _flags: u8) void {
return bgfx_dispatch_indirect(_id, _program, _indirectHandle, _start, _num, _flags);
}
-extern fn bgfx_dispatch_indirect(_id: ViewId, _program: ProgramHandle, _indirectHandle: IndirectBufferHandle, _start: u16, _num: u16, _flags: u8) void;
+extern fn bgfx_dispatch_indirect(_id: ViewId, _program: ProgramHandle, _indirectHandle: IndirectBufferHandle, _start: u32, _num: u32, _flags: u8) void;
/// Discard previously set state for draw or compute call.
/// Draw/compute states to discard.
diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h
index b76d30413b..dc8f9180bf 100644
--- a/include/bgfx/c99/bgfx.h
+++ b/include/bgfx/c99/bgfx.h
@@ -3395,7 +3395,7 @@ BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program
* @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
*
*/
-BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags);
+BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint32_t _start, uint32_t _num, uint8_t _flags);
/**
* Discard previously set state for draw or compute call.
@@ -3829,7 +3829,7 @@ struct bgfx_interface_vtbl
void (*set_compute_indirect_buffer)(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
void (*set_image)(uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
void (*dispatch)(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags);
- void (*dispatch_indirect)(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags);
+ void (*dispatch_indirect)(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint32_t _start, uint32_t _num, uint8_t _flags);
void (*discard)(uint8_t _flags);
void (*blit)(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth);
};
diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl
index e55740f948..b8ba53dbfe 100644
--- a/scripts/bgfx.idl
+++ b/scripts/bgfx.idl
@@ -3133,9 +3133,9 @@ func.dispatch { cname = "dispatch_indirect" }
.id "ViewId" --- View id.
.program "ProgramHandle" --- Compute program.
.indirectHandle "IndirectBufferHandle" --- Indirect buffer.
- .start "uint16_t" --- First element in indirect buffer.
+ .start "uint32_t" --- First element in indirect buffer.
{ default = 0 }
- .num "uint16_t" --- Number of dispatches.
+ .num "uint32_t" --- Number of dispatches.
{ default = 1 }
.flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
{ default = "BGFX_DISCARD_ALL" }
diff --git a/src/bgfx.idl.inl b/src/bgfx.idl.inl
index be42fe4ebf..06bef38ba5 100644
--- a/src/bgfx.idl.inl
+++ b/src/bgfx.idl.inl
@@ -1214,7 +1214,7 @@ BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program
bgfx::dispatch((bgfx::ViewId)_id, program.cpp, _numX, _numY, _numZ, _flags);
}
-BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags)
+BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint32_t _start, uint32_t _num, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };