ReactOS 0.4.16-dev-297-gc569aee
device.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include "wined3d_private.h"
Include dependency graph for device.c:

Go to the source code of this file.

Macros

#define copy_and_next(dest, src, size)   memcpy(dest, src, size); dest += (size)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d)
 
 WINE_DECLARE_DEBUG_CHANNEL (winediag)
 
GLenum gl_primitive_type_from_d3d (enum wined3d_primitive_type primitive_type)
 
static enum wined3d_primitive_type d3d_primitive_type_from_gl (GLenum primitive_type)
 
BOOL device_context_add (struct wined3d_device *device, struct wined3d_context *context)
 
void device_context_remove (struct wined3d_device *device, struct wined3d_context *context)
 
static BOOL is_full_clear (const struct wined3d_texture *texture, unsigned int sub_resource_idx, const RECT *draw_rect, const RECT *clear_rect)
 
void device_clear_render_targets (struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb, UINT rect_count, const RECT *clear_rect, const RECT *draw_rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
 
ULONG CDECL wined3d_device_incref (struct wined3d_device *device)
 
static void device_leftover_sampler (struct wine_rb_entry *entry, void *context)
 
ULONG CDECL wined3d_device_decref (struct wined3d_device *device)
 
UINT CDECL wined3d_device_get_swapchain_count (const struct wined3d_device *device)
 
struct wined3d_swapchain *CDECL wined3d_device_get_swapchain (const struct wined3d_device *device, UINT swapchain_idx)
 
static void device_load_logo (struct wined3d_device *device, const char *filename)
 
static void create_dummy_textures (struct wined3d_device *device, struct wined3d_context *context)
 
static void destroy_dummy_textures (struct wined3d_device *device, struct wined3d_context *context)
 
static void create_default_samplers (struct wined3d_device *device, struct wined3d_context *context)
 
static void destroy_default_samplers (struct wined3d_device *device, struct wined3d_context *context)
 
static LONG fullscreen_style (LONG style)
 
static LONG fullscreen_exstyle (LONG exstyle)
 
void CDECL wined3d_device_setup_fullscreen_window (struct wined3d_device *device, HWND window, UINT w, UINT h)
 
void CDECL wined3d_device_restore_fullscreen_window (struct wined3d_device *device, HWND window, const RECT *window_rect)
 
HRESULT CDECL wined3d_device_acquire_focus_window (struct wined3d_device *device, HWND window)
 
void CDECL wined3d_device_release_focus_window (struct wined3d_device *device)
 
static void device_init_swapchain_state (struct wined3d_device *device, struct wined3d_swapchain *swapchain)
 
static void wined3d_device_delete_opengl_contexts_cs (void *object)
 
static void wined3d_device_delete_opengl_contexts (struct wined3d_device *device)
 
static void wined3d_device_create_primary_opengl_context_cs (void *object)
 
static HRESULT wined3d_device_create_primary_opengl_context (struct wined3d_device *device)
 
HRESULT CDECL wined3d_device_init_3d (struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc)
 
HRESULT CDECL wined3d_device_init_gdi (struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc)
 
static void device_free_sampler (struct wine_rb_entry *entry, void *context)
 
HRESULT CDECL wined3d_device_uninit_3d (struct wined3d_device *device)
 
HRESULT CDECL wined3d_device_uninit_gdi (struct wined3d_device *device)
 
void CDECL wined3d_device_set_multithreaded (struct wined3d_device *device)
 
UINT CDECL wined3d_device_get_available_texture_mem (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_stream_output (struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer, UINT offset)
 
struct wined3d_buffer *CDECL wined3d_device_get_stream_output (struct wined3d_device *device, UINT idx, UINT *offset)
 
HRESULT CDECL wined3d_device_set_stream_source (struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
 
HRESULT CDECL wined3d_device_get_stream_source (const struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride)
 
HRESULT CDECL wined3d_device_set_stream_source_freq (struct wined3d_device *device, UINT stream_idx, UINT divider)
 
HRESULT CDECL wined3d_device_get_stream_source_freq (const struct wined3d_device *device, UINT stream_idx, UINT *divider)
 
void CDECL wined3d_device_set_transform (struct wined3d_device *device, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix)
 
void CDECL wined3d_device_get_transform (const struct wined3d_device *device, enum wined3d_transform_state state, struct wined3d_matrix *matrix)
 
void CDECL wined3d_device_multiply_transform (struct wined3d_device *device, enum wined3d_transform_state state, const struct wined3d_matrix *matrix)
 
HRESULT CDECL wined3d_device_set_light (struct wined3d_device *device, UINT light_idx, const struct wined3d_light *light)
 
HRESULT CDECL wined3d_device_get_light (const struct wined3d_device *device, UINT light_idx, struct wined3d_light *light)
 
HRESULT CDECL wined3d_device_set_light_enable (struct wined3d_device *device, UINT light_idx, BOOL enable)
 
HRESULT CDECL wined3d_device_get_light_enable (const struct wined3d_device *device, UINT light_idx, BOOL *enable)
 
HRESULT CDECL wined3d_device_set_clip_plane (struct wined3d_device *device, UINT plane_idx, const struct wined3d_vec4 *plane)
 
HRESULT CDECL wined3d_device_get_clip_plane (const struct wined3d_device *device, UINT plane_idx, struct wined3d_vec4 *plane)
 
HRESULT CDECL wined3d_device_set_clip_status (struct wined3d_device *device, const struct wined3d_clip_status *clip_status)
 
HRESULT CDECL wined3d_device_get_clip_status (const struct wined3d_device *device, struct wined3d_clip_status *clip_status)
 
void CDECL wined3d_device_set_material (struct wined3d_device *device, const struct wined3d_material *material)
 
void CDECL wined3d_device_get_material (const struct wined3d_device *device, struct wined3d_material *material)
 
void CDECL wined3d_device_set_index_buffer (struct wined3d_device *device, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset)
 
struct wined3d_buffer *CDECL wined3d_device_get_index_buffer (const struct wined3d_device *device, enum wined3d_format_id *format, unsigned int *offset)
 
void CDECL wined3d_device_set_base_vertex_index (struct wined3d_device *device, INT base_index)
 
INT CDECL wined3d_device_get_base_vertex_index (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_viewport (struct wined3d_device *device, const struct wined3d_viewport *viewport)
 
void CDECL wined3d_device_get_viewport (const struct wined3d_device *device, struct wined3d_viewport *viewport)
 
static void resolve_depth_buffer (struct wined3d_device *device)
 
void CDECL wined3d_device_set_blend_state (struct wined3d_device *device, struct wined3d_blend_state *blend_state)
 
struct wined3d_blend_state *CDECL wined3d_device_get_blend_state (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_rasterizer_state (struct wined3d_device *device, struct wined3d_rasterizer_state *rasterizer_state)
 
struct wined3d_rasterizer_state *CDECL wined3d_device_get_rasterizer_state (struct wined3d_device *device)
 
void CDECL wined3d_device_set_render_state (struct wined3d_device *device, enum wined3d_render_state state, DWORD value)
 
DWORD CDECL wined3d_device_get_render_state (const struct wined3d_device *device, enum wined3d_render_state state)
 
void CDECL wined3d_device_set_sampler_state (struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
 
DWORD CDECL wined3d_device_get_sampler_state (const struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state)
 
void CDECL wined3d_device_set_scissor_rect (struct wined3d_device *device, const RECT *rect)
 
void CDECL wined3d_device_get_scissor_rect (const struct wined3d_device *device, RECT *rect)
 
void CDECL wined3d_device_set_vertex_declaration (struct wined3d_device *device, struct wined3d_vertex_declaration *declaration)
 
struct wined3d_vertex_declaration *CDECL wined3d_device_get_vertex_declaration (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_vertex_shader (struct wined3d_device *device, struct wined3d_shader *shader)
 
struct wined3d_shader *CDECL wined3d_device_get_vertex_shader (const struct wined3d_device *device)
 
static void wined3d_device_set_constant_buffer (struct wined3d_device *device, enum wined3d_shader_type type, UINT idx, struct wined3d_buffer *buffer)
 
void CDECL wined3d_device_set_vs_cb (struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer)
 
static struct wined3d_bufferwined3d_device_get_constant_buffer (const struct wined3d_device *device, enum wined3d_shader_type shader_type, unsigned int idx)
 
struct wined3d_buffer *CDECL wined3d_device_get_vs_cb (const struct wined3d_device *device, UINT idx)
 
static void wined3d_device_set_shader_resource_view (struct wined3d_device *device, enum wined3d_shader_type type, UINT idx, struct wined3d_shader_resource_view *view)
 
void CDECL wined3d_device_set_vs_resource_view (struct wined3d_device *device, UINT idx, struct wined3d_shader_resource_view *view)
 
static struct wined3d_shader_resource_viewwined3d_device_get_shader_resource_view (const struct wined3d_device *device, enum wined3d_shader_type shader_type, unsigned int idx)
 
struct wined3d_shader_resource_view *CDECL wined3d_device_get_vs_resource_view (const struct wined3d_device *device, UINT idx)
 
static void wined3d_device_set_sampler (struct wined3d_device *device, enum wined3d_shader_type type, UINT idx, struct wined3d_sampler *sampler)
 
void CDECL wined3d_device_set_vs_sampler (struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler)
 
static struct wined3d_samplerwined3d_device_get_sampler (const struct wined3d_device *device, enum wined3d_shader_type shader_type, unsigned int idx)
 
struct wined3d_sampler *CDECL wined3d_device_get_vs_sampler (const struct wined3d_device *device, UINT idx)
 
HRESULT CDECL wined3d_device_set_vs_consts_b (struct wined3d_device *device, unsigned int start_idx, unsigned int count, const BOOL *constants)
 
HRESULT CDECL wined3d_device_get_vs_consts_b (const struct wined3d_device *device, unsigned int start_idx, unsigned int count, BOOL *constants)
 
HRESULT CDECL wined3d_device_set_vs_consts_i (struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants)
 
HRESULT CDECL wined3d_device_get_vs_consts_i (const struct wined3d_device *device, unsigned int start_idx, unsigned int count, struct wined3d_ivec4 *constants)
 
HRESULT CDECL wined3d_device_set_vs_consts_f (struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
 
HRESULT CDECL wined3d_device_get_vs_consts_f (const struct wined3d_device *device, unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants)
 
void CDECL wined3d_device_set_pixel_shader (struct wined3d_device *device, struct wined3d_shader *shader)
 
struct wined3d_shader *CDECL wined3d_device_get_pixel_shader (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_ps_cb (struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer)
 
struct wined3d_buffer *CDECL wined3d_device_get_ps_cb (const struct wined3d_device *device, UINT idx)
 
void CDECL wined3d_device_set_ps_resource_view (struct wined3d_device *device, UINT idx, struct wined3d_shader_resource_view *view)
 
struct wined3d_shader_resource_view *CDECL wined3d_device_get_ps_resource_view (const struct wined3d_device *device, UINT idx)
 
void CDECL wined3d_device_set_ps_sampler (struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler)
 
struct wined3d_sampler *CDECL wined3d_device_get_ps_sampler (const struct wined3d_device *device, UINT idx)
 
HRESULT CDECL wined3d_device_set_ps_consts_b (struct wined3d_device *device, unsigned int start_idx, unsigned int count, const BOOL *constants)
 
HRESULT CDECL wined3d_device_get_ps_consts_b (const struct wined3d_device *device, unsigned int start_idx, unsigned int count, BOOL *constants)
 
HRESULT CDECL wined3d_device_set_ps_consts_i (struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants)
 
HRESULT CDECL wined3d_device_get_ps_consts_i (const struct wined3d_device *device, unsigned int start_idx, unsigned int count, struct wined3d_ivec4 *constants)
 
HRESULT CDECL wined3d_device_set_ps_consts_f (struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
 
HRESULT CDECL wined3d_device_get_ps_consts_f (const struct wined3d_device *device, unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants)
 
void CDECL wined3d_device_set_hull_shader (struct wined3d_device *device, struct wined3d_shader *shader)
 
struct wined3d_shader *CDECL wined3d_device_get_hull_shader (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_hs_cb (struct wined3d_device *device, unsigned int idx, struct wined3d_buffer *buffer)
 
struct wined3d_buffer *CDECL wined3d_device_get_hs_cb (const struct wined3d_device *device, unsigned int idx)
 
void CDECL wined3d_device_set_hs_resource_view (struct wined3d_device *device, unsigned int idx, struct wined3d_shader_resource_view *view)
 
struct wined3d_shader_resource_view *CDECL wined3d_device_get_hs_resource_view (const struct wined3d_device *device, unsigned int idx)
 
void CDECL wined3d_device_set_hs_sampler (struct wined3d_device *device, unsigned int idx, struct wined3d_sampler *sampler)
 
struct wined3d_sampler *CDECL wined3d_device_get_hs_sampler (const struct wined3d_device *device, unsigned int idx)
 
void CDECL wined3d_device_set_domain_shader (struct wined3d_device *device, struct wined3d_shader *shader)
 
struct wined3d_shader *CDECL wined3d_device_get_domain_shader (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_ds_cb (struct wined3d_device *device, unsigned int idx, struct wined3d_buffer *buffer)
 
struct wined3d_buffer *CDECL wined3d_device_get_ds_cb (const struct wined3d_device *device, unsigned int idx)
 
void CDECL wined3d_device_set_ds_resource_view (struct wined3d_device *device, unsigned int idx, struct wined3d_shader_resource_view *view)
 
struct wined3d_shader_resource_view *CDECL wined3d_device_get_ds_resource_view (const struct wined3d_device *device, unsigned int idx)
 
void CDECL wined3d_device_set_ds_sampler (struct wined3d_device *device, unsigned int idx, struct wined3d_sampler *sampler)
 
struct wined3d_sampler *CDECL wined3d_device_get_ds_sampler (const struct wined3d_device *device, unsigned int idx)
 
void CDECL wined3d_device_set_geometry_shader (struct wined3d_device *device, struct wined3d_shader *shader)
 
struct wined3d_shader *CDECL wined3d_device_get_geometry_shader (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_gs_cb (struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer)
 
struct wined3d_buffer *CDECL wined3d_device_get_gs_cb (const struct wined3d_device *device, UINT idx)
 
void CDECL wined3d_device_set_gs_resource_view (struct wined3d_device *device, UINT idx, struct wined3d_shader_resource_view *view)
 
struct wined3d_shader_resource_view *CDECL wined3d_device_get_gs_resource_view (const struct wined3d_device *device, UINT idx)
 
void CDECL wined3d_device_set_gs_sampler (struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler)
 
struct wined3d_sampler *CDECL wined3d_device_get_gs_sampler (const struct wined3d_device *device, UINT idx)
 
void CDECL wined3d_device_set_compute_shader (struct wined3d_device *device, struct wined3d_shader *shader)
 
struct wined3d_shader *CDECL wined3d_device_get_compute_shader (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_cs_cb (struct wined3d_device *device, unsigned int idx, struct wined3d_buffer *buffer)
 
struct wined3d_buffer *CDECL wined3d_device_get_cs_cb (const struct wined3d_device *device, unsigned int idx)
 
void CDECL wined3d_device_set_cs_resource_view (struct wined3d_device *device, unsigned int idx, struct wined3d_shader_resource_view *view)
 
struct wined3d_shader_resource_view *CDECL wined3d_device_get_cs_resource_view (const struct wined3d_device *device, unsigned int idx)
 
void CDECL wined3d_device_set_cs_sampler (struct wined3d_device *device, unsigned int idx, struct wined3d_sampler *sampler)
 
struct wined3d_sampler *CDECL wined3d_device_get_cs_sampler (const struct wined3d_device *device, unsigned int idx)
 
static void wined3d_device_set_pipeline_unordered_access_view (struct wined3d_device *device, enum wined3d_pipeline pipeline, unsigned int idx, struct wined3d_unordered_access_view *uav, unsigned int initial_count)
 
static struct wined3d_unordered_access_viewwined3d_device_get_pipeline_unordered_access_view (const struct wined3d_device *device, enum wined3d_pipeline pipeline, unsigned int idx)
 
void CDECL wined3d_device_set_cs_uav (struct wined3d_device *device, unsigned int idx, struct wined3d_unordered_access_view *uav, unsigned int initial_count)
 
struct wined3d_unordered_access_view *CDECL wined3d_device_get_cs_uav (const struct wined3d_device *device, unsigned int idx)
 
void CDECL wined3d_device_set_unordered_access_view (struct wined3d_device *device, unsigned int idx, struct wined3d_unordered_access_view *uav, unsigned int initial_count)
 
struct wined3d_unordered_access_view *CDECL wined3d_device_get_unordered_access_view (const struct wined3d_device *device, unsigned int idx)
 
static HRESULT process_vertices_strided (const struct wined3d_device *device, DWORD dwDestIndex, DWORD dwCount, const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD flags, DWORD DestFVF)
 
HRESULT CDECL wined3d_device_process_vertices (struct wined3d_device *device, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf)
 
void CDECL wined3d_device_set_texture_stage_state (struct wined3d_device *device, UINT stage, enum wined3d_texture_stage_state state, DWORD value)
 
DWORD CDECL wined3d_device_get_texture_stage_state (const struct wined3d_device *device, UINT stage, enum wined3d_texture_stage_state state)
 
HRESULT CDECL wined3d_device_set_texture (struct wined3d_device *device, UINT stage, struct wined3d_texture *texture)
 
struct wined3d_texture *CDECL wined3d_device_get_texture (const struct wined3d_device *device, UINT stage)
 
HRESULT CDECL wined3d_device_get_device_caps (const struct wined3d_device *device, WINED3DCAPS *caps)
 
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)
 
HRESULT CDECL wined3d_device_begin_stateblock (struct wined3d_device *device)
 
HRESULT CDECL wined3d_device_end_stateblock (struct wined3d_device *device, struct wined3d_stateblock **stateblock)
 
HRESULT CDECL wined3d_device_begin_scene (struct wined3d_device *device)
 
HRESULT CDECL wined3d_device_end_scene (struct wined3d_device *device)
 
HRESULT CDECL wined3d_device_clear (struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
 
void CDECL wined3d_device_set_predication (struct wined3d_device *device, struct wined3d_query *predicate, BOOL value)
 
struct wined3d_query *CDECL wined3d_device_get_predication (struct wined3d_device *device, BOOL *value)
 
void CDECL wined3d_device_dispatch_compute (struct wined3d_device *device, unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z)
 
void CDECL wined3d_device_dispatch_compute_indirect (struct wined3d_device *device, struct wined3d_buffer *buffer, unsigned int offset)
 
void CDECL wined3d_device_set_primitive_type (struct wined3d_device *device, enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count)
 
void CDECL wined3d_device_get_primitive_type (const struct wined3d_device *device, enum wined3d_primitive_type *primitive_type, unsigned int *patch_vertex_count)
 
HRESULT CDECL wined3d_device_draw_primitive (struct wined3d_device *device, UINT start_vertex, UINT vertex_count)
 
void CDECL wined3d_device_draw_primitive_instanced (struct wined3d_device *device, UINT start_vertex, UINT vertex_count, UINT start_instance, UINT instance_count)
 
void CDECL wined3d_device_draw_primitive_instanced_indirect (struct wined3d_device *device, struct wined3d_buffer *buffer, unsigned int offset)
 
HRESULT CDECL wined3d_device_draw_indexed_primitive (struct wined3d_device *device, UINT start_idx, UINT index_count)
 
void CDECL wined3d_device_draw_indexed_primitive_instanced (struct wined3d_device *device, UINT start_idx, UINT index_count, UINT start_instance, UINT instance_count)
 
void CDECL wined3d_device_draw_indexed_primitive_instanced_indirect (struct wined3d_device *device, struct wined3d_buffer *buffer, unsigned int offset)
 
HRESULT CDECL wined3d_device_update_texture (struct wined3d_device *device, struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture)
 
HRESULT CDECL wined3d_device_validate_device (const struct wined3d_device *device, DWORD *num_passes)
 
void CDECL wined3d_device_set_software_vertex_processing (struct wined3d_device *device, BOOL software)
 
BOOL CDECL wined3d_device_get_software_vertex_processing (const struct wined3d_device *device)
 
HRESULT CDECL wined3d_device_get_raster_status (const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_raster_status *raster_status)
 
HRESULT CDECL wined3d_device_set_npatch_mode (struct wined3d_device *device, float segments)
 
float CDECL wined3d_device_get_npatch_mode (const struct wined3d_device *device)
 
void CDECL wined3d_device_copy_uav_counter (struct wined3d_device *device, struct wined3d_buffer *dst_buffer, unsigned int offset, struct wined3d_unordered_access_view *uav)
 
void CDECL wined3d_device_copy_resource (struct wined3d_device *device, struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource)
 
HRESULT CDECL wined3d_device_copy_sub_resource_region (struct wined3d_device *device, 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)
 
void CDECL wined3d_device_update_sub_resource (struct wined3d_device *device, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int depth_pitch)
 
void CDECL wined3d_device_resolve_sub_resource (struct wined3d_device *device, 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)
 
HRESULT CDECL wined3d_device_clear_rendertarget_view (struct wined3d_device *device, struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
 
void CDECL wined3d_device_clear_unordered_access_view_uint (struct wined3d_device *device, struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value)
 
struct wined3d_rendertarget_view *CDECL wined3d_device_get_rendertarget_view (const struct wined3d_device *device, unsigned int view_idx)
 
struct wined3d_rendertarget_view *CDECL wined3d_device_get_depth_stencil_view (const struct wined3d_device *device)
 
HRESULT CDECL wined3d_device_set_rendertarget_view (struct wined3d_device *device, unsigned int view_idx, struct wined3d_rendertarget_view *view, BOOL set_viewport)
 
void CDECL wined3d_device_set_depth_stencil_view (struct wined3d_device *device, struct wined3d_rendertarget_view *view)
 
static struct wined3d_texturewined3d_device_create_cursor_texture (struct wined3d_device *device, struct wined3d_texture *cursor_image, unsigned int sub_resource_idx)
 
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)
 
void CDECL wined3d_device_set_cursor_position (struct wined3d_device *device, int x_screen_space, int y_screen_space, DWORD flags)
 
BOOL CDECL wined3d_device_show_cursor (struct wined3d_device *device, BOOL show)
 
void CDECL wined3d_device_evict_managed_resources (struct wined3d_device *device)
 
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)
 
HRESULT CDECL wined3d_device_set_dialog_box_mode (struct wined3d_device *device, BOOL enable_dialogs)
 
void CDECL wined3d_device_get_creation_parameters (const struct wined3d_device *device, struct wined3d_device_creation_parameters *parameters)
 
struct wined3d *CDECL wined3d_device_get_wined3d (const struct wined3d_device *device)
 
void CDECL wined3d_device_set_gamma_ramp (const struct wined3d_device *device, UINT swapchain_idx, DWORD flags, const struct wined3d_gamma_ramp *ramp)
 
void CDECL wined3d_device_get_gamma_ramp (const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_gamma_ramp *ramp)
 
void device_resource_add (struct wined3d_device *device, struct wined3d_resource *resource)
 
static void device_resource_remove (struct wined3d_device *device, struct wined3d_resource *resource)
 
void device_resource_released (struct wined3d_device *device, struct wined3d_resource *resource)
 
static int wined3d_sampler_compare (const void *key, const struct wine_rb_entry *entry)
 
HRESULT device_init (struct wined3d_device *device, struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, HWND focus_window, DWORD flags, BYTE surface_alignment, struct wined3d_device_parent *device_parent)
 
void device_invalidate_state (const struct wined3d_device *device, DWORD state)
 
LRESULT device_process_message (struct wined3d_device *device, HWND window, BOOL unicode, UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc)
 

Variables

const struct wined3d_light WINED3D_default_light
 

Macro Definition Documentation

◆ copy_and_next

#define copy_and_next (   dest,
  src,
  size 
)    memcpy(dest, src, size); dest += (size)

Definition at line 3069 of file device.c.

Function Documentation

◆ create_default_samplers()

static void create_default_samplers ( struct wined3d_device device,
struct wined3d_context context 
)
static

Definition at line 780 of file device.c.

781{
783 HRESULT hr;
784
785 desc.address_u = WINED3D_TADDRESS_WRAP;
786 desc.address_v = WINED3D_TADDRESS_WRAP;
787 desc.address_w = WINED3D_TADDRESS_WRAP;
788 memset(desc.border_color, 0, sizeof(desc.border_color));
789 desc.mag_filter = WINED3D_TEXF_POINT;
790 desc.min_filter = WINED3D_TEXF_POINT;
791 desc.mip_filter = WINED3D_TEXF_NONE;
792 desc.lod_bias = 0.0f;
793 desc.min_lod = -1000.0f;
794 desc.max_lod = 1000.0f;
795 desc.mip_base_level = 0;
796 desc.max_anisotropy = 1;
797 desc.compare = FALSE;
798 desc.comparison_func = WINED3D_CMP_NEVER;
799 desc.srgb_decode = TRUE;
800
801 /* In SM4+ shaders there is a separation between resources and samplers. Some shader
802 * instructions allow access to resources without using samplers.
803 * In GLSL, resources are always accessed through sampler or image variables. The default
804 * sampler object is used to emulate the direct resource access when there is no sampler state
805 * to use.
806 */
808 {
809 ERR("Failed to create default sampler, hr %#x.\n", hr);
810 device->default_sampler = NULL;
811 }
812
813 /* In D3D10+, a NULL sampler maps to the default sampler state. */
814 desc.address_u = WINED3D_TADDRESS_CLAMP;
815 desc.address_v = WINED3D_TADDRESS_CLAMP;
816 desc.address_w = WINED3D_TADDRESS_CLAMP;
817 desc.mag_filter = WINED3D_TEXF_LINEAR;
818 desc.min_filter = WINED3D_TEXF_LINEAR;
819 desc.mip_filter = WINED3D_TEXF_LINEAR;
821 {
822 ERR("Failed to create null sampler, hr %#x.\n", hr);
823 device->null_sampler = NULL;
824 }
825}
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR desc[]
Definition: protectdata.c:36
HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct wined3d_sampler_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_sampler **sampler)
Definition: sampler.c:130
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
Definition: devices.h:37
const struct wined3d_parent_ops wined3d_null_parent_ops
Definition: directx.c:6815
@ WINED3D_TEXF_NONE
Definition: wined3d.h:685
@ WINED3D_TEXF_POINT
Definition: wined3d.h:686
@ WINED3D_TEXF_LINEAR
Definition: wined3d.h:687
@ WINED3D_TADDRESS_WRAP
Definition: wined3d.h:639
@ WINED3D_TADDRESS_CLAMP
Definition: wined3d.h:641
@ WINED3D_CMP_NEVER
Definition: wined3d.h:452

Referenced by wined3d_device_create_primary_opengl_context_cs().

◆ create_dummy_textures()

static void create_dummy_textures ( struct wined3d_device device,
struct wined3d_context context 
)
static

Definition at line 604 of file device.c.

605{
606 const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
607 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
608 struct wined3d_dummy_textures *textures = &device->dummy_textures;
609 unsigned int i;
610 DWORD color;
611
613 color = 0x000000ff;
614 else
615 color = 0x00000000;
616
617 /* Under DirectX you can sample even if no texture is bound, whereas
618 * OpenGL will only allow that when a valid texture is bound.
619 * We emulate this by creating dummy textures and binding them
620 * to each texture stage when the currently set D3D texture is NULL. */
621 context_active_texture(context, gl_info, 0);
622
623 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_1d);
624 TRACE("Dummy 1D texture given name %u.\n", textures->tex_1d);
625 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, textures->tex_1d);
626 gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA8, 1, 0,
628
629 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_2d);
630 TRACE("Dummy 2D texture given name %u.\n", textures->tex_2d);
631 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, textures->tex_2d);
632 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0,
634
635 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
636 {
637 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_rect);
638 TRACE("Dummy rectangle texture given name %u.\n", textures->tex_rect);
639 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textures->tex_rect);
640 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, 1, 1, 0,
642 }
643
644 if (gl_info->supported[EXT_TEXTURE3D])
645 {
646 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_3d);
647 TRACE("Dummy 3D texture given name %u.\n", textures->tex_3d);
648 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_3D, textures->tex_3d);
651 }
652
653 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
654 {
655 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_cube);
656 TRACE("Dummy cube texture given name %u.\n", textures->tex_cube);
657 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP, textures->tex_cube);
659 {
660 gl_info->gl_ops.gl.p_glTexImage2D(i, 0, GL_RGBA8, 1, 1, 0,
662 }
663 }
664
666 {
667 DWORD cube_array_data[6];
668
669 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_cube_array);
670 TRACE("Dummy cube array texture given name %u.\n", textures->tex_cube_array);
671 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures->tex_cube_array);
672 for (i = 0; i < ARRAY_SIZE(cube_array_data); ++i)
673 cube_array_data[i] = color;
675 GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, cube_array_data));
676 }
677
678 if (gl_info->supported[EXT_TEXTURE_ARRAY])
679 {
680
681 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_1d_array);
682 TRACE("Dummy 1D array texture given name %u.\n", textures->tex_1d_array);
683 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, textures->tex_1d_array);
684 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_1D_ARRAY, 0, GL_RGBA8, 1, 1, 0,
686
687 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_2d_array);
688 TRACE("Dummy 2D array texture given name %u.\n", textures->tex_2d_array);
689 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, textures->tex_2d_array);
692 }
693
695 {
697
698 GL_EXTCALL(glGenBuffers(1, &buffer));
699 GL_EXTCALL(glBindBuffer(GL_TEXTURE_BUFFER, buffer));
700 GL_EXTCALL(glBufferData(GL_TEXTURE_BUFFER, sizeof(color), &color, GL_STATIC_DRAW));
701 GL_EXTCALL(glBindBuffer(GL_TEXTURE_BUFFER, 0));
702
703 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_buffer);
704 TRACE("Dummy buffer texture given name %u.\n", textures->tex_buffer);
705 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_BUFFER, textures->tex_buffer);
707 GL_EXTCALL(glDeleteBuffers(1, &buffer));
708 }
709
711 {
712 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_2d_ms);
713 TRACE("Dummy multisample texture given name %u.\n", textures->tex_2d_ms);
714 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, textures->tex_2d_ms);
715 GL_EXTCALL(glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 1, GL_RGBA8, 1, 1, GL_TRUE));
716
717 gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_2d_ms_array);
718 TRACE("Dummy multisample array texture given name %u.\n", textures->tex_2d_ms_array);
719 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, textures->tex_2d_ms_array);
720 GL_EXTCALL(glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, GL_RGBA8, 1, 1, 1, GL_TRUE));
721
722 if (gl_info->supported[ARB_CLEAR_TEXTURE])
723 {
724 GL_EXTCALL(glClearTexImage(textures->tex_2d_ms, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color));
725 GL_EXTCALL(glClearTexImage(textures->tex_2d_ms_array, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color));
726 }
727 else
728 {
729 WARN("ARB_clear_texture is currently required to clear dummy multisample textures.\n");
730 }
731 }
732
733 checkGLcall("create dummy textures");
734
736}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define WARN(fmt,...)
Definition: precomp.h:61
void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info, unsigned int unit)
Definition: context.c:2717
void context_bind_dummy_textures(const struct wined3d_device *device, const struct wined3d_context *context)
Definition: context.c:1764
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GL_TRUE
Definition: gl.h:174
#define GL_TEXTURE_CUBE_MAP
Definition: gl.h:1788
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
Definition: gl.h:1795
#define GL_RGBA8
Definition: gl.h:762
unsigned int GLuint
Definition: gl.h:159
#define GL_TEXTURE_3D
Definition: gl.h:1515
GLAPI void GLAPIENTRY glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
#define GL_RGBA
Definition: gl.h:503
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X
Definition: gl.h:1790
#define GL_UNSIGNED_INT_8_8_8_8
Definition: gl.h:1494
#define GL_TEXTURE_2D
Definition: gl.h:645
#define GL_TEXTURE_1D
Definition: gl.h:644
GLuint buffer
Definition: glext.h:5915
GLuint color
Definition: glext.h:6243
const GLuint * textures
Definition: glext.h:8098
#define GL_TEXTURE_BUFFER
Definition: glext.h:748
#define GL_TEXTURE_1D_ARRAY
Definition: glext.h:533
#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY
Definition: glext.h:1941
#define GL_TEXTURE_2D_MULTISAMPLE
Definition: glext.h:1939
#define GL_STATIC_DRAW
Definition: glext.h:350
#define GL_TEXTURE_RECTANGLE_ARB
Definition: glext.h:1614
#define GL_TEXTURE_CUBE_MAP_ARRAY
Definition: glext.h:920
#define GL_TEXTURE_2D_ARRAY
Definition: glext.h:535
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
Definition: http.c:7252
BOOL supported[WINED3D_GL_EXT_COUNT]
struct opengl_funcs gl_ops
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1325
@ ARB_TEXTURE_BUFFER_OBJECT
Definition: wined3d_gl.h:108
@ ARB_TEXTURE_CUBE_MAP
Definition: wined3d_gl.h:113
@ ARB_CLEAR_TEXTURE
Definition: wined3d_gl.h:48
@ EXT_TEXTURE3D
Definition: wined3d_gl.h:171
@ ARB_TEXTURE_MULTISAMPLE
Definition: wined3d_gl.h:122
@ ARB_TEXTURE_RECTANGLE
Definition: wined3d_gl.h:125
@ EXT_TEXTURE_ARRAY
Definition: wined3d_gl.h:172
@ ARB_TEXTURE_CUBE_MAP_ARRAY
Definition: wined3d_gl.h:114
#define GL_EXTCALL(f)
#define checkGLcall(A)

Referenced by wined3d_device_create_primary_opengl_context_cs().

◆ d3d_primitive_type_from_gl()

static enum wined3d_primitive_type d3d_primitive_type_from_gl ( GLenum  primitive_type)
static

Definition at line 102 of file device.c.

