ReactOS  0.4.13-dev-242-g611e6d7
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)
 
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_viewports (struct wined3d_device *device, unsigned int viewport_count, const struct wined3d_viewport *viewports)
 
void CDECL wined3d_device_get_viewports (const struct wined3d_device *device, unsigned int *viewport_count, struct wined3d_viewport *viewports)
 
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_rects (struct wined3d_device *device, unsigned int rect_count, const RECT *rects)
 
void CDECL wined3d_device_get_scissor_rects (const struct wined3d_device *device, unsigned int *rect_count, RECT *rects)
 
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)
 
void CDECL wined3d_device_set_max_frame_latency (struct wined3d_device *device, unsigned int latency)
 
unsigned int CDECL wined3d_device_get_max_frame_latency (const struct wined3d_device *device)
 
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, unsigned int flags)
 
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, unsigned int flags)
 
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 3126 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 784 of file device.c.

785 {
786  struct wined3d_sampler_desc desc;
787  HRESULT hr;
788 
789  desc.address_u = WINED3D_TADDRESS_WRAP;
790  desc.address_v = WINED3D_TADDRESS_WRAP;
791  desc.address_w = WINED3D_TADDRESS_WRAP;
792  memset(desc.border_color, 0, sizeof(desc.border_color));
793  desc.mag_filter = WINED3D_TEXF_POINT;
794  desc.min_filter = WINED3D_TEXF_POINT;
795  desc.mip_filter = WINED3D_TEXF_NONE;
796  desc.lod_bias = 0.0f;
797  desc.min_lod = -1000.0f;
798  desc.max_lod = 1000.0f;
799  desc.mip_base_level = 0;
800  desc.max_anisotropy = 1;
801  desc.compare = FALSE;
802  desc.comparison_func = WINED3D_CMP_NEVER;
803  desc.srgb_decode = TRUE;
804 
805  /* In SM4+ shaders there is a separation between resources and samplers. Some shader
806  * instructions allow access to resources without using samplers.
807  * In GLSL, resources are always accessed through sampler or image variables. The default
808  * sampler object is used to emulate the direct resource access when there is no sampler state
809  * to use.
810  */
812  {
813  ERR("Failed to create default sampler, hr %#x.\n", hr);
814  device->default_sampler = NULL;
815  }
816 
817  /* In D3D10+, a NULL sampler maps to the default sampler state. */
818  desc.address_u = WINED3D_TADDRESS_CLAMP;
819  desc.address_v = WINED3D_TADDRESS_CLAMP;
820  desc.address_w = WINED3D_TADDRESS_CLAMP;
821  desc.mag_filter = WINED3D_TEXF_LINEAR;
822  desc.min_filter = WINED3D_TEXF_LINEAR;
823  desc.mip_filter = WINED3D_TEXF_LINEAR;
825  {
826  ERR("Failed to create null sampler, hr %#x.\n", hr);
827  device->null_sampler = NULL;
828  }
829 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
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
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109
const struct wined3d_parent_ops wined3d_null_parent_ops
Definition: directx.c:6781
#define memset(x, y, z)
Definition: compat.h:39

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

610 {
611  const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
612  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
613  struct wined3d_dummy_textures *textures = &device->dummy_textures;
614  unsigned int i;
615  DWORD color;
616 
618  color = 0x000000ff;
619  else
620  color = 0x00000000;
621 
622  /* Under DirectX you can sample even if no texture is bound, whereas
623  * OpenGL will only allow that when a valid texture is bound.
624  * We emulate this by creating dummy textures and binding them
625  * to each texture stage when the currently set D3D texture is NULL. */
626  context_active_texture(context, gl_info, 0);
627 
628  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_1d);
629  TRACE("Dummy 1D texture given name %u.\n", textures->tex_1d);
630  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, textures->tex_1d);
631  gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA8, 1, 0,
633 
634  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_2d);
635  TRACE("Dummy 2D texture given name %u.\n", textures->tex_2d);
636  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, textures->tex_2d);
637  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0,
639 
640  if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
641  {
642  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_rect);
643  TRACE("Dummy rectangle texture given name %u.\n", textures->tex_rect);
644  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textures->tex_rect);
645  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, 1, 1, 0,
647  }
648 
649  if (gl_info->supported[EXT_TEXTURE3D])
650  {
651  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_3d);
652  TRACE("Dummy 3D texture given name %u.\n", textures->tex_3d);
653  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_3D, textures->tex_3d);
656  }
657 
658  if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
659  {
660  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_cube);
661  TRACE("Dummy cube texture given name %u.\n", textures->tex_cube);
662  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP, textures->tex_cube);
664  {
665  gl_info->gl_ops.gl.p_glTexImage2D(i, 0, GL_RGBA8, 1, 1, 0,
667  }
668  }
669 
671  {
672  DWORD cube_array_data[6];
673 
674  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_cube_array);
675  TRACE("Dummy cube array texture given name %u.\n", textures->tex_cube_array);
676  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures->tex_cube_array);
677  for (i = 0; i < ARRAY_SIZE(cube_array_data); ++i)
678  cube_array_data[i] = color;
680  GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, cube_array_data));
681  }
682 
683  if (gl_info->supported[EXT_TEXTURE_ARRAY])
684  {
685  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_1d_array);
686  TRACE("Dummy 1D array texture given name %u.\n", textures->tex_1d_array);
687  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D_ARRAY, textures->tex_1d_array);
688  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_1D_ARRAY, 0, GL_RGBA8, 1, 1, 0,
690 
691  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_2d_array);
692  TRACE("Dummy 2D array texture given name %u.\n", textures->tex_2d_array);
693  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_ARRAY, textures->tex_2d_array);
696  }
697 
698  if (gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
699  {
700  GLuint buffer;
701 
702  GL_EXTCALL(glGenBuffers(1, &buffer));
703  GL_EXTCALL(glBindBuffer(GL_TEXTURE_BUFFER, buffer));
704  GL_EXTCALL(glBufferData(GL_TEXTURE_BUFFER, sizeof(color), &color, GL_STATIC_DRAW));
705  GL_EXTCALL(glBindBuffer(GL_TEXTURE_BUFFER, 0));
706 
707  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_buffer);
708  TRACE("Dummy buffer texture given name %u.\n", textures->tex_buffer);
709  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_BUFFER, textures->tex_buffer);
711  GL_EXTCALL(glDeleteBuffers(1, &buffer));
712  }
713 
714  if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE])
715  {
716  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_2d_ms);
717  TRACE("Dummy multisample texture given name %u.\n", textures->tex_2d_ms);
718  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, textures->tex_2d_ms);
719  GL_EXTCALL(glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 1, GL_RGBA8, 1, 1, GL_TRUE));
720 
721  gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_2d_ms_array);
722  TRACE("Dummy multisample array texture given name %u.\n", textures->tex_2d_ms_array);
723  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, textures->tex_2d_ms_array);
724  GL_EXTCALL(glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, GL_RGBA8, 1, 1, 1, GL_TRUE));
725 
726  if (gl_info->supported[ARB_CLEAR_TEXTURE])
727  {
728  GL_EXTCALL(glClearTexImage(textures->tex_2d_ms, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color));
729  GL_EXTCALL(glClearTexImage(textures->tex_2d_ms_array, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color));
730  }
731  else
732  {
733  WARN("ARB_clear_texture is currently required to clear dummy multisample textures.\n");
734  }
735  }
736 
737  checkGLcall("create dummy textures");
738 
740 }
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
Definition: gl.h:1795
struct opengl_funcs gl_ops
Definition: http.c:6587
void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info, unsigned int unit)
Definition: context.c:2486
#define GL_TEXTURE_BUFFER
Definition: glext.h:748
#define WARN(fmt,...)
Definition: debug.h:111
GLuint buffer
Definition: glext.h:5915
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_TEXTURE_CUBE_MAP_ARRAY
Definition: glext.h:920
#define GL_TEXTURE_2D_MULTISAMPLE
Definition: glext.h:1939
#define GL_TEXTURE_RECTANGLE_ARB
Definition: glext.h:1614
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 WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1327
#define GL_TEXTURE_1D
Definition: gl.h:644
#define GL_UNSIGNED_INT_8_8_8_8
Definition: gl.h:1494
GLuint color
Definition: glext.h:6243
Definition: devices.h:37
const GLuint * textures
Definition: glext.h:8098
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X
Definition: gl.h:1790
BOOL supported[WINED3D_GL_EXT_COUNT]
void context_bind_dummy_textures(const struct wined3d_device *device, const struct wined3d_context *context)
Definition: context.c:1750
#define GL_TEXTURE_3D
Definition: gl.h:1515
#define GL_EXTCALL(f)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GL_TEXTURE_1D_ARRAY
Definition: glext.h:533
#define GL_RGBA8
Definition: gl.h:762
#define GL_TEXTURE_2D_ARRAY
Definition: glext.h:535
#define GL_TEXTURE_CUBE_MAP
Definition: gl.h:1788
#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY
Definition: glext.h:1941
unsigned int GLuint
Definition: gl.h:159
#define ARRAY_SIZE(a)
Definition: main.h:24
#define GL_TRUE
Definition: gl.h:174
#define checkGLcall(A)
#define GL_TEXTURE_2D
Definition: gl.h:645
#define GL_RGBA
Definition: gl.h:503
#define GL_STATIC_DRAW
Definition: glext.h:350

Referenced by wined3d_device_create_primary_opengl_context_cs().

◆ d3d_primitive_type_from_gl()

enum wined3d_primitive_type d3d_primitive_type_from_gl ( GLenum  primitive_type)

Definition at line 102 of file device.c.

