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

Go to the source code of this file.

Classes

struct  wined3d_format_channels
 
struct  wined3d_typed_format_info
 
struct  wined3d_typeless_format_depth_stencil_info
 
struct  wined3d_format_ddi_info
 
struct  wined3d_format_base_flags
 
struct  wined3d_format_block_info
 
struct  wined3d_format_vertex_info
 
struct  wined3d_format_texture_info
 
struct  wined3d_format_srgb_info
 
struct  debug_buffer
 

Macros

#define WINED3D_FORMAT_FOURCC_BASE   (WINED3DFMT_BC7_UNORM_SRGB + 1)
 
#define WINED3D_FORMAT_COUNT   (WINED3D_FORMAT_FOURCC_BASE + ARRAY_SIZE(format_index_remap))
 
#define FMT_TO_STR(format_id)   case format_id: return #format_id
 
#define DEVTYPE_TO_STR(dev)   case dev: return #dev
 
#define ACCESS_TO_STR(x)   if (access & x) { debug_append(&buffer, #x, " | "); access &= ~x; }
 
#define WINED3DUSAGE_TO_STR(x)   if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }
 
#define WINED3DUSAGEQUERY_TO_STR(x)   if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }
 
#define WINED3DDECLMETHOD_TO_STR(u)   case u: return #u
 
#define WINED3DDECLUSAGE_TO_STR(u)   case u: return #u
 
#define WINED3D_TO_STR(x)   case x: return #x
 
#define WINED3D_TO_STR(x)   case x: return #x
 
#define PRIM_TO_STR(prim)   case prim: return #prim
 
#define D3DSTATE_TO_STR(u)   case u: return #u
 
#define D3DSTATE_TO_STR(u)   case u: return #u
 
#define D3DTEXTUREFILTERTYPE_TO_STR(u)   case u: return #u
 
#define D3DSTATE_TO_STR(u)   case u: return #u
 
#define D3DTOP_TO_STR(u)   case u: return #u
 
#define TSTYPE_TO_STR(tstype)   case tstype: return #tstype
 
#define WINED3D_TO_STR(type)   case type: return #type
 
#define WINED3D_TO_STR(x)   case x: return #x
 
#define FBOSTATUS_TO_STR(u)   case u: return #u
 
#define GLERROR_TO_STR(u)   case u: return #u
 
#define WINED3D_TO_STR(x)   case x: return #x
 
#define WINED3D_TO_STR(x)   case x: return #x
 
#define ARG1   0x01
 
#define ARG2   0x02
 
#define ARG0   0x04
 
#define LOCATION_TO_STR(x)   if (location & x) { debug_append(&buffer, #x, " | "); location &= ~x; }
 

Enumerations

enum  wined3d_channel_type {
  WINED3D_CHANNEL_TYPE_NONE , WINED3D_CHANNEL_TYPE_UNORM , WINED3D_CHANNEL_TYPE_SNORM , WINED3D_CHANNEL_TYPE_UINT ,
  WINED3D_CHANNEL_TYPE_SINT , WINED3D_CHANNEL_TYPE_FLOAT , WINED3D_CHANNEL_TYPE_DEPTH , WINED3D_CHANNEL_TYPE_STENCIL ,
  WINED3D_CHANNEL_TYPE_UNUSED
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d)
 
