xref: /aosp_15_r20/external/mesa3d/src/gallium/frontends/nine/volume9.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2011 Joakim Sindholt <[email protected]>
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #ifndef _NINE_VOLUME9_H_
7 #define _NINE_VOLUME9_H_
8 
9 #include "iunknown.h"
10 
11 #include "pipe/p_state.h"
12 #include "util/u_inlines.h"
13 
14 struct hash_table;
15 
16 struct NineDevice9;
17 
18 struct NineVolume9
19 {
20     struct NineUnknown base;
21 
22     struct pipe_resource *resource;
23     unsigned level;
24     unsigned level_actual;
25 
26     uint8_t *data; /* system memory backing */
27     uint8_t *data_internal; /* for conversions */
28 
29     D3DVOLUME_DESC desc;
30     struct pipe_resource info;
31     enum pipe_format format_internal;
32     unsigned stride;
33     unsigned stride_internal;
34     unsigned layer_stride;
35     unsigned layer_stride_internal;
36 
37     struct pipe_transfer *transfer;
38     unsigned lock_count;
39 
40     unsigned pending_uploads_counter; /* pending uploads */
41 };
42 static inline struct NineVolume9 *
NineVolume9(void * data)43 NineVolume9( void *data )
44 {
45     return (struct NineVolume9 *)data;
46 }
47 
48 HRESULT
49 NineVolume9_new( struct NineDevice9 *pDevice,
50                  struct NineUnknown *pContainer,
51                  struct pipe_resource *pResource,
52                  unsigned Level,
53                  D3DVOLUME_DESC *pDesc,
54                  struct NineVolume9 **ppOut );
55 
56 /*** Nine private ***/
57 
58 static inline void
NineVolume9_SetResource(struct NineVolume9 * This,struct pipe_resource * resource,unsigned level)59 NineVolume9_SetResource( struct NineVolume9 *This,
60                          struct pipe_resource *resource, unsigned level )
61 {
62     This->level = level;
63     pipe_resource_reference(&This->resource, resource);
64 }
65 
66 void
67 NineVolume9_AddDirtyRegion( struct NineVolume9 *This,
68                             const struct pipe_box *box );
69 
70 void
71 NineVolume9_CopyMemToDefault( struct NineVolume9 *This,
72                               struct NineVolume9 *From,
73                               unsigned dstx, unsigned dsty, unsigned dstz,
74                               struct pipe_box *pSrcBox );
75 
76 HRESULT
77 NineVolume9_UploadSelf( struct NineVolume9 *This,
78                         const struct pipe_box *damaged );
79 
80 
81 /*** Direct3D public ***/
82 
83 HRESULT NINE_WINAPI
84 NineVolume9_GetContainer( struct NineVolume9 *This,
85                           REFIID riid,
86                           void **ppContainer );
87 
88 HRESULT NINE_WINAPI
89 NineVolume9_GetDesc( struct NineVolume9 *This,
90                      D3DVOLUME_DESC *pDesc );
91 
92 HRESULT NINE_WINAPI
93 NineVolume9_LockBox( struct NineVolume9 *This,
94                      D3DLOCKED_BOX *pLockedVolume,
95                      const D3DBOX *pBox,
96                      DWORD Flags );
97 
98 HRESULT NINE_WINAPI
99 NineVolume9_UnlockBox( struct NineVolume9 *This );
100 
101 #endif /* _NINE_VOLUME9_H_ */
102