103 {
104  switch (primitive_type)
105  {
106  case GL_POINTS:
107  return WINED3D_PT_POINTLIST;
108 
109  case GL_LINES:
110  return WINED3D_PT_LINELIST;
111 
112  case GL_LINE_STRIP:
113  return WINED3D_PT_LINESTRIP;
114 
115  case GL_TRIANGLES:
117 
118  case GL_TRIANGLE_STRIP:
120 
121  case GL_TRIANGLE_FAN:
122  return WINED3D_PT_TRIANGLEFAN;
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:
142  return WINED3D_PT_UNDEFINED;
143  }
144 }
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
#define GL_TRIANGLES
Definition: gl.h:194
#define GL_LINE_STRIP_ADJACENCY_ARB
Definition: glext.h:1763
#define GL_POINTS
Definition: gl.h:190
#define FIXME(fmt,...)
Definition: debug.h:110
#define GL_TRIANGLE_FAN
Definition: gl.h:196
#define GL_LINE_STRIP
Definition: gl.h:193
#define GL_LINES
Definition: gl.h:191
const char * debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type)
Definition: utils.c:4288
#define GL_TRIANGLE_STRIP_ADJACENCY_ARB
Definition: glext.h:1765
#define GL_PATCHES
Definition: glext.h:2090
#define GL_TRIANGLES_ADJACENCY_ARB
Definition: glext.h:1764
#define GL_TRIANGLE_STRIP
Definition: gl.h:195
#define GL_LINES_ADJACENCY_ARB
Definition: glext.h:1762

Referenced by draw_primitive(), find_gs_compile_args(), and 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 832 of file device.c.

833 {
834  wined3d_sampler_decref(device->default_sampler);
835  device->default_sampler = NULL;
836  wined3d_sampler_decref(device->null_sampler);
837  device->null_sampler = NULL;
838 }
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
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 743 of file device.c.

744 {
745  struct wined3d_dummy_textures *dummy_textures = &device->dummy_textures;
746  const struct wined3d_gl_info *gl_info = context->gl_info;
747 
748  if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE])
749  {
750  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_2d_ms);
751  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_2d_ms_array);
752  }
753 
754  if (gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
755  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_buffer);
756 
757  if (gl_info->supported[EXT_TEXTURE_ARRAY])
758  {
759  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_2d_array);
760  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_1d_array);
761  }
762 
764  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_cube_array);
765 
766  if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
767  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_cube);
768 
769  if (gl_info->supported[EXT_TEXTURE3D])
770  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_3d);
771 
772  if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
773  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_rect);
774 
775  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_2d);
776  gl_info->gl_ops.gl.p_glDeleteTextures(1, &dummy_textures->tex_1d);
777 
778  checkGLcall("delete dummy textures");
779 
780  memset(dummy_textures, 0, sizeof(*dummy_textures));
781 }
struct opengl_funcs gl_ops
Definition: http.c:6587
Definition: devices.h:37
BOOL supported[WINED3D_GL_EXT_COUNT]
#define checkGLcall(A)
#define memset(x, y, z)
Definition: compat.h:39

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;
229  struct wined3d_rendertarget_view *dsv = fb->depth_stencil;
230  const struct wined3d_state *state = &device->cs->state;
231  struct wined3d_texture *depth_stencil = NULL;
232  const struct wined3d_gl_info *gl_info;
233  struct wined3d_texture *target = NULL;
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 (rtv && rtv->resource->type != WINED3D_RTYPE_BUFFER)
242  {
245  }
246  else
247  {
249  }
250 
251  if (dsv && dsv->resource->type != WINED3D_RTYPE_BUFFER)
252  depth_stencil = texture_from_resource(dsv->resource);
253 
254  if (!context->valid)
255  {
257  WARN("Invalid context, skipping clear.\n");
258  return;
259  }
260  gl_info = context->gl_info;
261 
262  /* When we're clearing parts of the drawable, make sure that the target surface is well up to date in the
263  * drawable. After the clear we'll mark the drawable up to date, so we have to make sure that this is true
264  * for the cleared parts, and the untouched parts.
265  *
266  * If we're clearing the whole target there is no need to copy it into the drawable, it will be overwritten
267  * anyway. If we're not clearing the color buffer we don't have to copy either since we're not going to set
268  * the drawable up to date. We have to check all settings that limit the clear area though. Do not bother
269  * checking all this if the dest surface is in the drawable anyway. */
270  for (i = 0; i < rt_count; ++i)
271  {
272  struct wined3d_rendertarget_view *rtv = fb->render_targets[i];
273 
274  if (rtv && rtv->format->id != WINED3DFMT_NULL)
275  {
277 
279  draw_rect, rect_count ? clear_rect : NULL))
280  wined3d_texture_load_location(rt, rtv->sub_resource_idx, context, rtv->resource->draw_binding);
281  else
282  wined3d_texture_prepare_location(rt, rtv->sub_resource_idx, context, rtv->resource->draw_binding);
283  }
284  }
285 
286  if (target)
287  {
288  render_offscreen = context->render_offscreen;
289  wined3d_rendertarget_view_get_drawable_size(rtv, context, &drawable_width, &drawable_height);
290  }
291  else
292  {
293  unsigned int ds_level = dsv->sub_resource_idx % depth_stencil->level_count;
294 
295  render_offscreen = TRUE;
296  drawable_width = wined3d_texture_get_level_pow2_width(depth_stencil, ds_level);
297  drawable_height = wined3d_texture_get_level_pow2_height(depth_stencil, ds_level);
298  }
299 
300  if (depth_stencil)
301  {
302  DWORD ds_location = render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE;
304 
306  && !is_full_clear(ds, dsv->sub_resource_idx, draw_rect, rect_count ? clear_rect : NULL))
308  else
310 
312  {
315  }
316  }
317 
318  if (!context_apply_clear_state(context, state, rt_count, fb))
319  {
321  WARN("Failed to apply clear state, skipping clear.\n");
322  return;
323  }
324 
325  /* Only set the values up once, as they are not changing. */
327  {
328  if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
329  {
330  gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
332  }
333  gl_info->gl_ops.gl.p_glStencilMask(~0U);
335  gl_info->gl_ops.gl.p_glClearStencil(stencil);
336  checkGLcall("glClearStencil");
337  clear_mask = clear_mask | GL_STENCIL_BUFFER_BIT;
338  }
339 
341  {
342  gl_info->gl_ops.gl.p_glDepthMask(GL_TRUE);
344  gl_info->gl_ops.gl.p_glClearDepth(depth);
345  checkGLcall("glClearDepth");
346  clear_mask = clear_mask | GL_DEPTH_BUFFER_BIT;
347  }
348 
350  {
351  for (i = 0; i < rt_count; ++i)
352  {
353  struct wined3d_rendertarget_view *rtv = fb->render_targets[i];
354  struct wined3d_texture *texture;
355 
356  if (!rtv)
357  continue;
358 
359  if (rtv->resource->type == WINED3D_RTYPE_BUFFER)
360  {
361  FIXME("Not supported on buffer resources.\n");
362  continue;
363  }
364 
368  }
369 
371  {
372  if (rt_count > 1)
373  WARN("Clearing multiple sRGB render targets with no GL_ARB_framebuffer_sRGB "
374  "support, this might cause graphical issues.\n");
375 
376  corrected_color.r = color->r < wined3d_srgb_const1[0]
377  ? color->r * wined3d_srgb_const0[3]
379  - wined3d_srgb_const0[2];
380  corrected_color.r = min(max(corrected_color.r, 0.0f), 1.0f);
381  corrected_color.g = color->g < wined3d_srgb_const1[0]
382  ? color->g * wined3d_srgb_const0[3]
384  - wined3d_srgb_const0[2];
385  corrected_color.g = min(max(corrected_color.g, 0.0f), 1.0f);
386  corrected_color.b = color->b < wined3d_srgb_const1[0]
387  ? color->b * wined3d_srgb_const0[3]
389  - wined3d_srgb_const0[2];
390  corrected_color.b = min(max(corrected_color.b, 0.0f), 1.0f);
391  color = &corrected_color;
392  }
393 
394  gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
395  for (i = 0; i < MAX_RENDER_TARGETS; ++i)
397  gl_info->gl_ops.gl.p_glClearColor(color->r, color->g, color->b, color->a);
398  checkGLcall("glClearColor");
399  clear_mask = clear_mask | GL_COLOR_BUFFER_BIT;
400  }
401 
402  if (!rect_count)
403  {
404  if (render_offscreen)
405  {
406  gl_info->gl_ops.gl.p_glScissor(draw_rect->left, draw_rect->top,
407  draw_rect->right - draw_rect->left, draw_rect->bottom - draw_rect->top);
408  }
409  else
410  {
411  gl_info->gl_ops.gl.p_glScissor(draw_rect->left, drawable_height - draw_rect->bottom,
412  draw_rect->right - draw_rect->left, draw_rect->bottom - draw_rect->top);
413  }
414  gl_info->gl_ops.gl.p_glClear(clear_mask);
415  }
416  else
417  {
418  RECT current_rect;
419 
420  /* Now process each rect in turn. */
421  for (i = 0; i < rect_count; ++i)
422  {
423  /* Note that GL uses lower left, width/height. */
424  IntersectRect(&current_rect, draw_rect, &clear_rect[i]);
425 
426  TRACE("clear_rect[%u] %s, current_rect %s.\n", i,
427  wine_dbgstr_rect(&clear_rect[i]),
428  wine_dbgstr_rect(&current_rect));
429 
430  /* Tests show that rectangles where x1 > x2 or y1 > y2 are ignored silently.
431  * The rectangle is not cleared, no error is returned, but further rectangles are
432  * still cleared if they are valid. */
433  if (current_rect.left > current_rect.right || current_rect.top > current_rect.bottom)
434  {
435  TRACE("Rectangle with negative dimensions, ignoring.\n");
436  continue;
437  }
438 
439  if (render_offscreen)
440  {
441  gl_info->gl_ops.gl.p_glScissor(current_rect.left, current_rect.top,
442  current_rect.right - current_rect.left, current_rect.bottom - current_rect.top);
443  }
444  else
445  {
446  gl_info->gl_ops.gl.p_glScissor(current_rect.left, drawable_height - current_rect.bottom,
447  current_rect.right - current_rect.left, current_rect.bottom - current_rect.top);
448  }
449  gl_info->gl_ops.gl.p_glClear(clear_mask);
450  }
451  }
452  context->scissor_rect_count = WINED3D_MAX_VIEWPORTS;
453  checkGLcall("clear");
454 
455  if (flags & WINED3DCLEAR_TARGET && target->swapchain && target->swapchain->front_buffer == target)
456  gl_info->gl_ops.gl.p_glFlush();
457 
459 }
#define MAX_RENDER_TARGETS
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
struct opengl_funcs gl_ops
Definition: http.c:6587
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
struct wined3d_rendertarget_view * render_targets[MAX_RENDER_TARGET_VIEWS]
#define GL_DEPTH_BUFFER_BIT
Definition: gl.h:710
#define WARN(fmt,...)
Definition: debug.h:111
#define U(x)
Definition: wordpad.c:44
#define GL_STENCIL_BUFFER_BIT
Definition: gl.h:712
LONG top
Definition: windef.h:292
#define ds
Definition: i386-dis.c:434
void context_invalidate_state(struct wined3d_context *context, DWORD state)
Definition: context.c:1638
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
static enum wined3d_render_state WINED3D_RS_COLORWRITE(int index)
Definition: wined3d.h:399
#define WINED3DCLEAR_STENCIL
Definition: wined3d.h:1001
GLint GLfloat GLint stencil
Definition: glext.h:6260
struct wined3d_texture *__cdecl wined3d_texture_from_resource(struct wined3d_resource *resource)
Definition: texture.c:2140
#define WINED3DCLEAR_ZBUFFER
Definition: wined3d.h:1000
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 GL_STENCIL_TEST_TWO_SIDE_EXT
Definition: glext.h:4210
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint color
Definition: glext.h:6243
Definition: devices.h:37
float pow(float __x, int __y)
Definition: _cmath.h:458
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL supported[WINED3D_GL_EXT_COUNT]
smooth NULL
Definition: ftsmooth.c:416
#define WINED3D_LOCATION_DRAWABLE
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:3002
void context_release(struct wined3d_context *context)
Definition: context.c:1559
const float wined3d_srgb_const0[]
Definition: shader.c:36
const struct wined3d_format * format
BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
Definition: texture.c:1800
const float wined3d_srgb_const1[]
Definition: shader.c:38
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
#define TRACE(s)
Definition: solgame.cpp:4
void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:286
GLenum GLuint texture
Definition: glext.h:6295
const char * wine_dbgstr_rect(const RECT *rect)
#define WINED3D_MAX_VIEWPORTS
Definition: wined3d.h:1579
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
static int state
Definition: maze.c:121
#define WINED3DCLEAR_TARGET
Definition: wined3d.h:999
static unsigned int wined3d_texture_get_level_pow2_height(const struct wined3d_texture *texture, unsigned int level)
struct wined3d_rendertarget_view * depth_stencil
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
unsigned int GLbitfield
Definition: gl.h:152
#define STATE_RENDER(a)
struct wined3d_context * context_acquire(const struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: context.c:4218
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:310
#define GL_TRUE
Definition: gl.h:174
#define checkGLcall(A)
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
Definition: texture.c:380
GLenum target
Definition: glext.h:7315
LONG bottom
Definition: windef.h:294
const struct wined3d_gl_info * gl_info
static BOOL needs_srgb_write(const struct wined3d_context *context, const struct wined3d_state *state, const struct wined3d_fb_state *fb)
static unsigned int wined3d_texture_get_level_pow2_width(const struct wined3d_texture *texture, unsigned int level)
struct wined3d_resource * resource

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 }
#define TRUE
Definition: types.h:120
Definition: http.c:6587
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109

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 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
Definition: http.c:6587
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
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
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int UINT
Definition: ndis.h:50
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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

