ReactOS 0.4.15-dev-7906-g1b85a5f
d3d8_private.h File Reference
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "d3d8.h"
#include "wine/wined3d.h"
Include dependency graph for d3d8_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  d3d8
 
struct  d3d8_handle_entry
 
struct  d3d8_handle_table
 
struct  FvfToDecl
 
struct  d3d8_device
 
struct  d3d8_resource
 
struct  d3d8_volume
 
struct  d3d8_swapchain
 
struct  d3d8_surface
 
struct  d3d8_vertexbuffer
 
struct  d3d8_indexbuffer
 
struct  d3d8_texture
 
struct  d3d8_vertex_declaration
 
struct  d3d8_vertex_shader
 
struct  d3d8_pixel_shader
 

Macros

#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define COBJMACROS
 
#define D3DPRESENTFLAGS_MASK   0x00000fffu
 
#define VS_HIGHESTFIXEDFXF   0xF0000000
 
#define D3D8_INITIAL_HANDLE_TABLE_SIZE   64
 
#define D3D8_INVALID_HANDLE   ~0U
 
#define D3D8_MAX_VERTEX_SHADER_CONSTANTF   256
 

Enumerations

enum  d3d8_handle_type { D3D8_HANDLE_FREE , D3D8_HANDLE_VS , D3D8_HANDLE_PS , D3D8_HANDLE_SB }
 
enum  d3d8_device_state { D3D8_DEVICE_STATE_OK , D3D8_DEVICE_STATE_LOST , D3D8_DEVICE_STATE_NOT_RESET }
 

Functions