static void convert_l4a4_unorm (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r5g5_snorm_l6_unorm (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r5g5_snorm_l6_unorm_ext (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r5g5_snorm_l6_unorm_nv (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r8g8_snorm (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r8g8_snorm_l8x8_unorm (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r8g8_snorm_l8x8_unorm_nv (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r8g8b8a8_snorm (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r16g16_snorm (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r16g16 (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_r32g32_float (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_s1_uint_d15_unorm (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_s4x4_uint_d24_unorm (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void convert_s8_uint_d24_float (const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 
static void x8_d24_unorm_upload (const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
 
static void x8_d24_unorm_download (const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
 
static BOOL color_in_range (const struct wined3d_color_key *color_key, DWORD color)
 
static void convert_p8_uint_b8g8r8a8_unorm (const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
 
static void convert_b5g6r5_unorm_b5g5r5a1_unorm_color_key (const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
 
static void convert_b5g5r5x1_unorm_b5g5r5a1_unorm_color_key (const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
 
static void convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key (const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
 
static void convert_b8g8r8x8_unorm_b8g8r8a8_unorm_color_key (const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
 
static void convert_b8g8r8a8_unorm_b8g8r8a8_unorm_color_key (const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
 
const struct wined3d_color_key_conversionwined3d_format_get_color_key_conversion (const struct wined3d_texture *texture, BOOL need_alpha_ck)
 
static int get_format_idx (enum wined3d_format_id format_id)
 
static struct wined3d_formatget_format_internal (struct wined3d_gl_info *gl_info, enum wined3d_format_id format_id)
 
static void copy_format (struct wined3d_format *dst_format, const struct wined3d_format *src_format)
 
static void format_set_flag (struct wined3d_format *format, unsigned int flag)
 
static void format_clear_flag (struct wined3d_format *format, unsigned int flag)
 
static enum wined3d_channel_type map_channel_type (char t)
 
static BOOL init_format_base_info (struct wined3d_gl_info *gl_info)
 
static BOOL init_format_block_info (struct wined3d_gl_info *gl_info)
 
static GLenum wined3d_gl_type_to_enum (enum wined3d_gl_resource_type type)
 
static void delete_fbo_attachment (const struct wined3d_gl_info *gl_info, enum wined3d_gl_resource_type d3d_type, GLuint object)
 
static void create_and_bind_fbo_attachment (const struct wined3d_gl_info *gl_info, unsigned int flags, enum wined3d_gl_resource_type d3d_type, GLuint *object, GLenum internal, GLenum format, GLenum type)
 
static void draw_test_quad (struct wined3d_caps_gl_ctx *ctx, const struct wined3d_vec3 *geometry, const struct wined3d_color *color)
 
static void check_fbo_compat (struct wined3d_caps_gl_ctx *ctx, struct wined3d_format *format)
 
static void query_format_flag (struct wined3d_gl_info *gl_info, struct wined3d_format *format, GLint internal, GLenum pname, DWORD flag, const char *string)
 
static void init_format_fbo_compat_info (struct wined3d_caps_gl_ctx *ctx)
 
static GLenum lookup_gl_view_class (GLenum internal_format)
 
static void query_view_class (struct wined3d_format *format)
 
static void query_internal_format (struct wined3d_adapter *adapter, struct wined3d_format *format, const struct wined3d_format_texture_info *texture_info, struct wined3d_gl_info *gl_info, BOOL srgb_write_supported, BOOL srgb_format)
 
static BOOL init_format_texture_info (struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
 
static BOOL color_match (DWORD c1, DWORD c2, BYTE max_diff)
 
static BOOL check_filter (const struct wined3d_gl_info *gl_info, GLenum internal)
 
static void init_format_filter_info (struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor)
 
static void apply_format_fixups (struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
 
static unsigned int calculate_vertex_attribute_size (GLenum type, unsigned int component_count)
 
static BOOL init_format_vertex_info (struct wined3d_gl_info *gl_info)
 
static BOOL init_typeless_formats (struct wined3d_gl_info *gl_info)
 
static void init_format_gen_mipmap_info (struct wined3d_gl_info *gl_info)
 
BOOL wined3d_caps_gl_ctx_test_viewport_subpixel_bits (struct wined3d_caps_gl_ctx *ctx)
 
static float wined3d_adapter_find_polyoffset_scale (struct wined3d_caps_gl_ctx *ctx, GLenum format)
 
static void init_format_depth_bias_scale (struct wined3d_caps_gl_ctx *ctx, const struct wined3d_d3d_info *d3d_info)
 
BOOL wined3d_adapter_init_format_info (struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
 
const struct wined3d_formatwined3d_get_format (const struct wined3d_gl_info *gl_info, enum wined3d_format_id format_id, unsigned int resource_usage)
 
BOOL wined3d_format_is_depth_view (enum wined3d_format_id resource_format_id, enum wined3d_format_id view_format_id)
 
void wined3d_format_calculate_pitch (const struct wined3d_format *format, unsigned int alignment, unsigned int width, unsigned int height, unsigned int *row_pitch, unsigned int *slice_pitch)
 
UINT wined3d_format_calculate_size (const struct wined3d_format *format, UINT alignment, UINT width, UINT height, UINT depth)
 
BOOL wined3d_formats_are_srgb_variants (enum wined3d_format_id format1, enum wined3d_format_id format2)
 
const chardebug_box (const struct wined3d_box *box)
 
const chardebug_color (const struct wined3d_color *color)
 
const chardebug_ivec4 (const struct wined3d_ivec4 *v)
 
const chardebug_uvec4 (const struct wined3d_uvec4 *v)
 
const chardebug_vec4 (const struct wined3d_vec4 *v)
 
const chardebug_d3dformat (enum wined3d_format_id format_id)
 
const chardebug_d3ddevicetype (enum wined3d_device_type device_type)
 
static void init_debug_buffer (struct debug_buffer *buffer, const char *default_string)
 
static void debug_append (struct debug_buffer *buffer, const char *str, const char *separator)
 
const charwined3d_debug_resource_access (DWORD access)
 
const chardebug_d3dusage (DWORD usage)
 
const chardebug_d3dusagequery (DWORD usage)
 
const chardebug_d3ddeclmethod (enum wined3d_decl_method method)
 
const chardebug_d3ddeclusage (enum wined3d_decl_usage usage)
 
const chardebug_d3dinput_classification (enum wined3d_input_classification classification)
 
const chardebug_d3dresourcetype (enum wined3d_resource_type resource_type)
 
const chardebug_d3dprimitivetype (enum wined3d_primitive_type primitive_type)
 
const chardebug_d3drenderstate (enum wined3d_render_state state)
 
const chardebug_d3dsamplerstate (enum wined3d_sampler_state state)
 
const chardebug_d3dtexturefiltertype (enum wined3d_texture_filter_type filter_type)
 
const chardebug_d3dtexturestate (enum wined3d_texture_stage_state state)
 
const chardebug_d3dtop (enum wined3d_texture_op d3dtop)
 
const chardebug_d3dtstype (enum wined3d_transform_state tstype)
 
const chardebug_shader_type (enum wined3d_shader_type type)
 
const chardebug_d3dstate (DWORD state)
 
const chardebug_fboattachment (GLenum attachment)
 
const chardebug_fbostatus (GLenum status)
 
const chardebug_glerror (GLenum error)
 
static const chardebug_fixup_channel_source (enum fixup_channel_source source)
 
static const chardebug_complex_fixup (enum complex_fixup fixup)
 
void dump_color_fixup_desc (struct color_fixup_desc fixup)
 
BOOL is_invalid_op (const struct wined3d_state *state, int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3)
 
void get_identity_matrix (struct wined3d_matrix *mat)
 
void get_modelview_matrix (const struct wined3d_context *context, const struct wined3d_state *state, unsigned int index, struct wined3d_matrix *mat)
 
void get_projection_matrix (const struct wined3d_context *context, const struct wined3d_state *state, struct wined3d_matrix *mat)
 
static void compute_texture_matrix (const struct wined3d_gl_info *gl_info, const struct wined3d_matrix *matrix, DWORD flags, BOOL calculated_coords, BOOL transformed, enum wined3d_format_id format_id, BOOL ffp_proj_control, struct wined3d_matrix *out_matrix)
 
void get_texture_matrix (const struct wined3d_context *context, const struct wined3d_state *state, unsigned int tex, struct wined3d_matrix *mat)
 
void get_pointsize_minmax (const struct wined3d_context *context, const struct wined3d_state *state, float *out_min, float *out_max)
 
void get_pointsize (const struct wined3d_context *context, const struct wined3d_state *state, float *out_pointsize, float *out_att)
 
void get_fog_start_end (const struct wined3d_context *context, const struct wined3d_state *state, float *start, float *end)
 
DWORD wined3d_format_convert_from_float (const struct wined3d_format *format, const struct wined3d_color *color)
 
static float color_to_float (DWORD color, DWORD size, DWORD offset)
 
void wined3d_format_get_float_color_key (const struct wined3d_format *format, const struct wined3d_color_key *key, struct wined3d_color *float_colors)
 
enum wined3d_format_id pixelformat_for_depth (DWORD depth)
 
void multiply_matrix (struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
 
BOOL invert_matrix_3d (struct wined3d_matrix *out, const struct wined3d_matrix *in)
 
static void swap_rows (float **a, float **b)
 
BOOL invert_matrix (struct wined3d_matrix *out, const struct wined3d_matrix *m)
 
void transpose_matrix (struct wined3d_matrix *out, const struct wined3d_matrix *m)
 
DWORD get_flexible_vertex_size (DWORD d3dvtVertexType)
 
unsigned int wined3d_max_compat_varyings (const struct wined3d_gl_info *gl_info)
 
void gen_ffp_frag_op (const struct wined3d_context *context, const struct wined3d_state *state, struct ffp_frag_settings *settings, BOOL ignore_textype)
 
const struct ffp_frag_descfind_ffp_frag_shader (const struct wine_rb_tree *fragment_shaders, const struct ffp_frag_settings *settings)
 
void add_ffp_frag_shader (struct wine_rb_tree *shaders, struct ffp_frag_desc *desc)
 
void texture_activate_dimensions (const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
 
void sampler_texdim (struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 
int wined3d_ffp_frag_program_key_compare (const void *key, const struct wine_rb_entry *entry)
 
void wined3d_ffp_get_vs_settings (const struct wined3d_context *context, const struct wined3d_state *state, struct wined3d_ffp_vs_settings *settings)
 
int wined3d_ffp_vertex_program_key_compare (const void *key, const struct wine_rb_entry *entry)
 
const charwined3d_debug_location (DWORD location)
 
void wined3d_ftoa (float value, char *s)
 
void wined3d_release_dc (HWND window, HDC dc)
 
BOOL wined3d_clip_blit (const RECT *clip_rect, RECT *clipped, RECT *other)
 
void wined3d_gl_limits_get_uniform_block_range (const struct wined3d_gl_limits *gl_limits, enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
 
void wined3d_gl_limits_get_texture_unit_range (const struct wined3d_gl_limits *gl_limits, enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
 
BOOL wined3d_array_reserve (void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size)
 

Variables

struct {
   enum wined3d_format_id   id
 
   unsigned int   idx
 
format_index_remap []
 
static const struct wined3d_format_channels formats []
 
static const struct wined3d_typed_format_info typed_formats []
 
static const struct wined3d_typeless_format_depth_stencil_info typeless_depth_stencil_formats []
 
static const struct wined3d_format_ddi_info ddi_formats []
 
static const struct wined3d_format_base_flags format_base_flags []
 
static const struct wined3d_format_block_info format_block_info []
 
static const struct wined3d_format_vertex_info format_vertex_info []
 
static const struct wined3d_format_texture_info format_texture_info []
 
static const struct wined3d_format_srgb_info format_srgb_info []
 

Macro Definition Documentation

◆ ACCESS_TO_STR

#define ACCESS_TO_STR (   x)    if (access & x) { debug_append(&buffer, #x, " | "); access &= ~x; }

◆ ARG0

#define ARG0   0x04

◆ ARG1

#define ARG1   0x01

◆ ARG2

#define ARG2   0x02

◆ D3DSTATE_TO_STR [1/3]

#define D3DSTATE_TO_STR (   u)    case u: return #u

◆ D3DSTATE_TO_STR [2/3]

#define D3DSTATE_TO_STR (   u)    case u: return #u

◆ D3DSTATE_TO_STR [3/3]

#define D3DSTATE_TO_STR (   u)    case u: return #u

◆ D3DTEXTUREFILTERTYPE_TO_STR

#define D3DTEXTUREFILTERTYPE_TO_STR (   u)    case u: return #u

◆ D3DTOP_TO_STR

#define D3DTOP_TO_STR (   u)    case u: return #u

◆ DEVTYPE_TO_STR

#define DEVTYPE_TO_STR (   dev)    case dev: return #dev

◆ FBOSTATUS_TO_STR

#define FBOSTATUS_TO_STR (   u)    case u: return #u

◆ FMT_TO_STR

#define FMT_TO_STR (   format_id)    case format_id: return #format_id

◆ GLERROR_TO_STR

#define GLERROR_TO_STR (   u)    case u: return #u

◆ LOCATION_TO_STR

#define LOCATION_TO_STR (   x)    if (location & x) { debug_append(&buffer, #x, " | "); location &= ~x; }

◆ PRIM_TO_STR

#define PRIM_TO_STR (   prim)    case prim: return #prim

◆ TSTYPE_TO_STR

#define TSTYPE_TO_STR (   tstype)    case tstype: return #tstype

◆ WINED3D_FORMAT_COUNT

Definition at line 70 of file utils.c.

◆ WINED3D_FORMAT_FOURCC_BASE

#define WINED3D_FORMAT_FOURCC_BASE   (WINED3DFMT_BC7_UNORM_SRGB + 1)

Definition at line 36 of file utils.c.

◆ WINED3D_TO_STR [1/6]

#define WINED3D_TO_STR (   type)    case type: return #type

◆ WINED3D_TO_STR [2/6]

#define WINED3D_TO_STR (   x)    case x: return #x

◆ WINED3D_TO_STR [3/6]

#define WINED3D_TO_STR (   x)    case x: return #x

◆ WINED3D_TO_STR [4/6]

#define WINED3D_TO_STR (   x)    case x: return #x

◆ WINED3D_TO_STR [5/6]

#define WINED3D_TO_STR (   x)    case x: return #x

◆ WINED3D_TO_STR [6/6]

#define WINED3D_TO_STR (   x)    case x: return #x

◆ WINED3DDECLMETHOD_TO_STR

#define WINED3DDECLMETHOD_TO_STR (   u)    case u: return #u

◆ WINED3DDECLUSAGE_TO_STR

#define WINED3DDECLUSAGE_TO_STR (   u)    case u: return #u

◆ WINED3DUSAGE_TO_STR

#define WINED3DUSAGE_TO_STR (   x)    if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }

◆ WINED3DUSAGEQUERY_TO_STR

#define WINED3DUSAGEQUERY_TO_STR (   x)    if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }

Enumeration Type Documentation

◆ wined3d_channel_type

Enumerator
WINED3D_CHANNEL_TYPE_NONE 
WINED3D_CHANNEL_TYPE_UNORM 
WINED3D_CHANNEL_TYPE_SNORM 
WINED3D_CHANNEL_TYPE_UINT 
WINED3D_CHANNEL_TYPE_SINT 
WINED3D_CHANNEL_TYPE_FLOAT 
WINED3D_CHANNEL_TYPE_DEPTH 
WINED3D_CHANNEL_TYPE_STENCIL 
WINED3D_CHANNEL_TYPE_UNUSED 

Definition at line 179 of file utils.c.

180{
190};
@ WINED3D_CHANNEL_TYPE_UNUSED
Definition: utils.c:189
@ WINED3D_CHANNEL_TYPE_UNORM
Definition: utils.c:182
@ WINED3D_CHANNEL_TYPE_STENCIL
Definition: utils.c:188
@ WINED3D_CHANNEL_TYPE_FLOAT
Definition: utils.c:186
@ WINED3D_CHANNEL_TYPE_SNORM
Definition: utils.c:183
@ WINED3D_CHANNEL_TYPE_NONE
Definition: utils.c:181
@ WINED3D_CHANNEL_TYPE_UINT
Definition: utils.c:184
@ WINED3D_CHANNEL_TYPE_SINT
Definition: utils.c:185
@ WINED3D_CHANNEL_TYPE_DEPTH
Definition: utils.c:187

Function Documentation

◆ add_ffp_frag_shader()

void add_ffp_frag_shader ( struct wine_rb_tree shaders,
struct ffp_frag_desc desc 
)

Definition at line 6083 of file utils.c.

6084{
6085 /* Note that the key is the implementation independent part of the ffp_frag_desc structure,
6086 * whereas desc points to an extended structure with implementation specific parts. */
6087 if (wine_rb_put(shaders, &desc->settings, &desc->entry) == -1)
6088 {
6089 ERR("Failed to insert ffp frag shader.\n");
6090 }
6091}
#define ERR(fmt,...)
Definition: precomp.h:57
const GLuint * shaders
Definition: glext.h:7538
static const WCHAR desc[]
Definition: protectdata.c:36
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
Definition: rbtree.h:215

Referenced by fragment_prog_arbfp(), set_tex_op_atifs(), and shader_glsl_find_ffp_fragment_shader().

◆ apply_format_fixups()

static void apply_format_fixups ( struct wined3d_adapter adapter,
struct wined3d_gl_info gl_info 
)
static

Definition at line 3203 of file utils.c.

3204{
3205 unsigned int i;
3206 int idx;
3207
3209 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3211
3213 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3215
3217 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3219
3221 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3223
3225 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3227
3228 /* GL_ATI_envmap_bumpmap in theory supports R8G8_SNORM but is no longer supported by
3229 * any driver. */
3230 if (gl_info->supported[NV_TEXTURE_SHADER] || gl_info->supported[EXT_TEXTURE_SNORM])
3231 {
3232 /* R8G8_SNORM and R16G16_SNORM need a fixup of the undefined blue channel. OpenGL
3233 * returns 0.0 when sampling from it, DirectX 1.0. So we always have in-shader
3234 * conversion for this format. */
3236 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3239 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3241 }
3242 else
3243 {
3244 /* Emulate using unsigned formats. This requires load-time conversion in addition to the
3245 * fixups here. */
3247 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3250 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3253 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3256 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3258 }
3259
3260 if (!gl_info->supported[NV_TEXTURE_SHADER])
3261 {
3263 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3265 }
3266
3268 {
3270 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3272
3274 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3276 }
3277 else if (gl_info->supported[ATI_TEXTURE_COMPRESSION_3DC])
3278 {
3280 gl_info->formats[idx].color_fixup= create_color_fixup_desc(
3282 }
3283
3284 if (!gl_info->supported[APPLE_YCBCR_422] && gl_info->supported[ARB_FRAGMENT_PROGRAM]
3286 {
3289
3292 }
3293 else if (!gl_info->supported[APPLE_YCBCR_422] && (!gl_info->supported[ARB_FRAGMENT_PROGRAM]
3294 || !gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]))
3295 {
3297 gl_info->formats[idx].glInternal = 0;
3298
3300 gl_info->formats[idx].glInternal = 0;
3301 }
3302
3304 {
3307 gl_info->formats[idx].height_scale.numerator = 3;
3308 gl_info->formats[idx].height_scale.denominator = 2;
3310
3313 gl_info->formats[idx].height_scale.numerator = 3;
3314 gl_info->formats[idx].height_scale.denominator = 2;
3316 }
3317 else
3318 {
3320 gl_info->formats[idx].glInternal = 0;
3321
3323 gl_info->formats[idx].glInternal = 0;
3324 }
3325
3326 if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
3327 {
3329 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3332 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3335 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3338 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3341 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3343 }
3344
3345 if (gl_info->supported[ARB_TEXTURE_RG])
3346 {
3348 gl_info->formats[idx].color_fixup = create_color_fixup_desc(
3350 }
3351
3352 if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
3353 {
3355 gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_P8);
3356 }
3357
3358 if (gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
3359 {
3361 gl_info->formats[idx].gl_vtx_format = GL_BGRA;
3362 }
3363
3364 if (!gl_info->supported[ARB_HALF_FLOAT_VERTEX])
3365 {
3366 /* Do not change the size of the type, it is CPU side. We have to change the GPU-side information though.
3367 * It is the job of the vertex buffer code to make sure that the vbos have the right format */
3369 gl_info->formats[idx].gl_vtx_type = GL_FLOAT;
3370
3372 gl_info->formats[idx].gl_vtx_type = GL_FLOAT;
3373 }
3374
3375 if (!gl_info->supported[ARB_HALF_FLOAT_PIXEL])
3376 {
3379
3382
3385 }
3386
3387 if (gl_info->quirks & WINED3D_QUIRK_BROKEN_RGBA16)
3388 {
3391 }
3392
3393 /* ATI instancing hack: Although ATI cards do not support Shader Model
3394 * 3.0, they support instancing. To query if the card supports instancing
3395 * CheckDeviceFormat() with the special format MAKEFOURCC('I','N','S','T')
3396 * is used. Should an application check for this, provide a proper return
3397 * value. We can do instancing with all shader versions, but we need
3398 * vertex shaders.
3399 *
3400 * Additionally applications have to set the D3DRS_POINTSIZE render state
3401 * to MAKEFOURCC('I','N','S','T') once to enable instancing. Wined3d
3402 * doesn't need that and just ignores it.
3403 *
3404 * With Shader Model 3.0 capable cards Instancing 'just works' in Windows. */
3405 /* FIXME: This should just check the shader backend caps. */
3406 if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_VERTEX_SHADER])
3407 {
3410 }
3411
3412 /* Depth bound test. To query if the card supports it CheckDeviceFormat()
3413 * with the special format MAKEFOURCC('N','V','D','B') is used. It is
3414 * enabled by setting D3DRS_ADAPTIVETESS_X render state to
3415 * MAKEFOURCC('N','V','D','B') and then controlled by setting
3416 * D3DRS_ADAPTIVETESS_Z (zMin) and D3DRS_ADAPTIVETESS_W (zMax) to test
3417 * value. */
3418 if (gl_info->supported[EXT_DEPTH_BOUNDS_TEST])
3419 {
3422 }
3423
3424 /* RESZ aka AMD DX9-level hack for multisampled depth buffer resolve. You query for RESZ
3425 * support by checking for availability of MAKEFOURCC('R','E','S','Z') surfaces with
3426 * RENDERTARGET usage. */
3427 if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
3428 {
3431 }
3432
3433 for (i = 0; i < gl_info->format_count; ++i)
3434 {
3435 struct wined3d_format *format = &gl_info->formats[i];
3436
3438 continue;
3439
3440 if (is_identity_fixup(format->color_fixup))
3441 continue;
3442
3443 TRACE("Checking support for fixup:\n");
3444 dump_color_fixup_desc(format->color_fixup);
3445 if (!adapter->shader_backend->shader_color_fixup_supported(format->color_fixup)
3446 || !adapter->fragment_pipe->color_fixup_supported(format->color_fixup))
3447 {
3448 TRACE("[FAILED]\n");
3450 }
3451 else
3452 {
3453 TRACE("[OK]\n");
3454 }
3455 }
3456
3457 /* GL_EXT_texture_compression_s3tc does not support 3D textures. Some Windows drivers
3458 * for dx9 GPUs support it, some do not, so not supporting DXTn volumes is OK for d3d9.
3459 *
3460 * Note that GL_NV_texture_compression_vtc adds this functionality to OpenGL, but the
3461 * block layout is not compatible with the one used by d3d. See volume_dxt5_test. */
3463 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3465 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3467 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3469 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3471 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3473 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3475 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3477 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3479 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3481 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3483 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3484 /* Similarly with ATI1N / ATI2N and GL_ARB_texture_compression_rgtc. */
3486 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3488 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3490 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3492 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3494 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3496 gl_info->formats[idx].flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
3497}
static int get_format_idx(enum wined3d_format_id format_id)
Definition: utils.c:1750
static void format_set_flag(struct wined3d_format *format, unsigned int flag)
Definition: utils.c:1787
unsigned int idx
Definition: utils.c:41
static void format_clear_flag(struct wined3d_format *format, unsigned int flag)
Definition: utils.c:1795
void dump_color_fixup_desc(struct color_fixup_desc fixup)
Definition: utils.c:4851
return adapter
#define GL_BGRA
Definition: gl.h:1485
#define GL_FLOAT
Definition: gl.h:183
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
Definition: format.c:58
unsigned int format_count
BOOL supported[WINED3D_GL_EXT_COUNT]
struct wined3d_format * formats
@ WINED3DFMT_RESZ
Definition: wined3d.h:254
@ WINED3DFMT_BC5_UNORM
Definition: wined3d.h:219
@ WINED3DFMT_BC2_UNORM_SRGB
Definition: wined3d.h:211
@ WINED3DFMT_INTZ
Definition: wined3d.h:253
@ WINED3DFMT_R16G16_UNORM
Definition: wined3d.h:171
@ WINED3DFMT_BC5_SNORM
Definition: wined3d.h:220
@ WINED3DFMT_DXT2
Definition: wined3d.h:240
@ WINED3DFMT_R32G32_FLOAT
Definition: wined3d.h:150
@ WINED3DFMT_R16G16_SNORM
Definition: wined3d.h:173
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:223
@ WINED3DFMT_ATI1N
Definition: wined3d.h:247
@ WINED3DFMT_BC2_UNORM
Definition: wined3d.h:210
@ WINED3DFMT_R8G8B8A8_SNORM
Definition: wined3d.h:167
@ WINED3DFMT_NV12
Definition: wined3d.h:258
@ WINED3DFMT_L8A8_UNORM
Definition: wined3d.h:119
@ WINED3DFMT_L4A4_UNORM
Definition: wined3d.h:120
@ WINED3DFMT_BC1_UNORM_SRGB
Definition: wined3d.h:208
@ WINED3DFMT_R16G16B16A16_FLOAT
Definition: wined3d.h:144
@ WINED3DFMT_L8_UNORM
Definition: wined3d.h:118
@ WINED3DFMT_R8G8_SNORM
Definition: wined3d.h:187
@ WINED3DFMT_R5G5_SNORM_L6_UNORM
Definition: wined3d.h:121
@ WINED3DFMT_INST
Definition: wined3d.h:249
@ WINED3DFMT_DXT1
Definition: wined3d.h:239
@ WINED3DFMT_NVDB
Definition: wined3d.h:250
@ WINED3DFMT_R16_FLOAT
Definition: wined3d.h:190
@ WINED3DFMT_DXT3
Definition: wined3d.h:241
@ WINED3DFMT_DXT4
Definition: wined3d.h:242
@ WINED3DFMT_R16G16B16A16_UNORM
Definition: wined3d.h:145
@ WINED3DFMT_BC3_UNORM
Definition: wined3d.h:213
@ WINED3DFMT_R32_FLOAT
Definition: wined3d.h:177
@ WINED3DFMT_R8G8_SNORM_L8X8_UNORM
Definition: wined3d.h:122
@ WINED3DFMT_YV12
Definition: wined3d.h:238
@ WINED3DFMT_DXT5
Definition: wined3d.h:243
@ WINED3DFMT_BC4_UNORM
Definition: wined3d.h:216
@ WINED3DFMT_YUY2
Definition: wined3d.h:237
@ WINED3DFMT_R16G16_FLOAT
Definition: wined3d.h:170
@ WINED3DFMT_P8_UINT
Definition: wined3d.h:117
@ WINED3DFMT_L16_UNORM
Definition: wined3d.h:132
@ WINED3DFMT_BC1_UNORM
Definition: wined3d.h:207
@ WINED3DFMT_UYVY
Definition: wined3d.h:236
@ WINED3DFMT_BC3_UNORM_SRGB
Definition: wined3d.h:214
@ WINED3DFMT_A8_UNORM
Definition: wined3d.h:201
@ WINED3DFMT_ATI2N
Definition: wined3d.h:248
@ WINED3DFMT_BC4_SNORM
Definition: wined3d.h:217
@ ARB_FRAGMENT_PROGRAM
Definition: wined3d_gl.h:70
@ ATI_TEXTURE_COMPRESSION_3DC
Definition: wined3d_gl.h:146
@ ARB_VERTEX_PROGRAM
Definition: wined3d_gl.h:139
@ ARB_TEXTURE_COMPRESSION_RGTC
Definition: wined3d_gl.h:112
@ ARB_FRAMEBUFFER_OBJECT
Definition: wined3d_gl.h:73
@ ARB_VERTEX_SHADER
Definition: wined3d_gl.h:140
@ ARB_TEXTURE_RG
Definition: wined3d_gl.h:126
@ ARB_HALF_FLOAT_VERTEX
Definition: wined3d_gl.h:78
@ EXT_TEXTURE_COMPRESSION_RGTC
Definition: wined3d_gl.h:173
@ ARB_VERTEX_ARRAY_BGRA
Definition: wined3d_gl.h:136
@ EXT_DEPTH_BOUNDS_TEST
Definition: wined3d_gl.h:156
@ ARB_HALF_FLOAT_PIXEL
Definition: wined3d_gl.h:77
@ APPLE_YCBCR_422
Definition: wined3d_gl.h:43
@ NV_TEXTURE_SHADER
Definition: wined3d_gl.h:198
@ WINED3D_GL_LEGACY_CONTEXT
Definition: wined3d_gl.h:213
@ EXT_TEXTURE_SNORM
Definition: wined3d_gl.h:181
static struct color_fixup_desc create_complex_fixup_desc(enum complex_fixup complex_fixup)
#define WINED3DFMT_FLAG_HEIGHT_SCALE
#define WINED3DFMT_FLAG_RENDERTARGET
@ CHANNEL_SOURCE_ONE
@ CHANNEL_SOURCE_W
@ CHANNEL_SOURCE_X
@ CHANNEL_SOURCE_ZERO
@ CHANNEL_SOURCE_Z
@ CHANNEL_SOURCE_Y
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
@ WINED3D_GL_RES_TYPE_TEX_3D
@ WINED3D_GL_RES_TYPE_TEX_2D
#define WINED3DFMT_FLAG_TEXTURE
#define WINED3D_QUIRK_BROKEN_RGBA16
@ COMPLEX_FIXUP_P8
@ COMPLEX_FIXUP_YUY2
@ COMPLEX_FIXUP_UYVY
@ COMPLEX_FIXUP_NV12
@ COMPLEX_FIXUP_YV12
static struct color_fixup_desc create_color_fixup_desc(int sign0, enum fixup_channel_source src0, int sign1, enum fixup_channel_source src1, int sign2, enum fixup_channel_source src2, int sign3, enum fixup_channel_source src3)

Referenced by wined3d_adapter_init_format_info().

◆ calculate_vertex_attribute_size()

static unsigned int calculate_vertex_attribute_size ( GLenum  type,
unsigned int  component_count 
)
static

Definition at line 3499 of file utils.c.

3500{
3501 switch (type)
3502 {
3503 case GL_HALF_FLOAT:
3504 return component_count * sizeof(GLhalfNV);
3505 case GL_FLOAT:
3506 return component_count * sizeof(GLfloat);
3507 case GL_BYTE:
3508 return component_count * sizeof(GLbyte);
3509 case GL_UNSIGNED_BYTE:
3510 return component_count * sizeof(GLubyte);
3511 case GL_SHORT:
3512 return component_count * sizeof(GLshort);
3513 case GL_UNSIGNED_SHORT:
3514 return component_count * sizeof(GLushort);
3515 case GL_INT:
3516 return component_count * sizeof(GLint);
3517 case GL_UNSIGNED_INT:
3518 return component_count * sizeof(GLuint);
3520 return sizeof(GLuint);
3521 default:
3522 FIXME("Unhandled GL type %#x.\n", type);
3523 return 0;
3524 }
3525}
#define FIXME(fmt,...)
Definition: precomp.h:53
unsigned int component_count
unsigned char GLubyte
Definition: gl.h:157
signed char GLbyte
Definition: gl.h:154
#define GL_INT
Definition: gl.h:181
short GLshort
Definition: gl.h:155
float GLfloat
Definition: gl.h:161
#define GL_UNSIGNED_SHORT
Definition: gl.h:180
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define GL_BYTE
Definition: gl.h:177
unsigned int GLuint
Definition: gl.h:159
#define GL_UNSIGNED_INT
Definition: gl.h:182
#define GL_SHORT
Definition: gl.h:179
#define GL_UNSIGNED_BYTE
Definition: gl.h:178
unsigned short GLushort
Definition: gl.h:158
int GLint
Definition: gl.h:156
#define GL_UNSIGNED_INT_2_10_10_10_REV
Definition: gl.h:1497
unsigned short GLhalfNV
Definition: glext.h:5520
#define GL_HALF_FLOAT
Definition: glext.h:1785

Referenced by init_format_vertex_info().

◆ check_fbo_compat()

static void check_fbo_compat ( struct wined3d_caps_gl_ctx ctx,
struct wined3d_format format 
)
static

Definition at line 2234 of file utils.c.

2235{
2236 /* Check if the default internal format is supported as a frame buffer
2237 * target, otherwise fall back to the render target internal.
2238 *
2239 * Try to stick to the standard format if possible, this limits precision differences. */
2240 static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 1.0f};
2241 static const struct wined3d_color half_transparent_red = {1.0f, 0.0f, 0.0f, 0.5f};
2242 const struct wined3d_gl_info *gl_info = ctx->gl_info;
2243 GLenum status, rt_internal = format->rtInternal;
2244 GLuint object, color_rb;
2246 BOOL fallback_fmt_used = FALSE, regular_fmt_used = FALSE;
2247
2248 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
2249
2250 for (type = 0; type < ARRAY_SIZE(format->flags); ++type)
2251 {
2252 const char *type_string = "color";
2253
2255 continue;
2256
2257 create_and_bind_fbo_attachment(gl_info, format->flags[type], type, &object, format->glInternal,
2258 format->glFormat, format->glType);
2259
2261 {
2262 gl_info->fbo_ops.glGenRenderbuffers(1, &color_rb);
2263 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, color_rb);
2265 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 16, 1);
2266 else
2267 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 16, 16);
2268
2269 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER,
2271 checkGLcall("Create and attach color rb attachment");
2272 type_string = "depth / stencil";
2273 }
2274
2275 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
2276 checkGLcall("Framebuffer format check");
2277
2279 {
2280 TRACE("Format %s is supported as FBO %s attachment, type %u.\n",
2281 debug_d3dformat(format->id), type_string, type);
2283 format->rtInternal = format->glInternal;
2284 regular_fmt_used = TRUE;
2285 }
2286 else
2287 {
2288 if (!rt_internal)
2289 {
2291 {
2292 WARN("Format %s with rendertarget flag is not supported as FBO color attachment (type %u),"
2293 " and no fallback specified.\n", debug_d3dformat(format->id), type);
2294 format->flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
2295 }
2296 else
2297 {
2298 TRACE("Format %s is not supported as FBO %s attachment, type %u.\n",
2299 debug_d3dformat(format->id), type_string, type);
2300 }
2301 format->rtInternal = format->glInternal;
2302 }
2303 else
2304 {
2305 TRACE("Format %s is not supported as FBO %s attachment (type %u),"
2306 " trying rtInternal format as fallback.\n",
2307 debug_d3dformat(format->id), type_string, type);
2308
2309 while (gl_info->gl_ops.gl.p_glGetError());
2310
2311 delete_fbo_attachment(gl_info, type, object);
2312 create_and_bind_fbo_attachment(gl_info, format->flags[type], type, &object, format->rtInternal,
2313 format->glFormat, format->glType);
2314
2315 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
2316 checkGLcall("Framebuffer format check");
2317
2319 {
2320 TRACE("Format %s rtInternal format is supported as FBO %s attachment, type %u.\n",
2321 debug_d3dformat(format->id), type_string, type);
2322 fallback_fmt_used = TRUE;
2323 }
2324 else
2325 {
2326 WARN("Format %s rtInternal format is not supported as FBO %s attachment, type %u.\n",
2327 debug_d3dformat(format->id), type_string, type);
2328 format->flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
2329 }
2330 }
2331 }
2332
2336 && !(format->flags[type] & WINED3DFMT_FLAG_INTEGER)
2338 && format->glFormat != GL_LUMINANCE && format->glFormat != GL_LUMINANCE_ALPHA
2339 && (format->red_size || format->alpha_size))
2340 {
2341 DWORD readback[16 * 16 * 16], color, r_range, a_range;
2342 BYTE r, a;
2343 BOOL match = TRUE;
2344 GLuint rb;
2345
2346 if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT]
2348 {
2349 gl_info->fbo_ops.glGenRenderbuffers(1, &rb);
2350 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, rb);
2352 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 16, 1);
2353 else
2354 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 16, 16);
2355 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rb);
2356 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rb);
2357 checkGLcall("RB attachment");
2358 }
2359
2360 gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
2361 gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
2362 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
2363 if (gl_info->gl_ops.gl.p_glGetError() == GL_INVALID_FRAMEBUFFER_OPERATION)
2364 {
2365 while (gl_info->gl_ops.gl.p_glGetError());
2366 TRACE("Format %s doesn't support post-pixelshader blending, type %u.\n",
2368 format->flags[type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
2369 }
2370 else
2371 {
2372 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
2374 gl_info->gl_ops.gl.p_glViewport(0, 0, 16, 1);
2375 else
2376 gl_info->gl_ops.gl.p_glViewport(0, 0, 16, 16);
2377 gl_info->gl_ops.gl.p_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2378
2379 draw_test_quad(ctx, NULL, &black);
2380
2381 gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
2382
2383 draw_test_quad(ctx, NULL, &half_transparent_red);
2384
2385 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
2386
2387 switch (type)
2388 {
2390 /* Rebinding texture to workaround a fglrx bug. */
2391 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, object);
2392 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_1D, 0, GL_BGRA,
2393 GL_UNSIGNED_INT_8_8_8_8_REV, readback);
2394 color = readback[7];
2395 break;
2396
2400 /* Rebinding texture to workaround a fglrx bug. */
2401 gl_info->gl_ops.gl.p_glBindTexture(wined3d_gl_type_to_enum(type), object);
2402 gl_info->gl_ops.gl.p_glGetTexImage(wined3d_gl_type_to_enum(type), 0, GL_BGRA,
2403 GL_UNSIGNED_INT_8_8_8_8_REV, readback);
2404 color = readback[7 * 16 + 7];
2405 break;
2406
2408 /* Rebinding texture to workaround a fglrx bug. */
2409 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, object);
2410 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL_BGRA,
2411 GL_UNSIGNED_INT_8_8_8_8_REV, readback);
2412 color = readback[7 * 16 + 7];
2413 break;
2414
2416 gl_info->gl_ops.gl.p_glReadPixels(0, 0, 16, 16,
2418 color = readback[7 * 16 + 7];
2419 break;
2420
2423 color = 0;
2424 break;
2425 }
2426 checkGLcall("Post-pixelshader blending check");
2427
2428 a = color >> 24;
2429 r = (color & 0x00ff0000u) >> 16;
2430
2431 r_range = format->red_size < 8 ? 1u << (8 - format->red_size) : 1;
2432 a_range = format->alpha_size < 8 ? 1u << (8 - format->alpha_size) : 1;
2433 if (format->red_size && (r < 0x7f - r_range || r > 0x7f + r_range))
2434 match = FALSE;
2435 else if (format->alpha_size > 1 && (a < 0xbf - a_range || a > 0xbf + a_range))
2436 match = FALSE;
2437 if (!match)
2438 {
2439 TRACE("Format %s doesn't support post-pixelshader blending, type %u.\n",
2441 TRACE("Color output: %#x\n", color);
2442 format->flags[type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
2443 }
2444 else
2445 {
2446 TRACE("Format %s supports post-pixelshader blending, type %u.\n",
2448 TRACE("Color output: %#x\n", color);
2450 }
2451 }
2452
2453 if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT]
2455 {
2456 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
2457 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
2458 gl_info->fbo_ops.glDeleteRenderbuffers(1, &rb);
2459 checkGLcall("RB cleanup");
2460 }
2461 }
2462
2463 if (format->glInternal != format->glGammaInternal)
2464 {
2465 delete_fbo_attachment(gl_info, type, object);
2466 create_and_bind_fbo_attachment(gl_info, format->flags[type], type, &object, format->glGammaInternal,
2467 format->glFormat, format->glType);
2468
2469 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
2470 checkGLcall("Framebuffer format check");
2471
2473 {
2474 TRACE("Format %s's sRGB format is FBO attachable, type %u.\n",
2477 if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
2478 format->glInternal = format->glGammaInternal;
2479 }
2480 else
2481 {
2482 WARN("Format %s's sRGB format is not FBO attachable, type %u.\n",
2485 }
2486 }
2487 else if (status == GL_FRAMEBUFFER_COMPLETE)
2489
2491 {
2492 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
2493 gl_info->fbo_ops.glDeleteRenderbuffers(1, &color_rb);
2494 }
2495
2496 delete_fbo_attachment(gl_info, type, object);
2497 checkGLcall("Framebuffer format check cleanup");
2498 }
2499
2500 if (fallback_fmt_used && regular_fmt_used)
2501 {
2502 FIXME("Format %s needs different render target formats for different resource types.\n",
2503 debug_d3dformat(format->id));
2506 }
2507}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define WARN(fmt,...)
Definition: precomp.h:61
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static GLenum wined3d_gl_type_to_enum(enum wined3d_gl_resource_type type)
Definition: utils.c:1954
static void create_and_bind_fbo_attachment(const struct wined3d_gl_info *gl_info, unsigned int flags, enum wined3d_gl_resource_type d3d_type, GLuint *object, GLenum internal, GLenum format, GLenum type)
Definition: utils.c:2003
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:3980
static void delete_fbo_attachment(const struct wined3d_gl_info *gl_info, enum wined3d_gl_resource_type d3d_type, GLuint object)
Definition: utils.c:1979
static void draw_test_quad(struct wined3d_caps_gl_ctx *ctx, const struct wined3d_vec3 *geometry, const struct wined3d_color *color)
Definition: utils.c:2104
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GL_RGBA8
Definition: gl.h:762
#define GL_LUMINANCE_ALPHA
Definition: gl.h:485
#define GL_SRC_ALPHA
Definition: gl.h:378
unsigned int GLenum
Definition: gl.h:150
#define GL_LUMINANCE
Definition: gl.h:484
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
#define GL_BLEND
Definition: gl.h:371
#define GL_ONE_MINUS_SRC_ALPHA
Definition: gl.h:379
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define GL_TEXTURE_1D
Definition: gl.h:644
#define GL_UNSIGNED_INT_8_8_8_8_REV
Definition: gl.h:1495
#define GL_DEPTH24_STENCIL8
Definition: glext.h:1687
GLuint color
Definition: glext.h:6243
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
Definition: glext.h:1232
#define GL_COLOR_ATTACHMENT0
Definition: glext.h:1714
#define GL_TEXTURE_CUBE_MAP_ARB
Definition: glext.h:1230
#define GL_FRAMEBUFFER_COMPLETE
Definition: glext.h:1707
#define GL_RENDERBUFFER
Definition: glext.h:1733
#define GL_FRAMEBUFFER
Definition: glext.h:1732
#define GL_INVALID_FRAMEBUFFER_OPERATION
Definition: glext.h:1672
#define GL_DEPTH_ATTACHMENT
Definition: glext.h:1730
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define GL_STENCIL_ATTACHMENT
Definition: glext.h:1731
#define a
Definition: ke_i.h:78
Definition: match.c:28
Definition: ps.c:97
struct opengl_funcs gl_ops
struct wined3d_fbo_ops fbo_ops
@ WINED3DFMT_NULL
Definition: wined3d.h:255
@ EXT_TEXTURE_SRGB_DECODE
Definition: wined3d_gl.h:183
@ EXT_PACKED_DEPTH_STENCIL
Definition: wined3d_gl.h:163
#define WINED3DFMT_FLAG_SRGB_WRITE
#define WINED3DFMT_FLAG_INTEGER
#define WINED3D_QUIRK_LIMITED_TEX_FILTERING
#define WINED3DFMT_FLAG_FBO_ATTACHABLE
wined3d_gl_resource_type
@ WINED3D_GL_RES_TYPE_TEX_CUBE
@ WINED3D_GL_RES_TYPE_BUFFER
@ WINED3D_GL_RES_TYPE_RB
@ WINED3D_GL_RES_TYPE_TEX_RECT
@ WINED3D_GL_RES_TYPE_TEX_1D
@ WINED3D_GL_RES_TYPE_COUNT
#define WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB
#define WINED3DFMT_FLAG_STENCIL
#define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
#define WINED3DFMT_FLAG_DEPTH
#define checkGLcall(A)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by init_format_fbo_compat_info().

◆ check_filter()

static BOOL check_filter ( const struct wined3d_gl_info gl_info,
GLenum  internal 
)
static

Definition at line 3038 of file utils.c.

3039{
3040 static const DWORD data[] = {0x00000000, 0xffffffff};
3041 GLuint tex, fbo, buffer;
3042 DWORD readback[16 * 1];
3043 BOOL ret = FALSE;
3044
3045 /* Render a filtered texture and see what happens. This is intended to detect the lack of
3046 * float16 filtering on ATI X1000 class cards. The drivers disable filtering instead of
3047 * falling back to software. If this changes in the future this code will get fooled and
3048 * apps might hit the software path due to incorrectly advertised caps.
3049 *
3050 * Its unlikely that this changes however. GL Games like Mass Effect depend on the filter
3051 * disable fallback, if Apple or ATI ever change the driver behavior they will break more
3052 * than Wine. The Linux binary <= r500 driver is not maintained any more anyway
3053 */
3054
3055 while (gl_info->gl_ops.gl.p_glGetError());
3056
3057 gl_info->gl_ops.gl.p_glGenTextures(1, &buffer);
3058 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, buffer);
3059 memset(readback, 0x7e, sizeof(readback));
3060 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 1, 0,
3061 GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, readback);
3062 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
3063 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
3064 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
3065 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
3066 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
3067
3068 gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
3069 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
3070 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, internal, 2, 1, 0,
3072 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
3073 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
3074 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
3075 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
3076 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
3077 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D);
3078
3079 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
3080 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
3081 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, buffer, 0);
3082 gl_info->gl_ops.gl.p_glDrawBuffer(GL_COLOR_ATTACHMENT0);
3083
3084 gl_info->gl_ops.gl.p_glViewport(0, 0, 16, 1);
3085 gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
3086 gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
3087 gl_info->gl_ops.gl.p_glLoadIdentity();
3088 gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
3089 gl_info->gl_ops.gl.p_glLoadIdentity();
3090
3091 gl_info->gl_ops.gl.p_glClearColor(0, 1, 0, 0);
3092 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
3093
3094 gl_info->gl_ops.gl.p_glBegin(GL_TRIANGLE_STRIP);
3095 gl_info->gl_ops.gl.p_glTexCoord2f(0.0, 0.0);
3096 gl_info->gl_ops.gl.p_glVertex2f(-1.0f, -1.0f);
3097 gl_info->gl_ops.gl.p_glTexCoord2f(1.0, 0.0);
3098 gl_info->gl_ops.gl.p_glVertex2f(1.0f, -1.0f);
3099 gl_info->gl_ops.gl.p_glTexCoord2f(0.0, 1.0);
3100 gl_info->gl_ops.gl.p_glVertex2f(-1.0f, 1.0f);
3101 gl_info->gl_ops.gl.p_glTexCoord2f(1.0, 1.0);
3102 gl_info->gl_ops.gl.p_glVertex2f(1.0f, 1.0f);
3103 gl_info->gl_ops.gl.p_glEnd();
3104
3105 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, buffer);
3106 memset(readback, 0x7f, sizeof(readback));
3107 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, readback);
3108 if (color_match(readback[6], 0xffffffff, 5) || color_match(readback[6], 0x00000000, 5)
3109 || color_match(readback[9], 0xffffffff, 5) || color_match(readback[9], 0x00000000, 5))
3110 {
3111 TRACE("Read back colors 0x%08x and 0x%08x close to unfiltered color, assuming no filtering\n",
3112 readback[6], readback[9]);
3113 ret = FALSE;
3114 }
3115 else
3116 {
3117 TRACE("Read back colors are 0x%08x and 0x%08x, assuming texture is filtered\n",
3118 readback[6], readback[9]);
3119 ret = TRUE;
3120 }
3121
3122 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3123 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
3124 gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
3125 gl_info->gl_ops.gl.p_glDeleteTextures(1, &buffer);
3126 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
3127
3128 if (gl_info->gl_ops.gl.p_glGetError())
3129 {
3130 FIXME("Error during filtering test for format %x, returning no filtering\n", internal);
3131 ret = FALSE;
3132 }
3133
3134 return ret;
3135}
ios_base &_STLP_CALL internal(ios_base &__s)
Definition: _ios_base.h:311
static BOOL color_match(DWORD c1, DWORD c2, BYTE max_diff)
Definition: utils.c:3025
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
#define GL_TEXTURE_WRAP_R
Definition: gl.h:1518
#define GL_TEXTURE_WRAP_S
Definition: gl.h:646
#define GL_LINEAR
Definition: gl.h:421
#define GL_NEAREST
Definition: gl.h:678
#define GL_PROJECTION
Definition: gl.h:246
#define GL_MODELVIEW
Definition: gl.h:245
#define GL_RGBA
Definition: gl.h:503
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define GL_UNSIGNED_INT_8_8_8_8
Definition: gl.h:1494
#define GL_TEXTURE_WRAP_T
Definition: gl.h:647
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
#define GL_TRIANGLE_STRIP
Definition: gl.h:195
#define GL_TEXTURE_2D
Definition: gl.h:645
#define GL_CLAMP_TO_EDGE
Definition: gl.h:1481
#define GL_LIGHTING
Definition: gl.h:310
GLuint buffer
Definition: glext.h:5915
#define memset(x, y, z)
Definition: compat.h:39
int ret

Referenced by init_format_filter_info().

◆ color_in_range()

static BOOL color_in_range ( const struct wined3d_color_key color_key,
DWORD  color 
)
static

Definition at line 890 of file utils.c.

891{
892 /* FIXME: Is this really how color keys are supposed to work? I think it
893 * makes more sense to compare the individual channels. */
894 return color >= color_key->color_space_low_value
895 && color <= color_key->color_space_high_value;
896}

Referenced by convert_b5g5r5x1_unorm_b5g5r5a1_unorm_color_key(), convert_b5g6r5_unorm_b5g5r5a1_unorm_color_key(), convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key(), convert_b8g8r8a8_unorm_b8g8r8a8_unorm_color_key(), and convert_b8g8r8x8_unorm_b8g8r8a8_unorm_color_key().

◆ color_match()

static BOOL color_match ( DWORD  c1,
DWORD  c2,
BYTE  max_diff 
)
static

Definition at line 3025 of file utils.c.

3026{
3027 if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
3028 c1 >>= 8; c2 >>= 8;
3029 if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
3030 c1 >>= 8; c2 >>= 8;
3031 if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
3032 c1 >>= 8; c2 >>= 8;
3033 if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
3034 return TRUE;
3035}
#define abs(i)
Definition: fconv.c:206

Referenced by check_filter().

◆ color_to_float()

static float color_to_float ( DWORD  color,
DWORD  size,
DWORD  offset 
)
static

Definition at line 5308 of file utils.c.

5309{
5310 DWORD mask = size < 32 ? (1u << size) - 1 : ~0u;
5311
5312 if (!size)
5313 return 1.0f;
5314
5315 color >>= offset;
5316 color &= mask;
5317
5318 return (float)color / (float)mask;
5319}
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLintptr offset
Definition: glext.h:5920
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
static float(__cdecl *square_half_float)(float x

Referenced by wined3d_format_get_float_color_key().

◆ compute_texture_matrix()

static void compute_texture_matrix ( const struct wined3d_gl_info gl_info,
const struct wined3d_matrix matrix,
DWORD  flags,
BOOL  calculated_coords,
BOOL  transformed,
enum wined3d_format_id  format_id,
BOOL  ffp_proj_control,
struct wined3d_matrix out_matrix 
)
static

Definition at line 4984 of file utils.c.

4987{
4988 struct wined3d_matrix mat;
4989
4990 if (flags == WINED3D_TTFF_DISABLE || flags == WINED3D_TTFF_COUNT1 || transformed)
4991 {
4992 get_identity_matrix(out_matrix);
4993 return;
4994 }
4995
4997 {
4998 ERR("Invalid texture transform flags: WINED3D_TTFF_COUNT1 | WINED3D_TTFF_PROJECTED.\n");
4999 return;
5000 }
5001
5002 mat = *matrix;
5003
5005 {
5006 if (!ffp_proj_control)
5007 {
5008 switch (flags & ~WINED3D_TTFF_PROJECTED)
5009 {
5011 mat._14 = mat._12;
5012 mat._24 = mat._22;
5013 mat._34 = mat._32;
5014 mat._44 = mat._42;
5015 mat._12 = mat._22 = mat._32 = mat._42 = 0.0f;
5016 break;
5018 mat._14 = mat._13;
5019 mat._24 = mat._23;
5020 mat._34 = mat._33;
5021 mat._44 = mat._43;
5022 mat._13 = mat._23 = mat._33 = mat._43 = 0.0f;
5023 break;
5024 }
5025 }
5026 }
5027 else
5028 {
5029 /* Under Direct3D the R/Z coord can be used for translation, under
5030 * OpenGL we use the Q coord instead. */
5031 if (!calculated_coords)
5032 {
5033 switch (format_id)
5034 {
5035 /* Direct3D passes the default 1.0 in the 2nd coord, while GL
5036 * passes it in the 4th. Swap 2nd and 4th coord. No need to
5037 * store the value of mat._41 in mat._21 because the input
5038 * value to the transformation will be 0, so the matrix value
5039 * is irrelevant. */
5041 mat._41 = mat._21;
5042 mat._42 = mat._22;
5043 mat._43 = mat._23;
5044 mat._44 = mat._24;
5045 break;
5046 /* See above, just 3rd and 4th coord. */
5048 mat._41 = mat._31;
5049 mat._42 = mat._32;
5050 mat._43 = mat._33;
5051 mat._44 = mat._34;
5052 break;
5053 case WINED3DFMT_R32G32B32_FLOAT: /* Opengl defaults match dx defaults */
5054 case WINED3DFMT_R32G32B32A32_FLOAT: /* No defaults apply, all app defined */
5055
5056 /* This is to prevent swapping the matrix lines and put the default 4th coord = 1.0
5057 * into a bad place. The division elimination below will apply to make sure the
5058 * 1.0 doesn't do anything bad. The caller will set this value if the stride is 0
5059 */
5060 case WINED3DFMT_UNKNOWN: /* No texture coords, 0/0/0/1 defaults are passed */
5061 break;
5062 default:
5063 FIXME("Unexpected fixed function texture coord input\n");
5064 }
5065 }
5066 if (!ffp_proj_control)
5067 {
5068 switch (flags & ~WINED3D_TTFF_PROJECTED)
5069 {
5070 /* case WINED3D_TTFF_COUNT1: Won't ever get here. */
5072 mat._13 = mat._23 = mat._33 = mat._43 = 0.0f;
5073 /* OpenGL divides the first 3 vertex coordinates by the 4th by
5074 * default, which is essentially the same as D3DTTFF_PROJECTED.
5075 * Make sure that the 4th coordinate evaluates to 1.0 to
5076 * eliminate that.
5077 *
5078 * If the fixed function pipeline is used, the 4th value
5079 * remains unused, so there is no danger in doing this. With
5080 * vertex shaders we have a problem. Should an application hit
5081 * that problem, the code here would have to check for pixel
5082 * shaders, and the shader has to undo the default GL divide.
5083 *
5084 * A more serious problem occurs if the application passes 4
5085 * coordinates in, and the 4th is != 1.0 (OpenGL default).
5086 * This would have to be fixed with immediate mode draws. */
5087 default:
5088 mat._14 = mat._24 = mat._34 = 0.0f; mat._44 = 1.0f;
5089 }
5090 }
5091 }
5092
5093 *out_matrix = mat;
5094}
void get_identity_matrix(struct wined3d_matrix *mat)
Definition: utils.c:4886
GLuint GLenum matrix
Definition: glext.h:9407
GLbitfield flags
Definition: glext.h:7161
static const MAT2 mat
Definition: font.c:66
static UINT format_id
Definition: clipboard.c:1343
@ WINED3DFMT_R32G32B32_FLOAT
Definition: wined3d.h:140
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:107
@ WINED3DFMT_R32G32B32A32_FLOAT
Definition: wined3d.h:136
@ WINED3D_TTFF_COUNT2
Definition: wined3d.h:601
@ WINED3D_TTFF_DISABLE
Definition: wined3d.h:599
@ WINED3D_TTFF_COUNT3
Definition: wined3d.h:602
@ WINED3D_TTFF_COUNT1
Definition: wined3d.h:600
@ WINED3D_TTFF_PROJECTED
Definition: wined3d.h:604

Referenced by get_texture_matrix().

◆ convert_b5g5r5x1_unorm_b5g5r5a1_unorm_color_key()

static void convert_b5g5r5x1_unorm_b5g5r5a1_unorm_color_key ( const BYTE src,
unsigned int  src_pitch,
BYTE dst,
unsigned int  dst_pitch,
unsigned int  width,
unsigned int  height,
const struct wined3d_palette palette,
const struct wined3d_color_key color_key 
)
static

Definition at line 957 of file utils.c.

960{
961 const WORD *src_row;
962 unsigned int x, y;
963 WORD *dst_row;
964
965 for (y = 0; y < height; ++y)
966 {
967 src_row = (WORD *)&src[src_pitch * y];
968 dst_row = (WORD *)&dst[dst_pitch * y];
969 for (x = 0; x < width; ++x)
970 {
971 WORD src_color = src_row[x];
972 if (color_in_range(color_key, src_color))
973 dst_row[x] = src_color & ~0x8000;
974 else
975 dst_row[x] = src_color | 0x8000;
976 }
977 }
978}
static BOOL color_in_range(const struct wined3d_color_key *color_key, DWORD color)
Definition: utils.c:890
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by wined3d_format_get_color_key_conversion().

◆ convert_b5g6r5_unorm_b5g5r5a1_unorm_color_key()

static void convert_b5g6r5_unorm_b5g5r5a1_unorm_color_key ( const BYTE src,
unsigned int  src_pitch,
BYTE dst,
unsigned int  dst_pitch,
unsigned int  width,
unsigned int  height,
const struct wined3d_palette palette,
const struct wined3d_color_key color_key 
)
static

Definition at line 934 of file utils.c.

937{
938 const WORD *src_row;
939 unsigned int x, y;
940 WORD *dst_row;
941
942 for (y = 0; y < height; ++y)
943 {
944 src_row = (WORD *)&src[src_pitch * y];
945 dst_row = (WORD *)&dst[dst_pitch * y];
946 for (x = 0; x < width; ++x)
947 {
948 WORD src_color = src_row[x];
949 if (!color_in_range(color_key, src_color))
950 dst_row[x] = 0x8000u | ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
951 else
952 dst_row[x] = ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
953 }
954 }
955}

Referenced by wined3d_format_get_color_key_conversion().

◆ convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key()

static void convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key ( const BYTE src,
unsigned int  src_pitch,
BYTE dst,
unsigned int  dst_pitch,
unsigned int  width,
unsigned int  height,
const struct wined3d_palette palette,
const struct wined3d_color_key color_key 
)
static

Definition at line 980 of file utils.c.

983{
984 const BYTE *src_row;
985 unsigned int x, y;
986 DWORD *dst_row;
987
988 for (y = 0; y < height; ++y)
989 {
990 src_row = &src[src_pitch * y];
991 dst_row = (DWORD *)&dst[dst_pitch * y];
992 for (x = 0; x < width; ++x)
993 {
994 DWORD src_color = (src_row[x * 3 + 2] << 16) | (src_row[x * 3 + 1] << 8) | src_row[x * 3];
995 if (!color_in_range(color_key, src_color))
996 dst_row[x] = src_color | 0xff000000;
997 }
998 }
999}

Referenced by wined3d_format_get_color_key_conversion().

◆ convert_b8g8r8a8_unorm_b8g8r8a8_unorm_color_key()

static void convert_b8g8r8a8_unorm_b8g8r8a8_unorm_color_key ( const BYTE src,
unsigned int  src_pitch,
BYTE dst,
unsigned int  dst_pitch,
unsigned int  width,
unsigned int  height,
const struct wined3d_palette palette,
const struct wined3d_color_key color_key 
)
static

Definition at line 1024 of file utils.c.

1027{
1028 const DWORD *src_row;
1029 unsigned int x, y;
1030 DWORD *dst_row;
1031
1032 for (y = 0; y < height; ++y)
1033 {
1034 src_row = (DWORD *)&src[src_pitch * y];
1035 dst_row = (DWORD *)&dst[dst_pitch * y];
1036 for (x = 0; x < width; ++x)
1037 {
1038 DWORD src_color = src_row[x];
1039 if (color_in_range(color_key, src_color))
1040 src_color &= ~0xff000000;
1041 dst_row[x] = src_color;
1042 }
1043 }
1044}

Referenced by wined3d_format_get_color_key_conversion().

◆ convert_b8g8r8x8_unorm_b8g8r8a8_unorm_color_key()

static void convert_b8g8r8x8_unorm_b8g8r8a8_unorm_color_key ( const BYTE src,
unsigned int  src_pitch,
BYTE dst,
unsigned int  dst_pitch,
unsigned int  width,
unsigned int  height,
const struct wined3d_palette palette,
const struct wined3d_color_key color_key 
)
static

Definition at line 1001 of file utils.c.

1004{
1005 const DWORD *src_row;
1006 unsigned int x, y;
1007 DWORD *dst_row;
1008
1009 for (y = 0; y < height; ++y)
1010 {
1011 src_row = (DWORD *)&src[src_pitch * y];
1012 dst_row = (DWORD *)&dst[dst_pitch * y];
1013 for (x = 0; x < width; ++x)
1014 {
1015 DWORD src_color = src_row[x];
1016 if (color_in_range(color_key, src_color))
1017 dst_row[x] = src_color & ~0xff000000;
1018 else
1019 dst_row[x] = src_color | 0xff000000;
1020 }
1021 }
1022}

Referenced by wined3d_format_get_color_key_conversion().

◆ convert_l4a4_unorm()

static void convert_l4a4_unorm ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 445 of file utils.c.

447{
448 /* WINED3DFMT_L4A4_UNORM exists as an internal gl format, but for some reason there is not
449 * format+type combination to load it. Thus convert it to A8L8, then load it
450 * with A4L4 internal, but A8L8 format+type
451 */
452 unsigned int x, y, z;
453 const unsigned char *Source;
454 unsigned char *Dest;
455
456 for (z = 0; z < depth; z++)
457 {
458 for (y = 0; y < height; y++)
459 {
460 Source = src + z * src_slice_pitch + y * src_row_pitch;
461 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
462 for (x = 0; x < width; x++ )
463 {
464 unsigned char color = (*Source++);
465 /* A */ Dest[1] = (color & 0xf0u) << 0;
466 /* L */ Dest[0] = (color & 0x0fu) << 4;
467 Dest += 2;
468 }
469 }
470 }
471}
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLdouble GLdouble z
Definition: glext.h:5874
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169

◆ convert_p8_uint_b8g8r8a8_unorm()

static void convert_p8_uint_b8g8r8a8_unorm ( const BYTE src,
unsigned int  src_pitch,
BYTE dst,
unsigned int  dst_pitch,
unsigned int  width,
unsigned int  height,
const struct wined3d_palette palette,
const struct wined3d_color_key color_key 
)
static

Definition at line 898 of file utils.c.

901{
902 const BYTE *src_row;
903 unsigned int x, y;
904 DWORD *dst_row;
905
906 if (!palette)
907 {
908 /* FIXME: This should probably use the system palette. */
909 FIXME("P8 surface loaded without a palette.\n");
910
911 for (y = 0; y < height; ++y)
912 {
913 memset(&dst[dst_pitch * y], 0, width * 4);
914 }
915
916 return;
917 }
918
919 for (y = 0; y < height; ++y)
920 {
921 src_row = &src[src_pitch * y];
922 dst_row = (DWORD *)&dst[dst_pitch * y];
923 for (x = 0; x < width; ++x)
924 {
925 BYTE src_color = src_row[x];
926 dst_row[x] = 0xff000000
927 | (palette->colors[src_color].rgbRed << 16)
928 | (palette->colors[src_color].rgbGreen << 8)
929 | palette->colors[src_color].rgbBlue;
930 }
931 }
932}
static HPALETTE palette
Definition: clipboard.c:1345

Referenced by wined3d_format_get_color_key_conversion().

◆ convert_r16g16()

static void convert_r16g16 ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 724 of file utils.c.

726{
727 unsigned int x, y, z;
728 const WORD *Source;
729 WORD *Dest;
730
731 for (z = 0; z < depth; z++)
732 {
733 for (y = 0; y < height; y++)
734 {
735 Source = (const WORD *)(src + z * src_slice_pitch + y * src_row_pitch);
736 Dest = (WORD *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
737 for (x = 0; x < width; x++ )
738 {
739 WORD green = (*Source++);
740 WORD red = (*Source++);
741 Dest[0] = green;
742 Dest[1] = red;
743 /* Strictly speaking not correct for R16G16F, but it doesn't matter because the
744 * shader overwrites it anyway */
745 Dest[2] = 0xffff;
746 Dest += 3;
747 }
748 }
749 }
750}
GLclampf green
Definition: gl.h:1740
#define red
Definition: linetest.c:67

◆ convert_r16g16_snorm()

static void convert_r16g16_snorm ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 699 of file utils.c.

701{
702 unsigned int x, y, z;
703 const DWORD *Source;
704 unsigned short *Dest;
705
706 for (z = 0; z < depth; z++)
707 {
708 for (y = 0; y < height; y++)
709 {
710 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
711 Dest = (unsigned short *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
712 for (x = 0; x < width; x++ )
713 {
714 const DWORD color = (*Source++);
715 /* B */ Dest[0] = 0xffff;
716 /* G */ Dest[1] = (color >> 16) + 32768; /* V */
717 /* R */ Dest[2] = (color & 0xffff) + 32768; /* U */
718 Dest += 3;
719 }
720 }
721 }
722}

◆ convert_r32g32_float()

static void convert_r32g32_float ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 752 of file utils.c.

754{
755 unsigned int x, y, z;
756 const float *Source;
757 float *Dest;
758
759 for (z = 0; z < depth; z++)
760 {
761 for (y = 0; y < height; y++)
762 {
763 Source = (const float *)(src + z * src_slice_pitch + y * src_row_pitch);
764 Dest = (float *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
765 for (x = 0; x < width; x++ )
766 {
767 float green = (*Source++);
768 float red = (*Source++);
769 Dest[0] = green;
770 Dest[1] = red;
771 Dest[2] = 1.0f;
772 Dest += 3;
773 }
774 }
775 }
776}

◆ convert_r5g5_snorm_l6_unorm()

static void convert_r5g5_snorm_l6_unorm ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 473 of file utils.c.

475{
476 unsigned int x, y, z;
477 unsigned char r_in, g_in, l_in;
478 const unsigned short *texel_in;
479 unsigned short *texel_out;
480
481 /* Emulating signed 5 bit values with unsigned 5 bit values has some precision problems by design:
482 * E.g. the signed input value 0 becomes 16. GL normalizes it to 16 / 31 = 0.516. We convert it
483 * back to a signed value by subtracting 0.5 and multiplying by 2.0. The resulting value is
484 * ((16 / 31) - 0.5) * 2.0 = 0.032, which is quite different from the intended result 0.000. */
485 for (z = 0; z < depth; z++)
486 {
487 for (y = 0; y < height; y++)
488 {
489 texel_out = (unsigned short *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
490 texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
491 for (x = 0; x < width; x++ )
492 {
493 l_in = (*texel_in & 0xfc00u) >> 10;
494 g_in = (*texel_in & 0x03e0u) >> 5;
495 r_in = *texel_in & 0x001fu;
496
497 *texel_out = ((r_in + 16) << 11) | (l_in << 5) | (g_in + 16);
498 texel_out++;
499 texel_in++;
500 }
501 }
502 }
503}
static struct stream g_in
Definition: tcp.c:73

◆ convert_r5g5_snorm_l6_unorm_ext()

static void convert_r5g5_snorm_l6_unorm_ext ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 505 of file utils.c.

507{
508 unsigned int x, y, z;
509 unsigned char *texel_out, r_out, g_out, r_in, g_in, l_in;
510 const unsigned short *texel_in;
511
512 for (z = 0; z < depth; z++)
513 {
514 for (y = 0; y < height; y++)
515 {
516 texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
517 texel_out = dst + z * dst_slice_pitch + y * dst_row_pitch;
518 for (x = 0; x < width; x++ )
519 {
520 l_in = (*texel_in & 0xfc00u) >> 10;
521 g_in = (*texel_in & 0x03e0u) >> 5;
522 r_in = *texel_in & 0x001fu;
523
524 r_out = r_in << 3;
525 if (!(r_in & 0x10)) /* r > 0 */
526 r_out |= r_in >> 1;
527
528 g_out = g_in << 3;
529 if (!(g_in & 0x10)) /* g > 0 */
530 g_out |= g_in >> 1;
531
532 texel_out[0] = r_out;
533 texel_out[1] = g_out;
534 texel_out[2] = l_in << 1 | l_in >> 5;
535 texel_out[3] = 0;
536
537 texel_out += 4;
538 texel_in++;
539 }
540 }
541 }
542}
static struct stream g_out[STREAM_COUNT]
Definition: tcp.c:74

◆ convert_r5g5_snorm_l6_unorm_nv()

static void convert_r5g5_snorm_l6_unorm_nv ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 544 of file utils.c.

546{
547 unsigned int x, y, z;
548 unsigned char *texel_out, ds_out, dt_out, r_in, g_in, l_in;
549 const unsigned short *texel_in;
550
551 /* This makes the gl surface bigger(24 bit instead of 16), but it works with
552 * fixed function and shaders without further conversion once the surface is
553 * loaded.
554 *
555 * The difference between this function and convert_r5g5_snorm_l6_unorm_ext
556 * is that convert_r5g5_snorm_l6_unorm_ext creates a 32 bit XRGB texture and
557 * this function creates a 24 bit DSDT_MAG texture. Trying to load a DSDT_MAG
558 * internal with a 32 bit DSDT_MAG_INTENSITY or DSDT_MAG_VIB format fails. */
559 for (z = 0; z < depth; z++)
560 {
561 for (y = 0; y < height; y++)
562 {
563 texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
564 texel_out = dst + z * dst_slice_pitch + y * dst_row_pitch;
565 for (x = 0; x < width; x++ )
566 {
567 l_in = (*texel_in & 0xfc00u) >> 10;
568 g_in = (*texel_in & 0x03e0u) >> 5;
569 r_in = *texel_in & 0x001fu;
570
571 ds_out = r_in << 3;
572 if (!(r_in & 0x10)) /* r > 0 */
573 ds_out |= r_in >> 1;
574
575 dt_out = g_in << 3;
576 if (!(g_in & 0x10)) /* g > 0 */
577 dt_out |= g_in >> 1;
578
579 texel_out[0] = ds_out;
580 texel_out[1] = dt_out;
581 texel_out[2] = l_in << 1 | l_in >> 5;
582
583 texel_out += 3;
584 texel_in++;
585 }
586 }
587 }
588}

◆ convert_r8g8_snorm()

static void convert_r8g8_snorm ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 590 of file utils.c.

592{
593 unsigned int x, y, z;
594 const short *Source;
595 unsigned char *Dest;
596
597 for (z = 0; z < depth; z++)
598 {
599 for (y = 0; y < height; y++)
600 {
601 Source = (const short *)(src + z * src_slice_pitch + y * src_row_pitch);
602 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
603 for (x = 0; x < width; x++ )
604 {
605 const short color = (*Source++);
606 /* B */ Dest[0] = 0xff;
607 /* G */ Dest[1] = (color >> 8) + 128; /* V */
608 /* R */ Dest[2] = (color & 0xff) + 128; /* U */
609 Dest += 3;
610 }
611 }
612 }
613}

◆ convert_r8g8_snorm_l8x8_unorm()

static void convert_r8g8_snorm_l8x8_unorm ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 615 of file utils.c.

617{
618 unsigned int x, y, z;
619 const DWORD *Source;
620 unsigned char *Dest;
621
622 /* Doesn't work correctly with the fixed function pipeline, but can work in
623 * shaders if the shader is adjusted. (There's no use for this format in gl's
624 * standard fixed function pipeline anyway).
625 */
626 for (z = 0; z < depth; z++)
627 {
628 for (y = 0; y < height; y++)
629 {
630 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
631 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
632 for (x = 0; x < width; x++ )
633 {
634 LONG color = (*Source++);
635 /* B */ Dest[0] = ((color >> 16) & 0xff); /* L */
636 /* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
637 /* R */ Dest[2] = (color & 0xff) + 128; /* U */
638 Dest += 4;
639 }
640 }
641 }
642}
long LONG
Definition: pedump.c:60

◆ convert_r8g8_snorm_l8x8_unorm_nv()

static void convert_r8g8_snorm_l8x8_unorm_nv ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 644 of file utils.c.

646{
647 unsigned int x, y, z;
648 const DWORD *Source;
649 unsigned char *Dest;
650
651 /* This implementation works with the fixed function pipeline and shaders
652 * without further modification after converting the surface.
653 */
654 for (z = 0; z < depth; z++)
655 {
656 for (y = 0; y < height; y++)
657 {
658 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
659 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
660 for (x = 0; x < width; x++ )
661 {
662 LONG color = (*Source++);
663 /* L */ Dest[2] = ((color >> 16) & 0xff); /* L */
664 /* V */ Dest[1] = ((color >> 8 ) & 0xff); /* V */
665 /* U */ Dest[0] = (color & 0xff); /* U */
666 /* I */ Dest[3] = 255; /* X */
667 Dest += 4;
668 }
669 }
670 }
671}

◆ convert_r8g8b8a8_snorm()

static void convert_r8g8b8a8_snorm ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 673 of file utils.c.

675{
676 unsigned int x, y, z;
677 const DWORD *Source;
678 unsigned char *Dest;
679
680 for (z = 0; z < depth; z++)
681 {
682 for (y = 0; y < height; y++)
683 {
684 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
685 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
686 for (x = 0; x < width; x++ )
687 {
688 LONG color = (*Source++);
689 /* B */ Dest[0] = ((color >> 16) & 0xff) + 128; /* W */
690 /* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
691 /* R */ Dest[2] = (color & 0xff) + 128; /* U */
692 /* A */ Dest[3] = ((color >> 24) & 0xff) + 128; /* Q */
693 Dest += 4;
694 }
695 }
696 }
697}

◆ convert_s1_uint_d15_unorm()

static void convert_s1_uint_d15_unorm ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 778 of file utils.c.

780{
781 unsigned int x, y, z;
782
783 for (z = 0; z < depth; z++)
784 {
785 for (y = 0; y < height; ++y)
786 {
787 const WORD *source = (const WORD *)(src + z * src_slice_pitch + y * src_row_pitch);
788 DWORD *dest = (DWORD *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
789
790 for (x = 0; x < width; ++x)
791 {
792 /* The depth data is normalized, so needs to be scaled,
793 * the stencil data isn't. Scale depth data by
794 * (2^24-1)/(2^15-1) ~~ (2^9 + 2^-6). */
795 WORD d15 = source[x] >> 1;
796 DWORD d24 = (d15 << 9) + (d15 >> 6);
797 dest[x] = (d24 << 8) | (source[x] & 0x1);
798 }
799 }
800 }
801}
static char * dest
Definition: rtl.c:135

◆ convert_s4x4_uint_d24_unorm()

static void convert_s4x4_uint_d24_unorm ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 803 of file utils.c.

805{
806 unsigned int x, y, z;
807
808 for (z = 0; z < depth; z++)
809 {
810 for (y = 0; y < height; ++y)
811 {
812 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
813 DWORD *dest = (DWORD *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
814
815 for (x = 0; x < width; ++x)
816 {
817 /* Just need to clear out the X4 part. */
818 dest[x] = source[x] & ~0xf0;
819 }
820 }
821 }
822}

◆ convert_s8_uint_d24_float()

static void convert_s8_uint_d24_float ( const BYTE src,
BYTE dst,
UINT  src_row_pitch,
UINT  src_slice_pitch,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
UINT  width,
UINT  height,
UINT  depth 
)
static

Definition at line 824 of file utils.c.

826{
827 unsigned int x, y, z;
828
829 for (z = 0; z < depth; z++)
830 {
831 for (y = 0; y < height; ++y)
832 {
833 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
834 float *dest_f = (float *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
835 DWORD *dest_s = (DWORD *)dest_f;
836
837 for (x = 0; x < width; ++x)
838 {
839 dest_f[x * 2] = float_24_to_32((source[x] & 0xffffff00u) >> 8);
840 dest_s[x * 2 + 1] = source[x] & 0xff;
841 }
842 }
843 }
844}
static float float_24_to_32(DWORD in)

◆ copy_format()

static void copy_format ( struct wined3d_format dst_format,
const struct wined3d_format src_format 
)
static

Definition at line 1780 of file utils.c.

1781{
1782 enum wined3d_format_id id = dst_format->id;
1783 *dst_format = *src_format;
1784 dst_format->id = id;
1785}
enum wined3d_format_id id
Definition: utils.c:40
static const char * dst_format
Definition: dib.c:1133
wined3d_format_id
Definition: wined3d.h:106

Referenced by init_format_texture_info(), and init_typeless_formats().

◆ create_and_bind_fbo_attachment()

static void create_and_bind_fbo_attachment ( const struct wined3d_gl_info gl_info,
unsigned int  flags,
enum wined3d_gl_resource_type  d3d_type,
GLuint object,
GLenum  internal,
GLenum  format,
GLenum  type 
)
static

Definition at line 2003 of file utils.c.

2005{
2006 GLenum attach_type = flags & WINED3DFMT_FLAG_DEPTH ?
2008
2009 switch (d3d_type)
2010 {
2012 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2013 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, *object);
2014 gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, internal, 16, 0, format, type, NULL);
2015 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2016 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2017
2018 gl_info->fbo_ops.glFramebufferTexture1D(GL_FRAMEBUFFER, attach_type, GL_TEXTURE_1D,
2019 *object, 0);
2021 gl_info->fbo_ops.glFramebufferTexture1D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_1D,
2022 *object, 0);
2023 break;
2024
2027 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2028 gl_info->gl_ops.gl.p_glBindTexture(wined3d_gl_type_to_enum(d3d_type), *object);
2029 gl_info->gl_ops.gl.p_glTexImage2D(wined3d_gl_type_to_enum(d3d_type), 0, internal, 16, 16, 0,
2030 format, type, NULL);
2031 gl_info->gl_ops.gl.p_glTexParameteri(wined3d_gl_type_to_enum(d3d_type), GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2032 gl_info->gl_ops.gl.p_glTexParameteri(wined3d_gl_type_to_enum(d3d_type), GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2033
2034 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, attach_type,
2035 wined3d_gl_type_to_enum(d3d_type), *object, 0);
2037 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
2038 wined3d_gl_type_to_enum(d3d_type), *object, 0);
2039 break;
2040
2042 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2043 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_3D, *object);
2045 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2046 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2047
2048 gl_info->fbo_ops.glFramebufferTexture3D(GL_FRAMEBUFFER, attach_type,
2049 GL_TEXTURE_3D, *object, 0, 0);
2051 gl_info->fbo_ops.glFramebufferTexture3D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
2052 GL_TEXTURE_3D, *object, 0, 0);
2053 break;
2054
2056 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2057 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, *object);
2058 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, internal, 16, 16, 0,
2059 format, type, NULL);
2060 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, 0, internal, 16, 16, 0,
2061 format, type, NULL);
2062 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, 0, internal, 16, 16, 0,
2063 format, type, NULL);
2064 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, 0, internal, 16, 16, 0,
2065 format, type, NULL);
2066 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, 0, internal, 16, 16, 0,
2067 format, type, NULL);
2068 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 0, internal, 16, 16, 0,
2069 format, type, NULL);
2070 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2071 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2072
2073 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, attach_type,
2076 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
2078 break;
2079
2081 gl_info->fbo_ops.glGenRenderbuffers(1, object);
2082 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, *object);
2083 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, internal, 16, 16);
2084 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, attach_type, GL_RENDERBUFFER,
2085 *object);
2087 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
2088 *object);
2089 break;
2090
2093 break;
2094 }
2095
2096 /* Ideally we'd skip all formats already known not to work on textures
2097 * by checking for WINED3DFMT_FLAG_TEXTURE here. However, we want to
2098 * know if we can attach WINED3DFMT_P8_UINT textures to FBOs, and this
2099 * format never has WINED3DFMT_FLAG_TEXTURE set. Instead, swallow GL
2100 * errors generated by invalid formats. */
2101 while (gl_info->gl_ops.gl.p_glGetError());
2102}
#define GL_TEXTURE_3D
Definition: gl.h:1515
GLAPI void GLAPIENTRY glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
Definition: glext.h:1237
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
Definition: glext.h:1234
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
Definition: glext.h:1235
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
Definition: glext.h:1236
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
Definition: glext.h:1233
#define GL_EXTCALL(f)

Referenced by check_fbo_compat().

◆ debug_append()

static void debug_append ( struct debug_buffer buffer,
const char str,
const char separator 
)
static

Definition at line 4182 of file utils.c.

4183{
4184 int size;
4185
4186 if (!separator || buffer->ptr == buffer->str)
4187 separator = "";
4188 size = snprintf(buffer->ptr, buffer->size, "%s%s", separator, str);
4189 if (size == -1 || size >= buffer->size)
4190 {
4191 buffer->size = 0;
4192 strcpy(&buffer->str[ARRAY_SIZE(buffer->str) - 4], "...");
4193 return;
4194 }
4195
4196 buffer->ptr += size;
4197 buffer->size -= size;
4198}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static const WCHAR separator[]
Definition: asmname.c:65
const WCHAR * str
#define snprintf
Definition: wintirpc.h:48

◆ debug_box()

const char * debug_box ( const struct wined3d_box box)

Definition at line 3939 of file utils.c.

3940{
3941 if (!box)
3942 return "(null)";
3943 return wine_dbg_sprintf("(%u, %u, %u)-(%u, %u, %u)",
3944 box->left, box->top, box->front,
3945 box->right, box->bottom, box->back);
3946}
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
Definition: palette.c:468

Referenced by surface_cpu_blt(), surface_cpu_blt_colour_fill(), texture3d_upload_data(), texture_resource_sub_resource_map(), wined3d_cs_exec_blt_sub_resource(), wined3d_device_copy_sub_resource_region(), wined3d_device_update_sub_resource(), wined3d_resource_map(), wined3d_resource_update_info(), wined3d_texture_add_dirty_region(), and wined3d_texture_check_box_dimensions().

◆ debug_color()

const char * debug_color ( const struct wined3d_color color)

◆ debug_complex_fixup()

static const char * debug_complex_fixup ( enum complex_fixup  fixup)
static

Definition at line 4834 of file utils.c.

4835{
4836 switch(fixup)
4837 {
4838#define WINED3D_TO_STR(x) case x: return #x
4844#undef WINED3D_TO_STR
4845 default:
4846 FIXME("Unrecognized complex fixup %#x\n", fixup);
4847 return "unrecognized";
4848 }
4849}
#define WINED3D_TO_STR(x)

Referenced by dump_color_fixup_desc().

◆ debug_d3ddeclmethod()

const char * debug_d3ddeclmethod ( enum wined3d_decl_method  method)

Definition at line 4270 of file utils.c.

4271{
4272 switch (method)
4273 {
4274#define WINED3DDECLMETHOD_TO_STR(u) case u: return #u
4282#undef WINED3DDECLMETHOD_TO_STR
4283 default:
4284 FIXME("Unrecognized declaration method %#x.\n", method);
4285 return "unrecognized";
4286 }
4287}
#define WINED3DDECLMETHOD_TO_STR(u)
method
Definition: dragdrop.c:54
@ WINED3D_DECL_METHOD_LOOKUP
Definition: wined3d.h:780
@ WINED3D_DECL_METHOD_LOOKUP_PRESAMPLED
Definition: wined3d.h:781
@ WINED3D_DECL_METHOD_PARTIAL_V
Definition: wined3d.h:777
@ WINED3D_DECL_METHOD_CROSS_UV
Definition: wined3d.h:778
@ WINED3D_DECL_METHOD_UV
Definition: wined3d.h:779
@ WINED3D_DECL_METHOD_PARTIAL_U
Definition: wined3d.h:776
@ WINED3D_DECL_METHOD_DEFAULT
Definition: wined3d.h:775

Referenced by dump_wined3d_vertex_element().

◆ debug_d3ddeclusage()

const char * debug_d3ddeclusage ( enum wined3d_decl_usage  usage)

Definition at line 4289 of file utils.c.

4290{
4291 switch (usage)
4292 {
4293#define WINED3DDECLUSAGE_TO_STR(u) case u: return #u
4308#undef WINED3DDECLUSAGE_TO_STR
4309 default:
4310 FIXME("Unrecognized %u declaration usage!\n", usage);
4311 return "unrecognized";
4312 }
4313}
#define WINED3DDECLUSAGE_TO_STR(u)
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
@ WINED3D_DECL_USAGE_DEPTH
Definition: wined3d.h:798
@ WINED3D_DECL_USAGE_BLEND_INDICES
Definition: wined3d.h:788
@ WINED3D_DECL_USAGE_TESS_FACTOR
Definition: wined3d.h:794
@ WINED3D_DECL_USAGE_NORMAL
Definition: wined3d.h:789
@ WINED3D_DECL_USAGE_PSIZE
Definition: wined3d.h:790
@ WINED3D_DECL_USAGE_BLEND_WEIGHT
Definition: wined3d.h:787
@ WINED3D_DECL_USAGE_SAMPLE
Definition: wined3d.h:799
@ WINED3D_DECL_USAGE_POSITION
Definition: wined3d.h:786
@ WINED3D_DECL_USAGE_BINORMAL
Definition: wined3d.h:793
@ WINED3D_DECL_USAGE_COLOR
Definition: wined3d.h:796
@ WINED3D_DECL_USAGE_POSITIONT
Definition: wined3d.h:795
@ WINED3D_DECL_USAGE_TEXCOORD
Definition: wined3d.h:791
@ WINED3D_DECL_USAGE_TANGENT
Definition: wined3d.h:792
@ WINED3D_DECL_USAGE_FOG
Definition: wined3d.h:797

Referenced by dump_wined3d_vertex_element(), fixed_get_input(), and wined3d_stream_info_from_declaration().

◆ debug_d3ddevicetype()

const char * debug_d3ddevicetype ( enum wined3d_device_type  device_type)

Definition at line 4153 of file utils.c.

4154{
4155 switch (device_type)
4156 {
4157#define DEVTYPE_TO_STR(dev) case dev: return #dev
4161#undef DEVTYPE_TO_STR
4162 default:
4163 FIXME("Unrecognized device type %#x.\n", device_type);
4164 return "unrecognized";
4165 }
4166}
device_type
#define DEVTYPE_TO_STR(dev)
@ WINED3D_DEVICE_TYPE_SW
Definition: wined3d.h:89
@ WINED3D_DEVICE_TYPE_HAL
Definition: wined3d.h:87
@ WINED3D_DEVICE_TYPE_REF
Definition: wined3d.h:88

Referenced by wined3d_check_depth_stencil_match(), wined3d_check_device_format(), wined3d_check_device_format_conversion(), wined3d_check_device_multisample_type(), wined3d_check_device_type(), and wined3d_get_device_caps().

◆ debug_d3dformat()

const char * debug_d3dformat ( enum wined3d_format_id  format_id)

Definition at line 3980 of file utils.c.

3981{
3982 switch (format_id)
3983 {
3984#define FMT_TO_STR(format_id) case format_id: return #format_id
4135#undef FMT_TO_STR
4136 default:
4137 {
4138 char fourcc[5];
4139 fourcc[0] = (char)(format_id);
4140 fourcc[1] = (char)(format_id >> 8);
4141 fourcc[2] = (char)(format_id >> 16);
4142 fourcc[3] = (char)(format_id >> 24);
4143 fourcc[4] = 0;
4144 if (isprint(fourcc[0]) && isprint(fourcc[1]) && isprint(fourcc[2]) && isprint(fourcc[3]))
4145 FIXME("Unrecognized %#x (as fourcc: %s) WINED3DFORMAT!\n", format_id, fourcc);
4146 else
4147 FIXME("Unrecognized %#x WINED3DFORMAT!\n", format_id);
4148 }
4149 return "unrecognized";
4150 }
4151}
#define isprint(c)
Definition: acclib.h:73
#define FMT_TO_STR(format_id)
unsigned char
Definition: typeof.h:29
@ WINED3DFMT_R32G32B32_TYPELESS
Definition: wined3d.h:139
@ WINED3DFMT_R8_TYPELESS
Definition: wined3d.h:196
@ WINED3DFMT_B2G3R3_UNORM
Definition: wined3d.h:111
@ WINED3DFMT_R32G32B32_SINT
Definition: wined3d.h:142
@ WINED3DFMT_R8G8_UNORM
Definition: wined3d.h:185
@ WINED3DFMT_BC7_TYPELESS
Definition: wined3d.h:232
@ WINED3DFMT_BC7_UNORM_SRGB
Definition: wined3d.h:234
@ WINED3DFMT_R32G32_SINT
Definition: wined3d.h:152
@ WINED3DFMT_X24_TYPELESS_G8_UINT
Definition: wined3d.h:183
@ WINED3DFMT_B4G4R4A4_UNORM
Definition: wined3d.h:110
@ WINED3DFMT_R16G16_UINT
Definition: wined3d.h:172
@ WINED3DFMT_R8G8_TYPELESS
Definition: wined3d.h:184
@ WINED3DFMT_R10G10B10X2_UINT
Definition: wined3d.h:124
@ WINED3DFMT_X8D24_UNORM
Definition: wined3d.h:130
@ WINED3DFMT_R32_SINT
Definition: wined3d.h:179
@ WINED3DFMT_D32_FLOAT
Definition: wined3d.h:176
@ WINED3DFMT_R10G10B10A2_UNORM
Definition: wined3d.h:158
@ WINED3DFMT_R8_UINT
Definition: wined3d.h:198
@ WINED3DFMT_R8G8_SNORM_Cx
Definition: wined3d.h:134
@ WINED3DFMT_R16_UNORM
Definition: wined3d.h:192
@ WINED3DFMT_R24G8_TYPELESS
Definition: wined3d.h:180
@ WINED3DFMT_R10G10B10A2_TYPELESS
Definition: wined3d.h:157
@ WINED3DFMT_R32G32_UINT
Definition: wined3d.h:151
@ WINED3DFMT_R32G32B32_UINT
Definition: wined3d.h:141
@ WINED3DFMT_BC4_TYPELESS
Definition: wined3d.h:215
@ WINED3DFMT_R8_UNORM
Definition: wined3d.h:197
@ WINED3DFMT_S8_UINT_D24_FLOAT
Definition: wined3d.h:133
@ WINED3DFMT_R10G10B10_XR_BIAS_A2_UNORM
Definition: wined3d.h:161
@ WINED3DFMT_R16_TYPELESS
Definition: wined3d.h:189
@ WINED3DFMT_R16G16B16A16_SINT
Definition: wined3d.h:148
@ WINED3DFMT_D16_LOCKABLE
Definition: wined3d.h:127
@ WINED3DFMT_R10G11B11_SNORM
Definition: wined3d.h:123
@ WINED3DFMT_S1_UINT_D15_UNORM
Definition: wined3d.h:129
@ WINED3DFMT_R16_SINT
Definition: wined3d.h:195
@ WINED3DFMT_B2G3R3A8_UNORM
Definition: wined3d.h:112
@ WINED3DFMT_R8G8_B8G8_UNORM
Definition: wined3d.h:204
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:224
@ WINED3DFMT_R32_FLOAT_X8X24_TYPELESS
Definition: wined3d.h:155
@ WINED3DFMT_R8G8B8X8_UNORM
Definition: wined3d.h:114
@ WINED3DFMT_B5G5R5X1_UNORM
Definition: wined3d.h:109
@ WINED3DFMT_B10G10R10A2_UNORM
Definition: wined3d.h:115
@ WINED3DFMT_D16_UNORM
Definition: wined3d.h:191
@ WINED3DFMT_NVHS
Definition: wined3d.h:252
@ WINED3DFMT_R8G8B8A8_TYPELESS
Definition: wined3d.h:163
@ WINED3DFMT_R8G8_UINT
Definition: wined3d.h:186
@ WINED3DFMT_BC7_UNORM
Definition: wined3d.h:233
@ WINED3DFMT_B8G8R8_UNORM
Definition: wined3d.h:108
@ WINED3DFMT_R8G8B8A8_UNORM_SRGB
Definition: wined3d.h:165
@ WINED3DFMT_R9G9B9E5_SHAREDEXP
Definition: wined3d.h:203
@ WINED3DFMT_B8G8R8X8_TYPELESS
Definition: wined3d.h:227
@ WINED3DFMT_R32_UINT
Definition: wined3d.h:178
@ WINED3DFMT_B5G5R5A1_UNORM
Definition: wined3d.h:222
@ WINED3DFMT_R10G10B10_SNORM_A2_UNORM
Definition: wined3d.h:126
@ WINED3DFMT_D32_UNORM
Definition: wined3d.h:128
@ WINED3DFMT_R8G8B8A8_UNORM
Definition: wined3d.h:164
@ WINED3DFMT_R10G10B10A2_UINT
Definition: wined3d.h:159
@ WINED3DFMT_G8R8_G8B8_UNORM
Definition: wined3d.h:205
@ WINED3DFMT_R32G32B32A32_UINT
Definition: wined3d.h:137
@ WINED3DFMT_BC6H_UF16
Definition: wined3d.h:230
@ WINED3DFMT_R16G16B16A16_TYPELESS
Definition: wined3d.h:143
@ WINED3DFMT_R10G10B10A2_SNORM
Definition: wined3d.h:160
@ WINED3DFMT_R24_UNORM_X8_TYPELESS
Definition: wined3d.h:182
@ WINED3DFMT_R16
Definition: wined3d.h:256
@ WINED3DFMT_D32_FLOAT_S8X24_UINT
Definition: wined3d.h:154
@ WINED3DFMT_NVHU
Definition: wined3d.h:251
@ WINED3DFMT_X32_TYPELESS_G8X24_UINT
Definition: wined3d.h:156
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:221
@ WINED3DFMT_R16G16B16A16_UINT
Definition: wined3d.h:146
@ WINED3DFMT_S4X4_UINT_D24_UNORM
Definition: wined3d.h:131
@ WINED3DFMT_BC1_TYPELESS
Definition: wined3d.h:206
@ WINED3DFMT_B8G8R8X8_UNORM_SRGB
Definition: wined3d.h:228
@ WINED3DFMT_B8G8R8A8_TYPELESS
Definition: wined3d.h:225
@ WINED3DFMT_BC3_TYPELESS
Definition: wined3d.h:212
@ WINED3DFMT_R16G16_TYPELESS
Definition: wined3d.h:169
@ WINED3DFMT_R8_SNORM
Definition: wined3d.h:199
@ WINED3DFMT_G8R8_G8B8
Definition: wined3d.h:245
@ WINED3DFMT_R8G8B8A8_UINT
Definition: wined3d.h:166
@ WINED3DFMT_R16_SNORM
Definition: wined3d.h:194
@ WINED3DFMT_BC6H_TYPELESS
Definition: wined3d.h:229
@ WINED3DFMT_R32G32B32A32_TYPELESS
Definition: wined3d.h:135
@ WINED3DFMT_R32_TYPELESS
Definition: wined3d.h:175
@ WINED3DFMT_R32G8X24_TYPELESS
Definition: wined3d.h:153
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:193
@ WINED3DFMT_R8_SINT
Definition: wined3d.h:200
@ WINED3DFMT_BC5_TYPELESS
Definition: wined3d.h:218
@ WINED3DFMT_R8G8_SINT
Definition: wined3d.h:188
@ WINED3DFMT_R32G32B32A32_SINT
Definition: wined3d.h:138
@ WINED3DFMT_R8G8B8A8_SINT
Definition: wined3d.h:168
@ WINED3DFMT_R10G10B10X2_SNORM
Definition: wined3d.h:125
@ WINED3DFMT_R1_UNORM
Definition: wined3d.h:202
@ WINED3DFMT_R11G11B10_FLOAT
Definition: wined3d.h:162
@ WINED3DFMT_B8G8R8A8_UNORM_SRGB
Definition: wined3d.h:226
@ WINED3DFMT_BC2_TYPELESS
Definition: wined3d.h:209
@ WINED3DFMT_R8G8_B8G8
Definition: wined3d.h:246
@ WINED3DFMT_BC6H_SF16
Definition: wined3d.h:231
@ WINED3DFMT_B4G4R4X4_UNORM
Definition: wined3d.h:113
@ WINED3DFMT_MULTI2_ARGB8
Definition: wined3d.h:244
@ WINED3DFMT_AL16
Definition: wined3d.h:257
@ WINED3DFMT_D24_UNORM_S8_UINT
Definition: wined3d.h:181
@ WINED3DFMT_P8_UINT_A8_UNORM
Definition: wined3d.h:116
@ WINED3DFMT_R16G16B16A16_SNORM
Definition: wined3d.h:147
@ WINED3DFMT_R16G16_SINT
Definition: wined3d.h:174
@ WINED3DFMT_R32G32_TYPELESS
Definition: wined3d.h:149

Referenced by buffer_check_attribute(), buffer_init(), buffer_process_converted_attribute(), check_fbo_compat(), CheckRenderTargetCapability(), context_choose_pixel_format(), context_find_fbo_entry(), cpu_blitter_clear(), draw_primitive_immediate_mode(), dump_wined3d_vertex_element(), get_format_internal(), init_format_depth_bias_scale(), init_format_fbo_compat_info(), init_format_filter_info(), init_format_vertex_info(), query_format_flag(), query_view_class(), resource_init(), state_depthbias(), surface_convert_format(), surface_cpu_blt(), surface_cpu_blt_colour_fill(), surface_cpu_blt_compressed(), surface_depth_blt_fbo(), surface_download_data(), swapchain_init(), texture1d_download_data(), texture2d_create_dc(), texture2d_prepare_texture(), texture3d_download_data(), validate_resource_view(), vertexdeclaration_init(), wined3d_calculate_format_pitch(), wined3d_check_depth_stencil_match(), wined3d_check_device_format(), wined3d_check_device_format_conversion(), wined3d_check_device_multisample_type(), wined3d_check_device_type(), wined3d_device_copy_resource(), wined3d_device_copy_sub_resource_region(), wined3d_device_reset(), wined3d_device_resolve_sub_resource(), wined3d_device_set_cursor_properties(), wined3d_device_set_index_buffer(), wined3d_dxt1_decode(), wined3d_dxt1_encode(), wined3d_dxt3_decode(), wined3d_dxt3_encode(), wined3d_dxt5_decode(), wined3d_dxt5_encode(), wined3d_enum_adapter_modes(), wined3d_find_closest_matching_adapter_mode(), wined3d_format_convert_from_float(), wined3d_format_get_color_key_conversion(), wined3d_format_get_float_color_key(), wined3d_get_adapter_display_mode(), wined3d_get_adapter_mode_count(), wined3d_get_format(), wined3d_render_target_view_cs_init(), wined3d_set_adapter_display_mode(), wined3d_shader_resource_view_cs_init(), wined3d_stream_info_from_declaration(), wined3d_surface_upload_data(), wined3d_swapchain_cs_init(), wined3d_swapchain_get_display_mode(), wined3d_swapchain_resize_buffers(), wined3d_texture_init(), wined3d_texture_update_desc(), and wined3d_unordered_access_view_clear_uint().

◆ debug_d3dinput_classification()

const char * debug_d3dinput_classification ( enum wined3d_input_classification  classification)

Definition at line 4315 of file utils.c.

4316{
4317 switch (classification)
4318 {
4319#define WINED3D_TO_STR(x) case x: return #x
4322#undef WINED3D_TO_STR
4323 default:
4324 FIXME("Unrecognized input classification %#x.\n", classification);
4325 return "unrecognized";
4326 }
4327}
@ WINED3D_INPUT_PER_INSTANCE_DATA
Definition: wined3d.h:1786
@ WINED3D_INPUT_PER_VERTEX_DATA
Definition: wined3d.h:1785

Referenced by dump_wined3d_vertex_element(), and wined3d_stream_info_from_declaration().

◆ debug_d3dprimitivetype()

const char * debug_d3dprimitivetype ( enum wined3d_primitive_type  primitive_type)

Definition at line 4346 of file utils.c.

4347{
4348 switch (primitive_type)
4349 {
4350#define PRIM_TO_STR(prim) case prim: return #prim
4363#undef PRIM_TO_STR
4364 default:
4365 FIXME("Unrecognized primitive type %#x.\n", primitive_type);
4366 return "unrecognized";
4367 }
4368}
#define PRIM_TO_STR(prim)
@ WINED3D_PT_LINESTRIP_ADJ
Definition: wined3d.h:79
@ WINED3D_PT_LINELIST
Definition: wined3d.h:73
@ WINED3D_PT_UNDEFINED
Definition: wined3d.h:71
@ WINED3D_PT_PATCH
Definition: wined3d.h:82
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:72
@ WINED3D_PT_TRIANGLELIST_ADJ
Definition: wined3d.h:80
@ WINED3D_PT_LINELIST_ADJ
Definition: wined3d.h:78
@ WINED3D_PT_TRIANGLESTRIP_ADJ
Definition: wined3d.h:81
@ WINED3D_PT_TRIANGLESTRIP
Definition: wined3d.h:76
@ WINED3D_PT_LINESTRIP
Definition: wined3d.h:74
@ WINED3D_PT_TRIANGLELIST
Definition: wined3d.h:75
@ WINED3D_PT_TRIANGLEFAN
Definition: wined3d.h:77

Referenced by d3d_primitive_type_from_gl(), gl_primitive_type_from_d3d(), glsl_primitive_type_from_d3d(), wined3d_device_get_primitive_type(), and wined3d_device_set_primitive_type().

◆ debug_d3drenderstate()

const char * debug_d3drenderstate ( enum wined3d_render_state  state)

Definition at line 4370 of file utils.c.

4371{
4372 switch (state)
4373 {
4374#define D3DSTATE_TO_STR(u) case u: return #u
4507#undef D3DSTATE_TO_STR
4508 default:
4509 FIXME("Unrecognized %u render state!\n", state);
4510 return "unrecognized";
4511 }
4512}
static int state
Definition: maze.c:121
#define D3DSTATE_TO_STR(u)
@ WINED3D_RS_TEXTUREFACTOR
Definition: wined3d.h:314
@ WINED3D_RS_COLORKEYENABLE
Definition: wined3d.h:300
@ WINED3D_RS_STENCILFAIL
Definition: wined3d.h:307
@ WINED3D_RS_NORMALDEGREE
Definition: wined3d.h:357
@ WINED3D_RS_WRAP8
Definition: wined3d.h:379
@ WINED3D_RS_LIGHTING
Definition: wined3d.h:324
@ WINED3D_RS_SOFTWAREVERTEXPROCESSING
Definition: wined3d.h:338
@ WINED3D_RS_COLORWRITEENABLE7
Definition: wined3d.h:396
@ WINED3D_RS_STIPPLEDALPHA
Definition: wined3d.h:292
@ WINED3D_RS_COLORWRITEENABLE1
Definition: wined3d.h:373
@ WINED3D_RS_STENCILENABLE
Definition: wined3d.h:306
@ WINED3D_RS_COLORVERTEX
Definition: wined3d.h:328
@ WINED3D_RS_TWEENFACTOR
Definition: wined3d.h:354
@ WINED3D_RS_FOGCOLOR
Definition: wined3d.h:293
@ WINED3D_RS_WRAP4
Definition: wined3d.h:319
@ WINED3D_RS_WRAP15
Definition: wined3d.h:386
@ WINED3D_RS_COLORWRITEENABLE5
Definition: wined3d.h:394
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:269
@ WINED3D_RS_ANTIALIASEDLINEENABLE
Definition: wined3d.h:360
@ WINED3D_RS_SPECULARMATERIALSOURCE
Definition: wined3d.h:333
@ WINED3D_RS_STENCILPASS
Definition: wined3d.h:309
@ WINED3D_RS_WRAP13
Definition: wined3d.h:384
@ WINED3D_RS_DEBUGMONITORTOKEN
Definition: wined3d.h:350
@ WINED3D_RS_WRAP1
Definition: wined3d.h:316
@ WINED3D_RS_WRAP3
Definition: wined3d.h:318
@ WINED3D_RS_DEPTHBIAS
Definition: wined3d.h:378
@ WINED3D_RS_MAXTESSELLATIONLEVEL
Definition: wined3d.h:362
@ WINED3D_RS_DITHERENABLE
Definition: wined3d.h:285
@ WINED3D_RS_SHADEMODE
Definition: wined3d.h:271
@ WINED3D_RS_CULLMODE
Definition: wined3d.h:281
@ WINED3D_RS_BACK_STENCILPASS
Definition: wined3d.h:371
@ WINED3D_RS_WRAPV
Definition: wined3d.h:268
@ WINED3D_RS_COLORWRITEENABLE4
Definition: wined3d.h:393
@ WINED3D_RS_PATCHEDGESTYLE
Definition: wined3d.h:348
@ WINED3D_RS_SCISSORTESTENABLE
Definition: wined3d.h:358
@ WINED3D_RS_LASTPIXEL
Definition: wined3d.h:278
@ WINED3D_RS_VERTEXBLEND
Definition: wined3d.h:336
@ WINED3D_RS_FOGEND
Definition: wined3d.h:296
@ WINED3D_RS_MINTESSELLATIONLEVEL
Definition: wined3d.h:361
@ WINED3D_RS_POINTSCALE_A
Definition: wined3d.h:343
@ WINED3D_RS_MULTISAMPLEMASK
Definition: wined3d.h:347
@ WINED3D_RS_BACK_STENCILFUNC
Definition: wined3d.h:372
@ WINED3D_RS_SRCBLEND
Definition: wined3d.h:279
@ WINED3D_RS_SRGBWRITEENABLE
Definition: wined3d.h:377
@ WINED3D_RS_RANGEFOGENABLE
Definition: wined3d.h:302
@ WINED3D_RS_POINTSIZE_MIN
Definition: wined3d.h:340
@ WINED3D_RS_TEXTUREPERSPECTIVE
Definition: wined3d.h:266
@ WINED3D_RS_DEPTHCLIP
Definition: wined3d.h:391
@ WINED3D_RS_ENABLEADAPTIVETESSELLATION
Definition: wined3d.h:367
@ WINED3D_RS_COLORWRITEENABLE3
Definition: wined3d.h:375
@ WINED3D_RS_ALPHABLENDENABLE
Definition: wined3d.h:286
@ WINED3D_RS_WRAPU
Definition: wined3d.h:267
@ WINED3D_RS_ADAPTIVETESS_X
Definition: wined3d.h:363
@ WINED3D_RS_MONOENABLE
Definition: wined3d.h:273
@ WINED3D_RS_LOCALVIEWER
Definition: wined3d.h:329
@ WINED3D_RS_ADAPTIVETESS_Z
Definition: wined3d.h:365
@ WINED3D_RS_WRAP0
Definition: wined3d.h:315
@ WINED3D_RS_STENCILMASK
Definition: wined3d.h:312
@ WINED3D_RS_COLORWRITEENABLE6
Definition: wined3d.h:395
@ WINED3D_RS_BLENDOP
Definition: wined3d.h:355
@ WINED3D_RS_POINTSCALE_C
Definition: wined3d.h:345
@ WINED3D_RS_FOGSTART
Definition: wined3d.h:295
@ WINED3D_RS_STENCILFUNC
Definition: wined3d.h:310
@ WINED3D_RS_WRAP7
Definition: wined3d.h:322
@ WINED3D_RS_FOGTABLEMODE
Definition: wined3d.h:294
@ WINED3D_RS_POINTSIZE
Definition: wined3d.h:339
@ WINED3D_RS_POINTSIZE_MAX
Definition: wined3d.h:351
@ WINED3D_RS_ZWRITEENABLE
Definition: wined3d.h:276
@ WINED3D_RS_PLANEMASK
Definition: wined3d.h:275
@ WINED3D_RS_SUBPIXELX
Definition: wined3d.h:291
@ WINED3D_RS_CLIPPLANEENABLE
Definition: wined3d.h:337
@ WINED3D_RS_DESTBLEND
Definition: wined3d.h:280
@ WINED3D_RS_AMBIENTMATERIALSOURCE
Definition: wined3d.h:334
@ WINED3D_RS_WRAP6
Definition: wined3d.h:321
@ WINED3D_RS_STENCILREF
Definition: wined3d.h:311
@ WINED3D_RS_FOGENABLE
Definition: wined3d.h:287
@ WINED3D_RS_POINTSPRITEENABLE
Definition: wined3d.h:341
@ WINED3D_RS_FLUSHBATCH
Definition: wined3d.h:304
@ WINED3D_RS_BACK_STENCILZFAIL
Definition: wined3d.h:370
@ WINED3D_RS_ZFUNC
Definition: wined3d.h:282
@ WINED3D_RS_ROP2
Definition: wined3d.h:274
@ WINED3D_RS_POSITIONDEGREE
Definition: wined3d.h:356
@ WINED3D_RS_MULTISAMPLEANTIALIAS
Definition: wined3d.h:346
@ WINED3D_RS_ANTIALIAS
Definition: wined3d.h:265
@ WINED3D_RS_BACK_STENCILFAIL
Definition: wined3d.h:369
@ WINED3D_RS_COLORWRITEENABLE
Definition: wined3d.h:353
@ WINED3D_RS_SLOPESCALEDEPTHBIAS
Definition: wined3d.h:359
@ WINED3D_RS_DIFFUSEMATERIALSOURCE
Definition: wined3d.h:332
@ WINED3D_RS_DEPTHBIASCLAMP
Definition: wined3d.h:392
@ WINED3D_RS_ALPHAREF
Definition: wined3d.h:283
@ WINED3D_RS_NORMALIZENORMALS
Definition: wined3d.h:330
@ WINED3D_RS_ANISOTROPY
Definition: wined3d.h:303
@ WINED3D_RS_TWOSIDEDSTENCILMODE
Definition: wined3d.h:368
@ WINED3D_RS_TRANSLUCENTSORTINDEPENDENT
Definition: wined3d.h:305
@ WINED3D_RS_EMISSIVEMATERIALSOURCE
Definition: wined3d.h:335
@ WINED3D_RS_PATCHSEGMENTS
Definition: wined3d.h:349
@ WINED3D_RS_SPECULARENABLE
Definition: wined3d.h:288
@ WINED3D_RS_WRAP2
Definition: wined3d.h:317
@ WINED3D_RS_ADAPTIVETESS_W
Definition: wined3d.h:366
@ WINED3D_RS_FILLMODE
Definition: wined3d.h:270
@ WINED3D_RS_CLIPPING
Definition: wined3d.h:323
@ WINED3D_RS_WRAP10
Definition: wined3d.h:381
@ WINED3D_RS_SRCBLENDALPHA
Definition: wined3d.h:388
@ WINED3D_RS_COLORKEYBLENDENABLE
Definition: wined3d.h:331
@ WINED3D_RS_COLORWRITEENABLE2
Definition: wined3d.h:374
@ WINED3D_RS_POINTSCALEENABLE
Definition: wined3d.h:342
@ WINED3D_RS_WRAP14
Definition: wined3d.h:385
@ WINED3D_RS_FOGVERTEXMODE
Definition: wined3d.h:327
@ WINED3D_RS_STENCILWRITEMASK
Definition: wined3d.h:313
@ WINED3D_RS_AMBIENT
Definition: wined3d.h:326
@ WINED3D_RS_WRAP11
Definition: wined3d.h:382
@ WINED3D_RS_LINEPATTERN
Definition: wined3d.h:272
@ WINED3D_RS_ZVISIBLE
Definition: wined3d.h:289
@ WINED3D_RS_BLENDFACTOR
Definition: wined3d.h:376
@ WINED3D_RS_EXTENTS
Definition: wined3d.h:325
@ WINED3D_RS_BLENDOPALPHA
Definition: wined3d.h:390
@ WINED3D_RS_DESTBLENDALPHA
Definition: wined3d.h:389
@ WINED3D_RS_FOGDENSITY
Definition: wined3d.h:297
@ WINED3D_RS_STENCILZFAIL
Definition: wined3d.h:308
@ WINED3D_RS_SUBPIXEL
Definition: wined3d.h:290
@ WINED3D_RS_POINTSCALE_B
Definition: wined3d.h:344
@ WINED3D_RS_INDEXEDVERTEXBLENDENABLE
Definition: wined3d.h:352
@ WINED3D_RS_MIPMAPLODBIAS
Definition: wined3d.h:301
@ WINED3D_RS_WRAP9
Definition: wined3d.h:380
@ WINED3D_RS_SEPARATEALPHABLENDENABLE
Definition: wined3d.h:387
@ WINED3D_RS_STIPPLEENABLE
Definition: wined3d.h:298
@ WINED3D_RS_WRAP5
Definition: wined3d.h:320
@ WINED3D_RS_ADAPTIVETESS_Y
Definition: wined3d.h:364
@ WINED3D_RS_ALPHATESTENABLE
Definition: wined3d.h:277
@ WINED3D_RS_ALPHAFUNC
Definition: wined3d.h:284
@ WINED3D_RS_WRAP12
Definition: wined3d.h:383
@ WINED3D_RS_EDGEANTIALIAS
Definition: wined3d.h:299

Referenced by debug_d3dstate(), wined3d_device_get_render_state(), and wined3d_device_set_render_state().

◆ debug_d3dresourcetype()

const char * debug_d3dresourcetype ( enum wined3d_resource_type  resource_type)

Definition at line 4329 of file utils.c.

4330{
4331 switch (resource_type)
4332 {
4333#define WINED3D_TO_STR(x) case x: return #x
4339#undef WINED3D_TO_STR
4340 default:
4341 FIXME("Unrecognized resource type %#x.\n", resource_type);
4342 return "unrecognized";
4343 }
4344}
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
@ WINED3D_RTYPE_TEXTURE_1D
Definition: wined3d.h:699
@ WINED3D_RTYPE_NONE
Definition: wined3d.h:697
@ WINED3D_RTYPE_BUFFER
Definition: wined3d.h:698
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:701

Referenced by context_generate_rt_mask_from_resource(), context_set_fbo_key_for_render_target(), device_resource_released(), resource_init(), surface_set_compatible_renderbuffer(), wined3d_check_device_format(), wined3d_cs_exec_blt_sub_resource(), wined3d_device_clear_rendertarget_view(), wined3d_device_copy_resource(), wined3d_device_copy_sub_resource_region(), wined3d_device_decref(), wined3d_device_resolve_sub_resource(), wined3d_device_update_sub_resource(), wined3d_render_target_view_cs_init(), wined3d_rendertarget_view_prepare_location(), wined3d_rendertarget_view_validate_location(), wined3d_resource_update_info(), wined3d_texture_create(), wined3d_texture_get_dc(), wined3d_texture_init(), wined3d_texture_release_dc(), wined3d_texture_unload(), wined3d_texture_update_desc(), and wined3d_unordered_access_view_clear_uint().

◆ debug_d3dsamplerstate()

const char * debug_d3dsamplerstate ( enum wined3d_sampler_state  state)

Definition at line 4514 of file utils.c.

4515{
4516 switch (state)
4517 {
4518#define D3DSTATE_TO_STR(u) case u: return #u
4532#undef D3DSTATE_TO_STR
4533 default:
4534 FIXME("Unrecognized %u sampler state!\n", state);
4535 return "unrecognized";
4536 }
4537}
@ WINED3D_SAMP_ELEMENT_INDEX
Definition: wined3d.h:547
@ WINED3D_SAMP_MAX_ANISOTROPY
Definition: wined3d.h:545
@ WINED3D_SAMP_MIPMAP_LOD_BIAS
Definition: wined3d.h:543
@ WINED3D_SAMP_MIN_FILTER
Definition: wined3d.h:541
@ WINED3D_SAMP_SRGB_TEXTURE
Definition: wined3d.h:546
@ WINED3D_SAMP_DMAP_OFFSET
Definition: wined3d.h:548
@ WINED3D_SAMP_MIP_FILTER
Definition: wined3d.h:542
@ WINED3D_SAMP_MAG_FILTER
Definition: wined3d.h:540
@ WINED3D_SAMP_BORDER_COLOR
Definition: wined3d.h:539
@ WINED3D_SAMP_ADDRESS_V
Definition: wined3d.h:537
@ WINED3D_SAMP_ADDRESS_U
Definition: wined3d.h:536
@ WINED3D_SAMP_ADDRESS_W
Definition: wined3d.h:538
@ WINED3D_SAMP_MAX_MIP_LEVEL
Definition: wined3d.h:544

Referenced by wined3d_device_get_sampler_state(), and wined3d_device_set_sampler_state().

◆ debug_d3dstate()

const char * debug_d3dstate ( DWORD  state)

Definition at line 4676 of file utils.c.

4677{
4679 return wine_dbg_sprintf("STATE_RENDER(%s)", debug_d3drenderstate(state - STATE_RENDER(0)));
4681 {
4682 DWORD texture_stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
4683 DWORD texture_state = state - STATE_TEXTURESTAGE(texture_stage, 0);
4684 return wine_dbg_sprintf("STATE_TEXTURESTAGE(%#x, %s)",
4685 texture_stage, debug_d3dtexturestate(texture_state));
4686 }
4688 return wine_dbg_sprintf("STATE_SAMPLER(%#x)", state - STATE_SAMPLER(0));
4692 return wine_dbg_sprintf("STATE_SHADER(%s)", debug_shader_type(state - STATE_SHADER(0)));
4694 return wine_dbg_sprintf("STATE_CONSTANT_BUFFER(%s)", debug_shader_type(WINED3D_SHADER_TYPE_COMPUTE));
4696 return wine_dbg_sprintf("STATE_CONSTANT_BUFFER(%s)", debug_shader_type(state - STATE_CONSTANT_BUFFER(0)));
4698 return "STATE_COMPUTE_SHADER_RESOURCE_BINDING";
4700 return "STATE_GRAPHICS_SHADER_RESOURCE_BINDING";
4702 return "STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING";
4704 return "STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING";
4706 return wine_dbg_sprintf("STATE_TRANSFORM(%s)", debug_d3dtstype(state - STATE_TRANSFORM(0)));
4708 return "STATE_STREAMSRC";
4710 return "STATE_INDEXBUFFER";
4711 if (STATE_IS_VDECL(state))
4712 return "STATE_VDECL";
4714 return "STATE_VIEWPORT";
4716 return "STATE_LIGHT_TYPE";
4718 return wine_dbg_sprintf("STATE_ACTIVELIGHT(%#x)", state - STATE_ACTIVELIGHT(0));
4720 return "STATE_SCISSORRECT";
4722 return wine_dbg_sprintf("STATE_CLIPPLANE(%#x)", state - STATE_CLIPPLANE(0));
4724 return "STATE_MATERIAL";
4726 return "STATE_FRONTFACE";
4728 return "STATE_POINTSPRITECOORDORIGIN";
4730 return "STATE_BASEVERTEXINDEX";
4732 return "STATE_FRAMEBUFFER";
4734 return "STATE_POINT_ENABLE";
4736 return "STATE_COLOR_KEY";
4738 return "STATE_STREAM_OUTPUT";
4739 if (STATE_IS_BLEND(state))
4740 return "STATE_BLEND";
4741
4742 return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state);
4743}
const char * debug_d3dtexturestate(enum wined3d_texture_stage_state state)
Definition: utils.c:4559
const char * debug_shader_type(enum wined3d_shader_type type)
Definition: utils.c:4658
const char * debug_d3dtstype(enum wined3d_transform_state tstype)
Definition: utils.c:4627
const char * debug_d3drenderstate(enum wined3d_render_state state)
Definition: utils.c:4370
#define WINED3D_HIGHEST_TEXTURE_STATE
Definition: wined3d.h:595
#define STATE_IS_GRAPHICS_CONSTANT_BUFFER(a)
#define STATE_CLIPPLANE(a)
#define STATE_IS_MATERIAL(a)
#define STATE_CONSTANT_BUFFER(a)
#define STATE_IS_SAMPLER(num)
#define STATE_IS_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING(a)
#define STATE_IS_ACTIVELIGHT(a)
#define STATE_IS_STREAM_OUTPUT(a)
#define STATE_IS_POINTSPRITECOORDORIGIN(a)
#define STATE_IS_VDECL(a)
#define STATE_TRANSFORM(a)
#define STATE_IS_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING(a)
#define STATE_IS_POINT_ENABLE(a)
#define STATE_IS_STREAMSRC(a)
#define STATE_IS_BLEND(a)
#define STATE_SHADER(a)
#define STATE_ACTIVELIGHT(a)
#define STATE_IS_TEXTURESTAGE(a)
#define STATE_IS_COLOR_KEY(a)
#define STATE_IS_CLIPPLANE(a)
#define STATE_IS_VIEWPORT(a)
#define STATE_IS_RENDER(a)
#define STATE_IS_COMPUTE_SHADER_RESOURCE_BINDING(a)
#define STATE_SAMPLER(num)
@ WINED3D_SHADER_TYPE_COMPUTE
#define STATE_IS_COMPUTE_SHADER(a)
#define STATE_TEXTURESTAGE(stage, num)
#define STATE_IS_FRONTFACE(a)
#define STATE_IS_LIGHT_TYPE(a)
#define STATE_IS_COMPUTE_CONSTANT_BUFFER(a)
#define STATE_IS_SCISSORRECT(a)
#define STATE_IS_FRAMEBUFFER(a)
#define STATE_IS_GRAPHICS_SHADER_RESOURCE_BINDING(a)
#define STATE_IS_TRANSFORM(a)
#define STATE_IS_INDEXBUFFER(a)
#define STATE_RENDER(a)
#define STATE_IS_GRAPHICS_SHADER(a)
#define STATE_IS_BASEVERTEXINDEX(a)

Referenced by compile_state_table(), state_cb_warn(), state_nop(), state_undefined(), and validate_state_table().

◆ debug_d3dtexturefiltertype()

const char * debug_d3dtexturefiltertype ( enum wined3d_texture_filter_type  filter_type)

Definition at line 4539 of file utils.c.

4540{
4541 switch (filter_type)
4542 {
4543#define D3DTEXTUREFILTERTYPE_TO_STR(u) case u: return #u
4552#undef D3DTEXTUREFILTERTYPE_TO_STR
4553 default:
4554 FIXME("Unrecognized texture filter type 0x%08x.\n", filter_type);
4555 return "unrecognized";
4556 }
4557}
#define D3DTEXTUREFILTERTYPE_TO_STR(u)
@ WINED3D_TEXF_GAUSSIAN_CUBIC
Definition: wined3d.h:690
@ WINED3D_TEXF_NONE
Definition: wined3d.h:685
@ WINED3D_TEXF_PYRAMIDAL_QUAD
Definition: wined3d.h:691
@ WINED3D_TEXF_FLAT_CUBIC
Definition: wined3d.h:689
@ WINED3D_TEXF_GAUSSIAN_QUAD
Definition: wined3d.h:692
@ WINED3D_TEXF_POINT
Definition: wined3d.h:686
@ WINED3D_TEXF_ANISOTROPIC
Definition: wined3d.h:688
@ WINED3D_TEXF_LINEAR
Definition: wined3d.h:687

Referenced by surface_blt_fbo(), surface_blt_special(), surface_cpu_blt(), wined3d_surface_blt(), and wined3d_texture_blt().

◆ debug_d3dtexturestate()

const char * debug_d3dtexturestate ( enum wined3d_texture_stage_state  state)

Definition at line 4559 of file utils.c.

4560{
4561 switch (state)
4562 {
4563#define D3DSTATE_TO_STR(u) case u: return #u
4582#undef D3DSTATE_TO_STR
4583 default:
4584 FIXME("Unrecognized %u texture state!\n", state);
4585 return "unrecognized";
4586 }
4587}
@ WINED3D_TSS_COLOR_ARG2
Definition: wined3d.h:577
@ WINED3D_TSS_BUMPENV_LOFFSET
Definition: wined3d.h:587
@ WINED3D_TSS_ALPHA_OP
Definition: wined3d.h:578
@ WINED3D_TSS_BUMPENV_MAT11
Definition: wined3d.h:584
@ WINED3D_TSS_COLOR_OP
Definition: wined3d.h:575
@ WINED3D_TSS_BUMPENV_MAT10
Definition: wined3d.h:583
@ WINED3D_TSS_TEXCOORD_INDEX
Definition: wined3d.h:585
@ WINED3D_TSS_ALPHA_ARG2
Definition: wined3d.h:580
@ WINED3D_TSS_CONSTANT
Definition: wined3d.h:592
@ WINED3D_TSS_BUMPENV_MAT01
Definition: wined3d.h:582
@ WINED3D_TSS_ALPHA_ARG0
Definition: wined3d.h:590
@ WINED3D_TSS_BUMPENV_LSCALE
Definition: wined3d.h:586
@ WINED3D_TSS_COLOR_ARG0
Definition: wined3d.h:589
@ WINED3D_TSS_COLOR_ARG1
Definition: wined3d.h:576
@ WINED3D_TSS_ALPHA_ARG1
Definition: wined3d.h:579
@ WINED3D_TSS_RESULT_ARG
Definition: wined3d.h:591
@ WINED3D_TSS_BUMPENV_MAT00
Definition: wined3d.h:581
@ WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS
Definition: wined3d.h:588

Referenced by debug_d3dstate(), wined3d_device_get_texture_stage_state(), and wined3d_device_set_texture_stage_state().

◆ debug_d3dtop()

const char * debug_d3dtop ( enum wined3d_texture_op  d3dtop)

Definition at line 4589 of file utils.c.

4590{
4591 switch (d3dtop)
4592 {
4593#define D3DTOP_TO_STR(u) case u: return #u
4620#undef D3DTOP_TO_STR
4621 default:
4622 FIXME("Unrecognized texture op %#x.\n", d3dtop);
4623 return "unrecognized";
4624 }
4625}
#define D3DTOP_TO_STR(u)
@ WINED3D_TOP_SELECT_ARG1
Definition: wined3d.h:610
@ WINED3D_TOP_DISABLE
Definition: wined3d.h:609
@ WINED3D_TOP_BLEND_DIFFUSE_ALPHA
Definition: wined3d.h:620
@ WINED3D_TOP_ADD
Definition: wined3d.h:615
@ WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM
Definition: wined3d.h:623
@ WINED3D_TOP_BLEND_CURRENT_ALPHA
Definition: wined3d.h:624
@ WINED3D_TOP_ADD_SIGNED_2X
Definition: wined3d.h:617
@ WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA
Definition: wined3d.h:629
@ WINED3D_TOP_MULTIPLY_ADD
Definition: wined3d.h:633
@ WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR
Definition: wined3d.h:628
@ WINED3D_TOP_SUBTRACT
Definition: wined3d.h:618
@ WINED3D_TOP_BUMPENVMAP_LUMINANCE
Definition: wined3d.h:631
@ WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA
Definition: wined3d.h:627
@ WINED3D_TOP_MODULATE
Definition: wined3d.h:612
@ WINED3D_TOP_BUMPENVMAP
Definition: wined3d.h:630
@ WINED3D_TOP_MODULATE_4X
Definition: wined3d.h:614
@ WINED3D_TOP_SELECT_ARG2
Definition: wined3d.h:611
@ WINED3D_TOP_LERP
Definition: wined3d.h:634
@ WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR
Definition: wined3d.h:626
@ WINED3D_TOP_BLEND_TEXTURE_ALPHA
Definition: wined3d.h:621
@ WINED3D_TOP_ADD_SIGNED
Definition: wined3d.h:616
@ WINED3D_TOP_DOTPRODUCT3
Definition: wined3d.h:632
@ WINED3D_TOP_PREMODULATE
Definition: wined3d.h:625
@ WINED3D_TOP_ADD_SMOOTH
Definition: wined3d.h:619
@ WINED3D_TOP_MODULATE_2X
Definition: wined3d.h:613
@ WINED3D_TOP_BLEND_FACTOR_ALPHA
Definition: wined3d.h:622

Referenced by set_tex_op(), and set_tex_op_nvrc().

◆ debug_d3dtstype()

const char * debug_d3dtstype ( enum wined3d_transform_state  tstype)

Definition at line 4627 of file utils.c.

4628{
4629 switch (tstype)
4630 {
4631#define TSTYPE_TO_STR(tstype) case tstype: return #tstype
4646#undef TSTYPE_TO_STR
4647 default:
4648 if (tstype > 256 && tstype < 512)
4649 {
4650 FIXME("WINED3D_TS_WORLD_MATRIX(%u). 1..255 not currently supported.\n", tstype);
4651 return ("WINED3D_TS_WORLD_MATRIX > 0");
4652 }
4653 FIXME("Unrecognized transform state %#x.\n", tstype);
4654 return "unrecognized";
4655 }
4656}
#define TSTYPE_TO_STR(tstype)
#define WINED3D_TS_WORLD_MATRIX(index)
Definition: wined3d.h:664
@ WINED3D_TS_TEXTURE1
Definition: wined3d.h:651
@ WINED3D_TS_TEXTURE0
Definition: wined3d.h:650
@ WINED3D_TS_TEXTURE2
Definition: wined3d.h:652
@ WINED3D_TS_PROJECTION
Definition: wined3d.h:649
@ WINED3D_TS_VIEW
Definition: wined3d.h:648
@ WINED3D_TS_TEXTURE7
Definition: wined3d.h:657
@ WINED3D_TS_TEXTURE6
Definition: wined3d.h:656
@ WINED3D_TS_TEXTURE4
Definition: wined3d.h:654
@ WINED3D_TS_TEXTURE3
Definition: wined3d.h:653
@ WINED3D_TS_TEXTURE5
Definition: wined3d.h:655

Referenced by debug_d3dstate(), wined3d_device_get_transform(), wined3d_device_multiply_transform(), and wined3d_device_set_transform().

◆ debug_d3dusage()

const char * debug_d3dusage ( DWORD  usage)

Definition at line 4217 of file utils.c.

4218{
4219 struct debug_buffer buffer;
4220
4222#define WINED3DUSAGE_TO_STR(x) if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }
4242#undef WINED3DUSAGE_TO_STR
4243 if (usage)
4244 FIXME("Unrecognized usage flag(s) %#x.\n", usage);
4245
4246 return wine_dbg_sprintf("%s", buffer.str);
4247}
static void init_debug_buffer(struct debug_buffer *buffer, const char *default_string)
Definition: utils.c:4175
#define WINED3DUSAGE_TO_STR(x)
#define WINED3DUSAGE_WRITEONLY
Definition: wined3d.h:901
#define WINED3DUSAGE_POINTS
Definition: wined3d.h:904
#define WINED3DUSAGE_DONOTCLIP
Definition: wined3d.h:903
#define WINED3DUSAGE_DMAP
Definition: wined3d.h:911
#define WINED3DUSAGE_OWNDC
Definition: wined3d.h:919
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:917
#define WINED3DUSAGE_RESTRICTED_CONTENT
Definition: wined3d.h:908
#define WINED3DUSAGE_OVERLAY
Definition: wined3d.h:921
#define WINED3DUSAGE_NPATCHES
Definition: wined3d.h:906
#define WINED3DUSAGE_TEXTAPI
Definition: wined3d.h:912
#define WINED3DUSAGE_RENDERTARGET
Definition: wined3d.h:899
#define WINED3DUSAGE_RTPATCHES
Definition: wined3d.h:905
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:907
#define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER
Definition: wined3d.h:909
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:920
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:918
#define WINED3DUSAGE_SOFTWAREPROCESSING
Definition: wined3d.h:902
#define WINED3DUSAGE_DEPTHSTENCIL
Definition: wined3d.h:900
#define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE
Definition: wined3d.h:910

Referenced by buffer_create_buffer_object(), wined3d_check_device_format(), wined3d_surface_blt(), and wined3d_texture_init().

◆ debug_d3dusagequery()

const char * debug_d3dusagequery ( DWORD  usage)

Definition at line 4249 of file utils.c.

4250{
4251 struct debug_buffer buffer;
4252
4254#define WINED3DUSAGEQUERY_TO_STR(x) if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }
4263#undef WINED3DUSAGEQUERY_TO_STR
4264 if (usage)
4265 FIXME("Unrecognized usage query flag(s) %#x.\n", usage);
4266
4267 return wine_dbg_sprintf("%s", buffer.str);
4268}
#define WINED3DUSAGEQUERY_TO_STR(x)
#define WINED3DUSAGE_QUERY_LEGACYBUMPMAP
Definition: wined3d.h:924
#define WINED3DUSAGE_QUERY_SRGBREAD
Definition: wined3d.h:927
#define WINED3DUSAGE_QUERY_FILTER
Definition: wined3d.h:925
#define WINED3DUSAGE_QUERY_WRAPANDMIP
Definition: wined3d.h:930
#define WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
Definition: wined3d.h:926
#define WINED3DUSAGE_QUERY_VERTEXTEXTURE
Definition: wined3d.h:929
#define WINED3DUSAGE_QUERY_GENMIPMAP
Definition: wined3d.h:923
#define WINED3DUSAGE_QUERY_SRGBWRITE
Definition: wined3d.h:928

Referenced by wined3d_check_device_format().

◆ debug_fboattachment()

const char * debug_fboattachment ( GLenum  attachment)

Definition at line 4745 of file utils.c.

4746{
4747 switch(attachment)
4748 {
4749#define WINED3D_TO_STR(x) case x: return #x
4768#undef WINED3D_TO_STR
4769 default:
4770 return wine_dbg_sprintf("Unknown FBO attachment %#x", attachment);
4771 }
4772}
#define GL_COLOR_ATTACHMENT5
Definition: glext.h:1719
#define GL_COLOR_ATTACHMENT13
Definition: glext.h:1727
#define GL_COLOR_ATTACHMENT7
Definition: glext.h:1721
#define GL_COLOR_ATTACHMENT9
Definition: glext.h:1723
#define GL_COLOR_ATTACHMENT11
Definition: glext.h:1725
#define GL_COLOR_ATTACHMENT2
Definition: glext.h:1716
#define GL_COLOR_ATTACHMENT1
Definition: glext.h:1715
#define GL_COLOR_ATTACHMENT3
Definition: glext.h:1717
#define GL_COLOR_ATTACHMENT8
Definition: glext.h:1722
#define GL_COLOR_ATTACHMENT10
Definition: glext.h:1724
#define GL_COLOR_ATTACHMENT15
Definition: glext.h:1729
#define GL_COLOR_ATTACHMENT4
Definition: glext.h:1718
#define GL_COLOR_ATTACHMENT12
Definition: glext.h:1726
#define GL_COLOR_ATTACHMENT6
Definition: glext.h:1720
#define GL_COLOR_ATTACHMENT14
Definition: glext.h:1728
GLenum attachment
Definition: glext.h:6295

Referenced by context_dump_fbo_attachment().

◆ debug_fbostatus()

const char * debug_fbostatus ( GLenum  status)

Definition at line 4774 of file utils.c.

4774 {
4775 switch(status) {
4776#define FBOSTATUS_TO_STR(u) case u: return #u
4789#undef FBOSTATUS_TO_STR
4790 default:
4791 FIXME("Unrecognized FBO status 0x%08x.\n", status);
4792 return "unrecognized";
4793 }
4794}
#define FBOSTATUS_TO_STR(u)
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
Definition: glext.h:1747
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB
Definition: glext.h:1770
#define GL_FRAMEBUFFER_UNDEFINED
Definition: glext.h:1682
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
Definition: glext.h:4442
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
Definition: glext.h:1708
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
Definition: glext.h:1709
#define GL_FRAMEBUFFER_UNSUPPORTED
Definition: glext.h:1712
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER
Definition: glext.h:1711
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
Definition: glext.h:1710
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
Definition: glext.h:819
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
Definition: glext.h:4443

Referenced by context_check_fbo_status().

◆ debug_fixup_channel_source()

static const char * debug_fixup_channel_source ( enum fixup_channel_source  source)
static

Definition at line 4814 of file utils.c.

4815{
4816 switch(source)
4817 {
4818#define WINED3D_TO_STR(x) case x: return #x
4827#undef WINED3D_TO_STR
4828 default:
4829 FIXME("Unrecognized fixup_channel_source %#x\n", source);
4830 return "unrecognized";
4831 }
4832}
@ CHANNEL_SOURCE_COMPLEX1
@ CHANNEL_SOURCE_COMPLEX0

Referenced by dump_color_fixup_desc().

◆ debug_glerror()

const char * debug_glerror ( GLenum  error)

Definition at line 4796 of file utils.c.

4796 {
4797 switch(error) {
4798#define GLERROR_TO_STR(u) case u: return #u
4807#undef GLERROR_TO_STR
4808 default:
4809 FIXME("Unrecognized GL error 0x%08x.\n", error);
4810 return "unrecognized";
4811 }
4812}
#define GLERROR_TO_STR(u)
#define GL_INVALID_VALUE
Definition: gl.h:695
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_STACK_OVERFLOW
Definition: gl.h:697
#define GL_NO_ERROR
Definition: gl.h:693
#define GL_OUT_OF_MEMORY
Definition: gl.h:699
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_STACK_UNDERFLOW
Definition: gl.h:698
#define error(str)
Definition: mkdosfs.c:1605

Referenced by buffer_create_buffer_object(), match_allows_spec_alpha(), and wined3d_check_gl_call().

◆ debug_ivec4()

const char * debug_ivec4 ( const struct wined3d_ivec4 v)

Definition at line 3956 of file utils.c.

3957{
3958 if (!v)
3959 return "(null)";
3960 return wine_dbg_sprintf("{%d, %d, %d, %d}",
3961 v->x, v->y, v->z, v->w);
3962}
const GLdouble * v
Definition: gl.h:2040

Referenced by wined3d_device_set_ps_consts_i(), wined3d_device_set_vs_consts_i(), and wined3d_stateblock_capture().

◆ debug_shader_type()

const char * debug_shader_type ( enum wined3d_shader_type  type)

Definition at line 4658 of file utils.c.

4659{
4660 switch(type)
4661 {
4662#define WINED3D_TO_STR(type) case type: return #type
4669#undef WINED3D_TO_STR
4670 default:
4671 FIXME("Unrecognized shader type %#x.\n", type);
4672 return "unrecognized";
4673 }
4674}
@ WINED3D_SHADER_TYPE_HULL
@ WINED3D_SHADER_TYPE_PIXEL
@ WINED3D_SHADER_TYPE_GEOMETRY
@ WINED3D_SHADER_TYPE_DOMAIN
@ WINED3D_SHADER_TYPE_VERTEX

Referenced by arb_get_helper_value(), and debug_d3dstate().

◆ debug_uvec4()

const char * debug_uvec4 ( const struct wined3d_uvec4 v)

Definition at line 3964 of file utils.c.

3965{
3966 if (!v)
3967 return "(null)";
3968 return wine_dbg_sprintf("{%u, %u, %u, %u}",
3969 v->x, v->y, v->z, v->w);
3970}

Referenced by wined3d_device_clear_unordered_access_view_uint().

◆ debug_vec4()

const char * debug_vec4 ( const struct wined3d_vec4 v)

Definition at line 3972 of file utils.c.

3973{
3974 if (!v)
3975 return "(null)";
3976 return wine_dbg_sprintf("{%.8e, %.8e, %.8e, %.8e}",
3977 v->x, v->y, v->z, v->w);
3978}

Referenced by shader_arb_load_constants_f(), wined3d_device_set_ps_consts_f(), wined3d_device_set_vs_consts_f(), and wined3d_stateblock_capture().

◆ delete_fbo_attachment()

static void delete_fbo_attachment ( const struct wined3d_gl_info gl_info,
enum wined3d_gl_resource_type  d3d_type,
GLuint  object 
)
static

Definition at line 1979 of file utils.c.

1981{
1982 switch (d3d_type)
1983 {
1989 gl_info->gl_ops.gl.p_glDeleteTextures(1, &object);
1990 break;
1991
1993 gl_info->fbo_ops.glDeleteRenderbuffers(1, &object);
1994 break;
1995
1998 break;
1999 }
2000}

Referenced by check_fbo_compat().

◆ draw_test_quad()

static void draw_test_quad ( struct wined3d_caps_gl_ctx ctx,
const struct wined3d_vec3 geometry,
const struct wined3d_color color 
)
static

Definition at line 2104 of file utils.c.

2106{
2107 const struct wined3d_gl_info *gl_info = ctx->gl_info;
2108 static const struct wined3d_vec3 default_geometry[] =
2109 {
2110 {-1.0f, -1.0f, 0.0f},
2111 { 1.0f, -1.0f, 0.0f},
2112 {-1.0f, 1.0f, 0.0f},
2113 { 1.0f, 1.0f, 0.0f},
2114 };
2115 static const char vs_core_header[] =
2116 "#version 150\n"
2117 "in vec4 pos;\n"
2118 "in vec4 color;\n"
2119 "out vec4 out_color;\n"
2120 "\n";
2121 static const char vs_legacy_header[] =
2122 "#version 120\n"
2123 "attribute vec4 pos;\n"
2124 "attribute vec4 color;\n"
2125 "varying vec4 out_color;\n"
2126 "\n";
2127 static const char vs_body[] =
2128 "void main()\n"
2129 "{\n"
2130 " gl_Position = pos;\n"
2131 " out_color = color;\n"
2132 "}\n";
2133 static const char fs_core[] =
2134 "#version 150\n"
2135 "in vec4 out_color;\n"
2136 "out vec4 fragment_color;\n"
2137 "\n"
2138 "void main()\n"
2139 "{\n"
2140 " fragment_color = out_color;\n"
2141 "}\n";
2142 static const char fs_legacy[] =
2143 "#version 120\n"
2144 "varying vec4 out_color;\n"
2145 "\n"
2146 "void main()\n"
2147 "{\n"
2148 " gl_FragData[0] = out_color;\n"
2149 "}\n";
2150 const char *source[2];
2151 GLuint vs_id, fs_id;
2152 unsigned int i;
2153
2154 if (!geometry)
2155 geometry = default_geometry;
2156
2158 || !gl_info->supported[ARB_FRAGMENT_SHADER])
2159 {
2160 gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
2161 gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
2162 gl_info->gl_ops.gl.p_glLoadIdentity();
2163 gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
2164 gl_info->gl_ops.gl.p_glLoadIdentity();
2165
2166 gl_info->gl_ops.gl.p_glBegin(GL_TRIANGLE_STRIP);
2167 gl_info->gl_ops.gl.p_glColor4f(color->r, color->g, color->b, color->a);
2168 for (i = 0; i < 4; ++i)
2169 gl_info->gl_ops.gl.p_glVertex3fv(&geometry[i].x);
2170 gl_info->gl_ops.gl.p_glEnd();
2171 checkGLcall("draw quad");
2172 return;
2173 }
2174
2175 if (!ctx->test_vbo)
2176 GL_EXTCALL(glGenBuffers(1, &ctx->test_vbo));
2177 GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, ctx->test_vbo));
2178 GL_EXTCALL(glBufferData(GL_ARRAY_BUFFER, sizeof(struct wined3d_vec3) * 4, geometry, GL_STREAM_DRAW));
2179 GL_EXTCALL(glVertexAttribPointer(0, 3, GL_FLOAT, FALSE, 0, NULL));
2180 GL_EXTCALL(glVertexAttrib4f(1, color->r, color->g, color->b, color->a));
2181 GL_EXTCALL(glEnableVertexAttribArray(0));
2182 GL_EXTCALL(glDisableVertexAttribArray(1));
2183
2184 if (!ctx->test_program_id)
2185 {
2186#ifdef __REACTOS__
2187 /* workaround CORE-15408 crash for many 3D applications.
2188 VBoxDisp with enabled 3D acceleration only supports OpenGL 2.1 (GLSL 120).
2189 Wine must not use shaders for OpenGL 3.2 (GLSL 150). */
2190 BOOL use_glsl_150 = FALSE;
2191#else
2192 BOOL use_glsl_150 = gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50);
2193#endif
2194
2195 ctx->test_program_id = GL_EXTCALL(glCreateProgram());
2196
2197 vs_id = GL_EXTCALL(glCreateShader(GL_VERTEX_SHADER));
2198 source[0] = use_glsl_150 ? vs_core_header : vs_legacy_header;
2199 source[1] = vs_body;
2200 GL_EXTCALL(glShaderSource(vs_id, 2, source, NULL));
2201 GL_EXTCALL(glAttachShader(ctx->test_program_id, vs_id));
2202 GL_EXTCALL(glDeleteShader(vs_id));
2203
2204 fs_id = GL_EXTCALL(glCreateShader(GL_FRAGMENT_SHADER));
2205 source[0] = use_glsl_150 ? fs_core : fs_legacy;
2206 GL_EXTCALL(glShaderSource(fs_id, 1, source, NULL));
2207 GL_EXTCALL(glAttachShader(ctx->test_program_id, fs_id));
2208 GL_EXTCALL(glDeleteShader(fs_id));
2209
2210 GL_EXTCALL(glBindAttribLocation(ctx->test_program_id, 0, "pos"));
2211 GL_EXTCALL(glBindAttribLocation(ctx->test_program_id, 1, "color"));
2212
2213 if (use_glsl_150)
2214 GL_EXTCALL(glBindFragDataLocation(ctx->test_program_id, 0, "fragment_color"));
2215
2216 GL_EXTCALL(glCompileShader(vs_id));
2217 print_glsl_info_log(gl_info, vs_id, FALSE);
2218 GL_EXTCALL(glCompileShader(fs_id));
2219 print_glsl_info_log(gl_info, fs_id, FALSE);
2220 GL_EXTCALL(glLinkProgram(ctx->test_program_id));
2221 shader_glsl_validate_link(gl_info, ctx->test_program_id);
2222 }
2223 GL_EXTCALL(glUseProgram(ctx->test_program_id));
2224
2225 gl_info->gl_ops.gl.p_glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
2226
2227 GL_EXTCALL(glUseProgram(0));
2228 GL_EXTCALL(glDisableVertexAttribArray(0));
2229 GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, 0));
2230 checkGLcall("draw quad");
2231}
#define GL_FRAGMENT_SHADER
Definition: glext.h:419
#define GL_ARRAY_BUFFER
Definition: glext.h:336
#define GL_STREAM_DRAW
Definition: glext.h:347
#define GL_VERTEX_SHADER
Definition: glext.h:420
void shader_glsl_validate_link(const struct wined3d_gl_info *gl_info, GLuint program)
Definition: glsl_shader.c:577
void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLuint id, BOOL program)
Definition: glsl_shader.c:459
@ ARB_VERTEX_BUFFER_OBJECT
Definition: wined3d_gl.h:138
@ ARB_FRAGMENT_SHADER
Definition: wined3d_gl.h:71
#define MAKEDWORD_VERSION(maj, min)

Referenced by check_fbo_compat(), wined3d_adapter_find_polyoffset_scale(), and wined3d_caps_gl_ctx_test_viewport_subpixel_bits().

◆ dump_color_fixup_desc()

void dump_color_fixup_desc ( struct color_fixup_desc  fixup)

Definition at line 4851 of file utils.c.

4852{
4853 if (is_complex_fixup(fixup))
4854 {
4855 TRACE("\tComplex: %s\n", debug_complex_fixup(get_complex_fixup(fixup)));
4856 return;
4857 }
4858
4859 TRACE("\tX: %s%s\n", debug_fixup_channel_source(fixup.x_source), fixup.x_sign_fixup ? ", SIGN_FIXUP" : "");
4860 TRACE("\tY: %s%s\n", debug_fixup_channel_source(fixup.y_source), fixup.y_sign_fixup ? ", SIGN_FIXUP" : "");
4861 TRACE("\tZ: %s%s\n", debug_fixup_channel_source(fixup.z_source), fixup.z_sign_fixup ? ", SIGN_FIXUP" : "");
4862 TRACE("\tW: %s%s\n", debug_fixup_channel_source(fixup.w_source), fixup.w_sign_fixup ? ", SIGN_FIXUP" : "");
4863}
static const char * debug_fixup_channel_source(enum fixup_channel_source source)
Definition: utils.c:4814
static const char * debug_complex_fixup(enum complex_fixup fixup)
Definition: utils.c:4834
unsigned short x_source
unsigned short y_sign_fixup
unsigned short w_source
unsigned short x_sign_fixup
unsigned short z_sign_fixup
unsigned short y_source
unsigned short w_sign_fixup
unsigned short z_source
static enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup)
static BOOL is_complex_fixup(struct color_fixup_desc fixup)