1194 {
1196 
1198 }
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler)
Definition: sampler.c:53
uint32_t entry
Definition: isohybrid.c:63
GLuint sampler
Definition: glext.h:7283

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

5226 {
5227  struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx];
5228  const struct fragment_pipeline *fragment_pipeline;
5229  const struct wined3d_vertex_pipe_ops *vertex_pipeline;
5230  unsigned int i;
5231  HRESULT hr;
5232 
5233  device->ref = 1;
5234  device->wined3d = wined3d;
5235  wined3d_incref(device->wined3d);
5236  device->adapter = wined3d->adapter_count ? adapter : NULL;
5237  device->device_parent = device_parent;
5238  list_init(&device->resources);
5239  list_init(&device->shaders);
5240  device->surface_alignment = surface_alignment;
5241 
5242  /* Save the creation parameters. */
5243  device->create_parms.adapter_idx = adapter_idx;
5244  device->create_parms.device_type = device_type;
5245  device->create_parms.focus_window = focus_window;
5246  device->create_parms.flags = flags;
5247 
5248  device->shader_backend = adapter->shader_backend;
5249 
5250  vertex_pipeline = adapter->vertex_pipe;
5251 
5252  fragment_pipeline = adapter->fragment_pipe;
5253 
5255 
5256  if (vertex_pipeline->vp_states && fragment_pipeline->states
5257  && FAILED(hr = compile_state_table(device->StateTable, device->multistate_funcs,
5258  &adapter->gl_info, &adapter->d3d_info, vertex_pipeline,
5260  {
5261  ERR("Failed to compile state table, hr %#x.\n", hr);
5262  wine_rb_destroy(&device->samplers, NULL, NULL);
5263  wined3d_decref(device->wined3d);
5264  return hr;
5265  }
5266 
5267  state_init(&device->state, &device->fb, &adapter->gl_info,
5269  device->update_state = &device->state;
5270 
5271  device->max_frame_latency = 3;
5272 
5273  if (!(device->cs = wined3d_cs_create(device)))
5274  {
5275  WARN("Failed to create command stream.\n");
5276  state_cleanup(&device->state);
5277  hr = E_FAIL;
5278  goto err;
5279  }
5280 
5281  return WINED3D_OK;
5282 
5283 err:
5284  for (i = 0; i < ARRAY_SIZE(device->multistate_funcs); ++i)
5285  {
5286  heap_free(device->multistate_funcs[i]);
5287  }
5288  wine_rb_destroy(&device->samplers, NULL, NULL);
5289  wined3d_decref(device->wined3d);
5290  return hr;
5291 }
const struct StateEntryTemplate * states
struct wined3d_adapter adapters[1]
const struct wined3d_vertex_pipe_ops * vertex_pipe
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
device_type
#define E_FAIL
Definition: ddrawi.h:102
struct wined3d_gl_info gl_info
struct wined3d_d3d_info d3d_info
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
ULONG CDECL wined3d_incref(struct wined3d *wined3d)
Definition: directx.c:457
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
const struct StateEntryTemplate misc_state_template[]
Definition: state.c:4504
void state_cleanup(struct wined3d_state *state)
Definition: stateblock.c:527
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
Definition: rbtree.h:179
static int wined3d_sampler_compare(const void *key, const struct wine_rb_entry *entry)
Definition: device.c:5216
ULONG CDECL wined3d_decref(struct wined3d *wined3d)
Definition: directx.c:466
const struct wined3d_shader_backend_ops * shader_backend
LONG HRESULT
Definition: typedefs.h:77
#define WINED3D_OK
Definition: wined3d.h:37
GLbitfield flags
Definition: glext.h:7161
static void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
Definition: rbtree.h:198
UINT adapter_count
#define err(...)
#define ERR(fmt,...)
Definition: debug.h:109
#define ARRAY_SIZE(a)
Definition: main.h:24
const struct fragment_pipeline * fragment_pipe
void state_init(void *ipp)
Definition: dhclient.c:218
#define WINED3D_STATE_INIT_DEFAULT
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
struct wined3d_cs * wined3d_cs_create(struct wined3d_device *device)
Definition: cs.c:2816
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:5543
const struct StateEntryTemplate * vp_states
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ device_init_swapchain_state()

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

Definition at line 966 of file device.c.

967 {
968  BOOL ds_enable = swapchain->desc.enable_auto_depth_stencil;
969  unsigned int i;
970 
971  for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
972  {
974  }
975  if (device->back_buffer_view)
976  wined3d_device_set_rendertarget_view(device, 0, device->back_buffer_view, TRUE);
977 
978  wined3d_device_set_depth_stencil_view(device, ds_enable ? device->auto_depth_stencil_view : NULL);
979 }
#define TRUE
Definition: types.h:120
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
Definition: device.c:4559
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
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
struct wined3d_swapchain_desc desc
smooth NULL
Definition: ftsmooth.c:416
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:4502

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

5294 {
5295  DWORD rep = device->StateTable[state].representative;
5296  struct wined3d_context *context;
5297  DWORD idx;
5298  BYTE shift;
5299  UINT i;
5300 
5301  wined3d_from_cs(device->cs);
5302 
5303  if (STATE_IS_COMPUTE(state))
5304  {
5305  for (i = 0; i < device->context_count; ++i)
5307  return;
5308  }
5309 
5310  for (i = 0; i < device->context_count; ++i)
5311  {
5312  context = device->contexts[i];
5313  if(isStateDirty(context, rep)) continue;
5314 
5315  context->dirtyArray[context->numDirtyEntries++] = rep;
5316  idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT);
5317  shift = rep & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1);
5318  context->isStateDirty[idx] |= (1u << shift);
5319  }
5320 }
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
#define shift
Definition: input.c:1668
Definition: http.c:6587
static void wined3d_from_cs(const struct wined3d_cs *cs)
#define CHAR_BIT
Definition: urlcache.c:57
#define STATE_IS_COMPUTE(a)
static BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
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
Definition: devices.h:37
unsigned int idx
Definition: utils.c:41
void context_invalidate_compute_state(struct wined3d_context *context, DWORD state_id)
Definition: context.c:1628
unsigned long DWORD
Definition: ntddk_ex.h:95
static int state
Definition: maze.c:121
unsigned char BYTE
Definition: mem.h:68
unsigned int UINT
Definition: ndis.h:50

Referenced by buffer_destroy_buffer_object(), texture2d_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_rects(), 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_viewports(), and wined3d_swapchain_rotate().

◆ device_leftover_sampler()

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

Definition at line 470 of file device.c.

471 {
473 
474  ERR("Leftover sampler %p.\n", sampler);
475 }
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
uint32_t entry
Definition: isohybrid.c:63
#define ERR(fmt,...)
Definition: debug.h:109
GLuint sampler
Definition: glext.h:7283

Referenced by wined3d_device_decref().

◆ device_load_logo()

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

Definition at line 552 of file device.c.

553 {
556  HBITMAP hbm;
557  BITMAP bm;
558  HRESULT hr;
559  HDC dcb = NULL, dcs = NULL;
560 
562  {
563  ERR_(winediag)("Failed to load logo %s.\n", wine_dbgstr_a(filename));
564  return;
565  }
566  GetObjectA(hbm, sizeof(BITMAP), &bm);
567 
568  if (!(dcb = CreateCompatibleDC(NULL)))
569  goto out;
570  SelectObject(dcb, hbm);
571 
572  desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
573  desc.format = WINED3DFMT_B5G6R5_UNORM;
574  desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
575  desc.multisample_quality = 0;
576  desc.usage = WINED3DUSAGE_DYNAMIC;
578  desc.width = bm.bmWidth;
579  desc.height = bm.bmHeight;
580  desc.depth = 1;
581  desc.size = 0;
584  NULL, NULL, &wined3d_null_parent_ops, &device->logo_texture)))
585  {
586  ERR("Wine logo requested, but failed to create texture, hr %#x.\n", hr);
587  goto out;
588  }
589 
590  if (FAILED(hr = wined3d_texture_get_dc(device->logo_texture, 0, &dcs)))
591  {
592  wined3d_texture_decref(device->logo_texture);
593  device->logo_texture = NULL;
594  goto out;
595  }
596  BitBlt(dcs, 0, 0, bm.bmWidth, bm.bmHeight, dcb, 0, 0, SRCCOPY);
597  wined3d_texture_release_dc(device->logo_texture, 0, dcs);
598 
599  color_key.color_space_low_value = 0;
600  color_key.color_space_high_value = 0;
602 
603 out:
604  if (dcb) DeleteDC(dcb);
605  if (hbm) DeleteObject(hbm);
606 }
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:186
HRESULT hr
Definition: shlfolder.c:183
#define WINED3D_CKEY_SRC_BLT
Definition: wined3d.h:1336
#define LR_LOADFROMFILE
Definition: winuser.h:1082
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:916
#define ERR_(ch,...)
Definition: debug.h:156
static HDC
Definition: imagelist.c:92
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
Definition: texture.c:3484
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
const char * filename
Definition: ioapi.h:135
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:416
#define WINED3D_TEXTURE_CREATE_GET_DC
Definition: wined3d.h:1561
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture, DWORD flags, const struct wined3d_color_key *color_key)
Definition: texture.c:1431
LONG HRESULT
Definition: typedefs.h:77
static FILE * out
Definition: regtests2xml.c:44
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define ERR(fmt,...)
Definition: debug.h:109
HANDLE WINAPI LoadImageA(_In_opt_ HINSTANCE, _In_ LPCSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2147
BOOL WINAPI DeleteDC(_In_ HDC)
#define WINED3D_TEXTURE_CREATE_MAPPABLE
Definition: wined3d.h:1558
const struct wined3d_parent_ops wined3d_null_parent_ops
Definition: directx.c:6781
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
Definition: bl.h:1331
HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc)
Definition: texture.c:3436
#define LR_CREATEDIBSECTION
Definition: winuser.h:1088
#define IMAGE_BITMAP
Definition: winuser.h:211
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1219
static HBITMAP
Definition: button.c:44
#define SRCCOPY
Definition: wingdi.h:332
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:3326

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

