31#define WINED3D_TEXTURE_DYNAMIC_MAP_THRESHOLD 50
38 && !
texture->resource.format->conv_byte_count
59 ERR(
"Texture %p is not part of a swapchain.\n",
texture);
65 TRACE(
"Returning GL_FRONT.\n");
71 TRACE(
"Returning GL_BACK.\n");
75 FIXME(
"Higher back buffer, returning GL_BACK.\n");
106 return (
x != 0) && !(
x & (
x - 1));
111 struct wined3d_texture_sub_resource *sub_resource;
112 unsigned int i, sub_count;
117 TRACE(
"Not evicting system memory for texture %p.\n",
texture);
121 TRACE(
"Evicting system memory for texture %p.\n",
texture);
124 for (
i = 0;
i < sub_count; ++
i)
126 sub_resource = &
texture->sub_resources[
i];
128 ERR(
"WINED3D_LOCATION_SYSMEM is the only location for sub-resource %u of texture %p.\n",
130 sub_resource->locations &= ~WINED3D_LOCATION_SYSMEM;
138 struct wined3d_texture_sub_resource *sub_resource;
139 DWORD previous_locations;
141 TRACE(
"texture %p, sub_resource_idx %u, location %s.\n",
144 sub_resource = &
texture->sub_resources[sub_resource_idx];
145 previous_locations = sub_resource->locations;
146 sub_resource->locations |=
location;
162 struct wined3d_texture_sub_resource *sub_resource;
163 DWORD previous_locations;
165 TRACE(
"texture %p, sub_resource_idx %u, location %s.\n",
171 sub_resource = &
texture->sub_resources[sub_resource_idx];
172 previous_locations = sub_resource->locations;
179 if (!sub_resource->locations)
180 ERR(
"Sub-resource %u of texture %p does not have any up to date location.\n",
187 unsigned int size =
texture->sub_resources[sub_resource_idx].size;
197 texture->sub_resources[sub_resource_idx].locations);
199 if (
dst.buffer_object)
211 if (
src.buffer_object)
237 TRACE(
"texture %p, sub_resource_idx %u, context %p, location %s.\n",
251 if ((
texture->resource.access & required_access) != required_access)
252 WARN(
"Operation requires %#x access, but texture only has %#x.\n",
253 required_access,
texture->resource.access);
258 TRACE(
"Sub-resource previously discarded, nothing to do.\n");
268 ERR(
"Sub-resource %u of texture %p does not have any up to date location.\n",
288 struct wined3d_texture_sub_resource *sub_resource;
290 TRACE(
"texture %p, sub_resource_idx %u, data %p, locations %s.\n",
293 sub_resource = &
texture->sub_resources[sub_resource_idx];
297#if !defined(STAGING_CSMT)
298 data->buffer_object = sub_resource->buffer_object;
300 data->buffer_object = sub_resource->buffer->
name;
307 data->buffer_object = 0;
313 data->addr += sub_resource->offset;
314 data->buffer_object = 0;
320 data->buffer_object = 0;
332 TRACE(
"texture %p, texture_ops %p, layer_count %u, level_count %u, resource_type %s, format %s, "
333 "multisample_type %#x, multisample_quality %#x, usage %s, access %s, width %u, height %u, depth %u, "
334 "flags %#x, device %p, parent %p, parent_ops %p, resource_ops %p.\n",
345 for (
i = 0;
i < layer_count; ++
i)
347 for (
j = 0;
j < level_count; ++
j)
349 unsigned int idx =
i * level_count +
j;
364 desc->multisample_type,
desc->multisample_quality,
desc->usage,
desc->access,
367 static unsigned int once;
374 ERR_(winediag)(
"The application tried to create a DXTn texture, but the driver does not support them.\n");
376 WARN(
"Failed to initialize resource, returning %#x\n",
hr);
383 texture->texture_ops = texture_ops;
385 texture->layer_count = layer_count;
386 texture->level_count = level_count;
398 WARN(
"Format doesn't support mipmaps generation, "
399 "ignoring WINED3D_TEXTURE_CREATE_GENERATE_MIPMAPS flag.\n");
409#
if !defined(STAGING_CSMT)
412 GLuint *buffer_object = &
texture->sub_resources[sub_resource_idx].buffer_object;
414 GL_EXTCALL(glDeleteBuffers(1, buffer_object));
417 TRACE(
"Deleted buffer object %u for texture %p, sub-resource %u.\n",
418 *buffer_object,
texture, sub_resource_idx);
425 struct wined3d_gl_bo *
buffer =
texture->sub_resources[sub_resource_idx].buffer;
429 texture->sub_resources[sub_resource_idx].buffer =
NULL;
432 TRACE(
"Deleted buffer object %u for texture %p, sub-resource %u.\n",
439 unsigned int sub_count =
texture->level_count *
texture->layer_count;
445 if (
device->d3d_initialized)
448 for (
i = 0;
i < sub_count; ++
i)
450 if (
texture->sub_resources[
i].locations ==
texture->resource.map_binding
454#if !defined(STAGING_CSMT)
464 texture->resource.map_binding = map_binding;
465 texture->update_map_binding = 0;
470 texture->update_map_binding = map_binding;
471 if (!
texture->resource.map_count)
480 gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex->
name);
500 unsigned int i,
count = 0;
504 if (
format->multisample_types & 1u <<
i)
513 return texture->resource.multisample_type;
522 unsigned int level, level_count,
layer, layer_count;
526 level_count =
texture->level_count;
543 TRACE(
"texture %p, layer %u, level %u, target %#x, width %u, height %u.\n",
610 if (
texture->texture_srgb.name)
615 TRACE(
"Deleting multisample renderbuffer %u.\n",
texture->rb_multisample);
617 gl_info->fbo_ops.glDeleteRenderbuffers(1, &
texture->rb_multisample);
623 TRACE(
"Deleting resolved renderbuffer %u.\n",
texture->rb_resolved);
638 unsigned int sub_count =
texture->level_count *
texture->layer_count;
639 struct wined3d_texture_sub_resource *sub_resource;
642 for (
i = 0;
i < sub_count; ++
i)
644 sub_resource = &
texture->sub_resources[
i];
645 if (sub_resource->parent)
647 TRACE(
"sub-resource %u.\n",
i);
648 sub_resource->parent_ops->wined3d_object_destroyed(sub_resource->parent);
649 sub_resource->parent =
NULL;
656 unsigned int sub_count =
texture->level_count *
texture->layer_count;
659#if !defined(STAGING_CSMT)
663 struct wined3d_gl_bo *
buffer;
669 for (
i = 0;
i < sub_count; ++
i)
671#if !defined(STAGING_CSMT)
672 if (!(buffer_object =
texture->sub_resources[
i].buffer_object))
675 TRACE(
"Deleting buffer object %u.\n", buffer_object);
680 TRACE(
"Deleting buffer object %u.\n",
buffer->name);
686#if !defined(STAGING_CSMT)
692 GL_EXTCALL(glDeleteBuffers(1, &buffer_object));
706 for (
i = 0;
i < sub_count; ++
i)
708 struct wined3d_overlay_info *
info = &
texture->overlay_info[
i];
709 struct wined3d_overlay_info *overlay, *
cur;
724 texture->swapchain = swapchain;
747 texture->flags &= ~WINED3D_TEXTURE_IS_SRGB;
758 gl_info->
gl_ops.gl.p_glGenTextures(1, &gl_tex->
name);
760 TRACE(
"Generated texture %d.\n", gl_tex->
name);
764 ERR(
"Failed to generate a texture name.\n");
800 TRACE(
"Setting GL_TEXTURE_MAX_LEVEL to %u.\n",
texture->level_count - 1);
802 checkGLcall(
"glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, texture->level_count)");
838 checkGLcall(
"glTexParameteri(GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY)");
843 static const GLenum swizzle_source[] =
863 checkGLcall(
"glTexParameteriv(GL_TEXTURE_SWIZZLE_RGBA)");
962 WARN(
"Anisotropic filtering not supported.\n");
990 checkGLcall(
"glTexEnvf(GL_TEXTURE_LOD_BIAS_EXT, ...)");
1004 TRACE(
"%p increasing refcount to %u.\n",
texture, refcount);
1033 TRACE(
"%p decreasing refcount to %u.\n",
texture, refcount);
1044 texture->resource.parent_ops->wined3d_object_destroyed(
texture->resource.parent);
1090 unsigned int sub_count =
texture->level_count *
texture->layer_count;
1093 TRACE(
"Reloading because of color key value change.\n");
1094 for (
i = 0;
i < sub_count;
i++)
1107 TRACE(
"Texture %p not dirty, nothing to do.\n",
texture);
1112 for (
i = 0;
i < sub_count; ++
i)
1116 ERR(
"Failed to load location (srgb %#x).\n", srgb);
1125 return texture->resource.parent;
1152 width_mask =
format->block_width - 1;
1153 height_mask =
format->block_height - 1;
1155 if ((
box->left & width_mask) || (
box->top & height_mask)
1156 || (
box->right & width_mask &&
box->right !=
width)
1157 || (
box->bottom & height_mask &&
box->bottom !=
height))
1159 WARN(
"Box %s is misaligned for %ux%u blocks.\n",
1169 unsigned int level,
unsigned int *row_pitch,
unsigned int *slice_pitch)
1177 *row_pitch =
texture->row_pitch;
1178 *slice_pitch =
texture->slice_pitch;
1196 TRACE(
"Ignoring LOD on texture with resource access %s.\n",
1211 texture->texture_rgb.base_level = ~0
u;
1212 texture->texture_srgb.base_level = ~0
u;
1213 if (
texture->resource.bind_count)
1244 if (
flags & ~all_flags)
1246 WARN(
"Invalid flags passed, returning WINED3DERR_INVALIDCALL.\n");
1260 unsigned int row_pitch, slice_pitch;
1263 D3DKMT_CREATEDCFROMMEMORY
desc;
1264 unsigned int sub_resource_idx;
1268 TRACE(
"surface %p.\n", surface);
1281 if (
device->d3d_initialized)
1289 texture->sub_resources[sub_resource_idx].size,
1298 desc.Pitch = row_pitch;
1306 WARN(
"Failed to create DC, status %#x.\n",
status);
1313 TRACE(
"Created DC %p, bitmap %p for surface %p.\n", surface->
dc, surface->
bitmap, surface);
1319 D3DKMT_DESTROYDCFROMMEMORY destroy_desc;
1323 unsigned int sub_resource_idx;
1333 ERR(
"Surface %p has no DC.\n", surface);
1339 destroy_desc.hDc = surface->
dc;
1340 destroy_desc.hBitmap = surface->
bitmap;
1342 ERR(
"Failed to destroy dc, status %#x.\n",
status);
1346 if (
device->d3d_initialized)
1364 struct wined3d_texture_sub_resource *sub_resource;
1366 DWORD valid_location = 0;
1369 TRACE(
"texture %p, width %u, height %u, format %s, multisample_type %#x, multisample_quality %u, "
1370 "mem %p, pitch %u.\n",
1378 WARN(
"Texture has multiple sub-resources, not supported.\n");
1390 FIXME(
"Not yet supported for 1D textures.\n");
1394 if (
texture->resource.map_count)
1396 WARN(
"Texture is mapped.\n");
1407 if (pitch %
texture->resource.format->byte_count)
1409 WARN(
"Pitch unsupported, not a multiple of the texture format byte width.\n");
1413 if (
device->d3d_initialized)
1417 sub_resource = &
texture->sub_resources[0];
1418 surface = sub_resource->u.surface;
1428 if ((
texture->row_pitch = pitch))
1436 texture->resource.multisample_type = multisample_type;
1437 texture->resource.multisample_quality = multisample_quality;
1441 sub_resource->size =
texture->slice_pitch;
1461 texture->flags &= ~WINED3D_TEXTURE_COND_NP2_EMULATED;
1498#
if !defined(STAGING_CSMT)
1504 struct wined3d_texture_sub_resource *sub_resource;
1506 sub_resource = &
texture->sub_resources[sub_resource_idx];
1507#if !defined(STAGING_CSMT)
1508 if (sub_resource->buffer_object)
1511 GL_EXTCALL(glGenBuffers(1, &sub_resource->buffer_object));
1517 TRACE(
"Created buffer object %u for texture %p, sub-resource %u.\n",
1518 sub_resource->buffer_object,
texture, sub_resource_idx);
1520 if (sub_resource->buffer)
1523 sub_resource->buffer = wined3d_device_get_bo(
texture->resource.device,
1526 TRACE(
"Created buffer object %u for texture %p, sub-resource %u.\n",
1527 sub_resource->buffer->name,
texture, sub_resource_idx);
1533 unsigned int sub_count =
texture->level_count *
texture->layer_count;
1538 texture->async.flags &= ~WINED3D_TEXTURE_ASYNC_COLOR_KEY;
1539 for (
i = 0;
i < sub_count; ++
i)
1561 if (
texture->flags & alloc_flag)
1582 gl_info->
fbo_ops.glGenRenderbuffers(1, &
texture->rb_multisample);
1586 checkGLcall(
"glRenderbufferStorageMultisample()");
1587 TRACE(
"Created multisample rb %u.\n",
texture->rb_multisample);
1599 TRACE(
"Created resolved rb %u.\n",
texture->rb_resolved);
1611 if (
texture->resource.heap_memory)
1616 ERR(
"Failed to allocate system memory.\n");
1623 ERR(
"Map binding is set to WINED3D_LOCATION_USER_MEMORY but surface->user_memory is NULL.\n");
1627#if !defined(STAGING_CSMT)
1644 ERR(
"Texture %p does not have a drawable.\n",
texture);
1662 unsigned int sub_resource_idx)
1666 TRACE(
"texture %p, sub_resource_idx %u.\n",
texture, sub_resource_idx);
1668 if (sub_resource_idx >= sub_count)
1670 WARN(
"sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count);
1674 return &
texture->sub_resources[sub_resource_idx];
1684 WARN(
"Invalid layer %u specified.\n",
layer);
1689 WARN(
"Ignoring dirty_region %s.\n",
debug_box(dirty_region));
1700 texture->texture_ops->texture_upload_data(
texture, sub_resource_idx,
1710 unsigned int row_pitch,
unsigned int slice_pitch)
1714 unsigned int level = sub_resource_idx %
texture->level_count;
1717 void *converted_mem =
NULL;
1718 unsigned int width,
x, update_w;
1721 TRACE(
"texture %p, sub_resource_idx %u, context %p, box %p, data {%#x:%p}, row_pitch %#x, slice_pitch %#x.\n",
1734 update_w =
box->right -
box->left;
1739 unsigned int dst_row_pitch;
1741 if (
data->buffer_object)
1742 ERR(
"Loading a converted texture from a PBO.\n");
1744 ERR(
"Converting a block-based format.\n");
1746 dst_row_pitch = update_w *
format->conv_byte_count;
1749 format->upload(
data->addr, converted_mem, row_pitch, slice_pitch, dst_row_pitch, dst_row_pitch, update_w, 1, 1);
1750 mem = converted_mem;
1753 if (
data->buffer_object)
1775 if (
data->buffer_object)
1791 struct wined3d_texture_sub_resource *sub_resource;
1796 sub_resource = &
texture->sub_resources[sub_resource_idx];
1798 if (
format->conv_byte_count)
1800 FIXME(
"Attempting to download a converted 1d texture, format %s.\n",
1808 WARN_(d3d_perf)(
"Downloading all miplevel layers to get the surface data for a single sub-resource.\n");
1812 ERR(
"Out of memory.\n");
1816 mem = temporary_mem;
1818 else if (
data->buffer_object)
1827 gl_info->
gl_ops.gl.p_glGetTexImage(
target, sub_resource_idx,
1833 void *src_data = temporary_mem + surface->
texture_layer * sub_resource->size;
1834 if (
data->buffer_object)
1843 memcpy(
data->addr, src_data, sub_resource->size);
1847 if (
data->buffer_object)
1860 struct wined3d_texture_sub_resource *sub_resource = &
texture->sub_resources[sub_resource_idx];
1861 unsigned int row_pitch, slice_pitch;
1864 WARN_(d3d_perf)(
"Performing slow rgb/srgb 1d texture transfer.\n");
1865 data.buffer_object = 0;
1883 struct wined3d_texture_sub_resource *sub_resource = &
texture->sub_resources[sub_resource_idx];
1885 unsigned int row_pitch, slice_pitch;
1887 TRACE(
"texture %p, sub_resource_idx %u, context %p, location %s.\n",
1894 TRACE(
"Location(s) already up to date.\n");
1898 if ((
texture->resource.access & required_access) != required_access)
1900 ERR(
"Operation requires %#x access, but 1d texture only has %#x.\n",
1901 required_access,
texture->resource.access);
1910 TRACE(
"1d texture previously discarded, nothing to do.\n");
1930#if !defined(STAGING_CSMT)
1970 FIXME(
"Implement WINED3D_LOCATION_SYSMEM loading from %s.\n",
1979#if !defined(STAGING_CSMT)
1994 FIXME(
"Implement WINED3D_LOCATION_BUFFER loading from %s.\n",
2015 unsigned int sub_count =
texture->level_count *
texture->layer_count;
2049 for (
i = 0;
i < sub_count; ++
i)
2088 unsigned int texture_level;
2096 dst_point.
x =
box->left;
2097 dst_point.
y =
box->top;
2103 dst_point.
x = dst_point.
y = 0;
2104 texture_level = sub_resource_idx %
texture->level_count;
2129 if (
format->conv_byte_count)
2163 unsigned int sub_count =
texture->level_count *
texture->layer_count;
2165 struct wined3d_texture_sub_resource *sub_resource;
2172 for (
i = 0;
i < sub_count; ++
i)
2174 sub_resource = &
texture->sub_resources[
i];
2175 if (!(surface = sub_resource->u.surface))
2178 TRACE(
"surface %p.\n", surface);
2188 TRACE(
"Deleting renderbuffer %u.\n",
entry->id);
2249 for (
i = 0;
i < sub_count; ++
i)
2251 struct wined3d_texture_sub_resource *sub_resource = &
texture->sub_resources[
i];
2264 ERR(
"Discarding %s %p sub-resource %u with resource access %s.\n",
2271#if !defined(STAGING_CSMT)
2272 if (sub_resource->buffer_object)
2275 if (sub_resource->buffer)
2306 struct wined3d_texture_sub_resource *sub_resource;
2308 unsigned int fmt_flags =
resource->format_flags;
2312 unsigned int texture_level;
2316 TRACE(
"resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
2323 texture_level = sub_resource_idx %
texture->level_count;
2326 WARN(
"Map box is invalid.\n");
2334 WARN(
"DC is in use.\n");
2338 if (sub_resource->map_count)
2340 WARN(
"Sub-resource is already mapped.\n");
2344 if (
device->d3d_initialized)
2349 TRACE(
"WINED3D_MAP_DISCARD flag passed, marking %s as up to date.\n",
2357 WARN_(d3d_perf)(
"Mapping a dynamic texture without WINED3D_MAP_DISCARD.\n");
2363 ERR(
"Failed to prepare location.\n");
2374 TRACE(
"Base memory pointer %p.\n", base_memory);
2391 map_desc->
data = base_memory;
2399 map_desc->
data = base_memory
2406 map_desc->
data = base_memory
2425 ++sub_resource->map_count;
2427 TRACE(
"Returning memory %p, row pitch %u, slice pitch %u.\n",
2437 struct wined3d_texture_sub_resource *sub_resource;
2438 unsigned int fmt_flags =
resource->format_flags;
2440 unsigned int texture_level;
2446 texture_level = sub_resource_idx %
texture->level_count;
2465 struct wined3d_texture_sub_resource *sub_resource;
2471 TRACE(
"resource %p, sub_resource_idx %u.\n",
resource, sub_resource_idx);
2477 if (!sub_resource->map_count)
2479 WARN(
"Trying to unmap unmapped sub-resource.\n");
2485 if (
device->d3d_initialized)
2497 texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(
texture->swapchain);
2500 --sub_resource->map_count;
2530 WARN(
"OpenGL implementation does not support array textures.\n");
2538 WARN(
"(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n",
texture);
2544 WARN(
"1d textures can not be used for cube mapping, returning D3DERR_INVALIDCALL.\n");
2559 WARN(
"Creating a scratch NPOT 1d texture despite lack of HW support.\n");
2563 WARN(
"Attempted to create a NPOT 1d texture (%u, %u, %u) without GL support.\n",
2571 if (level_count != 1)
2573 WARN(
"WINED3DUSAGE_QUERY_GENMIPMAP is set, and level count != 1, returning WINED3DERR_INVALIDCALL.\n");
2581 WARN(
"Failed to initialize texture, returning %#x.\n",
hr);
2585 texture->pow2_matrix[0] = 1.0f;
2586 texture->pow2_matrix[5] = 1.0f;
2587 texture->pow2_matrix[10] = 1.0f;
2588 texture->pow2_matrix[15] = 1.0f;
2597 if (level_count > ~(
SIZE_T)0 / layer_count
2609 struct wined3d_texture_sub_resource *sub_resource;
2621 sub_resource->u.surface = surface;
2623 if (
FAILED(
hr = device_parent->
ops->surface_created(device_parent,
2624 texture,
idx, &sub_resource->parent, &sub_resource->parent_ops)))
2626 WARN(
"Failed to create texture1d parent, hr %#x.\n",
hr);
2627 sub_resource->parent =
NULL;
2632 TRACE(
"parent %p, parent_ops %p.\n",
parent, parent_ops);
2634 TRACE(
"Created 1d texture surface level %u, layer %u @ %p.\n",
i,
j, surface);
2648 UINT pow2_width, pow2_height;
2649 unsigned int i,
j, sub_count;
2655 WARN(
"OpenGL implementation does not support array textures.\n");
2663 WARN(
"(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n",
texture);
2668 FIXME(
"Trying to create a managed texture with dynamic usage.\n");
2671 WARN(
"Creating a mappable texture that doesn't specify dynamic usage.\n");
2673 FIXME(
"Trying to create a CPU accessible render target.\n");
2675 pow2_width =
desc->width;
2676 pow2_height =
desc->height;
2677 if (((
desc->width & (
desc->width - 1)) || (
desc->height & (
desc->height - 1)))
2681 if (level_count != 1 || layer_count != 1)
2685 WARN(
"Attempted to create a mipmapped/cube/array NPOT texture without unconditional NPOT support.\n");
2689 WARN(
"Creating a scratch mipmapped/cube/array NPOT texture despite lack of HW support.\n");
2701 FIXME(
"Compressed or height scaled non-power-of-two (%ux%u) textures are not supported.\n",
2707 pow2_width = pow2_height = 1;
2708 while (pow2_width < desc->
width)
2710 while (pow2_height < desc->
height)
2715 texture->pow2_width = pow2_width;
2716 texture->pow2_height = pow2_height;
2718 if ((pow2_width > gl_info->
limits.texture_size || pow2_height > gl_info->
limits.texture_size)
2733 WARN(
"Dimensions (%ux%u) exceed the maximum texture size.\n", pow2_width, pow2_height);
2738 TRACE(
"Creating an oversized (%ux%u) surface.\n", pow2_width, pow2_height);
2744 WARN(
"Failed to initialize texture, returning %#x.\n",
hr);
2762 texture->flags &= ~WINED3D_TEXTURE_POW2_MAT_IDENT;
2766 texture->pow2_matrix[0] = 1.0f;
2767 texture->pow2_matrix[5] = 1.0f;
2775 if (layer_count > 1)
2782 if (layer_count > 1)
2788 texture->pow2_matrix[10] = 1.0f;
2789 texture->pow2_matrix[15] = 1.0f;
2795 sub_count = level_count * layer_count;
2796 if (sub_count / layer_count != level_count
2812 for (
i = 0;
i < sub_count; ++
i)
2824 struct wined3d_texture_sub_resource *sub_resource;
2836 sub_resource->u.surface = surface;
2843 if (
FAILED(
hr = device_parent->
ops->surface_created(device_parent,
2844 texture,
idx, &sub_resource->parent, &sub_resource->parent_ops)))
2846 WARN(
"Failed to create surface parent, hr %#x.\n",
hr);
2847 sub_resource->parent =
NULL;
2852 TRACE(
"parent %p, parent_ops %p.\n", sub_resource->parent, sub_resource->parent_ops);
2854 TRACE(
"Created surface level %u, layer %u @ %p.\n",
i,
j, surface);
2880 unsigned int level = sub_resource_idx %
texture->level_count;
2882 unsigned int x,
y,
z, update_w, update_h, update_d;
2883 unsigned int dst_row_pitch, dst_slice_pitch;
2886 void *converted_mem =
NULL;
2888 TRACE(
"texture %p, sub_resource_idx %u, context %p, box %s, data {%#x:%p}, row_pitch %#x, slice_pitch %#x.\n",
2890 data->buffer_object,
data->addr, row_pitch, slice_pitch);
2908 update_w =
box->right -
box->left;
2909 update_h =
box->bottom -
box->top;
2910 update_d =
box->back -
box->front;
2913 if (
format->conv_byte_count)
2915 if (
data->buffer_object)
2916 ERR(
"Loading a converted texture from a PBO.\n");
2918 ERR(
"Converting a block-based format.\n");
2920 dst_row_pitch = update_w *
format->conv_byte_count;
2921 dst_slice_pitch = dst_row_pitch * update_h;
2923 converted_mem =
heap_calloc(update_d, dst_slice_pitch);
2924 format->upload(
data->addr, converted_mem, row_pitch, slice_pitch,
2925 dst_row_pitch, dst_slice_pitch, update_w, update_h, update_d);
2926 mem = converted_mem;
2931 if (row_pitch != dst_row_pitch || slice_pitch != dst_slice_pitch)
2932 FIXME(
"Ignoring row/slice pitch (%u/%u).\n", row_pitch, slice_pitch);
2935 if (
data->buffer_object)
2942 update_w, update_h, update_d,
format->glFormat,
format->glType,
mem));
2945 if (
data->buffer_object)
2961 if (
format->conv_byte_count)
2963 FIXME(
"Attempting to download a converted volume, format %s.\n",
2968 if (
data->buffer_object)
2978 if (
data->buffer_object)
2990 struct wined3d_texture_sub_resource *sub_resource = &
texture->sub_resources[sub_resource_idx];
2991 unsigned int row_pitch, slice_pitch;
3000 WARN_(d3d_perf)(
"Performing slow rgb/srgb volume transfer.\n");
3001 data.buffer_object = 0;
3019 struct wined3d_texture_sub_resource *sub_resource = &
texture->sub_resources[sub_resource_idx];
3020 unsigned int row_pitch, slice_pitch;
3040#if !defined(STAGING_CSMT)
3081 FIXME(
"Implement WINED3D_LOCATION_SYSMEM loading from %s.\n",
3090#if !defined(STAGING_CSMT)
3105 FIXME(
"Implement WINED3D_LOCATION_BUFFER loading from %s.\n",
3124 unsigned int sub_count =
texture->level_count *
texture->layer_count;
3140 for (
i = 0;
i < sub_count; ++
i)
3173 if (layer_count != 1)
3175 ERR(
"Invalid layer count for volume texture.\n");
3183 WARN(
"(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n",
texture);
3189 WARN(
"(%p) : Texture cannot be created - no volume texture support.\n",
texture);
3196 WARN(
"Attempted to create a DYNAMIC texture with access %s.\n",
3207 WARN(
"Creating a scratch NPOT volume texture despite lack of HW support.\n");
3211 WARN(
"Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n",
3221 WARN(
"Failed to initialize texture, returning %#x.\n",
hr);
3225 texture->pow2_matrix[0] = 1.0f;
3226 texture->pow2_matrix[5] = 1.0f;
3227 texture->pow2_matrix[10] = 1.0f;
3228 texture->pow2_matrix[15] = 1.0f;
3240 struct wined3d_texture_sub_resource *sub_resource;
3242 sub_resource = &
texture->sub_resources[
i];
3245 if (
FAILED(
hr = device_parent->
ops->volume_created(device_parent,
3246 texture,
i, &sub_resource->parent, &sub_resource->parent_ops)))
3248 WARN(
"Failed to create volume parent, hr %#x.\n",
hr);
3249 sub_resource->parent =
NULL;
3254 TRACE(
"parent %p, parent_ops %p.\n",
parent, parent_ops);
3256 TRACE(
"Created volume level %u.\n",
i);
3263 const RECT *dst_rect,
struct wined3d_texture *src_texture,
unsigned int src_sub_resource_idx,
3268 unsigned int dst_format_flags, src_format_flags = 0;
3271 TRACE(
"dst_texture %p, dst_sub_resource_idx %u, dst_rect %s, src_texture %p, "
3272 "src_sub_resource_idx %u, src_rect %s, flags %#x, fx %p, filter %s.\n",
3273 dst_texture, dst_sub_resource_idx,
wine_dbgstr_rect(dst_rect), src_texture,
3284 dst_format_flags = dst_texture->
resource.format_flags;
3286 dst_sub_resource_idx % dst_texture->
level_count, &dst_box)))
3289 src_format_flags = src_texture->
resource.format_flags;
3291 src_sub_resource_idx % src_texture->
level_count, &src_box)))
3294 if (dst_texture->
sub_resources[dst_sub_resource_idx].map_count
3295 || src_texture->
sub_resources[src_sub_resource_idx].map_count)
3297#if !defined(STAGING_CSMT)
3298 WARN(
"Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.\n");
3303 if (dst_texture->
sub_resources[dst_sub_resource_idx].map_count
3304 || (src_texture && src_texture->
sub_resources[src_sub_resource_idx].map_count))
3306 WARN(
"Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.\n");
3315 WARN(
"Rejecting depth/stencil blit between incompatible formats.\n");
3326 unsigned int sub_resource_idx,
LONG *
x,
LONG *
y)
3328 struct wined3d_overlay_info *overlay;
3330 TRACE(
"texture %p, sub_resource_idx %u, x %p, y %p.\n",
texture, sub_resource_idx,
x,
y);
3333 || sub_resource_idx >=
texture->level_count *
texture->layer_count)
3335 WARN(
"Invalid sub-resource specified.\n");
3339 overlay = &
texture->overlay_info[sub_resource_idx];
3342 TRACE(
"Overlay not visible.\n");
3348 *
x = overlay->dst_rect.left;
3349 *
y = overlay->dst_rect.top;
3351 TRACE(
"Returning position %d, %d.\n", *
x, *
y);
3357 unsigned int sub_resource_idx,
LONG x,
LONG y)
3359 struct wined3d_overlay_info *overlay;
3362 TRACE(
"texture %p, sub_resource_idx %u, x %d, y %d.\n",
texture, sub_resource_idx,
x,
y);
3365 || sub_resource_idx >=
texture->level_count *
texture->layer_count)
3367 WARN(
"Invalid sub-resource specified.\n");
3371 overlay = &
texture->overlay_info[sub_resource_idx];
3372 w = overlay->dst_rect.right - overlay->dst_rect.left;
3373 h = overlay->dst_rect.bottom - overlay->dst_rect.top;
3380 const RECT *src_rect,
struct wined3d_texture *dst_texture,
unsigned int dst_sub_resource_idx,
3383 struct wined3d_texture_sub_resource *sub_resource, *dst_sub_resource;
3385 struct wined3d_overlay_info *overlay;
3387 TRACE(
"texture %p, sub_resource_idx %u, src_rect %s, dst_texture %p, "
3388 "dst_sub_resource_idx %u, dst_rect %s, flags %#x.\n",
3395 WARN(
"Invalid sub-resource specified.\n");
3402 WARN(
"Invalid destination sub-resource specified.\n");
3406 overlay = &
texture->overlay_info[sub_resource_idx];
3408 surface = sub_resource->u.surface;
3410 overlay->src_rect = *src_rect;
3412 SetRect(&overlay->src_rect, 0, 0,
3416 dst_surface = dst_sub_resource->u.surface;
3418 overlay->dst_rect = *dst_rect;
3420 SetRect(&overlay->dst_rect, 0, 0,
3426 overlay->dst =
NULL;
3432 if (overlay->dst != dst_surface)
3434 overlay->dst = dst_surface;
3443 overlay->dst =
NULL;
3451 unsigned int sub_count =
texture->level_count *
texture->layer_count;
3453 TRACE(
"texture %p, sub_resource_idx %u.\n",
texture, sub_resource_idx);
3455 if (sub_resource_idx >= sub_count)
3457 WARN(
"sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count);
3461 return texture->sub_resources[sub_resource_idx].parent;
3465 unsigned int sub_resource_idx,
void *
parent)
3467 unsigned int sub_count =
texture->level_count *
texture->layer_count;
3469 TRACE(
"texture %p, sub_resource_idx %u, parent %p.\n",
texture, sub_resource_idx,
parent);
3471 if (sub_resource_idx >= sub_count)
3473 WARN(
"sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count);
3483 unsigned int sub_count =
texture->level_count *
texture->layer_count;
3485 unsigned int level_idx;
3487 TRACE(
"texture %p, sub_resource_idx %u, desc %p.\n",
texture, sub_resource_idx,
desc);
3489 if (sub_resource_idx >= sub_count)
3491 WARN(
"sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count);
3498 desc->multisample_quality =
resource->multisample_quality;
3502 level_idx = sub_resource_idx %
texture->level_count;
3506 desc->size =
texture->sub_resources[sub_resource_idx].size;
3518 TRACE(
"device %p, desc %p, layer_count %u, level_count %u, flags %#x, data %p, "
3519 "parent %p, parent_ops %p, texture %p.\n",
3524 WARN(
"Invalid layer count.\n");
3529 ERR(
"Invalid layer count %u for legacy cubemap.\n",
layer_count);
3535 WARN(
"Invalid level count.\n");
3547 WARN(
"Unsupported quality level %u requested for WINED3D_MULTISAMPLE_NON_MASKABLE.\n",
3548 desc->multisample_quality);
3552 && (!(
format->multisample_types & 1u << (
desc->multisample_type - 1))
3553 ||
desc->multisample_quality))
3555 WARN(
"Unsupported multisample type %u quality %u requested.\n",
desc->multisample_type,
3556 desc->multisample_quality);
3562 sub_resources[level_count * layer_count]))))
3565 switch (
desc->resource_type)
3587 WARN(
"Failed to initialize texture, returning %#x.\n",
hr);
3596 unsigned int sub_count = level_count * layer_count;
3599 for (
i = 0;
i < sub_count; ++
i)
3603 WARN(
"Invalid sub-resource data specified for sub-resource %u.\n",
i);
3610 for (
i = 0;
i < sub_count; ++
i)
3617 TRACE(
"Created texture %p.\n",
object);
3626 struct wined3d_texture_sub_resource *sub_resource;
3629 TRACE(
"texture %p, sub_resource_idx %u, dc %p.\n",
texture, sub_resource_idx,
dc);
3633 WARN(
"Texture does not support GetDC\n");
3647 surface = sub_resource->u.surface;
3662 ++
texture->resource.map_count;
3663 ++sub_resource->map_count;
3666 TRACE(
"Returning dc %p.\n", *
dc);
3674 struct wined3d_texture_sub_resource *sub_resource;
3677 TRACE(
"texture %p, sub_resource_idx %u, dc %p.\n",
texture, sub_resource_idx,
dc);
3688 surface = sub_resource->u.surface;
3693 if (surface->
dc !=
dc)
3695 WARN(
"Application tries to release invalid DC %p, surface DC is %p.\n",
dc, surface->
dc);
3705 --sub_resource->map_count;
3706 if (!--
texture->resource.map_count &&
texture->update_map_binding)
3709 texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE;
ios_base &_STLP_CALL internal(ios_base &__s)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define InterlockedIncrement
#define InterlockedDecrement
static const char * wine_dbgstr_rect(const RECT *prc)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static int list_empty(struct list_entry *head)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
void wined3d_cs_emit_add_dirty_texture_region(struct wined3d_cs *cs, struct wined3d_texture *texture, unsigned int layer)
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource)
void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
void wined3d_cs_destroy_object(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
void wined3d_cs_init_object(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, WORD flags, const struct wined3d_color_key *color_key)
HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *device, UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
void context_unmap_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data, GLenum binding)
struct wined3d_context * context_acquire(const struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)
void context_invalidate_compute_state(struct wined3d_context *context, DWORD state_id)
void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint name)
void context_invalidate_state(struct wined3d_context *context, DWORD state)
void context_release(struct wined3d_context *context)
void * context_map_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data, size_t size, GLenum binding, DWORD flags)
void context_gl_resource_released(struct wined3d_device *device, GLuint name, BOOL rb_namespace)
void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int depth_pitch)
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)
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource)
void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)
void resource_cleanup(struct wined3d_resource *resource)
void wined3d_resource_update_draw_binding(struct wined3d_resource *resource)
void resource_unload(struct wined3d_resource *resource)
void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data)
BOOL surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
HRESULT CDECL wined3d_texture_get_overlay_position(const struct wined3d_texture *texture, unsigned int sub_resource_idx, LONG *x, LONG *y)
DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod)
static void texture1d_cleanup_sub_resources(struct wined3d_texture *texture)
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc)
static void texture2d_destroy_dc(void *object)
static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info)
HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc)
static void wined3d_texture_allocate_gl_immutable_storage(struct wined3d_texture *texture, GLenum gl_internal_format, const struct wined3d_gl_info *gl_info)
BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
static void wined3d_texture_cleanup(struct wined3d_texture *texture)
static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_box *box, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch)
static void wined3d_texture_unload(struct wined3d_resource *resource)
HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box)
void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding)
void CDECL wined3d_texture_set_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx, void *parent)
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture)
static void texture1d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
static void texture2d_create_dc(void *object)
static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
struct wined3d_texture *__cdecl wined3d_texture_from_resource(struct wined3d_resource *resource)
BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
static void wined3d_texture_evict_sysmem(struct wined3d_texture *texture)
static void wined3d_texture_allocate_gl_mutable_storage(struct wined3d_texture *texture, GLenum gl_internal_format, const struct wined3d_format *format, const struct wined3d_gl_info *gl_info)
static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
static void texture_resource_preload(struct wined3d_resource *resource)
DWORD CDECL wined3d_texture_get_lod(const struct wined3d_texture *texture)
HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, UINT layer, const struct wined3d_box *dirty_region)
static void wined3d_texture_set_dirty(struct wined3d_texture *texture)
void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
static const struct wined3d_texture_ops texture2d_ops
static HRESULT texture_resource_sub_resource_map_info(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_info *info, DWORD flags)
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_box *box, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch)
static DWORD wined3d_resource_access_from_location(DWORD location)
static void texture1d_download_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_bo_address *data)
void *CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx)
void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain)
struct wined3d_resource *CDECL wined3d_texture_get_resource(struct wined3d_texture *texture)
static void texture3d_srgb_transfer(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, BOOL dest_is_srgb)
HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT width, UINT height, enum wined3d_format_id format_id, enum wined3d_multisample_type multisample_type, UINT multisample_quality, void *mem, UINT pitch)
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_box *box, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch)
static BOOL color_key_equal(const struct wined3d_color_key *c1, struct wined3d_color_key *c2)
ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
static const struct wined3d_resource_ops texture_resource_ops
static void wined3d_texture_sub_resources_destroyed(struct wined3d_texture *texture)
static BOOL wined3d_texture_use_immutable_storage(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
static unsigned int wined3d_texture_get_gl_sample_count(const struct wined3d_texture *texture)
DWORD CDECL wined3d_texture_get_level_count(const struct wined3d_texture *texture)
void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture, const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context *context)
void wined3d_texture_bind(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture)
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
static ULONG texture_resource_decref(struct wined3d_resource *resource)
static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
static BOOL is_power_of_two(UINT x)
static void gltexture_delete(struct wined3d_device *device, const struct wined3d_gl_info *gl_info, struct gl_texture *tex)
static BOOL wined3d_texture_copy_sysmem_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, DWORD locations)
static const struct wined3d_texture_ops texture3d_ops
static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struct wined3d_texture_ops *texture_ops, UINT layer_count, UINT level_count, const struct wined3d_resource_desc *desc, DWORD flags, struct wined3d_device *device, void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops)
static struct wined3d_texture_sub_resource * wined3d_texture_get_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx)
static void wined3d_texture_destroy_object(void *object)
static ULONG texture_resource_incref(struct wined3d_resource *resource)
static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture)
static HRESULT texture1d_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, struct wined3d_device *device, void *parent, const struct wined3d_parent_ops *parent_ops)
static BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
HRESULT CDECL wined3d_texture_set_overlay_position(struct wined3d_texture *texture, unsigned int sub_resource_idx, LONG x, LONG y)
static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
static const struct wined3d_texture_ops texture1d_ops
static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture, DWORD flags, const struct wined3d_color_key *color_key)
static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_box *box, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch)
static void texture3d_download_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_bo_address *data)
void wined3d_texture_load(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
static void wined3d_texture_prepare_rb(struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info, BOOL multisample)
void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
static void wined3d_texture_force_reload(struct wined3d_texture *texture)
HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, unsigned int sub_resource_idx, const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, DWORD flags)
static void texture1d_srgb_transfer(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, BOOL dest_is_srgb)
static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_gl_info *gl_info)
#define WINED3D_TEXTURE_DYNAMIC_MAP_THRESHOLD
static void wined3d_texture_cleanup_sync(struct wined3d_texture *texture)
void CDECL wined3d_texture_get_pitch(const struct wined3d_texture *texture, unsigned int level, unsigned int *row_pitch, unsigned int *slice_pitch)
const struct wined3d_format * wined3d_get_format(const struct wined3d_gl_info *gl_info, enum wined3d_format_id format_id, unsigned int resource_usage)
const char * debug_box(const struct wined3d_box *box)
const char * debug_d3dformat(enum wined3d_format_id format_id)
UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT alignment, UINT width, UINT height, UINT depth)
const char * debug_d3dresourcetype(enum wined3d_resource_type resource_type)
const char * debug_d3dusage(DWORD usage)
const struct wined3d_color_key_conversion * wined3d_format_get_color_key_conversion(const struct wined3d_texture *texture, BOOL need_alpha_ck)
const char * debug_d3dtexturefiltertype(enum wined3d_texture_filter_type filter_type)
const char * wined3d_debug_location(DWORD location)
void wined3d_format_calculate_pitch(const struct wined3d_format *format, unsigned int alignment, unsigned int width, unsigned int height, unsigned int *row_pitch, unsigned int *slice_pitch)
const char * wined3d_debug_resource_access(DWORD access)
#define HeapFree(x, y, z)
#define WINE_DECLARE_DEBUG_CHANNEL(x)
#define GL_TEXTURE_MIN_FILTER
#define GL_TEXTURE_BORDER_COLOR
#define GL_TEXTURE_WRAP_R
GLint GLint GLsizei GLsizei GLsizei depth
#define GL_TEXTURE_WRAP_S
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
#define GL_TEXTURE_MAX_LEVEL
GLint GLint GLint GLint GLint GLint y
GLAPI void GLAPIENTRY glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
#define GL_TEXTURE_WRAP_T
#define GL_TEXTURE_MAG_FILTER
GLint GLint GLsizei width
GLAPI void GLAPIENTRY glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
#define GL_UNPACK_ROW_LENGTH
#define GL_SKIP_DECODE_EXT
#define GL_DEPTH_TEXTURE_MODE_ARB
GLsizei const GLint * locations
#define GL_TEXTURE_SRGB_DECODE_EXT
#define GL_TEXTURE_CUBE_MAP_ARB
#define GL_TEXTURE_SWIZZLE_RGBA
const GLvdpauSurfaceNV * surfaces
#define GL_PIXEL_PACK_BUFFER
#define GL_TEXTURE_1D_ARRAY
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY
#define GL_TEXTURE_2D_MULTISAMPLE
GLenum GLuint GLint GLint layer
#define GL_TEXTURE_RECTANGLE_ARB
#define GL_TEXTURE_COMPARE_MODE_ARB
#define GL_TEXTURE_2D_ARRAY
#define GL_TEXTURE_LOD_BIAS_EXT
GLubyte GLubyte GLubyte GLubyte w
#define GL_COMPARE_R_TO_TEXTURE_ARB
GLfloat GLfloat GLfloat GLfloat h
#define GL_PIXEL_UNPACK_BUFFER
#define GL_TEXTURE_FILTER_CONTROL_EXT
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 flag
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
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 * u
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 GLint GLint j
#define location(file, line)
#define memcpy(s1, s2, n)
struct task_struct * current
static const WCHAR desc[]
static void create_dib(STGMEDIUM *med)
static float(__cdecl *square_half_float)(float x
static void * heap_calloc(SIZE_T count, SIZE_T size)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
struct wined3d_sampler_desc sampler_desc
enum wined3d_format_id dst_format
DWORD color_space_high_value
DWORD color_space_low_value
const struct wined3d_gl_info * gl_info
const struct wined3d_device_parent_ops * ops
BOOL supported[WINED3D_GL_EXT_COUNT]
struct opengl_funcs gl_ops
struct wined3d_gl_limits limits
struct wined3d_fbo_ops fbo_ops
GLint wrap_lookup[WINED3D_TADDRESS_MIRROR_ONCE - WINED3D_TADDRESS_WRAP+1]
const struct wined3d_parent_ops * parent_ops
int offscreen_rendering_mode
struct list renderbuffers
unsigned int texture_layer
const struct wined3d_renderbuffer_entry * current_renderbuffer
struct wined3d_texture * container
unsigned int texture_level
struct wined3d_texture ** back_buffers
struct wined3d_texture * front_buffer
struct wined3d_resource resource
struct wined3d_texture::wined3d_texture_sub_resource sub_resources[1]
#define FIELD_OFFSET(t, f)
#define GL_TEXTURE_MAX_ANISOTROPY
NTSTATUS APIENTRY D3DKMTCreateDCFromMemory(_Inout_ D3DKMT_CREATEDCFROMMEMORY *desc)
NTSTATUS APIENTRY D3DKMTDestroyDCFromMemory(_In_ CONST D3DKMT_DESTROYDCFROMMEMORY *desc)
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
#define WINED3D_CKEY_DST_BLT
#define WINED3D_TEXTURE_CREATE_DISCARD
@ WINED3D_MULTISAMPLE_NON_MASKABLE
@ WINED3D_MULTISAMPLE_NONE
#define WINED3D_MAP_NO_DIRTY_UPDATE
#define WINED3D_CKEY_SRC_OVERLAY
#define WINED3DUSAGE_OWNDC
#define WINED3DUSAGE_LEGACY_CUBEMAP
@ WINED3D_SAMP_MAX_MIP_LEVEL
#define WINEDDERR_OVERLAYNOTVISIBLE
#define WINED3D_RESOURCE_ACCESS_GPU
#define WINED3D_RESOURCE_ACCESS_CPU
@ WINED3D_RTYPE_TEXTURE_2D
@ WINED3D_RTYPE_TEXTURE_1D
@ WINED3D_RTYPE_TEXTURE_3D
#define WINED3DERR_NOTAVAILABLE
wined3d_texture_filter_type
#define WINED3D_CKEY_SRC_BLT
#define WINED3DUSAGE_OVERLAY
#define WINEDDERR_NOTLOCKED
@ WINED3DFMT_D16_LOCKABLE
#define WINED3D_TEXTURE_CREATE_MAPPABLE
#define WINED3D_RESOURCE_ACCESS_MAP_R
#define WINED3D_MAP_DISCARD
#define WINED3D_MAP_WRITE
#define WINED3DUSAGE_SCRATCH
#define WINED3D_CKEY_DST_OVERLAY
#define WINED3DUSAGE_RENDERTARGET
#define WINED3DUSAGE_QUERY_GENMIPMAP
#define WINED3DUSAGE_DYNAMIC
#define WINEDDERR_INVALIDRECT
#define WINEDDERR_SURFACEBUSY
#define WINED3DERR_INVALIDCALL
#define WINED3D_TEXTURE_CREATE_GET_DC
#define WINED3D_TEXTURE_CREATE_GET_DC_LENIENT
#define WINED3D_SRGB_READ_WRITE_CONTROL
#define WINEDDERR_NOTAOVERLAYSURFACE
#define WINED3DUSAGE_TEXTURE
#define WINED3D_TEXTURE_CREATE_GENERATE_MIPMAPS
#define WINED3D_RESOURCE_ACCESS_MAP_W
#define WINED3DUSAGE_DEPTHSTENCIL
@ ARB_TEXTURE_FILTER_ANISOTROPIC
@ EXT_TEXTURE_SRGB_DECODE
@ ARB_TEXTURE_MULTISAMPLE
@ WINED3D_GL_NORMALIZED_TEXRECT
@ ARB_TEXTURE_NON_POWER_OF_TWO
@ WINED3D_GL_LEGACY_CONTEXT
@ ARB_PIXEL_BUFFER_OBJECT
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
#define WINED3D_TEXTURE_GENERATE_MIPMAPS
#define WINED3D_TEXTURE_GET_DC_LENIENT
#define WINED3D_LOCATION_TEXTURE_SRGB
#define WINED3D_TEXTURE_PIN_SYSMEM
static unsigned int wined3d_texture_get_level_pow2_height(const struct wined3d_texture *texture, unsigned int level)
#define STATE_GRAPHICS_SHADER_RESOURCE_BINDING
#define WINED3D_LOCATION_SYSMEM
static GLenum wined3d_gl_mag_filter(enum wined3d_texture_filter_type mag_filter)
#define WINED3D_TEXTURE_RGB_ALLOCATED
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)
#define WINED3DFMT_FLAG_HEIGHT_SCALE
static unsigned int surface_get_sub_resource_idx(const struct wined3d_surface *surface)
#define WINED3D_TEXTURE_RGB_VALID
#define WINED3D_TEXTURE_POW2_MAT_IDENT
#define WINED3DFMT_FLAG_BROKEN_PITCH
#define WINED3D_TEXTURE_COND_NP2
#define WINED3D_LOCATION_BUFFER
#define WINED3D_LOCATION_RB_RESOLVED
#define RESOURCE_ALIGNMENT
static unsigned int wined3d_texture_get_level_pow2_width(const struct wined3d_texture *texture, unsigned int level)
#define WINED3D_TEXTURE_COND_NP2_EMULATED
#define WINED3D_TEXTURE_SRGB_ALLOCATED
#define WINED3D_TEXTURE_CONVERTED
#define WINED3D_TEXTURE_GET_DC
#define STATE_SAMPLER(num)
static GLenum wined3d_texture_get_sub_resource_target(const struct wined3d_texture *texture, unsigned int sub_resource_idx)
#define WINED3D_TEXTURE_ASYNC_COLOR_KEY
static BOOL wined3d_resource_access_is_managed(unsigned int access)
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
#define STATE_COMPUTE_SHADER_RESOURCE_BINDING
@ WINED3D_GL_RES_TYPE_TEX_2D
@ WINED3D_GL_RES_TYPE_TEX_RECT
#define WINED3D_LOCATION_TEXTURE_RGB
#define WINED3D_TEXTURE_SRGB_VALID
static BOOL needs_separate_srgb_gl_texture(const struct wined3d_context *context, const struct wined3d_texture *texture)
#define WINED3DFMT_FLAG_TEXTURE
#define WINED3D_LOCATION_USER_MEMORY
#define WINED3D_TEXTURE_DC_IN_USE
#define WINED3D_LOCATION_DRAWABLE
#define WINED3D_TEXTURE_DISCARD
#define WINED3DFMT_FLAG_BLOCKS
static GLenum wined3d_gl_min_mip_filter(enum wined3d_texture_filter_type min_filter, enum wined3d_texture_filter_type mip_filter)
#define WINED3D_LOCATION_DISCARDED
static struct gl_texture * wined3d_texture_get_gl_texture(struct wined3d_texture *texture, BOOL srgb)
#define WINED3DFMT_FLAG_STENCIL
#define WINED3DFMT_FLAG_COMPRESSED
#define WINED3D_LOCATION_RB_MULTISAMPLE
#define WINED3DFMT_FLAG_DEPTH
static void wined3d_resource_wait_idle(struct wined3d_resource *resource)
#define WINED3D_TEXTURE_NORMALIZED_COORDS
@ WINED3D_CS_QUEUE_DEFAULT
#define WINED3D_UNMAPPED_STAGE
static BOOL can_use_texture_swizzle(const struct wined3d_gl_info *gl_info, const struct wined3d_format *format)
static unsigned int wined3d_popcount(unsigned int x)
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
#define WINED3D_TEXTURE_IS_SRGB
#define WINED3DFMT_FLAG_GEN_MIPMAP
static unsigned int wined3d_texture_get_level_depth(const struct wined3d_texture *texture, unsigned int level)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)