Fixed discard flags.

This commit is contained in:
Бранимир Караџић 2020-04-02 19:04:13 -07:00
parent 83a211efac
commit 06460b8ac2
10 changed files with 210 additions and 163 deletions

View File

@ -533,37 +533,42 @@ public static partial class bgfx
public enum DiscardFlags : uint
{
/// <summary>
/// Discard nothing
/// Preserve everything.
/// </summary>
None = 0x00000000,
/// <summary>
/// Discard only Index Buffer
/// Discard texture sampler and buffer bindings.
/// </summary>
IndexBuffer = 0x00000001,
Bindings = 0x00000001,
/// <summary>
/// Discard only Vertex Streams
/// Discard index buffer.
/// </summary>
VertexStreams = 0x00000002,
IndexBuffer = 0x00000002,
/// <summary>
/// Discard only texture samplers
/// Discard instance data.
/// </summary>
TextureSamplers = 0x00000004,
InstanceData = 0x00000004,
/// <summary>
/// Discard only Compute shader related state
/// Discard state.
/// </summary>
Compute = 0x00000008,
State = 0x00000008,
/// <summary>
/// Discard only state
/// Discard transform.
/// </summary>
State = 0x00000010,
Transform = 0x00000010,
/// <summary>
/// Discard every rendering states
/// Discard vertex streams.
/// </summary>
VertexStreams = 0x00000020,
/// <summary>
/// Discard all states.
/// </summary>
All = 0x000000ff,
}
@ -3733,7 +3738,7 @@ public static partial class bgfx
/// <param name="_id">View id.</param>
/// <param name="_program">Program.</param>
/// <param name="_depth">Depth for sorting.</param>
/// <param name="_flags">Which states to discard for next draw. See BGFX_DISCARD_</param>
/// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param>
///
[DllImport(DllName, EntryPoint="bgfx_encoder_submit", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void encoder_submit(Encoder* _this, ushort _id, ProgramHandle _program, uint _depth, byte _flags);
@ -3746,7 +3751,7 @@ public static partial class bgfx
/// <param name="_program">Program.</param>
/// <param name="_occlusionQuery">Occlusion query.</param>
/// <param name="_depth">Depth for sorting.</param>
/// <param name="_flags">Which states to discard for next draw. See BGFX_DISCARD_</param>
/// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param>
///
[DllImport(DllName, EntryPoint="bgfx_encoder_submit_occlusion_query", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void encoder_submit_occlusion_query(Encoder* _this, ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, byte _flags);
@ -3762,7 +3767,7 @@ public static partial class bgfx
/// <param name="_start">First element in indirect buffer.</param>
/// <param name="_num">Number of dispatches.</param>
/// <param name="_depth">Depth for sorting.</param>
/// <param name="_flags">Which states to discard for next draw. See BGFX_DISCARD_</param>
/// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param>
///
[DllImport(DllName, EntryPoint="bgfx_encoder_submit_indirect", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void encoder_submit_indirect(Encoder* _this, ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
@ -3844,9 +3849,10 @@ public static partial class bgfx
/// <param name="_numX">Number of groups X.</param>
/// <param name="_numY">Number of groups Y.</param>
/// <param name="_numZ">Number of groups Z.</param>
/// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param>
///
[DllImport(DllName, EntryPoint="bgfx_encoder_dispatch", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void encoder_dispatch(Encoder* _this, ushort _id, ProgramHandle _program, uint _numX, uint _numY, uint _numZ);
public static extern unsafe void encoder_dispatch(Encoder* _this, ushort _id, ProgramHandle _program, uint _numX, uint _numY, uint _numZ, byte _flags);
/// <summary>
/// Dispatch compute indirect.
@ -3857,15 +3863,16 @@ public static partial class bgfx
/// <param name="_indirectHandle">Indirect buffer.</param>
/// <param name="_start">First element in indirect buffer.</param>
/// <param name="_num">Number of dispatches.</param>
/// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param>
///
[DllImport(DllName, EntryPoint="bgfx_encoder_dispatch_indirect", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void encoder_dispatch_indirect(Encoder* _this, ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num);
public static extern unsafe void encoder_dispatch_indirect(Encoder* _this, ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, byte _flags);
/// <summary>
/// Discard previously set state for draw or compute call.
/// </summary>
///
/// <param name="_flags">Draw/compute states to discard.</param>
/// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param>
///
[DllImport(DllName, EntryPoint="bgfx_encoder_discard", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void encoder_discard(Encoder* _this, byte _flags);
@ -4359,9 +4366,10 @@ public static partial class bgfx
/// <param name="_numX">Number of groups X.</param>
/// <param name="_numY">Number of groups Y.</param>
/// <param name="_numZ">Number of groups Z.</param>
/// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param>
///
[DllImport(DllName, EntryPoint="bgfx_dispatch", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void dispatch(ushort _id, ProgramHandle _program, uint _numX, uint _numY, uint _numZ);
public static extern unsafe void dispatch(ushort _id, ProgramHandle _program, uint _numX, uint _numY, uint _numZ, byte _flags);
/// <summary>
/// Dispatch compute indirect.
@ -4372,9 +4380,10 @@ public static partial class bgfx
/// <param name="_indirectHandle">Indirect buffer.</param>
/// <param name="_start">First element in indirect buffer.</param>
/// <param name="_num">Number of dispatches.</param>
/// <param name="_flags">Discard or preserve states. See `BGFX_DISCARD_*`.</param>
///
[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);
public static extern unsafe void dispatch_indirect(ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, byte _flags);
/// <summary>
/// Discard previously set state for draw or compute call.

View File

@ -1463,7 +1463,7 @@ version(BindBgfx_Static)
* _id = View id.
* _program = Program.
* _depth = Depth for sorting.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, byte _flags);
@ -1474,7 +1474,7 @@ version(BindBgfx_Static)
* _program = Program.
* _occlusionQuery = Occlusion query.
* _depth = Depth for sorting.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
void bgfx_encoder_submit_occlusion_query(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, byte _flags);
@ -1488,7 +1488,7 @@ version(BindBgfx_Static)
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _depth = Depth for sorting.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
void bgfx_encoder_submit_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
@ -1556,8 +1556,9 @@ version(BindBgfx_Static)
* _numX = Number of groups X.
* _numY = Number of groups Y.
* _numZ = Number of groups Z.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ);
void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, byte _flags);
/**
* Dispatch compute indirect.
@ -1567,13 +1568,14 @@ version(BindBgfx_Static)
* _indirectHandle = Indirect buffer.
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num);
void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, byte _flags);
/**
* Discard previously set state for draw or compute call.
* Params:
* _flags = Draw/compute states to discard.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
void bgfx_encoder_discard(bgfx_encoder_t* _this, byte _flags);
@ -2015,8 +2017,9 @@ version(BindBgfx_Static)
* _numX = Number of groups X.
* _numY = Number of groups Y.
* _numZ = Number of groups Z.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ);
void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, byte _flags);
/**
* Dispatch compute indirect.
@ -2026,8 +2029,9 @@ version(BindBgfx_Static)
* _indirectHandle = Indirect buffer.
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num);
void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, byte _flags);
/**
* Discard previously set state for draw or compute call.
@ -3648,7 +3652,7 @@ else
* _id = View id.
* _program = Program.
* _depth = Depth for sorting.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
alias da_bgfx_encoder_submit = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, byte _flags);
da_bgfx_encoder_submit bgfx_encoder_submit;
@ -3660,7 +3664,7 @@ else
* _program = Program.
* _occlusionQuery = Occlusion query.
* _depth = Depth for sorting.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
alias da_bgfx_encoder_submit_occlusion_query = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, byte _flags);
da_bgfx_encoder_submit_occlusion_query bgfx_encoder_submit_occlusion_query;
@ -3675,7 +3679,7 @@ else
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _depth = Depth for sorting.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
alias da_bgfx_encoder_submit_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
da_bgfx_encoder_submit_indirect bgfx_encoder_submit_indirect;
@ -3750,8 +3754,9 @@ else
* _numX = Number of groups X.
* _numY = Number of groups Y.
* _numZ = Number of groups Z.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
alias da_bgfx_encoder_dispatch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ);
alias da_bgfx_encoder_dispatch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, byte _flags);
da_bgfx_encoder_dispatch bgfx_encoder_dispatch;
/**
@ -3762,14 +3767,15 @@ else
* _indirectHandle = Indirect buffer.
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
alias da_bgfx_encoder_dispatch_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num);
alias da_bgfx_encoder_dispatch_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, byte _flags);
da_bgfx_encoder_dispatch_indirect bgfx_encoder_dispatch_indirect;
/**
* Discard previously set state for draw or compute call.
* Params:
* _flags = Draw/compute states to discard.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
alias da_bgfx_encoder_discard = void function(bgfx_encoder_t* _this, byte _flags);
da_bgfx_encoder_discard bgfx_encoder_discard;
@ -4251,8 +4257,9 @@ else
* _numX = Number of groups X.
* _numY = Number of groups Y.
* _numZ = Number of groups Z.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
alias da_bgfx_dispatch = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ);
alias da_bgfx_dispatch = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ, byte _flags);
da_bgfx_dispatch bgfx_dispatch;
/**
@ -4263,8 +4270,9 @@ else
* _indirectHandle = Indirect buffer.
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _flags = Discard or preserve states. See `BGFX_DISCARD_*`.
*/
alias da_bgfx_dispatch_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num);
alias da_bgfx_dispatch_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, byte _flags);
da_bgfx_dispatch_indirect bgfx_dispatch_indirect;
/**

View File

@ -10,7 +10,7 @@ public import core.stdc.stdarg : va_list;
extern(C) @nogc nothrow:
enum uint BGFX_API_VERSION = 104;
enum uint BGFX_API_VERSION = 105;
alias bgfx_view_id_t = ushort;
@ -193,13 +193,14 @@ enum ushort BGFX_CLEAR_DISCARD_MASK = 0x1ff8;
* Rendering state discard. When state is preserved in submit, rendering states can be discarded
* on a finer grain.
*/
enum ubyte BGFX_DISCARD_NONE = 0x00; /// Discard nothing
enum ubyte BGFX_DISCARD_INDEX_BUFFER = 0x01; /// Discard only Index Buffer
enum ubyte BGFX_DISCARD_VERTEX_STREAMS = 0x02; /// Discard only Vertex Streams
enum ubyte BGFX_DISCARD_TEXTURE_SAMPLERS = 0x04; /// Discard only texture samplers
enum ubyte BGFX_DISCARD_COMPUTE = 0x08; /// Discard only Compute shader related state
enum ubyte BGFX_DISCARD_STATE = 0x10; /// Discard only state
enum ubyte BGFX_DISCARD_ALL = 0xff; /// Discard every rendering states
enum ubyte BGFX_DISCARD_NONE = 0x00; /// Preserve everything.
enum ubyte BGFX_DISCARD_BINDINGS = 0x01; /// Discard texture sampler and buffer bindings.
enum ubyte BGFX_DISCARD_INDEX_BUFFER = 0x02; /// Discard index buffer.
enum ubyte BGFX_DISCARD_INSTANCE_DATA = 0x04; /// Discard instance data.
enum ubyte BGFX_DISCARD_STATE = 0x08; /// Discard state.
enum ubyte BGFX_DISCARD_TRANSFORM = 0x10; /// Discard transform.
enum ubyte BGFX_DISCARD_VERTEX_STREAMS = 0x20; /// Discard vertex streams.
enum ubyte BGFX_DISCARD_ALL = 0xff; /// Discard all states.
enum uint BGFX_DEBUG_NONE = 0x00000000; /// No debug.
enum uint BGFX_DEBUG_WIREFRAME = 0x00000001; /// Enable wireframe for all primitives.

View File

@ -1407,8 +1407,7 @@ namespace bgfx
/// @param[in] _id View id.
/// @param[in] _program Program.
/// @param[in] _depth Depth for sorting.
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_encoder_submit`.
///
@ -1416,7 +1415,7 @@ namespace bgfx
ViewId _id
, ProgramHandle _program
, uint32_t _depth = 0
, uint8_t _flags = BGFX_DISCARD_ALL
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Submit primitive with occlusion query for rendering.
@ -1425,8 +1424,7 @@ namespace bgfx
/// @param[in] _program Program.
/// @param[in] _occlusionQuery Occlusion query.
/// @param[in] _depth Depth for sorting.
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_encoder_submit_occlusion_query`.
///
@ -1435,7 +1433,7 @@ namespace bgfx
, ProgramHandle _program
, OcclusionQueryHandle _occlusionQuery
, uint32_t _depth = 0
, uint8_t _flags = BGFX_DISCARD_ALL
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Submit primitive for rendering with index and instance data info from
@ -1447,8 +1445,7 @@ namespace bgfx
/// @param[in] _start First element in indirect buffer.
/// @param[in] _num Number of dispatches.
/// @param[in] _depth Depth for sorting.
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_encoder_submit_indirect`.
///
@ -1557,6 +1554,7 @@ namespace bgfx
/// @param[in] _numX Number of groups X.
/// @param[in] _numY Number of groups Y.
/// @param[in] _numZ Number of groups Z.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_encoder_dispatch`.
///
@ -1566,6 +1564,7 @@ namespace bgfx
, uint32_t _numX = 1
, uint32_t _numY = 1
, uint32_t _numZ = 1
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Dispatch compute indirect.
@ -1575,6 +1574,7 @@ namespace bgfx
/// @param[in] _indirectHandle Indirect buffer.
/// @param[in] _start First element in indirect buffer.
/// @param[in] _num Number of dispatches.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_encoder_dispatch_indirect`.
///
@ -1583,7 +1583,8 @@ namespace bgfx
, ProgramHandle _handle
, IndirectBufferHandle _indirectHandle
, uint16_t _start = 0
, uint16_t _num = 1
, uint16_t _num = 1
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Discard all previously set state for draw or compute call.
@ -3804,8 +3805,7 @@ namespace bgfx
/// @param[in] _id View id.
/// @param[in] _program Program.
/// @param[in] _depth Depth for sorting.
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_submit`.
///
@ -3813,7 +3813,7 @@ namespace bgfx
ViewId _id
, ProgramHandle _program
, uint32_t _depth = 0
, uint8_t _flags = BGFX_DISCARD_ALL
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Submit primitive with occlusion query for rendering.
@ -3822,8 +3822,7 @@ namespace bgfx
/// @param[in] _program Program.
/// @param[in] _occlusionQuery Occlusion query.
/// @param[in] _depth Depth for sorting.
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_submit_occlusion_query`.
///
@ -3832,7 +3831,7 @@ namespace bgfx
, ProgramHandle _program
, OcclusionQueryHandle _occlusionQuery
, uint32_t _depth = 0
, uint8_t _flags = BGFX_DISCARD_ALL
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Submit primitive for rendering with index and instance data info from
@ -3844,8 +3843,7 @@ namespace bgfx
/// @param[in] _start First element in indirect buffer.
/// @param[in] _num Number of dispatches.
/// @param[in] _depth Depth for sorting.
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_submit_indirect`.
///
@ -3854,9 +3852,9 @@ namespace bgfx
, ProgramHandle _program
, IndirectBufferHandle _indirectHandle
, uint16_t _start = 0
, uint16_t _num = 1
, uint16_t _num = 1
, uint32_t _depth = 0
, uint8_t _flags = BGFX_DISCARD_ALL
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Set compute index buffer.
@ -3954,6 +3952,7 @@ namespace bgfx
/// @param[in] _numX Number of groups X.
/// @param[in] _numY Number of groups Y.
/// @param[in] _numZ Number of groups Z.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_dispatch`.
///
@ -3963,6 +3962,7 @@ namespace bgfx
, uint32_t _numX = 1
, uint32_t _numY = 1
, uint32_t _numZ = 1
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Dispatch compute indirect.
@ -3972,6 +3972,7 @@ namespace bgfx
/// @param[in] _indirectHandle Indirect buffer.
/// @param[in] _start First element in indirect buffer.
/// @param[in] _num Number of dispatches.
/// @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
///
/// @attention C99 equivalent is `bgfx_dispatch_indirect`.
///
@ -3980,7 +3981,8 @@ namespace bgfx
, ProgramHandle _handle
, IndirectBufferHandle _indirectHandle
, uint16_t _start = 0
, uint16_t _num = 1
, uint16_t _num = 1
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Discard all previously set state for draw or compute call.

View File

@ -2551,7 +2551,7 @@ BGFX_C_API void bgfx_encoder_touch(bgfx_encoder_t* _this, bgfx_view_id_t _id);
* @param[in] _id View id.
* @param[in] _program Program.
* @param[in] _depth Depth for sorting.
* @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
* @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
*
*/
BGFX_C_API void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, uint8_t _flags);
@ -2563,7 +2563,7 @@ BGFX_C_API void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, b
* @param[in] _program Program.
* @param[in] _occlusionQuery Occlusion query.
* @param[in] _depth Depth for sorting.
* @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
* @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
*
*/
BGFX_C_API void bgfx_encoder_submit_occlusion_query(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, uint8_t _flags);
@ -2578,7 +2578,7 @@ BGFX_C_API void bgfx_encoder_submit_occlusion_query(bgfx_encoder_t* _this, bgfx_
* @param[in] _start First element in indirect buffer.
* @param[in] _num Number of dispatches.
* @param[in] _depth Depth for sorting.
* @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
* @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
*
*/
BGFX_C_API void bgfx_encoder_submit_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, uint8_t _flags);
@ -2653,9 +2653,10 @@ BGFX_C_API void bgfx_encoder_set_image(bgfx_encoder_t* _this, uint8_t _stage, bg
* @param[in] _numX Number of groups X.
* @param[in] _numY Number of groups Y.
* @param[in] _numZ Number of groups Z.
* @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
*
*/
BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ);
BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags);
/**
* Dispatch compute indirect.
@ -2665,14 +2666,15 @@ BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id,
* @param[in] _indirectHandle Indirect buffer.
* @param[in] _start First element in indirect buffer.
* @param[in] _num Number of dispatches.
* @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
*
*/
BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num);
BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, 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);
/**
* Discard previously set state for draw or compute call.
*
* @param[in] _flags Draw/compute states to discard.
* @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
*
*/
BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_t* _this, uint8_t _flags);
@ -3171,9 +3173,10 @@ BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_texture_handle_t _handle, ui
* @param[in] _numX Number of groups X.
* @param[in] _numY Number of groups Y.
* @param[in] _numZ Number of groups Z.
* @param[in] _flags Discard or preserve states. See `BGFX_DISCARD_*`.
*
*/
BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ);
BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags);
/**
* Dispatch compute indirect.
@ -3183,9 +3186,10 @@ BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program
* @param[in] _indirectHandle Indirect buffer.
* @param[in] _start First element in indirect buffer.
* @param[in] _num Number of dispatches.
* @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);
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);
/**
* Discard previously set state for draw or compute call.
@ -3556,8 +3560,8 @@ struct bgfx_interface_vtbl
void (*encoder_set_compute_dynamic_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
void (*encoder_set_compute_indirect_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access);
void (*encoder_set_image)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format);
void (*encoder_dispatch)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ);
void (*encoder_dispatch_indirect)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num);
void (*encoder_dispatch)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags);
void (*encoder_dispatch_indirect)(bgfx_encoder_t* _this, 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 (*encoder_discard)(bgfx_encoder_t* _this, uint8_t _flags);
void (*encoder_blit)(bgfx_encoder_t* _this, 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);
void (*request_screen_shot)(bgfx_frame_buffer_handle_t _handle, const char* _filePath);
@ -3598,8 +3602,8 @@ struct bgfx_interface_vtbl
void (*set_compute_dynamic_vertex_buffer)(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access);
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);
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);
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 (*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);
};

View File

@ -15,7 +15,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_API_VERSION UINT32_C(104)
#define BGFX_API_VERSION UINT32_C(105)
/**
* Color RGB/alpha/depth write. When it's not specified write will be disabled.
@ -258,13 +258,14 @@
* on a finer grain.
*
*/
#define BGFX_DISCARD_NONE UINT8_C(0x00) //!< Discard nothing
#define BGFX_DISCARD_INDEX_BUFFER UINT8_C(0x01) //!< Discard only Index Buffer
#define BGFX_DISCARD_VERTEX_STREAMS UINT8_C(0x02) //!< Discard only Vertex Streams
#define BGFX_DISCARD_TEXTURE_SAMPLERS UINT8_C(0x04) //!< Discard only texture samplers
#define BGFX_DISCARD_COMPUTE UINT8_C(0x08) //!< Discard only Compute shader related state
#define BGFX_DISCARD_STATE UINT8_C(0x10) //!< Discard only state
#define BGFX_DISCARD_ALL UINT8_C(0xff) //!< Discard every rendering states
#define BGFX_DISCARD_NONE UINT8_C(0x00) //!< Preserve everything.
#define BGFX_DISCARD_BINDINGS UINT8_C(0x01) //!< Discard texture sampler and buffer bindings.
#define BGFX_DISCARD_INDEX_BUFFER UINT8_C(0x02) //!< Discard index buffer.
#define BGFX_DISCARD_INSTANCE_DATA UINT8_C(0x04) //!< Discard instance data.
#define BGFX_DISCARD_STATE UINT8_C(0x08) //!< Discard state.
#define BGFX_DISCARD_TRANSFORM UINT8_C(0x10) //!< Discard transform.
#define BGFX_DISCARD_VERTEX_STREAMS UINT8_C(0x20) //!< Discard vertex streams.
#define BGFX_DISCARD_ALL UINT8_C(0xff) //!< Discard all states.
#define BGFX_DEBUG_NONE UINT32_C(0x00000000) //!< No debug.
#define BGFX_DEBUG_WIREFRAME UINT32_C(0x00000001) //!< Enable wireframe for all primitives.

View File

@ -1,7 +1,7 @@
-- vim: syntax=lua
-- bgfx interface
version(104)
version(105)
typedef "bool"
typedef "char"
@ -202,13 +202,14 @@ flag.Clear { bits = 16 }
--- Rendering state discard. When state is preserved in submit, rendering states can be discarded
--- on a finer grain.
flag.Discard { bits = 8, const, desc = "Discard flags" }
.None (0x00) --- Discard nothing
.IndexBuffer (0x01) --- Discard only Index Buffer
.VertexStreams (0x02) --- Discard only Vertex Streams
.TextureSamplers (0x04) --- Discard only texture samplers
.Compute (0x08) --- Discard only Compute shader related state
.State (0x10) --- Discard only state
.All (0xff) --- Discard every rendering states
.None (0x00) --- Preserve everything.
.Bindings (0x01) --- Discard texture sampler and buffer bindings.
.IndexBuffer (0x02) --- Discard index buffer.
.InstanceData (0x04) --- Discard instance data.
.State (0x08) --- Discard state.
.Transform (0x10) --- Discard transform.
.VertexStreams (0x20) --- Discard vertex streams.
.All (0xff) --- Discard all states.
()
flag.Debug { bits = 32 }
@ -2352,7 +2353,7 @@ func.Encoder.submit
.program "ProgramHandle" --- Program.
.depth "uint32_t" --- Depth for sorting.
{ default = 0 }
.flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
.flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
{ default = "BGFX_DISCARD_ALL" }
--- Submit primitive with occlusion query for rendering.
@ -2363,7 +2364,7 @@ func.Encoder.submit { cname = "submit_occlusion_query" }
.occlusionQuery "OcclusionQueryHandle" --- Occlusion query.
.depth "uint32_t" --- Depth for sorting.
{ default = 0 }
.flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
.flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
{ default = "BGFX_DISCARD_ALL" }
--- Submit primitive for rendering with index and instance data info from
@ -2379,7 +2380,7 @@ func.Encoder.submit { cname = "submit_indirect" }
{ default = 1 }
.depth "uint32_t" --- Depth for sorting.
{ default = 0 }
.flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
.flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
{ default = "BGFX_DISCARD_ALL" }
--- Set compute index buffer.
@ -2438,6 +2439,8 @@ func.Encoder.dispatch
{ default = 1 }
.numZ "uint32_t" --- Number of groups Z.
{ default = 1 }
.flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
{ default = "BGFX_DISCARD_ALL" }
--- Dispatch compute indirect.
func.Encoder.dispatch { cname = "dispatch_indirect" }
@ -2449,11 +2452,13 @@ func.Encoder.dispatch { cname = "dispatch_indirect" }
{ default = 0 }
.num "uint16_t" --- Number of dispatches.
{ default = 1 }
.flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
{ default = "BGFX_DISCARD_ALL" }
--- Discard previously set state for draw or compute call.
func.Encoder.discard
"void"
.flags "uint8_t" --- Draw/compute states to discard.
.flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
{ default = "BGFX_DISCARD_ALL" }
--- Blit 2D texture region between two 2D textures.
@ -2950,6 +2955,8 @@ func.dispatch
{ default = 1 }
.numZ "uint32_t" --- Number of groups Z.
{ default = 1 }
.flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
{ default = "BGFX_DISCARD_ALL" }
--- Dispatch compute indirect.
func.dispatch { cname = "dispatch_indirect" }
@ -2961,6 +2968,8 @@ func.dispatch { cname = "dispatch_indirect" }
{ default = 0 }
.num "uint16_t" --- Number of dispatches.
{ default = 1 }
.flags "uint8_t" --- Discard or preserve states. See `BGFX_DISCARD_*`.
{ default = "BGFX_DISCARD_ALL" }
--- Discard previously set state for draw or compute call.
func.discard

View File

@ -1212,14 +1212,14 @@ namespace bgfx
if (m_discard)
{
discard();
discard(_flags);
return;
}
if (0 == m_draw.m_numVertices
&& 0 == m_draw.m_numIndices)
{
discard();
discard(_flags);
++m_numDropped;
return;
}
@ -1227,7 +1227,7 @@ namespace bgfx
const uint32_t renderItemIdx = bx::atomicFetchAndAddsat<uint32_t>(&m_frame->m_numRenderItems, 1, BGFX_CONFIG_MAX_DRAW_CALLS);
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= renderItemIdx)
{
discard();
discard(_flags);
++m_numDropped;
return;
}
@ -1300,7 +1300,7 @@ namespace bgfx
}
}
void EncoderImpl::dispatch(ViewId _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ)
void EncoderImpl::dispatch(ViewId _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags)
{
if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
{
@ -1309,14 +1309,14 @@ namespace bgfx
if (m_discard)
{
discard();
discard(_flags);
return;
}
const uint32_t renderItemIdx = bx::atomicFetchAndAddsat<uint32_t>(&m_frame->m_numRenderItems, 1, BGFX_CONFIG_MAX_DRAW_CALLS);
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= renderItemIdx)
{
discard();
discard(_flags);
++m_numDropped;
return;
}
@ -1347,8 +1347,8 @@ namespace bgfx
m_frame->m_renderItem[renderItemIdx].compute = m_compute;
m_frame->m_renderItemBind[renderItemIdx] = m_bind;
m_compute.clear();
m_bind.clear();
m_compute.clear(_flags);
m_bind.clear(_flags);
m_uniformBegin = m_uniformEnd;
}
@ -3798,25 +3798,25 @@ namespace bgfx
BGFX_ENCODER(setImage(_stage, _handle, _mip, _access, _format) );
}
void Encoder::dispatch(ViewId _id, ProgramHandle _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ)
void Encoder::dispatch(ViewId _id, ProgramHandle _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags)
{
BGFX_CHECK_CAPS(BGFX_CAPS_COMPUTE, "Compute is not supported!");
BGFX_CHECK_HANDLE_INVALID_OK("dispatch", s_ctx->m_programHandle, _program);
BGFX_ENCODER(dispatch(_id, _program, _numX, _numY, _numZ) );
BGFX_ENCODER(dispatch(_id, _program, _numX, _numY, _numZ, _flags) );
}
void Encoder::dispatch(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num)
void Encoder::dispatch(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags)
{
BGFX_CHECK_CAPS(BGFX_CAPS_DRAW_INDIRECT, "Dispatch indirect is not supported!");
BGFX_CHECK_CAPS(BGFX_CAPS_COMPUTE, "Compute is not supported!");
BGFX_CHECK_HANDLE_INVALID_OK("dispatch", s_ctx->m_programHandle, _program);
BGFX_CHECK_HANDLE("dispatch", s_ctx->m_vertexBufferHandle, _indirectHandle);
BGFX_ENCODER(dispatch(_id, _program, _indirectHandle, _start, _num) );
BGFX_ENCODER(dispatch(_id, _program, _indirectHandle, _start, _num, _flags) );
}
void Encoder::discard(uint8_t flags)
void Encoder::discard(uint8_t _flags)
{
BGFX_ENCODER(discard(flags) );
BGFX_ENCODER(discard(_flags) );
}
void Encoder::blit(ViewId _id, TextureHandle _dst, uint16_t _dstX, uint16_t _dstY, TextureHandle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height)
@ -5014,22 +5014,22 @@ namespace bgfx
s_ctx->m_encoder0->setImage(_stage, _handle, _mip, _access, _format);
}
void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ)
void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags)
{
BGFX_CHECK_API_THREAD();
s_ctx->m_encoder0->dispatch(_id, _handle, _numX, _numY, _numZ);
s_ctx->m_encoder0->dispatch(_id, _handle, _numX, _numY, _numZ, _flags);
}
void dispatch(ViewId _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num)
void dispatch(ViewId _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags)
{
BGFX_CHECK_API_THREAD();
s_ctx->m_encoder0->dispatch(_id, _handle, _indirectHandle, _start, _num);
s_ctx->m_encoder0->dispatch(_id, _handle, _indirectHandle, _start, _num, _flags);
}
void discard(uint8_t flags)
void discard(uint8_t _flags)
{
BGFX_CHECK_API_THREAD();
s_ctx->m_encoder0->discard(flags);
s_ctx->m_encoder0->discard(_flags);
}
void blit(ViewId _id, TextureHandle _dst, uint16_t _dstX, uint16_t _dstY, TextureHandle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height)

