summaryrefslogtreecommitdiff
path: root/Runtime/GfxDevice/threaded/ThreadedDeviceStates.h
blob: a36a2fa8c60cb2c207a9822a0c8d146e590de82b (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#pragma once
#if ENABLE_MULTITHREADED_CODE

#include "Runtime/GfxDevice/GfxDeviceObjects.h"
#include "Runtime/GfxDevice/GfxDeviceResources.h"
#include "Runtime/GfxDevice/threaded/ClientIDMapper.h"
#include "Runtime/Filters/Mesh/VertexData.h"
#include "Runtime/Graphics/RenderSurface.h"

namespace ShaderLab { struct TextureBinding; }
namespace xenon { class IVideoPlayer; }
class VBO;
class RawVBO;
class GfxTimerQuery;
class GfxDeviceWindow;

struct ClientDeviceRect
{
	ClientDeviceRect() : x(0), y(0), width(0), height(0) {}
	int x;
	int y;
	int width;
	int height;
};

struct ClientDeviceBlendState : public DeviceBlendState
{
	ClientDeviceBlendState(const GfxBlendState& src) : DeviceBlendState(src), internalState(NULL) {}
	ClientIDWrapper(DeviceBlendState) internalState;
};

struct ClientDeviceDepthState : public DeviceDepthState
{
	ClientDeviceDepthState(const GfxDepthState& src) : DeviceDepthState(src), internalState(NULL) {}
	ClientIDWrapper(DeviceDepthState) internalState;
};

struct ClientDeviceStencilState : public DeviceStencilState
{
	ClientDeviceStencilState(const GfxStencilState& src) : DeviceStencilState(src), internalState(NULL) {}
	ClientIDWrapper(DeviceStencilState) internalState;
};

struct ClientDeviceRasterState : public DeviceRasterState
{
	ClientDeviceRasterState(const GfxRasterState& src) : DeviceRasterState(src), internalState(NULL) {}
	ClientIDWrapper(DeviceRasterState) internalState;
};

struct ClientDeviceTextureCombiners
{
	ClientIDWrapperHandle(TextureCombinersHandle) internalHandle;
	ShaderLab::TextureBinding* bindings;
	int count;
};

struct ClientDeviceRenderSurface : RenderSurfaceBase
{
	enum SurfaceState { kInitial, kCleared, kRendered, kResolved };
	ClientDeviceRenderSurface(int w, int h) { RenderSurfaceBase_Init(*this); width=w; height=h; zformat=kDepthFormatNone; state=kInitial; }
	ClientIDWrapperHandle(RenderSurfaceHandle) internalHandle;
	DepthBufferFormat zformat;
	SurfaceState state;
};

struct ClientDeviceVBO
{
	ClientDeviceVBO() : internalVBO(NULL) {}

#if ENABLE_GFXDEVICE_REMOTE_PROCESS
	ClientIDWrapper(VBO) GetInternal() { return internalVBO; }
#else
	VBO* GetInternal() { return const_cast<VBO*>(internalVBO); }
#endif
	volatile ClientIDWrapper(VBO) internalVBO;
};

struct ClientVertexBufferData
{
	ChannelInfoArray channels;
	StreamInfoArray streams;
	int bufferSize;
	int vertexCount;
	int hasData;
};

struct ClientDeviceTimerQuery
{
	ClientDeviceTimerQuery() : internalQuery(NULL), elapsed(0), pending(false) {}
	GfxTimerQuery* GetInternal() { return const_cast<GfxTimerQuery*>(internalQuery); }
	volatile GfxTimerQuery* internalQuery;
	volatile UInt64 elapsed;
	volatile bool pending;
};

struct ClientDeviceWindow
{
	ClientDeviceWindow() : internalWindow(NULL) {}
	GfxDeviceWindow* GetInternal() { return const_cast<GfxDeviceWindow*>(internalWindow); }
	volatile GfxDeviceWindow* internalWindow;
};

struct ClientDeviceConstantBuffer
{
	ClientDeviceConstantBuffer(UInt32 sz) : size(sz) {}
	ConstantBufferHandle internalHandle;
	UInt32 size;
};

struct ClientDeviceComputeProgram
{
	ClientDeviceComputeProgram() {}
	ComputeProgramHandle internalHandle;
};


#if UNITY_XENON
struct ClientDeviceRawVBO
{
	ClientDeviceRawVBO() : internalVBO(NULL) {}
	RawVBO* GetInternal() { return const_cast<RawVBO*>(internalVBO); }
	volatile RawVBO* internalVBO;
};

struct ClientDeviceVideoPlayer
{
	ClientDeviceVideoPlayer() : internalVP(NULL), isDead(false) {}
	xenon::IVideoPlayer* GetInternal() { return const_cast<xenon::IVideoPlayer*>(internalVP); }
	volatile xenon::IVideoPlayer* internalVP;
	volatile bool isDead;
};
#endif

#endif