2 * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
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:
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
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. */
23 #ifndef _NINE_VOLUME9_H_
24 #define _NINE_VOLUME9_H_
28 #include "pipe/p_state.h"
29 #include "util/u_inlines.h"
31 struct util_hash_table
;
37 struct NineUnknown base
;
39 struct pipe_resource
*resource
;
41 unsigned level_actual
;
43 uint8_t *data
; /* system memory backing */
46 struct pipe_resource info
;
48 unsigned layer_stride
;
50 struct pipe_transfer
*transfer
;
53 struct pipe_box dirty_box
[2];
55 struct pipe_context
*pipe
;
57 /* for [GS]etPrivateData/FreePrivateData */
58 struct util_hash_table
*pdata
;
60 static INLINE
struct NineVolume9
*
61 NineVolume9( void *data
)
63 return (struct NineVolume9
*)data
;
67 NineVolume9_new( struct NineDevice9
*pDevice
,
68 struct NineUnknown
*pContainer
,
69 struct pipe_resource
*pResource
,
71 D3DVOLUME_DESC
*pDesc
,
72 struct NineVolume9
**ppOut
);
74 /*** Nine private ***/
77 NineVolume9_SetResource( struct NineVolume9
*This
,
78 struct pipe_resource
*resource
, unsigned level
)
81 pipe_resource_reference(&This
->resource
, resource
);
85 NineVolume9_AddDirtyRegion( struct NineVolume9
*This
,
86 const struct pipe_box
*box
);
89 NineVolume9_ClearDirtyRegion( struct NineVolume9
*This
)
91 memset(&This
->dirty_box
, 0, sizeof(This
->dirty_box
));
95 NineVolume9_CopyVolume( struct NineVolume9
*This
,
96 struct NineVolume9
*From
,
97 unsigned dstx
, unsigned dsty
, unsigned dstz
,
98 struct pipe_box
*pSrcBox
);
101 NineVolume9_UploadSelf( struct NineVolume9
*This
);
104 /*** Direct3D public ***/
107 NineVolume9_SetPrivateData( struct NineVolume9
*This
,
114 NineVolume9_GetPrivateData( struct NineVolume9
*This
,
117 DWORD
*pSizeOfData
);
120 NineVolume9_FreePrivateData( struct NineVolume9
*This
,
124 NineVolume9_GetContainer( struct NineVolume9
*This
,
126 void **ppContainer
);
129 NineVolume9_GetDesc( struct NineVolume9
*This
,
130 D3DVOLUME_DESC
*pDesc
);
133 NineVolume9_LockBox( struct NineVolume9
*This
,
134 D3DLOCKED_BOX
*pLockedVolume
,
139 NineVolume9_UnlockBox( struct NineVolume9
*This
);
141 #endif /* _NINE_VOLUME9_H_ */