void d3dcaps_from_wined3dcaps (D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN
 
BOOL d3d8_init (struct d3d8 *d3d8) DECLSPEC_HIDDEN
 
HRESULT device_init (struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN
 
static struct d3d8_deviceimpl_from_IDirect3DDevice8 (IDirect3DDevice8 *iface)
 
void d3d8_resource_cleanup (struct d3d8_resource *resource) DECLSPEC_HIDDEN
 
HRESULT d3d8_resource_free_private_data (struct d3d8_resource *resource, const GUID *guid) DECLSPEC_HIDDEN
 
HRESULT d3d8_resource_get_private_data (struct d3d8_resource *resource, const GUID *guid, void *data, DWORD *data_size) DECLSPEC_HIDDEN
 
void d3d8_resource_init (struct d3d8_resource *resource) DECLSPEC_HIDDEN
 
HRESULT d3d8_resource_set_private_data (struct d3d8_resource *resource, const GUID *guid, const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN
 
void volume_init (struct d3d8_volume *volume, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN
 
HRESULT d3d8_swapchain_create (struct d3d8_device *device, struct wined3d_swapchain_desc *desc, struct d3d8_swapchain **swapchain) DECLSPEC_HIDDEN
 
struct wined3d_rendertarget_viewd3d8_surface_acquire_rendertarget_view (struct d3d8_surface *surface) DECLSPEC_HIDDEN
 
struct d3d8_deviced3d8_surface_get_device (const struct d3d8_surface *surface) DECLSPEC_HIDDEN
 
void d3d8_surface_release_rendertarget_view (struct d3d8_surface *surface, struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN
 
void surface_init (struct d3d8_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN
 
struct d3d8_surfaceunsafe_impl_from_IDirect3DSurface8 (IDirect3DSurface8 *iface) DECLSPEC_HIDDEN
 
HRESULT vertexbuffer_init (struct d3d8_vertexbuffer *buffer, struct d3d8_device *device, UINT size, DWORD usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN
 
struct d3d8_vertexbufferunsafe_impl_from_IDirect3DVertexBuffer8 (IDirect3DVertexBuffer8 *iface) DECLSPEC_HIDDEN
 
HRESULT indexbuffer_init (struct d3d8_indexbuffer *buffer, struct d3d8_device *device, UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN
 
struct d3d8_indexbufferunsafe_impl_from_IDirect3DIndexBuffer8 (IDirect3DIndexBuffer8 *iface) DECLSPEC_HIDDEN
 
HRESULT cubetexture_init (struct d3d8_texture *texture, struct d3d8_device *device, UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN
 
HRESULT texture_init (struct d3d8_texture *texture, struct d3d8_device *device, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN
 
HRESULT volumetexture_init (struct d3d8_texture *texture, struct d3d8_device *device, UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN
 
struct d3d8_textureunsafe_impl_from_IDirect3DBaseTexture8 (IDirect3DBaseTexture8 *iface) DECLSPEC_HIDDEN
 
void d3d8_vertex_declaration_destroy (struct d3d8_vertex_declaration *declaration) DECLSPEC_HIDDEN
 
HRESULT d3d8_vertex_declaration_init (struct d3d8_vertex_declaration *declaration, struct d3d8_device *device, const DWORD *elements, DWORD shader_handle) DECLSPEC_HIDDEN
 
HRESULT d3d8_vertex_declaration_init_fvf (struct d3d8_vertex_declaration *declaration, struct d3d8_device *device, DWORD fvf) DECLSPEC_HIDDEN
 
void d3d8_vertex_shader_destroy (struct d3d8_vertex_shader *shader) DECLSPEC_HIDDEN
 
HRESULT d3d8_vertex_shader_init (struct d3d8_vertex_shader *shader, struct d3d8_device *device, const DWORD *declaration, const DWORD *byte_code, DWORD shader_handle, DWORD usage) DECLSPEC_HIDDEN
 
void d3d8_pixel_shader_destroy (struct d3d8_pixel_shader *shader) DECLSPEC_HIDDEN
 
HRESULT d3d8_pixel_shader_init (struct d3d8_pixel_shader *shader, struct d3d8_device *device, const DWORD *byte_code, DWORD shader_handle) DECLSPEC_HIDDEN
 
D3DFORMAT d3dformat_from_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 load_local_constants (const DWORD *d3d8_elements, struct wined3d_shader *wined3d_vertex_shader) DECLSPEC_HIDDEN
 
size_t parse_token (const DWORD *pToken) DECLSPEC_HIDDEN
 
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)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 31 of file d3d8_private.h.

◆ D3D8_INITIAL_HANDLE_TABLE_SIZE

#define D3D8_INITIAL_HANDLE_TABLE_SIZE   64

Definition at line 60 of file d3d8_private.h.

◆ D3D8_INVALID_HANDLE

#define D3D8_INVALID_HANDLE   ~0U

Definition at line 61 of file d3d8_private.h.

◆ D3D8_MAX_VERTEX_SHADER_CONSTANTF

#define D3D8_MAX_VERTEX_SHADER_CONSTANTF   256

Definition at line 262 of file d3d8_private.h.

◆ D3DPRESENTFLAGS_MASK

#define D3DPRESENTFLAGS_MASK   0x00000fffu

Definition at line 40 of file d3d8_private.h.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 30 of file d3d8_private.h.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 29 of file d3d8_private.h.

◆ VS_HIGHESTFIXEDFXF

#define VS_HIGHESTFIXEDFXF   0xF0000000

Definition at line 43 of file d3d8_private.h.

Enumeration Type Documentation

◆ d3d8_device_state

Enumerator
D3D8_DEVICE_STATE_OK 
D3D8_DEVICE_STATE_LOST 
D3D8_DEVICE_STATE_NOT_RESET 

Definition at line 91 of file d3d8_private.h.

92{
96};
@ D3D8_DEVICE_STATE_OK
Definition: d3d8_private.h:93
@ D3D8_DEVICE_STATE_NOT_RESET
Definition: d3d8_private.h:95
@ D3D8_DEVICE_STATE_LOST
Definition: d3d8_private.h:94

◆ d3d8_handle_type

Enumerator
D3D8_HANDLE_FREE 
D3D8_HANDLE_VS 
D3D8_HANDLE_PS 
D3D8_HANDLE_SB 

Definition at line 63 of file d3d8_private.h.

64{
69};
@ D3D8_HANDLE_PS
Definition: d3d8_private.h:67
@ D3D8_HANDLE_VS
Definition: d3d8_private.h:66
@ D3D8_HANDLE_SB
Definition: d3d8_private.h:68
@ D3D8_HANDLE_FREE
Definition: d3d8_private.h:65

Function Documentation

◆ cubetexture_init()

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

Definition at line 1142 of file texture.c.

1144{
1146 DWORD flags = 0;
1147 HRESULT hr;
1148
1149 texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl;
1150 d3d8_resource_init(&texture->resource);
1151 list_init(&texture->rtv_list);
1152
1153 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1155 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1156 desc.multisample_quality = 0;
1157 desc.usage = usage & WINED3DUSAGE_MASK;
1159 if (pool == D3DPOOL_SCRATCH)
1160 desc.usage |= WINED3DUSAGE_SCRATCH;
1163 desc.width = edge_length;
1164 desc.height = edge_length;
1165 desc.depth = 1;
1166 desc.size = 0;
1167
1170
1171 if (!levels)
1172 levels = wined3d_log2i(edge_length) + 1;
1173
1175 hr = wined3d_texture_create(device->wined3d_device, &desc, 6, levels, flags,
1176 NULL, texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
1178 if (FAILED(hr))
1179 {
1180 WARN("Failed to create wined3d cube texture, hr %#x.\n", hr);
1181 return hr;
1182 }
1183
1184 texture->parent_device = &device->IDirect3DDevice8_iface;
1185 IDirect3DDevice8_AddRef(texture->parent_device);
1186
1187 return D3D_OK;
1188}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define WARN(fmt,...)
Definition: debug.h:112
void d3d8_resource_init(struct d3d8_resource *resource)
Definition: d3d8_main.c:191
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
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
@ D3DPOOL_SCRATCH
Definition: d3d8types.h:712
@ D3DPOOL_DEFAULT
Definition: d3d8types.h:709
#define D3D_OK
Definition: d3d.h:106
#define NULL
Definition: types.h:112
static const IDirect3DCubeTexture8Vtbl Direct3DCubeTexture8_Vtbl
Definition: texture.c:715
static const struct wined3d_parent_ops d3d8_texture_wined3d_parent_ops
Definition: texture.c:1089
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
#define IDirect3DDevice8_AddRef(p)
Definition: d3d8.h:947
HRESULT hr
Definition: shlfolder.c:183
Definition: devices.h:37
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 WINED3DUSAGE_MASK
Definition: wined3d.h:913
#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 WINED3DUSAGE_TEXTURE
Definition: wined3d.h:918
#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

Referenced by d3d8_device_CreateCubeTexture(), and d3d9_device_CreateCubeTexture().

◆ d3d8_init()

BOOL d3d8_init ( struct d3d8 d3d8)

Definition at line 415 of file directx.c.

416{
421
423 d3d8->refcount = 1;
424
428 if (!d3d8->wined3d)
429 return FALSE;
430
431 return TRUE;
432}
static const struct IDirect3D8Vtbl d3d8_vtbl
Definition: directx.c:393
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG refcount
Definition: d3d8_private.h:50
IDirect3D8 IDirect3D8_iface
Definition: d3d8_private.h:49
struct wined3d * wined3d
Definition: d3d8_private.h:51
#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_LEGACY_DEPTH_BIAS
Definition: wined3d.h:1315
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1322
#define WINED3D_LEGACY_CUBEMAP_FILTERING
Definition: wined3d.h:1327
struct wined3d *CDECL wined3d_create(DWORD flags)
Definition: wined3d_main.c:97

Referenced by Direct3DCreate8().

◆ d3d8_pixel_shader_destroy()

void d3d8_pixel_shader_destroy ( struct d3d8_pixel_shader shader)

Definition at line 148 of file shader.c.

149{
150 TRACE("shader %p.\n", shader);
151
153 wined3d_shader_decref(shader->wined3d_shader);
155}
ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader)
Definition: shader.c:3364
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by d3d8_device_DeletePixelShader().

◆ d3d8_pixel_shader_init()

HRESULT d3d8_pixel_shader_init ( struct d3d8_pixel_shader shader,
struct d3d8_device device,
const DWORD byte_code,
DWORD  shader_handle 
)

Definition at line 162 of file shader.c.

164{
166 HRESULT hr;
167
168 shader->handle = shader_handle;
169
170 desc.byte_code = byte_code;
171 desc.byte_code_size = ~(size_t)0;
173 desc.input_signature.element_count = 0;
174 desc.output_signature.element_count = 0;
175 desc.patch_constant_signature.element_count = 0;
176 desc.max_version = 1;
177
179 hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader,
182 if (FAILED(hr))
183 {
184 WARN("Failed to create wined3d pixel shader, hr %#x.\n", hr);
185 return hr;
186 }
187
188 return D3D_OK;
189}
static const struct wined3d_parent_ops d3d8_pixelshader_wined3d_parent_ops
Definition: shader.c:157
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
const DWORD * byte_code
Definition: wined3d.h:2051
@ WINED3D_SHADER_BYTE_CODE_FORMAT_SM1
Definition: wined3d.h:848

Referenced by d3d8_device_CreatePixelShader().

◆ d3d8_resource_cleanup()

void d3d8_resource_cleanup ( struct d3d8_resource resource)

◆ d3d8_resource_free_private_data()

HRESULT d3d8_resource_free_private_data ( struct d3d8_resource resource,
const GUID guid 
)

Definition at line 135 of file d3d8_main.c.

136{
138
141 if (!entry)
142 {
144 return D3DERR_NOTFOUND;
145 }
146
149
150 return D3D_OK;
151}
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 d3d8_indexbuffer_FreePrivateData(), d3d8_surface_FreePrivateData(), d3d8_texture_2d_FreePrivateData(), d3d8_texture_3d_FreePrivateData(), d3d8_texture_cube_FreePrivateData(), d3d8_vertexbuffer_FreePrivateData(), and d3d8_volume_FreePrivateData().

◆ d3d8_resource_get_private_data()

HRESULT d3d8_resource_get_private_data ( struct d3d8_resource resource,
const GUID guid,
void data,
DWORD data_size 
)

Definition at line 153 of file d3d8_main.c.

155{
156 const struct wined3d_private_data *stored_data;
157 DWORD size_in;
158 HRESULT hr;
159
161 stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid);
162 if (!stored_data)
163 {
165 goto done;
166 }
167
168 size_in = *data_size;
169 *data_size = stored_data->size;
170 if (!data)
171 {
172 hr = D3D_OK;
173 goto done;
174 }
175 if (size_in < stored_data->size)
176 {
178 goto done;
179 }
180
181 if (stored_data->flags & WINED3DSPD_IUNKNOWN)
182 IUnknown_AddRef(stored_data->content.object);
183 memcpy(data, stored_data->content.data, stored_data->size);
184 hr = D3D_OK;
185
186done:
188 return hr;
189}
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::@3679 content
IUnknown * object
Definition: wined3d.h:2168
#define WINED3DSPD_IUNKNOWN
Definition: wined3d.h:1006

Referenced by d3d8_indexbuffer_GetPrivateData(), d3d8_surface_GetPrivateData(), d3d8_texture_2d_GetPrivateData(), d3d8_texture_3d_GetPrivateData(), d3d8_texture_cube_GetPrivateData(), d3d8_vertexbuffer_GetPrivateData(), and d3d8_volume_GetPrivateData().

◆ d3d8_resource_init()

void d3d8_resource_init ( struct d3d8_resource resource)

Definition at line 191 of file d3d8_main.c.

192{
193 resource->refcount = 1;
194 wined3d_private_store_init(&resource->private_store);
195}
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().

◆ d3d8_resource_set_private_data()

HRESULT d3d8_resource_set_private_data ( struct d3d8_resource resource,
const GUID guid,
const void data,
DWORD  data_size,
DWORD  flags 
)

Definition at line 197 of file d3d8_main.c.

199{
200 HRESULT hr;
201
203 hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags);
205 return hr;
206}
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 d3d8_indexbuffer_SetPrivateData(), d3d8_surface_SetPrivateData(), d3d8_texture_2d_SetPrivateData(), d3d8_texture_3d_SetPrivateData(), d3d8_texture_cube_SetPrivateData(), d3d8_vertexbuffer_SetPrivateData(), and d3d8_volume_SetPrivateData().

◆ d3d8_surface_acquire_rendertarget_view()

struct wined3d_rendertarget_view * d3d8_surface_acquire_rendertarget_view ( struct d3d8_surface surface)

Definition at line 369 of file surface.c.

370{
371 HRESULT hr;
372
373 /* The surface reference count can be equal to 0 when this function is
374 * called. In order to properly manage the render target view reference
375 * count, we temporarily increment the surface reference count. */
377
378 if (surface->wined3d_rtv)
379 return surface->wined3d_rtv;
380
382 surface->sub_resource_idx, surface, &d3d8_view_wined3d_parent_ops, &surface->wined3d_rtv)))
383 {
384 ERR("Failed to create rendertarget view, hr %#x.\n", hr);
386 return NULL;
387 }
388
389 if (surface->texture)
390 list_add_head(&surface->texture->rtv_list, &surface->rtv_entry);
391
392 return surface->wined3d_rtv;
393}
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define ERR(fmt,...)
Definition: debug.h:110
static ULONG WINAPI d3d8_surface_Release(IDirect3DSurface8 *iface)
Definition: surface.c:80
static ULONG WINAPI d3d8_surface_AddRef(IDirect3DSurface8 *iface)
Definition: surface.c:50
static const struct wined3d_parent_ops d3d8_view_wined3d_parent_ops
Definition: surface.c:357
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 d3d8_texture * texture
Definition: d3d8_private.h:184
unsigned int sub_resource_idx
Definition: d3d8_private.h:179
struct list rtv_entry
Definition: d3d8_private.h:180
struct wined3d_rendertarget_view * wined3d_rtv
Definition: d3d8_private.h:181
IDirect3DSurface8 IDirect3DSurface8_iface
Definition: d3d8_private.h:176
struct wined3d_texture * wined3d_texture
Definition: d3d8_private.h:178

Referenced by d3d8_device_SetRenderTarget().

◆ d3d8_surface_get_device()

struct d3d8_device * d3d8_surface_get_device ( const struct d3d8_surface surface)

Definition at line 362 of file surface.c.

363{
364 IDirect3DDevice8 *device;
365 device = surface->texture ? surface->texture->parent_device : surface->parent_device;
367}
static struct d3d8_device * impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface)
Definition: d3d8_private.h:132
IDirect3DDevice8 * parent_device
Definition: d3d8_private.h:182

Referenced by d3d8_device_SetRenderTarget().

◆ d3d8_surface_release_rendertarget_view()

void d3d8_surface_release_rendertarget_view ( struct d3d8_surface surface,
struct wined3d_rendertarget_view rtv 
)

Definition at line 395 of file surface.c.

397{
398 if (rtv)
400}

Referenced by d3d8_device_SetRenderTarget().

◆ d3d8_swapchain_create()

HRESULT d3d8_swapchain_create ( struct d3d8_device device,
struct wined3d_swapchain_desc desc,
struct d3d8_swapchain **  swapchain 
)

Definition at line 194 of file swapchain.c.

196{
197 struct d3d8_swapchain *object;
198 HRESULT hr;
199
200 if (!(object = heap_alloc_zero(sizeof(*object))))
201 return E_OUTOFMEMORY;
202
203 if (FAILED(hr = swapchain_init(object, device, desc)))
204 {
205 WARN("Failed to initialize swapchain, hr %#x.\n", hr);
206 heap_free(object);
207 return hr;
208 }
209
210 TRACE("Created swapchain %p.\n", object);
211 *swapchain = object;
212
213 return D3D_OK;
214}
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

Referenced by d3d8_device_CreateAdditionalSwapChain(), and device_parent_create_swapchain().

◆ d3d8_vertex_declaration_destroy()

void d3d8_vertex_declaration_destroy ( struct d3d8_vertex_declaration declaration)

Definition at line 321 of file vertexdeclaration.c.

322{
323 TRACE("declaration %p.\n", declaration);
324
326 wined3d_vertex_declaration_decref(declaration->wined3d_vertex_declaration);
328}
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)

Referenced by d3d8_device_get_fvf_declaration(), d3d8_device_Release(), d3d8_vertex_shader_init(), and d3d8_vertexshader_wined3d_object_destroyed().

◆ d3d8_vertex_declaration_init()

HRESULT d3d8_vertex_declaration_init ( struct d3d8_vertex_declaration declaration,
struct d3d8_device device,
const DWORD elements,
DWORD  shader_handle 
)

Definition at line 335 of file vertexdeclaration.c.

337{
338 struct wined3d_vertex_element *wined3d_elements;
339 UINT wined3d_element_count;
340 HRESULT hr;
341
342 declaration->shader_handle = shader_handle;
343
344 wined3d_element_count = convert_to_wined3d_declaration(elements, &declaration->elements_size, &wined3d_elements);
345 if (!(declaration->elements = heap_alloc(declaration->elements_size)))
346 {
347 ERR("Failed to allocate vertex declaration elements memory.\n");
348 heap_free(wined3d_elements);
349 return E_OUTOFMEMORY;
350 }
351
352 memcpy(declaration->elements, elements, declaration->elements_size);
353
355 hr = wined3d_vertex_declaration_create(device->wined3d_device, wined3d_elements, wined3d_element_count,
358 heap_free(wined3d_elements);
359 if (FAILED(hr))
360 {
361 WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
362 heap_free(declaration->elements);
363 return hr;
364 }
365
366 return D3D_OK;
367}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, struct wined3d_vertex_element **wined3d_elements)
static const struct wined3d_parent_ops d3d8_vertexdeclaration_wined3d_parent_ops
unsigned int UINT
Definition: ndis.h:50
HRESULT CDECL wined3d_vertex_declaration_create(struct wined3d_device *device, const struct wined3d_vertex_element *elements, UINT element_count, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_vertex_declaration **declaration)

Referenced by d3d8_vertexshader_create_vertexdeclaration().

◆ d3d8_vertex_declaration_init_fvf()

HRESULT d3d8_vertex_declaration_init_fvf ( struct d3d8_vertex_declaration declaration,
struct d3d8_device device,
DWORD  fvf 
)

Definition at line 369 of file vertexdeclaration.c.

371{
372 HRESULT hr;
373
374 declaration->elements = NULL;
375 declaration->elements_size = 0;
376 declaration->shader_handle = fvf;
377
379 &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration);
380 if (FAILED(hr))
381 {
382 WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
383 return hr;
384 }
385
386 return D3D_OK;
387}
HRESULT CDECL wined3d_vertex_declaration_create_from_fvf(struct wined3d_device *device, DWORD fvf, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_vertex_declaration **declaration)

Referenced by d3d8_device_get_fvf_declaration().

◆ d3d8_vertex_shader_destroy()

void d3d8_vertex_shader_destroy ( struct d3d8_vertex_shader shader)

Definition at line 32 of file shader.c.

33{
34 TRACE("shader %p.\n", shader);
35
36 if (shader->wined3d_shader)
37 {
39 wined3d_shader_decref(shader->wined3d_shader);
41 }
42 else
43 {
45 }
46}
static void STDMETHODCALLTYPE d3d8_vertexshader_wined3d_object_destroyed(void *parent)
Definition: shader.c:25

Referenced by d3d8_device_DeleteVertexShader().

◆ d3d8_vertex_shader_init()

HRESULT d3d8_vertex_shader_init ( struct d3d8_vertex_shader shader,
struct d3d8_device device,
const DWORD declaration,
const DWORD byte_code,
DWORD  shader_handle,
DWORD  usage 
)

Definition at line 79 of file shader.c.

81{
82 const DWORD *token = declaration;
83 HRESULT hr;
84
85 /* Test if the vertex declaration is valid. */
86 while (D3DVSD_END() != *token)
87 {
89
90 if (token_type == D3DVSD_TOKEN_STREAMDATA && !(token_type & 0x10000000))
91 {
94
95 if (reg == D3DVSDE_NORMAL && type != D3DVSDT_FLOAT3 && !byte_code)
96 {
97 WARN("Attempt to use a non-FLOAT3 normal with the fixed-function function\n");
98 return D3DERR_INVALIDCALL;
99 }
100 }
102 }
103
104 hr = d3d8_vertexshader_create_vertexdeclaration(device, declaration, shader_handle, &shader->vertex_declaration);
105 if (FAILED(hr))
106 {
107 WARN("Failed to create vertex declaration, hr %#x.\n", hr);
108 return hr;
109 }
110
111 if (byte_code)
112 {
114
115 if (usage)
116 FIXME("Usage %#x not implemented.\n", usage);
117
118 desc.byte_code = byte_code;
119 desc.byte_code_size = ~(size_t)0;
121 desc.input_signature.element_count = 0;
122 desc.output_signature.element_count = 0;
123 desc.patch_constant_signature.element_count = 0;
124 desc.max_version = 1;
125
127 hr = wined3d_shader_create_vs(device->wined3d_device, &desc, shader,
130 if (FAILED(hr))
131 {
132 WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr);
133 d3d8_vertex_declaration_destroy(shader->vertex_declaration);
134 return hr;
135 }
136
137 load_local_constants(declaration, shader->wined3d_shader);
138 }
139
140 return D3D_OK;
141}
#define FIXME(fmt,...)
Definition: debug.h:111
size_t parse_token(const DWORD *pToken) DECLSPEC_HIDDEN
void load_local_constants(const DWORD *d3d8_elements, struct wined3d_shader *wined3d_vertex_shader) DECLSPEC_HIDDEN
void d3d8_vertex_declaration_destroy(struct d3d8_vertex_declaration *declaration) DECLSPEC_HIDDEN
#define D3DVSD_VERTEXREGMASK
Definition: d3d8types.h:257
#define D3DVSD_END()
Definition: d3d8types.h:275
#define D3DVSD_DATATYPEMASK
Definition: d3d8types.h:259
@ D3DVSDE_NORMAL
Definition: d3d8types.h:201
#define D3DVSD_VERTEXREGSHIFT
Definition: d3d8types.h:243
#define D3DVSD_TOKENTYPEMASK
Definition: d3d8types.h:266
#define D3DVSD_DATATYPESHIFT
Definition: d3d8types.h:245
#define D3DVSD_TOKENTYPESHIFT
Definition: d3d8types.h:252
@ D3DVSD_TOKEN_STREAMDATA
Definition: d3d8types.h:167
enum _D3DVSD_TOKENTYPE D3DVSD_TOKENTYPE
@ D3DVSDT_FLOAT3
Definition: d3d8types.h:231
#define D3DERR_INVALIDCALL
static const struct wined3d_parent_ops d3d8_vertexshader_wined3d_parent_ops
Definition: shader.c:48
static HRESULT d3d8_vertexshader_create_vertexdeclaration(struct d3d8_device *device, const DWORD *declaration, DWORD shader_handle, struct d3d8_vertex_declaration **decl_ptr)
Definition: shader.c:53
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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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 token
Definition: glfuncs.h:210
static int reg
Definition: i386-dis.c:1290

Referenced by d3d8_device_CreateVertexShader().

◆ d3dcaps_from_wined3dcaps()

void d3dcaps_from_wined3dcaps ( D3DCAPS8 caps,
const WINED3DCAPS wined3d_caps 
)

Definition at line 290 of file device.c.

291{
292 caps->DeviceType = (D3DDEVTYPE)wined3d_caps->DeviceType;
293 caps->AdapterOrdinal = wined3d_caps->AdapterOrdinal;
294 caps->Caps = wined3d_caps->Caps;
295 caps->Caps2 = wined3d_caps->Caps2;
296 caps->Caps3 = wined3d_caps->Caps3;
297 caps->PresentationIntervals = wined3d_caps->PresentationIntervals;
298 caps->CursorCaps = wined3d_caps->CursorCaps;
299 caps->DevCaps = wined3d_caps->DevCaps;
300 caps->PrimitiveMiscCaps = wined3d_caps->PrimitiveMiscCaps;
301 caps->RasterCaps = wined3d_caps->RasterCaps;
302 caps->ZCmpCaps = wined3d_caps->ZCmpCaps;
303 caps->SrcBlendCaps = wined3d_caps->SrcBlendCaps;
304 caps->DestBlendCaps = wined3d_caps->DestBlendCaps;
305 caps->AlphaCmpCaps = wined3d_caps->AlphaCmpCaps;
306 caps->ShadeCaps = wined3d_caps->ShadeCaps;
307 caps->TextureCaps = wined3d_caps->TextureCaps;
308 caps->TextureFilterCaps = wined3d_caps->TextureFilterCaps;
309 caps->CubeTextureFilterCaps = wined3d_caps->CubeTextureFilterCaps;
311 caps->TextureAddressCaps = wined3d_caps->TextureAddressCaps;
313 caps->LineCaps = wined3d_caps->LineCaps;
314 caps->MaxTextureWidth = wined3d_caps->MaxTextureWidth;
315 caps->MaxTextureHeight = wined3d_caps->MaxTextureHeight;
316 caps->MaxVolumeExtent = wined3d_caps->MaxVolumeExtent;
317 caps->MaxTextureRepeat = wined3d_caps->MaxTextureRepeat;
318 caps->MaxTextureAspectRatio = wined3d_caps->MaxTextureAspectRatio;
319 caps->MaxAnisotropy = wined3d_caps->MaxAnisotropy;
320 caps->MaxVertexW = wined3d_caps->MaxVertexW;
321 caps->GuardBandLeft = wined3d_caps->GuardBandLeft;
322 caps->GuardBandTop = wined3d_caps->GuardBandTop;
323 caps->GuardBandRight = wined3d_caps->GuardBandRight;
324 caps->GuardBandBottom = wined3d_caps->GuardBandBottom;
325 caps->ExtentsAdjust = wined3d_caps->ExtentsAdjust;
326 caps->StencilCaps = wined3d_caps->StencilCaps;
327 caps->FVFCaps = wined3d_caps->FVFCaps;
328 caps->TextureOpCaps = wined3d_caps->TextureOpCaps;
329 caps->MaxTextureBlendStages = wined3d_caps->MaxTextureBlendStages;
331 caps->VertexProcessingCaps = wined3d_caps->VertexProcessingCaps;
332 caps->MaxActiveLights = wined3d_caps->MaxActiveLights;
333 caps->MaxUserClipPlanes = wined3d_caps->MaxUserClipPlanes;
336 caps->MaxPointSize = wined3d_caps->MaxPointSize;
337 caps->MaxPrimitiveCount = wined3d_caps->MaxPrimitiveCount;
338 caps->MaxVertexIndex = wined3d_caps->MaxVertexIndex;
339 caps->MaxStreams = wined3d_caps->MaxStreams;
340 caps->MaxStreamStride = wined3d_caps->MaxStreamStride;
341 caps->VertexShaderVersion = wined3d_caps->VertexShaderVersion;
342 caps->MaxVertexShaderConst = wined3d_caps->MaxVertexShaderConst;
343 caps->PixelShaderVersion = wined3d_caps->PixelShaderVersion;
344 caps->MaxPixelShaderValue = wined3d_caps->PixelShader1xMaxValue;
345
346 /* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
347 if (caps->PixelShaderVersion)
348 caps->PixelShaderVersion = D3DPS_VERSION(1, 4);
349 else
350 caps->PixelShaderVersion = D3DPS_VERSION(0, 0);
351 if (caps->VertexShaderVersion)
353 else
356
357 caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;
358}
#define D3D8_MAX_VERTEX_SHADER_CONSTANTF
Definition: d3d8_private.h:262
#define D3DPS_VERSION(major, minor)
Definition: d3d8types.h:474
enum _D3DDEVTYPE D3DDEVTYPE
#define D3DVS_VERSION(major, minor)
Definition: d3d8types.h:475
if(dx< 0)
Definition: linetemp.h:194
#define min(a, b)
Definition: monoChain.cc:55
DWORD PresentationIntervals
Definition: d3d8caps.h:196
DWORD MaxVertexIndex
Definition: d3d8caps.h:237
DWORD PixelShaderVersion
Definition: d3d8caps.h:242
UINT AdapterOrdinal
Definition: d3d8caps.h:192
DWORD CursorCaps
Definition: d3d8caps.h:197
DWORD MaxTextureAspectRatio
Definition: d3d8caps.h:217
DWORD DestBlendCaps
Definition: d3d8caps.h:203
DWORD MaxPrimitiveCount
Definition: d3d8caps.h:236
DWORD LineCaps
Definition: d3d8caps.h:212
DWORD TextureAddressCaps
Definition: d3d8caps.h:210
DWORD MaxTextureWidth
Definition: d3d8caps.h:213
DWORD MaxAnisotropy
Definition: d3d8caps.h:218
DWORD TextureOpCaps
Definition: d3d8caps.h:227
DWORD VolumeTextureAddressCaps
Definition: d3d8caps.h:211
DWORD RasterCaps
Definition: d3d8caps.h:200
D3DDEVTYPE DeviceType
Definition: d3d8caps.h:191
DWORD MaxTextureRepeat
Definition: d3d8caps.h:216
DWORD ZCmpCaps
Definition: d3d8caps.h:201
DWORD MaxTextureHeight
Definition: d3d8caps.h:214
DWORD MaxStreams
Definition: d3d8caps.h:238
DWORD Caps3
Definition: d3d8caps.h:195
DWORD StencilCaps
Definition: d3d8caps.h:225
DWORD Caps2
Definition: d3d8caps.h:194
float MaxPointSize
Definition: d3d8caps.h:235
float GuardBandBottom
Definition: d3d8caps.h:223
float MaxVertexW
Definition: d3d8caps.h:219
DWORD MaxVertexShaderConst
Definition: d3d8caps.h:241
DWORD VertexProcessingCaps
Definition: d3d8caps.h:230
DWORD FVFCaps
Definition: d3d8caps.h:226
DWORD VertexShaderVersion
Definition: d3d8caps.h:240
DWORD Caps
Definition: d3d8caps.h:193
DWORD MaxSimultaneousTextures
Definition: d3d8caps.h:229
DWORD MaxTextureBlendStages
Definition: d3d8caps.h:228
DWORD MaxVolumeExtent
Definition: d3d8caps.h:215
DWORD TextureCaps
Definition: d3d8caps.h:206
DWORD DevCaps
Definition: d3d8caps.h:198
float ExtentsAdjust
Definition: d3d8caps.h:224
DWORD TextureFilterCaps
Definition: d3d8caps.h:207
DWORD AlphaCmpCaps
Definition: d3d8caps.h:204
DWORD MaxActiveLights
Definition: d3d8caps.h:231
DWORD PrimitiveMiscCaps
Definition: d3d8caps.h:199
DWORD ShadeCaps
Definition: d3d8caps.h:205
DWORD CubeTextureFilterCaps
Definition: d3d8caps.h:208
DWORD MaxStreamStride
Definition: d3d8caps.h:239
DWORD SrcBlendCaps
Definition: d3d8caps.h:202
float GuardBandTop
Definition: d3d8caps.h:221
float MaxPixelShaderValue
Definition: d3d8caps.h:243
float GuardBandRight
Definition: d3d8caps.h:222
float GuardBandLeft
Definition: d3d8caps.h:220
DWORD VolumeTextureFilterCaps
Definition: d3d8caps.h:209
DWORD MaxVertexBlendMatrices
Definition: d3d8caps.h:233
DWORD MaxUserClipPlanes
Definition: d3d8caps.h:232
DWORD MaxVertexBlendMatrixIndex
Definition: d3d8caps.h:234
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
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 VolumeTextureFilterCaps
Definition: wined3d.h:1906
DWORD MaxTextureHeight
Definition: wined3d.h:1912
DWORD MaxAnisotropy
Definition: wined3d.h:1916
DWORD MaxTextureWidth
Definition: wined3d.h:1911
float MaxVertexW
Definition: wined3d.h:1917
DWORD CubeTextureFilterCaps
Definition: wined3d.h:1905
DWORD AlphaCmpCaps
Definition: wined3d.h:1901
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 Caps
Definition: wined3d.h:1889
DWORD LineCaps
Definition: wined3d.h:1909
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 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 MaxActiveLights
Definition: wined3d.h:1933

Referenced by d3d8_device_GetDeviceCaps(), d3d8_GetDeviceCaps(), d3d9_device_GetDeviceCaps(), and d3d9_GetDeviceCaps().

◆ 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
@ 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_EnumAdapterModes(), d3d8_GetAdapterDisplayMode(), d3d8_indexbuffer_GetDesc(), d3d8_surface_GetDesc(), d3d8_texture_2d_GetLevelDesc(), d3d8_texture_3d_GetLevelDesc(), d3d8_texture_cube_GetLevelDesc(), d3d8_volume_GetDesc(), d3d9_EnumAdapterModes(), d3d9_EnumAdapterModesEx(), d3d9_GetAdapterDisplayMode(), d3d9_GetAdapterDisplayModeEx(), d3d9_indexbuffer_GetDesc(), d3d9_surface_GetDesc(), d3d9_swapchain_GetDisplayMode(), d3d9_swapchain_GetDisplayModeEx(), d3d9_texture_2d_GetLevelDesc(), d3d9_texture_3d_GetLevelDesc(), d3d9_texture_cube_GetLevelDesc(), and d3d9_volume_GetDesc().

◆ d3dpool_from_wined3daccess()

◆ d3dusage_from_wined3dusage()

◆ device_init()

HRESULT device_init ( struct d3d8_device device,
struct d3d8 parent,
struct wined3d wined3d,
UINT  adapter,
D3DDEVTYPE  device_type,
HWND  focus_window,
DWORD  flags,
D3DPRESENT_PARAMETERS parameters 
)

Definition at line 3279 of file device.c.

3281{
3282 struct wined3d_swapchain_desc swapchain_desc;
3284 HRESULT hr;
3285
3286 device->IDirect3DDevice8_iface.lpVtbl = &d3d8_device_vtbl;
3287 device->device_parent.ops = &d3d8_wined3d_device_parent_ops;
3288 device->ref = 1;
3289 if (!(device->handle_table.entries = heap_alloc_zero(D3D8_INITIAL_HANDLE_TABLE_SIZE
3290 * sizeof(*device->handle_table.entries))))
3291 {
3292 ERR("Failed to allocate handle table memory.\n");
3293 return E_OUTOFMEMORY;
3294 }
3295 device->handle_table.table_size = D3D8_INITIAL_HANDLE_TABLE_SIZE;
3296
3298
3301 &device->device_parent, &device->wined3d_device);
3302 if (FAILED(hr))
3303 {
3304 WARN("Failed to create wined3d device, hr %#x.\n", hr);
3306 heap_free(device->handle_table.entries);
3307 return hr;
3308 }
3309
3310 if (!parameters->Windowed)
3311 {
3312 HWND device_window = parameters->hDeviceWindow;
3313
3314 if (!focus_window)
3315 focus_window = device_window;
3316 if (FAILED(hr = wined3d_device_acquire_focus_window(device->wined3d_device, focus_window)))
3317 {
3318 ERR("Failed to acquire focus window, hr %#x.\n", hr);
3319 wined3d_device_decref(device->wined3d_device);
3321 heap_free(device->handle_table.entries);
3322 return hr;
3323 }
3324
3325 if (!device_window)
3326 device_window = focus_window;
3328 parameters->BackBufferWidth,
3329 parameters->BackBufferHeight);
3330 }
3331
3334
3335 if (!wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, parameters))
3336 {
3338 wined3d_device_decref(device->wined3d_device);
3340 heap_free(device->handle_table.entries);
3341 return D3DERR_INVALIDCALL;
3342 }
3343
3344 if (FAILED(hr = wined3d_device_init_3d(device->wined3d_device, &swapchain_desc)))
3345 {
3346 WARN("Failed to initialize 3D, hr %#x.\n", hr);
3348 wined3d_device_decref(device->wined3d_device);
3350 heap_free(device->handle_table.entries);
3351 return hr;
3352 }
3353
3355 WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil);
3358
3359 present_parameters_from_wined3d_swapchain_desc(parameters, &swapchain_desc);
3360
3361 device->declArraySize = 16;
3362 if (!(device->decls = heap_alloc(device->declArraySize * sizeof(*device->decls))))
3363 {
3364 ERR("Failed to allocate FVF vertex declaration map memory.\n");
3365 hr = E_OUTOFMEMORY;
3366 goto err;
3367 }
3368
3371
3372 device->d3d_parent = &parent->IDirect3D8_iface;
3373 IDirect3D8_AddRef(device->d3d_parent);
3374
3375 return D3D_OK;
3376
3377err:
3379 wined3d_device_uninit_3d(device->wined3d_device);
3381 wined3d_device_decref(device->wined3d_device);
3383 heap_free(device->handle_table.entries);
3384 return hr;
3385}
#define D3D8_INITIAL_HANDLE_TABLE_SIZE
Definition: d3d8_private.h:60
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 const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops
Definition: device.c:3251
static const struct IDirect3DDevice8Vtbl d3d8_device_vtbl
Definition: device.c:3036
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
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
struct wined3d_swapchain *CDECL wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx)
Definition: device.c:533
HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc)
Definition: device.c:1061
r parent
Definition: btrfs.c:3010
return adapter
#define err(...)
#define D3DCREATE_MULTITHREADED
Definition: d3d8.h:42
#define D3DCREATE_FPU_PRESERVE
Definition: d3d8.h:41
#define IDirect3D8_AddRef(p)
Definition: d3d8.h:160
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
void *CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain)
Definition: swapchain.c:133
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:269
@ WINED3D_RS_POINTSIZE_MIN
Definition: wined3d.h:340

Referenced by d3d8_CreateDevice(), d3d9_CreateDevice(), d3d9_CreateDeviceEx(), and wined3d_device_create().

◆ impl_from_IDirect3DDevice8()

static struct d3d8_device * impl_from_IDirect3DDevice8 ( IDirect3DDevice8 *  iface)
inlinestatic

Definition at line 132 of file d3d8_private.h.

133{
134 return CONTAINING_RECORD(iface, struct d3d8_device, IDirect3DDevice8_iface);
135}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by d3d8_device_AddRef(), d3d8_device_ApplyStateBlock(), d3d8_device_BeginScene(), d3d8_device_BeginStateBlock(), d3d8_device_CaptureStateBlock(), d3d8_device_Clear(), d3d8_device_CreateAdditionalSwapChain(), d3d8_device_CreateCubeTexture(), d3d8_device_CreateDepthStencilSurface(), d3d8_device_CreateImageSurface(), d3d8_device_CreateIndexBuffer(), d3d8_device_CreatePixelShader(), d3d8_device_CreateRenderTarget(), d3d8_device_CreateStateBlock(), d3d8_device_CreateTexture(), d3d8_device_CreateVertexBuffer(), d3d8_device_CreateVertexShader(), d3d8_device_CreateVolumeTexture(), d3d8_device_DeletePixelShader(), d3d8_device_DeleteStateBlock(), d3d8_device_DeleteVertexShader(), d3d8_device_DrawIndexedPrimitive(), d3d8_device_DrawIndexedPrimitiveUP(), d3d8_device_DrawPrimitive(), d3d8_device_DrawPrimitiveUP(), d3d8_device_EndScene(), d3d8_device_EndStateBlock(), d3d8_device_GetAvailableTextureMem(), d3d8_device_GetBackBuffer(), d3d8_device_GetClipPlane(), d3d8_device_GetClipStatus(), d3d8_device_GetCreationParameters(), d3d8_device_GetDepthStencilSurface(), d3d8_device_GetDeviceCaps(), d3d8_device_GetDirect3D(), d3d8_device_GetDisplayMode(), d3d8_device_GetFrontBuffer(), d3d8_device_GetGammaRamp(), d3d8_device_GetIndices(), d3d8_device_GetLight(), d3d8_device_GetLightEnable(), d3d8_device_GetMaterial(), d3d8_device_GetPixelShader(), d3d8_device_GetPixelShaderConstant(), d3d8_device_GetPixelShaderFunction(), d3d8_device_GetRasterStatus(), d3d8_device_GetRenderState(), d3d8_device_GetRenderTarget(), d3d8_device_GetStreamSource(), d3d8_device_GetTexture(), d3d8_device_GetTextureStageState(), d3d8_device_GetTransform(), d3d8_device_GetVertexShader(), d3d8_device_GetVertexShaderConstant(), d3d8_device_GetVertexShaderDeclaration(), d3d8_device_GetVertexShaderFunction(), d3d8_device_GetViewport(), d3d8_device_LightEnable(), d3d8_device_MultiplyTransform(), d3d8_device_Present(), d3d8_device_ProcessVertices(), d3d8_device_Release(), d3d8_device_Reset(), d3d8_device_ResourceManagerDiscardBytes(), d3d8_device_SetClipPlane(), d3d8_device_SetClipStatus(), d3d8_device_SetCursorPosition(), d3d8_device_SetCursorProperties(), d3d8_device_SetGammaRamp(), d3d8_device_SetIndices(), d3d8_device_SetLight(), d3d8_device_SetMaterial(), d3d8_device_SetPixelShader(), d3d8_device_SetPixelShaderConstant(), d3d8_device_SetRenderState(), d3d8_device_SetRenderTarget(), d3d8_device_SetStreamSource(), d3d8_device_SetTexture(), d3d8_device_SetTextureStageState(), d3d8_device_SetTransform(), d3d8_device_SetVertexShader(), d3d8_device_SetVertexShaderConstant(), d3d8_device_SetViewport(), d3d8_device_ShowCursor(), d3d8_device_TestCooperativeLevel(), d3d8_device_UpdateTexture(), d3d8_device_ValidateDevice(), d3d8_surface_get_device(), and d3d8_swapchain_Present().

◆ indexbuffer_init()

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

Definition at line 570 of file buffer.c.

572{
574 HRESULT hr;
575
576 desc.byte_width = size;
578 if (pool == D3DPOOL_SCRATCH)
579 desc.usage |= WINED3DUSAGE_SCRATCH;
580 desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
583 desc.misc_flags = 0;
584 desc.structure_byte_stride = 0;
585
586 buffer->IDirect3DIndexBuffer8_iface.lpVtbl = &d3d8_indexbuffer_vtbl;
587 d3d8_resource_init(&buffer->resource);
589
591 hr = wined3d_buffer_create(device->wined3d_device, &desc, NULL, buffer,
594 if (FAILED(hr))
595 {
596 WARN("Failed to create wined3d buffer, hr %#x.\n", hr);
597 return hr;
598 }
599
600 buffer->parent_device = &device->IDirect3DDevice8_iface;
601 IDirect3DDevice8_AddRef(buffer->parent_device);
602
603 return D3D_OK;
604}
static const IDirect3DIndexBuffer8Vtbl d3d8_indexbuffer_vtbl
Definition: buffer.c:537
static const struct wined3d_parent_ops d3d8_indexbuffer_wined3d_parent_ops
Definition: buffer.c:565
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

Referenced by d3d8_device_CreateIndexBuffer(), and d3d9_device_CreateIndexBuffer().

◆ load_local_constants()

void load_local_constants ( const DWORD d3d8_elements,
struct wined3d_shader wined3d_vertex_shader 
)

Definition at line 152 of file vertexdeclaration.c.

153{
154 const DWORD *token = d3d8_elements;
155
156 while (*token != D3DVSD_END())
157 {
159 {
162 HRESULT hr;
163
164 if (TRACE_ON(d3d8))
165 {
166 DWORD i;
167 for (i = 0; i < count; ++i)
168 {
169 TRACE("c[%u] = (%8f, %8f, %8f, %8f)\n",
170 constant_idx,
171 *(const float *)(token + i * 4 + 1),
172 *(const float *)(token + i * 4 + 2),
173 *(const float *)(token + i * 4 + 3),
174 *(const float *)(token + i * 4 + 4));
175 }
176 }
178 constant_idx, (const float *)token + 1, count);
179 if (FAILED(hr)) ERR("Failed setting shader constants\n");
180 }
181
183 }
184}
size_t parse_token(const DWORD *pToken)
#define D3DVSD_CONSTADDRESSSHIFT
Definition: d3d8types.h:240
#define D3DVSD_CONSTCOUNTSHIFT
Definition: d3d8types.h:249
#define D3DVSD_CONSTCOUNTMASK
Definition: d3d8types.h:263
#define D3DVSD_CONSTADDRESSMASK
Definition: d3d8types.h:254
@ D3DVSD_TOKEN_CONSTMEM
Definition: d3d8types.h:169
HRESULT CDECL wined3d_shader_set_local_constants_float(struct wined3d_shader *shader, UINT start_idx, const float *src_data, UINT count)
Definition: shader.c:3411
#define TRACE_ON(x)
Definition: compat.h:75
GLuint GLuint GLsizei count
Definition: gl.h:1545
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

Referenced by d3d8_vertex_shader_init().

◆ parse_token()

size_t parse_token ( const DWORD pToken)

Definition at line 78 of file vertexdeclaration.c.

79{
80 const DWORD token = *pToken;
81 size_t tokenlen = 1;
82
83 switch ((token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT) { /* maybe a macro to inverse ... */
85 TRACE(" 0x%08x NOP()\n", token);
86 break;
87
90 {
91 TRACE(" 0x%08x STREAM_TESS()\n", token);
92 } else {
93 TRACE(" 0x%08x STREAM(%u)\n", token, ((token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT));
94 }
95 break;
96
98 if (token & 0x10000000)
99 {
100 TRACE(" 0x%08x SKIP(%u)\n", token, ((token & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT));
101 } else {
104 TRACE(" 0x%08x REG(%s, %s)\n", token, debug_d3dvsde_register(reg), debug_d3dvsdt_type(type));
105 }
106 break;
107
109 if (token & 0x10000000)
110 {
113 TRACE(" 0x%08x TESSUV(%s) as %s\n", token, debug_d3dvsde_register(reg), debug_d3dvsdt_type(type));
114 } else {
118 TRACE(" 0x%08x TESSNORMAL(%s, %s) as %s\n", token, debug_d3dvsde_register(regin),
120 }
121 break;
122
124 {
126 tokenlen = (4 * count) + 1;
127 }
128 break;
129
130 case D3DVSD_TOKEN_EXT:
131 {
134 TRACE(" 0x%08x EXT(%u, %u)\n", token, count, extinfo);
135 /* todo ... print extension */
136 tokenlen = count + 1;
137 }
138 break;
139
140 case D3DVSD_TOKEN_END:
141 TRACE(" 0x%08x END()\n", token);
142 break;
143
144 default:
145 TRACE(" 0x%08x UNKNOWN\n", token);
146 /* arg error */
147 }
148
149 return tokenlen;
150}
static const char * debug_d3dvsde_register(D3DVSDE_REGISTER d3dvsde_register)
static const char * debug_d3dvsdt_type(D3DVSDT_TYPE d3dvsdt_type)
#define D3DVSD_EXTINFOSHIFT
Definition: d3d8types.h:241
#define D3DVSD_SKIPCOUNTSHIFT
Definition: d3d8types.h:246
#define D3DVSD_EXTINFOMASK
Definition: d3d8types.h:255
#define D3DVSD_VERTEXREGINSHIFT
Definition: d3d8types.h:247
#define D3DVSD_SKIPCOUNTMASK
Definition: d3d8types.h:260
#define D3DVSD_VERTEXREGINMASK
Definition: d3d8types.h:262
#define D3DVSD_STREAMNUMBERMASK
Definition: d3d8types.h:256
#define D3DVSD_STREAMTESSMASK
Definition: d3d8types.h:265
@ D3DVSD_TOKEN_STREAM
Definition: d3d8types.h:166
@ D3DVSD_TOKEN_TESSELLATOR
Definition: d3d8types.h:168
@ D3DVSD_TOKEN_EXT
Definition: d3d8types.h:170
@ D3DVSD_TOKEN_END
Definition: d3d8types.h:172
@ D3DVSD_TOKEN_NOP
Definition: d3d8types.h:165
#define D3DVSD_STREAMNUMBERSHIFT
Definition: d3d8types.h:242

Referenced by convert_to_wined3d_declaration(), d3d8_vertex_shader_init(), and load_local_constants().

◆ surface_init()

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

Definition at line 317 of file surface.c.

319{
320 IDirect3DBaseTexture8 *texture;
321
323 d3d8_resource_init(&surface->resource);
324 surface->resource.refcount = 0;
325 list_init(&surface->rtv_entry);
328 surface->sub_resource_idx = sub_resource_idx;
329
330 if (surface->container && SUCCEEDED(IUnknown_QueryInterface(surface->container,
331 &IID_IDirect3DBaseTexture8, (void **)&texture)))
332 {
335 }
336
337 *parent_ops = &d3d8_surface_wined3d_parent_ops;
338}
struct d3d8_texture * unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture8 *iface) DECLSPEC_HIDDEN
Definition: texture.c:1061
static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops
Definition: surface.c:312
static const IDirect3DSurface8Vtbl d3d8_surface_vtbl
Definition: surface.c:287
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1121
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define IDirect3DBaseTexture8_Release(p)
Definition: d3d8.h:546
struct d3d8_resource resource
Definition: d3d8_private.h:177
IUnknown * container
Definition: d3d8_private.h:183

Referenced by device_parent_surface_created().

◆ texture_init()

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

Definition at line 1094 of file texture.c.

1096{
1098 DWORD flags = 0;
1099 HRESULT hr;
1100
1101 texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl;
1102 d3d8_resource_init(&texture->resource);
1103 list_init(&texture->rtv_list);
1104
1105 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1107 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1108 desc.multisample_quality = 0;
1109 desc.usage = usage & WINED3DUSAGE_MASK;
1110 desc.usage |= WINED3DUSAGE_TEXTURE;
1111 if (pool == D3DPOOL_SCRATCH)
1112 desc.usage |= WINED3DUSAGE_SCRATCH;
1115 desc.width = width;
1116 desc.height = height;
1117 desc.depth = 1;
1118 desc.size = 0;
1119
1122
1123 if (!levels)
1125
1127 hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, flags,
1128 NULL, texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
1130 if (FAILED(hr))
1131 {
1132 WARN("Failed to create wined3d texture, hr %#x.\n", hr);
1133 return hr;
1134 }
1135
1136 texture->parent_device = &device->IDirect3DDevice8_iface;
1137 IDirect3DDevice8_AddRef(texture->parent_device);
1138
1139 return D3D_OK;
1140}
static const IDirect3DTexture8Vtbl Direct3DTexture8_Vtbl
Definition: texture.c:351
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

Referenced by d3d8_device_CreateTexture(), d3d9_device_CreateTexture(), and wined3d_texture_create().

◆ unsafe_impl_from_IDirect3DBaseTexture8()

struct d3d8_texture * unsafe_impl_from_IDirect3DBaseTexture8 ( IDirect3DBaseTexture8 *  iface)

Definition at line 1061 of file texture.c.

1062{
1063 if (!iface)
1064 return NULL;
1065
1066 /* SetTexture() in particular doesn't do a lot of validation on the pointer
1067 * that gets passed in, and passing an invalid pointer works as long as the
1068 * application doesn't try to actually render anything with it, so we print
1069 * a WARN and return NULL instead of having the usual assert() here.
1070 * One application affected by this is Fishdom 2. */
1071 if (iface->lpVtbl != (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl
1072 && iface->lpVtbl != (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl
1073 && iface->lpVtbl != (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl)
1074 {
1075 WARN("%p is not a valid IDirect3DBaseTexture8 interface.\n", iface);
1076 return NULL;
1077 }
1078
1079 return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
1080}
static const IDirect3DVolumeTexture8Vtbl Direct3DVolumeTexture8_Vtbl
Definition: texture.c:1034

Referenced by d3d8_device_SetTexture(), d3d8_device_UpdateTexture(), and surface_init().

◆ unsafe_impl_from_IDirect3DIndexBuffer8()

struct d3d8_indexbuffer * unsafe_impl_from_IDirect3DIndexBuffer8 ( IDirect3DIndexBuffer8 *  iface)

Definition at line 606 of file buffer.c.

607{
608 if (!iface)
609 return NULL;
610 assert(iface->lpVtbl == &d3d8_indexbuffer_vtbl);
611
613}
static struct d3d8_indexbuffer * impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
Definition: buffer.c:322
#define assert(x)
Definition: debug.h:53

Referenced by d3d8_device_SetIndices().

◆ unsafe_impl_from_IDirect3DSurface8()

struct d3d8_surface * unsafe_impl_from_IDirect3DSurface8 ( IDirect3DSurface8 *  iface)

Definition at line 402 of file surface.c.

403{
404 if (!iface)
405 return NULL;
406 assert(iface->lpVtbl == &d3d8_surface_vtbl);
407
408 return impl_from_IDirect3DSurface8(iface);
409}
static struct d3d8_surface * impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
Definition: surface.c:26

Referenced by d3d8_device_CopyRects(), d3d8_device_GetFrontBuffer(), d3d8_device_SetCursorProperties(), and d3d8_device_SetRenderTarget().

◆ unsafe_impl_from_IDirect3DVertexBuffer8()

struct d3d8_vertexbuffer * unsafe_impl_from_IDirect3DVertexBuffer8 ( IDirect3DVertexBuffer8 *  iface)

Definition at line 313 of file buffer.c.

314{
315 if (!iface)
316 return NULL;
317 assert(iface->lpVtbl == &Direct3DVertexBuffer8_Vtbl);
318
320}
static struct d3d8_vertexbuffer * impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
Definition: buffer.c:24
static const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl
Definition: buffer.c:240

Referenced by d3d8_device_ProcessVertices(), and d3d8_device_SetStreamSource().

◆ vertexbuffer_init()

HRESULT vertexbuffer_init ( struct d3d8_vertexbuffer buffer,
struct d3d8_device device,
UINT  size,
DWORD  usage,
DWORD  fvf,
D3DPOOL  pool 
)

Definition at line 273 of file buffer.c.

275{
277 HRESULT hr;
278
279 if (pool == D3DPOOL_SCRATCH)
280 {
281 WARN("Vertex buffer with D3DPOOL_SCRATCH requested.\n");
282 return D3DERR_INVALIDCALL;
283 }
284
285 buffer->IDirect3DVertexBuffer8_iface.lpVtbl = &Direct3DVertexBuffer8_Vtbl;
286 d3d8_resource_init(&buffer->resource);
287 buffer->fvf = fvf;
288
289 desc.byte_width = size;
290 desc.usage = usage & WINED3DUSAGE_MASK;
291 desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
294 desc.misc_flags = 0;
295 desc.structure_byte_stride = 0;
296
298 hr = wined3d_buffer_create(device->wined3d_device, &desc, NULL, buffer,
301 if (FAILED(hr))
302 {
303 WARN("Failed to create wined3d buffer, hr %#x.\n", hr);
304 return hr;
305 }
306
307 buffer->parent_device = &device->IDirect3DDevice8_iface;
308 IDirect3DDevice8_AddRef(buffer->parent_device);
309
310 return D3D_OK;
311}
static const struct wined3d_parent_ops d3d8_vertexbuffer_wined3d_parent_ops
Definition: buffer.c:268
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:890

Referenced by d3d8_device_CreateVertexBuffer(), and d3d9_device_CreateVertexBuffer().

◆ volume_init()

void volume_init ( struct d3d8_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->IDirect3DVolume8_iface.lpVtbl = &d3d8_volume_vtbl;
213 d3d8_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 = &d3d8_volume_wined3d_parent_ops;
220}
static const IDirect3DVolume8Vtbl d3d8_volume_vtbl
Definition: volume.c:180
static const struct wined3d_parent_ops d3d8_volume_wined3d_parent_ops
Definition: volume.c:204

Referenced by device_parent_volume_created().

◆ volumetexture_init()

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

Definition at line 1190 of file texture.c.

1192{
1194 HRESULT hr;
1195
1196 texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl;
1197 d3d8_resource_init(&texture->resource);
1198 list_init(&texture->rtv_list);
1199
1200 desc.resource_type = WINED3D_RTYPE_TEXTURE_3D;
1202 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1203 desc.multisample_quality = 0;
1204 desc.usage = usage & WINED3DUSAGE_MASK;
1205 desc.usage |= WINED3DUSAGE_TEXTURE;
1206 if (pool == D3DPOOL_SCRATCH)
1207 desc.usage |= WINED3DUSAGE_SCRATCH;
1209 desc.width = width;
1210 desc.height = height;
1211 desc.depth = depth;
1212 desc.size = 0;
1213
1214 if (!levels)
1216
1218 hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, 0,
1219 NULL, texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
1221 if (FAILED(hr))
1222 {
1223 WARN("Failed to create wined3d volume texture, hr %#x.\n", hr);
1224 return hr;
1225 }
1226
1227 texture->parent_device = &device->IDirect3DDevice8_iface;
1228 IDirect3DDevice8_AddRef(texture->parent_device);
1229
1230 return D3D_OK;
1231}
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:701

Referenced by d3d8_device_CreateVolumeTexture(), d3d9_device_CreateVolumeTexture(), and wined3d_texture_create().

◆ wined3daccess_from_d3dpool()

◆ 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 cubetexture_init(), d3d8_CheckDepthStencilMatch(), d3d8_CheckDeviceFormat(), d3d8_CheckDeviceMultiSampleType(), d3d8_CheckDeviceType(), d3d9_CheckDepthStencilMatch(), d3d9_CheckDeviceFormat(), d3d9_CheckDeviceFormatConversion(), d3d9_CheckDeviceMultiSampleType(), d3d9_CheckDeviceType(), d3d9_EnumAdapterModes(), d3d9_EnumAdapterModesEx(), d3d9_GetAdapterModeCount(), d3d9_GetAdapterModeCountEx(), indexbuffer_init(), texture_init(), and volumetexture_init().

◆ 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

Referenced by d3d8_indexbuffer_Lock(), d3d8_surface_LockRect(), d3d8_vertexbuffer_Lock(), d3d8_volume_LockBox(), d3d9_indexbuffer_Lock(), d3d9_surface_LockRect(), d3d9_vertexbuffer_Lock(), and d3d9_volume_LockBox().