Referenced by apply_format_fixups(), arbfp_blit_supported(), and ffp_blit_supported().

◆ find_ffp_frag_shader()

const struct ffp_frag_desc * find_ffp_frag_shader ( const struct wine_rb_tree fragment_shaders,
const struct ffp_frag_settings settings 
)

Definition at line 6076 of file utils.c.

6078{
6079 struct wine_rb_entry *entry = wine_rb_get(fragment_shaders, settings);
6081}
struct mke2fs_defaults settings[]
uint32_t entry
Definition: isohybrid.c:63
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
static struct wine_rb_entry * wine_rb_get(const struct wine_rb_tree *tree, const void *key)
Definition: rbtree.h:203
Definition: rbtree.h:36

Referenced by fragment_prog_arbfp(), set_tex_op_atifs(), and shader_glsl_find_ffp_fragment_shader().

◆ format_clear_flag()

static void format_clear_flag ( struct wined3d_format format,
unsigned int  flag 
)
static

Definition at line 1795 of file utils.c.

1796{
1797 unsigned int i;
1798
1799 for (i = 0; i < ARRAY_SIZE(format->flags); ++i)
1800 format->flags[i] &= ~flag;
1801}
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 flag
Definition: glfuncs.h:52

Referenced by apply_format_fixups(), check_fbo_compat(), init_format_fbo_compat_info(), init_format_texture_info(), and query_internal_format().

