1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * on the rights to use, copy, modify, merge, publish, distribute, sub
8bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom
9bf215546Sopenharmony_ci * the Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22bf215546Sopenharmony_ci
23bf215546Sopenharmony_ci#include "c99_alloca.h"
24bf215546Sopenharmony_ci
25bf215546Sopenharmony_ci#include "device9.h"
26bf215546Sopenharmony_ci#include "cubetexture9.h"
27bf215546Sopenharmony_ci#include "nine_memory_helper.h"
28bf215546Sopenharmony_ci#include "nine_helpers.h"
29bf215546Sopenharmony_ci#include "nine_pipe.h"
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci#define DBG_CHANNEL DBG_CUBETEXTURE
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_cistatic HRESULT
35bf215546Sopenharmony_ciNineCubeTexture9_ctor( struct NineCubeTexture9 *This,
36bf215546Sopenharmony_ci                       struct NineUnknownParams *pParams,
37bf215546Sopenharmony_ci                       UINT EdgeLength, UINT Levels,
38bf215546Sopenharmony_ci                       DWORD Usage,
39bf215546Sopenharmony_ci                       D3DFORMAT Format,
40bf215546Sopenharmony_ci                       D3DPOOL Pool,
41bf215546Sopenharmony_ci                       HANDLE *pSharedHandle )
42bf215546Sopenharmony_ci{
43bf215546Sopenharmony_ci    struct pipe_resource *info = &This->base.base.info;
44bf215546Sopenharmony_ci    struct pipe_screen *screen = pParams->device->screen;
45bf215546Sopenharmony_ci    enum pipe_format pf;
46bf215546Sopenharmony_ci    unsigned i, l, f, offset, face_size = 0;
47bf215546Sopenharmony_ci    unsigned *level_offsets = NULL;
48bf215546Sopenharmony_ci    D3DSURFACE_DESC sfdesc;
49bf215546Sopenharmony_ci    struct nine_allocation *p;
50bf215546Sopenharmony_ci    HRESULT hr;
51bf215546Sopenharmony_ci
52bf215546Sopenharmony_ci    DBG("This=%p pParams=%p EdgeLength=%u Levels=%u Usage=%d "
53bf215546Sopenharmony_ci        "Format=%d Pool=%d pSharedHandle=%p\n",
54bf215546Sopenharmony_ci        This, pParams, EdgeLength, Levels, Usage,
55bf215546Sopenharmony_ci        Format, Pool, pSharedHandle);
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_ci    This->base.base.base.device = pParams->device; /* Early fill this field in case of failure */
58bf215546Sopenharmony_ci
59bf215546Sopenharmony_ci    user_assert(EdgeLength, D3DERR_INVALIDCALL);
60bf215546Sopenharmony_ci
61bf215546Sopenharmony_ci    /* user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); */
62bf215546Sopenharmony_ci    user_assert(!pSharedHandle, D3DERR_INVALIDCALL); /* TODO */
63bf215546Sopenharmony_ci
64bf215546Sopenharmony_ci    user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
65bf215546Sopenharmony_ci                (Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL);
66bf215546Sopenharmony_ci
67bf215546Sopenharmony_ci    if (Usage & D3DUSAGE_AUTOGENMIPMAP)
68bf215546Sopenharmony_ci        Levels = 0;
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_ci    pf = d3d9_to_pipe_format_checked(screen, Format, PIPE_TEXTURE_CUBE, 0,
71bf215546Sopenharmony_ci                                     PIPE_BIND_SAMPLER_VIEW, FALSE,
72bf215546Sopenharmony_ci                                     Pool == D3DPOOL_SCRATCH);
73bf215546Sopenharmony_ci
74bf215546Sopenharmony_ci    if (pf == PIPE_FORMAT_NONE)
75bf215546Sopenharmony_ci        return D3DERR_INVALIDCALL;
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ci    if (compressed_format(Format)) {
78bf215546Sopenharmony_ci        const unsigned w = util_format_get_blockwidth(pf);
79bf215546Sopenharmony_ci        const unsigned h = util_format_get_blockheight(pf);
80bf215546Sopenharmony_ci
81bf215546Sopenharmony_ci        user_assert(!(EdgeLength % w) && !(EdgeLength % h), D3DERR_INVALIDCALL);
82bf215546Sopenharmony_ci    }
83bf215546Sopenharmony_ci
84bf215546Sopenharmony_ci    info->screen = pParams->device->screen;
85bf215546Sopenharmony_ci    info->target = PIPE_TEXTURE_CUBE;
86bf215546Sopenharmony_ci    info->format = pf;
87bf215546Sopenharmony_ci    info->width0 = EdgeLength;
88bf215546Sopenharmony_ci    info->height0 = EdgeLength;
89bf215546Sopenharmony_ci    info->depth0 = 1;
90bf215546Sopenharmony_ci    if (Levels)
91bf215546Sopenharmony_ci        info->last_level = Levels - 1;
92bf215546Sopenharmony_ci    else
93bf215546Sopenharmony_ci        info->last_level = util_logbase2(EdgeLength);
94bf215546Sopenharmony_ci    info->array_size = 6;
95bf215546Sopenharmony_ci    info->nr_samples = 0;
96bf215546Sopenharmony_ci    info->nr_storage_samples = 0;
97bf215546Sopenharmony_ci    info->bind = PIPE_BIND_SAMPLER_VIEW;
98bf215546Sopenharmony_ci    info->usage = PIPE_USAGE_DEFAULT;
99bf215546Sopenharmony_ci    info->flags = 0;
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_ci    if (Usage & D3DUSAGE_RENDERTARGET)
102bf215546Sopenharmony_ci        info->bind |= PIPE_BIND_RENDER_TARGET;
103bf215546Sopenharmony_ci    if (Usage & D3DUSAGE_DEPTHSTENCIL)
104bf215546Sopenharmony_ci        info->bind |= PIPE_BIND_DEPTH_STENCIL;
105bf215546Sopenharmony_ci
106bf215546Sopenharmony_ci    if (Usage & D3DUSAGE_DYNAMIC) {
107bf215546Sopenharmony_ci        info->usage = PIPE_USAGE_DYNAMIC;
108bf215546Sopenharmony_ci    }
109bf215546Sopenharmony_ci    if (Usage & D3DUSAGE_SOFTWAREPROCESSING)
110bf215546Sopenharmony_ci        DBG("Application asked for Software Vertex Processing, "
111bf215546Sopenharmony_ci            "but this is unimplemented\n");
112bf215546Sopenharmony_ci
113bf215546Sopenharmony_ci    hr = NineBaseTexture9_ctor(&This->base, pParams, NULL, D3DRTYPE_CUBETEXTURE,
114bf215546Sopenharmony_ci                               Format, Pool, Usage);
115bf215546Sopenharmony_ci    if (FAILED(hr))
116bf215546Sopenharmony_ci        return hr;
117bf215546Sopenharmony_ci    This->base.pstype = 2;
118bf215546Sopenharmony_ci
119bf215546Sopenharmony_ci    if (Pool != D3DPOOL_DEFAULT) {
120bf215546Sopenharmony_ci        level_offsets = alloca(sizeof(unsigned) * This->base.level_count);
121bf215546Sopenharmony_ci        face_size = nine_format_get_size_and_offsets(pf, level_offsets,
122bf215546Sopenharmony_ci                                                     EdgeLength, EdgeLength,
123bf215546Sopenharmony_ci                                                     This->base.level_count-1);
124bf215546Sopenharmony_ci        This->managed_buffer = nine_allocate(pParams->device->allocator, 6 * face_size);
125bf215546Sopenharmony_ci        if (!This->managed_buffer)
126bf215546Sopenharmony_ci            return E_OUTOFMEMORY;
127bf215546Sopenharmony_ci    }
128bf215546Sopenharmony_ci
129bf215546Sopenharmony_ci    This->surfaces = CALLOC(6 * This->base.level_count, sizeof(*This->surfaces));
130bf215546Sopenharmony_ci    if (!This->surfaces)
131bf215546Sopenharmony_ci        return E_OUTOFMEMORY;
132bf215546Sopenharmony_ci
133bf215546Sopenharmony_ci    /* Create all the surfaces right away.
134bf215546Sopenharmony_ci     * They manage backing storage, and transfers (LockRect) are deferred
135bf215546Sopenharmony_ci     * to them.
136bf215546Sopenharmony_ci     */
137bf215546Sopenharmony_ci    sfdesc.Format = Format;
138bf215546Sopenharmony_ci    sfdesc.Type = D3DRTYPE_SURFACE;
139bf215546Sopenharmony_ci    sfdesc.Usage = Usage;
140bf215546Sopenharmony_ci    sfdesc.Pool = Pool;
141bf215546Sopenharmony_ci    sfdesc.MultiSampleType = D3DMULTISAMPLE_NONE;
142bf215546Sopenharmony_ci    sfdesc.MultiSampleQuality = 0;
143bf215546Sopenharmony_ci    /* We allocate the memory for the surfaces as continous blocks.
144bf215546Sopenharmony_ci     * This is the expected behaviour, however we haven't tested for
145bf215546Sopenharmony_ci     * cube textures in which order the faces/levels should be in memory
146bf215546Sopenharmony_ci     */
147bf215546Sopenharmony_ci    for (f = 0; f < 6; f++) {
148bf215546Sopenharmony_ci        offset = f * face_size;
149bf215546Sopenharmony_ci        for (l = 0; l < This->base.level_count; l++) {
150bf215546Sopenharmony_ci            sfdesc.Width = sfdesc.Height = u_minify(EdgeLength, l);
151bf215546Sopenharmony_ci            p = This->managed_buffer ?
152bf215546Sopenharmony_ci                nine_suballocate(pParams->device->allocator, This->managed_buffer, offset + level_offsets[l]) : NULL;
153bf215546Sopenharmony_ci
154bf215546Sopenharmony_ci            hr = NineSurface9_new(This->base.base.base.device, NineUnknown(This),
155bf215546Sopenharmony_ci                                  This->base.base.resource, p, D3DRTYPE_CUBETEXTURE,
156bf215546Sopenharmony_ci                                  l, f, &sfdesc, &This->surfaces[f + 6 * l]);
157bf215546Sopenharmony_ci            if (FAILED(hr))
158bf215546Sopenharmony_ci                return hr;
159bf215546Sopenharmony_ci        }
160bf215546Sopenharmony_ci    }
161bf215546Sopenharmony_ci
162bf215546Sopenharmony_ci    for (i = 0; i < 6; ++i) {
163bf215546Sopenharmony_ci        /* Textures start initially dirty */
164bf215546Sopenharmony_ci        This->dirty_rect[i].width = EdgeLength;
165bf215546Sopenharmony_ci        This->dirty_rect[i].height = EdgeLength;
166bf215546Sopenharmony_ci        This->dirty_rect[i].depth = 1;
167bf215546Sopenharmony_ci    }
168bf215546Sopenharmony_ci
169bf215546Sopenharmony_ci    return D3D_OK;
170bf215546Sopenharmony_ci}
171bf215546Sopenharmony_ci
172bf215546Sopenharmony_cistatic void
173bf215546Sopenharmony_ciNineCubeTexture9_dtor( struct NineCubeTexture9 *This )
174bf215546Sopenharmony_ci{
175bf215546Sopenharmony_ci    unsigned i;
176bf215546Sopenharmony_ci    bool is_worker = nine_context_is_worker(This->base.base.base.device);
177bf215546Sopenharmony_ci
178bf215546Sopenharmony_ci    DBG("This=%p\n", This);
179bf215546Sopenharmony_ci
180bf215546Sopenharmony_ci    if (This->surfaces) {
181bf215546Sopenharmony_ci        for (i = 0; i < This->base.level_count * 6; ++i)
182bf215546Sopenharmony_ci            if (This->surfaces[i])
183bf215546Sopenharmony_ci                NineUnknown_Destroy(&This->surfaces[i]->base.base);
184bf215546Sopenharmony_ci        FREE(This->surfaces);
185bf215546Sopenharmony_ci    }
186bf215546Sopenharmony_ci
187bf215546Sopenharmony_ci    if (This->managed_buffer) {
188bf215546Sopenharmony_ci        if (is_worker)
189bf215546Sopenharmony_ci            nine_free_worker(This->base.base.base.device->allocator, This->managed_buffer);
190bf215546Sopenharmony_ci        else
191bf215546Sopenharmony_ci            nine_free(This->base.base.base.device->allocator, This->managed_buffer);
192bf215546Sopenharmony_ci    }
193bf215546Sopenharmony_ci
194bf215546Sopenharmony_ci    NineBaseTexture9_dtor(&This->base);
195bf215546Sopenharmony_ci}
196bf215546Sopenharmony_ci
197bf215546Sopenharmony_ciHRESULT NINE_WINAPI
198bf215546Sopenharmony_ciNineCubeTexture9_GetLevelDesc( struct NineCubeTexture9 *This,
199bf215546Sopenharmony_ci                               UINT Level,
200bf215546Sopenharmony_ci                               D3DSURFACE_DESC *pDesc )
201bf215546Sopenharmony_ci{
202bf215546Sopenharmony_ci    DBG("This=%p Level=%u pDesc=%p\n", This, Level, pDesc);
203bf215546Sopenharmony_ci
204bf215546Sopenharmony_ci    user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
205bf215546Sopenharmony_ci
206bf215546Sopenharmony_ci    *pDesc = This->surfaces[Level * 6]->desc;
207bf215546Sopenharmony_ci
208bf215546Sopenharmony_ci    return D3D_OK;
209bf215546Sopenharmony_ci}
210bf215546Sopenharmony_ci
211bf215546Sopenharmony_ciHRESULT NINE_WINAPI
212bf215546Sopenharmony_ciNineCubeTexture9_GetCubeMapSurface( struct NineCubeTexture9 *This,
213bf215546Sopenharmony_ci                                    D3DCUBEMAP_FACES FaceType,
214bf215546Sopenharmony_ci                                    UINT Level,
215bf215546Sopenharmony_ci                                    IDirect3DSurface9 **ppCubeMapSurface )
216bf215546Sopenharmony_ci{
217bf215546Sopenharmony_ci    const unsigned s = Level * 6 + FaceType;
218bf215546Sopenharmony_ci
219bf215546Sopenharmony_ci    DBG("This=%p FaceType=%d Level=%u ppCubeMapSurface=%p\n",
220bf215546Sopenharmony_ci        This, FaceType, Level, ppCubeMapSurface);
221bf215546Sopenharmony_ci
222bf215546Sopenharmony_ci    user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
223bf215546Sopenharmony_ci    user_assert(FaceType < 6, D3DERR_INVALIDCALL);
224bf215546Sopenharmony_ci
225bf215546Sopenharmony_ci    NineUnknown_AddRef(NineUnknown(This->surfaces[s]));
226bf215546Sopenharmony_ci    *ppCubeMapSurface = (IDirect3DSurface9 *)This->surfaces[s];
227bf215546Sopenharmony_ci
228bf215546Sopenharmony_ci    return D3D_OK;
229bf215546Sopenharmony_ci}
230bf215546Sopenharmony_ci
231bf215546Sopenharmony_ciHRESULT NINE_WINAPI
232bf215546Sopenharmony_ciNineCubeTexture9_LockRect( struct NineCubeTexture9 *This,
233bf215546Sopenharmony_ci                           D3DCUBEMAP_FACES FaceType,
234bf215546Sopenharmony_ci                           UINT Level,
235bf215546Sopenharmony_ci                           D3DLOCKED_RECT *pLockedRect,
236bf215546Sopenharmony_ci                           const RECT *pRect,
237bf215546Sopenharmony_ci                           DWORD Flags )
238bf215546Sopenharmony_ci{
239bf215546Sopenharmony_ci    const unsigned s = Level * 6 + FaceType;
240bf215546Sopenharmony_ci
241bf215546Sopenharmony_ci    DBG("This=%p FaceType=%d Level=%u pLockedRect=%p pRect=%p Flags=%d\n",
242bf215546Sopenharmony_ci        This, FaceType, Level, pLockedRect, pRect, Flags);
243bf215546Sopenharmony_ci
244bf215546Sopenharmony_ci    user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
245bf215546Sopenharmony_ci    user_assert(FaceType < 6, D3DERR_INVALIDCALL);
246bf215546Sopenharmony_ci
247bf215546Sopenharmony_ci    return NineSurface9_LockRect(This->surfaces[s], pLockedRect, pRect, Flags);
248bf215546Sopenharmony_ci}
249bf215546Sopenharmony_ci
250bf215546Sopenharmony_ciHRESULT NINE_WINAPI
251bf215546Sopenharmony_ciNineCubeTexture9_UnlockRect( struct NineCubeTexture9 *This,
252bf215546Sopenharmony_ci                             D3DCUBEMAP_FACES FaceType,
253bf215546Sopenharmony_ci                             UINT Level )
254bf215546Sopenharmony_ci{
255bf215546Sopenharmony_ci    const unsigned s = Level * 6 + FaceType;
256bf215546Sopenharmony_ci
257bf215546Sopenharmony_ci    DBG("This=%p FaceType=%d Level=%u\n", This, FaceType, Level);
258bf215546Sopenharmony_ci
259bf215546Sopenharmony_ci    user_assert(Level < This->base.level_count, D3DERR_INVALIDCALL);
260bf215546Sopenharmony_ci    user_assert(FaceType < 6, D3DERR_INVALIDCALL);
261bf215546Sopenharmony_ci
262bf215546Sopenharmony_ci    return NineSurface9_UnlockRect(This->surfaces[s]);
263bf215546Sopenharmony_ci}
264bf215546Sopenharmony_ci
265bf215546Sopenharmony_ciHRESULT NINE_WINAPI
266bf215546Sopenharmony_ciNineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This,
267bf215546Sopenharmony_ci                               D3DCUBEMAP_FACES FaceType,
268bf215546Sopenharmony_ci                               const RECT *pDirtyRect )
269bf215546Sopenharmony_ci{
270bf215546Sopenharmony_ci    DBG("This=%p FaceType=%d pDirtyRect=%p\n", This, FaceType, pDirtyRect);
271bf215546Sopenharmony_ci
272bf215546Sopenharmony_ci    user_assert(FaceType < 6, D3DERR_INVALIDCALL);
273bf215546Sopenharmony_ci
274bf215546Sopenharmony_ci    if (This->base.base.pool != D3DPOOL_MANAGED) {
275bf215546Sopenharmony_ci        if (This->base.base.usage & D3DUSAGE_AUTOGENMIPMAP) {
276bf215546Sopenharmony_ci            This->base.dirty_mip = TRUE;
277bf215546Sopenharmony_ci            BASETEX_REGISTER_UPDATE(&This->base);
278bf215546Sopenharmony_ci        }
279bf215546Sopenharmony_ci        return D3D_OK;
280bf215546Sopenharmony_ci    }
281bf215546Sopenharmony_ci
282bf215546Sopenharmony_ci    if (This->base.base.pool == D3DPOOL_MANAGED) {
283bf215546Sopenharmony_ci        This->base.managed.dirty = TRUE;
284bf215546Sopenharmony_ci        BASETEX_REGISTER_UPDATE(&This->base);
285bf215546Sopenharmony_ci    }
286bf215546Sopenharmony_ci
287bf215546Sopenharmony_ci    if (!pDirtyRect) {
288bf215546Sopenharmony_ci        u_box_origin_2d(This->base.base.info.width0,
289bf215546Sopenharmony_ci                        This->base.base.info.height0,
290bf215546Sopenharmony_ci                        &This->dirty_rect[FaceType]);
291bf215546Sopenharmony_ci    } else {
292bf215546Sopenharmony_ci        if (This->dirty_rect[FaceType].width == 0) {
293bf215546Sopenharmony_ci            rect_to_pipe_box_clamp(&This->dirty_rect[FaceType], pDirtyRect);
294bf215546Sopenharmony_ci        } else {
295bf215546Sopenharmony_ci            struct pipe_box box;
296bf215546Sopenharmony_ci            rect_to_pipe_box_clamp(&box, pDirtyRect);
297bf215546Sopenharmony_ci            u_box_union_2d(&This->dirty_rect[FaceType], &This->dirty_rect[FaceType],
298bf215546Sopenharmony_ci                           &box);
299bf215546Sopenharmony_ci        }
300bf215546Sopenharmony_ci        (void) u_box_clip_2d(&This->dirty_rect[FaceType],
301bf215546Sopenharmony_ci                             &This->dirty_rect[FaceType],
302bf215546Sopenharmony_ci                             This->base.base.info.width0,
303bf215546Sopenharmony_ci                             This->base.base.info.height0);
304bf215546Sopenharmony_ci    }
305bf215546Sopenharmony_ci    return D3D_OK;
306bf215546Sopenharmony_ci}
307bf215546Sopenharmony_ci
308bf215546Sopenharmony_ciIDirect3DCubeTexture9Vtbl NineCubeTexture9_vtable = {
309bf215546Sopenharmony_ci    (void *)NineUnknown_QueryInterface,
310bf215546Sopenharmony_ci    (void *)NineUnknown_AddRef,
311bf215546Sopenharmony_ci    (void *)NineUnknown_Release,
312bf215546Sopenharmony_ci    (void *)NineUnknown_GetDevice, /* actually part of Resource9 iface */
313bf215546Sopenharmony_ci    (void *)NineUnknown_SetPrivateData,
314bf215546Sopenharmony_ci    (void *)NineUnknown_GetPrivateData,
315bf215546Sopenharmony_ci    (void *)NineUnknown_FreePrivateData,
316bf215546Sopenharmony_ci    (void *)NineResource9_SetPriority,
317bf215546Sopenharmony_ci    (void *)NineResource9_GetPriority,
318bf215546Sopenharmony_ci    (void *)NineBaseTexture9_PreLoad,
319bf215546Sopenharmony_ci    (void *)NineResource9_GetType,
320bf215546Sopenharmony_ci    (void *)NineBaseTexture9_SetLOD,
321bf215546Sopenharmony_ci    (void *)NineBaseTexture9_GetLOD,
322bf215546Sopenharmony_ci    (void *)NineBaseTexture9_GetLevelCount,
323bf215546Sopenharmony_ci    (void *)NineBaseTexture9_SetAutoGenFilterType,
324bf215546Sopenharmony_ci    (void *)NineBaseTexture9_GetAutoGenFilterType,
325bf215546Sopenharmony_ci    (void *)NineBaseTexture9_GenerateMipSubLevels,
326bf215546Sopenharmony_ci    (void *)NineCubeTexture9_GetLevelDesc,
327bf215546Sopenharmony_ci    (void *)NineCubeTexture9_GetCubeMapSurface,
328bf215546Sopenharmony_ci    (void *)NineCubeTexture9_LockRect,
329bf215546Sopenharmony_ci    (void *)NineCubeTexture9_UnlockRect,
330bf215546Sopenharmony_ci    (void *)NineCubeTexture9_AddDirtyRect
331bf215546Sopenharmony_ci};
332bf215546Sopenharmony_ci
333bf215546Sopenharmony_cistatic const GUID *NineCubeTexture9_IIDs[] = {
334bf215546Sopenharmony_ci    &IID_IDirect3DCubeTexture9,
335bf215546Sopenharmony_ci    &IID_IDirect3DBaseTexture9,
336bf215546Sopenharmony_ci    &IID_IDirect3DResource9,
337bf215546Sopenharmony_ci    &IID_IUnknown,
338bf215546Sopenharmony_ci    NULL
339bf215546Sopenharmony_ci};
340bf215546Sopenharmony_ci
341bf215546Sopenharmony_ciHRESULT
342bf215546Sopenharmony_ciNineCubeTexture9_new( struct NineDevice9 *pDevice,
343bf215546Sopenharmony_ci                      UINT EdgeLength, UINT Levels,
344bf215546Sopenharmony_ci                      DWORD Usage,
345bf215546Sopenharmony_ci                      D3DFORMAT Format,
346bf215546Sopenharmony_ci                      D3DPOOL Pool,
347bf215546Sopenharmony_ci                      struct NineCubeTexture9 **ppOut,
348bf215546Sopenharmony_ci                      HANDLE *pSharedHandle )
349bf215546Sopenharmony_ci{
350bf215546Sopenharmony_ci    NINE_DEVICE_CHILD_NEW(CubeTexture9, ppOut, pDevice,
351bf215546Sopenharmony_ci                          EdgeLength, Levels,
352bf215546Sopenharmony_ci                          Usage, Format, Pool, pSharedHandle);
353bf215546Sopenharmony_ci}
354