103{
104 switch (primitive_type)
105 {
106 case GL_POINTS:
108
109 case GL_LINES:
110 return WINED3D_PT_LINELIST;
111
112 case GL_LINE_STRIP:
114
115 case GL_TRIANGLES:
117
120
121 case GL_TRIANGLE_FAN:
123
126
129
132
135
136 case GL_PATCHES:
137 return WINED3D_PT_PATCH;
138
139 default:
140 FIXME("Unhandled primitive type %s.\n", debug_d3dprimitivetype(primitive_type));
141 case ~0u:
143 }
144}
#define FIXME(fmt,...)
Definition: precomp.h:53
const char * debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type)
Definition: utils.c:4346
#define GL_TRIANGLE_FAN
Definition: gl.h:196
#define GL_LINE_STRIP
Definition: gl.h:193
#define GL_LINES
Definition: gl.h:191
#define GL_TRIANGLES
Definition: gl.h:194
#define GL_POINTS
Definition: gl.h:190
#define GL_TRIANGLE_STRIP
Definition: gl.h:195
#define GL_TRIANGLE_STRIP_ADJACENCY_ARB
Definition: glext.h:1765
#define GL_LINE_STRIP_ADJACENCY_ARB
Definition: glext.h:1763
#define GL_LINES_ADJACENCY_ARB
Definition: glext.h:1762
#define GL_TRIANGLES_ADJACENCY_ARB
Definition: glext.h:1764
#define GL_PATCHES
Definition: glext.h:2090
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 * u
Definition: glfuncs.h:240
@ WINED3D_PT_LINESTRIP_ADJ
Definition: wined3d.h:79
@ WINED3D_PT_LINELIST
Definition: wined3d.h:73
@ WINED3D_PT_UNDEFINED
Definition: wined3d.h:71
@ WINED3D_PT_PATCH
Definition: wined3d.h:82
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:72
@ WINED3D_PT_TRIANGLELIST_ADJ
Definition: wined3d.h:80
@ WINED3D_PT_LINELIST_ADJ
Definition: wined3d.h:78
@ WINED3D_PT_TRIANGLESTRIP_ADJ
Definition: wined3d.h:81
@ WINED3D_PT_TRIANGLESTRIP
Definition: wined3d.h:76
@ WINED3D_PT_LINESTRIP
Definition: wined3d.h:74
@ WINED3D_PT_TRIANGLELIST
Definition: wined3d.h:75
@ WINED3D_PT_TRIANGLEFAN
Definition: wined3d.h:77

Referenced by wined3d_device_get_primitive_type().

◆ destroy_default_samplers()

static void destroy_default_samplers ( struct wined3d_device device,
struct wined3d_context context 
)
static

Definition at line 828 of file device.c.

829{
830 wined3d_sampler_decref(device->default_sampler);
831 device->default_sampler = NULL;
832 wined3d_sampler_decref(device->null_sampler);
833 device->null_sampler = NULL;
834}
ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler)
Definition: sampler.c:53

Referenced by wined3d_device_delete_opengl_contexts_cs().

◆ destroy_dummy_textures()

static void destroy_dummy_textures ( struct wined3d_device device,
struct wined3d_context context 
)
static

Definition at line 739 of file device.c.

740{
741 struct wined3d_dummy_textures *dummy_textures = &device->dummy_textures;
742 const struct wined3d_gl_info *gl_info = context->gl_info;
743
745 {
746 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_2d_ms);
747 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_2d_ms_array);
748 }
749
751 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_buffer);
752
753 if (gl_info->supported[EXT_TEXTURE_ARRAY])
754 {
755 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_1d_array);
756 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_2d_array);
757 }
758
760 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_cube_array);
761
762 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
763 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_cube);
764
765 if (gl_info->supported[EXT_TEXTURE3D])
766 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_3d);
767
768 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
769 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_rect);
770
771 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_2d);
772 gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_1d);
773
774 checkGLcall("delete dummy textures");
775
776 memset(dummy_textures, 0, sizeof(*dummy_textures));
777}

Referenced by wined3d_device_delete_opengl_contexts_cs().

◆ device_clear_render_targets()

void device_clear_render_targets ( struct wined3d_device device,
UINT  rt_count,
const struct wined3d_fb_state fb,
UINT  rect_count,
const RECT clear_rect,
const RECT draw_rect,
DWORD  flags,
const struct wined3d_color color,
float  depth,
DWORD  stencil 
)

Definition at line 224 of file device.c.

227{
228 struct wined3d_rendertarget_view *rtv = rt_count ? fb->render_targets[0] : NULL;
231 struct wined3d_surface *depth_stencil = dsv ? wined3d_rendertarget_view_get_surface(dsv) : NULL;
232 const struct wined3d_state *state = &device->cs->state;
233 const struct wined3d_gl_info *gl_info;
234 UINT drawable_width, drawable_height;
235 struct wined3d_color corrected_color;
236 struct wined3d_context *context;
237 GLbitfield clear_mask = 0;
239 unsigned int i;
240
241 if (target)
243 else
245 if (!context->valid)
246 {
248 WARN("Invalid context, skipping clear.\n");
249 return;
250 }
251 gl_info = context->gl_info;
252
253 /* When we're clearing parts of the drawable, make sure that the target surface is well up to date in the
254 * drawable. After the clear we'll mark the drawable up to date, so we have to make sure that this is true
255 * for the cleared parts, and the untouched parts.
256 *
257 * If we're clearing the whole target there is no need to copy it into the drawable, it will be overwritten
258 * anyway. If we're not clearing the color buffer we don't have to copy either since we're not going to set
259 * the drawable up to date. We have to check all settings that limit the clear area though. Do not bother
260 * checking all this if the dest surface is in the drawable anyway. */
261 for (i = 0; i < rt_count; ++i)
262 {
263 struct wined3d_rendertarget_view *rtv = fb->render_targets[i];
264
265 if (rtv && rtv->format->id != WINED3DFMT_NULL)
266 {
268
270 draw_rect, rect_count ? clear_rect : NULL))
271 wined3d_texture_load_location(rt, rtv->sub_resource_idx, context, rtv->resource->draw_binding);
272 else
274 }
275 }
276
277 if (target)
278 {
279 render_offscreen = context->render_offscreen;
280 wined3d_rendertarget_view_get_drawable_size(rtv, context, &drawable_width, &drawable_height);
281 }
282 else
283 {
284 unsigned int ds_level = dsv->sub_resource_idx % depth_stencil->container->level_count;
285
286 render_offscreen = TRUE;
287 drawable_width = wined3d_texture_get_level_pow2_width(depth_stencil->container, ds_level);
288 drawable_height = wined3d_texture_get_level_pow2_height(depth_stencil->container, ds_level);
289 }
290
291 if (depth_stencil)
292 {
293 DWORD ds_location = render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE;
295
297 && !is_full_clear(ds, dsv->sub_resource_idx, draw_rect, rect_count ? clear_rect : NULL))
299 else
301
303 {
306 }
307 }
308
309 if (!context_apply_clear_state(context, state, rt_count, fb))
310 {
312 WARN("Failed to apply clear state, skipping clear.\n");
313 return;
314 }
315
316 /* Only set the values up once, as they are not changing. */
318 {
319 if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
320 {
321 gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
323 }
324 gl_info->gl_ops.gl.p_glStencilMask(~0U);
326 gl_info->gl_ops.gl.p_glClearStencil(stencil);
327 checkGLcall("glClearStencil");
328 clear_mask = clear_mask | GL_STENCIL_BUFFER_BIT;
329 }
330
332 {
333 gl_info->gl_ops.gl.p_glDepthMask(GL_TRUE);
335 gl_info->gl_ops.gl.p_glClearDepth(depth);
336 checkGLcall("glClearDepth");
337 clear_mask = clear_mask | GL_DEPTH_BUFFER_BIT;
338 }
339
341 {
342 for (i = 0; i < rt_count; ++i)
343 {
344 struct wined3d_rendertarget_view *rtv = fb->render_targets[i];
345 struct wined3d_texture *texture;
346
347 if (!rtv)
348 continue;
349
350 if (rtv->resource->type == WINED3D_RTYPE_BUFFER)
351 {
352 FIXME("Not supported on buffer resources.\n");
353 continue;
354 }
355
359 }
360
362 {
363 if (rt_count > 1)
364 WARN("Clearing multiple sRGB render targets with no GL_ARB_framebuffer_sRGB "
365 "support, this might cause graphical issues.\n");
366
367 corrected_color.r = color->r < wined3d_srgb_const1[0]
368 ? color->r * wined3d_srgb_const0[3]
371 corrected_color.r = min(max(corrected_color.r, 0.0f), 1.0f);
372 corrected_color.g = color->g < wined3d_srgb_const1[0]
373 ? color->g * wined3d_srgb_const0[3]
376 corrected_color.g = min(max(corrected_color.g, 0.0f), 1.0f);
377 corrected_color.b = color->b < wined3d_srgb_const1[0]
378 ? color->b * wined3d_srgb_const0[3]
381 corrected_color.b = min(max(corrected_color.b, 0.0f), 1.0f);
382 color = &corrected_color;
383 }
384
385 gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
386 for (i = 0; i < MAX_RENDER_TARGETS; ++i)
388 gl_info->gl_ops.gl.p_glClearColor(color->r, color->g, color->b, color->a);
389 checkGLcall("glClearColor");
390 clear_mask = clear_mask | GL_COLOR_BUFFER_BIT;
391 }
392
393 if (!rect_count)
394 {
395 if (render_offscreen)
396 {
397 gl_info->gl_ops.gl.p_glScissor(draw_rect->left, draw_rect->top,
398 draw_rect->right - draw_rect->left, draw_rect->bottom - draw_rect->top);
399 }
400 else
401 {
402 gl_info->gl_ops.gl.p_glScissor(draw_rect->left, drawable_height - draw_rect->bottom,
403 draw_rect->right - draw_rect->left, draw_rect->bottom - draw_rect->top);
404 }
405 checkGLcall("glScissor");
406 gl_info->gl_ops.gl.p_glClear(clear_mask);
407 checkGLcall("glClear");
408 }
409 else
410 {
411 RECT current_rect;
412
413 /* Now process each rect in turn. */
414 for (i = 0; i < rect_count; ++i)
415 {
416 /* Note that GL uses lower left, width/height. */
417 IntersectRect(&current_rect, draw_rect, &clear_rect[i]);
418
419 TRACE("clear_rect[%u] %s, current_rect %s.\n", i,
420 wine_dbgstr_rect(&clear_rect[i]),
421 wine_dbgstr_rect(&current_rect));
422
423 /* Tests show that rectangles where x1 > x2 or y1 > y2 are ignored silently.
424 * The rectangle is not cleared, no error is returned, but further rectangles are
425 * still cleared if they are valid. */
426 if (current_rect.left > current_rect.right || current_rect.top > current_rect.bottom)
427 {
428 TRACE("Rectangle with negative dimensions, ignoring.\n");
429 continue;
430 }
431
432 if (render_offscreen)
433 {
434 gl_info->gl_ops.gl.p_glScissor(current_rect.left, current_rect.top,
435 current_rect.right - current_rect.left, current_rect.bottom - current_rect.top);
436 }
437 else
438 {
439 gl_info->gl_ops.gl.p_glScissor(current_rect.left, drawable_height - current_rect.bottom,
440 current_rect.right - current_rect.left, current_rect.bottom - current_rect.top);
441 }
442 checkGLcall("glScissor");
443
444 gl_info->gl_ops.gl.p_glClear(clear_mask);
445 checkGLcall("glClear");
446 }
447 }
448
450 && target->container->swapchain && target->container->swapchain->front_buffer == target->container))
451 gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
452
454}
static int state
Definition: maze.c:121
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define U(x)
Definition: wordpad.c:45
struct wined3d_context * context_acquire(const struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: context.c:4242
BOOL context_apply_clear_state(struct wined3d_context *context, const struct wined3d_state *state, UINT rt_count, const struct wined3d_fb_state *fb)
Definition: context.c:3047
void context_invalidate_state(struct wined3d_context *context, DWORD state)
Definition: context.c:1652
void context_release(struct wined3d_context *context)
Definition: context.c:1571
static BOOL is_full_clear(const struct wined3d_texture *texture, unsigned int sub_resource_idx, const RECT *draw_rect, const RECT *clear_rect)
Definition: device.c:203
const float wined3d_srgb_const0[]
Definition: shader.c:36
const float wined3d_srgb_const1[]
Definition: shader.c:38
BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
Definition: texture.c:229
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:159
struct wined3d_texture *__cdecl wined3d_texture_from_resource(struct wined3d_resource *resource)
Definition: texture.c:2210
BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
Definition: texture.c:1605
void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:135
void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarget_view *view, const struct wined3d_context *context, unsigned int *width, unsigned int *height)
Definition: view.c:404
unsigned int BOOL
Definition: ntddk_ex.h:94
double pow(double x, double y)
Definition: freeldr.c:110
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
#define GL_STENCIL_BUFFER_BIT
Definition: gl.h:712
unsigned int GLbitfield
Definition: gl.h:152
#define GL_DEPTH_BUFFER_BIT
Definition: gl.h:710
GLenum GLuint texture
Definition: glext.h:6295
#define GL_STENCIL_TEST_TWO_SIDE_EXT
Definition: glext.h:4210
GLbitfield flags
Definition: glext.h:7161
GLint GLfloat GLint stencil
Definition: glext.h:6260
GLenum target
Definition: glext.h:7315
#define ds
Definition: i386-dis.c:443
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
const struct wined3d_gl_info * gl_info
struct wined3d_rendertarget_view * depth_stencil
struct wined3d_rendertarget_view * render_targets[MAX_RENDER_TARGET_VIEWS]
struct wined3d_resource * resource
const struct wined3d_format * format
struct wined3d_texture * container
#define max(a, b)
Definition: svc.c:63
#define WINED3DCLEAR_TARGET
Definition: wined3d.h:997
@ WINED3D_RS_ZWRITEENABLE
Definition: wined3d.h:276
@ WINED3D_RS_TWOSIDEDSTENCILMODE
Definition: wined3d.h:368
@ WINED3D_RS_STENCILWRITEMASK
Definition: wined3d.h:313
@ WINED3D_RTYPE_BUFFER
Definition: wined3d.h:698
@ WINED3DFMT_NULL
Definition: wined3d.h:255
#define WINED3DCLEAR_STENCIL
Definition: wined3d.h:999
#define WINED3DCLEAR_ZBUFFER
Definition: wined3d.h:998
static enum wined3d_render_state WINED3D_RS_COLORWRITE(int index)
Definition: wined3d.h:400
@ EXT_STENCIL_TWO_SIDE
Definition: wined3d_gl.h:169
@ ARB_FRAMEBUFFER_SRGB
Definition: wined3d_gl.h:74
static unsigned int wined3d_texture_get_level_pow2_height(const struct wined3d_texture *texture, unsigned int level)
static struct wined3d_surface * wined3d_rendertarget_view_get_surface(const struct wined3d_rendertarget_view *view)
static unsigned int wined3d_texture_get_level_pow2_width(const struct wined3d_texture *texture, unsigned int level)
#define MAX_RENDER_TARGETS
static BOOL needs_srgb_write(const struct wined3d_context *context, const struct wined3d_state *state, const struct wined3d_fb_state *fb)
#define WINED3D_LOCATION_DRAWABLE
#define STATE_RENDER(a)
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)

Referenced by ffp_blitter_clear().

◆ device_context_add()

BOOL device_context_add ( struct wined3d_device device,
struct wined3d_context context 
)

Definition at line 146 of file device.c.

147{
148 struct wined3d_context **new_array;
149
150 TRACE("Adding context %p.\n", context);
151
152 if (!(new_array = heap_realloc(device->contexts, sizeof(*new_array) * (device->context_count + 1))))
153 {
154 ERR("Failed to grow the context array.\n");
155 return FALSE;
156 }
157
158 new_array[device->context_count++] = context;
159 device->contexts = new_array;
160 return TRUE;
161}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71

Referenced by context_create().

◆ device_context_remove()

void device_context_remove ( struct wined3d_device device,
struct wined3d_context context 
)

Definition at line 163 of file device.c.

164{
165 struct wined3d_context **new_array;
166 BOOL found = FALSE;
167 UINT i;
168
169 TRACE("Removing context %p.\n", context);
170
171 for (i = 0; i < device->context_count; ++i)
172 {
173 if (device->contexts[i] == context)
174 {
175 found = TRUE;
176 break;
177 }
178 }
179
180 if (!found)
181 {
182 ERR("Context %p doesn't exist in context array.\n", context);
183 return;
184 }
185
186 if (!--device->context_count)
187 {
188 heap_free(device->contexts);
189 device->contexts = NULL;
190 return;
191 }
192
193 memmove(&device->contexts[i], &device->contexts[i + 1], (device->context_count - i) * sizeof(*device->contexts));
194 if (!(new_array = heap_realloc(device->contexts, device->context_count * sizeof(*device->contexts))))
195 {
196 ERR("Failed to shrink context array. Oh well.\n");
197 return;
198 }
199
200 device->contexts = new_array;
201}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define memmove(s1, s2, n)
Definition: mkisofs.h:881

Referenced by context_create(), and context_destroy().

◆ device_free_sampler()

static void device_free_sampler ( struct wine_rb_entry entry,
void context 
)
static

Definition at line 1188 of file device.c.

1189{
1191
1193}
GLuint sampler
Definition: glext.h:7283
uint32_t entry
Definition: isohybrid.c:63
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31

Referenced by wined3d_device_reset(), and wined3d_device_uninit_3d().

◆ device_init()

HRESULT device_init ( struct wined3d_device device,
struct wined3d wined3d,
UINT  adapter_idx,
enum wined3d_device_type  device_type,
HWND  focus_window,
DWORD  flags,
BYTE  surface_alignment,
struct wined3d_device_parent device_parent 
)

Definition at line 5195 of file device.c.

5198{
5199 struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx];
5201 const struct wined3d_vertex_pipe_ops *vertex_pipeline;
5202 unsigned int i;
5203 HRESULT hr;
5204
5205 device->ref = 1;
5206 device->wined3d = wined3d;
5207 wined3d_incref(device->wined3d);
5208 device->adapter = wined3d->adapter_count ? adapter : NULL;
5209 device->device_parent = device_parent;
5210 list_init(&device->resources);
5211 list_init(&device->shaders);
5212 device->surface_alignment = surface_alignment;
5213
5214 /* Save the creation parameters. */
5215 device->create_parms.adapter_idx = adapter_idx;
5216 device->create_parms.device_type = device_type;
5217 device->create_parms.focus_window = focus_window;
5218 device->create_parms.flags = flags;
5219
5220 device->shader_backend = adapter->shader_backend;
5221
5222 vertex_pipeline = adapter->vertex_pipe;
5223
5224 fragment_pipeline = adapter->fragment_pipe;
5225
5227
5228 if (vertex_pipeline->vp_states && fragment_pipeline->states
5229 && FAILED(hr = compile_state_table(device->StateTable, device->multistate_funcs,
5230 &adapter->gl_info, &adapter->d3d_info, vertex_pipeline,
5232 {
5233 ERR("Failed to compile state table, hr %#x.\n", hr);
5234 wine_rb_destroy(&device->samplers, NULL, NULL);
5235 wined3d_decref(device->wined3d);
5236 return hr;
5237 }
5238
5239 state_init(&device->state, &device->fb, &adapter->gl_info,
5241 device->update_state = &device->state;
5242
5243 if (!(device->cs = wined3d_cs_create(device)))
5244 {
5245 WARN("Failed to create command stream.\n");
5246 state_cleanup(&device->state);
5247 hr = E_FAIL;
5248 goto err;
5249 }
5250
5251 return WINED3D_OK;
5252
5253err:
5254 for (i = 0; i < ARRAY_SIZE(device->multistate_funcs); ++i)
5255 {
5256 heap_free(device->multistate_funcs[i]);
5257 }
5258 wine_rb_destroy(&device->samplers, NULL, NULL);
5259 wined3d_decref(device->wined3d);
5260 return hr;
5261}
static void list_init(struct list_entry *head)
Definition: list.h:51
struct wined3d_cs * wined3d_cs_create(struct wined3d_device *device)
Definition: cs.c:2828
#define E_FAIL
Definition: ddrawi.h:102
device_type
void state_init(void *ipp)
Definition: dhclient.c:210
static int wined3d_sampler_compare(const void *key, const struct wine_rb_entry *entry)
Definition: device.c:5188
const struct StateEntryTemplate misc_state_template[]
Definition: state.c:5100
HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment, const struct StateEntryTemplate *misc)
Definition: state.c:6142
return adapter
#define err(...)
static void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
Definition: rbtree.h:198
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
Definition: rbtree.h:179
const struct StateEntryTemplate * states
const struct StateEntryTemplate * vp_states
UINT adapter_count
struct wined3d_adapter adapters[1]
ULONG CDECL wined3d_decref(struct wined3d *wined3d)
Definition: directx.c:465
ULONG CDECL wined3d_incref(struct wined3d *wined3d)
Definition: directx.c:456
void state_cleanup(struct wined3d_state *state)
Definition: stateblock.c:528
#define WINED3D_OK
Definition: wined3d.h:37
#define WINED3D_STATE_INIT_DEFAULT

◆ device_init_swapchain_state()

static void device_init_swapchain_state ( struct wined3d_device device,
struct wined3d_swapchain swapchain 
)
static

Definition at line 962 of file device.c.

963{
964 BOOL ds_enable = swapchain->desc.enable_auto_depth_stencil;
965 unsigned int i;
966
967 for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
968 {
970 }
971 if (device->back_buffer_view)
973
974 wined3d_device_set_depth_stencil_view(device, ds_enable ? device->auto_depth_stencil_view : NULL);
975}
HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device, unsigned int view_idx, struct wined3d_rendertarget_view *view, BOOL set_viewport)
Definition: device.c:4468
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
Definition: device.c:4524
struct wined3d_swapchain_desc desc

Referenced by wined3d_device_init_3d(), and wined3d_device_reset().

◆ device_invalidate_state()

void device_invalidate_state ( const struct wined3d_device device,
DWORD  state 
)

Definition at line 5263 of file device.c.

5264{
5265 DWORD rep = device->StateTable[state].representative;
5266 struct wined3d_context *context;
5267 DWORD idx;
5268 BYTE shift;
5269 UINT i;
5270
5272
5274 {
5275 for (i = 0; i < device->context_count; ++i)
5277 return;
5278 }
5279
5280 for (i = 0; i < device->context_count; ++i)
5281 {
5282 context = device->contexts[i];
5283 if(isStateDirty(context, rep)) continue;
5284
5285 context->dirtyArray[context->numDirtyEntries++] = rep;
5286 idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT);
5287 shift = rep & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1);
5288 context->isStateDirty[idx] |= (1u << shift);
5289 }
5290}
void context_invalidate_compute_state(struct wined3d_context *context, DWORD state_id)
Definition: context.c:1642
unsigned int idx
Definition: utils.c:41
#define CHAR_BIT
Definition: urlcache.c:62
#define shift
Definition: input.c:1755
#define STATE_IS_COMPUTE(a)
static void wined3d_from_cs(const struct wined3d_cs *cs)
static BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by buffer_destroy_buffer_object(), surface_load_fb_texture(), wined3d_cs_exec_draw(), wined3d_cs_exec_set_blend_state(), wined3d_cs_exec_set_clip_plane(), wined3d_cs_exec_set_color_key(), wined3d_cs_exec_set_constant_buffer(), wined3d_cs_exec_set_depth_stencil_view(), wined3d_cs_exec_set_index_buffer(), wined3d_cs_exec_set_light(), wined3d_cs_exec_set_light_enable(), wined3d_cs_exec_set_material(), wined3d_cs_exec_set_rasterizer_state(), wined3d_cs_exec_set_render_state(), wined3d_cs_exec_set_rendertarget_view(), wined3d_cs_exec_set_sampler(), wined3d_cs_exec_set_sampler_state(), wined3d_cs_exec_set_scissor_rect(), wined3d_cs_exec_set_shader(), wined3d_cs_exec_set_shader_resource_view(), wined3d_cs_exec_set_stream_output(), wined3d_cs_exec_set_stream_source(), wined3d_cs_exec_set_stream_source_freq(), wined3d_cs_exec_set_texture(), wined3d_cs_exec_set_texture_state(), wined3d_cs_exec_set_transform(), wined3d_cs_exec_set_unordered_access_view(), wined3d_cs_exec_set_vertex_declaration(), wined3d_cs_exec_set_viewport(), and wined3d_swapchain_rotate().

◆ device_leftover_sampler()

static void device_leftover_sampler ( struct wine_rb_entry entry,
void context 
)
static

Definition at line 465 of file device.c.

466{
468
469 ERR("Leftover sampler %p.\n", sampler);
470}

Referenced by wined3d_device_decref().

◆ device_load_logo()

static void device_load_logo ( struct wined3d_device device,
const char filename 
)
static

Definition at line 547 of file device.c.

548{
551 HBITMAP hbm;
552 BITMAP bm;
553 HRESULT hr;
554 HDC dcb = NULL, dcs = NULL;
555
557 {
558 ERR_(winediag)("Failed to load logo %s.\n", wine_dbgstr_a(filename));
559 return;
560 }
561 GetObjectA(hbm, sizeof(BITMAP), &bm);
562
563 if (!(dcb = CreateCompatibleDC(NULL)))
564 goto out;
565 SelectObject(dcb, hbm);
566
567 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
569 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
570 desc.multisample_quality = 0;
573 desc.width = bm.bmWidth;
574 desc.height = bm.bmHeight;
575 desc.depth = 1;
576 desc.size = 0;
579 NULL, NULL, &wined3d_null_parent_ops, &device->logo_texture)))
580 {
581 ERR("Wine logo requested, but failed to create texture, hr %#x.\n", hr);
582 goto out;
583 }
584
585 if (FAILED(hr = wined3d_texture_get_dc(device->logo_texture, 0, &dcs)))
586 {
587 wined3d_texture_decref(device->logo_texture);
588 device->logo_texture = NULL;
589 goto out;
590 }
591 BitBlt(dcs, 0, 0, bm.bmWidth, bm.bmHeight, dcb, 0, 0, SRCCOPY);
592 wined3d_texture_release_dc(device->logo_texture, 0, dcs);
593
594 color_key.color_space_low_value = 0;
595 color_key.color_space_high_value = 0;
597
598out:
599 if (dcb) DeleteDC(dcb);
600 if (hbm) DeleteObject(hbm);
601}
HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc)
Definition: texture.c:3623
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
Definition: texture.c:3511
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1023
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
Definition: texture.c:3671
HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture, DWORD flags, const struct wined3d_color_key *color_key)
Definition: texture.c:1235
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
pKey DeleteObject()
const char * filename
Definition: ioapi.h:137
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
static FILE * out
Definition: regtests2xml.c:44
#define ERR_(ch,...)
Definition: debug.h:156
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:187
Definition: bl.h:1331
@ WINED3D_MULTISAMPLE_NONE
Definition: wined3d.h:554
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
#define WINED3D_CKEY_SRC_BLT
Definition: wined3d.h:1336
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:221
#define WINED3D_TEXTURE_CREATE_MAPPABLE
Definition: wined3d.h:1558
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:907
#define WINED3D_TEXTURE_CREATE_GET_DC
Definition: wined3d.h:1561
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
BOOL WINAPI DeleteDC(_In_ HDC)
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_LOADFROMFILE
Definition: winuser.h:1095
#define LR_CREATEDIBSECTION
Definition: winuser.h:1101
HANDLE WINAPI LoadImageA(_In_opt_ HINSTANCE hInst, _In_ LPCSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2230

Referenced by wined3d_device_init_3d(), and wined3d_device_reset().

◆ device_process_message()

LRESULT device_process_message ( struct wined3d_device device,
HWND  window,
BOOL  unicode,
UINT  message,
WPARAM  wparam,
LPARAM  lparam,
WNDPROC  proc 
)

Definition at line 5292 of file device.c.

5294{
5295 if (device->filter_messages && message != WM_DISPLAYCHANGE)
5296 {
5297 TRACE("Filtering message: window %p, message %#x, wparam %#lx, lparam %#lx.\n",
5299 if (unicode)
5301 else
5303 }
5304
5305 if (message == WM_DESTROY)
5306 {
5307 TRACE("unregister window %p.\n", window);
5309
5310 if (InterlockedCompareExchangePointer((void **)&device->focus_window, NULL, window) != window)
5311 ERR("Window %p is not the focus window for device %p.\n", window, device);
5312 }
5313 else if (message == WM_DISPLAYCHANGE)
5314 {
5315 device->device_parent->ops->mode_changed(device->device_parent);
5316 }
5317 else if (message == WM_ACTIVATEAPP)
5318 {
5319 UINT i;
5320
5321 for (i = 0; i < device->swapchain_count; i++)
5323
5324 device->device_parent->ops->activate(device->device_parent, wparam);
5325 }
5326 else if (message == WM_SYSCOMMAND)
5327 {
5328 if (wparam == SC_RESTORE && device->wined3d->flags & WINED3D_HANDLE_RESTORE)
5329 {
5330 if (unicode)
5332 else
5334 }
5335 }
5336
5337 if (unicode)
5339 else
5341}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
static IHTMLWindow2 * window
Definition: events.c:77
static HANDLE proc()
Definition: pdb.c:34
Definition: tftpd.h:60
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate)
Definition: swapchain.c:1149
#define WINED3D_HANDLE_RESTORE
Definition: wined3d.h:1321
void wined3d_unregister_window(HWND window)
Definition: wined3d_main.c:470
#define WM_SYSCOMMAND
Definition: winuser.h:1744
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_ACTIVATEAPP
Definition: winuser.h:1635
#define WM_DESTROY
Definition: winuser.h:1612
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SC_RESTORE
Definition: winuser.h:2601
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by wined3d_wndproc().

◆ device_resource_add()

void device_resource_add ( struct wined3d_device device,
struct wined3d_resource resource 
)

Definition at line 5081 of file device.c.

5082{
5083 TRACE("device %p, resource %p.\n", device, resource);
5084
5086
5087 list_add_head(&device->resources, &resource->resource_list_entry);
5088}
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
static void wined3d_not_from_cs(struct wined3d_cs *cs)

Referenced by resource_init().

◆ device_resource_released()

void device_resource_released ( struct wined3d_device device,
struct wined3d_resource resource 
)

Definition at line 5099 of file device.c.

5100{
5101 enum wined3d_resource_type type = resource->type;
5102 struct wined3d_rendertarget_view *rtv;
5103 unsigned int i;
5104
5105 TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type));
5106
5107 if (device->d3d_initialized)
5108 {
5109 for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
5110 {
5111 if ((rtv = device->fb.render_targets[i]) && rtv->resource == resource)
5112 ERR("Resource %p is still in use as render target %u.\n", resource, i);
5113 }
5114
5115 if ((rtv = device->fb.depth_stencil) && rtv->resource == resource)
5116 ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
5117 }
5118
5119 switch (type)
5120 {
5124 for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
5125 {
5127
5128 if (device->state.textures[i] == texture)
5129 {
5130 ERR("Texture %p is still in use, stage %u.\n", texture, i);
5131 device->state.textures[i] = NULL;
5132 }
5133
5134 if (device->recording && device->update_state->textures[i] == texture)
5135 {
5136 ERR("Texture %p is still in use by recording stateblock %p, stage %u.\n",
5137 texture, device->recording, i);
5138 device->update_state->textures[i] = NULL;
5139 }
5140 }
5141 break;
5142
5144 {
5146
5147 for (i = 0; i < MAX_STREAMS; ++i)
5148 {
5149 if (device->state.streams[i].buffer == buffer)
5150 {
5151 ERR("Buffer %p is still in use, stream %u.\n", buffer, i);
5152 device->state.streams[i].buffer = NULL;
5153 }
5154
5155 if (device->recording && device->update_state->streams[i].buffer == buffer)
5156 {
5157 ERR("Buffer %p is still in use by stateblock %p, stream %u.\n",
5158 buffer, device->recording, i);
5159 device->update_state->streams[i].buffer = NULL;
5160 }
5161 }
5162
5163 if (device->state.index_buffer == buffer)
5164 {
5165 ERR("Buffer %p is still in use as index buffer.\n", buffer);
5166 device->state.index_buffer = NULL;
5167 }
5168
5169 if (device->recording && device->update_state->index_buffer == buffer)
5170 {
5171 ERR("Buffer %p is still in use by stateblock %p as index buffer.\n",
5172 buffer, device->recording);
5173 device->update_state->index_buffer = NULL;
5174 }
5175 }
5176 break;
5177
5178 default:
5179 break;
5180 }
5181
5182 /* Remove the resource from the resourceStore */
5184
5185 TRACE("Resource released.\n");
5186}
static void device_resource_remove(struct wined3d_device *device, struct wined3d_resource *resource)
Definition: device.c:5090
const char * debug_d3dresourcetype(enum wined3d_resource_type resource_type)
Definition: utils.c:4329
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
wined3d_resource_type
Definition: wined3d.h:696
@ WINED3D_RTYPE_TEXTURE_1D
Definition: wined3d.h:699
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:701
#define MAX_STREAMS
#define MAX_COMBINED_SAMPLERS
static struct wined3d_buffer * buffer_from_resource(struct wined3d_resource *resource)

Referenced by resource_cleanup().

◆ device_resource_remove()

static void device_resource_remove ( struct wined3d_device device,
struct wined3d_resource resource 
)
static

Definition at line 5090 of file device.c.

5091{
5092 TRACE("device %p, resource %p.\n", device, resource);
5093
5095
5096 list_remove(&resource->resource_list_entry);
5097}
static void list_remove(struct list_entry *entry)
Definition: list.h:90

Referenced by device_resource_released().

◆ fullscreen_exstyle()

static LONG fullscreen_exstyle ( LONG  exstyle)
static

Definition at line 845 of file device.c.

846{
847 /* Filter out window decorations. */
848 exstyle &= ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE);
849
850 return exstyle;
851}
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384

Referenced by wined3d_device_restore_fullscreen_window(), and wined3d_device_setup_fullscreen_window().

