st/nine: Align stack for entry points
[mesa.git] / src / gallium / state_trackers / nine / volume9.h
1 /*
2 * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22
23 #ifndef _NINE_VOLUME9_H_
24 #define _NINE_VOLUME9_H_
25
26 #include "iunknown.h"
27
28 #include "pipe/p_state.h"
29 #include "util/u_inlines.h"
30
31 struct util_hash_table;
32
33 struct NineDevice9;
34
35 struct NineVolume9
36 {
37 struct NineUnknown base;
38
39 struct pipe_resource *resource;
40 unsigned level;
41 unsigned level_actual;
42
43 uint8_t *data; /* system memory backing */
44
45 D3DVOLUME_DESC desc;
46 struct pipe_resource info;
47 unsigned stride;
48 unsigned layer_stride;
49
50 struct pipe_transfer *transfer;
51 unsigned lock_count;
52
53 struct pipe_context *pipe;
54
55 /* for [GS]etPrivateData/FreePrivateData */
56 struct util_hash_table *pdata;
57 };
58 static inline struct NineVolume9 *
59 NineVolume9( void *data )
60 {
61 return (struct NineVolume9 *)data;
62 }
63
64 HRESULT
65 NineVolume9_new( struct NineDevice9 *pDevice,
66 struct NineUnknown *pContainer,
67 struct pipe_resource *pResource,
68 unsigned Level,
69 D3DVOLUME_DESC *pDesc,
70 struct NineVolume9 **ppOut );
71
72 /*** Nine private ***/
73
74 static inline void
75 NineVolume9_SetResource( struct NineVolume9 *This,
76 struct pipe_resource *resource, unsigned level )
77 {
78 This->level = level;
79 pipe_resource_reference(&This->resource, resource);
80 }
81
82 void
83 NineVolume9_AddDirtyRegion( struct NineVolume9 *This,
84 const struct pipe_box *box );
85
86 HRESULT
87 NineVolume9_CopyMemToDefault( struct NineVolume9 *This,
88 struct NineVolume9 *From,
89 unsigned dstx, unsigned dsty, unsigned dstz,
90 struct pipe_box *pSrcBox );
91
92 HRESULT
93 NineVolume9_UploadSelf( struct NineVolume9 *This,
94 const struct pipe_box *damaged );
95
96
97 /*** Direct3D public ***/
98
99 HRESULT NINE_WINAPI
100 NineVolume9_SetPrivateData( struct NineVolume9 *This,
101 REFGUID refguid,
102 const void *pData,
103 DWORD SizeOfData,
104 DWORD Flags );
105
106 HRESULT NINE_WINAPI
107 NineVolume9_GetPrivateData( struct NineVolume9 *This,
108 REFGUID refguid,
109 void *pData,
110 DWORD *pSizeOfData );
111
112 HRESULT NINE_WINAPI
113 NineVolume9_FreePrivateData( struct NineVolume9 *This,
114 REFGUID refguid );
115
116 HRESULT NINE_WINAPI
117 NineVolume9_GetContainer( struct NineVolume9 *This,
118 REFIID riid,
119 void **ppContainer );
120
121 HRESULT NINE_WINAPI
122 NineVolume9_GetDesc( struct NineVolume9 *This,
123 D3DVOLUME_DESC *pDesc );
124
125 HRESULT NINE_WINAPI
126 NineVolume9_LockBox( struct NineVolume9 *This,
127 D3DLOCKED_BOX *pLockedVolume,
128 const D3DBOX *pBox,
129 DWORD Flags );
130
131 HRESULT NINE_WINAPI
132 NineVolume9_UnlockBox( struct NineVolume9 *This );
133
134 #endif /* _NINE_VOLUME9_H_ */