diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.h new file mode 100644 index 0000000..822ac80 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_VERTEX_BUFFER_CACHE_H__ | ||
2 | #define __EVAS_DIRECT3D_VERTEX_BUFFER_CACHE_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "array.h" | ||
8 | |||
9 | class D3DDevice; | ||
10 | |||
11 | class D3DVertexBufferCache : virtual public Referenc | ||
12 | { | ||
13 | public: | ||
14 | struct CacheEntryInfo | ||
15 | { | ||
16 | int id; | ||
17 | }; | ||
18 | |||
19 | public: | ||
20 | ~D3DVertexBufferCache(); | ||
21 | |||
22 | static D3DVertexBufferCache *Current(); | ||
23 | static void SetCurrent(D3DVertexBufferCache *obj); | ||
24 | |||
25 | inline void SetSizeBorders(FLOAT low, FLOAT high); | ||
26 | |||
27 | bool InitBuffer(D3DDevice *d3d, BYTE *data, int size, CacheEntryInfo &info); | ||
28 | bool SelectBufferToDevice(D3DDevice *device, int id, int vertex_size); | ||
29 | void Uninitialize(); | ||
30 | |||
31 | private: | ||
32 | struct CacheEntry | ||
33 | { | ||
34 | LPDIRECT3DVERTEXBUFFER9 vb; | ||
35 | int size; | ||
36 | }; | ||
37 | |||
38 | private: | ||
39 | D3DVertexBufferCache(); | ||
40 | |||
41 | int FindBestEntry(int size); | ||
42 | bool CreateEntry(D3DDevice *d3d, CacheEntry &entry, int size); | ||
43 | void DeleteEntry(int id); | ||
44 | bool InsertData(CacheEntry &entry, BYTE *data, int size); | ||
45 | |||
46 | private: | ||
47 | TArray<CacheEntry> _cache; | ||
48 | FLOAT size_border_low; | ||
49 | FLOAT size_border_high; | ||
50 | |||
51 | static Ref<D3DVertexBufferCache> _this; | ||
52 | }; | ||
53 | |||
54 | void D3DVertexBufferCache::SetSizeBorders(FLOAT low, FLOAT high) | ||
55 | { | ||
56 | size_border_low = low; | ||
57 | size_border_high = high; | ||
58 | } | ||
59 | |||
60 | #endif // __EVAS_DIRECT3D_VERTEX_BUFFER_CACHE_H__ | ||