-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathreduce.h
More file actions
28 lines (22 loc) · 840 Bytes
/
reduce.h
File metadata and controls
28 lines (22 loc) · 840 Bytes
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
#pragma once
#include <Vortex2D/Vortex2D.h>
extern Vortex2D::Renderer::Device* gDevice;
class Reduce
{
public:
Reduce(const Vortex2D::Renderer::Device& device,
int size,
int localSize);
void Upload(const std::vector<float>& input);
float Download();
void Submit();
uint64_t GetElapsedNs();
private:
Vortex2D::Renderer::Timer mTimer;
Vortex2D::Renderer::CommandBuffer mUploadCmd, mDownloadCmd, mReduceCmd;
Vortex2D::Renderer::Work mReduceWork; // reduce shader
std::vector<Vortex2D::Renderer::Buffer<float>> mBuffers; // buffers for input, intermediate results and output
Vortex2D::Renderer::Buffer<float> mLocalInput, mLocalOutput; // buffers for copying input/output to device
std::vector<Vortex2D::Renderer::Work::Bound> mReduce; // bound reduce shaders for each level
};
void CheckReduce();