ReactOS 0.4.15-dev-7953-g1f49173
device.c File Reference
#include "config.h"
#include <math.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d8_private.h"
Include dependency graph for device.c:

Go to the source code of this file.

Classes

struct  tss_lookup
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d8)
 
static void STDMETHODCALLTYPE d3d8_null_wined3d_object_destroyed (void *parent)
 
D3DFORMAT d3dformat_from_wined3dformat (enum wined3d_format_id format)
 
enum wined3d_format_id wined3dformat_from_d3dformat (D3DFORMAT format)
 
unsigned int wined3dmapflags_from_d3dmapflags (unsigned int flags)
 
static UINT vertex_count_from_primitive_count (D3DPRIMITIVETYPE primitive_type, UINT primitive_count)
 
static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect (enum wined3d_swap_effect effect)
 
static void present_parameters_from_wined3d_swapchain_desc (D3DPRESENT_PARAMETERS *present_parameters, const struct wined3d_swapchain_desc *swapchain_desc)
 
static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect (D3DSWAPEFFECT effect)
 
static BOOL wined3d_swapchain_desc_from_present_parameters (struct wined3d_swapchain_desc *swapchain_desc, const D3DPRESENT_PARAMETERS *present_parameters)
 
void d3dcaps_from_wined3dcaps (D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps)
 
static DWORD d3d8_allocate_handle (struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type)
 
static voidd3d8_free_handle (struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
 
static voidd3d8_get_object (struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
 
static HRESULT WINAPI d3d8_device_QueryInterface (IDirect3DDevice8 *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3d8_device_AddRef (IDirect3DDevice8 *iface)
 
static ULONG WINAPI d3d8_device_Release (IDirect3DDevice8 *iface)
 
static HRESULT WINAPI d3d8_device_TestCooperativeLevel (IDirect3DDevice8 *iface)
 
static UINT WINAPI d3d8_device_GetAvailableTextureMem (IDirect3DDevice8 *iface)
 
static HRESULT WINAPI d3d8_device_ResourceManagerDiscardBytes (IDirect3DDevice8 *iface, DWORD byte_count)
 
static HRESULT WINAPI d3d8_device_GetDirect3D (IDirect3DDevice8 *iface, IDirect3D8 **d3d8)
 
static HRESULT WINAPI d3d8_device_GetDeviceCaps (IDirect3DDevice8 *iface, D3DCAPS8 *caps)
 
static HRESULT WINAPI d3d8_device_GetDisplayMode (IDirect3DDevice8 *iface, D3DDISPLAYMODE *mode)
 
static HRESULT WINAPI d3d8_device_GetCreationParameters (IDirect3DDevice8 *iface, D3DDEVICE_CREATION_PARAMETERS *parameters)
 
static HRESULT WINAPI d3d8_device_SetCursorProperties (IDirect3DDevice8 *iface, UINT hotspot_x, UINT hotspot_y, IDirect3DSurface8 *bitmap)
 
static void WINAPI d3d8_device_SetCursorPosition (IDirect3DDevice8 *iface, UINT x, UINT y, DWORD flags)
 
static BOOL WINAPI d3d8_device_ShowCursor (IDirect3DDevice8 *iface, BOOL show)
 
static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain (IDirect3DDevice8 *iface, D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain8 **swapchain)
 
static HRESULT CDECL reset_enum_callback (struct wined3d_resource *resource)
 
static HRESULT WINAPI d3d8_device_Reset (IDirect3DDevice8 *iface, D3DPRESENT_PARAMETERS *present_parameters)
 
static HRESULT WINAPI d3d8_device_Present (IDirect3DDevice8 *iface, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region)
 
static HRESULT WINAPI d3d8_device_GetBackBuffer (IDirect3DDevice8 *iface, UINT backbuffer_idx, D3DBACKBUFFER_TYPE backbuffer_type, IDirect3DSurface8 **backbuffer)
 
static HRESULT WINAPI d3d8_device_GetRasterStatus (IDirect3DDevice8 *iface, D3DRASTER_STATUS *raster_status)
 
static void WINAPI d3d8_device_SetGammaRamp (IDirect3DDevice8 *iface, DWORD flags, const D3DGAMMARAMP *ramp)
 
static void WINAPI d3d8_device_GetGammaRamp (IDirect3DDevice8 *iface, D3DGAMMARAMP *ramp)
 
static HRESULT WINAPI d3d8_device_CreateTexture (IDirect3DDevice8 *iface, UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DTexture8 **texture)
 
static HRESULT WINAPI d3d8_device_CreateVolumeTexture (IDirect3DDevice8 *iface, UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DVolumeTexture8 **texture)
 
static HRESULT WINAPI d3d8_device_CreateCubeTexture (IDirect3DDevice8 *iface, UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DCubeTexture8 **texture)
 
static HRESULT WINAPI d3d8_device_CreateVertexBuffer (IDirect3DDevice8 *iface, UINT size, DWORD usage, DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer8 **buffer)
 
static HRESULT WINAPI d3d8_device_CreateIndexBuffer (IDirect3DDevice8 *iface, UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer8 **buffer)
 
static HRESULT d3d8_device_create_surface (struct d3d8_device *device, UINT width, UINT height, D3DFORMAT format, DWORD flags, IDirect3DSurface8 **surface, UINT usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality)
 
static HRESULT WINAPI d3d8_device_CreateRenderTarget (IDirect3DDevice8 *iface, UINT width, UINT height, D3DFORMAT format, D3DMULTISAMPLE_TYPE multisample_type, BOOL lockable, IDirect3DSurface8 **surface)
 
static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface (IDirect3DDevice8 *iface, UINT width, UINT height, D3DFORMAT format, D3DMULTISAMPLE_TYPE multisample_type, IDirect3DSurface8 **surface)
 
static HRESULT WINAPI d3d8_device_CreateImageSurface (IDirect3DDevice8 *iface, UINT width, UINT height, D3DFORMAT format, IDirect3DSurface8 **surface)
 
static HRESULT WINAPI d3d8_device_CopyRects (IDirect3DDevice8 *iface, IDirect3DSurface8 *src_surface, const RECT *src_rects, UINT rect_count, IDirect3DSurface8 *dst_surface, const POINT *dst_points)
 
static HRESULT WINAPI d3d8_device_UpdateTexture (IDirect3DDevice8 *iface, IDirect3DBaseTexture8 *src_texture, IDirect3DBaseTexture8 *dst_texture)
 
static HRESULT WINAPI d3d8_device_GetFrontBuffer (IDirect3DDevice8 *iface, IDirect3DSurface8 *dst_surface)
 
static HRESULT WINAPI d3d8_device_SetRenderTarget (IDirect3DDevice8 *iface, IDirect3DSurface8 *render_target, IDirect3DSurface8 *depth_stencil)
 
static HRESULT WINAPI d3d8_device_GetRenderTarget (IDirect3DDevice8 *iface, IDirect3DSurface8 **render_target)
 
static HRESULT WINAPI d3d8_device_GetDepthStencilSurface (IDirect3DDevice8 *iface, IDirect3DSurface8 **depth_stencil)
 
static HRESULT WINAPI d3d8_device_BeginScene (IDirect3DDevice8 *iface)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_device_EndScene (IDirect3DDevice8 *iface)
 
static HRESULT WINAPI d3d8_device_Clear (IDirect3DDevice8 *iface, DWORD rect_count, const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
 
static HRESULT WINAPI d3d8_device_SetTransform (IDirect3DDevice8 *iface, D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix)
 
static HRESULT WINAPI d3d8_device_GetTransform (IDirect3DDevice8 *iface, D3DTRANSFORMSTATETYPE state, D3DMATRIX *matrix)
 
static HRESULT WINAPI d3d8_device_MultiplyTransform (IDirect3DDevice8 *iface, D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix)
 
static HRESULT WINAPI d3d8_device_SetViewport (IDirect3DDevice8 *iface, const D3DVIEWPORT8 *viewport)
 
static HRESULT WINAPI d3d8_device_GetViewport (IDirect3DDevice8 *iface, D3DVIEWPORT8 *viewport)
 
static HRESULT WINAPI d3d8_device_SetMaterial (IDirect3DDevice8 *iface, const D3DMATERIAL8 *material)
 
static HRESULT WINAPI d3d8_device_GetMaterial (IDirect3DDevice8 *iface, D3DMATERIAL8 *material)
 
static HRESULT WINAPI d3d8_device_SetLight (IDirect3DDevice8 *iface, DWORD index, const D3DLIGHT8 *light)
 
static HRESULT WINAPI d3d8_device_GetLight (IDirect3DDevice8 *iface, DWORD index, D3DLIGHT8 *light)
 
static HRESULT WINAPI d3d8_device_LightEnable (IDirect3DDevice8 *iface, DWORD index, BOOL enable)
 
static HRESULT WINAPI d3d8_device_GetLightEnable (IDirect3DDevice8 *iface, DWORD index, BOOL *enable)
 
static HRESULT WINAPI d3d8_device_SetClipPlane (IDirect3DDevice8 *iface, DWORD index, const float *plane)
 
static HRESULT WINAPI d3d8_device_GetClipPlane (IDirect3DDevice8 *iface, DWORD index, float *plane)
 
static HRESULT WINAPI d3d8_device_SetRenderState (IDirect3DDevice8 *iface, D3DRENDERSTATETYPE state, DWORD value)
 
static HRESULT WINAPI d3d8_device_GetRenderState (IDirect3DDevice8 *iface, D3DRENDERSTATETYPE state, DWORD *value)
 
static HRESULT WINAPI d3d8_device_BeginStateBlock (IDirect3DDevice8 *iface)
 
static HRESULT WINAPI d3d8_device_EndStateBlock (IDirect3DDevice8 *iface, DWORD *token)
 
static HRESULT WINAPI d3d8_device_ApplyStateBlock (IDirect3DDevice8 *iface, DWORD token)
 
static HRESULT WINAPI d3d8_device_CaptureStateBlock (IDirect3DDevice8 *iface, DWORD token)
 
static HRESULT WINAPI d3d8_device_DeleteStateBlock (IDirect3DDevice8 *iface, DWORD token)
 
static HRESULT WINAPI d3d8_device_CreateStateBlock (IDirect3DDevice8 *iface, D3DSTATEBLOCKTYPE type, DWORD *handle)
 
static HRESULT WINAPI d3d8_device_SetClipStatus (IDirect3DDevice8 *iface, const D3DCLIPSTATUS8 *clip_status)
 
static HRESULT WINAPI d3d8_device_GetClipStatus (IDirect3DDevice8 *iface, D3DCLIPSTATUS8 *clip_status)
 
static HRESULT WINAPI d3d8_device_GetTexture (IDirect3DDevice8 *iface, DWORD stage, IDirect3DBaseTexture8 **texture)
 
static HRESULT WINAPI d3d8_device_SetTexture (IDirect3DDevice8 *iface, DWORD stage, IDirect3DBaseTexture8 *texture)
 
static HRESULT WINAPI d3d8_device_GetTextureStageState (IDirect3DDevice8 *iface, DWORD stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *value)
 
static HRESULT WINAPI d3d8_device_SetTextureStageState (IDirect3DDevice8 *iface, DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value)
 
static HRESULT WINAPI d3d8_device_ValidateDevice (IDirect3DDevice8 *iface, DWORD *pass_count)
 
static HRESULT WINAPI d3d8_device_GetInfo (IDirect3DDevice8 *iface, DWORD info_id, void *info, DWORD info_size)
 
static HRESULT WINAPI d3d8_device_SetPaletteEntries (IDirect3DDevice8 *iface, UINT palette_idx, const PALETTEENTRY *entries)
 
static HRESULT WINAPI d3d8_device_GetPaletteEntries (IDirect3DDevice8 *iface, UINT palette_idx, PALETTEENTRY *entries)
 
static HRESULT WINAPI d3d8_device_SetCurrentTexturePalette (IDirect3DDevice8 *iface, UINT palette_idx)
 
static HRESULT WINAPI d3d8_device_GetCurrentTexturePalette (IDirect3DDevice8 *iface, UINT *palette_idx)
 
static HRESULT WINAPI d3d8_device_DrawPrimitive (IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT start_vertex, UINT primitive_count)
 
static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive (IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count, UINT start_idx, UINT primitive_count)
 
static HRESULT d3d8_device_prepare_vertex_buffer (struct d3d8_device *device, UINT min_size)
 
static HRESULT WINAPI d3d8_device_DrawPrimitiveUP (IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT primitive_count, const void *data, UINT stride)
 
static HRESULT d3d8_device_prepare_index_buffer (struct d3d8_device *device, UINT min_size)
 
static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP (IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count, UINT primitive_count, const void *index_data, D3DFORMAT index_format, const void *vertex_data, UINT vertex_stride)
 
static HRESULT WINAPI d3d8_device_ProcessVertices (IDirect3DDevice8 *iface, UINT src_start_idx, UINT dst_idx, UINT vertex_count, IDirect3DVertexBuffer8 *dst_buffer, DWORD flags)
 
static HRESULT WINAPI d3d8_device_CreateVertexShader (IDirect3DDevice8 *iface, const DWORD *declaration, const DWORD *byte_code, DWORD *shader, DWORD usage)
 
static struct d3d8_vertex_declarationd3d8_device_get_fvf_declaration (struct d3d8_device *device, DWORD fvf)
 
static HRESULT WINAPI d3d8_device_SetVertexShader (IDirect3DDevice8 *iface, DWORD shader)
 
static HRESULT WINAPI d3d8_device_GetVertexShader (IDirect3DDevice8 *iface, DWORD *shader)
 
static HRESULT WINAPI d3d8_device_DeleteVertexShader (IDirect3DDevice8 *iface, DWORD shader)
 
static HRESULT WINAPI d3d8_device_SetVertexShaderConstant (IDirect3DDevice8 *iface, DWORD start_register, const void *data, DWORD count)
 
static HRESULT WINAPI d3d8_device_GetVertexShaderConstant (IDirect3DDevice8 *iface, DWORD start_register, void *data, DWORD count)
 
static HRESULT WINAPI d3d8_device_GetVertexShaderDeclaration (IDirect3DDevice8 *iface, DWORD shader, void *data, DWORD *data_size)
 
static HRESULT WINAPI d3d8_device_GetVertexShaderFunction (IDirect3DDevice8 *iface, DWORD shader, void *data, DWORD *data_size)
 
static HRESULT WINAPI d3d8_device_SetIndices (IDirect3DDevice8 *iface, IDirect3DIndexBuffer8 *buffer, UINT base_vertex_idx)
 
static HRESULT WINAPI d3d8_device_GetIndices (IDirect3DDevice8 *iface, IDirect3DIndexBuffer8 **buffer, UINT *base_vertex_index)
 
static HRESULT WINAPI d3d8_device_CreatePixelShader (IDirect3DDevice8 *iface, const DWORD *byte_code, DWORD *shader)
 
static HRESULT WINAPI d3d8_device_SetPixelShader (IDirect3DDevice8 *iface, DWORD shader)
 
static HRESULT WINAPI d3d8_device_GetPixelShader (IDirect3DDevice8 *iface, DWORD *shader)
 
static HRESULT WINAPI d3d8_device_DeletePixelShader (IDirect3DDevice8 *iface, DWORD shader)
 
static HRESULT WINAPI d3d8_device_SetPixelShaderConstant (IDirect3DDevice8 *iface, DWORD start_register, const void *data, DWORD count)
 
static HRESULT WINAPI d3d8_device_GetPixelShaderConstant (IDirect3DDevice8 *iface, DWORD start_register, void *data, DWORD count)
 
static HRESULT WINAPI d3d8_device_GetPixelShaderFunction (IDirect3DDevice8 *iface, DWORD shader, void *data, DWORD *data_size)
 
static HRESULT WINAPI d3d8_device_DrawRectPatch (IDirect3DDevice8 *iface, UINT handle, const float *segment_count, const D3DRECTPATCH_INFO *patch_info)
 
static HRESULT WINAPI d3d8_device_DrawTriPatch (IDirect3DDevice8 *iface, UINT handle, const float *segment_count, const D3DTRIPATCH_INFO *patch_info)
 
static HRESULT WINAPI d3d8_device_DeletePatch (IDirect3DDevice8 *iface, UINT handle)
 
static HRESULT WINAPI d3d8_device_SetStreamSource (IDirect3DDevice8 *iface, UINT stream_idx, IDirect3DVertexBuffer8 *buffer, UINT stride)
 
static HRESULT WINAPI d3d8_device_GetStreamSource (IDirect3DDevice8 *iface, UINT stream_idx, IDirect3DVertexBuffer8 **buffer, UINT *stride)
 
static struct d3d8_devicedevice_from_device_parent (struct wined3d_device_parent *device_parent)
 
static void CDECL device_parent_wined3d_device_created (struct wined3d_device_parent *device_parent, struct wined3d_device *device)
 
static void CDECL device_parent_mode_changed (struct wined3d_device_parent *device_parent)
 
static void CDECL device_parent_activate (struct wined3d_device_parent *device_parent, BOOL activate)
 
static HRESULT CDECL device_parent_surface_created (struct wined3d_device_parent *device_parent, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, void **parent, const struct wined3d_parent_ops **parent_ops)
 
static HRESULT CDECL device_parent_volume_created (struct wined3d_device_parent *device_parent, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, void **parent, const struct wined3d_parent_ops **parent_ops)
 
static HRESULT CDECL device_parent_create_swapchain_texture (struct wined3d_device_parent *device_parent, void *container_parent, const struct wined3d_resource_desc *desc, DWORD texture_flags, struct wined3d_texture **texture)
 
static HRESULT CDECL device_parent_create_swapchain (struct wined3d_device_parent *device_parent, struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
 
static void setup_fpu (void)
 
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)
 

Variables

static const struct wined3d_parent_ops d3d8_null_wined3d_parent_ops
 
static const struct tss_lookup tss_lookup []
 
static const struct IDirect3DDevice8Vtbl d3d8_device_vtbl
 
static const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops
 

Function Documentation

◆ d3d8_allocate_handle()

static DWORD d3d8_allocate_handle ( struct d3d8_handle_table t,
void object,
enum d3d8_handle_type  type 
)
static

Definition at line 361 of file device.c.

362{
363 struct d3d8_handle_entry *entry;
364
365 if (t->free_entries)
366 {
367 DWORD index = t->free_entries - t->entries;
368 /* Use a free handle */
369 entry = t->free_entries;
370 if (entry->type != D3D8_HANDLE_FREE)
371 {
372 ERR("Handle %u(%p) is in the free list, but has type %#x.\n", index, entry, entry->type);
373 return D3D8_INVALID_HANDLE;
374 }
375 t->free_entries = entry->object;
376 entry->object = object;
377 entry->type = type;
378
379 return index;
380 }
381
382 if (!(t->entry_count < t->table_size))
383 {
384 /* Grow the table */
385 UINT new_size = t->table_size + (t->table_size >> 1);
386 struct d3d8_handle_entry *new_entries;
387
388 if (!(new_entries = heap_realloc(t->entries, new_size * sizeof(*t->entries))))
389 {
390 ERR("Failed to grow the handle table.\n");
391 return D3D8_INVALID_HANDLE;
392 }
393 t->entries = new_entries;
394 t->table_size = new_size;
395 }
396
397 entry = &t->entries[t->entry_count];
398 entry->object = object;
399 entry->type = type;
400
401 return t->entry_count++;
402}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define index(s, c)
Definition: various.h:29
#define ERR(fmt,...)
Definition: debug.h:110
#define D3D8_INVALID_HANDLE
Definition: d3d8_private.h:61
@ D3D8_HANDLE_FREE
Definition: d3d8_private.h:65
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble GLdouble t
Definition: gl.h:2047
GLuint index
Definition: glext.h:6031
uint32_t entry
Definition: isohybrid.c:63
unsigned int UINT
Definition: ndis.h:50
Definition: d3d8_private.h:72
void * object
Definition: d3d8_private.h:73

Referenced by d3d8_device_CreatePixelShader(), d3d8_device_CreateStateBlock(), d3d8_device_CreateVertexShader(), and d3d8_device_EndStateBlock().

◆ d3d8_device_AddRef()

static ULONG WINAPI d3d8_device_AddRef ( IDirect3DDevice8 *  iface)
static

Definition at line 469 of file device.c.

470{
473
474 TRACE("%p increasing refcount to %u.\n", iface, ref);
475
476 return ref;
477}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3d8_device * impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface)
Definition: d3d8_private.h:132
#define TRACE(s)
Definition: solgame.cpp:4
Definition: devices.h:37
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ d3d8_device_ApplyStateBlock()

static HRESULT WINAPI d3d8_device_ApplyStateBlock ( IDirect3DDevice8 *  iface,
DWORD  token 
)
static

Definition at line 1783 of file device.c.

1784{
1786 struct wined3d_stateblock *stateblock;
1787
1788 TRACE("iface %p, token %#x.\n", iface, token);
1789
1790 if (!token)
1791 return D3D_OK;
1792
1794 stateblock = d3d8_get_object(&device->handle_table, token - 1, D3D8_HANDLE_SB);
1795 if (!stateblock)
1796 {
1797 WARN("Invalid handle (%#x) passed.\n", token);
1799 return D3DERR_INVALIDCALL;
1800 }
1801 wined3d_stateblock_apply(stateblock);
1803
1804 return D3D_OK;
1805}
#define WARN(fmt,...)
Definition: debug.h:112
@ D3D8_HANDLE_SB
Definition: d3d8_private.h:68
#define D3D_OK
Definition: d3d.h:106
#define D3DERR_INVALIDCALL
static void * d3d8_get_object(struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
Definition: device.c:430
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
void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
Definition: stateblock.c:965
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368

◆ d3d8_device_BeginScene()

static HRESULT WINAPI d3d8_device_BeginScene ( IDirect3DDevice8 *  iface)
static

Definition at line 1429 of file device.c.

1430{
1432 HRESULT hr;
1433
1434 TRACE("iface %p.\n", iface);
1435
1437 hr = wined3d_device_begin_scene(device->wined3d_device);
1439
1440 return hr;
1441}
HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device)
Definition: device.c:3602
HRESULT hr
Definition: shlfolder.c:183

◆ d3d8_device_BeginStateBlock()

static HRESULT WINAPI d3d8_device_BeginStateBlock ( IDirect3DDevice8 *  iface)
static

Definition at line 1731 of file device.c.

1732{
1734 HRESULT hr;
1735
1736 TRACE("iface %p.\n", iface);
1737
1739 hr = wined3d_device_begin_stateblock(device->wined3d_device);
1741
1742 return hr;
1743}
HRESULT CDECL wined3d_device_begin_stateblock(struct wined3d_device *device)
Definition: device.c:3555

◆ d3d8_device_CaptureStateBlock()

static HRESULT WINAPI d3d8_device_CaptureStateBlock ( IDirect3DDevice8 *  iface,
DWORD  token 
)
static

Definition at line 1807 of file device.c.

1808{
1810 struct wined3d_stateblock *stateblock;
1811
1812 TRACE("iface %p, token %#x.\n", iface, token);
1813
1815 stateblock = d3d8_get_object(&device->handle_table, token - 1, D3D8_HANDLE_SB);
1816 if (!stateblock)
1817 {
1818 WARN("Invalid handle (%#x) passed.\n", token);
1820 return D3DERR_INVALIDCALL;
1821 }
1822 wined3d_stateblock_capture(stateblock);
1824
1825 return D3D_OK;
1826}
void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:684

◆ d3d8_device_Clear()

static HRESULT WINAPI d3d8_device_Clear ( IDirect3DDevice8 *  iface,
DWORD  rect_count,
const D3DRECT rects,
DWORD  flags,
D3DCOLOR  color,
float  z,
DWORD  stencil 
)
static

Definition at line 1457 of file device.c.

1459{
1460 const struct wined3d_color c =
1461 {
1462 ((color >> 16) & 0xff) / 255.0f,
1463 ((color >> 8) & 0xff) / 255.0f,
1464 (color & 0xff) / 255.0f,
1465 ((color >> 24) & 0xff) / 255.0f,
1466 };
1468 HRESULT hr;
1469
1470 TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n",
1471 iface, rect_count, rects, flags, color, z, stencil);
1472
1473 if (rect_count && !rects)
1474 {
1475 WARN("count %u with NULL rects.\n", rect_count);
1476 rect_count = 0;
1477 }
1478
1480 hr = wined3d_device_clear(device->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
1482
1483 return hr;
1484}
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
Definition: device.c:3633
GLuint color
Definition: glext.h:6243
const GLubyte * c
Definition: glext.h:8905
GLbitfield flags
Definition: glext.h:7161
GLint GLfloat GLint stencil
Definition: glext.h:6260
GLdouble GLdouble z
Definition: glext.h:5874

◆ d3d8_device_CopyRects()

static HRESULT WINAPI d3d8_device_CopyRects ( IDirect3DDevice8 *  iface,
IDirect3DSurface8 *  src_surface,
const RECT src_rects,
UINT  rect_count,
IDirect3DSurface8 *  dst_surface,
const POINT dst_points 
)
static

Definition at line 1163 of file device.c.

1166{
1169 enum wined3d_format_id src_format, dst_format;
1170 struct wined3d_sub_resource_desc wined3d_desc;
1171 UINT src_w, src_h;
1172
1173 TRACE("iface %p, src_surface %p, src_rects %p, rect_count %u, dst_surface %p, dst_points %p.\n",
1174 iface, src_surface, src_rects, rect_count, dst_surface, dst_points);
1175
1176 /* Check that the source texture is in WINED3D_POOL_SYSTEM_MEM and the
1177 * destination texture is in WINED3D_POOL_DEFAULT. */
1178
1180 wined3d_texture_get_sub_resource_desc(src->wined3d_texture, src->sub_resource_idx, &wined3d_desc);
1181 if (wined3d_desc.usage & WINED3DUSAGE_DEPTHSTENCIL)
1182 {
1183 WARN("Source %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", src_surface);
1185 return D3DERR_INVALIDCALL;
1186 }
1187 src_format = wined3d_desc.format;
1188 src_w = wined3d_desc.width;
1189 src_h = wined3d_desc.height;
1190
1191 wined3d_texture_get_sub_resource_desc(dst->wined3d_texture, dst->sub_resource_idx, &wined3d_desc);
1192 if (wined3d_desc.usage & WINED3DUSAGE_DEPTHSTENCIL)
1193 {
1194 WARN("Destination %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", dst_surface);
1196 return D3DERR_INVALIDCALL;
1197 }
1198 dst_format = wined3d_desc.format;
1199
1200 /* Check that the source and destination formats match */
1201 if (src_format != dst_format)
1202 {
1203 WARN("Source %p format must match the destination %p format, returning D3DERR_INVALIDCALL.\n",
1204 src_surface, dst_surface);
1206 return D3DERR_INVALIDCALL;
1207 }
1208
1209 /* Quick if complete copy ... */
1210 if (!rect_count && !src_rects && !dst_points)
1211 {
1212 RECT rect = {0, 0, src_w, src_h};
1213 wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &rect,
1214 src->wined3d_texture, src->sub_resource_idx, &rect, 0, NULL, WINED3D_TEXF_POINT);
1215 }
1216 else
1217 {
1218 unsigned int i;
1219 /* Copy rect by rect */
1220 if (src_rects && dst_points)
1221 {
1222 for (i = 0; i < rect_count; ++i)
1223 {
1224 UINT w = src_rects[i].right - src_rects[i].left;
1225 UINT h = src_rects[i].bottom - src_rects[i].top;
1226 RECT dst_rect = {dst_points[i].x, dst_points[i].y,
1227 dst_points[i].x + w, dst_points[i].y + h};
1228
1229 wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
1230 src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
1231 }
1232 }
1233 else
1234 {
1235 for (i = 0; i < rect_count; ++i)
1236 {
1237 UINT w = src_rects[i].right - src_rects[i].left;
1238 UINT h = src_rects[i].bottom - src_rects[i].top;
1239 RECT dst_rect = {0, 0, w, h};
1240
1241 wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
1242 src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
1243 }
1244 }
1245 }
1247
1248 return WINED3D_OK;
1249}
struct d3d8_surface * unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN
Definition: surface.c:402
#define NULL
Definition: types.h:112
HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc)
Definition: texture.c:3480
HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: texture.c:3262
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const char * dst_format
Definition: dib.c:1133
& rect
Definition: startmenu.cpp:1413
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define WINED3D_OK
Definition: wined3d.h:37
@ WINED3D_TEXF_POINT
Definition: wined3d.h:686
wined3d_format_id
Definition: wined3d.h:106
#define WINED3DUSAGE_DEPTHSTENCIL
Definition: wined3d.h:900

◆ d3d8_device_create_surface()

static HRESULT d3d8_device_create_surface ( struct d3d8_device device,
UINT  width,
UINT  height,
D3DFORMAT  format,
DWORD  flags,
IDirect3DSurface8 **  surface,
UINT  usage,
D3DPOOL  pool,
D3DMULTISAMPLE_TYPE  multisample_type,
DWORD  multisample_quality 
)
static

Definition at line 1059 of file device.c.

1062{
1064 struct d3d8_surface *surface_impl;
1065 struct wined3d_texture *texture;
1066 HRESULT hr;
1067
1068 TRACE("device %p, width %u, height %u, format %#x, flags %#x, surface %p, "
1069 "usage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n",
1070 device, width, height, format, flags, surface,
1071 usage, pool, multisample_type, multisample_quality);
1072
1073 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1075 desc.multisample_type = multisample_type;
1076 desc.multisample_quality = multisample_quality;
1077 desc.usage = usage & WINED3DUSAGE_MASK;
1078 if (pool == D3DPOOL_SCRATCH)
1079 desc.usage |= WINED3DUSAGE_SCRATCH;
1082 desc.width = width;
1083 desc.height = height;
1084 desc.depth = 1;
1085 desc.size = 0;
1086
1088
1089 if (FAILED(hr = wined3d_texture_create(device->wined3d_device, &desc,
1091 {
1093 WARN("Failed to create texture, hr %#x.\n", hr);
1094 return hr;
1095 }
1096
1098 surface_impl->parent_device = &device->IDirect3DDevice8_iface;
1099 *surface = &surface_impl->IDirect3DSurface8_iface;
1100 IDirect3DSurface8_AddRef(*surface);
1102
1104
1105 return D3D_OK;
1106}
static unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int usage)
Definition: d3d8_private.h:301
@ D3DPOOL_SCRATCH
Definition: d3d8types.h:712
static const struct wined3d_parent_ops d3d8_null_wined3d_parent_ops
Definition: device.c:39
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format)
Definition: device.c:94
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
void *CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: texture.c:3449
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1023
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
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 IDirect3DSurface8_AddRef(p)
Definition: d3d8.h:309
IDirect3DDevice8 * parent_device
Definition: d3d8_private.h:182
IDirect3DSurface8 IDirect3DSurface8_iface
Definition: d3d8_private.h:176
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
#define WINED3DUSAGE_MASK
Definition: wined3d.h:913
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:915
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58

Referenced by d3d8_device_CreateDepthStencilSurface(), d3d8_device_CreateImageSurface(), and d3d8_device_CreateRenderTarget().

◆ d3d8_device_CreateAdditionalSwapChain()

static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain ( IDirect3DDevice8 *  iface,
D3DPRESENT_PARAMETERS present_parameters,
IDirect3DSwapChain8 **  swapchain 
)
static

Definition at line 695 of file device.c.

697{
700 struct d3d8_swapchain *object;
701 UINT i, count;
702 HRESULT hr;
703
704 TRACE("iface %p, present_parameters %p, swapchain %p.\n",
705 iface, present_parameters, swapchain);
706
707 if (!present_parameters->Windowed)
708 {
709 WARN("Trying to create an additional fullscreen swapchain, returning D3DERR_INVALIDCALL.\n");
710 return D3DERR_INVALIDCALL;
711 }
712
715 for (i = 0; i < count; ++i)
716 {
718
721
722 if (!desc.windowed)
723 {
725 WARN("Trying to create an additional swapchain in fullscreen mode, returning D3DERR_INVALIDCALL.\n");
726 return D3DERR_INVALIDCALL;
727 }
728 }
730
731 if (!wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters))
732 return D3DERR_INVALIDCALL;
733 if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, &object)))
734 *swapchain = &object->IDirect3DSwapChain8_iface;
736
737 return hr;
738}
HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapchain_desc *desc, struct d3d8_swapchain **swapchain) DECLSPEC_HIDDEN
Definition: swapchain.c:194
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
struct wined3d_swapchain *CDECL wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx)
Definition: device.c:533
UINT CDECL wined3d_device_get_swapchain_count(const struct wined3d_device *device)
Definition: device.c:526
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define SUCCEEDED(hr)
Definition: intsafe.h:50
void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:271