View File

@ -897,19 +897,19 @@ BGFX_C_API void bgfx_encoder_set_image(bgfx_encoder_t* _this, uint8_t _stage, bg
This->setImage(_stage, handle.cpp, _mip, (bgfx::Access::Enum)_access, (bgfx::TextureFormat::Enum)_format);
}
BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ)
BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
This->dispatch((bgfx::ViewId)_id, program.cpp, _numX, _numY, _numZ);
This->dispatch((bgfx::ViewId)_id, program.cpp, _numX, _numY, _numZ, _flags);
}
BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num)
BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, 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::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
This->dispatch((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num);
This->dispatch((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _flags);
}
BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_t* _this, uint8_t _flags)
@ -1141,17 +1141,17 @@ BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_texture_handle_t _handle, ui
bgfx::setImage(_stage, handle.cpp, _mip, (bgfx::Access::Enum)_access, (bgfx::TextureFormat::Enum)_format);
}
BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ)
BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
bgfx::dispatch((bgfx::ViewId)_id, program.cpp, _numX, _numY, _numZ);
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)
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)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
bgfx::dispatch((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num);
bgfx::dispatch((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _flags);
}
BGFX_C_API void bgfx_discard(uint8_t _flags)

View File

@ -1545,7 +1545,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA
{
void clear(uint8_t _flags = BGFX_DISCARD_ALL)
{
if (0 != (_flags & BGFX_DISCARD_TEXTURE_SAMPLERS) )
if (0 != (_flags & BGFX_DISCARD_BINDINGS) )
{
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii)
{
@ -1566,40 +1566,49 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA
{
if (0 != (_flags & BGFX_DISCARD_STATE) )
{
m_uniformBegin = 0;
m_uniformEnd = 0;
m_stateFlags = BGFX_STATE_DEFAULT;
m_stencil = packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT);
m_rgba = 0;
m_startMatrix = 0;
m_startIndex = 0;
m_numIndices = UINT32_MAX;
m_numVertices = UINT32_MAX;
m_uniformBegin = 0;
m_uniformEnd = 0;
m_uniformIdx = UINT8_MAX;
m_stateFlags = BGFX_STATE_DEFAULT;
m_stencil = packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT);
m_rgba = 0;
m_scissor = UINT16_MAX;
}
if (0 != (_flags & BGFX_DISCARD_TRANSFORM) )
{
m_startMatrix = 0;
m_numMatrices = 1;
}
if (0 != (_flags & BGFX_DISCARD_INSTANCE_DATA) )
{
m_instanceDataOffset = 0;
m_instanceDataStride = 0;
m_numInstances = 1;
m_startIndirect = 0;
m_numIndirect = UINT16_MAX;
m_numMatrices = 1;
m_submitFlags = 0;
m_scissor = UINT16_MAX;
m_instanceDataBuffer.idx = kInvalidHandle;
m_indirectBuffer.idx = kInvalidHandle;
m_occlusionQuery.idx = kInvalidHandle;
m_uniformIdx = UINT8_MAX;
}
if (0 != (_flags & BGFX_DISCARD_VERTEX_STREAMS) )
{
m_streamMask = 0;
m_numVertices = UINT32_MAX;
m_streamMask = 0;
m_stream[0].clear();
}
if (0 != (_flags & BGFX_DISCARD_INDEX_BUFFER) )
{
m_startIndex = 0;
m_numIndices = UINT32_MAX;
m_indexBuffer.idx = kInvalidHandle;
}
m_submitFlags = 0;
m_startIndirect = 0;
m_numIndirect = UINT16_MAX;
m_indirectBuffer.idx = kInvalidHandle;
m_occlusionQuery.idx = kInvalidHandle;
}
bool setStreamBit(uint8_t _stream, VertexBufferHandle _handle)
@ -1640,24 +1649,28 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA
BX_ALIGN_DECL_CACHE_LINE(struct) RenderCompute
{
void clear(uint8_t _flags = BGFX_DISCARD_ALL)
void clear(uint8_t _flags)
{
if (0 != (_flags & BGFX_DISCARD_COMPUTE) )
if (0 != (_flags & BGFX_DISCARD_STATE) )
{
m_uniformBegin = 0;
m_uniformEnd = 0;
m_startMatrix = 0;
m_numX = 0;
m_numY = 0;
m_numZ = 0;
m_numMatrices = 0;
m_submitFlags = 0;
m_uniformIdx = UINT8_MAX;
m_indirectBuffer.idx = kInvalidHandle;
m_startIndirect = 0;
m_numIndirect = UINT16_MAX;
}
if (0 != (_flags & BGFX_DISCARD_TRANSFORM) )
{
m_startMatrix = 0;
m_numMatrices = 0;
}
m_numX = 0;
m_numY = 0;
m_numZ = 0;
m_submitFlags = 0;
m_indirectBuffer.idx = kInvalidHandle;
m_startIndirect = 0;
m_numIndirect = UINT16_MAX;
}
uint32_t m_uniformBegin;
@ -2201,7 +2214,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA
{
EncoderImpl()
{
discard();
discard(BGFX_DISCARD_ALL);
}
void begin(Frame* _frame, uint8_t _idx)
@ -2496,7 +2509,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA
bind.m_mip = _mip;
}
void discard(uint8_t _flags = BGFX_DISCARD_ALL)
void discard(uint8_t _flags)
{
if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) )
{
@ -2509,9 +2522,9 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA
m_bind.clear(_flags);
}
void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, uint8_t _flags = BGFX_DISCARD_ALL);
void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, uint8_t _flags);
void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, uint8_t _flags = BGFX_DISCARD_ALL)
void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, uint8_t _flags)
{
m_draw.m_startIndirect = _start;
m_draw.m_numIndirect = _num;
@ -2520,14 +2533,14 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA
submit(_id, _program, handle, _depth, _flags);
}
void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _ngx, uint32_t _ngy, uint32_t _ngz);
void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _ngx, uint32_t _ngy, uint32_t _ngz, uint8_t _flags);
void dispatch(ViewId _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num)
void dispatch(ViewId _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags)
{
m_compute.m_indirectBuffer = _indirectHandle;
m_compute.m_startIndirect = _start;
m_compute.m_numIndirect = _num;
dispatch(_id, _handle, 0, 0, 0);
dispatch(_id, _handle, 0, 0, 0, _flags);
}
void blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth);