ReactOS 0.4.15-dev-8100-g1887773
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) 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, 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.

78{
82};
@ D3D9_DEVICE_STATE_OK
Definition: d3d9_private.h:79
@ D3D9_DEVICE_STATE_NOT_RESET
Definition: d3d9_private.h:81
@ D3D9_DEVICE_STATE_LOST
Definition: d3d9_private.h:80

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 1369 of file texture.c.

1371{
1373 DWORD flags = 0;
1374 HRESULT hr;
1375
1376 texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl;
1377 d3d9_resource_init(&texture->resource);
1378 list_init(&texture->rtv_list);
1379 texture->usage = usage;
1380
1381 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1383 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1384 desc.multisample_quality = 0;
1387 if (pool == D3DPOOL_SCRATCH)
1388 desc.usage |= WINED3DUSAGE_SCRATCH;
1391 desc.width = edge_length;
1392 desc.height = edge_length;
1393 desc.depth = 1;
1394 desc.size = 0;
1395
1398
1401
1403 {
1404 if (pool == D3DPOOL_SYSTEMMEM)
1405 {
1406 WARN("D3DUSAGE_AUTOGENMIPMAP texture can't be in D3DPOOL_SYSTEMMEM, returning D3DERR_INVALIDCALL.\n");
1407 return D3DERR_INVALIDCALL;
1408 }
1409 if (levels && levels != 1)
1410 {
1411 WARN("D3DUSAGE_AUTOGENMIPMAP texture with %u levels, returning D3DERR_INVALIDCALL.\n", levels);
1412 return D3DERR_INVALIDCALL;
1413 }
1415 texture->autogen_filter_type = D3DTEXF_LINEAR;
1416 levels = 0;
1417 }
1418 else
1419 {
1420 texture->autogen_filter_type = D3DTEXF_NONE;
1421 }
1422 if (!levels)
1423 levels = wined3d_log2i(edge_length) + 1;
1424
1426 hr = wined3d_texture_create(device->wined3d_device, &desc, 6, levels, flags,
1427 NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
1429 if (FAILED(hr))
1430 {
1431 WARN("Failed to create wined3d cube texture, hr %#x.\n", hr);
1432 return hr;
1433 }
1434
1435 texture->parent_device = &device->IDirect3DDevice9Ex_iface;
1436 IDirect3DDevice9Ex_AddRef(texture->parent_device);
1437
1438 return D3D_OK;
1439}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define WARN(fmt,...)
Definition: debug.h:115
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: device.c:94
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:301
@ D3DTEXF_NONE
Definition: d3d8types.h:870
@ D3DTEXF_LINEAR
Definition: d3d8types.h:872
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
@ D3DPOOL_SCRATCH
Definition: d3d8types.h:712
@ D3DPOOL_DEFAULT
Definition: d3d8types.h:709
@ D3DPOOL_SYSTEMMEM
Definition: d3d8types.h:711
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
void d3d9_resource_init(struct d3d9_resource *resource)
Definition: d3d9_main.c:216
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
#define D3D_OK
Definition: d3d.h:106
#define D3DERR_INVALIDCALL
#define NULL
Definition: types.h:112
static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops
Definition: texture.c:1292
static const IDirect3DCubeTexture9Vtbl d3d9_texture_cube_vtbl
Definition: texture.c:906
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:3511
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
GLbitfield flags
Definition: glext.h:7161
GLsizei levels
Definition: glext.h:7884
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR desc[]
Definition: protectdata.c:36
HRESULT hr
Definition: shlfolder.c:183
Definition: devices.h:37
BOOL is_gdi_compat_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN
Definition: device.c:1389
static DWORD wined3dusage_from_d3dusage(unsigned int usage)
Definition: d3d9_private.h:334
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2759
@ WINED3D_MULTISAMPLE_NONE
Definition: wined3d.h:554
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:917
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
#define WINED3D_TEXTURE_CREATE_MAPPABLE
Definition: wined3d.h:1558
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:915
#define WINED3D_TEXTURE_CREATE_GET_DC
Definition: wined3d.h:1561
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:918
#define WINED3D_TEXTURE_CREATE_GENERATE_MIPMAPS
Definition: wined3d.h:1562
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368

◆ d3d9_init()

BOOL d3d9_init ( struct d3d9 d3d9,
BOOL  extended 
)

Definition at line 577 of file directx.c.

578{
583
584 if (!extended)
586 else
588
590 d3d9->refcount = 1;
591
595 if (!d3d9->wined3d)
596 return FALSE;
597 d3d9->extended = extended;
598
599 return TRUE;
600}
static const struct IDirect3D9ExVtbl d3d9_vtbl
Definition: directx.c:548
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
struct wined3d * wined3d
Definition: d3d9_private.h:65
LONG refcount
Definition: d3d9_private.h:64
BOOL extended
Definition: d3d9_private.h:66
IDirect3D9Ex IDirect3D9Ex_iface
Definition: d3d9_private.h:63
#define WINED3D_RESTORE_MODE_ON_ACTIVATE
Definition: wined3d.h:1319
#define WINED3D_NORMALIZED_DEPTH_BIAS
Definition: wined3d.h:1328
#define WINED3D_LIMIT_VIEWPORT
Definition: wined3d.h:1330
#define WINED3D_VIDMEM_ACCOUNTING
Definition: wined3d.h:1317
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1325
#define WINED3D_HANDLE_RESTORE
Definition: wined3d.h:1321
#define WINED3D_NO_PRIMITIVE_RESTART
Definition: wined3d.h:1326
#define WINED3D_PRESENT_CONVERSION
Definition: wined3d.h:1318
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1322
#define WINED3D_SRGB_READ_WRITE_CONTROL
Definition: wined3d.h:1324
#define WINED3D_LEGACY_CUBEMAP_FILTERING
Definition: wined3d.h:1327
struct wined3d *CDECL wined3d_create(DWORD flags)
Definition: wined3d_main.c:97

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{
163
166 if (!entry)
167 {
169 return D3DERR_NOTFOUND;
170 }
171
174
175 return D3D_OK;
176}
uint32_t entry
Definition: isohybrid.c:63
const GUID * guid
#define D3DERR_NOTFOUND
Definition: d3d8.h:80
static struct wined3d_private_data * wined3d_private_store_get_private_data(const struct wined3d_private_store *store, const GUID *tag)
Definition: wined3d.h:2517
static void wined3d_private_store_free_private_data(struct wined3d_private_store *store, struct wined3d_private_data *entry)
Definition: wined3d.h:2532

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
211done:
213 return hr;
214}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define D3DERR_MOREDATA
Definition: d3d8.h:81
union wined3d_private_data::@3683 content
IUnknown * object
Definition: wined3d.h:2168
#define WINED3DSPD_IUNKNOWN
Definition: wined3d.h:1006

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:2512

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}
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:2553

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}
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define ERR(fmt,...)
Definition: debug.h:113
static const struct wined3d_parent_ops d3d9_view_wined3d_parent_ops
Definition: surface.c:395
static ULONG WINAPI d3d9_surface_AddRef(IDirect3DSurface9 *iface)
Definition: surface.c:51
static ULONG WINAPI d3d9_surface_Release(IDirect3DSurface9 *iface)
Definition: surface.c:81
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 wined3d_texture * wined3d_texture
Definition: d3d9_private.h:161
struct list rtv_entry
Definition: d3d9_private.h:163
IDirect3DSurface9 IDirect3DSurface9_iface
Definition: d3d9_private.h:159
struct wined3d_rendertarget_view * wined3d_rtv
Definition: d3d9_private.h:164
struct d3d9_texture * texture
Definition: d3d9_private.h:167
unsigned int sub_resource_idx
Definition: d3d9_private.h:162

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}
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:165
static struct d3d9_device * impl_from_IDirect3DDevice9Ex(IDirect3DDevice9Ex *iface)
Definition: d3d9_private.h:289

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}

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,
struct d3d9_swapchain **  swapchain 
)

Definition at line 371 of file swapchain.c.

373{
374 struct d3d9_swapchain *object;
375 HRESULT hr;
376
377 if (!(object = heap_alloc_zero(sizeof(*object))))
378 return E_OUTOFMEMORY;
379
380 if (FAILED(hr = swapchain_init(object, device, desc)))
381 {
382 WARN("Failed to initialize swapchain, hr %#x.\n", hr);
383 heap_free(object);
384 return hr;
385 }
386
387 TRACE("Created swapchain %p.\n", object);
388 *swapchain = object;
389
390 return D3D_OK;
391}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_device *device, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:169
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by d3d9_device_CreateAdditionalSwapChain(), and device_parent_create_swapchain().

◆ d3d9_texture_flag_auto_gen_mipmap()

◆ 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;
105 texture->flags &= ~D3D9_TEXTURE_MIPMAP_DIRTY;
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:917

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);
434
435 return D3D_OK;
436}
static HRESULT vertexdeclaration_init(struct d3d9_vertex_declaration *declaration, struct d3d9_device *device, const D3DVERTEXELEMENT9 *elements)
D3DVERTEXELEMENT9 * elements
Definition: d3d9_private.h:242

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 317 of file device.c.

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

◆ 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;
88 default:
89 FIXME("Unhandled wined3d format %#x.\n", format);
90 return D3DFMT_UNKNOWN;
91 }
92}
#define isprint(c)
Definition: acclib.h:73
#define FIXME(fmt,...)
Definition: debug.h:114
@ D3DFMT_L6V5U5
Definition: d3d8types.h:625
@ D3DFMT_A1R5G5B5
Definition: d3d8types.h:608
@ D3DFMT_A8P8
Definition: d3d8types.h:617
@ D3DFMT_D16
Definition: d3d8types.h:644
@ D3DFMT_X1R5G5B5
Definition: d3d8types.h:607
@ D3DFMT_W11V11U10
Definition: d3d8types.h:629
@ D3DFMT_D16_LOCKABLE
Definition: d3d8types.h:640
@ D3DFMT_R8G8B8
Definition: d3d8types.h:603
@ D3DFMT_R3G3B2
Definition: d3d8types.h:610
@ D3DFMT_A8L8
Definition: d3d8types.h:621
@ D3DFMT_V16U16
Definition: d3d8types.h:628
@ D3DFMT_A8R8G8B8
Definition: d3d8types.h:604
@ D3DFMT_A2B10G10R10
Definition: d3d8types.h:614
@ D3DFMT_X8L8V8U8
Definition: d3d8types.h:626
@ D3DFMT_INDEX16
Definition: d3d8types.h:649
@ D3DFMT_A8
Definition: d3d8types.h:611
@ D3DFMT_X4R4G4B4
Definition: d3d8types.h:613
@ D3DFMT_R5G6B5
Definition: d3d8types.h:606
@ D3DFMT_A8R3G3B2
Definition: d3d8types.h:612
@ D3DFMT_V8U8
Definition: d3d8types.h:624
@ D3DFMT_A4R4G4B4
Definition: d3d8types.h:609
@ D3DFMT_D24S8
Definition: d3d8types.h:643
@ D3DFMT_D32
Definition: d3d8types.h:641
@ D3DFMT_D24X8
Definition: d3d8types.h:645
@ D3DFMT_P8
Definition: d3d8types.h:618
@ D3DFMT_INDEX32
Definition: d3d8types.h:650
@ D3DFMT_UNKNOWN
Definition: d3d8types.h:601
@ D3DFMT_X8R8G8B8
Definition: d3d8types.h:605
@ D3DFMT_L8
Definition: d3d8types.h:620
@ D3DFMT_G16R16
Definition: d3d8types.h:615
@ D3DFMT_A2W10V10U10
Definition: d3d8types.h:630
@ D3DFMT_Q8W8V8U8
Definition: d3d8types.h:627
@ D3DFMT_D15S1
Definition: d3d8types.h:642
@ D3DFMT_D24X4S4
Definition: d3d8types.h:646
@ D3DFMT_A4L4
Definition: d3d8types.h:622
const GLubyte * c
Definition: glext.h:8905
@ WINED3DFMT_B2G3R3_UNORM
Definition: wined3d.h:111
@ WINED3DFMT_B4G4R4A4_UNORM
Definition: wined3d.h:110
@ WINED3DFMT_R16G16_UNORM
Definition: wined3d.h:171
@ WINED3DFMT_X8D24_UNORM
Definition: wined3d.h:130
@ WINED3DFMT_R10G10B10A2_UNORM
Definition: wined3d.h:158
@ WINED3DFMT_R16G16_SNORM
Definition: wined3d.h:173
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:223
@ WINED3DFMT_R8G8B8A8_SNORM
Definition: wined3d.h:167
@ WINED3DFMT_D16_LOCKABLE
Definition: wined3d.h:127
@ WINED3DFMT_R10G11B11_SNORM
Definition: wined3d.h:123
@ WINED3DFMT_S1_UINT_D15_UNORM
Definition: wined3d.h:129
@ WINED3DFMT_B2G3R3A8_UNORM
Definition: wined3d.h:112
@ WINED3DFMT_L8A8_UNORM
Definition: wined3d.h:119
@ WINED3DFMT_L4A4_UNORM
Definition: wined3d.h:120
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:224
@ WINED3DFMT_B5G5R5X1_UNORM
Definition: wined3d.h:109
@ WINED3DFMT_D16_UNORM
Definition: wined3d.h:191
@ WINED3DFMT_L8_UNORM
Definition: wined3d.h:118
@ WINED3DFMT_R8G8_SNORM
Definition: wined3d.h:187
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:107
@ WINED3DFMT_R5G5_SNORM_L6_UNORM
Definition: wined3d.h:121
@ WINED3DFMT_B8G8R8_UNORM
Definition: wined3d.h:108
@ WINED3DFMT_R32_UINT
Definition: wined3d.h:178
@ WINED3DFMT_B5G5R5A1_UNORM
Definition: wined3d.h:222
@ WINED3DFMT_R10G10B10_SNORM_A2_UNORM
Definition: wined3d.h:126
@ WINED3DFMT_D32_UNORM
Definition: wined3d.h:128
@ WINED3DFMT_R8G8_SNORM_L8X8_UNORM
Definition: wined3d.h:122
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:221
@ WINED3DFMT_S4X4_UINT_D24_UNORM
Definition: wined3d.h:131
@ WINED3DFMT_P8_UINT
Definition: wined3d.h:117
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:193
@ WINED3DFMT_A8_UNORM
Definition: wined3d.h:201
@ WINED3DFMT_B4G4R4X4_UNORM
Definition: wined3d.h:113
@ WINED3DFMT_D24_UNORM_S8_UINT
Definition: wined3d.h:181
@ WINED3DFMT_P8_UINT_A8_UNORM
Definition: wined3d.h:116
unsigned char BYTE
Definition: xxhash.c:193

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}
@ D3DPOOL_MANAGED
Definition: d3d8types.h:710
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56

◆ 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:913

◆ 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 4174 of file device.c.

4177{
4178 struct wined3d_swapchain_desc *swapchain_desc;
4179 unsigned i, count = 1;
4180 WINED3DCAPS caps;
4181 HRESULT hr;
4182
4183 if (mode)
4184 FIXME("Ignoring display mode.\n");
4185
4186 device->IDirect3DDevice9Ex_iface.lpVtbl = &d3d9_device_vtbl;
4187 device->device_parent.ops = &d3d9_wined3d_device_parent_ops;
4188 device->refcount = 1;
4189
4191
4194 &device->device_parent, &device->wined3d_device)))
4195 {
4196 WARN("Failed to create wined3d device, hr %#x.\n", hr);
4198 return hr;
4199 }
4200
4202 device->max_user_clip_planes = caps.MaxUserClipPlanes;
4205
4208
4209 if (!parameters->Windowed)
4210 {
4211 if (!focus_window)
4212 focus_window = parameters->hDeviceWindow;
4213 if (FAILED(hr = wined3d_device_acquire_focus_window(device->wined3d_device, focus_window)))
4214 {
4215 ERR("Failed to acquire focus window, hr %#x.\n", hr);
4216 wined3d_device_decref(device->wined3d_device);
4218 return hr;
4219 }
4220
4221 for (i = 0; i < count; ++i)
4222 {
4223 HWND device_window = parameters[i].hDeviceWindow;
4224
4225 if (!device_window) device_window = focus_window;
4227 parameters[i].BackBufferWidth,
4228 parameters[i].BackBufferHeight);
4229 }
4230 }
4231
4232 if (!(swapchain_desc = heap_alloc(sizeof(*swapchain_desc) * count)))
4233 {
4234 ERR("Failed to allocate wined3d parameters.\n");
4236 wined3d_device_decref(device->wined3d_device);
4238 return E_OUTOFMEMORY;
4239 }
4240
4241 for (i = 0; i < count; ++i)
4242 {
4243 if (!wined3d_swapchain_desc_from_present_parameters(&swapchain_desc[i], &parameters[i],
4244 parent->extended))
4245 {
4247 wined3d_device_decref(device->wined3d_device);
4248 heap_free(swapchain_desc);
4250 return D3DERR_INVALIDCALL;
4251 }
4252 }
4253
4254 if (FAILED(hr = wined3d_device_init_3d(device->wined3d_device, swapchain_desc)))
4255 {
4256 WARN("Failed to initialize 3D, hr %#x.\n", hr);
4258 heap_free(swapchain_desc);
4259 wined3d_device_decref(device->wined3d_device);
4261 return hr;
4262 }
4263
4266
4268 {
4269 wined3d_device_uninit_3d(device->wined3d_device);
4271 wined3d_device_decref(device->wined3d_device);
4273 return E_OUTOFMEMORY;
4274 }
4275
4276 for (i = 0; i < count; ++i)
4277 {
4278 present_parameters_from_wined3d_swapchain_desc(&parameters[i], &swapchain_desc[i]);
4279 }
4280
4282
4283 heap_free(swapchain_desc);
4284
4285 /* Initialize the converted declaration array. This creates a valid pointer
4286 * and when adding decls HeapReAlloc() can be used without further checking. */
4287 if (!(device->fvf_decls = heap_alloc(0)))
4288 {
4289 ERR("Failed to allocate FVF vertex declaration map memory.\n");
4291 heap_free(device->implicit_swapchains);
4292 wined3d_device_uninit_3d(device->wined3d_device);
4294 wined3d_device_decref(device->wined3d_device);
4296 return E_OUTOFMEMORY;
4297 }
4298
4299 /* We could also simply ignore the initial rendertarget since it's known
4300 * not to be a texture (we currently use these only for automatic mipmap
4301 * generation). */
4304 wined3d_device_get_rendertarget_view(device->wined3d_device, 0));
4306
4307 IDirect3D9Ex_AddRef(&parent->IDirect3D9Ex_iface);
4308 device->d3d_parent = parent;
4309
4310 return D3D_OK;
4311}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define D3DCREATE_ADAPTERGROUP_DEVICE
Definition: d3d9.h:49
#define IDirect3D9Ex_AddRef(p)
Definition: d3d9.h:308
device_type
static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, const struct wined3d_swapchain_desc *swapchain_desc)
Definition: device.c:211
static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapchain_desc *swapchain_desc, const D3DPRESENT_PARAMETERS *present_parameters)
Definition: device.c:248
static void setup_fpu(void)
Definition: device.c:3262
static const struct IDirect3DDevice9ExVtbl d3d9_device_vtbl
Definition: device.c:3879
static const struct wined3d_device_parent_ops d3d9_wined3d_device_parent_ops
Definition: device.c:4146
static HRESULT d3d9_device_get_swapchains(struct d3d9_device *device)
Definition: device.c:858
struct wined3d_rendertarget_view *CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, unsigned int view_idx)
Definition: device.c:4447
void CDECL wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h)
Definition: device.c:853
HRESULT CDECL wined3d_device_acquire_focus_window(struct wined3d_device *device, HWND window)
Definition: device.c:938
HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
Definition: device.c:1195
ULONG CDECL wined3d_device_decref(struct wined3d_device *device)
Definition: device.c:472
void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
Definition: device.c:1290
void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
Definition: device.c:954
void CDECL wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value)
Definition: device.c:2027
HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc)
Definition: device.c:1061
void *CDECL wined3d_rendertarget_view_get_sub_resource_parent(const struct wined3d_rendertarget_view *view)
Definition: view.c:376
r parent
Definition: btrfs.c:3010
return adapter
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum mode
Definition: glext.h:6217
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define D3DCREATE_MULTITHREADED
Definition: d3d8.h:42
#define D3DCREATE_FPU_PRESERVE
Definition: d3d8.h:41
BOOL enable_auto_depth_stencil
Definition: wined3d.h:1742
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:6244
HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, WINED3DCAPS *caps)
Definition: directx.c:5659
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:269

◆ 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}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

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_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_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{
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,
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}
static const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops
Definition: buffer.c:564
static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl
Definition: buffer.c:536
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:1436
GLuint buffer
Definition: glext.h:5915
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:920
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:891

◆ is_gdi_compat_wined3dformat()

BOOL is_gdi_compat_wined3dformat ( enum wined3d_format_id  format)

Definition at line 1389 of file device.c.

1390{
1391 switch (format)
1392 {
1399 return TRUE;
1400 default:
1401 return FALSE;
1402 }
1403}

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{
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,
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}
static const IDirect3DPixelShader9Vtbl d3d9_pixelshader_vtbl
Definition: shader.c:270
static const struct wined3d_parent_ops d3d9_pixelshader_wined3d_parent_ops
Definition: shader.c:286
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:4205
__kernel_size_t size_t
Definition: linux.h:237
GLuint shader
Definition: glext.h:6030
const DWORD * byte_code
Definition: wined3d.h:2051
@ WINED3D_SHADER_BYTE_CODE_FORMAT_SM1
Definition: wined3d.h:848

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 
)

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 = swapchain_desc->swap_interval;
251}
#define D3DPRESENTFLAGS_MASK
Definition: d3d8_private.h:40
static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect(enum wined3d_swap_effect effect)
Definition: device.c:213
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format)
Definition: device.c:35
D3DSWAPEFFECT SwapEffect
Definition: d3d8types.h:1128
D3DMULTISAMPLE_TYPE MultiSampleType
Definition: d3d8types.h:1126
D3DFORMAT BackBufferFormat
Definition: d3d8types.h:1123
D3DFORMAT AutoDepthStencilFormat
Definition: d3d8types.h:1132
enum wined3d_multisample_type multisample_type
Definition: wined3d.h:1737
enum wined3d_format_id auto_depth_stencil_format
Definition: wined3d.h:1743
enum wined3d_format_id backbuffer_format
Definition: wined3d.h:1734
enum wined3d_swap_effect swap_effect
Definition: wined3d.h:1739

◆ 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}
@ D3DQUERYTYPE_OCCLUSION
Definition: d3d9types.h:293
@ D3DQUERYTYPE_TIMESTAMPDISJOINT
Definition: d3d9types.h:295
@ D3DQUERYTYPE_MEMORYPRESSURE
Definition: d3d9types.h:303
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
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
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
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84

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
140 stateblock->refcount = 1;
141
143 {
145 }
146 else
147 {
149 hr = wined3d_stateblock_create(device->wined3d_device,
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}
static const struct IDirect3DStateBlock9Vtbl d3d9_stateblock_vtbl
Definition: stateblock.c:122
struct wined3d_stateblock * wined3d_stateblock
Definition: d3d9_private.h:231
IDirect3DDevice9Ex * parent_device
Definition: d3d9_private.h:232
IDirect3DStateBlock9 IDirect3DStateBlock9_iface
Definition: d3d9_private.h:229
HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock)
Definition: stateblock.c:1372
wined3d_stateblock_type
Definition: wined3d.h:766

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
361 d3d9_resource_init(&surface->resource);
362 surface->resource.refcount = 0;
363 list_init(&surface->rtv_entry);
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}
#define IDirect3DBaseTexture9_Release(p)
Definition: d3d9.h:835
static const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl
Definition: surface.c:319
static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops
Definition: surface.c:350
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1121
#define SUCCEEDED(hr)
Definition: intsafe.h:50
IUnknown * container
Definition: d3d9_private.h:166
struct d3d9_resource resource
Definition: d3d9_private.h:160
struct d3d9_texture * unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture9 *iface) DECLSPEC_HIDDEN
Definition: texture.c:1269