5324 {
5325  if (device->filter_messages && message != WM_DISPLAYCHANGE)
5326  {
5327  TRACE("Filtering message: window %p, message %#x, wparam %#lx, lparam %#lx.\n",
5329  if (unicode)
5331  else
5333  }
5334 
5335  if (message == WM_DESTROY)
5336  {
5337  TRACE("unregister window %p.\n", window);
5339 
5340  if (InterlockedCompareExchangePointer((void **)&device->focus_window, NULL, window) != window)
5341  ERR("Window %p is not the focus window for device %p.\n", window, device);
5342  }
5343  else if (message == WM_DISPLAYCHANGE)
5344  {
5345  device->device_parent->ops->mode_changed(device->device_parent);
5346  }
5347  else if (message == WM_ACTIVATEAPP)
5348  {
5349  UINT i;
5350 
5351  for (i = 0; i < device->swapchain_count; i++)
5352  wined3d_swapchain_activate(device->swapchains[i], wparam);
5353 
5354  device->device_parent->ops->activate(device->device_parent, wparam);
5355  }
5356  else if (message == WM_SYSCOMMAND)
5357  {
5358  if (wparam == SC_RESTORE && device->wined3d->flags & WINED3D_HANDLE_RESTORE)
5359  {
5360  if (unicode)
5362  else
5364  }
5365  }
5366 
5367  if (unicode)
5369  else
5371 }
Definition: tftpd.h:59
#define SC_RESTORE
Definition: winuser.h:2552
#define WINED3D_HANDLE_RESTORE
Definition: wined3d.h:1323
static HANDLE proc()
Definition: pdb.c:32
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
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
void wined3d_unregister_window(HWND window)
Definition: wined3d_main.c:462
Definition: devices.h:37
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate)
Definition: swapchain.c:1124
#define WM_DESTROY
Definition: winuser.h:1591
#define TRACE(s)
Definition: solgame.cpp:4
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static IHTMLWindow2 * window
Definition: events.c:77
#define ERR(fmt,...)
Definition: debug.h:109
#define WM_ACTIVATEAPP
Definition: winuser.h:1614
unsigned int UINT
Definition: ndis.h:50
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SYSCOMMAND
Definition: winuser.h:1717
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by wined3d_wndproc().

◆ device_resource_add()

void device_resource_add ( struct wined3d_device device,
struct wined3d_resource resource 
)

Definition at line 5115 of file device.c.

5116 {
5117  TRACE("device %p, resource %p.\n", device, resource);
5118 
5120 
5121  list_add_head(&device->resources, &resource->resource_list_entry);
5122 }
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
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 5133 of file device.c.

5134 {
5135  enum wined3d_resource_type type = resource->type;
5136  struct wined3d_rendertarget_view *rtv;
5137  unsigned int i;
5138 
5139  TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type));
5140 
5141  if (device->d3d_initialized)
5142  {
5143  for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
5144  {
5145  if ((rtv = device->fb.render_targets[i]) && rtv->resource == resource)
5146  ERR("Resource %p is still in use as render target %u.\n", resource, i);
5147  }
5148 
5149  if ((rtv = device->fb.depth_stencil) && rtv->resource == resource)
5150  ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
5151  }
5152 
5153  switch (type)
5154  {
5158  for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
5159  {
5160  if (&device->state.textures[i]->resource == resource)
5161  {
5162  ERR("Texture resource %p is still in use, stage %u.\n", resource, i);
5163  device->state.textures[i] = NULL;
5164  }
5165 
5166  if (device->recording && &device->update_state->textures[i]->resource == resource)
5167  {
5168  ERR("Texture resource %p is still in use by recording stateblock %p, stage %u.\n",
5169  resource, device->recording, i);
5170  device->update_state->textures[i] = NULL;
5171  }
5172  }
5173  break;
5174 
5175  case WINED3D_RTYPE_BUFFER:
5176  for (i = 0; i < MAX_STREAMS; ++i)
5177  {
5178  if (&device->state.streams[i].buffer->resource == resource)
5179  {
5180  ERR("Buffer resource %p is still in use, stream %u.\n", resource, i);
5181  device->state.streams[i].buffer = NULL;
5182  }
5183 
5184  if (device->recording && &device->update_state->streams[i].buffer->resource == resource)
5185  {
5186  ERR("Buffer resource %p is still in use by stateblock %p, stream %u.\n",
5187  resource, device->recording, i);
5188  device->update_state->streams[i].buffer = NULL;
5189  }
5190  }
5191 
5192  if (&device->state.index_buffer->resource == resource)
5193  {
5194  ERR("Buffer resource %p is still in use as index buffer.\n", resource);
5195  device->state.index_buffer = NULL;
5196  }
5197 
5198  if (device->recording && &device->update_state->index_buffer->resource == resource)
5199  {
5200  ERR("Buffer resource %p is still in use by stateblock %p as index buffer.\n",
5201  resource, device->recording);
5202  device->update_state->index_buffer = NULL;
5203  }
5204  break;
5205 
5206  default:
5207  break;
5208  }
5209 
5210  /* Remove the resource from the resourceStore */
5212 
5213  TRACE("Resource released.\n");
5214 }
wined3d_resource_type
Definition: wined3d.h:704
static void device_resource_remove(struct wined3d_device *device, struct wined3d_resource *resource)
Definition: device.c:5124
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat 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 MAX_COMBINED_SAMPLERS
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109
#define MAX_STREAMS
const char * debug_d3dresourcetype(enum wined3d_resource_type resource_type)
Definition: utils.c:4271
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 5124 of file device.c.

