ReactOS 0.4.17-dev-966-gf06eace
device.c File Reference
#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, unsigned int usage)
 
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, DWORD presentation_interval)
 
static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect (D3DSWAPEFFECT effect)
 
static enum wined3d_swap_interval wined3dswapinterval_from_d3d (DWORD interval)
 
static enum wined3d_multisample_type wined3d_multisample_type_from_d3d (D3DMULTISAMPLE_TYPE type)
 
static BOOL wined3d_swapchain_desc_from_d3d8 (struct wined3d_swapchain_desc *swapchain_desc, struct wined3d_output *output, const D3DPRESENT_PARAMETERS *present_parameters)
 
void d3dcaps_from_wined3dcaps (D3DCAPS8 *caps, const struct wined3d_caps *wined3d_caps, unsigned int adapter_ordinal)
 
static enum wined3d_transform_state wined3d_transform_state_from_d3d (D3DTRANSFORMSTATETYPE state)
 
static enum wined3d_render_state wined3d_render_state_from_d3d (D3DRENDERSTATETYPE state)
 
static enum wined3d_primitive_type wined3d_primitive_type_from_d3d (D3DPRIMITIVETYPE type)
 
static DWORD d3d8_allocate_handle (struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type)
 
static void * d3d8_free_handle (struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
 
static void * d3d8_get_object (struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
 
static void device_reset_viewport_state (struct d3d8_device *device)
 
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, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type, unsigned int bind_flags, unsigned int access, unsigned int width, unsigned int height, IDirect3DSurface8 **surface)
 
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 *enabled)
 
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 void resolve_depth_buffer (struct d3d8_device *device)
 
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 state, 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 void d3d8_device_upload_sysmem_vertex_buffers (struct d3d8_device *device, unsigned int start_vertex, unsigned int vertex_count)
 
static HRESULT d3d8_device_upload_sysmem_index_buffer (struct d3d8_device *device, unsigned int *start_idx, unsigned int idx_count)
 
static void d3d8_device_upload_managed_textures (struct d3d8_device *device)
 
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 WINAPI d3d8_device_DrawPrimitiveUP (IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT primitive_count, const void *data, UINT stride)
 
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_declaration * d3d8_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_idx, void *constants, 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_idx, void *constants, 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_device * device_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_texture_sub_resource_created (struct wined3d_device_parent *device_parent, enum wined3d_resource_type type, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, void **parent, const struct wined3d_parent_ops **parent_ops)
 
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

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

471{
472 struct d3d8_handle_entry *entry;
473
474 if (t->free_entries)
475 {
476 DWORD index = t->free_entries - t->entries;
477 /* Use a free handle */
478 entry = t->free_entries;
479 if (entry->type != D3D8_HANDLE_FREE)
480 {
481 ERR("Handle %lu(%p) is in the free list, but has type %#x.\n", index, entry, entry->type);
482 return D3D8_INVALID_HANDLE;
483 }
484 t->free_entries = entry->object;
485 entry->object = object;
486 entry->type = type;
487
488 return index;
489 }
490
491 if (!(t->entry_count < t->table_size))
492 {
493 /* Grow the table */
494 UINT new_size = t->table_size + (t->table_size >> 1);
495 struct d3d8_handle_entry *new_entries;
496
497 if (!(new_entries = realloc(t->entries, new_size * sizeof(*t->entries))))
498 {
499 ERR("Failed to grow the handle table.\n");
500 return D3D8_INVALID_HANDLE;
501 }
502 t->entries = new_entries;
503 t->table_size = new_size;
504 }
505
506 entry = &t->entries[t->entry_count];
507 entry->object = object;
508 entry->type = type;
509
510 return t->entry_count++;
511}
#define index(s, c)
Definition: various.h:29
#define ERR(fmt,...)
Definition: precomp.h:57
#define D3D8_INVALID_HANDLE
Definition: d3d8_private.h:70
@ D3D8_HANDLE_FREE
Definition: d3d8_private.h:74
#define realloc
Definition: debug_ros.c:6
size_t const new_size
Definition: expand.cpp:66
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
unsigned int UINT
Definition: sysinfo.c:13
uint32_t entry
Definition: isohybrid.c:63
Definition: d3d8_private.h:81
void * object
Definition: d3d8_private.h:82

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

590{
593
594 TRACE("%p increasing refcount to %lu.\n", iface, ref);
595
596 return ref;
597}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3d8_device * impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface)
Definition: d3d8_private.h:144
#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 2094 of file device.c.

2095{
2097 const struct wined3d_stateblock_state *state;
2099 struct wined3d_stateblock *stateblock;
2100 struct d3d8_indexbuffer *index_buffer;
2102 unsigned int i;
2103
2104 TRACE("iface %p, token %#lx.\n", iface, token);
2105
2106 if (!token)
2107 return D3D_OK;
2108
2110 if (device->recording)
2111 {
2113 WARN("Trying to apply stateblock while recording, returning D3DERR_INVALIDCALL.\n");
2114 return D3DERR_INVALIDCALL;
2115 }
2116 stateblock = d3d8_get_object(&device->handle_table, token - 1, D3D8_HANDLE_SB);
2117 if (!stateblock)
2118 {
2119 WARN("Invalid handle (%#lx) passed.\n", token);
2121 return D3DERR_INVALIDCALL;
2122 }
2123 wined3d_stateblock_apply(stateblock, device->state);
2124 device->sysmem_vb = 0;
2125 state = device->stateblock_state;
2126 for (i = 0; i < D3D8_MAX_STREAMS; ++i)
2127 {
2128 wined3d_buffer = state->streams[i].buffer;
2130 continue;
2131 if (vertex_buffer->draw_buffer)
2132 device->sysmem_vb |= 1u << i;
2133 }
2134 device->sysmem_ib = (wined3d_buffer = state->index_buffer)
2135 && (index_buffer = wined3d_buffer_get_parent(wined3d_buffer)) && index_buffer->sysmem;
2137
2138 return D3D_OK;
2139}
static int state
Definition: maze.c:121
#define WARN(fmt,...)
Definition: precomp.h:61
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
#define D3D8_MAX_STREAMS
Definition: d3d8_private.h:41
@ D3D8_HANDLE_SB
Definition: d3d8_private.h:77
#define D3D_OK
Definition: d3d.h:106
static void * d3d8_get_object(struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
Definition: device.c:539
void *CDECL wined3d_buffer_get_parent(const struct wined3d_buffer *buffer)
Definition: buffer.c:476
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
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, struct wined3d_stateblock *device_state)
Definition: stateblock.c:1156
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:544
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:539

◆ d3d8_device_BeginScene()

static HRESULT WINAPI d3d8_device_BeginScene ( IDirect3DDevice8 *  iface)
static

Definition at line 1676 of file device.c.

1677{
1679 HRESULT hr;
1680
1681 TRACE("iface %p.\n", iface);
1682
1684 hr = wined3d_device_begin_scene(device->wined3d_device);
1686
1687 return hr;
1688}
HRESULT hr
Definition: delayimp.cpp:582
HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device)
Definition: device.c:3700

◆ d3d8_device_BeginStateBlock()

static HRESULT WINAPI d3d8_device_BeginStateBlock ( IDirect3DDevice8 *  iface)
static

Definition at line 2031 of file device.c.

2032{
2034 struct wined3d_stateblock *stateblock;
2035 HRESULT hr;
2036
2037 TRACE("iface %p.\n", iface);
2038
2040 if (device->recording)
2041 {
2043 WARN("Trying to begin a stateblock while recording, returning D3DERR_INVALIDCALL.\n");
2044 return D3DERR_INVALIDCALL;
2045 }
2046
2047 if (SUCCEEDED(hr = wined3d_stateblock_create(device->wined3d_device, NULL, WINED3D_SBT_RECORDED, &stateblock)))
2048 device->update_state = device->recording = stateblock;
2050
2051 return hr;
2052}
#define NULL
Definition: types.h:112
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, const struct wined3d_stateblock *device_state, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock)
Definition: stateblock.c:2508
@ WINED3D_SBT_RECORDED
Definition: wined3d.h:790

◆ d3d8_device_CaptureStateBlock()

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

Definition at line 2141 of file device.c.

2142{
2144 struct wined3d_stateblock *stateblock;
2145
2146 TRACE("iface %p, token %#lx.\n", iface, token);
2147
2149 if (device->recording)
2150 {
2152 WARN("Trying to capture stateblock while recording, returning D3DERR_INVALIDCALL.\n");
2153 return D3DERR_INVALIDCALL;
2154 }
2155 stateblock = d3d8_get_object(&device->handle_table, token - 1, D3D8_HANDLE_SB);
2156 if (!stateblock)
2157 {
2158 WARN("Invalid handle (%#lx) passed.\n", token);
2160 return D3DERR_INVALIDCALL;
2161 }
2162 wined3d_stateblock_capture(stateblock, device->state);
2164
2165 return D3D_OK;
2166}
void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock, const struct wined3d_stateblock *device_state)
Definition: stateblock.c:893

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

1706{
1707 const struct wined3d_color c =
1708 {
1709 ((color >> 16) & 0xff) / 255.0f,
1710 ((color >> 8) & 0xff) / 255.0f,
1711 (color & 0xff) / 255.0f,
1712 ((color >> 24) & 0xff) / 255.0f,
1713 };
1715 HRESULT hr;
1716
1717 TRACE("iface %p, rect_count %lu, rects %p, flags %#lx, color 0x%08lx, z %.8e, stencil %lu.\n",
1718 iface, rect_count, rects, flags, color, z, stencil);
1719
1720 if (rect_count && !rects)
1721 {
1722 WARN("count %lu with NULL rects.\n", rect_count);
1723 rect_count = 0;
1724 }
1725
1727 wined3d_stateblock_apply_clear_state(device->state, device->wined3d_device);
1728 hr = wined3d_device_clear(device->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
1730
1731 return hr;
1732}
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, unsigned int rect_count, const RECT *rects, uint32_t flags, const struct wined3d_color *color, float depth, unsigned int stencil)
Definition: device.c:3729
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
Definition: dcommon.idl:28
void CDECL wined3d_stateblock_apply_clear_state(struct wined3d_stateblock *stateblock, struct wined3d_device *device)
Definition: stateblock.c:2917

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

1397{
1401 enum wined3d_format_id src_format, dst_format;
1402 struct wined3d_sub_resource_desc wined3d_desc;
1403 UINT src_w, src_h;
1404
1405 TRACE("iface %p, src_surface %p, src_rects %p, rect_count %u, dst_surface %p, dst_points %p.\n",
1406 iface, src_surface, src_rects, rect_count, dst_surface, dst_points);
1407
1409 wined3d_texture_get_sub_resource_desc(src->wined3d_texture, src->sub_resource_idx, &wined3d_desc);
1410 if (wined3d_desc.bind_flags & WINED3D_BIND_DEPTH_STENCIL)
1411 {
1412 WARN("Source %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", src_surface);
1414 return D3DERR_INVALIDCALL;
1415 }
1416 src_format = wined3d_desc.format;
1417 src_w = wined3d_desc.width;
1418 src_h = wined3d_desc.height;
1419
1420 wined3d_texture_get_sub_resource_desc(dst->wined3d_texture, dst->sub_resource_idx, &wined3d_desc);
1421 if (wined3d_desc.bind_flags & WINED3D_BIND_DEPTH_STENCIL)
1422 {
1423 WARN("Destination %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", dst_surface);
1425 return D3DERR_INVALIDCALL;
1426 }
1427 dst_format = wined3d_desc.format;
1428
1429 /* Check that the source and destination formats match */
1430 if (src_format != dst_format)
1431 {
1432 WARN("Source %p format must match the destination %p format, returning D3DERR_INVALIDCALL.\n",
1433 src_surface, dst_surface);
1435 return D3DERR_INVALIDCALL;
1436 }
1437
1438 /* Quick if complete copy ... */
1439 if (!rect_count && !src_rects && !dst_points)
1440 {
1441 RECT rect = {0, 0, src_w, src_h};
1442 wined3d_device_context_blt(device->immediate_context, dst->wined3d_texture, dst->sub_resource_idx, &rect,
1443 src->wined3d_texture, src->sub_resource_idx, &rect, 0, NULL, WINED3D_TEXF_POINT);
1444 }
1445 else
1446 {
1447 unsigned int i;
1448 /* Copy rect by rect */
1449 if (src_rects && dst_points)
1450 {
1451 for (i = 0; i < rect_count; ++i)
1452 {
1453 UINT w = src_rects[i].right - src_rects[i].left;
1454 UINT h = src_rects[i].bottom - src_rects[i].top;
1455 RECT dst_rect = {dst_points[i].x, dst_points[i].y,
1456 dst_points[i].x + w, dst_points[i].y + h};
1457
1458 wined3d_device_context_blt(device->immediate_context,
1459 dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
1460 src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
1461 }
1462 }
1463 else
1464 {
1465 for (i = 0; i < rect_count; ++i)
1466 {
1467 UINT w = src_rects[i].right - src_rects[i].left;
1468 UINT h = src_rects[i].bottom - src_rects[i].top;
1469 RECT dst_rect = {0, 0, w, h};
1470
1471 wined3d_device_context_blt(device->immediate_context,
1472 dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
1473 src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
1474 }
1475 }
1476 }
1478
1479 return WINED3D_OK;
1480}
RECT rect
Definition: combotst.c:67
struct d3d8_surface * unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
Definition: surface.c:412
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:4055
HRESULT CDECL wined3d_device_context_blt(struct wined3d_device_context *context, 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, unsigned int flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: texture.c:3854
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
static const char * dst_format
Definition: dib.c:1339
long y
Definition: dcommon.idl:24
long x
Definition: dcommon.idl:24
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
#define WINED3D_OK
Definition: wined3d.h:33
@ WINED3D_TEXF_POINT
Definition: wined3d.h:706
wined3d_format_id
Definition: wined3d.h:126
#define WINED3D_BIND_DEPTH_STENCIL
Definition: wined3d.h:915

◆ d3d8_device_create_surface()

static HRESULT d3d8_device_create_surface ( struct d3d8_device *  device,
enum wined3d_format_id  format,
enum wined3d_multisample_type  multisample_type,
unsigned int  bind_flags,
unsigned int  access,
unsigned int  width,
unsigned int  height,
IDirect3DSurface8 **  surface 
)
static

Definition at line 1285 of file device.c.

1288{
1290 struct d3d8_surface *surface_impl;
1291 struct wined3d_texture *texture;
1292 HRESULT hr;
1293
1294 TRACE("device %p, format %#x, multisample_type %#x, bind_flags %#x, "
1295 "access %#x, width %u, height %u, surface %p.\n",
1296 device, format, multisample_type, bind_flags, access, width, height, surface);
1297
1298 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1299 desc.format = format;
1300 desc.multisample_type = multisample_type;
1301 desc.multisample_quality = 0;
1302 desc.usage = 0;
1303 desc.bind_flags = bind_flags;
1304 desc.access = access;
1305 desc.width = width;
1306 desc.height = height;
1307 desc.depth = 1;
1308 desc.size = 0;
1309
1311
1312 if (FAILED(hr = wined3d_texture_create(device->wined3d_device, &desc,
1314 {
1316 WARN("Failed to create texture, hr %#lx.\n", hr);
1317 return hr;
1318 }
1319
1320 if (!(surface_impl = d3d8_surface_create(texture, 0, NULL)))
1321 {
1324 return E_OUTOFMEMORY;
1325 }
1326 surface_impl->parent_device = &device->IDirect3DDevice8_iface;
1327 *surface = &surface_impl->IDirect3DSurface8_iface;
1328 IDirect3DSurface8_AddRef(*surface);
1330
1332
1333 return D3D_OK;
1334}
struct d3d8_surface * d3d8_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, IUnknown *container)
Definition: surface.c:318
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const struct wined3d_parent_ops d3d8_null_wined3d_parent_ops
Definition: device.c:28
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, uint32_t flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
Definition: texture.c:4158
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1606
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define FAILED(hr)
Definition: intsafe.h:51
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
#define IDirect3DSurface8_AddRef(p)
Definition: d3d8.h:305
IDirect3DDevice8 * parent_device
Definition: d3d8_private.h:196
IDirect3DSurface8 IDirect3DSurface8_iface
Definition: d3d8_private.h:190
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:720

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

843{
846 struct d3d8_swapchain *object;
847 unsigned int swap_interval;
848 unsigned int output_idx;
849 unsigned int i, count;
850 HRESULT hr;
851
852 TRACE("iface %p, present_parameters %p, swapchain %p.\n",
853 iface, present_parameters, swapchain);
854
855 if (!present_parameters->Windowed)
856 {
857 WARN("Trying to create an additional fullscreen swapchain, returning D3DERR_INVALIDCALL.\n");
858 return D3DERR_INVALIDCALL;
859 }
860
863 for (i = 0; i < count; ++i)
864 {
866
869
870 if (!desc.windowed)
871 {
873 WARN("Trying to create an additional swapchain in fullscreen mode, returning D3DERR_INVALIDCALL.\n");
874 return D3DERR_INVALIDCALL;
875 }
876 }
878
879 output_idx = device->adapter_ordinal;
880 if (!wined3d_swapchain_desc_from_d3d8(&desc, device->d3d_parent->wined3d_outputs[output_idx],
881 present_parameters))
882 return D3DERR_INVALIDCALL;
885 *swapchain = &object->IDirect3DSwapChain8_iface;
887 &desc, present_parameters->FullScreen_PresentationInterval);
888
889 return hr;
890}
HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapchain_desc *desc, unsigned int swap_interval, struct d3d8_swapchain **swapchain)
Definition: swapchain.c:193
static enum wined3d_swap_interval wined3dswapinterval_from_d3d(DWORD interval)
Definition: device.c:239
static BOOL wined3d_swapchain_desc_from_d3d8(struct wined3d_swapchain_desc *swapchain_desc, struct wined3d_output *output, const D3DPRESENT_PARAMETERS *present_parameters)
Definition: device.c:265
static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval)
Definition: device.c:202
struct wined3d_swapchain *CDECL wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx)
Definition: device.c:501
UINT CDECL wined3d_device_get_swapchain_count(const struct wined3d_device *device)
Definition: device.c:494
GLuint GLuint GLsizei count
Definition: gl.h:1545
UINT FullScreen_PresentationInterval
Definition: d3d8types.h:1136
unsigned int swap_interval
Definition: d3d8_private.h:182
unsigned int swap_interval
void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc)
Definition: swapchain.c:345

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

1191{
1193 struct d3d8_texture *object;
1194 unsigned int i;
1195 HRESULT hr;
1196
1197 TRACE("iface %p, edge_length %u, levels %u, usage %#lx, format %#x, pool %#x, texture %p.\n",
1198 iface, edge_length, levels, usage, format, pool, texture);
1199
1200 if (!format)
1201 return D3DERR_INVALIDCALL;
1202
1203 *texture = NULL;
1204 if (!(object = calloc(1, sizeof(*object))))
1206
1207 hr = d3d8_texture_cube_init(object, device, edge_length, levels, usage, format, pool);
1208 if (FAILED(hr))
1209 {
1210 WARN("Failed to initialize cube texture, hr %#lx.\n", hr);
1211 free(object);
1212 return hr;
1213 }
1214
1215 levels = wined3d_texture_get_level_count(object->wined3d_texture);
1216 for (i = 0; i < levels * 6; ++i)
1217 {
1218 if (!d3d8_surface_create(object->wined3d_texture, i, (IUnknown *)&object->IDirect3DBaseTexture8_iface))
1219 {
1220 IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface);
1221 return E_OUTOFMEMORY;
1222 }
1223 }
1224
1225 TRACE("Created cube texture %p.\n", object);
1226 *texture = (IDirect3DCubeTexture8 *)&object->IDirect3DBaseTexture8_iface;
1227
1228 return hr;
1229}
HRESULT d3d8_texture_cube_init(struct d3d8_texture *texture, struct d3d8_device *device, unsigned int edge_length, unsigned int level_count, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: texture.c:1141
#define free
Definition: debug_ros.c:5
UINT CDECL wined3d_texture_get_level_count(const struct wined3d_texture *texture)
Definition: texture.c:1746
GLsizei levels
Definition: glext.h:7884
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define calloc
Definition: rosglue.h:14
#define IDirect3DTexture8_Release(p)
Definition: d3d8.h:695
#define D3DERR_OUTOFVIDEOMEMORY
Definition: d3d8.h:81

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

1361{
1363
1364 TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, surface %p.\n",
1365 iface, width, height, format, multisample_type, surface);
1366
1367 if (!format)
1368 return D3DERR_INVALIDCALL;
1369
1370 *surface = NULL;
1371
1375}
static enum wined3d_multisample_type wined3d_multisample_type_from_d3d(D3DMULTISAMPLE_TYPE type)
Definition: device.c:260
static HRESULT d3d8_device_create_surface(struct d3d8_device *device, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type, unsigned int bind_flags, unsigned int access, unsigned int width, unsigned int height, IDirect3DSurface8 **surface)
Definition: device.c:1285
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format)
Definition: device.c:84
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:51

◆ d3d8_device_CreateImageSurface()

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

Definition at line 1378 of file device.c.

1380{
1382 unsigned int access = WINED3D_RESOURCE_ACCESS_CPU
1384
1385 TRACE("iface %p, width %u, height %u, format %#x, surface %p.\n",
1386 iface, width, height, format, surface);
1387
1388 *surface = NULL;
1389
1392}
@ WINED3D_MULTISAMPLE_NONE
Definition: wined3d.h:573
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:52
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:53
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:54

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

1260{
1262 struct d3d8_indexbuffer *object;
1263 HRESULT hr;
1264
1265 TRACE("iface %p, size %u, usage %#lx, format %#x, pool %#x, buffer %p.\n",
1266 iface, size, usage, format, pool, buffer);
1267
1268 if (!(object = calloc(1, sizeof(*object))))
1270
1272 if (FAILED(hr))
1273 {
1274 WARN("Failed to initialize index buffer, hr %#lx.\n", hr);
1275 free(object);
1276 return hr;
1277 }
1278
1279 TRACE("Created index buffer %p.\n", object);
1280 *buffer = &object->IDirect3DIndexBuffer8_iface;
1281
1282 return D3D_OK;
1283}
HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *device, UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: buffer.c:605
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919

◆ d3d8_device_CreatePixelShader()

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

Definition at line 3194 of file device.c.

3196{
3198 struct d3d8_pixel_shader *object;
3199 DWORD shader_handle;
3200 DWORD handle;
3201 HRESULT hr;
3202
3203 TRACE("iface %p, byte_code %p, shader %p.\n", iface, byte_code, shader);
3204
3205 if (!shader)
3206 return D3DERR_INVALIDCALL;
3207
3208 if (!(object = calloc(1, sizeof(*object))))
3209 return E_OUTOFMEMORY;
3210
3212 handle = d3d8_allocate_handle(&device->handle_table, object, D3D8_HANDLE_PS);
3215 {
3216 ERR("Failed to allocate pixel shader handle.\n");
3217 free(object);
3218 return E_OUTOFMEMORY;
3219 }
3220
3221 shader_handle = handle + VS_HIGHESTFIXEDFXF + 1;
3222
3223 hr = d3d8_pixel_shader_init(object, device, byte_code, shader_handle);
3224 if (FAILED(hr))
3225 {
3226 WARN("Failed to initialize pixel shader, hr %#lx.\n", hr);
3228 d3d8_free_handle(&device->handle_table, handle, D3D8_HANDLE_PS);
3230 free(object);
3231 *shader = 0;
3232 return hr;
3233 }
3234
3235 TRACE("Created pixel shader %p (handle %#lx).\n", object, shader_handle);
3236 *shader = shader_handle;
3237
3238 return D3D_OK;
3239}
#define VS_HIGHESTFIXEDFXF
Definition: d3d8_private.h:47
HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_device *device, const DWORD *byte_code, DWORD shader_handle)
Definition: shader.c:156
@ D3D8_HANDLE_PS
Definition: d3d8_private.h:76
static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type)
Definition: device.c:470
static void * d3d8_free_handle(struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
Definition: device.c:513
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 1336 of file device.c.

1339{
1341 unsigned int access = WINED3D_RESOURCE_ACCESS_GPU;
1342
1343 TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, lockable %#x, surface %p.\n",
1344 iface, width, height, format, multisample_type, lockable, surface);
1345
1346 if (!format)
1347 return D3DERR_INVALIDCALL;
1348
1349 *surface = NULL;
1350 if (lockable)
1352
1354 wined3d_multisample_type_from_d3d(multisample_type),
1356}
#define WINED3D_BIND_RENDER_TARGET
Definition: wined3d.h:914

◆ d3d8_device_CreateStateBlock()

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

Definition at line 2194 of file device.c.

2196{
2198 struct wined3d_stateblock *stateblock;
2199 HRESULT hr;
2200
2201 TRACE("iface %p, type %#x, handle %p.\n", iface, type, handle);
2202
2203 if (type != D3DSBT_ALL
2206 {
2207 WARN("Unexpected stateblock type, returning D3DERR_INVALIDCALL\n");
2208 return D3DERR_INVALIDCALL;
2209 }
2210
2212 if (device->recording)
2213 {
2215 WARN("Trying to create a stateblock while recording, returning D3DERR_INVALIDCALL.\n");
2216 return D3DERR_INVALIDCALL;
2217 }
2218 hr = wined3d_stateblock_create(device->wined3d_device, device->state, (enum wined3d_stateblock_type)type, &stateblock);
2219 if (FAILED(hr))
2220 {
2222 ERR("Failed to create the state block, hr %#lx.\n", hr);
2223 return hr;
2224 }
2225
2226 *handle = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB);
2228
2230 {
2231 ERR("Failed to allocate a handle.\n");
2233 wined3d_stateblock_decref(stateblock);
2235 return E_FAIL;
2236 }
2237 ++*handle;
2238
2239 TRACE("Returning %#lx (%p).\n", *handle, stateblock);
2240
2241 return hr;
2242}
@ 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:670
wined3d_stateblock_type
Definition: wined3d.h:786

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

1117{
1119 struct d3d8_texture *object;
1120 unsigned int i;
1121 HRESULT hr;
1122
1123 TRACE("iface %p, width %u, height %u, levels %u, usage %#lx, format %#x, pool %#x, texture %p.\n",
1124 iface, width, height, levels, usage, format, pool, texture);
1125
1126 if (!format)
1127 return D3DERR_INVALIDCALL;
1128
1129 *texture = NULL;
1130 if (!(object = calloc(1, sizeof(*object))))
1132
1134 if (FAILED(hr))
1135 {
1136 WARN("Failed to initialize texture, hr %#lx.\n", hr);
1137 free(object);
1138 return hr;
1139 }
1140
1141 levels = wined3d_texture_get_level_count(object->wined3d_texture);
1142 for (i = 0; i < levels; ++i)
1143 {
1144 if (!d3d8_surface_create(object->wined3d_texture, i, (IUnknown *)&object->IDirect3DBaseTexture8_iface))
1145 {
1146 IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface);
1147 return E_OUTOFMEMORY;
1148 }
1149 }
1150
1151 TRACE("Created texture %p.\n", object);
1152 *texture = (IDirect3DTexture8 *)&object->IDirect3DBaseTexture8_iface;
1153
1154 return D3D_OK;
1155}
HRESULT d3d8_texture_2d_init(struct d3d8_texture *texture, struct d3d8_device *device, unsigned int width, unsigned int height, unsigned int level_count, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: texture.c:1114

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

1233{
1235 struct d3d8_vertexbuffer *object;
1236 HRESULT hr;
1237
1238 TRACE("iface %p, size %u, usage %#lx, fvf %#lx, pool %#x, buffer %p.\n",
1239 iface, size, usage, fvf, pool, buffer);
1240
1241 if (!(object = calloc(1, sizeof(*object))))
1243
1244 hr = vertexbuffer_init(object, device, size, usage, fvf, pool);
1245 if (FAILED(hr))
1246 {
1247 WARN("Failed to initialize vertex buffer, hr %#lx.\n", hr);
1248 free(object);
1249 return hr;
1250 }
1251
1252 TRACE("Created vertex buffer %p.\n", object);
1253 *buffer = &object->IDirect3DVertexBuffer8_iface;
1254
1255 return D3D_OK;
1256}
HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *device, UINT size, DWORD usage, DWORD fvf, D3DPOOL pool)
Definition: buffer.c:284

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

2824{
2826 struct d3d8_vertex_shader *object;
2827 DWORD shader_handle;
2828 DWORD handle;
2829 HRESULT hr;
2830
2831 TRACE("iface %p, declaration %p, byte_code %p, shader %p, usage %#lx.\n",
2832 iface, declaration, byte_code, shader, usage);
2833
2834 if (!(object = calloc(1, sizeof(*object))))
2835 {
2836 *shader = 0;
2837 return E_OUTOFMEMORY;
2838 }
2839
2841 handle = d3d8_allocate_handle(&device->handle_table, object, D3D8_HANDLE_VS);
2844 {
2845 ERR("Failed to allocate vertex shader handle.\n");
2846 free(object);
2847 *shader = 0;
2848 return E_OUTOFMEMORY;
2849 }
2850
2851 shader_handle = handle + VS_HIGHESTFIXEDFXF + 1;
2852
2853 hr = d3d8_vertex_shader_init(object, device, declaration, byte_code, shader_handle, usage);
2854 if (FAILED(hr))
2855 {
2856 WARN("Failed to initialize vertex shader, hr %#lx.\n", hr);
2858 d3d8_free_handle(&device->handle_table, handle, D3D8_HANDLE_VS);
2860 free(object);
2861 *shader = 0;
2862 return hr;
2863 }
2864
2865 TRACE("Created vertex shader %p (handle %#lx).\n", object, shader_handle);
2866 *shader = shader_handle;
2867
2868 return D3D_OK;
2869}
HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_device *device, const DWORD *declaration, const DWORD *byte_code, DWORD shader_handle, DWORD usage)
Definition: shader.c:78
@ D3D8_HANDLE_VS
Definition: d3d8_private.h:75

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

1160{
1162 struct d3d8_texture *object;
1163 HRESULT hr;
1164
1165 TRACE("iface %p, width %u, height %u, depth %u, levels %u, usage %#lx, format %#x, pool %#x, texture %p.\n",
1167
1168 if (!format)
1169 return D3DERR_INVALIDCALL;
1170
1171 *texture = NULL;
1172 if (!(object = calloc(1, sizeof(*object))))
1174
1176 if (FAILED(hr))
1177 {
1178 WARN("Failed to initialize volume texture, hr %#lx.\n", hr);
1179 free(object);
1180 return hr;
1181 }
1182
1183 TRACE("Created volume texture %p.\n", object);
1184 *texture = (IDirect3DVolumeTexture8 *)&object->IDirect3DBaseTexture8_iface;
1185
1186 return D3D_OK;
1187}
HRESULT d3d8_texture_3d_init(struct d3d8_texture *texture, struct d3d8_device *device, unsigned int width, unsigned int height, unsigned int depth, unsigned int levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
Definition: texture.c:1168
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 3398 of file device.c.

3399{
3400 FIXME("iface %p, handle %#x unimplemented.\n", iface, handle);
3401 return D3DERR_INVALIDCALL;
3402}
#define FIXME(fmt,...)
Definition: precomp.h:53

◆ d3d8_device_DeletePixelShader()

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

Definition at line 3299 of file device.c.

3300{
3302 struct d3d8_pixel_shader *shader_impl;
3303
3304 TRACE("iface %p, shader %#lx.\n", iface, shader);
3305
3307
3308 if (!(shader_impl = d3d8_free_handle(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
3309 {
3310 WARN("Invalid handle (%#lx) passed.\n", shader);
3312 return D3DERR_INVALIDCALL;
3313 }
3314
3315 if (device->stateblock_state->ps == shader_impl->wined3d_shader)
3317
3319
3320 d3d8_pixel_shader_destroy(shader_impl);
3321
3322 return D3D_OK;
3323}
void d3d8_pixel_shader_destroy(struct d3d8_pixel_shader *shader)
Definition: shader.c:142
#define IDirect3DDevice8_SetPixelShader(p, a)
Definition: d3d8.h:1031
struct wined3d_shader * wined3d_shader
Definition: d3d8_private.h:292

◆ d3d8_device_DeleteStateBlock()

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

Definition at line 2168 of file device.c.

2169{
2171 struct wined3d_stateblock *stateblock;
2172
2173 TRACE("iface %p, token %#lx.\n", iface, token);
2174
2176 stateblock = d3d8_free_handle(&device->handle_table, token - 1, D3D8_HANDLE_SB);
2177
2178 if (!stateblock)
2179 {
2180 WARN("Invalid handle (%#lx) passed.\n", token);
2182 return D3DERR_INVALIDCALL;
2183 }
2184
2185 if (wined3d_stateblock_decref(stateblock))
2186 {
2187 ERR("Stateblock %p has references left, this shouldn't happen.\n", stateblock);
2188 }
2190
2191 return D3D_OK;
2192}

◆ d3d8_device_DeleteVertexShader()

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

Definition at line 2999 of file device.c.

3000{
3002 struct d3d8_vertex_shader *shader_impl;
3003
3004 TRACE("iface %p, shader %#lx.\n", iface, shader);
3005
3007 if (!(shader_impl = d3d8_free_handle(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
3008 {
3009 WARN("Invalid handle (%#lx) passed.\n", shader);
3011
3012 return D3DERR_INVALIDCALL;
3013 }
3014
3015 if (shader_impl->wined3d_shader
3016 && device->stateblock_state->vs == shader_impl->wined3d_shader)
3018
3020
3021 d3d8_vertex_shader_destroy(shader_impl);
3022
3023 return D3D_OK;
3024}
void d3d8_vertex_shader_destroy(struct d3d8_vertex_shader *shader)
Definition: shader.c:31
#define IDirect3DDevice8_SetVertexShader(p, a)
Definition: d3d8.h:1019
struct wined3d_shader * wined3d_shader
Definition: d3d8_private.h:282

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

2619{
2621 struct d3d8_vertexbuffer *vb;
2622 struct d3d8_indexbuffer *ib;
2623 unsigned int index_count, i;
2624 int base_vertex_index;
2625 HRESULT hr;
2626
2627 TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, start_idx %u, primitive_count %u.\n",
2628 iface, primitive_type, min_vertex_idx, vertex_count, start_idx, primitive_count);
2629
2630 index_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2632 if (!device->stateblock_state->index_buffer)
2633 {
2635 WARN("Index buffer not set, returning D3D_OK.\n");
2636 return D3D_OK;
2637 }
2638 base_vertex_index = device->stateblock_state->base_vertex_index;
2640 d3d8_device_upload_sysmem_vertex_buffers(device, base_vertex_index + min_vertex_idx, vertex_count);
2642 wined3d_primitive_type_from_d3d(primitive_type), 0);
2643 wined3d_device_apply_stateblock(device->wined3d_device, device->state);
2644 if (FAILED(hr = d3d8_device_upload_sysmem_index_buffer(device, &start_idx, index_count)))
2645 {
2647 return hr;
2648 }
2649 wined3d_device_context_draw_indexed(device->immediate_context, base_vertex_index, start_idx, index_count, 0, 0);
2650
2651 ib = wined3d_buffer_get_parent(device->stateblock_state->index_buffer);
2652 ib->discarded = false;
2653 for (i = 0; i < ARRAY_SIZE(device->stateblock_state->streams); ++i)
2654 {
2655 if (device->stateblock_state->streams[i].buffer)
2656 {
2657 vb = wined3d_buffer_get_parent(device->stateblock_state->streams[i].buffer);
2658 vb->discarded = false;
2659 }
2660 }
2661
2663
2664 return D3D_OK;
2665}
#define ARRAY_SIZE(A)
Definition: main.h:20
static void d3d8_device_upload_managed_textures(struct d3d8_device *device)
Definition: device.c:2564
static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, UINT primitive_count)
Definition: device.c:158
static HRESULT d3d8_device_upload_sysmem_index_buffer(struct d3d8_device *device, unsigned int *start_idx, unsigned int idx_count)
Definition: device.c:2527
static void d3d8_device_upload_sysmem_vertex_buffers(struct d3d8_device *device, unsigned int start_vertex, unsigned int vertex_count)
Definition: device.c:2486
static enum wined3d_primitive_type wined3d_primitive_type_from_d3d(D3DPRIMITIVETYPE type)
Definition: device.c:464
void CDECL wined3d_device_context_set_primitive_type(struct wined3d_device_context *context, enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count)
Definition: device.c:3779
void CDECL wined3d_device_context_draw_indexed(struct wined3d_device_context *context, int base_vertex_index, unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count)
Definition: device.c:2649
int vertex_count
Definition: d3drm.c:3528
void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, struct wined3d_stateblock *stateblock)
Definition: stateblock.c:3038

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

2712{
2713 UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2715 UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4;
2716 unsigned int base_vertex_idx, vb_pos, ib_pos;
2717 UINT vtx_size = vertex_count * vertex_stride;
2718 UINT idx_size = idx_count * idx_fmt_size;
2719 HRESULT hr;
2720
2721 TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u, "
2722 "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n",
2723 iface, primitive_type, min_vertex_idx, vertex_count, primitive_count,
2724 index_data, index_format, vertex_data, vertex_stride);
2725
2726 if (!primitive_count || !vertex_stride)
2727 {
2728 WARN("primitive_count or vertex_stride is 0, returning D3D_OK.\n");
2729 return D3D_OK;
2730 }
2731
2733
2734 if (FAILED(hr = wined3d_streaming_buffer_upload(device->wined3d_device, &device->vertex_buffer,
2735 (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size, vertex_stride, &vb_pos)))
2736 goto done;
2737
2738 if (FAILED(hr = wined3d_streaming_buffer_upload(device->wined3d_device, &device->index_buffer,
2739 index_data, idx_size, idx_fmt_size, &ib_pos)))
2740 goto done;
2741
2742 hr = wined3d_stateblock_set_stream_source(device->state, 0, device->vertex_buffer.buffer, 0, vertex_stride);
2743 if (FAILED(hr))
2744 goto done;
2745
2746 wined3d_stateblock_set_index_buffer(device->state, device->index_buffer.buffer,
2747 wined3dformat_from_d3dformat(index_format));
2748 base_vertex_idx = vb_pos / vertex_stride - min_vertex_idx;
2749 wined3d_stateblock_set_base_vertex_index(device->state, base_vertex_idx);
2750
2753 wined3d_primitive_type_from_d3d(primitive_type), 0);
2754 wined3d_device_apply_stateblock(device->wined3d_device, device->state);
2756 base_vertex_idx, ib_pos / idx_fmt_size, idx_count, 0, 0);
2757
2761
2762done:
2764 return hr;
2765}
@ D3DFMT_INDEX16
Definition: d3d8types.h:649
HRESULT CDECL wined3d_streaming_buffer_upload(struct wined3d_device *device, struct wined3d_streaming_buffer *buffer, const void *data, unsigned int size, unsigned int stride, unsigned int *ret_pos)
Definition: buffer.c:1422
void CDECL wined3d_stateblock_set_index_buffer(struct wined3d_stateblock *stateblock, struct wined3d_buffer *buffer, enum wined3d_format_id format_id)
Definition: stateblock.c:1918
void CDECL wined3d_stateblock_set_base_vertex_index(struct wined3d_stateblock *stateblock, INT base_index)
Definition: stateblock.c:1932
HRESULT CDECL wined3d_stateblock_set_stream_source(struct wined3d_stateblock *stateblock, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: stateblock.c:1939
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:127

◆ d3d8_device_DrawPrimitive()

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

Definition at line 2583 of file device.c.

2585{
2587 struct d3d8_vertexbuffer *vb;
2588 unsigned int vertex_count, i;
2589
2590 TRACE("iface %p, primitive_type %#x, start_vertex %u, primitive_count %u.\n",
2591 iface, primitive_type, start_vertex, primitive_count);
2592
2593 vertex_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2598 wined3d_primitive_type_from_d3d(primitive_type), 0);
2599 wined3d_device_apply_stateblock(device->wined3d_device, device->state);
2600 wined3d_device_context_draw(device->immediate_context, start_vertex, vertex_count, 0, 0);
2601
2602 for (i = 0; i < ARRAY_SIZE(device->stateblock_state->streams); ++i)
2603 {
2604 if (device->stateblock_state->streams[i].buffer)
2605 {
2606 vb = wined3d_buffer_get_parent(device->stateblock_state->streams[i].buffer);
2607 vb->discarded = false;
2608 }
2609 }
2610
2612
2613 return D3D_OK;
2614}
void CDECL wined3d_device_context_draw(struct wined3d_device_context *context, unsigned int start_vertex, unsigned int vertex_count, unsigned int start_instance, unsigned int instance_count)
Definition: device.c:2635

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

2670{
2672 UINT vtx_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
2673 UINT size = vtx_count * stride;
2674 unsigned int vb_pos;
2675 HRESULT hr;
2676
2677 TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n",
2678 iface, primitive_type, primitive_count, data, stride);
2679
2680 if (!primitive_count || !stride)
2681 {
2682 WARN("primitive_count or stride is 0, returning D3D_OK.\n");
2683 return D3D_OK;
2684 }
2685
2687
2688 if (FAILED(hr = wined3d_streaming_buffer_upload(device->wined3d_device,
2689 &device->vertex_buffer, data, size, stride, &vb_pos)))
2690 goto done;
2691
2692 hr = wined3d_stateblock_set_stream_source(device->state, 0, device->vertex_buffer.buffer, 0, stride);
2693 if (FAILED(hr))
2694 goto done;
2695
2698 wined3d_primitive_type_from_d3d(primitive_type), 0);
2699 wined3d_device_apply_stateblock(device->wined3d_device, device->state);
2700 wined3d_device_context_draw(device->immediate_context, vb_pos / stride, vtx_count, 0, 0);
2702
2703done:
2705 return hr;
2706}
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 3382 of file device.c.

3384{
3385 FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
3386 iface, handle, segment_count, patch_info);
3387 return D3D_OK;
3388}

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

3392{
3393 FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
3394 iface, handle, segment_count, patch_info);
3395 return D3D_OK;
3396}

◆ d3d8_device_EndScene()

static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_device_EndScene ( IDirect3DDevice8 *  iface)
static

Definition at line 1690 of file device.c.

1691{
1693 HRESULT hr;
1694
1695 TRACE("iface %p.\n", iface);
1696
1698 hr = wined3d_device_end_scene(device->wined3d_device);
1700
1701 return hr;
1702}
HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
Definition: device.c:3715

◆ d3d8_device_EndStateBlock()

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

Definition at line 2054 of file device.c.

2055{
2057 struct wined3d_stateblock *stateblock;
2058
2059 TRACE("iface %p, token %p.\n", iface, token);
2060
2061 /* Tell wineD3D to endstateblock before anything else (in case we run out
2062 * of memory later and cause locking problems)
2063 */
2065 if (!device->recording)
2066 {
2068 WARN("Trying to end a stateblock, but no stateblock is being recorded.\n");
2069 return D3DERR_INVALIDCALL;
2070 }
2071 stateblock = device->recording;
2073 device->recording = NULL;
2074 device->update_state = device->state;
2075
2076 *token = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB);
2078
2079 if (*token == D3D8_INVALID_HANDLE)
2080 {
2081 ERR("Failed to create a handle\n");
2083 wined3d_stateblock_decref(stateblock);
2085 return E_FAIL;
2086 }
2087 ++*token;
2088
2089 TRACE("Returning %#lx (%p).\n", *token, stateblock);
2090
2091 return D3D_OK;
2092}
void CDECL wined3d_stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:393

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

2872{
2873 struct d3d8_vertex_declaration *d3d8_declaration;
2874 struct FvfToDecl *convertedDecls = device->decls;
2875 int p, low, high; /* deliberately signed */
2876 HRESULT hr;
2877
2878 TRACE("Searching for declaration for fvf %#lx... ", fvf);
2879
2880 low = 0;
2881 high = device->numConvertedDecls - 1;
2882 while (low <= high)
2883 {
2884 p = (low + high) >> 1;
2885 TRACE("%d ", p);
2886
2887 if (convertedDecls[p].fvf == fvf)
2888 {
2889 TRACE("found %p\n", convertedDecls[p].declaration);
2890 return convertedDecls[p].declaration;
2891 }
2892
2893 if (convertedDecls[p].fvf < fvf)
2894 low = p + 1;
2895 else
2896 high = p - 1;
2897 }
2898 TRACE("not found. Creating and inserting at position %d.\n", low);
2899
2900 if (!(d3d8_declaration = malloc(sizeof(*d3d8_declaration))))
2901 return NULL;
2902
2903 if (FAILED(hr = d3d8_vertex_declaration_init_fvf(d3d8_declaration, device, fvf)))
2904 {
2905 WARN("Failed to initialize vertex declaration, hr %#lx.\n", hr);
2906 free(d3d8_declaration);
2907 return NULL;
2908 }
2909
2910 if (device->declArraySize == device->numConvertedDecls)
2911 {
2912 UINT grow = device->declArraySize / 2;
2913
2914 if (!(convertedDecls = realloc(convertedDecls,
2915 sizeof(*convertedDecls) * (device->numConvertedDecls + grow))))
2916 {
2917 d3d8_vertex_declaration_destroy(d3d8_declaration);
2918 return NULL;
2919 }
2920 device->decls = convertedDecls;
2921 device->declArraySize += grow;
2922 }
2923
2924 memmove(convertedDecls + low + 1, convertedDecls + low,
2925 sizeof(*convertedDecls) * (device->numConvertedDecls - low));
2926 convertedDecls[low].declaration = d3d8_declaration;
2927 convertedDecls[low].fvf = fvf;
2928 ++device->numConvertedDecls;
2929
2930 TRACE("Returning %p. %u decls in array.\n", d3d8_declaration, device->numConvertedDecls);
2931
2932 return d3d8_declaration;
2933}
void d3d8_vertex_declaration_destroy(struct d3d8_vertex_declaration *declaration)
HRESULT d3d8_vertex_declaration_init_fvf(struct d3d8_vertex_declaration *declaration, struct d3d8_device *device, DWORD fvf)
#define malloc
Definition: debug_ros.c:4
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:97
DWORD fvf
Definition: d3d8_private.h:96

Referenced by d3d8_device_SetVertexShader().

◆ d3d8_device_GetAvailableTextureMem()

static UINT WINAPI d3d8_device_GetAvailableTextureMem ( IDirect3DDevice8 *  iface)
static

Definition at line 668 of file device.c.

669{
671 UINT ret;
672
673 TRACE("iface %p.\n", iface);
674
678
679 return ret;
680}
UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device)
Definition: device.c:1754
return ret
Definition: mutex.c:147

◆ d3d8_device_GetBackBuffer()

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

Definition at line 1046 of file device.c.

1048{
1051 struct d3d8_surface *surface_impl;
1052
1053 TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
1054 iface, backbuffer_idx, backbuffer_type, backbuffer);
1055
1056 /* backbuffer_type is ignored by native. */
1057
1058 /* No need to check for backbuffer == NULL, Windows crashes in that case. */
1060
1061 if (!(wined3d_texture = wined3d_swapchain_get_back_buffer(device->implicit_swapchain, backbuffer_idx)))
1062 {
1064 *backbuffer = NULL;
1065 return D3DERR_INVALIDCALL;
1066 }
1067
1069 *backbuffer = &surface_impl->IDirect3DSurface8_iface;
1070 IDirect3DSurface8_AddRef(*backbuffer);
1071
1073 return D3D_OK;
1074}
void *CDECL wined3d_texture_get_sub_resource_parent(struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: texture.c:4033
struct wined3d_texture *CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, UINT back_buffer_idx)
Definition: swapchain.c:256

◆ d3d8_device_GetClipPlane()

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

Definition at line 1944 of file device.c.

1945{
1947
1948 TRACE("iface %p, index %lu, plane %p.\n", iface, index, plane);
1949
1950 if (index >= device->max_user_clip_planes)
1951 {
1952 TRACE("Plane %lu requested, but only %u planes are supported.\n", index, device->max_user_clip_planes);
1954 }
1955
1957 memcpy(plane, &device->stateblock_state->clip_planes[index], sizeof(struct wined3d_vec4));
1959
1960 return D3D_OK;
1961}
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
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:44

◆ d3d8_device_GetClipStatus()

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

Definition at line 2259 of file device.c.

2260{
2262 HRESULT hr;
2263
2264 TRACE("iface %p, clip_status %p.\n", iface, clip_status);
2265
2267 hr = wined3d_device_get_clip_status(device->wined3d_device, (struct wined3d_clip_status *)clip_status);
2269
2270 return hr;
2271}
HRESULT CDECL wined3d_device_get_clip_status(const struct wined3d_device *device, struct wined3d_clip_status *clip_status)
Definition: device.c:1820

◆ d3d8_device_GetCreationParameters()

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

Definition at line 754 of file device.c.

756{
758
759 TRACE("iface %p, parameters %p.\n", iface, parameters);
760
765
766 parameters->AdapterOrdinal = device->adapter_ordinal;
767 return D3D_OK;
768}
void CDECL wined3d_device_get_creation_parameters(const struct wined3d_device *device, struct wined3d_device_creation_parameters *parameters)
Definition: device.c:5274
static BYTE parameters[]
Definition: asn.c:558

◆ d3d8_device_GetCurrentTexturePalette()

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

Definition at line 2479 of file device.c.

2480{
2481 FIXME("iface %p, palette_idx %p unimplemented.\n", iface, palette_idx);
2482
2483 return D3DERR_INVALIDCALL;
2484}

◆ d3d8_device_GetDepthStencilSurface()

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

Definition at line 1645 of file device.c.

1646{
1648 struct wined3d_rendertarget_view *wined3d_dsv;
1649 struct d3d8_surface *surface_impl;
1650 HRESULT hr = D3D_OK;
1651
1652 TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil);
1653
1654 if (!depth_stencil)
1655 return D3DERR_INVALIDCALL;
1656
1658 if ((wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
1659 {
1660 /* We want the sub resource parent here, since the view itself may be
1661 * internal to wined3d and may not have a parent. */
1662 surface_impl = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_dsv);
1663 *depth_stencil = &surface_impl->IDirect3DSurface8_iface;
1665 }
1666 else
1667 {
1670 }
1672
1673 return hr;
1674}
struct wined3d_rendertarget_view *CDECL wined3d_device_context_get_depth_stencil_view(const struct wined3d_device_context *context)
Definition: device.c:4676
void *CDECL wined3d_rendertarget_view_get_sub_resource_parent(const struct wined3d_rendertarget_view *view)
Definition: view.c:407
static void depth_stencil(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:766
#define D3DERR_NOTFOUND
Definition: d3d8.h:76

◆ d3d8_device_GetDeviceCaps()

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

Definition at line 711 of file device.c.

712{
715 HRESULT hr;
716
717 TRACE("iface %p, caps %p.\n", iface, caps);
718
719 if (!caps)
720 return D3DERR_INVALIDCALL;
721
725
726 d3dcaps_from_wined3dcaps(caps, &wined3d_caps, device->adapter_ordinal);
727
728 return hr;
729}
void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const struct wined3d_caps *wined3d_caps, unsigned int adapter_ordinal)
Definition: device.c:321
HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, struct wined3d_caps *caps)
Definition: device.c:3679

◆ d3d8_device_GetDirect3D()

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

Definition at line 698 of file device.c.

699{
701
702 TRACE("iface %p, d3d8 %p.\n", iface, d3d8);
703
704 if (!d3d8)
705 return D3DERR_INVALIDCALL;
706
707 return IDirect3D8_QueryInterface(&device->d3d_parent->IDirect3D8_iface, &IID_IDirect3D8,
708 (void **)d3d8);
709}
#define IDirect3D8_QueryInterface(p, a, b)
Definition: d3d8.h:155

◆ d3d8_device_GetDisplayMode()

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

Definition at line 731 of file device.c.

732{
734 struct wined3d_display_mode wined3d_mode;
735 HRESULT hr;
736
737 TRACE("iface %p, mode %p.\n", iface, mode);
738
740 hr = wined3d_device_get_display_mode(device->wined3d_device, 0, &wined3d_mode, NULL);
742
743 if (SUCCEEDED(hr))
744 {
745 mode->Width = wined3d_mode.width;
746 mode->Height = wined3d_mode.height;
747 mode->RefreshRate = wined3d_mode.refresh_rate;
748 mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id);
749 }
750
751 return hr;
752}
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format)
Definition: device.c:33
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:3686
GLenum mode
Definition: glext.h:6217

◆ d3d8_device_GetFrontBuffer()

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

Definition at line 1508 of file device.c.

1509{
1511 struct d3d8_surface *dst_impl = unsafe_impl_from_IDirect3DSurface8(dst_surface);
1512 HRESULT hr;
1513
1514 TRACE("iface %p, dst_surface %p.\n", iface, dst_surface);
1515
1516 if (!dst_surface)
1517 {
1518 WARN("Invalid destination surface passed.\n");
1519 return D3DERR_INVALIDCALL;
1520 }
1521
1524 dst_impl->wined3d_texture, dst_impl->sub_resource_idx);
1526
1527 return hr;
1528}
unsigned int sub_resource_idx
Definition: d3d8_private.h:193
struct wined3d_texture * wined3d_texture
Definition: d3d8_private.h:192
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:235

◆ d3d8_device_GetGammaRamp()

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

Definition at line 1102 of file device.c.

1103{
1105
1106 TRACE("iface %p, ramp %p.\n", iface, ramp);
1107
1108 /* Note: D3DGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
1110 wined3d_device_get_gamma_ramp(device->wined3d_device, 0, (struct wined3d_gamma_ramp *)ramp);
1112}
void CDECL wined3d_device_get_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_gamma_ramp *ramp)
Definition: device.c:5301
static const BYTE ramp[17]
Definition: dib.c:2957

◆ d3d8_device_GetIndices()

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

Definition at line 3162 of file device.c.

3164{
3166 const struct wined3d_stateblock_state *state;
3168 struct d3d8_indexbuffer *buffer_impl;
3169
3170 TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, buffer, base_vertex_index);
3171
3172 if (!buffer)
3173 return D3DERR_INVALIDCALL;
3174
3175 /* The case from UINT to INT is safe because d3d8 will never set negative values */
3177 state = device->stateblock_state;
3178 *base_vertex_index = state->base_vertex_index;
3179 if ((wined3d_buffer = state->index_buffer))
3180 {
3182 *buffer = &buffer_impl->IDirect3DIndexBuffer8_iface;
3184 }
3185 else
3186 {
3187 *buffer = NULL;
3188 }
3190
3191 return D3D_OK;
3192}
#define IDirect3DIndexBuffer8_AddRef(p)
Definition: d3d8.h:477
IDirect3DIndexBuffer8 IDirect3DIndexBuffer8_iface
Definition: d3d8_private.h:227

◆ d3d8_device_GetInfo()

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

Definition at line 2443 of file device.c.

2445{
2446 TRACE("iface %p, info_id %#lx, info %p, info_size %lu.\n", iface, info_id, info, info_size);
2447
2448 if (info_id < 4)
2449 return E_FAIL;
2450 return S_FALSE;
2451}
#define S_FALSE
Definition: winerror.h:3451

◆ d3d8_device_GetLight()

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

Definition at line 1885 of file device.c.

1886{
1888 BOOL enabled;
1889 HRESULT hr;
1890
1891 TRACE("iface %p, index %lu, light %p.\n", iface, index, light);
1892
1893 /* Note: D3DLIGHT8 is compatible with struct wined3d_light. */
1897
1898 return hr;
1899}
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
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
HRESULT CDECL wined3d_stateblock_get_light(const struct wined3d_stateblock *stateblock, UINT light_idx, struct wined3d_light *light, BOOL *enabled)
Definition: stateblock.c:2069

◆ d3d8_device_GetLightEnable()

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

Definition at line 1915 of file device.c.

1916{
1918 struct wined3d_light light;
1919 HRESULT hr;
1920
1921 TRACE("iface %p, index %lu, enabled %p.\n", iface, index, enabled);
1922
1926
1927 return hr;
1928}

◆ d3d8_device_GetMaterial()

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

Definition at line 1856 of file device.c.

1857{
1859
1860 TRACE("iface %p, material %p.\n", iface, material);
1861
1862 /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */
1864 memcpy(material, &device->stateblock_state->material, sizeof(*material));
1866
1867 return D3D_OK;
1868}

◆ d3d8_device_GetPaletteEntries()

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

Definition at line 2464 of file device.c.

2466{
2467 FIXME("iface %p, palette_idx %u, entries %p unimplemented.\n", iface, palette_idx, entries);
2468
2469 return D3DERR_INVALIDCALL;
2470}

◆ d3d8_device_GetPixelShader()

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

Definition at line 3271 of file device.c.

3272{
3274 struct wined3d_shader *object;
3275
3276 TRACE("iface %p, shader %p.\n", iface, shader);
3277
3278 if (!shader)
3279 return D3DERR_INVALIDCALL;
3280
3282 if ((object = device->stateblock_state->ps))
3283 {
3284 struct d3d8_pixel_shader *d3d8_shader;
3285 d3d8_shader = wined3d_shader_get_parent(object);
3286 *shader = d3d8_shader->handle;
3287 }
3288 else
3289 {
3290 *shader = 0;
3291 }
3293
3294 TRACE("Returning %#lx.\n", *shader);
3295
3296 return D3D_OK;
3297}
void *CDECL wined3d_shader_get_parent(const struct wined3d_shader *shader)
Definition: shader.c:2605

◆ d3d8_device_GetPixelShaderConstant()

static HRESULT WINAPI d3d8_device_GetPixelShaderConstant ( IDirect3DDevice8 *  iface,
DWORD  start_idx,
void *  constants,
DWORD  count 
)
static

Definition at line 3340 of file device.c.

3342{
3344 HRESULT hr;
3345
3346 TRACE("iface %p, start_idx %lu, constants %p, count %lu.\n", iface, start_idx, constants, count);
3347
3350
3354
3355 return hr;
3356}
#define D3D8_MAX_PIXEL_SHADER_CONSTANTF
Definition: d3d8_private.h:40
constants
Definition: resource.c:30
HRESULT CDECL wined3d_stateblock_get_ps_consts_f(struct wined3d_stateblock *stateblock, unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants)
Definition: stateblock.c:1529
static bool wined3d_bound_range(unsigned int start, unsigned int count, unsigned int limit)
Definition: wined3d.h:2995

◆ d3d8_device_GetPixelShaderFunction()

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

Definition at line 3358 of file device.c.

3360{
3362 struct d3d8_pixel_shader *shader_impl = NULL;
3363 HRESULT hr;
3364
3365 TRACE("iface %p, shader %#lx, data %p, data_size %p.\n", iface, shader, data, data_size);
3366
3368 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
3369 {
3370 WARN("Invalid handle (%#lx) passed.\n", shader);
3372
3373 return D3DERR_INVALIDCALL;
3374 }
3375
3376 hr = wined3d_shader_get_byte_code(shader_impl->wined3d_shader, data, (unsigned int *)data_size);
3378
3379 return hr;
3380}
HRESULT CDECL wined3d_shader_get_byte_code(const struct wined3d_shader *shader, void *byte_code, UINT *byte_code_size)
Definition: shader.c:2612

◆ d3d8_device_GetRasterStatus()

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

Definition at line 1076 of file device.c.

1077{
1079 HRESULT hr;
1080
1081 TRACE("iface %p, raster_status %p.\n", iface, raster_status);
1082
1084 hr = wined3d_device_get_raster_status(device->wined3d_device, 0, (struct wined3d_raster_status *)raster_status);
1086
1087 return hr;
1088}
HRESULT CDECL wined3d_device_get_raster_status(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_raster_status *raster_status)
Definition: device.c:4055

◆ d3d8_device_GetRenderState()

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

Definition at line 2007 of file device.c.

2009{
2012
2013 TRACE("iface %p, state %#x, value %p.\n", iface, state, value);
2014
2016 device_state = device->stateblock_state;
2017 switch (state)
2018 {
2019 case D3DRS_ZBIAS:
2021 break;
2022
2023 default:
2024 *value = device_state->rs[state];
2025 }
2027
2028 return D3D_OK;
2029}
@ D3DRS_ZBIAS
Definition: d3d8types.h:753
Definition: pdh_main.c:64
@ WINED3D_RS_DEPTHBIAS
Definition: wined3d.h:401

◆ d3d8_device_GetRenderTarget()

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

Definition at line 1612 of file device.c.

1613{
1615 struct wined3d_rendertarget_view *wined3d_rtv;
1616 struct d3d8_surface *surface_impl;
1617 HRESULT hr;
1618
1619 TRACE("iface %p, render_target %p.\n", iface, render_target);
1620
1621 if (!render_target)
1622 return D3DERR_INVALIDCALL;
1623
1626 {
1627 /* We want the sub resource parent here, since the view itself may be
1628 * internal to wined3d and may not have a parent. */
1630 *render_target = &surface_impl->IDirect3DSurface8_iface;
1631 IDirect3DSurface8_AddRef(*render_target);
1632 hr = D3D_OK;
1633 }
1634 else
1635 {
1636 ERR("Failed to get wined3d render target.\n");
1637 *render_target = NULL;
1639 }
1641
1642 return hr;
1643}
struct wined3d_rendertarget_view *CDECL wined3d_device_context_get_rendertarget_view(const struct wined3d_device_context *context, unsigned int view_idx)
Definition: device.c:4659
struct wined3d_rendertarget_view * wined3d_rtv
Definition: d3d8_private.h:195

◆ d3d8_device_GetStreamSource()

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

Definition at line 3449 of file device.c.

3451{
3453 const struct wined3d_stateblock_state *state;
3454 const struct wined3d_stream_state *stream;
3455 struct d3d8_vertexbuffer *buffer_impl;
3456
3457 TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n",
3458 iface, stream_idx, buffer, stride);
3459
3460 if (!buffer)
3461 return D3DERR_INVALIDCALL;
3462
3463 if (stream_idx >= ARRAY_SIZE(state->streams))
3464 {
3465 WARN("Stream index %u out of range.\n", stream_idx);
3466 return D3DERR_INVALIDCALL;
3467 }
3468
3470 state = device->stateblock_state;
3471 stream = &state->streams[stream_idx];
3472 if (stream->buffer)
3473 {
3474 buffer_impl = wined3d_buffer_get_parent(stream->buffer);
3475 *buffer = &buffer_impl->IDirect3DVertexBuffer8_iface;
3477 }
3478 else
3479 *buffer = NULL;
3480 *stride = stream->stride;
3482
3483 return D3D_OK;
3484}
#define IDirect3DVertexBuffer8_AddRef(p)
Definition: d3d8.h:413
IDirect3DVertexBuffer8 IDirect3DVertexBuffer8_iface
Definition: d3d8_private.h:212
Definition: parse.h:23

◆ d3d8_device_GetTexture()

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

Definition at line 2273 of file device.c.

2274{
2277 struct d3d8_texture *texture_impl;
2278
2279 TRACE("iface %p, stage %lu, texture %p.\n", iface, stage, texture);
2280
2281 if (!texture)
2282 return D3DERR_INVALIDCALL;
2283
2284 if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS)
2285 {
2286 WARN("Ignoring invalid stage %lu.\n", stage);
2287 *texture = NULL;
2288 return D3D_OK;
2289 }
2290
2292 if ((wined3d_texture = device->stateblock_state->textures[stage]))
2293 {
2295 *texture = &texture_impl->IDirect3DBaseTexture8_iface;
2297 }
2298 else
2299 {
2300 *texture = NULL;
2301 }
2303
2304 return D3D_OK;
2305}
void *CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture)
Definition: texture.c:1690
#define IDirect3DBaseTexture8_AddRef(p)
Definition: d3d8.h:541
IDirect3DBaseTexture8 IDirect3DBaseTexture8_iface
Definition: d3d8_private.h:243
#define WINED3D_MAX_FRAGMENT_SAMPLERS
Definition: wined3d.h:1598

◆ d3d8_device_GetTextureStageState()

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

Definition at line 2366 of file device.c.

2368{
2371 const struct tss_lookup *l;
2372
2373 TRACE("iface %p, stage %lu, state %#x, value %p.\n", iface, stage, state, value);
2374
2375 if (state >= ARRAY_SIZE(tss_lookup))
2376 {
2377 WARN("Invalid state %#x.\n", state);
2378 return D3D_OK;
2379 }
2380
2381 l = &tss_lookup[state];
2382
2384 device_state = device->stateblock_state;
2385 if (l->sampler_state)
2386 *value = device_state->sampler_states[stage][l->u.sampler_state];
2387 else
2388 *value = device_state->texture_states[stage][l->u.texture_state];
2390
2391 return D3D_OK;
2392}
r l[0]
Definition: byte_order.h:168

◆ d3d8_device_GetTransform()

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

Definition at line 1750 of file device.c.

1752{
1754
1755 TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
1756
1757 /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
1759 memcpy(matrix, &device->stateblock_state->transforms[state], sizeof(*matrix));
1761
1762 return D3D_OK;
1763}
GLuint GLenum matrix
Definition: glext.h:9407

◆ d3d8_device_GetVertexShader()

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

Definition at line 2974 of file device.c.

2975{
2977 struct wined3d_vertex_declaration *wined3d_declaration;
2978 struct d3d8_vertex_declaration *d3d8_declaration;
2979
2980 TRACE("iface %p, shader %p.\n", iface, shader);
2981
2983 if ((wined3d_declaration = device->stateblock_state->vertex_declaration))
2984 {
2985 d3d8_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration);
2986 *shader = d3d8_declaration->shader_handle;
2987 }
2988 else
2989 {
2990 *shader = 0;
2991 }
2993
2994 TRACE("Returning %#lx.\n", *shader);
2995
2996 return D3D_OK;
2997}
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_idx,
void *  constants,
DWORD  count 
)
static

Definition at line 3049 of file device.c.

3051{
3053 HRESULT hr;
3054
3055 TRACE("iface %p, start_idx %lu, constants %p, count %lu.\n", iface, start_idx, constants, count);
3056
3060
3061 return hr;
3062}
HRESULT CDECL wined3d_stateblock_get_vs_consts_f(struct wined3d_stateblock *stateblock, unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants)
Definition: stateblock.c:1416

◆ d3d8_device_GetVertexShaderDeclaration()

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

Definition at line 3064 of file device.c.

3066{
3069 struct d3d8_vertex_shader *shader_impl;
3070
3071 TRACE("iface %p, shader %#lx, data %p, data_size %p.\n", iface, shader, data, data_size);
3072
3074 shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
3076
3077 if (!shader_impl)
3078 {
3079 WARN("Invalid handle (%#lx) passed.\n", shader);
3080 return D3DERR_INVALIDCALL;
3081 }
3082 declaration = shader_impl->vertex_declaration;
3083
3084 if (!data)
3085 {
3086 *data_size = declaration->elements_size;
3087 return D3D_OK;
3088 }
3089
3090 /* MSDN claims that if *data_size is smaller than the required size
3091 * we should write the required size and return D3DERR_MOREDATA.
3092 * That's not actually true. */
3093 if (*data_size < declaration->elements_size)
3094 return D3DERR_INVALIDCALL;
3095
3096 memcpy(data, declaration->elements, declaration->elements_size);
3097
3098 return D3D_OK;
3099}
struct d3d8_vertex_declaration * vertex_declaration
Definition: d3d8_private.h:281

◆ d3d8_device_GetVertexShaderFunction()

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

Definition at line 3101 of file device.c.

3103{
3105 struct d3d8_vertex_shader *shader_impl = NULL;
3106 HRESULT hr;
3107
3108 TRACE("iface %p, shader %#lx, data %p, data_size %p.\n", iface, shader, data, data_size);
3109
3111 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
3112 {
3113 WARN("Invalid handle (%#lx) passed.\n", shader);
3115
3116 return D3DERR_INVALIDCALL;
3117 }
3118
3119 if (!shader_impl->wined3d_shader)
3120 {
3122 *data_size = 0;
3123 return D3D_OK;
3124 }
3125
3126 hr = wined3d_shader_get_byte_code(shader_impl->wined3d_shader, data, (unsigned int *)data_size);
3128
3129 return hr;
3130}

◆ d3d8_device_GetViewport()

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

Definition at line 1821 of file device.c.

1822{
1825
1826 TRACE("iface %p, viewport %p.\n", iface, viewport);
1827
1829 wined3d_viewport = device->stateblock_state->viewport;
1831
1832 viewport->X = wined3d_viewport.x;
1833 viewport->Y = wined3d_viewport.y;
1834 viewport->Width = wined3d_viewport.width;
1835 viewport->Height = wined3d_viewport.height;
1836 viewport->MinZ = wined3d_viewport.min_z;
1837 viewport->MaxZ = wined3d_viewport.max_z;
1838
1839 return D3D_OK;
1840}

◆ d3d8_device_LightEnable()

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

Definition at line 1901 of file device.c.

1902{
1904 HRESULT hr;
1905
1906 TRACE("iface %p, index %lu, enable %#x.\n", iface, index, enable);
1907
1911
1912 return hr;
1913}
GLboolean enable
Definition: glext.h:11120
HRESULT CDECL wined3d_stateblock_set_light_enable(struct wined3d_stateblock *stateblock, UINT light_idx, BOOL enable)
Definition: stateblock.c:2042

◆ d3d8_device_MultiplyTransform()

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

Definition at line 1765 of file device.c.

1767{
1769
1770 TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
1771
1772 /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
1777
1778 return D3D_OK;
1779}
static enum wined3d_transform_state wined3d_transform_state_from_d3d(D3DTRANSFORMSTATETYPE state)
Definition: device.c:446
void CDECL wined3d_stateblock_multiply_transform(struct wined3d_stateblock *stateblock, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix)
Definition: stateblock.c:1859

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

1029{
1031 struct d3d8_swapchain *implicit_swapchain;
1032
1033 TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p.\n",
1034 iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), dst_window_override, dirty_region);
1035
1036 /* Fraps does not hook IDirect3DDevice8::Present regardless of the hotpatch
1037 * attribute. It only hooks IDirect3DSwapChain8::Present. Yet it properly
1038 * shows a framerate on Windows in applications that only call the device
1039 * method, like e.g. the dx8 sdk samples. The conclusion is that native
1040 * calls the swapchain's public method from the device. */
1041 implicit_swapchain = wined3d_swapchain_get_parent(device->implicit_swapchain);
1042 return IDirect3DSwapChain8_Present(&implicit_swapchain->IDirect3DSwapChain8_iface,
1043 src_rect, dst_rect, dst_window_override, dirty_region);
1044}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define IDirect3DSwapChain8_Present(p, a, b, c, d)
Definition: d3d8.h:268
IDirect3DSwapChain8 IDirect3DSwapChain8_iface
Definition: d3d8_private.h:177
void *CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain)
Definition: swapchain.c:170

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

2769{
2772 const struct wined3d_stateblock_state *state;
2773 const struct wined3d_stream_state *stream;
2774 struct d3d8_vertexbuffer *d3d8_buffer;
2775 unsigned int i, map;
2776 HRESULT hr;
2777
2778 TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, flags %#lx.\n",
2779 iface, src_start_idx, dst_idx, vertex_count, dst_buffer, flags);
2780
2782
2783 state = device->stateblock_state;
2784
2785 /* Note that an alternative approach would be to simply create these
2786 * buffers with WINED3D_RESOURCE_ACCESS_MAP_R and update them here like we
2787 * do for draws. In some regards that would be easier, but it seems less
2788 * than optimal to upload data to the GPU only to subsequently download it
2789 * again. */
2790 map = device->sysmem_vb;
2791 while (map)
2792 {
2794 stream = &state->streams[i];
2795
2796 d3d8_buffer = wined3d_buffer_get_parent(stream->buffer);
2798 i, d3d8_buffer->wined3d_buffer, stream->offset, stream->stride)))
2799 ERR("Failed to set stream source.\n");
2800 }
2801
2802 hr = wined3d_device_process_vertices(device->wined3d_device, device->state, src_start_idx, dst_idx,
2803 vertex_count, dst->wined3d_buffer, NULL, flags, dst->fvf);
2804
2805 map = device->sysmem_vb;
2806 while (map)
2807 {
2809 stream = &state->streams[i];
2810
2811 d3d8_buffer = wined3d_buffer_get_parent(stream->buffer);
2813 i, d3d8_buffer->draw_buffer, stream->offset, stream->stride)))
2814 ERR("Failed to set stream source.\n");
2815 }
2816
2818
2819 return hr;
2820}
Definition: _map.h:48
struct d3d8_vertexbuffer * unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
Definition: buffer.c:345
HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, struct wined3d_stateblock *stateblock, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, uint32_t flags, uint32_t dst_fvf)
Definition: device.c:3598
struct wined3d_buffer * draw_buffer
Definition: d3d8_private.h:216
struct wined3d_buffer * wined3d_buffer
Definition: d3d8_private.h:214
static int wined3d_bit_scan(unsigned int *x)
Definition: wined3d.h:2982

◆ d3d8_device_QueryInterface()

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

Definition at line 570 of file device.c.

571{
572 TRACE("iface %p, riid %s, out %p.\n",
573 iface, debugstr_guid(riid), out);
574
575 if (IsEqualGUID(riid, &IID_IDirect3DDevice8)
577 {
579 *out = iface;
580 return S_OK;
581 }
582
583 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
584
585 *out = NULL;
586 return E_NOINTERFACE;
587}
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
#define IDirect3DDevice8_AddRef(p)
Definition: d3d8.h:943
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ d3d8_device_Release()

static ULONG WINAPI d3d8_device_Release ( IDirect3DDevice8 *  iface)
static

Definition at line 599 of file device.c.

600{
602 ULONG ref;
603
604 if (device->in_destruction)
605 return 0;
606
608
609 TRACE("%p decreasing refcount to %lu.\n", iface, ref);
610
611 if (!ref)
612 {
613 IDirect3D8 *parent = &device->d3d_parent->IDirect3D8_iface;
614 unsigned i;
615
616 TRACE("Releasing wined3d device %p.\n", device->wined3d_device);
617
619
620 device->in_destruction = TRUE;
621
622 for (i = 0; i < device->numConvertedDecls; ++i)
623 {
624 d3d8_vertex_declaration_destroy(device->decls[i].declaration);
625 }
626 free(device->decls);
627
630
631 if (device->recording)
634
635 wined3d_swapchain_decref(device->implicit_swapchain);
637 wined3d_device_decref(device->wined3d_device);
638 free(device->handle_table.entries);
639 free(device);
640
642
644 }
645 return ref;
646}
#define InterlockedDecrement
Definition: armddk.h:52
#define TRUE
Definition: types.h:120
ULONG CDECL wined3d_device_decref(struct wined3d_device *device)
Definition: device.c:251
void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
Definition: device.c:1154
r parent
Definition: btrfs.c:3010
#define IDirect3D8_Release(p)
Definition: d3d8.h:157
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:144
static void wined3d_streaming_buffer_cleanup(struct wined3d_streaming_buffer *buffer)
Definition: wined3d.h:2943

◆ d3d8_device_Reset()

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

Definition at line 940 of file device.c.

942{
943 struct wined3d_swapchain_desc swapchain_desc, old_swapchain_desc;
945 struct d3d8_swapchain *implicit_swapchain;
946 unsigned int output_idx;
947 HRESULT hr;
948
949 TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
950
951 if (device->device_state == D3D8_DEVICE_STATE_LOST)
952 {
953 WARN("App not active, returning D3DERR_DEVICELOST.\n");
954 return D3DERR_DEVICELOST;
955 }
956 output_idx = device->adapter_ordinal;
957 if (!wined3d_swapchain_desc_from_d3d8(&swapchain_desc,
958 device->d3d_parent->wined3d_outputs[output_idx], present_parameters))
959 return D3DERR_INVALIDCALL;
960 swapchain_desc.flags |= WINED3D_SWAPCHAIN_IMPLICIT;
961
963
966
967 wined3d_swapchain_get_desc(device->implicit_swapchain, &old_swapchain_desc);
968
969 if (device->recording)
971 device->recording = NULL;
972 device->update_state = device->state;
974
975 /* wined3d_device_reset() may recreate swapchain textures.
976 * We do not need to remove the reference to the wined3d swapchain from the
977 * old d3d8 surfaces: we will fail the reset if they have 0 references,
978 * and therefore they are not actually holding a reference to the wined3d
979 * swapchain, and will not do anything with it when they are destroyed. */
980
981 if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc,
983 {
984 struct wined3d_rendertarget_view *rtv;
985 struct d3d8_surface *surface;
986 unsigned int i;
987
988 present_parameters->BackBufferCount = swapchain_desc.backbuffer_count;
989 implicit_swapchain = wined3d_swapchain_get_parent(device->implicit_swapchain);
990 implicit_swapchain->swap_interval
994 !!swapchain_desc.enable_auto_depth_stencil);
996
997 /* FIXME: This should be the new backbuffer count, but we don't support
998 * changing the backbuffer count in wined3d yet. */
999 for (i = 0; i < old_swapchain_desc.backbuffer_count; ++i)
1000 {
1001 struct wined3d_texture *backbuffer = wined3d_swapchain_get_back_buffer(device->implicit_swapchain, i);
1002
1003 if ((surface = d3d8_surface_create(backbuffer, 0, (IUnknown *)&device->IDirect3DDevice8_iface)))
1004 surface->parent_device = &device->IDirect3DDevice8_iface;
1005 }
1006
1007 if ((rtv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
1008 {
1010
1012 (IUnknown *)&device->IDirect3DDevice8_iface)))
1013 surface->parent_device = &device->IDirect3DDevice8_iface;
1014 }
1015
1016 device->device_state = D3D8_DEVICE_STATE_OK;
1017 }
1018 else
1019 {
1020 device->device_state = D3D8_DEVICE_STATE_NOT_RESET;
1021 }
1023
1024 return hr;
1025}
@ D3D8_DEVICE_STATE_OK
Definition: d3d8_private.h:102
@ D3D8_DEVICE_STATE_NOT_RESET
Definition: d3d8_private.h:104
@ D3D8_DEVICE_STATE_LOST
Definition: d3d8_private.h:103
static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
Definition: device.c:892
static void device_reset_viewport_state(struct d3d8_device *device)
Definition: device.c:559
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:4970
struct wined3d_texture *__cdecl wined3d_texture_from_resource(struct wined3d_resource *resource)
Definition: texture.c:3343
struct wined3d_resource *CDECL wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view)
Definition: view.c:430
#define D3DERR_DEVICELOST
Definition: d3d8.h:78
void CDECL wined3d_stateblock_reset(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:2534
void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateblock, enum wined3d_render_state state, unsigned int value)
Definition: stateblock.c:1623
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:293
@ WINED3D_RS_POINTSIZE_MIN
Definition: wined3d.h:363
#define WINED3D_SWAPCHAIN_IMPLICIT
Definition: wined3d.h:901

◆ d3d8_device_ResourceManagerDiscardBytes()

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

Definition at line 682 of file device.c.

683{
685
686 TRACE("iface %p, byte_count %lu.\n", iface, byte_count);
687
688 if (byte_count)
689 FIXME("Byte count ignored.\n");
690
694
695 return D3D_OK;
696}
void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
Definition: device.c:4923

◆ d3d8_device_SetClipPlane()

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

Definition at line 1930 of file device.c.

1931{
1933 HRESULT hr;
1934
1935 TRACE("iface %p, index %lu, plane %p.\n", iface, index, plane);
1936
1938 hr = wined3d_stateblock_set_clip_plane(device->update_state, index, (const struct wined3d_vec4 *)plane);
1940
1941 return hr;
1942}
HRESULT CDECL wined3d_stateblock_set_clip_plane(struct wined3d_stateblock *stateblock, UINT plane_idx, const struct wined3d_vec4 *plane)
Definition: stateblock.c:1875

◆ d3d8_device_SetClipStatus()

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

Definition at line 2244 of file device.c.

2245{
2247 HRESULT hr;
2248
2249 TRACE("iface %p, clip_status %p.\n", iface, clip_status);
2250 /* FIXME: Verify that D3DCLIPSTATUS8 ~= struct wined3d_clip_status. */
2251
2253 hr = wined3d_device_set_clip_status(device->wined3d_device, (const struct wined3d_clip_status *)clip_status);
2255
2256 return hr;
2257}
HRESULT CDECL wined3d_device_set_clip_status(struct wined3d_device *device, const struct wined3d_clip_status *clip_status)
Definition: device.c:1809

◆ d3d8_device_SetCurrentTexturePalette()

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

Definition at line 2472 of file device.c.

2473{
2474 WARN("iface %p, palette_idx %u unimplemented.\n", iface, palette_idx);
2475
2476 return D3D_OK;
2477}

◆ d3d8_device_SetCursorPosition()

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

Definition at line 816 of file device.c.

817{
819
820 TRACE("iface %p, x %u, y %u, flags %#lx.\n", iface, x, y, flags);
821
825}
void CDECL wined3d_device_set_cursor_position(struct wined3d_device *device, int x_screen_space, int y_screen_space, uint32_t flags)
Definition: device.c:4845
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 770 of file device.c.

772{
775 D3DSURFACE_DESC surface_desc;
777 HRESULT hr;
778
779 TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n",
780 iface, hotspot_x, hotspot_y, bitmap);
781
782 if (!bitmap)
783 {
784 WARN("No cursor bitmap, returning D3DERR_INVALIDCALL.\n");
785 return D3DERR_INVALIDCALL;
786 }
787
788 if (FAILED(hr = IDirect3DSurface8_GetDesc(bitmap, &surface_desc)))
789 {
790 WARN("Failed to get surface description, hr %#lx.\n", hr);
791 return hr;
792 }
793
794 if (FAILED(hr = IDirect3D8_GetAdapterDisplayMode(&device->d3d_parent->IDirect3D8_iface,
795 device->adapter_ordinal, &mode)))
796 {
797 WARN("Failed to get device display mode, hr %#lx.\n", hr);
798 return hr;
799 }
800
801 if (surface_desc.Width > mode.Width || surface_desc.Height > mode.Height)
802 {
803 WARN("Surface dimension %ux%u exceeds display mode %ux%u.\n", surface_desc.Width,
804 surface_desc.Height, mode.Width, mode.Height);
805 return D3DERR_INVALIDCALL;
806 }
807
810 hotspot_x, hotspot_y, bitmap_impl->wined3d_texture, bitmap_impl->sub_resource_idx);
812
813 return hr;
814}
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:4752
#define IDirect3DSurface8_GetDesc(p, a)
Definition: d3d8.h:313
#define IDirect3D8_GetAdapterDisplayMode(p, a, b)
Definition: d3d8.h:164
Definition: uimain.c:89

◆ d3d8_device_SetGammaRamp()

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

Definition at line 1090 of file device.c.

1091{
1093
1094 TRACE("iface %p, flags %#lx, ramp %p.\n", iface, flags, ramp);
1095
1096 /* Note: D3DGAMMARAMP is compatible with struct wined3d_gamma_ramp. */
1098 wined3d_device_set_gamma_ramp(device->wined3d_device, 0, flags, (const struct wined3d_gamma_ramp *)ramp);
1100}
void CDECL wined3d_device_set_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, uint32_t flags, const struct wined3d_gamma_ramp *ramp)
Definition: device.c:5289

◆ d3d8_device_SetIndices()

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

Definition at line 3132 of file device.c.

3134{
3138
3139 TRACE("iface %p, buffer %p, base_vertex_idx %u.\n", iface, buffer, base_vertex_idx);
3140
3141 if (!ib)
3143 else
3145
3146 /* WineD3D takes an INT(due to d3d9), but d3d8 uses UINTs. Do I have to add a check here that
3147 * the UINT doesn't cause an overflow in the INT? It seems rather unlikely because such large
3148 * vertex buffers can't be created to address them with an index that requires the 32nd bit
3149 * (4 Byte minimum vertex size * 2^31-1 -> 8 gb buffer. The index sign would be the least
3150 * problem)
3151 */
3153 wined3d_stateblock_set_base_vertex_index(device->update_state, base_vertex_idx);
3155 if (!device->recording)
3156 device->sysmem_ib = ib && ib->sysmem;
3158
3159 return D3D_OK;
3160}
struct d3d8_indexbuffer * unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
Definition: buffer.c:653
struct wined3d_buffer * wined3d_buffer
Definition: d3d8_private.h:229
enum wined3d_format_id format
Definition: d3d8_private.h:231

◆ d3d8_device_SetLight()

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

Definition at line 1870 of file device.c.

1871{
1873 HRESULT hr;
1874
1875 TRACE("iface %p, index %lu, light %p.\n", iface, index, light);
1876
1877 /* Note: D3DLIGHT8 is compatible with struct wined3d_light. */
1879 hr = wined3d_stateblock_set_light(device->update_state, index, (const struct wined3d_light *)light);
1881
1882 return hr;
1883}
HRESULT CDECL wined3d_stateblock_set_light(struct wined3d_stateblock *stateblock, UINT light_idx, const struct wined3d_light *light)
Definition: stateblock.c:1996

◆ d3d8_device_SetMaterial()

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

Definition at line 1842 of file device.c.

1843{
1845
1846 TRACE("iface %p, material %p.\n", iface, material);
1847
1848 /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */
1850 wined3d_stateblock_set_material(device->update_state, (const struct wined3d_material *)material);
1852
1853 return D3D_OK;
1854}
void CDECL wined3d_stateblock_set_material(struct wined3d_stateblock *stateblock, const struct wined3d_material *material)
Definition: stateblock.c:1891

◆ d3d8_device_SetPaletteEntries()

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

Definition at line 2453 of file device.c.

2455{
2456 WARN("iface %p, palette_idx %u, entries %p unimplemented\n", iface, palette_idx, entries);
2457
2458 /* GPUs stopped supporting palettized textures with the Shader Model 1 generation. Wined3d
2459 * does not have a d3d8/9-style palette API */
2460
2461 return D3D_OK;
2462}

◆ d3d8_device_SetPixelShader()

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

Definition at line 3241 of file device.c.

3242{
3244 struct d3d8_pixel_shader *shader_impl;
3245
3246 TRACE("iface %p, shader %#lx.\n", iface, shader);
3247
3249
3250 if (!shader)
3251 {
3254 return D3D_OK;
3255 }
3256
3257 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS)))
3258 {
3259 WARN("Invalid handle (%#lx) passed.\n", shader);
3261 return D3DERR_INVALIDCALL;
3262 }
3263
3264 TRACE("Setting shader %p.\n", shader_impl);
3265 wined3d_stateblock_set_pixel_shader(device->update_state, shader_impl->wined3d_shader);
3267
3268 return D3D_OK;
3269}
void CDECL wined3d_stateblock_set_pixel_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader)
Definition: stateblock.c:1460

◆ d3d8_device_SetPixelShaderConstant()

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

Definition at line 3325 of file device.c.

3327{
3329 HRESULT hr;
3330
3331 TRACE("iface %p, start_register %lu, data %p, count %lu.\n", iface, start_register, data, count);
3332
3334 hr = wined3d_stateblock_set_ps_consts_f(device->update_state, start_register, count, data);
3336
3337 return hr;
3338}
HRESULT CDECL wined3d_stateblock_set_ps_consts_f(struct wined3d_stateblock *stateblock, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
Definition: stateblock.c:1473

◆ d3d8_device_SetRenderState()

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

Definition at line 1991 of file device.c.

1993{
1995
1996 TRACE("iface %p, state %#x, value %#lx.\n", iface, state, value);
1997
2003
2004 return D3D_OK;
2005}
#define D3D8_RESZ_CODE
Definition: d3d8_private.h:44
@ D3DRS_POINTSIZE
Definition: d3d8types.h:786
static void resolve_depth_buffer(struct d3d8_device *device)
Definition: device.c:1963
static enum wined3d_render_state wined3d_render_state_from_d3d(D3DRENDERSTATETYPE state)
Definition: device.c:451

◆ d3d8_device_SetRenderTarget()

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

Definition at line 1530 of file device.c.

1532{
1534 struct d3d8_surface *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target);
1536 struct wined3d_rendertarget_view *original_dsv, *rtv;
1537 HRESULT hr = D3D_OK;
1538
1539 TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, render_target, depth_stencil);
1540
1541 if (rt_impl && d3d8_surface_get_device(rt_impl) != device)
1542 {
1543 WARN("Render target surface does not match device.\n");
1544 return D3DERR_INVALIDCALL;
1545 }
1546
1548
1549 if (ds_impl)
1550 {
1551 struct wined3d_sub_resource_desc ds_desc, rt_desc;
1552 struct wined3d_rendertarget_view *original_rtv;
1553 struct d3d8_surface *original_surface;
1554
1555 /* If no render target is passed in check the size against the current RT */
1556 if (!render_target)
1557 {
1558 if (!(original_rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
1559 {
1561 return D3DERR_NOTFOUND;
1562 }
1563 original_surface = wined3d_rendertarget_view_get_sub_resource_parent(original_rtv);
1565 original_surface->sub_resource_idx, &rt_desc);
1566 }
1567 else
1569 rt_impl->sub_resource_idx, &rt_desc);
1570
1572
1573 if (ds_desc.width < rt_desc.width || ds_desc.height < rt_desc.height)
1574 {
1575 WARN("Depth stencil is smaller than the render target, returning D3DERR_INVALIDCALL\n");
1577 return D3DERR_INVALIDCALL;
1578 }
1579 if (ds_desc.multisample_type != rt_desc.multisample_type
1580 || ds_desc.multisample_quality != rt_desc.multisample_quality)
1581 {
1582 WARN("Multisample settings do not match, returning D3DERR_INVALIDCALL\n");
1584 return D3DERR_INVALIDCALL;
1585 }
1586 }
1587
1588 original_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context);
1589 rtv = ds_impl ? d3d8_surface_acquire_rendertarget_view(ds_impl) : NULL;
1590 hr = wined3d_device_context_set_depth_stencil_view(device->immediate_context, rtv);
1592 if (SUCCEEDED(hr))
1593 {
1594 rtv = render_target ? d3d8_surface_acquire_rendertarget_view(rt_impl) : NULL;
1595 if (render_target)
1596 {
1598 0, 1, &rtv, TRUE)))
1600 else
1601 wined3d_device_context_set_depth_stencil_view(device->immediate_context, original_dsv);
1602 }
1605 }
1606
1608
1609 return hr;
1610}
struct d3d8_device * d3d8_surface_get_device(const struct d3d8_surface *surface)
Definition: surface.c:372
struct wined3d_rendertarget_view * d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface)
Definition: surface.c:379
void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface, struct wined3d_rendertarget_view *rtv)
Definition: surface.c:405
HRESULT CDECL wined3d_device_context_set_rendertarget_views(struct wined3d_device_context *context, unsigned int start_idx, unsigned int count, struct wined3d_rendertarget_view *const *views, BOOL set_viewport)
Definition: device.c:2377
HRESULT CDECL wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context, struct wined3d_rendertarget_view *view)
Definition: device.c:2453
void CDECL wined3d_stateblock_depth_buffer_changed(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:4043

◆ d3d8_device_SetStreamSource()

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

Definition at line 3404 of file device.c.

3406{
3409 const struct wined3d_stateblock_state *state;
3411 HRESULT hr;
3412
3413 TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n",
3414 iface, stream_idx, buffer, stride);
3415
3416 if (stream_idx >= ARRAY_SIZE(state->streams))
3417 {
3418 WARN("Stream index %u out of range.\n", stream_idx);
3419 return D3DERR_INVALIDCALL;
3420 }
3421
3423
3424 if (!buffer_impl)
3425 {
3427 state = device->stateblock_state;
3428 stride = state->streams[stream_idx].stride;
3429 }
3430 else if (buffer_impl->draw_buffer)
3431 wined3d_buffer = buffer_impl->draw_buffer;
3432 else
3433 wined3d_buffer = buffer_impl->wined3d_buffer;
3434
3435 hr = wined3d_stateblock_set_stream_source(device->update_state, stream_idx, wined3d_buffer, 0, stride);
3436 if (SUCCEEDED(hr) && !device->recording)
3437 {
3438 if (buffer_impl && buffer_impl->draw_buffer)
3439 device->sysmem_vb |= (1u << stream_idx);
3440 else
3441 device->sysmem_vb &= ~(1u << stream_idx);
3442 }
3443
3445
3446 return hr;
3447}

◆ d3d8_device_SetTexture()

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

Definition at line 2307 of file device.c.

2308{
2310 struct d3d8_texture *texture_impl;
2311
2312 TRACE("iface %p, stage %lu, texture %p.\n", iface, stage, texture);
2313
2315
2317 wined3d_stateblock_set_texture(device->update_state, stage,
2318 texture_impl ? d3d8_texture_get_draw_texture(texture_impl) : NULL);
2320
2321 return D3D_OK;
2322}
struct d3d8_texture * unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture8 *iface)
Definition: texture.c:1017
static struct wined3d_texture * d3d8_texture_get_draw_texture(struct d3d8_texture *texture)
Definition: d3d8_private.h:257
void CDECL wined3d_stateblock_set_texture(struct wined3d_stateblock *stateblock, UINT stage, struct wined3d_texture *texture)
Definition: stateblock.c:1816

◆ d3d8_device_SetTextureStageState()

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

Definition at line 2394 of file device.c.

2396{
2398 const struct tss_lookup *l;
2399
2400 TRACE("iface %p, stage %lu, state %#x, value %#lx.\n", iface, stage, type, value);
2401
2402 if (type >= ARRAY_SIZE(tss_lookup))
2403 {
2404 WARN("Invalid type %#x passed.\n", type);
2405 return D3D_OK;
2406 }
2407
2408 l = &tss_lookup[type];
2409
2411 if (l->sampler_state)
2412 wined3d_stateblock_set_sampler_state(device->update_state, stage, l->u.sampler_state, value);
2413 else
2414 wined3d_stateblock_set_texture_stage_state(device->update_state, stage, l->u.texture_state, value);
2416
2417 return D3D_OK;
2418}
void CDECL wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock, UINT sampler_idx, enum wined3d_sampler_state state, unsigned int value)
Definition: stateblock.c:1702
void CDECL wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock *stateblock, UINT stage, enum wined3d_texture_stage_state state, unsigned int value)
Definition: stateblock.c:1718

◆ d3d8_device_SetTransform()

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

Definition at line 1734 of file device.c.

1736{
1738
1739 TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix);
1740
1741 /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
1746
1747 return D3D_OK;
1748}
void CDECL wined3d_stateblock_set_transform(struct wined3d_stateblock *stateblock, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix)
Definition: stateblock.c:1840

◆ d3d8_device_SetVertexShader()

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

Definition at line 2935 of file device.c.

2936{
2938 struct d3d8_vertex_shader *shader_impl;
2939
2940 TRACE("iface %p, shader %#lx.\n", iface, shader);
2941
2943 {
2944 TRACE("Setting FVF, %#lx\n", shader);
2945
2951
2952 return D3D_OK;
2953 }
2954
2955 TRACE("Setting shader\n");
2956
2958 if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS)))
2959 {
2960 WARN("Invalid handle (%#lx) passed.\n", shader);
2962
2963 return D3DERR_INVALIDCALL;
2964 }
2965
2967 shader_impl->vertex_declaration->wined3d_vertex_declaration);
2968 wined3d_stateblock_set_vertex_shader(device->update_state, shader_impl->wined3d_shader);
2970
2971 return D3D_OK;
2972}
static struct d3d8_vertex_declaration * d3d8_device_get_fvf_declaration(struct d3d8_device *device, DWORD fvf)
Definition: device.c:2871
void CDECL wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock, struct wined3d_vertex_declaration *declaration)
Definition: stateblock.c:1571
void CDECL wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader)
Definition: stateblock.c:1319

◆ d3d8_device_SetVertexShaderConstant()

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

Definition at line 3026 of file device.c.

3028{
3030 HRESULT hr;
3031
3032 TRACE("iface %p, start_register %lu, data %p, count %lu.\n",
3033 iface, start_register, data, count);
3034
3035 if (start_register + count > D3D8_MAX_VERTEX_SHADER_CONSTANTF)
3036 {
3037 WARN("Trying to access %lu constants, but d3d8 only supports %u.\n",
3038 start_register + count, D3D8_MAX_VERTEX_SHADER_CONSTANTF);
3039 return D3DERR_INVALIDCALL;
3040 }
3041
3043 hr = wined3d_stateblock_set_vs_consts_f(device->update_state, start_register, count, data);
3045
3046 return hr;
3047}
#define D3D8_MAX_VERTEX_SHADER_CONSTANTF
Definition: d3d8_private.h:39
HRESULT CDECL wined3d_stateblock_set_vs_consts_f(struct wined3d_stateblock *stateblock, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
Definition: stateblock.c:1360

◆ d3d8_device_SetViewport()

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

Definition at line 1781 of file device.c.

1782{
1784 struct wined3d_sub_resource_desc rt_desc;
1785 struct wined3d_rendertarget_view *rtv;
1786 struct d3d8_surface *surface;
1787 struct wined3d_viewport vp;
1788
1789 TRACE("iface %p, viewport %p.\n", iface, viewport);
1790
1792 if (!(rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
1793 {
1795 return D3DERR_NOTFOUND;
1796 }
1799
1800 if (viewport->X > rt_desc.width || viewport->Width > rt_desc.width - viewport->X
1801 || viewport->Y > rt_desc.height || viewport->Height > rt_desc.height - viewport->Y)
1802 {
1803 WARN("Invalid viewport, returning D3DERR_INVALIDCALL.\n");
1805 return D3DERR_INVALIDCALL;
1806 }
1807
1808 vp.x = viewport->X;
1809 vp.y = viewport->Y;
1810 vp.width = viewport->Width;
1811 vp.height = viewport->Height;
1812 vp.min_z = viewport->MinZ;
1813 vp.max_z = viewport->MaxZ;
1814
1815 wined3d_stateblock_set_viewport(device->update_state, &vp);
1817
1818 return D3D_OK;
1819}
void CDECL wined3d_stateblock_set_viewport(struct wined3d_stateblock *stateblock, const struct wined3d_viewport *viewport)
Definition: stateblock.c:1900

◆ d3d8_device_ShowCursor()

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

Definition at line 827 of file device.c.

828{
830 BOOL ret;
831
832 TRACE("iface %p, show %#x.\n", iface, show);
833
835 ret = wined3d_device_show_cursor(device->wined3d_device, show);
837
838 return ret;
839}
BOOL CDECL wined3d_device_show_cursor(struct wined3d_device *device, BOOL show)
Definition: device.c:4874

◆ d3d8_device_TestCooperativeLevel()

static HRESULT WINAPI d3d8_device_TestCooperativeLevel ( IDirect3DDevice8 *  iface)
static

Definition at line 648 of file device.c.

649{
651
652 TRACE("iface %p.\n", iface);
653
654 TRACE("device state: %#lx.\n", device->device_state);
655
656 switch (device->device_state)
657 {
658 default:
660 return D3D_OK;
662 return D3DERR_DEVICELOST;
665 }
666}
#define D3DERR_DEVICENOTRESET
Definition: d3d8.h:79

◆ d3d8_device_UpdateTexture()

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

Definition at line 1482 of file device.c.

1484{
1486 struct d3d8_texture *src_impl, *dst_impl;
1487 HRESULT hr;
1488
1489 TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, src_texture, dst_texture);
1490
1491 src_impl = unsafe_impl_from_IDirect3DBaseTexture8(src_texture);
1492 dst_impl = unsafe_impl_from_IDirect3DBaseTexture8(dst_texture);
1493
1494 if (src_impl->draw_texture || dst_impl->draw_texture)
1495 {
1496 WARN("Source or destination is managed; returning D3DERR_INVALIDCALL.\n");
1497 return D3DERR_INVALIDCALL;
1498 }
1499
1501 hr = wined3d_device_update_texture(device->wined3d_device,
1502 src_impl->wined3d_texture, dst_impl->wined3d_texture);
1504
1505 return hr;
1506}
HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
Definition: device.c:3808
struct wined3d_texture * wined3d_texture
Definition: d3d8_private.h:245
struct wined3d_texture * draw_texture
Definition: d3d8_private.h:245

◆ d3d8_device_upload_managed_textures()

static void d3d8_device_upload_managed_textures ( struct d3d8_device *  device)
static

Definition at line 2564 of file device.c.

2565{
2566 const struct wined3d_stateblock_state *state = device->stateblock_state;
2567 unsigned int i;
2568
2569 for (i = 0; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i)
2570 {
2571 struct wined3d_texture *wined3d_texture = state->textures[i];
2572 struct d3d8_texture *d3d8_texture;
2573
2574 if (!wined3d_texture)
2575 continue;
2578 wined3d_device_update_texture(device->wined3d_device,
2580 }
2581}

Referenced by d3d8_device_DrawIndexedPrimitive(), d3d8_device_DrawIndexedPrimitiveUP(), d3d8_device_DrawPrimitive(), and d3d8_device_DrawPrimitiveUP().

◆ d3d8_device_upload_sysmem_index_buffer()

static HRESULT d3d8_device_upload_sysmem_index_buffer ( struct d3d8_device *  device,
unsigned int *  start_idx,
unsigned int  idx_count 
)
static

Definition at line 2527 of file device.c.

2529{
2530 const struct wined3d_stateblock_state *state = device->stateblock_state;
2531 unsigned int src_offset, idx_size, buffer_size, pos;
2532 struct wined3d_resource_desc resource_desc;
2533 struct wined3d_resource *index_buffer;
2534 struct wined3d_map_desc map_desc;
2535 struct wined3d_box box;
2536 HRESULT hr;
2537
2538 if (!device->sysmem_ib)
2539 return S_OK;
2540
2541 index_buffer = wined3d_buffer_get_resource(state->index_buffer);
2542 wined3d_resource_get_desc(index_buffer, &resource_desc);
2543 idx_size = (state->index_format == WINED3DFMT_R16_UINT) ? 2 : 4;
2544
2545 src_offset = (*start_idx) * idx_size;
2546 buffer_size = min(idx_count * idx_size, resource_desc.size - src_offset);
2547
2548 wined3d_box_set(&box, src_offset, 0, buffer_size, 1, 0, 1);
2549 if (FAILED(hr = wined3d_resource_map(index_buffer, 0, &map_desc, &box, WINED3D_MAP_READ)))
2550 {
2551 ERR("Failed to map index buffer, hr %#lx.\n", hr);
2552 return hr;
2553 }
2554 wined3d_streaming_buffer_upload(device->wined3d_device, &device->index_buffer,
2555 map_desc.data, buffer_size, idx_size, &pos);
2556 wined3d_resource_unmap(index_buffer, 0);
2557
2559 device->index_buffer.buffer, state->index_format, pos);
2560 *start_idx = 0;
2561 return S_OK;
2562}
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:520
void CDECL wined3d_device_context_set_index_buffer(struct wined3d_device_context *context, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset)
Definition: device.c:2557
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:304
void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc)
Definition: resource.c:280
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, uint32_t flags)
Definition: resource.c:295
#define min(a, b)
Definition: monoChain.cc:55
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
Definition: palette.c:466
#define WINED3D_MAP_READ
Definition: wined3d.h:957
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:214
static void wined3d_box_set(struct wined3d_box *box, unsigned int left, unsigned int top, unsigned int right, unsigned int bottom, unsigned int front, unsigned int back)
Definition: wined3d.h:3006

Referenced by d3d8_device_DrawIndexedPrimitive().

◆ d3d8_device_upload_sysmem_vertex_buffers()

static void d3d8_device_upload_sysmem_vertex_buffers ( struct d3d8_device *  device,
unsigned int  start_vertex,
unsigned int  vertex_count 
)
static

Definition at line 2486 of file device.c.

2488{
2489 const struct wined3d_stateblock_state *state = device->stateblock_state;
2490 struct wined3d_vertex_declaration *wined3d_decl;
2491 struct wined3d_box box = {0, 0, 0, 1, 0, 1};
2492 const struct wined3d_stream_state *stream;
2493 struct d3d8_vertexbuffer *d3d8_buffer;
2494 struct wined3d_resource *dst_resource;
2495 struct d3d8_vertex_declaration *decl;
2496 struct wined3d_buffer *dst_buffer;
2498 unsigned int stride, map;
2499 HRESULT hr;
2500
2501 if (!device->sysmem_vb)
2502 return;
2503
2504 if (!(wined3d_decl = state->vertex_declaration))
2505 return;
2506
2507 decl = wined3d_vertex_declaration_get_parent(wined3d_decl);
2508 map = decl->stream_map & device->sysmem_vb;
2509 while (map)
2510 {
2511 stream = &state->streams[wined3d_bit_scan(&map)];
2512 dst_buffer = stream->buffer;
2513 stride = stream->stride;
2514
2515 d3d8_buffer = wined3d_buffer_get_parent(dst_buffer);
2516 dst_resource = wined3d_buffer_get_resource(dst_buffer);
2517 wined3d_resource_get_desc(dst_resource, &desc);
2518 box.left = stream->offset + start_vertex * stride;
2519 box.right = min(box.left + vertex_count * stride, desc.size);
2521 dst_resource, 0, box.left, 0, 0,
2522 wined3d_buffer_get_resource(d3d8_buffer->wined3d_buffer), 0, &box, 0)))
2523 ERR("Failed to update buffer.\n");
2524 }
2525}
HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_device_context *context, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, unsigned int flags)
Definition: device.c:4220

Referenced by d3d8_device_DrawIndexedPrimitive(), and d3d8_device_DrawPrimitive().

◆ d3d8_device_ValidateDevice()

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

Definition at line 2420 of file device.c.

2421{
2423 HRESULT hr;
2424
2425 TRACE("iface %p, pass_count %p.\n", iface, pass_count);
2426
2428 hr = wined3d_device_validate_device(device->wined3d_device, device->stateblock_state, pass_count);
2430
2431 /* In d3d8, texture filters are not validated, so errors concerning
2432 * unsupported ones are ignored here. */
2434 {
2435 WARN("Ignoring invalid texture filter settings.\n");
2436 *pass_count = 1;
2437 return D3D_OK;
2438 }
2439
2440 return hr;
2441}
HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, const struct wined3d_stateblock_state *state, DWORD *num_passes)
Definition: device.c:3963
#define WINED3DERR_UNSUPPORTEDTEXTUREFILTER
Definition: wined3d.h:41

◆ d3d8_free_handle()

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

Definition at line 513 of file device.c.

514{
515 struct d3d8_handle_entry *entry;
516 void *object;
517
518 if (handle == D3D8_INVALID_HANDLE || handle >= t->entry_count)
519 {
520 WARN("Invalid handle %lu passed.\n", handle);
521 return NULL;
522 }
523
524 entry = &t->entries[handle];
525 if (entry->type != type)
526 {
527 WARN("Handle %lu(%p) is not of type %#x.\n", handle, entry, type);
528 return NULL;
529 }
530
531 object = entry->object;
532 entry->object = t->free_entries;
533 entry->type = D3D8_HANDLE_FREE;
534 t->free_entries = entry;
535
536 return object;
537}

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

540{
541 struct d3d8_handle_entry *entry;
542
543 if (handle == D3D8_INVALID_HANDLE || handle >= t->entry_count)
544 {
545 WARN("Invalid handle %lu passed.\n", handle);
546 return NULL;
547 }
548
549 entry = &t->entries[handle];
550 if (entry->type != type)
551 {
552 WARN("Handle %lu(%p) is not of type %#x.\n", handle, entry, type);
553 return NULL;
554 }
555
556 return entry->object;
557}

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

26{}

◆ d3dcaps_from_wined3dcaps()

void d3dcaps_from_wined3dcaps ( D3DCAPS8 *  caps,
const struct wined3d_caps *  wined3d_caps,
unsigned int  adapter_ordinal 
)

Definition at line 321 of file device.c.

323{
325 caps->AdapterOrdinal = adapter_ordinal;
326 caps->Caps = wined3d_caps->Caps;
327 caps->Caps2 = wined3d_caps->Caps2;
328 caps->Caps3 = wined3d_caps->Caps3;
377
428 caps->LineCaps &= ~WINED3DLINECAPS_ANTIALIAS;
429 caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;
433
434 /* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
435 if (caps->PixelShaderVersion)
436 caps->PixelShaderVersion = D3DPS_VERSION(1, 4);
437 else
438 caps->PixelShaderVersion = D3DPS_VERSION(0, 0);
439 if (caps->VertexShaderVersion)
441 else
444}
#define D3DPS_VERSION(major, minor)
Definition: d3d8types.h:474
enum _D3DDEVTYPE D3DDEVTYPE
#define D3DVS_VERSION(major, minor)
Definition: d3d8types.h:475
#define D3DPRASTERCAPS_ANTIALIASEDGES
Definition: d3d8caps.h:77
#define D3DCAPS2_RESERVED
Definition: d3d8caps.h:23
#define D3DPTEXTURECAPS_CUBEMAP_POW2
Definition: d3d8caps.h:126
#define D3DPBLENDCAPS_SRCCOLOR
Definition: d3d8caps.h:98
#define D3DVTXPCAPS_LOCALVIEWER
Definition: d3d8caps.h:185
#define D3DPTEXTURECAPS_PROJECTED
Definition: d3d8caps.h:120
#define D3DPRASTERCAPS_WBUFFER
Definition: d3d8caps.h:83
#define D3DPBLENDCAPS_DESTCOLOR
Definition: d3d8caps.h:104
#define D3DPMISCCAPS_CULLNONE
Definition: d3d8caps.h:58
#define D3DPTFILTERCAPS_MAGFAFLATCUBIC
Definition: d3d8caps.h:136
#define D3DPTFILTERCAPS_MIPFLINEAR
Definition: d3d8caps.h:132
#define D3DPMISCCAPS_CLIPTLVERTS
Definition: d3d8caps.h:63
#define D3DPMISCCAPS_CULLCW
Definition: d3d8caps.h:59
#define D3DPBLENDCAPS_INVSRCCOLOR
Definition: d3d8caps.h:99
#define D3DPBLENDCAPS_ZERO
Definition: d3d8caps.h:96
#define D3DCAPS2_CANRENDERWINDOWED
Definition: d3d8caps.h:21
#define D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE
Definition: d3d8caps.h:87
#define D3DPTFILTERCAPS_MINFANISOTROPIC
Definition: d3d8caps.h:130
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE
Definition: d3d8caps.h:117
#define D3DPBLENDCAPS_INVDESTCOLOR
Definition: d3d8caps.h:105
#define D3DPBLENDCAPS_INVDESTALPHA
Definition: d3d8caps.h:103
#define D3DVTXPCAPS_MATERIALSOURCE7
Definition: d3d8caps.h:182
#define D3DPMISCCAPS_COLORWRITEENABLE
Definition: d3d8caps.h:61
#define D3DPTFILTERCAPS_MINFLINEAR
Definition: d3d8caps.h:129
#define D3DPTEXTURECAPS_SQUAREONLY
Definition: d3d8caps.h:116
#define D3DPTFILTERCAPS_MAGFANISOTROPIC
Definition: d3d8caps.h:135
#define D3DPTEXTURECAPS_ALPHAPALETTE
Definition: d3d8caps.h:118
#define D3DPMISCCAPS_NULLREFERENCE
Definition: d3d8caps.h:66
#define D3DPRASTERCAPS_ZBUFFERLESSHSR
Definition: d3d8caps.h:80
#define D3DPBLENDCAPS_SRCALPHASAT
Definition: d3d8caps.h:106
#define D3DPBLENDCAPS_BOTHSRCALPHA
Definition: d3d8caps.h:107
#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS
Definition: d3d8caps.h:62
#define D3DPRASTERCAPS_WFOG
Definition: d3d8caps.h:84
#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD
Definition: d3d8caps.h:27
#define D3DVTXPCAPS_NO_VSDT_UBYTE4
Definition: d3d8caps.h:187
#define D3DPTEXTURECAPS_ALPHA
Definition: d3d8caps.h:115
#define D3DPMISCCAPS_BLENDOP
Definition: d3d8caps.h:65
#define D3DPMISCCAPS_CULLCCW
Definition: d3d8caps.h:60
#define D3DPMISCCAPS_LINEPATTERNREP
Definition: d3d8caps.h:57
#define D3DPTEXTURECAPS_VOLUMEMAP
Definition: d3d8caps.h:122
#define D3DPTEXTURECAPS_VOLUMEMAP_POW2
Definition: d3d8caps.h:127
#define D3DPRESENT_INTERVAL_IMMEDIATE
Definition: d3d8caps.h:33
#define D3DPRASTERCAPS_ANISOTROPY
Definition: d3d8caps.h:82
#define D3DVTXPCAPS_DIRECTIONALLIGHTS
Definition: d3d8caps.h:183
#define D3DPRASTERCAPS_COLORPERSPECTIVE
Definition: d3d8caps.h:86
#define D3DPBLENDCAPS_INVSRCALPHA
Definition: d3d8caps.h:101
#define D3DCAPS2_CANCALIBRATEGAMMA
Definition: d3d8caps.h:22
#define D3DPRASTERCAPS_ZFOG
Definition: d3d8caps.h:85
#define D3DPBLENDCAPS_DESTALPHA
Definition: d3d8caps.h:102
#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC
Definition: d3d8caps.h:137
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL
Definition: d3d8caps.h:119
#define D3DPRESENT_INTERVAL_ONE
Definition: d3d8caps.h:29
#define D3DCAPS3_RESERVED
Definition: d3d8caps.h:26
#define D3DPRASTERCAPS_PAT
Definition: d3d8caps.h:73
#define D3DPRASTERCAPS_FOGRANGE
Definition: d3d8caps.h:81
#define D3DPTEXTURECAPS_PERSPECTIVE
Definition: d3d8caps.h:113
#define D3DPBLENDCAPS_SRCALPHA
Definition: d3d8caps.h:100
#define D3DVTXPCAPS_TWEENING
Definition: d3d8caps.h:186
#define D3DPBLENDCAPS_ONE
Definition: d3d8caps.h:97
#define D3DPRASTERCAPS_FOGVERTEX
Definition: d3d8caps.h:75
#define D3DPMISCCAPS_TSSARGTEMP
Definition: d3d8caps.h:64
#define D3DPTFILTERCAPS_MAGFLINEAR
Definition: d3d8caps.h:134
#define D3DCAPS2_NO2DDURING3DSCENE
Definition: d3d8caps.h:19
#define D3DPTFILTERCAPS_MINFPOINT
Definition: d3d8caps.h:128
#define D3DPTEXTURECAPS_CUBEMAP
Definition: d3d8caps.h:121
#define D3DVTXPCAPS_TEXGEN
Definition: d3d8caps.h:181
#define D3DCAPS2_DYNAMICTEXTURES
Definition: d3d8caps.h:25
#define D3DPBLENDCAPS_BOTHINVSRCALPHA
Definition: d3d8caps.h:108
#define D3DPRASTERCAPS_FOGTABLE
Definition: d3d8caps.h:76
#define D3DCAPS2_CANMANAGERESOURCE
Definition: d3d8caps.h:24
#define D3DPTEXTURECAPS_MIPCUBEMAP
Definition: d3d8caps.h:125
#define D3DPTFILTERCAPS_MIPFPOINT
Definition: d3d8caps.h:131
#define D3DPMISCCAPS_MASKZ
Definition: d3d8caps.h:56
#define D3DPRASTERCAPS_ZTEST
Definition: d3d8caps.h:74
#define D3DVTXPCAPS_POSITIONALLIGHTS
Definition: d3d8caps.h:184
#define D3DPRASTERCAPS_ZBIAS
Definition: d3d8caps.h:79
#define D3DCAPS2_FULLSCREENGAMMA
Definition: d3d8caps.h:20
#define D3DPTEXTURECAPS_MIPMAP
Definition: d3d8caps.h:123
#define D3DPTEXTURECAPS_POW2
Definition: d3d8caps.h:114
#define D3DPTFILTERCAPS_MAGFPOINT
Definition: d3d8caps.h:133
#define D3DPRASTERCAPS_MIPMAPLODBIAS
Definition: d3d8caps.h:78
#define D3DPTEXTURECAPS_MIPVOLUMEMAP
Definition: d3d8caps.h:124
#define D3DPRASTERCAPS_DITHER
Definition: d3d8caps.h:72
if(dx< 0)
Definition: linetemp.h:194
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 MaxVertexBlendMatrices
Definition: wined3d.h:1967
DWORD MaxTextureBlendStages
Definition: wined3d.h:1961
DWORD VolumeTextureAddressCaps
Definition: wined3d.h:1940
float GuardBandTop
Definition: wined3d.h:1952
float PixelShader1xMaxValue
Definition: wined3d.h:1981
DWORD FVFCaps
Definition: wined3d.h:1959
DWORD PrimitiveMiscCaps
Definition: wined3d.h:1928
DWORD MaxVertexBlendMatrixIndex
Definition: wined3d.h:1968
DWORD VertexProcessingCaps
Definition: wined3d.h:1964
DWORD TextureAddressCaps
Definition: wined3d.h:1939
DWORD TextureCaps
Definition: wined3d.h:1935
DWORD ShadeCaps
Definition: wined3d.h:1934
DWORD TextureOpCaps
Definition: wined3d.h:1960
DWORD MaxTextureRepeat
Definition: wined3d.h:1946
DWORD MaxAnisotropy
Definition: wined3d.h:1948
DWORD MaxVolumeExtent
Definition: wined3d.h:1945
float ExtentsAdjust
Definition: wined3d.h:1956
float GuardBandLeft
Definition: wined3d.h:1951
DWORD VolumeTextureFilterCaps
Definition: wined3d.h:1938
DWORD DevCaps
Definition: wined3d.h:1927
DWORD ZCmpCaps
Definition: wined3d.h:1930
DWORD MaxTextureHeight
Definition: wined3d.h:1944
DWORD CursorCaps
Definition: wined3d.h:1926
DWORD Caps
Definition: wined3d.h:1922
DWORD Caps3
Definition: wined3d.h:1924
DWORD MaxStreams
Definition: wined3d.h:1974
DWORD AlphaCmpCaps
Definition: wined3d.h:1933
DWORD DestBlendCaps
Definition: wined3d.h:1932
DWORD RasterCaps
Definition: wined3d.h:1929
float MaxVertexW
Definition: wined3d.h:1949
float MaxPointSize
Definition: wined3d.h:1970
DWORD Caps2
Definition: wined3d.h:1923
DWORD MaxPrimitiveCount
Definition: wined3d.h:1972
DWORD VertexShaderVersion
Definition: wined3d.h:1977
enum wined3d_device_type DeviceType
Definition: wined3d.h:1920
DWORD MaxTextureWidth
Definition: wined3d.h:1943
DWORD LineCaps
Definition: wined3d.h:1941
DWORD MaxUserClipPlanes
Definition: wined3d.h:1966
DWORD PixelShaderVersion
Definition: wined3d.h:1980
float GuardBandBottom
Definition: wined3d.h:1954
float GuardBandRight
Definition: wined3d.h:1953
DWORD MaxVertexIndex
Definition: wined3d.h:1973
DWORD CubeTextureFilterCaps
Definition: wined3d.h:1937
DWORD MaxTextureAspectRatio
Definition: wined3d.h:1947
DWORD MaxStreamStride
Definition: wined3d.h:1975
DWORD MaxSimultaneousTextures
Definition: wined3d.h:1962
DWORD MaxActiveLights
Definition: wined3d.h:1965
DWORD StencilCaps
Definition: wined3d.h:1957
DWORD SrcBlendCaps
Definition: wined3d.h:1931
DWORD TextureFilterCaps
Definition: wined3d.h:1936
DWORD MaxVertexShaderConst
Definition: wined3d.h:1978
#define WINED3DLINECAPS_ANTIALIAS
Definition: wined3d.h:1073
#define WINED3DPRASTERCAPS_DEPTHBIAS
Definition: wined3d.h:1222

Referenced by d3d8_device_GetDeviceCaps(), and d3d8_GetDeviceCaps().

◆ d3dformat_from_wined3dformat()

D3DFORMAT d3dformat_from_wined3dformat ( enum wined3d_format_id  format)

Definition at line 33 of file device.c.

34{
35 BYTE *c = (BYTE *)&format;
36
37 /* Don't translate FOURCC formats */
38 if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3]))
39 return (D3DFORMAT)format;
40
41 switch(format)
42 {
52 case WINED3DFMT_A8_UNORM: return D3DFMT_A8;
58 case WINED3DFMT_P8_UINT: return D3DFMT_P8;
59 case WINED3DFMT_L8_UNORM: return D3DFMT_L8;
78 default:
79 FIXME("Unhandled wined3d format %#x.\n", format);
80 return D3DFMT_UNKNOWN;
81 }
82}
#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
enum _D3DFORMAT D3DFORMAT
@ WINED3DFMT_B2G3R3_UNORM
Definition: wined3d.h:131
@ WINED3DFMT_B4G4R4A4_UNORM
Definition: wined3d.h:130
@ WINED3DFMT_R16G16_UNORM
Definition: wined3d.h:192
@ WINED3DFMT_X8D24_UNORM
Definition: wined3d.h:151
@ WINED3DFMT_R10G10B10A2_UNORM
Definition: wined3d.h:179
@ WINED3DFMT_R16G16_SNORM
Definition: wined3d.h:194
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:244
@ WINED3DFMT_R8G8B8A8_SNORM
Definition: wined3d.h:188
@ WINED3DFMT_D16_LOCKABLE
Definition: wined3d.h:148
@ WINED3DFMT_R10G11B11_SNORM
Definition: wined3d.h:143
@ WINED3DFMT_S1_UINT_D15_UNORM
Definition: wined3d.h:150
@ WINED3DFMT_B2G3R3A8_UNORM
Definition: wined3d.h:132
@ WINED3DFMT_L8A8_UNORM
Definition: wined3d.h:139
@ WINED3DFMT_L4A4_UNORM
Definition: wined3d.h:140
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:245
@ WINED3DFMT_B5G5R5X1_UNORM
Definition: wined3d.h:129
@ WINED3DFMT_D16_UNORM
Definition: wined3d.h:212
@ WINED3DFMT_L8_UNORM
Definition: wined3d.h:138
@ WINED3DFMT_R8G8_SNORM
Definition: wined3d.h:208
@ WINED3DFMT_R5G5_SNORM_L6_UNORM
Definition: wined3d.h:141
@ WINED3DFMT_B8G8R8_UNORM
Definition: wined3d.h:128
@ WINED3DFMT_R32_UINT
Definition: wined3d.h:199
@ WINED3DFMT_B5G5R5A1_UNORM
Definition: wined3d.h:243
@ WINED3DFMT_R10G10B10_SNORM_A2_UNORM
Definition: wined3d.h:147
@ WINED3DFMT_D32_UNORM
Definition: wined3d.h:149
@ WINED3DFMT_R8G8_SNORM_L8X8_UNORM
Definition: wined3d.h:142
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:242
@ WINED3DFMT_S4X4_UINT_D24_UNORM
Definition: wined3d.h:152
@ WINED3DFMT_P8_UINT
Definition: wined3d.h:137
@ WINED3DFMT_A8_UNORM
Definition: wined3d.h:222
@ WINED3DFMT_B4G4R4X4_UNORM
Definition: wined3d.h:133
@ WINED3DFMT_D24_UNORM_S8_UINT
Definition: wined3d.h:202
@ WINED3DFMT_P8_UINT_A8_UNORM
Definition: wined3d.h:136
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 184 of file device.c.

185{
186 switch (effect)
187 {
191 return D3DSWAPEFFECT_FLIP;
193 return D3DSWAPEFFECT_COPY;
196 default:
197 FIXME("Unhandled swap effect %#x.\n", effect);
198 return D3DSWAPEFFECT_FLIP;
199 }
200}
@ 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:538
@ WINED3D_SWAP_EFFECT_SEQUENTIAL
Definition: wined3d.h:535
@ WINED3D_SWAP_EFFECT_DISCARD
Definition: wined3d.h:534
@ WINED3D_SWAP_EFFECT_COPY_VSYNC
Definition: wined3d.h:539

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

3588{
3589 return CONTAINING_RECORD(device_parent, struct d3d8_device, device_parent);
3590}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by device_parent_activate().

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

3669{
3670 struct wined3d_swapchain_desc swapchain_desc;
3674 struct d3d8_swapchain *d3d_swapchain;
3675 struct wined3d_caps caps;
3676 unsigned int output_idx;
3677 HRESULT hr;
3678
3679 static const enum wined3d_feature_level feature_levels[] =
3680 {
3685 };
3686
3687 output_idx = adapter;
3688 if (output_idx >= parent->wined3d_output_count)
3689 return D3DERR_INVALIDCALL;
3690
3691 device->IDirect3DDevice8_iface.lpVtbl = &d3d8_device_vtbl;
3692 device->device_parent.ops = &d3d8_wined3d_device_parent_ops;
3693 device->adapter_ordinal = adapter;
3694 device->ref = 1;
3695 if (!(device->handle_table.entries = calloc(D3D8_INITIAL_HANDLE_TABLE_SIZE,
3696 sizeof(*device->handle_table.entries))))
3697 {
3698 ERR("Failed to allocate handle table memory.\n");
3699 return E_OUTOFMEMORY;
3700 }
3701 device->handle_table.table_size = D3D8_INITIAL_HANDLE_TABLE_SIZE;
3702
3704
3706 wined3d_output = parent->wined3d_outputs[output_idx];
3709 focus_window, flags, 4, feature_levels, ARRAY_SIZE(feature_levels),
3710 &device->device_parent, &device->wined3d_device)))
3711 {
3712 WARN("Failed to create wined3d device, hr %#lx.\n", hr);
3714 free(device->handle_table.entries);
3715 return hr;
3716 }
3717
3718 device->immediate_context = wined3d_device_get_immediate_context(device->wined3d_device);
3720 device->max_user_clip_planes = caps.MaxUserClipPlanes;
3721 device->vs_uniform_count = caps.MaxVertexShaderConst;
3722
3723 if (FAILED(hr = wined3d_stateblock_create(device->wined3d_device, NULL, WINED3D_SBT_PRIMARY, &device->state)))
3724 {
3725 ERR("Failed to create primary stateblock, hr %#lx.\n", hr);
3726 wined3d_device_decref(device->wined3d_device);
3728 return hr;
3729 }
3730 device->stateblock_state = wined3d_stateblock_get_state(device->state);
3731 device->update_state = device->state;
3732
3735
3736 if (!parameters->Windowed)
3737 {
3738 if (!focus_window)
3739 focus_window = parameters->hDeviceWindow;
3740 if (FAILED(hr = wined3d_device_acquire_focus_window(device->wined3d_device, focus_window)))
3741 {
3742 ERR("Failed to acquire focus window, hr %#lx.\n", hr);
3743 wined3d_device_decref(device->wined3d_device);
3745 free(device->handle_table.entries);
3746 return hr;
3747 }
3748 }
3749
3752
3754 {
3756 wined3d_device_decref(device->wined3d_device);
3758 free(device->handle_table.entries);
3759 return D3DERR_INVALIDCALL;
3760 }
3761 swapchain_desc.flags |= WINED3D_SWAPCHAIN_IMPLICIT;
3762
3763 if (FAILED(hr = d3d8_swapchain_create(device, &swapchain_desc,
3764 wined3dswapinterval_from_d3d(parameters->FullScreen_PresentationInterval), &d3d_swapchain)))
3765 {
3766 WARN("Failed to create implicit swapchain, hr %#lx.\n", hr);
3768 wined3d_device_decref(device->wined3d_device);
3770 free(device->handle_table.entries);
3771 return hr;
3772 }
3773
3774 wined3d_swapchain = d3d_swapchain->wined3d_swapchain;
3777
3779 !!swapchain_desc.enable_auto_depth_stencil);
3783
3785 &swapchain_desc, parameters->FullScreen_PresentationInterval);
3786
3787 device->declArraySize = 16;
3788 if (!(device->decls = malloc(device->declArraySize * sizeof(*device->decls))))
3789 {
3790 ERR("Failed to allocate FVF vertex declaration map memory.\n");
3791 hr = E_OUTOFMEMORY;
3792 goto err;
3793 }
3794
3795 device->implicit_swapchain = wined3d_swapchain;
3796
3797 device->d3d_parent = parent;
3798 IDirect3D8_AddRef(&parent->IDirect3D8_iface);
3799
3800 return D3D_OK;
3801
3802err:
3806 wined3d_device_decref(device->wined3d_device);
3808 free(device->handle_table.entries);
3809 return hr;
3810}
#define D3D8_INITIAL_HANDLE_TABLE_SIZE
Definition: d3d8_private.h:69
static enum wined3d_device_type wined3d_device_type_from_d3d(D3DDEVTYPE type)
Definition: d3d8_private.h:392
device_type
static const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops
Definition: device.c:3642
static const struct IDirect3DDevice8Vtbl d3d8_device_vtbl
Definition: device.c:3486
static void setup_fpu(void)
Definition: device.c:3650
HRESULT CDECL wined3d_device_acquire_focus_window(struct wined3d_device *device, HWND window)
Definition: device.c:1133
void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device)
Definition: device.c:1746
struct wined3d_device_context *CDECL wined3d_device_get_immediate_context(struct wined3d_device *device)
Definition: device.c:1969
return adapter
static D3D_DRIVER_TYPE HMODULE UINT const D3D_FEATURE_LEVEL * feature_levels
Definition: hlsl_d3d11.c:28
#define err(...)
#define IDirect3DSwapChain8_Release(p)
Definition: d3d8.h:266
#define D3DCREATE_MULTITHREADED
Definition: d3d8.h:38
#define D3DCREATE_FPU_PRESERVE
Definition: d3d8.h:37
#define IDirect3D8_AddRef(p)
Definition: d3d8.h:156
struct wined3d_swapchain * wined3d_swapchain
Definition: d3d8_private.h:179
struct wined3d_adapter *CDECL wined3d_output_get_adapter(const struct wined3d_output *output)
Definition: directx.c:1508
HRESULT CDECL wined3d_get_device_caps(const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, struct wined3d_caps *caps)
Definition: directx.c:2366
HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, struct wined3d_adapter *adapter, enum wined3d_device_type device_type, HWND focus_window, uint32_t flags, BYTE surface_alignment, const enum wined3d_feature_level *feature_levels, unsigned int feature_level_count, struct wined3d_device_parent *device_parent, struct wined3d_device **device)
Definition: directx.c:2777
const struct wined3d_stateblock_state *CDECL wined3d_stateblock_get_state(const struct wined3d_stateblock *stateblock)
Definition: stateblock.c:2064
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:135
@ WINED3D_SBT_PRIMARY
Definition: wined3d.h:791
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:909
static void wined3d_streaming_buffer_init(struct wined3d_streaming_buffer *buffer, unsigned int bind_flags)
Definition: wined3d.h:2937
wined3d_feature_level
Definition: wined3d.h:98
@ WINED3D_FEATURE_LEVEL_8
Definition: wined3d.h:103
@ WINED3D_FEATURE_LEVEL_7
Definition: wined3d.h:102
@ WINED3D_FEATURE_LEVEL_6
Definition: wined3d.h:101
@ WINED3D_FEATURE_LEVEL_5
Definition: wined3d.h:100
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:910

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

◆ device_parent_activate()

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

Definition at line 3603 of file device.c.

3604{
3606
3607 TRACE("device_parent %p, activate %#x.\n", device_parent, activate);
3608
3609 if (!activate)
3611 else
3613}
static struct d3d8_device * device_from_device_parent(struct wined3d_device_parent *device_parent)
Definition: device.c:3587
#define InterlockedCompareExchange
Definition: interlocked.h:119
struct wined3d_device_parent device_parent
Definition: d3d8_private.h:111

◆ device_parent_mode_changed()

static void CDECL device_parent_mode_changed ( struct wined3d_device_parent *  device_parent)
static

Definition at line 3598 of file device.c.

3599{
3600 TRACE("device_parent %p.\n", device_parent);
3601}

◆ device_parent_texture_sub_resource_created()

static HRESULT CDECL device_parent_texture_sub_resource_created ( struct wined3d_device_parent *  device_parent,
enum wined3d_resource_type  type,
struct wined3d_texture *  wined3d_texture,
unsigned int  sub_resource_idx,
void **  parent,
const struct wined3d_parent_ops **  parent_ops 
)
static

Definition at line 3615 of file device.c.

3618{
3619 TRACE("device_parent %p, type %#x, wined3d_texture %p, sub_resource_idx %u, parent %p, parent_ops %p.\n",
3620 device_parent, type, wined3d_texture, sub_resource_idx, parent, parent_ops);
3621
3623 {
3624 struct d3d8_volume *d3d_volume;
3625
3626 if (!(d3d_volume = calloc(1, sizeof(*d3d_volume))))
3627 return E_OUTOFMEMORY;
3628
3629 volume_init(d3d_volume, wined3d_texture, sub_resource_idx, parent_ops);
3630 *parent = d3d_volume;
3631 TRACE("Created volume %p.\n", d3d_volume);
3632 }
3633 else if (type != WINED3D_RTYPE_TEXTURE_2D)
3634 {
3635 ERR("Unhandled resource type %#x.\n", type);
3636 return E_FAIL;
3637 }
3638
3639 return D3D_OK;
3640}
void volume_init(struct d3d8_volume *volume, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops)
Definition: volume.c:203
unsigned int sub_resource_idx
Definition: d3d8_private.h:168
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:721

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

3594{
3595 TRACE("device_parent %p, device %p\n", device_parent, device);
3596}

◆ device_reset_viewport_state()

static void device_reset_viewport_state ( struct d3d8_device *  device)
static

Definition at line 559 of file device.c.

560{
561 struct wined3d_viewport vp;
562 RECT rect;
563
564 wined3d_device_context_get_viewports(device->immediate_context, NULL, &vp);
568}
void CDECL wined3d_device_context_get_scissor_rects(const struct wined3d_device_context *context, unsigned int *rect_count, RECT *rects)
Definition: device.c:1890
void CDECL wined3d_device_context_get_viewports(const struct wined3d_device_context *context, unsigned int *viewport_count, struct wined3d_viewport *viewports)
Definition: device.c:1844
void CDECL wined3d_stateblock_set_scissor_rect(struct wined3d_stateblock *stateblock, const RECT *rect)
Definition: stateblock.c:1910

Referenced by d3d8_device_Reset(), d3d8_device_SetRenderTarget(), d3d9_device_reset(), d3d9_device_SetRenderTarget(), d3d_device_init(), and device_init().

◆ 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,
DWORD  presentation_interval 
)
static

Definition at line 202 of file device.c.

204{
205 present_parameters->BackBufferWidth = swapchain_desc->backbuffer_width;
206 present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height;
207 present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc->backbuffer_format);
208 present_parameters->BackBufferCount = swapchain_desc->backbuffer_count;
209 present_parameters->MultiSampleType = d3dmultisample_type_from_wined3d(swapchain_desc->multisample_type);
210 present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect);
211 present_parameters->hDeviceWindow = swapchain_desc->device_window;
212 present_parameters->Windowed = swapchain_desc->windowed;
213 present_parameters->EnableAutoDepthStencil = swapchain_desc->enable_auto_depth_stencil;
214 present_parameters->AutoDepthStencilFormat
216 present_parameters->Flags = swapchain_desc->flags & D3DPRESENTFLAGS_MASK;
217 present_parameters->FullScreen_RefreshRateInHz = swapchain_desc->refresh_rate;
218 present_parameters->FullScreen_PresentationInterval = presentation_interval;
219}
static D3DMULTISAMPLE_TYPE d3dmultisample_type_from_wined3d(enum wined3d_multisample_type type)
Definition: d3d8_private.h:387
#define D3DPRESENTFLAGS_MASK
Definition: d3d8_private.h:37
static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect(enum wined3d_swap_effect effect)
Definition: device.c:184
D3DSWAPEFFECT SwapEffect
Definition: d3d8types.h:1128
D3DMULTISAMPLE_TYPE MultiSampleType
Definition: d3d8types.h:1126
D3DFORMAT BackBufferFormat
Definition: d3d8types.h:1123
D3DFORMAT AutoDepthStencilFormat
Definition: d3d8types.h:1132
unsigned int backbuffer_height
Definition: wined3d.h:1773
enum wined3d_multisample_type multisample_type
Definition: wined3d.h:1777
enum wined3d_format_id auto_depth_stencil_format
Definition: wined3d.h:1783
unsigned int backbuffer_width
Definition: wined3d.h:1772
unsigned int backbuffer_count
Definition: wined3d.h:1775
enum wined3d_format_id backbuffer_format
Definition: wined3d.h:1774
enum wined3d_swap_effect swap_effect
Definition: wined3d.h:1779
BOOL enable_auto_depth_stencil
Definition: wined3d.h:1782
unsigned int refresh_rate
Definition: wined3d.h:1785

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

893{
895 struct d3d8_indexbuffer *index_buffer;
897 IDirect3DBaseTexture8 *texture;
898 struct d3d8_surface *surface;
900
902 if ((desc.access & WINED3D_RESOURCE_ACCESS_CPU) || (desc.usage & WINED3DUSAGE_MANAGED))
903 return D3D_OK;
904
905 if (desc.resource_type != WINED3D_RTYPE_TEXTURE_2D)
906 {
907 if (desc.bind_flags & WINED3D_BIND_VERTEX_BUFFER)
908 {
910 if (vertex_buffer && vertex_buffer->draw_buffer)
911 return D3D_OK;
912 }
913 if (desc.bind_flags & WINED3D_BIND_INDEX_BUFFER)
914 {
916 if (index_buffer && index_buffer->sysmem)
917 return D3D_OK;
918 }
919
920 WARN("Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", resource);
921 return D3DERR_DEVICELOST;
922 }
923
925 if (parent && SUCCEEDED(IUnknown_QueryInterface(parent, &IID_IDirect3DBaseTexture8, (void **)&texture)))
926 {
928 WARN("Texture %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", texture, resource);
929 return D3DERR_DEVICELOST;
930 }
931
933 if (!surface || !surface->resource.refcount)
934 return D3D_OK;
935
936 WARN("Surface %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface);
937 return D3DERR_DEVICELOST;
938}
void *CDECL wined3d_resource_get_parent(const struct wined3d_resource *resource)
Definition: resource.c:269
#define IDirect3DBaseTexture8_Release(p)
Definition: d3d8.h:542
struct d3d8_resource resource
Definition: d3d8_private.h:191
#define WINED3DUSAGE_MANAGED
Definition: wined3d.h:938

Referenced by d3d8_device_Reset(), and d3d9_device_reset().

◆ resolve_depth_buffer()

static void resolve_depth_buffer ( struct d3d8_device *  device)
static

Definition at line 1963 of file device.c.

1964{
1965 const struct wined3d_stateblock_state *state = device->stateblock_state;
1966 struct wined3d_rendertarget_view *wined3d_dsv;
1967 struct wined3d_resource *dst_resource;
1968 struct wined3d_texture *dst_texture;
1970 struct d3d8_surface *d3d8_dsv;
1971
1972 if (!(dst_texture = state->textures[0]))
1973 return;
1974 dst_resource = wined3d_texture_get_resource(dst_texture);
1975 wined3d_resource_get_desc(dst_resource, &desc);
1977 && desc.format != WINED3DFMT_X8D24_UNORM
1978 && desc.format != WINED3DFMT_DF16
1979 && desc.format != WINED3DFMT_DF24
1980 && desc.format != WINED3DFMT_INTZ)
1981 return;
1982
1983 if (!(wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
1984 return;
1986
1987 wined3d_device_context_resolve_sub_resource(device->immediate_context, dst_resource, 0,
1988 wined3d_rendertarget_view_get_resource(wined3d_dsv), d3d8_dsv->sub_resource_idx, desc.format);
1989}
void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_context *context, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, enum wined3d_format_id format_id)
Definition: device.c:4417
struct wined3d_resource *CDECL wined3d_texture_get_resource(struct wined3d_texture *texture)
Definition: texture.c:1649
@ WINED3DFMT_DF16
Definition: wined3d.h:280
@ WINED3DFMT_INTZ
Definition: wined3d.h:274
@ WINED3DFMT_DF24
Definition: wined3d.h:281

Referenced by d3d8_device_SetRenderState(), and d3d9_device_SetRenderState().

◆ setup_fpu()

static void setup_fpu ( void  )
static

Definition at line 3650 of file device.c.

3651{
3652#if defined(__i386__) && defined(_MSC_VER)
3653 WORD cw;
3654 __asm fnstcw cw;
3655 cw = (cw & ~0xf3f) | 0x3f;
3656 __asm fldcw cw;
3657#elif defined(__i386__) || (defined(__x86_64__) && !defined(__arm64ec__) && (defined(__GNUC__) || defined(__clang__)))
3658 WORD cw;
3659 __asm__ volatile ("fnstcw %0" : "=m" (cw));
3660 cw = (cw & ~0xf3f) | 0x3f;
3661 __asm__ volatile ("fldcw %0" : : "m" (cw));
3662#else
3663 FIXME("FPU setup not implemented for this platform.\n");
3664#endif
3665}
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" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tpush %rbx\n" "\t.seh_pushreg %rbx\n" "\tpush %rdi\n" "\t.seh_pushreg %rdi\n" "\tpush %rsi\n" "\t.seh_pushreg %rsi\n" "\tpush %r12\n" "\t.seh_pushreg %r12\n" "\tpush %r13\n" "\t.seh_pushreg %r13\n" "\tpush %r14\n" "\t.seh_pushreg %r14\n" "\tpush %r15\n" "\t.seh_pushreg %r15\n" "\tsub $40, %rsp\n" "\t.seh_stackalloc 40\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $40, %rsp\n" "\tpop %r15\n" "\tpop %r14\n" "\tpop %r13\n" "\tpop %r12\n" "\tpop %rsi\n" "\tpop %rdi\n" "\tpop %rbx\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 158 of file device.c.

159{
160 switch (primitive_type)
161 {
162 case D3DPT_POINTLIST:
163 return primitive_count;
164
165 case D3DPT_LINELIST:
166 return primitive_count * 2;
167
168 case D3DPT_LINESTRIP:
169 return primitive_count + 1;
170
172 return primitive_count * 3;
173
176 return primitive_count + 2;
177
178 default:
179 FIXME("Unhandled primitive type %#x.\n", primitive_type);
180 return 0;
181 }
182}
@ 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_multisample_type_from_d3d()

◆ wined3d_primitive_type_from_d3d()

◆ wined3d_render_state_from_d3d()

static enum wined3d_render_state wined3d_render_state_from_d3d ( D3DRENDERSTATETYPE  state)
static

Definition at line 451 of file device.c.

452{
453 switch (state)
454 {
455 case D3DRS_ZBIAS:
459 default:
460 return (enum wined3d_render_state)state;
461 }
462}
@ D3DRS_EDGEANTIALIAS
Definition: d3d8types.h:752
wined3d_render_state
Definition: wined3d.h:288
@ WINED3D_RS_ANTIALIASEDLINEENABLE
Definition: wined3d.h:383

Referenced by d3d8_device_SetRenderState(), and d3d9_device_SetRenderState().

◆ wined3d_swapchain_desc_from_d3d8()

static BOOL wined3d_swapchain_desc_from_d3d8 ( struct wined3d_swapchain_desc *  swapchain_desc,
struct wined3d_output *  output,
const D3DPRESENT_PARAMETERS *  present_parameters 
)
static

Definition at line 265 of file device.c.

267{
268 if (!present_parameters->SwapEffect || present_parameters->SwapEffect > D3DSWAPEFFECT_COPY_VSYNC)
269 {
270 WARN("Invalid swap effect %u passed.\n", present_parameters->SwapEffect);
271 return FALSE;
272 }
273 if (present_parameters->BackBufferCount > 3
274 || ((present_parameters->SwapEffect == D3DSWAPEFFECT_COPY
275 || present_parameters->SwapEffect == D3DSWAPEFFECT_COPY_VSYNC)
276 && present_parameters->BackBufferCount > 1))
277 {
278 WARN("Invalid backbuffer count %u.\n", present_parameters->BackBufferCount);
279 return FALSE;
280 }
281 switch (present_parameters->FullScreen_PresentationInterval)
282 {
289 break;
290 default:
291 WARN("Invalid presentation interval %#x.\n",
292 present_parameters->FullScreen_PresentationInterval);
293 return FALSE;
294 }
295
296 swapchain_desc->output = output;
297 swapchain_desc->backbuffer_width = present_parameters->BackBufferWidth;
298 swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
299 swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
300 swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount);
302 swapchain_desc->multisample_type = wined3d_multisample_type_from_d3d(present_parameters->MultiSampleType);
303 swapchain_desc->multisample_quality = 0; /* d3d9 only */
304 swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect);
305 swapchain_desc->device_window = present_parameters->hDeviceWindow;
306 swapchain_desc->windowed = present_parameters->Windowed;
307 swapchain_desc->enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil;
308 swapchain_desc->auto_depth_stencil_format
310 swapchain_desc->flags
312 swapchain_desc->refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
313 swapchain_desc->auto_restore_display_mode = TRUE;
314
315 if (present_parameters->Flags & ~D3DPRESENTFLAGS_MASK)
316 FIXME("Unhandled flags %#lx.\n", present_parameters->Flags & ~D3DPRESENTFLAGS_MASK);
317
318 return TRUE;
319}
#define FALSE
Definition: types.h:117
static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFECT effect)
Definition: device.c:221
#define D3DPRESENT_INTERVAL_THREE
Definition: d3d8caps.h:31
#define D3DPRESENT_INTERVAL_TWO
Definition: d3d8caps.h:30
#define D3DPRESENT_INTERVAL_FOUR
Definition: d3d8caps.h:32
#define D3DPRESENT_INTERVAL_DEFAULT
Definition: d3d8caps.h:28
unsigned int multisample_quality
Definition: wined3d.h:1778
BOOL auto_restore_display_mode
Definition: wined3d.h:1786
struct wined3d_output * output
Definition: wined3d.h:1771
unsigned int backbuffer_bind_flags
Definition: wined3d.h:1776
#define max(a, b)
Definition: svc.c:63
#define WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
Definition: wined3d.h:897

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

◆ wined3d_transform_state_from_d3d()

static enum wined3d_transform_state wined3d_transform_state_from_d3d ( D3DTRANSFORMSTATETYPE  state)
static

◆ wined3dformat_from_d3dformat()

enum wined3d_format_id wined3dformat_from_d3dformat ( D3DFORMAT  format)

Definition at line 84 of file device.c.

85{
86 BYTE *c = (BYTE *)&format;
87
88 /* Don't translate FOURCC formats */
89 if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3]))
90 return (enum wined3d_format_id)format;
91
92 switch(format)
93 {
103 case D3DFMT_A8: return WINED3DFMT_A8_UNORM;
109 case D3DFMT_P8: return WINED3DFMT_P8_UINT;
110 case D3DFMT_L8: return WINED3DFMT_L8_UNORM;
121 case D3DFMT_D32: return WINED3DFMT_D32_UNORM;
126 case D3DFMT_D16: return WINED3DFMT_D16_UNORM;
129 default:
130 FIXME("Unhandled D3DFORMAT %#x.\n", format);
131 return WINED3DFMT_UNKNOWN;
132 }
133}

Referenced by d3d8_device_CreateDepthStencilSurface(), d3d8_device_CreateImageSurface(), d3d8_device_CreateRenderTarget(), d3d8_device_DrawIndexedPrimitiveUP(), d3d9_device_CreateDepthStencilSurface(), d3d9_device_CreateDepthStencilSurfaceEx(), d3d9_device_CreateOffscreenPlainSurface(), d3d9_device_CreateRenderTarget(), d3d9_device_CreateRenderTargetEx(), d3d9_device_DrawIndexedPrimitiveUP(), d3d9_device_reset(), wined3d_swapchain_desc_from_d3d8(), and wined3d_swapchain_desc_from_d3d9().

◆ wined3dmapflags_from_d3dmapflags()

unsigned int wined3dmapflags_from_d3dmapflags ( unsigned int  flags,
unsigned int  usage 
)

Definition at line 135 of file device.c.

136{
137 static const unsigned int handled = D3DLOCK_NOSYSLOCK
141 unsigned int wined3d_flags;
142
143 wined3d_flags = flags & handled;
145 wined3d_flags |= WINED3D_MAP_READ;
146 if (!(flags & D3DLOCK_READONLY))
147 wined3d_flags |= WINED3D_MAP_WRITE;
148 if (!(wined3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
149 wined3d_flags |= WINED3D_MAP_WRITE;
150 flags &= ~(handled | D3DLOCK_READONLY);
151
152 if (flags)
153 FIXME("Unhandled flags %#x.\n", flags);
154
155 return wined3d_flags;
156}
#define D3DLOCK_DISCARD
Definition: d3d8types.h:72
#define D3DUSAGE_WRITEONLY
Definition: d3d8types.h:93
#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_WRITE
Definition: wined3d.h:956

◆ wined3dswapeffect_from_d3dswapeffect()

static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect ( D3DSWAPEFFECT  effect)
static

Definition at line 221 of file device.c.

222{
223 switch (effect)
224 {
233 default:
234 FIXME("Unhandled swap effect %#x.\n", effect);
236 }
237}

Referenced by wined3d_swapchain_desc_from_d3d8(), and wined3d_swapchain_desc_from_d3d9().

◆ wined3dswapinterval_from_d3d()

static enum wined3d_swap_interval wined3dswapinterval_from_d3d ( DWORD  interval)
static

Definition at line 239 of file device.c.

240{
241 switch (interval)
242 {
253 default:
254 FIXME("Unhandled presentation interval %#lx.\n", interval);
257 }
258}
@ WINED3D_SWAP_INTERVAL_TWO
Definition: wined3d.h:547
@ WINED3D_SWAP_INTERVAL_FOUR
Definition: wined3d.h:549
@ WINED3D_SWAP_INTERVAL_ONE
Definition: wined3d.h:546
@ WINED3D_SWAP_INTERVAL_DEFAULT
Definition: wined3d.h:550
@ WINED3D_SWAP_INTERVAL_THREE
Definition: wined3d.h:548
@ WINED3D_SWAP_INTERVAL_IMMEDIATE
Definition: wined3d.h:545

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

Variable Documentation

◆ d3d8_device_vtbl

const struct IDirect3DDevice8Vtbl d3d8_device_vtbl
static

Definition at line 3486 of file device.c.

Referenced by device_init().

◆ d3d8_null_wined3d_parent_ops

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

Definition at line 28 of file device.c.

Referenced by d3d8_device_create_surface(), d3d8_texture_init(), and vertexbuffer_init().

◆ 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:7692
static void CDECL device_parent_activate(struct wined3d_device_parent *device_parent, BOOL activate)
Definition: device.c:7697
static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_device_parent *device_parent, enum wined3d_resource_type type, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, void **parent, const struct wined3d_parent_ops **parent_ops)
Definition: device.c:7702
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent, struct wined3d_device *wined3d_device)
Definition: device.c:7658

Definition at line 3642 of file device.c.

Referenced by device_init().

◆ tss_lookup