-
Notifications
You must be signed in to change notification settings - Fork 0
/
RenderQueue.h
60 lines (42 loc) · 1.04 KB
/
RenderQueue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// Created by Marrony Neris on 11/7/15.
//
#ifndef RENDERQUEUE_H
#define RENDERQUEUE_H
#include <algorithm>
#include <functional>
#include "Allocator.h"
#include "Commands.h"
#include "Device.h"
struct RenderItem {
uint64_t key;
int commandBufferCount;
CommandBuffer* commandBuffer[16];
};
struct RenderGroup {
CommandBuffer* commandBuffer;
int itemsCount;
RenderItem* items;
};
class RenderQueue {
public:
RenderQueue(Device& device, HeapAllocator& allocator);
~RenderQueue();
void submit(uint64_t key, CommandBuffer** commandBuffer, int commandBufferCount);
void sort();
CommandBuffer* sendToCommandBuffer();
void sendToDevice();
int getSkippedCommands();
int getExecutedCommands();
private:
void submit(std::function<void(Command*)> execute);
bool isDirectCommand(uint32_t id);
void invoke(Command* cmd);
Device& device;
HeapAllocator& allocator;
int itemsCount;
RenderItem* items;
int executedCommands;
int skippedCommands;
};
#endif //RENDERQUEUE_H