◆ d3d8_device_CreateCubeTexture()

static HRESULT WINAPI d3d8_device_CreateCubeTexture ( IDirect3DDevice8 *  iface,
UINT  edge_length,
UINT  levels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
IDirect3DCubeTexture8 **  texture 
)
static

Definition at line 974 of file device.c.

976{
978 struct d3d8_texture *object;
979 HRESULT hr;
980
981 TRACE("iface %p, edge_length %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.\n",
982 iface, edge_length, levels, usage, format, pool, texture);
983
984 if (!format)
985 return D3DERR_INVALIDCALL;
986
987 *texture = NULL;
988 if (!(object = heap_alloc_zero(sizeof(*object))))
990
991 hr = cubetexture_init(object, device, edge_length, levels, usage, format, pool);
992 if (FAILED(hr))
993 {
994 WARN("Failed to initialize cube texture, hr %#x.\n", hr);
995 heap_free(object);
996 return hr;
997 }
998
999 TRACE("Created cube texture %p.\n", object);
1000 *texture = (IDirect3DCubeTexture8 *)&object->IDirect3DBaseTexture8_iface;
1001
1002 return hr;
1003}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *device, UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN
Definition: texture.c:1142
GLsizei levels
Definition: glext.h:7884
#define D3DERR_OUTOFVIDEOMEMORY
Definition: d3d8.h:85

◆ d3d8_device_CreateDepthStencilSurface()

static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface ( IDirect3DDevice8 *  iface,
UINT  width,
UINT  height,
D3DFORMAT  format,
D3DMULTISAMPLE_TYPE  multisample_type,
IDirect3DSurface8 **  surface 
)
static

Definition at line 1129 of file device.c.

1132{
1134
1135 TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, surface %p.\n",
1136 iface, width, height, format, multisample_type, surface);
1137
1138 if (!format)
1139 return D3DERR_INVALIDCALL;
1140
1141 *surface = NULL;
1142
1143 /* TODO: Verify that Discard is false */
1145 surface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, multisample_type, 0);
1146}
@ D3DPOOL_DEFAULT
Definition: d3d8types.h:709
#define D3DUSAGE_DEPTHSTENCIL
Definition: d3d8types.h:92
static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width, UINT height, D3DFORMAT format, DWORD flags, IDirect3DSurface8 **surface, UINT usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality)
Definition: device.c:1059
#define WINED3D_TEXTURE_CREATE_MAPPABLE
Definition: wined3d.h:1558

◆ d3d8_device_CreateImageSurface()

static HRESULT WINAPI d3d8_device_CreateImageSurface ( IDirect3DDevice8 *  iface,
UINT  width,
UINT  height,
D3DFORMAT  format,
IDirect3DSurface8 **  surface 
)
static

Definition at line 1149 of file device.c.

1151{
1153
1154 TRACE("iface %p, width %u, height %u, format %#x, surface %p.\n",
1155 iface, width, height, format, surface);
1156
1157 *surface = NULL;
1158
1160 surface, 0, D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE, 0);
1161}
@ D3DMULTISAMPLE_NONE
Definition: d3d8types.h:672
@ D3DPOOL_SYSTEMMEM
Definition: d3d8types.h:711

◆ d3d8_device_CreateIndexBuffer()

static HRESULT WINAPI d3d8_device_CreateIndexBuffer ( IDirect3DDevice8 *  iface,
UINT  size,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
IDirect3DIndexBuffer8 **  buffer 
)
static

Definition at line 1032 of file device.c.

1034{
1036 struct d3d8_indexbuffer *object;
1037 HRESULT hr;
1038
1039 TRACE("iface %p, size %u, usage %#x, format %#x, pool %#x, buffer %p.\n",
1040 iface, size, usage, format, pool, buffer);
1041
1042 if (!(object = heap_alloc_zero(sizeof(*object))))
1044
1046 if (FAILED(hr))
1047 {
1048 WARN("Failed to initialize index buffer, hr %#x.\n", hr);
1049 heap_free(object);
1050 return hr;
1051 }
1052
1053 TRACE("Created index buffer %p.\n", object);
1054 *buffer = &object->IDirect3DIndexBuffer8_iface;
1055
1056 return D3D_OK;
1057}
HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *device, UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: buffer.c:570
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915

◆ d3d8_device_CreatePixelShader()

static HRESULT WINAPI d3d8_device_CreatePixelShader ( IDirect3DDevice8 *  iface,
const DWORD byte_code,
DWORD shader 
)
static

Definition at line 2775 of file device.c.

2777{
2779 struct d3d8_pixel_shader *object;
2780 DWORD shader_handle;
2781 DWORD handle;
2782 HRESULT hr;
2783
2784 TRACE("iface %p, byte_code %p, shader %p.\n", iface, byte_code, shader);
2785
2786 if (!shader)
2787 return D3DERR_INVALIDCALL;
2788
2789 if (!(object = heap_alloc_zero(sizeof(*object))))
2790 return E_OUTOFMEMORY;
2791
2793 handle = d3d8_allocate_handle(&device->handle_table, object, D3D8_HANDLE_PS);
2796 {
2797 ERR("Failed to allocate pixel shader handle.\n");
2798 heap_free(object);
2799 return E_OUTOFMEMORY;
2800 }
2801
2802 shader_handle = handle + VS_HIGHESTFIXEDFXF + 1;
2803
2804 hr = d3d8_pixel_shader_init(object, device, byte_code, shader_handle);
2805 if (FAILED(hr))
2806 {
2807 WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
2809 d3d8_free_handle(&device->handle_table, handle, D3D8_HANDLE_PS);
2811 heap_free(object);
2812 *shader = 0;
2813 return hr;
2814 }
2815
2816 TRACE("Created pixel shader %p (handle %#x).\n", object, shader_handle);
2817 *shader = shader_handle;
2818
2819 return D3D_OK;
2820}
#define VS_HIGHESTFIXEDFXF
Definition: d3d8_private.h:43
HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_device *device, const DWORD *byte_code, DWORD shader_handle) DECLSPEC_HIDDEN
Definition: shader.c:162
@ D3D8_HANDLE_PS
Definition: d3d8_private.h:67
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type)
Definition: device.c:361
static void * d3d8_free_handle(struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
Definition: device.c:404
GLuint shader
Definition: glext.h:6030

◆ d3d8_device_CreateRenderTarget()

static HRESULT WINAPI d3d8_device_CreateRenderTarget ( IDirect3DDevice8 *  iface,
UINT  width,
UINT  height,
D3DFORMAT  format,
D3DMULTISAMPLE_TYPE  multisample_type,
BOOL  lockable,
IDirect3DSurface8 **  surface 
)
static

Definition at line 1108 of file device.c.

1111{
1113 DWORD flags = 0;
1114
1115 TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, lockable %#x, surface %p.\n",
1116 iface, width, height, format, multisample_type, lockable, surface);
1117
1118 if (!format)
1119 return D3DERR_INVALIDCALL;
1120
1121 *surface = NULL;
1122 if (lockable)
1124
1126 D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, multisample_type, 0);
1127}
#define D3DUSAGE_RENDERTARGET
Definition: d3d8types.h:91

◆ d3d8_device_CreateStateBlock()

static HRESULT WINAPI d3d8_device_CreateStateBlock ( IDirect3DDevice8 *  iface,
D3DSTATEBLOCKTYPE  type,
DWORD handle 
)
static

Definition at line 1854 of file device.c.

1856{
1858 struct wined3d_stateblock *stateblock;
1859 HRESULT hr;
1860
1861 TRACE("iface %p, type %#x, handle %p.\n", iface, type, handle);
1862
1863 if (type != D3DSBT_ALL
1866 {
1867 WARN("Unexpected stateblock type, returning D3DERR_INVALIDCALL\n");
1868 return D3DERR_INVALIDCALL;
1869 }
1870
1872 hr = wined3d_stateblock_create(device->wined3d_device, (enum wined3d_stateblock_type)type, &stateblock);
1873 if (FAILED(hr))
1874 {
1876 ERR("Failed to create the state block, hr %#x\n", hr);
1877 return hr;
1878 }
1879
1880 *handle = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB);
1882
1884 {
1885 ERR("Failed to allocate a handle.\n");
1887 wined3d_stateblock_decref(stateblock);
1889 return E_FAIL;
1890 }
1891 ++*handle;
1892
1893 TRACE("Returning %#x (%p).\n", *handle, stateblock);
1894
1895 return hr;
1896}
@ D3DSBT_PIXELSTATE
Definition: d3d8types.h:831
@ D3DSBT_ALL
Definition: d3d8types.h:830
@ D3DSBT_VERTEXSTATE
Definition: d3d8types.h:832
#define E_FAIL
Definition: ddrawi.h:102
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:552
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

◆ d3d8_device_CreateTexture()

static HRESULT WINAPI d3d8_device_CreateTexture ( IDirect3DDevice8 *  iface,
UINT  width,
UINT  height,
UINT  levels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
IDirect3DTexture8 **  texture 
)
static

Definition at line 910 of file device.c.

913{
915 struct d3d8_texture *object;
916 HRESULT hr;
917
918 TRACE("iface %p, width %u, height %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.\n",
919 iface, width, height, levels, usage, format, pool, texture);
920
921 if (!format)
922 return D3DERR_INVALIDCALL;
923
924 *texture = NULL;
925 if (!(object = heap_alloc_zero(sizeof(*object))))
927
929 if (FAILED(hr))
930 {
931 WARN("Failed to initialize texture, hr %#x.\n", hr);
932 heap_free(object);
933 return hr;
934 }
935
936 TRACE("Created texture %p.\n", object);
937 *texture = (IDirect3DTexture8 *)&object->IDirect3DBaseTexture8_iface;
938
939 return D3D_OK;
940}
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
Definition: texture.c:1094

◆ d3d8_device_CreateVertexBuffer()

static HRESULT WINAPI d3d8_device_CreateVertexBuffer ( IDirect3DDevice8 *  iface,
UINT  size,
DWORD  usage,
DWORD  fvf,
D3DPOOL  pool,
IDirect3DVertexBuffer8 **  buffer 
)
static

Definition at line 1005 of file device.c.

1007{
1009 struct d3d8_vertexbuffer *object;
1010 HRESULT hr;
1011
1012 TRACE("iface %p, size %u, usage %#x, fvf %#x, pool %#x, buffer %p.\n",
1013 iface, size, usage, fvf, pool, buffer);
1014
1015 if (!(object = heap_alloc_zero(sizeof(*object))))
1017
1018 hr = vertexbuffer_init(object, device, size, usage, fvf, pool);
1019 if (FAILED(hr))
1020 {
1021 WARN("Failed to initialize vertex buffer, hr %#x.\n", hr);
1022 heap_free(object);
1023 return hr;
1024 }
1025
1026 TRACE("Created vertex buffer %p.\n", object);
1027 *buffer = &object->IDirect3DVertexBuffer8_iface;
1028
1029 return D3D_OK;
1030}
HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *device, UINT size, DWORD usage, DWORD fvf, D3DPOOL pool)
Definition: buffer.c:273

◆ d3d8_device_CreateVertexShader()

static HRESULT WINAPI d3d8_device_CreateVertexShader ( IDirect3DDevice8 *  iface,
const DWORD declaration,
const DWORD byte_code,
DWORD shader,
DWORD  usage 
)
static

Definition at line 2401 of file device.c.

2403{
2405 struct d3d8_vertex_shader *object;
2406 DWORD shader_handle;
2407 DWORD handle;
2408 HRESULT hr;
2409
2410 TRACE("iface %p, declaration %p, byte_code %p, shader %p, usage %#x.\n",
2411 iface, declaration, byte_code, shader, usage);
2412
2413 if (!(object = heap_alloc_zero(sizeof(*object))))
2414 {
2415 *shader = 0;
2416 return E_OUTOFMEMORY;
2417 }
2418
2420 handle = d3d8_allocate_handle(&device->handle_table, object, D3D8_HANDLE_VS);
2423 {
2424 ERR("Failed to allocate vertex shader handle.\n");
2425 heap_free(object);
2426 *shader = 0;
2427 return E_OUTOFMEMORY;
2428 }
2429
2430 shader_handle = handle + VS_HIGHESTFIXEDFXF + 1;
2431
2432 hr = d3d8_vertex_shader_init(object, device, declaration, byte_code, shader_handle, usage);
2433 if (FAILED(hr))
2434 {
2435 WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
2437 d3d8_free_handle(&device->handle_table, handle, D3D8_HANDLE_VS);
2439 heap_free(object);
2440 *shader = 0;
2441 return hr;
2442 }
2443
2444 TRACE("Created vertex shader %p (handle %#x).\n", object, shader_handle);
2445 *shader = shader_handle;
2446
2447 return D3D_OK;
2448}
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
Definition: shader.c:79
@ D3D8_HANDLE_VS
Definition: d3d8_private.h:66

◆ d3d8_device_CreateVolumeTexture()

static HRESULT WINAPI d3d8_device_CreateVolumeTexture ( IDirect3DDevice8 *  iface,
UINT  width,
UINT  height,
UINT  depth,
UINT  levels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
IDirect3DVolumeTexture8 **  texture 
)
static

Definition at line 942 of file device.c.

945{
947 struct d3d8_texture *object;
948 HRESULT hr;
949
950 TRACE("iface %p, width %u, height %u, depth %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.\n",
952
953 if (!format)
954 return D3DERR_INVALIDCALL;
955
956 *texture = NULL;
957 if (!(object = heap_alloc_zero(sizeof(*object))))
959
961 if (FAILED(hr))
962 {
963 WARN("Failed to initialize volume texture, hr %#x.\n", hr);
964 heap_free(object);
965 return hr;
966 }
967
968 TRACE("Created volume texture %p.\n", object);
969 *texture = (IDirect3DVolumeTexture8 *)&object->IDirect3DBaseTexture8_iface;
970
971 return D3D_OK;
972}
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
Definition: texture.c:1190
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546

◆ d3d8_device_DeletePatch()

static HRESULT WINAPI d3d8_device_DeletePatch ( IDirect3DDevice8 *  iface,
UINT  handle 
)
static

Definition at line 2979 of file device.c.

2980{
2981 FIXME("iface %p, handle %#x unimplemented.\n", iface, handle);
2982 return D3DERR_INVALIDCALL;
2983}
#define FIXME(fmt,...)
Definition: debug.h:111

◆ d3d8_device_DeletePixelShader()

static HRESULT WINAPI d3d8_device_DeletePixelShader ( IDirect3DDevice8 *  iface,
DWORD  shader 
)
static

Definition at line 2880 of file device.c.

2881{
2883 struct d3d8_pixel_shader *shader_impl;
2884
2885 TRACE("iface %p, shader %#x.\n", iface, shader);
2886
2888
2889 if (!(shader_impl = d3d8_free_handle(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
2890 {
2891 WARN("Invalid handle (%#x) passed.\n", shader);
2893 return D3DERR_INVALIDCALL;
2894 }
2895
2896 if (wined3d_device_get_pixel_shader(device->wined3d_device) == shader_impl->wined3d_shader)
2898
2900
2901 d3d8_pixel_shader_destroy(shader_impl);
2902
2903 return D3D_OK;
2904}
void d3d8_pixel_shader_destroy(struct d3d8_pixel_shader *shader) DECLSPEC_HIDDEN
Definition: shader.c:148
struct wined3d_shader *CDECL wined3d_device_get_pixel_shader(const struct wined3d_device *device)
Definition: device.c:2530
#define IDirect3DDevice8_SetPixelShader(p, a)
Definition: d3d8.h:1035
struct wined3d_shader * wined3d_shader
Definition: d3d8_private.h:267

◆ d3d8_device_DeleteStateBlock()

static HRESULT WINAPI d3d8_device_DeleteStateBlock ( IDirect3DDevice8 *  iface,
DWORD  token 
)
static

Definition at line 1828 of file device.c.

1829{
1831 struct wined3d_stateblock *stateblock;
1832
1833 TRACE("iface %p, token %#x.\n", iface, token);
1834
1836 stateblock = d3d8_free_handle(&device->handle_table, token - 1, D3D8_HANDLE_SB);
1837
1838 if (!stateblock)
1839 {
1840 WARN("Invalid handle (%#x) passed.\n", token);
1842 return D3DERR_INVALIDCALL;
1843 }
1844
1845 if (wined3d_stateblock_decref(stateblock))
1846 {
1847 ERR("Stateblock %p has references left, this shouldn't happen.\n", stateblock);
1848 }
1850
1851 return D3D_OK;
1852}

◆ d3d8_device_DeleteVertexShader()

static HRESULT WINAPI d3d8_device_DeleteVertexShader ( IDirect3DDevice8 *  iface,
DWORD  shader 
)
static

Definition at line 2578 of file device.c.

2579{
2581 struct d3d8_vertex_shader *shader_impl;
2582
2583 TRACE("iface %p, shader %#x.\n", iface, shader);
2584
2586 if (!(shader_impl = d3d8_free_handle(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
2587 {
2588 WARN("Invalid handle (%#x) passed.\n", shader);
2590
2591 return D3DERR_INVALIDCALL;
2592 }
2593
2594 if (shader_impl->wined3d_shader
2595 && wined3d_device_get_vertex_shader(device->wined3d_device) == shader_impl->wined3d_shader)
2597
2599
2600 d3d8_vertex_shader_destroy(shader_impl);
2601
2602 return D3D_OK;
2603}
void d3d8_vertex_shader_destroy(struct d3d8_vertex_shader *shader) DECLSPEC_HIDDEN
Definition: shader.c:32
struct wined3d_shader *CDECL wined3d_device_get_vertex_shader(const struct wined3d_device *device)
Definition: device.c:2207
#define IDirect3DDevice8_SetVertexShader(p, a)
Definition: d3d8.h:1023
struct wined3d_shader * wined3d_shader
Definition: d3d8_private.h:255

◆ d3d8_device_DrawIndexedPrimitive()

static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive ( IDirect3DDevice8 *  iface,
D3DPRIMITIVETYPE  primitive_type,
UINT  min_vertex_idx,
UINT  vertex_count,
UINT  start_idx,
UINT  primitive_count 
)
static

Definition at line 2139 of file device.c.

2142{
2144 HRESULT hr;
2145
2146 TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, start_idx %u, primitive_count %u.\n",
2147 iface, primitive_type, min_vertex_idx, vertex_count, start_idx, primitive_count);
2148
2150 wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
2151 hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx,
2152 vertex_count_from_primitive_count(primitive_type, primitive_count));
2154
2155 return hr;
2156}
static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, UINT primitive_count)
Definition: device.c:167
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
Definition: device.c:3769
void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count)
Definition: device.c:3717
int vertex_count
Definition: d3drm.c:3367

◆ d3d8_device_DrawIndexedPrimitiveUP()

static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP ( IDirect3DDevice8 *  iface,
D3DPRIMITIVETYPE  primitive_type,
UINT  min_vertex_idx,
UINT  vertex_count,
UINT  primitive_count,
const void index_data,
D3DFORMAT  index_format,
const void vertex_data,
UINT  vertex_stride 
)
static

Definition at line 2290 of file device.c.

2294{
2295 UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2297 UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4;
2298 UINT vtx_size = vertex_count * vertex_stride;
2299 UINT idx_size = idx_count * idx_fmt_size;
2301 struct wined3d_box wined3d_box = {0};
2302 struct wined3d_resource *ib, *vb;
2303 UINT vb_pos, ib_pos, align;
2304 HRESULT hr;
2305
2306 TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u, "
2307 "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n",
2308 iface, primitive_type, min_vertex_idx, vertex_count, primitive_count,
2309 index_data, index_format, vertex_data, vertex_stride);
2310
2311 if (!primitive_count)
2312 {
2313 WARN("primitive_count is 0, returning D3D_OK\n");
2314 return D3D_OK;
2315 }
2316
2318
2320 if (FAILED(hr))
2321 goto done;
2322
2323 vb_pos = device->vertex_buffer_pos;
2324 align = vb_pos % vertex_stride;
2325 if (align) align = vertex_stride - align;
2326 if (vb_pos + vtx_size + align > device->vertex_buffer_size)
2327 vb_pos = 0;
2328 else
2329 vb_pos += align;
2330
2331 wined3d_box.left = vb_pos;
2332 wined3d_box.right = vb_pos + vtx_size;
2333 vb = wined3d_buffer_get_resource(device->vertex_buffer);
2336 goto done;
2337 memcpy(wined3d_map_desc.data, (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size);
2339 device->vertex_buffer_pos = vb_pos + vtx_size;
2340
2342 if (FAILED(hr))
2343 goto done;
2344
2345 ib_pos = device->index_buffer_pos;
2346 align = ib_pos % idx_fmt_size;
2347 if (align) align = idx_fmt_size - align;
2348 if (ib_pos + idx_size + align > device->index_buffer_size)
2349 ib_pos = 0;
2350 else
2351 ib_pos += align;
2352
2353 wined3d_box.left = ib_pos;
2354 wined3d_box.right = ib_pos + idx_size;
2355 ib = wined3d_buffer_get_resource(device->index_buffer);
2358 goto done;
2361 device->index_buffer_pos = ib_pos + idx_size;
2362
2363 hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, vertex_stride);
2364 if (FAILED(hr))
2365 goto done;
2366
2367 wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer,
2368 wined3dformat_from_d3dformat(index_format), 0);
2369 wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride - min_vertex_idx);
2370
2371 wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
2372 hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
2373
2374 wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0);
2376 wined3d_device_set_base_vertex_index(device->wined3d_device, 0);
2377
2378done:
2380 return hr;
2381}
@ D3DFMT_INDEX16
Definition: d3d8types.h:649
static HRESULT d3d8_device_prepare_index_buffer(struct d3d8_device *device, UINT min_size)
Definition: device.c:2254
static HRESULT d3d8_device_prepare_vertex_buffer(struct d3d8_device *device, UINT min_size)
Definition: device.c:2159
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:995
void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index)
Definition: device.c:1917
void CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset)
Definition: device.c:1874
HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: device.c:1378
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:382
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
Definition: resource.c:344
int align(int length, int align)
Definition: dsound8.c:36
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
UINT left
Definition: wined3d.h:1839
UINT right
Definition: wined3d.h:1841
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:107
#define WINED3D_MAP_DISCARD
Definition: wined3d.h:935
#define WINED3D_MAP_WRITE
Definition: wined3d.h:938
#define WINED3D_MAP_NOOVERWRITE
Definition: wined3d.h:934

◆ d3d8_device_DrawPrimitive()

static HRESULT WINAPI d3d8_device_DrawPrimitive ( IDirect3DDevice8 *  iface,
D3DPRIMITIVETYPE  primitive_type,
UINT  start_vertex,
UINT  primitive_count 
)
static

Definition at line 2121 of file device.c.

2123{
2125 HRESULT hr;
2126
2127 TRACE("iface %p, primitive_type %#x, start_vertex %u, primitive_count %u.\n",
2128 iface, primitive_type, start_vertex, primitive_count);
2129
2131 wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
2132 hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex,
2133 vertex_count_from_primitive_count(primitive_type, primitive_count));
2135
2136 return hr;
2137}
HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count)
Definition: device.c:3740

◆ d3d8_device_DrawPrimitiveUP()

static HRESULT WINAPI d3d8_device_DrawPrimitiveUP ( IDirect3DDevice8 *  iface,
D3DPRIMITIVETYPE  primitive_type,
UINT  primitive_count,
const void data,
UINT  stride 
)
static

Definition at line 2195 of file device.c.

2198{
2200 HRESULT hr;
2201 UINT vtx_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2203 struct wined3d_box wined3d_box = {0};
2204 UINT size = vtx_count * stride;
2205 struct wined3d_resource *vb;
2206 UINT vb_pos, align;
2207
2208 TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n",
2209 iface, primitive_type, primitive_count, data, stride);
2210
2211 if (!primitive_count)
2212 {
2213 WARN("primitive_count is 0, returning D3D_OK\n");
2214 return D3D_OK;
2215 }
2216
2219 if (FAILED(hr))
2220 goto done;
2221
2222 vb_pos = device->vertex_buffer_pos;
2223 align = vb_pos % stride;
2224 if (align) align = stride - align;
2225 if (vb_pos + size + align > device->vertex_buffer_size)
2226 vb_pos = 0;
2227 else
2228 vb_pos += align;
2229
2230 wined3d_box.left = vb_pos;
2231 wined3d_box.right = vb_pos + size;
2232 vb = wined3d_buffer_get_resource(device->vertex_buffer);
2235 goto done;
2238 device->vertex_buffer_pos = vb_pos + size;
2239
2240 hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, stride);
2241 if (FAILED(hr))
2242 goto done;
2243
2244 wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
2245 hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count);
2246 wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0);
2247
2248done:
2250 return hr;
2251}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei stride
Definition: glext.h:5848

◆ d3d8_device_DrawRectPatch()

static HRESULT WINAPI d3d8_device_DrawRectPatch ( IDirect3DDevice8 *  iface,
UINT  handle,
const float segment_count,
const D3DRECTPATCH_INFO patch_info 
)
static

Definition at line 2963 of file device.c.

2965{
2966 FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
2967 iface, handle, segment_count, patch_info);
2968 return D3D_OK;
2969}

◆ d3d8_device_DrawTriPatch()

static HRESULT WINAPI d3d8_device_DrawTriPatch ( IDirect3DDevice8 *  iface,
UINT  handle,
const float segment_count,
const D3DTRIPATCH_INFO patch_info 
)
static

Definition at line 2971 of file device.c.

2973{
2974 FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
2975 iface, handle, segment_count, patch_info);
2976 return D3D_OK;
2977}

◆ d3d8_device_EndScene()

static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_device_EndScene ( IDirect3DDevice8 *  iface)
static

Definition at line 1443 of file device.c.

1444{
1446 HRESULT hr;
1447
1448 TRACE("iface %p.\n", iface);
1449
1451 hr = wined3d_device_end_scene(device->wined3d_device);
1453
1454 return hr;
1455}
HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
Definition: device.c:3617

◆ d3d8_device_EndStateBlock()

static HRESULT WINAPI d3d8_device_EndStateBlock ( IDirect3DDevice8 *  iface,
DWORD token 
)
static

Definition at line 1745 of file device.c.

1746{
1748 struct wined3d_stateblock *stateblock;
1749 HRESULT hr;
1750
1751 TRACE("iface %p, token %p.\n", iface, token);
1752
1753 /* Tell wineD3D to endstateblock before anything else (in case we run out
1754 * of memory later and cause locking problems)
1755 */
1757 hr = wined3d_device_end_stateblock(device->wined3d_device, &stateblock);
1758 if (FAILED(hr))
1759 {
1760 WARN("Failed to end the state block, %#x.\n", hr);
1762 return hr;
1763 }
1764
1765 *token = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB);
1767
1768 if (*token == D3D8_INVALID_HANDLE)
1769 {
1770 ERR("Failed to create a handle\n");
1772 wined3d_stateblock_decref(stateblock);
1774 return E_FAIL;
1775 }
1776 ++*token;
1777
1778 TRACE("Returning %#x (%p).\n", *token, stateblock);
1779
1780 return hr;
1781}
HRESULT CDECL wined3d_device_end_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock)
Definition: device.c:3577

◆ d3d8_device_get_fvf_declaration()

static struct d3d8_vertex_declaration * d3d8_device_get_fvf_declaration ( struct d3d8_device device,
DWORD  fvf 
)
static

Definition at line 2450 of file device.c.

2451{
2452 struct d3d8_vertex_declaration *d3d8_declaration;
2453 struct FvfToDecl *convertedDecls = device->decls;
2454 int p, low, high; /* deliberately signed */
2455 HRESULT hr;
2456
2457 TRACE("Searching for declaration for fvf %08x... ", fvf);
2458
2459 low = 0;
2460 high = device->numConvertedDecls - 1;
2461 while (low <= high)
2462 {
2463 p = (low + high) >> 1;
2464 TRACE("%d ", p);
2465
2466 if (convertedDecls[p].fvf == fvf)
2467 {
2468 TRACE("found %p\n", convertedDecls[p].declaration);
2469 return convertedDecls[p].declaration;
2470 }
2471
2472 if (convertedDecls[p].fvf < fvf)
2473 low = p + 1;
2474 else
2475 high = p - 1;
2476 }
2477 TRACE("not found. Creating and inserting at position %d.\n", low);
2478
2479 if (!(d3d8_declaration = heap_alloc(sizeof(*d3d8_declaration))))
2480 return NULL;
2481
2482 if (FAILED(hr = d3d8_vertex_declaration_init_fvf(d3d8_declaration, device, fvf)))
2483 {
2484 WARN("Failed to initialize vertex declaration, hr %#x.\n", hr);
2485 heap_free(d3d8_declaration);
2486 return NULL;
2487 }
2488
2489 if (device->declArraySize == device->numConvertedDecls)
2490 {
2491 UINT grow = device->declArraySize / 2;
2492
2493 if (!(convertedDecls = heap_realloc(convertedDecls,
2494 sizeof(*convertedDecls) * (device->numConvertedDecls + grow))))
2495 {
2496 d3d8_vertex_declaration_destroy(d3d8_declaration);
2497 return NULL;
2498 }
2499 device->decls = convertedDecls;
2500 device->declArraySize += grow;
2501 }
2502
2503 memmove(convertedDecls + low + 1, convertedDecls + low,
2504 sizeof(*convertedDecls) * (device->numConvertedDecls - low));
2505 convertedDecls[low].declaration = d3d8_declaration;
2506 convertedDecls[low].fvf = fvf;
2507 ++device->numConvertedDecls;
2508
2509 TRACE("Returning %p. %u decls in array.\n", d3d8_declaration, device->numConvertedDecls);
2510
2511 return d3d8_declaration;
2512}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
HRESULT d3d8_vertex_declaration_init_fvf(struct d3d8_vertex_declaration *declaration, struct d3d8_device *device, DWORD fvf) DECLSPEC_HIDDEN
void d3d8_vertex_declaration_destroy(struct d3d8_vertex_declaration *declaration) DECLSPEC_HIDDEN
GLfloat GLfloat p
Definition: glext.h:8902
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
struct d3d8_vertex_declaration * declaration
Definition: d3d8_private.h:88
DWORD fvf
Definition: d3d8_private.h:87

Referenced by d3d8_device_SetVertexShader().

◆ d3d8_device_GetAvailableTextureMem()

static UINT WINAPI d3d8_device_GetAvailableTextureMem ( IDirect3DDevice8 *  iface)
static

Definition at line 546 of file device.c.

547{
549 UINT ret;
550
551 TRACE("iface %p.\n", iface);
552
556
557 return ret;
558}
UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device)
Definition: device.c:1298
int ret

◆ d3d8_device_GetBackBuffer()

static HRESULT WINAPI d3d8_device_GetBackBuffer ( IDirect3DDevice8 *  iface,
UINT  backbuffer_idx,
D3DBACKBUFFER_TYPE  backbuffer_type,
IDirect3DSurface8 **  backbuffer 
)
static

Definition at line 840 of file device.c.

842{
846 struct d3d8_surface *surface_impl;
847
848 TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
849 iface, backbuffer_idx, backbuffer_type, backbuffer);
850
851 /* backbuffer_type is ignored by native. */
852
853 /* No need to check for backbuffer == NULL, Windows crashes in that case. */
855
856 wined3d_swapchain = device->implicit_swapchain->wined3d_swapchain;
858 {
860 *backbuffer = NULL;
861 return D3DERR_INVALIDCALL;
862 }
863
865 *backbuffer = &surface_impl->IDirect3DSurface8_iface;
866 IDirect3DSurface8_AddRef(*backbuffer);
867
869 return D3D_OK;
870}
struct wined3d_texture *CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, UINT back_buffer_idx)
Definition: swapchain.c:215

◆ d3d8_device_GetClipPlane()

static HRESULT WINAPI d3d8_device_GetClipPlane ( IDirect3DDevice8 *  iface,
DWORD  index,
float plane 
)
static

Definition at line 1673 of file device.c.

1674{
1676 HRESULT hr;
1677
1678 TRACE("iface %p, index %u, plane %p.\n", iface, index, plane);
1679
1681 hr = wined3d_device_get_clip_plane(device->wined3d_device, index, (struct wined3d_vec4 *)plane);
1683
1684 return hr;
1685}
HRESULT CDECL wined3d_device_get_clip_plane(const struct wined3d_device *device, UINT plane_idx, struct wined3d_vec4 *plane)
Definition: device.c:1811
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
Definition: glfuncs.h:270

◆ d3d8_device_GetClipStatus()

static HRESULT WINAPI d3d8_device_GetClipStatus ( IDirect3DDevice8 *  iface,
D3DCLIPSTATUS8 clip_status 
)
static

Definition at line 1913 of file device.c.

1914{
1916 HRESULT hr;
1917
1918 TRACE("iface %p, clip_status %p.\n", iface, clip_status);
1919
1921 hr = wined3d_device_get_clip_status(device->wined3d_device, (struct wined3d_clip_status *)clip_status);
1923
1924 return hr;
1925}
HRESULT CDECL wined3d_device_get_clip_status(const struct wined3d_device *device, struct wined3d_clip_status *clip_status)
Definition: device.c:1838

◆ d3d8_device_GetCreationParameters()

static HRESULT WINAPI d3d8_device_GetCreationParameters ( IDirect3DDevice8 *  iface,
D3DDEVICE_CREATION_PARAMETERS parameters 
)
static

Definition at line 631 of file device.c.

633{
635
636 TRACE("iface %p, parameters %p.\n", iface, parameters);
637
640 (struct wined3d_device_creation_parameters *)parameters);
642
643 return D3D_OK;
644}
void CDECL wined3d_device_get_creation_parameters(const struct wined3d_device *device, struct wined3d_device_creation_parameters *parameters)
Definition: device.c:5042

◆ d3d8_device_GetCurrentTexturePalette()

static HRESULT WINAPI d3d8_device_GetCurrentTexturePalette ( IDirect3DDevice8 *  iface,
UINT palette_idx 
)
static

Definition at line 2114 of file device.c.

2115{
2116 FIXME("iface %p, palette_idx %p unimplemented.\n", iface, palette_idx);
2117
2118 return D3DERR_INVALIDCALL;
2119}

◆ d3d8_device_GetDepthStencilSurface()

static HRESULT WINAPI d3d8_device_GetDepthStencilSurface ( IDirect3DDevice8 *  iface,
IDirect3DSurface8 **  depth_stencil 
)
static

Definition at line 1398 of file device.c.

1399{
1401 struct wined3d_rendertarget_view *wined3d_dsv;
1402 struct d3d8_surface *surface_impl;
1403 HRESULT hr = D3D_OK;
1404
1405 TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil);
1406
1407 if (!depth_stencil)
1408 return D3DERR_INVALIDCALL;
1409
1411 if ((wined3d_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device)))
1412 {
1413 /* We want the sub resource parent here, since the view itself may be
1414 * internal to wined3d and may not have a parent. */
1415 surface_impl = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_dsv);
1416 *depth_stencil = &surface_impl->IDirect3DSurface8_iface;
1417 IDirect3DSurface8_AddRef(*depth_stencil);
1418 }
1419 else
1420 {
1422 *depth_stencil = NULL;
1423 }
1425
1426 return hr;
1427}
struct wined3d_rendertarget_view *CDECL wined3d_device_get_depth_stencil_view(const struct wined3d_device *device)
Definition: device.c:4461
void *CDECL wined3d_rendertarget_view_get_sub_resource_parent(const struct wined3d_rendertarget_view *view)
Definition: view.c:376
#define D3DERR_NOTFOUND
Definition: d3d8.h:80

◆ d3d8_device_GetDeviceCaps()

static HRESULT WINAPI d3d8_device_GetDeviceCaps ( IDirect3DDevice8 *  iface,
D3DCAPS8 caps 
)
static

Definition at line 588 of file device.c.

589{
591 WINED3DCAPS wined3d_caps;
592 HRESULT hr;
593
594 TRACE("iface %p, caps %p.\n", iface, caps);
595
596 if (!caps)
597 return D3DERR_INVALIDCALL;
598
600 hr = wined3d_device_get_device_caps(device->wined3d_device, &wined3d_caps);
602
603 d3dcaps_from_wined3dcaps(caps, &wined3d_caps);
604
605 return hr;
606}
void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps)
Definition: device.c:290
HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps)
Definition: device.c:3526

◆ d3d8_device_GetDirect3D()

static HRESULT WINAPI d3d8_device_GetDirect3D ( IDirect3DDevice8 *  iface,
IDirect3D8 **  d3d8 
)
static

Definition at line 576 of file device.c.

577{
579
580 TRACE("iface %p, d3d8 %p.\n", iface, d3d8);
581
582 if (!d3d8)
583 return D3DERR_INVALIDCALL;
584
585 return IDirect3D8_QueryInterface(device->d3d_parent, &IID_IDirect3D8, (void **)d3d8);
586}
#define IDirect3D8_QueryInterface(p, a, b)
Definition: d3d8.h:159

◆ d3d8_device_GetDisplayMode()

static HRESULT WINAPI d3d8_device_GetDisplayMode ( IDirect3DDevice8 *  iface,
D3DDISPLAYMODE mode 
)
static

Definition at line 608 of file device.c.

609{
611 struct wined3d_display_mode wined3d_mode;
612 HRESULT hr;
613
614 TRACE("iface %p, mode %p.\n", iface, mode);
615
617 hr = wined3d_device_get_display_mode(device->wined3d_device, 0, &wined3d_mode, NULL);
619
620 if (SUCCEEDED(hr))
621 {
622 mode->Width = wined3d_mode.width;
623 mode->Height = wined3d_mode.height;
624 mode->RefreshRate = wined3d_mode.refresh_rate;
625 mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id);
626 }
627
628 return hr;
629}
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format)
Definition: device.c:44
HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: device.c:3541
GLenum mode
Definition: glext.h:6217

◆ d3d8_device_GetFrontBuffer()

static HRESULT WINAPI d3d8_device_GetFrontBuffer ( IDirect3DDevice8 *  iface,
IDirect3DSurface8 *  dst_surface 
)
static

Definition at line 1271 of file device.c.

1272{
1274 struct d3d8_surface *dst_impl = unsafe_impl_from_IDirect3DSurface8(dst_surface);
1275 HRESULT hr;
1276
1277 TRACE("iface %p, dst_surface %p.\n", iface, dst_surface);
1278
1279 if (!dst_surface)
1280 {
1281 WARN("Invalid destination surface passed.\n");
1282 return D3DERR_INVALIDCALL;
1283 }
1284
1286 hr = wined3d_swapchain_get_front_buffer_data(device->implicit_swapchain->wined3d_swapchain,
1287 dst_impl->wined3d_texture, dst_impl->sub_resource_idx);
1289
1290 return hr;
1291}
unsigned int sub_resource_idx
Definition: d3d8_private.h:179
struct wined3d_texture * wined3d_texture
Definition: d3d8_private.h:178
HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain, struct wined3d_texture *dst_texture, unsigned int sub_resource_idx)
Definition: swapchain.c:194

◆ d3d8_device_GetGammaRamp()

static void WINAPI d3d8_device_GetGammaRamp ( IDirect3DDevice8 *  iface,
D3DGAMMARAMP ramp 
)
static

Definition at line 898 of file device.c.

899{
901
902 TRACE("iface %p, ramp %p.\n", iface, ramp);
903
904 /* Note: D3DGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
906 wined3d_device_get_gamma_ramp(device->wined3d_device, 0, (struct wined3d_gamma_ramp *)ramp);
908}
void CDECL wined3d_device_get_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_gamma_ramp *ramp)
Definition: device.c:5069
static const BYTE ramp[17]
Definition: dib.c:2709

◆ d3d8_device_GetIndices()

static HRESULT WINAPI d3d8_device_GetIndices ( IDirect3DDevice8 *  iface,
IDirect3DIndexBuffer8 **  buffer,
UINT base_vertex_index 
)
static

Definition at line 2744 of file device.c.

2746{
2750 struct d3d8_indexbuffer *buffer_impl;
2751
2752 TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, buffer, base_vertex_index);
2753
2754 if (!buffer)
2755 return D3DERR_INVALIDCALL;
2756
2757 /* The case from UINT to INT is safe because d3d8 will never set negative values */
2759 *base_vertex_index = wined3d_device_get_base_vertex_index(device->wined3d_device);
2761 {
2763 *buffer = &buffer_impl->IDirect3DIndexBuffer8_iface;
2765 }
2766 else
2767 {
2768 *buffer = NULL;
2769 }
2771
2772 return D3D_OK;
2773}
void *CDECL wined3d_buffer_get_parent(const struct wined3d_buffer *buffer)
Definition: buffer.c:807
INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *device)
Definition: device.c:1924
struct wined3d_buffer *CDECL wined3d_device_get_index_buffer(const struct wined3d_device *device, enum wined3d_format_id *format, unsigned int *offset)
Definition: device.c:1906
#define IDirect3DIndexBuffer8_AddRef(p)
Definition: d3d8.h:481
IDirect3DIndexBuffer8 IDirect3DIndexBuffer8_iface
Definition: d3d8_private.h:210

◆ d3d8_device_GetInfo()

static HRESULT WINAPI d3d8_device_GetInfo ( IDirect3DDevice8 *  iface,
DWORD  info_id,
void info,
DWORD  info_size 
)
static

Definition at line 2080 of file device.c.

2082{
2083 FIXME("iface %p, info_id %#x, info %p, info_size %u stub!\n", iface, info_id, info, info_size);
2084
2085 return D3D_OK;
2086}

◆ d3d8_device_GetLight()

static HRESULT WINAPI d3d8_device_GetLight ( IDirect3DDevice8 *  iface,
DWORD  index,
D3DLIGHT8 light 
)
static

Definition at line 1616 of file device.c.

1617{
1619 HRESULT hr;
1620
1621 TRACE("iface %p, index %u, light %p.\n", iface, index, light);
1622
1623 /* Note: D3DLIGHT8 is compatible with struct wined3d_light. */
1625 hr = wined3d_device_get_light(device->wined3d_device, index, (struct wined3d_light *)light);
1627
1628 return hr;
1629}
HRESULT CDECL wined3d_device_get_light(const struct wined3d_device *device, UINT light_idx, struct wined3d_light *light)
Definition: device.c:1724
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 light
Definition: glfuncs.h:170

◆ d3d8_device_GetLightEnable()

static HRESULT WINAPI d3d8_device_GetLightEnable ( IDirect3DDevice8 *  iface,
DWORD  index,
BOOL enable 
)
static

Definition at line 1645 of file device.c.

1646{
1648 HRESULT hr;
1649
1650 TRACE("iface %p, index %u, enable %p.\n", iface, index, enable);
1651
1655
1656 return hr;
1657}
HRESULT CDECL wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable)
Definition: device.c:1767
GLboolean enable
Definition: glext.h:11120

◆ d3d8_device_GetMaterial()

static HRESULT WINAPI d3d8_device_GetMaterial ( IDirect3DDevice8 *  iface,
D3DMATERIAL8 material 
)
static

Definition at line 1587 of file device.c.

1588{
1590
1591 TRACE("iface %p, material %p.\n", iface, material);
1592
1593 /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */
1595 wined3d_device_get_material(device->wined3d_device, (struct wined3d_material *)material);
1597
1598 return D3D_OK;
1599}
void CDECL wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material)
Definition: device.c:1861

◆ d3d8_device_GetPaletteEntries()

static HRESULT WINAPI d3d8_device_GetPaletteEntries ( IDirect3DDevice8 *  iface,
UINT  palette_idx,
PALETTEENTRY entries 
)
static

Definition at line 2099 of file device.c.

2101{
2102 FIXME("iface %p, palette_idx %u, entries %p unimplemented.\n", iface, palette_idx, entries);
2103
2104 return D3DERR_INVALIDCALL;
2105}

◆ d3d8_device_GetPixelShader()

static HRESULT WINAPI d3d8_device_GetPixelShader ( IDirect3DDevice8 *  iface,
DWORD shader 
)
static

Definition at line 2852 of file device.c.

2853{
2855 struct wined3d_shader *object;
2856
2857 TRACE("iface %p, shader %p.\n", iface, shader);
2858
2859 if (!shader)
2860 return D3DERR_INVALIDCALL;
2861
2863 if ((object = wined3d_device_get_pixel_shader(device->wined3d_device)))
2864 {
2865 struct d3d8_pixel_shader *d3d8_shader;
2866 d3d8_shader = wined3d_shader_get_parent(object);
2867 *shader = d3d8_shader->handle;
2868 }
2869 else
2870 {
2871 *shader = 0;
2872 }
2874
2875 TRACE("Returning %#x.\n", *shader);
2876
2877 return D3D_OK;
2878}
void *CDECL wined3d_shader_get_parent(const struct wined3d_shader *shader)
Definition: shader.c:3379

◆ d3d8_device_GetPixelShaderConstant()

static HRESULT WINAPI d3d8_device_GetPixelShaderConstant ( IDirect3DDevice8 *  iface,
DWORD  start_register,
void data,
DWORD  count 
)
static

Definition at line 2922 of file device.c.

2924{
2926 HRESULT hr;
2927
2928 TRACE("iface %p, start_register %u, data %p, count %u.\n",
2929 iface, start_register, data, count);
2930
2932 hr = wined3d_device_get_ps_consts_f(device->wined3d_device, start_register, count, data);
2934
2935 return hr;
2936}
HRESULT CDECL wined3d_device_get_ps_consts_f(const struct wined3d_device *device, unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants)
Definition: device.c:2708

◆ d3d8_device_GetPixelShaderFunction()

static HRESULT WINAPI d3d8_device_GetPixelShaderFunction ( IDirect3DDevice8 *  iface,
DWORD  shader,
void data,
DWORD data_size 
)
static

Definition at line 2938 of file device.c.

2940{
2942 struct d3d8_pixel_shader *shader_impl = NULL;
2943 HRESULT hr;
2944
2945 TRACE("iface %p, shader %#x, data %p, data_size %p.\n",
2946 iface, shader, data, data_size);
2947
2949 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
2950 {
2951 WARN("Invalid handle (%#x) passed.\n", shader);
2953
2954 return D3DERR_INVALIDCALL;
2955 }
2956
2957 hr = wined3d_shader_get_byte_code(shader_impl->wined3d_shader, data, data_size);
2959
2960 return hr;
2961}
HRESULT CDECL wined3d_shader_get_byte_code(const struct wined3d_shader *shader, void *byte_code, UINT *byte_code_size)
Definition: shader.c:3386

◆ d3d8_device_GetRasterStatus()

static HRESULT WINAPI d3d8_device_GetRasterStatus ( IDirect3DDevice8 *  iface,
D3DRASTER_STATUS raster_status 
)
static

Definition at line 872 of file device.c.

873{
875 HRESULT hr;
876
877 TRACE("iface %p, raster_status %p.\n", iface, raster_status);
878
880 hr = wined3d_device_get_raster_status(device->wined3d_device, 0, (struct wined3d_raster_status *)raster_status);
882
883 return hr;
884}
HRESULT CDECL wined3d_device_get_raster_status(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_raster_status *raster_status)
Definition: device.c:3981

◆ d3d8_device_GetRenderState()

static HRESULT WINAPI d3d8_device_GetRenderState ( IDirect3DDevice8 *  iface,
D3DRENDERSTATETYPE  state,
DWORD value 
)
static

Definition at line 1709 of file device.c.

1711{
1713
1714 TRACE("iface %p, state %#x, value %p.\n", iface, state, value);
1715
1717 switch (state)
1718 {
1719 case D3DRS_ZBIAS:
1721 break;
1722
1723 default:
1725 }
1727
1728 return D3D_OK;
1729}
static int state
Definition: maze.c:121
@ D3DRS_ZBIAS
Definition: d3d8types.h:753
DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state)
Definition: device.c:2064
Definition: pdh_main.c:94
@ WINED3D_RS_DEPTHBIAS
Definition: wined3d.h:378

◆ d3d8_device_GetRenderTarget()

static HRESULT WINAPI d3d8_device_GetRenderTarget ( IDirect3DDevice8 *  iface,
IDirect3DSurface8 **  render_target 
)
static

Definition at line 1365 of file device.c.

1366{
1368 struct wined3d_rendertarget_view *wined3d_rtv;
1369 struct d3d8_surface *surface_impl;
1370 HRESULT hr;
1371
1372 TRACE("iface %p, render_target %p.\n", iface, render_target);
1373
1374 if (!render_target)
1375 return D3DERR_INVALIDCALL;
1376
1378 if ((wined3d_rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
1379 {
1380 /* We want the sub resource parent here, since the view itself may be
1381 * internal to wined3d and may not have a parent. */
1383 *render_target = &surface_impl->IDirect3DSurface8_iface;
1384 IDirect3DSurface8_AddRef(*render_target);
1385 hr = D3D_OK;
1386 }
1387 else
1388 {
1389 ERR("Failed to get wined3d render target.\n");
1390 *render_target = NULL;
1392 }
1394
1395 return hr;
1396}
struct wined3d_rendertarget_view *CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, unsigned int view_idx)
Definition: device.c:4447
struct wined3d_rendertarget_view * wined3d_rtv
Definition: d3d8_private.h:181

◆ d3d8_device_GetStreamSource()

static HRESULT WINAPI d3d8_device_GetStreamSource ( IDirect3DDevice8 *  iface,
UINT  stream_idx,
IDirect3DVertexBuffer8 **  buffer,
UINT stride 
)
static

Definition at line 3003 of file device.c.

3005{
3007 struct d3d8_vertexbuffer *buffer_impl;
3009 HRESULT hr;
3010
3011 TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n",
3012 iface, stream_idx, buffer, stride);
3013
3014 if (!buffer)
3015 return D3DERR_INVALIDCALL;
3016
3018 hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer, 0, stride);
3019 if (SUCCEEDED(hr) && wined3d_buffer)
3020 {
3022 *buffer = &buffer_impl->IDirect3DVertexBuffer8_iface;
3024 }
3025 else
3026 {
3027 if (FAILED(hr))
3028 ERR("Failed to get wined3d stream source, hr %#x.\n", hr);
3029 *buffer = NULL;
3030 }
3032
3033 return hr;
3034}
HRESULT CDECL wined3d_device_get_stream_source(const struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride)
Definition: device.c:1428
#define IDirect3DVertexBuffer8_AddRef(p)
Definition: d3d8.h:417
IDirect3DVertexBuffer8 IDirect3DVertexBuffer8_iface
Definition: d3d8_private.h:197

◆ d3d8_device_GetTexture()

static HRESULT WINAPI d3d8_device_GetTexture ( IDirect3DDevice8 *  iface,
DWORD  stage,
IDirect3DBaseTexture8 **  texture 
)
static

Definition at line 1927 of file device.c.

1928{
1931 struct d3d8_texture *texture_impl;
1932
1933 TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
1934
1935 if (!texture)
1936 return D3DERR_INVALIDCALL;
1937
1939 if ((wined3d_texture = wined3d_device_get_texture(device->wined3d_device, stage)))
1940 {
1942 *texture = &texture_impl->IDirect3DBaseTexture8_iface;
1944 }
1945 else
1946 {
1947 *texture = NULL;
1948 }
1950
1951 return D3D_OK;
1952}
struct wined3d_texture *CDECL wined3d_device_get_texture(const struct wined3d_device *device, UINT stage)
Definition: device.c:3510
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1121
#define IDirect3DBaseTexture8_AddRef(p)
Definition: d3d8.h:545
IDirect3DBaseTexture8 IDirect3DBaseTexture8_iface
Definition: d3d8_private.h:223

◆ d3d8_device_GetTextureStageState()

static HRESULT WINAPI d3d8_device_GetTextureStageState ( IDirect3DDevice8 *  iface,
DWORD  stage,
D3DTEXTURESTAGESTATETYPE  Type,
DWORD value 
)
static

Definition at line 2014 of file device.c.

2016{
2018 const struct tss_lookup *l;
2019
2020 TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, Type, value);
2021
2022 if (Type >= sizeof(tss_lookup) / sizeof(*tss_lookup))
2023 {
2024 WARN("Invalid Type %#x passed.\n", Type);
2025 return D3D_OK;
2026 }
2027
2028 l = &tss_lookup[Type];
2029
2031 if (l->sampler_state)
2032 *value = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->u.sampler_state);
2033 else
2034 *value = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->u.texture_state);
2036
2037 return D3D_OK;
2038}
Type
Definition: Type.h:7
r l[0]
Definition: byte_order.h:168
DWORD CDECL wined3d_device_get_sampler_state(const struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state)
Definition: device.c:2108
DWORD CDECL wined3d_device_get_texture_stage_state(const struct wined3d_device *device, UINT stage, enum wined3d_texture_stage_state state)
Definition: device.c:3447

◆ d3d8_device_GetTransform()

static HRESULT WINAPI d3d8_device_GetTransform ( IDirect3DDevice8 *  iface,
D3DTRANSFORMSTATETYPE  state,
D3DMATRIX matrix 
)
static

Definition at line 1501 of file device.c.

1503{
1505
1506 TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
1507
1508 /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
1510 wined3d_device_get_transform(device->wined3d_device, state, (struct wined3d_matrix *)matrix);
1512
1513 return D3D_OK;
1514}
void CDECL wined3d_device_get_transform(const struct wined3d_device *device, enum wined3d_transform_state state, struct wined3d_matrix *matrix)
Definition: device.c:1540
GLuint GLenum matrix
Definition: glext.h:9407

◆ d3d8_device_GetVertexShader()

static HRESULT WINAPI d3d8_device_GetVertexShader ( IDirect3DDevice8 *  iface,
DWORD shader 
)
static

Definition at line 2553 of file device.c.

2554{
2556 struct wined3d_vertex_declaration *wined3d_declaration;
2557 struct d3d8_vertex_declaration *d3d8_declaration;
2558
2559 TRACE("iface %p, shader %p.\n", iface, shader);
2560
2562 if ((wined3d_declaration = wined3d_device_get_vertex_declaration(device->wined3d_device)))
2563 {
2564 d3d8_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration);
2565 *shader = d3d8_declaration->shader_handle;
2566 }
2567 else
2568 {
2569 *shader = 0;
2570 }
2572
2573 TRACE("Returning %#x.\n", *shader);
2574
2575 return D3D_OK;
2576}
struct wined3d_vertex_declaration *CDECL wined3d_device_get_vertex_declaration(const struct wined3d_device *device)
Definition: device.c:2179
void *CDECL wined3d_vertex_declaration_get_parent(const struct wined3d_vertex_declaration *declaration)

◆ d3d8_device_GetVertexShaderConstant()

static HRESULT WINAPI d3d8_device_GetVertexShaderConstant ( IDirect3DDevice8 *  iface,
DWORD  start_register,
void data,
DWORD  count 
)
static

Definition at line 2628 of file device.c.

2630{
2632 HRESULT hr;
2633
2634 TRACE("iface %p, start_register %u, data %p, count %u.\n",
2635 iface, start_register, data, count);
2636
2637 if (start_register + count > D3D8_MAX_VERTEX_SHADER_CONSTANTF)
2638 {
2639 WARN("Trying to access %u constants, but d3d8 only supports %u\n",
2640 start_register + count, D3D8_MAX_VERTEX_SHADER_CONSTANTF);
2641 return D3DERR_INVALIDCALL;
2642 }
2643
2645 hr = wined3d_device_get_vs_consts_f(device->wined3d_device, start_register, count, data);
2647
2648 return hr;
2649}
#define D3D8_MAX_VERTEX_SHADER_CONSTANTF
Definition: d3d8_private.h:262
HRESULT CDECL wined3d_device_get_vs_consts_f(const struct wined3d_device *device, unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants)
Definition: device.c:2492

◆ d3d8_device_GetVertexShaderDeclaration()

static HRESULT WINAPI d3d8_device_GetVertexShaderDeclaration ( IDirect3DDevice8 *  iface,
DWORD  shader,
void data,
DWORD data_size 
)
static

Definition at line 2651 of file device.c.

2653{
2656 struct d3d8_vertex_shader *shader_impl;
2657
2658 TRACE("iface %p, shader %#x, data %p, data_size %p.\n",
2659 iface, shader, data, data_size);
2660
2662 shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
2664
2665 if (!shader_impl)
2666 {
2667 WARN("Invalid handle (%#x) passed.\n", shader);
2668 return D3DERR_INVALIDCALL;
2669 }
2670 declaration = shader_impl->vertex_declaration;
2671
2672 if (!data)
2673 {
2674 *data_size = declaration->elements_size;
2675 return D3D_OK;
2676 }
2677
2678 /* MSDN claims that if *data_size is smaller than the required size
2679 * we should write the required size and return D3DERR_MOREDATA.
2680 * That's not actually true. */
2681 if (*data_size < declaration->elements_size)
2682 return D3DERR_INVALIDCALL;
2683
2684 memcpy(data, declaration->elements, declaration->elements_size);
2685
2686 return D3D_OK;
2687}
struct d3d8_vertex_declaration * vertex_declaration
Definition: d3d8_private.h:254

◆ d3d8_device_GetVertexShaderFunction()

static HRESULT WINAPI d3d8_device_GetVertexShaderFunction ( IDirect3DDevice8 *  iface,
DWORD  shader,
void data,
DWORD data_size 
)
static

Definition at line 2689 of file device.c.

2691{
2693 struct d3d8_vertex_shader *shader_impl = NULL;
2694 HRESULT hr;
2695
2696 TRACE("iface %p, shader %#x, data %p, data_size %p.\n",
2697 iface, shader, data, data_size);
2698
2700 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
2701 {
2702 WARN("Invalid handle (%#x) passed.\n", shader);
2704
2705 return D3DERR_INVALIDCALL;
2706 }
2707
2708 if (!shader_impl->wined3d_shader)
2709 {
2711 *data_size = 0;
2712 return D3D_OK;
2713 }
2714
2715 hr = wined3d_shader_get_byte_code(shader_impl->wined3d_shader, data, data_size);
2717
2718 return hr;
2719}

◆ d3d8_device_GetViewport()

static HRESULT WINAPI d3d8_device_GetViewport ( IDirect3DDevice8 *  iface,
D3DVIEWPORT8 viewport 
)
static

Definition at line 1552 of file device.c.

1553{
1556
1557 TRACE("iface %p, viewport %p.\n", iface, viewport);
1558
1562
1563 viewport->X = wined3d_viewport.x;
1564 viewport->Y = wined3d_viewport.y;
1565 viewport->Width = wined3d_viewport.width;
1566 viewport->Height = wined3d_viewport.height;
1567 viewport->MinZ = wined3d_viewport.min_z;
1568 viewport->MaxZ = wined3d_viewport.max_z;
1569
1570 return D3D_OK;
1571}
void CDECL wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport)
Definition: device.c:1950

◆ d3d8_device_LightEnable()

static HRESULT WINAPI d3d8_device_LightEnable ( IDirect3DDevice8 *  iface,
DWORD  index,
BOOL  enable 
)
static

Definition at line 1631 of file device.c.

1632{
1634 HRESULT hr;
1635
1636 TRACE("iface %p, index %u, enable %#x.\n", iface, index, enable);
1637
1641
1642 return hr;
1643}
HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable)
Definition: device.c:1741

◆ d3d8_device_MultiplyTransform()

static HRESULT WINAPI d3d8_device_MultiplyTransform ( IDirect3DDevice8 *  iface,
D3DTRANSFORMSTATETYPE  state,
const D3DMATRIX matrix 
)
static

Definition at line 1516 of file device.c.

1518{
1520
1521 TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
1522
1523 /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
1525 wined3d_device_multiply_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix);
1527
1528 return D3D_OK;
1529}
void CDECL wined3d_device_multiply_transform(struct wined3d_device *device, enum wined3d_transform_state state, const struct wined3d_matrix *matrix)
Definition: device.c:1548

◆ d3d8_device_prepare_index_buffer()

static HRESULT d3d8_device_prepare_index_buffer ( struct d3d8_device device,
UINT  min_size 
)
static

Definition at line 2254 of file device.c.

2255{
2256 HRESULT hr;
2257
2258 if (device->index_buffer_size < min_size || !device->index_buffer)
2259 {
2260 UINT size = max(device->index_buffer_size * 2, min_size);
2262 struct wined3d_buffer *buffer;
2263
2264 TRACE("Growing index buffer to %u bytes\n", size);
2265
2266 desc.byte_width = size;
2268 desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
2270 desc.misc_flags = 0;
2271 desc.structure_byte_stride = 0;
2272
2273 if (FAILED(hr = wined3d_buffer_create(device->wined3d_device, &desc,
2275 {
2276 ERR("Failed to create index buffer, hr %#x.\n", hr);
2277 return hr;
2278 }
2279
2280 if (device->index_buffer)
2281 wined3d_buffer_decref(device->index_buffer);
2282
2283 device->index_buffer = buffer;
2284 device->index_buffer_size = size;
2285 device->index_buffer_pos = 0;
2286 }
2287 return D3D_OK;
2288}
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
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791
#define max(a, b)
Definition: svc.c:63
#define WINED3DUSAGE_WRITEONLY
Definition: wined3d.h:901
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:907
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:920
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:891

Referenced by d3d8_device_DrawIndexedPrimitiveUP().

◆ d3d8_device_prepare_vertex_buffer()

static HRESULT d3d8_device_prepare_vertex_buffer ( struct d3d8_device device,
UINT  min_size 
)
static

Definition at line 2159 of file device.c.

2160{
2161 HRESULT hr;
2162
2163 if (device->vertex_buffer_size < min_size || !device->vertex_buffer)
2164 {
2165 UINT size = max(device->vertex_buffer_size * 2, min_size);
2167 struct wined3d_buffer *buffer;
2168
2169 TRACE("Growing vertex buffer to %u bytes\n", size);
2170
2171 desc.byte_width = size;
2173 desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
2175 desc.misc_flags = 0;
2176 desc.structure_byte_stride = 0;
2177
2178 if (FAILED(hr = wined3d_buffer_create(device->wined3d_device, &desc,
2180 {
2181 ERR("Failed to create vertex buffer, hr %#x.\n", hr);
2182 return hr;
2183 }
2184
2185 if (device->vertex_buffer)
2186 wined3d_buffer_decref(device->vertex_buffer);
2187
2188 device->vertex_buffer = buffer;
2189 device->vertex_buffer_size = size;
2190 device->vertex_buffer_pos = 0;
2191 }
2192 return D3D_OK;
2193}
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:890

Referenced by d3d8_device_DrawIndexedPrimitiveUP(), and d3d8_device_DrawPrimitiveUP().

◆ d3d8_device_Present()

static HRESULT WINAPI d3d8_device_Present ( IDirect3DDevice8 *  iface,
const RECT src_rect,
const RECT dst_rect,
HWND  dst_window_override,
const RGNDATA dirty_region 
)
static

Definition at line 823 of file device.c.

825{
827
828 TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p.\n",
829 iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), dst_window_override, dirty_region);
830
831 /* Fraps does not hook IDirect3DDevice8::Present regardless of the hotpatch
832 * attribute. It only hooks IDirect3DSwapChain8::Present. Yet it properly
833 * shows a framerate on Windows in applications that only call the device
834 * method, like e.g. the dx8 sdk samples. The conclusion is that native
835 * calls the swapchain's public method from the device. */
836 return IDirect3DSwapChain8_Present(&device->implicit_swapchain->IDirect3DSwapChain8_iface,
837 src_rect, dst_rect, dst_window_override, dirty_region);
838}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define IDirect3DSwapChain8_Present(p, a, b, c, d)
Definition: d3d8.h:272

◆ d3d8_device_ProcessVertices()

static HRESULT WINAPI d3d8_device_ProcessVertices ( IDirect3DDevice8 *  iface,
UINT  src_start_idx,
UINT  dst_idx,
UINT  vertex_count,
IDirect3DVertexBuffer8 *  dst_buffer,
DWORD  flags 
)
static

Definition at line 2383 of file device.c.

2385{
2388 HRESULT hr;
2389
2390 TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, flags %#x.\n",
2391 iface, src_start_idx, dst_idx, vertex_count, dst_buffer, flags);
2392
2394 hr = wined3d_device_process_vertices(device->wined3d_device, src_start_idx, dst_idx,
2395 vertex_count, dst->wined3d_buffer, NULL, flags, dst->fvf);
2397
2398 return hr;
2399}
struct d3d8_vertexbuffer * unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
Definition: buffer.c:313
HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf)
Definition: device.c:3340

◆ d3d8_device_QueryInterface()

static HRESULT WINAPI d3d8_device_QueryInterface ( IDirect3DDevice8 *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 450 of file device.c.

451{
452 TRACE("iface %p, riid %s, out %p.\n",
453 iface, debugstr_guid(riid), out);
454
455 if (IsEqualGUID(riid, &IID_IDirect3DDevice8)
457 {
459 *out = iface;
460 return S_OK;
461 }
462
463 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
464
465 *out = NULL;
466 return E_NOINTERFACE;
467}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static FILE * out
Definition: regtests2xml.c:44
#define IDirect3DDevice8_AddRef(p)
Definition: d3d8.h:947
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ d3d8_device_Release()

static ULONG WINAPI d3d8_device_Release ( IDirect3DDevice8 *  iface)
static

Definition at line 479 of file device.c.

480{
482 ULONG ref;
483
484 if (device->inDestruction)
485 return 0;
486
488
489 TRACE("%p decreasing refcount to %u.\n", iface, ref);
490
491 if (!ref)
492 {
493 IDirect3D8 *parent = device->d3d_parent;
494 unsigned i;
495
496 TRACE("Releasing wined3d device %p.\n", device->wined3d_device);
497
499
500 device->inDestruction = TRUE;
501
502 for (i = 0; i < device->numConvertedDecls; ++i)
503 {
504 d3d8_vertex_declaration_destroy(device->decls[i].declaration);
505 }
506 heap_free(device->decls);
507
508 if (device->vertex_buffer)
509 wined3d_buffer_decref(device->vertex_buffer);
510 if (device->index_buffer)
511 wined3d_buffer_decref(device->index_buffer);
512
513 wined3d_device_uninit_3d(device->wined3d_device);
515 wined3d_device_decref(device->wined3d_device);
516 heap_free(device->handle_table.entries);
518
520
522 }
523 return ref;
524}
#define InterlockedDecrement
Definition: armddk.h:52
#define TRUE
Definition: types.h:120
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_release_focus_window(struct wined3d_device *device)
Definition: device.c:954
r parent
Definition: btrfs.c:3010
#define IDirect3D8_Release(p)
Definition: d3d8.h:161

◆ d3d8_device_Reset()

static HRESULT WINAPI d3d8_device_Reset ( IDirect3DDevice8 *  iface,
D3DPRESENT_PARAMETERS present_parameters 
)
static

Definition at line 773 of file device.c.

775{
777 struct wined3d_swapchain_desc swapchain_desc;
778 HRESULT hr;
779
780 TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
781
782 if (device->device_state == D3D8_DEVICE_STATE_LOST)
783 {
784 WARN("App not active, returning D3DERR_DEVICELOST.\n");
785 return D3DERR_DEVICELOST;
786 }
787 if (!wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters))
788 return D3DERR_INVALIDCALL;
789
791
792 if (device->vertex_buffer)
793 {
794 wined3d_buffer_decref(device->vertex_buffer);
795 device->vertex_buffer = NULL;
796 device->vertex_buffer_size = 0;
797 }
798 if (device->index_buffer)
799 {
800 wined3d_buffer_decref(device->index_buffer);
801 device->index_buffer = NULL;
802 device->index_buffer_size = 0;
803 }
804
805 if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc,
807 {
808 present_parameters->BackBufferCount = swapchain_desc.backbuffer_count;
811 !!swapchain_desc.enable_auto_depth_stencil);
812 device->device_state = D3D8_DEVICE_STATE_OK;
813 }
814 else
815 {
816 device->device_state = D3D8_DEVICE_STATE_NOT_RESET;
817 }
819
820 return hr;
821}
@ 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
static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
Definition: device.c:740
HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode, wined3d_device_reset_cb callback, BOOL reset_state)
Definition: device.c:4771
void CDECL wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value)
Definition: device.c:2027
#define D3DERR_DEVICELOST
Definition: d3d8.h:82
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:269
@ WINED3D_RS_POINTSIZE_MIN
Definition: wined3d.h:340

◆ d3d8_device_ResourceManagerDiscardBytes()

static HRESULT WINAPI d3d8_device_ResourceManagerDiscardBytes ( IDirect3DDevice8 *  iface,
DWORD  byte_count 
)
static

Definition at line 560 of file device.c.

561{
563
564 TRACE("iface %p, byte_count %u.\n", iface, byte_count);
565
566 if (byte_count)
567 FIXME("Byte count ignored.\n");
568
572
573 return D3D_OK;
574}
void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
Definition: device.c:4753

◆ d3d8_device_SetClipPlane()

static HRESULT WINAPI d3d8_device_SetClipPlane ( IDirect3DDevice8 *  iface,
DWORD  index,
const float plane 
)
static

Definition at line 1659 of file device.c.

1660{
1662 HRESULT hr;
1663
1664 TRACE("iface %p, index %u, plane %p.\n", iface, index, plane);
1665
1667 hr = wined3d_device_set_clip_plane(device->wined3d_device, index, (const struct wined3d_vec4 *)plane);
1669
1670 return hr;
1671}
HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const struct wined3d_vec4 *plane)
Definition: device.c:1783

◆ d3d8_device_SetClipStatus()

static HRESULT WINAPI d3d8_device_SetClipStatus ( IDirect3DDevice8 *  iface,
const D3DCLIPSTATUS8 clip_status 
)
static

Definition at line 1898 of file device.c.

1899{
1901 HRESULT hr;
1902
1903 TRACE("iface %p, clip_status %p.\n", iface, clip_status);
1904 /* FIXME: Verify that D3DCLIPSTATUS8 ~= struct wined3d_clip_status. */
1905
1907 hr = wined3d_device_set_clip_status(device->wined3d_device, (const struct wined3d_clip_status *)clip_status);
1909
1910 return hr;
1911}
HRESULT CDECL wined3d_device_set_clip_status(struct wined3d_device *device, const struct wined3d_clip_status *clip_status)
Definition: device.c:1827

◆ d3d8_device_SetCurrentTexturePalette()

static HRESULT WINAPI d3d8_device_SetCurrentTexturePalette ( IDirect3DDevice8 *  iface,
UINT  palette_idx 
)
static

Definition at line 2107 of file device.c.

2108{
2109 WARN("iface %p, palette_idx %u unimplemented.\n", iface, palette_idx);
2110
2111 return D3D_OK;
2112}

◆ d3d8_device_SetCursorPosition()

static void WINAPI d3d8_device_SetCursorPosition ( IDirect3DDevice8 *  iface,
UINT  x,
UINT  y,
DWORD  flags 
)
static

Definition at line 670 of file device.c.

671{
673
674 TRACE("iface %p, x %u, y %u, flags %#x.\n", iface, x, y, flags);
675
679}
void CDECL wined3d_device_set_cursor_position(struct wined3d_device *device, int x_screen_space, int y_screen_space, DWORD flags)
Definition: device.c:4690
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ d3d8_device_SetCursorProperties()

static HRESULT WINAPI d3d8_device_SetCursorProperties ( IDirect3DDevice8 *  iface,
UINT  hotspot_x,
UINT  hotspot_y,
IDirect3DSurface8 *  bitmap 
)
static

Definition at line 646 of file device.c.

648{
651 HRESULT hr;
652
653 TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
654 iface, hotspot_x, hotspot_y, bitmap);
655
656 if (!bitmap)
657 {
658 WARN("No cursor bitmap, returning D3DERR_INVALIDCALL.\n");
659 return D3DERR_INVALIDCALL;
660 }
661
664 hotspot_x, hotspot_y, bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx);
666
667 return hr;
668}
HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device, UINT x_hotspot, UINT y_hotspot, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: device.c:4587
Definition: uimain.c:89

◆ d3d8_device_SetGammaRamp()

static void WINAPI d3d8_device_SetGammaRamp ( IDirect3DDevice8 *  iface,
DWORD  flags,
const D3DGAMMARAMP ramp 
)
static

Definition at line 886 of file device.c.

887{
889
890 TRACE("iface %p, flags %#x, ramp %p.\n", iface, flags, ramp);
891
892 /* Note: D3DGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
894 wined3d_device_set_gamma_ramp(device->wined3d_device, 0, flags, (const struct wined3d_gamma_ramp *)ramp);
896}
void CDECL wined3d_device_set_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, DWORD flags, const struct wined3d_gamma_ramp *ramp)
Definition: device.c:5057

◆ d3d8_device_SetIndices()

static HRESULT WINAPI d3d8_device_SetIndices ( IDirect3DDevice8 *  iface,
IDirect3DIndexBuffer8 *  buffer,
UINT  base_vertex_idx 
)
static

Definition at line 2721 of file device.c.

2723{
2726
2727 TRACE("iface %p, buffer %p, base_vertex_idx %u.\n", iface, buffer, base_vertex_idx);
2728
2729 /* WineD3D takes an INT(due to d3d9), but d3d8 uses UINTs. Do I have to add a check here that
2730 * the UINT doesn't cause an overflow in the INT? It seems rather unlikely because such large
2731 * vertex buffers can't be created to address them with an index that requires the 32nd bit
2732 * (4 Byte minimum vertex size * 2^31-1 -> 8 gb buffer. The index sign would be the least
2733 * problem)
2734 */
2736 wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_idx);
2738 ib ? ib->wined3d_buffer : NULL, ib ? ib->format : WINED3DFMT_UNKNOWN, 0);
2740
2741 return D3D_OK;
2742}
struct d3d8_indexbuffer * unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
Definition: buffer.c:606
struct wined3d_buffer * wined3d_buffer
Definition: d3d8_private.h:212
enum wined3d_format_id format
Definition: d3d8_private.h:214

◆ d3d8_device_SetLight()

static HRESULT WINAPI d3d8_device_SetLight ( IDirect3DDevice8 *  iface,
DWORD  index,
const D3DLIGHT8 light 
)
static

Definition at line 1601 of file device.c.

1602{
1604 HRESULT hr;
1605
1606 TRACE("iface %p, index %u, light %p.\n", iface, index, light);
1607
1608 /* Note: D3DLIGHT8 is compatible with struct wined3d_light. */
1610 hr = wined3d_device_set_light(device->wined3d_device, index, (const struct wined3d_light *)light);
1612
1613 return hr;
1614}
HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, UINT light_idx, const struct wined3d_light *light)
Definition: device.c:1580

◆ d3d8_device_SetMaterial()

static HRESULT WINAPI d3d8_device_SetMaterial ( IDirect3DDevice8 *  iface,
const D3DMATERIAL8 material 
)
static

Definition at line 1573 of file device.c.

1574{
1576
1577 TRACE("iface %p, material %p.\n", iface, material);
1578
1579 /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */
1581 wined3d_device_set_material(device->wined3d_device, (const struct wined3d_material *)material);
1583
1584 return D3D_OK;
1585}
void CDECL wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material)
Definition: device.c:1849

◆ d3d8_device_SetPaletteEntries()

static HRESULT WINAPI d3d8_device_SetPaletteEntries ( IDirect3DDevice8 *  iface,
UINT  palette_idx,
const PALETTEENTRY entries 
)
static

Definition at line 2088 of file device.c.

2090{
2091 WARN("iface %p, palette_idx %u, entries %p unimplemented\n", iface, palette_idx, entries);
2092
2093 /* GPUs stopped supporting palettized textures with the Shader Model 1 generation. Wined3d
2094 * does not have a d3d8/9-style palette API */
2095
2096 return D3D_OK;
2097}

◆ d3d8_device_SetPixelShader()

static HRESULT WINAPI d3d8_device_SetPixelShader ( IDirect3DDevice8 *  iface,
DWORD  shader 
)
static

Definition at line 2822 of file device.c.

2823{
2825 struct d3d8_pixel_shader *shader_impl;
2826
2827 TRACE("iface %p, shader %#x.\n", iface, shader);
2828
2830
2831 if (!shader)
2832 {
2835 return D3D_OK;
2836 }
2837
2838 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
2839 {
2840 WARN("Invalid handle (%#x) passed.\n", shader);
2842 return D3DERR_INVALIDCALL;
2843 }
2844
2845 TRACE("Setting shader %p.\n", shader_impl);
2846 wined3d_device_set_pixel_shader(device->wined3d_device, shader_impl->wined3d_shader);
2848
2849 return D3D_OK;
2850}
void CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader)
Definition: device.c:2509

◆ d3d8_device_SetPixelShaderConstant()

static HRESULT WINAPI d3d8_device_SetPixelShaderConstant ( IDirect3DDevice8 *  iface,
DWORD  start_register,
const void data,
DWORD  count 
)
static

Definition at line 2906 of file device.c.

2908{
2910 HRESULT hr;
2911
2912 TRACE("iface %p, start_register %u, data %p, count %u.\n",
2913 iface, start_register, data, count);
2914
2916 hr = wined3d_device_set_ps_consts_f(device->wined3d_device, start_register, count, data);
2918
2919 return hr;
2920}
HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
Definition: device.c:2679

◆ d3d8_device_SetRenderState()

static HRESULT WINAPI d3d8_device_SetRenderState ( IDirect3DDevice8 *  iface,
D3DRENDERSTATETYPE  state,
DWORD  value 
)
static

Definition at line 1687 of file device.c.

1689{
1691
1692 TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
1693
1695 switch (state)
1696 {
1697 case D3DRS_ZBIAS:
1699 break;
1700
1701 default:
1703 }
1705
1706 return D3D_OK;
1707}

◆ d3d8_device_SetRenderTarget()

static HRESULT WINAPI d3d8_device_SetRenderTarget ( IDirect3DDevice8 *  iface,
IDirect3DSurface8 *  render_target,
IDirect3DSurface8 *  depth_stencil 
)
static

Definition at line 1293 of file device.c.

1295{
1297 struct d3d8_surface *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target);
1298 struct d3d8_surface *ds_impl = unsafe_impl_from_IDirect3DSurface8(depth_stencil);
1299 struct wined3d_rendertarget_view *original_dsv, *rtv;
1300 HRESULT hr = D3D_OK;
1301
1302 TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, render_target, depth_stencil);
1303
1304 if (rt_impl && d3d8_surface_get_device(rt_impl) != device)
1305 {
1306 WARN("Render target surface does not match device.\n");
1307 return D3DERR_INVALIDCALL;
1308 }
1309
1311
1312 if (ds_impl)
1313 {
1314 struct wined3d_sub_resource_desc ds_desc, rt_desc;
1315 struct wined3d_rendertarget_view *original_rtv;
1316 struct d3d8_surface *original_surface;
1317
1318 /* If no render target is passed in check the size against the current RT */
1319 if (!render_target)
1320 {
1321 if (!(original_rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
1322 {
1324 return D3DERR_NOTFOUND;
1325 }
1326 original_surface = wined3d_rendertarget_view_get_sub_resource_parent(original_rtv);
1328 original_surface->sub_resource_idx, &rt_desc);
1329 }
1330 else
1332 rt_impl->sub_resource_idx, &rt_desc);
1333
1335
1336 if (ds_desc.width < rt_desc.width || ds_desc.height < rt_desc.height)
1337 {
1338 WARN("Depth stencil is smaller than the render target, returning D3DERR_INVALIDCALL\n");
1340 return D3DERR_INVALIDCALL;
1341 }
1342 if (ds_desc.multisample_type != rt_desc.multisample_type
1343 || ds_desc.multisample_quality != rt_desc.multisample_quality)
1344 {
1345 WARN("Multisample settings do not match, returning D3DERR_INVALIDCALL\n");
1347 return D3DERR_INVALIDCALL;
1348 }
1349 }
1350
1351 original_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device);
1352 rtv = ds_impl ? d3d8_surface_acquire_rendertarget_view(ds_impl) : NULL;
1353 wined3d_device_set_depth_stencil_view(device->wined3d_device, rtv);
1355 rtv = render_target ? d3d8_surface_acquire_rendertarget_view(rt_impl) : NULL;
1356 if (render_target && FAILED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, 0, rtv, TRUE)))
1357 wined3d_device_set_depth_stencil_view(device->wined3d_device, original_dsv);
1359
1361
1362 return hr;
1363}
struct d3d8_device * d3d8_surface_get_device(const struct d3d8_surface *surface) DECLSPEC_HIDDEN
Definition: surface.c:362
void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface, struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN
Definition: surface.c:395
struct wined3d_rendertarget_view * d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN
Definition: surface.c:369
HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device, unsigned int view_idx, struct wined3d_rendertarget_view *view, BOOL set_viewport)
Definition: device.c:4468
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
Definition: device.c:4524

◆ d3d8_device_SetStreamSource()

static HRESULT WINAPI d3d8_device_SetStreamSource ( IDirect3DDevice8 *  iface,
UINT  stream_idx,
IDirect3DVertexBuffer8 *  buffer,
UINT  stride 
)
static

Definition at line 2985 of file device.c.

2987{
2990 HRESULT hr;
2991
2992 TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n",
2993 iface, stream_idx, buffer, stride);
2994
2996 hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx,
2997 buffer_impl ? buffer_impl->wined3d_buffer : NULL, 0, stride);
2999
3000 return hr;
3001}
struct wined3d_buffer * wined3d_buffer
Definition: d3d8_private.h:199

◆ d3d8_device_SetTexture()

static HRESULT WINAPI d3d8_device_SetTexture ( IDirect3DDevice8 *  iface,
DWORD  stage,
IDirect3DBaseTexture8 *  texture 
)
static

Definition at line 1954 of file device.c.

1955{
1957 struct d3d8_texture *texture_impl;
1958 HRESULT hr;
1959
1960 TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
1961
1963
1965 hr = wined3d_device_set_texture(device->wined3d_device, stage,
1966 texture_impl ? texture_impl->wined3d_texture : NULL);
1968
1969 return hr;
1970}
struct d3d8_texture * unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture8 *iface) DECLSPEC_HIDDEN
Definition: texture.c:1061
HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, UINT stage, struct wined3d_texture *texture)
Definition: device.c:3462
struct wined3d_texture * wined3d_texture
Definition: d3d8_private.h:225

◆ d3d8_device_SetTextureStageState()

static HRESULT WINAPI d3d8_device_SetTextureStageState ( IDirect3DDevice8 *  iface,
DWORD  stage,
D3DTEXTURESTAGESTATETYPE  type,
DWORD  value 
)
static

Definition at line 2040 of file device.c.

2042{
2044 const struct tss_lookup *l;
2045
2046 TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, stage, type, value);
2047
2048 if (type >= sizeof(tss_lookup) / sizeof(*tss_lookup))
2049 {
2050 WARN("Invalid type %#x passed.\n", type);
2051 return D3D_OK;
2052 }
2053
2054 l = &tss_lookup[type];
2055
2057 if (l->sampler_state)
2058 wined3d_device_set_sampler_state(device->wined3d_device, stage, l->u.sampler_state, value);
2059 else
2060 wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->u.texture_state, value);
2062
2063 return D3D_OK;
2064}
void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
Definition: device.c:2071
void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, UINT stage, enum wined3d_texture_stage_state state, DWORD value)
Definition: device.c:3405

◆ d3d8_device_SetTransform()

static HRESULT WINAPI d3d8_device_SetTransform ( IDirect3DDevice8 *  iface,
D3DTRANSFORMSTATETYPE  state,
const D3DMATRIX matrix 
)
static

Definition at line 1486 of file device.c.

1488{
1490
1491 TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
1492
1493 /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
1495 wined3d_device_set_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix);
1497
1498 return D3D_OK;
1499}
void CDECL wined3d_device_set_transform(struct wined3d_device *device, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix)
Definition: device.c:1505

◆ d3d8_device_SetVertexShader()

static HRESULT WINAPI d3d8_device_SetVertexShader ( IDirect3DDevice8 *  iface,
DWORD  shader 
)
static

Definition at line 2514 of file device.c.

2515{
2517 struct d3d8_vertex_shader *shader_impl;
2518
2519 TRACE("iface %p, shader %#x.\n", iface, shader);
2520
2522 {
2523 TRACE("Setting FVF, %#x\n", shader);
2524
2530
2531 return D3D_OK;
2532 }
2533
2534 TRACE("Setting shader\n");
2535
2537 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
2538 {
2539 WARN("Invalid handle (%#x) passed.\n", shader);
2541
2542 return D3DERR_INVALIDCALL;
2543 }
2544
2546 shader_impl->vertex_declaration->wined3d_vertex_declaration);
2547 wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader);
2549
2550 return D3D_OK;
2551}
static struct d3d8_vertex_declaration * d3d8_device_get_fvf_declaration(struct d3d8_device *device, DWORD fvf)
Definition: device.c:2450
void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device, struct wined3d_vertex_declaration *declaration)
Definition: device.c:2157
void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
Definition: device.c:2186

◆ d3d8_device_SetVertexShaderConstant()

static HRESULT WINAPI d3d8_device_SetVertexShaderConstant ( IDirect3DDevice8 *  iface,
DWORD  start_register,
const void data,
DWORD  count 
)
static

Definition at line 2605 of file device.c.

2607{
2609 HRESULT hr;
2610
2611 TRACE("iface %p, start_register %u, data %p, count %u.\n",
2612 iface, start_register, data, count);
2613
2614 if (start_register + count > D3D8_MAX_VERTEX_SHADER_CONSTANTF)
2615 {
2616 WARN("Trying to access %u constants, but d3d8 only supports %u\n",
2617 start_register + count, D3D8_MAX_VERTEX_SHADER_CONSTANTF);
2618 return D3DERR_INVALIDCALL;
2619 }
2620
2622 hr = wined3d_device_set_vs_consts_f(device->wined3d_device, start_register, count, data);
2624
2625 return hr;
2626}
HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
Definition: device.c:2463

◆ d3d8_device_SetViewport()

static HRESULT WINAPI d3d8_device_SetViewport ( IDirect3DDevice8 *  iface,
const D3DVIEWPORT8 viewport 
)
static

Definition at line 1531 of file device.c.

1532{
1534 struct wined3d_viewport vp;
1535
1536 TRACE("iface %p, viewport %p.\n", iface, viewport);
1537
1538 vp.x = viewport->X;
1539 vp.y = viewport->Y;
1540 vp.width = viewport->Width;
1541 vp.height = viewport->Height;
1542 vp.min_z = viewport->MinZ;
1543 vp.max_z = viewport->MaxZ;
1544
1546 wined3d_device_set_viewport(device->wined3d_device, &vp);
1548
1549 return D3D_OK;
1550}
void CDECL wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport)
Definition: device.c:1931

◆ d3d8_device_ShowCursor()

static BOOL WINAPI d3d8_device_ShowCursor ( IDirect3DDevice8 *  iface,
BOOL  show 
)
static

Definition at line 681 of file device.c.

682{
684 BOOL ret;
685
686 TRACE("iface %p, show %#x.\n", iface, show);
687
689 ret = wined3d_device_show_cursor(device->wined3d_device, show);
691
692 return ret;
693}
BOOL CDECL wined3d_device_show_cursor(struct wined3d_device *device, BOOL show)
Definition: device.c:4719
unsigned int BOOL
Definition: ntddk_ex.h:94

◆ d3d8_device_TestCooperativeLevel()

static HRESULT WINAPI d3d8_device_TestCooperativeLevel ( IDirect3DDevice8 *  iface)
static

Definition at line 526 of file device.c.

527{
529
530 TRACE("iface %p.\n", iface);
531
532 TRACE("device state: %#x.\n", device->device_state);
533
534 switch (device->device_state)
535 {
536 default:
538 return D3D_OK;
540 return D3DERR_DEVICELOST;
543 }
544}
#define D3DERR_DEVICENOTRESET
Definition: d3d8.h:83

◆ d3d8_device_UpdateTexture()

static HRESULT WINAPI d3d8_device_UpdateTexture ( IDirect3DDevice8 *  iface,
IDirect3DBaseTexture8 *  src_texture,
IDirect3DBaseTexture8 *  dst_texture 
)
static

Definition at line 1251 of file device.c.

1253{
1255 struct d3d8_texture *src_impl, *dst_impl;
1256 HRESULT hr;
1257
1258 TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, src_texture, dst_texture);
1259
1260 src_impl = unsafe_impl_from_IDirect3DBaseTexture8(src_texture);
1261 dst_impl = unsafe_impl_from_IDirect3DBaseTexture8(dst_texture);
1262
1264 hr = wined3d_device_update_texture(device->wined3d_device,
1265 src_impl->wined3d_texture, dst_impl->wined3d_texture);
1267
1268 return hr;
1269}
HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
Definition: device.c:3808

◆ d3d8_device_ValidateDevice()

static HRESULT WINAPI d3d8_device_ValidateDevice ( IDirect3DDevice8 *  iface,
DWORD pass_count 
)
static

Definition at line 2066 of file device.c.

2067{
2069 HRESULT hr;
2070
2071 TRACE("iface %p, pass_count %p.\n", iface, pass_count);
2072
2074 hr = wined3d_device_validate_device(device->wined3d_device, pass_count);
2076
2077 return hr;
2078}
HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes)
Definition: device.c:3905

◆ d3d8_free_handle()

static void * d3d8_free_handle ( struct d3d8_handle_table t,
DWORD  handle,
enum d3d8_handle_type  type 
)
static

Definition at line 404 of file device.c.

405{
406 struct d3d8_handle_entry *entry;
407 void *object;
408
409 if (handle == D3D8_INVALID_HANDLE || handle >= t->entry_count)
410 {
411 WARN("Invalid handle %u passed.\n", handle);
412 return NULL;
413 }
414
415 entry = &t->entries[handle];
416 if (entry->type != type)
417 {
418 WARN("Handle %u(%p) is not of type %#x.\n", handle, entry, type);
419 return NULL;
420 }
421
422 object = entry->object;
423 entry->object = t->free_entries;
424 entry->type = D3D8_HANDLE_FREE;
425 t->free_entries = entry;
426
427 return object;
428}

Referenced by d3d8_device_CreatePixelShader(), d3d8_device_CreateVertexShader(), d3d8_device_DeletePixelShader(), d3d8_device_DeleteStateBlock(), and d3d8_device_DeleteVertexShader().

◆ d3d8_get_object()

static void * d3d8_get_object ( struct d3d8_handle_table t,
DWORD  handle,
enum d3d8_handle_type  type 
)
static

Definition at line 430 of file device.c.

431{
432 struct d3d8_handle_entry *entry;
433
434 if (handle == D3D8_INVALID_HANDLE || handle >= t->entry_count)
435 {
436 WARN("Invalid handle %u passed.\n", handle);
437 return NULL;
438 }
439
440 entry = &t->entries[handle];
441 if (entry->type != type)
442 {
443 WARN("Handle %u(%p) is not of type %#x.\n", handle, entry, type);
444 return NULL;
445 }
446
447 return entry->object;
448}

Referenced by d3d8_device_ApplyStateBlock(), d3d8_device_CaptureStateBlock(), d3d8_device_GetPixelShaderFunction(), d3d8_device_GetVertexShaderDeclaration(), d3d8_device_GetVertexShaderFunction(), d3d8_device_SetPixelShader(), and d3d8_device_SetVertexShader().

