Skip to content

Commit 64bc96c

Browse files
committed
-always using spaces instead of tabs
1 parent 4b4097c commit 64bc96c

17 files changed

+5036
-5036
lines changed

CommandBuffer.h

+442-442
Large diffs are not rendered by default.

CommandKeys.h

+341-341
Large diffs are not rendered by default.

CommandPacket.h

+152-152
Original file line numberDiff line numberDiff line change
@@ -12,172 +12,172 @@
1212

1313
namespace cb
1414
{
15-
/// Contains one or more commands packed together in a specific order.
16-
struct CommandPacket
17-
{
18-
CB_DECLARE_COMMAND_DEBUG();
19-
20-
template <class CommandClass>
21-
struct is_valid_type
22-
{
23-
enum
24-
{
25-
// must not be CommandPacket and must be pod, not void
26-
value = std::is_same<CommandPacket, CommandClass>::value == 0 && //
27-
std::is_void<CommandClass>::value == 0 && cb::detail::is_pod<CommandClass>::value
28-
};
29-
};
30-
31-
template <class CommandClass, class AllocatorClass>
32-
static CommandPacket* create(AllocatorClass& allocator, uint32_t auxilarySize);
33-
34-
template <class CommandClass>
35-
static CommandPacket* getCommandPacket(CommandClass* commandData);
36-
template <class CommandClass>
37-
static const CommandPacket* getCommandPacket(const CommandClass* commandData);
38-
template <class CommandClass>
39-
static CommandClass* getCommandData(CommandPacket* packet);
40-
template <class CommandClass, typename CastType>
41-
static CastType* getAuxilaryData(CommandClass* commandData);
42-
43-
static void dispatch(const cb::CommandPacket* packet, cb::RenderContext* rc);
15+
/// Contains one or more commands packed together in a specific order.
16+
struct CommandPacket
17+
{
18+
CB_DECLARE_COMMAND_DEBUG();
19+
20+
template <class CommandClass>
21+
struct is_valid_type
22+
{
23+
enum
24+
{
25+
// must not be CommandPacket and must be pod, not void
26+
value = std::is_same<CommandPacket, CommandClass>::value == 0 && //
27+
std::is_void<CommandClass>::value == 0 && cb::detail::is_pod<CommandClass>::value
28+
};
29+
};
30+
31+
template <class CommandClass, class AllocatorClass>
32+
static CommandPacket* create(AllocatorClass& allocator, uint32_t auxilarySize);
33+
34+
template <class CommandClass>
35+
static CommandPacket* getCommandPacket(CommandClass* commandData);
36+
template <class CommandClass>
37+
static const CommandPacket* getCommandPacket(const CommandClass* commandData);
38+
template <class CommandClass>
39+
static CommandClass* getCommandData(CommandPacket* packet);
40+
template <class CommandClass, typename CastType>
41+
static CastType* getAuxilaryData(CommandClass* commandData);
42+
43+
static void dispatch(const cb::CommandPacket* packet, cb::RenderContext* rc);
4444

4545
#if CB_DEBUG_TAG_COMMANDS
46-
template <class CommandClass>
47-
static CommandPacket& command(CommandClass& cmd);
48-
template <class CommandClass>
49-
static CommandPacket& command(CommandClass* cmd);
50-
template <class CommandClass>
51-
static std::string commandName(CommandClass& cmd);
52-
template <class CommandClass>
53-
static std::string commandName(CommandClass* cmd);
54-
55-
typedef int(*log_function_t)(const char* fmt, ...);
56-
static void log(const cb::CommandPacket* packet, log_function_t logger);
46+
template <class CommandClass>
47+
static CommandPacket& command(CommandClass& cmd);
48+
template <class CommandClass>
49+
static CommandPacket& command(CommandClass* cmd);
50+
template <class CommandClass>
51+
static std::string commandName(CommandClass& cmd);
52+
template <class CommandClass>
53+
static std::string commandName(CommandClass* cmd);
54+
55+
typedef int(*log_function_t)(const char* fmt, ...);
56+
static void log(const cb::CommandPacket* packet, log_function_t logger);
5757
#endif // #if CB_DEBUG_TAG_COMMANDS
5858

59-
private:
60-
// not allowed
61-
template <class CommandClass, typename CastType>
62-
static CastType* getAuxilaryData(CommandClass**);
63-
template <class CommandClass>
64-
static CommandPacket* getCommandPacket(CommandClass**);
65-
template <class CommandClass>
66-
static const CommandPacket* getCommandPacket(const CommandClass**);
67-
68-
public:
69-
cb::RenderContext::function_t dispatchFunction;
70-
void* commandData;
71-
void* auxilaryData; // optional
72-
CommandPacket* nextCommand;
73-
};
74-
75-
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
76-
77-
template <class CommandClass, class AllocatorClass>
78-
CB_FORCE_INLINE CommandPacket* CommandPacket::create(AllocatorClass& allocator, uint32_t auxilarySize)
79-
{
80-
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
59+
private:
60+
// not allowed
61+
template <class CommandClass, typename CastType>
62+
static CastType* getAuxilaryData(CommandClass**);
63+
template <class CommandClass>
64+
static CommandPacket* getCommandPacket(CommandClass**);
65+
template <class CommandClass>
66+
static const CommandPacket* getCommandPacket(const CommandClass**);
67+
68+
public:
69+
cb::RenderContext::function_t dispatchFunction;
70+
void* commandData;
71+
void* auxilaryData; // optional
72+
CommandPacket* nextCommand;
73+
};
74+
75+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
76+
77+
template <class CommandClass, class AllocatorClass>
78+
CB_FORCE_INLINE CommandPacket* CommandPacket::create(AllocatorClass& allocator, uint32_t auxilarySize)
79+
{
80+
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
8181

8282
#if CB_COMMAND_PACKET_ALIGNED
83-
static_assert(alignof(CommandPacket) == alignof(CommandClass), "COMMAND_MUST_BE_ALIGNED_WITH_PACKET");
84-
const uint32_t alignment = alignof(CommandClass);
83+
static_assert(alignof(CommandPacket) == alignof(CommandClass), "COMMAND_MUST_BE_ALIGNED_WITH_PACKET");
84+
const uint32_t alignment = alignof(CommandClass);
8585
#else
86-
const uint32_t a1 = alignof(CommandPacket);
87-
const uint32_t a2 = alignof(CommandClass);
88-
const uint32_t alignment = std::max(a1, a2);
86+
const uint32_t a1 = alignof(CommandPacket);
87+
const uint32_t a2 = alignof(CommandClass);
88+
const uint32_t alignment = std::max(a1, a2);
8989
#endif
9090

91-
uint8_t* data = allocator.alloc(sizeof(CommandPacket) + sizeof(CommandClass) + auxilarySize, alignment);
91+
uint8_t* data = allocator.alloc(sizeof(CommandPacket) + sizeof(CommandClass) + auxilarySize, alignment);
9292

93-
CommandPacket* packet = reinterpret_cast<CommandPacket*>(data);
94-
packet->commandData = data + sizeof(CommandPacket);
95-
packet->auxilaryData = data + sizeof(CommandPacket) + sizeof(CommandClass);
93+
CommandPacket* packet = reinterpret_cast<CommandPacket*>(data);
94+
packet->commandData = data + sizeof(CommandPacket);
95+
packet->auxilaryData = data + sizeof(CommandPacket) + sizeof(CommandClass);
9696
#ifndef NDEBUG
97-
if (auxilarySize == 0)
98-
packet->auxilaryData = NULL;
97+
if (auxilarySize == 0)
98+
packet->auxilaryData = NULL;
9999
#endif
100-
packet->nextCommand = NULL;
101-
102-
return packet;
103-
}
104-
105-
template <class CommandClass>
106-
CB_FORCE_INLINE CommandPacket* CommandPacket::getCommandPacket(CommandClass* commandData)
107-
{
108-
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
109-
return reinterpret_cast<CommandPacket*>(reinterpret_cast<uint8_t*>(commandData) - sizeof(CommandPacket));
110-
}
111-
112-
template <class CommandClass>
113-
CB_FORCE_INLINE const CommandPacket* CommandPacket::getCommandPacket(const CommandClass* commandData)
114-
{
115-
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
116-
return reinterpret_cast<const CommandPacket*>(reinterpret_cast<const uint8_t*>(commandData) -
117-
sizeof(CommandPacket));
118-
}
119-
120-
template <class CommandClass>
121-
CB_FORCE_INLINE CommandClass* CommandPacket::getCommandData(CommandPacket* packet)
122-
{
123-
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
124-
return reinterpret_cast<CommandClass*>(packet->commandData);
125-
}
126-
127-
template <class CommandClass, typename CastType>
128-
CB_FORCE_INLINE CastType* CommandPacket::getAuxilaryData(CommandClass* commandData)
129-
{
130-
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
131-
CommandPacket* packet = CommandPacket::getCommandPacket<CommandClass>(commandData);
132-
return reinterpret_cast<CastType*>(packet->auxilaryData);
133-
}
134-
135-
CB_FORCE_INLINE void CommandPacket::dispatch(const cb::CommandPacket* packet, cb::RenderContext* rc)
136-
{
137-
do
138-
{
139-
(*packet->dispatchFunction)(packet->commandData, rc);
140-
packet = packet->nextCommand;
141-
} while (packet != NULL);
142-
}
100+
packet->nextCommand = NULL;
101+
102+
return packet;
103+
}
104+
105+
template <class CommandClass>
106+
CB_FORCE_INLINE CommandPacket* CommandPacket::getCommandPacket(CommandClass* commandData)
107+
{
108+
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
109+
return reinterpret_cast<CommandPacket*>(reinterpret_cast<uint8_t*>(commandData) - sizeof(CommandPacket));
110+
}
111+
112+
template <class CommandClass>
113+
CB_FORCE_INLINE const CommandPacket* CommandPacket::getCommandPacket(const CommandClass* commandData)
114+
{
115+
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
116+
return reinterpret_cast<const CommandPacket*>(reinterpret_cast<const uint8_t*>(commandData) -
117+
sizeof(CommandPacket));
118+
}
119+
120+
template <class CommandClass>
121+
CB_FORCE_INLINE CommandClass* CommandPacket::getCommandData(CommandPacket* packet)
122+
{
123+
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
124+
return reinterpret_cast<CommandClass*>(packet->commandData);
125+
}
126+
127+
template <class CommandClass, typename CastType>
128+
CB_FORCE_INLINE CastType* CommandPacket::getAuxilaryData(CommandClass* commandData)
129+
{
130+
static_assert(is_valid_type<CommandClass>::value, "COMMAND_INVALID_TYPE");
131+
CommandPacket* packet = CommandPacket::getCommandPacket<CommandClass>(commandData);
132+
return reinterpret_cast<CastType*>(packet->auxilaryData);
133+
}
134+
135+
CB_FORCE_INLINE void CommandPacket::dispatch(const cb::CommandPacket* packet, cb::RenderContext* rc)
136+
{
137+
do
138+
{
139+
(*packet->dispatchFunction)(packet->commandData, rc);
140+
packet = packet->nextCommand;
141+
} while (packet != NULL);
142+
}
143143

144144
#if CB_DEBUG_TAG_COMMANDS
145-
template <class CommandClass>
146-
CB_FORCE_INLINE CommandPacket& CommandPacket::command(CommandClass& cmd)
147-
{
148-
return *CommandPacket::getCommandPacket<CommandClass>(&cmd);
149-
}
150-
151-
template <class CommandClass>
152-
CB_FORCE_INLINE CommandPacket& CommandPacket::command(CommandClass* cmd)
153-
{
154-
return *CommandPacket::getCommandPacket<CommandClass>(cmd);
155-
}
156-
157-
template <class CommandClass>
158-
CB_FORCE_INLINE std::string CommandPacket::commandName(CommandClass& cmd)
159-
{
160-
return typeid(&cmd).name();
161-
}
162-
163-
template <class CommandClass>
164-
CB_FORCE_INLINE std::string CommandPacket::commandName(CommandClass* cmd)
165-
{
166-
return typeid(cmd).name();
167-
}
168-
169-
CB_FORCE_INLINE void CommandPacket::log(const cb::CommandPacket* packet, log_function_t logger)
170-
{
171-
do
172-
{
173-
if (packet->nextCommand != NULL)
174-
(*logger)("%s ->", packet->debug.tag);
175-
else
176-
(*logger)("%s", packet->debug.tag);
177-
packet = packet->nextCommand;
178-
} while (packet != NULL);
179-
(*logger)("\n");
180-
}
145+
template <class CommandClass>
146+
CB_FORCE_INLINE CommandPacket& CommandPacket::command(CommandClass& cmd)
147+
{
148+
return *CommandPacket::getCommandPacket<CommandClass>(&cmd);
149+
}
150+
151+
template <class CommandClass>
152+
CB_FORCE_INLINE CommandPacket& CommandPacket::command(CommandClass* cmd)
153+
{
154+
return *CommandPacket::getCommandPacket<CommandClass>(cmd);
155+
}
156+
157+
template <class CommandClass>
158+
CB_FORCE_INLINE std::string CommandPacket::commandName(CommandClass& cmd)
159+
{
160+
return typeid(&cmd).name();
161+
}
162+
163+
template <class CommandClass>
164+
CB_FORCE_INLINE std::string CommandPacket::commandName(CommandClass* cmd)
165+
{
166+
return typeid(cmd).name();
167+
}
168+
169+
CB_FORCE_INLINE void CommandPacket::log(const cb::CommandPacket* packet, log_function_t logger)
170+
{
171+
do
172+
{
173+
if (packet->nextCommand != NULL)
174+
(*logger)("%s ->", packet->debug.tag);
175+
else
176+
(*logger)("%s", packet->debug.tag);
177+
packet = packet->nextCommand;
178+
} while (packet != NULL);
179+
(*logger)("\n");
180+
}
181181
#endif // #if CB_DEBUG_TAG_COMMANDS
182182

183183
} // namespace cb

0 commit comments

Comments
 (0)