◆ 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{
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
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 }
1343 texture->autogen_filter_type = D3DTEXF_LINEAR;
1344 levels = 0;
1345 }
1346 else
1347 {
1348 texture->autogen_filter_type = D3DTEXF_NONE;
1349 }
1350 if (!levels)
1352
1354 hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, flags,
1355 NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
1357 if (FAILED(hr))
1358 {
1359 WARN("Failed to create wined3d texture, hr %#x.\n", hr);
1360 return hr;
1361 }
1362
1363 texture->parent_device = &device->IDirect3DDevice9Ex_iface;
1364 IDirect3DDevice9Ex_AddRef(texture->parent_device);
1365
1366 return D3D_OK;
1367}
static const IDirect3DTexture9Vtbl d3d9_texture_2d_vtbl
Definition: texture.c:482
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define max(a, b)
Definition: svc.c:63

◆ 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 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
612}
static struct d3d9_indexbuffer * impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
Definition: buffer.c:323
#define assert(x)
Definition: debug.h:53

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
331}
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)

◆ 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
321}
static struct d3d9_vertexbuffer * impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
Definition: buffer.c:26
static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl
Definition: buffer.c:241

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}
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
177}
static const IDirect3DVertexShader9Vtbl d3d9_vertexshader_vtbl
Definition: shader.c:116
static struct d3d9_vertexshader * impl_from_IDirect3DVertexShader9(IDirect3DVertexShader9 *iface)
Definition: shader.c:25

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) ||
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 }
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;
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}
Type
Definition: Type.h:7
#define D3DFVF_DIFFUSE
Definition: d3d8types.h:122
#define D3DFVF_TEXCOUNT_SHIFT
Definition: d3d8types.h:125
#define D3DFVF_XYZB1
Definition: d3d8types.h:115
#define D3DFVF_LASTBETA_UBYTE4
Definition: d3d8types.h:135
#define D3DFVF_XYZB5
Definition: d3d8types.h:119
#define D3DFVF_XYZRHW
Definition: d3d8types.h:114
#define D3DFVF_NORMAL
Definition: d3d8types.h:120
#define D3DFVF_TEXTUREFORMAT4
Definition: d3d8types.h:63
#define D3DFVF_XYZB2
Definition: d3d8types.h:116
#define D3DFVF_TEXTUREFORMAT3
Definition: d3d8types.h:62
#define D3DFVF_TEXCOUNT_MASK
Definition: d3d8types.h:124
#define D3DFVF_TEXTUREFORMAT1
Definition: d3d8types.h:60
#define D3DFVF_PSIZE
Definition: d3d8types.h:121
#define D3DFVF_TEXTUREFORMAT2
Definition: d3d8types.h:61
#define D3DFVF_SPECULAR
Definition: d3d8types.h:123
#define D3DFVF_POSITION_MASK
Definition: d3d8types.h:112
static const struct @237 d3d_dtype_lookup[]
@ D3DDECLUSAGE_BLENDWEIGHT
Definition: d3d9types.h:221
@ D3DDECLUSAGE_BLENDINDICES
Definition: d3d9types.h:222
@ D3DDECLUSAGE_POSITIONT
Definition: d3d9types.h:229
@ D3DDECLUSAGE_NORMAL
Definition: d3d9types.h:223
@ D3DDECLUSAGE_TEXCOORD
Definition: d3d9types.h:225
@ D3DDECLUSAGE_POSITION
Definition: d3d9types.h:220
@ D3DDECLUSAGE_PSIZE
Definition: d3d9types.h:224
@ D3DDECLUSAGE_COLOR
Definition: d3d9types.h:230
#define D3DFVF_LASTBETA_D3DCOLOR
Definition: d3d9types.h:160
@ D3DDECLTYPE_UBYTE4
Definition: d3d9types.h:260
@ D3DDECLTYPE_FLOAT3
Definition: d3d9types.h:257
@ D3DDECLTYPE_FLOAT1
Definition: d3d9types.h:255
@ D3DDECLTYPE_D3DCOLOR
Definition: d3d9types.h:259
@ D3DDECLTYPE_FLOAT2
Definition: d3d9types.h:256
@ D3DDECLTYPE_FLOAT4
Definition: d3d9types.h:258
#define D3DDECL_END()
Definition: d3d9types.h:311
#define D3DFVF_XYZW
Definition: d3d9types.h:143
@ D3DDECLMETHOD_DEFAULT
Definition: d3d9types.h:242
unsigned int idx
Definition: utils.c:41
unsigned int BOOL
Definition: ntddk_ex.h:94
GLintptr offset
Definition: glext.h:5920
#define D3DERR_OUTOFVIDEOMEMORY
Definition: d3d8.h:85

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{
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,
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}
static const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops
Definition: buffer.c:269
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:890

