Discard flags for submit call

This commit is contained in:
Cedric Guillemet 2020-03-13 11:22:33 +01:00 committed by Бранимир Караџић
parent 78675e238d
commit 0881d98bd2
11 changed files with 120 additions and 112 deletions

View File

@ -532,6 +532,11 @@ public static partial class bgfx
[Flags]
public enum DiscardFlags : uint
{
/// <summary>
/// Discard nothing
/// </summary>
None = 0x00000000,
/// <summary>
/// Discard only Index Buffer
/// </summary>
@ -3728,10 +3733,10 @@ 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="_preserveState">Preserve internal draw state for next draw call submit.</param>
/// <param name="_flags">Which states to discard for next draw. 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, bool _preserveState);
public static extern unsafe void encoder_submit(Encoder* _this, ushort _id, ProgramHandle _program, uint _depth, byte _flags);
/// <summary>
/// Submit primitive with occlusion query for rendering.
@ -3741,10 +3746,10 @@ 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="_preserveState">Preserve internal draw state for next draw call submit.</param>
/// <param name="_flags">Which states to discard for next draw. 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, bool _preserveState);
public static extern unsafe void encoder_submit_occlusion_query(Encoder* _this, ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, byte _flags);
/// <summary>
/// Submit primitive for rendering with index and instance data info from
@ -3757,10 +3762,10 @@ 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="_preserveState">Preserve internal draw state for next draw call submit.</param>
/// <param name="_flags">Which states to discard for next draw. 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, bool _preserveState);
public static extern unsafe void encoder_submit_indirect(Encoder* _this, ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
/// <summary>
/// Set compute index buffer.
@ -4243,10 +4248,10 @@ 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="_preserveState">Preserve internal draw state for next draw call submit.</param>
/// <param name="_flags">Which states to discard for next draw. See BGFX_DISCARD_</param>
///
[DllImport(DllName, EntryPoint="bgfx_submit", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void submit(ushort _id, ProgramHandle _program, uint _depth, bool _preserveState);
public static extern unsafe void submit(ushort _id, ProgramHandle _program, uint _depth, byte _flags);
/// <summary>
/// Submit primitive with occlusion query for rendering.
@ -4256,10 +4261,10 @@ 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="_preserveState">Preserve internal draw state for next draw call submit.</param>
/// <param name="_flags">Which states to discard for next draw. See BGFX_DISCARD_</param>
///
[DllImport(DllName, EntryPoint="bgfx_submit_occlusion_query", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void submit_occlusion_query(ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, bool _preserveState);
public static extern unsafe void submit_occlusion_query(ushort _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint _depth, byte _flags);
/// <summary>
/// Submit primitive for rendering with index and instance data info from
@ -4272,10 +4277,10 @@ 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="_preserveState">Preserve internal draw state for next draw call submit.</param>
/// <param name="_flags">Which states to discard for next draw. See BGFX_DISCARD_</param>
///
[DllImport(DllName, EntryPoint="bgfx_submit_indirect", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void submit_indirect(ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState);
public static extern unsafe void submit_indirect(ushort _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
/// <summary>
/// Set compute index buffer.

View File

@ -1463,9 +1463,9 @@ version(BindBgfx_Static)
* _id = View id.
* _program = Program.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
*/
void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, bool _preserveState);
void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, byte _flags);
/**
* Submit primitive with occlusion query for rendering.
@ -1474,9 +1474,9 @@ version(BindBgfx_Static)
* _program = Program.
* _occlusionQuery = Occlusion query.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. 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, bool _preserveState);
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);
/**
* Submit primitive for rendering with index and instance data info from
@ -1488,9 +1488,9 @@ version(BindBgfx_Static)
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. 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, bool _preserveState);
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);
/**
* Set compute index buffer.
@ -1922,9 +1922,9 @@ version(BindBgfx_Static)
* _id = View id.
* _program = Program.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
*/
void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, bool _preserveState);
void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, byte _flags);
/**
* Submit primitive with occlusion query for rendering.
@ -1933,9 +1933,9 @@ version(BindBgfx_Static)
* _program = Program.
* _occlusionQuery = Occlusion query.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
*/
void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, bool _preserveState);
void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, byte _flags);
/**
* Submit primitive for rendering with index and instance data info from
@ -1947,9 +1947,9 @@ version(BindBgfx_Static)
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
*/
void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState);
void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, byte _flags);
/**
* Set compute index buffer.
@ -3648,9 +3648,9 @@ else
* _id = View id.
* _program = Program.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. 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, bool _preserveState);
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,9 +3660,9 @@ else
* _program = Program.
* _occlusionQuery = Occlusion query.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. 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, bool _preserveState);
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,9 +3675,9 @@ else
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. 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, bool _preserveState);
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;
/**
@ -4149,9 +4149,9 @@ else
* _id = View id.
* _program = Program.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
*/
alias da_bgfx_submit = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, bool _preserveState);
alias da_bgfx_submit = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, byte _flags);
da_bgfx_submit bgfx_submit;
/**
@ -4161,9 +4161,9 @@ else
* _program = Program.
* _occlusionQuery = Occlusion query.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
*/
alias da_bgfx_submit_occlusion_query = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, bool _preserveState);
alias da_bgfx_submit_occlusion_query = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, byte _flags);
da_bgfx_submit_occlusion_query bgfx_submit_occlusion_query;
/**
@ -4176,9 +4176,9 @@ else
* _start = First element in indirect buffer.
* _num = Number of dispatches.
* _depth = Depth for sorting.
* _preserveState = Preserve internal draw state for next draw call submit.
* _flags = Which states to discard for next draw. See BGFX_DISCARD_
*/
alias da_bgfx_submit_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState);
alias da_bgfx_submit_indirect = void function(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_submit_indirect bgfx_submit_indirect;
/**

View File

@ -193,6 +193,7 @@ 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

View File

@ -610,7 +610,7 @@ namespace
m_uniforms.submit();
bgfx::submit(1, m_programsDraw[m_shading], m_dispatchIndirect, 0, true);
bgfx::submit(1, m_programsDraw[m_shading], m_dispatchIndirect, 0, 1, 0, BGFX_DISCARD_NONE);
m_pingPong = 1 - m_pingPong;

View File

@ -1407,7 +1407,7 @@ namespace bgfx
/// @param[in] _id View id.
/// @param[in] _program Program.
/// @param[in] _depth Depth for sorting.
/// @param[in] _preserveState Preserve internal draw state for next draw
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
///
/// @attention C99 equivalent is `bgfx_encoder_submit`.
@ -1416,7 +1416,7 @@ namespace bgfx
ViewId _id
, ProgramHandle _program
, uint32_t _depth = 0
, bool _preserveState = false
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Submit primitive with occlusion query for rendering.
@ -1425,7 +1425,7 @@ namespace bgfx
/// @param[in] _program Program.
/// @param[in] _occlusionQuery Occlusion query.
/// @param[in] _depth Depth for sorting.
/// @param[in] _preserveState Preserve internal draw state for next draw
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
///
/// @attention C99 equivalent is `bgfx_encoder_submit_occlusion_query`.
@ -1435,7 +1435,7 @@ namespace bgfx
, ProgramHandle _program
, OcclusionQueryHandle _occlusionQuery
, uint32_t _depth = 0
, bool _preserveState = false
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Submit primitive for rendering with index and instance data info from
@ -1447,7 +1447,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] _preserveState Preserve internal draw state for next draw
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
///
/// @attention C99 equivalent is `bgfx_encoder_submit_indirect`.
@ -1459,7 +1459,7 @@ namespace bgfx
, uint16_t _start = 0
, uint16_t _num = 1
, uint32_t _depth = 0
, bool _preserveState = false
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Set compute index buffer.
@ -3804,7 +3804,7 @@ namespace bgfx
/// @param[in] _id View id.
/// @param[in] _program Program.
/// @param[in] _depth Depth for sorting.
/// @param[in] _preserveState Preserve internal draw state for next draw
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
///
/// @attention C99 equivalent is `bgfx_submit`.
@ -3813,7 +3813,7 @@ namespace bgfx
ViewId _id
, ProgramHandle _program
, uint32_t _depth = 0
, bool _preserveState = false
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Submit primitive with occlusion query for rendering.
@ -3822,7 +3822,7 @@ namespace bgfx
/// @param[in] _program Program.
/// @param[in] _occlusionQuery Occlusion query.
/// @param[in] _depth Depth for sorting.
/// @param[in] _preserveState Preserve internal draw state for next draw
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
///
/// @attention C99 equivalent is `bgfx_submit_occlusion_query`.
@ -3832,7 +3832,7 @@ namespace bgfx
, ProgramHandle _program
, OcclusionQueryHandle _occlusionQuery
, uint32_t _depth = 0
, bool _preserveState = false
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Submit primitive for rendering with index and instance data info from
@ -3844,7 +3844,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] _preserveState Preserve internal draw state for next draw
/// @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
/// call submit.
///
/// @attention C99 equivalent is `bgfx_submit_indirect`.
@ -3856,7 +3856,7 @@ namespace bgfx
, uint16_t _start = 0
, uint16_t _num = 1
, uint32_t _depth = 0
, bool _preserveState = false
, uint8_t _flags = BGFX_DISCARD_ALL
);
/// Set compute index buffer.

View File

@ -2551,10 +2551,10 @@ 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] _preserveState Preserve internal draw state for next draw call submit.
* @param[in] _flags Which states to discard for next draw. 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, bool _preserveState);
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);
/**
* Submit primitive with occlusion query for rendering.
@ -2563,10 +2563,10 @@ 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] _preserveState Preserve internal draw state for next draw call submit.
* @param[in] _flags Which states to discard for next draw. 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, bool _preserveState);
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);
/**
* Submit primitive for rendering with index and instance data info from
@ -2578,10 +2578,10 @@ 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] _preserveState Preserve internal draw state for next draw call submit.
* @param[in] _flags Which states to discard for next draw. 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, bool _preserveState);
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);
/**
* Set compute index buffer.
@ -3069,10 +3069,10 @@ BGFX_C_API void bgfx_touch(bgfx_view_id_t _id);
* @param[in] _id View id.
* @param[in] _program Program.
* @param[in] _depth Depth for sorting.
* @param[in] _preserveState Preserve internal draw state for next draw call submit.
* @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
*
*/
BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, bool _preserveState);
BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, uint8_t _flags);
/**
* Submit primitive with occlusion query for rendering.
@ -3081,10 +3081,10 @@ BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program,
* @param[in] _program Program.
* @param[in] _occlusionQuery Occlusion query.
* @param[in] _depth Depth for sorting.
* @param[in] _preserveState Preserve internal draw state for next draw call submit.
* @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
*
*/
BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState);
BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, uint8_t _flags);
/**
* Submit primitive for rendering with index and instance data info from
@ -3096,10 +3096,10 @@ BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_han
* @param[in] _start First element in indirect buffer.
* @param[in] _num Number of dispatches.
* @param[in] _depth Depth for sorting.
* @param[in] _preserveState Preserve internal draw state for next draw call submit.
* @param[in] _flags Which states to discard for next draw. See BGFX_DISCARD_
*
*/
BGFX_C_API void bgfx_submit_indirect(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, bool _preserveState);
BGFX_C_API void bgfx_submit_indirect(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);
/**
* Set compute index buffer.
@ -3547,9 +3547,9 @@ struct bgfx_interface_vtbl
void (*encoder_set_instance_count)(bgfx_encoder_t* _this, uint32_t _numInstances);
void (*encoder_set_texture)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
void (*encoder_touch)(bgfx_encoder_t* _this, bgfx_view_id_t _id);
void (*encoder_submit)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, bool _preserveState);
void (*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, bool _preserveState);
void (*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, bool _preserveState);
void (*encoder_submit)(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, uint8_t _flags);
void (*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);
void (*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);
void (*encoder_set_compute_index_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
void (*encoder_set_compute_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
void (*encoder_set_compute_dynamic_index_buffer)(bgfx_encoder_t* _this, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);
@ -3589,9 +3589,9 @@ struct bgfx_interface_vtbl
void (*set_instance_count)(uint32_t _numInstances);
void (*set_texture)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
void (*touch)(bgfx_view_id_t _id);
void (*submit)(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, bool _preserveState);
void (*submit_occlusion_query)(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState);
void (*submit_indirect)(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, bool _preserveState);
void (*submit)(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, uint8_t _flags);
void (*submit_occlusion_query)(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, uint8_t _flags);
void (*submit_indirect)(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);
void (*set_compute_index_buffer)(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access);
void (*set_compute_vertex_buffer)(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access);
void (*set_compute_dynamic_index_buffer)(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access);

View File

@ -258,6 +258,7 @@
* 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

View File

@ -201,7 +201,8 @@ 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, base = 1, desc = "Discard flags" }
flag.Discard { bits = 8, desc = "Discard flags" }
.None(0) --- Discard nothing
.IndexBuffer --- Discard only Index Buffer
.VertexStreams --- Discard only Vertex Streams
.TextureSamplers --- Discard only texture samplers
@ -2351,8 +2352,8 @@ func.Encoder.submit
.program "ProgramHandle" --- Program.
.depth "uint32_t" --- Depth for sorting.
{ default = 0 }
.preserveState "bool" --- Preserve internal draw state for next draw call submit.
{ default = false }
.flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
{ default = "BGFX_DISCARD_ALL" }
--- Submit primitive with occlusion query for rendering.
func.Encoder.submit { cname = "submit_occlusion_query" }
@ -2362,8 +2363,8 @@ func.Encoder.submit { cname = "submit_occlusion_query" }
.occlusionQuery "OcclusionQueryHandle" --- Occlusion query.
.depth "uint32_t" --- Depth for sorting.
{ default = 0 }
.preserveState "bool" --- Preserve internal draw state for next draw call submit.
{ default = false }
.flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
{ default = "BGFX_DISCARD_ALL" }
--- Submit primitive for rendering with index and instance data info from
--- indirect buffer.
@ -2378,8 +2379,8 @@ func.Encoder.submit { cname = "submit_indirect" }
{ default = 1 }
.depth "uint32_t" --- Depth for sorting.
{ default = 0 }
.preserveState "bool" --- Preserve internal draw state for next draw call submit.
{ default = false }
.flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
{ default = "BGFX_DISCARD_ALL" }
--- Set compute index buffer.
func.Encoder.setBuffer { cname = "set_compute_index_buffer" }
@ -2863,8 +2864,8 @@ func.submit
.program "ProgramHandle" --- Program.
.depth "uint32_t" --- Depth for sorting.
{ default = 0 }
.preserveState "bool" --- Preserve internal draw state for next draw call submit.
{ default = false }
.flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
{ default = "BGFX_DISCARD_ALL" }
--- Submit primitive with occlusion query for rendering.
func.submit { cname = "submit_occlusion_query" }
@ -2874,8 +2875,8 @@ func.submit { cname = "submit_occlusion_query" }
.occlusionQuery "OcclusionQueryHandle" --- Occlusion query.
.depth "uint32_t" --- Depth for sorting.
{ default = 0 }
.preserveState "bool" --- Preserve internal draw state for next draw call submit.
{ default = false }
.flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
{ default = "BGFX_DISCARD_ALL" }
--- Submit primitive for rendering with index and instance data info from
--- indirect buffer.
@ -2890,8 +2891,8 @@ func.submit { cname = "submit_indirect" }
{ default = 1 }
.depth "uint32_t" --- Depth for sorting.
{ default = 0 }
.preserveState "bool" --- Preserve internal draw state for next draw call submit.
{ default = false }
.flags "uint8_t" --- Which states to discard for next draw. See BGFX_DISCARD_
{ default = "BGFX_DISCARD_ALL" }
--- Set compute index buffer.
func.setBuffer { cname = "set_compute_index_buffer" }

View File

@ -1191,10 +1191,10 @@ namespace bgfx
}
}
void EncoderImpl::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, bool _preserveState)
void EncoderImpl::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, uint8_t _flags)
{
if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM)
&& !_preserveState)
&& (_flags == BGFX_DISCARD_ALL))
{
m_uniformSet.clear();
}
@ -1291,10 +1291,10 @@ namespace bgfx
m_frame->m_renderItem[renderItemIdx].draw = m_draw;
m_frame->m_renderItemBind[renderItemIdx] = m_bind;
if (!_preserveState)
m_draw.clear(_flags);
m_bind.clear(_flags);
if (_flags == BGFX_DISCARD_ALL)
{
m_draw.clear();
m_bind.clear();
m_uniformBegin = m_uniformEnd;
}
}
@ -3713,13 +3713,13 @@ namespace bgfx
submit(_id, handle);
}
void Encoder::submit(ViewId _id, ProgramHandle _program, uint32_t _depth, bool _preserveState)
void Encoder::submit(ViewId _id, ProgramHandle _program, uint32_t _depth, uint8_t _flags)
{
OcclusionQueryHandle handle = BGFX_INVALID_HANDLE;
submit(_id, _program, handle, _depth, _preserveState);
submit(_id, _program, handle, _depth, _flags);
}
void Encoder::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, bool _preserveState)
void Encoder::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, uint8_t _flags)
{
BX_CHECK(false
|| !isValid(_occlusionQuery)
@ -3728,15 +3728,15 @@ namespace bgfx
);
BGFX_CHECK_HANDLE_INVALID_OK("submit", s_ctx->m_programHandle, _program);
BGFX_CHECK_HANDLE_INVALID_OK("submit", s_ctx->m_occlusionQueryHandle, _occlusionQuery);
BGFX_ENCODER(submit(_id, _program, _occlusionQuery, _depth, _preserveState) );
BGFX_ENCODER(submit(_id, _program, _occlusionQuery, _depth, _flags) );
}
void Encoder::submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState)
void Encoder::submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, uint8_t _flags)
{
BGFX_CHECK_HANDLE_INVALID_OK("submit", s_ctx->m_programHandle, _program);
BGFX_CHECK_HANDLE("submit", s_ctx->m_vertexBufferHandle, _indirectHandle);
BGFX_CHECK_CAPS(BGFX_CAPS_DRAW_INDIRECT, "Draw indirect is not supported!");
BGFX_ENCODER(submit(_id, _program, _indirectHandle, _start, _num, _depth, _preserveState) );
BGFX_ENCODER(submit(_id, _program, _indirectHandle, _start, _num, _depth, _flags) );
}
void Encoder::setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access)
@ -4953,22 +4953,22 @@ namespace bgfx
submit(_id, handle);
}
void submit(ViewId _id, ProgramHandle _program, uint32_t _depth, bool _preserveState)
void submit(ViewId _id, ProgramHandle _program, uint32_t _depth, uint8_t _flags)
{
OcclusionQueryHandle handle = BGFX_INVALID_HANDLE;
submit(_id, _program, handle, _depth, _preserveState);
submit(_id, _program, handle, _depth, _flags);
}
void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, bool _preserveState)
void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, uint8_t _flags)
{
BGFX_CHECK_API_THREAD();
s_ctx->m_encoder0->submit(_id, _program, _occlusionQuery, _depth, _preserveState);
s_ctx->m_encoder0->submit(_id, _program, _occlusionQuery, _depth, _flags);
}
void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState)
void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, uint8_t _flags)
{
BGFX_CHECK_API_THREAD();
s_ctx->m_encoder0->submit(_id, _program, _indirectHandle, _start, _num, _depth, _preserveState);
s_ctx->m_encoder0->submit(_id, _program, _indirectHandle, _start, _num, _depth, _flags);
}
void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access)

View File

@ -832,27 +832,27 @@ BGFX_C_API void bgfx_encoder_touch(bgfx_encoder_t* _this, bgfx_view_id_t _id)
This->touch((bgfx::ViewId)_id);
}
BGFX_C_API void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, bool _preserveState)
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)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
This->submit((bgfx::ViewId)_id, program.cpp, _depth, _preserveState);
This->submit((bgfx::ViewId)_id, program.cpp, _depth, _flags);
}
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, bool _preserveState)
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)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery };
This->submit((bgfx::ViewId)_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState);
This->submit((bgfx::ViewId)_id, program.cpp, occlusionQuery.cpp, _depth, _flags);
}
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, bool _preserveState)
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)
{
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->submit((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _depth, _preserveState);
This->submit((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _depth, _flags);
}
BGFX_C_API void bgfx_encoder_set_compute_index_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access)
@ -1085,24 +1085,24 @@ BGFX_C_API void bgfx_touch(bgfx_view_id_t _id)
bgfx::touch((bgfx::ViewId)_id);
}
BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, bool _preserveState)
BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
bgfx::submit((bgfx::ViewId)_id, program.cpp, _depth, _preserveState);
bgfx::submit((bgfx::ViewId)_id, program.cpp, _depth, _flags);
}
BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState)
BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery };
bgfx::submit((bgfx::ViewId)_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState);
bgfx::submit((bgfx::ViewId)_id, program.cpp, occlusionQuery.cpp, _depth, _flags);
}
BGFX_C_API void bgfx_submit_indirect(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, bool _preserveState)
BGFX_C_API void bgfx_submit_indirect(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)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
bgfx::submit((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _depth, _preserveState);
bgfx::submit((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _depth, _flags);
}
BGFX_C_API void bgfx_set_compute_index_buffer(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access)

View File

@ -2509,15 +2509,15 @@ 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, bool _preserveState);
void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, 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, bool _preserveState)
void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, uint8_t _flags = BGFX_DISCARD_ALL)
{
m_draw.m_startIndirect = _start;
m_draw.m_numIndirect = _num;
m_draw.m_indirectBuffer = _indirectHandle;
OcclusionQueryHandle handle = BGFX_INVALID_HANDLE;
submit(_id, _program, handle, _depth, _preserveState);
submit(_id, _program, handle, _depth, _flags);
}
void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _ngx, uint32_t _ngy, uint32_t _ngz);