forked from baldurk/visor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpu.h
63 lines (57 loc) · 1.1 KB
/
gpu.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
61
62
63
#pragma once
struct GPUState
{
struct
{
VkBuffer buffer;
VkDeviceSize offset;
VkIndexType indexType;
} ib;
struct
{
VkBuffer buffer;
VkDeviceSize offset;
} vbs[4];
VkViewport view;
VkImage col[8];
VkImage depth;
VkPipeline pipeline;
VkDescriptorSet set;
};
struct int4
{
int4() {}
int4(int X, int Y, int Z, int W) : x(X), y(Y), z(Z), w(W) {}
union
{
struct
{
int x, y, z, w;
};
int v[4];
};
};
struct float4
{
float4() {}
float4(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) {}
union
{
struct
{
float x, y, z, w;
};
float v[4];
};
};
struct VertexCacheEntry
{
float4 position;
float4 interps[8];
};
void ClearTarget(VkImage target, const VkClearColorValue &col);
void ClearTarget(VkImage target, const VkClearDepthStencilValue &col);
void DrawTriangles(const GPUState &state, int numVerts, uint32_t first, bool indexed);
void InitTextureCache();
float4 sample_tex_wrapped(float u, float v, VkImage tex, VkDeviceSize byteOffs = 0);
float4 sample_cube_wrapped(float x, float y, float z, VkImage tex);