◆ d3d8_null_wined3d_object_destroyed()

static void STDMETHODCALLTYPE d3d8_null_wined3d_object_destroyed ( void parent)
static

Definition at line 37 of file device.c.

37{}

◆ 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 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_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
@ 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_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().

◆ d3dswapeffect_from_wined3dswapeffect()

static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect ( enum wined3d_swap_effect  effect)
static

Definition at line 193 of file device.c.

194{
195 switch (effect)
196 {
200 return D3DSWAPEFFECT_FLIP;
202 return D3DSWAPEFFECT_COPY;
205 default:
206 FIXME("Unhandled swap effect %#x.\n", effect);
207 return D3DSWAPEFFECT_FLIP;
208 }
209}
@ D3DSWAPEFFECT_FLIP
Definition: d3d8types.h:852
@ D3DSWAPEFFECT_DISCARD
Definition: d3d8types.h:851
@ D3DSWAPEFFECT_COPY
Definition: d3d8types.h:853
@ D3DSWAPEFFECT_COPY_VSYNC
Definition: d3d8types.h:854
@ WINED3D_SWAP_EFFECT_COPY
Definition: wined3d.h:529
@ WINED3D_SWAP_EFFECT_SEQUENTIAL
Definition: wined3d.h:526
@ WINED3D_SWAP_EFFECT_DISCARD
Definition: wined3d.h:525
@ WINED3D_SWAP_EFFECT_COPY_VSYNC
Definition: wined3d.h:530

Referenced by present_parameters_from_wined3d_swapchain_desc().

◆ device_from_device_parent()

static struct d3d8_device * device_from_device_parent ( struct wined3d_device_parent device_parent)
inlinestatic

Definition at line 3137 of file device.c.

3138{
3139 return CONTAINING_RECORD(device_parent, struct d3d8_device, device_parent);
3140}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by device_parent_activate(), device_parent_create_swapchain(), and device_parent_create_swapchain_texture().

◆ 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 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 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
void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
Definition: device.c:1290
HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc)
Definition: device.c:1061
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

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

◆ device_parent_activate()

static void CDECL device_parent_activate ( struct wined3d_device_parent device_parent,
BOOL  activate 
)
static

Definition at line 3153 of file device.c.

3154{
3156
3157 TRACE("device_parent %p, activate %#x.\n", device_parent, activate);
3158
3159 if (!activate)
3161 else
3163}
static struct d3d8_device * device_from_device_parent(struct wined3d_device_parent *device_parent)
Definition: device.c:3137
#define InterlockedCompareExchange
Definition: interlocked.h:104
struct wined3d_device_parent device_parent
Definition: d3d8_private.h:102

◆ device_parent_create_swapchain()

static HRESULT CDECL device_parent_create_swapchain ( struct wined3d_device_parent device_parent,
struct wined3d_swapchain_desc desc,
struct wined3d_swapchain **  swapchain 
)
static

Definition at line 3228 of file device.c.

3230{
3232 struct d3d8_swapchain *d3d_swapchain;
3233 HRESULT hr;
3234
3235 TRACE("device_parent %p, desc %p, swapchain %p.\n", device_parent, desc, swapchain);
3236
3237 if (FAILED(hr = d3d8_swapchain_create(device, desc, &d3d_swapchain)))
3238 {
3239 WARN("Failed to create swapchain, hr %#x.\n", hr);
3240 *swapchain = NULL;
3241 return hr;
3242 }
3243
3244 *swapchain = d3d_swapchain->wined3d_swapchain;
3245 wined3d_swapchain_incref(*swapchain);
3247
3248 return hr;
3249}
#define IDirect3DSwapChain8_Release(p)
Definition: d3d8.h:270
IDirect3DSwapChain8 IDirect3DSwapChain8_iface
Definition: d3d8_private.h:165
struct wined3d_swapchain * wined3d_swapchain
Definition: d3d8_private.h:167
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:104

◆ device_parent_create_swapchain_texture()

static HRESULT CDECL device_parent_create_swapchain_texture ( struct wined3d_device_parent device_parent,
void container_parent,
const struct wined3d_resource_desc desc,
DWORD  texture_flags,
struct wined3d_texture **  texture 
)
static

Definition at line 3203 of file device.c.

3206{
3208 struct d3d8_surface *d3d_surface;
3209 HRESULT hr;
3210
3211 TRACE("device_parent %p, container_parent %p, desc %p, texture flags %#x, texture %p.\n",
3212 device_parent, container_parent, desc, texture_flags, texture);
3213
3214 if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, 1,
3215 texture_flags | WINED3D_TEXTURE_CREATE_MAPPABLE, NULL, &device->IDirect3DDevice8_iface,
3217 {
3218 WARN("Failed to create texture, hr %#x.\n", hr);
3219 return hr;
3220 }
3221
3223 d3d_surface->parent_device = &device->IDirect3DDevice8_iface;
3224
3225 return hr;
3226}

◆ device_parent_mode_changed()

static void CDECL device_parent_mode_changed ( struct wined3d_device_parent device_parent)
static

Definition at line 3148 of file device.c.

3149{
3150 TRACE("device_parent %p.\n", device_parent);
3151}

◆ device_parent_surface_created()

static HRESULT CDECL device_parent_surface_created ( struct wined3d_device_parent device_parent,
struct wined3d_texture wined3d_texture,
unsigned int  sub_resource_idx,
void **  parent,
const struct wined3d_parent_ops **  parent_ops 
)
static

Definition at line 3165 of file device.c.

3168{
3169 struct d3d8_surface *d3d_surface;
3170
3171 TRACE("device_parent %p, wined3d_texture %p, sub_resource_idx %u, parent %p, parent_ops %p.\n",
3172 device_parent, wined3d_texture, sub_resource_idx, parent, parent_ops);
3173
3174 if (!(d3d_surface = heap_alloc_zero(sizeof(*d3d_surface))))
3175 return E_OUTOFMEMORY;
3176
3177 surface_init(d3d_surface, wined3d_texture, sub_resource_idx, parent_ops);
3178 *parent = d3d_surface;
3179 TRACE("Created surface %p.\n", d3d_surface);
3180
3181 return D3D_OK;
3182}
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
Definition: surface.c:317

◆ device_parent_volume_created()

static HRESULT CDECL device_parent_volume_created ( struct wined3d_device_parent device_parent,
struct wined3d_texture wined3d_texture,
unsigned int  sub_resource_idx,
void **  parent,
const struct wined3d_parent_ops **  parent_ops 
)
static

Definition at line 3184 of file device.c.

3187{
3188 struct d3d8_volume *d3d_volume;
3189
3190 TRACE("device_parent %p, texture %p, sub_resource_idx %u, parent %p, parent_ops %p.\n",
3191 device_parent, wined3d_texture, sub_resource_idx, parent, parent_ops);
3192
3193 if (!(d3d_volume = heap_alloc_zero(sizeof(*d3d_volume))))
3194 return E_OUTOFMEMORY;
3195
3196 volume_init(d3d_volume, wined3d_texture, sub_resource_idx, parent_ops);
3197 *parent = d3d_volume;
3198 TRACE("Created volume %p.\n", d3d_volume);
3199
3200 return D3D_OK;
3201}
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
Definition: volume.c:209
unsigned int sub_resource_idx
Definition: d3d8_private.h:156

◆ device_parent_wined3d_device_created()

static void CDECL device_parent_wined3d_device_created ( struct wined3d_device_parent device_parent,
struct wined3d_device device 
)
static

Definition at line 3142 of file device.c.

3144{
3145 TRACE("device_parent %p, device %p\n", device_parent, device);
3146}

◆ present_parameters_from_wined3d_swapchain_desc()

static void present_parameters_from_wined3d_swapchain_desc ( D3DPRESENT_PARAMETERS present_parameters,
const struct wined3d_swapchain_desc swapchain_desc 
)
static

Definition at line 211 of file device.c.

213{
214 present_parameters->BackBufferWidth = swapchain_desc->backbuffer_width;
215 present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height;
216 present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc->backbuffer_format);
217 present_parameters->BackBufferCount = swapchain_desc->backbuffer_count;
218 present_parameters->MultiSampleType = swapchain_desc->multisample_type;
219 present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect);
220 present_parameters->hDeviceWindow = swapchain_desc->device_window;
221 present_parameters->Windowed = swapchain_desc->windowed;
222 present_parameters->EnableAutoDepthStencil = swapchain_desc->enable_auto_depth_stencil;
223 present_parameters->AutoDepthStencilFormat
225 present_parameters->Flags = swapchain_desc->flags & D3DPRESENTFLAGS_MASK;
226 present_parameters->FullScreen_RefreshRateInHz = swapchain_desc->refresh_rate;
227 present_parameters->FullScreen_PresentationInterval = swapchain_desc->swap_interval;
228}
#define D3DPRESENTFLAGS_MASK
Definition: d3d8_private.h:40
static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect(enum wined3d_swap_effect effect)
Definition: device.c:193
D3DSWAPEFFECT SwapEffect
Definition: d3d8types.h:1128
D3DMULTISAMPLE_TYPE MultiSampleType
Definition: d3d8types.h:1126
D3DFORMAT BackBufferFormat
Definition: d3d8types.h:1123
UINT FullScreen_PresentationInterval
Definition: d3d8types.h:1136
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
BOOL enable_auto_depth_stencil
Definition: wined3d.h:1742

Referenced by d3d8_device_CreateAdditionalSwapChain(), d3d9_device_CreateAdditionalSwapChain(), d3d9_swapchain_GetPresentParameters(), and device_init().

◆ reset_enum_callback()

static HRESULT CDECL reset_enum_callback ( struct wined3d_resource resource)
static

Definition at line 740 of file device.c.

741{
743 IDirect3DBaseTexture8 *texture;
744 struct d3d8_surface *surface;
746
749 return D3D_OK;
750
751 if (desc.resource_type != WINED3D_RTYPE_TEXTURE_2D)
752 {
753 WARN("Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", resource);
754 return D3DERR_DEVICELOST;
755 }
756
758 if (parent && SUCCEEDED(IUnknown_QueryInterface(parent, &IID_IDirect3DBaseTexture8, (void **)&texture)))
759 {
761 WARN("Texture %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", texture, resource);
762 return D3DERR_DEVICELOST;
763 }
764
766 if (!surface->resource.refcount)
767 return D3D_OK;
768
769 WARN("Surface %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface);
770 return D3DERR_DEVICELOST;
771}
void *CDECL wined3d_resource_get_parent(const struct wined3d_resource *resource)
Definition: resource.c:285
void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc)
Definition: resource.c:295
struct wined3d_texture *__cdecl wined3d_texture_from_resource(struct wined3d_resource *resource)
Definition: texture.c:2210
#define IDirect3DBaseTexture8_Release(p)
Definition: d3d8.h:546
struct d3d8_resource resource
Definition: d3d8_private.h:177
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56

Referenced by d3d8_device_Reset(), and d3d9_device_reset().

◆ setup_fpu()

static void setup_fpu ( void  )
static

Definition at line 3262 of file device.c.

3263{
3264#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
3265 WORD cw;
3266 __asm__ volatile ("fnstcw %0" : "=m" (cw));
3267 cw = (cw & ~0xf3f) | 0x3f;
3268 __asm__ volatile ("fldcw %0" : : "m" (cw));
3269#elif defined(__i386__) && defined(_MSC_VER)
3270 WORD cw;
3271 __asm fnstcw cw;
3272 cw = (cw & ~0xf3f) | 0x3f;
3273 __asm fldcw cw;
3274#else
3275 FIXME("FPU setup not implemented for this platform.\n");
3276#endif
3277}
unsigned short WORD
Definition: ntddk_ex.h:93
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tmov %rdx, %rbp\n" "\tjmp *%rax\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")

Referenced by device_init().

◆ vertex_count_from_primitive_count()

static UINT vertex_count_from_primitive_count ( D3DPRIMITIVETYPE  primitive_type,
UINT  primitive_count 
)
static

Definition at line 167 of file device.c.

168{
169 switch (primitive_type)
170 {
171 case D3DPT_POINTLIST:
172 return primitive_count;
173
174 case D3DPT_LINELIST:
175 return primitive_count * 2;
176
177 case D3DPT_LINESTRIP:
178 return primitive_count + 1;
179
181 return primitive_count * 3;
182
185 return primitive_count + 2;
186
187 default:
188 FIXME("Unhandled primitive type %#x.\n", primitive_type);
189 return 0;
190 }
191}
@ D3DPT_LINELIST
Definition: d3d8types.h:719
@ D3DPT_POINTLIST
Definition: d3d8types.h:718
@ D3DPT_TRIANGLELIST
Definition: d3d8types.h:721
@ D3DPT_LINESTRIP
Definition: d3d8types.h:720
@ D3DPT_TRIANGLEFAN
Definition: d3d8types.h:723
@ D3DPT_TRIANGLESTRIP
Definition: d3d8types.h:722

Referenced by d3d8_device_DrawIndexedPrimitive(), d3d8_device_DrawIndexedPrimitiveUP(), d3d8_device_DrawPrimitive(), d3d8_device_DrawPrimitiveUP(), d3d9_device_DrawIndexedPrimitive(), d3d9_device_DrawIndexedPrimitiveUP(), d3d9_device_DrawPrimitive(), and d3d9_device_DrawPrimitiveUP().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d8  )

◆ wined3d_swapchain_desc_from_present_parameters()

static BOOL wined3d_swapchain_desc_from_present_parameters ( struct wined3d_swapchain_desc swapchain_desc,
const D3DPRESENT_PARAMETERS present_parameters 
)
static

Definition at line 248 of file device.c.

250{
251 if (!present_parameters->SwapEffect || present_parameters->SwapEffect > D3DSWAPEFFECT_COPY_VSYNC)
252 {
253 WARN("Invalid swap effect %u passed.\n", present_parameters->SwapEffect);
254 return FALSE;
255 }
256 if (present_parameters->BackBufferCount > 3
257 || ((present_parameters->SwapEffect == D3DSWAPEFFECT_COPY
258 || present_parameters->SwapEffect == D3DSWAPEFFECT_COPY_VSYNC)
259 && present_parameters->BackBufferCount > 1))
260 {
261 WARN("Invalid backbuffer count %u.\n", present_parameters->BackBufferCount);
262 return FALSE;
263 }
264
265 swapchain_desc->backbuffer_width = present_parameters->BackBufferWidth;
266 swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
267 swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
268 swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount);
270 swapchain_desc->multisample_type = present_parameters->MultiSampleType;
271 swapchain_desc->multisample_quality = 0; /* d3d9 only */
272 swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect);
273 swapchain_desc->device_window = present_parameters->hDeviceWindow;
274 swapchain_desc->windowed = present_parameters->Windowed;
275 swapchain_desc->enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil;
276 swapchain_desc->auto_depth_stencil_format
278 swapchain_desc->flags
280 swapchain_desc->refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
281 swapchain_desc->swap_interval = present_parameters->FullScreen_PresentationInterval;
282 swapchain_desc->auto_restore_display_mode = TRUE;
283
284 if (present_parameters->Flags & ~D3DPRESENTFLAGS_MASK)
285 FIXME("Unhandled flags %#x.\n", present_parameters->Flags & ~D3DPRESENTFLAGS_MASK);
286
287 return TRUE;
288}
#define FALSE
Definition: types.h:117
static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFECT effect)
Definition: device.c:230
BOOL auto_restore_display_mode
Definition: wined3d.h:1747
#define WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
Definition: wined3d.h:883
#define WINED3DUSAGE_RENDERTARGET
Definition: wined3d.h:899

Referenced by d3d8_device_CreateAdditionalSwapChain(), d3d8_device_Reset(), d3d9_device_CreateAdditionalSwapChain(), d3d9_device_reset(), and device_init().

◆ 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

◆ wined3dswapeffect_from_d3dswapeffect()

static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect ( D3DSWAPEFFECT  effect)
static

Definition at line 230 of file device.c.

231{
232 switch (effect)
233 {
242 default:
243 FIXME("Unhandled swap effect %#x.\n", effect);
245 }
246}

Referenced by wined3d_swapchain_desc_from_present_parameters().

Variable Documentation

◆ d3d8_device_vtbl

const struct IDirect3DDevice8Vtbl d3d8_device_vtbl
static

Definition at line 3036 of file device.c.

Referenced by device_init().

◆ d3d8_null_wined3d_parent_ops

const struct wined3d_parent_ops d3d8_null_wined3d_parent_ops
static
Initial value:
=
{
}
static void STDMETHODCALLTYPE d3d8_null_wined3d_object_destroyed(void *parent)
Definition: device.c:37

Definition at line 39 of file device.c.

Referenced by d3d8_device_create_surface(), d3d8_device_prepare_index_buffer(), d3d8_device_prepare_vertex_buffer(), and device_parent_create_swapchain_texture().

◆ d3d8_wined3d_device_parent_ops

const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops
static
Initial value:
=
{
}
static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
Definition: device.c:3148
static void CDECL device_parent_activate(struct wined3d_device_parent *device_parent, BOOL activate)
Definition: device.c:3153
static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent *device_parent, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, void **parent, const struct wined3d_parent_ops **parent_ops)
Definition: device.c:3165
static HRESULT CDECL device_parent_volume_created(struct wined3d_device_parent *device_parent, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, void **parent, const struct wined3d_parent_ops **parent_ops)
Definition: device.c:3184
static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent, struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
Definition: device.c:3228
static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_device_parent *device_parent, void *container_parent, const struct wined3d_resource_desc *desc, DWORD texture_flags, struct wined3d_texture **texture)
Definition: device.c:3203
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent, struct wined3d_device *device)
Definition: device.c:3142

Definition at line 3251 of file device.c.

Referenced by device_init().

◆ tss_lookup