5125 {
5126  TRACE("device %p, resource %p.\n", device, resource);
5127 
5129 
5130  list_remove(&resource->resource_list_entry);
5131 }
Definition: devices.h:37
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
static void wined3d_not_from_cs(struct wined3d_cs *cs)

Referenced by device_resource_released().

◆ fullscreen_exstyle()

static LONG fullscreen_exstyle ( LONG  exstyle)
static

Definition at line 849 of file device.c.

850 {
851  /* Filter out window decorations. */
852  exstyle &= ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE);
853 
854  return exstyle;
855 }
#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 840 of file device.c.

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

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 
92  case WINED3D_PT_PATCH:
93  return GL_PATCHES;
94 
95  default:
96  FIXME("Unhandled primitive type %s.\n", debug_d3dprimitivetype(primitive_type));
98  return ~0u;
99  }
100 }
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
#define GL_TRIANGLES
Definition: gl.h:194
#define GL_LINE_STRIP_ADJACENCY_ARB
Definition: glext.h:1763
#define GL_POINTS
Definition: gl.h:190
#define FIXME(fmt,...)
Definition: debug.h:110
#define GL_TRIANGLE_FAN
Definition: gl.h:196
#define GL_LINE_STRIP
Definition: gl.h:193
#define GL_LINES
Definition: gl.h:191
const char * debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type)
Definition: utils.c:4288
#define GL_TRIANGLE_STRIP_ADJACENCY_ARB
Definition: glext.h:1765
#define GL_PATCHES
Definition: glext.h:2090
#define GL_TRIANGLES_ADJACENCY_ARB
Definition: glext.h:1764
#define GL_TRIANGLE_STRIP
Definition: gl.h:195
#define GL_LINES_ADJACENCY_ARB
Definition: glext.h:1762

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 width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
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)
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
GLenum GLuint texture
Definition: glext.h:6295
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
LONG bottom
Definition: windef.h:294

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

3130 {
3131  struct wined3d_matrix mat, proj_mat, view_mat, world_mat;
3132  struct wined3d_map_desc map_desc;
3133  struct wined3d_box box = {0};
3134  struct wined3d_viewport vp;
3135  UINT vertex_size;
3136  unsigned int i;
3137  BYTE *dest_ptr;
3138  BOOL doClip;
3139  DWORD numTextures;
3140  HRESULT hr;
3141 
3142  if (stream_info->use_map & (1u << WINED3D_FFP_NORMAL))
3143  {
3144  WARN(" lighting state not saved yet... Some strange stuff may happen !\n");
3145  }
3146 
3147  if (!(stream_info->use_map & (1u << WINED3D_FFP_POSITION)))
3148  {
3149  ERR("Source has no position mask\n");
3150  return WINED3DERR_INVALIDCALL;
3151  }
3152 
3153  if (device->state.render_states[WINED3D_RS_CLIPPING])
3154  {
3155  static BOOL warned = FALSE;
3156  /*
3157  * The clipping code is not quite correct. Some things need
3158  * to be checked against IDirect3DDevice3 (!), d3d8 and d3d9,
3159  * so disable clipping for now.
3160  * (The graphics in Half-Life are broken, and my processvertices
3161  * test crashes with IDirect3DDevice3)
3162  doClip = TRUE;
3163  */
3164  doClip = FALSE;
3165  if(!warned) {
3166  warned = TRUE;
3167  FIXME("Clipping is broken and disabled for now\n");
3168  }
3169  }
3170  else
3171  doClip = FALSE;
3172 
3173  vertex_size = get_flexible_vertex_size(DestFVF);
3174  box.left = dwDestIndex * vertex_size;
3175  box.right = box.left + dwCount * vertex_size;
3176  if (FAILED(hr = wined3d_resource_map(&dest->resource, 0, &map_desc, &box, WINED3D_MAP_WRITE)))
3177  {
3178  WARN("Failed to map buffer, hr %#x.\n", hr);
3179  return hr;
3180  }
3181  dest_ptr = map_desc.data;
3182 
3186 
3187  TRACE("View mat:\n");
3188  TRACE("%.8e %.8e %.8e %.8e\n", view_mat._11, view_mat._12, view_mat._13, view_mat._14);
3189  TRACE("%.8e %.8e %.8e %.8e\n", view_mat._21, view_mat._22, view_mat._23, view_mat._24);
3190  TRACE("%.8e %.8e %.8e %.8e\n", view_mat._31, view_mat._32, view_mat._33, view_mat._34);
3191  TRACE("%.8e %.8e %.8e %.8e\n", view_mat._41, view_mat._42, view_mat._43, view_mat._44);
3192 
3193  TRACE("Proj mat:\n");
3194  TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._11, proj_mat._12, proj_mat._13, proj_mat._14);
3195  TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._21, proj_mat._22, proj_mat._23, proj_mat._24);
3196  TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._31, proj_mat._32, proj_mat._33, proj_mat._34);
3197  TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._41, proj_mat._42, proj_mat._43, proj_mat._44);
3198 
3199  TRACE("World mat:\n");
3200  TRACE("%.8e %.8e %.8e %.8e\n", world_mat._11, world_mat._12, world_mat._13, world_mat._14);
3201  TRACE("%.8e %.8e %.8e %.8e\n", world_mat._21, world_mat._22, world_mat._23, world_mat._24);
3202  TRACE("%.8e %.8e %.8e %.8e\n", world_mat._31, world_mat._32, world_mat._33, world_mat._34);
3203  TRACE("%.8e %.8e %.8e %.8e\n", world_mat._41, world_mat._42, world_mat._43, world_mat._44);
3204 
3205  /* Get the viewport */
3207  TRACE("viewport x %.8e, y %.8e, width %.8e, height %.8e, min_z %.8e, max_z %.8e.\n",
3208  vp.x, vp.y, vp.width, vp.height, vp.min_z, vp.max_z);
3209 
3210  multiply_matrix(&mat,&view_mat,&world_mat);
3211  multiply_matrix(&mat,&proj_mat,&mat);
3212 
3213  numTextures = (DestFVF & WINED3DFVF_TEXCOUNT_MASK) >> WINED3DFVF_TEXCOUNT_SHIFT;
3214 
3215  for (i = 0; i < dwCount; i+= 1) {
3216  unsigned int tex_index;
3217 
3218  if ( ((DestFVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZ ) ||
3219  ((DestFVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZRHW ) ) {
3220  /* The position first */
3222  const float *p = (const float *)(element->data.addr + i * element->stride);
3223  float x, y, z, rhw;
3224  TRACE("In: ( %06.2f %06.2f %06.2f )\n", p[0], p[1], p[2]);
3225 
3226  /* Multiplication with world, view and projection matrix. */
3227  x = (p[0] * mat._11) + (p[1] * mat._21) + (p[2] * mat._31) + mat._41;
3228  y = (p[0] * mat._12) + (p[1] * mat._22) + (p[2] * mat._32) + mat._42;
3229  z = (p[0] * mat._13) + (p[1] * mat._23) + (p[2] * mat._33) + mat._43;
3230  rhw = (p[0] * mat._14) + (p[1] * mat._24) + (p[2] * mat._34) + mat._44;
3231 
3232  TRACE("x=%f y=%f z=%f rhw=%f\n", x, y, z, rhw);
3233 
3234  /* WARNING: The following things are taken from d3d7 and were not yet checked
3235  * against d3d8 or d3d9!
3236  */
3237 
3238  /* Clipping conditions: From msdn
3239  *
3240  * A vertex is clipped if it does not match the following requirements
3241  * -rhw < x <= rhw
3242  * -rhw < y <= rhw
3243  * 0 < z <= rhw
3244  * 0 < rhw ( Not in d3d7, but tested in d3d7)
3245  *
3246  * If clipping is on is determined by the D3DVOP_CLIP flag in D3D7, and
3247  * by the D3DRS_CLIPPING in D3D9(according to the msdn, not checked)
3248  *
3249  */
3250 
3251  if( !doClip ||
3252  ( (-rhw -eps < x) && (-rhw -eps < y) && ( -eps < z) &&
3253  (x <= rhw + eps) && (y <= rhw + eps ) && (z <= rhw + eps) &&
3254  ( rhw > eps ) ) ) {
3255 
3256  /* "Normal" viewport transformation (not clipped)
3257  * 1) The values are divided by rhw
3258  * 2) The y axis is negative, so multiply it with -1
3259  * 3) Screen coordinates go from -(Width/2) to +(Width/2) and
3260  * -(Height/2) to +(Height/2). The z range is MinZ to MaxZ
3261  * 4) Multiply x with Width/2 and add Width/2
3262  * 5) The same for the height
3263  * 6) Add the viewpoint X and Y to the 2D coordinates and
3264  * The minimum Z value to z
3265  * 7) rhw = 1 / rhw Reciprocal of Homogeneous W....
3266  *
3267  * Well, basically it's simply a linear transformation into viewport
3268  * coordinates
3269  */
3270 
3271  x /= rhw;
3272  y /= rhw;
3273  z /= rhw;
3274 
3275  y *= -1;
3276 
3277  x *= vp.width / 2;
3278  y *= vp.height / 2;
3279  z *= vp.max_z - vp.min_z;
3280 
3281  x += vp.width / 2 + vp.x;
3282  y += vp.height / 2 + vp.y;
3283  z += vp.min_z;
3284 
3285  rhw = 1 / rhw;
3286  } else {
3287  /* That vertex got clipped
3288  * Contrary to OpenGL it is not dropped completely, it just
3289  * undergoes a different calculation.
3290  */
3291  TRACE("Vertex got clipped\n");
3292  x += rhw;
3293  y += rhw;
3294 
3295  x /= 2;
3296  y /= 2;
3297 
3298  /* Msdn mentions that Direct3D9 keeps a list of clipped vertices
3299  * outside of the main vertex buffer memory. That needs some more
3300  * investigation...
3301  */
3302  }
3303 
3304  TRACE("Writing (%f %f %f) %f\n", x, y, z, rhw);
3305 
3306 
3307  ( (float *) dest_ptr)[0] = x;
3308  ( (float *) dest_ptr)[1] = y;
3309  ( (float *) dest_ptr)[2] = z;
3310  ( (float *) dest_ptr)[3] = rhw; /* SIC, see ddraw test! */
3311 
3312  dest_ptr += 3 * sizeof(float);
3313 
3314  if ((DestFVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZRHW)
3315  dest_ptr += sizeof(float);
3316  }
3317 
3318  if (DestFVF & WINED3DFVF_PSIZE)
3319  dest_ptr += sizeof(DWORD);
3320 
3321  if (DestFVF & WINED3DFVF_NORMAL)
3322  {
3324  const float *normal = (const float *)(element->data.addr + i * element->stride);
3325  /* AFAIK this should go into the lighting information */
3326  FIXME("Didn't expect the destination to have a normal\n");
3327  copy_and_next(dest_ptr, normal, 3 * sizeof(float));
3328  }
3329 
3330  if (DestFVF & WINED3DFVF_DIFFUSE)
3331  {
3333  const DWORD *color_d = (const DWORD *)(element->data.addr + i * element->stride);
3334  if (!(stream_info->use_map & (1u << WINED3D_FFP_DIFFUSE)))
3335  {
3336  static BOOL warned = FALSE;
3337 
3338  if(!warned) {
3339  ERR("No diffuse color in source, but destination has one\n");
3340  warned = TRUE;
3341  }
3342 
3343  *( (DWORD *) dest_ptr) = 0xffffffff;
3344  dest_ptr += sizeof(DWORD);
3345  }
3346  else
3347  {
3348  copy_and_next(dest_ptr, color_d, sizeof(DWORD));
3349  }
3350  }
3351 
3352  if (DestFVF & WINED3DFVF_SPECULAR)
3353  {
3354  /* What's the color value in the feedback buffer? */
3356  const DWORD *color_s = (const DWORD *)(element->data.addr + i * element->stride);
3357  if (!(stream_info->use_map & (1u << WINED3D_FFP_SPECULAR)))
3358  {
3359  static BOOL warned = FALSE;
3360 
3361  if(!warned) {
3362  ERR("No specular color in source, but destination has one\n");
3363  warned = TRUE;
3364  }
3365 
3366  *(DWORD *)dest_ptr = 0xff000000;
3367  dest_ptr += sizeof(DWORD);
3368  }
3369  else
3370  {
3371  copy_and_next(dest_ptr, color_s, sizeof(DWORD));
3372  }
3373  }
3374 
3375  for (tex_index = 0; tex_index < numTextures; ++tex_index)
3376  {
3377  const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_TEXCOORD0 + tex_index];
3378  const float *tex_coord = (const float *)(element->data.addr + i * element->stride);
3379  if (!(stream_info->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + tex_index))))
3380  {
3381  ERR("No source texture, but destination requests one\n");
3382  dest_ptr += GET_TEXCOORD_SIZE_FROM_FVF(DestFVF, tex_index) * sizeof(float);
3383  }
3384  else
3385  {
3386  copy_and_next(dest_ptr, tex_coord, GET_TEXCOORD_SIZE_FROM_FVF(DestFVF, tex_index) * sizeof(float));
3387  }
3388  }
3389  }
3390 
3391  wined3d_resource_unmap(&dest->resource, 0);
3392 
3393  return WINED3D_OK;
3394 }
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
#define WINED3D_TS_WORLD_MATRIX(index)
Definition: wined3d.h:673
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
void CDECL wined3d_device_get_viewports(const struct wined3d_device *device, unsigned int *viewport_count, struct wined3d_viewport *viewports)
Definition: device.c:1964
void CDECL wined3d_device_get_transform(const struct wined3d_device *device, enum wined3d_transform_state state, struct wined3d_matrix *matrix)
Definition: device.c:1543
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:372
#define WARN(fmt,...)
Definition: debug.h:111
#define WINED3DFVF_NORMAL
Definition: wined3d.h:970
#define WINED3DFVF_TEXCOUNT_MASK
Definition: wined3d.h:974
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static const MAT2 mat
Definition: font.c:66
#define WINED3DFVF_POSITION_MASK
Definition: wined3d.h:961
#define WINED3DFVF_PSIZE
Definition: wined3d.h:971
#define DWORD
Definition: nt_native.h:44
static void stream_info(IStream *stream, HGLOBAL *hmem, int *size, int *pos)
#define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num)
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
unsigned int BOOL
Definition: ntddk_ex.h:94
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:334
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN
Definition: utils.c:923
GLdouble GLdouble z
Definition: glext.h:5874
smooth NULL
Definition: ftsmooth.c:416
#define eps
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define WINED3D_OK
Definition: wined3d.h:37
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WINED3DFVF_XYZRHW
Definition: wined3d.h:963
#define WINED3D_MAP_WRITE
Definition: wined3d.h:947
unsigned char BYTE
Definition: mem.h:68
#define WINED3DFVF_XYZ
Definition: wined3d.h:962
#define ERR(fmt,...)
Definition: debug.h:109
#define WINED3DFVF_DIFFUSE
Definition: wined3d.h:972
unsigned int UINT
Definition: ndis.h:50
void multiply_matrix(D3DMATRIX *dst, const D3DMATRIX *src1, const D3DMATRIX *src2) DECLSPEC_HIDDEN
Definition: utils.c:1173
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define copy_and_next(dest, src, size)
Definition: device.c:3126
static char * dest
Definition: rtl.c:135
GLfloat GLfloat p
Definition: glext.h:8902
#define WINED3DFVF_TEXCOUNT_SHIFT
Definition: wined3d.h:975
Definition: palette.c:467
#define WINED3DFVF_SPECULAR
Definition: wined3d.h:973

Referenced by wined3d_device_process_vertices().

◆ resolve_depth_buffer()

static void resolve_depth_buffer ( struct wined3d_device device)
static

Definition at line 1978 of file device.c.

1979 {
1980  const struct wined3d_state *state = &device->state;
1981  struct wined3d_rendertarget_view *src_view;
1982  struct wined3d_resource *dst_resource;
1983  struct wined3d_texture *dst_texture;
1984 
1985  if (!(dst_texture = state->textures[0]))
1986  return;
1987  dst_resource = &dst_texture->resource;
1988  if (!(dst_resource->format_flags & WINED3DFMT_FLAG_DEPTH))
1989  return;
1990  if (!(src_view = state->fb->depth_stencil))
1991  return;
1992 
1994  src_view->resource, src_view->sub_resource_idx, dst_resource->format->id);
1995 }
struct wined3d_resource resource
unsigned int format_flags
const struct wined3d_format * format
Definition: devices.h:37
static int state
Definition: maze.c:121
#define WINED3DFMT_FLAG_DEPTH
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:4380
struct wined3d_resource * resource

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

943 {
944  TRACE("device %p, window %p.\n", device, window);
945 
947  {
948  ERR("Failed to register window %p.\n", window);
949  return E_FAIL;
950  }
951 
952  InterlockedExchangePointer((void **)&device->focus_window, window);
953  SetWindowPos(window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
954 
955  return WINED3D_OK;
956 }
#define E_FAIL
Definition: ddrawi.h:102
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
#define WINED3D_OK
Definition: wined3d.h:37
BOOL wined3d_register_window(HWND window, struct wined3d_device *device)
Definition: wined3d_main.c:424
static IHTMLWindow2 * window
Definition: events.c:77
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ERR(fmt,...)
Definition: debug.h:109
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)

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

3660 {
3661  /* At the moment we have no need for any functionality at the beginning
3662  * of a scene. */
3663  TRACE("device %p.\n", device);
3664 
3665  if (device->inScene)
3666  {
3667  WARN("Already in scene, returning WINED3DERR_INVALIDCALL.\n");
3668  return WINED3DERR_INVALIDCALL;
3669  }
3670  device->inScene = TRUE;
3671  return WINED3D_OK;
3672 }
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define WINED3D_OK
Definition: wined3d.h:37

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

3613 {
3614  struct wined3d_stateblock *stateblock;
3615  HRESULT hr;
3616 
3617  TRACE("device %p.\n", device);
3618 
3619  if (device->recording)
3620  return WINED3DERR_INVALIDCALL;
3621 
3623  if (FAILED(hr))
3624  return hr;
3625 
3626  device->recording = stateblock;
3627  device->update_state = &stateblock->state;
3628 
3629  TRACE("Recording stateblock %p.\n", stateblock);
3630 
3631  return WINED3D_OK;
3632 }
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
HRESULT hr
Definition: shlfolder.c:183
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:1384
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define WINED3D_OK
Definition: wined3d.h:37

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