◆ fullscreen_style()

static LONG fullscreen_style ( LONG  style)
static

Definition at line 836 of file device.c.

837{
838 /* Make sure the window is managed, otherwise we won't get keyboard input. */
841
842 return style;
843}
Arabic default style
Definition: afstyles.h:94
#define WS_CAPTION
Definition: pedump.c:624
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_POPUP
Definition: pedump.c:616
#define WS_THICKFRAME
Definition: pedump.c:630

Referenced by wined3d_device_restore_fullscreen_window(), and wined3d_device_setup_fullscreen_window().

◆ gl_primitive_type_from_d3d()

GLenum gl_primitive_type_from_d3d ( enum wined3d_primitive_type  primitive_type)

Definition at line 58 of file device.c.

59{
60 switch (primitive_type)
61 {
63 return GL_POINTS;
64
66 return GL_LINES;
67
69 return GL_LINE_STRIP;
70
72 return GL_TRIANGLES;
73
75 return GL_TRIANGLE_STRIP;
76
78 return GL_TRIANGLE_FAN;
79
82
85
88
91
93 return GL_PATCHES;
94
95 default:
96 FIXME("Unhandled primitive type %s.\n", debug_d3dprimitivetype(primitive_type));
98 return ~0u;
99 }
100}

Referenced by gl_tfb_primitive_type_from_d3d(), and wined3d_device_set_primitive_type().

◆ is_full_clear()

static BOOL is_full_clear ( const struct wined3d_texture texture,
unsigned int  sub_resource_idx,
const RECT draw_rect,
const RECT clear_rect 
)
static

Definition at line 203 of file device.c.

205{
206 unsigned int width, height, level;
207
208 level = sub_resource_idx % texture->level_count;
211
212 /* partial draw rect */
213 if (draw_rect->left || draw_rect->top || draw_rect->right < width || draw_rect->bottom < height)
214 return FALSE;
215
216 /* partial clear rect */
217 if (clear_rect && (clear_rect->left > 0 || clear_rect->top > 0
218 || clear_rect->right < width || clear_rect->bottom < height))
219 return FALSE;
220
221 return TRUE;
222}
GLint level
Definition: gl.h:1546
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)

Referenced by device_clear_render_targets().

◆ process_vertices_strided()

static HRESULT process_vertices_strided ( const struct wined3d_device device,
DWORD  dwDestIndex,
DWORD  dwCount,
const struct wined3d_stream_info stream_info,
struct wined3d_buffer dest,
DWORD  flags,
DWORD  DestFVF 
)
static

Definition at line 3070 of file device.c.

3073{
3074 struct wined3d_matrix mat, proj_mat, view_mat, world_mat;
3075 struct wined3d_map_desc map_desc;
3076 struct wined3d_box box = {0};
3077 struct wined3d_viewport vp;
3078 UINT vertex_size;
3079 unsigned int i;
3080 BYTE *dest_ptr;
3081 BOOL doClip;
3082 DWORD numTextures;
3083 HRESULT hr;
3084
3085 if (stream_info->use_map & (1u << WINED3D_FFP_NORMAL))
3086 {
3087 WARN(" lighting state not saved yet... Some strange stuff may happen !\n");
3088 }
3089
3090 if (!(stream_info->use_map & (1u << WINED3D_FFP_POSITION)))
3091 {
3092 ERR("Source has no position mask\n");
3094 }
3095
3096 if (device->state.render_states[WINED3D_RS_CLIPPING])
3097 {
3098 static BOOL warned = FALSE;
3099 /*
3100 * The clipping code is not quite correct. Some things need
3101 * to be checked against IDirect3DDevice3 (!), d3d8 and d3d9,
3102 * so disable clipping for now.
3103 * (The graphics in Half-Life are broken, and my processvertices
3104 * test crashes with IDirect3DDevice3)
3105 doClip = TRUE;
3106 */
3107 doClip = FALSE;
3108 if(!warned) {
3109 warned = TRUE;
3110 FIXME("Clipping is broken and disabled for now\n");
3111 }
3112 }
3113 else
3114 doClip = FALSE;
3115
3116 vertex_size = get_flexible_vertex_size(DestFVF);
3117 box.left = dwDestIndex * vertex_size;
3118 box.right = box.left + dwCount * vertex_size;
3119 if (FAILED(hr = wined3d_resource_map(&dest->resource, 0, &map_desc, &box, WINED3D_MAP_WRITE)))
3120 {
3121 WARN("Failed to map buffer, hr %#x.\n", hr);
3122 return hr;
3123 }
3124 dest_ptr = map_desc.data;
3125
3129
3130 TRACE("View mat:\n");
3131 TRACE("%.8e %.8e %.8e %.8e\n", view_mat._11, view_mat._12, view_mat._13, view_mat._14);
3132 TRACE("%.8e %.8e %.8e %.8e\n", view_mat._21, view_mat._22, view_mat._23, view_mat._24);
3133 TRACE("%.8e %.8e %.8e %.8e\n", view_mat._31, view_mat._32, view_mat._33, view_mat._34);
3134 TRACE("%.8e %.8e %.8e %.8e\n", view_mat._41, view_mat._42, view_mat._43, view_mat._44);
3135
3136 TRACE("Proj mat:\n");
3137 TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._11, proj_mat._12, proj_mat._13, proj_mat._14);
3138 TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._21, proj_mat._22, proj_mat._23, proj_mat._24);
3139 TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._31, proj_mat._32, proj_mat._33, proj_mat._34);
3140 TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._41, proj_mat._42, proj_mat._43, proj_mat._44);
3141
3142 TRACE("World mat:\n");
3143 TRACE("%.8e %.8e %.8e %.8e\n", world_mat._11, world_mat._12, world_mat._13, world_mat._14);
3144 TRACE("%.8e %.8e %.8e %.8e\n", world_mat._21, world_mat._22, world_mat._23, world_mat._24);
3145 TRACE("%.8e %.8e %.8e %.8e\n", world_mat._31, world_mat._32, world_mat._33, world_mat._34);
3146 TRACE("%.8e %.8e %.8e %.8e\n", world_mat._41, world_mat._42, world_mat._43, world_mat._44);
3147
3148 /* Get the viewport */
3150 TRACE("viewport x %.8e, y %.8e, width %.8e, height %.8e, min_z %.8e, max_z %.8e.\n",
3151 vp.x, vp.y, vp.width, vp.height, vp.min_z, vp.max_z);
3152
3153 multiply_matrix(&mat,&view_mat,&world_mat);
3154 multiply_matrix(&mat,&proj_mat,&mat);
3155
3156 numTextures = (DestFVF & WINED3DFVF_TEXCOUNT_MASK) >> WINED3DFVF_TEXCOUNT_SHIFT;
3157
3158 for (i = 0; i < dwCount; i+= 1) {
3159 unsigned int tex_index;
3160
3161 if ( ((DestFVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZ ) ||
3162 ((DestFVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZRHW ) ) {
3163 /* The position first */
3165 const float *p = (const float *)(element->data.addr + i * element->stride);
3166 float x, y, z, rhw;
3167 TRACE("In: ( %06.2f %06.2f %06.2f )\n", p[0], p[1], p[2]);
3168
3169 /* Multiplication with world, view and projection matrix. */
3170 x = (p[0] * mat._11) + (p[1] * mat._21) + (p[2] * mat._31) + mat._41;
3171 y = (p[0] * mat._12) + (p[1] * mat._22) + (p[2] * mat._32) + mat._42;
3172 z = (p[0] * mat._13) + (p[1] * mat._23) + (p[2] * mat._33) + mat._43;
3173 rhw = (p[0] * mat._14) + (p[1] * mat._24) + (p[2] * mat._34) + mat._44;
3174
3175 TRACE("x=%f y=%f z=%f rhw=%f\n", x, y, z, rhw);
3176
3177 /* WARNING: The following things are taken from d3d7 and were not yet checked
3178 * against d3d8 or d3d9!
3179 */
3180
3181 /* Clipping conditions: From msdn
3182 *
3183 * A vertex is clipped if it does not match the following requirements
3184 * -rhw < x <= rhw
3185 * -rhw < y <= rhw
3186 * 0 < z <= rhw
3187 * 0 < rhw ( Not in d3d7, but tested in d3d7)
3188 *
3189 * If clipping is on is determined by the D3DVOP_CLIP flag in D3D7, and
3190 * by the D3DRS_CLIPPING in D3D9(according to the msdn, not checked)
3191 *
3192 */
3193
3194 if( !doClip ||
3195 ( (-rhw -eps < x) && (-rhw -eps < y) && ( -eps < z) &&
3196 (x <= rhw + eps) && (y <= rhw + eps ) && (z <= rhw + eps) &&
3197 ( rhw > eps ) ) ) {
3198
3199 /* "Normal" viewport transformation (not clipped)
3200 * 1) The values are divided by rhw
3201 * 2) The y axis is negative, so multiply it with -1
3202 * 3) Screen coordinates go from -(Width/2) to +(Width/2) and
3203 * -(Height/2) to +(Height/2). The z range is MinZ to MaxZ
3204 * 4) Multiply x with Width/2 and add Width/2
3205 * 5) The same for the height
3206 * 6) Add the viewpoint X and Y to the 2D coordinates and
3207 * The minimum Z value to z
3208 * 7) rhw = 1 / rhw Reciprocal of Homogeneous W....
3209 *
3210 * Well, basically it's simply a linear transformation into viewport
3211 * coordinates
3212 */
3213
3214 x /= rhw;
3215 y /= rhw;
3216 z /= rhw;
3217
3218 y *= -1;
3219
3220 x *= vp.width / 2;
3221 y *= vp.height / 2;
3222 z *= vp.max_z - vp.min_z;
3223
3224 x += vp.width / 2 + vp.x;
3225 y += vp.height / 2 + vp.y;
3226 z += vp.min_z;
3227
3228 rhw = 1 / rhw;
3229 } else {
3230 /* That vertex got clipped
3231 * Contrary to OpenGL it is not dropped completely, it just
3232 * undergoes a different calculation.
3233 */
3234 TRACE("Vertex got clipped\n");
3235 x += rhw;
3236 y += rhw;
3237
3238 x /= 2;
3239 y /= 2;
3240
3241 /* Msdn mentions that Direct3D9 keeps a list of clipped vertices
3242 * outside of the main vertex buffer memory. That needs some more
3243 * investigation...
3244 */
3245 }
3246
3247 TRACE("Writing (%f %f %f) %f\n", x, y, z, rhw);
3248
3249
3250 ( (float *) dest_ptr)[0] = x;
3251 ( (float *) dest_ptr)[1] = y;
3252 ( (float *) dest_ptr)[2] = z;
3253 ( (float *) dest_ptr)[3] = rhw; /* SIC, see ddraw test! */
3254
3255 dest_ptr += 3 * sizeof(float);
3256
3258 dest_ptr += sizeof(float);
3259 }
3260
3261 if (DestFVF & WINED3DFVF_PSIZE)
3262 dest_ptr += sizeof(DWORD);
3263
3264 if (DestFVF & WINED3DFVF_NORMAL)
3265 {
3267 const float *normal = (const float *)(element->data.addr + i * element->stride);
3268 /* AFAIK this should go into the lighting information */
3269 FIXME("Didn't expect the destination to have a normal\n");
3270 copy_and_next(dest_ptr, normal, 3 * sizeof(float));
3271 }
3272
3273 if (DestFVF & WINED3DFVF_DIFFUSE)
3274 {
3276 const DWORD *color_d = (const DWORD *)(element->data.addr + i * element->stride);
3277 if (!(stream_info->use_map & (1u << WINED3D_FFP_DIFFUSE)))
3278 {
3279 static BOOL warned = FALSE;
3280
3281 if(!warned) {
3282 ERR("No diffuse color in source, but destination has one\n");
3283 warned = TRUE;
3284 }
3285
3286 *( (DWORD *) dest_ptr) = 0xffffffff;
3287 dest_ptr += sizeof(DWORD);
3288 }
3289 else
3290 {
3291 copy_and_next(dest_ptr, color_d, sizeof(DWORD));
3292 }
3293 }
3294
3295 if (DestFVF & WINED3DFVF_SPECULAR)
3296 {
3297 /* What's the color value in the feedback buffer? */
3299 const DWORD *color_s = (const DWORD *)(element->data.addr + i * element->stride);
3300 if (!(stream_info->use_map & (1u << WINED3D_FFP_SPECULAR)))
3301 {
3302 static BOOL warned = FALSE;
3303
3304 if(!warned) {
3305 ERR("No specular color in source, but destination has one\n");
3306 warned = TRUE;
3307 }
3308
3309 *(DWORD *)dest_ptr = 0xff000000;
3310 dest_ptr += sizeof(DWORD);
3311 }
3312 else
3313 {
3314 copy_and_next(dest_ptr, color_s, sizeof(DWORD));
3315 }
3316 }
3317
3318 for (tex_index = 0; tex_index < numTextures; ++tex_index)
3319 {
3320 const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_TEXCOORD0 + tex_index];
3321 const float *tex_coord = (const float *)(element->data.addr + i * element->stride);
3322 if (!(stream_info->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + tex_index))))
3323 {
3324 ERR("No source texture, but destination requests one\n");
3325 dest_ptr += GET_TEXCOORD_SIZE_FROM_FVF(DestFVF, tex_index) * sizeof(float);
3326 }
3327 else
3328 {
3329 copy_and_next(dest_ptr, tex_coord, GET_TEXCOORD_SIZE_FROM_FVF(DestFVF, tex_index) * sizeof(float));
3330 }
3331 }
3332 }
3333
3334 wined3d_resource_unmap(&dest->resource, 0);
3335
3336 return WINED3D_OK;
3337}
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN
Definition: utils.c:923
void multiply_matrix(D3DMATRIX *dst, const D3DMATRIX *src1, const D3DMATRIX *src2) DECLSPEC_HIDDEN
Definition: utils.c:1173
#define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num)
#define copy_and_next(dest, src, size)
Definition: device.c:3069
void CDECL wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport)
Definition: device.c:1950
void CDECL wined3d_device_get_transform(const struct wined3d_device *device, enum wined3d_transform_state state, struct wined3d_matrix *matrix)
Definition: device.c:1540
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:382
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
Definition: resource.c:344
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLfloat GLfloat p
Definition: glext.h:8902
GLdouble GLdouble z
Definition: glext.h:5874
static const MAT2 mat
Definition: font.c:66
static char * dest
Definition: rtl.c:135
static void stream_info(IStream *stream, HGLOBAL *hmem, int *size, int *pos)
static float(__cdecl *square_half_float)(float x
#define DWORD
Definition: nt_native.h:44
@ normal
Definition: optimize.h:166
Definition: palette.c:468
#define WINED3DFVF_PSIZE
Definition: wined3d.h:969
#define WINED3D_TS_WORLD_MATRIX(index)
Definition: wined3d.h:664
#define WINED3DFVF_SPECULAR
Definition: wined3d.h:971
@ WINED3D_RS_CLIPPING
Definition: wined3d.h:323
#define WINED3DFVF_TEXCOUNT_SHIFT
Definition: wined3d.h:973
#define WINED3DFVF_DIFFUSE
Definition: wined3d.h:970
#define WINED3DFVF_POSITION_MASK
Definition: wined3d.h:959
#define WINED3DFVF_XYZ
Definition: wined3d.h:960
#define WINED3DFVF_TEXCOUNT_MASK
Definition: wined3d.h:972
#define WINED3DFVF_XYZRHW
Definition: wined3d.h:961
#define WINED3DFVF_NORMAL
Definition: wined3d.h:968
#define WINED3D_MAP_WRITE
Definition: wined3d.h:938
@ WINED3D_TS_PROJECTION
Definition: wined3d.h:649
@ WINED3D_TS_VIEW
Definition: wined3d.h:648
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
@ WINED3D_FFP_SPECULAR
@ WINED3D_FFP_POSITION
@ WINED3D_FFP_NORMAL
@ WINED3D_FFP_DIFFUSE
@ WINED3D_FFP_TEXCOORD0
#define eps

Referenced by wined3d_device_process_vertices().

◆ resolve_depth_buffer()

static void resolve_depth_buffer ( struct wined3d_device device)
static

Definition at line 1957 of file device.c.

1958{
1959 const struct wined3d_state *state = &device->state;
1960 struct wined3d_rendertarget_view *src_view;
1961 struct wined3d_resource *dst_resource;
1962 struct wined3d_texture *dst_texture;
1963
1964 if (!(dst_texture = state->textures[0]))
1965 return;
1966 dst_resource = &dst_texture->resource;
1967 if (!(dst_resource->format_flags & WINED3DFMT_FLAG_DEPTH))
1968 return;
1969 if (!(src_view = state->fb->depth_stencil))
1970 return;
1971
1973 src_view->resource, src_view->sub_resource_idx, dst_resource->format->id);
1974}
void CDECL wined3d_device_resolve_sub_resource(struct wined3d_device *device, 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:4346
unsigned int format_flags
const struct wined3d_format * format
struct wined3d_resource resource
#define WINED3DFMT_FLAG_DEPTH

Referenced by wined3d_device_set_render_state().

◆ WINE_DECLARE_DEBUG_CHANNEL()

WINE_DECLARE_DEBUG_CHANNEL ( winediag  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d  )

◆ wined3d_device_acquire_focus_window()

HRESULT CDECL wined3d_device_acquire_focus_window ( struct wined3d_device device,
HWND  window 
)

Definition at line 938 of file device.c.

939{
940 TRACE("device %p, window %p.\n", device, window);
941
943 {
944 ERR("Failed to register window %p.\n", window);
945 return E_FAIL;
946 }
947
948 InterlockedExchangePointer((void **)&device->focus_window, window);
949 SetWindowPos(window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
950
951 return WINED3D_OK;
952}
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
BOOL wined3d_register_window(HWND window, struct wined3d_device *device)
Definition: wined3d_main.c:432
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1247
#define SWP_NOSIZE
Definition: winuser.h:1248

Referenced by ddraw_set_cooperative_level(), device_init(), and wined3d_swapchain_set_fullscreen().

◆ wined3d_device_begin_scene()

HRESULT CDECL wined3d_device_begin_scene ( struct wined3d_device device)

Definition at line 3602 of file device.c.

3603{
3604 /* At the moment we have no need for any functionality at the beginning
3605 * of a scene. */
3606 TRACE("device %p.\n", device);
3607
3608 if (device->inScene)
3609 {
3610 WARN("Already in scene, returning WINED3DERR_INVALIDCALL.\n");
3612 }
3613 device->inScene = TRUE;
3614 return WINED3D_OK;
3615}

Referenced by d3d8_device_BeginScene(), d3d9_device_BeginScene(), and d3d_device7_BeginScene().

◆ wined3d_device_begin_stateblock()

HRESULT CDECL wined3d_device_begin_stateblock ( struct wined3d_device device)

Definition at line 3555 of file device.c.

3556{
3557 struct wined3d_stateblock *stateblock;
3558 HRESULT hr;
3559
3560 TRACE("device %p.\n", device);
3561
3562 if (device->recording)
3564
3566 if (FAILED(hr))
3567 return hr;
3568
3569 device->recording = stateblock;
3570 device->update_state = &stateblock->state;
3571
3572 TRACE("Recording stateblock %p.\n", stateblock);
3573
3574 return WINED3D_OK;
3575}
struct wined3d_state state
HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock)
Definition: stateblock.c:1372
@ WINED3D_SBT_RECORDED
Definition: wined3d.h:770

Referenced by d3d8_device_BeginStateBlock(), d3d9_device_BeginStateBlock(), and d3d_device7_BeginStateBlock().

◆ wined3d_device_clear()

HRESULT CDECL wined3d_device_clear ( struct wined3d_device device,
DWORD  rect_count,
const RECT rects,
DWORD  flags,
const struct wined3d_color color,
float  depth,
DWORD  stencil 
)

Definition at line 3633 of file device.c.

3635{
3636 TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n",
3637 device, rect_count, rects, flags, debug_color(color), depth, stencil);
3638
3639 if (!rect_count && rects)
3640 {
3641 WARN("Rects is %p, but rect_count is 0, ignoring clear\n", rects);
3642 return WINED3D_OK;
3643 }
3644
3646 {
3647 struct wined3d_rendertarget_view *ds = device->fb.depth_stencil;
3648 if (!ds)
3649 {
3650 WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n");
3651 /* TODO: What about depth stencil buffers without stencil bits? */
3653 }
3654 else if (flags & WINED3DCLEAR_TARGET)
3655 {
3656 if (ds->width < device->fb.render_targets[0]->width
3657 || ds->height < device->fb.render_targets[0]->height)
3658 {
3659 WARN("Silently ignoring depth and target clear with mismatching sizes\n");
3660 return WINED3D_OK;
3661 }
3662 }
3663 }
3664
3665 wined3d_cs_emit_clear(device->cs, rect_count, rects, flags, color, depth, stencil);
3666
3667 return WINED3D_OK;
3668}
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
Definition: cs.c:536
const char * debug_color(const struct wined3d_color *color)
Definition: utils.c:3948

Referenced by d3d8_device_Clear(), d3d9_device_Clear(), d3d_device7_Clear(), and wined3d_device_init_3d().

◆ wined3d_device_clear_rendertarget_view()

HRESULT CDECL wined3d_device_clear_rendertarget_view ( struct wined3d_device device,
struct wined3d_rendertarget_view view,
const RECT rect,
DWORD  flags,
const struct wined3d_color color,
float  depth,
DWORD  stencil 
)

Definition at line 4392 of file device.c.

4395{
4396 struct wined3d_resource *resource;
4397 RECT r;
4398
4399 TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n",
4401
4402 if (!flags)
4403 return WINED3D_OK;
4404
4405 resource = view->resource;
4407 {
4408 FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
4410 }
4411
4412 if (view->layer_count > 1)
4413 {
4414 FIXME("Layered clears not implemented.\n");
4416 }
4417
4418 if (!rect)
4419 {
4420 SetRect(&r, 0, 0, view->width, view->height);
4421 rect = &r;
4422 }
4423 else
4424 {
4425 struct wined3d_box b = {rect->left, rect->top, rect->right, rect->bottom, 0, 1};
4427 HRESULT hr;
4428
4430 view->sub_resource_idx % texture->level_count, &b)))
4431 return hr;
4432 }
4433
4435
4436 return WINED3D_OK;
4437}
void wined3d_cs_emit_clear_rendertarget_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
Definition: cs.c:574
HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box)
Definition: texture.c:1128
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define resource
Definition: kernel32.h:9
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by d3d9_device_ColorFill(), and ddraw_surface_blt().

◆ wined3d_device_clear_unordered_access_view_uint()

void CDECL wined3d_device_clear_unordered_access_view_uint ( struct wined3d_device device,
struct wined3d_unordered_access_view view,
const struct wined3d_uvec4 clear_value 
)

Definition at line 4439 of file device.c.

4441{
4442 TRACE("device %p, view %p, clear_value %s.\n", device, view, debug_uvec4(clear_value));
4443
4445}
void wined3d_cs_emit_clear_unordered_access_view_uint(struct wined3d_cs *cs, struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value)
Definition: cs.c:2381
const char * debug_uvec4(const struct wined3d_uvec4 *v)
Definition: utils.c:3964

◆ wined3d_device_copy_resource()

void CDECL wined3d_device_copy_resource ( struct wined3d_device device,
struct wined3d_resource dst_resource,
struct wined3d_resource src_resource 
)

Definition at line 4043 of file device.c.

4045{
4046 struct wined3d_texture *dst_texture, *src_texture;
4047 struct wined3d_box box;
4048 unsigned int i, j;
4049
4050 TRACE("device %p, dst_resource %p, src_resource %p.\n", device, dst_resource, src_resource);
4051
4052 if (src_resource == dst_resource)
4053 {
4054 WARN("Source and destination are the same resource.\n");
4055 return;
4056 }
4057
4058 if (src_resource->type != dst_resource->type)
4059 {
4060 WARN("Resource types (%s / %s) don't match.\n",
4061 debug_d3dresourcetype(dst_resource->type),
4062 debug_d3dresourcetype(src_resource->type));
4063 return;
4064 }
4065
4066 if (src_resource->width != dst_resource->width
4067 || src_resource->height != dst_resource->height
4068 || src_resource->depth != dst_resource->depth)
4069 {
4070 WARN("Resource dimensions (%ux%ux%u / %ux%ux%u) don't match.\n",
4071 dst_resource->width, dst_resource->height, dst_resource->depth,
4072 src_resource->width, src_resource->height, src_resource->depth);
4073 return;
4074 }
4075
4076 if (src_resource->format->typeless_id != dst_resource->format->typeless_id
4077 || (!src_resource->format->typeless_id && src_resource->format->id != dst_resource->format->id))
4078 {
4079 WARN("Resource formats %s and %s are incompatible.\n",
4080 debug_d3dformat(dst_resource->format->id),
4081 debug_d3dformat(src_resource->format->id));
4082 return;
4083 }
4084
4085 if (dst_resource->type == WINED3D_RTYPE_BUFFER)
4086 {
4087 wined3d_box_set(&box, 0, 0, src_resource->size, 1, 0, 1);
4088 wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, 0, &box,
4089 src_resource, 0, &box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
4090 return;
4091 }
4092
4093 dst_texture = texture_from_resource(dst_resource);
4094 src_texture = texture_from_resource(src_resource);
4095
4096 if (src_texture->layer_count != dst_texture->layer_count
4097 || src_texture->level_count != dst_texture->level_count)
4098 {
4099 WARN("Subresource layouts (%ux%u / %ux%u) don't match.\n",
4100 dst_texture->layer_count, dst_texture->level_count,
4101 src_texture->layer_count, src_texture->level_count);
4102 return;
4103 }
4104
4105 for (i = 0; i < dst_texture->level_count; ++i)
4106 {
4107 wined3d_box_set(&box, 0, 0,
4108 wined3d_texture_get_level_width(dst_texture, i),
4109 wined3d_texture_get_level_height(dst_texture, i),
4110 0, wined3d_texture_get_level_depth(dst_texture, i));
4111 for (j = 0; j < dst_texture->layer_count; ++j)
4112 {
4113 unsigned int idx = j * dst_texture->level_count + i;
4114
4115 wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, idx, &box,
4116 src_resource, idx, &box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
4117 }
4118 }
4119}
void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: cs.c:2172
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:3980
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 j
Definition: glfuncs.h:250
enum wined3d_resource_type type
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:2789
#define WINED3D_BLT_RAW
Definition: wined3d.h:1366
static unsigned int wined3d_texture_get_level_depth(const struct wined3d_texture *texture, unsigned int level)

◆ wined3d_device_copy_sub_resource_region()

HRESULT CDECL wined3d_device_copy_sub_resource_region ( struct wined3d_device device,
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 
)

Definition at line 4121 of file device.c.

4125{
4126 struct wined3d_box dst_box, b;
4127
4128 TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, "
4129 "src_resource %p, src_sub_resource_idx %u, src_box %s.\n",
4130 device, dst_resource, dst_sub_resource_idx, dst_x, dst_y, dst_z,
4131 src_resource, src_sub_resource_idx, debug_box(src_box));
4132
4133 if (src_resource == dst_resource && src_sub_resource_idx == dst_sub_resource_idx)
4134 {
4135 WARN("Source and destination are the same sub-resource.\n");
4137 }
4138
4139 if (src_resource->type != dst_resource->type)
4140 {
4141 WARN("Resource types (%s / %s) don't match.\n",
4142 debug_d3dresourcetype(dst_resource->type),
4143 debug_d3dresourcetype(src_resource->type));
4145 }
4146
4147 if (src_resource->format->typeless_id != dst_resource->format->typeless_id
4148 || (!src_resource->format->typeless_id && src_resource->format->id != dst_resource->format->id))
4149 {
4150 WARN("Resource formats %s and %s are incompatible.\n",
4151 debug_d3dformat(dst_resource->format->id),
4152 debug_d3dformat(src_resource->format->id));
4154 }
4155
4156 if (dst_resource->type == WINED3D_RTYPE_BUFFER)
4157 {
4158 if (dst_sub_resource_idx)
4159 {
4160 WARN("Invalid dst_sub_resource_idx %u.\n", dst_sub_resource_idx);
4162 }
4163
4164 if (src_sub_resource_idx)
4165 {
4166 WARN("Invalid src_sub_resource_idx %u.\n", src_sub_resource_idx);
4168 }
4169
4170 if (!src_box)
4171 {
4172 unsigned int dst_w;
4173
4174 dst_w = dst_resource->size - dst_x;
4175 wined3d_box_set(&b, 0, 0, min(src_resource->size, dst_w), 1, 0, 1);
4176 src_box = &b;
4177 }
4178 else if ((src_box->left >= src_box->right
4179 || src_box->top >= src_box->bottom
4180 || src_box->front >= src_box->back))
4181 {
4182 WARN("Invalid box %s specified.\n", debug_box(src_box));
4184 }
4185
4186 if (src_box->right > src_resource->size || dst_x >= dst_resource->size
4187 || src_box->right - src_box->left > dst_resource->size - dst_x)
4188 {
4189 WARN("Invalid range specified, dst_offset %u, src_offset %u, size %u.\n",
4190 dst_x, src_box->left, src_box->right - src_box->left);
4192 }
4193
4194 wined3d_box_set(&dst_box, dst_x, 0, dst_x + (src_box->right - src_box->left), 1, 0, 1);
4195 }
4196 else if (dst_resource->type == WINED3D_RTYPE_TEXTURE_2D)
4197 {
4198 struct wined3d_texture *dst_texture = texture_from_resource(dst_resource);
4199 struct wined3d_texture *src_texture = texture_from_resource(src_resource);
4200 unsigned int src_level = src_sub_resource_idx % src_texture->level_count;
4201
4202 if (dst_sub_resource_idx >= dst_texture->level_count * dst_texture->layer_count)
4203 {
4204 WARN("Invalid destination sub-resource %u.\n", dst_sub_resource_idx);
4206 }
4207
4208 if (src_sub_resource_idx >= src_texture->level_count * src_texture->layer_count)
4209 {
4210 WARN("Invalid source sub-resource %u.\n", src_sub_resource_idx);
4212 }
4213
4214#if !defined(STAGING_CSMT)
4215 if (dst_texture->sub_resources[dst_sub_resource_idx].map_count)
4216 {
4217 WARN("Destination sub-resource %u is mapped.\n", dst_sub_resource_idx);
4219 }
4220
4221 if (src_texture->sub_resources[src_sub_resource_idx].map_count)
4222 {
4223 WARN("Source sub-resource %u is mapped.\n", src_sub_resource_idx);
4225#else /* STAGING_CSMT */
4226 if (dst_texture->sub_resources[dst_sub_resource_idx].map_count ||
4227 src_texture->sub_resources[src_sub_resource_idx].map_count)
4228 {
4229 struct wined3d_device *device = dst_texture->resource.device;
4230 device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
4231 if (dst_texture->sub_resources[dst_sub_resource_idx].map_count ||
4232 src_texture->sub_resources[src_sub_resource_idx].map_count)
4233 {
4234 WARN("Destination or source sub-resource is mapped.\n");
4235 return WINEDDERR_SURFACEBUSY;
4236 }
4237#endif /* STAGING_CSMT */
4238 }
4239
4240 if (!src_box)
4241 {
4242 unsigned int src_w, src_h, dst_w, dst_h, dst_level;
4243
4244 src_w = wined3d_texture_get_level_width(src_texture, src_level);
4245 src_h = wined3d_texture_get_level_height(src_texture, src_level);
4246
4247 dst_level = dst_sub_resource_idx % dst_texture->level_count;
4248 dst_w = wined3d_texture_get_level_width(dst_texture, dst_level) - dst_x;
4249 dst_h = wined3d_texture_get_level_height(dst_texture, dst_level) - dst_y;
4250
4251 wined3d_box_set(&b, 0, 0, min(src_w, dst_w), min(src_h, dst_h), 0, 1);
4252 src_box = &b;
4253 }
4254 else if (FAILED(wined3d_texture_check_box_dimensions(src_texture, src_level, src_box)))
4255 {
4256 WARN("Invalid source box %s.\n", debug_box(src_box));
4258 }
4259
4260 wined3d_box_set(&dst_box, dst_x, dst_y, dst_x + (src_box->right - src_box->left),
4261 dst_y + (src_box->bottom - src_box->top), 0, 1);
4263 dst_sub_resource_idx % dst_texture->level_count, &dst_box)))
4264 {
4265 WARN("Invalid destination box %s.\n", debug_box(&dst_box));
4267 }
4268 }
4269 else
4270 {
4271 FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(dst_resource->type));
4273 }
4274
4275 wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, dst_sub_resource_idx, &dst_box,
4276 src_resource, src_sub_resource_idx, src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
4277
4278 return WINED3D_OK;
4279}
const char * debug_box(const struct wined3d_box *box)
Definition: utils.c:3939
#define b
Definition: ke_i.h:79
UINT left
Definition: wined3d.h:1839
UINT right
Definition: wined3d.h:1841
UINT back
Definition: wined3d.h:1844
UINT front
Definition: wined3d.h:1843
UINT bottom
Definition: wined3d.h:1842
UINT top
Definition: wined3d.h:1840
struct wined3d_texture::wined3d_texture_sub_resource sub_resources[1]
#define WINEDDERR_SURFACEBUSY
Definition: wined3d.h:51
@ WINED3D_CS_QUEUE_DEFAULT

Referenced by d3d9_device_UpdateSurface().

◆ wined3d_device_copy_uav_counter()

void CDECL wined3d_device_copy_uav_counter ( struct wined3d_device device,
struct wined3d_buffer dst_buffer,
unsigned int  offset,
struct wined3d_unordered_access_view uav 
)

Definition at line 4028 of file device.c.

4030{
4031 TRACE("device %p, dst_buffer %p, offset %u, uav %p.\n",
4032 device, dst_buffer, offset, uav);
4033
4034 if (offset + sizeof(GLuint) > dst_buffer->resource.size)
4035 {
4036 WARN("Offset %u too large.\n", offset);
4037 return;
4038 }
4039
4040 wined3d_cs_emit_copy_uav_counter(device->cs, dst_buffer, offset, uav);
4041}
void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer, unsigned int offset, struct wined3d_unordered_access_view *uav)
Definition: cs.c:2410
GLintptr offset
Definition: glext.h:5920
struct wined3d_resource resource

◆ wined3d_device_create_cursor_texture()

static struct wined3d_texture * wined3d_device_create_cursor_texture ( struct wined3d_device device,
struct wined3d_texture cursor_image,
unsigned int  sub_resource_idx 
)
static

Definition at line 4544 of file device.c.

4546{
4547 unsigned int texture_level = sub_resource_idx % cursor_image->level_count;
4550 struct wined3d_map_desc map_desc;
4551 struct wined3d_texture *texture;
4552 HRESULT hr;
4553
4554 if (FAILED(wined3d_resource_map(&cursor_image->resource, sub_resource_idx, &map_desc, NULL, WINED3D_MAP_READ)))
4555 {
4556 ERR("Failed to map source texture.\n");
4557 return NULL;
4558 }
4559
4560 data.data = map_desc.data;
4561 data.row_pitch = map_desc.row_pitch;
4562 data.slice_pitch = map_desc.slice_pitch;
4563
4564 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
4566 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
4567 desc.multisample_quality = 0;
4568 desc.usage = WINED3DUSAGE_DYNAMIC;
4570 desc.width = wined3d_texture_get_level_width(cursor_image, texture_level);
4571 desc.height = wined3d_texture_get_level_height(cursor_image, texture_level);
4572 desc.depth = 1;
4573 desc.size = 0;
4574
4577 wined3d_resource_unmap(&cursor_image->resource, sub_resource_idx);
4578 if (FAILED(hr))
4579 {
4580 ERR("Failed to create cursor texture.\n");
4581 return NULL;
4582 }
4583
4584 return texture;
4585}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define WINED3D_MAP_READ
Definition: wined3d.h:939
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:223

Referenced by wined3d_device_set_cursor_properties().

◆ wined3d_device_create_primary_opengl_context()

static HRESULT wined3d_device_create_primary_opengl_context ( struct wined3d_device device)
static

Definition at line 1051 of file device.c.

1052{
1054 device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
1055 if (!device->swapchains[0]->num_contexts)
1056 return E_FAIL;
1057
1058 return WINED3D_OK;
1059}
void wined3d_cs_init_object(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
Definition: cs.c:1890
static void wined3d_device_create_primary_opengl_context_cs(void *object)
Definition: device.c:1017

Referenced by wined3d_device_init_3d(), and wined3d_device_reset().

◆ wined3d_device_create_primary_opengl_context_cs()

static void wined3d_device_create_primary_opengl_context_cs ( void object)
static

Definition at line 1017 of file device.c.

1018{
1019 struct wined3d_device *device = object;
1020 struct wined3d_swapchain *swapchain;
1021 struct wined3d_context *context;
1022 struct wined3d_texture *target;
1023 HRESULT hr;
1024
1025 if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
1026 device->adapter->vertex_pipe, device->adapter->fragment_pipe)))
1027 {
1028 ERR("Failed to allocate shader private data, hr %#x.\n", hr);
1029 return;
1030 }
1031
1032 if (!(device->blitter = wined3d_cpu_blitter_create()))
1033 {
1034 ERR("Failed to create CPU blitter.\n");
1035 device->shader_backend->shader_free_private(device);
1036 return;
1037 }
1038 wined3d_ffp_blitter_create(&device->blitter, &device->adapter->gl_info);
1040 wined3d_fbo_blitter_create(&device->blitter, &device->adapter->gl_info);
1041 wined3d_raw_blitter_create(&device->blitter, &device->adapter->gl_info);
1042
1043 swapchain = device->swapchains[0];
1044 target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer;
1049}
void wined3d_arbfp_blitter_create(struct wined3d_blitter **next, const struct wined3d_device *device)
static void create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context)
Definition: device.c:604
static void create_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
Definition: device.c:780
void wined3d_fbo_blitter_create(struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
Definition: surface.c:2734
struct wined3d_blitter * wined3d_cpu_blitter_create(void)
Definition: surface.c:3983
void wined3d_raw_blitter_create(struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
Definition: surface.c:2871
void wined3d_ffp_blitter_create(struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
Definition: surface.c:3170
struct wined3d_swapchain * swapchain

Referenced by wined3d_device_create_primary_opengl_context().

◆ wined3d_device_decref()

ULONG CDECL wined3d_device_decref ( struct wined3d_device device)

Definition at line 472 of file device.c.

473{
474 ULONG refcount = InterlockedDecrement(&device->ref);
475
476 TRACE("%p decreasing refcount to %u.\n", device, refcount);
477
478 if (!refcount)
479 {
480 UINT i;
481
483
484 if (device->recording && wined3d_stateblock_decref(device->recording))
485 ERR("Something's still holding the recording stateblock.\n");
486 device->recording = NULL;
487
488 state_cleanup(&device->state);
489
490 for (i = 0; i < ARRAY_SIZE(device->multistate_funcs); ++i)
491 {
492 heap_free(device->multistate_funcs[i]);
493 device->multistate_funcs[i] = NULL;
494 }
495
496 if (!list_empty(&device->resources))
497 {
499
500 ERR("Device released with resources still bound.\n");
501
503 {
504 ERR("Leftover resource %p with type %s (%#x).\n",
506 }
507 }
508
509 if (device->contexts)
510 ERR("Context array not freed!\n");
511 if (device->hardwareCursor)
512 DestroyCursor(device->hardwareCursor);
513 device->hardwareCursor = 0;
514
516
517 wined3d_decref(device->wined3d);
518 device->wined3d = NULL;
520 TRACE("Freed device %p.\n", device);
521 }
522
523 return refcount;
524}
#define InterlockedDecrement
Definition: armddk.h:52
static int list_empty(struct list_entry *head)
Definition: list.h:58
void wined3d_cs_destroy(struct wined3d_cs *cs)
Definition: cs.c:2885
static void device_leftover_sampler(struct wine_rb_entry *entry, void *context)
Definition: device.c:465
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
struct list resource_list_entry
uint32_t ULONG
Definition: typedefs.h:59
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:552
BOOL WINAPI DestroyCursor(_In_ HCURSOR)
Definition: cursoricon.c:2741

Referenced by d3d8_device_Release(), d3d9_device_Release(), d3d_device_inner_Release(), ddraw_destroy(), ddraw_surface_release_iface(), and device_init().

◆ wined3d_device_delete_opengl_contexts()

static void wined3d_device_delete_opengl_contexts ( struct wined3d_device device)
static

Definition at line 1011 of file device.c.

1012{
1014 device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
1015}
void wined3d_cs_destroy_object(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
Definition: cs.c:1885
static void wined3d_device_delete_opengl_contexts_cs(void *object)
Definition: device.c:977

Referenced by wined3d_device_reset(), and wined3d_device_uninit_3d().

◆ wined3d_device_delete_opengl_contexts_cs()

static void wined3d_device_delete_opengl_contexts_cs ( void object)
static

Definition at line 977 of file device.c.

978{
980 struct wined3d_device *device = object;
981 struct wined3d_context *context;
982 struct wined3d_shader *shader;
983
984 LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
985 {
986 TRACE("Unloading resource %p.\n", resource);
988 }
989
991 {
992 device->shader_backend->shader_destroy(shader);
993 }
994
996 device->blitter->ops->blitter_destroy(device->blitter, context);
997 device->shader_backend->shader_free_private(device);
1001
1002 while (device->context_count)
1003 {
1004 if (device->contexts[0]->swapchain)
1005 swapchain_destroy_contexts(device->contexts[0]->swapchain);
1006 else
1007 context_destroy(device, device->contexts[0]);
1008 }
1009}
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource)
Definition: cs.c:1978
void context_destroy(struct wined3d_device *device, struct wined3d_context *context)
Definition: context.c:2290
static void destroy_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
Definition: device.c:828
static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d_context *context)
Definition: device.c:739
GLuint shader
Definition: glext.h:6030
const char cursor[]
Definition: icontest.c:13
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct list shader_list_entry
void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:1079

Referenced by wined3d_device_delete_opengl_contexts().

◆ wined3d_device_dispatch_compute()

void CDECL wined3d_device_dispatch_compute ( struct wined3d_device device,
unsigned int  group_count_x,
unsigned int  group_count_y,
unsigned int  group_count_z 
)

Definition at line 3700 of file device.c.

3702{
3703 TRACE("device %p, group_count_x %u, group_count_y %u, group_count_z %u.\n",
3704 device, group_count_x, group_count_y, group_count_z);
3705
3706 wined3d_cs_emit_dispatch(device->cs, group_count_x, group_count_y, group_count_z);
3707}
void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z)
Definition: cs.c:738

◆ wined3d_device_dispatch_compute_indirect()

void CDECL wined3d_device_dispatch_compute_indirect ( struct wined3d_device device,
struct wined3d_buffer buffer,
unsigned int  offset 
)

Definition at line 3709 of file device.c.

3711{
3712 TRACE("device %p, buffer %p, offset %u.\n", device, buffer, offset);
3713
3715}
void wined3d_cs_emit_dispatch_indirect(struct wined3d_cs *cs, struct wined3d_buffer *buffer, unsigned int offset)
Definition: cs.c:756

◆ wined3d_device_draw_indexed_primitive()

HRESULT CDECL wined3d_device_draw_indexed_primitive ( struct wined3d_device device,
UINT  start_idx,
UINT  index_count 
)

Definition at line 3769 of file device.c.

3770{
3771 TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count);
3772
3773 if (!device->state.index_buffer)
3774 {
3775 /* D3D9 returns D3DERR_INVALIDCALL when DrawIndexedPrimitive is called
3776 * without an index buffer set. (The first time at least...)
3777 * D3D8 simply dies, but I doubt it can do much harm to return
3778 * D3DERR_INVALIDCALL there as well. */
3779 WARN("Called without a valid index buffer set, returning WINED3DERR_INVALIDCALL.\n");
3781 }
3782
3783 wined3d_cs_emit_draw(device->cs, device->state.gl_primitive_type, device->state.gl_patch_vertices,
3784 device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE);
3785
3786 return WINED3D_OK;
3787}
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned int patch_vertex_count, int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed)
Definition: cs.c:873

Referenced by d3d8_device_DrawIndexedPrimitive(), d3d8_device_DrawIndexedPrimitiveUP(), d3d9_device_DrawIndexedPrimitive(), d3d9_device_DrawIndexedPrimitiveUP(), d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), and d3d_device7_DrawIndexedPrimitiveVB().

◆ wined3d_device_draw_indexed_primitive_instanced()

void CDECL wined3d_device_draw_indexed_primitive_instanced ( struct wined3d_device device,
UINT  start_idx,
UINT  index_count,
UINT  start_instance,
UINT  instance_count 
)

Definition at line 3789 of file device.c.

3791{
3792 TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n",
3793 device, start_idx, index_count, start_instance, instance_count);
3794
3795 wined3d_cs_emit_draw(device->cs, device->state.gl_primitive_type, device->state.gl_patch_vertices,
3796 device->state.base_vertex_index, start_idx, index_count, start_instance, instance_count, TRUE);
3797}

◆ wined3d_device_draw_indexed_primitive_instanced_indirect()

void CDECL wined3d_device_draw_indexed_primitive_instanced_indirect ( struct wined3d_device device,
struct wined3d_buffer buffer,
unsigned int  offset 
)

Definition at line 3799 of file device.c.

3801{
3802 TRACE("device %p, buffer %p, offset %u.\n", device, buffer, offset);
3803
3804 wined3d_cs_emit_draw_indirect(device->cs, device->state.gl_primitive_type, device->state.gl_patch_vertices,
3805 buffer, offset, TRUE);
3806}
void wined3d_cs_emit_draw_indirect(struct wined3d_cs *cs, GLenum primitive_type, unsigned int patch_vertex_count, struct wined3d_buffer *buffer, unsigned int offset, BOOL indexed)
Definition: cs.c:898

◆ wined3d_device_draw_primitive()

HRESULT CDECL wined3d_device_draw_primitive ( struct wined3d_device device,
UINT  start_vertex,
UINT  vertex_count 
)

Definition at line 3740 of file device.c.

3741{
3742 TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count);
3743
3744 wined3d_cs_emit_draw(device->cs, device->state.gl_primitive_type, device->state.gl_patch_vertices,
3745 0, start_vertex, vertex_count, 0, 0, FALSE);
3746
3747 return WINED3D_OK;
3748}
int vertex_count
Definition: d3drm.c:3367

Referenced by d3d8_device_DrawPrimitive(), d3d8_device_DrawPrimitiveUP(), d3d9_device_DrawPrimitive(), d3d9_device_DrawPrimitiveUP(), d3d_device7_DrawPrimitive(), d3d_device7_DrawPrimitiveStrided(), and d3d_device7_DrawPrimitiveVB().

◆ wined3d_device_draw_primitive_instanced()

void CDECL wined3d_device_draw_primitive_instanced ( struct wined3d_device device,
UINT  start_vertex,
UINT  vertex_count,
UINT  start_instance,
UINT  instance_count 
)

Definition at line 3750 of file device.c.

3752{
3753 TRACE("device %p, start_vertex %u, vertex_count %u, start_instance %u, instance_count %u.\n",
3754 device, start_vertex, vertex_count, start_instance, instance_count);
3755
3756 wined3d_cs_emit_draw(device->cs, device->state.gl_primitive_type, device->state.gl_patch_vertices,
3757 0, start_vertex, vertex_count, start_instance, instance_count, FALSE);
3758}

◆ wined3d_device_draw_primitive_instanced_indirect()

void CDECL wined3d_device_draw_primitive_instanced_indirect ( struct wined3d_device device,
struct wined3d_buffer buffer,
unsigned int  offset 
)

Definition at line 3760 of file device.c.

3762{
3763 TRACE("device %p, buffer %p, offset %u.\n", device, buffer, offset);
3764
3765 wined3d_cs_emit_draw_indirect(device->cs, device->state.gl_primitive_type, device->state.gl_patch_vertices,
3766 buffer, offset, FALSE);
3767}

◆ wined3d_device_end_scene()

HRESULT CDECL wined3d_device_end_scene ( struct wined3d_device device)

Definition at line 3617 of file device.c.

3618{
3619 TRACE("device %p.\n", device);
3620
3621 if (!device->inScene)
3622 {
3623 WARN("Not in scene, returning WINED3DERR_INVALIDCALL.\n");
3625 }
3626
3628
3629 device->inScene = FALSE;
3630 return WINED3D_OK;
3631}
void wined3d_cs_emit_flush(struct wined3d_cs *cs)
Definition: cs.c:930

Referenced by d3d8_device_EndScene(), d3d9_device_EndScene(), and d3d_device7_EndScene().

◆ wined3d_device_end_stateblock()

HRESULT CDECL wined3d_device_end_stateblock ( struct wined3d_device device,
struct wined3d_stateblock **  stateblock 
)

Definition at line 3577 of file device.c.

3579{
3580 struct wined3d_stateblock *object = device->recording;
3581
3582 TRACE("device %p, stateblock %p.\n", device, stateblock);
3583
3584 if (!device->recording)
3585 {
3586 WARN("Not recording.\n");
3587 *stateblock = NULL;
3589 }
3590
3592
3593 *stateblock = object;
3594 device->recording = NULL;
3595 device->update_state = &device->state;
3596
3597 TRACE("Returning stateblock %p.\n", *stateblock);
3598
3599 return WINED3D_OK;
3600}
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
Definition: stateblock.c:290

Referenced by d3d8_device_EndStateBlock(), d3d9_device_EndStateBlock(), and d3d_device7_EndStateBlock().

◆ wined3d_device_evict_managed_resources()

void CDECL wined3d_device_evict_managed_resources ( struct wined3d_device device)

Definition at line 4753 of file device.c.

4754{
4756
4757 TRACE("device %p.\n", device);
4758
4760 {
4761 TRACE("Checking resource %p for eviction.\n", resource);
4762
4763 if (wined3d_resource_access_is_managed(resource->access) && !resource->map_count)
4764 {
4765 TRACE("Evicting %p.\n", resource);
4767 }
4768 }
4769}
static BOOL wined3d_resource_access_is_managed(unsigned int access)

Referenced by d3d7_EvictManagedTextures(), d3d8_device_ResourceManagerDiscardBytes(), and d3d9_device_EvictManagedResources().

◆ wined3d_device_get_available_texture_mem()

UINT CDECL wined3d_device_get_available_texture_mem ( const struct wined3d_device device)

Definition at line 1298 of file device.c.

1299{
1300 /* const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; */
1301
1302 TRACE("device %p.\n", device);
1303
1304 /* We can not acquire the context unless there is a swapchain. */
1305 /*
1306 if (device->swapchains && gl_info->supported[NVX_GPU_MEMORY_INFO] &&
1307 !wined3d_settings.emulated_textureram)
1308 {
1309 GLint vram_free_kb;
1310 UINT64 vram_free;
1311
1312 struct wined3d_context *context = context_acquire(device, NULL, 0);
1313 gl_info->gl_ops.gl.p_glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &vram_free_kb);
1314 vram_free = (UINT64)vram_free_kb * 1024;
1315 context_release(context);
1316
1317 TRACE("Total 0x%s bytes. emulation 0x%s left, driver 0x%s left.\n",
1318 wine_dbgstr_longlong(device->adapter->vram_bytes),
1319 wine_dbgstr_longlong(device->adapter->vram_bytes - device->adapter->vram_bytes_used),
1320 wine_dbgstr_longlong(vram_free));
1321
1322 vram_free = min(vram_free, device->adapter->vram_bytes - device->adapter->vram_bytes_used);
1323 return min(UINT_MAX, vram_free);
1324 }
1325 */
1326
1327 TRACE("Emulating 0x%s bytes. 0x%s used, returning 0x%s left.\n",
1328 wine_dbgstr_longlong(device->adapter->vram_bytes),
1329 wine_dbgstr_longlong(device->adapter->vram_bytes_used),
1330 wine_dbgstr_longlong(device->adapter->vram_bytes - device->adapter->vram_bytes_used));
1331
1332 return min(UINT_MAX, device->adapter->vram_bytes - device->adapter->vram_bytes_used);
1333}
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define UINT_MAX
Definition: intsafe.h:152

Referenced by d3d8_device_GetAvailableTextureMem(), d3d9_device_GetAvailableTextureMem(), ddraw7_GetAvailableVidMem(), and resource_init().

◆ wined3d_device_get_base_vertex_index()

INT CDECL wined3d_device_get_base_vertex_index ( const struct wined3d_device device)

Definition at line 1924 of file device.c.

1925{
1926 TRACE("device %p.\n", device);
1927
1928 return device->state.base_vertex_index;
1929}

Referenced by d3d8_device_GetIndices().

◆ wined3d_device_get_blend_state()

struct wined3d_blend_state *CDECL wined3d_device_get_blend_state ( const struct wined3d_device device)

Definition at line 1994 of file device.c.

1995{
1996 TRACE("device %p.\n", device);
1997
1998 return device->state.blend_state;
1999}

◆ wined3d_device_get_clip_plane()

HRESULT CDECL wined3d_device_get_clip_plane ( const struct wined3d_device device,
UINT  plane_idx,
struct wined3d_vec4 plane 
)

Definition at line 1811 of file device.c.

1813{
1814 TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
1815
1816 if (plane_idx >= device->adapter->gl_info.limits.user_clip_distances)
1817 {
1818 TRACE("Application has requested clipplane this device doesn't support.\n");
1820 }
1821
1822 *plane = device->state.clip_planes[plane_idx];
1823
1824 return WINED3D_OK;
1825}
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

Referenced by d3d8_device_GetClipPlane(), d3d9_device_GetClipPlane(), and d3d_device7_GetClipPlane().

◆ wined3d_device_get_clip_status()

HRESULT CDECL wined3d_device_get_clip_status ( const struct wined3d_device device,
struct wined3d_clip_status clip_status 
)

Definition at line 1838 of file device.c.

1840{
1841 FIXME("device %p, clip_status %p stub!\n", device, clip_status);
1842
1843 if (!clip_status)
1845
1846 return WINED3D_OK;
1847}

Referenced by d3d8_device_GetClipStatus(), and d3d9_device_GetClipStatus().

◆ wined3d_device_get_compute_shader()

struct wined3d_shader *CDECL wined3d_device_get_compute_shader ( const struct wined3d_device device)

Definition at line 2947 of file device.c.

2948{
2949 TRACE("device %p.\n", device);
2950
2951 return device->state.shader[WINED3D_SHADER_TYPE_COMPUTE];
2952}
@ WINED3D_SHADER_TYPE_COMPUTE

◆ wined3d_device_get_constant_buffer()

static struct wined3d_buffer * wined3d_device_get_constant_buffer ( const struct wined3d_device device,
enum wined3d_shader_type  shader_type,
unsigned int  idx 
)
static

Definition at line 2245 of file device.c.

2247{
2249 {
2250 WARN("Invalid constant buffer index %u.\n", idx);
2251 return NULL;
2252 }
2253
2254 return device->state.cb[shader_type][idx];
2255}
#define MAX_CONSTANT_BUFFERS

Referenced by wined3d_device_get_cs_cb(), wined3d_device_get_ds_cb(), wined3d_device_get_gs_cb(), wined3d_device_get_hs_cb(), wined3d_device_get_ps_cb(), and wined3d_device_get_vs_cb().

◆ wined3d_device_get_creation_parameters()

void CDECL wined3d_device_get_creation_parameters ( const struct wined3d_device device,
struct wined3d_device_creation_parameters parameters 
)

Definition at line 5042 of file device.c.

5044{
5045 TRACE("device %p, parameters %p.\n", device, parameters);
5046
5047 *parameters = device->create_parms;
5048}

Referenced by d3d8_device_GetCreationParameters(), and d3d9_device_GetCreationParameters().

◆ wined3d_device_get_cs_cb()

struct wined3d_buffer *CDECL wined3d_device_get_cs_cb ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 2961 of file device.c.

2962{
2963 TRACE("device %p, idx %u.\n", device, idx);
2964
2966}
static struct wined3d_buffer * wined3d_device_get_constant_buffer(const struct wined3d_device *device, enum wined3d_shader_type shader_type, unsigned int idx)
Definition: device.c:2245

◆ wined3d_device_get_cs_resource_view()

struct wined3d_shader_resource_view *CDECL wined3d_device_get_cs_resource_view ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 2976 of file device.c.

2978{
2979 TRACE("device %p, idx %u.\n", device, idx);
2980
2982}
static struct wined3d_shader_resource_view * wined3d_device_get_shader_resource_view(const struct wined3d_device *device, enum wined3d_shader_type shader_type, unsigned int idx)
Definition: device.c:2296

◆ wined3d_device_get_cs_sampler()

struct wined3d_sampler *CDECL wined3d_device_get_cs_sampler ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 2992 of file device.c.

2993{
2994 TRACE("device %p, idx %u.\n", device, idx);
2995
2997}
static struct wined3d_sampler * wined3d_device_get_sampler(const struct wined3d_device *device, enum wined3d_shader_type shader_type, unsigned int idx)
Definition: device.c:2347

◆ wined3d_device_get_cs_uav()

struct wined3d_unordered_access_view *CDECL wined3d_device_get_cs_uav ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 3044 of file device.c.

3046{
3047 TRACE("device %p, idx %u.\n", device, idx);
3048
3050}
static struct wined3d_unordered_access_view * wined3d_device_get_pipeline_unordered_access_view(const struct wined3d_device *device, enum wined3d_pipeline pipeline, unsigned int idx)
Definition: device.c:3024
@ WINED3D_PIPELINE_COMPUTE

◆ wined3d_device_get_depth_stencil_view()

struct wined3d_rendertarget_view *CDECL wined3d_device_get_depth_stencil_view ( const struct wined3d_device device)

Definition at line 4461 of file device.c.

4462{
4463 TRACE("device %p.\n", device);
4464
4465 return device->fb.depth_stencil;
4466}

Referenced by d3d8_device_GetDepthStencilSurface(), d3d8_device_SetRenderTarget(), d3d9_device_GetDepthStencilSurface(), ddraw_set_cooperative_level(), and ddraw_surface_delete_attached_surface().

◆ wined3d_device_get_device_caps()

HRESULT CDECL wined3d_device_get_device_caps ( const struct wined3d_device device,
WINED3DCAPS caps 
)

Definition at line 3526 of file device.c.

3527{
3528 HRESULT hr;
3529
3530 TRACE("device %p, caps %p.\n", device, caps);
3531
3532 hr = wined3d_get_device_caps(device->wined3d, device->adapter->ordinal,
3533 device->create_parms.device_type, caps);
3534
3536 caps->MaxVertexBlendMatrixIndex = 255;
3537
3538 return hr;
3539}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
DWORD MaxVertexBlendMatrixIndex
Definition: wined3d.h:1936
HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, WINED3DCAPS *caps)
Definition: directx.c:5659
static BOOL use_software_vertex_processing(const struct wined3d_device *device)

Referenced by d3d8_device_GetDeviceCaps(), d3d9_device_GetDeviceCaps(), and ddraw7_GetCaps().

◆ wined3d_device_get_display_mode()

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 at line 3541 of file device.c.

3543{
3544 struct wined3d_swapchain *swapchain;
3545
3546 TRACE("device %p, swapchain_idx %u, mode %p, rotation %p.\n",
3547 device, swapchain_idx, mode, rotation);
3548
3549 if (!(swapchain = wined3d_device_get_swapchain(device, swapchain_idx)))
3551
3552 return wined3d_swapchain_get_display_mode(swapchain, mode, rotation);
3553}
struct wined3d_swapchain *CDECL wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx)
Definition: device.c:533
GLenum mode
Definition: glext.h:6217
HRESULT CDECL wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: swapchain.c:248

Referenced by d3d8_device_GetDisplayMode(), d3d9_device_GetDisplayMode(), and d3d9_device_GetDisplayModeEx().

◆ wined3d_device_get_domain_shader()

struct wined3d_shader *CDECL wined3d_device_get_domain_shader ( const struct wined3d_device device)

Definition at line 2811 of file device.c.

2812{
2813 TRACE("device %p.\n", device);
2814
2815 return device->state.shader[WINED3D_SHADER_TYPE_DOMAIN];
2816}
@ WINED3D_SHADER_TYPE_DOMAIN

◆ wined3d_device_get_ds_cb()

struct wined3d_buffer *CDECL wined3d_device_get_ds_cb ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 2825 of file device.c.

2826{
2827 TRACE("device %p, idx %u.\n", device, idx);
2828
2830}

◆ wined3d_device_get_ds_resource_view()

struct wined3d_shader_resource_view *CDECL wined3d_device_get_ds_resource_view ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 2840 of file device.c.

2842{
2843 TRACE("device %p, idx %u.\n", device, idx);
2844
2846}

◆ wined3d_device_get_ds_sampler()

struct wined3d_sampler *CDECL wined3d_device_get_ds_sampler ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 2856 of file device.c.

2857{
2858 TRACE("device %p, idx %u.\n", device, idx);
2859
2861}

◆ wined3d_device_get_gamma_ramp()

void CDECL wined3d_device_get_gamma_ramp ( const struct wined3d_device device,
UINT  swapchain_idx,
struct wined3d_gamma_ramp ramp 
)

Definition at line 5069 of file device.c.

5071{
5072 struct wined3d_swapchain *swapchain;
5073
5074 TRACE("device %p, swapchain_idx %u, ramp %p.\n",
5075 device, swapchain_idx, ramp);
5076
5077 if ((swapchain = wined3d_device_get_swapchain(device, swapchain_idx)))
5079}
static const BYTE ramp[17]
Definition: dib.c:2709
HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain, struct wined3d_gamma_ramp *ramp)
Definition: swapchain.c:302

Referenced by d3d8_device_GetGammaRamp(), d3d9_device_GetGammaRamp(), and ddraw_gamma_control_GetGammaRamp().

◆ wined3d_device_get_geometry_shader()

struct wined3d_shader *CDECL wined3d_device_get_geometry_shader ( const struct wined3d_device device)

Definition at line 2879 of file device.c.

2880{
2881 TRACE("device %p.\n", device);
2882
2883 return device->state.shader[WINED3D_SHADER_TYPE_GEOMETRY];
2884}
@ WINED3D_SHADER_TYPE_GEOMETRY

◆ wined3d_device_get_gs_cb()

struct wined3d_buffer *CDECL wined3d_device_get_gs_cb ( const struct wined3d_device device,
UINT  idx 
)

Definition at line 2893 of file device.c.

2894{
2895 TRACE("device %p, idx %u.\n", device, idx);
2896
2898}

◆ wined3d_device_get_gs_resource_view()

struct wined3d_shader_resource_view *CDECL wined3d_device_get_gs_resource_view ( const struct wined3d_device device,
UINT  idx 
)

Definition at line 2908 of file device.c.

2910{
2911 TRACE("device %p, idx %u.\n", device, idx);
2912
2914}

◆ wined3d_device_get_gs_sampler()

struct wined3d_sampler *CDECL wined3d_device_get_gs_sampler ( const struct wined3d_device device,
UINT  idx 
)

Definition at line 2923 of file device.c.

2924{
2925 TRACE("device %p, idx %u.\n", device, idx);
2926
2928}

◆ wined3d_device_get_hs_cb()

struct wined3d_buffer *CDECL wined3d_device_get_hs_cb ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 2756 of file device.c.

2757{
2758 TRACE("device %p, idx %u.\n", device, idx);
2759
2761}
@ WINED3D_SHADER_TYPE_HULL

◆ wined3d_device_get_hs_resource_view()

struct wined3d_shader_resource_view *CDECL wined3d_device_get_hs_resource_view ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 2771 of file device.c.

2773{
2774 TRACE("device %p, idx %u.\n", device, idx);
2775
2777}

◆ wined3d_device_get_hs_sampler()

struct wined3d_sampler *CDECL wined3d_device_get_hs_sampler ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 2787 of file device.c.

2788{
2789 TRACE("device %p, idx %u.\n", device, idx);
2790
2792}

◆ wined3d_device_get_hull_shader()

struct wined3d_shader *CDECL wined3d_device_get_hull_shader ( const struct wined3d_device device)

Definition at line 2742 of file device.c.

2743{
2744 TRACE("device %p.\n", device);
2745
2746 return device->state.shader[WINED3D_SHADER_TYPE_HULL];
2747}

◆ wined3d_device_get_index_buffer()

struct wined3d_buffer *CDECL wined3d_device_get_index_buffer ( const struct wined3d_device device,
enum wined3d_format_id format,
unsigned int offset 
)

Definition at line 1906 of file device.c.

1908{
1909 TRACE("device %p, format %p, offset %p.\n", device, format, offset);
1910
1911 *format = device->state.index_format;
1912 if (offset)
1913 *offset = device->state.index_offset;
1914 return device->state.index_buffer;
1915}
Definition: format.c:58

Referenced by d3d8_device_GetIndices(), and d3d9_device_GetIndices().

◆ wined3d_device_get_light()

HRESULT CDECL wined3d_device_get_light ( const struct wined3d_device device,
UINT  light_idx,
struct wined3d_light light 
)

Definition at line 1724 of file device.c.

1726{
1727 struct wined3d_light_info *light_info;
1728
1729 TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light);
1730
1731 if (!(light_info = wined3d_state_get_light(&device->state, light_idx)))
1732 {
1733 TRACE("Light information requested but light not defined\n");
1735 }
1736
1737 *light = light_info->OriginalParms;
1738 return WINED3D_OK;
1739}
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
struct wined3d_light OriginalParms
struct wined3d_light_info * wined3d_state_get_light(const struct wined3d_state *state, unsigned int idx)
Definition: stateblock.c:567

Referenced by d3d8_device_GetLight(), d3d9_device_GetLight(), and d3d_device7_GetLight().

◆ wined3d_device_get_light_enable()

HRESULT CDECL wined3d_device_get_light_enable ( const struct wined3d_device device,
UINT  light_idx,
BOOL enable 
)

Definition at line 1767 of file device.c.

1768{
1769 struct wined3d_light_info *light_info;
1770
1771 TRACE("device %p, light_idx %u, enable %p.\n", device, light_idx, enable);
1772
1773 if (!(light_info = wined3d_state_get_light(&device->state, light_idx)))
1774 {
1775 TRACE("Light enabled state requested but light not defined.\n");
1777 }
1778 /* true is 128 according to SetLightEnable */
1779 *enable = light_info->enabled ? 128 : 0;
1780 return WINED3D_OK;
1781}
GLboolean enable
Definition: glext.h:11120

Referenced by d3d8_device_GetLightEnable(), d3d9_device_GetLightEnable(), and d3d_device7_GetLightEnable().

◆ wined3d_device_get_material()

void CDECL wined3d_device_get_material ( const struct wined3d_device device,
struct wined3d_material material 
)

Definition at line 1861 of file device.c.

1862{
1863 TRACE("device %p, material %p.\n", device, material);
1864
1865 *material = device->state.material;
1866
1867 TRACE("diffuse %s\n", debug_color(&material->diffuse));
1868 TRACE("ambient %s\n", debug_color(&material->ambient));
1869 TRACE("specular %s\n", debug_color(&material->specular));
1870 TRACE("emissive %s\n", debug_color(&material->emissive));
1871 TRACE("power %.8e.\n", material->power);
1872}
struct wined3d_color specular
Definition: wined3d.h:1664
struct wined3d_color ambient
Definition: wined3d.h:1663
struct wined3d_color diffuse
Definition: wined3d.h:1662
struct wined3d_color emissive
Definition: wined3d.h:1665

Referenced by d3d8_device_GetMaterial(), d3d9_device_GetMaterial(), and d3d_device7_GetMaterial().

◆ wined3d_device_get_npatch_mode()

float CDECL wined3d_device_get_npatch_mode ( const struct wined3d_device device)

Definition at line 4013 of file device.c.