◆ format_set_flag()

static void format_set_flag ( struct wined3d_format format,
unsigned int  flag 
)
static

Definition at line 1787 of file utils.c.

1788{
1789 unsigned int i;
1790
1791 for (i = 0; i < ARRAY_SIZE(format->flags); ++i)
1792 format->flags[i] |= flag;
1793}

Referenced by apply_format_fixups(), init_format_base_info(), init_format_block_info(), init_format_filter_info(), init_format_texture_info(), and query_internal_format().

◆ gen_ffp_frag_op()

void gen_ffp_frag_op ( const struct wined3d_context context,
const struct wined3d_state state,
struct ffp_frag_settings settings,
BOOL  ignore_textype 
)

Definition at line 5751 of file utils.c.

5753{
5754#define ARG1 0x01
5755#define ARG2 0x02
5756#define ARG0 0x04
5757 static const unsigned char args[WINED3D_TOP_LERP + 1] =
5758 {
5759 /* undefined */ 0,
5760 /* D3DTOP_DISABLE */ 0,
5761 /* D3DTOP_SELECTARG1 */ ARG1,
5762 /* D3DTOP_SELECTARG2 */ ARG2,
5763 /* D3DTOP_MODULATE */ ARG1 | ARG2,
5764 /* D3DTOP_MODULATE2X */ ARG1 | ARG2,
5765 /* D3DTOP_MODULATE4X */ ARG1 | ARG2,
5766 /* D3DTOP_ADD */ ARG1 | ARG2,
5767 /* D3DTOP_ADDSIGNED */ ARG1 | ARG2,
5768 /* D3DTOP_ADDSIGNED2X */ ARG1 | ARG2,
5769 /* D3DTOP_SUBTRACT */ ARG1 | ARG2,
5770 /* D3DTOP_ADDSMOOTH */ ARG1 | ARG2,
5771 /* D3DTOP_BLENDDIFFUSEALPHA */ ARG1 | ARG2,
5772 /* D3DTOP_BLENDTEXTUREALPHA */ ARG1 | ARG2,
5773 /* D3DTOP_BLENDFACTORALPHA */ ARG1 | ARG2,
5774 /* D3DTOP_BLENDTEXTUREALPHAPM */ ARG1 | ARG2,
5775 /* D3DTOP_BLENDCURRENTALPHA */ ARG1 | ARG2,
5776 /* D3DTOP_PREMODULATE */ ARG1 | ARG2,
5777 /* D3DTOP_MODULATEALPHA_ADDCOLOR */ ARG1 | ARG2,
5778 /* D3DTOP_MODULATECOLOR_ADDALPHA */ ARG1 | ARG2,
5779 /* D3DTOP_MODULATEINVALPHA_ADDCOLOR */ ARG1 | ARG2,
5780 /* D3DTOP_MODULATEINVCOLOR_ADDALPHA */ ARG1 | ARG2,
5781 /* D3DTOP_BUMPENVMAP */ ARG1 | ARG2,
5782 /* D3DTOP_BUMPENVMAPLUMINANCE */ ARG1 | ARG2,
5783 /* D3DTOP_DOTPRODUCT3 */ ARG1 | ARG2,
5784 /* D3DTOP_MULTIPLYADD */ ARG1 | ARG2 | ARG0,
5785 /* D3DTOP_LERP */ ARG1 | ARG2 | ARG0
5786 };
5787 unsigned int i;
5788 DWORD ttff;
5789 DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2;
5790 const struct wined3d_gl_info *gl_info = context->gl_info;
5791 const struct wined3d_d3d_info *d3d_info = context->d3d_info;
5792
5793 settings->padding = 0;
5794
5795 for (i = 0; i < d3d_info->limits.ffp_blend_stages; ++i)
5796 {
5797 const struct wined3d_texture *texture;
5798
5799 settings->op[i].padding = 0;
5800 if (state->texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_DISABLE)
5801 {
5802 settings->op[i].cop = WINED3D_TOP_DISABLE;
5803 settings->op[i].aop = WINED3D_TOP_DISABLE;
5804 settings->op[i].carg0 = settings->op[i].carg1 = settings->op[i].carg2 = ARG_UNUSED;
5805 settings->op[i].aarg0 = settings->op[i].aarg1 = settings->op[i].aarg2 = ARG_UNUSED;
5806 settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
5807 settings->op[i].dst = resultreg;
5808 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
5809 settings->op[i].projected = proj_none;
5810 i++;
5811 break;
5812 }
5813
5814 if ((texture = state->textures[i]))
5815 {
5816 if (can_use_texture_swizzle(gl_info, texture->resource.format))
5817 settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
5818 else
5819 settings->op[i].color_fixup = texture->resource.format->color_fixup;
5820 if (ignore_textype)
5821 {
5822 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
5823 }
5824 else
5825 {
5826 switch (texture->target)
5827 {
5828 case GL_TEXTURE_1D:
5829 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
5830 break;
5831 case GL_TEXTURE_2D:
5832 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_2D;
5833 break;
5834 case GL_TEXTURE_3D:
5835 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_3D;
5836 break;
5838 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_CUBE;
5839 break;
5841 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_RECT;
5842 break;
5843 }
5844 }
5845 } else {
5846 settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
5847 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
5848 }
5849
5850 cop = state->texture_states[i][WINED3D_TSS_COLOR_OP];
5851 aop = state->texture_states[i][WINED3D_TSS_ALPHA_OP];
5852
5853 carg1 = (args[cop] & ARG1) ? state->texture_states[i][WINED3D_TSS_COLOR_ARG1] : ARG_UNUSED;
5854 carg2 = (args[cop] & ARG2) ? state->texture_states[i][WINED3D_TSS_COLOR_ARG2] : ARG_UNUSED;
5855 carg0 = (args[cop] & ARG0) ? state->texture_states[i][WINED3D_TSS_COLOR_ARG0] : ARG_UNUSED;
5856
5857 if (is_invalid_op(state, i, cop, carg1, carg2, carg0))
5858 {
5859 carg0 = ARG_UNUSED;
5860 carg2 = ARG_UNUSED;
5861 carg1 = WINED3DTA_CURRENT;
5863 }
5864
5865 if (cop == WINED3D_TOP_DOTPRODUCT3)
5866 {
5867 /* A dotproduct3 on the colorop overwrites the alphaop operation and replicates
5868 * the color result to the alpha component of the destination
5869 */
5870 aop = cop;
5871 aarg1 = carg1;
5872 aarg2 = carg2;
5873 aarg0 = carg0;
5874 }
5875 else
5876 {
5877 aarg1 = (args[aop] & ARG1) ? state->texture_states[i][WINED3D_TSS_ALPHA_ARG1] : ARG_UNUSED;
5878 aarg2 = (args[aop] & ARG2) ? state->texture_states[i][WINED3D_TSS_ALPHA_ARG2] : ARG_UNUSED;
5879 aarg0 = (args[aop] & ARG0) ? state->texture_states[i][WINED3D_TSS_ALPHA_ARG0] : ARG_UNUSED;
5880 }
5881
5882 if (!i && state->textures[0] && state->render_states[WINED3D_RS_COLORKEYENABLE])
5883 {
5884 GLenum texture_dimensions;
5885
5886 texture = state->textures[0];
5887 texture_dimensions = texture->target;
5888
5889 if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
5890 {
5891 if (texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT && !texture->resource.format->alpha_size)
5892 {
5893 if (aop == WINED3D_TOP_DISABLE)
5894 {
5895 aarg1 = WINED3DTA_TEXTURE;
5897 }
5898 else if (aop == WINED3D_TOP_SELECT_ARG1 && aarg1 != WINED3DTA_TEXTURE)
5899 {
5900 if (state->render_states[WINED3D_RS_ALPHABLENDENABLE])
5901 {
5902 aarg2 = WINED3DTA_TEXTURE;
5904 }
5905 else aarg1 = WINED3DTA_TEXTURE;
5906 }
5907 else if (aop == WINED3D_TOP_SELECT_ARG2 && aarg2 != WINED3DTA_TEXTURE)
5908 {
5909 if (state->render_states[WINED3D_RS_ALPHABLENDENABLE])
5910 {
5911 aarg1 = WINED3DTA_TEXTURE;
5913 }
5914 else aarg2 = WINED3DTA_TEXTURE;
5915 }
5916 }
5917 }
5918 }
5919
5920 if (is_invalid_op(state, i, aop, aarg1, aarg2, aarg0))
5921 {
5922 aarg0 = ARG_UNUSED;
5923 aarg2 = ARG_UNUSED;
5924 aarg1 = WINED3DTA_CURRENT;
5926 }
5927
5928 if (carg1 == WINED3DTA_TEXTURE || carg2 == WINED3DTA_TEXTURE || carg0 == WINED3DTA_TEXTURE
5929 || aarg1 == WINED3DTA_TEXTURE || aarg2 == WINED3DTA_TEXTURE || aarg0 == WINED3DTA_TEXTURE)
5930 {
5931 ttff = state->texture_states[i][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS];
5933 settings->op[i].projected = proj_count3;
5934 else if (ttff & WINED3D_TTFF_PROJECTED)
5935 settings->op[i].projected = proj_count4;
5936 else
5937 settings->op[i].projected = proj_none;
5938 }
5939 else
5940 {
5941 settings->op[i].projected = proj_none;
5942 }
5943
5944 settings->op[i].cop = cop;
5945 settings->op[i].aop = aop;
5946 settings->op[i].carg0 = carg0;
5947 settings->op[i].carg1 = carg1;
5948 settings->op[i].carg2 = carg2;
5949 settings->op[i].aarg0 = aarg0;
5950 settings->op[i].aarg1 = aarg1;
5951 settings->op[i].aarg2 = aarg2;
5952
5953 if (state->texture_states[i][WINED3D_TSS_RESULT_ARG] == WINED3DTA_TEMP)
5954 settings->op[i].dst = tempreg;
5955 else
5956 settings->op[i].dst = resultreg;
5957 }
5958
5959 /* Clear unsupported stages */
5960 for(; i < MAX_TEXTURES; i++) {
5961 memset(&settings->op[i], 0xff, sizeof(settings->op[i]));
5962 }
5963
5964 if (!state->render_states[WINED3D_RS_FOGENABLE])
5965 {
5967 }
5968 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE)
5969 {
5970 if (use_vs(state) || state->vertex_declaration->position_transformed)
5971 {
5973 }
5974 else
5975 {
5976 switch (state->render_states[WINED3D_RS_FOGVERTEXMODE])
5977 {
5978 case WINED3D_FOG_NONE:
5979 case WINED3D_FOG_LINEAR:
5981 break;
5982 case WINED3D_FOG_EXP:
5984 break;
5985 case WINED3D_FOG_EXP2:
5987 break;
5988 }
5989 }
5990 }
5991 else
5992 {
5993 switch (state->render_states[WINED3D_RS_FOGTABLEMODE])
5994 {
5995 case WINED3D_FOG_LINEAR:
5997 break;
5998 case WINED3D_FOG_EXP:
6000 break;
6001 case WINED3D_FOG_EXP2:
6003 break;
6004 }
6005 }
6006 settings->sRGB_write = !gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context, state, state->fb);
6007 if (d3d_info->vs_clipping || !use_vs(state) || !state->render_states[WINED3D_RS_CLIPPING]
6008 || !state->render_states[WINED3D_RS_CLIPPLANEENABLE])
6009 {
6010 /* No need to emulate clipplanes if GL supports native vertex shader clipping or if
6011 * the fixed function vertex pipeline is used(which always supports clipplanes), or
6012 * if no clipplane is enabled
6013 */
6014 settings->emul_clipplanes = 0;
6015 } else {
6016 settings->emul_clipplanes = 1;
6017 }
6018
6019 if (state->render_states[WINED3D_RS_COLORKEYENABLE] && state->textures[0]
6020 && state->textures[0]->async.color_key_flags & WINED3D_CKEY_SRC_BLT
6021 && settings->op[0].cop != WINED3D_TOP_DISABLE)
6022 settings->color_key_enabled = 1;
6023 else
6024 settings->color_key_enabled = 0;
6025
6026 /* texcoords_initialized is set to meaningful values only when GL doesn't
6027 * support enough varyings to always pass around all the possible texture
6028 * coordinates.
6029 * This is used to avoid reading a varying not written by the vertex shader.
6030 * Reading uninitialized varyings on core profile contexts results in an
6031 * error while with builtin varyings on legacy contexts you get undefined
6032 * behavior. */
6033 if (d3d_info->limits.varying_count
6034 && d3d_info->limits.varying_count < wined3d_max_compat_varyings(gl_info))
6035 {
6036 settings->texcoords_initialized = 0;
6037 for (i = 0; i < MAX_TEXTURES; ++i)
6038 {
6039 if (use_vs(state))
6040 {
6041 if (state->shader[WINED3D_SHADER_TYPE_VERTEX]->reg_maps.output_registers & (1u << i))
6042 settings->texcoords_initialized |= 1u << i;
6043 }
6044 else
6045 {
6046 const struct wined3d_stream_info *si = &context->stream_info;
6047 unsigned int coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6048 if ((state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX] >> WINED3D_FFP_TCI_SHIFT)
6050 || (coord_idx < MAX_TEXTURES && (si->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx)))))
6051 settings->texcoords_initialized |= 1u << i;
6052 }
6053 }
6054 }
6055 else
6056 {
6057 settings->texcoords_initialized = (1u << MAX_TEXTURES) - 1;
6058 }
6059
6060 settings->pointsprite = state->render_states[WINED3D_RS_POINTSPRITEENABLE]
6061 && state->gl_primitive_type == GL_POINTS;
6062
6064 settings->alpha_test_func = WINED3D_CMP_ALWAYS - 1;
6065 else
6066 settings->alpha_test_func = (state->render_states[WINED3D_RS_ALPHATESTENABLE]
6068 : WINED3D_CMP_ALWAYS) - 1;
6069
6070 if (d3d_info->emulated_flatshading)
6071 settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
6072 else
6073 settings->flatshading = FALSE;
6074}
#define ARG2
BOOL is_invalid_op(const struct wined3d_state *state, int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3)
Definition: utils.c:4865
#define ARG1
unsigned int wined3d_max_compat_varyings(const struct wined3d_gl_info *gl_info)
Definition: utils.c:5744
#define ARG0
#define GL_POINTS
Definition: gl.h:190
GLenum GLuint texture
Definition: glext.h:6295
#define GL_TEXTURE_RECTANGLE_ARB
Definition: glext.h:1614
if(dx< 0)
Definition: linetemp.h:194
Definition: match.c:390
Definition: http.c:7252
struct wined3d_d3d_limits limits
@ WINED3D_SHADE_FLAT
Definition: wined3d.h:479
#define WINED3DTA_TEMP
Definition: wined3d.h:872
@ WINED3D_FOG_LINEAR
Definition: wined3d.h:474
@ WINED3D_FOG_EXP
Definition: wined3d.h:472
@ WINED3D_FOG_NONE
Definition: wined3d.h:471
@ WINED3D_FOG_EXP2
Definition: wined3d.h:473
#define WINED3D_CKEY_SRC_BLT
Definition: wined3d.h:1336
#define WINED3DTA_CURRENT
Definition: wined3d.h:868
@ WINED3D_CMP_ALWAYS
Definition: wined3d.h:459
#define WINED3DTA_TEXTURE
Definition: wined3d.h:869
@ ARB_FRAMEBUFFER_SRGB
Definition: wined3d_gl.h:74
@ proj_none
@ proj_count3
@ proj_count4
@ WINED3D_FFP_TEXCOORD0
#define WINED3D_FFP_TCI_SHIFT
#define ARG_UNUSED
static BOOL use_vs(const struct wined3d_state *state)
#define WINED3D_FFP_TCI_MASK
@ tempreg
@ resultreg
static enum wined3d_cmp_func wined3d_sanitize_cmp_func(enum wined3d_cmp_func func)
#define MAX_TEXTURES
static const struct color_fixup_desc COLOR_FIXUP_IDENTITY
static BOOL needs_srgb_write(const struct wined3d_context *context, const struct wined3d_state *state, const struct wined3d_fb_state *fb)
@ WINED3D_FFP_PS_FOG_EXP
@ WINED3D_FFP_PS_FOG_OFF
@ WINED3D_FFP_PS_FOG_EXP2
@ WINED3D_FFP_PS_FOG_LINEAR
static BOOL can_use_texture_swizzle(const struct wined3d_gl_info *gl_info, const struct wined3d_format *format)

Referenced by fragment_prog_arbfp(), set_glsl_shader_program(), and set_tex_op_atifs().

◆ get_flexible_vertex_size()

DWORD get_flexible_vertex_size ( DWORD  d3dvtVertexType)

Definition at line 5717 of file utils.c.

5717 {
5718 DWORD size = 0;
5719 int i;
5720 int numTextures = (d3dvtVertexType & WINED3DFVF_TEXCOUNT_MASK) >> WINED3DFVF_TEXCOUNT_SHIFT;
5721
5722 if (d3dvtVertexType & WINED3DFVF_NORMAL) size += 3 * sizeof(float);
5723 if (d3dvtVertexType & WINED3DFVF_DIFFUSE) size += sizeof(DWORD);
5724 if (d3dvtVertexType & WINED3DFVF_SPECULAR) size += sizeof(DWORD);
5725 if (d3dvtVertexType & WINED3DFVF_PSIZE) size += sizeof(DWORD);
5726 switch (d3dvtVertexType & WINED3DFVF_POSITION_MASK) {
5727 case WINED3DFVF_XYZ: size += 3 * sizeof(float); break;
5728 case WINED3DFVF_XYZRHW: size += 4 * sizeof(float); break;
5729 case WINED3DFVF_XYZB1: size += 4 * sizeof(float); break;
5730 case WINED3DFVF_XYZB2: size += 5 * sizeof(float); break;
5731 case WINED3DFVF_XYZB3: size += 6 * sizeof(float); break;
5732 case WINED3DFVF_XYZB4: size += 7 * sizeof(float); break;
5733 case WINED3DFVF_XYZB5: size += 8 * sizeof(float); break;
5734 case WINED3DFVF_XYZW: size += 4 * sizeof(float); break;
5735 default: ERR("Unexpected position mask\n");
5736 }
5737 for (i = 0; i < numTextures; i++) {
5738 size += GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, i) * sizeof(float);
5739 }
5740
5741 return size;
5742}
#define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num)
#define DWORD
Definition: nt_native.h:44
#define WINED3DFVF_XYZB4
Definition: wined3d.h:965
#define WINED3DFVF_PSIZE
Definition: wined3d.h:969
#define WINED3DFVF_XYZB5
Definition: wined3d.h:966
#define WINED3DFVF_SPECULAR
Definition: wined3d.h:971
#define WINED3DFVF_TEXCOUNT_SHIFT
Definition: wined3d.h:973
#define WINED3DFVF_DIFFUSE
Definition: wined3d.h:970
#define WINED3DFVF_XYZW
Definition: wined3d.h:967
#define WINED3DFVF_POSITION_MASK
Definition: wined3d.h:959
#define WINED3DFVF_XYZ
Definition: wined3d.h:960
#define WINED3DFVF_XYZB1
Definition: wined3d.h:962
#define WINED3DFVF_TEXCOUNT_MASK
Definition: wined3d.h:972
#define WINED3DFVF_XYZRHW
Definition: wined3d.h:961
#define WINED3DFVF_NORMAL
Definition: wined3d.h:968
#define WINED3DFVF_XYZB3
Definition: wined3d.h:964
#define WINED3DFVF_XYZB2
Definition: wined3d.h:963

Referenced by d3d_device3_Begin(), d3d_device7_DrawIndexedPrimitive(), d3d_device7_DrawIndexedPrimitiveStrided(), d3d_device7_DrawIndexedPrimitiveVB(), d3d_device7_DrawPrimitive(), d3d_device7_DrawPrimitiveStrided(), d3d_device7_DrawPrimitiveVB(), d3d_vertex_buffer7_GetVertexBufferDesc(), d3d_vertex_buffer7_ProcessVertices(), d3d_vertex_buffer_create(), and process_vertices_strided().

◆ get_fog_start_end()

void get_fog_start_end ( const struct wined3d_context context,
const struct wined3d_state state,
float start,
float end 
)

Definition at line 5179 of file utils.c.

5181{
5182 union
5183 {
5184 DWORD d;
5185 float f;
5186 } tmpvalue;
5187
5188 switch (context->fog_source)
5189 {
5190 case FOGSOURCE_VS:
5191 *start = 1.0f;
5192 *end = 0.0f;
5193 break;
5194
5195 case FOGSOURCE_COORD:
5196 *start = 255.0f;
5197 *end = 0.0f;
5198 break;
5199
5200 case FOGSOURCE_FFP:
5201 tmpvalue.d = state->render_states[WINED3D_RS_FOGSTART];
5202 *start = tmpvalue.f;
5203 tmpvalue.d = state->render_states[WINED3D_RS_FOGEND];
5204 *end = tmpvalue.f;
5205 /* Special handling for fog_start == fog_end. In d3d with vertex
5206 * fog, everything is fogged. With table fog, everything with
5207 * fog_coord < fog_start is unfogged, and fog_coord > fog_start
5208 * is fogged. Windows drivers disagree when fog_coord == fog_start. */
5209 if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE && *start == *end)
5210 {
5211 *start = -INFINITY;
5212 *end = 0.0f;
5213 }
5214 break;
5215
5216 default:
5217 /* This should not happen, context->fog_source is set in wined3d, not the app. */
5218 ERR("Unexpected fog coordinate source.\n");
5219 *start = 0.0f;
5220 *end = 0.0f;
5221 }
5222}
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
#define d
Definition: ke_i.h:81
#define f
Definition: ke_i.h:83
#define INFINITY
Definition: misc.c:36
@ FOGSOURCE_VS
@ FOGSOURCE_COORD
@ FOGSOURCE_FFP

Referenced by shader_glsl_load_fog_uniform(), and state_fogstartend().

◆ get_format_idx()

static int get_format_idx ( enum wined3d_format_id  format_id)
inlinestatic

Definition at line 1750 of file utils.c.

1751{
1752 unsigned int i;
1753
1755 return format_id;
1756
1757 for (i = 0; i < ARRAY_SIZE(format_index_remap); ++i)
1758 {
1759 if (format_index_remap[i].id == format_id)
1760 return format_index_remap[i].idx;
1761 }
1762
1763 return -1;
1764}
#define WINED3D_FORMAT_FOURCC_BASE
Definition: utils.c:36
static const struct @272 format_index_remap[]

Referenced by apply_format_fixups(), get_format_internal(), init_format_filter_info(), and wined3d_get_format().

◆ get_format_internal()

static struct wined3d_format * get_format_internal ( struct wined3d_gl_info gl_info,
enum wined3d_format_id  format_id 
)
static

Definition at line 1766 of file utils.c.

1768{
1769 int fmt_idx;
1770
1771 if ((fmt_idx = get_format_idx(format_id)) == -1)
1772 {
1773 ERR("Format %s (%#x) not found.\n", debug_d3dformat(format_id), format_id);
1774 return NULL;
1775 }
1776
1777 return &gl_info->formats[fmt_idx];
1778}

Referenced by init_format_base_info(), init_format_block_info(), init_format_texture_info(), init_format_vertex_info(), and init_typeless_formats().

◆ get_identity_matrix()

void get_identity_matrix ( struct wined3d_matrix mat)

Definition at line 4886 of file utils.c.

4887{
4888 static const struct wined3d_matrix identity =
4889 {
4890 1.0f, 0.0f, 0.0f, 0.0f,
4891 0.0f, 1.0f, 0.0f, 0.0f,
4892 0.0f, 0.0f, 1.0f, 0.0f,
4893 0.0f, 0.0f, 0.0f, 1.0f,
4894 };
4895
4896 *mat = identity;
4897}

Referenced by compute_texture_matrix(), get_modelview_matrix(), and state_init_default().

◆ get_modelview_matrix()

void get_modelview_matrix ( const struct wined3d_context context,
const struct wined3d_state state,
unsigned int  index,
struct wined3d_matrix mat 
)

Definition at line 4899 of file utils.c.

4901{
4902 if (context->last_was_rhw)
4904 else
4906}
void multiply_matrix(struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
Definition: utils.c:5401
GLuint index
Definition: glext.h:6031

Referenced by shader_glsl_load_constants(), software_vertex_blending(), and transform_world().

◆ get_pointsize()

void get_pointsize ( const struct wined3d_context context,
const struct wined3d_state state,
float out_pointsize,
float out_att 
)

Definition at line 5147 of file utils.c.

5149{
5150 /* POINTSCALEENABLE controls how point size value is treated. If set to
5151 * true, the point size is scaled with respect to height of viewport.
5152 * When set to false point size is in pixels. */
5153 union
5154 {
5155 DWORD d;
5156 float f;
5157 } pointsize, a, b, c;
5158
5159 out_att[0] = 1.0f;
5160 out_att[1] = 0.0f;
5161 out_att[2] = 0.0f;
5162
5163 pointsize.d = state->render_states[WINED3D_RS_POINTSIZE];
5164 a.d = state->render_states[WINED3D_RS_POINTSCALE_A];
5165 b.d = state->render_states[WINED3D_RS_POINTSCALE_B];
5166 c.d = state->render_states[WINED3D_RS_POINTSCALE_C];
5167
5168 if (state->render_states[WINED3D_RS_POINTSCALEENABLE])
5169 {
5170 float scale_factor = state->viewport.height * state->viewport.height;
5171
5172 out_att[0] = a.f / scale_factor;
5173 out_att[1] = b.f / scale_factor;
5174 out_att[2] = c.f / scale_factor;
5175 }
5176 *out_pointsize = pointsize.f;
5177}
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
int scale_factor
Definition: jpeglib.h:995
#define c
Definition: ke_i.h:80
#define b
Definition: ke_i.h:79

Referenced by shader_glsl_pointsize_uniform(), and state_pscale().

◆ get_pointsize_minmax()

void get_pointsize_minmax ( const struct wined3d_context context,
const struct wined3d_state state,
float out_min,
float out_max 
)

Definition at line 5128 of file utils.c.

5130{
5131 union
5132 {
5133 DWORD d;
5134 float f;
5135 } min, max;
5136
5137 min.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
5138 max.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
5139
5140 if (min.f > max.f)
5141 min.f = max.f;
5142
5143 *out_min = min.f;
5144 *out_max = max.f;
5145}
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63

Referenced by shader_glsl_pointsize_uniform(), state_psizemin_arb(), state_psizemin_ext(), and state_psizemin_w().

◆ get_projection_matrix()

void get_projection_matrix ( const struct wined3d_context context,
const struct wined3d_state state,
struct wined3d_matrix mat 
)

Definition at line 4908 of file utils.c.

4910{
4911 BOOL clip_control = context->gl_info->supported[ARB_CLIP_CONTROL];
4912 BOOL flip = !clip_control && context->render_offscreen;
4913 float center_offset;
4914
4915 /* There are a couple of additional things we have to take into account
4916 * here besides the projection transformation itself:
4917 * - We need to flip along the y-axis in case of offscreen rendering.
4918 * - OpenGL Z range is {-Wc,...,Wc} while D3D Z range is {0,...,Wc}.
4919 * - <= D3D9 coordinates refer to pixel centers while GL coordinates
4920 * refer to pixel corners.
4921 * - D3D has a top-left filling convention. We need to maintain this
4922 * even after the y-flip mentioned above.
4923 * In order to handle the last two points, we translate by
4924 * (63.0 / 128.0) / VPw and (63.0 / 128.0) / VPh. This is equivalent to
4925 * translating slightly less than half a pixel. We want the difference to
4926 * be large enough that it doesn't get lost due to rounding inside the
4927 * driver, but small enough to prevent it from interfering with any
4928 * anti-aliasing. */
4929
4930 if (!clip_control && context->d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER)
4931 center_offset = 63.0f / 64.0f;
4932 else
4933 center_offset = -1.0f / 64.0f;
4934
4935 if (context->last_was_rhw)
4936 {
4937 /* Transform D3D RHW coordinates to OpenGL clip coordinates. */
4938 float x = state->viewport.x;
4939 float y = state->viewport.y;
4940 float w = state->viewport.width;
4941 float h = state->viewport.height;
4942 float x_scale = 2.0f / w;
4943 float x_offset = (center_offset - (2.0f * x) - w) / w;
4944 float y_scale = flip ? 2.0f / h : 2.0f / -h;
4945 float y_offset = flip
4946 ? (center_offset - (2.0f * y) - h) / h
4947 : (center_offset - (2.0f * y) - h) / -h;
4948 enum wined3d_depth_buffer_type zenable = state->fb->depth_stencil ?
4949 state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE;
4950 float z_scale = zenable ? clip_control ? 1.0f : 2.0f : 0.0f;
4951 float z_offset = zenable ? clip_control ? 0.0f : -1.0f : 0.0f;
4952 const struct wined3d_matrix projection =
4953 {
4954 x_scale, 0.0f, 0.0f, 0.0f,
4955 0.0f, y_scale, 0.0f, 0.0f,
4956 0.0f, 0.0f, z_scale, 0.0f,
4957 x_offset, y_offset, z_offset, 1.0f,
4958 };
4959
4960 *mat = projection;
4961 }
4962 else
4963 {
4964 float y_scale = flip ? -1.0f : 1.0f;
4965 float x_offset = center_offset / state->viewport.width;
4966 float y_offset = flip
4967 ? center_offset / state->viewport.height
4968 : -center_offset / state->viewport.height;
4969 float z_scale = clip_control ? 1.0f : 2.0f;
4970 float z_offset = clip_control ? 0.0f : -1.0f;
4971 const struct wined3d_matrix projection =
4972 {
4973 1.0f, 0.0f, 0.0f, 0.0f,
4974 0.0f, y_scale, 0.0f, 0.0f,
4975 0.0f, 0.0f, z_scale, 0.0f,
4976 x_offset, y_offset, z_offset, 1.0f,
4977 };
4978
4979 multiply_matrix(mat, &projection, &state->transforms[WINED3D_TS_PROJECTION]);
4980 }
4981}
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
wined3d_depth_buffer_type
Definition: wined3d.h:463
@ WINED3D_ZB_FALSE
Definition: wined3d.h:464
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1322
@ ARB_CLIP_CONTROL
Definition: wined3d_gl.h:49

Referenced by shader_glsl_load_constants(), and transform_projection().

◆ get_texture_matrix()

void get_texture_matrix ( const struct wined3d_context context,
const struct wined3d_state state,
unsigned int  tex,
struct wined3d_matrix mat 
)

Definition at line 5096 of file utils.c.

5098{
5099 const struct wined3d_device *device = context->device;
5100 const struct wined3d_gl_info *gl_info = context->gl_info;
5101 BOOL generated = (state->texture_states[tex][WINED3D_TSS_TEXCOORD_INDEX] & 0xffff0000)
5103 unsigned int coord_idx = min(state->texture_states[tex][WINED3D_TSS_TEXCOORD_INDEX & 0x0000ffff],
5104 MAX_TEXTURES - 1);
5105
5106 compute_texture_matrix(gl_info, &state->transforms[WINED3D_TS_TEXTURE0 + tex],
5107 state->texture_states[tex][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS],
5108 generated, context->last_was_rhw,
5109 context->stream_info.use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx))
5110 ? context->stream_info.elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->id
5112 device->shader_backend->shader_has_ffp_proj_control(device->shader_priv), mat);
5113
5114 if ((context->lastWasPow2Texture & (1u << tex)) && state->textures[tex])
5115 {
5116 if (generated)
5117 FIXME("Non-power-of-two texture being used with generated texture coords.\n");
5118 /* NP2 texcoord fixup is implemented for pixelshaders so only enable the
5119 * fixed-function-pipeline fixup via pow2Matrix when no PS is used. */
5120 if (!use_ps(state))
5121 {
5122 TRACE("Non-power-of-two texture matrix multiply fixup.\n");
5123 multiply_matrix(mat, mat, (struct wined3d_matrix *)state->textures[tex]->pow2_matrix);
5124 }
5125 }
5126}
static void compute_texture_matrix(const struct wined3d_gl_info *gl_info, const struct wined3d_matrix *matrix, DWORD flags, BOOL calculated_coords, BOOL transformed, enum wined3d_format_id format_id, BOOL ffp_proj_control, struct wined3d_matrix *out_matrix)
Definition: utils.c:4984
Definition: devices.h:37
#define WINED3DTSS_TCI_PASSTHRU
Definition: wined3d.h:860
static BOOL use_ps(const struct wined3d_state *state)

Referenced by shader_glsl_ffp_vertex_texmatrix_uniform(), and transform_texture().

◆ init_debug_buffer()

static void init_debug_buffer ( struct debug_buffer buffer,
const char default_string 
)
static

Definition at line 4175 of file utils.c.

4176{
4177 strcpy(buffer->str, default_string);
4178 buffer->ptr = buffer->str;
4179 buffer->size = ARRAY_SIZE(buffer->str);
4180}

Referenced by debug_d3dusage(), debug_d3dusagequery(), wined3d_debug_location(), and wined3d_debug_resource_access().

◆ init_format_base_info()

static BOOL init_format_base_info ( struct wined3d_gl_info gl_info)
static

Definition at line 1829 of file utils.c.

1830{
1831 struct wined3d_format *format;
1832 unsigned int i, j;
1833
1835 if (!(gl_info->formats = heap_calloc(gl_info->format_count
1836 + ARRAY_SIZE(typeless_depth_stencil_formats), sizeof(*gl_info->formats))))
1837 {
1838 ERR("Failed to allocate memory.\n");
1839 return FALSE;
1840 }
1841
1842 for (i = 0; i < ARRAY_SIZE(formats); ++i)
1843 {
1844 if (!(format = get_format_internal(gl_info, formats[i].id)))
1845 goto fail;
1846
1847 format->id = formats[i].id;
1848 format->red_size = formats[i].red_size;
1849 format->green_size = formats[i].green_size;
1850 format->blue_size = formats[i].blue_size;
1851 format->alpha_size = formats[i].alpha_size;
1852 format->red_offset = formats[i].red_offset;
1853 format->green_offset = formats[i].green_offset;
1854 format->blue_offset = formats[i].blue_offset;
1855 format->alpha_offset = formats[i].alpha_offset;
1856 format->byte_count = formats[i].bpp;
1857 format->depth_size = formats[i].depth_size;
1858 format->stencil_size = formats[i].stencil_size;
1859 format->block_width = 1;
1860 format->block_height = 1;
1861 format->block_byte_count = formats[i].bpp;
1862 }
1863
1864 for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
1865 {
1866 const struct wined3d_format *typeless_format;
1867 DWORD flags = 0;
1868
1869 if (!(format = get_format_internal(gl_info, typed_formats[i].id)))
1870 goto fail;
1871
1872 if (!(typeless_format = get_format_internal(gl_info, typed_formats[i].typeless_id)))
1873 goto fail;
1874
1875 format->id = typed_formats[i].id;
1876 format->red_size = typeless_format->red_size;
1877 format->green_size = typeless_format->green_size;
1878 format->blue_size = typeless_format->blue_size;
1879 format->alpha_size = typeless_format->alpha_size;
1880 format->red_offset = typeless_format->red_offset;
1881 format->green_offset = typeless_format->green_offset;
1882 format->blue_offset = typeless_format->blue_offset;
1883 format->alpha_offset = typeless_format->alpha_offset;
1884 format->byte_count = typeless_format->byte_count;
1885 format->depth_size = typeless_format->depth_size;
1886 format->stencil_size = typeless_format->stencil_size;
1887 format->block_width = typeless_format->block_width;
1888 format->block_height = typeless_format->block_height;
1889 format->block_byte_count = typeless_format->block_byte_count;
1890 format->typeless_id = typeless_format->id;
1891
1892 for (j = 0; j < strlen(typed_formats[i].channels); ++j)
1893 {
1895 if (channel_type == WINED3D_CHANNEL_TYPE_UINT || channel_type == WINED3D_CHANNEL_TYPE_SINT)
1897 if (channel_type == WINED3D_CHANNEL_TYPE_FLOAT)
1899
1900 if (channel_type == WINED3D_CHANNEL_TYPE_DEPTH && !format->depth_size)
1901 {
1902 format->depth_size = format->red_size;
1903 format->red_size = format->red_offset = 0;
1904 }
1905 }
1906
1908 }
1909
1910 for (i = 0; i < ARRAY_SIZE(ddi_formats); ++i)
1911 {
1912 if (!(format = get_format_internal(gl_info, ddi_formats[i].id)))
1913 goto fail;
1914
1915 format->ddi_format = ddi_formats[i].ddi_format;
1916 }
1917
1918 for (i = 0; i < ARRAY_SIZE(format_base_flags); ++i)
1919 {
1920 if (!(format = get_format_internal(gl_info, format_base_flags[i].id)))
1921 goto fail;
1922
1924 }
1925
1926 return TRUE;
1927
1928fail:
1929 heap_free(gl_info->formats);
1930 return FALSE;
1931}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define WINED3D_FORMAT_COUNT
Definition: utils.c:70
wined3d_channel_type
Definition: utils.c:180
static const struct wined3d_typeless_format_depth_stencil_info typeless_depth_stencil_formats[]
Definition: utils.c:293
static const struct wined3d_typed_format_info typed_formats[]
Definition: utils.c:211
static struct wined3d_format * get_format_internal(struct wined3d_gl_info *gl_info, enum wined3d_format_id format_id)
Definition: utils.c:1766
static const struct wined3d_format_ddi_info ddi_formats[]
Definition: utils.c:309
static const struct wined3d_format_channels formats[]
Definition: utils.c:81
static enum wined3d_channel_type map_channel_type(char t)
Definition: utils.c:1803
static const struct wined3d_format_base_flags format_base_flags[]
Definition: utils.c:331
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
int This channels
Definition: rdpsnd_libao.c:37
static void * heap_calloc(SIZE_T count, SIZE_T size)
Definition: heap.h:49
enum wined3d_format_id id
enum wined3d_format_id typeless_id
#define WINED3DFMT_FLAG_FLOAT

Referenced by wined3d_adapter_init_format_info().

◆ init_format_block_info()

static BOOL init_format_block_info ( struct wined3d_gl_info gl_info)
static

Definition at line 1933 of file utils.c.

1934{
1935 struct wined3d_format *format;
1936 unsigned int i;
1937
1938 for (i = 0; i < ARRAY_SIZE(format_block_info); ++i)
1939 {
1940 if (!(format = get_format_internal(gl_info, format_block_info[i].id)))
1941 return FALSE;
1942
1943 format->block_width = format_block_info[i].block_width;
1944 format->block_height = format_block_info[i].block_height;
1945 format->block_byte_count = format_block_info[i].block_byte_count;
1947 if (!format_block_info[i].verify)
1949 }
1950
1951 return TRUE;
1952}
static const struct wined3d_format_block_info format_block_info[]
Definition: utils.c:354
#define WINED3DFMT_FLAG_BLOCKS
#define WINED3DFMT_FLAG_BLOCKS_NO_VERIFY

Referenced by wined3d_adapter_init_format_info().

◆ init_format_depth_bias_scale()

static void init_format_depth_bias_scale ( struct wined3d_caps_gl_ctx ctx,
const struct wined3d_d3d_info d3d_info 
)
static

Definition at line 3773 of file utils.c.

3775{
3776 const struct wined3d_gl_info *gl_info = ctx->gl_info;
3777 unsigned int i;
3778
3779 for (i = 0; i < gl_info->format_count; ++i)
3780 {
3781 struct wined3d_format *format = &gl_info->formats[i];
3782
3784 {
3785 TRACE("Testing depth bias scale for format %s.\n", debug_d3dformat(format->id));
3786 format->depth_bias_scale = wined3d_adapter_find_polyoffset_scale(ctx, format->glInternal);
3787
3789 {
3790 /* The single-precision binary floating-point format has
3791 * a significand precision of 24 bits.
3792 */
3794 format->depth_bias_scale /= 1u << 24;
3795 else
3796 format->depth_bias_scale /= 1u << format->depth_size;
3797 }
3798 }
3799 }
3800}
static float wined3d_adapter_find_polyoffset_scale(struct wined3d_caps_gl_ctx *ctx, GLenum format)
Definition: utils.c:3679
#define WINED3D_NORMALIZED_DEPTH_BIAS
Definition: wined3d.h:1328

Referenced by wined3d_adapter_init_format_info().

◆ init_format_fbo_compat_info()

static void init_format_fbo_compat_info ( struct wined3d_caps_gl_ctx ctx)
static

Definition at line 2532 of file utils.c.

2533{
2534 const struct wined3d_gl_info *gl_info = ctx->gl_info;
2535 unsigned int i, type;
2536 GLuint fbo;
2537
2539 {
2540 for (i = 0; i < gl_info->format_count; ++i)
2541 {
2542 GLint value;
2543 struct wined3d_format *format = &gl_info->formats[i];
2544 BOOL fallback_fmt_used = FALSE, regular_fmt_used = FALSE;
2545 GLenum rt_internal = format->rtInternal;
2546
2547 if (!format->glInternal)
2548 continue;
2549
2550 for (type = 0; type < ARRAY_SIZE(format->flags); ++type)
2551 {
2552 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2553 format->glInternal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
2554 if (value == GL_FULL_SUPPORT)
2555 {
2556 TRACE("Format %s is supported as FBO color attachment, resource type %u.\n",
2559 format->rtInternal = format->glInternal;
2560 regular_fmt_used = TRUE;
2561
2562 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2563 format->glInternal, GL_FRAMEBUFFER_BLEND, 1, &value);
2564 if (value == GL_FULL_SUPPORT)
2565 {
2566 TRACE("Format %s supports post-pixelshader blending, resource type %u.\n",
2569 }
2570 else
2571 {
2572 TRACE("Format %s doesn't support post-pixelshader blending, resource typed %u.\n",
2574 format->flags[type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
2575 }
2576 }
2577 else
2578 {
2579 if (!rt_internal)
2580 {
2582 {
2583 WARN("Format %s with rendertarget flag is not supported as FBO color attachment"
2584 " and no fallback specified, resource type %u.\n",
2586 format->flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
2587 }
2588 else
2589 TRACE("Format %s is not supported as FBO color attachment,"
2590 " resource type %u.\n", debug_d3dformat(format->id), type);
2591 format->rtInternal = format->glInternal;
2592 }
2593 else
2594 {
2595 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2596 rt_internal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
2597 if (value == GL_FULL_SUPPORT)
2598 {
2599 TRACE("Format %s rtInternal format is supported as FBO color attachment,"
2600 " resource type %u.\n", debug_d3dformat(format->id), type);
2601 fallback_fmt_used = TRUE;
2602 }
2603 else
2604 {
2605 WARN("Format %s rtInternal format is not supported as FBO color attachment,"
2606 " resource type %u.\n", debug_d3dformat(format->id), type);
2607 format->flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
2608 }
2609 }
2610 }
2611
2612 if (format->glInternal != format->glGammaInternal)
2613 {
2614 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2615 format->glGammaInternal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
2616 if (value == GL_FULL_SUPPORT)
2617 {
2618 TRACE("Format %s's sRGB format is FBO attachable, resource type %u.\n",
2621 if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
2622 format->glInternal = format->glGammaInternal;
2623 }
2624 else
2625 {
2626 WARN("Format %s's sRGB format is not FBO attachable, resource type %u.\n",
2629 }
2630 }
2631 else if (format->flags[type] & WINED3DFMT_FLAG_FBO_ATTACHABLE)
2633 }
2634
2635 if (fallback_fmt_used && regular_fmt_used)
2636 {
2637 FIXME("Format %s needs different render target formats for different resource types.\n",
2638 debug_d3dformat(format->id));
2641 }
2642 }
2643 return;
2644 }
2645
2647 {
2648 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
2649 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
2650 gl_info->gl_ops.gl.p_glDrawBuffer(GL_COLOR_ATTACHMENT0);
2651 gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0);
2652 }
2653
2654 for (i = 0; i < gl_info->format_count; ++i)
2655 {
2656 struct wined3d_format *format = &gl_info->formats[i];
2657
2658 if (!format->glInternal) continue;
2659
2661 {
2662 TRACE("Skipping format %s because it's a compressed format.\n",
2663 debug_d3dformat(format->id));
2664 continue;
2665 }
2666
2668 {
2669 TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(format->id));
2671 }
2672 else
2673 {
2674 format->rtInternal = format->glInternal;
2675 }
2676 }
2677
2679 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
2680}
static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_format *format)
Definition: utils.c:2234
Definition: pdh_main.c:94
#define GL_FRAMEBUFFER_BLEND
Definition: wgl.h:1483
#define GL_FRAMEBUFFER_RENDERABLE
Definition: wgl.h:1513
#define GL_FULL_SUPPORT
Definition: wgl.h:1534
@ ARB_INTERNALFORMAT_QUERY2
Definition: wined3d_gl.h:81
#define WINED3DFMT_FLAG_COMPRESSED
#define ORM_FBO

Referenced by wined3d_adapter_init_format_info().

◆ init_format_filter_info()

static void init_format_filter_info ( struct wined3d_gl_info gl_info,
enum wined3d_pci_vendor  vendor 
)
static

Definition at line 3137 of file utils.c.

3138{
3139 struct wined3d_format *format;
3140 unsigned int fmt_idx, i;
3141 static const enum wined3d_format_id fmts16[] =
3142 {
3146 };
3147 BOOL filtered;
3148
3150 /* This was already handled by init_format_texture_info(). */
3151 return;
3152
3155 {
3156 WARN("No FBO support, or no FBO ORM, guessing filter info from GL caps\n");
3158 {
3159 TRACE("Nvidia card with texture_float support: Assuming float16 blending\n");
3160 filtered = TRUE;
3161 }
3162 else if (gl_info->limits.glsl_varyings > 44)
3163 {
3164 TRACE("More than 44 GLSL varyings - assuming d3d10 card with float16 blending\n");
3165 filtered = TRUE;
3166 }
3167 else
3168 {
3169 TRACE("Assuming no float16 blending\n");
3170 filtered = FALSE;
3171 }
3172
3173 if (filtered)
3174 {
3175 for (i = 0; i < ARRAY_SIZE(fmts16); ++i)
3176 {
3177 fmt_idx = get_format_idx(fmts16[i]);
3179 }
3180 }
3181 return;
3182 }
3183
3184 for (i = 0; i < ARRAY_SIZE(fmts16); ++i)
3185 {
3186 fmt_idx = get_format_idx(fmts16[i]);
3187 format = &gl_info->formats[fmt_idx];
3188 if (!format->glInternal) continue; /* Not supported by GL */
3189
3190 filtered = check_filter(gl_info, gl_info->formats[fmt_idx].glInternal);
3191 if (filtered)
3192 {
3193 TRACE("Format %s supports filtering\n", debug_d3dformat(fmts16[i]));
3195 }
3196 else
3197 {
3198 TRACE("Format %s does not support filtering\n", debug_d3dformat(fmts16[i]));
3199 }
3200 }
3201}
#define HW_VENDOR_NVIDIA
Definition: builtin.c:4465
const WCHAR * vendor
Definition: db.cpp:872
static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal)
Definition: utils.c:3038
struct wined3d_gl_limits limits
@ ARB_TEXTURE_FLOAT
Definition: wined3d_gl.h:118
#define WINED3DFMT_FLAG_FILTERING

Referenced by wined3d_adapter_init_format_info().

◆ init_format_gen_mipmap_info()

static void init_format_gen_mipmap_info ( struct wined3d_gl_info gl_info)
static

Definition at line 3615 of file utils.c.

3616{
3617 unsigned int i, j;
3618
3619 if (!gl_info->fbo_ops.glGenerateMipmap)
3620 return;
3621
3622 for (i = 0; i < gl_info->format_count; ++i)
3623 {
3624 struct wined3d_format *format = &gl_info->formats[i];
3625
3626 for (j = 0; j < ARRAY_SIZE(format->flags); ++j)
3629 }
3630}
#define WINED3DFMT_FLAG_GEN_MIPMAP

Referenced by wined3d_adapter_init_format_info().

◆ init_format_texture_info()

static BOOL init_format_texture_info ( struct wined3d_adapter adapter,
struct wined3d_gl_info gl_info 
)
static

Definition at line 2923 of file utils.c.

2924{
2925 struct wined3d_format *format, *srgb_format;
2927 struct shader_caps shader_caps;
2928 unsigned int i, j;
2929 BOOL srgb_write;
2930
2931 adapter->fragment_pipe->get_caps(gl_info, &fragment_caps);
2932 adapter->shader_backend->shader_get_caps(gl_info, &shader_caps);
2935
2936 for (i = 0; i < ARRAY_SIZE(format_texture_info); ++i)
2937 {
2938 if (!(format = get_format_internal(gl_info, format_texture_info[i].id)))
2939 return FALSE;
2940
2941 if (!gl_info->supported[format_texture_info[i].extension])
2942 continue;
2943
2944 /* ARB_texture_rg defines floating point formats, but only if
2945 * ARB_texture_float is also supported. */
2946 if (!gl_info->supported[ARB_TEXTURE_FLOAT]
2948 continue;
2949
2950 /* ARB_texture_rg defines integer formats if EXT_texture_integer is also supported. */
2951 if (!gl_info->supported[EXT_TEXTURE_INTEGER]
2953 continue;
2954
2955 format->glInternal = format_texture_info[i].gl_internal;
2956 format->glGammaInternal = format_texture_info[i].gl_srgb_internal;
2957 format->rtInternal = format_texture_info[i].gl_rt_internal;
2958 format->glFormat = format_texture_info[i].gl_format;
2959 format->glType = format_texture_info[i].gl_type;
2960 format->color_fixup = COLOR_FIXUP_IDENTITY;
2961 format->height_scale.numerator = 1;
2962 format->height_scale.denominator = 1;
2963
2967
2968 /* GL_ARB_depth_texture does not support 3D textures. It also says "cube textures are
2969 * problematic", but doesn't explicitly mandate that an error is generated. */
2970 if (gl_info->supported[EXT_TEXTURE3D]
2973
2976
2977 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
2979
2981 format->flags[WINED3D_GL_RES_TYPE_RB] &= ~WINED3DFMT_FLAG_TEXTURE;
2982
2983 if (format->glGammaInternal != format->glInternal
2984 && !(adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
2985 {
2986 format->glGammaInternal = format->glInternal;
2988 }
2989
2991
2992 /* Texture conversion stuff */
2993 format->conv_byte_count = format_texture_info[i].conv_byte_count;
2994 format->upload = format_texture_info[i].upload;
2995 format->download = format_texture_info[i].download;
2996
2997 srgb_format = NULL;
2998 for (j = 0; j < ARRAY_SIZE(format_srgb_info); ++j)
2999 {
3000 if (format_srgb_info[j].base_format_id == format->id)
3001 {
3002 if (!(srgb_format = get_format_internal(gl_info, format_srgb_info[j].srgb_format_id)))
3003 return FALSE;
3004 break;
3005 }
3006 }
3007 if (!srgb_format)
3008 continue;
3009
3010 copy_format(srgb_format, format);
3011
3012 if (gl_info->supported[EXT_TEXTURE_SRGB]
3013 && !(adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
3014 {
3015 srgb_format->glInternal = format_texture_info[i].gl_srgb_internal;
3016 srgb_format->glGammaInternal = format_texture_info[i].gl_srgb_internal;
3018 query_internal_format(adapter, srgb_format, &format_texture_info[i], gl_info, srgb_write, TRUE);
3019 }
3020 }
3021
3022 return TRUE;
3023}
static void copy_format(struct wined3d_format *dst_format, const struct wined3d_format *src_format)
Definition: utils.c:1780
static const struct wined3d_format_texture_info format_texture_info[]
Definition: utils.c:1114
static const struct wined3d_format_srgb_info format_srgb_info[]
Definition: utils.c:1739
static void query_internal_format(struct wined3d_adapter *adapter, struct wined3d_format *format, const struct wined3d_format_texture_info *texture_info, struct wined3d_gl_info *gl_info, BOOL srgb_write_supported, BOOL srgb_format)
Definition: utils.c:2813
#define WINED3D_SRGB_READ_WRITE_CONTROL
Definition: wined3d.h:1324
@ ARB_TEXTURE_CUBE_MAP
Definition: wined3d_gl.h:113
@ EXT_TEXTURE_INTEGER
Definition: wined3d_gl.h:177
@ EXT_TEXTURE3D
Definition: wined3d_gl.h:171
@ EXT_TEXTURE_SRGB
Definition: wined3d_gl.h:182
@ ARB_TEXTURE_RECTANGLE
Definition: wined3d_gl.h:125
#define WINED3D_FRAGMENT_CAP_SRGB_WRITE
#define WINED3DFMT_FLAG_SRGB_READ
#define WINED3D_SHADER_CAP_SRGB_WRITE

Referenced by wined3d_adapter_init_format_info().

◆ init_format_vertex_info()

static BOOL init_format_vertex_info ( struct wined3d_gl_info gl_info)
static

Definition at line 3527 of file utils.c.

3528{
3529 struct wined3d_format *format;
3530 unsigned int i;
3531
3532 for (i = 0; i < ARRAY_SIZE(format_vertex_info); ++i)
3533 {
3534 if (!(format = get_format_internal(gl_info, format_vertex_info[i].id)))
3535 return FALSE;
3536
3537 if (!gl_info->supported[format_vertex_info[i].extension])
3538 continue;
3539
3540 format->emit_idx = format_vertex_info[i].emit_idx;
3541 format->component_count = format_vertex_info[i].component_count;
3542 format->gl_vtx_type = format_vertex_info[i].gl_vtx_type;
3543 format->gl_vtx_format = format_vertex_info[i].component_count;
3544 format->gl_normalized = format_vertex_info[i].gl_normalized;
3545 if (!(format->attribute_size = calculate_vertex_attribute_size(format->gl_vtx_type,
3546 format->component_count)))
3547 {
3548 ERR("Invalid attribute size for vertex format %s (%#x).\n",
3550 return FALSE;
3551 }
3552 }
3553
3554 return TRUE;
3555}
static unsigned int calculate_vertex_attribute_size(GLenum type, unsigned int component_count)
Definition: utils.c:3499
static const struct wined3d_format_vertex_info format_vertex_info[]
Definition: utils.c:387

Referenced by wined3d_adapter_init_format_info().

◆ init_typeless_formats()

static BOOL init_typeless_formats ( struct wined3d_gl_info gl_info)
static

Definition at line 3557 of file utils.c.

3558{
3559 unsigned int flags[WINED3D_GL_RES_TYPE_COUNT];
3560 unsigned int i, j;
3561
3562 for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
3563 {
3564 struct wined3d_format *format, *typeless_format;
3565
3566 if (!(format = get_format_internal(gl_info, typed_formats[i].id)))
3567 return FALSE;
3568 if (!(typeless_format = get_format_internal(gl_info, typed_formats[i].typeless_id)))
3569 return FALSE;
3570
3571 memcpy(flags, typeless_format->flags, sizeof(flags));
3572 copy_format(typeless_format, format);
3573 for (j = 0; j < ARRAY_SIZE(typeless_format->flags); ++j)
3574 typeless_format->flags[j] |= flags[j];
3575 }
3576
3578 {
3579 struct wined3d_format *typeless_format, *typeless_ds_format, *ds_format;
3580 struct wined3d_format *depth_view_format, *stencil_view_format;
3582
3583 if (!(typeless_format = get_format_internal(gl_info, typeless_depth_stencil_formats[i].typeless_id)))
3584 return FALSE;
3585 if (!(ds_format = get_format_internal(gl_info, typeless_depth_stencil_formats[i].depth_stencil_id)))
3586 return FALSE;
3587
3588 typeless_ds_format = &gl_info->formats[WINED3D_FORMAT_COUNT + i];
3589 typeless_ds_format->id = typeless_depth_stencil_formats[i].typeless_id;
3590 copy_format(typeless_ds_format, ds_format);
3591 for (j = 0; j < ARRAY_SIZE(typeless_ds_format->flags); ++j)
3592 {
3593 typeless_ds_format->flags[j] = typeless_format->flags[j];
3594 typeless_format->flags[j] &= ~(WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
3595 }
3596
3597 if ((format_id = typeless_depth_stencil_formats[i].depth_view_id)
3598 && typeless_depth_stencil_formats[i].separate_depth_view_format)
3599 {
3600 if (!(depth_view_format = get_format_internal(gl_info, format_id)))
3601 return FALSE;
3602 copy_format(depth_view_format, ds_format);
3603 }
3604 if ((format_id = typeless_depth_stencil_formats[i].stencil_view_id))
3605 {
3606 if (!(stencil_view_format = get_format_internal(gl_info, format_id)))
3607 return FALSE;
3608 copy_format(stencil_view_format, ds_format);
3609 }
3610 }
3611
3612 return TRUE;
3613}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned int flags[WINED3D_GL_RES_TYPE_COUNT]

Referenced by wined3d_adapter_init_format_info().

◆ invert_matrix()

BOOL invert_matrix ( struct wined3d_matrix out,
const struct wined3d_matrix m 
)

Definition at line 5501 of file utils.c.

5502{
5503 float wtmp[4][8];
5504 float m0, m1, m2, m3, s;
5505 float *r0, *r1, *r2, *r3;
5506
5507 r0 = wtmp[0];
5508 r1 = wtmp[1];
5509 r2 = wtmp[2];
5510 r3 = wtmp[3];
5511
5512 r0[0] = m->_11;
5513 r0[1] = m->_12;
5514 r0[2] = m->_13;
5515 r0[3] = m->_14;
5516 r0[4] = 1.0f;
5517 r0[5] = r0[6] = r0[7] = 0.0f;
5518
5519 r1[0] = m->_21;
5520 r1[1] = m->_22;
5521 r1[2] = m->_23;
5522 r1[3] = m->_24;
5523 r1[5] = 1.0f;
5524 r1[4] = r1[6] = r1[7] = 0.0f;
5525
5526 r2[0] = m->_31;
5527 r2[1] = m->_32;
5528 r2[2] = m->_33;
5529 r2[3] = m->_34;
5530 r2[6] = 1.0f;
5531 r2[4] = r2[5] = r2[7] = 0.0f;
5532
5533 r3[0] = m->_41;
5534 r3[1] = m->_42;
5535 r3[2] = m->_43;
5536 r3[3] = m->_44;
5537 r3[7] = 1.0f;
5538 r3[4] = r3[5] = r3[6] = 0.0f;
5539
5540 /* Choose pivot - or die. */
5541 if (fabsf(r3[0]) > fabsf(r2[0]))
5542 swap_rows(&r3, &r2);
5543 if (fabsf(r2[0]) > fabsf(r1[0]))
5544 swap_rows(&r2, &r1);
5545 if (fabsf(r1[0]) > fabsf(r0[0]))
5546 swap_rows(&r1, &r0);
5547 if (r0[0] == 0.0f)
5548 return FALSE;
5549
5550 /* Eliminate first variable. */
5551 m1 = r1[0] / r0[0]; m2 = r2[0] / r0[0]; m3 = r3[0] / r0[0];
5552 s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s;
5553 s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s;
5554 s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s;
5555 s = r0[4];
5556 if (s != 0.0f)
5557 {
5558 r1[4] -= m1 * s;
5559 r2[4] -= m2 * s;
5560 r3[4] -= m3 * s;
5561 }
5562 s = r0[5];
5563 if (s != 0.0f)
5564 {
5565 r1[5] -= m1 * s;
5566 r2[5] -= m2 * s;
5567 r3[5] -= m3 * s;
5568 }
5569 s = r0[6];
5570 if (s != 0.0f)
5571 {
5572 r1[6] -= m1 * s;
5573 r2[6] -= m2 * s;
5574 r3[6] -= m3 * s;
5575 }
5576 s = r0[7];
5577 if (s != 0.0f)
5578 {
5579 r1[7] -= m1 * s;
5580 r2[7] -= m2 * s;
5581 r3[7] -= m3 * s;
5582 }
5583
5584 /* Choose pivot - or die. */
5585 if (fabsf(r3[1]) > fabsf(r2[1]))
5586 swap_rows(&r3, &r2);
5587 if (fabsf(r2[1]) > fabsf(r1[1]))
5588 swap_rows(&r2, &r1);
5589 if (r1[1] == 0.0f)
5590 return FALSE;
5591
5592 /* Eliminate second variable. */
5593 m2 = r2[1] / r1[1]; m3 = r3[1] / r1[1];
5594 r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2];
5595 r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3];
5596 s = r1[4];
5597 if (s != 0.0f)
5598 {
5599 r2[4] -= m2 * s;
5600 r3[4] -= m3 * s;
5601 }
5602 s = r1[5];
5603 if (s != 0.0f)
5604 {
5605 r2[5] -= m2 * s;
5606 r3[5] -= m3 * s;
5607 }
5608 s = r1[6];
5609 if (s != 0.0f)
5610 {
5611 r2[6] -= m2 * s;
5612 r3[6] -= m3 * s;
5613 }
5614 s = r1[7];
5615 if (s != 0.0f)
5616 {
5617 r2[7] -= m2 * s;
5618 r3[7] -= m3 * s;
5619 }
5620
5621 /* Choose pivot - or die. */
5622 if (fabsf(r3[2]) > fabsf(r2[2]))
5623 swap_rows(&r3, &r2);
5624 if (r2[2] == 0.0f)
5625 return FALSE;
5626
5627 /* Eliminate third variable. */
5628 m3 = r3[2] / r2[2];
5629 r3[3] -= m3 * r2[3];
5630 r3[4] -= m3 * r2[4];
5631 r3[5] -= m3 * r2[5];
5632 r3[6] -= m3 * r2[6];
5633 r3[7] -= m3 * r2[7];
5634
5635 /* Last check. */
5636 if (r3[3] == 0.0f)
5637 return FALSE;
5638
5639 /* Back substitute row 3. */
5640 s = 1.0f / r3[3];
5641 r3[4] *= s;
5642 r3[5] *= s;
5643 r3[6] *= s;
5644 r3[7] *= s;
5645
5646 /* Back substitute row 2. */
5647 m2 = r2[3];
5648 s = 1.0f / r2[2];
5649 r2[4] = s * (r2[4] - r3[4] * m2);
5650 r2[5] = s * (r2[5] - r3[5] * m2);
5651 r2[6] = s * (r2[6] - r3[6] * m2);
5652 r2[7] = s * (r2[7] - r3[7] * m2);
5653 m1 = r1[3];
5654 r1[4] -= r3[4] * m1;
5655 r1[5] -= r3[5] * m1;
5656 r1[6] -= r3[6] * m1;
5657 r1[7] -= r3[7] * m1;
5658 m0 = r0[3];
5659 r0[4] -= r3[4] * m0;
5660 r0[5] -= r3[5] * m0;
5661 r0[6] -= r3[6] * m0;
5662 r0[7] -= r3[7] * m0;
5663
5664 /* Back substitute row 1. */
5665 m1 = r1[2];
5666 s = 1.0f / r1[1];
5667 r1[4] = s * (r1[4] - r2[4] * m1);
5668 r1[5] = s * (r1[5] - r2[5] * m1);
5669 r1[6] = s * (r1[6] - r2[6] * m1);
5670 r1[7] = s * (r1[7] - r2[7] * m1);
5671 m0 = r0[2];
5672 r0[4] -= r2[4] * m0;
5673 r0[5] -= r2[5] * m0;
5674 r0[6] -= r2[6] * m0;
5675 r0[7] -= r2[7] * m0;
5676
5677 /* Back substitute row 0. */
5678 m0 = r0[1];
5679 s = 1.0f / r0[0];
5680 r0[4] = s * (r0[4] - r1[4] * m0);
5681 r0[5] = s * (r0[5] - r1[5] * m0);
5682 r0[6] = s * (r0[6] - r1[6] * m0);
5683 r0[7] = s * (r0[7] - r1[7] * m0);
5684
5685 out->_11 = r0[4];
5686 out->_12 = r0[5];
5687 out->_13 = r0[6];
5688 out->_14 = r0[7];
5689 out->_21 = r1[4];
5690 out->_22 = r1[5];
5691 out->_23 = r1[6];
5692 out->_24 = r1[7];
5693 out->_31 = r2[4];
5694 out->_32 = r2[5];
5695 out->_33 = r2[6];
5696 out->_34 = r2[7];
5697 out->_41 = r3[4];
5698 out->_42 = r3[5];
5699 out->_43 = r3[6];
5700 out->_44 = r3[7];
5701
5702 return TRUE;
5703}
static void swap_rows(float **a, float **b)
Definition: utils.c:5493
GLdouble s
Definition: gl.h:2039
const GLfloat * m
Definition: glext.h:10848
_Check_return_ __CRT_INLINE float __CRTDECL fabsf(_In_ float x)
Definition: math.h:179
static DNS_RECORDW r3
Definition: record.c:39
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38
static FILE * out
Definition: regtests2xml.c:44

Referenced by get_normal_matrix(), shader_glsl_clip_plane_uniform(), and software_vertex_blending().

◆ invert_matrix_3d()

BOOL invert_matrix_3d ( struct wined3d_matrix out,
const struct wined3d_matrix in 
)

Definition at line 5431 of file utils.c.

5432{
5433 float pos, neg, t, det;
5434 struct wined3d_matrix temp;
5435
5436 /* Calculate the determinant of upper left 3x3 submatrix and
5437 * determine if the matrix is singular. */
5438 pos = neg = 0.0f;
5439 t = in->_11 * in->_22 * in->_33;
5440 if (t >= 0.0f)
5441 pos += t;
5442 else
5443 neg += t;
5444
5445 t = in->_21 * in->_32 * in->_13;
5446 if (t >= 0.0f)
5447 pos += t;
5448 else
5449 neg += t;
5450 t = in->_31 * in->_12 * in->_23;
5451 if (t >= 0.0f)
5452 pos += t;
5453 else
5454 neg += t;
5455
5456 t = -in->_31 * in->_22 * in->_13;
5457 if (t >= 0.0f)
5458 pos += t;
5459 else
5460 neg += t;
5461 t = -in->_21 * in->_12 * in->_33;
5462 if (t >= 0.0f)
5463 pos += t;
5464 else
5465 neg += t;
5466
5467 t = -in->_11 * in->_32 * in->_23;
5468 if (t >= 0.0f)
5469 pos += t;
5470 else
5471 neg += t;
5472
5473 det = pos + neg;
5474
5475 if (fabsf(det) < 1e-25f)
5476 return FALSE;
5477
5478 det = 1.0f / det;
5479 temp._11 = (in->_22 * in->_33 - in->_32 * in->_23) * det;
5480 temp._12 = -(in->_12 * in->_33 - in->_32 * in->_13) * det;
5481 temp._13 = (in->_12 * in->_23 - in->_22 * in->_13) * det;
5482 temp._21 = -(in->_21 * in->_33 - in->_31 * in->_23) * det;
5483 temp._22 = (in->_11 * in->_33 - in->_31 * in->_13) * det;
5484 temp._23 = -(in->_11 * in->_23 - in->_21 * in->_13) * det;
5485 temp._31 = (in->_21 * in->_32 - in->_31 * in->_22) * det;
5486 temp._32 = -(in->_11 * in->_32 - in->_31 * in->_12) * det;
5487 temp._33 = (in->_11 * in->_22 - in->_21 * in->_12) * det;
5488
5489 *out = temp;
5490 return TRUE;
5491}
GLdouble GLdouble t
Definition: gl.h:2047
GLuint in
Definition: glext.h:9616
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by get_normal_matrix(), and software_vertex_blending().

◆ is_invalid_op()

BOOL is_invalid_op ( const struct wined3d_state state,
int  stage,
enum wined3d_texture_op  op,
DWORD  arg1,
DWORD  arg2,
DWORD  arg3 
)

Definition at line 4865 of file utils.c.

4867{
4868 if (op == WINED3D_TOP_DISABLE)
4869 return FALSE;
4870 if (state->textures[stage])
4871 return FALSE;
4872
4875 return TRUE;
4878 return TRUE;
4881 return TRUE;
4882
4883 return FALSE;
4884}
UINT op
Definition: effect.c:236
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3
Definition: glext.h:9515
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
#define WINED3DTA_SELECTMASK
Definition: wined3d.h:866

Referenced by gen_ffp_frag_op(), set_tex_op(), and set_tex_op_nvrc().

◆ lookup_gl_view_class()

static GLenum lookup_gl_view_class ( GLenum  internal_format)
static

Definition at line 2682 of file utils.c.

2683{
2684 static const struct
2685 {
2686 GLenum internal_format;
2687 GLenum view_class;
2688 }
2689 view_classes[] =
2690 {
2691 /* 128-bit */
2695 /* 96-bit */
2699 /* 64-bit */
2708 /* 48-bit */
2714 /* 32-bit */
2732 /* 24-bit */
2738 /* 16-bit */
2748 /* 8-bit */
2753
2754 /* RGTC1 */
2757 /* RGTC2 */
2760
2761 /* BPTC unorm */
2764 /* BPTC float */
2767
2768 /* DXT1 RGB */
2771 /* DXT1 RGBA */
2774 /* DXT3 */
2777 /* DXT5 */
2780 };
2781
2782 unsigned int i;
2783
2784 for (i = 0; i < ARRAY_SIZE(view_classes); ++i)
2785 {
2786 if (view_classes[i].internal_format == internal_format)
2787 return view_classes[i].view_class;
2788 }
2789
2790 return GL_NONE;
2791}
#define GL_NONE
Definition: gl.h:465
#define GL_RGB16
Definition: gl.h:758
#define GL_RGB8
Definition: gl.h:755
#define GL_RGB10_A2
Definition: gl.h:763
#define GL_RGBA16
Definition: gl.h:765
#define GL_RGB10_A2UI
Definition: glext.h:2024
#define GL_R32UI
Definition: glext.h:1832
#define GL_RG16I
Definition: glext.h:1835
#define GL_R16UI
Definition: glext.h:1830
#define GL_RGB8_SNORM
Definition: glext.h:763
#define GL_R16
Definition: glext.h:1820
#define GL_R8_SNORM
Definition: glext.h:761
#define GL_COMPRESSED_RED_RGTC1
Definition: glext.h:1810
#define GL_RG16
Definition: glext.h:1822
#define GL_RGB8UI
Definition: glext.h:564
#define GL_R8
Definition: glext.h:1819
#define GL_RG16_SNORM
Definition: glext.h:766
#define GL_RG32F
Definition: glext.h:1826
#define GL_COMPRESSED_RG_RGTC2
Definition: glext.h:1812
#define GL_RG32UI
Definition: glext.h:1838
#define GL_RGB16_SNORM
Definition: glext.h:767
#define GL_RGBA16F
Definition: glext.h:524
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
Definition: glext.h:4514
#define GL_RGBA32UI
Definition: glext.h:559
#define GL_RGB16I
Definition: glext.h:568
#define GL_RG8
Definition: glext.h:1821
#define GL_RGB16F
Definition: glext.h:525
#define GL_R16I
Definition: glext.h:1829
#define GL_R8I
Definition: glext.h:1827
#define GL_R8UI
Definition: glext.h:1828
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
Definition: glext.h:3492
#define GL_RGBA16_SNORM
Definition: glext.h:768
#define GL_R16_SNORM
Definition: glext.h:765
#define GL_RG8UI
Definition: glext.h:1834
#define GL_RGB16UI
Definition: glext.h:562
#define GL_R32F
Definition: glext.h:1824
#define GL_RGB32UI
Definition: glext.h:560
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT
Definition: glext.h:3489
#define GL_SRGB8_ALPHA8
Definition: glext.h:489
#define GL_RGBA32I
Definition: glext.h:565
#define GL_RGBA16UI
Definition: glext.h:561
#define GL_RGBA16I
Definition: glext.h:567
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
Definition: glext.h:4513
#define GL_RGB9_E5
Definition: glext.h:541
#define GL_R16F
Definition: glext.h:1823
#define GL_RG8I
Definition: glext.h:1833
#define GL_R11F_G11F_B10F
Definition: glext.h:539
#define GL_COMPRESSED_SIGNED_RG_RGTC2
Definition: glext.h:1813
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
Definition: glext.h:3491
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
Definition: glext.h:3490
#define GL_RGB8I
Definition: glext.h:570
#define GL_RGB32I
Definition: glext.h:566
#define GL_RGBA32F
Definition: glext.h:522
#define GL_RG16F
Definition: glext.h:1825
#define GL_RG32I
Definition: glext.h:1837
#define GL_RG16UI
Definition: glext.h:1836
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
Definition: glext.h:4512
#define GL_RGBA8I
Definition: glext.h:569
#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
Definition: glext.h:4511
#define GL_COMPRESSED_SIGNED_RED_RGTC1
Definition: glext.h:1811
#define GL_RGB32F
Definition: glext.h:523
#define GL_RGBA8UI
Definition: glext.h:563
#define GL_RG8_SNORM
Definition: glext.h:762
#define GL_R32I
Definition: glext.h:1831
#define GL_SRGB8
Definition: glext.h:487
#define GL_RGBA8_SNORM
Definition: glext.h:764
#define GL_VIEW_CLASS_16_BITS
Definition: wgl.h:4896
#define GL_VIEW_CLASS_96_BITS
Definition: wgl.h:4902
#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
Definition: wgl.h:677
#define GL_VIEW_CLASS_S3TC_DXT1_RGB
Definition: wgl.h:4907
#define GL_VIEW_CLASS_128_BITS
Definition: wgl.h:4895
#define GL_VIEW_CLASS_S3TC_DXT5_RGBA
Definition: wgl.h:4910
#define GL_VIEW_CLASS_S3TC_DXT1_RGBA
Definition: wgl.h:4908
#define GL_VIEW_CLASS_24_BITS
Definition: wgl.h:4897
#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT
Definition: wgl.h:639
#define GL_VIEW_CLASS_8_BITS
Definition: wgl.h:4901
#define GL_VIEW_CLASS_BPTC_FLOAT
Definition: wgl.h:4903
#define GL_VIEW_CLASS_48_BITS
Definition: wgl.h:4899
#define GL_COMPRESSED_RGBA_BPTC_UNORM
Definition: wgl.h:632
#define GL_VIEW_CLASS_64_BITS
Definition: wgl.h:4900
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT
Definition: wgl.h:641
#define GL_VIEW_CLASS_BPTC_UNORM
Definition: wgl.h:4904
#define GL_VIEW_CLASS_32_BITS
Definition: wgl.h:4898
#define GL_VIEW_CLASS_RGTC1_RED
Definition: wgl.h:4905
#define GL_VIEW_CLASS_RGTC2_RG
Definition: wgl.h:4906
#define GL_VIEW_CLASS_S3TC_DXT3_RGBA
Definition: wgl.h:4909

Referenced by query_view_class().

◆ map_channel_type()

static enum wined3d_channel_type map_channel_type ( char  t)
static

Definition at line 1803 of file utils.c.

1804{
1805 switch (t)
1806 {
1807 case 'u':
1809 case 'i':
1811 case 'U':
1813 case 'I':
1815 case 'F':
1817 case 'D':
1819 case 'S':
1821 case 'X':
1823 default:
1824 ERR("Invalid channel type '%c'.\n", t);
1826 }
1827}

Referenced by init_format_base_info().

◆ multiply_matrix()

void multiply_matrix ( struct wined3d_matrix dst,
const struct wined3d_matrix src1,
const struct wined3d_matrix src2 
)

Definition at line 5401 of file utils.c.

5402{
5403 struct wined3d_matrix tmp;
5404
5405 /* Now do the multiplication 'by hand'.
5406 I know that all this could be optimised, but this will be done later :-) */
5407 tmp._11 = (src1->_11 * src2->_11) + (src1->_21 * src2->_12) + (src1->_31 * src2->_13) + (src1->_41 * src2->_14);
5408 tmp._21 = (src1->_11 * src2->_21) + (src1->_21 * src2->_22) + (src1->_31 * src2->_23) + (src1->_41 * src2->_24);
5409 tmp._31 = (src1->_11 * src2->_31) + (src1->_21 * src2->_32) + (src1->_31 * src2->_33) + (src1->_41 * src2->_34);
5410 tmp._41 = (src1->_11 * src2->_41) + (src1->_21 * src2->_42) + (src1->_31 * src2->_43) + (src1->_41 * src2->_44);
5411
5412 tmp._12 = (src1->_12 * src2->_11) + (src1->_22 * src2->_12) + (src1->_32 * src2->_13) + (src1->_42 * src2->_14);
5413 tmp._22 = (src1->_12 * src2->_21) + (src1->_22 * src2->_22) + (src1->_32 * src2->_23) + (src1->_42 * src2->_24);
5414 tmp._32 = (src1->_12 * src2->_31) + (src1->_22 * src2->_32) + (src1->_32 * src2->_33) + (src1->_42 * src2->_34);
5415 tmp._42 = (src1->_12 * src2->_41) + (src1->_22 * src2->_42) + (src1->_32 * src2->_43) + (src1->_42 * src2->_44);
5416
5417 tmp._13 = (src1->_13 * src2->_11) + (src1->_23 * src2->_12) + (src1->_33 * src2->_13) + (src1->_43 * src2->_14);
5418 tmp._23 = (src1->_13 * src2->_21) + (src1->_23 * src2->_22) + (src1->_33 * src2->_23) + (src1->_43 * src2->_24);
5419 tmp._33 = (src1->_13 * src2->_31) + (src1->_23 * src2->_32) + (src1->_33 * src2->_33) + (src1->_43 * src2->_34);
5420 tmp._43 = (src1->_13 * src2->_41) + (src1->_23 * src2->_42) + (src1->_33 * src2->_43) + (src1->_43 * src2->_44);
5421
5422 tmp._14 = (src1->_14 * src2->_11) + (src1->_24 * src2->_12) + (src1->_34 * src2->_13) + (src1->_44 * src2->_14);
5423 tmp._24 = (src1->_14 * src2->_21) + (src1->_24 * src2->_22) + (src1->_34 * src2->_23) + (src1->_44 * src2->_24);
5424 tmp._34 = (src1->_14 * src2->_31) + (src1->_24 * src2->_32) + (src1->_34 * src2->_33) + (src1->_44 * src2->_34);
5425 tmp._44 = (src1->_14 * src2->_41) + (src1->_24 * src2->_42) + (src1->_34 * src2->_43) + (src1->_44 * src2->_44);
5426
5427 *dst = tmp;
5428}

◆ pixelformat_for_depth()

enum wined3d_format_id pixelformat_for_depth ( DWORD  depth)

Definition at line 5388 of file utils.c.

5389{
5390 switch (depth)
5391 {
5392 case 8: return WINED3DFMT_P8_UINT;
5393 case 15: return WINED3DFMT_B5G5R5X1_UNORM;
5394 case 16: return WINED3DFMT_B5G6R5_UNORM;
5395 case 24: return WINED3DFMT_B8G8R8X8_UNORM; /* Robots needs 24bit to be WINED3DFMT_B8G8R8X8_UNORM */
5396 case 32: return WINED3DFMT_B8G8R8X8_UNORM; /* EVE online and the Fur demo need 32bit AdapterDisplayMode to return WINED3DFMT_B8G8R8X8_UNORM */
5397 default: return WINED3DFMT_UNKNOWN;
5398 }
5399}

Referenced by wined3d_enum_adapter_modes(), wined3d_get_adapter_display_mode(), and wined3d_set_adapter_display_mode().

◆ query_format_flag()

static void query_format_flag ( struct wined3d_gl_info gl_info,
struct wined3d_format format,
GLint  internal,
GLenum  pname,
DWORD  flag,
const char string 
)
static

Definition at line 2509 of file utils.c.

2511{
2512 GLint value;
2514
2515 for (type = 0; type < ARRAY_SIZE(format->flags); ++type)
2516 {
2517 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type), internal, pname, 1, &value);
2518 if (value == GL_FULL_SUPPORT)
2519 {
2520 TRACE("Format %s supports %s, resource type %u.\n", debug_d3dformat(format->id), string, type);
2521 format->flags[type] |= flag;
2522 }
2523 else
2524 {
2525 TRACE("Format %s doesn't support %s, resource type %u.\n", debug_d3dformat(format->id), string, type);
2526 format->flags[type] &= ~flag;
2527 }
2528 }
2529}
GLenum pname
Definition: glext.h:5645

Referenced by query_internal_format().

◆ query_internal_format()

static void query_internal_format ( struct wined3d_adapter adapter,
struct wined3d_format format,
const struct wined3d_format_texture_info texture_info,
struct wined3d_gl_info gl_info,
BOOL  srgb_write_supported,
BOOL  srgb_format 
)
static

Definition at line 2813 of file utils.c.

2816{
2817 GLint count, multisample_types[MAX_MULTISAMPLE_TYPES];
2818 unsigned int i, max_log2;
2819 GLenum target;
2820
2822 {
2823 query_format_flag(gl_info, format, format->glInternal, GL_VERTEX_TEXTURE,
2824 WINED3DFMT_FLAG_VTF, "vertex texture usage");
2825 query_format_flag(gl_info, format, format->glInternal, GL_FILTER,
2826 WINED3DFMT_FLAG_FILTERING, "filtering");
2827
2828 if (srgb_format || format->glGammaInternal != format->glInternal)
2829 {
2830 query_format_flag(gl_info, format, format->glGammaInternal, GL_SRGB_READ,
2831 WINED3DFMT_FLAG_SRGB_READ, "sRGB read");
2832
2833 if (srgb_write_supported)
2834 query_format_flag(gl_info, format, format->glGammaInternal, GL_SRGB_WRITE,
2835 WINED3DFMT_FLAG_SRGB_WRITE, "sRGB write");
2836 else
2838
2840 format->glGammaInternal = format->glInternal;
2843 format->glInternal = format->glGammaInternal;
2844 }
2845 }
2846 else
2847 {
2848 if (!gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX])
2850
2855
2856 if (srgb_format || format->glGammaInternal != format->glInternal)
2857 {
2858 /* Filter sRGB capabilities if EXT_texture_sRGB is not supported. */
2859 if (!gl_info->supported[EXT_TEXTURE_SRGB])
2860 {
2861 format->glGammaInternal = format->glInternal;
2863 }
2866 {
2867 format->glInternal = format->glGammaInternal;
2868 }
2869 }
2870
2871 if ((format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_SRGB_WRITE) && !srgb_write_supported)
2873
2874 if (!gl_info->supported[ARB_DEPTH_TEXTURE]
2876 {
2877 format->flags[WINED3D_GL_RES_TYPE_TEX_1D] &= ~WINED3DFMT_FLAG_TEXTURE;
2878 format->flags[WINED3D_GL_RES_TYPE_TEX_2D] &= ~WINED3DFMT_FLAG_TEXTURE;
2879 format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
2880 format->flags[WINED3D_GL_RES_TYPE_TEX_CUBE] &= ~WINED3DFMT_FLAG_TEXTURE;
2881 format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] &= ~WINED3DFMT_FLAG_TEXTURE;
2882 }
2883 }
2884
2886
2887 if (format->glInternal && format->flags[WINED3D_GL_RES_TYPE_RB]
2889 {
2890 if (gl_info->supported[ARB_INTERNALFORMAT_QUERY])
2891 {
2893 count = 0;
2894 GL_EXTCALL(glGetInternalformativ(target, format->glInternal,
2897 GL_EXTCALL(glGetInternalformativ(target, format->glInternal,
2898 GL_SAMPLES, count, multisample_types));
2899 checkGLcall("query sample counts");
2900 for (i = 0; i < count; ++i)
2901 {
2902 if (multisample_types[i] > sizeof(format->multisample_types) * CHAR_BIT)
2903 continue;
2904 format->multisample_types |= 1u << (multisample_types[i] - 1);
2905 }
2906 }
2907 else
2908 {
2909#ifdef __REACTOS__
2910 if (gl_info->limits.samples) {
2911#endif
2912 max_log2 = wined3d_log2i(min(gl_info->limits.samples,
2913 sizeof(format->multisample_types) * CHAR_BIT));
2914 for (i = 1; i <= max_log2; ++i)
2915 format->multisample_types |= 1u << ((1u << i) - 1);
2916#ifdef __REACTOS__
2917 }
2918#endif
2919 }
2920 }
2921}
static void query_format_flag(struct wined3d_gl_info *gl_info, struct wined3d_format *format, GLint internal, GLenum pname, DWORD flag, const char *string)
Definition: utils.c:2509
static void query_view_class(struct wined3d_format *format)
Definition: utils.c:2793
#define CHAR_BIT
Definition: urlcache.c:62
#define GL_SAMPLES
Definition: gl.h:1816
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define GL_NUM_SAMPLE_COUNTS
Definition: glext.h:2289
#define GL_TEXTURE_2D_MULTISAMPLE
Definition: glext.h:1939
GLenum target
Definition: glext.h:7315
unsigned int flags
Definition: utils.c:435
#define GL_SRGB_WRITE
Definition: wgl.h:3939
#define GL_SRGB_READ
Definition: wgl.h:3938
#define GL_FILTER
Definition: wgl.h:1291
#define GL_VERTEX_TEXTURE
Definition: wgl.h:4848
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2759
@ ARB_INTERNALFORMAT_QUERY
Definition: wined3d_gl.h:80
@ ARB_DEPTH_TEXTURE
Definition: wined3d_gl.h:59
@ ARB_TEXTURE_MULTISAMPLE
Definition: wined3d_gl.h:122
#define WINED3DFMT_FLAG_VTF
#define MAX_MULTISAMPLE_TYPES

Referenced by init_format_texture_info().

◆ query_view_class()

static void query_view_class ( struct wined3d_format format)
static

Definition at line 2793 of file utils.c.

2794{
2795 GLenum internal_view_class, gamma_view_class, rt_view_class;
2796
2797 internal_view_class = lookup_gl_view_class(format->glInternal);
2798 gamma_view_class = lookup_gl_view_class(format->glGammaInternal);
2799 rt_view_class = lookup_gl_view_class(format->rtInternal);
2800
2801 if (internal_view_class == gamma_view_class || gamma_view_class == rt_view_class)
2802 {
2803 format->gl_view_class = internal_view_class;
2804 TRACE("Format %s is member of GL view class %#x.\n",
2805 debug_d3dformat(format->id), format->gl_view_class);
2806 }
2807 else
2808 {
2809 format->gl_view_class = GL_NONE;
2810 }
2811}
static GLenum lookup_gl_view_class(GLenum internal_format)
Definition: utils.c:2682

Referenced by query_internal_format().

◆ sampler_texdim()

void sampler_texdim ( struct wined3d_context context,
const struct wined3d_state state,
DWORD  state_id 
)

Definition at line 6212 of file utils.c.

6213{
6214 DWORD sampler = state_id - STATE_SAMPLER(0);
6215 DWORD mapped_stage = context->tex_unit_map[sampler];
6216
6217 /* No need to enable / disable anything here for unused samplers. The
6218 * tex_colorop handler takes care. Also no action is needed with pixel
6219 * shaders, or if tex_colorop will take care of this business. */
6220 if (mapped_stage == WINED3D_UNMAPPED_STAGE || mapped_stage >= context->gl_info->limits.textures)
6221 return;
6222 if (sampler >= context->lowest_disabled_stage)
6223 return;
6225 return;
6226
6227 texture_activate_dimensions(state->textures[sampler], context->gl_info);
6228}
void texture_activate_dimensions(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
Definition: utils.c:6097
GLuint sampler
Definition: glext.h:7283
static BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
#define WINED3D_UNMAPPED_STAGE

◆ swap_rows()

static void swap_rows ( float **  a,
float **  b 
)
static

Definition at line 5493 of file utils.c.

5494{
5495 float *tmp = *a;
5496
5497 *a = *b;
5498 *b = tmp;
5499}

Referenced by invert_matrix().

◆ texture_activate_dimensions()

void texture_activate_dimensions ( const struct wined3d_texture texture,
const struct wined3d_gl_info gl_info 
)

Definition at line 6097 of file utils.c.

6098{
6099 if (texture)
6100 {
6101 switch (texture->target)
6102 {
6103 case GL_TEXTURE_1D:
6104 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
6105 checkGLcall("glDisable(GL_TEXTURE_2D)");
6106 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
6107 checkGLcall("glDisable(GL_TEXTURE_3D)");
6108 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
6109 {
6110 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
6111 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
6112 }
6113 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
6114 {
6115 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
6116 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
6117 }
6118 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_1D);
6119 checkGLcall("glEnable(GL_TEXTURE_1D)");
6120 break;
6121 case GL_TEXTURE_2D:
6122 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
6123 checkGLcall("glDisable(GL_TEXTURE_1D)");
6124 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
6125 checkGLcall("glDisable(GL_TEXTURE_3D)");
6126 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
6127 {
6128 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
6129 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
6130 }
6131 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
6132 {
6133 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
6134 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
6135 }
6136 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D);
6137 checkGLcall("glEnable(GL_TEXTURE_2D)");
6138 break;
6140 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
6141 checkGLcall("glDisable(GL_TEXTURE_1D)");
6142 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
6143 checkGLcall("glDisable(GL_TEXTURE_2D)");
6144 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
6145 checkGLcall("glDisable(GL_TEXTURE_3D)");
6146 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
6147 {
6148 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
6149 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
6150 }
6151 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_RECTANGLE_ARB);
6152 checkGLcall("glEnable(GL_TEXTURE_RECTANGLE_ARB)");
6153 break;
6154 case GL_TEXTURE_3D:
6155 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
6156 {
6157 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
6158 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
6159 }
6160 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
6161 {
6162 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
6163 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
6164 }
6165 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
6166 checkGLcall("glDisable(GL_TEXTURE_1D)");
6167 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
6168 checkGLcall("glDisable(GL_TEXTURE_2D)");
6169 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_3D);
6170 checkGLcall("glEnable(GL_TEXTURE_3D)");
6171 break;
6173 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
6174 checkGLcall("glDisable(GL_TEXTURE_1D)");
6175 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
6176 checkGLcall("glDisable(GL_TEXTURE_2D)");
6177 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
6178 checkGLcall("glDisable(GL_TEXTURE_3D)");
6179 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
6180 {
6181 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
6182 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
6183 }
6184 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_CUBE_MAP_ARB);
6185 checkGLcall("glEnable(GL_TEXTURE_CUBE_MAP_ARB)");
6186 break;
6187 }
6188 }
6189 else
6190 {
6191 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_1D);
6192 checkGLcall("glDisable(GL_TEXTURE_1D)");
6193 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D);
6194 checkGLcall("glEnable(GL_TEXTURE_2D)");
6195 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
6196 checkGLcall("glDisable(GL_TEXTURE_3D)");
6197 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
6198 {
6199 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
6200 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
6201 }
6202 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
6203 {
6204 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
6205 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
6206 }
6207 /* Binding textures is done by samplers. A dummy texture will be bound */
6208 }
6209}

Referenced by nvrc_colorop(), sampler_texdim(), set_tex_op_atifs(), and tex_colorop().

◆ transpose_matrix()

void transpose_matrix ( struct wined3d_matrix out,
const struct wined3d_matrix m 
)

Definition at line 5705 of file utils.c.

5706{
5707 struct wined3d_matrix temp;
5708 unsigned int i, j;
5709
5710 for (i = 0; i < 4; ++i)
5711 for (j = 0; j < 4; ++j)
5712 (&temp._11)[4 * j + i] = (&m->_11)[4 * i + j];
5713
5714 *out = temp;
5715}

Referenced by shader_glsl_clip_plane_uniform().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d  )

◆ wined3d_adapter_find_polyoffset_scale()

static float wined3d_adapter_find_polyoffset_scale ( struct wined3d_caps_gl_ctx ctx,
GLenum  format 
)
static

Definition at line 3679 of file utils.c.

3680{
3681 const struct wined3d_gl_info *gl_info = ctx->gl_info;
3682 static const struct wined3d_color blue = {0.0f, 0.0f, 1.0f, 1.0f};
3683 GLuint fbo, color, depth;
3684 unsigned int low = 0, high = 32, cur;
3685 DWORD readback[256];
3686 static const struct wined3d_vec3 geometry[] =
3687 {
3688 {-1.0f, -1.0f, -1.0f},
3689 { 1.0f, -1.0f, 0.0f},
3690 {-1.0f, 1.0f, -1.0f},
3691 { 1.0f, 1.0f, 0.0f},
3692 };
3693
3694 /* Most drivers want 2^23 for fixed point depth buffers, including r300g, r600g,
3695 * Nvidia. Use this as a fallback if the detection fails. */
3696 unsigned int fallback = 23;
3697
3699 {
3700 FIXME("No FBOs, assuming polyoffset scale of 2^%u.\n", fallback);
3701 return (float)(1u << fallback);
3702 }
3703
3704 gl_info->gl_ops.gl.p_glGenTextures(1, &color);
3705 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, color);
3706 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
3707 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 256, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
3708
3709 gl_info->fbo_ops.glGenRenderbuffers(1, &depth);
3710 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, depth);
3711 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, format, 256, 1);
3712
3713 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
3714 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
3715 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color, 0);
3716 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth);
3717 checkGLcall("Setup framebuffer");
3718
3719 gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 0.5f, 0.0f);
3720 gl_info->gl_ops.gl.p_glClearDepth(0.5f);
3721 gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_TEST);
3722 gl_info->gl_ops.gl.p_glEnable(GL_POLYGON_OFFSET_FILL);
3723 gl_info->gl_ops.gl.p_glViewport(0, 0, 256, 1);
3724 checkGLcall("Misc parameters");
3725
3726 for (;;)
3727 {
3728 if (high - low <= 1)
3729 {
3730 ERR("PolygonOffset scale factor detection failed, using fallback value 2^%u.\n", fallback);
3731 cur = fallback;
3732 break;
3733 }
3734 cur = (low + high) / 2;
3735
3736 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
3737 /* The post viewport transform Z of the geometry runs from 0.0 to 0.5. We want to push it another
3738 * 0.25 so that the Z buffer content (0.5) cuts the quad off at half the screen. */
3739 gl_info->gl_ops.gl.p_glPolygonOffset(0.0f, (float)(1u << cur) * 0.25f);
3740 draw_test_quad(ctx, geometry, &blue);
3741 checkGLcall("Test draw");
3742
3743 /* Rebinding texture to workaround a fglrx bug. */
3744 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, color);
3745 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, readback);
3746 checkGLcall("readback");
3747
3748 TRACE("low %02u, high %02u, cur %2u, 0=0x%08x, 125=0x%08x, 131=0x%08x, 255=0x%08x\n",
3749 low, high, cur, readback[0], readback[125], readback[131], readback[255]);
3750
3751 if ((readback[125] & 0xff) < 0xa0)
3752 high = cur;
3753 else if ((readback[131] & 0xff) > 0xa0)
3754 low = cur;
3755 else
3756 {
3757 TRACE("Found scale factor 2^%u for format %x.\n", cur, format);
3758 break;
3759 }
3760 }
3761
3762 gl_info->gl_ops.gl.p_glDeleteTextures(1, &color);
3763 gl_info->fbo_ops.glDeleteRenderbuffers(1, &depth);
3764 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
3765 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3766 checkGLcall("Delete framebuffer");
3767
3768 gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
3769 gl_info->gl_ops.gl.p_glDisable(GL_POLYGON_OFFSET_FILL);
3770 return (float)(1u << cur);
3771}
FxCollectionEntry * cur
#define GL_POLYGON_OFFSET_FILL
Definition: gl.h:283
#define GL_TEXTURE_MAX_LEVEL
Definition: gl.h:1504
#define GL_DEPTH_TEST
Definition: gl.h:301
GLclampf GLclampf blue
Definition: gl.h:1740
#define GL_DEPTH_BUFFER_BIT
Definition: gl.h:710

Referenced by init_format_depth_bias_scale().

◆ wined3d_adapter_init_format_info()

BOOL wined3d_adapter_init_format_info ( struct wined3d_adapter adapter,
struct wined3d_caps_gl_ctx ctx 
)

Definition at line 3803 of file utils.c.

3804{
3805 struct wined3d_gl_info *gl_info = &adapter->gl_info;
3806
3807 if (!init_format_base_info(gl_info)) return FALSE;
3808 if (!init_format_block_info(gl_info)) goto fail;
3809
3810 if (!ctx) /* WINED3D_NO3D */
3811 return TRUE;
3812
3813 if (!init_format_texture_info(adapter, gl_info)) goto fail;
3814 if (!init_format_vertex_info(gl_info)) goto fail;
3815
3816 apply_format_fixups(adapter, gl_info);
3818 init_format_filter_info(gl_info, adapter->driver_info.vendor);
3819 if (!init_typeless_formats(gl_info)) goto fail;
3822
3823 return TRUE;
3824
3825fail:
3826 heap_free(gl_info->formats);
3827 gl_info->formats = NULL;
3828 return FALSE;
3829}
static BOOL init_format_block_info(struct wined3d_gl_info *gl_info)
Definition: utils.c:1933
static void init_format_gen_mipmap_info(struct wined3d_gl_info *gl_info)
Definition: utils.c:3615
static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:2923
static BOOL init_typeless_formats(struct wined3d_gl_info *gl_info)
Definition: utils.c:3557
static BOOL init_format_vertex_info(struct wined3d_gl_info *gl_info)
Definition: utils.c:3527
static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3203
static void init_format_depth_bias_scale(struct wined3d_caps_gl_ctx *ctx, const struct wined3d_d3d_info *d3d_info)
Definition: utils.c:3773
static BOOL init_format_base_info(struct wined3d_gl_info *gl_info)
Definition: utils.c:1829
static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor)
Definition: utils.c:3137
static void init_format_fbo_compat_info(struct wined3d_caps_gl_ctx *ctx)
Definition: utils.c:2532

Referenced by wined3d_adapter_init(), and wined3d_adapter_init_nogl().

◆ wined3d_array_reserve()

BOOL wined3d_array_reserve ( void **  elements,
SIZE_T capacity,
SIZE_T  count,
SIZE_T  size 
)

Definition at line 6526 of file utils.c.

6527{
6528 SIZE_T max_capacity, new_capacity;
6529 void *new_elements;
6530
6531 if (count <= *capacity)
6532 return TRUE;
6533
6534 max_capacity = ~(SIZE_T)0 / size;
6535 if (count > max_capacity)
6536 return FALSE;
6537
6538 new_capacity = max(1, *capacity);
6539 while (new_capacity < count && new_capacity <= max_capacity / 2)
6540 new_capacity *= 2;
6541 if (new_capacity < count)
6542 new_capacity = count;
6543
6544 if (!*elements)
6545 new_elements = heap_alloc_zero(new_capacity * size);
6546 else
6547 new_elements = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *elements, new_capacity * size);
6548 if (!new_elements)
6549 return FALSE;
6550
6551 *elements = new_elements;
6552 *capacity = new_capacity;
6553 return TRUE;
6554}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by buffer_invalidate_bo_range(), context_free_fence(), context_free_occlusion_query(), context_free_pipeline_statistics_query(), context_free_so_statistics_query(), context_free_timestamp_query(), shader_record_shader_phase(), shader_reg_maps_add_tgsm(), and wined3d_register_window().

◆ wined3d_caps_gl_ctx_test_viewport_subpixel_bits()

BOOL wined3d_caps_gl_ctx_test_viewport_subpixel_bits ( struct wined3d_caps_gl_ctx ctx)

Definition at line 3632 of file utils.c.

3633{
3634 static const struct wined3d_color red = {1.0f, 0.0f, 0.0f, 1.0f};
3635 const struct wined3d_gl_info *gl_info = ctx->gl_info;
3636 static const float offset = -63.0f / 128.0f;
3637 GLuint texture, fbo;
3638 DWORD readback[4];
3639 unsigned int i;
3640
3641 gl_info->gl_ops.gl.p_glGenTextures(1, &texture);
3642 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3643 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
3644 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ARRAY_SIZE(readback), 1, 0,
3646 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
3647 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
3648 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
3650 checkGLcall("create resources");
3651
3652 gl_info->gl_ops.gl.p_glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
3653 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
3654 GL_EXTCALL(glViewportIndexedf(0, offset, offset, 4.0f, 1.0f));
3656 checkGLcall("draw");
3657
3658 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3659 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0,
3661 checkGLcall("readback");
3662
3663 TRACE("Readback colors are 0x%08x, 0x%08x, 0x%08x, 0x%08x.\n",
3664 readback[0], readback[1], readback[2], readback[3]);
3665
3666 gl_info->gl_ops.gl.p_glDeleteTextures(1, &texture);
3667 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
3668 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3669 checkGLcall("delete resources");
3670
3671 for (i = 0; i < ARRAY_SIZE(readback); ++i)
3672 {
3673 if (readback[i] != 0xffff0000)
3674 return FALSE;
3675 }
3676 return TRUE;
3677}

Referenced by match_broken_viewport_subpixel_bits().

◆ wined3d_clip_blit()

BOOL wined3d_clip_blit ( const RECT clip_rect,
RECT clipped,
RECT other 
)

Definition at line 6458 of file utils.c.

6459{
6460 RECT orig = *clipped;
6461 float scale_x = (float)(orig.right - orig.left) / (float)(other->right - other->left);
6462 float scale_y = (float)(orig.bottom - orig.top) / (float)(other->bottom - other->top);
6463
6464 IntersectRect(clipped, clipped, clip_rect);
6465
6466 if (IsRectEmpty(clipped))
6467 {
6469 return FALSE;
6470 }
6471
6472 other->left += (LONG)((clipped->left - orig.left) / scale_x);
6473 other->top += (LONG)((clipped->top - orig.top) / scale_y);
6474 other->right -= (LONG)((orig.right - clipped->right) / scale_x);
6475 other->bottom -= (LONG)((orig.bottom - clipped->bottom) / scale_y);
6476
6477 return TRUE;
6478}
static BOOL clipped
Definition: input.c:1258
int other
Definition: msacm.c:1376
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)

Referenced by swapchain_gl_present().

◆ wined3d_debug_location()

const char * wined3d_debug_location ( DWORD  location)

Definition at line 6396 of file utils.c.

6397{
6398 struct debug_buffer buffer;
6399 const char *prefix = "";
6400 const char *suffix = "";
6401
6402 if (wined3d_popcount(location) > 16)
6403 {
6404 prefix = "~(";
6406 suffix = ")";
6407 }
6408
6410#define LOCATION_TO_STR(x) if (location & x) { debug_append(&buffer, #x, " | "); location &= ~x; }
6420#undef LOCATION_TO_STR
6421 if (location)
6422 FIXME("Unrecognized location flag(s) %#x.\n", location);
6423
6424 return wine_dbg_sprintf("%s%s%s", prefix, buffer.str, suffix);
6425}
#define LOCATION_TO_STR(x)
#define WINED3D_LOCATION_TEXTURE_SRGB
#define WINED3D_LOCATION_SYSMEM
#define WINED3D_LOCATION_BUFFER
#define WINED3D_LOCATION_RB_RESOLVED
#define WINED3D_LOCATION_TEXTURE_RGB
#define WINED3D_LOCATION_USER_MEMORY
#define WINED3D_LOCATION_DRAWABLE
#define WINED3D_LOCATION_DISCARDED
#define WINED3D_LOCATION_RB_MULTISAMPLE
static unsigned int wined3d_popcount(unsigned int x)

Referenced by raw_blitter_blit(), surface_blt_fbo(), surface_convert_format(), surface_cpu_blt(), surface_cpu_blt_colour_fill(), surface_depth_blt_fbo(), surface_load_drawable(), surface_load_location(), surface_load_renderbuffer(), surface_load_sysmem(), texture1d_load_location(), texture3d_load_location(), texture_resource_sub_resource_map(), wined3d_buffer_get_memory(), wined3d_buffer_invalidate_range(), wined3d_buffer_load_location(), wined3d_buffer_prepare_location(), wined3d_buffer_validate_location(), wined3d_cs_exec_add_dirty_texture_region(), wined3d_cs_exec_blt_sub_resource(), wined3d_texture_get_memory(), wined3d_texture_invalidate_location(), wined3d_texture_load(), wined3d_texture_load_location(), wined3d_texture_prepare_location(), wined3d_texture_update_map_binding(), and wined3d_texture_validate_location().

◆ wined3d_debug_resource_access()

const char * wined3d_debug_resource_access ( DWORD  access)

Definition at line 4200 of file utils.c.

4201{
4202 struct debug_buffer buffer;
4203
4205#define ACCESS_TO_STR(x) if (access & x) { debug_append(&buffer, #x, " | "); access &= ~x; }
4210#undef ACCESS_TO_STR
4211 if (access)
4212 FIXME("Unrecognised access flag(s) %#x.\n", access);
4213
4214 return wine_dbg_sprintf("%s", buffer.str);
4215}
#define ACCESS_TO_STR(x)
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58

Referenced by resource_init(), texture1d_init(), volumetexture_init(), wined3d_texture_init(), wined3d_texture_set_lod(), and wined3d_texture_unload().

◆ wined3d_ffp_frag_program_key_compare()

int wined3d_ffp_frag_program_key_compare ( const void key,
const struct wine_rb_entry entry 
)

Definition at line 6230 of file utils.c.

6231{
6232 const struct ffp_frag_settings *ka = key;
6233 const struct ffp_frag_settings *kb = &WINE_RB_ENTRY_VALUE(entry, const struct ffp_frag_desc, entry)->settings;
6234
6235 return memcmp(ka, kb, sizeof(*ka));
6236}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: copy.c:22

Referenced by arbfp_alloc(), atifs_alloc(), and glsl_fragment_pipe_alloc().

◆ wined3d_ffp_get_vs_settings()

void wined3d_ffp_get_vs_settings ( const struct wined3d_context context,
const struct wined3d_state state,
struct wined3d_ffp_vs_settings settings 
)

Definition at line 6238 of file utils.c.

6240{
6241 const struct wined3d_stream_info *si = &context->stream_info;
6242 const struct wined3d_gl_info *gl_info = context->gl_info;
6243 const struct wined3d_d3d_info *d3d_info = context->d3d_info;
6244 unsigned int coord_idx, i;
6245
6246 memset(settings, 0, sizeof(*settings));
6247
6248 if (si->position_transformed)
6249 {
6250 settings->transformed = 1;
6251 settings->point_size = state->gl_primitive_type == GL_POINTS;
6252 settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE);
6253 if (!state->render_states[WINED3D_RS_FOGENABLE])
6254 settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
6255 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
6257 else
6259
6260 for (i = 0; i < MAX_TEXTURES; ++i)
6261 {
6262 coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6263 if (coord_idx < MAX_TEXTURES && (si->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx))))
6264 settings->texcoords |= 1u << i;
6265 settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6266 }
6267 if (d3d_info->limits.varying_count >= wined3d_max_compat_varyings(gl_info))
6268 settings->texcoords = (1u << MAX_TEXTURES) - 1;
6269
6270 if (d3d_info->emulated_flatshading)
6271 settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
6272 else
6273 settings->flatshading = FALSE;
6274
6275 settings->swizzle_map = si->swizzle_map;
6276
6277 return;
6278 }
6279
6280 switch (state->render_states[WINED3D_RS_VERTEXBLEND])
6281 {
6286 settings->vertexblends = state->render_states[WINED3D_RS_VERTEXBLEND];
6287 break;
6288 default:
6289 FIXME("Unsupported vertex blending: %d\n", state->render_states[WINED3D_RS_VERTEXBLEND]);
6290 break;
6291 }
6292
6294 {
6296 settings->sw_blending = 1;
6297 else
6298 settings->vb_indices = 1;
6299 }
6300
6301 settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
6302 && state->render_states[WINED3D_RS_CLIPPLANEENABLE];
6303 settings->normal = !!(si->use_map & (1u << WINED3D_FFP_NORMAL));
6304 settings->normalize = settings->normal && state->render_states[WINED3D_RS_NORMALIZENORMALS];
6305 settings->lighting = !!state->render_states[WINED3D_RS_LIGHTING];
6306 settings->localviewer = !!state->render_states[WINED3D_RS_LOCALVIEWER];
6307 settings->point_size = state->gl_primitive_type == GL_POINTS;
6308 settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE);
6309
6310 if (state->render_states[WINED3D_RS_COLORVERTEX] && (si->use_map & (1u << WINED3D_FFP_DIFFUSE)))
6311 {
6312 settings->diffuse_source = state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE];
6313 settings->emissive_source = state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE];
6314 settings->ambient_source = state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE];
6315 settings->specular_source = state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE];
6316 }
6317 else
6318 {
6319 settings->diffuse_source = WINED3D_MCS_MATERIAL;
6320 settings->emissive_source = WINED3D_MCS_MATERIAL;
6321 settings->ambient_source = WINED3D_MCS_MATERIAL;
6322 settings->specular_source = WINED3D_MCS_MATERIAL;
6323 }
6324
6325 for (i = 0; i < MAX_TEXTURES; ++i)
6326 {
6327 coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6328 if (coord_idx < MAX_TEXTURES && (si->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx))))
6329 settings->texcoords |= 1u << i;
6330 settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6331 }
6332 if (d3d_info->limits.varying_count >= wined3d_max_compat_varyings(gl_info))
6333 settings->texcoords = (1u << MAX_TEXTURES) - 1;
6334
6335 for (i = 0; i < MAX_ACTIVE_LIGHTS; ++i)
6336 {
6337 if (!state->lights[i])
6338 continue;
6339
6340 switch (state->lights[i]->OriginalParms.type)
6341 {
6343 ++settings->point_light_count;
6344 break;
6345 case WINED3D_LIGHT_SPOT:
6346 ++settings->spot_light_count;
6347 break;
6349 ++settings->directional_light_count;
6350 break;
6352 ++settings->parallel_point_light_count;
6353 break;
6354 default:
6355 FIXME("Unhandled light type %#x.\n", state->lights[i]->OriginalParms.type);
6356 break;
6357 }
6358 }
6359
6360 if (!state->render_states[WINED3D_RS_FOGENABLE])
6361 settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
6362 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
6363 {
6365
6366 if (state->transforms[WINED3D_TS_PROJECTION]._14 == 0.0f
6367 && state->transforms[WINED3D_TS_PROJECTION]._24 == 0.0f
6368 && state->transforms[WINED3D_TS_PROJECTION]._34 == 0.0f
6369 && state->transforms[WINED3D_TS_PROJECTION]._44 == 1.0f)
6370 settings->ortho_fog = 1;
6371 }
6372 else if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE)
6374 else if (state->render_states[WINED3D_RS_RANGEFOGENABLE])
6376 else
6378
6379 if (d3d_info->emulated_flatshading)
6380 settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
6381 else
6382 settings->flatshading = FALSE;
6383
6384 settings->swizzle_map = si->swizzle_map;
6385}
@ WINED3D_MCS_MATERIAL
Definition: wined3d.h:512
@ WINED3D_LIGHT_SPOT
Definition: wined3d.h:63
@ WINED3D_LIGHT_PARALLELPOINT
Definition: wined3d.h:65
@ WINED3D_LIGHT_POINT
Definition: wined3d.h:62
@ WINED3D_LIGHT_DIRECTIONAL
Definition: wined3d.h:64
@ WINED3D_VBF_1WEIGHTS
Definition: wined3d.h:443
@ WINED3D_VBF_DISABLE
Definition: wined3d.h:442
@ WINED3D_VBF_3WEIGHTS
Definition: wined3d.h:445
@ WINED3D_VBF_2WEIGHTS
Definition: wined3d.h:444
static BOOL use_indexed_vertex_blending(const struct wined3d_state *state, const struct wined3d_stream_info *si)
@ WINED3D_FFP_PSIZE
@ WINED3D_FFP_NORMAL
@ WINED3D_FFP_DIFFUSE
static BOOL use_software_vertex_processing(const struct wined3d_device *device)
#define MAX_ACTIVE_LIGHTS
@ WINED3D_FFP_VS_FOG_FOGCOORD
@ WINED3D_FFP_VS_FOG_OFF
@ WINED3D_FFP_VS_FOG_DEPTH
@ WINED3D_FFP_VS_FOG_RANGE

Referenced by set_glsl_shader_program().

◆ wined3d_ffp_vertex_program_key_compare()

int wined3d_ffp_vertex_program_key_compare ( const void key,
const struct wine_rb_entry entry 
)

Definition at line 6387 of file utils.c.

6388{
6389 const struct wined3d_ffp_vs_settings *ka = key;
6391 const struct wined3d_ffp_vs_desc, entry)->settings;
6392
6393 return memcmp(ka, kb, sizeof(*ka));
6394}

Referenced by glsl_vertex_pipe_vp_alloc().

◆ wined3d_format_calculate_pitch()

void wined3d_format_calculate_pitch ( const struct wined3d_format format,
unsigned int  alignment,
unsigned int  width,
unsigned int  height,
unsigned int row_pitch,
unsigned int slice_pitch 
)

Definition at line 3876 of file utils.c.

3878{
3879 /* For block based formats, pitch means the amount of bytes to the next
3880 * row of blocks rather than the next row of pixels. */
3882 {
3883 unsigned int row_block_count = (width + format->block_width - 1) / format->block_width;
3884 unsigned int slice_block_count = (height + format->block_height - 1) / format->block_height;
3885 *row_pitch = row_block_count * format->block_byte_count;
3886 *row_pitch = (*row_pitch + alignment - 1) & ~(alignment - 1);
3887 *slice_pitch = *row_pitch * slice_block_count;
3888 }
3889 else
3890 {
3891 *row_pitch = format->byte_count * width; /* Bytes / row */
3892 *row_pitch = (*row_pitch + alignment - 1) & ~(alignment - 1);
3893 *slice_pitch = *row_pitch * height;
3894 }
3895
3897 {
3898 /* The D3D format requirements make sure that the resulting format is an integer again */
3899 *slice_pitch *= format->height_scale.numerator;
3900 *slice_pitch /= format->height_scale.denominator;
3901 }
3902
3903 TRACE("Returning row pitch %u, slice pitch %u.\n", *row_pitch, *slice_pitch);
3904}

Referenced by surface_download_data(), surface_load_texture(), wined3d_calculate_format_pitch(), wined3d_format_calculate_size(), wined3d_surface_upload_data(), wined3d_texture_get_pitch(), and wined3d_texture_update_desc().

◆ wined3d_format_calculate_size()

UINT wined3d_format_calculate_size ( const struct wined3d_format format,
UINT  alignment,
UINT  width,
UINT  height,
UINT  depth 
)

Definition at line 3906 of file utils.c.

3908{
3909 unsigned int row_pitch, slice_pitch;
3910
3911 if (format->id == WINED3DFMT_UNKNOWN)
3912 return 0;
3913
3915 return width * height * depth * format->byte_count;
3916
3917 wined3d_format_calculate_pitch(format, alignment, width, height, &row_pitch, &slice_pitch);
3918
3919 return slice_pitch * depth;
3920}
void wined3d_format_calculate_pitch(const struct wined3d_format *format, unsigned int alignment, unsigned int width, unsigned int height, unsigned int *row_pitch, unsigned int *slice_pitch)
Definition: utils.c:3876
#define WINED3DFMT_FLAG_BROKEN_PITCH

Referenced by wined3d_texture_init(), and wined3d_texture_update_desc().

◆ wined3d_format_convert_from_float()

DWORD wined3d_format_convert_from_float ( const struct wined3d_format format,
const struct wined3d_color color 
)

Definition at line 5227 of file utils.c.

5228{
5229 static const struct
5230 {
5232 struct wined3d_vec4 mul;
5233 struct wined3d_uvec4 shift;
5234 }
5235 float_conv[] =
5236 {
5237 {WINED3DFMT_B8G8R8A8_UNORM, { 255.0f, 255.0f, 255.0f, 255.0f}, {16, 8, 0, 24}},
5238 {WINED3DFMT_B8G8R8X8_UNORM, { 255.0f, 255.0f, 255.0f, 255.0f}, {16, 8, 0, 24}},
5239 {WINED3DFMT_B8G8R8_UNORM, { 255.0f, 255.0f, 255.0f, 255.0f}, {16, 8, 0, 24}},
5240 {WINED3DFMT_B5G6R5_UNORM, { 31.0f, 63.0f, 31.0f, 0.0f}, {11, 5, 0, 0}},
5241 {WINED3DFMT_B5G5R5A1_UNORM, { 31.0f, 31.0f, 31.0f, 1.0f}, {10, 5, 0, 15}},
5242 {WINED3DFMT_B5G5R5X1_UNORM, { 31.0f, 31.0f, 31.0f, 1.0f}, {10, 5, 0, 15}},
5243 {WINED3DFMT_R8_UNORM, { 255.0f, 0.0f, 0.0f, 0.0f}, { 0, 0, 0, 0}},
5244 {WINED3DFMT_A8_UNORM, { 0.0f, 0.0f, 0.0f, 255.0f}, { 0, 0, 0, 0}},
5245 {WINED3DFMT_B4G4R4A4_UNORM, { 15.0f, 15.0f, 15.0f, 15.0f}, { 8, 4, 0, 12}},
5246 {WINED3DFMT_B4G4R4X4_UNORM, { 15.0f, 15.0f, 15.0f, 15.0f}, { 8, 4, 0, 12}},
5247 {WINED3DFMT_B2G3R3_UNORM, { 7.0f, 7.0f, 3.0f, 0.0f}, { 5, 2, 0, 0}},
5248 {WINED3DFMT_R8G8B8A8_UNORM, { 255.0f, 255.0f, 255.0f, 255.0f}, { 0, 8, 16, 24}},
5249 {WINED3DFMT_R8G8B8X8_UNORM, { 255.0f, 255.0f, 255.0f, 255.0f}, { 0, 8, 16, 24}},
5250 {WINED3DFMT_B10G10R10A2_UNORM, { 1023.0f, 1023.0f, 1023.0f, 3.0f}, {20, 10, 0, 30}},
5251 {WINED3DFMT_R10G10B10A2_UNORM, { 1023.0f, 1023.0f, 1023.0f, 3.0f}, { 0, 10, 20, 30}},
5252 {WINED3DFMT_P8_UINT, { 0.0f, 0.0f, 0.0f, 255.0f}, { 0, 0, 0, 0}},
5253 {WINED3DFMT_S1_UINT_D15_UNORM, { 32767.0f, 0.0f, 0.0f, 0.0f}, { 0, 0, 0, 0}},
5254 {WINED3DFMT_D16_UNORM, { 65535.0f, 0.0f, 0.0f, 0.0f}, { 0, 0, 0, 0}},
5255 };
5256 static const struct
5257 {
5259 struct wined3d_dvec4 mul;
5260 struct wined3d_uvec4 shift;
5261 }
5262 double_conv[] =
5263 {
5264 {WINED3DFMT_D24_UNORM_S8_UINT, { 16777215.0, 1.0, 0.0, 0.0}, {8, 0, 0, 0}},
5265 {WINED3DFMT_X8D24_UNORM, { 16777215.0, 0.0, 0.0, 0.0}, {0, 0, 0, 0}},
5266 {WINED3DFMT_D32_UNORM, {4294967295.0, 0.0, 0.0, 0.0}, {0, 0, 0, 0}},
5267 };
5268 unsigned int i;
5269 DWORD ret;
5270
5271 TRACE("Converting color %s to format %s.\n", debug_color(color), debug_d3dformat(format->id));
5272
5273 for (i = 0; i < ARRAY_SIZE(float_conv); ++i)
5274 {
5275 if (format->id != float_conv[i].format_id)
5276 continue;
5277
5278 ret = ((DWORD)((color->r * float_conv[i].mul.x) + 0.5f)) << float_conv[i].shift.x;
5279 ret |= ((DWORD)((color->g * float_conv[i].mul.y) + 0.5f)) << float_conv[i].shift.y;
5280 ret |= ((DWORD)((color->b * float_conv[i].mul.z) + 0.5f)) << float_conv[i].shift.z;
5281 ret |= ((DWORD)((color->a * float_conv[i].mul.w) + 0.5f)) << float_conv[i].shift.w;
5282
5283 TRACE("Returning 0x%08x.\n", ret);
5284
5285 return ret;
5286 }
5287
5288 for (i = 0; i < ARRAY_SIZE(double_conv); ++i)
5289 {
5290 if (format->id != double_conv[i].format_id)
5291 continue;
5292
5293 ret = ((DWORD)((color->r * double_conv[i].mul.x) + 0.5)) << double_conv[i].shift.x;
5294 ret |= ((DWORD)((color->g * double_conv[i].mul.y) + 0.5)) << double_conv[i].shift.y;
5295 ret |= ((DWORD)((color->b * double_conv[i].mul.z) + 0.5)) << double_conv[i].shift.z;
5296 ret |= ((DWORD)((color->a * double_conv[i].mul.w) + 0.5)) << double_conv[i].shift.w;
5297
5298 TRACE("Returning 0x%08x.\n", ret);
5299
5300 return ret;
5301 }
5302
5303 FIXME("Conversion for format %s not implemented.\n", debug_d3dformat(format->id));
5304
5305 return 0;
5306}
const char * debug_color(const struct wined3d_color *color)
Definition: utils.c:3948
#define shift
Definition: input.c:1755
#define mul(aa, bb)
Definition: mvAesAlg.c:25

Referenced by surface_cpu_blt_colour_fill().

◆ wined3d_format_get_color_key_conversion()

const struct wined3d_color_key_conversion * wined3d_format_get_color_key_conversion ( const struct wined3d_texture texture,
BOOL  need_alpha_ck 
)

Definition at line 1046 of file utils.c.

1048{
1049 const struct wined3d_format *format = texture->resource.format;
1050 unsigned int i;
1051
1052 static const struct
1053 {
1054 enum wined3d_format_id src_format;
1055 struct wined3d_color_key_conversion conversion;
1056 }
1057 color_key_info[] =
1058 {
1064 };
1065 static const struct wined3d_color_key_conversion convert_p8 =
1066 {
1068 };
1069
1070 if (need_alpha_ck && (texture->async.flags & WINED3D_TEXTURE_ASYNC_COLOR_KEY))
1071 {
1072 for (i = 0; i < ARRAY_SIZE(color_key_info); ++i)
1073 {
1074 if (color_key_info[i].src_format == format->id)
1075 return &color_key_info[i].conversion;
1076 }
1077
1078 FIXME("Color-keying not supported with format %s.\n", debug_d3dformat(format->id));
1079 }
1080
1081 /* FIXME: This should check if the blitter backend can do P8 conversion,
1082 * instead of checking for ARB_fragment_program. */
1083 if (format->id == WINED3DFMT_P8_UINT
1084 && !(texture->resource.device->adapter->gl_info.supported[ARB_FRAGMENT_PROGRAM]
1085 && texture->swapchain && texture == texture->swapchain->front_buffer))
1086 return &convert_p8;
1087
1088 return NULL;
1089}
static void convert_p8_uint_b8g8r8a8_unorm(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
Definition: utils.c:898
static void convert_b8g8r8x8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
Definition: utils.c:1001
static void convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
Definition: utils.c:980
static void convert_b8g8r8a8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
Definition: utils.c:1024
static void convert_b5g6r5_unorm_b5g5r5a1_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
Definition: utils.c:934
static void convert_b5g5r5x1_unorm_b5g5r5a1_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_palette *palette, const struct wined3d_color_key *color_key)
Definition: utils.c:957
#define WINED3D_TEXTURE_ASYNC_COLOR_KEY

Referenced by surface_load_texture(), texture2d_prepare_texture(), and wined3d_surface_blt().

◆ wined3d_format_get_float_color_key()

void wined3d_format_get_float_color_key ( const struct wined3d_format format,
const struct wined3d_color_key key,
struct wined3d_color float_colors 
)

Definition at line 5321 of file utils.c.

5323{
5324 struct wined3d_color slop;
5325
5326 switch (format->id)
5327 {
5346 slop.r = 0.5f / ((1u << format->red_size) - 1);
5347 slop.g = 0.5f / ((1u << format->green_size) - 1);
5348 slop.b = 0.5f / ((1u << format->blue_size) - 1);
5349 slop.a = 0.5f / ((1u << format->alpha_size) - 1);
5350
5351 float_colors[0].r = color_to_float(key->color_space_low_value, format->red_size, format->red_offset)
5352 - slop.r;
5353 float_colors[0].g = color_to_float(key->color_space_low_value, format->green_size, format->green_offset)
5354 - slop.g;
5355 float_colors[0].b = color_to_float(key->color_space_low_value, format->blue_size, format->blue_offset)
5356 - slop.b;
5357 float_colors[0].a = color_to_float(key->color_space_low_value, format->alpha_size, format->alpha_offset)
5358 - slop.a;
5359
5360 float_colors[1].r = color_to_float(key->color_space_high_value, format->red_size, format->red_offset)
5361 + slop.r;
5362 float_colors[1].g = color_to_float(key->color_space_high_value, format->green_size, format->green_offset)
5363 + slop.g;
5364 float_colors[1].b = color_to_float(key->color_space_high_value, format->blue_size, format->blue_offset)
5365 + slop.b;
5366 float_colors[1].a = color_to_float(key->color_space_high_value, format->alpha_size, format->alpha_offset)
5367 + slop.a;
5368 break;
5369
5370 case WINED3DFMT_P8_UINT:
5371 float_colors[0].r = 0.0f;
5372 float_colors[0].g = 0.0f;
5373 float_colors[0].b = 0.0f;
5374 float_colors[0].a = (key->color_space_low_value - 0.5f) / 255.0f;
5375
5376 float_colors[1].r = 0.0f;
5377 float_colors[1].g = 0.0f;
5378 float_colors[1].b = 0.0f;
5379 float_colors[1].a = (key->color_space_high_value + 0.5f) / 255.0f;
5380 break;
5381
5382 default:
5383 ERR("Unhandled color key to float conversion for format %s.\n", debug_d3dformat(format->id));
5384 }
5385}
static float color_to_float(DWORD color, DWORD size, DWORD offset)
Definition: utils.c:5308

Referenced by arbfp_blit_set(), color_key_arbfp(), and shader_glsl_load_color_key_constant().

◆ wined3d_format_is_depth_view()

BOOL wined3d_format_is_depth_view ( enum wined3d_format_id  resource_format_id,
enum wined3d_format_id  view_format_id 
)

Definition at line 3863 of file utils.c.

3865{
3866 unsigned int i;
3867
3869 {
3870 if (typeless_depth_stencil_formats[i].typeless_id == resource_format_id)
3871 return typeless_depth_stencil_formats[i].depth_view_id == view_format_id;
3872 }
3873 return FALSE;
3874}

Referenced by wined3d_shader_resource_view_cs_init().

◆ wined3d_formats_are_srgb_variants()

BOOL wined3d_formats_are_srgb_variants ( enum wined3d_format_id  format1,
enum wined3d_format_id  format2 
)

Definition at line 3922 of file utils.c.

3923{
3924 unsigned int i;
3925
3926 for (i = 0; i < ARRAY_SIZE(format_srgb_info); ++i)
3927 {
3928 if (format1 == format_srgb_info[i].srgb_format_id)
3929 return format2 == format_srgb_info[i].base_format_id;
3930 if (format1 == format_srgb_info[i].base_format_id)
3931 return format2 == format_srgb_info[i].srgb_format_id;
3932 }
3933 return FALSE;
3934}

Referenced by validate_resource_view().

◆ wined3d_ftoa()

void wined3d_ftoa ( float  value,
char s 
)

Definition at line 6429 of file utils.c.

6430{
6431 int idx = 1;
6432
6433 if (copysignf(1.0f, value) < 0.0f)
6434 ++idx;
6435
6436 /* Be sure to allocate a buffer of at least 17 characters for the result
6437 as sprintf may return a 3 digit exponent when using the MSVC runtime
6438 instead of a 2 digit exponent. */
6439 sprintf(s, "%.8e", value);
6440 if (isfinite(value))
6441 s[idx] = '.';
6442}
float __cdecl copysignf(float, float)
#define isfinite(x)
Definition: mingw_math.h:91
#define sprintf(buf, format,...)
Definition: sprintf.c:55

Referenced by shader_arb_append_imm_vec4(), shader_arb_generate_pshader(), shader_arb_generate_vshader(), shader_glsl_append_imm_vec4(), and shader_glsl_get_register_name().

◆ wined3d_get_format()

const struct wined3d_format * wined3d_get_format ( const struct wined3d_gl_info gl_info,
enum wined3d_format_id  format_id,
unsigned int  resource_usage 
)

Definition at line 3831 of file utils.c.

3833{
3834 const struct wined3d_format *format;
3836 unsigned int i;
3837
3838 if (idx == -1)
3839 {
3840 FIXME("Can't find format %s (%#x) in the format lookup table.\n",
3842 return &gl_info->formats[get_format_idx(WINED3DFMT_UNKNOWN)];
3843 }
3844
3845 format = &gl_info->formats[idx];
3846
3848 {
3850 {
3852 return &gl_info->formats[WINED3D_FORMAT_COUNT + i];
3853 }
3854
3855 FIXME("Cannot find depth/stencil typeless format %s (%#x).\n",
3857 return &gl_info->formats[get_format_idx(WINED3DFMT_UNKNOWN)];
3858 }
3859
3860 return format;
3861}
static BOOL wined3d_format_is_typeless(const struct wined3d_format *format)

Referenced by append_decl_element(), buffer_init(), context_create(), surface_load_texture(), texture2d_prepare_texture(), texture_init(), validate_resource_view(), vertexdeclaration_init(), wined3d_calculate_format_pitch(), wined3d_check_depth_stencil_match(), wined3d_check_device_format(), wined3d_check_device_multisample_type(), wined3d_enum_adapter_modes(), wined3d_get_adapter_mode_count(), wined3d_set_adapter_display_mode(), wined3d_swapchain_apply_sample_count_override(), wined3d_swapchain_cs_init(), wined3d_texture_create(), wined3d_texture_init(), and wined3d_texture_update_desc().

◆ wined3d_gl_limits_get_texture_unit_range()

void wined3d_gl_limits_get_texture_unit_range ( const struct wined3d_gl_limits gl_limits,
enum wined3d_shader_type  shader_type,
unsigned int base,
unsigned int count 
)

Definition at line 6498 of file utils.c.

6500{
6501 unsigned int i;
6502
6504 {
6505 if (gl_limits->combined_samplers == gl_limits->graphics_samplers)
6506 *base = 0;
6507 else
6508 *base = gl_limits->graphics_samplers;
6510 return;
6511 }
6512
6513 *base = 0;
6514 for (i = 0; i < WINED3D_SHADER_TYPE_GRAPHICS_COUNT; ++i)
6515 {
6516 *count = gl_limits->samplers[i];
6517 if (i == shader_type)
6518 return;
6519 *base += *count;
6520 }
6521
6522 ERR("Unrecognized shader type %#x.\n", shader_type);
6523 *count = 0;
6524}
unsigned int samplers[WINED3D_SHADER_TYPE_COUNT]
unsigned int graphics_samplers
unsigned int combined_samplers
@ WINED3D_SHADER_TYPE_GRAPHICS_COUNT

Referenced by context_create(), and context_get_tex_unit_mapping().

◆ wined3d_gl_limits_get_uniform_block_range()

void wined3d_gl_limits_get_uniform_block_range ( const struct wined3d_gl_limits gl_limits,
enum wined3d_shader_type  shader_type,
unsigned int base,
unsigned int count 
)

Definition at line 6480 of file utils.c.

6482{
6483 unsigned int i;
6484
6485 *base = 0;
6486 for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
6487 {
6488 *count = gl_limits->uniform_blocks[i];
6489 if (i == shader_type)
6490 return;
6491 *base += *count;
6492 }
6493
6494 ERR("Unrecognized shader type %#x.\n", shader_type);
6495 *count = 0;
6496}
unsigned int uniform_blocks[WINED3D_SHADER_TYPE_COUNT]
@ WINED3D_SHADER_TYPE_COUNT

Referenced by shader_generate_glsl_declarations(), shader_glsl_init_uniform_block_bindings(), and state_cb().

◆ wined3d_gl_type_to_enum()

static GLenum wined3d_gl_type_to_enum ( enum wined3d_gl_resource_type  type)
static

Definition at line 1954 of file utils.c.

1955{
1956 switch (type)
1957 {
1959 return GL_TEXTURE_1D;
1961 return GL_TEXTURE_2D;
1963 return GL_TEXTURE_3D;
1969 return GL_TEXTURE_2D; /* TODO: GL_TEXTURE_BUFFER. */
1971 return GL_RENDERBUFFER;
1973 break;
1974 }
1975 ERR("Unexpected GL resource type %u.\n", type);
1976 return 0;
1977}

Referenced by check_fbo_compat(), create_and_bind_fbo_attachment(), init_format_fbo_compat_info(), and query_format_flag().

◆ wined3d_max_compat_varyings()

unsigned int wined3d_max_compat_varyings ( const struct wined3d_gl_info gl_info)

Definition at line 5744 of file utils.c.

5745{
5746 /* On core profile we have to also count diffuse and specular colors and the
5747 * fog coordinate. */
5748 return gl_info->supported[WINED3D_GL_LEGACY_CONTEXT] ? MAX_TEXTURES * 4 : (MAX_TEXTURES + 2) * 4 + 1;
5749}

Referenced by find_ps_compile_args(), gen_ffp_frag_op(), glsl_fragment_pipe_vdecl(), glsl_fragment_pipe_vs(), glsl_vertex_pipe_vdecl(), shader_glsl_generate_ffp_vertex_shader(), shader_glsl_generate_vs3_rasterizer_input_setup(), and wined3d_ffp_get_vs_settings().

◆ wined3d_release_dc()

void wined3d_release_dc ( HWND  window,
HDC  dc 
)

Definition at line 6444 of file utils.c.

6445{
6446 /* You'd figure ReleaseDC() would fail if the DC doesn't match the window.
6447 * However, that's not what actually happens, and there are user32 tests
6448 * that confirm ReleaseDC() with the wrong window is supposed to succeed.
6449 * So explicitly check that the DC belongs to the window, since we want to
6450 * avoid releasing a DC that belongs to some other window if the original
6451 * window was already destroyed. */
6452 if (WindowFromDC(dc) != window)
6453 WARN("DC %p does not belong to window %p.\n", dc, window);
6454 else if (!ReleaseDC(window, dc))
6455 ERR("Failed to release device context %p, last error %#x.\n", dc, GetLastError());
6456}
static const WCHAR dc[]
static IHTMLWindow2 * window
Definition: events.c:77
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND WINAPI WindowFromDC(_In_ HDC hDC)

Referenced by context_create(), context_destroy_gl_resources(), context_update_window(), swapchain_cleanup(), and wined3d_caps_gl_ctx_destroy().

◆ x8_d24_unorm_download()

static void x8_d24_unorm_download ( const BYTE src,
BYTE dst,
unsigned int  src_row_pitch,
unsigned int  src_slice_pitch,
unsigned int  dst_row_pitch,
unsigned int  dst_slice_pitch,
unsigned int  width,
unsigned int  height,
unsigned int  depth 
)
static

Definition at line 868 of file utils.c.

872{
873 unsigned int x, y, z;
874
875 for (z = 0; z < depth; ++z)
876 {
877 for (y = 0; y < height; ++y)
878 {
879 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
880 DWORD *dest = (DWORD *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
881
882 for (x = 0; x < width; ++x)
883 {
884 dest[x] = source[x] >> 8;
885 }
886 }
887 }
888}

◆ x8_d24_unorm_upload()

static void x8_d24_unorm_upload ( const BYTE src,
BYTE dst,
unsigned int  src_row_pitch,
unsigned int  src_slice_pitch,
unsigned int  dst_row_pitch,
unsigned int  dst_slice_pitch,
unsigned int  width,
unsigned int  height,
unsigned int  depth 
)
static

Definition at line 846 of file utils.c.

850{
851 unsigned int x, y, z;
852
853 for (z = 0; z < depth; ++z)
854 {
855 for (y = 0; y < height; ++y)
856 {
857 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
858 DWORD *dest = (DWORD *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
859
860 for (x = 0; x < width; ++x)
861 {
862 dest[x] = source[x] << 8 | ((source[x] >> 16) & 0xff);
863 }
864 }
865 }
866}

Variable Documentation

◆ ddi_formats

const struct wined3d_format_ddi_info ddi_formats[]
static
Initial value:
=
{
{WINED3DFMT_B8G8R8_UNORM, D3DDDIFMT_R8G8B8},
{WINED3DFMT_B8G8R8A8_UNORM, D3DDDIFMT_A8R8G8B8},
{WINED3DFMT_B8G8R8X8_UNORM, D3DDDIFMT_X8R8G8B8},
{WINED3DFMT_B5G6R5_UNORM, D3DDDIFMT_R5G6B5},
{WINED3DFMT_B5G5R5X1_UNORM, D3DDDIFMT_X1R5G5B5},
{WINED3DFMT_B5G5R5A1_UNORM, D3DDDIFMT_A1R5G5B5},
{WINED3DFMT_B4G4R4A4_UNORM, D3DDDIFMT_A4R4G4B4},
{WINED3DFMT_B4G4R4X4_UNORM, D3DDDIFMT_X4R4G4B4},
{WINED3DFMT_P8_UINT, D3DDDIFMT_P8},
}

Definition at line 309 of file utils.c.

Referenced by init_format_base_info().

◆ format_base_flags

◆ format_block_info

const struct wined3d_format_block_info format_block_info[]
static
Initial value:
=
{
{WINED3DFMT_DXT1, 4, 4, 8, TRUE},
{WINED3DFMT_DXT2, 4, 4, 16, TRUE},
{WINED3DFMT_DXT3, 4, 4, 16, TRUE},
{WINED3DFMT_DXT4, 4, 4, 16, TRUE},
{WINED3DFMT_DXT5, 4, 4, 16, TRUE},
{WINED3DFMT_BC2_UNORM, 4, 4, 16, TRUE},
{WINED3DFMT_BC3_UNORM, 4, 4, 16, TRUE},
{WINED3DFMT_BC5_UNORM, 4, 4, 16, TRUE},
{WINED3DFMT_BC5_SNORM, 4, 4, 16, TRUE},
{WINED3DFMT_BC6H_UF16, 4, 4, 16, TRUE},
{WINED3DFMT_BC6H_SF16, 4, 4, 16, TRUE},
{WINED3DFMT_BC7_UNORM, 4, 4, 16, TRUE},
{WINED3DFMT_ATI1N, 4, 4, 8, FALSE},
{WINED3DFMT_ATI2N, 4, 4, 16, FALSE},
{WINED3DFMT_YUY2, 2, 1, 4, FALSE},
{WINED3DFMT_UYVY, 2, 1, 4, FALSE},
}

Definition at line 354 of file utils.c.

Referenced by init_format_block_info().

◆ 

◆ format_srgb_info

◆ format_texture_info

const struct wined3d_format_texture_info format_texture_info[]
static

Definition at line 1114 of file utils.c.

Referenced by init_format_texture_info().

◆ format_vertex_info

const struct wined3d_format_vertex_info format_vertex_info[]
static

Definition at line 387 of file utils.c.

Referenced by init_format_vertex_info().

◆ formats

Definition at line 81 of file utils.c.

Referenced by init_format_base_info().

◆ id

Definition at line 40 of file utils.c.

Referenced by copy_format().

◆ idx

Definition at line 41 of file utils.c.

Referenced by _get_child_item(), _test_file_access(), _test_select_selidx(), FileChildWindow::activate_entry(), add_dispinterface_typeinfo(), add_enum_typeinfo(), add_func_desc(), add_interface_typeinfo(), add_module_typeinfo(), add_structure_typeinfo(), add_union_typeinfo(), addItem(), CRegFolderEnum::AddItemsFromKey(), AdvancedDlgProc(), af_face_globals_compute_style_coverage(), af_glyph_hints_reload(), af_shaper_get_elem(), alloc_device(), append_decl_element(), apply_format_fixups(), Arguments_idx_get(), Arguments_idx_put(), Array_slice(), assembly_get_external_files(), assembly_get_pubkey_token(), AtapiDmaInit(), AutomationObject_GetIDsOfNames(), AVIFILE_SaveIndex(), CEnumMergedFolder::Begin(), buffer_process_converted_attribute(), cache_bump_bitmap(), cache_evict_bitmap(), cache_get_bitmap(), cache_get_brush_data(), cache_put_bitmap(), cache_put_brush_data(), cache_rebuild_bmpcache_linked_list(), cache_save_state(), CBUpdateLBox(), CDevSettings_EnumAllModes(), cf2_arrstack_getPointer(), cf2_doFlex(), cf2_initGlobalRegionBuffer(), cf2_initLocalRegionBuffer(), cf2_interpT2CharString(), cf2_stack_getReal(), cf2_stack_roll(), cf2_stack_setReal(), cff_blend_build_vector(), cff_face_init(), cff_font_done(), cff_font_load(), cff_index_access_element(), cff_index_done(), cff_index_forget_element(), cff_index_get_name(), cff_index_get_pointers(), cff_index_init(), cff_index_load_offsets(), cff_index_read_offset(), cff_subfont_load(), CFn_WMCommand(), CFn_WMDrawItem(), CMenuToolbarBase::ChangeTrackedItem(), check_bits(), check_product_patches(), check_system_palette_entries(), check_vertical_metrics(), chmc_pmgi_add_entry(), chmc_pmgl_add_entry(), CHSourceDlgProc(), ClassInitializeDispatchTables(), cmp_sorttab_addr(), codeview_jump_to_type(), FileChildWindow::collapse_entry(), COMBO_GetText(), COMBO_GetTextA(), COMBO_GetTextW(), FileChildWindow::Command(), compare_FindGlyph(), compute_method_indexes(), context_apply_draw_state(), context_attach_surface_fbo(), context_invalidate_state(), context_preload_texture(), context_set_fbo_key_for_render_target(), context_set_tls_idx(), Control_RegisterRegistryApplets(), convert_fvf_to_declaration(), Pane::create_header(), CreateShortcut(), d3d9_device_GetRenderTarget(), d3d9_device_SetRenderTarget(), d3d_device7_GetClipPlane(), d3d_device7_GetClipPlane_FPUPreserve(), d3d_device7_GetClipPlane_FPUSetup(), d3d_device7_SetClipPlane(), d3d_device7_SetClipPlane_FPUPreserve(), d3d_device7_SetClipPlane_FPUSetup(), D3DXDeclaratorFromFVF(), dataformat_to_odf(), dbgstr_longlong(), dde_connect(), ddraw_allocate_handle(), delete_test_key(), delItem(), device_invalidate_state(), dir_sdi(), DispatchEx_GetMemberName(), DispatchEx_GetNextDispID(), DispatchEx_InvokeEx(), RdpClientUI::Display_DoGlyph(), DisplayParameter(), DisplayScreen(), ensure_useragent(), enum_components(), enum_compressors(), enum_patches(), enum_products(), CCharMapWindow::EnumDisplayFont(), EnumFontNames(), enumFontProc(), FileChildWindow::expand_entry(), expect(), Entry::extract_icon(), FaceNameList_Initialize(), fetch_machine_component(), fetch_machine_product(), fetch_user_component(), fetch_user_product(), FileChildWindow::FileChildWindow(), fill_pnpentity(), FilterMapper_EnumMatchingFilters(), find_color_in_colortbl(), find_font_in_fonttbl(), find_insert_index(), find_loop_control_values(), find_prop_name(), find_registry_key(), FontSizeList_SelectFontSize(), FormatBufferFat(), free_pp_entry(), FT_Get_PS_Font_Value(), ft_list_get_node_at(), ft_stroke_border_export(), FT_Trace_Get_Name(), FTC_Manager_Done(), g2s(), gen_proxy(), generic_d3dcolor(), generic_float16_2(), generic_float16_4(), generic_short2n(), generic_ushort2n(), get_argument_ref(), get_attr_dispid_by_idx(), get_attr_dispid_by_name(), get_bool_const(), get_builtin_accessible_obj(), get_comboexlist_selection(), get_cp(), get_format_info_idx(), get_glyph_indices(), ShellBrowser::get_image_idx(), get_item_idx(), get_loop_control_const(), get_priv_data(), get_temp_buffer(), get_token(), get_unused_desc(), GetCustomIconPath(), getItem(), getopt_long(), gl_local_filename_completion_proc(), global_idx(), glsl_is_color_reg_read(), guid2string(), HEADER_Refresh(), HLPFILE_ReadFont(), HLPFILE_Uncompress3(), HTMLDOMChildrenCollection_get_dispid(), HTMLElementCollection_get_dispid(), HTMLElementCollection_invoke(), HTMLElementCollection_item(), HTMLFiltersCollection_get_dispid(), HTMLSelectElement_get_dispid(), HTMLStyleSheet_put_cssText(), HTMLWindow_invoke(), icm_choose_compressor_dlgproc(), IDirectInputDevice2WImpl_GetObjectInfo(), idx_to_block(), idx_to_str(), II_step_two(), III_i_stereo(), in_plane(), index_to_rgba(), init_registered_oid_info(), InitializeDefaultIcons(), insert_column(), Pane::insert_entries(), insert_item(), TrayNotifyDlg::InsertItem(), instr_ps_1_0123_texld(), IOAPICSetupIrqs(), IRQPolarity(), IRQTrigger(), is_used_desc_packed(), isStateDirty(), CMenuToolbarBase::IsTrackedItem(), jsdisp_delete_idx(), jsdisp_get_idx(), jsdisp_propput_idx(), FileChildWindow::jump_to_int(), FindProgramDlg::LaunchSelected(), ListView_GetFocusedItem(), ListView_GetItemData(), main(), make_decode_tables(), MCI_FindCommand(), MCI_IsCommandTableValid(), ME_DrawParaDecoration(), ME_GetBorderPenWidth(), ME_GetParaBorderWidth(), ME_StreamOutRTFTableProps(), MIDI_player(), MIDIMAP_LoadSettingsScheme(), MMDRV_Free(), MMDRV_Get(), MSACM_FindFormatTagInCache(), MsiEnumComponentsExW(), MsiEnumPatchesExW(), MsiEnumPatchesW(), MsiEnumProductsExW(), MSRLE32_GetNearestPaletteIndex(), NdisMWriteLogData(), NetGroupGetUsers(), Pane::Notify(), TaskBar::Notify(), TrayNotifyDlg::Notify(), Number_toString(), ok_path(), OLEACC_DllGetClassObject(), OnHScroll(), OnInitDialog(), otv_SingleSubst_validate(), parent_wnd_proc(), parse_subrs(), ParseCommand(), ParseHelpTopic(), PATH_ExtTextOut(), path_GetNamespaceAt(), path_RemoveNamespaceAt(), path_SetNamespaceAt(), PCM_StreamOpen(), pdb_read_strings(), PerfDataGetProcessIndex(), pfr_glyph_load_simple(), pfr_log_font_load(), Pin2Irq(), DesktopShellView::PositionIcons(), pp_add_define(), pp_add_macro(), pp_del_define(), pplookup(), PRINTF_ATTR(), PrintStackBacktrace(), PropertyBag_Read(), PropertyBag_Write(), PROPSHEET_Back(), PROPSHEET_DialogProc(), PROPSHEET_Next(), PROPSHEET_SetCurSelId(), ps_dimension_add_t1stem(), ps_hints_t1stem3(), ps_mask_clear_bit(), ps_mask_set_bit(), ps_mask_test_bit(), ps_parser_load_field(), ps_table_add(), psaux_get_glyph_name(), psh_hint_table_activate_mask(), psh_hint_table_init(), psh_hint_table_record(), psh_hint_table_record_mask(), pstcache_enumerate(), put_unused_desc_chain(), NtObjDirectory::read_directory(), RegDirectory::read_directory(), CConfigParser::ReadSection(), TaskBar::Refresh(), CControlPanelEnum::RegisterRegistryCPanelApps(), Remove(), remove_attribute(), remove_style(), remove_subset_prefix(), SSOThread::Run(), SampleGrabber_IMemInputPin_ReceiveMultiple(), FileChildWindow::scan_entry(), ScriptShapeOpenType(), set_clipboard_formats(), TrayNotifyDlg::SetIconMode(), setItem(), setItemUnicodeNotify(), SetupDiGetClassImageListExW(), SetupOpenAppendInfFileW(), sfnt_table_info(), shader_arb_get_register_name(), shader_arb_load_np2fixup_constants(), shader_generate_arb_declarations(), shader_get_registers_used(), shader_glsl_ffp_vertex_lighting(), shader_glsl_ffp_vertex_lighting_footer(), shader_glsl_get_register_name(), shader_glsl_get_resource_info(), shader_glsl_load_constants(), shader_glsl_load_constants_i(), shader_glsl_load_constantsB(), shader_glsl_load_np2fixup_constants(), shader_hw_sample(), SHELL_execute(), SHEnumerateUnreadMailAccountsW(), show_image(), ShutdownOnInit(), ShutdownOnOk(), ListSort::sort(), source_get(), sparse_array_add(), sparse_array_find(), sparse_array_lookup(), SPY_Bsearch_Msg(), SPY_Bsearch_Notify(), stabs_add_include(), stabs_pts_read_aggregate(), stabs_pts_read_enum(), stabs_pts_read_type_def(), START_TEST(), STATUSBAR_SetTextT(), str_array_get_ref(), stream_out_para_num(), String_charCodeAt(), String_idx_get(), String_replace(), Desktops::SwitchToDesktop(), T1_Get_Kerning(), T1_Open_Face(), t1_ps_get_font_value(), T42_Open_Face(), TAB_RemoveImage(), td_get_offs(), test_bitmap_data(), test_comboex_WM_LBUTTONDOWN(), test_halftone_palette(), test_ImmMessages(), test_Installer_Products(), test_negative_width(), test_RtlFindCharInUnicodeString(), test_selection(), test_SetDIBits(), test_SetDIBitsToDevice(), test_ShowWindow(), test_Sign_Media(), test_specific_encoder_properties(), test_stylesheets(), test_WM_LBUTTONDOWN(), texture1d_init(), texture_init(), TIME_MMSysTimeCallback(), TLB_ReadTypeLib(), ListSort::toggle_sort(), TOOLBAR_Restore(), TransformView_Create(), TREEVIEW_ProcessLetterKeys(), triangulation_get_next_point(), TT_Get_HMetrics(), TT_Get_VMetrics(), UniataInitIoRes(), update_heap_entry(), update_margin_edits(), variant_from_registry_value(), vdecl_convert_fvf(), vers_write(), VfatCreateFile(), virtqueue_add_buf_split(), virtqueue_detach_unused_buf_split(), virtqueue_get_buf_split(), Volume_FindMixerControl(), walk_constant_heap(), walk_constant_heap_clamped(), widOpenHelper(), wine_compose(), wined3d_cs_emit_set_light_enable(), wined3d_device_copy_resource(), wined3d_device_get_constant_buffer(), wined3d_device_get_cs_cb(), wined3d_device_get_cs_resource_view(), wined3d_device_get_cs_sampler(), wined3d_device_get_cs_uav(), wined3d_device_get_ds_cb(), wined3d_device_get_ds_resource_view(), wined3d_device_get_ds_sampler(), wined3d_device_get_gs_cb(), wined3d_device_get_gs_resource_view(), wined3d_device_get_gs_sampler(), wined3d_device_get_hs_cb(), wined3d_device_get_hs_resource_view(), wined3d_device_get_hs_sampler(), wined3d_device_get_pipeline_unordered_access_view(), wined3d_device_get_ps_cb(), wined3d_device_get_ps_resource_view(), wined3d_device_get_ps_sampler(), wined3d_device_get_sampler(), wined3d_device_get_shader_resource_view(), wined3d_device_get_stream_output(), wined3d_device_get_unordered_access_view(), wined3d_device_get_vs_cb(), wined3d_device_get_vs_resource_view(), wined3d_device_get_vs_sampler(), wined3d_device_set_constant_buffer(), wined3d_device_set_cs_cb(), wined3d_device_set_cs_resource_view(), wined3d_device_set_cs_sampler(), wined3d_device_set_cs_uav(), wined3d_device_set_ds_cb(), wined3d_device_set_ds_resource_view(), wined3d_device_set_ds_sampler(), wined3d_device_set_gs_cb(), wined3d_device_set_gs_resource_view(), wined3d_device_set_gs_sampler(), wined3d_device_set_hs_cb(), wined3d_device_set_hs_resource_view(), wined3d_device_set_hs_sampler(), wined3d_device_set_pipeline_unordered_access_view(), wined3d_device_set_ps_cb(), wined3d_device_set_ps_resource_view(), wined3d_device_set_ps_sampler(), wined3d_device_set_sampler(), wined3d_device_set_shader_resource_view(), wined3d_device_set_stream_output(), wined3d_device_set_unordered_access_view(), wined3d_device_set_vs_cb(), wined3d_device_set_vs_resource_view(), wined3d_device_set_vs_sampler(), wined3d_extract_bits(), wined3d_ftoa(), wined3d_get_format(), wined3d_insert_bits(), wined3d_state_get_light(), wined3d_stateblock_capture(), wined3d_stream_info_from_declaration(), wined3d_texture_init(), FileChildWindow::WndProc(), QuickLaunchBar::WndProc(), wodOpenHelper(), write_proxy(), write_str_file(), xfwrite(), xmlMemDisplay(), xmlMemDisplayLast(), ZSTD_insertAndFindFirstIndex_internal(), ZSTD_insertAndFindFirstIndexHash3(), ZSTD_updateDUBT(), and ZSTD_updateTree_internal().

◆ typed_formats

const struct wined3d_typed_format_info typed_formats[]
static

The last entry for a given typeless format defines its internal format.

u - WINED3D_CHANNEL_TYPE_UNORM i - WINED3D_CHANNEL_TYPE_SNORM U - WINED3D_CHANNEL_TYPE_UINT I - WINED3D_CHANNEL_TYPE_SINT F - WINED3D_CHANNEL_TYPE_FLOAT D - WINED3D_CHANNEL_TYPE_DEPTH S - WINED3D_CHANNEL_TYPE_STENCIL X - WINED3D_CHANNEL_TYPE_UNUSED

Definition at line 211 of file utils.c.

Referenced by init_format_base_info(), and init_typeless_formats().

◆ typeless_depth_stencil_formats