3692 {
3693  TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n",
3694  device, rect_count, rects, flags, debug_color(color), depth, stencil);
3695 
3696  if (!rect_count && rects)
3697  {
3698  WARN("Rects is %p, but rect_count is 0, ignoring clear\n", rects);
3699  return WINED3D_OK;
3700  }
3701 
3703  {
3704  struct wined3d_rendertarget_view *ds = device->fb.depth_stencil;
3705  if (!ds)
3706  {
3707  WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n");
3708  /* TODO: What about depth stencil buffers without stencil bits? */
3709  return WINED3DERR_INVALIDCALL;
3710  }
3711  else if (flags & WINED3DCLEAR_TARGET)
3712  {
3713  if (ds->width < device->fb.render_targets[0]->width
3714  || ds->height < device->fb.render_targets[0]->height)
3715  {
3716  WARN("Silently ignoring depth and target clear with mismatching sizes\n");
3717  return WINED3D_OK;
3718  }
3719  }
3720  }
3721 
3722  wined3d_cs_emit_clear(device->cs, rect_count, rects, flags, color, depth, stencil);
3723 
3724  return WINED3D_OK;
3725 }
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
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:530
#define WARN(fmt,...)
Definition: debug.h:111
#define ds
Definition: i386-dis.c:434
#define WINED3DCLEAR_STENCIL
Definition: wined3d.h:1001
const char * debug_color(const struct wined3d_color *color)
Definition: utils.c:3890
GLint GLfloat GLint stencil
Definition: glext.h:6260
#define WINED3DCLEAR_ZBUFFER
Definition: wined3d.h:1000
GLuint color
Definition: glext.h:6243
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define WINED3D_OK
Definition: wined3d.h:37
GLbitfield flags
Definition: glext.h:7161
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define WINED3DCLEAR_TARGET
Definition: wined3d.h:999

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

4429 {
4430  struct wined3d_resource *resource;
4431  RECT r;
4432 
4433  TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n",
4435 
4436  if (!flags)
4437  return WINED3D_OK;
4438 
4439  resource = view->resource;
4441  {
4442  FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
4443  return WINED3DERR_INVALIDCALL;
4444  }
4445 
4446  if (view->layer_count > 1)
4447  {
4448  FIXME("Layered clears not implemented.\n");
4449  return WINED3DERR_INVALIDCALL;
4450  }
4451 
4452  if (!rect)
4453  {
4454  SetRect(&r, 0, 0, view->width, view->height);
4455  rect = &r;
4456  }
4457  else
4458  {
4459  struct wined3d_box b = {rect->left, rect->top, rect->right, rect->bottom, 0, 1};
4460  struct wined3d_texture *texture = texture_from_resource(view->resource);
4461  HRESULT hr;
4462 
4464  view->sub_resource_idx % texture->level_count, &b)))
4465  return hr;
4466  }
4467 
4469 
4470  return WINED3D_OK;
4471 }
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
HRESULT hr
Definition: shlfolder.c:183
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box)
Definition: texture.c:1324
int resource
Definition: rdpsnd_sgi.c:44
& rect
Definition: startmenu.cpp:1413
const char * debug_color(const struct wined3d_color *color)
Definition: utils.c:3890
GLint GLfloat GLint stencil
Definition: glext.h:6260
GLuint color
Definition: glext.h:6243
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:77
const char * wine_dbgstr_rect(const RECT *rect)
#define WINED3D_OK
Definition: wined3d.h:37
GLbitfield flags
Definition: glext.h:7161
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
const char * debug_d3dresourcetype(enum wined3d_resource_type resource_type)
Definition: utils.c:4271
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:582

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

4475 {
4476  TRACE("device %p, view %p, clear_value %s.\n", device, view, debug_uvec4(clear_value));
4477 
4479 }
Definition: devices.h:37
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:2379
#define TRACE(s)
Definition: solgame.cpp:4
const char * debug_uvec4(const struct wined3d_uvec4 *v)
Definition: utils.c:3906

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

4099 {
4100  struct wined3d_texture *dst_texture, *src_texture;
4101  struct wined3d_box box;
4102  unsigned int i, j;
4103 
4104  TRACE("device %p, dst_resource %p, src_resource %p.\n", device, dst_resource, src_resource);
4105 
4106  if (src_resource == dst_resource)
4107  {
4108  WARN("Source and destination are the same resource.\n");
4109  return;
4110  }
4111 
4112  if (src_resource->type != dst_resource->type)
4113  {
4114  WARN("Resource types (%s / %s) don't match.\n",
4115  debug_d3dresourcetype(dst_resource->type),
4116  debug_d3dresourcetype(src_resource->type));
4117  return;
4118  }
4119 
4120  if (src_resource->width != dst_resource->width
4121  || src_resource->height != dst_resource->height
4122  || src_resource->depth != dst_resource->depth)
4123  {
4124  WARN("Resource dimensions (%ux%ux%u / %ux%ux%u) don't match.\n",
4125  dst_resource->width, dst_resource->height, dst_resource->depth,
4126  src_resource->width, src_resource->height, src_resource->depth);
4127  return;
4128  }
4129 
4130  if (src_resource->format->typeless_id != dst_resource->format->typeless_id
4131  || (!src_resource->format->typeless_id && src_resource->format->id != dst_resource->format->id))
4132  {
4133  WARN("Resource formats %s and %s are incompatible.\n",
4134  debug_d3dformat(dst_resource->format->id),
4135  debug_d3dformat(src_resource->format->id));
4136  return;
4137  }
4138 
4139  if (dst_resource->type == WINED3D_RTYPE_BUFFER)
4140  {
4141  wined3d_box_set(&box, 0, 0, src_resource->size, 1, 0, 1);
4142  wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, 0, &box,
4143  src_resource, 0, &box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
4144  return;
4145  }
4146 
4147  dst_texture = texture_from_resource(dst_resource);
4148  src_texture = texture_from_resource(src_resource);
4149 
4150  if (src_texture->layer_count != dst_texture->layer_count
4151  || src_texture->level_count != dst_texture->level_count)
4152  {
4153  WARN("Subresource layouts (%ux%u / %ux%u) don't match.\n",
4154  dst_texture->layer_count, dst_texture->level_count,
4155  src_texture->layer_count, src_texture->level_count);
4156  return;
4157  }
4158 
4159  for (i = 0; i < dst_texture->level_count; ++i)
4160  {
4161  wined3d_box_set(&box, 0, 0,
4162  wined3d_texture_get_level_width(dst_texture, i),
4163  wined3d_texture_get_level_height(dst_texture, i),
4164  0, wined3d_texture_get_level_depth(dst_texture, i));
4165  for (j = 0; j < dst_texture->layer_count; ++j)
4166  {
4167  unsigned int idx = j * dst_texture->level_count + i;
4168 
4169  wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, idx, &box,
4170  src_resource, idx, &box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
4171  }
4172  }
4173 }
enum wined3d_resource_type type
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)
#define WARN(fmt,...)
Definition: debug.h:111
static unsigned int wined3d_texture_get_level_depth(const struct wined3d_texture *texture, unsigned int level)
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:2793
const struct wined3d_format * format
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 WINED3D_BLT_RAW
Definition: wined3d.h:1366
Definition: devices.h:37
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
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
#define TRACE(s)
Definition: solgame.cpp:4
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
const char * debug_d3dresourcetype(enum wined3d_resource_type resource_type)
Definition: utils.c:4271
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:2174
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:3922
Definition: palette.c:467

◆ 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,
unsigned int  flags 
)

Definition at line 4175 of file device.c.