4014{
4015 static BOOL warned;
4016
4017 TRACE("device %p.\n", device);
4018
4019 if (!warned)
4020 {
4021 FIXME("device %p stub!\n", device);
4022 warned = TRUE;
4023 }
4024
4025 return 0.0f;
4026}

Referenced by d3d9_device_GetNPatchMode().

◆ wined3d_device_get_pipeline_unordered_access_view()

static struct wined3d_unordered_access_view * wined3d_device_get_pipeline_unordered_access_view ( const struct wined3d_device device,
enum wined3d_pipeline  pipeline,
unsigned int  idx 
)
static

Definition at line 3024 of file device.c.

3026{
3028 {
3029 WARN("Invalid UAV index %u.\n", idx);
3030 return NULL;
3031 }
3032
3033 return device->state.unordered_access_view[pipeline][idx];
3034}
#define MAX_UNORDERED_ACCESS_VIEWS

Referenced by wined3d_device_get_cs_uav(), and wined3d_device_get_unordered_access_view().

◆ wined3d_device_get_pixel_shader()

struct wined3d_shader *CDECL wined3d_device_get_pixel_shader ( const struct wined3d_device device)

Definition at line 2530 of file device.c.

2531{
2532 TRACE("device %p.\n", device);
2533
2534 return device->state.shader[WINED3D_SHADER_TYPE_PIXEL];
2535}
@ WINED3D_SHADER_TYPE_PIXEL

Referenced by d3d8_device_DeletePixelShader(), d3d8_device_GetPixelShader(), and d3d9_device_GetPixelShader().

◆ wined3d_device_get_predication()

struct wined3d_query *CDECL wined3d_device_get_predication ( struct wined3d_device device,
BOOL value 
)

Definition at line 3691 of file device.c.

3692{
3693 TRACE("device %p, value %p.\n", device, value);
3694
3695 if (value)
3696 *value = device->state.predicate_value;
3697 return device->state.predicate;
3698}
Definition: pdh_main.c:94

◆ wined3d_device_get_primitive_type()

void CDECL wined3d_device_get_primitive_type ( const struct wined3d_device device,
enum wined3d_primitive_type primitive_type,
unsigned int patch_vertex_count 
)

Definition at line 3727 of file device.c.

3729{
3730 TRACE("device %p, primitive_type %p, patch_vertex_count %p.\n",
3731 device, primitive_type, patch_vertex_count);
3732
3733 *primitive_type = d3d_primitive_type_from_gl(device->state.gl_primitive_type);
3734 if (patch_vertex_count)
3735 *patch_vertex_count = device->state.gl_patch_vertices;
3736
3737 TRACE("Returning %s.\n", debug_d3dprimitivetype(*primitive_type));
3738}
static enum wined3d_primitive_type d3d_primitive_type_from_gl(GLenum primitive_type)
Definition: device.c:102

◆ wined3d_device_get_ps_cb()

struct wined3d_buffer *CDECL wined3d_device_get_ps_cb ( const struct wined3d_device device,
UINT  idx 
)

Definition at line 2544 of file device.c.

2545{
2546 TRACE("device %p, idx %u.\n", device, idx);
2547
2549}

◆ wined3d_device_get_ps_consts_b()

HRESULT CDECL wined3d_device_get_ps_consts_b ( const struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
BOOL constants 
)

Definition at line 2614 of file device.c.

2616{
2617 TRACE("device %p, start_idx %u, count %u,constants %p.\n",
2618 device, start_idx, count, constants);
2619
2620 if (!constants || start_idx >= WINED3D_MAX_CONSTS_B)
2622
2623 if (count > WINED3D_MAX_CONSTS_B - start_idx)
2624 count = WINED3D_MAX_CONSTS_B - start_idx;
2625 memcpy(constants, &device->state.ps_consts_b[start_idx], count * sizeof(*constants));
2626
2627 return WINED3D_OK;
2628}
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
constants
Definition: resource.c:29
#define WINED3D_MAX_CONSTS_B

Referenced by d3d9_device_GetPixelShaderConstantB().

◆ wined3d_device_get_ps_consts_f()

HRESULT CDECL wined3d_device_get_ps_consts_f ( const struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
struct wined3d_vec4 constants 
)

Definition at line 2708 of file device.c.

2710{
2711 const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
2712
2713 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2714 device, start_idx, count, constants);
2715
2716 if (!constants || start_idx >= d3d_info->limits.ps_uniform_count
2717 || count > d3d_info->limits.ps_uniform_count - start_idx)
2719
2720 memcpy(constants, &device->state.ps_consts_f[start_idx], count * sizeof(*constants));
2721
2722 return WINED3D_OK;
2723}
struct wined3d_d3d_limits limits

Referenced by d3d8_device_GetPixelShaderConstant(), and d3d9_device_GetPixelShaderConstantF().

◆ wined3d_device_get_ps_consts_i()

HRESULT CDECL wined3d_device_get_ps_consts_i ( const struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
struct wined3d_ivec4 constants 
)

Definition at line 2663 of file device.c.

2665{
2666 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2667 device, start_idx, count, constants);
2668
2669 if (!constants || start_idx >= WINED3D_MAX_CONSTS_I)
2671
2672 if (count > WINED3D_MAX_CONSTS_I - start_idx)
2673 count = WINED3D_MAX_CONSTS_I - start_idx;
2674 memcpy(constants, &device->state.ps_consts_i[start_idx], count * sizeof(*constants));
2675
2676 return WINED3D_OK;
2677}
#define WINED3D_MAX_CONSTS_I

Referenced by d3d9_device_GetPixelShaderConstantI().

◆ wined3d_device_get_ps_resource_view()

struct wined3d_shader_resource_view *CDECL wined3d_device_get_ps_resource_view ( const struct wined3d_device device,
UINT  idx 
)

Definition at line 2559 of file device.c.

2561{
2562 TRACE("device %p, idx %u.\n", device, idx);
2563
2565}

◆ wined3d_device_get_ps_sampler()

struct wined3d_sampler *CDECL wined3d_device_get_ps_sampler ( const struct wined3d_device device,
UINT  idx 
)

Definition at line 2574 of file device.c.

2575{
2576 TRACE("device %p, idx %u.\n", device, idx);
2577
2579}

◆ wined3d_device_get_raster_status()

HRESULT CDECL wined3d_device_get_raster_status ( const struct wined3d_device device,
UINT  swapchain_idx,
struct wined3d_raster_status raster_status 
)

Definition at line 3981 of file device.c.

3983{
3984 struct wined3d_swapchain *swapchain;
3985
3986 TRACE("device %p, swapchain_idx %u, raster_status %p.\n",
3987 device, swapchain_idx, raster_status);
3988
3989 if (!(swapchain = wined3d_device_get_swapchain(device, swapchain_idx)))
3991
3992 return wined3d_swapchain_get_raster_status(swapchain, raster_status);
3993}
HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain, struct wined3d_raster_status *raster_status)
Definition: swapchain.c:239

Referenced by d3d8_device_GetRasterStatus(), and d3d9_device_GetRasterStatus().

◆ wined3d_device_get_rasterizer_state()

struct wined3d_rasterizer_state *CDECL wined3d_device_get_rasterizer_state ( struct wined3d_device device)

Definition at line 2020 of file device.c.

2021{
2022 TRACE("device %p.\n", device);
2023
2024 return device->state.rasterizer_state;
2025}

◆ wined3d_device_get_render_state()

DWORD CDECL wined3d_device_get_render_state ( const struct wined3d_device device,
enum wined3d_render_state  state 
)

Definition at line 2064 of file device.c.

2065{
2066 TRACE("device %p, state %s (%#x).\n", device, debug_d3drenderstate(state), state);
2067
2068 return device->state.render_states[state];
2069}
const char * debug_d3drenderstate(enum wined3d_render_state state)
Definition: utils.c:4370

Referenced by d3d8_device_GetRenderState(), d3d9_device_GetRenderState(), d3d_device7_GetRenderState(), and d3d_vertex_buffer7_ProcessVertices().

◆ wined3d_device_get_rendertarget_view()

struct wined3d_rendertarget_view *CDECL wined3d_device_get_rendertarget_view ( const struct wined3d_device device,
unsigned int  view_idx 
)

Definition at line 4447 of file device.c.

4449{
4450 TRACE("device %p, view_idx %u.\n", device, view_idx);
4451
4452 if (view_idx >= device->adapter->gl_info.limits.buffers)
4453 {
4454 WARN("Only %u render targets are supported.\n", device->adapter->gl_info.limits.buffers);
4455 return NULL;
4456 }
4457
4458 return device->fb.render_targets[view_idx];
4459}

Referenced by d3d8_device_GetRenderTarget(), d3d8_device_SetRenderTarget(), d3d9_device_GetRenderTarget(), d3d9_device_reset(), ddraw_set_cooperative_level(), ddraw_surface7_Flip(), and device_init().

◆ wined3d_device_get_sampler()

static struct wined3d_sampler * wined3d_device_get_sampler ( const struct wined3d_device device,
enum wined3d_shader_type  shader_type,
unsigned int  idx 
)
static

Definition at line 2347 of file device.c.

2349{
2350 if (idx >= MAX_SAMPLER_OBJECTS)
2351 {
2352 WARN("Invalid sampler index %u.\n", idx);
2353 return NULL;
2354 }
2355
2356 return device->state.sampler[shader_type][idx];
2357}
#define MAX_SAMPLER_OBJECTS

Referenced by wined3d_device_get_cs_sampler(), wined3d_device_get_ds_sampler(), wined3d_device_get_gs_sampler(), wined3d_device_get_hs_sampler(), wined3d_device_get_ps_sampler(), and wined3d_device_get_vs_sampler().

◆ wined3d_device_get_sampler_state()

DWORD CDECL wined3d_device_get_sampler_state ( const struct wined3d_device device,
UINT  sampler_idx,
enum wined3d_sampler_state  state 
)

Definition at line 2108 of file device.c.

2110{
2111 TRACE("device %p, sampler_idx %u, state %s.\n",
2112 device, sampler_idx, debug_d3dsamplerstate(state));
2113
2114 if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
2116
2117 if (sampler_idx >= ARRAY_SIZE(device->state.sampler_states))
2118 {
2119 WARN("Invalid sampler %u.\n", sampler_idx);
2120 return 0; /* Windows accepts overflowing this array ... we do not. */
2121 }
2122
2123 return device->state.sampler_states[sampler_idx][state];
2124}
const char * debug_d3dsamplerstate(enum wined3d_sampler_state state)
Definition: utils.c:4514
#define WINED3DVERTEXTEXTURESAMPLER3
Definition: wined3d.h:1028
#define WINED3DVERTEXTEXTURESAMPLER0
Definition: wined3d.h:1025
#define MAX_FRAGMENT_SAMPLERS

Referenced by d3d8_device_GetTextureStageState(), d3d9_device_GetSamplerState(), d3d_device7_GetRenderState(), and d3d_device7_GetTextureStageState().

◆ wined3d_device_get_scissor_rect()

void CDECL wined3d_device_get_scissor_rect ( const struct wined3d_device device,
RECT rect 
)

Definition at line 2149 of file device.c.

2150{
2151 TRACE("device %p, rect %p.\n", device, rect);
2152
2153 *rect = device->state.scissor_rect;
2154 TRACE("Returning rect %s.\n", wine_dbgstr_rect(rect));
2155}

Referenced by d3d9_device_GetScissorRect().

◆ wined3d_device_get_shader_resource_view()

static struct wined3d_shader_resource_view * wined3d_device_get_shader_resource_view ( const struct wined3d_device device,
enum wined3d_shader_type  shader_type,
unsigned int  idx 
)
static

Definition at line 2296 of file device.c.

2298{
2300 {
2301 WARN("Invalid view index %u.\n", idx);
2302 return NULL;
2303 }
2304
2305 return device->state.shader_resource_view[shader_type][idx];
2306}
#define MAX_SHADER_RESOURCE_VIEWS

Referenced by wined3d_device_get_cs_resource_view(), wined3d_device_get_ds_resource_view(), wined3d_device_get_gs_resource_view(), wined3d_device_get_hs_resource_view(), wined3d_device_get_ps_resource_view(), and wined3d_device_get_vs_resource_view().

◆ wined3d_device_get_software_vertex_processing()

BOOL CDECL wined3d_device_get_software_vertex_processing ( const struct wined3d_device device)

Definition at line 3974 of file device.c.

3975{
3976 TRACE("device %p.\n", device);
3977
3978 return device->softwareVertexProcessing;
3979}

Referenced by d3d9_device_GetSoftwareVertexProcessing().

◆ wined3d_device_get_stream_output()

struct wined3d_buffer *CDECL wined3d_device_get_stream_output ( struct wined3d_device device,
UINT  idx,
UINT offset 
)

Definition at line 1362 of file device.c.

1364{
1365 TRACE("device %p, idx %u, offset %p.\n", device, idx, offset);
1366
1368 {
1369 WARN("Invalid stream output %u.\n", idx);
1370 return NULL;
1371 }
1372
1373 if (offset)
1374 *offset = device->state.stream_output[idx].offset;
1375 return device->state.stream_output[idx].buffer;
1376}
#define WINED3D_MAX_STREAM_OUTPUT_BUFFERS
Definition: wined3d.h:1569

◆ wined3d_device_get_stream_source()

HRESULT CDECL wined3d_device_get_stream_source ( const struct wined3d_device device,
UINT  stream_idx,
struct wined3d_buffer **  buffer,
UINT offset,
UINT stride 
)

Definition at line 1428 of file device.c.

1430{
1431 const struct wined3d_stream_state *stream;
1432
1433 TRACE("device %p, stream_idx %u, buffer %p, offset %p, stride %p.\n",
1434 device, stream_idx, buffer, offset, stride);
1435
1436 if (stream_idx >= MAX_STREAMS)
1437 {
1438 WARN("Stream index %u out of range.\n", stream_idx);
1440 }
1441
1442 stream = &device->state.streams[stream_idx];
1443 *buffer = stream->buffer;
1444 if (offset)
1445 *offset = stream->offset;
1446 *stride = stream->stride;
1447
1448 return WINED3D_OK;
1449}
GLsizei stride
Definition: glext.h:5848
Definition: parse.h:23

Referenced by d3d8_device_GetStreamSource(), d3d9_device_GetStreamSource(), and d3d_vertex_buffer7_Release().

◆ wined3d_device_get_stream_source_freq()

HRESULT CDECL wined3d_device_get_stream_source_freq ( const struct wined3d_device device,
UINT  stream_idx,
UINT divider 
)

Definition at line 1490 of file device.c.

1492{
1493 const struct wined3d_stream_state *stream;
1494
1495 TRACE("device %p, stream_idx %u, divider %p.\n", device, stream_idx, divider);
1496
1497 stream = &device->state.streams[stream_idx];
1498 *divider = stream->flags | stream->frequency;
1499
1500 TRACE("Returning %#x.\n", *divider);
1501
1502 return WINED3D_OK;
1503}

Referenced by d3d9_device_GetStreamSourceFreq().

◆ wined3d_device_get_swapchain()

struct wined3d_swapchain *CDECL wined3d_device_get_swapchain ( const struct wined3d_device device,
UINT  swapchain_idx 
)

Definition at line 533 of file device.c.

534{
535 TRACE("device %p, swapchain_idx %u.\n", device, swapchain_idx);
536
537 if (swapchain_idx >= device->swapchain_count)
538 {
539 WARN("swapchain_idx %u >= swapchain_count %u.\n",
540 swapchain_idx, device->swapchain_count);
541 return NULL;
542 }
543
544 return device->swapchains[swapchain_idx];
545}

Referenced by d3d8_device_CreateAdditionalSwapChain(), d3d9_device_CreateAdditionalSwapChain(), d3d9_device_get_swapchains(), ddraw_create_swapchain(), device_init(), wined3d_device_get_display_mode(), wined3d_device_get_gamma_ramp(), wined3d_device_get_raster_status(), wined3d_device_reset(), and wined3d_device_set_gamma_ramp().

◆ wined3d_device_get_swapchain_count()

UINT CDECL wined3d_device_get_swapchain_count ( const struct wined3d_device device)

Definition at line 526 of file device.c.

527{
528 TRACE("device %p.\n", device);
529
530 return device->swapchain_count;
531}

Referenced by d3d8_device_CreateAdditionalSwapChain(), d3d9_device_CreateAdditionalSwapChain(), d3d9_device_get_swapchains(), and d3d9_device_GetNumberOfSwapChains().

◆ wined3d_device_get_texture()

struct wined3d_texture *CDECL wined3d_device_get_texture ( const struct wined3d_device device,
UINT  stage 
)

Definition at line 3510 of file device.c.

3511{
3512 TRACE("device %p, stage %u.\n", device, stage);
3513
3516
3517 if (stage >= ARRAY_SIZE(device->state.textures))
3518 {
3519 WARN("Ignoring invalid stage %u.\n", stage);
3520 return NULL; /* Windows accepts overflowing this array ... we do not. */
3521 }
3522
3523 return device->state.textures[stage];
3524}

Referenced by d3d8_device_GetTexture(), d3d9_device_GetTexture(), d3d_device3_GetRenderState(), d3d_device3_SetRenderState(), d3d_device3_SetTexture(), and d3d_device7_GetTexture().

◆ wined3d_device_get_texture_stage_state()

DWORD CDECL wined3d_device_get_texture_stage_state ( const struct wined3d_device device,
UINT  stage,
enum wined3d_texture_stage_state  state 
)

Definition at line 3447 of file device.c.

3449{
3450 TRACE("device %p, stage %u, state %s.\n",
3452
3454 {
3455 WARN("Invalid state %#x passed.\n", state);
3456 return 0;
3457 }
3458
3459 return device->state.texture_states[stage][state];
3460}
const char * debug_d3dtexturestate(enum wined3d_texture_stage_state state)
Definition: utils.c:4559
#define WINED3D_HIGHEST_TEXTURE_STATE
Definition: wined3d.h:595

Referenced by d3d8_device_GetTextureStageState(), d3d9_device_GetTextureStageState(), d3d_device3_GetRenderState(), and d3d_device7_GetTextureStageState().

◆ wined3d_device_get_transform()

void CDECL wined3d_device_get_transform ( const struct wined3d_device device,
enum wined3d_transform_state  state,
struct wined3d_matrix matrix 
)

Definition at line 1540 of file device.c.

1542{
1543 TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix);
1544
1545 *matrix = device->state.transforms[state];
1546}
const char * debug_d3dtstype(enum wined3d_transform_state tstype)
Definition: utils.c:4627
GLuint GLenum matrix
Definition: glext.h:9407

Referenced by d3d8_device_GetTransform(), d3d9_device_GetTransform(), d3d_device7_GetTransform(), d3d_viewport_TransformVertices(), prepare_clip_space_planes(), and process_vertices_strided().

◆ wined3d_device_get_unordered_access_view()

struct wined3d_unordered_access_view *CDECL wined3d_device_get_unordered_access_view ( const struct wined3d_device device,
unsigned int  idx 
)

Definition at line 3060 of file device.c.

3062{
3063 TRACE("device %p, idx %u.\n", device, idx);
3064
3066}
@ WINED3D_PIPELINE_GRAPHICS

◆ wined3d_device_get_vertex_declaration()

struct wined3d_vertex_declaration *CDECL wined3d_device_get_vertex_declaration ( const struct wined3d_device device)

Definition at line 2179 of file device.c.

2180{
2181 TRACE("device %p.\n", device);
2182
2183 return device->state.vertex_declaration;
2184}

Referenced by d3d8_device_GetVertexShader(), d3d9_device_GetFVF(), and d3d9_device_GetVertexDeclaration().

◆ wined3d_device_get_vertex_shader()

struct wined3d_shader *CDECL wined3d_device_get_vertex_shader ( const struct wined3d_device device)

Definition at line 2207 of file device.c.

2208{
2209 TRACE("device %p.\n", device);
2210
2211 return device->state.shader[WINED3D_SHADER_TYPE_VERTEX];
2212}
@ WINED3D_SHADER_TYPE_VERTEX

Referenced by d3d8_device_DeleteVertexShader(), and d3d9_device_GetVertexShader().

◆ wined3d_device_get_viewport()

void CDECL wined3d_device_get_viewport ( const struct wined3d_device device,
struct wined3d_viewport viewport 
)

Definition at line 1950 of file device.c.

1951{
1952 TRACE("device %p, viewport %p.\n", device, viewport);
1953
1954 *viewport = device->state.viewport;
1955}

Referenced by d3d8_device_GetViewport(), d3d9_device_GetViewport(), d3d_device7_GetViewport(), and process_vertices_strided().

◆ wined3d_device_get_vs_cb()

struct wined3d_buffer *CDECL wined3d_device_get_vs_cb ( const struct wined3d_device device,
UINT  idx 
)

Definition at line 2257 of file device.c.

2258{
2259 TRACE("device %p, idx %u.\n", device, idx);
2260
2262}

◆ wined3d_device_get_vs_consts_b()

HRESULT CDECL wined3d_device_get_vs_consts_b ( const struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
BOOL constants 
)

Definition at line 2399 of file device.c.

2401{
2402 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2403 device, start_idx, count, constants);
2404
2405 if (!constants || start_idx >= WINED3D_MAX_CONSTS_B)
2407
2408 if (count > WINED3D_MAX_CONSTS_B - start_idx)
2409 count = WINED3D_MAX_CONSTS_B - start_idx;
2410 memcpy(constants, &device->state.vs_consts_b[start_idx], count * sizeof(*constants));
2411
2412 return WINED3D_OK;
2413}

Referenced by d3d9_device_GetVertexShaderConstantB().

◆ wined3d_device_get_vs_consts_f()

HRESULT CDECL wined3d_device_get_vs_consts_f ( const struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
struct wined3d_vec4 constants 
)

Definition at line 2492 of file device.c.

2494{
2495 const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
2496
2497 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2498 device, start_idx, count, constants);
2499
2500 if (!constants || start_idx >= d3d_info->limits.vs_uniform_count
2501 || count > d3d_info->limits.vs_uniform_count - start_idx)
2503
2504 memcpy(constants, &device->state.vs_consts_f[start_idx], count * sizeof(*constants));
2505
2506 return WINED3D_OK;
2507}

Referenced by d3d8_device_GetVertexShaderConstant(), and d3d9_device_GetVertexShaderConstantF().

◆ wined3d_device_get_vs_consts_i()

HRESULT CDECL wined3d_device_get_vs_consts_i ( const struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
struct wined3d_ivec4 constants 
)

Definition at line 2448 of file device.c.

2450{
2451 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2452 device, start_idx, count, constants);
2453
2454 if (!constants || start_idx >= WINED3D_MAX_CONSTS_I)
2456
2457 if (count > WINED3D_MAX_CONSTS_I - start_idx)
2458 count = WINED3D_MAX_CONSTS_I - start_idx;
2459 memcpy(constants, &device->state.vs_consts_i[start_idx], count * sizeof(*constants));
2460 return WINED3D_OK;
2461}

Referenced by d3d9_device_GetVertexShaderConstantI().

◆ wined3d_device_get_vs_resource_view()

struct wined3d_shader_resource_view *CDECL wined3d_device_get_vs_resource_view ( const struct wined3d_device device,
UINT  idx 
)

Definition at line 2308 of file device.c.

2310{
2311 TRACE("device %p, idx %u.\n", device, idx);
2312
2314}

◆ wined3d_device_get_vs_sampler()

struct wined3d_sampler *CDECL wined3d_device_get_vs_sampler ( const struct wined3d_device device,
UINT  idx 
)

Definition at line 2359 of file device.c.

2360{
2361 TRACE("device %p, idx %u.\n", device, idx);
2362
2364}

◆ wined3d_device_get_wined3d()

struct wined3d *CDECL wined3d_device_get_wined3d ( const struct wined3d_device device)

Definition at line 5050 of file device.c.

5051{
5052 TRACE("device %p.\n", device);
5053
5054 return device->wined3d;
5055}

◆ wined3d_device_incref()

ULONG CDECL wined3d_device_incref ( struct wined3d_device device)

Definition at line 456 of file device.c.

457{
458 ULONG refcount = InterlockedIncrement(&device->ref);
459
460 TRACE("%p increasing refcount to %u.\n", device, refcount);
461
462 return refcount;
463}
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by d3d_device_init(), and ddraw_surface_create().

◆ wined3d_device_init_3d()

HRESULT CDECL wined3d_device_init_3d ( struct wined3d_device device,
struct wined3d_swapchain_desc swapchain_desc 
)

Definition at line 1061 of file device.c.

1063{
1064 static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
1065 struct wined3d_swapchain *swapchain = NULL;
1066 DWORD clear_flags = 0;
1067 HRESULT hr;
1068
1069 TRACE("device %p, swapchain_desc %p.\n", device, swapchain_desc);
1070
1071 if (device->d3d_initialized)
1073 if (device->wined3d->flags & WINED3D_NO3D)
1075
1076 memset(device->fb.render_targets, 0, sizeof(device->fb.render_targets));
1077
1078 /* Setup the implicit swapchain. This also initializes a context. */
1079 TRACE("Creating implicit swapchain.\n");
1080 if (FAILED(hr = device->device_parent->ops->create_swapchain(device->device_parent,
1081 swapchain_desc, &swapchain)))
1082 {
1083 WARN("Failed to create implicit swapchain.\n");
1084 goto err_out;
1085 }
1086
1087 if (swapchain_desc->backbuffer_count)
1088 {
1089 struct wined3d_resource *back_buffer = &swapchain->back_buffers[0]->resource;
1090 struct wined3d_view_desc view_desc;
1091
1092 view_desc.format_id = back_buffer->format->id;
1093 view_desc.flags = 0;
1094 view_desc.u.texture.level_idx = 0;
1095 view_desc.u.texture.level_count = 1;
1096 view_desc.u.texture.layer_idx = 0;
1097 view_desc.u.texture.layer_count = 1;
1098 if (FAILED(hr = wined3d_rendertarget_view_create(&view_desc, back_buffer,
1099 NULL, &wined3d_null_parent_ops, &device->back_buffer_view)))
1100 {
1101 ERR("Failed to create rendertarget view, hr %#x.\n", hr);
1102 goto err_out;
1103 }
1104 }
1105
1106 device->swapchain_count = 1;
1107 if (!(device->swapchains = heap_calloc(device->swapchain_count, sizeof(*device->swapchains))))
1108 {
1109 ERR("Out of memory!\n");
1110 goto err_out;
1111 }
1112 device->swapchains[0] = swapchain;
1113
1115 goto err_out;
1117
1118 device->contexts[0]->last_was_rhw = 0;
1119
1120 TRACE("All defaults now set up.\n");
1121
1122 /* Clear the screen */
1123 if (swapchain->back_buffers && swapchain->back_buffers[0])
1124 clear_flags |= WINED3DCLEAR_TARGET;
1125 if (swapchain_desc->enable_auto_depth_stencil)
1127 if (clear_flags)
1128 wined3d_device_clear(device, 0, NULL, clear_flags, &black, 1.0f, 0);
1129
1130 device->d3d_initialized = TRUE;
1131
1134 return WINED3D_OK;
1135
1136err_out:
1137 heap_free(device->swapchains);
1138 device->swapchain_count = 0;
1139 if (device->back_buffer_view)
1140 wined3d_rendertarget_view_decref(device->back_buffer_view);
1141 if (swapchain)
1142 wined3d_swapchain_decref(swapchain);
1143
1144 return hr;
1145}
static HRESULT wined3d_device_create_primary_opengl_context(struct wined3d_device *device)
Definition: device.c:1051
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
Definition: device.c:3633
static void device_load_logo(struct wined3d_device *device, const char *filename)
Definition: device.c:547
static void device_init_swapchain_state(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
Definition: device.c:962
HRESULT CDECL wined3d_rendertarget_view_create(const struct wined3d_view_desc *desc, struct wined3d_resource *resource, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view)
Definition: view.c:598
ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view)
Definition: view.c:348
static void * heap_calloc(SIZE_T count, SIZE_T size)
Definition: heap.h:49
BOOL enable_auto_depth_stencil
Definition: wined3d.h:1742
struct wined3d_texture ** back_buffers
enum wined3d_format_id format_id
Definition: wined3d.h:2080
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:113
#define WINED3D_NO3D
Definition: wined3d.h:1316

Referenced by ddraw_attach_d3d_device(), and device_init().

◆ wined3d_device_init_gdi()

HRESULT CDECL wined3d_device_init_gdi ( struct wined3d_device device,
struct wined3d_swapchain_desc swapchain_desc 
)

Definition at line 1147 of file device.c.

1149{
1150 struct wined3d_swapchain *swapchain = NULL;
1151 HRESULT hr;
1152
1153 TRACE("device %p, swapchain_desc %p.\n", device, swapchain_desc);
1154
1155 /* Setup the implicit swapchain */
1156 TRACE("Creating implicit swapchain\n");
1157 hr = device->device_parent->ops->create_swapchain(device->device_parent,
1158 swapchain_desc, &swapchain);
1159 if (FAILED(hr))
1160 {
1161 WARN("Failed to create implicit swapchain\n");
1162 goto err_out;
1163 }
1164
1165 device->swapchain_count = 1;
1166 if (!(device->swapchains = heap_calloc(device->swapchain_count, sizeof(*device->swapchains))))
1167 {
1168 ERR("Out of memory!\n");
1169 goto err_out;
1170 }
1171 device->swapchains[0] = swapchain;
1172
1173 if (!(device->blitter = wined3d_cpu_blitter_create()))
1174 {
1175 ERR("Failed to create CPU blitter.\n");
1176 heap_free(device->swapchains);
1177 device->swapchain_count = 0;
1178 goto err_out;
1179 }
1180
1181 return WINED3D_OK;
1182
1183err_out:
1184 wined3d_swapchain_decref(swapchain);
1185 return hr;
1186}

Referenced by ddraw_create_swapchain().

◆ wined3d_device_multiply_transform()

void CDECL wined3d_device_multiply_transform ( struct wined3d_device device,
enum wined3d_transform_state  state,
const struct wined3d_matrix matrix 
)

Definition at line 1548 of file device.c.

1550{
1551 const struct wined3d_matrix *mat;
1552 struct wined3d_matrix temp;
1553
1554 TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix);
1555
1556 /* Note: Using 'updateStateBlock' rather than 'stateblock' in the code
1557 * below means it will be recorded in a state block change, but it
1558 * works regardless where it is recorded.
1559 * If this is found to be wrong, change to StateBlock. */
1561 {
1562 WARN("Unhandled transform state %#x.\n", state);
1563 return;
1564 }
1565
1566 mat = &device->update_state->transforms[state];
1568
1569 /* Apply change via set transform - will reapply to eg. lights this way. */
1571}
void CDECL wined3d_device_set_transform(struct wined3d_device *device, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix)
Definition: device.c:1505
static calc_node_t temp
Definition: rpn_ieee.c:38
#define HIGHEST_TRANSFORMSTATE

Referenced by d3d8_device_MultiplyTransform(), d3d9_device_MultiplyTransform(), and d3d_device7_MultiplyTransform().

◆ wined3d_device_process_vertices()

HRESULT CDECL wined3d_device_process_vertices ( struct wined3d_device device,
UINT  src_start_idx,
UINT  dst_idx,
UINT  vertex_count,
struct wined3d_buffer dst_buffer,
const struct wined3d_vertex_declaration declaration,
DWORD  flags,
DWORD  dst_fvf 
)

Definition at line 3340 of file device.c.

3343{
3344 struct wined3d_state *state = &device->state;
3346 struct wined3d_resource *resource;
3347 struct wined3d_box box = {0};
3348 struct wined3d_shader *vs;
3349 unsigned int i;
3350 HRESULT hr;
3351 WORD map;
3352
3353 TRACE("device %p, src_start_idx %u, dst_idx %u, vertex_count %u, "
3354 "dst_buffer %p, declaration %p, flags %#x, dst_fvf %#x.\n",
3355 device, src_start_idx, dst_idx, vertex_count,
3356 dst_buffer, declaration, flags, dst_fvf);
3357
3358 if (declaration)
3359 FIXME("Output vertex declaration not implemented yet.\n");
3360
3363 wined3d_stream_info_from_declaration(&stream_info, state, &device->adapter->gl_info, &device->adapter->d3d_info);
3365
3366 /* We can't convert FROM a VBO, and vertex buffers used to source into
3367 * process_vertices() are unlikely to ever be used for drawing. Release
3368 * VBOs in those buffers and fix up the stream_info structure.
3369 *
3370 * Also apply the start index. */
3371 for (i = 0, map = stream_info.use_map; map; map >>= 1, ++i)
3372 {
3374 struct wined3d_map_desc map_desc;
3375
3376 if (!(map & 1))
3377 continue;
3378
3379 e = &stream_info.elements[i];
3380 resource = &state->streams[e->stream_idx].buffer->resource;
3381 box.left = src_start_idx * e->stride;
3382 box.right = box.left + vertex_count * e->stride;
3384 ERR("Failed to map resource.\n");
3385 e->data.buffer_object = 0;
3386 e->data.addr += (ULONG_PTR)map_desc.data;
3387 }
3388
3390 &stream_info, dst_buffer, flags, dst_fvf);
3391
3392 for (i = 0, map = stream_info.use_map; map; map >>= 1, ++i)
3393 {
3394 if (!(map & 1))
3395 continue;
3396
3397 resource = &state->streams[stream_info.elements[i].stream_idx].buffer->resource;
3399 ERR("Failed to unmap resource.\n");
3400 }
3401
3402 return hr;
3403}
Definition: _map.h:48
void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_info, const struct wined3d_state *state, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info)
Definition: context.c:3523
static HRESULT process_vertices_strided(const struct wined3d_device *device, DWORD dwDestIndex, DWORD dwCount, const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD flags, DWORD DestFVF)
Definition: device.c:3070
#define ULONG_PTR
Definition: config.h:101
unsigned short WORD
Definition: ntddk_ex.h:93
#define e
Definition: ke_i.h:82
static vector_t * vs
Definition: server.c:127

Referenced by d3d8_device_ProcessVertices(), d3d9_device_ProcessVertices(), and d3d_vertex_buffer7_ProcessVertices().

◆ wined3d_device_release_focus_window()

void CDECL wined3d_device_release_focus_window ( struct wined3d_device device)

Definition at line 954 of file device.c.

955{
956 TRACE("device %p.\n", device);
957
958 if (device->focus_window) wined3d_unregister_window(device->focus_window);
959 InterlockedExchangePointer((void **)&device->focus_window, NULL);
960}

Referenced by d3d8_device_Release(), d3d9_device_Release(), ddraw_set_cooperative_level(), device_init(), swapchain_cleanup(), and wined3d_swapchain_set_fullscreen().

◆ wined3d_device_reset()

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 at line 4771 of file device.c.

4774{
4776 struct wined3d_swapchain *swapchain;
4777 struct wined3d_view_desc view_desc;
4778 BOOL backbuffer_resized;
4780 unsigned int i;
4781
4782 TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n",
4783 device, swapchain_desc, mode, callback, reset_state);
4784
4785 device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
4786
4787 if (!(swapchain = wined3d_device_get_swapchain(device, 0)))
4788 {
4789 ERR("Failed to get the first implicit swapchain.\n");
4791 }
4792
4793 if (reset_state)
4794 {
4795 if (device->logo_texture)
4796 {
4797 wined3d_texture_decref(device->logo_texture);
4798 device->logo_texture = NULL;
4799 }
4800 if (device->cursor_texture)
4801 {
4802 wined3d_texture_decref(device->cursor_texture);
4803 device->cursor_texture = NULL;
4804 }
4806 }
4807
4808 for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
4809 {
4811 }
4813
4814 if (reset_state)
4815 {
4816 LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
4817 {
4818 TRACE("Enumerating resource %p.\n", resource);
4819 if (FAILED(hr = callback(resource)))
4820 return hr;
4821 }
4822 }
4823
4824 TRACE("New params:\n");
4825 TRACE("backbuffer_width %u\n", swapchain_desc->backbuffer_width);
4826 TRACE("backbuffer_height %u\n", swapchain_desc->backbuffer_height);
4827 TRACE("backbuffer_format %s\n", debug_d3dformat(swapchain_desc->backbuffer_format));
4828 TRACE("backbuffer_count %u\n", swapchain_desc->backbuffer_count);
4829 TRACE("multisample_type %#x\n", swapchain_desc->multisample_type);
4830 TRACE("multisample_quality %u\n", swapchain_desc->multisample_quality);
4831 TRACE("swap_effect %#x\n", swapchain_desc->swap_effect);
4832 TRACE("device_window %p\n", swapchain_desc->device_window);
4833 TRACE("windowed %#x\n", swapchain_desc->windowed);
4834 TRACE("enable_auto_depth_stencil %#x\n", swapchain_desc->enable_auto_depth_stencil);
4835 if (swapchain_desc->enable_auto_depth_stencil)
4836 TRACE("auto_depth_stencil_format %s\n", debug_d3dformat(swapchain_desc->auto_depth_stencil_format));
4837 TRACE("flags %#x\n", swapchain_desc->flags);
4838 TRACE("refresh_rate %u\n", swapchain_desc->refresh_rate);
4839 TRACE("swap_interval %u\n", swapchain_desc->swap_interval);
4840 TRACE("auto_restore_display_mode %#x\n", swapchain_desc->auto_restore_display_mode);
4841
4842 if (swapchain_desc->backbuffer_usage != WINED3DUSAGE_RENDERTARGET)
4843 FIXME("Got unexpected backbuffer usage %#x.\n", swapchain_desc->backbuffer_usage);
4844
4845 if (swapchain_desc->swap_effect != WINED3D_SWAP_EFFECT_DISCARD
4846 && swapchain_desc->swap_effect != WINED3D_SWAP_EFFECT_SEQUENTIAL
4847 && swapchain_desc->swap_effect != WINED3D_SWAP_EFFECT_COPY)
4848 FIXME("Unimplemented swap effect %#x.\n", swapchain_desc->swap_effect);
4849
4850 /* No special treatment of these parameters. Just store them */
4851 swapchain->desc.swap_effect = swapchain_desc->swap_effect;
4852 swapchain->desc.enable_auto_depth_stencil = swapchain_desc->enable_auto_depth_stencil;
4853 swapchain->desc.auto_depth_stencil_format = swapchain_desc->auto_depth_stencil_format;
4854 swapchain->desc.flags = swapchain_desc->flags;
4855 swapchain->desc.refresh_rate = swapchain_desc->refresh_rate;
4856 swapchain->desc.swap_interval = swapchain_desc->swap_interval;
4857 swapchain->desc.auto_restore_display_mode = swapchain_desc->auto_restore_display_mode;
4858
4859 if (swapchain_desc->device_window
4860 && swapchain_desc->device_window != swapchain->desc.device_window)
4861 {
4862 TRACE("Changing the device window from %p to %p.\n",
4863 swapchain->desc.device_window, swapchain_desc->device_window);
4864 swapchain->desc.device_window = swapchain_desc->device_window;
4865 swapchain->device_window = swapchain_desc->device_window;
4867 }
4868
4869 backbuffer_resized = swapchain_desc->backbuffer_width != swapchain->desc.backbuffer_width
4870 || swapchain_desc->backbuffer_height != swapchain->desc.backbuffer_height;
4871
4872 if (!swapchain_desc->windowed != !swapchain->desc.windowed
4873 || swapchain->reapply_mode || mode
4874 || (!swapchain_desc->windowed && backbuffer_resized))
4875 {
4876 if (FAILED(hr = wined3d_swapchain_set_fullscreen(swapchain, swapchain_desc, mode)))
4877 return hr;
4878 }
4879 else if (!swapchain_desc->windowed)
4880 {
4881 DWORD style = device->style;
4882 DWORD exStyle = device->exStyle;
4883 /* If we're in fullscreen, and the mode wasn't changed, we have to get the window back into
4884 * the right position. Some applications(Battlefield 2, Guild Wars) move it and then call
4885 * Reset to clear up their mess. Guild Wars also loses the device during that.
4886 */
4887 device->style = 0;
4888 device->exStyle = 0;
4890 swapchain_desc->backbuffer_width,
4891 swapchain_desc->backbuffer_height);
4892 device->style = style;
4893 device->exStyle = exStyle;
4894 }
4895
4896 if (FAILED(hr = wined3d_swapchain_resize_buffers(swapchain, swapchain_desc->backbuffer_count,
4897 swapchain_desc->backbuffer_width, swapchain_desc->backbuffer_height, swapchain_desc->backbuffer_format,
4898 swapchain_desc->multisample_type, swapchain_desc->multisample_quality)))
4899 return hr;
4900
4901 if (device->auto_depth_stencil_view)
4902 {
4903 wined3d_rendertarget_view_decref(device->auto_depth_stencil_view);
4904 device->auto_depth_stencil_view = NULL;
4905 }
4906 if (swapchain->desc.enable_auto_depth_stencil)
4907 {
4908 struct wined3d_resource_desc texture_desc;
4909 struct wined3d_texture *texture;
4910 DWORD flags = 0;
4911
4912 TRACE("Creating the depth stencil buffer.\n");
4913
4914 texture_desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
4915 texture_desc.format = swapchain->desc.auto_depth_stencil_format;
4916 texture_desc.multisample_type = swapchain->desc.multisample_type;
4917 texture_desc.multisample_quality = swapchain->desc.multisample_quality;
4918 texture_desc.usage = WINED3DUSAGE_DEPTHSTENCIL;
4919 texture_desc.access = WINED3D_RESOURCE_ACCESS_GPU;
4920 texture_desc.width = swapchain->desc.backbuffer_width;
4921 texture_desc.height = swapchain->desc.backbuffer_height;
4922 texture_desc.depth = 1;
4923 texture_desc.size = 0;
4924
4925 if (swapchain_desc->flags & WINED3D_SWAPCHAIN_GDI_COMPATIBLE)
4927
4928 if (FAILED(hr = device->device_parent->ops->create_swapchain_texture(device->device_parent,
4929 device->device_parent, &texture_desc, flags, &texture)))
4930 {
4931 ERR("Failed to create the auto depth/stencil surface, hr %#x.\n", hr);
4933 }
4934
4935 view_desc.format_id = texture->resource.format->id;
4936 view_desc.flags = 0;
4937 view_desc.u.texture.level_idx = 0;
4938 view_desc.u.texture.level_count = 1;
4939 view_desc.u.texture.layer_idx = 0;
4940 view_desc.u.texture.layer_count = 1;
4941 hr = wined3d_rendertarget_view_create(&view_desc, &texture->resource,
4942 NULL, &wined3d_null_parent_ops, &device->auto_depth_stencil_view);
4944 if (FAILED(hr))
4945 {
4946 ERR("Failed to create rendertarget view, hr %#x.\n", hr);
4947 return hr;
4948 }
4949
4950 wined3d_device_set_depth_stencil_view(device, device->auto_depth_stencil_view);
4951 }
4952
4953 if (device->back_buffer_view)
4954 {
4955 wined3d_rendertarget_view_decref(device->back_buffer_view);
4956 device->back_buffer_view = NULL;
4957 }
4958 if (swapchain->desc.backbuffer_count)
4959 {
4960 struct wined3d_resource *back_buffer = &swapchain->back_buffers[0]->resource;
4961
4962 view_desc.format_id = back_buffer->format->id;
4963 view_desc.flags = 0;
4964 view_desc.u.texture.level_idx = 0;
4965 view_desc.u.texture.level_count = 1;
4966 view_desc.u.texture.layer_idx = 0;
4967 view_desc.u.texture.layer_count = 1;
4968 if (FAILED(hr = wined3d_rendertarget_view_create(&view_desc, back_buffer,
4969 NULL, &wined3d_null_parent_ops, &device->back_buffer_view)))
4970 {
4971 ERR("Failed to create rendertarget view, hr %#x.\n", hr);
4972 return hr;
4973 }
4974 }
4975
4977
4978 if (reset_state)
4979 {
4980 TRACE("Resetting stateblock.\n");
4981 if (device->recording)
4982 {
4984 device->recording = NULL;
4985 }
4987 state_cleanup(&device->state);
4988
4989 if (device->d3d_initialized)
4991
4992 memset(&device->state, 0, sizeof(device->state));
4993 state_init(&device->state, &device->fb, &device->adapter->gl_info,
4994 &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT);
4995 device->update_state = &device->state;
4996
5000 }
5001 else if (device->back_buffer_view)
5002 {
5003 struct wined3d_rendertarget_view *view = device->back_buffer_view;
5004 struct wined3d_state *state = &device->state;
5005
5007
5008 /* Note the min_z / max_z is not reset. */
5009 state->viewport.x = 0;
5010 state->viewport.y = 0;
5011 state->viewport.width = view->width;
5012 state->viewport.height = view->height;
5013 wined3d_cs_emit_set_viewport(device->cs, &state->viewport);
5014
5015 SetRect(&state->scissor_rect, 0, 0, view->width, view->height);
5016 wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
5017 }
5018
5019 if (device->d3d_initialized)
5020 {
5021 if (reset_state)
5024 }
5025
5026 /* All done. There is no need to reload resources or shaders, this will happen automatically on the
5027 * first use
5028 */
5029 return hr;
5030}
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
Definition: cs.c:988
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport)
Definition: cs.c:969
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
Definition: cs.c:1856
void CDECL wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h)
Definition: device.c:853
static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
Definition: device.c:1011
static void device_free_sampler(struct wine_rb_entry *entry, void *context)
Definition: device.c:1188
static IPrintDialogCallback callback
Definition: printdlg.c:326
static void wine_rb_clear(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
Definition: rbtree.h:191
BOOL auto_restore_display_mode
Definition: wined3d.h:1747
enum wined3d_multisample_type multisample_type
Definition: wined3d.h:1737
enum wined3d_format_id auto_depth_stencil_format
Definition: wined3d.h:1743
enum wined3d_format_id backbuffer_format
Definition: wined3d.h:1734
enum wined3d_swap_effect swap_effect
Definition: wined3d.h:1739
void state_unbind_resources(struct wined3d_state *state)
Definition: stateblock.c:429
void swapchain_update_swap_interval(struct wined3d_swapchain *swapchain)
Definition: swapchain.c:1144
void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window)
Definition: swapchain.c:140
HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count, unsigned int width, unsigned int height, enum wined3d_format_id format_id, enum wined3d_multisample_type multisample_type, unsigned int multisample_quality)
Definition: swapchain.c:1200
HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapchain, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode)
Definition: swapchain.c:1369
@ WINED3D_SWAP_EFFECT_COPY
Definition: wined3d.h:529
@ WINED3D_SWAP_EFFECT_SEQUENTIAL
Definition: wined3d.h:526
@ WINED3D_SWAP_EFFECT_DISCARD
Definition: wined3d.h:525
#define WINED3D_SWAPCHAIN_GDI_COMPATIBLE
Definition: wined3d.h:886
#define WINED3DUSAGE_RENDERTARGET
Definition: wined3d.h:899
#define WINED3DUSAGE_DEPTHSTENCIL
Definition: wined3d.h:900

Referenced by d3d8_device_Reset(), d3d9_device_reset(), and ddraw_surface_create().

◆ wined3d_device_resolve_sub_resource()

void CDECL wined3d_device_resolve_sub_resource ( struct wined3d_device device,
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 at line 4346 of file device.c.

4350{
4351 struct wined3d_texture *dst_texture, *src_texture;
4352 unsigned int dst_level, src_level;
4353 RECT dst_rect, src_rect;
4354
4355 TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, "
4356 "src_resource %p, src_sub_resource_idx %u, format %s.\n",
4357 device, dst_resource, dst_sub_resource_idx,
4358 src_resource, src_sub_resource_idx, debug_d3dformat(format_id));
4359
4360 if (wined3d_format_is_typeless(dst_resource->format)
4361 || wined3d_format_is_typeless(src_resource->format))
4362 {
4363 FIXME("Unhandled multisample resolve, dst_format %s, src_format %s, format %s.\n",
4364 debug_d3dformat(dst_resource->format->id), debug_d3dformat(src_resource->format->id),
4366 return;
4367 }
4368 if (dst_resource->type != WINED3D_RTYPE_TEXTURE_2D)
4369 {
4370 WARN("Invalid destination resource type %s.\n", debug_d3dresourcetype(dst_resource->type));
4371 return;
4372 }
4373 if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D)
4374 {
4375 WARN("Invalid source resource type %s.\n", debug_d3dresourcetype(src_resource->type));
4376 return;
4377 }
4378
4379 dst_texture = texture_from_resource(dst_resource);
4380 src_texture = texture_from_resource(src_resource);
4381
4382 dst_level = dst_sub_resource_idx % dst_texture->level_count;
4383 SetRect(&dst_rect, 0, 0, wined3d_texture_get_level_width(dst_texture, dst_level),
4384 wined3d_texture_get_level_height(dst_texture, dst_level));
4385 src_level = src_sub_resource_idx % src_texture->level_count;
4386 SetRect(&src_rect, 0, 0, wined3d_texture_get_level_width(src_texture, src_level),
4387 wined3d_texture_get_level_height(src_texture, src_level));
4388 wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect,
4389 src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT);
4390}
HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: texture.c:3262
static UINT format_id
Definition: clipboard.c:1343
static BOOL wined3d_format_is_typeless(const struct wined3d_format *format)

Referenced by resolve_depth_buffer().

◆ wined3d_device_restore_fullscreen_window()

void CDECL wined3d_device_restore_fullscreen_window ( struct wined3d_device device,
HWND  window,
const RECT window_rect 
)

Definition at line 885 of file device.c.

887{
888 unsigned int window_pos_flags = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE;
889 BOOL filter_messages;
890 LONG style, exstyle;
891 RECT rect = {0};
892
893 if (!device->style && !device->exStyle)
894 return;
895
898
899 /* These flags are set by wined3d_device_setup_fullscreen_window, not the
900 * application, and we want to ignore them in the test below, since it's
901 * not the application's fault that they changed. Additionally, we want to
902 * preserve the current status of these flags (i.e. don't restore them) to
903 * more closely emulate the behavior of Direct3D, which leaves these flags
904 * alone when returning to windowed mode. */
905 device->style ^= (device->style ^ style) & WS_VISIBLE;
906 device->exStyle ^= (device->exStyle ^ exstyle) & WS_EX_TOPMOST;
907
908 TRACE("Restoring window style of window %p to %08x, %08x.\n",
909 window, device->style, device->exStyle);
910
911 filter_messages = device->filter_messages;
912 device->filter_messages = TRUE;
913
914 /* Only restore the style if the application didn't modify it during the
915 * fullscreen phase. Some applications change it before calling Reset()
916 * when switching between windowed and fullscreen modes (HL2), some
917 * depend on the original style (Eve Online). */
918 if (style == fullscreen_style(device->style) && exstyle == fullscreen_exstyle(device->exStyle))
919 {
922 }
923
924 if (window_rect)
925 rect = *window_rect;
926 else
927 window_pos_flags |= (SWP_NOMOVE | SWP_NOSIZE);
928 SetWindowPos(window, 0, rect.left, rect.top,
929 rect.right - rect.left, rect.bottom - rect.top, window_pos_flags);
930
931 device->filter_messages = filter_messages;
932
933 /* Delete the old values. */
934 device->style = 0;
935 device->exStyle = 0;
936}
static LONG fullscreen_style(LONG style)
Definition: device.c:836
static LONG fullscreen_exstyle(LONG exstyle)
Definition: device.c:845
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_EX_TOPMOST
Definition: pedump.c:647
long LONG
Definition: pedump.c:60
#define SWP_NOACTIVATE
Definition: winuser.h:1245
#define SWP_FRAMECHANGED
Definition: winuser.h:1243
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SWP_NOZORDER
Definition: winuser.h:1250
#define GWL_STYLE
Definition: winuser.h:855
#define GWL_EXSTYLE
Definition: winuser.h:854

Referenced by ddraw_set_cooperative_level(), swapchain_cleanup(), and wined3d_swapchain_set_fullscreen().

◆ wined3d_device_set_base_vertex_index()

void CDECL wined3d_device_set_base_vertex_index ( struct wined3d_device device,
INT  base_index 
)

◆ wined3d_device_set_blend_state()

void CDECL wined3d_device_set_blend_state ( struct wined3d_device device,
struct wined3d_blend_state blend_state 
)

Definition at line 1976 of file device.c.

1977{
1978 struct wined3d_blend_state *prev;
1979
1980 TRACE("device %p, blend_state %p.\n", device, blend_state);
1981
1982 prev = device->update_state->blend_state;
1983 if (prev == blend_state)
1984 return;
1985
1986 if (blend_state)
1987 wined3d_blend_state_incref(blend_state);
1988 device->update_state->blend_state = blend_state;
1989 wined3d_cs_emit_set_blend_state(device->cs, blend_state);
1990 if (prev)
1992}
void wined3d_cs_emit_set_blend_state(struct wined3d_cs *cs, struct wined3d_blend_state *state)
Definition: cs.c:1457
ULONG CDECL wined3d_blend_state_incref(struct wined3d_blend_state *state)
Definition: state.c:44
ULONG CDECL wined3d_blend_state_decref(struct wined3d_blend_state *state)
Definition: state.c:58

◆ wined3d_device_set_clip_plane()

HRESULT CDECL wined3d_device_set_clip_plane ( struct wined3d_device device,
UINT  plane_idx,
const struct wined3d_vec4 plane 
)

Definition at line 1783 of file device.c.

1785{
1786 TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane);
1787
1788 if (plane_idx >= device->adapter->gl_info.limits.user_clip_distances)
1789 {
1790 TRACE("Application has requested clipplane this device doesn't support.\n");
1792 }
1793
1794 if (device->recording)
1795 device->recording->changed.clipplane |= 1u << plane_idx;
1796
1797 if (!memcmp(&device->update_state->clip_planes[plane_idx], plane, sizeof(*plane)))
1798 {
1799 TRACE("Application is setting old values over, nothing to do.\n");
1800 return WINED3D_OK;
1801 }
1802
1803 device->update_state->clip_planes[plane_idx] = *plane;
1804
1805 if (!device->recording)
1807
1808 return WINED3D_OK;
1809}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane)
Definition: cs.c:1582

Referenced by d3d8_device_SetClipPlane(), d3d9_device_SetClipPlane(), d3d_device7_SetClipPlane(), and wined3d_stateblock_apply().

◆ wined3d_device_set_clip_status()

HRESULT CDECL wined3d_device_set_clip_status ( struct wined3d_device device,
const struct wined3d_clip_status clip_status 
)

Definition at line 1827 of file device.c.

1829{
1830 FIXME("device %p, clip_status %p stub!\n", device, clip_status);
1831
1832 if (!clip_status)
1834
1835 return WINED3D_OK;
1836}

Referenced by d3d8_device_SetClipStatus(), and d3d9_device_SetClipStatus().

◆ wined3d_device_set_compute_shader()

void CDECL wined3d_device_set_compute_shader ( struct wined3d_device device,
struct wined3d_shader shader 
)

Definition at line 2930 of file device.c.

2931{
2932 struct wined3d_shader *prev;
2933
2934 TRACE("device %p, shader %p.\n", device, shader);
2935
2936 prev = device->update_state->shader[WINED3D_SHADER_TYPE_COMPUTE];
2937 if (device->recording || shader == prev)
2938 return;
2939 if (shader)
2941 device->update_state->shader[WINED3D_SHADER_TYPE_COMPUTE] = shader;
2943 if (prev)
2945}
void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader)
Definition: cs.c:1437
ULONG CDECL wined3d_shader_incref(struct wined3d_shader *shader)
Definition: shader.c:3339
ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader)
Definition: shader.c:3364

◆ wined3d_device_set_constant_buffer()

static void wined3d_device_set_constant_buffer ( struct wined3d_device device,
enum wined3d_shader_type  type,
UINT  idx,
struct wined3d_buffer buffer 
)
static

Definition at line 2214 of file device.c.

2216{
2217 struct wined3d_buffer *prev;
2218
2220 {
2221 WARN("Invalid constant buffer index %u.\n", idx);
2222 return;
2223 }
2224
2225 prev = device->update_state->cb[type][idx];
2226 if (buffer == prev)
2227 return;
2228
2229 if (buffer)
2231 device->update_state->cb[type][idx] = buffer;
2232 if (!device->recording)
2234 if (prev)
2236}
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT cb_idx, struct wined3d_buffer *buffer)
Definition: cs.c:1228
ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
Definition: buffer.c:525
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:791

Referenced by wined3d_device_set_cs_cb(), wined3d_device_set_ds_cb(), wined3d_device_set_gs_cb(), wined3d_device_set_hs_cb(), wined3d_device_set_ps_cb(), and wined3d_device_set_vs_cb().

◆ wined3d_device_set_cs_cb()

void CDECL wined3d_device_set_cs_cb ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_buffer buffer 
)

Definition at line 2954 of file device.c.

2955{
2956 TRACE("device %p, idx %u, buffer %p.\n", device, idx, buffer);
2957
2959}
static void wined3d_device_set_constant_buffer(struct wined3d_device *device, enum wined3d_shader_type type, UINT idx, struct wined3d_buffer *buffer)
Definition: device.c:2214

◆ wined3d_device_set_cs_resource_view()

void CDECL wined3d_device_set_cs_resource_view ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_shader_resource_view view 
)

Definition at line 2968 of file device.c.

2970{
2971 TRACE("device %p, idx %u, view %p.\n", device, idx, view);
2972
2974}
static void wined3d_device_set_shader_resource_view(struct wined3d_device *device, enum wined3d_shader_type type, UINT idx, struct wined3d_shader_resource_view *view)
Definition: device.c:2264

◆ wined3d_device_set_cs_sampler()

void CDECL wined3d_device_set_cs_sampler ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_sampler sampler 
)

Definition at line 2984 of file device.c.

2986{
2987 TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler);
2988
2990}
static void wined3d_device_set_sampler(struct wined3d_device *device, enum wined3d_shader_type type, UINT idx, struct wined3d_sampler *sampler)
Definition: device.c:2316

◆ wined3d_device_set_cs_uav()

void CDECL wined3d_device_set_cs_uav ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_unordered_access_view uav,
unsigned int  initial_count 
)

Definition at line 3036 of file device.c.

3038{
3039 TRACE("device %p, idx %u, uav %p, initial_count %#x.\n", device, idx, uav, initial_count);
3040
3042}
static void wined3d_device_set_pipeline_unordered_access_view(struct wined3d_device *device, enum wined3d_pipeline pipeline, unsigned int idx, struct wined3d_unordered_access_view *uav, unsigned int initial_count)
Definition: device.c:2999

◆ wined3d_device_set_cursor_position()

void CDECL wined3d_device_set_cursor_position ( struct wined3d_device device,
int  x_screen_space,
int  y_screen_space,
DWORD  flags 
)

Definition at line 4690 of file device.c.

4692{
4693 TRACE("device %p, x %d, y %d, flags %#x.\n",
4694 device, x_screen_space, y_screen_space, flags);
4695
4696 device->xScreenSpace = x_screen_space;
4697 device->yScreenSpace = y_screen_space;
4698
4699 if (device->hardwareCursor)
4700 {
4701 POINT pt;
4702
4703 GetCursorPos( &pt );
4704 if (x_screen_space == pt.x && y_screen_space == pt.y)
4705 return;
4706 SetCursorPos( x_screen_space, y_screen_space );
4707
4708 /* Switch to the software cursor if position diverges from the hardware one. */
4709 GetCursorPos( &pt );
4710 if (x_screen_space != pt.x || y_screen_space != pt.y)
4711 {
4712 if (device->bCursorVisible) SetCursor( NULL );
4713 DestroyCursor( device->hardwareCursor );
4714 device->hardwareCursor = 0;
4715 }
4716 }
4717}
#define pt(x, y)
Definition: drawing.c:79
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2722
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2714

Referenced by d3d8_device_SetCursorPosition(), and d3d9_device_SetCursorPosition().

◆ wined3d_device_set_cursor_properties()

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 at line 4587 of file device.c.

4589{
4590 unsigned int texture_level = sub_resource_idx % texture->level_count;
4591 unsigned int cursor_width, cursor_height;
4593 struct wined3d_map_desc map_desc;
4594 HRESULT hr;
4595
4596 TRACE("device %p, x_hotspot %u, y_hotspot %u, texture %p, sub_resource_idx %u.\n",
4597 device, x_hotspot, y_hotspot, texture, sub_resource_idx);
4598
4599 if (sub_resource_idx >= texture->level_count * texture->layer_count
4600 || texture->resource.type != WINED3D_RTYPE_TEXTURE_2D)
4602
4603 if (device->cursor_texture)
4604 {
4605 wined3d_texture_decref(device->cursor_texture);
4606 device->cursor_texture = NULL;
4607 }
4608
4609 if (texture->resource.format->id != WINED3DFMT_B8G8R8A8_UNORM)
4610 {
4611 WARN("Texture %p has invalid format %s.\n",
4612 texture, debug_d3dformat(texture->resource.format->id));
4614 }
4615
4616 if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d, device->adapter->ordinal, &mode, NULL)))
4617 {
4618 ERR("Failed to get display mode, hr %#x.\n", hr);
4620 }
4621
4622 cursor_width = wined3d_texture_get_level_width(texture, texture_level);
4623 cursor_height = wined3d_texture_get_level_height(texture, texture_level);
4624 if (cursor_width > mode.width || cursor_height > mode.height)
4625 {
4626 WARN("Texture %p, sub-resource %u dimensions are %ux%u, but screen dimensions are %ux%u.\n",
4627 texture, sub_resource_idx, cursor_width, cursor_height, mode.width, mode.height);
4629 }
4630
4631 /* TODO: MSDN: Cursor sizes must be a power of 2 */
4632
4633 /* Do not store the surface's pointer because the application may
4634 * release it after setting the cursor image. Windows doesn't
4635 * addref the set surface, so we can't do this either without
4636 * creating circular refcount dependencies. */
4637 if (!(device->cursor_texture = wined3d_device_create_cursor_texture(device, texture, sub_resource_idx)))
4638 {
4639 ERR("Failed to create cursor texture.\n");
4641 }
4642
4643 if (cursor_width == 32 && cursor_height == 32)
4644 {
4645 UINT mask_size = cursor_width * cursor_height / 8;
4646 ICONINFO cursor_info;
4647 DWORD *mask_bits;
4649
4650 /* 32-bit user32 cursors ignore the alpha channel if it's all
4651 * zeroes, and use the mask instead. Fill the mask with all ones
4652 * to ensure we still get a fully transparent cursor. */
4653 if (!(mask_bits = heap_alloc(mask_size)))
4654 return E_OUTOFMEMORY;
4655 memset(mask_bits, 0xff, mask_size);
4656
4657 wined3d_resource_map(&texture->resource, sub_resource_idx, &map_desc, NULL,
4659 cursor_info.fIcon = FALSE;
4660 cursor_info.xHotspot = x_hotspot;
4661 cursor_info.yHotspot = y_hotspot;
4662 cursor_info.hbmMask = CreateBitmap(cursor_width, cursor_height, 1, 1, mask_bits);
4663 cursor_info.hbmColor = CreateBitmap(cursor_width, cursor_height, 1, 32, map_desc.data);
4664 wined3d_resource_unmap(&texture->resource, sub_resource_idx);
4665
4666 /* Create our cursor and clean up. */
4667 cursor = CreateIconIndirect(&cursor_info);
4668 if (cursor_info.hbmMask)
4669 DeleteObject(cursor_info.hbmMask);
4670 if (cursor_info.hbmColor)
4671 DeleteObject(cursor_info.hbmColor);
4672 if (device->hardwareCursor)
4673 DestroyCursor(device->hardwareCursor);
4674 device->hardwareCursor = cursor;
4675 if (device->bCursorVisible)
4677
4678 heap_free(mask_bits);
4679 }
4680
4681 TRACE("New cursor dimensions are %ux%u.\n", cursor_width, cursor_height);
4682 device->cursorWidth = cursor_width;
4683 device->cursorHeight = cursor_height;
4684 device->xHotSpot = x_hotspot;
4685 device->yHotSpot = y_hotspot;
4686
4687 return WINED3D_OK;
4688}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static struct wined3d_texture * wined3d_device_create_cursor_texture(struct wined3d_device *device, struct wined3d_texture *cursor_image, unsigned int sub_resource_idx)
Definition: device.c:4544
DWORD yHotspot
Definition: winuser.h:3128
BOOL fIcon
Definition: winuser.h:3126
DWORD xHotspot
Definition: winuser.h:3127
HBITMAP hbmColor
Definition: winuser.h:3130
HBITMAP hbmMask
Definition: winuser.h:3129
HICON HCURSOR
Definition: windef.h:299
HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: directx.c:4767
#define WINED3D_MAP_NO_DIRTY_UPDATE
Definition: wined3d.h:937
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2633

Referenced by d3d8_device_SetCursorProperties(), and d3d9_device_SetCursorProperties().

◆ wined3d_device_set_depth_stencil_view()

void CDECL wined3d_device_set_depth_stencil_view ( struct wined3d_device device,
struct wined3d_rendertarget_view view 
)

Definition at line 4524 of file device.c.

4525{
4526 struct wined3d_rendertarget_view *prev;
4527
4528 TRACE("device %p, view %p.\n", device, view);
4529
4530 prev = device->fb.depth_stencil;
4531 if (prev == view)
4532 {
4533 TRACE("Trying to do a NOP SetRenderTarget operation.\n");
4534 return;
4535 }
4536
4537 if ((device->fb.depth_stencil = view))
4540 if (prev)
4542}
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view)
Definition: cs.c:1057
ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view)
Definition: view.c:318

Referenced by d3d8_device_SetRenderTarget(), d3d9_device_SetDepthStencilSurface(), d3d_device_update_depth_stencil(), ddraw_set_cooperative_level(), ddraw_surface_delete_attached_surface(), device_init_swapchain_state(), and wined3d_device_reset().

◆ wined3d_device_set_dialog_box_mode()

HRESULT CDECL wined3d_device_set_dialog_box_mode ( struct wined3d_device device,
BOOL  enable_dialogs 
)

Definition at line 5032 of file device.c.

5033{
5034 TRACE("device %p, enable_dialogs %#x.\n", device, enable_dialogs);
5035
5036 if (!enable_dialogs) FIXME("Dialogs cannot be disabled yet.\n");
5037
5038 return WINED3D_OK;
5039}

Referenced by d3d9_device_SetDialogBoxMode().

◆ wined3d_device_set_domain_shader()

void CDECL wined3d_device_set_domain_shader ( struct wined3d_device device,
struct wined3d_shader shader 
)

Definition at line 2794 of file device.c.

2795{
2796 struct wined3d_shader *prev;
2797
2798 TRACE("device %p, shader %p.\n", device, shader);
2799
2800 prev = device->update_state->shader[WINED3D_SHADER_TYPE_DOMAIN];
2801 if (shader == prev)
2802 return;
2803 if (shader)
2805 device->update_state->shader[WINED3D_SHADER_TYPE_DOMAIN] = shader;
2807 if (prev)
2809}

◆ wined3d_device_set_ds_cb()

void CDECL wined3d_device_set_ds_cb ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_buffer buffer 
)

Definition at line 2818 of file device.c.

2819{
2820 TRACE("device %p, idx %u, buffer %p.\n", device, idx, buffer);
2821
2823}

◆ wined3d_device_set_ds_resource_view()

void CDECL wined3d_device_set_ds_resource_view ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_shader_resource_view view 
)

Definition at line 2832 of file device.c.

2834{
2835 TRACE("device %p, idx %u, view %p.\n", device, idx, view);
2836
2838}

◆ wined3d_device_set_ds_sampler()

void CDECL wined3d_device_set_ds_sampler ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_sampler sampler 
)

Definition at line 2848 of file device.c.

2850{
2851 TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler);
2852
2854}

◆ wined3d_device_set_gamma_ramp()

void CDECL wined3d_device_set_gamma_ramp ( const struct wined3d_device device,
UINT  swapchain_idx,
DWORD  flags,
const struct wined3d_gamma_ramp ramp 
)

Definition at line 5057 of file device.c.

5059{
5060 struct wined3d_swapchain *swapchain;
5061
5062 TRACE("device %p, swapchain_idx %u, flags %#x, ramp %p.\n",
5063 device, swapchain_idx, flags, ramp);
5064
5065 if ((swapchain = wined3d_device_get_swapchain(device, swapchain_idx)))
5067}
HRESULT CDECL wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain, DWORD flags, const struct wined3d_gamma_ramp *ramp)
Definition: swapchain.c:279

Referenced by d3d8_device_SetGammaRamp(), d3d9_device_SetGammaRamp(), and ddraw_gamma_control_SetGammaRamp().

◆ wined3d_device_set_geometry_shader()

void CDECL wined3d_device_set_geometry_shader ( struct wined3d_device device,
struct wined3d_shader shader 
)

Definition at line 2863 of file device.c.

2864{
2865 struct wined3d_shader *prev = device->update_state->shader[WINED3D_SHADER_TYPE_GEOMETRY];
2866
2867 TRACE("device %p, shader %p.\n", device, shader);
2868
2869 if (device->recording || shader == prev)
2870 return;
2871 if (shader)
2873 device->update_state->shader[WINED3D_SHADER_TYPE_GEOMETRY] = shader;
2875 if (prev)
2877}

◆ wined3d_device_set_gs_cb()

void CDECL wined3d_device_set_gs_cb ( struct wined3d_device device,
UINT  idx,
struct wined3d_buffer buffer 
)

Definition at line 2886 of file device.c.

2887{
2888 TRACE("device %p, idx %u, buffer %p.\n", device, idx, buffer);
2889
2891}

◆ wined3d_device_set_gs_resource_view()

void CDECL wined3d_device_set_gs_resource_view ( struct wined3d_device device,
UINT  idx,
struct wined3d_shader_resource_view view 
)

Definition at line 2900 of file device.c.

2902{
2903 TRACE("device %p, idx %u, view %p.\n", device, idx, view);
2904
2906}

◆ wined3d_device_set_gs_sampler()

void CDECL wined3d_device_set_gs_sampler ( struct wined3d_device device,
UINT  idx,
struct wined3d_sampler sampler 
)

Definition at line 2916 of file device.c.

2917{
2918 TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler);
2919
2921}

◆ wined3d_device_set_hs_cb()

void CDECL wined3d_device_set_hs_cb ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_buffer buffer 
)

Definition at line 2749 of file device.c.

2750{
2751 TRACE("device %p, idx %u, buffer %p.\n", device, idx, buffer);
2752
2754}

◆ wined3d_device_set_hs_resource_view()

void CDECL wined3d_device_set_hs_resource_view ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_shader_resource_view view 
)

Definition at line 2763 of file device.c.

2765{
2766 TRACE("device %p, idx %u, view %p.\n", device, idx, view);
2767
2769}

◆ wined3d_device_set_hs_sampler()

void CDECL wined3d_device_set_hs_sampler ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_sampler sampler 
)

Definition at line 2779 of file device.c.

2781{
2782 TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler);
2783
2785}

◆ wined3d_device_set_hull_shader()

void CDECL wined3d_device_set_hull_shader ( struct wined3d_device device,
struct wined3d_shader shader 
)

Definition at line 2725 of file device.c.

2726{
2727 struct wined3d_shader *prev;
2728
2729 TRACE("device %p, shader %p.\n", device, shader);
2730
2731 prev = device->update_state->shader[WINED3D_SHADER_TYPE_HULL];
2732 if (shader == prev)
2733 return;
2734 if (shader)
2736 device->update_state->shader[WINED3D_SHADER_TYPE_HULL] = shader;
2738 if (prev)
2740}

◆ wined3d_device_set_index_buffer()

void CDECL wined3d_device_set_index_buffer ( struct wined3d_device device,
struct wined3d_buffer buffer,
enum wined3d_format_id  format_id,
unsigned int  offset 
)

Definition at line 1874 of file device.c.

1876{
1877 enum wined3d_format_id prev_format;
1878 struct wined3d_buffer *prev_buffer;
1879 unsigned int prev_offset;
1880
1881 TRACE("device %p, buffer %p, format %s, offset %u.\n",
1883
1884 prev_buffer = device->update_state->index_buffer;
1885 prev_format = device->update_state->index_format;
1886 prev_offset = device->update_state->index_offset;
1887
1888 device->update_state->index_buffer = buffer;
1889 device->update_state->index_format = format_id;
1890 device->update_state->index_offset = offset;
1891
1892 if (device->recording)
1893 device->recording->changed.indices = TRUE;
1894
1895 if (prev_buffer == buffer && prev_format == format_id && prev_offset == offset)
1896 return;
1897
1898 if (buffer)
1900 if (!device->recording)
1902 if (prev_buffer)
1903 wined3d_buffer_decref(prev_buffer);
1904}
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, enum wined3d_format_id format_id, unsigned int offset)
Definition: cs.c:1198
wined3d_format_id
Definition: wined3d.h:106

Referenced by d3d8_device_DrawIndexedPrimitiveUP(), d3d8_device_SetIndices(), d3d9_device_DrawIndexedPrimitiveUP(), d3d9_device_SetIndices(), d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), d3d_device7_DrawIndexedPrimitiveVB(), and wined3d_stateblock_apply().

◆ wined3d_device_set_light()

HRESULT CDECL wined3d_device_set_light ( struct wined3d_device device,
UINT  light_idx,
const struct wined3d_light light 
)

Definition at line 1580 of file device.c.

1582{
1583 UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx);
1584 struct wined3d_light_info *object = NULL;
1585 float rho;
1586
1587 TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light);
1588
1589 /* Check the parameter range. Need for speed most wanted sets junk lights
1590 * which confuse the GL driver. */
1591 if (!light)
1593
1594 switch (light->type)
1595 {
1597 case WINED3D_LIGHT_SPOT:
1599 /* Incorrect attenuation values can cause the gl driver to crash.
1600 * Happens with Need for speed most wanted. */
1601 if (light->attenuation0 < 0.0f || light->attenuation1 < 0.0f || light->attenuation2 < 0.0f)
1602 {
1603 WARN("Attenuation is negative, returning WINED3DERR_INVALIDCALL.\n");
1605 }
1606 break;
1607
1610 /* Ignores attenuation */
1611 break;
1612
1613 default:
1614 WARN("Light type out of range, returning WINED3DERR_INVALIDCALL\n");
1616 }
1617
1618 if (!(object = wined3d_state_get_light(device->update_state, light_idx)))
1619 {
1620 TRACE("Adding new light\n");
1621 if (!(object = heap_alloc_zero(sizeof(*object))))
1622 return E_OUTOFMEMORY;
1623
1624 list_add_head(&device->update_state->light_map[hash_idx], &object->entry);
1625 object->glIndex = -1;
1626 object->OriginalIndex = light_idx;
1627 }
1628
1629 /* Initialize the object. */
1630 TRACE("Light %u setting to type %#x, diffuse %s, specular %s, ambient %s, "
1631 "position {%.8e, %.8e, %.8e}, direction {%.8e, %.8e, %.8e}, "
1632 "range %.8e, falloff %.8e, theta %.8e, phi %.8e.\n",
1633 light_idx, light->type, debug_color(&light->diffuse),
1634 debug_color(&light->specular), debug_color(&light->ambient),
1635 light->position.x, light->position.y, light->position.z,
1636 light->direction.x, light->direction.y, light->direction.z,
1637 light->range, light->falloff, light->theta, light->phi);
1638
1639 /* Save away the information. */
1640 object->OriginalParms = *light;
1641
1642 switch (light->type)
1643 {
1645 /* Position */
1646 object->position.x = light->position.x;
1647 object->position.y = light->position.y;
1648 object->position.z = light->position.z;
1649 object->position.w = 1.0f;
1650 object->cutoff = 180.0f;
1651 /* FIXME: Range */
1652 break;
1653
1655 /* Direction */
1656 object->direction.x = -light->direction.x;
1657 object->direction.y = -light->direction.y;
1658 object->direction.z = -light->direction.z;
1659 object->direction.w = 0.0f;
1660 object->exponent = 0.0f;
1661 object->cutoff = 180.0f;
1662 break;
1663
1664 case WINED3D_LIGHT_SPOT:
1665 /* Position */
1666 object->position.x = light->position.x;
1667 object->position.y = light->position.y;
1668 object->position.z = light->position.z;
1669 object->position.w = 1.0f;
1670
1671 /* Direction */
1672 object->direction.x = light->direction.x;
1673 object->direction.y = light->direction.y;
1674 object->direction.z = light->direction.z;
1675 object->direction.w = 0.0f;
1676
1677 /* opengl-ish and d3d-ish spot lights use too different models
1678 * for the light "intensity" as a function of the angle towards
1679 * the main light direction, so we only can approximate very
1680 * roughly. However, spot lights are rather rarely used in games
1681 * (if ever used at all). Furthermore if still used, probably
1682 * nobody pays attention to such details. */
1683 if (!light->falloff)
1684 {
1685 /* Falloff = 0 is easy, because d3d's and opengl's spot light
1686 * equations have the falloff resp. exponent parameter as an
1687 * exponent, so the spot light lighting will always be 1.0 for
1688 * both of them, and we don't have to care for the rest of the
1689 * rather complex calculation. */
1690 object->exponent = 0.0f;
1691 }
1692 else
1693 {
1694 rho = light->theta + (light->phi - light->theta) / (2 * light->falloff);
1695 if (rho < 0.0001f)
1696 rho = 0.0001f;
1697 object->exponent = -0.3f / logf(cosf(rho / 2));
1698 }
1699
1700 if (object->exponent > 128.0f)
1701 object->exponent = 128.0f;
1702
1703 object->cutoff = (float)(light->phi * 90 / M_PI);
1704 /* FIXME: Range */
1705 break;
1706
1708 object->position.x = light->position.x;
1709 object->position.y = light->position.y;
1710 object->position.z = light->position.z;
1711 object->position.w = 1.0f;
1712 break;
1713
1714 default:
1715 FIXME("Unrecognized light type %#x.\n", light->type);
1716 }
1717
1718 if (!device->recording)
1719 wined3d_cs_emit_set_light(device->cs, object);
1720
1721 return WINED3D_OK;
1722}
void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light_info *light)
Definition: cs.c:1733
_Check_return_ float __cdecl logf(_In_ float x)
Definition: math.h:229
_Check_return_ float __cdecl cosf(_In_ float x)
Definition: math.h:224
#define M_PI
Definition: macros.h:263
@ WINED3D_LIGHT_SPOT
Definition: wined3d.h:63
@ WINED3D_LIGHT_GLSPOT
Definition: wined3d.h:66
@ WINED3D_LIGHT_PARALLELPOINT
Definition: wined3d.h:65
@ WINED3D_LIGHT_POINT
Definition: wined3d.h:62
@ WINED3D_LIGHT_DIRECTIONAL
Definition: wined3d.h:64
#define LIGHTMAP_HASHFUNC(x)

Referenced by apply_lights(), d3d8_device_SetLight(), d3d9_device_SetLight(), d3d_device7_SetLight(), and wined3d_device_set_light_enable().

◆ wined3d_device_set_light_enable()

HRESULT CDECL wined3d_device_set_light_enable ( struct wined3d_device device,
UINT  light_idx,
BOOL  enable 
)

Definition at line 1741 of file device.c.

1742{
1743 struct wined3d_light_info *light_info;
1744
1745 TRACE("device %p, light_idx %u, enable %#x.\n", device, light_idx, enable);
1746
1747 /* Special case - enabling an undefined light creates one with a strict set of parameters. */
1748 if (!(light_info = wined3d_state_get_light(device->update_state, light_idx)))
1749 {
1750 TRACE("Light enabled requested but light not defined, so defining one!\n");
1752
1753 if (!(light_info = wined3d_state_get_light(device->update_state, light_idx)))
1754 {
1755 FIXME("Adding default lights has failed dismally\n");
1757 }
1758 }
1759
1760 wined3d_state_enable_light(device->update_state, &device->adapter->d3d_info, light_info, enable);
1761 if (!device->recording)
1763
1764 return WINED3D_OK;
1765}
void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, BOOL enable)
Definition: cs.c:1766
HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, UINT light_idx, const struct wined3d_light *light)
Definition: device.c:1580
const struct wined3d_light WINED3D_default_light
Definition: device.c:41
void wined3d_state_enable_light(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info, struct wined3d_light_info *light_info, BOOL enable)
Definition: stateblock.c:582

Referenced by apply_lights(), d3d8_device_LightEnable(), d3d9_device_LightEnable(), and d3d_device7_LightEnable().

◆ wined3d_device_set_material()

void CDECL wined3d_device_set_material ( struct wined3d_device device,
const struct wined3d_material material 
)

Definition at line 1849 of file device.c.

1850{
1851 TRACE("device %p, material %p.\n", device, material);
1852
1853 device->update_state->material = *material;
1854
1855 if (device->recording)
1856 device->recording->changed.material = TRUE;
1857 else
1858 wined3d_cs_emit_set_material(device->cs, material);
1859}
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material)
Definition: cs.c:1685

Referenced by d3d8_device_SetMaterial(), d3d9_device_SetMaterial(), d3d_device7_SetMaterial(), and wined3d_stateblock_apply().

◆ wined3d_device_set_multithreaded()

void CDECL wined3d_device_set_multithreaded ( struct wined3d_device device)

Definition at line 1290 of file device.c.

1291{
1292 TRACE("device %p.\n", device);
1293
1294 /* For now just store the flag (needed in case of ddraw). */
1295 device->create_parms.flags |= WINED3DCREATE_MULTITHREADED;
1296}
#define WINED3DCREATE_MULTITHREADED

Referenced by ddraw_set_cooperative_level(), and device_init().

◆ wined3d_device_set_npatch_mode()

HRESULT CDECL wined3d_device_set_npatch_mode ( struct wined3d_device device,
float  segments 
)

Definition at line 3995 of file device.c.

3996{
3997 static BOOL warned;
3998
3999 TRACE("device %p, segments %.8e.\n", device, segments);
4000
4001 if (segments != 0.0f)
4002 {
4003 if (!warned)
4004 {
4005 FIXME("device %p, segments %.8e stub!\n", device, segments);
4006 warned = TRUE;
4007 }
4008 }
4009
4010 return WINED3D_OK;
4011}

Referenced by d3d9_device_SetNPatchMode().

◆ wined3d_device_set_pipeline_unordered_access_view()

static void wined3d_device_set_pipeline_unordered_access_view ( struct wined3d_device device,
enum wined3d_pipeline  pipeline,
unsigned int  idx,
struct wined3d_unordered_access_view uav,
unsigned int  initial_count 
)
static

Definition at line 2999 of file device.c.

3002{
3003 struct wined3d_unordered_access_view *prev;
3004
3006 {
3007 WARN("Invalid UAV index %u.\n", idx);
3008 return;
3009 }
3010
3011 prev = device->update_state->unordered_access_view[pipeline][idx];
3012 if (uav == prev && initial_count == ~0u)
3013 return;
3014
3015 if (uav)
3017 device->update_state->unordered_access_view[pipeline][idx] = uav;
3018 if (!device->recording)
3019 wined3d_cs_emit_set_unordered_access_view(device->cs, pipeline, idx, uav, initial_count);
3020 if (prev)
3022}
void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined3d_pipeline pipeline, unsigned int view_idx, struct wined3d_unordered_access_view *view, unsigned int initial_count)
Definition: cs.c:1385
ULONG CDECL wined3d_unordered_access_view_decref(struct wined3d_unordered_access_view *view)
Definition: view.c:970
ULONG CDECL wined3d_unordered_access_view_incref(struct wined3d_unordered_access_view *view)
Definition: view.c:939

Referenced by wined3d_device_set_cs_uav(), and wined3d_device_set_unordered_access_view().

◆ wined3d_device_set_pixel_shader()

void CDECL wined3d_device_set_pixel_shader ( struct wined3d_device device,
struct wined3d_shader shader 
)

Definition at line 2509 of file device.c.

2510{
2511 struct wined3d_shader *prev = device->update_state->shader[WINED3D_SHADER_TYPE_PIXEL];
2512
2513 TRACE("device %p, shader %p.\n", device, shader);
2514
2515 if (device->recording)
2516 device->recording->changed.pixelShader = TRUE;
2517
2518 if (shader == prev)
2519 return;
2520
2521 if (shader)
2523 device->update_state->shader[WINED3D_SHADER_TYPE_PIXEL] = shader;
2524 if (!device->recording)
2526 if (prev)
2528}

Referenced by d3d8_device_SetPixelShader(), d3d9_device_SetPixelShader(), and wined3d_stateblock_apply().

◆ wined3d_device_set_predication()

void CDECL wined3d_device_set_predication ( struct wined3d_device device,
struct wined3d_query predicate,
BOOL  value 
)

Definition at line 3670 of file device.c.

3672{
3673 struct wined3d_query *prev;
3674
3675 TRACE("device %p, predicate %p, value %#x.\n", device, predicate, value);
3676
3677 prev = device->update_state->predicate;
3678 if (predicate)
3679 {
3680 FIXME("Predicated rendering not implemented.\n");
3681 wined3d_query_incref(predicate);
3682 }
3683 device->update_state->predicate = predicate;
3684 device->update_state->predicate_value = value;
3685 if (!device->recording)
3687 if (prev)
3689}
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value)
Definition: cs.c:949
ULONG CDECL wined3d_query_incref(struct wined3d_query *query)
Definition: query.c:326
ULONG CDECL wined3d_query_decref(struct wined3d_query *query)
Definition: query.c:349

◆ wined3d_device_set_primitive_type()

void CDECL wined3d_device_set_primitive_type ( struct wined3d_device device,
enum wined3d_primitive_type  primitive_type,
unsigned int  patch_vertex_count 
)

Definition at line 3717 of file device.c.

3719{
3720 TRACE("device %p, primitive_type %s, patch_vertex_count %u.\n",
3721 device, debug_d3dprimitivetype(primitive_type), patch_vertex_count);
3722
3723 device->state.gl_primitive_type = gl_primitive_type_from_d3d(primitive_type);
3724 device->state.gl_patch_vertices = patch_vertex_count;
3725}
GLenum gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type)
Definition: device.c:58

Referenced by d3d8_device_DrawIndexedPrimitive(), d3d8_device_DrawIndexedPrimitiveUP(), d3d8_device_DrawPrimitive(), d3d8_device_DrawPrimitiveUP(), d3d9_device_DrawIndexedPrimitive(), d3d9_device_DrawIndexedPrimitiveUP(), d3d9_device_DrawPrimitive(), d3d9_device_DrawPrimitiveUP(), d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), d3d_device7_DrawIndexedPrimitiveVB(), d3d_device7_DrawPrimitive(), d3d_device7_DrawPrimitiveStrided(), and d3d_device7_DrawPrimitiveVB().

◆ wined3d_device_set_ps_cb()

void CDECL wined3d_device_set_ps_cb ( struct wined3d_device device,
UINT  idx,
struct wined3d_buffer buffer 
)

Definition at line 2537 of file device.c.

2538{
2539 TRACE("device %p, idx %u, buffer %p.\n", device, idx, buffer);
2540
2542}

◆ wined3d_device_set_ps_consts_b()

HRESULT CDECL wined3d_device_set_ps_consts_b ( struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
const BOOL constants 
)

Definition at line 2581 of file device.c.

2583{
2584 unsigned int i;
2585
2586 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2587 device, start_idx, count, constants);
2588
2589 if (!constants || start_idx >= WINED3D_MAX_CONSTS_B)
2591
2592 if (count > WINED3D_MAX_CONSTS_B - start_idx)
2593 count = WINED3D_MAX_CONSTS_B - start_idx;
2594 memcpy(&device->update_state->ps_consts_b[start_idx], constants, count * sizeof(*constants));
2595 if (TRACE_ON(d3d))
2596 {
2597 for (i = 0; i < count; ++i)
2598 TRACE("Set BOOL constant %u to %#x.\n", start_idx + i, constants[i]);
2599 }
2600
2601 if (device->recording)
2602 {
2603 for (i = start_idx; i < count + start_idx; ++i)
2604 device->recording->changed.pixelShaderConstantsB |= (1u << i);
2605 }
2606 else
2607 {
2609 }
2610
2611 return WINED3D_OK;
2612}
#define TRACE_ON(x)
Definition: compat.h:75
@ WINED3D_PUSH_CONSTANTS_PS_B

Referenced by d3d9_device_SetPixelShaderConstantB(), and wined3d_stateblock_apply().

◆ wined3d_device_set_ps_consts_f()

HRESULT CDECL wined3d_device_set_ps_consts_f ( struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
const struct wined3d_vec4 constants 
)

Definition at line 2679 of file device.c.

2681{
2682 const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
2683 unsigned int i;
2684
2685 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2686 device, start_idx, count, constants);
2687
2688 if (!constants || start_idx >= d3d_info->limits.ps_uniform_count
2689 || count > d3d_info->limits.ps_uniform_count - start_idx)
2691
2692 memcpy(&device->update_state->ps_consts_f[start_idx], constants, count * sizeof(*constants));
2693 if (TRACE_ON(d3d))
2694 {
2695 for (i = 0; i < count; ++i)
2696 TRACE("Set vec4 constant %u to %s.\n", start_idx + i, debug_vec4(&constants[i]));
2697 }
2698
2699 if (device->recording)
2700 memset(&device->recording->changed.ps_consts_f[start_idx], 1,
2701 count * sizeof(*device->recording->changed.ps_consts_f));
2702 else
2704
2705 return WINED3D_OK;
2706}
const char * debug_vec4(const struct wined3d_vec4 *v)
Definition: utils.c:3972
@ WINED3D_PUSH_CONSTANTS_PS_F

Referenced by d3d8_device_SetPixelShaderConstant(), d3d9_device_SetPixelShaderConstantF(), and wined3d_stateblock_apply().

◆ wined3d_device_set_ps_consts_i()

HRESULT CDECL wined3d_device_set_ps_consts_i ( struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
const struct wined3d_ivec4 constants 
)

Definition at line 2630 of file device.c.

2632{
2633 unsigned int i;
2634
2635 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2636 device, start_idx, count, constants);
2637
2638 if (!constants || start_idx >= WINED3D_MAX_CONSTS_I)
2640
2641 if (count > WINED3D_MAX_CONSTS_I - start_idx)
2642 count = WINED3D_MAX_CONSTS_I - start_idx;
2643 memcpy(&device->update_state->ps_consts_i[start_idx], constants, count * sizeof(*constants));
2644 if (TRACE_ON(d3d))
2645 {
2646 for (i = 0; i < count; ++i)
2647 TRACE("Set ivec4 constant %u to %s.\n", start_idx + i, debug_ivec4(&constants[i]));
2648 }
2649
2650 if (device->recording)
2651 {
2652 for (i = start_idx; i < count + start_idx; ++i)
2653 device->recording->changed.pixelShaderConstantsI |= (1u << i);
2654 }
2655 else
2656 {
2658 }
2659
2660 return WINED3D_OK;
2661}
const char * debug_ivec4(const struct wined3d_ivec4 *v)
Definition: utils.c:3956
@ WINED3D_PUSH_CONSTANTS_PS_I

Referenced by d3d9_device_SetPixelShaderConstantI(), and wined3d_stateblock_apply().

◆ wined3d_device_set_ps_resource_view()

void CDECL wined3d_device_set_ps_resource_view ( struct wined3d_device device,
UINT  idx,
struct wined3d_shader_resource_view view 
)

Definition at line 2551 of file device.c.

2553{
2554 TRACE("device %p, idx %u, view %p.\n", device, idx, view);
2555
2557}

◆ wined3d_device_set_ps_sampler()

void CDECL wined3d_device_set_ps_sampler ( struct wined3d_device device,
UINT  idx,
struct wined3d_sampler sampler 
)

Definition at line 2567 of file device.c.

2568{
2569 TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler);
2570
2572}

◆ wined3d_device_set_rasterizer_state()

void CDECL wined3d_device_set_rasterizer_state ( struct wined3d_device device,
struct wined3d_rasterizer_state rasterizer_state 
)

Definition at line 2001 of file device.c.

2003{
2004 struct wined3d_rasterizer_state *prev;
2005
2006 TRACE("device %p, rasterizer_state %p.\n", device, rasterizer_state);
2007
2008 prev = device->update_state->rasterizer_state;
2009 if (prev == rasterizer_state)
2010 return;
2011
2012 if (rasterizer_state)
2013 wined3d_rasterizer_state_incref(rasterizer_state);
2014 device->update_state->rasterizer_state = rasterizer_state;
2015 wined3d_cs_emit_set_rasterizer_state(device->cs, rasterizer_state);
2016 if (prev)
2018}
void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, struct wined3d_rasterizer_state *rasterizer_state)
Definition: cs.c:1476
ULONG CDECL wined3d_rasterizer_state_incref(struct wined3d_rasterizer_state *state)
Definition: state.c:105
ULONG CDECL wined3d_rasterizer_state_decref(struct wined3d_rasterizer_state *state)
Definition: state.c:119

◆ wined3d_device_set_render_state()

void CDECL wined3d_device_set_render_state ( struct wined3d_device device,
enum wined3d_render_state  state,
DWORD  value 
)

Definition at line 2027 of file device.c.

2029{
2031
2032 TRACE("device %p, state %s (%#x), value %#x.\n", device, debug_d3drenderstate(state), state, value);
2033
2035 {
2036 WARN("Unhandled render state %#x.\n", state);
2037 return;
2038 }
2039
2040 old_value = device->state.render_states[state];
2041 device->update_state->render_states[state] = value;
2042
2043 /* Handle recording of state blocks. */
2044 if (device->recording)
2045 {
2046 TRACE("Recording... not performing anything.\n");
2047 device->recording->changed.renderState[state >> 5] |= 1u << (state & 0x1f);
2048 return;
2049 }
2050
2051 /* Compared here and not before the assignment to allow proper stateblock recording. */
2052 if (value == old_value)
2053 TRACE("Application is setting the old value over, nothing to do.\n");
2054 else
2056
2058 {
2059 TRACE("RESZ multisampled depth buffer resolve triggered.\n");
2061 }
2062}
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value)
Definition: cs.c:1496
static void resolve_depth_buffer(struct wined3d_device *device)
Definition: device.c:1957
static ULONG * old_value
Definition: directory.c:54
@ WINED3D_RS_POINTSIZE
Definition: wined3d.h:339
#define WINED3D_RESZ_CODE
Definition: wined3d.h:1332
#define WINEHIGHEST_RENDER_STATE
Definition: wined3d.h:398

Referenced by d3d8_device_Reset(), d3d8_device_SetRenderState(), d3d9_device_reset(), d3d9_device_SetRenderState(), d3d_device7_SetRenderState(), d3d_device_init(), d3d_vertex_buffer7_ProcessVertices(), ddraw_surface_create(), device_init(), setup_lighting(), and wined3d_stateblock_apply().

◆ wined3d_device_set_rendertarget_view()

HRESULT CDECL wined3d_device_set_rendertarget_view ( struct wined3d_device device,
unsigned int  view_idx,
struct wined3d_rendertarget_view view,
BOOL  set_viewport 
)

Definition at line 4468 of file device.c.

4470{
4471 struct wined3d_rendertarget_view *prev;
4472
4473 TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n",
4474 device, view_idx, view, set_viewport);
4475
4476 if (view_idx >= device->adapter->gl_info.limits.buffers)
4477 {
4478 WARN("Only %u render targets are supported.\n", device->adapter->gl_info.limits.buffers);
4480 }
4481
4482 if (view && !(view->resource->usage & WINED3DUSAGE_RENDERTARGET))
4483 {
4484 WARN("View resource %p doesn't have render target usage.\n", view->resource);
4486 }
4487
4488 /* Set the viewport and scissor rectangles, if requested. Tests show that
4489 * stateblock recording is ignored, the change goes directly into the
4490 * primary stateblock. */
4491 if (!view_idx && set_viewport)
4492 {
4493 struct wined3d_state *state = &device->state;
4494
4495 state->viewport.x = 0;
4496 state->viewport.y = 0;
4497 state->viewport.width = view->width;
4498 state->viewport.height = view->height;
4499 state->viewport.min_z = 0.0f;
4500 state->viewport.max_z = 1.0f;
4501 wined3d_cs_emit_set_viewport(device->cs, &state->viewport);
4502
4503 SetRect(&state->scissor_rect, 0, 0, view->width, view->height);
4504 wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
4505 }
4506
4507
4508 prev = device->fb.render_targets[view_idx];
4509 if (view == prev)
4510 return WINED3D_OK;
4511
4512 if (view)
4514 device->fb.render_targets[view_idx] = view;
4516 /* Release after the assignment, to prevent device_resource_released()
4517 * from seeing the surface as still in use. */
4518 if (prev)
4520
4521 return WINED3D_OK;
4522}
void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, struct wined3d_rendertarget_view *view)
Definition: cs.c:1007

Referenced by d3d8_device_SetRenderTarget(), d3d9_device_SetRenderTarget(), d3d_device_init(), d3d_device_inner_Release(), d3d_device_set_render_target(), ddraw_set_cooperative_level(), ddraw_surface7_Flip(), device_init_swapchain_state(), wined3d_device_reset(), and wined3d_device_uninit_3d().

◆ wined3d_device_set_sampler()

static void wined3d_device_set_sampler ( struct wined3d_device device,
enum wined3d_shader_type  type,
UINT  idx,
struct wined3d_sampler sampler 
)
static

Definition at line 2316 of file device.c.

2318{
2319 struct wined3d_sampler *prev;
2320
2321 if (idx >= MAX_SAMPLER_OBJECTS)
2322 {
2323 WARN("Invalid sampler index %u.\n", idx);
2324 return;
2325 }
2326
2327 prev = device->update_state->sampler[type][idx];
2328 if (sampler == prev)
2329 return;
2330
2331 if (sampler)
2333 device->update_state->sampler[type][idx] = sampler;
2334 if (!device->recording)
2336 if (prev)
2338}
void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT sampler_idx, struct wined3d_sampler *sampler)
Definition: cs.c:1411
ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler)
Definition: sampler.c:27

Referenced by wined3d_device_set_cs_sampler(), wined3d_device_set_ds_sampler(), wined3d_device_set_gs_sampler(), wined3d_device_set_hs_sampler(), wined3d_device_set_ps_sampler(), and wined3d_device_set_vs_sampler().

◆ wined3d_device_set_sampler_state()

void CDECL wined3d_device_set_sampler_state ( struct wined3d_device device,
UINT  sampler_idx,
enum wined3d_sampler_state  state,
DWORD  value 
)

Definition at line 2071 of file device.c.

2073{
2075
2076 TRACE("device %p, sampler_idx %u, state %s, value %#x.\n",
2077 device, sampler_idx, debug_d3dsamplerstate(state), value);
2078
2079 if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
2081
2082 if (sampler_idx >= ARRAY_SIZE(device->state.sampler_states))
2083 {
2084 WARN("Invalid sampler %u.\n", sampler_idx);
2085 return; /* Windows accepts overflowing this array ... we do not. */
2086 }
2087
2088 old_value = device->state.sampler_states[sampler_idx][state];
2089 device->update_state->sampler_states[sampler_idx][state] = value;
2090
2091 /* Handle recording of state blocks. */
2092 if (device->recording)
2093 {
2094 TRACE("Recording... not performing anything.\n");
2095 device->recording->changed.samplerState[sampler_idx] |= 1u << state;
2096 return;
2097 }
2098
2099 if (old_value == value)
2100 {
2101 TRACE("Application is setting the old value over, nothing to do.\n");
2102 return;
2103 }
2104
2106}
void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
Definition: cs.c:1538

Referenced by d3d8_device_SetTextureStageState(), d3d9_device_SetSamplerState(), d3d_device7_SetRenderState(), d3d_device7_SetTextureStageState(), and wined3d_stateblock_apply().

◆ wined3d_device_set_scissor_rect()

void CDECL wined3d_device_set_scissor_rect ( struct wined3d_device device,
const RECT rect 
)

Definition at line 2126 of file device.c.

2127{
2128 TRACE("device %p, rect %s.\n", device, wine_dbgstr_rect(rect));
2129
2130 if (device->recording)
2131 device->recording->changed.scissorRect = TRUE;
2132
2133 if (EqualRect(&device->update_state->scissor_rect, rect))
2134 {
2135 TRACE("App is setting the old scissor rectangle over, nothing to do.\n");
2136 return;
2137 }
2138 CopyRect(&device->update_state->scissor_rect, rect);
2139
2140 if (device->recording)
2141 {
2142 TRACE("Recording... not performing anything.\n");
2143 return;
2144 }
2145
2147}
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)

Referenced by d3d9_device_SetScissorRect(), and wined3d_stateblock_apply().

◆ wined3d_device_set_shader_resource_view()

static void wined3d_device_set_shader_resource_view ( struct wined3d_device device,
enum wined3d_shader_type  type,
UINT  idx,
struct wined3d_shader_resource_view view 
)
static

Definition at line 2264 of file device.c.

2266{
2267 struct wined3d_shader_resource_view *prev;
2268
2270 {
2271 WARN("Invalid view index %u.\n", idx);
2272 return;
2273 }
2274
2275 prev = device->update_state->shader_resource_view[type][idx];
2276 if (view == prev)
2277 return;
2278
2279 if (view)
2281 device->update_state->shader_resource_view[type][idx] = view;
2282 if (!device->recording)
2284 if (prev)
2286}
void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT view_idx, struct wined3d_shader_resource_view *view)
Definition: cs.c:1352
ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_view *view)
Definition: view.c:643
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view)
Definition: view.c:671

Referenced by wined3d_device_set_cs_resource_view(), wined3d_device_set_ds_resource_view(), wined3d_device_set_gs_resource_view(), wined3d_device_set_hs_resource_view(), wined3d_device_set_ps_resource_view(), and wined3d_device_set_vs_resource_view().

◆ wined3d_device_set_software_vertex_processing()

void CDECL wined3d_device_set_software_vertex_processing ( struct wined3d_device device,
BOOL  software 
)

Definition at line 3967 of file device.c.

3968{
3969 TRACE("device %p, software %#x.\n", device, software);
3970
3971 device->softwareVertexProcessing = software;
3972}

Referenced by d3d9_device_SetSoftwareVertexProcessing().

◆ wined3d_device_set_stream_output()

void CDECL wined3d_device_set_stream_output ( struct wined3d_device device,
UINT  idx,
struct wined3d_buffer buffer,
UINT  offset 
)

Definition at line 1335 of file device.c.

1337{
1339 struct wined3d_buffer *prev_buffer;
1340
1341 TRACE("device %p, idx %u, buffer %p, offset %u.\n", device, idx, buffer, offset);
1342
1344 {
1345 WARN("Invalid stream output %u.\n", idx);
1346 return;
1347 }
1348
1349 stream = &device->update_state->stream_output[idx];
1350 prev_buffer = stream->buffer;
1351
1352 if (buffer)
1354 stream->buffer = buffer;
1355 stream->offset = offset;
1356 if (!device->recording)
1358 if (prev_buffer)
1359 wined3d_buffer_decref(prev_buffer);
1360}
void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset)
Definition: cs.c:1166

◆ wined3d_device_set_stream_source()

HRESULT CDECL wined3d_device_set_stream_source ( struct wined3d_device device,
UINT  stream_idx,
struct wined3d_buffer buffer,
UINT  offset,
UINT  stride 
)

Definition at line 1378 of file device.c.

1380{
1382 struct wined3d_buffer *prev_buffer;
1383
1384 TRACE("device %p, stream_idx %u, buffer %p, offset %u, stride %u.\n",
1385 device, stream_idx, buffer, offset, stride);
1386
1387 if (stream_idx >= MAX_STREAMS)
1388 {
1389 WARN("Stream index %u out of range.\n", stream_idx);
1391 }
1392 else if (offset & 0x3)
1393 {
1394 WARN("Offset %u is not 4 byte aligned.\n", offset);
1396 }
1397
1398 stream = &device->update_state->streams[stream_idx];
1399 prev_buffer = stream->buffer;
1400
1401 if (device->recording)
1402 device->recording->changed.streamSource |= 1u << stream_idx;
1403
1404 if (prev_buffer == buffer
1405 && stream->stride == stride
1406 && stream->offset == offset)
1407 {
1408 TRACE("Application is setting the old values over, nothing to do.\n");
1409 return WINED3D_OK;
1410 }
1411
1412 stream->buffer = buffer;
1413 if (buffer)
1414 {
1415 stream->stride = stride;
1416 stream->offset = offset;
1418 }
1419
1420 if (!device->recording)
1422 if (prev_buffer)
1423 wined3d_buffer_decref(prev_buffer);
1424
1425 return WINED3D_OK;
1426}
void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: cs.c:1107

Referenced by d3d8_device_DrawIndexedPrimitiveUP(), d3d8_device_DrawPrimitiveUP(), d3d8_device_SetStreamSource(), d3d9_device_DrawIndexedPrimitiveUP(), d3d9_device_DrawPrimitiveUP(), d3d9_device_SetStreamSource(), d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), d3d_device7_DrawIndexedPrimitiveVB(), d3d_device7_DrawPrimitive(), d3d_device7_DrawPrimitiveStrided(), d3d_device7_DrawPrimitiveVB(), d3d_vertex_buffer7_ProcessVertices(), d3d_vertex_buffer7_Release(), and wined3d_stateblock_apply().

◆ wined3d_device_set_stream_source_freq()

HRESULT CDECL wined3d_device_set_stream_source_freq ( struct wined3d_device device,
UINT  stream_idx,
UINT  divider 
)

Definition at line 1451 of file device.c.

1452{
1454 UINT old_flags, old_freq;
1455
1456 TRACE("device %p, stream_idx %u, divider %#x.\n", device, stream_idx, divider);
1457
1458 /* Verify input. At least in d3d9 this is invalid. */
1460 {
1461 WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL.\n");
1463 }
1464 if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && !stream_idx)
1465 {
1466 WARN("INSTANCEDATA used on stream 0, returning D3DERR_INVALIDCALL.\n");
1468 }
1469 if (!divider)
1470 {
1471 WARN("Divider is 0, returning D3DERR_INVALIDCALL.\n");
1473 }
1474
1475 stream = &device->update_state->streams[stream_idx];
1476 old_flags = stream->flags;
1477 old_freq = stream->frequency;
1478
1480 stream->frequency = divider & 0x7fffff;
1481
1482 if (device->recording)
1483 device->recording->changed.streamFreq |= 1u << stream_idx;
1484 else if (stream->frequency != old_freq || stream->flags != old_flags)
1485 wined3d_cs_emit_set_stream_source_freq(device->cs, stream_idx, stream->frequency, stream->flags);
1486
1487 return WINED3D_OK;
1488}
void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags)
Definition: cs.c:1134
#define WINED3DSTREAMSOURCE_INSTANCEDATA
Definition: wined3d.h:1003
#define WINED3DSTREAMSOURCE_INDEXEDDATA
Definition: wined3d.h:1002

Referenced by d3d9_device_SetStreamSourceFreq(), and wined3d_stateblock_apply().

◆ wined3d_device_set_texture()

HRESULT CDECL wined3d_device_set_texture ( struct wined3d_device device,
UINT  stage,
struct wined3d_texture texture 
)

Definition at line 3462 of file device.c.

3464{
3465 struct wined3d_texture *prev;
3466
3467 TRACE("device %p, stage %u, texture %p.\n", device, stage, texture);
3468
3471
3472 /* Windows accepts overflowing this array... we do not. */
3473 if (stage >= ARRAY_SIZE(device->state.textures))
3474 {
3475 WARN("Ignoring invalid stage %u.\n", stage);
3476 return WINED3D_OK;
3477 }
3478
3479 if (texture && texture->resource.usage & WINED3DUSAGE_SCRATCH)
3480 {
3481 WARN("Rejecting attempt to set scratch texture.\n");
3483 }
3484
3485 if (device->recording)
3486 device->recording->changed.textures |= 1u << stage;
3487
3488 prev = device->update_state->textures[stage];
3489 TRACE("Previous texture %p.\n", prev);
3490
3491 if (texture == prev)
3492 {
3493 TRACE("App is setting the same texture again, nothing to do.\n");
3494 return WINED3D_OK;
3495 }
3496
3497 TRACE("Setting new texture to %p.\n", texture);
3498 device->update_state->textures[stage] = texture;
3499
3500 if (texture)
3502 if (!device->recording)
3504 if (prev)
3506
3507 return WINED3D_OK;
3508}
void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture)
Definition: cs.c:1321
ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture)
Definition: texture.c:994
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:915

Referenced by d3d8_device_SetTexture(), d3d9_device_SetTexture(), d3d_device3_SetRenderState(), d3d_device7_SetTexture(), and wined3d_stateblock_apply().

◆ wined3d_device_set_texture_stage_state()

void CDECL wined3d_device_set_texture_stage_state ( struct wined3d_device device,
UINT  stage,
enum wined3d_texture_stage_state  state,
DWORD  value 
)

Definition at line 3405 of file device.c.

3407{
3408 const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
3410
3411 TRACE("device %p, stage %u, state %s, value %#x.\n",
3413
3415 {
3416 WARN("Invalid state %#x passed.\n", state);
3417 return;
3418 }
3419
3420 if (stage >= d3d_info->limits.ffp_blend_stages)
3421 {
3422 WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n",
3423 stage, d3d_info->limits.ffp_blend_stages - 1);
3424 return;
3425 }
3426
3427 old_value = device->update_state->texture_states[stage][state];
3428 device->update_state->texture_states[stage][state] = value;
3429
3430 if (device->recording)
3431 {
3432 TRACE("Recording... not performing anything.\n");
3433 device->recording->changed.textureState[stage] |= 1u << state;
3434 return;
3435 }
3436
3437 /* Checked after the assignments to allow proper stateblock recording. */
3438 if (old_value == value)
3439 {
3440 TRACE("Application is setting the old value over, nothing to do.\n");
3441 return;
3442 }
3443
3445}
void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, enum wined3d_texture_stage_state state, DWORD value)
Definition: cs.c:1516

Referenced by d3d8_device_SetTextureStageState(), d3d9_device_SetTextureStageState(), d3d_device3_SetRenderState(), d3d_device3_SetTexture(), d3d_device7_SetTextureStageState(), and wined3d_stateblock_apply().

◆ wined3d_device_set_transform()

void CDECL wined3d_device_set_transform ( struct wined3d_device device,
enum wined3d_transform_state  d3dts,
const struct wined3d_matrix matrix 
)

Definition at line 1505 of file device.c.

1507{
1508 TRACE("device %p, state %s, matrix %p.\n",
1509 device, debug_d3dtstype(d3dts), matrix);
1510 TRACE("%.8e %.8e %.8e %.8e\n", matrix->_11, matrix->_12, matrix->_13, matrix->_14);
1511 TRACE("%.8e %.8e %.8e %.8e\n", matrix->_21, matrix->_22, matrix->_23, matrix->_24);
1512 TRACE("%.8e %.8e %.8e %.8e\n", matrix->_31, matrix->_32, matrix->_33, matrix->_34);
1513 TRACE("%.8e %.8e %.8e %.8e\n", matrix->_41, matrix->_42, matrix->_43, matrix->_44);
1514
1515 /* Handle recording of state blocks. */
1516 if (device->recording)
1517 {
1518 TRACE("Recording... not performing anything.\n");
1519 device->recording->changed.transform[d3dts >> 5] |= 1u << (d3dts & 0x1f);
1520 device->update_state->transforms[d3dts] = *matrix;
1521 return;
1522 }
1523
1524 /* If the new matrix is the same as the current one,
1525 * we cut off any further processing. this seems to be a reasonable
1526 * optimization because as was noticed, some apps (warcraft3 for example)
1527 * tend towards setting the same matrix repeatedly for some reason.
1528 *
1529 * From here on we assume that the new matrix is different, wherever it matters. */
1530 if (!memcmp(&device->state.transforms[d3dts], matrix, sizeof(*matrix)))
1531 {
1532 TRACE("The application is setting the same matrix over again.\n");
1533 return;
1534 }
1535
1536 device->state.transforms[d3dts] = *matrix;
1538}
void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, const struct wined3d_matrix *matrix)
Definition: cs.c:1561

Referenced by d3d8_device_SetTransform(), d3d9_device_SetTransform(), d3d_device1_SetMatrix(), d3d_device3_MultiplyTransform(), d3d_device3_SetTransform(), d3d_device7_SetTransform(), update_clip_space(), wined3d_device_multiply_transform(), and wined3d_stateblock_apply().

◆ wined3d_device_set_unordered_access_view()

void CDECL wined3d_device_set_unordered_access_view ( struct wined3d_device device,
unsigned int  idx,
struct wined3d_unordered_access_view uav,
unsigned int  initial_count 
)

Definition at line 3052 of file device.c.

3054{
3055 TRACE("device %p, idx %u, uav %p, initial_count %#x.\n", device, idx, uav, initial_count);
3056
3058}

◆ wined3d_device_set_vertex_declaration()

void CDECL wined3d_device_set_vertex_declaration ( struct wined3d_device device,
struct wined3d_vertex_declaration declaration 
)

Definition at line 2157 of file device.c.

2159{
2160 struct wined3d_vertex_declaration *prev = device->update_state->vertex_declaration;
2161
2162 TRACE("device %p, declaration %p.\n", device, declaration);
2163
2164 if (device->recording)
2165 device->recording->changed.vertexDecl = TRUE;
2166
2167 if (declaration == prev)
2168 return;
2169
2170 if (declaration)
2172 device->update_state->vertex_declaration = declaration;
2173 if (!device->recording)
2175 if (prev)
2177}
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration)
Definition: cs.c:1076
ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration)
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)

Referenced by d3d8_device_SetVertexShader(), d3d9_device_SetFVF(), d3d9_device_SetVertexDeclaration(), d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), d3d_device7_DrawIndexedPrimitiveVB(), d3d_device7_DrawPrimitive(), d3d_device7_DrawPrimitiveStrided(), d3d_device7_DrawPrimitiveVB(), d3d_vertex_buffer7_ProcessVertices(), and wined3d_stateblock_apply().

◆ wined3d_device_set_vertex_shader()

void CDECL wined3d_device_set_vertex_shader ( struct wined3d_device device,
struct wined3d_shader shader 
)

Definition at line 2186 of file device.c.

2187{
2188 struct wined3d_shader *prev = device->update_state->shader[WINED3D_SHADER_TYPE_VERTEX];
2189
2190 TRACE("device %p, shader %p.\n", device, shader);
2191
2192 if (device->recording)
2193 device->recording->changed.vertexShader = TRUE;
2194
2195 if (shader == prev)
2196 return;
2197
2198 if (shader)
2200 device->update_state->shader[WINED3D_SHADER_TYPE_VERTEX] = shader;
2201 if (!device->recording)
2203 if (prev)
2205}

Referenced by d3d8_device_SetVertexShader(), d3d9_device_SetVertexShader(), and wined3d_stateblock_apply().

◆ wined3d_device_set_viewport()

void CDECL wined3d_device_set_viewport ( struct wined3d_device device,
const struct wined3d_viewport viewport 
)

Definition at line 1931 of file device.c.

1932{
1933 TRACE("device %p, viewport %p.\n", device, viewport);
1934 TRACE("x %.8e, y %.8e, w %.8e, h %.8e, min_z %.8e, max_z %.8e.\n",
1935 viewport->x, viewport->y, viewport->width, viewport->height, viewport->min_z, viewport->max_z);
1936
1937 device->update_state->viewport = *viewport;
1938
1939 /* Handle recording of state blocks */
1940 if (device->recording)
1941 {
1942 TRACE("Recording... not performing anything\n");
1943 device->recording->changed.viewport = TRUE;
1944 return;
1945 }
1946
1947 wined3d_cs_emit_set_viewport(device->cs, viewport);
1948}

Referenced by d3d8_device_SetViewport(), d3d9_device_SetViewport(), d3d_device7_SetViewport(), and wined3d_stateblock_apply().

◆ wined3d_device_set_vs_cb()

void CDECL wined3d_device_set_vs_cb ( struct wined3d_device device,
UINT  idx,
struct wined3d_buffer buffer 
)

Definition at line 2238 of file device.c.

2239{
2240 TRACE("device %p, idx %u, buffer %p.\n", device, idx, buffer);
2241
2243}

◆ wined3d_device_set_vs_consts_b()

HRESULT CDECL wined3d_device_set_vs_consts_b ( struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
const BOOL constants 
)

Definition at line 2366 of file device.c.

2368{
2369 unsigned int i;
2370
2371 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2372 device, start_idx, count, constants);
2373
2374 if (!constants || start_idx >= WINED3D_MAX_CONSTS_B)
2376
2377 if (count > WINED3D_MAX_CONSTS_B - start_idx)
2378 count = WINED3D_MAX_CONSTS_B - start_idx;
2379 memcpy(&device->update_state->vs_consts_b[start_idx], constants, count * sizeof(*constants));
2380 if (TRACE_ON(d3d))
2381 {
2382 for (i = 0; i < count; ++i)
2383 TRACE("Set BOOL constant %u to %#x.\n", start_idx + i, constants[i]);
2384 }
2385
2386 if (device->recording)
2387 {
2388 for (i = start_idx; i < count + start_idx; ++i)
2389 device->recording->changed.vertexShaderConstantsB |= (1u << i);
2390 }
2391 else
2392 {
2394 }
2395
2396 return WINED3D_OK;
2397}
@ WINED3D_PUSH_CONSTANTS_VS_B

Referenced by d3d9_device_SetVertexShaderConstantB(), and wined3d_stateblock_apply().

◆ wined3d_device_set_vs_consts_f()

HRESULT CDECL wined3d_device_set_vs_consts_f ( struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
const struct wined3d_vec4 constants 
)

Definition at line 2463 of file device.c.

2465{
2466 const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
2467 unsigned int i;
2468
2469 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2470 device, start_idx, count, constants);
2471
2472 if (!constants || start_idx >= d3d_info->limits.vs_uniform_count
2473 || count > d3d_info->limits.vs_uniform_count - start_idx)
2475
2476 memcpy(&device->update_state->vs_consts_f[start_idx], constants, count * sizeof(*constants));
2477 if (TRACE_ON(d3d))
2478 {
2479 for (i = 0; i < count; ++i)
2480 TRACE("Set vec4 constant %u to %s.\n", start_idx + i, debug_vec4(&constants[i]));
2481 }
2482
2483 if (device->recording)
2484 memset(&device->recording->changed.vs_consts_f[start_idx], 1,
2485 count * sizeof(*device->recording->changed.vs_consts_f));
2486 else
2488
2489 return WINED3D_OK;
2490}
@ WINED3D_PUSH_CONSTANTS_VS_F

Referenced by d3d8_device_SetVertexShaderConstant(), d3d9_device_SetVertexShaderConstantF(), and wined3d_stateblock_apply().

◆ wined3d_device_set_vs_consts_i()

HRESULT CDECL wined3d_device_set_vs_consts_i ( struct wined3d_device device,
unsigned int  start_idx,
unsigned int  count,
const struct wined3d_ivec4 constants 
)

Definition at line 2415 of file device.c.

2417{
2418 unsigned int i;
2419
2420 TRACE("device %p, start_idx %u, count %u, constants %p.\n",
2421 device, start_idx, count, constants);
2422
2423 if (!constants || start_idx >= WINED3D_MAX_CONSTS_I)
2425
2426 if (count > WINED3D_MAX_CONSTS_I - start_idx)
2427 count = WINED3D_MAX_CONSTS_I - start_idx;
2428 memcpy(&device->update_state->vs_consts_i[start_idx], constants, count * sizeof(*constants));
2429 if (TRACE_ON(d3d))
2430 {
2431 for (i = 0; i < count; ++i)
2432 TRACE("Set ivec4 constant %u to %s.\n", start_idx + i, debug_ivec4(&constants[i]));
2433 }
2434
2435 if (device->recording)
2436 {
2437 for (i = start_idx; i < count + start_idx; ++i)
2438 device->recording->changed.vertexShaderConstantsI |= (1u << i);
2439 }
2440 else
2441 {
2443 }
2444
2445 return WINED3D_OK;
2446}
@ WINED3D_PUSH_CONSTANTS_VS_I

Referenced by d3d9_device_SetVertexShaderConstantI(), and wined3d_stateblock_apply().

◆ wined3d_device_set_vs_resource_view()

void CDECL wined3d_device_set_vs_resource_view ( struct wined3d_device device,
UINT  idx,
struct wined3d_shader_resource_view view 
)

Definition at line 2288 of file device.c.

2290{
2291 TRACE("device %p, idx %u, view %p.\n", device, idx, view);
2292
2294}

◆ wined3d_device_set_vs_sampler()

void CDECL wined3d_device_set_vs_sampler ( struct wined3d_device device,
UINT  idx,
struct wined3d_sampler sampler 
)

Definition at line 2340 of file device.c.

2341{
2342 TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler);
2343
2345}

◆ wined3d_device_setup_fullscreen_window()

void CDECL wined3d_device_setup_fullscreen_window ( struct wined3d_device device,
HWND  window,
UINT  w,
UINT  h 
)

Definition at line 853 of file device.c.

854{
855 BOOL filter_messages;
856 LONG style, exstyle;
857
858 TRACE("Setting up window %p for fullscreen mode.\n", window);
859
860 if (device->style || device->exStyle)
861 {
862 ERR("Changing the window style for window %p, but another style (%08x, %08x) is already stored.\n",
863 window, device->style, device->exStyle);
864 }
865
868
869 style = fullscreen_style(device->style);
870 exstyle = fullscreen_exstyle(device->exStyle);
871
872 TRACE("Old style was %08x, %08x, setting to %08x, %08x.\n",
873 device->style, device->exStyle, style, exstyle);
874
875 filter_messages = device->filter_messages;
876 device->filter_messages = TRUE;
877
881
882 device->filter_messages = filter_messages;
883}
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define HWND_TOPMOST
Definition: winuser.h:1211
#define SWP_SHOWWINDOW
Definition: winuser.h:1251

Referenced by ddraw_set_cooperative_level(), device_init(), wined3d_device_reset(), and wined3d_swapchain_set_fullscreen().

◆ wined3d_device_show_cursor()

BOOL CDECL wined3d_device_show_cursor ( struct wined3d_device device,
BOOL  show 
)

Definition at line 4719 of file device.c.

4720{
4721 BOOL oldVisible = device->bCursorVisible;
4722
4723 TRACE("device %p, show %#x.\n", device, show);
4724
4725 /*
4726 * When ShowCursor is first called it should make the cursor appear at the OS's last
4727 * known cursor position.
4728 */
4729 if (show && !oldVisible)
4730 {
4731 POINT pt;
4732 GetCursorPos(&pt);
4733 device->xScreenSpace = pt.x;
4734 device->yScreenSpace = pt.y;
4735 }
4736
4737 if (device->hardwareCursor)
4738 {
4739 device->bCursorVisible = show;
4740 if (show)
4741 SetCursor(device->hardwareCursor);
4742 else
4743 SetCursor(NULL);
4744 }
4745 else if (device->cursor_texture)
4746 {
4747 device->bCursorVisible = show;
4748 }
4749
4750 return oldVisible;
4751}

Referenced by d3d8_device_ShowCursor(), and d3d9_device_ShowCursor().

◆ wined3d_device_uninit_3d()

HRESULT CDECL wined3d_device_uninit_3d ( struct wined3d_device device)

Definition at line 1195 of file device.c.

1196{
1197 unsigned int i;
1198
1199 TRACE("device %p.\n", device);
1200
1201 if (!device->d3d_initialized)
1203
1204 device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
1205
1206 if (device->logo_texture)
1207 wined3d_texture_decref(device->logo_texture);
1208 if (device->cursor_texture)
1209 wined3d_texture_decref(device->cursor_texture);
1210
1212
1214
1215#if defined(STAGING_CSMT)
1217#endif /* STAGING_CSMT */
1219
1220 if (device->fb.depth_stencil)
1221 {
1222 struct wined3d_rendertarget_view *view = device->fb.depth_stencil;
1223
1224 TRACE("Releasing depth/stencil view %p.\n", view);
1225
1226 device->fb.depth_stencil = NULL;
1228 }
1229
1230 if (device->auto_depth_stencil_view)
1231 {
1232 struct wined3d_rendertarget_view *view = device->auto_depth_stencil_view;
1233
1234 device->auto_depth_stencil_view = NULL;
1236 ERR("Something's still holding the auto depth/stencil view (%p).\n", view);
1237 }
1238
1239 for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
1240 {
1242 }
1243 if (device->back_buffer_view)
1244 {
1245 wined3d_rendertarget_view_decref(device->back_buffer_view);
1246 device->back_buffer_view = NULL;
1247 }
1248
1249 for (i = 0; i < device->swapchain_count; ++i)
1250 {
1251 TRACE("Releasing the implicit swapchain %u.\n", i);
1252 if (wined3d_swapchain_decref(device->swapchains[i]))
1253 FIXME("Something's still holding the implicit swapchain.\n");
1254 }
1255
1256 heap_free(device->swapchains);
1257 device->swapchains = NULL;
1258 device->swapchain_count = 0;
1259
1260 device->d3d_initialized = FALSE;
1261
1262 return WINED3D_OK;
1263}
BOOL context_set_current(struct wined3d_context *ctx)
Definition: context.c:1512

Referenced by d3d8_device_Release(), d3d9_device_Release(), ddraw_attach_d3d_device(), ddraw_destroy_swapchain(), and device_init().

◆ wined3d_device_uninit_gdi()

HRESULT CDECL wined3d_device_uninit_gdi ( struct wined3d_device device)

Definition at line 1265 of file device.c.

1266{
1267 unsigned int i;
1268
1269 device->blitter->ops->blitter_destroy(device->blitter, NULL);
1270
1271 for (i = 0; i < device->swapchain_count; ++i)
1272 {
1273 TRACE("Releasing the implicit swapchain %u.\n", i);
1274 if (wined3d_swapchain_decref(device->swapchains[i]))
1275 FIXME("Something's still holding the implicit swapchain.\n");
1276 }
1277
1278 heap_free(device->swapchains);
1279 device->swapchains = NULL;
1280 device->swapchain_count = 0;
1281 return WINED3D_OK;
1282}

Referenced by ddraw_destroy_swapchain().

◆ wined3d_device_update_sub_resource()

void CDECL wined3d_device_update_sub_resource ( struct wined3d_device device,
struct wined3d_resource resource,
unsigned int  sub_resource_idx,
const struct wined3d_box box,
const void data,
unsigned int  row_pitch,
unsigned int  depth_pitch 
)

Definition at line 4281 of file device.c.

4284{
4285 unsigned int width, height, depth;
4286 struct wined3d_box b;
4287
4288 TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n",
4289 device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch);
4290
4291 if (resource->type == WINED3D_RTYPE_BUFFER)
4292 {
4293 if (sub_resource_idx > 0)
4294 {
4295 WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
4296 return;
4297 }
4298
4299 width = resource->size;
4300 height = 1;
4301 depth = 1;
4302 }
4303 else if (resource->type == WINED3D_RTYPE_TEXTURE_1D ||
4305 {
4307 unsigned int level;
4308
4309 if (sub_resource_idx >= texture->level_count * texture->layer_count)
4310 {
4311 WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
4312 return;
4313 }
4314
4315 level = sub_resource_idx % texture->level_count;
4319 }
4320 else
4321 {
4322 FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
4323 return;
4324 }
4325
4326 if (!box)
4327 {
4328 wined3d_box_set(&b, 0, 0, width, height, 0, depth);
4329 box = &b;
4330 }
4331 else if (box->left >= box->right || box->right > width
4332 || box->top >= box->bottom || box->bottom > height
4333 || box->front >= box->back || box->back > depth)
4334 {
4335 WARN("Invalid box %s specified.\n", debug_box(box));
4336 return;
4337 }
4338
4339#if !defined(STAGING_CSMT)
4341
4342#endif /* STAGING_CSMT */
4343 wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch);
4344}
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int slice_pitch)
Definition: cs.c:2260
size_t size
Definition: utils.c:259
unsigned int row_pitch
static void wined3d_resource_wait_idle(struct wined3d_resource *resource)

Referenced by buffer_init(), and wined3d_texture_create().

◆ wined3d_device_update_texture()

HRESULT CDECL wined3d_device_update_texture ( struct wined3d_device device,
struct wined3d_texture src_texture,
struct wined3d_texture dst_texture 
)

Definition at line 3808 of file device.c.

3810{
3811 unsigned int src_size, dst_size, src_skip_levels = 0;
3812 unsigned int src_level_count, dst_level_count;
3813 unsigned int layer_count, level_count, i, j;
3814 unsigned int width, height, depth;
3816 struct wined3d_box box;
3817
3818 TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture);
3819
3820 /* Verify that the source and destination textures are non-NULL. */
3821 if (!src_texture || !dst_texture)
3822 {
3823 WARN("Source and destination textures must be non-NULL, returning WINED3DERR_INVALIDCALL.\n");
3825 }
3826
3827 if (src_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU
3828 || src_texture->resource.usage & WINED3DUSAGE_SCRATCH)
3829 {
3830 WARN("Source resource is GPU accessible or a scratch resource.\n");
3832 }
3833 if (dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_CPU)
3834 {
3835 WARN("Destination resource is CPU accessible.\n");
3837 }
3838
3839 /* Verify that the source and destination textures are the same type. */
3840 type = src_texture->resource.type;
3841 if (dst_texture->resource.type != type)
3842 {
3843 WARN("Source and destination have different types, returning WINED3DERR_INVALIDCALL.\n");
3845 }
3846
3847 layer_count = src_texture->layer_count;
3848 if (layer_count != dst_texture->layer_count)
3849 {
3850 WARN("Source and destination have different layer counts.\n");
3852 }
3853
3854 if (src_texture->resource.format != dst_texture->resource.format)
3855 {
3856 WARN("Source and destination formats do not match.\n");
3858 }
3859
3860 src_level_count = src_texture->level_count;
3861 dst_level_count = dst_texture->level_count;
3862 level_count = min(src_level_count, dst_level_count);
3863
3864 src_size = max(src_texture->resource.width, src_texture->resource.height);
3865 dst_size = max(dst_texture->resource.width, dst_texture->resource.height);
3867 {
3868 src_size = max(src_size, src_texture->resource.depth);
3869 dst_size = max(dst_size, dst_texture->resource.depth);
3870 }
3871 while (src_size > dst_size)
3872 {
3873 src_size >>= 1;
3874 ++src_skip_levels;
3875 }
3876
3877 if (wined3d_texture_get_level_width(src_texture, src_skip_levels) != dst_texture->resource.width
3878 || wined3d_texture_get_level_height(src_texture, src_skip_levels) != dst_texture->resource.height
3879 || wined3d_texture_get_level_depth(src_texture, src_skip_levels) != dst_texture->resource.depth)
3880 {
3881 WARN("Source and destination dimensions do not match.\n");
3883 }
3884
3885 /* Update every surface level of the texture. */
3886 for (i = 0; i < level_count; ++i)
3887 {
3888 width = wined3d_texture_get_level_width(dst_texture, i);
3890 depth = wined3d_texture_get_level_depth(dst_texture, i);
3891 wined3d_box_set(&box, 0, 0, width, height, 0, depth);
3892
3893 for (j = 0; j < layer_count; ++j)
3894 {
3896 &dst_texture->resource, j * dst_level_count + i, &box,
3897 &src_texture->resource, j * src_level_count + i + src_skip_levels, &box,
3899 }
3900 }
3901
3902 return WINED3D_OK;
3903}
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56

Referenced by d3d8_device_UpdateTexture(), and d3d9_device_UpdateTexture().

◆ wined3d_device_validate_device()

HRESULT CDECL wined3d_device_validate_device ( const struct wined3d_device device,
DWORD num_passes 
)

Definition at line 3905 of file device.c.

3906{
3907 const struct wined3d_state *state = &device->state;
3908 struct wined3d_texture *texture;
3909 DWORD i;
3910
3911 TRACE("device %p, num_passes %p.\n", device, num_passes);
3912
3913 for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
3914 {
3915 if (state->sampler_states[i][WINED3D_SAMP_MIN_FILTER] == WINED3D_TEXF_NONE)
3916 {
3917 WARN("Sampler state %u has minfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i);
3919 }
3920 if (state->sampler_states[i][WINED3D_SAMP_MAG_FILTER] == WINED3D_TEXF_NONE)
3921 {
3922 WARN("Sampler state %u has magfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i);
3924 }
3925
3926 texture = state->textures[i];
3927 if (!texture || texture->resource.format_flags & WINED3DFMT_FLAG_FILTERING) continue;
3928
3929 if (state->sampler_states[i][WINED3D_SAMP_MAG_FILTER] != WINED3D_TEXF_POINT)
3930 {
3931 WARN("Non-filterable texture and mag filter enabled on sampler %u, returning E_FAIL\n", i);
3932 return E_FAIL;
3933 }
3934 if (state->sampler_states[i][WINED3D_SAMP_MIN_FILTER] != WINED3D_TEXF_POINT)
3935 {
3936 WARN("Non-filterable texture and min filter enabled on sampler %u, returning E_FAIL\n", i);
3937 return E_FAIL;
3938 }
3939 if (state->sampler_states[i][WINED3D_SAMP_MIP_FILTER] != WINED3D_TEXF_NONE
3940 && state->sampler_states[i][WINED3D_SAMP_MIP_FILTER] != WINED3D_TEXF_POINT)
3941 {
3942 WARN("Non-filterable texture and mip filter enabled on sampler %u, returning E_FAIL\n", i);
3943 return E_FAIL;
3944 }
3945 }
3946
3947 if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE]
3948 || state->render_states[WINED3D_RS_STENCILENABLE])
3949 {
3950 struct wined3d_rendertarget_view *rt = device->fb.render_targets[0];
3951 struct wined3d_rendertarget_view *ds = device->fb.depth_stencil;
3952
3953 if (ds && rt && (ds->width < rt->width || ds->height < rt->height))
3954 {
3955 WARN("Depth stencil is smaller than the color buffer, returning D3DERR_CONFLICTINGRENDERSTATE\n");
3957 }
3958 }
3959
3960 /* return a sensible default */
3961 *num_passes = 1;
3962
3963 TRACE("returning D3D_OK\n");
3964 return WINED3D_OK;
3965}
#define WINED3DERR_UNSUPPORTEDTEXTUREFILTER
Definition: wined3d.h:45
@ WINED3D_RS_STENCILENABLE
Definition: wined3d.h:306
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:269
@ WINED3D_SAMP_MIN_FILTER
Definition: wined3d.h:541
@ WINED3D_SAMP_MIP_FILTER
Definition: wined3d.h:542
@ WINED3D_SAMP_MAG_FILTER
Definition: wined3d.h:540
#define WINED3DERR_CONFLICTINGRENDERSTATE
Definition: wined3d.h:44
#define WINED3DFMT_FLAG_FILTERING

Referenced by d3d8_device_ValidateDevice(), d3d9_device_ValidateDevice(), and d3d_device7_ValidateDevice().

◆ wined3d_sampler_compare()

static int wined3d_sampler_compare ( const void key,
const struct wine_rb_entry entry 
)
static

Definition at line 5188 of file device.c.

5189{
5191
5192 return memcmp(&sampler->desc, key, sizeof(sampler->desc));
5193}
Definition: copy.c:22

Referenced by device_init().

Variable Documentation

◆ WINED3D_default_light

const struct wined3d_light WINED3D_default_light
Initial value:
=
{
{ 1.0f, 1.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f },
0.0f,
0.0f,
0.0f, 0.0f, 0.0f,
0.0f,
0.0f
}

Definition at line 41 of file device.c.

Referenced by wined3d_device_set_light_enable(), and wined3d_state_record_lights().