Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
GenericDrawCommand.h
Go to the documentation of this file.
1/*
2Copyright (c) 2018 DIVIDE-Studio
3Copyright (c) 2009 Ionut Cava
4
5This file is part of DIVIDE Framework.
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software
9and associated documentation files (the "Software"), to deal in the Software
10without restriction,
11including without limitation the rights to use, copy, modify, merge, publish,
12distribute, sublicense,
13and/or sell copies of the Software, and to permit persons to whom the
14Software is furnished to do so,
15subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED,
22INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23PARTICULAR PURPOSE AND NONINFRINGEMENT.
24IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25DAMAGES OR OTHER LIABILITY,
26WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27IN CONNECTION WITH THE SOFTWARE
28OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30*/
31
32#pragma once
33#ifndef DVD_GENERIC_DRAW_COMMAND_H_
34#define DVD_GENERIC_DRAW_COMMAND_H_
35
37
38namespace Divide {
39
41{
42 union
43 {
46 };
47
51
52 union
53 {
56 };
57};
58
59static_assert(sizeof( IndirectIndexedDrawCommand ) == 20, "Wrong indexed indirect command size!");
60
62{
66 union
67 {
70 };
71};
72
73static_assert(sizeof( IndirectNonIndexedDrawCommand ) == 16, "Wrong non-indexed indirect command size!");
74
75enum class CmdRenderOptions : U8
76{
80 COUNT = 3
81};
82
83#pragma pack(push, 1)
87 U32 _commandOffset{ 0u }; // 8 bytes
88 U16 _drawCount{ 1u }; // 4 bytes
91};
92#pragma pack(pop)
93
94static_assert(sizeof(GenericDrawCommand) == 32, "Wrong command size! May cause performance issues. Disable assert to continue anyway.");
95
96using GenericDrawCommandContainer = eastl::fixed_vector<GenericDrawCommand, 1, true>;
97
98[[nodiscard]] bool isEnabledOption(const GenericDrawCommand& cmd, CmdRenderOptions option) noexcept;
99void toggleOption(GenericDrawCommand& cmd, CmdRenderOptions option) noexcept;
100
101void enableOption(GenericDrawCommand& cmd, CmdRenderOptions option) noexcept;
102void disableOption(GenericDrawCommand& cmd, CmdRenderOptions option) noexcept;
103void setOption(GenericDrawCommand& cmd, CmdRenderOptions option, bool state) noexcept;
104
105void enableOptions(GenericDrawCommand& cmd, BaseType<CmdRenderOptions> optionsMask) noexcept;
106void disableOptions(GenericDrawCommand& cmd, BaseType<CmdRenderOptions> optionsMask) noexcept;
107void setOptions(GenericDrawCommand& cmd, BaseType<CmdRenderOptions> optionsMask, bool state) noexcept;
108
109void resetOptions(GenericDrawCommand& cmd) noexcept;
110
111[[nodiscard]] bool Compatible(const GenericDrawCommand& lhs, const GenericDrawCommand& rhs) noexcept;
112
113}; //namespace Divide
114
115#endif //DVD_GENERIC_DRAW_COMMAND_H_
116
117#include "GenericDrawCommand.inl"
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
bool isEnabledOption(const GenericDrawCommand &cmd, CmdRenderOptions option) noexcept
void disableOptions(GenericDrawCommand &cmd, BaseType< CmdRenderOptions > optionsMask) noexcept
void disableOption(GenericDrawCommand &cmd, CmdRenderOptions option) noexcept
uint8_t U8
void toggleOption(GenericDrawCommand &cmd, CmdRenderOptions option) noexcept
void enableOption(GenericDrawCommand &cmd, CmdRenderOptions option) noexcept
void setOptions(GenericDrawCommand &cmd, BaseType< CmdRenderOptions > optionsMask, bool state) noexcept
uint16_t U16
void resetOptions(GenericDrawCommand &cmd) noexcept
std::underlying_type_t< Type > BaseType
eastl::fixed_vector< GenericDrawCommand, 1, true > GenericDrawCommandContainer
void enableOptions(GenericDrawCommand &cmd, BaseType< CmdRenderOptions > optionsMask) noexcept
bool Compatible(const GenericDrawCommand &lhs, const GenericDrawCommand &rhs) noexcept
void setOption(GenericDrawCommand &cmd, CmdRenderOptions option, bool state) noexcept
uint32_t U32
constexpr T toBit(const T X)
Converts an arbitrary positive integer value to a bitwise value used for masks.
constexpr auto to_base(const Type value) -> Type
IndirectIndexedDrawCommand _cmd