4179 {
4180  struct wined3d_box dst_box, b;
4181 
4182  TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, "
4183  "src_resource %p, src_sub_resource_idx %u, src_box %s, flags %#x.\n",
4184  device, dst_resource, dst_sub_resource_idx, dst_x, dst_y, dst_z,
4185  src_resource, src_sub_resource_idx, debug_box(src_box), flags);
4186 
4187  if (flags)
4188  FIXME("Ignoring flags %#x.\n", flags);
4189 
4190  if (src_resource == dst_resource && src_sub_resource_idx == dst_sub_resource_idx)
4191  {
4192  WARN("Source and destination are the same sub-resource.\n");
4193  return WINED3DERR_INVALIDCALL;
4194  }
4195 
4196  if (src_resource->type != dst_resource->type)
4197  {
4198  WARN("Resource types (%s / %s) don't match.\n",
4199  debug_d3dresourcetype(dst_resource->type),
4200  debug_d3dresourcetype(src_resource->type));
4201  return WINED3DERR_INVALIDCALL;
4202  }
4203 
4204  if (src_resource->format->typeless_id != dst_resource->format->typeless_id
4205  || (!src_resource->format->typeless_id && src_resource->format->id != dst_resource->format->id))
4206  {
4207  WARN("Resource formats %s and %s are incompatible.\n",
4208  debug_d3dformat(dst_resource->format->id),
4209  debug_d3dformat(src_resource->format->id));
4210  return WINED3DERR_INVALIDCALL;
4211  }
4212 
4213  if (dst_resource->type == WINED3D_RTYPE_BUFFER)
4214  {
4215  if (dst_sub_resource_idx)
4216  {
4217  WARN("Invalid dst_sub_resource_idx %u.\n", dst_sub_resource_idx);
4218  return WINED3DERR_INVALIDCALL;
4219  }
4220 
4221  if (src_sub_resource_idx)
4222  {
4223  WARN("Invalid src_sub_resource_idx %u.\n", src_sub_resource_idx);
4224  return WINED3DERR_INVALIDCALL;
4225  }
4226 
4227  if (!src_box)
4228  {
4229  unsigned int dst_w;
4230 
4231  dst_w = dst_resource->size - dst_x;
4232  wined3d_box_set(&b, 0, 0, min(src_resource->size, dst_w), 1, 0, 1);
4233  src_box = &b;
4234  }
4235  else if ((src_box->left >= src_box->right
4236  || src_box->top >= src_box->bottom
4237  || src_box->front >= src_box->back))
4238  {
4239  WARN("Invalid box %s specified.\n", debug_box(src_box));
4240  return WINED3DERR_INVALIDCALL;
4241  }
4242 
4243  if (src_box->right > src_resource->size || dst_x >= dst_resource->size
4244  || src_box->right - src_box->left > dst_resource->size - dst_x)
4245  {
4246  WARN("Invalid range specified, dst_offset %u, src_offset %u, size %u.\n",
4247  dst_x, src_box->left, src_box->right - src_box->left);
4248  return WINED3DERR_INVALIDCALL;
4249  }
4250 
4251  wined3d_box_set(&dst_box, dst_x, 0, dst_x + (src_box->right - src_box->left), 1, 0, 1);
4252  }
4253  else
4254  {
4255  struct wined3d_texture *dst_texture = texture_from_resource(dst_resource);
4256  struct wined3d_texture *src_texture = texture_from_resource(src_resource);
4257  unsigned int src_level = src_sub_resource_idx % src_texture->level_count;
4258 
4259  if (dst_sub_resource_idx >= dst_texture->level_count * dst_texture->layer_count)
4260  {
4261  WARN("Invalid destination sub-resource %u.\n", dst_sub_resource_idx);
4262  return WINED3DERR_INVALIDCALL;
4263  }
4264 
4265  if (src_sub_resource_idx >= src_texture->level_count * src_texture->layer_count)
4266  {
4267  WARN("Invalid source sub-resource %u.\n", src_sub_resource_idx);
4268  return WINED3DERR_INVALIDCALL;
4269  }
4270 
4271  if (dst_texture->sub_resources[dst_sub_resource_idx].map_count)
4272  {
4273  WARN("Destination sub-resource %u is mapped.\n", dst_sub_resource_idx);
4274  return WINED3DERR_INVALIDCALL;
4275  }
4276 
4277  if (src_texture->sub_resources[src_sub_resource_idx].map_count)
4278  {
4279  WARN("Source sub-resource %u is mapped.\n", src_sub_resource_idx);
4280  return WINED3DERR_INVALIDCALL;
4281  }
4282 
4283  if (!src_box)
4284  {
4285  unsigned int src_w, src_h, src_d, dst_w, dst_h, dst_d, dst_level;
4286 
4287  src_w = wined3d_texture_get_level_width(src_texture, src_level);
4288  src_h = wined3d_texture_get_level_height(src_texture, src_level);
4289  src_d = wined3d_texture_get_level_depth(src_texture, src_level);
4290 
4291  dst_level = dst_sub_resource_idx % dst_texture->level_count;
4292  dst_w = wined3d_texture_get_level_width(dst_texture, dst_level) - dst_x;
4293  dst_h = wined3d_texture_get_level_height(dst_texture, dst_level) - dst_y;
4294  dst_d = wined3d_texture_get_level_depth(dst_texture, dst_level) - dst_z;
4295 
4296  wined3d_box_set(&b, 0, 0, min(src_w, dst_w), min(src_h, dst_h), 0, min(src_d, dst_d));
4297  src_box = &b;
4298  }
4299  else if (FAILED(wined3d_texture_check_box_dimensions(src_texture, src_level, src_box)))
4300  {
4301  WARN("Invalid source box %s.\n", debug_box(src_box));
4302  return WINED3DERR_INVALIDCALL;
4303  }
4304 
4305  wined3d_box_set(&dst_box, dst_x, dst_y, dst_x + (src_box->right - src_box->left),
4306  dst_y + (src_box->bottom - src_box->top), dst_z, dst_z + (src_box->back - src_box->front));
4308  dst_sub_resource_idx % dst_texture->level_count, &dst_box)))
4309  {
4310  WARN("Invalid destination box %s.\n", debug_box(&dst_box));
4311  return WINED3DERR_INVALIDCALL;
4312  }
4313  }
4314 
4315  wined3d_cs_emit_blt_sub_resource(device->cs, dst_resource, dst_sub_resource_idx, &dst_box,
4316  src_resource, src_sub_resource_idx, src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
4317 
4318  return WINED3D_OK;
4319 }
enum wined3d_resource_type type
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
UINT left
Definition: wined3d.h:1840
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)
UINT back
Definition: wined3d.h:1845
#define WARN(fmt,...)
Definition: debug.h:111
static unsigned int wined3d_texture_get_level_depth(const struct wined3d_texture *texture, unsigned int level)
const char * debug_box(const struct wined3d_box *box)
Definition: utils.c:3881
UINT front
Definition: wined3d.h:1844
UINT top
Definition: wined3d.h:1841
HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box)
Definition: texture.c:1324
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:2793
const struct wined3d_format * format
#define WINED3D_BLT_RAW
Definition: wined3d.h:1366
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
UINT right
Definition: wined3d.h:1842
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
#define WINED3D_OK
Definition: wined3d.h:37
UINT bottom
Definition: wined3d.h:1843
GLbitfield flags
Definition: glext.h:7161
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
struct wined3d_texture::wined3d_texture_sub_resource sub_resources[1]
#define min(a, b)
Definition: monoChain.cc:55
const char * debug_d3dresourcetype(enum wined3d_resource_type resource_type)
Definition: utils.c:4271
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:2174
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:3922

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

4084 {
4085  TRACE("device %p, dst_buffer %p, offset %u, uav %p.\n",
4086  device, dst_buffer, offset, uav);
4087 
4088  if (offset + sizeof(GLuint) > dst_buffer->resource.size)
4089  {
4090  WARN("Offset %u too large.\n", offset);
4091  return;
4092  }
4093 
4094  wined3d_cs_emit_copy_uav_counter(device->cs, dst_buffer, offset, uav);
4095 }
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:2408
#define WARN(fmt,...)
Definition: debug.h:111
GLintptr offset
Definition: glext.h:5920
struct wined3d_resource resource
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int GLuint
Definition: gl.h:159

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

4581 {
4582  unsigned int texture_level = sub_resource_idx % cursor_image->level_count;
4584  struct wined3d_resource_desc desc;
4585  struct wined3d_map_desc map_desc;
4586  struct wined3d_texture *texture;
4587  HRESULT hr;
4588 
4589  if (FAILED(wined3d_resource_map(&cursor_image->resource, sub_resource_idx, &map_desc, NULL, WINED3D_MAP_READ)))
4590  {
4591  ERR("Failed to map source texture.\n");
4592  return NULL;
4593  }
4594 
4595  data.data = map_desc.data;
4596  data.row_pitch = map_desc.row_pitch;
4597  data.slice_pitch = map_desc.slice_pitch;
4598 
4599  desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
4601  desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
4602  desc.multisample_quality = 0;
4603  desc.usage = WINED3DUSAGE_DYNAMIC;
4605  desc.width = wined3d_texture_get_level_width(cursor_image, texture_level);
4606  desc.height = wined3d_texture_get_level_height(cursor_image, texture_level);
4607  desc.depth = 1;
4608  desc.size = 0;
4609 
4612  wined3d_resource_unmap(&cursor_image->resource, sub_resource_idx);
4613  if (FAILED(hr))
4614  {
4615  ERR("Failed to create cursor texture.\n");
4616  return NULL;
4617  }
4618 
4619  return texture;
4620 }
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
HRESULT hr
Definition: shlfolder.c:183
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:916
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:372
struct wined3d_resource resource
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:334
Definition: devices.h:37
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
#define WINED3D_MAP_READ
Definition: wined3d.h:948
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:77
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define ERR(fmt,...)
Definition: debug.h:109
#define WINED3D_TEXTURE_CREATE_MAPPABLE
Definition: wined3d.h:1558
const struct wined3d_parent_ops wined3d_null_parent_ops
Definition: directx.c:6781
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:3326

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

1057 {
1059  device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
1060  if (!device->swapchains[0]->num_contexts)
1061  return E_FAIL;
1062 
1063  return WINED3D_OK;
1064 }
void wined3d_cs_init_object(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
Definition: cs.c:1912
#define E_FAIL
Definition: ddrawi.h:102
Definition: devices.h:37
#define WINED3D_OK
Definition: wined3d.h:37
static void wined3d_device_create_primary_opengl_context_cs(void *object)
Definition: device.c:1021

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

1022 {
1023  struct wined3d_device *device = object;
1024  struct wined3d_swapchain *swapchain;
1025  struct wined3d_context *context;
1026  struct wined3d_texture *target;
1027  HRESULT hr;
1028 
1029  if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
1030  device->adapter->vertex_pipe, device->adapter->fragment_pipe)))
1031  {
1032  ERR("Failed to allocate shader private data, hr %#x.\n", hr);
1033  return;
1034  }
1035 
1036  if (!(device->blitter = wined3d_cpu_blitter_create()))
1037  {
1038  ERR("Failed to create CPU blitter.\n");
1039  device->shader_backend->shader_free_private(device);
1040  return;
1041  }
1042  wined3d_ffp_blitter_create(&device->blitter, &device->adapter->gl_info);
1043  if (!wined3d_glsl_blitter_create(&device->blitter, device))
1045  wined3d_fbo_blitter_create(&device->blitter, &device->adapter->gl_info);
1046  wined3d_raw_blitter_create(&device->blitter, &device->adapter->gl_info);
1047 
1048  swapchain = device->swapchains[0];
1049  target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer;