ReactOS 0.4.16-dev-340-g0540c21
resource.c
Go to the documentation of this file.
1/*
2 * Copyright 2002-2004 Jason Edmeades
3 * Copyright 2003-2004 Raphael Junqueira
4 * Copyright 2004 Christian Costa
5 * Copyright 2005 Oliver Stieber
6 * Copyright 2009-2010 Henri Verbeet for CodeWeavers
7 * Copyright 2006-2008, 2013 Stefan Dösinger for CodeWeavers
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include "config.h"
25#include "wine/port.h"
26#include "wined3d_private.h"
27
30
32{
33 static DWORD handled = WINED3DUSAGE_RENDERTARGET
43
44 /* WINED3DUSAGE_WRITEONLY is supposed to result in write-combined mappings
45 * being returned. OpenGL doesn't give us explicit control over that, but
46 * the hints and access flags we set for typical access patterns on
47 * dynamic resources should in theory have the same effect on the OpenGL
48 * driver. */
49
50 if (usage & ~handled)
51 {
52 FIXME("Unhandled usage flags %#x.\n", usage & ~handled);
53 handled |= usage;
54 }
56 WARN_(d3d_perf)("WINED3DUSAGE_DYNAMIC used without WINED3DUSAGE_WRITEONLY.\n");
57}
58
61 enum wined3d_multisample_type multisample_type, unsigned int multisample_quality,
62 unsigned int usage, unsigned int access, unsigned int width, unsigned int height, unsigned int depth,
63 unsigned int size, void *parent, const struct wined3d_parent_ops *parent_ops,
64 const struct wined3d_resource_ops *resource_ops)
65{
68 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
69 BOOL tex_2d_ok = FALSE;
70 unsigned int i;
71
72 static const struct
73 {
75 DWORD cube_usage;
76 enum wined3d_gl_resource_type gl_type;
77 }
78 resource_types[] =
79 {
87 };
88
90
92 {
93 ERR("Trying to create a scratch resource with access flags %s.\n",
96 }
97
98 for (i = 0; i < ARRAY_SIZE(resource_types); ++i)
99 {
100 if (resource_types[i].type != type
101 || resource_types[i].cube_usage != (usage & WINED3DUSAGE_LEGACY_CUBEMAP))
102 continue;
103
104 gl_type = resource_types[i].gl_type;
105 if (base_type == WINED3D_GL_RES_TYPE_COUNT)
106 base_type = gl_type;
107
109 {
110 WARN("Format %s cannot be used for render targets.\n", debug_d3dformat(format->id));
111 continue;
112 }
114 && !(format->flags[gl_type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
115 {
116 WARN("Format %s cannot be used for depth/stencil buffers.\n", debug_d3dformat(format->id));
117 continue;
118 }
121 && !(format->flags[gl_type] & WINED3DFMT_FLAG_FBO_ATTACHABLE))
122 {
123 WARN("Render target or depth stencil is not FBO attachable.\n");
124 continue;
125 }
126 if ((usage & WINED3DUSAGE_TEXTURE) && !(format->flags[gl_type] & WINED3DFMT_FLAG_TEXTURE))
127 {
128 WARN("Format %s cannot be used for texturing.\n", debug_d3dformat(format->id));
129 continue;
130 }
131 if (((width & (width - 1)) || (height & (height - 1)))
134 && gl_type == WINED3D_GL_RES_TYPE_TEX_2D)
135 {
136 TRACE("Skipping 2D texture type to try texture rectangle.\n");
137 tex_2d_ok = TRUE;
138 continue;
139 }
140 break;
141 }
142
143 if (base_type != WINED3D_GL_RES_TYPE_COUNT && i == ARRAY_SIZE(resource_types))
144 {
145 if (tex_2d_ok)
146 {
147 /* Non power of 2 texture and rectangle textures or renderbuffers do not work.
148 * Use 2D textures, the texture code will pad to a power of 2 size. */
150 }
151 else if (usage & WINED3DUSAGE_SCRATCH)
152 {
153 /* Needed for proper format information. */
154 gl_type = base_type;
155 }
156 else
157 {
158 WARN("Did not find a suitable GL resource type for resource type %s.\n",
161 }
162 }
163
164 if (base_type != WINED3D_GL_RES_TYPE_COUNT
167 {
168 UINT width_mask = format->block_width - 1;
169 UINT height_mask = format->block_height - 1;
170 if (width & width_mask || height & height_mask)
172 }
173
174 resource->ref = 1;
175 resource->device = device;
176 resource->type = type;
177 resource->gl_type = gl_type;
178 resource->format = format;
179 if (gl_type < WINED3D_GL_RES_TYPE_COUNT)
180 resource->format_flags = format->flags[gl_type];
181 resource->multisample_type = multisample_type;
182 resource->multisample_quality = multisample_quality;
183 resource->usage = usage;
184 resource->access = access;
185 resource->width = width;
186 resource->height = height;
187 resource->depth = depth;
188 resource->size = size;
189 resource->priority = 0;
190 resource->parent = parent;
191 resource->parent_ops = parent_ops;
192 resource->resource_ops = resource_ops;
193 resource->map_binding = WINED3D_LOCATION_SYSMEM;
194
195 if (size)
196 {
198 {
199 ERR("Failed to allocate system memory.\n");
200 return E_OUTOFMEMORY;
201 }
202 }
203 else
204 {
205 resource->heap_memory = NULL;
206 }
207
209 {
210 /* Check that we have enough video ram left */
212 {
214 {
215 ERR("Out of adapter memory\n");
218 }
220 }
221
223 }
224
225 return WINED3D_OK;
226}
227
228static void wined3d_resource_destroy_object(void *object)
229{
231
235}
236
238{
239 const struct wined3d *d3d = resource->device->wined3d;
240
241 TRACE("Cleaning up resource %p.\n", resource);
242
243 if (!(resource->usage & WINED3DUSAGE_PRIVATE))
244 {
246 {
247 TRACE("Decrementing device memory pool by %u.\n", resource->size);
248 adapter_adjust_memory(resource->device->adapter, (INT64)0 - resource->size);
249 }
250
252 }
255}
256
258{
259 if (resource->map_count)
260 ERR("Resource %p is being unloaded while mapped.\n", resource);
261}
262
264{
265 DWORD prev;
266
268 {
269 WARN("Called on non-managed resource %p, ignoring.\n", resource);
270 return 0;
271 }
272
273 prev = resource->priority;
274 resource->priority = priority;
275 TRACE("resource %p, new priority %u, returning old priority %u.\n", resource, priority, prev);
276 return prev;
277}
278
280{
281 TRACE("resource %p, returning %u.\n", resource, resource->priority);
282 return resource->priority;
283}
284
286{
287 return resource->parent;
288}
289
291{
292 resource->parent = parent;
293}
294
296{
297 desc->resource_type = resource->type;
298 desc->format = resource->format->id;
299 desc->multisample_type = resource->multisample_type;
300 desc->multisample_quality = resource->multisample_quality;
301 desc->usage = resource->usage;
302 desc->access = resource->access;
303 desc->width = resource->width;
304 desc->height = resource->height;
305 desc->depth = resource->depth;
306 desc->size = resource->size;
307}
308
310{
311 /* Not all flags make sense together, but Windows never returns an error.
312 * Catch the cases that could cause issues. */
314 {
316 {
317 WARN("WINED3D_MAP_READ combined with WINED3D_MAP_DISCARD, ignoring flags.\n");
319 }
321 {
322 WARN("WINED3D_MAP_READ combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.\n");
324 }
325 }
327 {
328 if (!(resource->usage & WINED3DUSAGE_DYNAMIC))
329 {
330 WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n");
332 }
335 {
336 WARN("WINED3D_MAP_NOOVERWRITE used with WINED3D_MAP_DISCARD, ignoring WINED3D_MAP_DISCARD.\n");
337 flags &= ~WINED3D_MAP_DISCARD;
338 }
339 }
340
341 return flags;
342}
343
344HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx,
345 struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
346{
347 TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
348 resource, sub_resource_idx, map_desc, debug_box(box), flags);
349
351 {
352 WARN("No read/write flags specified.\n");
353 return E_INVALIDARG;
354 }
355
357 {
358 WARN("Resource does not have MAP_R access.\n");
359 return E_INVALIDARG;
360 }
361
363 {
364 WARN("Resource does not have MAP_W access.\n");
365 return E_INVALIDARG;
366 }
367
370
371 return wined3d_cs_map(resource->device->cs, resource, sub_resource_idx, map_desc, box, flags);
372}
373
374HRESULT CDECL wined3d_resource_map_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
376{
377 TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
378
379 return resource->resource_ops->resource_map_info(resource, sub_resource_idx, info, flags);
380}
381
382HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
383{
384 TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
385
386 return wined3d_cs_unmap(resource->device->cs, resource, sub_resource_idx);
387}
388
389UINT CDECL wined3d_resource_update_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
390 const struct wined3d_box *box, unsigned int row_pitch, unsigned int depth_pitch)
391{
392 unsigned int width, height, depth;
393 struct wined3d_box b;
394 UINT data_size;
395
396 TRACE("resource %p, sub_resource_idx %u, box %s, row_pitch %u, depth_pitch %u.\n",
397 resource, sub_resource_idx, debug_box(box), row_pitch, depth_pitch);
398
399 if (resource->type == WINED3D_RTYPE_BUFFER)
400 {
401 if (sub_resource_idx > 0)
402 {
403 WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
404 return 0;
405 }
406
408 height = 1;
409 depth = 1;
410 }
411 else if (resource->type == WINED3D_RTYPE_TEXTURE_1D ||
413 {
415 unsigned int level;
416
417 if (sub_resource_idx >= texture->level_count * texture->layer_count)
418 {
419 WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
420 return 0;
421 }
422
423 level = sub_resource_idx % texture->level_count;
427 }
428 else
429 {
430 FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
431 return 0;
432 }
433
434 if (!box)
435 {
436 wined3d_box_set(&b, 0, 0, width, height, 0, depth);
437 box = &b;
438 }
439 else if (box->left >= box->right || box->right > width
440 || box->top >= box->bottom || box->bottom > height
441 || box->front >= box->back || box->back > depth)
442 {
443 WARN("Invalid box %s specified.\n", debug_box(box));
444 return 0;
445 }
446
447 if (resource->format_flags & WINED3DFMT_FLAG_BLOCKS)
448 {
450 {
451 FIXME("Calculation of block formats not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
452 return 0;
453 }
454
455 height = (box->bottom - box->top + resource->format->block_height - 1) / resource->format->block_height;
456 width = (box->right - box->left + resource->format->block_width - 1) / resource->format->block_width;
457 return (height - 1) * row_pitch + width * resource->format->block_byte_count;
458 }
459
460 data_size = 0;
461 switch (resource->type)
462 {
464 data_size += (box->back - box->front - 1) * depth_pitch;
465 /* fall-through */
467 data_size += (box->bottom - box->top - 1) * row_pitch;
468 /* fall-through */
470 data_size += (box->right - box->left) * resource->format->byte_count;
471 break;
473 data_size = box->right - box->left;
474 break;
476 break;
477 }
478
479 return data_size;
480}
481
483{
485}
486
488{
489 void **p;
490 SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p);
491 void *mem;
492
493 if (!(mem = heap_alloc_zero(resource->size + align)))
494 return FALSE;
495
496 p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1;
497 *p = mem;
498
499 resource->heap_memory = ++p;
500
501 return TRUE;
502}
503
505{
506 void **p = resource->heap_memory;
507
508 if (!p)
509 return;
510
511 heap_free(*(--p));
512 resource->heap_memory = NULL;
513}
514
516{
517 GLbitfield ret = 0;
518
519 if (d3d_flags & WINED3D_MAP_WRITE)
521 if (d3d_flags & WINED3D_MAP_READ)
523
524 if (d3d_flags & WINED3D_MAP_DISCARD)
526 if (d3d_flags & WINED3D_MAP_NOOVERWRITE)
528
529 return ret;
530}
531
533{
534 switch (d3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE))
535 {
536 case WINED3D_MAP_READ:
537 return GL_READ_ONLY_ARB;
538
540 return GL_WRITE_ONLY_ARB;
541
542 default:
543 return GL_READ_WRITE_ARB;
544 }
545}
546
548{
549 struct wined3d_swapchain *swapchain;
550
551 /* Only 2D texture resources can be onscreen. */
553 return TRUE;
554
555 /* Not on a swapchain - must be offscreen */
556 if (!(swapchain = texture_from_resource(resource)->swapchain))
557 return TRUE;
558
559 /* The front buffer is always onscreen */
560 if (resource == &swapchain->front_buffer->resource)
561 return FALSE;
562
563 /* If the swapchain is rendered to an FBO, the backbuffer is
564 * offscreen, otherwise onscreen */
565 return swapchain->render_to_fbo;
566}
567
569{
571 {
572 resource->draw_binding = WINED3D_LOCATION_DRAWABLE;
573 }
574 else if (resource->multisample_type)
575 {
576 const struct wined3d_gl_info *gl_info = &resource->device->adapter->gl_info;
579 else
581 }
582 else if (resource->gl_type == WINED3D_GL_RES_TYPE_RB)
583 {
585 }
586 else
587 {
589 }
590}
signed long long INT64
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource)
Definition: cs.c:1956
void wined3d_cs_destroy_object(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
Definition: cs.c:1885
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
void context_resource_released(const struct wined3d_device *device, struct wined3d_resource *resource, enum wined3d_resource_type type)
Definition: context.c:1073
UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device)
Definition: device.c:1298
void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource)
Definition: device.c:5081
void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource)
Definition: device.c:5099
HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, enum wined3d_resource_type type, const struct wined3d_format *format, enum wined3d_multisample_type multisample_type, unsigned int multisample_quality, unsigned int usage, unsigned int access, unsigned int width, unsigned int height, unsigned int depth, unsigned int size, void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops)
Definition: resource.c:59
void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
Definition: resource.c:482
DWORD CDECL wined3d_resource_set_priority(struct wined3d_resource *resource, DWORD priority)
Definition: resource.c:263
DWORD CDECL wined3d_resource_get_priority(const struct wined3d_resource *resource)
Definition: resource.c:279
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:382
void *CDECL wined3d_resource_get_parent(const struct wined3d_resource *resource)
Definition: resource.c:285
void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc)
Definition: resource.c:295
static void resource_check_usage(DWORD usage)
Definition: resource.c:31
UINT CDECL wined3d_resource_update_info(struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, unsigned int row_pitch, unsigned int depth_pitch)
Definition: resource.c:389
HRESULT CDECL wined3d_resource_map_info(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_info *info, DWORD flags)
Definition: resource.c:374
static void wined3d_resource_destroy_object(void *object)
Definition: resource.c:228
void CDECL wined3d_resource_set_parent(struct wined3d_resource *resource, void *parent)
Definition: resource.c:290
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource)
Definition: resource.c:547
void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
Definition: resource.c:504
GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags)
Definition: resource.c:532
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
Definition: resource.c:344
GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
Definition: resource.c:515
BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)
Definition: resource.c:487
void resource_cleanup(struct wined3d_resource *resource)
Definition: resource.c:237
static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource *resource, DWORD flags)
Definition: resource.c:309
void wined3d_resource_update_draw_binding(struct wined3d_resource *resource)
Definition: resource.c:568
void resource_unload(struct wined3d_resource *resource)
Definition: resource.c:257
const char * debug_box(const struct wined3d_box *box)
Definition: utils.c:3939
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:3980
const char * debug_d3dresourcetype(enum wined3d_resource_type resource_type)
Definition: utils.c:4329
const char * wined3d_debug_resource_access(DWORD access)
Definition: utils.c:4200
#define CDECL
Definition: compat.h:29
#define WINE_DECLARE_DEBUG_CHANNEL(x)
Definition: compat.h:45
r parent
Definition: btrfs.c:3010
int align(int length, int align)
Definition: dsound8.c:36
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLint level
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
unsigned int GLbitfield
Definition: gl.h:152
unsigned int GLenum
Definition: gl.h:150
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
#define GL_MAP_READ_BIT
Definition: glext.h:1793
GLenum GLuint texture
Definition: glext.h:6295
#define GL_WRITE_ONLY_ARB
Definition: glext.h:1501
#define GL_MAP_FLUSH_EXPLICIT_BIT
Definition: glext.h:1797
#define GL_READ_WRITE_ARB
Definition: glext.h:1502
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define GL_MAP_UNSYNCHRONIZED_BIT
Definition: glext.h:1798
GLbitfield flags
Definition: glext.h:7161
#define GL_MAP_WRITE_BIT
Definition: glext.h:1794
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
GLfloat GLfloat p
Definition: glext.h:8902
#define GL_MAP_INVALIDATE_BUFFER_BIT
Definition: glext.h:1796
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define GL_READ_ONLY_ARB
Definition: glext.h:1500
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define b
Definition: ke_i.h:79
static const WCHAR desc[]
Definition: protectdata.c:36
static int priority
Definition: timer.c:163
unsigned int UINT
Definition: ndis.h:50
#define WARN_(ch,...)
Definition: debug.h:157
#define TRACE(s)
Definition: solgame.cpp:4
Definition: palette.c:468
Definition: devices.h:37
Definition: format.c:58
Definition: mem.c:349
size_t size
Definition: utils.c:259
BOOL supported[WINED3D_GL_EXT_COUNT]
struct wined3d_texture * front_buffer
unsigned int row_pitch
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
int ret
UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount)
Definition: directx.c:441
#define WINED3DUSAGE_WRITEONLY
Definition: wined3d.h:901
wined3d_multisample_type
Definition: wined3d.h:553
#define WINED3D_OK
Definition: wined3d.h:37
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:917
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define WINED3D_VIDMEM_ACCOUNTING
Definition: wined3d.h:1317
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56
wined3d_resource_type
Definition: wined3d.h:696
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
@ WINED3D_RTYPE_TEXTURE_1D
Definition: wined3d.h:699
@ WINED3D_RTYPE_NONE
Definition: wined3d.h:697
@ WINED3D_RTYPE_BUFFER
Definition: wined3d.h:698
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:701
#define WINED3D_MAP_READ
Definition: wined3d.h:939
#define WINED3DUSAGE_OVERLAY
Definition: wined3d.h:921
static void wined3d_box_set(struct wined3d_box *box, unsigned int left, unsigned int top, unsigned int right, unsigned int bottom, unsigned int front, unsigned int back)
Definition: wined3d.h:2789
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
#define WINED3D_MAP_DISCARD
Definition: wined3d.h:935
#define WINED3D_MAP_WRITE
Definition: wined3d.h:938
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:915
#define WINED3DUSAGE_PRIVATE
Definition: wined3d.h:916
#define WINED3DUSAGE_RENDERTARGET
Definition: wined3d.h:899
#define WINED3D_MAP_NOOVERWRITE
Definition: wined3d.h:934
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:907
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:920
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:918
#define WINED3DERR_OUTOFVIDEOMEMORY
Definition: wined3d.h:47
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define WINED3DUSAGE_DEPTHSTENCIL
Definition: wined3d.h:900
@ ARB_TEXTURE_MULTISAMPLE
Definition: wined3d_gl.h:122
@ WINED3D_GL_NORMALIZED_TEXRECT
Definition: wined3d_gl.h:214
@ ARB_TEXTURE_NON_POWER_OF_TWO
Definition: wined3d_gl.h:123
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
#define WINED3D_LOCATION_SYSMEM
static void wined3d_resource_acquire(struct wined3d_resource *resource)
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)
#define WINED3DFMT_FLAG_RENDERTARGET
#define WINED3D_LOCATION_RB_RESOLVED
#define RESOURCE_ALIGNMENT
#define WINED3DFMT_FLAG_FBO_ATTACHABLE
static void wined3d_resource_release(struct wined3d_resource *resource)
static BOOL wined3d_resource_access_is_managed(unsigned int access)
wined3d_gl_resource_type
@ WINED3D_GL_RES_TYPE_TEX_3D
@ WINED3D_GL_RES_TYPE_TEX_CUBE
@ WINED3D_GL_RES_TYPE_BUFFER
@ WINED3D_GL_RES_TYPE_TEX_2D
@ WINED3D_GL_RES_TYPE_RB
@ WINED3D_GL_RES_TYPE_TEX_RECT
@ WINED3D_GL_RES_TYPE_TEX_1D
@ WINED3D_GL_RES_TYPE_COUNT
#define WINED3D_LOCATION_TEXTURE_RGB
#define WINED3DFMT_FLAG_TEXTURE
#define WINED3D_LOCATION_DRAWABLE
#define WINED3DFMT_FLAG_BLOCKS
#define WINED3DFMT_FLAG_STENCIL
#define WINED3D_LOCATION_RB_MULTISAMPLE
#define ORM_FBO
#define WINED3DFMT_FLAG_DEPTH
static void wined3d_resource_wait_idle(struct wined3d_resource *resource)
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
#define WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
static unsigned int wined3d_texture_get_level_depth(const struct wined3d_texture *texture, unsigned int level)