ReactOS  0.4.13-dev-259-g5ca9c9c
d3d9_private.h File Reference
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h"
#include "d3d9.h"
#include "wine/wined3d.h"
Include dependency graph for d3d9_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  d3d9
 
struct  fvf_declaration
 
struct  d3d9_device
 
struct  d3d9_resource
 
struct  d3d9_volume
 
struct  d3d9_swapchain
 
struct  d3d9_surface
 
struct  d3d9_vertexbuffer
 
struct  d3d9_indexbuffer
 
struct  d3d9_texture
 
struct  d3d9_stateblock
 
struct  d3d9_vertex_declaration
 
struct  d3d9_vertexshader
 
struct  d3d9_pixelshader
 
struct  d3d9_query
 

Macros

#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define COBJMACROS
 
#define D3D9_MAX_VERTEX_SHADER_CONSTANTF   256
 
#define D3D9_MAX_TEXTURE_UNITS   20
 
#define D3DPRESENTFLAGS_MASK   0x00000fffu
 
#define D3D9_TEXTURE_MIPMAP_DIRTY   0x1
 

Enumerations

enum  d3d9_device_state { D3D9_DEVICE_STATE_OK, D3D9_DEVICE_STATE_LOST, D3D9_DEVICE_STATE_NOT_RESET }
 

Functions

HRESULT vdecl_convert_fvf (DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN
 
D3DFORMAT d3dformat_from_wined3dformat (enum wined3d_format_id format) DECLSPEC_HIDDEN
 
BOOL is_gdi_compat_wined3dformat (enum wined3d_format_id format) DECLSPEC_HIDDEN
 
enum wined3d_format_id wined3dformat_from_d3dformat (D3DFORMAT format) DECLSPEC_HIDDEN
 
unsigned int wined3dmapflags_from_d3dmapflags (unsigned int flags) DECLSPEC_HIDDEN
 
void present_parameters_from_wined3d_swapchain_desc (D3DPRESENT_PARAMETERS *present_parameters, const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval) DECLSPEC_HIDDEN
 
void d3dcaps_from_wined3dcaps (D3DCAPS9 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN
 
BOOL d3d9_init (struct d3d9 *d3d9, BOOL extended) DECLSPEC_HIDDEN
 
HRESULT device_init (struct d3d9_device *device, struct d3d9 *parent, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) DECLSPEC_HIDDEN
 
void d3d9_resource_cleanup (struct d3d9_resource *resource) DECLSPEC_HIDDEN
 
HRESULT d3d9_resource_free_private_data (struct d3d9_resource *resource, const GUID *guid) DECLSPEC_HIDDEN
 
HRESULT d3d9_resource_get_private_data (struct d3d9_resource *resource, const GUID *guid, void *data, DWORD *data_size) DECLSPEC_HIDDEN
 
void d3d9_resource_init (struct d3d9_resource *resource) DECLSPEC_HIDDEN
 
HRESULT d3d9_resource_set_private_data (struct d3d9_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN
 
void volume_init (struct d3d9_volume *volume, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN
 
HRESULT d3d9_swapchain_create (struct d3d9_device *device, struct wined3d_swapchain_desc *desc, unsigned int swap_interval, struct d3d9_swapchain **swapchain) DECLSPEC_HIDDEN
 
struct wined3d_rendertarget_viewd3d9_surface_acquire_rendertarget_view (struct d3d9_surface *surface) DECLSPEC_HIDDEN
 
struct d3d9_deviced3d9_surface_get_device (const struct d3d9_surface *surface) DECLSPEC_HIDDEN
 
void d3d9_surface_release_rendertarget_view (struct d3d9_surface *surface, struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN
 
void surface_init (struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN
 
struct d3d9_surfaceunsafe_impl_from_IDirect3DSurface9 (IDirect3DSurface9 *iface) DECLSPEC_HIDDEN
 
HRESULT vertexbuffer_init (struct d3d9_vertexbuffer *buffer, struct d3d9_device *device, UINT size, UINT usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN
 
struct d3d9_vertexbufferunsafe_impl_from_IDirect3DVertexBuffer9 (IDirect3DVertexBuffer9 *iface) DECLSPEC_HIDDEN
 
HRESULT indexbuffer_init (struct d3d9_indexbuffer *buffer, struct d3d9_device *device, UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN
 
struct d3d9_indexbufferunsafe_impl_from_IDirect3DIndexBuffer9 (IDirect3DIndexBuffer9 *iface) DECLSPEC_HIDDEN
 
HRESULT cubetexture_init (struct d3d9_texture *texture, struct d3d9_device *device, UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN
 
HRESULT texture_init (struct d3d9_texture *texture, struct d3d9_device *device, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN
 
HRESULT volumetexture_init (struct d3d9_texture *texture, struct d3d9_device *device, UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN
 
struct d3d9_textureunsafe_impl_from_IDirect3DBaseTexture9 (IDirect3DBaseTexture9 *iface) DECLSPEC_HIDDEN
 
void d3d9_texture_flag_auto_gen_mipmap (struct d3d9_texture *texture) DECLSPEC_HIDDEN
 
void d3d9_texture_gen_auto_mipmap (struct d3d9_texture *texture) DECLSPEC_HIDDEN
 
HRESULT stateblock_init (struct d3d9_stateblock *stateblock, struct d3d9_device *device, D3DSTATEBLOCKTYPE type, struct wined3d_stateblock *wined3d_stateblock) DECLSPEC_HIDDEN
 
HRESULT d3d9_vertex_declaration_create (struct d3d9_device *device, const D3DVERTEXELEMENT9 *elements, struct d3d9_vertex_declaration **declaration) DECLSPEC_HIDDEN
 
struct d3d9_vertex_declarationunsafe_impl_from_IDirect3DVertexDeclaration9 (IDirect3DVertexDeclaration9 *iface) DECLSPEC_HIDDEN
 
HRESULT vertexshader_init (struct d3d9_vertexshader *shader, struct d3d9_device *device, const DWORD *byte_code) DECLSPEC_HIDDEN
 
struct d3d9_vertexshaderunsafe_impl_from_IDirect3DVertexShader9 (IDirect3DVertexShader9 *iface) DECLSPEC_HIDDEN
 
HRESULT pixelshader_init (struct d3d9_pixelshader *shader, struct d3d9_device *device, const DWORD *byte_code) DECLSPEC_HIDDEN
 
struct d3d9_pixelshaderunsafe_impl_from_IDirect3DPixelShader9 (IDirect3DPixelShader9 *iface) DECLSPEC_HIDDEN
 
HRESULT query_init (struct d3d9_query *query, struct d3d9_device *device, D3DQUERYTYPE type) DECLSPEC_HIDDEN
 
static struct d3d9_deviceimpl_from_IDirect3DDevice9Ex (IDirect3DDevice9Ex *iface)
 
static DWORD d3dusage_from_wined3dusage (unsigned int usage)
 
static D3DPOOL d3dpool_from_wined3daccess (unsigned int access, unsigned int usage)
 
static unsigned int wined3daccess_from_d3dpool (D3DPOOL pool, unsigned int usage)
 
static DWORD wined3dusage_from_d3dusage (unsigned int usage)
 

Variables

const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 31 of file d3d9_private.h.

◆ D3D9_MAX_TEXTURE_UNITS

#define D3D9_MAX_TEXTURE_UNITS   20

Definition at line 44 of file d3d9_private.h.

◆ D3D9_MAX_VERTEX_SHADER_CONSTANTF

#define D3D9_MAX_VERTEX_SHADER_CONSTANTF   256

Definition at line 43 of file d3d9_private.h.

◆ D3D9_TEXTURE_MIPMAP_DIRTY

#define D3D9_TEXTURE_MIPMAP_DIRTY   0x1

Definition at line 48 of file d3d9_private.h.

◆ D3DPRESENTFLAGS_MASK

#define D3DPRESENTFLAGS_MASK   0x00000fffu

Definition at line 46 of file d3d9_private.h.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 30 of file d3d9_private.h.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 29 of file d3d9_private.h.

Enumeration Type Documentation

◆ d3d9_device_state

Enumerator
D3D9_DEVICE_STATE_OK 
D3D9_DEVICE_STATE_LOST 
D3D9_DEVICE_STATE_NOT_RESET 

Definition at line 77 of file d3d9_private.h.

Function Documentation

◆ cubetexture_init()

HRESULT cubetexture_init ( struct d3d9_texture texture,
struct d3d9_device device,
UINT  edge_length,
UINT  levels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool 
)

Definition at line 1382 of file texture.c.

1384 {
1385  struct wined3d_resource_desc desc;
1386  DWORD flags = 0;
1387  HRESULT hr;
1388 
1389  texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl;
1390  d3d9_resource_init(&texture->resource);
1391  list_init(&texture->rtv_list);
1392  texture->usage = usage;
1393 
1394  desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1396  desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1397  desc.multisample_quality = 0;
1400  if (pool == D3DPOOL_SCRATCH)
1401  desc.usage |= WINED3DUSAGE_SCRATCH;
1404  desc.width = edge_length;
1405  desc.height = edge_length;
1406  desc.depth = 1;
1407  desc.size = 0;
1408 
1411 
1412  if (is_gdi_compat_wined3dformat(desc.format))
1414 
1416  {
1417  if (pool == D3DPOOL_SYSTEMMEM)
1418  {
1419  WARN("D3DUSAGE_AUTOGENMIPMAP texture can't be in D3DPOOL_SYSTEMMEM, returning D3DERR_INVALIDCALL.\n");
1420  return D3DERR_INVALIDCALL;
1421  }
1422  if (levels && levels != 1)
1423  {
1424  WARN("D3DUSAGE_AUTOGENMIPMAP texture with %u levels, returning D3DERR_INVALIDCALL.\n", levels);
1425  return D3DERR_INVALIDCALL;
1426  }
1428  texture->autogen_filter_type = D3DTEXF_LINEAR;
1429  levels = 0;
1430  }
1431  else
1432  {
1433  texture->autogen_filter_type = D3DTEXF_NONE;
1434  }
1435  if (!levels)
1436  levels = wined3d_log2i(edge_length) + 1;
1437 
1439  hr = wined3d_texture_create(device->wined3d_device, &desc, 6, levels, flags,
1440  NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
1442  if (FAILED(hr))
1443  {
1444  WARN("Failed to create wined3d cube texture, hr %#x.\n", hr);
1445  return hr;
1446  }
1447 
1448  texture->parent_device = &device->IDirect3DDevice9Ex_iface;
1449  IDirect3DDevice9Ex_AddRef(texture->parent_device);
1450 
1451  return D3D_OK;
1452 }
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
#define WINED3D_TEXTURE_CREATE_GENERATE_MIPMAPS
Definition: wined3d.h:1562
HRESULT hr
Definition: shlfolder.c:183
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: device.c:94
GLsizei levels
Definition: glext.h:7884
static const IDirect3DCubeTexture9Vtbl d3d9_texture_cube_vtbl
Definition: texture.c:906
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
#define WARN(fmt,...)
Definition: debug.h:111
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
BOOL is_gdi_compat_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN
Definition: device.c:1425
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define D3DERR_INVALIDCALL
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define WINED3D_TEXTURE_CREATE_GET_DC
Definition: wined3d.h:1561
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:926
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
static DWORD wined3dusage_from_d3dusage(unsigned int usage)
Definition: d3d9_private.h:334
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:77
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
unsigned long DWORD
Definition: ntddk_ex.h:95
static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops
Definition: texture.c:1292
GLbitfield flags
Definition: glext.h:7161
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define D3D_OK
Definition: d3d.h:106
#define WINED3D_TEXTURE_CREATE_MAPPABLE
Definition: wined3d.h:1558
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:927
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:924
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2763
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)
Definition: texture.c:3326
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:302

◆ d3d9_init()

BOOL d3d9_init ( struct d3d9 d3d9,
BOOL  extended 
)

Definition at line 583 of file directx.c.

584 {
589 
590  if (!extended)
592  else
594 
595  d3d9->IDirect3D9Ex_iface.lpVtbl = &d3d9_vtbl;
596  d3d9->refcount = 1;
597 
601  if (!d3d9->wined3d)
602  return FALSE;
603  d3d9->extended = extended;
604 
605  return TRUE;
606 }
BOOL extended
Definition: d3d9_private.h:66
LONG refcount
Definition: d3d9_private.h:64
#define TRUE
Definition: types.h:120
#define WINED3D_RESTORE_MODE_ON_ACTIVATE
Definition: wined3d.h:1321
IDirect3D9Ex IDirect3D9Ex_iface
Definition: d3d9_private.h:63
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define WINED3D_HANDLE_RESTORE
Definition: wined3d.h:1323
struct wined3d * wined3d
Definition: d3d9_private.h:65
#define WINED3D_PRESENT_CONVERSION
Definition: wined3d.h:1320
static const struct IDirect3D9ExVtbl d3d9_vtbl
Definition: directx.c:554
struct wined3d *CDECL wined3d_create(DWORD flags)
Definition: wined3d_main.c:96
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1327
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1324
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WINED3D_LEGACY_CUBEMAP_FILTERING
Definition: wined3d.h:1329
GLbitfield flags
Definition: glext.h:7161
#define WINED3D_NORMALIZED_DEPTH_BIAS
Definition: wined3d.h:1330
#define WINED3D_NO_PRIMITIVE_RESTART
Definition: wined3d.h:1328
#define WINED3D_SRGB_READ_WRITE_CONTROL
Definition: wined3d.h:1326
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365
#define WINED3D_VIDMEM_ACCOUNTING
Definition: wined3d.h:1319

Referenced by Direct3DCreate9(), and Direct3DCreate9Ex().

◆ d3d9_resource_cleanup()

void d3d9_resource_cleanup ( struct d3d9_resource resource)

◆ d3d9_resource_free_private_data()

HRESULT d3d9_resource_free_private_data ( struct d3d9_resource resource,
const GUID guid 
)

Definition at line 160 of file d3d9_main.c.

161 {
162  struct wined3d_private_data *entry;
163 
166  if (!entry)
167  {
169  return D3DERR_NOTFOUND;
170  }
171 
174 
175  return D3D_OK;
176 }
static void wined3d_private_store_free_private_data(struct wined3d_private_store *store, struct wined3d_private_data *entry)
Definition: wined3d.h:2536
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define D3DERR_NOTFOUND
Definition: d3d8.h:80
const GUID * guid
uint32_t entry
Definition: isohybrid.c:63
#define D3D_OK
Definition: d3d.h:106
static struct wined3d_private_data * wined3d_private_store_get_private_data(const struct wined3d_private_store *store, const GUID *tag)
Definition: wined3d.h:2521
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365

Referenced by d3d9_indexbuffer_FreePrivateData(), d3d9_surface_FreePrivateData(), d3d9_texture_2d_FreePrivateData(), d3d9_texture_3d_FreePrivateData(), d3d9_texture_cube_FreePrivateData(), d3d9_vertexbuffer_FreePrivateData(), and d3d9_volume_FreePrivateData().

◆ d3d9_resource_get_private_data()

HRESULT d3d9_resource_get_private_data ( struct d3d9_resource resource,
const GUID guid,
void data,
DWORD data_size 
)

Definition at line 178 of file d3d9_main.c.

180 {
181  const struct wined3d_private_data *stored_data;
182  DWORD size_in;
183  HRESULT hr;
184 
186  stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid);
187  if (!stored_data)
188  {
190  goto done;
191  }
192 
193  size_in = *data_size;
194  *data_size = stored_data->size;
195  if (!data)
196  {
197  hr = D3D_OK;
198  goto done;
199  }
200  if (size_in < stored_data->size)
201  {
203  goto done;
204  }
205 
206  if (stored_data->flags & WINED3DSPD_IUNKNOWN)
207  IUnknown_AddRef(stored_data->content.object);
208  memcpy(data, stored_data->content.data, stored_data->size);
209  hr = D3D_OK;
210 
211 done:
213  return hr;
214 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define D3DERR_NOTFOUND
Definition: d3d8.h:80
const GUID * guid
#define D3DERR_MOREDATA
Definition: d3d8.h:81
union wined3d_private_data::@3520 content
#define WINED3DSPD_IUNKNOWN
Definition: wined3d.h:1008
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define D3D_OK
Definition: d3d.h:106
IUnknown * object
Definition: wined3d.h:2166
static struct wined3d_private_data * wined3d_private_store_get_private_data(const struct wined3d_private_store *store, const GUID *tag)
Definition: wined3d.h:2521
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365

Referenced by d3d9_indexbuffer_GetPrivateData(), d3d9_surface_GetPrivateData(), d3d9_texture_2d_GetPrivateData(), d3d9_texture_3d_GetPrivateData(), d3d9_texture_cube_GetPrivateData(), d3d9_vertexbuffer_GetPrivateData(), and d3d9_volume_GetPrivateData().

◆ d3d9_resource_init()

void d3d9_resource_init ( struct d3d9_resource resource)

Definition at line 216 of file d3d9_main.c.

217 {
218  resource->refcount = 1;
219  wined3d_private_store_init(&resource->private_store);
220 }
static void wined3d_private_store_init(struct wined3d_private_store *store)
Definition: wined3d.h:2516

Referenced by cubetexture_init(), indexbuffer_init(), surface_init(), texture_init(), vertexbuffer_init(), volume_init(), and volumetexture_init().

◆ d3d9_resource_set_private_data()

HRESULT d3d9_resource_set_private_data ( struct d3d9_resource resource,
const GUID guid,
const void data,
DWORD  data_size,
DWORD  flags 
)

Definition at line 222 of file d3d9_main.c.

224 {
225  HRESULT hr;
226 
228  hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags);
230  return hr;
231 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
const GUID * guid
static HRESULT wined3d_private_store_set_private_data(struct wined3d_private_store *store, const GUID *guid, const void *data, DWORD data_size, DWORD flags)
Definition: wined3d.h:2557
LONG HRESULT
Definition: typedefs.h:77
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365

Referenced by d3d9_indexbuffer_SetPrivateData(), d3d9_surface_SetPrivateData(), d3d9_texture_2d_SetPrivateData(), d3d9_texture_3d_SetPrivateData(), d3d9_texture_cube_SetPrivateData(), d3d9_vertexbuffer_SetPrivateData(), and d3d9_volume_SetPrivateData().

◆ d3d9_surface_acquire_rendertarget_view()

struct wined3d_rendertarget_view* d3d9_surface_acquire_rendertarget_view ( struct d3d9_surface surface)

Definition at line 407 of file surface.c.

408 {
409  HRESULT hr;
410 
411  /* The surface reference count can be equal to 0 when this function is
412  * called. In order to properly manage the render target view reference
413  * count, we temporarily increment the surface reference count. */
415 
416  if (surface->wined3d_rtv)
417  return surface->wined3d_rtv;
418 
420  surface->sub_resource_idx, surface, &d3d9_view_wined3d_parent_ops, &surface->wined3d_rtv)))
421  {
422  ERR("Failed to create rendertarget view, hr %#x.\n", hr);
424  return NULL;
425  }
426 
427  if (surface->texture)
428  list_add_head(&surface->texture->rtv_list, &surface->rtv_entry);
429 
430  return surface->wined3d_rtv;
431 }
HRESULT hr
Definition: shlfolder.c:183
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
static const struct wined3d_parent_ops d3d9_view_wined3d_parent_ops
Definition: surface.c:395
struct wined3d_rendertarget_view * wined3d_rtv
Definition: d3d9_private.h:164
struct wined3d_texture * wined3d_texture
Definition: d3d9_private.h:161
smooth NULL
Definition: ftsmooth.c:416
HRESULT CDECL wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view)
Definition: view.c:624
struct list rtv_entry
Definition: d3d9_private.h:163
LONG HRESULT
Definition: typedefs.h:77
static ULONG WINAPI d3d9_surface_Release(IDirect3DSurface9 *iface)
Definition: surface.c:81
struct d3d9_texture * texture
Definition: d3d9_private.h:167
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int sub_resource_idx
Definition: d3d9_private.h:162
static ULONG WINAPI d3d9_surface_AddRef(IDirect3DSurface9 *iface)
Definition: surface.c:51
IDirect3DSurface9 IDirect3DSurface9_iface
Definition: d3d9_private.h:159

Referenced by d3d9_device_ColorFill(), d3d9_device_SetDepthStencilSurface(), and d3d9_device_SetRenderTarget().

◆ d3d9_surface_get_device()

struct d3d9_device* d3d9_surface_get_device ( const struct d3d9_surface surface)

Definition at line 400 of file surface.c.

401 {
402  IDirect3DDevice9Ex *device;
403  device = surface->texture ? surface->texture->parent_device : surface->parent_device;
405 }
Definition: devices.h:37
static struct d3d9_device * impl_from_IDirect3DDevice9Ex(IDirect3DDevice9Ex *iface)
Definition: d3d9_private.h:289
struct d3d9_texture * texture
Definition: d3d9_private.h:167
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:165

Referenced by d3d9_device_SetRenderTarget().

◆ d3d9_surface_release_rendertarget_view()

void d3d9_surface_release_rendertarget_view ( struct d3d9_surface surface,
struct wined3d_rendertarget_view rtv 
)

Definition at line 433 of file surface.c.

435 {
436  if (rtv)
438 }
static ULONG WINAPI d3d9_surface_Release(IDirect3DSurface9 *iface)
Definition: surface.c:81
IDirect3DSurface9 IDirect3DSurface9_iface
Definition: d3d9_private.h:159

Referenced by d3d9_device_ColorFill(), d3d9_device_SetDepthStencilSurface(), and d3d9_device_SetRenderTarget().

◆ d3d9_swapchain_create()

HRESULT d3d9_swapchain_create ( struct d3d9_device device,
struct wined3d_swapchain_desc desc,
unsigned int  swap_interval,
struct d3d9_swapchain **  swapchain 
)

Definition at line 395 of file swapchain.c.

397 {
398  struct d3d9_swapchain *object;
399  HRESULT hr;
400 
401  if (!(object = heap_alloc_zero(sizeof(*object))))
402  return E_OUTOFMEMORY;
403 
404  if (FAILED(hr = swapchain_init(object, device, desc, swap_interval)))
405  {
406  WARN("Failed to initialize swapchain, hr %#x.\n", hr);
407  heap_free(object);
408  return hr;
409  }
410 
411  TRACE("Created swapchain %p.\n", object);
412  *swapchain = object;
413 
414  return D3D_OK;
415 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
unsigned int swap_interval
Definition: d3d9_private.h:151
static HRESULT swapchain_init(struct d3d9_swapchain *swapchain, struct d3d9_device *device, struct wined3d_swapchain_desc *desc, unsigned int swap_interval)
Definition: swapchain.c:369
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define D3D_OK
Definition: d3d.h:106
void * object
Definition: jmemsys.h:48
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by d3d9_device_CreateAdditionalSwapChain(), and device_parent_create_swapchain().

◆ d3d9_texture_flag_auto_gen_mipmap()

void d3d9_texture_flag_auto_gen_mipmap ( struct d3d9_texture texture)

Definition at line 108 of file texture.c.

109 {
110  if (texture->usage & D3DUSAGE_AUTOGENMIPMAP)
112 }
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
GLenum GLuint texture
Definition: glext.h:6295
#define D3D9_TEXTURE_MIPMAP_DIRTY
Definition: d3d9_private.h:48

Referenced by d3d9_device_ColorFill(), d3d9_device_StretchRect(), d3d9_device_UpdateSurface(), d3d9_device_UpdateTexture(), d3d9_rts_flag_auto_gen_mipmap(), d3d9_surface_ReleaseDC(), and d3d9_surface_UnlockRect().

◆ d3d9_texture_gen_auto_mipmap()

void d3d9_texture_gen_auto_mipmap ( struct d3d9_texture texture)

Definition at line 99 of file texture.c.

100 {
101  if (!(texture->flags & D3D9_TEXTURE_MIPMAP_DIRTY))
102  return;
106 }
static struct wined3d_shader_resource_view * d3d9_texture_acquire_shader_resource_view(struct d3d9_texture *texture)
Definition: texture.c:54
void CDECL wined3d_shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *view)
Definition: view.c:913
GLenum GLuint texture
Definition: glext.h:6295
#define D3D9_TEXTURE_MIPMAP_DIRTY
Definition: d3d9_private.h:48

Referenced by d3d9_generate_auto_mipmaps(), d3d9_texture_2d_GenerateMipSubLevels(), and d3d9_texture_cube_GenerateMipSubLevels().

◆ d3d9_vertex_declaration_create()

HRESULT d3d9_vertex_declaration_create ( struct d3d9_device device,
const D3DVERTEXELEMENT9 elements,
struct d3d9_vertex_declaration **  declaration 
)

Definition at line 415 of file vertexdeclaration.c.

417 {
419  HRESULT hr;
420 
421  if (!(object = heap_alloc_zero(sizeof(*object))))
422  return E_OUTOFMEMORY;
423 
425  if (FAILED(hr))
426  {
427  WARN("Failed to initialize vertex declaration, hr %#x.\n", hr);
428  heap_free(object);
429  return hr;
430  }
431 
432  TRACE("Created vertex declaration %p.\n", object);
433  *declaration = object;
434 
435  return D3D_OK;
436 }
static HRESULT vertexdeclaration_init(struct d3d9_vertex_declaration *declaration, struct d3d9_device *device, const D3DVERTEXELEMENT9 *elements)
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
D3DVERTEXELEMENT9 * elements
Definition: d3d9_private.h:242
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define D3D_OK
Definition: d3d.h:106
void * object
Definition: jmemsys.h:48
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by d3d9_device_CreateVertexDeclaration(), and device_get_fvf_declaration().

◆ d3dcaps_from_wined3dcaps()

void d3dcaps_from_wined3dcaps ( D3DCAPS9 caps,
const WINED3DCAPS wined3d_caps 
)

Definition at line 350 of file device.c.

351 {
352  static const DWORD ps_minor_version[] = {0, 4, 0, 0};
353  static const DWORD vs_minor_version[] = {0, 1, 0, 0};
354  static const DWORD texture_filter_caps =
360 
361  caps->DeviceType = (D3DDEVTYPE)wined3d_caps->DeviceType;
362  caps->AdapterOrdinal = wined3d_caps->AdapterOrdinal;
363  caps->Caps = wined3d_caps->Caps;
364  caps->Caps2 = wined3d_caps->Caps2;
365  caps->Caps3 = wined3d_caps->Caps3;
367  caps->CursorCaps = wined3d_caps->CursorCaps;
368  caps->DevCaps = wined3d_caps->DevCaps;
369  caps->PrimitiveMiscCaps = wined3d_caps->PrimitiveMiscCaps;
370  caps->RasterCaps = wined3d_caps->RasterCaps;
371  caps->ZCmpCaps = wined3d_caps->ZCmpCaps;
372  caps->SrcBlendCaps = wined3d_caps->SrcBlendCaps;
373  caps->DestBlendCaps = wined3d_caps->DestBlendCaps;
374  caps->AlphaCmpCaps = wined3d_caps->AlphaCmpCaps;
375  caps->ShadeCaps = wined3d_caps->ShadeCaps;
376  caps->TextureCaps = wined3d_caps->TextureCaps;
377  caps->TextureFilterCaps = wined3d_caps->TextureFilterCaps;
378  caps->CubeTextureFilterCaps = wined3d_caps->CubeTextureFilterCaps;
379  caps->VolumeTextureFilterCaps = wined3d_caps->VolumeTextureFilterCaps;
380  caps->TextureAddressCaps = wined3d_caps->TextureAddressCaps;
382  caps->LineCaps = wined3d_caps->LineCaps;
383  caps->MaxTextureWidth = wined3d_caps->MaxTextureWidth;
384  caps->MaxTextureHeight = wined3d_caps->MaxTextureHeight;
385  caps->MaxVolumeExtent = wined3d_caps->MaxVolumeExtent;
386  caps->MaxTextureRepeat = wined3d_caps->MaxTextureRepeat;
387  caps->MaxTextureAspectRatio = wined3d_caps->MaxTextureAspectRatio;
388  caps->MaxAnisotropy = wined3d_caps->MaxAnisotropy;
389  caps->MaxVertexW = wined3d_caps->MaxVertexW;
390  caps->GuardBandLeft = wined3d_caps->GuardBandLeft;
391  caps->GuardBandTop = wined3d_caps->GuardBandTop;
392  caps->GuardBandRight = wined3d_caps->GuardBandRight;
393  caps->GuardBandBottom = wined3d_caps->GuardBandBottom;
394  caps->ExtentsAdjust = wined3d_caps->ExtentsAdjust;
395  caps->StencilCaps = wined3d_caps->StencilCaps;
396  caps->FVFCaps = wined3d_caps->FVFCaps;
397  caps->TextureOpCaps = wined3d_caps->TextureOpCaps;
398  caps->MaxTextureBlendStages = wined3d_caps->MaxTextureBlendStages;
399  caps->MaxSimultaneousTextures = wined3d_caps->MaxSimultaneousTextures;
400  caps->VertexProcessingCaps = wined3d_caps->VertexProcessingCaps;
401  caps->MaxActiveLights = wined3d_caps->MaxActiveLights;
402  caps->MaxUserClipPlanes = wined3d_caps->MaxUserClipPlanes;
403  caps->MaxVertexBlendMatrices = wined3d_caps->MaxVertexBlendMatrices;
405  caps->MaxPointSize = wined3d_caps->MaxPointSize;
406  caps->MaxPrimitiveCount = wined3d_caps->MaxPrimitiveCount;
407  caps->MaxVertexIndex = wined3d_caps->MaxVertexIndex;
408  caps->MaxStreams = wined3d_caps->MaxStreams;
409  caps->MaxStreamStride = wined3d_caps->MaxStreamStride;
410  caps->VertexShaderVersion = wined3d_caps->VertexShaderVersion;
411  caps->MaxVertexShaderConst = wined3d_caps->MaxVertexShaderConst;
412  caps->PixelShaderVersion = wined3d_caps->PixelShaderVersion;
413  caps->PixelShader1xMaxValue = wined3d_caps->PixelShader1xMaxValue;
414  caps->DevCaps2 = wined3d_caps->DevCaps2;
416  caps->MasterAdapterOrdinal = wined3d_caps->MasterAdapterOrdinal;
417  caps->AdapterOrdinalInGroup = wined3d_caps->AdapterOrdinalInGroup;
418  caps->NumberOfAdaptersInGroup = wined3d_caps->NumberOfAdaptersInGroup;
419  caps->DeclTypes = wined3d_caps->DeclTypes;
420  caps->NumSimultaneousRTs = wined3d_caps->NumSimultaneousRTs;
421  caps->StretchRectFilterCaps = wined3d_caps->StretchRectFilterCaps;
422  caps->VS20Caps.Caps = wined3d_caps->VS20Caps.caps;
423  caps->VS20Caps.DynamicFlowControlDepth = wined3d_caps->VS20Caps.dynamic_flow_control_depth;
424  caps->VS20Caps.NumTemps = wined3d_caps->VS20Caps.temp_count;
425  caps->VS20Caps.StaticFlowControlDepth = wined3d_caps->VS20Caps.static_flow_control_depth;
426  caps->PS20Caps.Caps = wined3d_caps->PS20Caps.caps;
427  caps->PS20Caps.DynamicFlowControlDepth = wined3d_caps->PS20Caps.dynamic_flow_control_depth;
428  caps->PS20Caps.NumTemps = wined3d_caps->PS20Caps.temp_count;
429  caps->PS20Caps.StaticFlowControlDepth = wined3d_caps->PS20Caps.static_flow_control_depth;
430  caps->PS20Caps.NumInstructionSlots = wined3d_caps->PS20Caps.instruction_slot_count;
431  caps->VertexTextureFilterCaps = wined3d_caps->VertexTextureFilterCaps;
436 
437  /* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps. */
439 
440  /* Filter wined3d caps. */
441  caps->TextureFilterCaps &= texture_filter_caps;
442  caps->CubeTextureFilterCaps &= texture_filter_caps;
443  caps->VolumeTextureFilterCaps &= texture_filter_caps;
444 
445  caps->DevCaps &=
453 
454  caps->ShadeCaps &=
457 
458  caps->RasterCaps &=
465 
466  caps->DevCaps2 &=
470 
471  caps->Caps2 &=
474 
475  caps->VertexProcessingCaps &=
479 
480  caps->TextureCaps &=
487 
490 
491  if (caps->PixelShaderVersion > 3)
492  {
493  caps->PixelShaderVersion = D3DPS_VERSION(3, 0);
494  }
495  else
496  {
498  caps->PixelShaderVersion = D3DPS_VERSION(major, ps_minor_version[major]);
499  }
500 
501  if (caps->VertexShaderVersion > 3)
502  {
503  caps->VertexShaderVersion = D3DVS_VERSION(3, 0);
504  }
505  else
506  {
508  caps->VertexShaderVersion = D3DVS_VERSION(major, vs_minor_version[major]);
509  }
510 }
#define D3DPTEXTURECAPS_NOPROJECTEDBUMPENV
Definition: d3d9caps.h:136
float MaxNpatchTessellationLevel
Definition: d3d9caps.h:318
#define D3DDEVCAPS_NPATCHES
Definition: d3d8caps.h:55
#define D3DPTEXTURECAPS_PROJECTED
Definition: d3d8caps.h:120
D3DPSHADERCAPS2_0 PS20Caps
Definition: d3d9caps.h:327
#define D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
Definition: d3d9caps.h:92
UINT AdapterOrdinal
Definition: wined3d.h:1888
UINT MasterAdapterOrdinal
Definition: wined3d.h:1957
float GuardBandBottom
Definition: wined3d.h:1922
float MaxVertexW
Definition: wined3d.h:1917
#define D3DPTEXTURECAPS_POW2
Definition: d3d8caps.h:114
DWORD MaxTextureAspectRatio
Definition: wined3d.h:1915
#define D3DPRESENT_INTERVAL_ONE
Definition: d3d8caps.h:29
DWORD MaxTextureBlendStages
Definition: wined3d.h:1929
D3DVSHADERCAPS2_0 VS20Caps
Definition: d3d9caps.h:326
#define D3DVTXPCAPS_POSITIONALLIGHTS
Definition: d3d8caps.h:184
DWORD MaxUserClipPlanes
Definition: wined3d.h:1934
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY
Definition: d3d8caps.h:38
#define D3DPRASTERCAPS_FOGVERTEX
Definition: d3d8caps.h:75
DWORD TextureCaps
Definition: d3d9caps.h:279
#define D3DPSHADECAPS_FOGGOURAUD
Definition: d3d8caps.h:112
#define D3DPTFILTERCAPS_MAGFANISOTROPIC
Definition: d3d8caps.h:135
DWORD MaxTextureHeight
Definition: wined3d.h:1912
DWORD MaxVertexBlendMatrixIndex
Definition: d3d9caps.h:307
#define D3DPTEXTURECAPS_MIPMAP
Definition: d3d8caps.h:123
float PixelShader1xMaxValue
Definition: wined3d.h:1949
#define D3DPRASTERCAPS_MIPMAPLODBIAS
Definition: d3d8caps.h:78
DWORD MaxTextureAspectRatio
Definition: d3d9caps.h:290
DWORD MaxVShaderInstructionsExecuted
Definition: d3d9caps.h:329
DWORD ZCmpCaps
Definition: d3d9caps.h:274
float MaxNpatchTessellationLevel
Definition: wined3d.h:1954
#define D3DPRASTERCAPS_ANISOTROPY
Definition: d3d8caps.h:82
#define D3DDEVCAPS2_DMAPNPATCH
Definition: d3d9caps.h:202
#define D3DPTFILTERCAPS_MINFGAUSSIANQUAD
Definition: d3d9caps.h:141
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL
Definition: d3d8caps.h:49
DWORD StencilCaps
Definition: wined3d.h:1925
DWORD MaxActiveLights
Definition: d3d9caps.h:304
float GuardBandRight
Definition: wined3d.h:1921
#define D3DDEVCAPS_QUINTICRTPATCHES
Definition: d3d8caps.h:52
DWORD TextureOpCaps
Definition: wined3d.h:1928
#define D3DPTEXTURECAPS_CUBEMAP_POW2
Definition: d3d8caps.h:126
#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH
Definition: d3d9caps.h:206
DWORD NumSimultaneousRTs
Definition: d3d9caps.h:324
DWORD MaxActiveLights
Definition: wined3d.h:1933
DWORD MaxTextureHeight
Definition: d3d9caps.h:287
#define D3DPTEXTURECAPS_PERSPECTIVE
Definition: d3d8caps.h:113
DWORD VertexShaderVersion
Definition: d3d9caps.h:313
DWORD ShadeCaps
Definition: wined3d.h:1902
DWORD DestBlendCaps
Definition: d3d9caps.h:276
DWORD AlphaCmpCaps
Definition: wined3d.h:1901
#define D3DPTFILTERCAPS_MINFLINEAR
Definition: d3d8caps.h:129
UINT NumberOfAdaptersInGroup
Definition: d3d9caps.h:322
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES
Definition: d3d8caps.h:46
DWORD MaxVertexBlendMatrices
Definition: wined3d.h:1935
DWORD FVFCaps
Definition: wined3d.h:1927
DWORD MaxPixelShader30InstructionSlots
Definition: wined3d.h:1969
#define D3DPTEXTURECAPS_MIPVOLUMEMAP
Definition: d3d8caps.h:124
DWORD MaxSimultaneousTextures
Definition: d3d9caps.h:302
DWORD VolumeTextureAddressCaps
Definition: d3d9caps.h:284
DWORD RasterCaps
Definition: wined3d.h:1897
#define D3DVTXPCAPS_TEXGEN
Definition: d3d8caps.h:181
#define D3DDEVCAPS2_ADAPTIVETESSNPATCH
Definition: d3d9caps.h:204
DWORD TextureFilterCaps
Definition: d3d9caps.h:280
INT StaticFlowControlDepth
Definition: d3d9caps.h:257
#define D3DPS_VERSION(major, minor)
Definition: d3d8types.h:474
DWORD StretchRectFilterCaps
Definition: d3d9caps.h:325
#define D3DPRASTERCAPS_WFOG
Definition: d3d8caps.h:84
float GuardBandLeft
Definition: d3d9caps.h:293
DWORD MaxVertexIndex
Definition: wined3d.h:1941
DWORD VertexShaderVersion
Definition: wined3d.h:1945
DWORD MaxVolumeExtent
Definition: d3d9caps.h:288
#define D3DPSHADECAPS_SPECULARGOURAUDRGB
Definition: d3d8caps.h:110
float GuardBandTop
Definition: d3d9caps.h:294
#define D3D9_MAX_VERTEX_SHADER_CONSTANTF
Definition: d3d9_private.h:43
struct wined3d_pixel_shader_caps PS20Caps
Definition: wined3d.h:1964
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY
Definition: d3d8caps.h:39
#define D3DPTFILTERCAPS_MIPFLINEAR
Definition: d3d8caps.h:132
DWORD DevCaps2
Definition: d3d9caps.h:317
UINT AdapterOrdinalInGroup
Definition: d3d9caps.h:321
#define D3DVS_VERSION(major, minor)
Definition: d3d8types.h:475
#define D3DPRASTERCAPS_ZFOG
Definition: d3d8caps.h:85
DWORD MaxStreamStride
Definition: wined3d.h:1943
DWORD Caps3
Definition: d3d9caps.h:268
#define D3DDEVCAPS_DRAWPRIMITIVES2EX
Definition: d3d8caps.h:47
float ExtentsAdjust
Definition: wined3d.h:1924
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT
Definition: d3d8caps.h:48
DWORD LineCaps
Definition: d3d9caps.h:285
DWORD MaxSimultaneousTextures
Definition: wined3d.h:1930
DWORD CursorCaps
Definition: wined3d.h:1894
DWORD MaxPrimitiveCount
Definition: d3d9caps.h:309
#define D3DPTFILTERCAPS_MINFPYRAMIDALQUAD
Definition: d3d9caps.h:140
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND
Definition: d3d8caps.h:111
DWORD MaxTextureWidth
Definition: d3d9caps.h:286
DWORD MaxVertexShaderConst
Definition: wined3d.h:1946
float GuardBandBottom
Definition: d3d9caps.h:296
DWORD MaxStreams
Definition: wined3d.h:1942
DWORD Caps2
Definition: wined3d.h:1891
float MaxVertexW
Definition: d3d9caps.h:292
#define D3DPTEXTURECAPS_SQUAREONLY
Definition: d3d8caps.h:116
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY
Definition: d3d8caps.h:37
#define D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD
Definition: d3d9caps.h:147
float PixelShader1xMaxValue
Definition: d3d9caps.h:316
#define D3DVTXPCAPS_TWEENING
Definition: d3d8caps.h:186
#define D3DCAPS2_CANMANAGERESOURCE
Definition: d3d8caps.h:24
#define D3DPRASTERCAPS_COLORPERSPECTIVE
Definition: d3d8caps.h:86
#define D3DPRESENT_INTERVAL_IMMEDIATE
Definition: d3d8caps.h:33
DWORD VolumeTextureFilterCaps
Definition: d3d9caps.h:282
DWORD VertexProcessingCaps
Definition: d3d9caps.h:303
#define D3DDEVCAPS2_ADAPTIVETESSRTPATCH
Definition: d3d9caps.h:203
DWORD TextureOpCaps
Definition: d3d9caps.h:300
DWORD MaxStreamStride
Definition: d3d9caps.h:312
DWORD SrcBlendCaps
Definition: wined3d.h:1899
DWORD MaxTextureRepeat
Definition: d3d9caps.h:289
DWORD DestBlendCaps
Definition: wined3d.h:1900
DWORD PresentationIntervals
Definition: d3d9caps.h:269
DWORD VolumeTextureAddressCaps
Definition: wined3d.h:1908
UINT NumberOfAdaptersInGroup
Definition: wined3d.h:1959
struct wined3d_vertex_shader_caps VS20Caps
Definition: wined3d.h:1963
#define D3DPTEXTURECAPS_CUBEMAP
Definition: d3d8caps.h:121
float GuardBandRight
Definition: d3d9caps.h:295
DWORD DevCaps2
Definition: wined3d.h:1952
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY
Definition: d3d8caps.h:40
#define D3DPTFILTERCAPS_MIPFPOINT
Definition: d3d8caps.h:131
DWORD Caps2
Definition: d3d9caps.h:267
#define D3DVTXPCAPS_LOCALVIEWER
Definition: d3d8caps.h:185
#define D3DDEVCAPS_RTPATCHES
Definition: d3d8caps.h:53
DWORD MaxVertexShader30InstructionSlots
Definition: d3d9caps.h:331
D3DDEVTYPE DeviceType
Definition: d3d9caps.h:264
#define D3DPTEXTURECAPS_ALPHAPALETTE
Definition: d3d8caps.h:118
DWORD MaxTextureBlendStages
Definition: d3d9caps.h:301
enum wined3d_device_type DeviceType
Definition: wined3d.h:1887
DWORD StretchRectFilterCaps
Definition: wined3d.h:1962
float GuardBandLeft
Definition: wined3d.h:1919
DWORD TextureCaps
Definition: wined3d.h:1903
#define D3DPTFILTERCAPS_MAGFGAUSSIANQUAD
Definition: d3d9caps.h:148
DWORD MaxVShaderInstructionsExecuted
Definition: wined3d.h:1966
DWORD TextureFilterCaps
Definition: wined3d.h:1904
#define D3DVTXPCAPS_DIRECTIONALLIGHTS
Definition: d3d8caps.h:183
enum _D3DDEVTYPE D3DDEVTYPE
#define D3DCAPS2_RESERVED
Definition: d3d8caps.h:23
#define D3DPRASTERCAPS_FOGTABLE
Definition: d3d8caps.h:76
#define D3DPRASTERCAPS_DITHER
Definition: d3d8caps.h:72
unsigned long DWORD
Definition: ntddk_ex.h:95
#define D3DPRASTERCAPS_DEPTHBIAS
Definition: d3d9caps.h:93
DWORD DevCaps
Definition: d3d9caps.h:271
DWORD Caps
Definition: d3d9caps.h:266
DWORD Caps3
Definition: wined3d.h:1892
DWORD FVFCaps
Definition: d3d9caps.h:299
#define D3DPRASTERCAPS_ZTEST
Definition: d3d8caps.h:74
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL
Definition: d3d8caps.h:119
INT StaticFlowControlDepth
Definition: d3d9caps.h:248
#define D3DCAPS2_CANCALIBRATEGAMMA
Definition: d3d8caps.h:22
float MaxPointSize
Definition: wined3d.h:1938
DWORD VertexTextureFilterCaps
Definition: d3d9caps.h:328
INT DynamicFlowControlDepth
Definition: d3d9caps.h:246
DWORD Caps
Definition: wined3d.h:1890
DWORD TextureAddressCaps
Definition: wined3d.h:1907
#define D3DPRASTERCAPS_ZBUFFERLESSHSR
Definition: d3d8caps.h:80
DWORD AlphaCmpCaps
Definition: d3d9caps.h:277
#define D3DVTXPCAPS_MATERIALSOURCE7
Definition: d3d8caps.h:182
#define D3DDEVCAPS2_STREAMOFFSET
Definition: d3d9caps.h:201
DWORD VertexProcessingCaps
Definition: wined3d.h:1932
UINT AdapterOrdinalInGroup
Definition: wined3d.h:1958
#define D3DPRASTERCAPS_MULTISAMPLE_TOGGLE
Definition: d3d9caps.h:94
#define D3DPTFILTERCAPS_MINFANISOTROPIC
Definition: d3d8caps.h:130
DWORD MaxVertexBlendMatrices
Definition: d3d9caps.h:306
DWORD PixelShaderVersion
Definition: d3d9caps.h:315
DWORD SrcBlendCaps
Definition: d3d9caps.h:275
#define D3DPTFILTERCAPS_MINFPOINT
Definition: d3d8caps.h:128
DWORD PrimitiveMiscCaps
Definition: wined3d.h:1896
#define D3DDEVCAPS_DRAWPRIMITIVES2
Definition: d3d8caps.h:45
#define D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER
Definition: d3d9caps.h:200
DWORD MaxPrimitiveCount
Definition: wined3d.h:1940
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE
Definition: d3d8caps.h:117
#define D3DPTEXTURECAPS_ALPHA
Definition: d3d8caps.h:115
#define D3DCAPS2_CANAUTOGENMIPMAP
Definition: d3d9caps.h:22
UINT MasterAdapterOrdinal
Definition: d3d9caps.h:320
#define D3DPTFILTERCAPS_MAGFPOINT
Definition: d3d8caps.h:133
DWORD CubeTextureFilterCaps
Definition: d3d9caps.h:281
DWORD MaxPShaderInstructionsExecuted
Definition: d3d9caps.h:330
DWORD MaxStreams
Definition: d3d9caps.h:311
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY
Definition: d3d8caps.h:41
DWORD MaxVertexIndex
Definition: d3d9caps.h:310
DWORD LineCaps
Definition: wined3d.h:1909
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM
Definition: d3d8caps.h:44
#define D3D_MAX_SIMULTANEOUS_RENDERTARGETS
Definition: d3d9types.h:184
#define major(rdev)
Definition: propsheet.cpp:879
DWORD PrimitiveMiscCaps
Definition: d3d9caps.h:272
DWORD MaxVertexShaderConst
Definition: d3d9caps.h:314
DWORD MaxTextureRepeat
Definition: wined3d.h:1914
float MaxPointSize
Definition: d3d9caps.h:308
DWORD CubeTextureFilterCaps
Definition: wined3d.h:1905
DWORD VolumeTextureFilterCaps
Definition: wined3d.h:1906
#define min(a, b)
Definition: monoChain.cc:55
DWORD MaxUserClipPlanes
Definition: d3d9caps.h:305
#define D3DPTFILTERCAPS_MAGFLINEAR
Definition: d3d8caps.h:134
DWORD MaxVolumeExtent
Definition: wined3d.h:1913
DWORD StencilCaps
Definition: d3d9caps.h:298
#define D3DVTXPCAPS_TEXGEN_SPHEREMAP
Definition: d3d9caps.h:199
float GuardBandTop
Definition: wined3d.h:1920
UINT AdapterOrdinal
Definition: d3d9caps.h:265
#define D3DPRASTERCAPS_SCISSORTEST
Definition: d3d9caps.h:91
DWORD MaxVertexBlendMatrixIndex
Definition: wined3d.h:1936
#define D3DPTEXTURECAPS_MIPCUBEMAP
Definition: d3d8caps.h:125
DWORD CursorCaps
Definition: d3d9caps.h:270
#define D3DPRASTERCAPS_WBUFFER
Definition: d3d8caps.h:83
#define D3DPRASTERCAPS_FOGRANGE
Definition: d3d8caps.h:81
DWORD MaxVertexShader30InstructionSlots
Definition: wined3d.h:1968
DWORD TextureAddressCaps
Definition: d3d9caps.h:283
#define D3DPTEXTURECAPS_VOLUMEMAP_POW2
Definition: d3d8caps.h:127
#define D3DCAPS2_FULLSCREENGAMMA
Definition: d3d8caps.h:20
#define D3DDEVCAPS_DRAWPRIMTLVERTEX
Definition: d3d8caps.h:42
DWORD MaxAnisotropy
Definition: wined3d.h:1916
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY
Definition: d3d8caps.h:36
DWORD ShadeCaps
Definition: d3d9caps.h:278
DWORD MaxAnisotropy
Definition: d3d9caps.h:291
INT DynamicFlowControlDepth
Definition: d3d9caps.h:255
DWORD RasterCaps
Definition: d3d9caps.h:273
DWORD DevCaps
Definition: wined3d.h:1895
#define D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES
Definition: d3d9caps.h:205
#define D3DDEVCAPS_RTPATCHHANDLEZERO
Definition: d3d8caps.h:54
DWORD VertexTextureFilterCaps
Definition: wined3d.h:1965
DWORD ZCmpCaps
Definition: wined3d.h:1898
DWORD MaxTextureWidth
Definition: wined3d.h:1911
#define D3DDEVCAPS_HWRASTERIZATION
Definition: d3d8caps.h:50
DWORD NumSimultaneousRTs
Definition: wined3d.h:1961
#define D3DPSHADECAPS_COLORGOURAUDRGB
Definition: d3d8caps.h:109
#define D3DPTEXTURECAPS_VOLUMEMAP
Definition: d3d8caps.h:122
float ExtentsAdjust
Definition: d3d9caps.h:297
DWORD PixelShaderVersion
Definition: wined3d.h:1948
DWORD MaxPShaderInstructionsExecuted
Definition: wined3d.h:1967
#define D3DDEVCAPS_PUREDEVICE
Definition: d3d8caps.h:51
#define D3DCAPS2_DYNAMICTEXTURES
Definition: d3d8caps.h:25
DWORD MaxPixelShader30InstructionSlots
Definition: d3d9caps.h:332
#define D3DDEVCAPS_CANRENDERAFTERFLIP
Definition: d3d8caps.h:43
#define D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET
Definition: d3d9caps.h:207
DWORD DeclTypes
Definition: wined3d.h:1960
DWORD DeclTypes
Definition: d3d9caps.h:323

◆ d3dformat_from_wined3dformat()

D3DFORMAT d3dformat_from_wined3dformat ( enum wined3d_format_id  format)

Definition at line 44 of file device.c.

45 {
46  BYTE *c = (BYTE *)&format;
47 
48  /* Don't translate FOURCC formats */
49  if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return format;
50 
51  switch(format)
52  {
62  case WINED3DFMT_A8_UNORM: return D3DFMT_A8;
68  case WINED3DFMT_P8_UINT: return D3DFMT_P8;
69  case WINED3DFMT_L8_UNORM: return D3DFMT_L8;
80  case WINED3DFMT_D32_UNORM: return D3DFMT_D32;
85  case WINED3DFMT_D16_UNORM: return D3DFMT_D16;
88  default:
89  FIXME("Unhandled wined3d format %#x.\n", format);
90  return D3DFMT_UNKNOWN;
91  }
92 }
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define FIXME(fmt,...)
Definition: debug.h:110
const GLubyte * c
Definition: glext.h:8905
unsigned char BYTE
Definition: mem.h:68
#define isprint(c)
Definition: acclib.h:73

Referenced by d3d8_device_GetDisplayMode(), d3d9_device_GetDisplayMode(), d3d9_device_GetDisplayModeEx(), d3d9_device_reset(), d3d9_device_UpdateSurface(), and present_parameters_from_wined3d_swapchain_desc().

◆ d3dpool_from_wined3daccess()

static D3DPOOL d3dpool_from_wined3daccess ( unsigned int  access,
unsigned int  usage 
)
inlinestatic

Definition at line 299 of file d3d9_private.h.

300 {
302  {
303  default:
305  return D3DPOOL_DEFAULT;
308  return D3DPOOL_SCRATCH;
309  return D3DPOOL_SYSTEMMEM;
311  return D3DPOOL_MANAGED;
312  }
313 }
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:924

◆ d3dusage_from_wined3dusage()

static DWORD d3dusage_from_wined3dusage ( unsigned int  usage)
inlinestatic

Definition at line 294 of file d3d9_private.h.

295 {
296  return usage & WINED3DUSAGE_MASK;
297 }
#define WINED3DUSAGE_MASK
Definition: wined3d.h:922
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919

◆ device_init()

HRESULT device_init ( struct d3d9_device device,
struct d3d9 parent,
struct wined3d wined3d,
UINT  adapter,
D3DDEVTYPE  device_type,
HWND  focus_window,
DWORD  flags,
D3DPRESENT_PARAMETERS parameters,
D3DDISPLAYMODEEX mode 
)

Definition at line 4217 of file device.c.

4220 {
4221  struct wined3d_swapchain_desc *swapchain_desc;
4222  unsigned i, count = 1;
4223  WINED3DCAPS caps;
4224  HRESULT hr;
4225 
4226  if (mode)
4227  FIXME("Ignoring display mode.\n");
4228 
4229  device->IDirect3DDevice9Ex_iface.lpVtbl = &d3d9_device_vtbl;
4230  device->device_parent.ops = &d3d9_wined3d_device_parent_ops;
4231  device->refcount = 1;
4232 
4234 
4236  if (FAILED(hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags, 4,
4237  &device->device_parent, &device->wined3d_device)))
4238  {
4239  WARN("Failed to create wined3d device, hr %#x.\n", hr);
4241  return hr;
4242  }
4243 
4244  wined3d_get_device_caps(wined3d, adapter, device_type, &caps);
4245  device->max_user_clip_planes = caps.MaxUserClipPlanes;
4248 
4250  wined3d_device_set_multithreaded(device->wined3d_device);
4251 
4252  if (!parameters->Windowed)
4253  {
4254  if (!focus_window)
4255  focus_window = parameters->hDeviceWindow;
4256  if (FAILED(hr = wined3d_device_acquire_focus_window(device->wined3d_device, focus_window)))
4257  {
4258  ERR("Failed to acquire focus window, hr %#x.\n", hr);
4259  wined3d_device_decref(device->wined3d_device);
4261  return hr;
4262  }
4263 
4264  for (i = 0; i < count; ++i)
4265  {
4266  HWND device_window = parameters[i].hDeviceWindow;
4267 
4268  if (!device_window) device_window = focus_window;
4270  parameters[i].BackBufferWidth,
4271  parameters[i].BackBufferHeight);
4272  }
4273  }
4274 
4275  if (!(swapchain_desc = heap_alloc(sizeof(*swapchain_desc) * count)))
4276  {
4277  ERR("Failed to allocate wined3d parameters.\n");
4279  wined3d_device_decref(device->wined3d_device);
4281  return E_OUTOFMEMORY;
4282  }
4283 
4284  for (i = 0; i < count; ++i)
4285  {
4286  if (!wined3d_swapchain_desc_from_present_parameters(&swapchain_desc[i], &parameters[i],
4287  parent->extended))
4288  {
4290  wined3d_device_decref(device->wined3d_device);
4291  heap_free(swapchain_desc);
4293  return D3DERR_INVALIDCALL;
4294  }
4295  }
4296 
4297  if (FAILED(hr = wined3d_device_init_3d(device->wined3d_device, swapchain_desc)))
4298  {
4299  WARN("Failed to initialize 3D, hr %#x.\n", hr);
4301  heap_free(swapchain_desc);
4302  wined3d_device_decref(device->wined3d_device);
4304  return hr;
4305  }
4306 
4307  wined3d_device_set_render_state(device->wined3d_device,
4308  WINED3D_RS_ZENABLE, !!swapchain_desc->enable_auto_depth_stencil);
4309 
4311  {
4312  wined3d_device_uninit_3d(device->wined3d_device);
4314  wined3d_device_decref(device->wined3d_device);
4316  return E_OUTOFMEMORY;
4317  }
4318  for (i = 0; i < device->implicit_swapchain_count; ++i)
4319  {
4320  device->implicit_swapchains[i]->swap_interval
4321  = wined3dswapinterval_from_d3d(parameters[i].PresentationInterval);
4322  }
4323 
4324  for (i = 0; i < count; ++i)
4325  {
4327  &swapchain_desc[i], parameters[i].PresentationInterval);
4328  }
4329 
4331 
4332  heap_free(swapchain_desc);
4333 
4334  /* Initialize the converted declaration array. This creates a valid pointer
4335  * and when adding decls HeapReAlloc() can be used without further checking. */
4336  if (!(device->fvf_decls = heap_alloc(0)))
4337  {
4338  ERR("Failed to allocate FVF vertex declaration map memory.\n");
4340  heap_free(device->implicit_swapchains);
4341  wined3d_device_uninit_3d(device->wined3d_device);
4343  wined3d_device_decref(device->wined3d_device);
4345  return E_OUTOFMEMORY;
4346  }
4347 
4348  /* We could also simply ignore the initial rendertarget since it's known
4349  * not to be a texture (we currently use these only for automatic mipmap
4350  * generation). */
4353  wined3d_device_get_rendertarget_view(device->wined3d_device, 0));
4355 
4356  IDirect3D9Ex_AddRef(&parent->IDirect3D9Ex_iface);
4357  device->d3d_parent = parent;
4358 
4359  return D3D_OK;
4360 }
void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval)
Definition: device.c:233
static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapchain_desc *swapchain_desc, const D3DPRESENT_PARAMETERS *present_parameters, BOOL extended)
Definition: device.c:294
void CDECL wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value)
Definition: device.c:2048
void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
Definition: device.c:1293
HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
Definition: device.c:1200
DWORD MaxUserClipPlanes
Definition: wined3d.h:1934
#define D3DCREATE_ADAPTERGROUP_DEVICE
Definition: d3d9.h:49
HRESULT hr
Definition: shlfolder.c:183
HRESULT CDECL wined3d_device_acquire_focus_window(struct wined3d_device *device, HWND window)
Definition: device.c:942
struct wined3d_rendertarget_view *CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, unsigned int view_idx)
Definition: device.c:4481
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
device_type
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define D3DERR_INVALIDCALL
HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, WINED3DCAPS *caps)
Definition: directx.c:5651
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
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
static const struct wined3d_device_parent_ops d3d9_wined3d_device_parent_ops
Definition: device.c:4190
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
static enum wined3d_swap_interval wined3dswapinterval_from_d3d(DWORD interval)
Definition: device.c:273
void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
Definition: device.c:958
void *CDECL wined3d_rendertarget_view_get_sub_resource_parent(const struct wined3d_rendertarget_view *view)
Definition: view.c:376
static HRESULT d3d9_device_get_swapchains(struct d3d9_device *device)
Definition: device.c:894
#define D3DCREATE_FPU_PRESERVE
Definition: d3d8.h:41
UINT NumberOfAdaptersInGroup
Definition: wined3d.h:1959
HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, HWND focus_window, DWORD flags, BYTE surface_alignment, struct wined3d_device_parent *device_parent, struct wined3d_device **device)
Definition: directx.c:6233
HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc)
Definition: device.c:1066
r parent
Definition: btrfs.c:2677
LONG HRESULT
Definition: typedefs.h:77
void CDECL wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h)
Definition: device.c:857
GLbitfield flags
Definition: glext.h:7161
static const struct IDirect3DDevice9ExVtbl d3d9_device_vtbl
Definition: device.c:3924
GLenum mode
Definition: glext.h:6217
#define ERR(fmt,...)
Definition: debug.h:109
BOOL enable_auto_depth_stencil
Definition: wined3d.h:1744
#define D3DCREATE_MULTITHREADED
Definition: d3d8.h:42
#define D3D_OK
Definition: d3d.h:106
static void setup_fpu(void)
Definition: device.c:4200
#define IDirect3D9Ex_AddRef(p)
Definition: d3d9.h:308
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
ULONG CDECL wined3d_device_decref(struct wined3d_device *device)
Definition: device.c:477

◆ impl_from_IDirect3DDevice9Ex()

static struct d3d9_device* impl_from_IDirect3DDevice9Ex ( IDirect3DDevice9Ex *  iface)
inlinestatic

Definition at line 289 of file d3d9_private.h.

290 {
291  return CONTAINING_RECORD(iface, struct d3d9_device, IDirect3DDevice9Ex_iface);
292 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by d3d9_device_AddRef(), d3d9_device_BeginScene(), d3d9_device_BeginStateBlock(), d3d9_device_CheckDeviceState(), d3d9_device_Clear(), d3d9_device_ColorFill(), d3d9_device_CreateAdditionalSwapChain(), d3d9_device_CreateCubeTexture(), d3d9_device_CreateDepthStencilSurface(), d3d9_device_CreateDepthStencilSurfaceEx(), d3d9_device_CreateIndexBuffer(), d3d9_device_CreateOffscreenPlainSurface(), d3d9_device_CreatePixelShader(), d3d9_device_CreateQuery(), d3d9_device_CreateRenderTarget(), d3d9_device_CreateStateBlock(), d3d9_device_CreateTexture(), d3d9_device_CreateVertexBuffer(), d3d9_device_CreateVertexDeclaration(), d3d9_device_CreateVertexShader(), d3d9_device_CreateVolumeTexture(), d3d9_device_DrawIndexedPrimitive(), d3d9_device_DrawIndexedPrimitiveUP(), d3d9_device_DrawPrimitive(), d3d9_device_DrawPrimitiveUP(), d3d9_device_EndScene(), d3d9_device_EndStateBlock(), d3d9_device_EvictManagedResources(), d3d9_device_GetAvailableTextureMem(), d3d9_device_GetBackBuffer(), d3d9_device_GetClipPlane(), d3d9_device_GetClipStatus(), d3d9_device_GetCreationParameters(), d3d9_device_GetDepthStencilSurface(), d3d9_device_GetDeviceCaps(), d3d9_device_GetDirect3D(), d3d9_device_GetDisplayMode(), d3d9_device_GetDisplayModeEx(), d3d9_device_GetFrontBufferData(), d3d9_device_GetFVF(), d3d9_device_GetGammaRamp(), d3d9_device_GetIndices(), d3d9_device_GetLight(), d3d9_device_GetLightEnable(), d3d9_device_GetMaterial(), d3d9_device_GetMaximumFrameLatency(), d3d9_device_GetNPatchMode(), d3d9_device_GetNumberOfSwapChains(), d3d9_device_GetPixelShader(), d3d9_device_GetPixelShaderConstantB(), d3d9_device_GetPixelShaderConstantF(), d3d9_device_GetPixelShaderConstantI(), d3d9_device_GetRasterStatus(), d3d9_device_GetRenderState(), d3d9_device_GetRenderTarget(), d3d9_device_GetSamplerState(), d3d9_device_GetScissorRect(), d3d9_device_GetSoftwareVertexProcessing(), d3d9_device_GetStreamSource(), d3d9_device_GetStreamSourceFreq(), d3d9_device_GetSwapChain(), d3d9_device_GetTexture(), d3d9_device_GetTextureStageState(), d3d9_device_GetTransform(), d3d9_device_GetVertexDeclaration(), d3d9_device_GetVertexShader(), d3d9_device_GetVertexShaderConstantB(), d3d9_device_GetVertexShaderConstantF(), d3d9_device_GetVertexShaderConstantI(), d3d9_device_GetViewport(), d3d9_device_LightEnable(), d3d9_device_MultiplyTransform(), d3d9_device_Present(), d3d9_device_PresentEx(), d3d9_device_ProcessVertices(), d3d9_device_QueryInterface(), d3d9_device_Release(), d3d9_device_Reset(), d3d9_device_ResetEx(), d3d9_device_SetClipPlane(), d3d9_device_SetClipStatus(), d3d9_device_SetCursorPosition(), d3d9_device_SetCursorProperties(), d3d9_device_SetDepthStencilSurface(), d3d9_device_SetDialogBoxMode(), d3d9_device_SetFVF(), d3d9_device_SetGammaRamp(), d3d9_device_SetIndices(), d3d9_device_SetLight(), d3d9_device_SetMaterial(), d3d9_device_SetMaximumFrameLatency(), d3d9_device_SetNPatchMode(), d3d9_device_SetPixelShader(), d3d9_device_SetPixelShaderConstantB(), d3d9_device_SetPixelShaderConstantF(), d3d9_device_SetPixelShaderConstantI(), d3d9_device_SetRenderState(), d3d9_device_SetRenderTarget(), d3d9_device_SetSamplerState(), d3d9_device_SetScissorRect(), d3d9_device_SetSoftwareVertexProcessing(), d3d9_device_SetStreamSource(), d3d9_device_SetStreamSourceFreq(), d3d9_device_SetTexture(), d3d9_device_SetTextureStageState(), d3d9_device_SetTransform(), d3d9_device_SetVertexDeclaration(), d3d9_device_SetVertexShader(), d3d9_device_SetVertexShaderConstantB(), d3d9_device_SetVertexShaderConstantF(), d3d9_device_SetVertexShaderConstantI(), d3d9_device_SetViewport(), d3d9_device_ShowCursor(), d3d9_device_StretchRect(), d3d9_device_TestCooperativeLevel(), d3d9_device_UpdateSurface(), d3d9_device_UpdateTexture(), d3d9_device_ValidateDevice(), d3d9_surface_get_device(), d3d9_swapchain_Present(), and d3d9_swapchain_QueryInterface().

◆ indexbuffer_init()

HRESULT indexbuffer_init ( struct d3d9_indexbuffer buffer,
struct d3d9_device device,
UINT  size,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool 
)

Definition at line 569 of file buffer.c.

571 {
572  struct wined3d_buffer_desc desc;
573  HRESULT hr;
574 
575  desc.byte_width = size;
577  if (pool == D3DPOOL_SCRATCH)
578  desc.usage |= WINED3DUSAGE_SCRATCH;
579  desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
582  desc.misc_flags = 0;
583  desc.structure_byte_stride = 0;
584 
585  buffer->IDirect3DIndexBuffer9_iface.lpVtbl = &d3d9_indexbuffer_vtbl;
587  d3d9_resource_init(&buffer->resource);
588 
590  hr = wined3d_buffer_create(device->wined3d_device, &desc, NULL, buffer,
591  &d3d9_indexbuffer_wined3d_parent_ops, &buffer->wined3d_buffer);
593  if (FAILED(hr))
594  {
595  WARN("Failed to create wined3d buffer, hr %#x.\n", hr);
596  return hr;
597  }
598 
599  buffer->parent_device = &device->IDirect3DDevice9Ex_iface;
600  IDirect3DDevice9Ex_AddRef(buffer->parent_device);
601 
602  return D3D_OK;
603 }
HRESULT hr
Definition: shlfolder.c:183
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: device.c:94
#define WARN(fmt,...)
Definition: debug.h:111
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
GLuint buffer
Definition: glext.h:5915
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define WINED3DUSAGE_MASK
Definition: wined3d.h:922
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:900
static const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops
Definition: buffer.c:564
Definition: devices.h:37
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:929
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define D3D_OK
Definition: d3d.h:106
static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl
Definition: buffer.c:536
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:924
HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer)
Definition: buffer.c:1434
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:302

◆ is_gdi_compat_wined3dformat()

BOOL is_gdi_compat_wined3dformat ( enum wined3d_format_id  format)

Definition at line 1425 of file device.c.

1426 {
1427  switch (format)
1428  {
1435  return TRUE;
1436  default:
1437  return FALSE;
1438  }
1439 }
#define TRUE
Definition: types.h:120
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546

Referenced by cubetexture_init(), d3d9_device_create_surface(), device_parent_create_swapchain_texture(), and texture_init().

◆ pixelshader_init()

HRESULT pixelshader_init ( struct d3d9_pixelshader shader,
struct d3d9_device device,
const DWORD byte_code 
)

Definition at line 291 of file shader.c.

292 {
293  struct wined3d_shader_desc desc;
294  HRESULT hr;
295 
296  shader->refcount = 1;
297  shader->IDirect3DPixelShader9_iface.lpVtbl = &d3d9_pixelshader_vtbl;
298 
299  desc.byte_code = byte_code;
300  desc.byte_code_size = ~(size_t)0;
302  desc.input_signature.element_count = 0;
303  desc.output_signature.element_count = 0;
304  desc.patch_constant_signature.element_count = 0;
305  desc.max_version = 3;
306 
308  hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader,
309  &d3d9_pixelshader_wined3d_parent_ops, &shader->wined3d_shader);
311  if (FAILED(hr))
312  {
313  WARN("Failed to created wined3d pixel shader, hr %#x.\n", hr);
314  return hr;
315  }
316 
317  shader->parent_device = &device->IDirect3DDevice9Ex_iface;
318  IDirect3DDevice9Ex_AddRef(shader->parent_device);
319 
320  return D3D_OK;
321 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
const DWORD * byte_code
Definition: wined3d.h:2052
static const IDirect3DPixelShader9Vtbl d3d9_pixelshader_vtbl
Definition: shader.c:270
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
static const struct wined3d_parent_ops d3d9_pixelshader_wined3d_parent_ops
Definition: shader.c:286
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
__kernel_size_t size_t
Definition: linux.h:237
GLuint shader
Definition: glext.h:6030
LONG HRESULT
Definition: typedefs.h:77
#define D3D_OK
Definition: d3d.h:106
HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader)
Definition: shader.c:4315
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365

Referenced by d3d9_device_CreatePixelShader().

◆ present_parameters_from_wined3d_swapchain_desc()

void present_parameters_from_wined3d_swapchain_desc ( D3DPRESENT_PARAMETERS present_parameters,
const struct wined3d_swapchain_desc swapchain_desc,
DWORD  presentation_interval 
)

Definition at line 233 of file device.c.

235 {
236  present_parameters->BackBufferWidth = swapchain_desc->backbuffer_width;
237  present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height;
238  present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc->backbuffer_format);
239  present_parameters->BackBufferCount = swapchain_desc->backbuffer_count;
240  present_parameters->MultiSampleType = swapchain_desc->multisample_type;
241  present_parameters->MultiSampleQuality = swapchain_desc->multisample_quality;
242  present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect);
243  present_parameters->hDeviceWindow = swapchain_desc->device_window;
244  present_parameters->Windowed = swapchain_desc->windowed;
245  present_parameters->EnableAutoDepthStencil = swapchain_desc->enable_auto_depth_stencil;
246  present_parameters->AutoDepthStencilFormat
248  present_parameters->Flags = swapchain_desc->flags & D3DPRESENTFLAGS_MASK;
249  present_parameters->FullScreen_RefreshRateInHz = swapchain_desc->refresh_rate;
250  present_parameters->PresentationInterval = presentation_interval;
251 }
unsigned int backbuffer_height
Definition: wined3d.h:1735
unsigned int backbuffer_width
Definition: wined3d.h:1734
enum wined3d_multisample_type multisample_type
Definition: wined3d.h:1739
unsigned int backbuffer_count
Definition: wined3d.h:1737
D3DMULTISAMPLE_TYPE MultiSampleType
Definition: d3d8types.h:1126
D3DFORMAT AutoDepthStencilFormat
Definition: d3d8types.h:1132
D3DFORMAT BackBufferFormat
Definition: d3d8types.h:1123
enum wined3d_swap_effect swap_effect
Definition: wined3d.h:1741
enum wined3d_format_id auto_depth_stencil_format
Definition: wined3d.h:1745
BOOL enable_auto_depth_stencil
Definition: wined3d.h:1744
static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect(enum wined3d_swap_effect effect)
Definition: device.c:213
#define D3DPRESENTFLAGS_MASK
Definition: d3d8_private.h:40
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format)
Definition: device.c:44
unsigned int refresh_rate
Definition: wined3d.h:1747
enum wined3d_format_id backbuffer_format
Definition: wined3d.h:1736
D3DSWAPEFFECT SwapEffect
Definition: d3d8types.h:1128

Referenced by d3d9_device_CreateAdditionalSwapChain(), and device_init().

◆ query_init()

HRESULT query_init ( struct d3d9_query query,
struct d3d9_device device,
D3DQUERYTYPE  type 
)

Definition at line 184 of file query.c.

185 {
186  HRESULT hr;
187 
189  {
190  if (type == 0x16)
191  FIXME("Undocumented query %#x created.\n", type);
192  else
193  WARN("Invalid query type %#x.\n", type);
194 
195  return D3DERR_NOTAVAILABLE;
196  }
197 
198  query->IDirect3DQuery9_iface.lpVtbl = &d3d9_query_vtbl;
199  query->refcount = 1;
200 
202  if (FAILED(hr = wined3d_query_create(device->wined3d_device, type,
203  query, &d3d9_null_wined3d_parent_ops, &query->wined3d_query)))
204  {
206  WARN("Failed to create wined3d query, hr %#x.\n", hr);
207  return hr;
208  }
209 
211  query->data_size = sizeof(DWORD);
213  query->data_size = sizeof(BOOL);
214  else
215  query->data_size = wined3d_query_get_data_size(query->wined3d_query);
217 
218  query->parent_device = &device->IDirect3DDevice9Ex_iface;
219  IDirect3DDevice9Ex_AddRef(query->parent_device);
220 
221  return D3D_OK;
222 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
UINT CDECL wined3d_query_get_data_size(const struct wined3d_query *query)
Definition: query.c:403
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
LONG HRESULT
Definition: typedefs.h:77
#define D3D_OK
Definition: d3d.h:106
HRESULT CDECL wined3d_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1294
const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops
Definition: device.c:30
static const struct IDirect3DQuery9Vtbl d3d9_query_vtbl
Definition: query.c:172
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365

Referenced by d3d9_device_CreateQuery().

◆ stateblock_init()

HRESULT stateblock_init ( struct d3d9_stateblock stateblock,
struct d3d9_device device,
D3DSTATEBLOCKTYPE  type,
struct wined3d_stateblock wined3d_stateblock 
)

Definition at line 134 of file stateblock.c.

136 {
137  HRESULT hr;
138 
139  stateblock->IDirect3DStateBlock9_iface.lpVtbl = &d3d9_stateblock_vtbl;
140  stateblock->refcount = 1;
141 
142  if (wined3d_stateblock)
143  {
145  }
146  else
147  {
149  hr = wined3d_stateblock_create(device->wined3d_device,
150  (enum wined3d_stateblock_type)type, &stateblock->wined3d_stateblock);
152  if (FAILED(hr))
153  {
154  WARN("Failed to create wined3d stateblock, hr %#x.\n", hr);
155  return hr;
156  }
157  }
158 
159  stateblock->parent_device = &device->IDirect3DDevice9Ex_iface;
161 
162  return D3D_OK;
163 }
struct wined3d_stateblock * wined3d_stateblock
Definition: d3d9_private.h:231
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock)
Definition: stateblock.c:1384
Definition: devices.h:37
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
wined3d_stateblock_type
Definition: wined3d.h:774
static const struct IDirect3DStateBlock9Vtbl d3d9_stateblock_vtbl
Definition: stateblock.c:122
LONG HRESULT
Definition: typedefs.h:77
IDirect3DStateBlock9 IDirect3DStateBlock9_iface
Definition: d3d9_private.h:229
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:232
#define D3D_OK
Definition: d3d.h:106
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365

Referenced by d3d9_device_CreateStateBlock(), d3d9_device_EndStateBlock(), and wined3d_stateblock_create().

◆ surface_init()

void surface_init ( struct d3d9_surface surface,
struct wined3d_texture wined3d_texture,
unsigned int  sub_resource_idx,
const struct wined3d_parent_ops **  parent_ops 
)

Definition at line 355 of file surface.c.

357 {
358  IDirect3DBaseTexture9 *texture;
359 
360  surface->IDirect3DSurface9_iface.lpVtbl = &d3d9_surface_vtbl;
361  d3d9_resource_init(&surface->resource);
362  surface->resource.refcount = 0;
363  list_init(&surface->rtv_entry);
365  surface->wined3d_texture = wined3d_texture;
366  surface->sub_resource_idx = sub_resource_idx;
367 
368  if (surface->container && SUCCEEDED(IUnknown_QueryInterface(surface->container,
369  &IID_IDirect3DBaseTexture9, (void **)&texture)))
370  {
373  }
374 
375  *parent_ops = &d3d9_surface_wined3d_parent_ops;
376 }
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1317
struct d3d9_texture * unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture9 *iface) DECLSPEC_HIDDEN
Definition: texture.c:1269
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
struct wined3d_texture * wined3d_texture
Definition: d3d9_private.h:161
IUnknown * container
Definition: d3d9_private.h:166
struct list rtv_entry
Definition: d3d9_private.h:163
static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops
Definition: surface.c:350
GLenum GLuint texture
Definition: glext.h:6295
static const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl
Definition: surface.c:319
struct d3d9_texture * texture
Definition: d3d9_private.h:167
#define IDirect3DBaseTexture9_Release(p)
Definition: d3d9.h:835
struct d3d9_resource resource
Definition: d3d9_private.h:160
unsigned int sub_resource_idx
Definition: d3d9_private.h:162
IDirect3DSurface9 IDirect3DSurface9_iface
Definition: d3d9_private.h:159
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ texture_init()

HRESULT texture_init ( struct d3d9_texture texture,
struct d3d9_device device,
UINT  width,
UINT  height,
UINT  levels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool 
)

Definition at line 1297 of file texture.c.

1299 {
1300  struct wined3d_resource_desc desc;
1301  DWORD flags = 0;
1302  HRESULT hr;
1303 
1304  texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl;
1305  d3d9_resource_init(&texture->resource);
1306  list_init(&texture->rtv_list);
1307  texture->usage = usage;
1308 
1309  desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1311  desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1312  desc.multisample_quality = 0;
1314  desc.usage |= WINED3DUSAGE_TEXTURE;
1315  if (pool == D3DPOOL_SCRATCH)
1316  desc.usage |= WINED3DUSAGE_SCRATCH;
1319  desc.width = width;
1320  desc.height = height;
1321  desc.depth = 1;
1322  desc.size = 0;
1323 
1326 
1327  if (is_gdi_compat_wined3dformat(desc.format))
1329 
1331  {
1332  if (pool == D3DPOOL_SYSTEMMEM)
1333  {
1334  WARN("D3DUSAGE_AUTOGENMIPMAP texture can't be in D3DPOOL_SYSTEMMEM, returning D3DERR_INVALIDCALL.\n");
1335  return D3DERR_INVALIDCALL;
1336  }
1337  if (levels && levels != 1)
1338  {
1339  WARN("D3DUSAGE_AUTOGENMIPMAP texture with %u levels, returning D3DERR_INVALIDCALL.\n", levels);
1340  return D3DERR_INVALIDCALL;
1341  }
1346  if (hr == D3D_OK)
1347  {
1349  levels = 0;
1350  }
1351  else
1352  {
1353  WARN("D3DUSAGE_AUTOGENMIPMAP not supported on D3DFORMAT %#x, creating a texture "
1354  "with a single level.\n", format);
1355  levels = 1;
1356  }
1357  texture->autogen_filter_type = D3DTEXF_LINEAR;
1358  }
1359  else
1360  {
1361  texture->autogen_filter_type = D3DTEXF_NONE;
1362  }
1363  if (!levels)
1364  levels = wined3d_log2i(max(width, height)) + 1;
1365 
1367  hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, flags,
1368  NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
1370  if (FAILED(hr))
1371  {
1372  WARN("Failed to create wined3d texture, hr %#x.\n", hr);
1373  return hr;
1374  }
1375 
1376  texture->parent_device = &device->IDirect3DDevice9Ex_iface;
1377  IDirect3DDevice9Ex_AddRef(texture->parent_device);
1378 
1379  return D3D_OK;
1380 }
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
GLint GLint GLsizei width
Definition: gl.h:1546
#define max(a, b)
Definition: svc.c:63
#define WINED3D_TEXTURE_CREATE_GENERATE_MIPMAPS
Definition: wined3d.h:1562
HRESULT hr
Definition: shlfolder.c:183
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: device.c:94
GLsizei levels
Definition: glext.h:7884
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
#define WARN(fmt,...)
Definition: debug.h:111
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
BOOL is_gdi_compat_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN
Definition: device.c:1425
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define D3DERR_INVALIDCALL
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
Definition: directx.c:5331
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define WINED3D_TEXTURE_CREATE_GET_DC
Definition: wined3d.h:1561
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
#define WINED3DUSAGE_QUERY_GENMIPMAP
Definition: wined3d.h:932
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
static DWORD wined3dusage_from_d3dusage(unsigned int usage)
Definition: d3d9_private.h:334
static const IDirect3DTexture9Vtbl d3d9_texture_2d_vtbl
Definition: texture.c:482
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:77
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
unsigned long DWORD
Definition: ntddk_ex.h:95
static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops
Definition: texture.c:1292
GLbitfield flags
Definition: glext.h:7161
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define D3D_OK
Definition: d3d.h:106
#define WINED3D_TEXTURE_CREATE_MAPPABLE
Definition: wined3d.h:1558
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:927
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:924
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2763
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)
Definition: texture.c:3326
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:302

◆ unsafe_impl_from_IDirect3DBaseTexture9()

struct d3d9_texture* unsafe_impl_from_IDirect3DBaseTexture9 ( IDirect3DBaseTexture9 *  iface)

Definition at line 1269 of file texture.c.

1270 {
1271  if (!iface)
1272  return NULL;
1273 
1274  if (iface->lpVtbl != (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl
1275  && iface->lpVtbl != (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl
1276  && iface->lpVtbl != (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl)
1277  {
1278  WARN("%p is not a valid IDirect3DBaseTexture9 interface.\n", iface);
1279  return NULL;
1280  }
1281 
1282  return CONTAINING_RECORD(iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
1283 }
static const IDirect3DCubeTexture9Vtbl d3d9_texture_cube_vtbl
Definition: texture.c:906
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static const IDirect3DTexture9Vtbl d3d9_texture_2d_vtbl
Definition: texture.c:482
static const IDirect3DVolumeTexture9Vtbl d3d9_texture_3d_vtbl
Definition: texture.c:1239

Referenced by d3d9_device_SetTexture(), d3d9_device_UpdateTexture(), and surface_init().

◆ unsafe_impl_from_IDirect3DIndexBuffer9()

struct d3d9_indexbuffer* unsafe_impl_from_IDirect3DIndexBuffer9 ( IDirect3DIndexBuffer9 *  iface)

Definition at line 605 of file buffer.c.

606 {
607  if (!iface)
608  return NULL;
609  assert(iface->lpVtbl == &d3d9_indexbuffer_vtbl);
610 
611  return impl_from_IDirect3DIndexBuffer9(iface);
612 }
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl
Definition: buffer.c:536
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323

Referenced by d3d9_device_SetIndices().

◆ unsafe_impl_from_IDirect3DPixelShader9()

struct d3d9_pixelshader* unsafe_impl_from_IDirect3DPixelShader9 ( IDirect3DPixelShader9 *  iface)

Definition at line 323 of file shader.c.

324 {
325  if (!iface)
326  return NULL;
327  if (iface->lpVtbl != &d3d9_pixelshader_vtbl)
328  WARN("Pixel shader %p with the wrong vtbl %p\n", iface, iface->lpVtbl);
329 
330  return impl_from_IDirect3DPixelShader9(iface);
331 }
#define WARN(fmt,...)
Definition: debug.h:111
static const IDirect3DPixelShader9Vtbl d3d9_pixelshader_vtbl
Definition: shader.c:270
smooth NULL
Definition: ftsmooth.c:416
static struct d3d9_pixelshader * impl_from_IDirect3DPixelShader9(IDirect3DPixelShader9 *iface)
Definition: shader.c:179

Referenced by d3d9_device_SetPixelShader().

◆ unsafe_impl_from_IDirect3DSurface9()

struct d3d9_surface* unsafe_impl_from_IDirect3DSurface9 ( IDirect3DSurface9 *  iface)

Definition at line 440 of file surface.c.

441 {
442  if (!iface)
443  return NULL;
444  assert(iface->lpVtbl == &d3d9_surface_vtbl);
445 
446  return impl_from_IDirect3DSurface9(iface);
447 }
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
static struct d3d9_surface * impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface)
Definition: surface.c:27
static const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl
Definition: surface.c:319

Referenced by d3d9_device_ColorFill(), d3d9_device_GetFrontBufferData(), d3d9_device_GetRenderTargetData(), d3d9_device_SetCursorProperties(), d3d9_device_SetDepthStencilSurface(), d3d9_device_SetRenderTarget(), d3d9_device_StretchRect(), d3d9_device_UpdateSurface(), and d3d9_swapchain_GetFrontBufferData().

◆ unsafe_impl_from_IDirect3DVertexBuffer9()

struct d3d9_vertexbuffer* unsafe_impl_from_IDirect3DVertexBuffer9 ( IDirect3DVertexBuffer9 *  iface)

Definition at line 314 of file buffer.c.

315 {
316  if (!iface)
317  return NULL;
318  assert(iface->lpVtbl == &d3d9_vertexbuffer_vtbl);
319 
320  return impl_from_IDirect3DVertexBuffer9(iface);
321 }
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl
Definition: buffer.c:241
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26

Referenced by d3d9_device_ProcessVertices(), and d3d9_device_SetStreamSource().

◆ unsafe_impl_from_IDirect3DVertexDeclaration9()

struct d3d9_vertex_declaration* unsafe_impl_from_IDirect3DVertexDeclaration9 ( IDirect3DVertexDeclaration9 *  iface)

Definition at line 302 of file vertexdeclaration.c.

303 {
304  if (!iface)
305  return NULL;
306  assert(iface->lpVtbl == &d3d9_vertex_declaration_vtbl);
307  return CONTAINING_RECORD(iface, struct d3d9_vertex_declaration, IDirect3DVertexDeclaration9_iface);
308 }
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static const struct IDirect3DVertexDeclaration9Vtbl d3d9_vertex_declaration_vtbl

Referenced by d3d9_device_ProcessVertices(), and d3d9_device_SetVertexDeclaration().

◆ unsafe_impl_from_IDirect3DVertexShader9()

struct d3d9_vertexshader* unsafe_impl_from_IDirect3DVertexShader9 ( IDirect3DVertexShader9 *  iface)

Definition at line 169 of file shader.c.

170 {
171  if (!iface)
172  return NULL;
173  if (iface->lpVtbl != &d3d9_vertexshader_vtbl)
174  WARN("Vertex shader %p with the wrong vtbl %p\n", iface, iface->lpVtbl);
175 
176  return impl_from_IDirect3DVertexShader9(iface);
177 }
#define WARN(fmt,...)
Definition: debug.h:111
static struct d3d9_vertexshader * impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface)
Definition: shader.c:25
smooth NULL
Definition: ftsmooth.c:416
static const IDirect3DVertexShader9Vtbl d3d9_vertexshader_vtbl
Definition: shader.c:116

Referenced by d3d9_device_SetVertexShader().

◆ vdecl_convert_fvf()

HRESULT vdecl_convert_fvf ( DWORD  FVF,
D3DVERTEXELEMENT9 **  ppVertexElements 
)

Definition at line 59 of file vertexdeclaration.c.

61  {
62 
63  unsigned int idx, idx2;
64  unsigned int offset;
65  BOOL has_pos = (fvf & D3DFVF_POSITION_MASK) != 0;
66  BOOL has_blend = (fvf & D3DFVF_XYZB5) > D3DFVF_XYZRHW;
67  BOOL has_blend_idx = has_blend &&
68  (((fvf & D3DFVF_XYZB5) == D3DFVF_XYZB5) ||
69  (fvf & D3DFVF_LASTBETA_D3DCOLOR) ||
70  (fvf & D3DFVF_LASTBETA_UBYTE4));
71  BOOL has_normal = (fvf & D3DFVF_NORMAL) != 0;
72  BOOL has_psize = (fvf & D3DFVF_PSIZE) != 0;
73 
74  BOOL has_diffuse = (fvf & D3DFVF_DIFFUSE) != 0;
75  BOOL has_specular = (fvf & D3DFVF_SPECULAR) !=0;
76 
77  DWORD num_textures = (fvf & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT;
78  DWORD texcoords = (fvf & 0xFFFF0000) >> 16;
79 
80  D3DVERTEXELEMENT9 end_element = D3DDECL_END();
81  D3DVERTEXELEMENT9 *elements = NULL;
82 
83  unsigned int size;
84  DWORD num_blends = 1 + (((fvf & D3DFVF_XYZB5) - D3DFVF_XYZB1) >> 1);
85  if (has_blend_idx) num_blends--;
86 
87  /* Compute declaration size */
88  size = has_pos + (has_blend && num_blends > 0) + has_blend_idx + has_normal +
89  has_psize + has_diffuse + has_specular + num_textures + 1;
90 
91  /* convert the declaration */
92  if (!(elements = heap_alloc(size * sizeof(*elements))))
94 
95  elements[size-1] = end_element;
96  idx = 0;
97  if (has_pos) {
98  if (!has_blend && (fvf & D3DFVF_XYZRHW)) {
99  elements[idx].Type = D3DDECLTYPE_FLOAT4;
100  elements[idx].Usage = D3DDECLUSAGE_POSITIONT;
101  }
102  else if (!has_blend && (fvf & D3DFVF_XYZW) == D3DFVF_XYZW) {
103  elements[idx].Type = D3DDECLTYPE_FLOAT4;
104  elements[idx].Usage = D3DDECLUSAGE_POSITION;
105  }
106  else {
107  elements[idx].Type = D3DDECLTYPE_FLOAT3;
108  elements[idx].Usage = D3DDECLUSAGE_POSITION;
109  }
110  elements[idx].UsageIndex = 0;
111  idx++;
112  }
113  if (has_blend && (num_blends > 0)) {
114  if (((fvf & D3DFVF_XYZB5) == D3DFVF_XYZB2) && (fvf & D3DFVF_LASTBETA_D3DCOLOR))
115  elements[idx].Type = D3DDECLTYPE_D3DCOLOR;
116  else {
117  switch(num_blends) {
118  case 1: elements[idx].Type = D3DDECLTYPE_FLOAT1; break;
119  case 2: elements[idx].Type = D3DDECLTYPE_FLOAT2; break;
120  case 3: elements[idx].Type = D3DDECLTYPE_FLOAT3; break;
121  case 4: elements[idx].Type = D3DDECLTYPE_FLOAT4; break;
122  default:
123  ERR("Unexpected amount of blend values: %u\n", num_blends);
124  }
125  }
126  elements[idx].Usage = D3DDECLUSAGE_BLENDWEIGHT;
127  elements[idx].UsageIndex = 0;
128  idx++;
129  }
130  if (has_blend_idx) {
131  if (fvf & D3DFVF_LASTBETA_UBYTE4 ||
132  (((fvf & D3DFVF_XYZB5) == D3DFVF_XYZB2) && (fvf & D3DFVF_LASTBETA_D3DCOLOR)))
133  elements[idx].Type = D3DDECLTYPE_UBYTE4;
134  else if (fvf & D3DFVF_LASTBETA_D3DCOLOR)
135  elements[idx].Type = D3DDECLTYPE_D3DCOLOR;
136  else
137  elements[idx].Type = D3DDECLTYPE_FLOAT1;
138  elements[idx].Usage = D3DDECLUSAGE_BLENDINDICES;
139  elements[idx].UsageIndex = 0;
140  idx++;
141  }
142  if (has_normal) {
143  elements[idx].Type = D3DDECLTYPE_FLOAT3;
144  elements[idx].Usage = D3DDECLUSAGE_NORMAL;
145  elements[idx].UsageIndex = 0;
146  idx++;
147  }
148  if (has_psize) {
149  elements[idx].Type = D3DDECLTYPE_FLOAT1;
150  elements[idx].Usage = D3DDECLUSAGE_PSIZE;
151  elements[idx].UsageIndex = 0;
152  idx++;
153  }
154  if (has_diffuse) {
155  elements[idx].Type = D3DDECLTYPE_D3DCOLOR;
156  elements[idx].Usage = D3DDECLUSAGE_COLOR;
157  elements[idx].UsageIndex = 0;
158  idx++;
159  }
160  if (has_specular) {
161  elements[idx].Type = D3DDECLTYPE_D3DCOLOR;
162  elements[idx].Usage = D3DDECLUSAGE_COLOR;
163  elements[idx].UsageIndex = 1;
164  idx++;
165  }
166  for (idx2 = 0; idx2 < num_textures; idx2++) {
167  unsigned int numcoords = (texcoords >> (idx2*2)) & 0x03;
168  switch (numcoords) {
170  elements[idx].Type = D3DDECLTYPE_FLOAT1;
171  break;
173  elements[idx].Type = D3DDECLTYPE_FLOAT2;
174  break;
176  elements[idx].Type = D3DDECLTYPE_FLOAT3;
177  break;
179  elements[idx].Type = D3DDECLTYPE_FLOAT4;
180  break;
181  }
182  elements[idx].Usage = D3DDECLUSAGE_TEXCOORD;
183  elements[idx].UsageIndex = idx2;
184  idx++;
185  }
186 
187  /* Now compute offsets, and initialize the rest of the fields */
188  for (idx = 0, offset = 0; idx < size-1; idx++) {
189  elements[idx].Stream = 0;
190  elements[idx].Method = D3DDECLMETHOD_DEFAULT;
191  elements[idx].Offset = offset;
192  offset += d3d_dtype_lookup[elements[idx].Type].component_count
193  * d3d_dtype_lookup[elements[idx].Type].component_size;
194  }
195 
196  *ppVertexElements = elements;
197  return D3D_OK;
198 }
#define D3DFVF_XYZB1
Definition: d3d8types.h:115
#define D3DFVF_LASTBETA_UBYTE4
Definition: d3d8types.h:135
#define D3DFVF_XYZRHW
Definition: d3d8types.h:114
Type
Definition: Type.h:6
#define D3DFVF_PSIZE
Definition: d3d8types.h:121
#define D3DFVF_NORMAL
Definition: d3d8types.h:120
GLintptr offset
Definition: glext.h:5920
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static const struct @218 d3d_dtype_lookup[]
#define D3DFVF_TEXCOUNT_MASK
Definition: d3d8types.h:124
unsigned int BOOL
Definition: ntddk_ex.h:94
#define D3DFVF_POSITION_MASK
Definition: d3d8types.h:112
unsigned int idx
Definition: utils.c:41
#define D3DFVF_SPECULAR
Definition: d3d8types.h:123
smooth NULL
Definition: ftsmooth.c:416
#define D3DFVF_TEXTUREFORMAT2
Definition: d3d8types.h:61
#define D3DFVF_XYZB2
Definition: d3d8types.h:116
#define D3DFVF_TEXTUREFORMAT4
Definition: d3d8types.h:63
GLsizeiptr size
Definition: glext.h:5919
#define D3DFVF_XYZB5
Definition: d3d8types.h:119
unsigned long DWORD
Definition: ntddk_ex.h:95
#define D3DDECL_END()
Definition: d3d9types.h:311
#define ERR(fmt,...)
Definition: debug.h:109
#define D3DERR_OUTOFVIDEOMEMORY
Definition: d3d8.h:85
#define D3D_OK
Definition: d3d.h:106
#define D3DFVF_TEXCOUNT_SHIFT
Definition: d3d8types.h:125
#define D3DFVF_DIFFUSE
Definition: d3d8types.h:122
#define D3DFVF_TEXTUREFORMAT3
Definition: d3d8types.h:62
#define D3DFVF_XYZW
Definition: d3d9types.h:143
#define D3DFVF_LASTBETA_D3DCOLOR
Definition: d3d9types.h:160
#define D3DFVF_TEXTUREFORMAT1
Definition: d3d8types.h:60

Referenced by device_get_fvf_declaration().

◆ vertexbuffer_init()

HRESULT vertexbuffer_init ( struct d3d9_vertexbuffer buffer,
struct d3d9_device device,
UINT  size,
UINT  usage,
DWORD  fvf,
D3DPOOL  pool 
)

Definition at line 274 of file buffer.c.

276 {
277  struct wined3d_buffer_desc desc;
278  HRESULT hr;
279 
280  if (pool == D3DPOOL_SCRATCH)
281  {
282  WARN("Vertex buffer with D3DPOOL_SCRATCH requested.\n");
283  return D3DERR_INVALIDCALL;
284  }
285 
286  buffer->IDirect3DVertexBuffer9_iface.lpVtbl = &d3d9_vertexbuffer_vtbl;
287  buffer->fvf = fvf;
288  d3d9_resource_init(&buffer->resource);
289 
290  desc.byte_width = size;
291  desc.usage = usage & WINED3DUSAGE_MASK;
292  desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
295  desc.misc_flags = 0;
296  desc.structure_byte_stride = 0;
297 
299  hr = wined3d_buffer_create(device->wined3d_device, &desc, NULL, buffer,
300  &d3d9_vertexbuffer_wined3d_parent_ops, &buffer->wined3d_buffer);
302  if (FAILED(hr))
303  {
304  WARN("Failed to create wined3d buffer, hr %#x.\n", hr);
305  return hr;
306  }
307 
308  buffer->parent_device = &device->IDirect3DDevice9Ex_iface;
309  IDirect3DDevice9Ex_AddRef(buffer->parent_device);
310 
311  return D3D_OK;
312 }
HRESULT hr
Definition: shlfolder.c:183
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:899
#define WARN(fmt,...)
Definition: debug.h:111
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
static const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops
Definition: buffer.c:269
#define D3DERR_INVALIDCALL
GLuint buffer
Definition: glext.h:5915
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define WINED3DUSAGE_MASK
Definition: wined3d.h:922
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl
Definition: buffer.c:241
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define D3D_OK
Definition: d3d.h:106
HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer)
Definition: buffer.c:1434
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:302

◆ vertexshader_init()

HRESULT vertexshader_init ( struct d3d9_vertexshader shader,
struct d3d9_device device,
const DWORD byte_code 
)

Definition at line 137 of file shader.c.

138 {
139  struct wined3d_shader_desc desc;
140  HRESULT hr;
141 
142  shader->refcount = 1;
143  shader->IDirect3DVertexShader9_iface.lpVtbl = &d3d9_vertexshader_vtbl;
144 
145  desc.byte_code = byte_code;
146  desc.byte_code_size = ~(size_t)0;
148  desc.input_signature.element_count = 0;
149  desc.output_signature.element_count = 0;
150  desc.patch_constant_signature.element_count = 0;
151  desc.max_version = 3;
152 
154  hr = wined3d_shader_create_vs(device->wined3d_device, &desc, shader,
155  &d3d9_vertexshader_wined3d_parent_ops, &shader->wined3d_shader);
157  if (FAILED(hr))
158  {
159  WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr);
160  return hr;
161  }
162 
163  shader->parent_device = &device->IDirect3DDevice9Ex_iface;
164  IDirect3DDevice9Ex_AddRef(shader->parent_device);
165 
166  return D3D_OK;
167 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
const DWORD * byte_code
Definition: wined3d.h:2052
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
__kernel_size_t size_t
Definition: linux.h:237
GLuint shader
Definition: glext.h:6030
static const struct wined3d_parent_ops d3d9_vertexshader_wined3d_parent_ops
Definition: shader.c:132
LONG HRESULT
Definition: typedefs.h:77
#define D3D_OK
Definition: d3d.h:106
static const IDirect3DVertexShader9Vtbl d3d9_vertexshader_vtbl
Definition: shader.c:116
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365
HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader)
Definition: shader.c:4345

Referenced by d3d9_device_CreateVertexShader().

◆ volume_init()

void volume_init ( struct d3d9_volume volume,
struct wined3d_texture wined3d_texture,
unsigned int  sub_resource_idx,
const struct wined3d_parent_ops **  parent_ops 
)

Definition at line 209 of file volume.c.

211 {
212  volume->IDirect3DVolume9_iface.lpVtbl = &d3d9_volume_vtbl;
213  d3d9_resource_init(&volume->resource);
214  volume->resource.refcount = 0;
216  volume->wined3d_texture = wined3d_texture;
217  volume->sub_resource_idx = sub_resource_idx;
218 
219  *parent_ops = &d3d9_volume_wined3d_parent_ops;
220 }
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1317
static const struct IDirect3DVolume9Vtbl d3d9_volume_vtbl
Definition: volume.c:180
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
static const struct wined3d_parent_ops d3d9_volume_wined3d_parent_ops
Definition: volume.c:204

◆ volumetexture_init()

HRESULT volumetexture_init ( struct d3d9_texture texture,
struct d3d9_device device,
UINT  width,
UINT  height,
UINT  depth,
UINT  levels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool 
)

Definition at line 1454 of file texture.c.

1456 {
1457  struct wined3d_resource_desc desc;
1458  HRESULT hr;
1459 
1460  texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl;
1461  d3d9_resource_init(&texture->resource);
1462  list_init(&texture->rtv_list);
1463  texture->usage = usage;
1464 
1465  desc.resource_type = WINED3D_RTYPE_TEXTURE_3D;
1467  desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1468  desc.multisample_quality = 0;
1470  desc.usage |= WINED3DUSAGE_TEXTURE;
1471  if (pool == D3DPOOL_SCRATCH)
1472  desc.usage |= WINED3DUSAGE_SCRATCH;
1474  desc.width = width;
1475  desc.height = height;
1476  desc.depth = depth;
1477  desc.size = 0;
1478 
1480  {
1481  WARN("D3DUSAGE_AUTOGENMIPMAP volume texture is not supported, returning D3DERR_INVALIDCALL.\n");
1482  return D3DERR_INVALIDCALL;
1483  }
1484  if (!levels)
1486 
1488  hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, 0,
1489  NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
1491  if (FAILED(hr))
1492  {
1493  WARN("Failed to create wined3d volume texture, hr %#x.\n", hr);
1494  return hr;
1495  }
1496 
1497  texture->parent_device = &device->IDirect3DDevice9Ex_iface;
1498  IDirect3DDevice9Ex_AddRef(texture->parent_device);
1499 
1500  return D3D_OK;
1501 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define max(a, b)
Definition: svc.c:63
HRESULT hr
Definition: shlfolder.c:183
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: device.c:94
GLsizei levels
Definition: glext.h:7884
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
#define WARN(fmt,...)
Definition: debug.h:111
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:360
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
static DWORD wined3dusage_from_d3dusage(unsigned int usage)
Definition: d3d9_private.h:334
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:77
static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops
Definition: texture.c:1292
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
static const IDirect3DVolumeTexture9Vtbl d3d9_texture_3d_vtbl
Definition: texture.c:1239
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define D3D_OK
Definition: d3d.h:106
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:927
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:924
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:365
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2763
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)
Definition: texture.c:3326
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:302

◆ wined3daccess_from_d3dpool()

static unsigned int wined3daccess_from_d3dpool ( D3DPOOL  pool,
unsigned int  usage 
)
inlinestatic

Definition at line 315 of file d3d9_private.h.

316 {
317  switch (pool)
318  {
319  case D3DPOOL_DEFAULT:
320  if (usage & D3DUSAGE_DYNAMIC)
323  case D3DPOOL_MANAGED:
326  case D3DPOOL_SYSTEMMEM:
327  case D3DPOOL_SCRATCH:
329  default:
330  return 0;
331  }
332 }
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55

◆ wined3dformat_from_d3dformat()

enum wined3d_format_id wined3dformat_from_d3dformat ( D3DFORMAT  format)

Definition at line 94 of file device.c.

95 {
96  BYTE *c = (BYTE *)&format;
97 
98  /* Don't translate FOURCC formats */
99  if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return format;
100 
101  switch(format)
102  {
103  case D3DFMT_UNKNOWN: return WINED3DFMT_UNKNOWN;
112  case D3DFMT_A8: return WINED3DFMT_A8_UNORM;
118  case D3DFMT_P8: return WINED3DFMT_P8_UINT;
119  case D3DFMT_L8: return WINED3DFMT_L8_UNORM;
120  case D3DFMT_A8L8: return WINED3DFMT_L8A8_UNORM;
121  case D3DFMT_A4L4: return WINED3DFMT_L4A4_UNORM;
122  case D3DFMT_V8U8: return WINED3DFMT_R8G8_SNORM;
130  case D3DFMT_D32: return WINED3DFMT_D32_UNORM;
135  case D3DFMT_D16: return WINED3DFMT_D16_UNORM;
136  case D3DFMT_INDEX16: return WINED3DFMT_R16_UINT;
137  case D3DFMT_INDEX32: return WINED3DFMT_R32_UINT;
138  default:
139  FIXME("Unhandled D3DFORMAT %#x.\n", format);
140  return WINED3DFMT_UNKNOWN;
141  }
142 }
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define FIXME(fmt,...)
Definition: debug.h:110
const GLubyte * c
Definition: glext.h:8905
unsigned char BYTE
Definition: mem.h:68
#define isprint(c)
Definition: acclib.h:73

Referenced by d3d8_device_create_surface(), d3d8_device_DrawIndexedPrimitiveUP(), d3d9_device_create_surface(), d3d9_device_CreateTexture(), d3d9_device_DrawIndexedPrimitiveUP(), d3d9_device_reset(), and wined3d_swapchain_desc_from_present_parameters().

◆ wined3dmapflags_from_d3dmapflags()

unsigned int wined3dmapflags_from_d3dmapflags ( unsigned int  flags)

Definition at line 144 of file device.c.

145 {
146  static const unsigned int handled = D3DLOCK_NOSYSLOCK
150  unsigned int wined3d_flags;
151 
152  wined3d_flags = flags & handled;
154  wined3d_flags |= WINED3D_MAP_READ;
155  if (!(flags & D3DLOCK_READONLY))
156  wined3d_flags |= WINED3D_MAP_WRITE;
157  if (!(wined3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
158  wined3d_flags |= WINED3D_MAP_READ | WINED3D_MAP_WRITE;
159  flags &= ~(handled | D3DLOCK_READONLY);
160 
161  if (flags)
162  FIXME("Unhandled flags %#x.\n", flags);
163 
164  return wined3d_flags;
165 }
#define D3DLOCK_NOSYSLOCK
Definition: d3d8types.h:70
#define D3DLOCK_NOOVERWRITE
Definition: d3d8types.h:71
#define D3DLOCK_DISCARD
Definition: d3d8types.h:72
#define FIXME(fmt,...)
Definition: debug.h:110
#define WINED3D_MAP_READ
Definition: wined3d.h:948
GLbitfield flags
Definition: glext.h:7161
#define WINED3D_MAP_WRITE
Definition: wined3d.h:947
#define D3DLOCK_NO_DIRTY_UPDATE
Definition: d3d8types.h:73
#define D3DLOCK_READONLY
Definition: d3d8types.h:69

◆ wined3dusage_from_d3dusage()

static DWORD wined3dusage_from_d3dusage ( unsigned int  usage)
inlinestatic

Definition at line 334 of file d3d9_private.h.

335 {
336  return usage & WINED3DUSAGE_MASK;
337 }
#define WINED3DUSAGE_MASK
Definition: wined3d.h:922
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919

Referenced by cubetexture_init(), texture_init(), and volumetexture_init().

Variable Documentation

◆ DECLSPEC_HIDDEN