◆ 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{
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,
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}
static const struct wined3d_parent_ops d3d9_vertexshader_wined3d_parent_ops
Definition: shader.c:132
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:4230

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}
static const struct IDirect3DVolume9Vtbl d3d9_volume_vtbl
Definition: volume.c:180
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 1441 of file texture.c.

1443{
1445 HRESULT hr;
1446
1447 texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl;
1448 d3d9_resource_init(&texture->resource);
1449 list_init(&texture->rtv_list);
1450 texture->usage = usage;
1451
1452 desc.resource_type = WINED3D_RTYPE_TEXTURE_3D;
1454 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1455 desc.multisample_quality = 0;
1457 desc.usage |= WINED3DUSAGE_TEXTURE;
1458 if (pool == D3DPOOL_SCRATCH)
1459 desc.usage |= WINED3DUSAGE_SCRATCH;
1461 desc.width = width;
1462 desc.height = height;
1463 desc.depth = depth;
1464 desc.size = 0;
1465
1467 {
1468 WARN("D3DUSAGE_AUTOGENMIPMAP volume texture is not supported, returning D3DERR_INVALIDCALL.\n");
1469 return D3DERR_INVALIDCALL;
1470 }
1471 if (!levels)
1473
1475 hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, 0,
1476 NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
1478 if (FAILED(hr))
1479 {
1480 WARN("Failed to create wined3d volume texture, hr %#x.\n", hr);
1481 return hr;
1482 }
1483
1484 texture->parent_device = &device->IDirect3DDevice9Ex_iface;
1485 IDirect3DDevice9Ex_AddRef(texture->parent_device);
1486
1487 return D3D_OK;
1488}
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:701

◆ wined3daccess_from_d3dpool()

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

◆ 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 {
112 case D3DFMT_A8: return WINED3DFMT_A8_UNORM;
118 case D3DFMT_P8: return WINED3DFMT_P8_UINT;
119 case D3DFMT_L8: return WINED3DFMT_L8_UNORM;
130 case D3DFMT_D32: return WINED3DFMT_D32_UNORM;
135 case D3DFMT_D16: return WINED3DFMT_D16_UNORM;
138 default:
139 FIXME("Unhandled D3DFORMAT %#x.\n", format);
140 return WINED3DFMT_UNKNOWN;
141 }
142}

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_DISCARD
Definition: d3d8types.h:72
#define D3DLOCK_NO_DIRTY_UPDATE
Definition: d3d8types.h:73
#define D3DLOCK_NOOVERWRITE
Definition: d3d8types.h:71
#define D3DLOCK_NOSYSLOCK
Definition: d3d8types.h:70
#define D3DLOCK_READONLY
Definition: d3d8types.h:69
#define WINED3D_MAP_READ
Definition: wined3d.h:939
#define WINED3D_MAP_WRITE
Definition: wined3d.h:938

◆ 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}

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

Variable Documentation

◆ DECLSPEC_HIDDEN

Definition at line 289 of file d3dcompiler_private.h.