ReactOS 0.4.17-dev-970-gcf0f1a6
utils.c File Reference
#include <stdio.h>
#include "wined3d_private.h"
#include "wined3d_gl.h"
#include "wined3d_vk.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_decompress_info
 
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 BIND_FLAG_TO_STR(x)   if (bind_flags & x) { debug_append(&buffer, #x, " | "); bind_flags &= ~x; }
 
#define VIEW_FLAG_TO_STR(x)   if (flags & x) { debug_append(&buffer, #x, " | "); flags &= ~x; }
 
#define WINED3DUSAGE_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 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; }
 
#define LEVEL_TO_STR(level)   case level: return #level
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d)
 
static void rgb888_from_rgb565 (WORD rgb565, BYTE *r, BYTE *g, BYTE *b)
 
static void build_dxtn_colour_table (WORD colour0, WORD colour1, DWORD colour_table[4], enum wined3d_format_id format_id)
 
static void build_bc3_alpha_table (BYTE alpha0, BYTE alpha1, BYTE alpha_table[8])
 
static void decompress_dxtn_block (const BYTE *src, BYTE *dst, unsigned int width, unsigned int height, unsigned int dst_row_pitch, enum wined3d_format_id format_id)
 
static void decompress_dxtn (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, enum wined3d_format_id format_id)
 
static void decompress_bc3 (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 decompress_bc2 (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 decompress_bc1 (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 build_rgtc_colour_table (uint8_t red0, uint8_t red1, uint8_t colour_table[8])
 
static void decompress_rgtc_block (const uint8_t *src, uint8_t *dst, unsigned int width, unsigned int height, unsigned int dst_row_pitch)
 
static void decompress_bc4 (const uint8_t *src, uint8_t *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 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_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_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_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_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_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_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_color_key *color_key)
 
const struct wined3d_color_key_conversion * wined3d_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_format_gl * wined3d_format_gl_mutable (struct wined3d_format *format)
 
static struct wined3d_format_vk * wined3d_format_vk_mutable (struct wined3d_format *format)
 
static struct wined3d_format * get_format_by_idx (const struct wined3d_adapter *adapter, int fmt_idx)
 
static struct wined3d_format_gl * get_format_gl_by_idx (const struct wined3d_adapter *adapter, int fmt_idx)
 
static struct wined3d_format * get_format_internal (const struct wined3d_adapter *adapter, enum wined3d_format_id format_id)
 
static struct wined3d_format_gl * get_format_gl_internal (const struct wined3d_adapter *adapter, enum wined3d_format_id format_id)
 
static void copy_format (const struct wined3d_adapter *adapter, struct wined3d_format *dst_format, const struct wined3d_format *src_format)
 
static void format_set_caps (struct wined3d_format *format, unsigned int caps)
 
static void format_clear_caps (struct wined3d_format *format, unsigned int caps)
 
static enum wined3d_channel_type map_channel_type (char t)
 
static void parse_channel_desc (struct wined3d_format *format, const char *channel_desc)
 
static BOOL init_format_base_info (struct wined3d_adapter *adapter)
 
static BOOL init_format_block_info (struct wined3d_adapter *adapter)
 
static BOOL init_format_decompress_info (struct wined3d_adapter *adapter)
 
static BOOL init_srgb_formats (struct wined3d_adapter *adapter)
 
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, const struct wined3d_format_gl *format_gl, enum wined3d_gl_resource_type d3d_type, GLuint *object, GLenum internal)
 
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_gl *format)
 
static void query_format_cap (struct wined3d_gl_info *gl_info, struct wined3d_format_gl *format, GLint internal, GLenum pname, unsigned int cap, const char *string)
 
static void init_format_fbo_compat_info (const struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
 
static GLenum lookup_gl_view_class (GLenum internal_format)
 
static void query_view_class (struct wined3d_format_gl *format)
 
static void query_internal_format (struct wined3d_adapter *adapter, struct wined3d_format_gl *format, const struct wined3d_format_texture_info *texture_info, struct wined3d_gl_info *gl_info, BOOL srgb_format)
 
static BOOL init_format_texture_info (struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
 
static BOOL compare_uint (unsigned int x, unsigned int y, unsigned int max_diff)
 
static BOOL compare_colour (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_adapter *adapter, struct wined3d_gl_info *gl_info)
 
static enum fixup_channel_source fixup_source_from_char (char c)
 
static unsigned int fixup_sign_from_char (char c)
 
static struct color_fixup_desc create_color_fixup_desc_from_string (const char *s)
 
static void apply_format_fixups (struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
 
static BOOL init_format_vertex_info (const struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
 
static BOOL init_typeless_formats (const struct wined3d_adapter *adapter)
 
static void init_format_gen_mipmap_info (const struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
 
BOOL wined3d_caps_gl_ctx_test_viewport_subpixel_bits (struct wined3d_caps_gl_ctx *ctx)
 
bool wined3d_caps_gl_ctx_test_filling_convention (struct wined3d_caps_gl_ctx *ctx, float offset)
 
static float wined3d_adapter_find_polyoffset_scale (struct wined3d_caps_gl_ctx *ctx, GLenum format)
 
static void init_format_depth_bias_scale (struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
 
static BOOL wined3d_adapter_init_format_info (struct wined3d_adapter *adapter, size_t format_size)
 
BOOL wined3d_adapter_no3d_init_format_info (struct wined3d_adapter *adapter)
 
BOOL wined3d_adapter_gl_init_format_info (struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
 
static void init_vulkan_format_info (struct wined3d_format_vk *format, const struct wined3d_vk_info *vk_info, VkPhysicalDevice vk_physical_device)
 
BOOL wined3d_adapter_vk_init_format_info (struct wined3d_adapter_vk *adapter_vk, const struct wined3d_vk_info *vk_info)
 
const struct wined3d_format * wined3d_get_format (const struct wined3d_adapter *adapter, enum wined3d_format_id format_id, unsigned int bind_flags)
 
enum wined3d_format_id wined3d_get_typed_format_id (const struct wined3d_adapter *adapter, const struct wined3d_format *format, enum wined3d_channel_type channel_type)
 
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 char * debug_box (const struct wined3d_box *box)
 
const char * debug_color (const struct wined3d_color *color)
 
const char * debug_ivec4 (const struct wined3d_ivec4 *v)
 
const char * debug_uvec4 (const struct wined3d_uvec4 *v)
 
const char * debug_vec4 (const struct wined3d_vec4 *v)
 
const char * debug_const_bo_address (const struct wined3d_const_bo_address *address)
 
const char * debug_bo_address (const struct wined3d_bo_address *address)
 
const char * debug_d3dformat (enum wined3d_format_id format_id)
 
const char * debug_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 char * wined3d_debug_resource_access (uint32_t access)
 
const char * wined3d_debug_bind_flags (uint32_t bind_flags)
 
const char * wined3d_debug_view_desc (const struct wined3d_view_desc *d, const struct wined3d_resource *resource)
 
const char * debug_d3dusage (uint32_t usage)
 
const char * debug_d3ddeclmethod (enum wined3d_decl_method method)
 
const char * debug_d3ddeclusage (enum wined3d_decl_usage usage)
 
const char * debug_d3dinput_classification (enum wined3d_input_classification classification)
 
const char * debug_d3dresourcetype (enum wined3d_resource_type resource_type)
 
const char * debug_d3dprimitivetype (enum wined3d_primitive_type primitive_type)
 
const char * debug_d3drenderstate (enum wined3d_render_state state)
 
const char * debug_d3dsamplerstate (enum wined3d_sampler_state state)
 
const char * debug_d3dtexturefiltertype (enum wined3d_texture_filter_type filter_type)
 
const char * debug_d3dtexturestate (enum wined3d_texture_stage_state state)
 
const char * debug_d3dtop (enum wined3d_texture_op d3dtop)
 
const char * debug_d3dtstype (enum wined3d_transform_state tstype)
 
const char * debug_shader_type (enum wined3d_shader_type type)
 
const char * debug_d3dstate (uint32_t state)
 
const char * debug_fboattachment (GLenum attachment)
 
const char * debug_fbostatus (GLenum status)
 
const char * debug_glerror (GLenum error)
 
const char * wined3d_debug_vkresult (VkResult vr)
 
static const char * debug_fixup_channel_source (enum fixup_channel_source source)
 
static const char * debug_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_stateblock_state *state, unsigned int index, struct wined3d_matrix *mat)
 
static void compute_texture_matrix (const struct wined3d_matrix *matrix, uint32_t flags, BOOL calculated_coords, enum wined3d_format_id format_id, struct wined3d_matrix *out_matrix)
 
static enum wined3d_format_id get_texcoord_format (const struct wined3d_vertex_declaration *decl, unsigned int index)
 
void get_texture_matrix (const struct wined3d_stateblock_state *state, const 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_fog_start_end (const struct wined3d_context *context, const struct wined3d_state *state, float *start, float *end)
 
static BOOL wined3d_get_primary_display (WCHAR *display)
 
BOOL wined3d_get_primary_adapter_luid (LUID *luid)
 
uint32_t wined3d_format_pack (const struct wined3d_format *format, const struct wined3d_uvec4 *value)
 
void wined3d_format_colour_to_vk (const struct wined3d_format *format, const struct wined3d_color *c, VkClearColorValue *retval)
 
void wined3d_format_convert_from_float (const struct wined3d_format *format, const struct wined3d_color *color, void *ret)
 
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 wined3d_format_copy_data (const struct wined3d_format *format, const uint8_t *src, unsigned int src_row_pitch, unsigned int src_slice_pitch, uint8_t *dst, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int w, unsigned int h, unsigned int d)
 
void multiply_matrix (struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
 
void wined3d_ffp_get_fs_settings (const struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info, struct ffp_frag_settings *settings)
 
const struct ffp_frag_desc * find_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)
 
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_state *state, const struct wined3d_stream_info *si, const struct wined3d_d3d_info *d3d_info, struct wined3d_ffp_vs_settings *settings)
 
int wined3d_ffp_vertex_program_key_compare (const void *key, const struct wine_rb_entry *entry)
 
const char * wined3d_debug_location (uint32_t location)
 
const char * wined3d_debug_feature_level (enum wined3d_feature_level level)
 
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)
 
static void swap_rows (float **a, float **b)
 
BOOL invert_matrix (struct wined3d_matrix *out, const struct wined3d_matrix *m)
 
static BOOL invert_matrix_3d (struct wined3d_matrix *out, const struct wined3d_matrix *in)
 
void compute_normal_matrix (struct wined3d_matrix *normal_matrix, BOOL legacy_lighting, const struct wined3d_matrix *modelview)
 
static void wined3d_allocator_release_block (struct wined3d_allocator *allocator, struct wined3d_allocator_block *block)
 
static struct wined3d_allocator_block * wined3d_allocator_acquire_block (struct wined3d_allocator *allocator)
 
void wined3d_allocator_block_free (struct wined3d_allocator_block *block)
 
static void wined3d_allocator_block_init (struct wined3d_allocator_block *block, struct wined3d_allocator_chunk *chunk, struct wined3d_allocator_block *parent, struct wined3d_allocator_block *sibling, unsigned int order, size_t offset, bool free)
 
void wined3d_allocator_chunk_cleanup (struct wined3d_allocator_chunk *chunk)
 
bool wined3d_allocator_chunk_init (struct wined3d_allocator_chunk *chunk, struct wined3d_allocator *allocator)
 
void wined3d_allocator_cleanup (struct wined3d_allocator *allocator)
 
static struct wined3d_allocator_block * wined3d_allocator_chunk_allocate (struct wined3d_allocator_chunk *chunk, unsigned int order)
 
struct wined3d_allocator_block * wined3d_allocator_allocate (struct wined3d_allocator *allocator, struct wined3d_context *context, unsigned int memory_type, size_t size)
 
bool wined3d_allocator_init (struct wined3d_allocator *allocator, size_t pool_count, const struct wined3d_allocator_ops *allocator_ops)
 

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_decompress_info format_decompress_info []
 
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

◆ BIND_FLAG_TO_STR

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

◆ 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

◆ LEVEL_TO_STR

#define LEVEL_TO_STR (   level)    case level: return #level

◆ 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

◆ VIEW_FLAG_TO_STR

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

◆ 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 35 of file utils.c.

◆ WINED3D_TO_STR [1/7]

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

◆ WINED3D_TO_STR [2/7]

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

◆ WINED3D_TO_STR [3/7]

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

◆ WINED3D_TO_STR [4/7]

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

◆ WINED3D_TO_STR [5/7]

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

◆ WINED3D_TO_STR [6/7]

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

◆ WINED3D_TO_STR [7/7]

#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; }

Function Documentation

◆ add_ffp_frag_shader()

void add_ffp_frag_shader ( struct wine_rb_tree *  shaders,
struct ffp_frag_desc *  desc 
)

Definition at line 6426 of file utils.c.

6427{
6428 /* Note that the key is the implementation independent part of the ffp_frag_desc structure,
6429 * whereas desc points to an extended structure with implementation specific parts. */
6430 if (wine_rb_put(shaders, &desc->settings, &desc->entry) == -1)
6431 {
6432 ERR("Failed to insert ffp frag shader.\n");
6433 }
6434}
#define ERR(fmt,...)
Definition: precomp.h:57
const GLuint * shaders
Definition: glext.h:7538
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
#define wine_rb_put
Definition: rbtree.h:410

Referenced by get_ffp_pixel_shader(), 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 3492 of file utils.c.

3493{
3494 const struct wined3d_d3d_info *d3d_info = &adapter->d3d_info;
3495 struct wined3d_format_gl *format;
3496 BOOL use_legacy_fixups;
3497 unsigned int i;
3498
3499 static const struct
3500 {
3501 enum wined3d_format_id id;
3502 const char *fixup;
3503 BOOL legacy;
3504 enum wined3d_gl_extension extension;
3505 }
3506 fixups[] =
3507 {
3513
3517
3521
3525
3529
3532
3535
3539
3542
3545
3548
3551
3554
3556 };
3557
3558 use_legacy_fixups = d3d_info->wined3d_creation_flags & WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR;
3559 for (i = 0; i < ARRAY_SIZE(fixups); ++i)
3560 {
3561 if (fixups[i].legacy && !use_legacy_fixups)
3562 continue;
3563
3564 if (!gl_info->supported[fixups[i].extension])
3565 continue;
3566
3567 format = get_format_gl_internal(adapter, fixups[i].id);
3568 format->f.color_fixup = create_color_fixup_desc_from_string(fixups[i].fixup);
3569 }
3570
3571 if (!gl_info->supported[APPLE_YCBCR_422] && !gl_info->supported[APPLE_RGB_422]
3572 && (gl_info->supported[ARB_FRAGMENT_PROGRAM]
3573 || (gl_info->supported[ARB_FRAGMENT_SHADER] && gl_info->supported[ARB_VERTEX_SHADER])))
3574 {
3577
3580 }
3581 else if (!gl_info->supported[APPLE_YCBCR_422] && gl_info->supported[APPLE_RGB_422])
3582 {
3585
3588 }
3589 else if (!gl_info->supported[APPLE_YCBCR_422] && (!gl_info->supported[ARB_FRAGMENT_PROGRAM]
3590 && (!gl_info->supported[ARB_FRAGMENT_SHADER] || !gl_info->supported[ARB_VERTEX_SHADER])))
3591 {
3594 format->internal = 0;
3595
3598 format->internal = 0;
3599 }
3600
3601 if (gl_info->supported[ARB_FRAGMENT_PROGRAM]
3602 || (gl_info->supported[ARB_FRAGMENT_SHADER] && gl_info->supported[ARB_VERTEX_SHADER]))
3603 {
3606 format->f.height_scale.numerator = 3;
3607 format->f.height_scale.denominator = 2;
3609
3612 format->f.height_scale.numerator = 3;
3613 format->f.height_scale.denominator = 2;
3615 }
3616 else
3617 {
3620 format->internal = 0;
3621
3624 format->internal = 0;
3625 }
3626
3628 {
3631 }
3632
3633 if (!gl_info->supported[ARB_HALF_FLOAT_PIXEL])
3634 {
3637
3640
3643 }
3644
3645 if (gl_info->quirks & WINED3D_QUIRK_BROKEN_RGBA16)
3646 {
3649 }
3650
3651 /* ATI instancing hack: Although ATI cards do not support Shader Model
3652 * 3.0, they support instancing. To query if the card supports instancing
3653 * CheckDeviceFormat() with the special format MAKEFOURCC('I','N','S','T')
3654 * is used. Should an application check for this, provide a proper return
3655 * value. We can do instancing with all shader versions, but we need
3656 * vertex shaders.
3657 *
3658 * Additionally applications have to set the D3DRS_POINTSIZE render state
3659 * to MAKEFOURCC('I','N','S','T') once to enable instancing. Wined3d
3660 * doesn't need that and just ignores it.
3661 *
3662 * With Shader Model 3.0 capable cards Instancing 'just works' in Windows. */
3663 /* FIXME: This should just check the shader backend caps. */
3664 if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_VERTEX_SHADER])
3665 {
3668 }
3669
3670 /* Depth bound test. To query if the card supports it CheckDeviceFormat()
3671 * with the special format MAKEFOURCC('N','V','D','B') is used. It is
3672 * enabled by setting D3DRS_ADAPTIVETESS_X render state to
3673 * MAKEFOURCC('N','V','D','B') and then controlled by setting
3674 * D3DRS_ADAPTIVETESS_Z (zMin) and D3DRS_ADAPTIVETESS_W (zMax) to test
3675 * value. */
3676 if (gl_info->supported[EXT_DEPTH_BOUNDS_TEST])
3677 {
3680 }
3681
3682 if (gl_info->supported[ARB_MULTISAMPLE])
3683 {
3686 }
3687
3688 /* RESZ aka AMD DX9-level hack for multisampled depth buffer resolve. You query for RESZ
3689 * support by checking for availability of MAKEFOURCC('R','E','S','Z') surfaces with
3690 * RENDERTARGET usage. */
3691 if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
3692 {
3695 }
3696
3697 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
3698 {
3700
3702 continue;
3703
3704 if (is_identity_fixup(format->f.color_fixup))
3705 continue;
3706
3707 TRACE("Checking support for fixup:\n");
3708 dump_color_fixup_desc(format->f.color_fixup);
3709 if (!adapter->shader_backend->shader_color_fixup_supported(format->f.color_fixup)
3710 || !adapter->fragment_pipe->color_fixup_supported(format->f.color_fixup))
3711 {
3712 TRACE("[FAILED]\n");
3714 }
3715 else
3716 {
3717 TRACE("[OK]\n");
3718 }
3719 }
3720
3721 /* These formats are not supported for 3D textures. See also
3722 * WINED3D_FORMAT_CAP_DECOMPRESS. */
3724 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3726 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3728 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3730 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3732 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3733}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void format_clear_caps(struct wined3d_format *format, unsigned int caps)
Definition: utils.c:2009
#define WINED3D_FORMAT_COUNT
Definition: utils.c:70
static struct wined3d_format_gl * get_format_gl_internal(const struct wined3d_adapter *adapter, enum wined3d_format_id format_id)
Definition: utils.c:1982
enum wined3d_format_id id
Definition: utils.c:39
static void format_set_caps(struct wined3d_format *format, unsigned int caps)
Definition: utils.c:2001
static struct wined3d_format_gl * get_format_gl_by_idx(const struct wined3d_adapter *adapter, int fmt_idx)
Definition: utils.c:1963
static struct color_fixup_desc create_color_fixup_desc_from_string(const char *s)
Definition: utils.c:3470
void dump_color_fixup_desc(struct color_fixup_desc fixup)
Definition: utils.c:5540
unsigned int BOOL
Definition: ntddk_ex.h:94
return adapter
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
BOOL legacy
Definition: mkisofs.c:131
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t wined3d_creation_flags
uint32_t quirks
Definition: wined3d_gl.h:346
BOOL supported[WINED3D_GL_EXT_COUNT]
Definition: wined3d_gl.h:347
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1331
wined3d_format_id
Definition: wined3d.h:126
@ WINED3DFMT_RESZ
Definition: wined3d.h:275
@ WINED3DFMT_BC5_UNORM
Definition: wined3d.h:240
@ WINED3DFMT_INTZ
Definition: wined3d.h:274
@ WINED3DFMT_R16G16_UNORM
Definition: wined3d.h:192
@ WINED3DFMT_BC5_SNORM
Definition: wined3d.h:241
@ WINED3DFMT_R32G32_FLOAT
Definition: wined3d.h:171
@ WINED3DFMT_R16G16_SNORM
Definition: wined3d.h:194
@ WINED3DFMT_ATI1N
Definition: wined3d.h:268
@ WINED3DFMT_R8G8B8A8_SNORM
Definition: wined3d.h:188
@ WINED3DFMT_NV12
Definition: wined3d.h:279
@ WINED3DFMT_L8A8_UNORM
Definition: wined3d.h:139
@ WINED3DFMT_L4A4_UNORM
Definition: wined3d.h:140
@ WINED3DFMT_R16G16B16A16_FLOAT
Definition: wined3d.h:165
@ WINED3DFMT_L8_UNORM
Definition: wined3d.h:138
@ WINED3DFMT_R8G8_SNORM
Definition: wined3d.h:208
@ WINED3DFMT_R5G5_SNORM_L6_UNORM
Definition: wined3d.h:141
@ WINED3DFMT_INST
Definition: wined3d.h:270
@ WINED3DFMT_NVDB
Definition: wined3d.h:271
@ WINED3DFMT_R16_FLOAT
Definition: wined3d.h:211
@ WINED3DFMT_R16G16B16A16_UNORM
Definition: wined3d.h:166
@ WINED3DFMT_R32_FLOAT
Definition: wined3d.h:198
@ WINED3DFMT_R8G8_SNORM_L8X8_UNORM
Definition: wined3d.h:142
@ WINED3DFMT_YV12
Definition: wined3d.h:259
@ WINED3DFMT_YUY2
Definition: wined3d.h:258
@ WINED3DFMT_R16G16_FLOAT
Definition: wined3d.h:191
@ WINED3DFMT_P8_UINT
Definition: wined3d.h:137
@ WINED3DFMT_L16_UNORM
Definition: wined3d.h:153
@ WINED3DFMT_UYVY
Definition: wined3d.h:257
@ WINED3DFMT_ATOC
Definition: wined3d.h:282
@ WINED3DFMT_A8_UNORM
Definition: wined3d.h:222
@ WINED3DFMT_ATI2N
Definition: wined3d.h:269
@ WINED3DFMT_BC4_SNORM
Definition: wined3d.h:238
wined3d_gl_extension
Definition: wined3d_gl.h:42
@ WINED3D_GL_EXT_NONE
Definition: wined3d_gl.h:43
@ ARB_FRAGMENT_PROGRAM
Definition: wined3d_gl.h:80
@ ATI_TEXTURE_COMPRESSION_3DC
Definition: wined3d_gl.h:163
@ ARB_VERTEX_PROGRAM
Definition: wined3d_gl.h:154
@ ARB_TEXTURE_COMPRESSION_RGTC
Definition: wined3d_gl.h:129
@ ARB_MULTISAMPLE
Definition: wined3d_gl.h:95
@ ARB_FRAMEBUFFER_OBJECT
Definition: wined3d_gl.h:84
@ ARB_VERTEX_SHADER
Definition: wined3d_gl.h:155
@ ARB_TEXTURE_RG
Definition: wined3d_gl.h:142
@ EXT_TEXTURE_COMPRESSION_RGTC
Definition: wined3d_gl.h:192
@ ARB_FRAGMENT_SHADER
Definition: wined3d_gl.h:82
@ EXT_DEPTH_BOUNDS_TEST
Definition: wined3d_gl.h:172
@ ARB_HALF_FLOAT_PIXEL
Definition: wined3d_gl.h:88
@ APPLE_YCBCR_422
Definition: wined3d_gl.h:51
@ NV_TEXTURE_SHADER
Definition: wined3d_gl.h:217
@ WINED3D_GL_LEGACY_CONTEXT
Definition: wined3d_gl.h:232
@ APPLE_RGB_422
Definition: wined3d_gl.h:50
@ EXT_TEXTURE_SNORM
Definition: wined3d_gl.h:201
#define WINED3D_QUIRK_BROKEN_RGBA16
Definition: wined3d_gl.h:327
#define WINED3D_FORMAT_ATTR_HEIGHT_SCALE
static struct color_fixup_desc create_complex_fixup_desc(enum complex_fixup complex_fixup)
#define WINED3D_FORMAT_CAP_TEXTURE
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
@ WINED3D_GL_RES_TYPE_TEX_3D
@ WINED3D_GL_RES_TYPE_TEX_2D
@ COMPLEX_FIXUP_P8
@ COMPLEX_FIXUP_YUY2
@ COMPLEX_FIXUP_UYVY
@ COMPLEX_FIXUP_NV12
@ COMPLEX_FIXUP_YV12
@ COMPLEX_FIXUP_YUV
#define WINED3D_FORMAT_CAP_RENDERTARGET
#define WINED3D_FORMAT_CAP_BLIT

Referenced by wined3d_adapter_gl_init_format_info().

◆ build_bc3_alpha_table()

static void build_bc3_alpha_table ( BYTE  alpha0,
BYTE  alpha1,
BYTE  alpha_table[8] 
)
static

Definition at line 413 of file utils.c.

414{
415 unsigned int i;
416
417 alpha_table[0] = alpha0;
418 alpha_table[1] = alpha1;
419
420 if (alpha0 > alpha1)
421 {
422 for (i = 0; i < 6; ++i)
423 {
424 alpha_table[2 + i] = ((6 - i) * alpha0 + (i + 1) * alpha1) / 7;
425 }
426 return;
427 }
428 else
429 {
430 for (i = 0; i < 4; ++i)
431 {
432 alpha_table[2 + i] = ((4 - i) * alpha0 + (i + 1) * alpha1) / 5;
433 }
434 alpha_table[6] = 0x00;
435 alpha_table[7] = 0xff;
436 }
437}

Referenced by decompress_dxtn_block().

◆ build_dxtn_colour_table()

static void build_dxtn_colour_table ( WORD  colour0,
WORD  colour1,
DWORD  colour_table[4],
enum wined3d_format_id  format_id 
)
static

Definition at line 375 of file utils.c.

377{
378 unsigned int i;
379 struct
380 {
381 BYTE r, g, b;
382 } c[4];
383
384 rgb888_from_rgb565(colour0, &c[0].r, &c[0].g, &c[0].b);
385 rgb888_from_rgb565(colour1, &c[1].r, &c[1].g, &c[1].b);
386
387 if (format_id == WINED3DFMT_BC1_UNORM && colour0 <= colour1)
388 {
389 c[2].r = (c[0].r + c[1].r) / 2;
390 c[2].g = (c[0].g + c[1].g) / 2;
391 c[2].b = (c[0].b + c[1].b) / 2;
392
393 c[3].r = 0;
394 c[3].g = 0;
395 c[3].b = 0;
396 }
397 else
398 {
399 for (i = 0; i < 2; ++i)
400 {
401 c[i + 2].r = (2 * c[i].r + c[1 - i].r) / 3;
402 c[i + 2].g = (2 * c[i].g + c[1 - i].g) / 3;
403 c[i + 2].b = (2 * c[i].b + c[1 - i].b) / 3;
404 }
405 }
406
407 for (i = 0; i < 4; ++i)
408 {
409 colour_table[i] = (c[i].r << 16) | (c[i].g << 8) | c[i].b;
410 }
411}
static void rgb888_from_rgb565(WORD rgb565, BYTE *r, BYTE *g, BYTE *b)
Definition: utils.c:361
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
static UINT format_id
Definition: clipboard.c:1455
@ WINED3DFMT_BC1_UNORM
Definition: wined3d.h:228
unsigned char BYTE
Definition: xxhash.c:193

Referenced by decompress_dxtn_block().

◆ build_rgtc_colour_table()

static void build_rgtc_colour_table ( uint8_t  red0,
uint8_t  red1,
uint8_t  colour_table[8] 
)
static

Definition at line 566 of file utils.c.

567{
568 unsigned int i;
569
570 colour_table[0] = red0;
571 colour_table[1] = red1;
572 if (red0 <= red1)
573 {
574 for (i = 0; i < 4; ++i)
575 {
576 colour_table[i + 2] = ((8 - 2 * i) * red0 + (2 + 2 * i) * red1 + 5) / 10;
577 }
578 colour_table[6] = 0x00;
579 colour_table[7] = 0xff;
580 }
581 else
582 {
583 for (i = 0; i < 6; ++i)
584 {
585 colour_table[i + 2] = ((12 - 2 * i) * red0 + (2 + 2 * i) * red1 + 7) / 14;
586 }
587 }
588}

Referenced by decompress_rgtc_block().

◆ check_fbo_compat()

static void check_fbo_compat ( struct wined3d_caps_gl_ctx *  ctx,
struct wined3d_format_gl *  format 
)
static

Definition at line 2494 of file utils.c.

2495{
2496 /* Check if the default internal format is supported as a frame buffer
2497 * target, otherwise fall back to the render target internal.
2498 *
2499 * Try to stick to the standard format if possible, this limits precision differences. */
2500 static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 1.0f};
2501 static const struct wined3d_color half_transparent_red = {1.0f, 0.0f, 0.0f, 0.5f};
2502 const struct wined3d_gl_info *gl_info = ctx->gl_info;
2503 GLenum status, rt_internal = format->rt_internal;
2504 GLuint object, color_rb;
2506 BOOL fallback_fmt_used = FALSE, regular_fmt_used = FALSE;
2507
2508 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
2509
2510 for (type = 0; type < ARRAY_SIZE(format->f.caps); ++type)
2511 {
2512 const char *type_string = "color";
2513
2515 continue;
2516
2517 create_and_bind_fbo_attachment(gl_info, format, type, &object, format->internal);
2518
2520 {
2521 gl_info->fbo_ops.glGenRenderbuffers(1, &color_rb);
2522 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, color_rb);
2524 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 16, 1);
2525 else
2526 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 16, 16);
2527
2528 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER,
2530 checkGLcall("Create and attach color rb attachment");
2531 type_string = "depth / stencil";
2532 }
2533
2534 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
2535 checkGLcall("Framebuffer format check");
2536
2538 {
2539 TRACE("Format %s is supported as FBO %s attachment, type %u.\n",
2540 debug_d3dformat(format->f.id), type_string, type);
2542 format->rt_internal = format->internal;
2543 regular_fmt_used = TRUE;
2544 }
2545 else
2546 {
2547 if (!rt_internal)
2548 {
2550 {
2551 WARN("Format %s with rendertarget flag is not supported as FBO color attachment (type %u),"
2552 " and no fallback specified.\n", debug_d3dformat(format->f.id), type);
2554 }
2555 else
2556 {
2557 TRACE("Format %s is not supported as FBO %s attachment, type %u.\n",
2558 debug_d3dformat(format->f.id), type_string, type);
2559 }
2560 format->rt_internal = format->internal;
2561 }
2562 else
2563 {
2564 TRACE("Format %s is not supported as FBO %s attachment (type %u),"
2565 " trying rtInternal format as fallback.\n",
2566 debug_d3dformat(format->f.id), type_string, type);
2567
2568 while (gl_info->gl_ops.gl.p_glGetError());
2569
2570 delete_fbo_attachment(gl_info, type, object);
2571 create_and_bind_fbo_attachment(gl_info, format, type, &object, format->rt_internal);
2572
2573 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
2574 checkGLcall("Framebuffer format check");
2575
2577 {
2578 TRACE("Format %s rtInternal format is supported as FBO %s attachment, type %u.\n",
2579 debug_d3dformat(format->f.id), type_string, type);
2580 fallback_fmt_used = TRUE;
2581 }
2582 else
2583 {
2584 WARN("Format %s rtInternal format is not supported as FBO %s attachment, type %u.\n",
2585 debug_d3dformat(format->f.id), type_string, type);
2587 }
2588 }
2589 }
2590
2594 && !(format->f.attrs & WINED3D_FORMAT_ATTR_INTEGER)
2595 && format->f.id != WINED3DFMT_NULL && format->f.id != WINED3DFMT_P8_UINT
2596 && format->format != GL_LUMINANCE && format->format != GL_LUMINANCE_ALPHA
2597 && (format->f.red_size || format->f.alpha_size))
2598 {
2599 uint32_t readback[16 * 16 * 16], color = 0;
2600 unsigned int r_range, a_range;
2601 BYTE r, a;
2602 BOOL match = TRUE;
2603 GLuint rb;
2604
2605 if (gl_info->supported[EXT_PACKED_DEPTH_STENCIL])
2606 {
2607 gl_info->fbo_ops.glGenRenderbuffers(1, &rb);
2608 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, rb);
2610 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 16, 1);
2611 else
2612 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 16, 16);
2613 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rb);
2614 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rb);
2615 checkGLcall("RB attachment");
2616 }
2617
2618 gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
2619 gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
2620 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
2621 if (gl_info->gl_ops.gl.p_glGetError() == GL_INVALID_FRAMEBUFFER_OPERATION)
2622 {
2623 while (gl_info->gl_ops.gl.p_glGetError());
2624 TRACE("Format %s doesn't support post-pixelshader blending, type %u.\n",
2625 debug_d3dformat(format->f.id), type);
2626 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING;
2627 }
2628 else
2629 {
2630 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
2632 gl_info->gl_ops.gl.p_glViewport(0, 0, 16, 1);
2633 else
2634 gl_info->gl_ops.gl.p_glViewport(0, 0, 16, 16);
2635 gl_info->gl_ops.gl.p_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2636
2637 draw_test_quad(ctx, NULL, &black);
2638
2639 gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
2640
2641 draw_test_quad(ctx, NULL, &half_transparent_red);
2642
2643 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
2644
2645 switch (type)
2646 {
2648 /* Rebinding texture to workaround a fglrx bug. */
2649 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, object);
2650 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_1D, 0, GL_BGRA,
2652 color = readback[7];
2653 break;
2654
2657 /* Rebinding texture to workaround a fglrx bug. */
2658 gl_info->gl_ops.gl.p_glBindTexture(wined3d_gl_type_to_enum(type), object);
2659 gl_info->gl_ops.gl.p_glGetTexImage(wined3d_gl_type_to_enum(type), 0, GL_BGRA,
2661 color = readback[7 * 16 + 7];
2662 break;
2663
2665 /* Rebinding texture to workaround a fglrx bug. */
2666 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, object);
2667 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL_BGRA,
2669 color = readback[7 * 16 + 7];
2670 break;
2671
2673 gl_info->gl_ops.gl.p_glReadPixels(0, 0, 16, 16,
2675 color = readback[7 * 16 + 7];
2676 break;
2677
2680 color = 0;
2681 break;
2682 }
2683 checkGLcall("Post-pixelshader blending check");
2684
2685 a = color >> 24;
2686 r = (color & 0x00ff0000u) >> 16;
2687
2688 r_range = format->f.red_size < 8 ? 1u << (8 - format->f.red_size) : 1;
2689 a_range = format->f.alpha_size < 8 ? 1u << (8 - format->f.alpha_size) : 1;
2690 if (format->f.red_size && (r < 0x7f - r_range || r > 0x7f + r_range))
2691 match = FALSE;
2692 else if (format->f.alpha_size > 1 && (a < 0xbf - a_range || a > 0xbf + a_range))
2693 match = FALSE;
2694 if (!match)
2695 {
2696 TRACE("Format %s doesn't support post-pixelshader blending, type %u.\n",
2697 debug_d3dformat(format->f.id), type);
2698 TRACE("Color output: %#x\n", color);
2699 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING;
2700 }
2701 else
2702 {
2703 TRACE("Format %s supports post-pixelshader blending, type %u.\n",
2704 debug_d3dformat(format->f.id), type);
2705 TRACE("Color output: %#x\n", color);
2707 }
2708 }
2709
2710 if (gl_info->supported[EXT_PACKED_DEPTH_STENCIL])
2711 {
2712 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
2713 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
2714 gl_info->fbo_ops.glDeleteRenderbuffers(1, &rb);
2715 checkGLcall("RB cleanup");
2716 }
2717 }
2718
2719 if (format->internal != format->srgb_internal)
2720 {
2721 delete_fbo_attachment(gl_info, type, object);
2722 create_and_bind_fbo_attachment(gl_info, format, type, &object, format->srgb_internal);
2723
2724 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
2725 checkGLcall("Framebuffer format check");
2726
2728 {
2729 TRACE("Format %s's sRGB format is FBO attachable, type %u.\n",
2730 debug_d3dformat(format->f.id), type);
2732 if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
2733 format->internal = format->srgb_internal;
2734 }
2735 else
2736 {
2737 WARN("Format %s's sRGB format is not FBO attachable, type %u.\n",
2738 debug_d3dformat(format->f.id), type);
2740 }
2741 }
2742 else if (status == GL_FRAMEBUFFER_COMPLETE)
2744
2746 {
2747 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
2748 gl_info->fbo_ops.glDeleteRenderbuffers(1, &color_rb);
2749 }
2750
2751 delete_fbo_attachment(gl_info, type, object);
2752 checkGLcall("Framebuffer format check cleanup");
2753 }
2754
2755 if (fallback_fmt_used && regular_fmt_used)
2756 {
2757 FIXME("Format %s needs different render target formats for different resource types.\n",
2758 debug_d3dformat(format->f.id));
2762 }
2763}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define NULL
Definition: types.h:112
UINT32 uint32_t
Definition: types.h:75
static GLenum wined3d_gl_type_to_enum(enum wined3d_gl_resource_type type)
Definition: utils.c:2226
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:4605
static void delete_fbo_attachment(const struct wined3d_gl_info *gl_info, enum wined3d_gl_resource_type d3d_type, GLuint object)
Definition: utils.c:2249
static void draw_test_quad(struct wined3d_caps_gl_ctx *ctx, const struct wined3d_vec3 *geometry, const struct wined3d_color *color)
Definition: utils.c:2371
static void create_and_bind_fbo_attachment(const struct wined3d_gl_info *gl_info, const struct wined3d_format_gl *format_gl, enum wined3d_gl_resource_type d3d_type, GLuint *object, GLenum internal)
Definition: utils.c:2271
#define GL_RGBA8
Definition: gl.h:762
#define GL_LUMINANCE_ALPHA
Definition: gl.h:485
#define GL_SRC_ALPHA
Definition: gl.h:378
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define GL_BGRA
Definition: gl.h:1485
unsigned int GLenum
Definition: gl.h:150
#define GL_LUMINANCE
Definition: gl.h:484
unsigned int GLuint
Definition: gl.h:159
#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
#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
Definition: wined3d_gl.h:353
struct wined3d_fbo_ops fbo_ops
Definition: wined3d_gl.h:354
@ WINED3DFMT_NULL
Definition: wined3d.h:276
@ EXT_TEXTURE_SRGB_DECODE
Definition: wined3d_gl.h:203
@ EXT_PACKED_DEPTH_STENCIL
Definition: wined3d_gl.h:182
#define WINED3D_QUIRK_LIMITED_TEX_FILTERING
Definition: wined3d_gl.h:329
#define checkGLcall(A)
Definition: wined3d_gl.h:402
#define WINED3D_FORMAT_CAP_FBO_ATTACHABLE_SRGB
#define WINED3D_FORMAT_ATTR_INTEGER
#define WINED3D_FORMAT_CAP_SRGB_WRITE
#define WINED3D_FORMAT_CAP_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_1D
@ WINED3D_GL_RES_TYPE_COUNT
#define WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING
#define WINED3D_FORMAT_CAP_DEPTH_STENCIL

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 3274 of file utils.c.

3275{
3276 static const DWORD data[] = {0x00000000, 0xffffffff};
3277 GLuint tex, fbo, buffer;
3278 uint32_t readback[16 * 1];
3279 BOOL ret = FALSE;
3280
3281 /* Render a filtered texture and see what happens. This is intended to detect the lack of
3282 * float16 filtering on ATI X1000 class cards. The drivers disable filtering instead of
3283 * falling back to software. If this changes in the future this code will get fooled and
3284 * apps might hit the software path due to incorrectly advertised caps.
3285 *
3286 * Its unlikely that this changes however. GL Games like Mass Effect depend on the filter
3287 * disable fallback, if Apple or ATI ever change the driver behavior they will break more
3288 * than Wine. The Linux binary <= r500 driver is not maintained any more anyway
3289 */
3290
3291 while (gl_info->gl_ops.gl.p_glGetError());
3292
3293 gl_info->gl_ops.gl.p_glGenTextures(1, &buffer);
3294 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, buffer);
3295 memset(readback, 0x7e, sizeof(readback));
3296 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 1, 0,
3298 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
3299 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
3300 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
3301 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
3302 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
3303
3304 gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
3305 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
3306 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, internal, 2, 1, 0,
3308 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
3309 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
3310 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
3311 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
3312 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
3313 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D);
3314
3315 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
3316 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
3317 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, buffer, 0);
3318 gl_info->gl_ops.gl.p_glDrawBuffer(GL_COLOR_ATTACHMENT0);
3319
3320 gl_info->gl_ops.gl.p_glViewport(0, 0, 16, 1);
3321 gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
3322 gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
3323 gl_info->gl_ops.gl.p_glLoadIdentity();
3324 gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
3325 gl_info->gl_ops.gl.p_glLoadIdentity();
3326
3327 gl_info->gl_ops.gl.p_glClearColor(0, 1, 0, 0);
3328 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
3329
3330 gl_info->gl_ops.gl.p_glBegin(GL_TRIANGLE_STRIP);
3331 gl_info->gl_ops.gl.p_glTexCoord2f(0.0, 0.0);
3332 gl_info->gl_ops.gl.p_glVertex2f(-1.0f, -1.0f);
3333 gl_info->gl_ops.gl.p_glTexCoord2f(1.0, 0.0);
3334 gl_info->gl_ops.gl.p_glVertex2f(1.0f, -1.0f);
3335 gl_info->gl_ops.gl.p_glTexCoord2f(0.0, 1.0);
3336 gl_info->gl_ops.gl.p_glVertex2f(-1.0f, 1.0f);
3337 gl_info->gl_ops.gl.p_glTexCoord2f(1.0, 1.0);
3338 gl_info->gl_ops.gl.p_glVertex2f(1.0f, 1.0f);
3339 gl_info->gl_ops.gl.p_glEnd();
3340
3341 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, buffer);
3342 memset(readback, 0x7f, sizeof(readback));
3343 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, readback);
3344 if (compare_colour(readback[6], 0xffffffff, 5) || compare_colour(readback[6], 0x00000000, 5)
3345 || compare_colour(readback[9], 0xffffffff, 5) || compare_colour(readback[9], 0x00000000, 5))
3346 {
3347 TRACE("Read back colors 0x%08x and 0x%08x close to unfiltered color, assuming no filtering\n",
3348 readback[6], readback[9]);
3349 ret = FALSE;
3350 }
3351 else
3352 {
3353 TRACE("Read back colors are 0x%08x and 0x%08x, assuming texture is filtered\n",
3354 readback[6], readback[9]);
3355 ret = TRUE;
3356 }
3357
3358 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3359 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
3360 gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
3361 gl_info->gl_ops.gl.p_glDeleteTextures(1, &buffer);
3362 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
3363
3364 if (gl_info->gl_ops.gl.p_glGetError())
3365 {
3366 FIXME("Error during filtering test for format %x, returning no filtering\n", internal);
3367 ret = FALSE;
3368 }
3369
3370 return ret;
3371}
ios_base &_STLP_CALL internal(ios_base &__s)
Definition: _ios_base.h:311
static BOOL compare_colour(DWORD c1, DWORD c2, BYTE max_diff)
Definition: utils.c:3265
return ret
Definition: mutex.c:147
unsigned long DWORD
Definition: ntddk_ex.h:95
#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

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 1173 of file utils.c.

1174{
1175 /* FIXME: Is this really how color keys are supposed to work? I think it
1176 * makes more sense to compare the individual channels. */
1177 return color >= color_key->color_space_low_value
1178 && color <= color_key->color_space_high_value;
1179}

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_to_float()

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

Definition at line 5984 of file utils.c.

5985{
5987
5988 if (!size)
5989 return 1.0f;
5990
5991 color >>= offset;
5992 color &= mask;
5993
5994 return (float)color / (float)mask;
5995}
static float(WINAPI *pD2D1Tan)(float angle)
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLenum GLint GLuint mask
Definition: glext.h:6028
static uint32_t wined3d_mask_from_size(unsigned int size)

Referenced by wined3d_format_get_float_color_key().

◆ compare_colour()

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

Definition at line 3265 of file utils.c.

3266{
3267 return compare_uint(c1 & 0xff, c2 & 0xff, max_diff)
3268 && compare_uint((c1 >> 8) & 0xff, (c2 >> 8) & 0xff, max_diff)
3269 && compare_uint((c1 >> 16) & 0xff, (c2 >> 16) & 0xff, max_diff)
3270 && compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff);
3271}
static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
Definition: utils.c:3258

Referenced by check_filter().

◆ compare_uint()

static BOOL compare_uint ( unsigned int  x,
unsigned int  y,
unsigned int  max_diff 
)
static

Definition at line 3258 of file utils.c.

3259{
3260 unsigned int diff = x > y ? x - y : y - x;
3261
3262 return diff <= max_diff;
3263}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by compare_colour().

◆ compute_normal_matrix()

void compute_normal_matrix ( struct wined3d_matrix *  normal_matrix,
BOOL  legacy_lighting,
const struct wined3d_matrix *  modelview 
)

Definition at line 7042 of file utils.c.

7044{
7045 struct wined3d_matrix mv;
7046
7047 mv = *modelview;
7048 if (legacy_lighting)
7049 invert_matrix_3d(&mv, &mv);
7050 else
7051 invert_matrix(&mv, &mv);
7052 /* Tests show that singular modelview matrices are used unchanged as normal
7053 * matrices on D3D3 and older. There seems to be no clearly consistent
7054 * behavior on newer D3D versions so always follow older ddraw behavior. */
7055
7056 normal_matrix->_11 = mv._11;
7057 normal_matrix->_12 = mv._21;
7058 normal_matrix->_13 = mv._31;
7059 normal_matrix->_21 = mv._12;
7060 normal_matrix->_22 = mv._22;
7061 normal_matrix->_23 = mv._32;
7062 normal_matrix->_31 = mv._13;
7063 normal_matrix->_32 = mv._23;
7064 normal_matrix->_33 = mv._33;
7065}
BOOL invert_matrix(struct wined3d_matrix *out, const struct wined3d_matrix *m)
Definition: utils.c:6775
static BOOL invert_matrix_3d(struct wined3d_matrix *out, const struct wined3d_matrix *in)
Definition: utils.c:6980

Referenced by init_transformed_lights(), and wined3d_device_apply_stateblock().

◆ compute_texture_matrix()

static void compute_texture_matrix ( const struct wined3d_matrix *  matrix,
uint32_t  flags,
BOOL  calculated_coords,
enum wined3d_format_id  format_id,
struct wined3d_matrix *  out_matrix 
)
static

Definition at line 5594 of file utils.c.

5596{
5597 struct wined3d_matrix mat;
5598
5600 {
5601 get_identity_matrix(out_matrix);
5602 return;
5603 }
5604
5606 {
5607 ERR("Invalid texture transform flags: WINED3D_TTFF_COUNT1 | WINED3D_TTFF_PROJECTED.\n");
5608 return;
5609 }
5610
5611 mat = *matrix;
5612
5613 /* When less than 4 components are provided for an attribute, the remaining
5614 * components are filled with (..., 0, 0, 1). This is the case when using
5615 * shaders in Direct3D as well as in GL and Vulkan.
5616 *
5617 * However, when using the Direct3D fixed function vertex pipeline, the
5618 * texture coordinates transformed by texture matrices effectively have
5619 * 1 in the first "default" component and 0 in the others (e.g. for
5620 * R32_FLOAT the coordinates are (..., 1, 0, 0).
5621 *
5622 * We could approximate this by modifying the shader, but modifying uniforms
5623 * is generally cheaper, so instead we change the matrix, copying the 2nd or
5624 * 3rd column to the 4th. That is, whichever coefficients expect a value of
5625 * 1 will instead be used as the coefficients for the 4th column, which
5626 * actually has a value of 1. The coefficients for other columns don't need
5627 * to be modified, since the corresponding texcoord components are zero. */
5628
5629 if (!(flags & WINED3D_TTFF_PROJECTED) && !calculated_coords)
5630 {
5631 switch (format_id)
5632 {
5634 mat._41 = mat._21;
5635 mat._42 = mat._22;
5636 mat._43 = mat._23;
5637 mat._44 = mat._24;
5638 break;
5639
5641 mat._41 = mat._31;
5642 mat._42 = mat._32;
5643 mat._43 = mat._33;
5644 mat._44 = mat._34;
5645 break;
5646
5649 case WINED3DFMT_UNKNOWN:
5650 break;
5651 default:
5652 FIXME("Unexpected fixed function texture coord input\n");
5653 }
5654 }
5655
5656 *out_matrix = mat;
5657}
void get_identity_matrix(struct wined3d_matrix *mat)
Definition: utils.c:5575
GLuint GLenum matrix
Definition: glext.h:9407
GLbitfield flags
Definition: glext.h:7161
static const MAT2 mat
Definition: font.c:51
@ WINED3DFMT_R32G32B32_FLOAT
Definition: wined3d.h:161
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:127
@ WINED3DFMT_R32G32B32A32_FLOAT
Definition: wined3d.h:157
@ WINED3D_TTFF_DISABLE
Definition: wined3d.h:618
@ WINED3D_TTFF_COUNT1
Definition: wined3d.h:619
@ WINED3D_TTFF_PROJECTED
Definition: wined3d.h:623

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_color_key *  color_key 
)
static

Definition at line 1204 of file utils.c.

1207{
1208 const WORD *src_row;
1209 unsigned int x, y;
1210 WORD *dst_row;
1211
1212 for (y = 0; y < height; ++y)
1213 {
1214 src_row = (WORD *)&src[src_pitch * y];
1215 dst_row = (WORD *)&dst[dst_pitch * y];
1216 for (x = 0; x < width; ++x)
1217 {
1218 WORD src_color = src_row[x];
1219 if (color_in_range(color_key, src_color))
1220 dst_row[x] = src_color & ~0x8000;
1221 else
1222 dst_row[x] = src_color | 0x8000;
1223 }
1224 }
1225}
static BOOL color_in_range(const struct wined3d_color_key *color_key, DWORD color)
Definition: utils.c:1173
unsigned short WORD
Definition: ntddk_ex.h:93
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_color_key *  color_key 
)
static

Definition at line 1181 of file utils.c.

1184{
1185 const WORD *src_row;
1186 unsigned int x, y;
1187 WORD *dst_row;
1188
1189 for (y = 0; y < height; ++y)
1190 {
1191 src_row = (WORD *)&src[src_pitch * y];
1192 dst_row = (WORD *)&dst[dst_pitch * y];
1193 for (x = 0; x < width; ++x)
1194 {
1195 WORD src_color = src_row[x];
1196 if (!color_in_range(color_key, src_color))
1197 dst_row[x] = 0x8000u | ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
1198 else
1199 dst_row[x] = ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
1200 }
1201 }
1202}

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_color_key *  color_key 
)
static

Definition at line 1227 of file utils.c.

1230{
1231 const BYTE *src_row;
1232 unsigned int x, y;
1233 DWORD *dst_row;
1234
1235 for (y = 0; y < height; ++y)
1236 {
1237 src_row = &src[src_pitch * y];
1238 dst_row = (DWORD *)&dst[dst_pitch * y];
1239 for (x = 0; x < width; ++x)
1240 {
1241 DWORD src_color = (src_row[x * 3 + 2] << 16) | (src_row[x * 3 + 1] << 8) | src_row[x * 3];
1242 if (!color_in_range(color_key, src_color))
1243 dst_row[x] = src_color | 0xff000000;
1244 }
1245 }
1246}

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_color_key *  color_key 
)
static

Definition at line 1271 of file utils.c.

1274{
1275 const DWORD *src_row;
1276 unsigned int x, y;
1277 DWORD *dst_row;
1278
1279 for (y = 0; y < height; ++y)
1280 {
1281 src_row = (DWORD *)&src[src_pitch * y];
1282 dst_row = (DWORD *)&dst[dst_pitch * y];
1283 for (x = 0; x < width; ++x)
1284 {
1285 DWORD src_color = src_row[x];
1286 if (color_in_range(color_key, src_color))
1287 src_color &= ~0xff000000;
1288 dst_row[x] = src_color;
1289 }
1290 }
1291}

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_color_key *  color_key 
)
static

Definition at line 1248 of file utils.c.

1251{
1252 const DWORD *src_row;
1253 unsigned int x, y;
1254 DWORD *dst_row;
1255
1256 for (y = 0; y < height; ++y)
1257 {
1258 src_row = (DWORD *)&src[src_pitch * y];
1259 dst_row = (DWORD *)&dst[dst_pitch * y];
1260 for (x = 0; x < width; ++x)
1261 {
1262 DWORD src_color = src_row[x];
1263 if (color_in_range(color_key, src_color))
1264 dst_row[x] = src_color & ~0xff000000;
1265 else
1266 dst_row[x] = src_color | 0xff000000;
1267 }
1268 }
1269}

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 774 of file utils.c.

776{
777 /* WINED3DFMT_L4A4_UNORM exists as an internal gl format, but for some reason there is not
778 * format+type combination to load it. Thus convert it to A8L8, then load it
779 * with A4L4 internal, but A8L8 format+type
780 */
781 unsigned int x, y, z;
782 const unsigned char *Source;
783 unsigned char *Dest;
784
785 for (z = 0; z < depth; z++)
786 {
787 for (y = 0; y < height; y++)
788 {
789 Source = src + z * src_slice_pitch + y * src_row_pitch;
790 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
791 for (x = 0; x < width; x++ )
792 {
793 unsigned char color = (*Source++);
794 /* A */ Dest[1] = (color & 0xf0u) << 0;
795 /* L */ Dest[0] = (color & 0x0fu) << 4;
796 Dest += 2;
797 }
798 }
799 }
800}
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_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 1053 of file utils.c.

1055{
1056 unsigned int x, y, z;
1057 const WORD *Source;
1058 WORD *Dest;
1059
1060 for (z = 0; z < depth; z++)
1061 {
1062 for (y = 0; y < height; y++)
1063 {
1064 Source = (const WORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1065 Dest = (WORD *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
1066 for (x = 0; x < width; x++ )
1067 {
1068 WORD green = (*Source++);
1069 WORD red = (*Source++);
1070 Dest[0] = green;
1071 Dest[1] = red;
1072 /* Strictly speaking not correct for R16G16F, but it doesn't matter because the
1073 * shader overwrites it anyway */
1074 Dest[2] = 0xffff;
1075 Dest += 3;
1076 }
1077 }
1078 }
1079}
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 1028 of file utils.c.

1030{
1031 unsigned int x, y, z;
1032 const DWORD *Source;
1033 unsigned short *Dest;
1034
1035 for (z = 0; z < depth; z++)
1036 {
1037 for (y = 0; y < height; y++)
1038 {
1039 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1040 Dest = (unsigned short *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
1041 for (x = 0; x < width; x++ )
1042 {
1043 const DWORD color = (*Source++);
1044 /* B */ Dest[0] = 0xffff;
1045 /* G */ Dest[1] = (color >> 16) + 32768; /* V */
1046 /* R */ Dest[2] = (color & 0xffff) + 32768; /* U */
1047 Dest += 3;
1048 }
1049 }
1050 }
1051}

◆ 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 1081 of file utils.c.

1083{
1084 unsigned int x, y, z;
1085 const float *Source;
1086 float *Dest;
1087
1088 for (z = 0; z < depth; z++)
1089 {
1090 for (y = 0; y < height; y++)
1091 {
1092 Source = (const float *)(src + z * src_slice_pitch + y * src_row_pitch);
1093 Dest = (float *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
1094 for (x = 0; x < width; x++ )
1095 {
1096 float green = (*Source++);
1097 float red = (*Source++);
1098 Dest[0] = green;
1099 Dest[1] = red;
1100 Dest[2] = 1.0f;
1101 Dest += 3;
1102 }
1103 }
1104 }
1105}

◆ 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 802 of file utils.c.

804{
805 unsigned int x, y, z;
806 unsigned char r_in, g_in, l_in;
807 const unsigned short *texel_in;
808 unsigned short *texel_out;
809
810 /* Emulating signed 5 bit values with unsigned 5 bit values has some precision problems by design:
811 * E.g. the signed input value 0 becomes 16. GL normalizes it to 16 / 31 = 0.516. We convert it
812 * back to a signed value by subtracting 0.5 and multiplying by 2.0. The resulting value is
813 * ((16 / 31) - 0.5) * 2.0 = 0.032, which is quite different from the intended result 0.000. */
814 for (z = 0; z < depth; z++)
815 {
816 for (y = 0; y < height; y++)
817 {
818 texel_out = (unsigned short *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
819 texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
820 for (x = 0; x < width; x++ )
821 {
822 l_in = (*texel_in & 0xfc00u) >> 10;
823 g_in = (*texel_in & 0x03e0u) >> 5;
824 r_in = *texel_in & 0x001fu;
825
826 *texel_out = ((r_in + 16) << 11) | (l_in << 5) | (g_in + 16);
827 texel_out++;
828 texel_in++;
829 }
830 }
831 }
832}
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 834 of file utils.c.

836{
837 unsigned int x, y, z;
838 unsigned char *texel_out, r_out, g_out, r_in, g_in, l_in;
839 const unsigned short *texel_in;
840
841 for (z = 0; z < depth; z++)
842 {
843 for (y = 0; y < height; y++)
844 {
845 texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
846 texel_out = dst + z * dst_slice_pitch + y * dst_row_pitch;
847 for (x = 0; x < width; x++ )
848 {
849 l_in = (*texel_in & 0xfc00u) >> 10;
850 g_in = (*texel_in & 0x03e0u) >> 5;
851 r_in = *texel_in & 0x001fu;
852
853 r_out = r_in << 3;
854 if (!(r_in & 0x10)) /* r > 0 */
855 r_out |= r_in >> 1;
856
857 g_out = g_in << 3;
858 if (!(g_in & 0x10)) /* g > 0 */
859 g_out |= g_in >> 1;
860
861 texel_out[0] = r_out;
862 texel_out[1] = g_out;
863 texel_out[2] = l_in << 1 | l_in >> 5;
864 texel_out[3] = 0;
865
866 texel_out += 4;
867 texel_in++;
868 }
869 }
870 }
871}
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 873 of file utils.c.

875{
876 unsigned int x, y, z;
877 unsigned char *texel_out, ds_out, dt_out, r_in, g_in, l_in;
878 const unsigned short *texel_in;
879
880 /* This makes the gl surface bigger(24 bit instead of 16), but it works with
881 * fixed function and shaders without further conversion once the surface is
882 * loaded.
883 *
884 * The difference between this function and convert_r5g5_snorm_l6_unorm_ext
885 * is that convert_r5g5_snorm_l6_unorm_ext creates a 32 bit XRGB texture and
886 * this function creates a 24 bit DSDT_MAG texture. Trying to load a DSDT_MAG
887 * internal with a 32 bit DSDT_MAG_INTENSITY or DSDT_MAG_VIB format fails. */
888 for (z = 0; z < depth; z++)
889 {
890 for (y = 0; y < height; y++)
891 {
892 texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
893 texel_out = dst + z * dst_slice_pitch + y * dst_row_pitch;
894 for (x = 0; x < width; x++ )
895 {
896 l_in = (*texel_in & 0xfc00u) >> 10;
897 g_in = (*texel_in & 0x03e0u) >> 5;
898 r_in = *texel_in & 0x001fu;
899
900 ds_out = r_in << 3;
901 if (!(r_in & 0x10)) /* r > 0 */
902 ds_out |= r_in >> 1;
903
904 dt_out = g_in << 3;
905 if (!(g_in & 0x10)) /* g > 0 */
906 dt_out |= g_in >> 1;
907
908 texel_out[0] = ds_out;
909 texel_out[1] = dt_out;
910 texel_out[2] = l_in << 1 | l_in >> 5;
911
912 texel_out += 3;
913 texel_in++;
914 }
915 }
916 }
917}

◆ 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 919 of file utils.c.

921{
922 unsigned int x, y, z;
923 const short *Source;
924 unsigned char *Dest;
925
926 for (z = 0; z < depth; z++)
927 {
928 for (y = 0; y < height; y++)
929 {
930 Source = (const short *)(src + z * src_slice_pitch + y * src_row_pitch);
931 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
932 for (x = 0; x < width; x++ )
933 {
934 const short color = (*Source++);
935 /* B */ Dest[0] = 0xff;
936 /* G */ Dest[1] = (color >> 8) + 128; /* V */
937 /* R */ Dest[2] = (color & 0xff) + 128; /* U */
938 Dest += 3;
939 }
940 }
941 }
942}

◆ 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 944 of file utils.c.

946{
947 unsigned int x, y, z;
948 const DWORD *Source;
949 unsigned char *Dest;
950
951 /* Doesn't work correctly with the fixed function pipeline, but can work in
952 * shaders if the shader is adjusted. (There's no use for this format in gl's
953 * standard fixed function pipeline anyway).
954 */
955 for (z = 0; z < depth; z++)
956 {
957 for (y = 0; y < height; y++)
958 {
959 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
960 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
961 for (x = 0; x < width; x++ )
962 {
963 LONG color = (*Source++);
964 /* B */ Dest[0] = ((color >> 16) & 0xff); /* L */
965 /* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
966 /* R */ Dest[2] = (color & 0xff) + 128; /* U */
967 Dest += 4;
968 }
969 }
970 }
971}
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 973 of file utils.c.

975{
976 unsigned int x, y, z;
977 const DWORD *Source;
978 unsigned char *Dest;
979
980 /* This implementation works with the fixed function pipeline and shaders
981 * without further modification after converting the surface.
982 */
983 for (z = 0; z < depth; z++)
984 {
985 for (y = 0; y < height; y++)
986 {
987 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
988 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
989 for (x = 0; x < width; x++ )
990 {
991 LONG color = (*Source++);
992 /* L */ Dest[2] = ((color >> 16) & 0xff); /* L */
993 /* V */ Dest[1] = ((color >> 8 ) & 0xff); /* V */
994 /* U */ Dest[0] = (color & 0xff); /* U */
995 /* I */ Dest[3] = 255; /* X */
996 Dest += 4;
997 }
998 }
999 }
1000}

◆ 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 1002 of file utils.c.

1004{
1005 unsigned int x, y, z;
1006 const DWORD *Source;
1007 unsigned char *Dest;
1008
1009 for (z = 0; z < depth; z++)
1010 {
1011 for (y = 0; y < height; y++)
1012 {
1013 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1014 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
1015 for (x = 0; x < width; x++ )
1016 {
1017 LONG color = (*Source++);
1018 /* B */ Dest[0] = ((color >> 16) & 0xff) + 128; /* W */
1019 /* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
1020 /* R */ Dest[2] = (color & 0xff) + 128; /* U */
1021 /* A */ Dest[3] = ((color >> 24) & 0xff) + 128; /* Q */
1022 Dest += 4;
1023 }
1024 }
1025 }
1026}

◆ 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 1107 of file utils.c.

1109{
1110 unsigned int x, y, z;
1111
1112 for (z = 0; z < depth; z++)
1113 {
1114 for (y = 0; y < height; ++y)
1115 {
1116 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1117 float *dest_f = (float *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
1118 DWORD *dest_s = (DWORD *)dest_f;
1119
1120 for (x = 0; x < width; ++x)
1121 {
1122 dest_f[x * 2] = float_24_to_32((source[x] & 0xffffff00u) >> 8);
1123 dest_s[x * 2 + 1] = source[x] & 0xff;
1124 }
1125 }
1126 }
1127}
static float float_24_to_32(DWORD in)

◆ copy_format()

static void copy_format ( const struct wined3d_adapter *  adapter,
struct wined3d_format *  dst_format,
const struct wined3d_format *  src_format 
)
static

Definition at line 1993 of file utils.c.

1995{
1996 enum wined3d_format_id id = dst_format->id;
1997 memcpy(dst_format, src_format, adapter->format_size);
1998 dst_format->id = id;
1999}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const char * dst_format
Definition: dib.c:1339

Referenced by init_format_texture_info(), init_srgb_formats(), and init_typeless_formats().

◆ create_and_bind_fbo_attachment()

static void create_and_bind_fbo_attachment ( const struct wined3d_gl_info *  gl_info,
const struct wined3d_format_gl *  format_gl,
enum wined3d_gl_resource_type  d3d_type,
GLuint *  object,
GLenum  internal 
)
static

Definition at line 2271 of file utils.c.

2274{
2275 GLenum format = format_gl->format;
2276 GLenum type = format_gl->type;
2278
2279 attach_type = format_gl->f.depth_size ? GL_DEPTH_ATTACHMENT : GL_COLOR_ATTACHMENT0;
2280 switch (d3d_type)
2281 {
2283 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2284 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, *object);
2285 gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, internal, 16, 0, format, type, NULL);
2286 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2287 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2288
2289 gl_info->fbo_ops.glFramebufferTexture1D(GL_FRAMEBUFFER, attach_type, GL_TEXTURE_1D, *object, 0);
2290 if (format_gl->f.stencil_size)
2291 gl_info->fbo_ops.glFramebufferTexture1D(GL_FRAMEBUFFER,
2293 break;
2294
2296 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2297 gl_info->gl_ops.gl.p_glBindTexture(wined3d_gl_type_to_enum(d3d_type), *object);
2298 gl_info->gl_ops.gl.p_glTexImage2D(wined3d_gl_type_to_enum(d3d_type), 0, internal, 16, 16, 0,
2299 format, type, NULL);
2300 gl_info->gl_ops.gl.p_glTexParameteri(wined3d_gl_type_to_enum(d3d_type), GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2301 gl_info->gl_ops.gl.p_glTexParameteri(wined3d_gl_type_to_enum(d3d_type), GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2302
2303 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, attach_type,
2304 wined3d_gl_type_to_enum(d3d_type), *object, 0);
2305 if (format_gl->f.stencil_size)
2306 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
2307 wined3d_gl_type_to_enum(d3d_type), *object, 0);
2308 break;
2309
2311 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2312 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_3D, *object);
2314 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2315 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2316
2317 gl_info->fbo_ops.glFramebufferTexture3D(GL_FRAMEBUFFER, attach_type, GL_TEXTURE_3D, *object, 0, 0);
2318 if (format_gl->f.stencil_size)
2319 gl_info->fbo_ops.glFramebufferTexture3D(GL_FRAMEBUFFER,
2320 GL_STENCIL_ATTACHMENT, GL_TEXTURE_3D, *object, 0, 0);
2321 break;
2322
2324 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2325 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, *object);
2326 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, internal, 16, 16, 0,
2327 format, type, NULL);
2328 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, 0, internal, 16, 16, 0,
2329 format, type, NULL);
2330 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, 0, internal, 16, 16, 0,
2331 format, type, NULL);
2332 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, 0, internal, 16, 16, 0,
2333 format, type, NULL);
2334 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, 0, internal, 16, 16, 0,
2335 format, type, NULL);
2336 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 0, internal, 16, 16, 0,
2337 format, type, NULL);
2338 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2339 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2340
2341 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, attach_type,
2343 if (format_gl->f.stencil_size)
2344 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
2346 break;
2347
2349 gl_info->fbo_ops.glGenRenderbuffers(1, object);
2350 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, *object);
2351 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, internal, 16, 16);
2352 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, attach_type, GL_RENDERBUFFER, *object);
2353 if (format_gl->f.stencil_size)
2354 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER,
2356 break;
2357
2360 break;
2361 }
2362
2363 /* Ideally we'd skip all formats already known not to work on textures
2364 * by checking for WINED3D_FORMAT_CAP_TEXTURE here. However, we want to
2365 * know if we can attach WINED3DFMT_P8_UINT textures to FBOs, and this
2366 * format never has WINED3D_FORMAT_CAP_TEXTURE set. Instead, swallow GL
2367 * errors generated by invalid formats. */
2368 while (gl_info->gl_ops.gl.p_glGetError());
2369}
attach_type
Definition: opentype.c:507
#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
struct wined3d_format f
Definition: wined3d_gl.h:1142
#define GL_EXTCALL(f)
Definition: wined3d_gl.h:360

Referenced by check_fbo_compat().

◆ create_color_fixup_desc_from_string()

static struct color_fixup_desc create_color_fixup_desc_from_string ( const char *  s)
static

Definition at line 3470 of file utils.c.

3471{
3472 struct color_fixup_desc fixup;
3473
3474 if (strlen(s) != 4)
3475 {
3476 ERR("Invalid fixup string %s.\n", wine_dbgstr_a(s));
3477 return COLOR_FIXUP_IDENTITY;
3478 }
3479
3480 fixup.x_sign_fixup = fixup_sign_from_char(s[0]);
3481 fixup.x_source = fixup_source_from_char(s[0]);
3482 fixup.y_sign_fixup = fixup_sign_from_char(s[1]);
3483 fixup.y_source = fixup_source_from_char(s[1]);
3484 fixup.z_sign_fixup = fixup_sign_from_char(s[2]);
3485 fixup.z_source = fixup_source_from_char(s[2]);
3486 fixup.w_sign_fixup = fixup_sign_from_char(s[3]);
3487 fixup.w_source = fixup_source_from_char(s[3]);
3488
3489 return fixup;
3490}
static enum fixup_channel_source fixup_source_from_char(char c)
Definition: utils.c:3439
static unsigned int fixup_sign_from_char(char c)
Definition: utils.c:3463
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
GLdouble s
Definition: gl.h:2039
int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:160
static const struct color_fixup_desc COLOR_FIXUP_IDENTITY

Referenced by apply_format_fixups(), and init_vulkan_format_info().

◆ debug_append()

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

Definition at line 4810 of file utils.c.

4811{
4812 int size;
4813
4814 if (!separator || buffer->ptr == buffer->str)
4815 separator = "";
4816 size = snprintf(buffer->ptr, buffer->size, "%s%s", separator, str);
4817 if (size == -1 || size >= buffer->size)
4818 {
4819 buffer->size = 0;
4820 strcpy(&buffer->str[sizeof(buffer->str) - 4], "...");
4821 return;
4822 }
4823
4824 buffer->ptr += size;
4825 buffer->size -= size;
4826}
static const WCHAR separator[]
Definition: asmname.c:65
const WCHAR * str
strcpy
Definition: string.h:131
#define snprintf
Definition: wintirpc.h:48

◆ debug_bo_address()

const char * debug_bo_address ( const struct wined3d_bo_address *  address)

Definition at line 4600 of file utils.c.

4601{
4603}
const char * debug_const_bo_address(const struct wined3d_const_bo_address *address)
Definition: utils.c:4593
GLuint address
Definition: glext.h:9393

Referenced by context_update_stream_info(), wined3d_context_gl_load_numbered_arrays(), wined3d_deferred_context_map_upload_bo(), wined3d_texture_gl_download_data(), and wined3d_texture_vk_download_data().

◆ debug_box()

◆ debug_color()

◆ debug_complex_fixup()

static const char * debug_complex_fixup ( enum complex_fixup  fixup)
static

Definition at line 5522 of file utils.c.

5523{
5524 switch(fixup)
5525 {
5526#define WINED3D_TO_STR(x) case x: return #x
5533#undef WINED3D_TO_STR
5534 default:
5535 FIXME("Unrecognized complex fixup %#x\n", fixup);
5536 return "unrecognized";
5537 }
5538}
#define WINED3D_TO_STR(x)

Referenced by dump_color_fixup_desc().

◆ debug_const_bo_address()

◆ debug_d3ddeclmethod()

const char * debug_d3ddeclmethod ( enum wined3d_decl_method  method)

Definition at line 4933 of file utils.c.

4934{
4935 switch (method)
4936 {
4937#define WINED3DDECLMETHOD_TO_STR(u) case u: return #u
4945#undef WINED3DDECLMETHOD_TO_STR
4946 default:
4947 FIXME("Unrecognized declaration method %#x.\n", method);
4948 return "unrecognized";
4949 }
4950}
#define WINED3DDECLMETHOD_TO_STR(u)
method
Definition: dragdrop.c:54
@ WINED3D_DECL_METHOD_LOOKUP
Definition: wined3d.h:801
@ WINED3D_DECL_METHOD_LOOKUP_PRESAMPLED
Definition: wined3d.h:802
@ WINED3D_DECL_METHOD_PARTIAL_V
Definition: wined3d.h:798
@ WINED3D_DECL_METHOD_CROSS_UV
Definition: wined3d.h:799
@ WINED3D_DECL_METHOD_UV
Definition: wined3d.h:800
@ WINED3D_DECL_METHOD_PARTIAL_U
Definition: wined3d.h:797
@ WINED3D_DECL_METHOD_DEFAULT
Definition: wined3d.h:796

Referenced by dump_wined3d_vertex_element().

◆ debug_d3ddeclusage()

const char * debug_d3ddeclusage ( enum wined3d_decl_usage  usage)

Definition at line 4952 of file utils.c.

4953{
4954 switch (usage)
4955 {
4956#define WINED3DDECLUSAGE_TO_STR(u) case u: return #u
4971#undef WINED3DDECLUSAGE_TO_STR
4972 default:
4973 FIXME("Unrecognized %u declaration usage!\n", usage);
4974 return "unrecognized";
4975 }
4976}
#define WINED3DDECLUSAGE_TO_STR(u)
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
@ WINED3D_DECL_USAGE_DEPTH
Definition: wined3d.h:819
@ WINED3D_DECL_USAGE_BLEND_INDICES
Definition: wined3d.h:809
@ WINED3D_DECL_USAGE_TESS_FACTOR
Definition: wined3d.h:815
@ WINED3D_DECL_USAGE_NORMAL
Definition: wined3d.h:810
@ WINED3D_DECL_USAGE_PSIZE
Definition: wined3d.h:811
@ WINED3D_DECL_USAGE_BLEND_WEIGHT
Definition: wined3d.h:808
@ WINED3D_DECL_USAGE_SAMPLE
Definition: wined3d.h:820
@ WINED3D_DECL_USAGE_POSITION
Definition: wined3d.h:807
@ WINED3D_DECL_USAGE_BINORMAL
Definition: wined3d.h:814
@ WINED3D_DECL_USAGE_COLOR
Definition: wined3d.h:817
@ WINED3D_DECL_USAGE_POSITIONT
Definition: wined3d.h:816
@ WINED3D_DECL_USAGE_TEXCOORD
Definition: wined3d.h:812
@ WINED3D_DECL_USAGE_TANGENT
Definition: wined3d.h:813
@ WINED3D_DECL_USAGE_FOG
Definition: wined3d.h:818

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 4781 of file utils.c.

4782{
4783 switch (device_type)
4784 {
4785#define DEVTYPE_TO_STR(dev) case dev: return #dev
4789#undef DEVTYPE_TO_STR
4790 default:
4791 FIXME("Unrecognized device type %#x.\n", device_type);
4792 return "unrecognized";
4793 }
4794}
device_type
#define DEVTYPE_TO_STR(dev)
@ WINED3D_DEVICE_TYPE_SW
Definition: wined3d.h:93
@ WINED3D_DEVICE_TYPE_HAL
Definition: wined3d.h:91
@ WINED3D_DEVICE_TYPE_REF
Definition: wined3d.h:92

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 4605 of file utils.c.

4606{
4607 switch (format_id)
4608 {
4609#define FMT_TO_STR(format_id) case format_id: return #format_id
4763#undef FMT_TO_STR
4764 default:
4765 {
4766 char fourcc[5];
4767 fourcc[0] = (char)(format_id);
4768 fourcc[1] = (char)(format_id >> 8);
4769 fourcc[2] = (char)(format_id >> 16);
4770 fourcc[3] = (char)(format_id >> 24);
4771 fourcc[4] = 0;
4772 if (isprint(fourcc[0]) && isprint(fourcc[1]) && isprint(fourcc[2]) && isprint(fourcc[3]))
4773 FIXME("Unrecognized %#x (as fourcc: %s) WINED3DFORMAT!\n", format_id, fourcc);
4774 else
4775 FIXME("Unrecognized %#x WINED3DFORMAT!\n", format_id);
4776 }
4777 return "unrecognized";
4778 }
4779}
#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:160
@ WINED3DFMT_R8_TYPELESS
Definition: wined3d.h:217
@ WINED3DFMT_B2G3R3_UNORM
Definition: wined3d.h:131
@ WINED3DFMT_R32G32B32_SINT
Definition: wined3d.h:163
@ WINED3DFMT_R8G8_UNORM
Definition: wined3d.h:206
@ WINED3DFMT_BC7_TYPELESS
Definition: wined3d.h:253
@ WINED3DFMT_BC7_UNORM_SRGB
Definition: wined3d.h:255
@ WINED3DFMT_R32G32_SINT
Definition: wined3d.h:173
@ WINED3DFMT_X24_TYPELESS_G8_UINT
Definition: wined3d.h:204
@ WINED3DFMT_BC2_UNORM_SRGB
Definition: wined3d.h:232
@ WINED3DFMT_B4G4R4A4_UNORM
Definition: wined3d.h:130
@ WINED3DFMT_R16G16_UINT
Definition: wined3d.h:193
@ WINED3DFMT_R8G8_TYPELESS
Definition: wined3d.h:205
@ WINED3DFMT_R10G10B10X2_UINT
Definition: wined3d.h:145
@ WINED3DFMT_X8D24_UNORM
Definition: wined3d.h:151
@ WINED3DFMT_R32_SINT
Definition: wined3d.h:200
@ WINED3DFMT_DXT2
Definition: wined3d.h:261
@ WINED3DFMT_D32_FLOAT
Definition: wined3d.h:197
@ WINED3DFMT_R10G10B10A2_UNORM
Definition: wined3d.h:179
@ WINED3DFMT_R8_UINT
Definition: wined3d.h:219
@ WINED3DFMT_R8G8_SNORM_Cx
Definition: wined3d.h:155
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:244
@ WINED3DFMT_R16_UNORM
Definition: wined3d.h:213
@ WINED3DFMT_R24G8_TYPELESS
Definition: wined3d.h:201
@ WINED3DFMT_R10G10B10A2_TYPELESS
Definition: wined3d.h:178
@ WINED3DFMT_R32G32_UINT
Definition: wined3d.h:172
@ WINED3DFMT_R32G32B32_UINT
Definition: wined3d.h:162
@ WINED3DFMT_BC4_TYPELESS
Definition: wined3d.h:236
@ WINED3DFMT_BC2_UNORM
Definition: wined3d.h:231
@ WINED3DFMT_R8_UNORM
Definition: wined3d.h:218
@ WINED3DFMT_S8_UINT_D24_FLOAT
Definition: wined3d.h:154
@ WINED3DFMT_R10G10B10_XR_BIAS_A2_UNORM
Definition: wined3d.h:182
@ WINED3DFMT_R16_TYPELESS
Definition: wined3d.h:210
@ WINED3DFMT_R16G16B16A16_SINT
Definition: wined3d.h:169
@ WINED3DFMT_D16_LOCKABLE
Definition: wined3d.h:148
@ WINED3DFMT_R10G11B11_SNORM
Definition: wined3d.h:143
@ WINED3DFMT_S1_UINT_D15_UNORM
Definition: wined3d.h:150
@ WINED3DFMT_R16_SINT
Definition: wined3d.h:216
@ WINED3DFMT_B2G3R3A8_UNORM
Definition: wined3d.h:132
@ WINED3DFMT_R8G8_B8G8_UNORM
Definition: wined3d.h:225
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:245
@ WINED3DFMT_R32_FLOAT_X8X24_TYPELESS
Definition: wined3d.h:176
@ WINED3DFMT_R8G8B8X8_UNORM
Definition: wined3d.h:134
@ WINED3DFMT_BC1_UNORM_SRGB
Definition: wined3d.h:229
@ WINED3DFMT_B5G5R5X1_UNORM
Definition: wined3d.h:129
@ WINED3DFMT_B10G10R10A2_UNORM
Definition: wined3d.h:135
@ WINED3DFMT_D16_UNORM
Definition: wined3d.h:212
@ WINED3DFMT_NVHS
Definition: wined3d.h:273
@ WINED3DFMT_R8G8B8A8_TYPELESS
Definition: wined3d.h:184
@ WINED3DFMT_R8G8_UINT
Definition: wined3d.h:207
@ WINED3DFMT_BC7_UNORM
Definition: wined3d.h:254
@ WINED3DFMT_B8G8R8_UNORM
Definition: wined3d.h:128
@ WINED3DFMT_DXT1
Definition: wined3d.h:260
@ WINED3DFMT_R8G8B8A8_UNORM_SRGB
Definition: wined3d.h:186
@ WINED3DFMT_R9G9B9E5_SHAREDEXP
Definition: wined3d.h:224
@ WINED3DFMT_B8G8R8X8_TYPELESS
Definition: wined3d.h:248
@ WINED3DFMT_R32_UINT
Definition: wined3d.h:199
@ WINED3DFMT_B5G5R5A1_UNORM
Definition: wined3d.h:243
@ WINED3DFMT_R10G10B10_SNORM_A2_UNORM
Definition: wined3d.h:147
@ WINED3DFMT_DXT3
Definition: wined3d.h:262
@ WINED3DFMT_DXT4
Definition: wined3d.h:263
@ WINED3DFMT_D32_UNORM
Definition: wined3d.h:149
@ WINED3DFMT_R8G8B8A8_UNORM
Definition: wined3d.h:185
@ WINED3DFMT_R10G10B10A2_UINT
Definition: wined3d.h:180
@ WINED3DFMT_G8R8_G8B8_UNORM
Definition: wined3d.h:226
@ WINED3DFMT_R10G10B10X2_TYPELESS
Definition: wined3d.h:144
@ WINED3DFMT_R32G32B32A32_UINT
Definition: wined3d.h:158
@ WINED3DFMT_BC3_UNORM
Definition: wined3d.h:234
@ WINED3DFMT_BC6H_UF16
Definition: wined3d.h:251
@ WINED3DFMT_R16G16B16A16_TYPELESS
Definition: wined3d.h:164
@ WINED3DFMT_R10G10B10A2_SNORM
Definition: wined3d.h:181
@ WINED3DFMT_R24_UNORM_X8_TYPELESS
Definition: wined3d.h:203
@ WINED3DFMT_R16
Definition: wined3d.h:277
@ WINED3DFMT_D32_FLOAT_S8X24_UINT
Definition: wined3d.h:175
@ WINED3DFMT_NVHU
Definition: wined3d.h:272
@ WINED3DFMT_X32_TYPELESS_G8X24_UINT
Definition: wined3d.h:177
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:242
@ WINED3DFMT_R16G16B16A16_UINT
Definition: wined3d.h:167
@ WINED3DFMT_S4X4_UINT_D24_UNORM
Definition: wined3d.h:152
@ WINED3DFMT_BC1_TYPELESS
Definition: wined3d.h:227
@ WINED3DFMT_B8G8R8X8_UNORM_SRGB
Definition: wined3d.h:249
@ WINED3DFMT_DXT5
Definition: wined3d.h:264
@ WINED3DFMT_BC4_UNORM
Definition: wined3d.h:237
@ WINED3DFMT_B8G8R8A8_TYPELESS
Definition: wined3d.h:246
@ WINED3DFMT_BC3_TYPELESS
Definition: wined3d.h:233
@ WINED3DFMT_R16G16_TYPELESS
Definition: wined3d.h:190
@ WINED3DFMT_R8_SNORM
Definition: wined3d.h:220
@ WINED3DFMT_G8R8_G8B8
Definition: wined3d.h:266
@ WINED3DFMT_R8G8B8A8_UINT
Definition: wined3d.h:187
@ WINED3DFMT_R16_SNORM
Definition: wined3d.h:215
@ WINED3DFMT_BC6H_TYPELESS
Definition: wined3d.h:250
@ WINED3DFMT_R32G32B32A32_TYPELESS
Definition: wined3d.h:156
@ WINED3DFMT_R32_TYPELESS
Definition: wined3d.h:196
@ WINED3DFMT_R32G8X24_TYPELESS
Definition: wined3d.h:174
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:214
@ WINED3DFMT_R8_SINT
Definition: wined3d.h:221
@ WINED3DFMT_BC5_TYPELESS
Definition: wined3d.h:239
@ WINED3DFMT_R8G8_SINT
Definition: wined3d.h:209
@ WINED3DFMT_R32G32B32A32_SINT
Definition: wined3d.h:159
@ WINED3DFMT_R8G8B8A8_SINT
Definition: wined3d.h:189
@ WINED3DFMT_R10G10B10X2_SNORM
Definition: wined3d.h:146
@ WINED3DFMT_R1_UNORM
Definition: wined3d.h:223
@ WINED3DFMT_R11G11B10_FLOAT
Definition: wined3d.h:183
@ WINED3DFMT_B8G8R8A8_UNORM_SRGB
Definition: wined3d.h:247
@ WINED3DFMT_BC3_UNORM_SRGB
Definition: wined3d.h:235
@ WINED3DFMT_BC2_TYPELESS
Definition: wined3d.h:230
@ WINED3DFMT_R8G8_B8G8
Definition: wined3d.h:267
@ WINED3DFMT_BC6H_SF16
Definition: wined3d.h:252
@ WINED3DFMT_B4G4R4X4_UNORM
Definition: wined3d.h:133
@ WINED3DFMT_MULTI2_ARGB8
Definition: wined3d.h:265
@ WINED3DFMT_AL16
Definition: wined3d.h:278
@ WINED3DFMT_D24_UNORM_S8_UINT
Definition: wined3d.h:202
@ WINED3DFMT_P8_UINT_A8_UNORM
Definition: wined3d.h:136
@ WINED3DFMT_R16G16B16A16_SNORM
Definition: wined3d.h:168
@ WINED3DFMT_R16G16_SINT
Definition: wined3d.h:195
@ WINED3DFMT_R32G32_TYPELESS
Definition: wined3d.h:170

Referenced by check_fbo_compat(), context_choose_pixel_format(), cpu_blitter_clear(), cpu_blitter_clear_rtv(), cpu_blitter_clear_texture(), depthbias(), dump_wined3d_vertex_element(), get_format_internal(), init_format_depth_bias_scale(), init_format_fbo_compat_info(), init_format_filter_info(), init_vulkan_format_info(), query_format_cap(), query_internal_format(), query_view_class(), resource_init(), surface_convert_format(), surface_cpu_blt(), surface_cpu_blt_compressed(), swapchain_blit_gdi(), texture2d_blt(), texture2d_depth_blt_fbo(), 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_context_gl_find_fbo_entry(), wined3d_debug_view_desc(), wined3d_device_context_clear_uav_float(), wined3d_device_context_copy_resource(), wined3d_device_context_copy_sub_resource_region(), wined3d_device_context_resolve_sub_resource(), wined3d_device_context_set_index_buffer(), wined3d_device_reset(), wined3d_device_set_cursor_properties(), wined3d_format_convert_from_float(), wined3d_format_get_color_key_conversion(), wined3d_format_get_colour(), wined3d_format_get_float_color_key(), wined3d_get_format(), wined3d_output_find_closest_matching_mode(), wined3d_output_get_display_mode(), wined3d_output_get_mode(), wined3d_output_get_mode_count(), wined3d_output_set_display_mode(), wined3d_render_target_view_gl_cs_init(), wined3d_shader_resource_view_gl_cs_init(), wined3d_shader_resource_view_vk_generate_mipmap(), wined3d_stateblock_set_index_buffer(), wined3d_stream_info_from_declaration(), wined3d_swapchain_get_display_mode(), wined3d_swapchain_resize_buffers(), wined3d_swapchain_state_init(), wined3d_swapchain_vk_select_vk_format(), wined3d_texture_create_dc(), wined3d_texture_gl_download_data(), wined3d_texture_gl_download_data_slow_path(), wined3d_texture_gl_prepare_texture(), wined3d_texture_gl_upload_data(), wined3d_texture_init(), wined3d_texture_vk_download_data(), wined3d_texture_vk_upload_data(), wined3d_unordered_access_view_gl_clear(), and wined3d_unordered_access_view_vk_clear().

◆ debug_d3dinput_classification()

const char * debug_d3dinput_classification ( enum wined3d_input_classification  classification)

Definition at line 4978 of file utils.c.

4979{
4980 switch (classification)
4981 {
4982#define WINED3D_TO_STR(x) case x: return #x
4985#undef WINED3D_TO_STR
4986 default:
4987 FIXME("Unrecognized input classification %#x.\n", classification);
4988 return "unrecognized";
4989 }
4990}
@ WINED3D_INPUT_PER_INSTANCE_DATA
Definition: wined3d.h:1827
@ WINED3D_INPUT_PER_VERTEX_DATA
Definition: wined3d.h:1826

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 5009 of file utils.c.

5010{
5011 switch (primitive_type)
5012 {
5013#define PRIM_TO_STR(prim) case prim: return #prim
5026#undef PRIM_TO_STR
5027 default:
5028 FIXME("Unrecognized primitive type %#x.\n", primitive_type);
5029 return "unrecognized";
5030 }
5031}
#define PRIM_TO_STR(prim)
@ WINED3D_PT_LINESTRIP_ADJ
Definition: wined3d.h:83
@ WINED3D_PT_LINELIST
Definition: wined3d.h:77
@ WINED3D_PT_UNDEFINED
Definition: wined3d.h:75
@ WINED3D_PT_PATCH
Definition: wined3d.h:86
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:76
@ WINED3D_PT_TRIANGLELIST_ADJ
Definition: wined3d.h:84
@ WINED3D_PT_LINELIST_ADJ
Definition: wined3d.h:82
@ WINED3D_PT_TRIANGLESTRIP_ADJ
Definition: wined3d.h:85
@ WINED3D_PT_TRIANGLESTRIP
Definition: wined3d.h:80
@ WINED3D_PT_LINESTRIP
Definition: wined3d.h:78
@ WINED3D_PT_TRIANGLELIST
Definition: wined3d.h:79
@ WINED3D_PT_TRIANGLEFAN
Definition: wined3d.h:81

Referenced by gl_primitive_type_from_d3d(), glsl_primitive_type_from_d3d(), shader_glsl_generate_geometry_shader(), vk_topology_class_from_wined3d(), vk_topology_from_wined3d(), wined3d_device_context_get_primitive_type(), and wined3d_device_context_set_primitive_type().

◆ debug_d3drenderstate()

const char * debug_d3drenderstate ( enum wined3d_render_state  state)

Definition at line 5033 of file utils.c.

5034{
5035 switch (state)
5036 {
5037#define D3DSTATE_TO_STR(u) case u: return #u
5162#undef D3DSTATE_TO_STR
5163 default:
5164 FIXME("Unrecognized %u render state!\n", state);
5165 return "unrecognized";
5166 }
5167}
static int state
Definition: maze.c:121
#define D3DSTATE_TO_STR(u)
@ WINED3D_RS_TEXTUREFACTOR
Definition: wined3d.h:337
@ WINED3D_RS_COLORKEYENABLE
Definition: wined3d.h:323
@ WINED3D_RS_STENCILFAIL
Definition: wined3d.h:330
@ WINED3D_RS_NORMALDEGREE
Definition: wined3d.h:380
@ WINED3D_RS_WRAP8
Definition: wined3d.h:402
@ WINED3D_RS_LIGHTING
Definition: wined3d.h:347
@ WINED3D_RS_SOFTWAREVERTEXPROCESSING
Definition: wined3d.h:361
@ WINED3D_RS_STIPPLEDALPHA
Definition: wined3d.h:316
@ WINED3D_RS_COLORWRITEENABLE1
Definition: wined3d.h:396
@ WINED3D_RS_STENCILENABLE
Definition: wined3d.h:329
@ WINED3D_RS_COLORVERTEX
Definition: wined3d.h:351
@ WINED3D_RS_TWEENFACTOR
Definition: wined3d.h:377
@ WINED3D_RS_FOGCOLOR
Definition: wined3d.h:317
@ WINED3D_RS_WRAP4
Definition: wined3d.h:342
@ WINED3D_RS_WRAP15
Definition: wined3d.h:409
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:293
@ WINED3D_RS_ANTIALIASEDLINEENABLE
Definition: wined3d.h:383
@ WINED3D_RS_SPECULARMATERIALSOURCE
Definition: wined3d.h:356
@ WINED3D_RS_STENCILPASS
Definition: wined3d.h:332
@ WINED3D_RS_WRAP13
Definition: wined3d.h:407
@ WINED3D_RS_DEBUGMONITORTOKEN
Definition: wined3d.h:373
@ WINED3D_RS_WRAP1
Definition: wined3d.h:339
@ WINED3D_RS_WRAP3
Definition: wined3d.h:341
@ WINED3D_RS_DEPTHBIAS
Definition: wined3d.h:401
@ WINED3D_RS_MAXTESSELLATIONLEVEL
Definition: wined3d.h:385
@ WINED3D_RS_DITHERENABLE
Definition: wined3d.h:309
@ WINED3D_RS_SHADEMODE
Definition: wined3d.h:295
@ WINED3D_RS_CULLMODE
Definition: wined3d.h:305
@ WINED3D_RS_BACK_STENCILPASS
Definition: wined3d.h:394
@ WINED3D_RS_WRAPV
Definition: wined3d.h:292
@ WINED3D_RS_PATCHEDGESTYLE
Definition: wined3d.h:371
@ WINED3D_RS_SCISSORTESTENABLE
Definition: wined3d.h:381
@ WINED3D_RS_LASTPIXEL
Definition: wined3d.h:302
@ WINED3D_RS_VERTEXBLEND
Definition: wined3d.h:359
@ WINED3D_RS_FOGEND
Definition: wined3d.h:320
@ WINED3D_RS_MINTESSELLATIONLEVEL
Definition: wined3d.h:384
@ WINED3D_RS_POINTSCALE_A
Definition: wined3d.h:366
@ WINED3D_RS_MULTISAMPLEMASK
Definition: wined3d.h:370
@ WINED3D_RS_BACK_STENCILFUNC
Definition: wined3d.h:395
@ WINED3D_RS_SRCBLEND
Definition: wined3d.h:303
@ WINED3D_RS_SRGBWRITEENABLE
Definition: wined3d.h:400
@ WINED3D_RS_RANGEFOGENABLE
Definition: wined3d.h:325
@ WINED3D_RS_POINTSIZE_MIN
Definition: wined3d.h:363
@ WINED3D_RS_TEXTUREPERSPECTIVE
Definition: wined3d.h:290
@ WINED3D_RS_ENABLEADAPTIVETESSELLATION
Definition: wined3d.h:390
@ WINED3D_RS_COLORWRITEENABLE3
Definition: wined3d.h:398
@ WINED3D_RS_ALPHABLENDENABLE
Definition: wined3d.h:310
@ WINED3D_RS_WRAPU
Definition: wined3d.h:291
@ WINED3D_RS_ADAPTIVETESS_X
Definition: wined3d.h:386
@ WINED3D_RS_MONOENABLE
Definition: wined3d.h:297
@ WINED3D_RS_LOCALVIEWER
Definition: wined3d.h:352
@ WINED3D_RS_ADAPTIVETESS_Z
Definition: wined3d.h:388
@ WINED3D_RS_WRAP0
Definition: wined3d.h:338
@ WINED3D_RS_STENCILMASK
Definition: wined3d.h:335
@ WINED3D_RS_BLENDOP
Definition: wined3d.h:378
@ WINED3D_RS_POINTSCALE_C
Definition: wined3d.h:368
@ WINED3D_RS_FOGSTART
Definition: wined3d.h:319
@ WINED3D_RS_STENCILFUNC
Definition: wined3d.h:333
@ WINED3D_RS_WRAP7
Definition: wined3d.h:345
@ WINED3D_RS_FOGTABLEMODE
Definition: wined3d.h:318
@ WINED3D_RS_POINTSIZE
Definition: wined3d.h:362
@ WINED3D_RS_POINTSIZE_MAX
Definition: wined3d.h:374
@ WINED3D_RS_ZWRITEENABLE
Definition: wined3d.h:300
@ WINED3D_RS_PLANEMASK
Definition: wined3d.h:299
@ WINED3D_RS_SUBPIXELX
Definition: wined3d.h:315
@ WINED3D_RS_CLIPPLANEENABLE
Definition: wined3d.h:360
@ WINED3D_RS_DESTBLEND
Definition: wined3d.h:304
@ WINED3D_RS_AMBIENTMATERIALSOURCE
Definition: wined3d.h:357
@ WINED3D_RS_WRAP6
Definition: wined3d.h:344
@ WINED3D_RS_STENCILREF
Definition: wined3d.h:334
@ WINED3D_RS_FOGENABLE
Definition: wined3d.h:311
@ WINED3D_RS_POINTSPRITEENABLE
Definition: wined3d.h:364
@ WINED3D_RS_FLUSHBATCH
Definition: wined3d.h:327
@ WINED3D_RS_BACK_STENCILZFAIL
Definition: wined3d.h:393
@ WINED3D_RS_ZFUNC
Definition: wined3d.h:306
@ WINED3D_RS_ROP2
Definition: wined3d.h:298
@ WINED3D_RS_POSITIONDEGREE
Definition: wined3d.h:379
@ WINED3D_RS_MULTISAMPLEANTIALIAS
Definition: wined3d.h:369
@ WINED3D_RS_ANTIALIAS
Definition: wined3d.h:289
@ WINED3D_RS_BACK_STENCILFAIL
Definition: wined3d.h:392
@ WINED3D_RS_COLORWRITEENABLE
Definition: wined3d.h:376
@ WINED3D_RS_SLOPESCALEDEPTHBIAS
Definition: wined3d.h:382
@ WINED3D_RS_DIFFUSEMATERIALSOURCE
Definition: wined3d.h:355
@ WINED3D_RS_ALPHAREF
Definition: wined3d.h:307
@ WINED3D_RS_NORMALIZENORMALS
Definition: wined3d.h:353
@ WINED3D_RS_ANISOTROPY
Definition: wined3d.h:326
@ WINED3D_RS_TWOSIDEDSTENCILMODE
Definition: wined3d.h:391
@ WINED3D_RS_TRANSLUCENTSORTINDEPENDENT
Definition: wined3d.h:328
@ WINED3D_RS_EMISSIVEMATERIALSOURCE
Definition: wined3d.h:358
@ WINED3D_RS_PATCHSEGMENTS
Definition: wined3d.h:372
@ WINED3D_RS_SPECULARENABLE
Definition: wined3d.h:312
@ WINED3D_RS_WRAP2
Definition: wined3d.h:340
@ WINED3D_RS_ADAPTIVETESS_W
Definition: wined3d.h:389
@ WINED3D_RS_FILLMODE
Definition: wined3d.h:294
@ WINED3D_RS_CLIPPING
Definition: wined3d.h:346
@ WINED3D_RS_WRAP10
Definition: wined3d.h:404
@ WINED3D_RS_SRCBLENDALPHA
Definition: wined3d.h:411
@ WINED3D_RS_COLORKEYBLENDENABLE
Definition: wined3d.h:354
@ WINED3D_RS_COLORWRITEENABLE2
Definition: wined3d.h:397
@ WINED3D_RS_POINTSCALEENABLE
Definition: wined3d.h:365
@ WINED3D_RS_WRAP14
Definition: wined3d.h:408
@ WINED3D_RS_FOGVERTEXMODE
Definition: wined3d.h:350
@ WINED3D_RS_STENCILWRITEMASK
Definition: wined3d.h:336
@ WINED3D_RS_AMBIENT
Definition: wined3d.h:349
@ WINED3D_RS_WRAP11
Definition: wined3d.h:405
@ WINED3D_RS_LINEPATTERN
Definition: wined3d.h:296
@ WINED3D_RS_ZVISIBLE
Definition: wined3d.h:313
@ WINED3D_RS_EXTENTS
Definition: wined3d.h:348
@ WINED3D_RS_BLENDOPALPHA
Definition: wined3d.h:413
@ WINED3D_RS_DESTBLENDALPHA
Definition: wined3d.h:412
@ WINED3D_RS_FOGDENSITY
Definition: wined3d.h:321
@ WINED3D_RS_STENCILZFAIL
Definition: wined3d.h:331
@ WINED3D_RS_SUBPIXEL
Definition: wined3d.h:314
@ WINED3D_RS_POINTSCALE_B
Definition: wined3d.h:367
@ WINED3D_RS_INDEXEDVERTEXBLENDENABLE
Definition: wined3d.h:375
@ WINED3D_RS_MIPMAPLODBIAS
Definition: wined3d.h:324
@ WINED3D_RS_WRAP9
Definition: wined3d.h:403
@ WINED3D_RS_SEPARATEALPHABLENDENABLE
Definition: wined3d.h:410
@ WINED3D_RS_STIPPLEENABLE
Definition: wined3d.h:322
@ WINED3D_RS_WRAP5
Definition: wined3d.h:343
@ WINED3D_RS_ADAPTIVETESS_Y
Definition: wined3d.h:387
@ WINED3D_RS_ALPHATESTENABLE
Definition: wined3d.h:301
@ WINED3D_RS_ALPHAFUNC
Definition: wined3d.h:308
@ WINED3D_RS_WRAP12
Definition: wined3d.h:406

Referenced by debug_d3dstate(), and wined3d_stateblock_set_render_state().

◆ debug_d3dresourcetype()

const char * debug_d3dresourcetype ( enum wined3d_resource_type  resource_type)

Definition at line 4992 of file utils.c.

4993{
4994 switch (resource_type)
4995 {
4996#define WINED3D_TO_STR(x) case x: return #x
5002#undef WINED3D_TO_STR
5003 default:
5004 FIXME("Unrecognized resource type %#x.\n", resource_type);
5005 return "unrecognized";
5006 }
5007}
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:720
@ WINED3D_RTYPE_TEXTURE_1D
Definition: wined3d.h:719
@ WINED3D_RTYPE_NONE
Definition: wined3d.h:717
@ WINED3D_RTYPE_BUFFER
Definition: wined3d.h:718
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:721

Referenced by context_generate_rt_mask_from_resource(), device_resource_released(), resource_init(), texture_resource_unload(), vk_blitter_blit(), vk_image_view_type_from_wined3d(), wined3d_check_device_format(), wined3d_context_gl_set_fbo_key_for_render_target(), wined3d_cs_exec_blt_sub_resource(), wined3d_device_cleanup(), wined3d_device_context_clear_rendertarget_view(), wined3d_device_context_copy_resource(), wined3d_device_context_copy_sub_resource_region(), wined3d_device_context_resolve_sub_resource(), wined3d_render_target_view_gl_cs_init(), wined3d_rendertarget_view_prepare_location(), wined3d_rendertarget_view_validate_location(), wined3d_texture_get_dc(), wined3d_texture_gl_download_data(), wined3d_texture_gl_init(), wined3d_texture_gl_set_compatible_renderbuffer(), wined3d_texture_init(), wined3d_texture_release_dc(), wined3d_texture_update_desc(), wined3d_texture_vk_prepare_texture(), and wined3d_unordered_access_view_vk_clear().

◆ debug_d3dsamplerstate()

const char * debug_d3dsamplerstate ( enum wined3d_sampler_state  state)

Definition at line 5169 of file utils.c.

5170{
5171 switch (state)
5172 {
5173#define D3DSTATE_TO_STR(u) case u: return #u
5187#undef D3DSTATE_TO_STR
5188 default:
5189 FIXME("Unrecognized %u sampler state!\n", state);
5190 return "unrecognized";
5191 }
5192}
@ WINED3D_SAMP_ELEMENT_INDEX
Definition: wined3d.h:566
@ WINED3D_SAMP_MAX_ANISOTROPY
Definition: wined3d.h:564
@ WINED3D_SAMP_MIPMAP_LOD_BIAS
Definition: wined3d.h:562
@ WINED3D_SAMP_MIN_FILTER
Definition: wined3d.h:560
@ WINED3D_SAMP_SRGB_TEXTURE
Definition: wined3d.h:565
@ WINED3D_SAMP_DMAP_OFFSET
Definition: wined3d.h:567
@ WINED3D_SAMP_MIP_FILTER
Definition: wined3d.h:561
@ WINED3D_SAMP_MAG_FILTER
Definition: wined3d.h:559
@ WINED3D_SAMP_BORDER_COLOR
Definition: wined3d.h:558
@ WINED3D_SAMP_ADDRESS_V
Definition: wined3d.h:556
@ WINED3D_SAMP_ADDRESS_U
Definition: wined3d.h:555
@ WINED3D_SAMP_ADDRESS_W
Definition: wined3d.h:557
@ WINED3D_SAMP_MAX_MIP_LEVEL
Definition: wined3d.h:563

Referenced by wined3d_stateblock_set_sampler_state().

◆ debug_d3dstate()

const char * debug_d3dstate ( uint32_t  state)

Definition at line 5331 of file utils.c.

5332{
5334 return wine_dbg_sprintf("STATE_RENDER(%s)", debug_d3drenderstate(state - STATE_RENDER(0)));
5336 {
5337 unsigned int texture_stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
5338 uint32_t texture_state = state - STATE_TEXTURESTAGE(texture_stage, 0);
5339 return wine_dbg_sprintf("STATE_TEXTURESTAGE(%#x, %s)",
5340 texture_stage, debug_d3dtexturestate(texture_state));
5341 }
5345 return wine_dbg_sprintf("STATE_SHADER(%s)", debug_shader_type(state - STATE_SHADER(0)));
5347 return wine_dbg_sprintf("STATE_CONSTANT_BUFFER(%s)", debug_shader_type(WINED3D_SHADER_TYPE_COMPUTE));
5349 return wine_dbg_sprintf("STATE_CONSTANT_BUFFER(%s)", debug_shader_type(state - STATE_CONSTANT_BUFFER(0)));
5351 return "STATE_COMPUTE_SHADER_RESOURCE_BINDING";
5353 return "STATE_GRAPHICS_SHADER_RESOURCE_BINDING";
5355 return "STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING";
5357 return "STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING";
5359 return "STATE_STREAMSRC";
5361 return "STATE_INDEXBUFFER";
5362 if (STATE_IS_VDECL(state))
5363 return "STATE_VDECL";
5365 return "STATE_VIEWPORT";
5367 return "STATE_SCISSORRECT";
5369 return wine_dbg_sprintf("STATE_CLIPPLANE(%#x)", state - STATE_CLIPPLANE(0));
5371 return "STATE_RASTERIZER";
5373 return "STATE_DEPTH_BOUNDS";
5375 return "STATE_BASEVERTEXINDEX";
5377 return "STATE_FRAMEBUFFER";
5379 return "STATE_STREAM_OUTPUT";
5380 if (STATE_IS_BLEND(state))
5381 return "STATE_BLEND";
5383 return "STATE_BLEND_FACTOR";
5385 return "STATE_SAMPLE_MASK";
5387 return "STATE_DEPTH_STENCIL";
5389 return "STATE_STENCIL_REF";
5390
5391 return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state);
5392}
const char * debug_d3dtexturestate(enum wined3d_texture_stage_state state)
Definition: utils.c:5214
const char * debug_shader_type(enum wined3d_shader_type type)
Definition: utils.c:5313
const char * debug_d3drenderstate(enum wined3d_render_state state)
Definition: utils.c:5033
@ WINED3D_SHADER_TYPE_COMPUTE
Definition: wined3d.h:848
#define WINED3D_HIGHEST_TEXTURE_STATE
Definition: wined3d.h:614
#define STATE_IS_GRAPHICS_CONSTANT_BUFFER(a)
#define STATE_CLIPPLANE(a)
#define STATE_CONSTANT_BUFFER(a)
#define STATE_IS_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING(a)
#define STATE_IS_STREAM_OUTPUT(a)
#define STATE_IS_VDECL(a)
#define STATE_IS_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING(a)
#define STATE_IS_BLEND_FACTOR(a)
#define STATE_IS_STREAMSRC(a)
#define STATE_IS_BLEND(a)
#define STATE_SHADER(a)
#define STATE_IS_TEXTURESTAGE(a)
#define STATE_IS_CLIPPLANE(a)
#define STATE_IS_VIEWPORT(a)
#define STATE_IS_STENCIL_REF(a)
#define STATE_IS_RENDER(a)
#define STATE_IS_COMPUTE_SHADER_RESOURCE_BINDING(a)
#define STATE_IS_COMPUTE_SHADER(a)
#define STATE_TEXTURESTAGE(stage, num)
#define STATE_IS_DEPTH_STENCIL(a)
#define STATE_IS_COMPUTE_CONSTANT_BUFFER(a)
#define STATE_IS_SCISSORRECT(a)
#define STATE_IS_RASTERIZER(a)
#define STATE_IS_FRAMEBUFFER(a)
#define STATE_IS_GRAPHICS_SHADER_RESOURCE_BINDING(a)
#define STATE_IS_INDEXBUFFER(a)
#define STATE_IS_DEPTH_BOUNDS(a)
#define STATE_RENDER(a)
#define STATE_IS_GRAPHICS_SHADER(a)
#define STATE_IS_SAMPLE_MASK(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 5194 of file utils.c.

5195{
5196 switch (filter_type)
5197 {
5198#define D3DTEXTUREFILTERTYPE_TO_STR(u) case u: return #u
5207#undef D3DTEXTUREFILTERTYPE_TO_STR
5208 default:
5209 FIXME("Unrecognized texture filter type 0x%08x.\n", filter_type);
5210 return "unrecognized";
5211 }
5212}
#define D3DTEXTUREFILTERTYPE_TO_STR(u)
@ WINED3D_TEXF_GAUSSIAN_CUBIC
Definition: wined3d.h:710
@ WINED3D_TEXF_NONE
Definition: wined3d.h:705
@ WINED3D_TEXF_PYRAMIDAL_QUAD
Definition: wined3d.h:711
@ WINED3D_TEXF_FLAT_CUBIC
Definition: wined3d.h:709
@ WINED3D_TEXF_GAUSSIAN_QUAD
Definition: wined3d.h:712
@ WINED3D_TEXF_POINT
Definition: wined3d.h:706
@ WINED3D_TEXF_ANISOTROPIC
Definition: wined3d.h:708
@ WINED3D_TEXF_LINEAR
Definition: wined3d.h:707

Referenced by fbo_blitter_blit(), glsl_blitter_blit(), surface_cpu_blt(), texture2d_blt(), texture2d_blt_fbo(), vk_blitter_blit(), and wined3d_device_context_blt().

◆ debug_d3dtexturestate()

const char * debug_d3dtexturestate ( enum wined3d_texture_stage_state  state)

Definition at line 5214 of file utils.c.

5215{
5216 switch (state)
5217 {
5218#define D3DSTATE_TO_STR(u) case u: return #u
5237#undef D3DSTATE_TO_STR
5238 default:
5239 FIXME("Unrecognized %u texture state!\n", state);
5240 return "unrecognized";
5241 }
5242}
@ WINED3D_TSS_COLOR_ARG2
Definition: wined3d.h:596
@ WINED3D_TSS_BUMPENV_LOFFSET
Definition: wined3d.h:606
@ WINED3D_TSS_ALPHA_OP
Definition: wined3d.h:597
@ WINED3D_TSS_BUMPENV_MAT11
Definition: wined3d.h:603
@ WINED3D_TSS_COLOR_OP
Definition: wined3d.h:594
@ WINED3D_TSS_BUMPENV_MAT10
Definition: wined3d.h:602
@ WINED3D_TSS_TEXCOORD_INDEX
Definition: wined3d.h:604
@ WINED3D_TSS_ALPHA_ARG2
Definition: wined3d.h:599
@ WINED3D_TSS_CONSTANT
Definition: wined3d.h:611
@ WINED3D_TSS_BUMPENV_MAT01
Definition: wined3d.h:601
@ WINED3D_TSS_ALPHA_ARG0
Definition: wined3d.h:609
@ WINED3D_TSS_BUMPENV_LSCALE
Definition: wined3d.h:605
@ WINED3D_TSS_COLOR_ARG0
Definition: wined3d.h:608
@ WINED3D_TSS_COLOR_ARG1
Definition: wined3d.h:595
@ WINED3D_TSS_ALPHA_ARG1
Definition: wined3d.h:598
@ WINED3D_TSS_RESULT_ARG
Definition: wined3d.h:610
@ WINED3D_TSS_BUMPENV_MAT00
Definition: wined3d.h:600
@ WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS
Definition: wined3d.h:607

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

◆ debug_d3dtop()

const char * debug_d3dtop ( enum wined3d_texture_op  d3dtop)

Definition at line 5244 of file utils.c.

5245{
5246 switch (d3dtop)
5247 {
5248#define D3DTOP_TO_STR(u) case u: return #u
5275#undef D3DTOP_TO_STR
5276 default:
5277 FIXME("Unrecognized texture op %#x.\n", d3dtop);
5278 return "unrecognized";
5279 }
5280}
#define D3DTOP_TO_STR(u)
@ WINED3D_TOP_SELECT_ARG1
Definition: wined3d.h:629
@ WINED3D_TOP_DISABLE
Definition: wined3d.h:628
@ WINED3D_TOP_BLEND_DIFFUSE_ALPHA
Definition: wined3d.h:639
@ WINED3D_TOP_ADD
Definition: wined3d.h:634
@ WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM
Definition: wined3d.h:642
@ WINED3D_TOP_BLEND_CURRENT_ALPHA
Definition: wined3d.h:643
@ WINED3D_TOP_ADD_SIGNED_2X
Definition: wined3d.h:636
@ WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA
Definition: wined3d.h:648
@ WINED3D_TOP_MULTIPLY_ADD
Definition: wined3d.h:652
@ WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR
Definition: wined3d.h:647
@ WINED3D_TOP_SUBTRACT
Definition: wined3d.h:637
@ WINED3D_TOP_BUMPENVMAP_LUMINANCE
Definition: wined3d.h:650
@ WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA
Definition: wined3d.h:646
@ WINED3D_TOP_MODULATE
Definition: wined3d.h:631
@ WINED3D_TOP_BUMPENVMAP
Definition: wined3d.h:649
@ WINED3D_TOP_MODULATE_4X
Definition: wined3d.h:633
@ WINED3D_TOP_SELECT_ARG2
Definition: wined3d.h:630
@ WINED3D_TOP_LERP
Definition: wined3d.h:653
@ WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR
Definition: wined3d.h:645
@ WINED3D_TOP_BLEND_TEXTURE_ALPHA
Definition: wined3d.h:640
@ WINED3D_TOP_ADD_SIGNED
Definition: wined3d.h:635
@ WINED3D_TOP_DOTPRODUCT3
Definition: wined3d.h:651
@ WINED3D_TOP_PREMODULATE
Definition: wined3d.h:644
@ WINED3D_TOP_ADD_SMOOTH
Definition: wined3d.h:638
@ WINED3D_TOP_MODULATE_2X
Definition: wined3d.h:632
@ WINED3D_TOP_BLEND_FACTOR_ALPHA
Definition: wined3d.h:641

◆ debug_d3dtstype()

const char * debug_d3dtstype ( enum wined3d_transform_state  tstype)

Definition at line 5282 of file utils.c.

5283{
5284 switch (tstype)
5285 {
5286#define TSTYPE_TO_STR(tstype) case tstype: return #tstype
5301#undef TSTYPE_TO_STR
5302 default:
5303 if (tstype > 256 && tstype < 512)
5304 {
5305 FIXME("WINED3D_TS_WORLD_MATRIX(%u). 1..255 not currently supported.\n", tstype);
5306 return ("WINED3D_TS_WORLD_MATRIX > 0");
5307 }
5308 FIXME("Unrecognized transform state %#x.\n", tstype);
5309 return "unrecognized";
5310 }
5311}
#define TSTYPE_TO_STR(tstype)
#define WINED3D_TS_WORLD_MATRIX(index)
Definition: wined3d.h:683
@ WINED3D_TS_TEXTURE1
Definition: wined3d.h:670
@ WINED3D_TS_TEXTURE0
Definition: wined3d.h:669
@ WINED3D_TS_TEXTURE2
Definition: wined3d.h:671
@ WINED3D_TS_PROJECTION
Definition: wined3d.h:668
@ WINED3D_TS_VIEW
Definition: wined3d.h:667
@ WINED3D_TS_TEXTURE7
Definition: wined3d.h:676
@ WINED3D_TS_TEXTURE6
Definition: wined3d.h:675
@ WINED3D_TS_TEXTURE4
Definition: wined3d.h:673
@ WINED3D_TS_TEXTURE3
Definition: wined3d.h:672
@ WINED3D_TS_TEXTURE5
Definition: wined3d.h:674

Referenced by wined3d_device_set_transform(), wined3d_stateblock_multiply_transform(), and wined3d_stateblock_set_transform().

◆ debug_d3dusage()

const char * debug_d3dusage ( uint32_t  usage)

Definition at line 4895 of file utils.c.

4896{
4897 struct debug_buffer buffer;
4898
4900#define WINED3DUSAGE_TO_STR(x) if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }
4926#undef WINED3DUSAGE_TO_STR
4927 if (usage)
4928 FIXME("Unrecognized usage flag(s) %#x.\n", usage);
4929
4930 return wine_dbg_sprintf("%s", buffer.str);
4931}
static void init_debug_buffer(struct debug_buffer *buffer, const char *default_string)
Definition: utils.c:4803
#define WINED3DUSAGE_TO_STR(x)
#define WINED3DUSAGE_QUERY_LEGACYBUMPMAP
Definition: wined3d.h:942
#define WINED3DUSAGE_POINTS
Definition: wined3d.h:921
#define WINED3DUSAGE_DONOTCLIP
Definition: wined3d.h:920
#define WINED3DUSAGE_DMAP
Definition: wined3d.h:928
#define WINED3DUSAGE_OWNDC
Definition: wined3d.h:935
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:934
#define WINED3DUSAGE_RESTRICTED_CONTENT
Definition: wined3d.h:925
#define WINED3DUSAGE_QUERY_SRGBREAD
Definition: wined3d.h:945
#define WINED3DUSAGE_QUERY_FILTER
Definition: wined3d.h:943
#define WINED3DUSAGE_OVERLAY
Definition: wined3d.h:937
#define WINED3DUSAGE_VIDMEM_ACCOUNTING
Definition: wined3d.h:939
#define WINED3DUSAGE_QUERY_WRAPANDMIP
Definition: wined3d.h:948
#define WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
Definition: wined3d.h:944
#define WINED3DUSAGE_NPATCHES
Definition: wined3d.h:923
#define WINED3DUSAGE_TEXTAPI
Definition: wined3d.h:929
#define WINED3DUSAGE_MANAGED
Definition: wined3d.h:938
#define WINED3DUSAGE_QUERY_VERTEXTEXTURE
Definition: wined3d.h:947
#define WINED3DUSAGE_QUERY_GENMIPMAP
Definition: wined3d.h:941
#define WINED3DUSAGE_RTPATCHES
Definition: wined3d.h:922
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:924
#define WINED3DUSAGE_QUERY_SRGBWRITE
Definition: wined3d.h:946
#define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER
Definition: wined3d.h:926
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:936
#define WINED3DUSAGE_SOFTWAREPROCESSING
Definition: wined3d.h:919
#define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE
Definition: wined3d.h:927

Referenced by resource_init(), texture2d_blt(), wined3d_buffer_gl_create_buffer_object(), wined3d_buffer_init(), wined3d_check_device_format(), and wined3d_texture_init().

◆ debug_fboattachment()

const char * debug_fboattachment ( GLenum  attachment)

Definition at line 5394 of file utils.c.

5395{
5396 switch(attachment)
5397 {
5398#define WINED3D_TO_STR(x) case x: return #x
5417#undef WINED3D_TO_STR
5418 default:
5419 return wine_dbg_sprintf("Unknown FBO attachment %#x", attachment);
5420 }
5421}
#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 5423 of file utils.c.

5423 {
5424 switch(status) {
5425#define FBOSTATUS_TO_STR(u) case u: return #u
5438#undef FBOSTATUS_TO_STR
5439 default:
5440 FIXME("Unrecognized FBO status 0x%08x.\n", status);
5441 return "unrecognized";
5442 }
5443}
#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 wined3d_context_gl_check_fbo_status().

◆ debug_fixup_channel_source()

static const char * debug_fixup_channel_source ( enum fixup_channel_source  source)
static

Definition at line 5502 of file utils.c.

5503{
5504 switch(source)
5505 {
5506#define WINED3D_TO_STR(x) case x: return #x
5515#undef WINED3D_TO_STR
5516 default:
5517 FIXME("Unrecognized fixup_channel_source %#x\n", source);
5518 return "unrecognized";
5519 }
5520}
@ CHANNEL_SOURCE_COMPLEX1
@ CHANNEL_SOURCE_ONE
@ CHANNEL_SOURCE_W
@ CHANNEL_SOURCE_X
@ CHANNEL_SOURCE_ZERO
@ CHANNEL_SOURCE_Z
@ CHANNEL_SOURCE_Y
@ CHANNEL_SOURCE_COMPLEX0

Referenced by dump_color_fixup_desc().

◆ debug_glerror()

const char * debug_glerror ( GLenum  error)

Definition at line 5445 of file utils.c.

5445 {
5446 switch(error) {
5447#define GLERROR_TO_STR(u) case u: return #u
5456#undef GLERROR_TO_STR
5457 default:
5458 FIXME("Unrecognized GL error 0x%08x.\n", error);
5459 return "unrecognized";
5460 }
5461}
#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 match_allows_spec_alpha(), and wined3d_check_gl_call().

◆ debug_ivec4()

const char * debug_ivec4 ( const struct wined3d_ivec4 *  v)

Definition at line 4569 of file utils.c.

4570{
4571 if (!v)
4572 return "(null)";
4573 return wine_dbg_sprintf("{%d, %d, %d, %d}",
4574 v->x, v->y, v->z, v->w);
4575}
const GLdouble * v
Definition: gl.h:2040

Referenced by wined3d_device_set_ps_consts_i(), and wined3d_device_set_vs_consts_i().

◆ debug_shader_type()

const char * debug_shader_type ( enum wined3d_shader_type  type)

Definition at line 5313 of file utils.c.

5314{
5315 switch(type)
5316 {
5317#define WINED3D_TO_STR(type) case type: return #type
5324#undef WINED3D_TO_STR
5325 default:
5326 FIXME("Unrecognized shader type %#x.\n", type);
5327 return "unrecognized";
5328 }
5329}
@ WINED3D_SHADER_TYPE_HULL
Definition: wined3d.h:844
@ WINED3D_SHADER_TYPE_PIXEL
Definition: wined3d.h:841
@ WINED3D_SHADER_TYPE_GEOMETRY
Definition: wined3d.h:843
@ WINED3D_SHADER_TYPE_DOMAIN
Definition: wined3d.h:845
@ WINED3D_SHADER_TYPE_VERTEX
Definition: wined3d.h:842

Referenced by debug_d3dstate(), geometry_shader_init_stream_output(), shader_record_shader_phase(), shader_set_function(), vk_shader_stage_from_wined3d(), and vkd3d_shader_visibility_from_wined3d().

◆ debug_uvec4()

const char * debug_uvec4 ( const struct wined3d_uvec4 *  v)

Definition at line 4577 of file utils.c.

4578{
4579 if (!v)
4580 return "(null)";
4581 return wine_dbg_sprintf("{%u, %u, %u, %u}",
4582 v->x, v->y, v->z, v->w);
4583}

Referenced by adapter_gl_clear_uav(), adapter_no3d_clear_uav(), adapter_vk_clear_uav(), and wined3d_device_context_clear_uav_uint().

◆ debug_vec4()

const char * debug_vec4 ( const struct wined3d_vec4 *  v)

Definition at line 4585 of file utils.c.

4586{
4587 if (!v)
4588 return "(null)";
4589 return wine_dbg_sprintf("{%.8e, %.8e, %.8e, %.8e}",
4590 v->x, v->y, v->z, v->w);
4591}

Referenced by wined3d_device_context_clear_uav_float(), wined3d_device_set_ps_consts_f(), and wined3d_device_set_vs_consts_f().

◆ decompress_bc1()

static void decompress_bc1 ( 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 558 of file utils.c.

561{
562 decompress_dxtn(src, dst, src_row_pitch, src_slice_pitch, dst_row_pitch,
563 dst_slice_pitch, width, height, depth, WINED3DFMT_BC1_UNORM);
564}
static void decompress_dxtn(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, enum wined3d_format_id format_id)
Definition: utils.c:510

◆ decompress_bc2()

static void decompress_bc2 ( 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 550 of file utils.c.

553{
554 decompress_dxtn(src, dst, src_row_pitch, src_slice_pitch, dst_row_pitch,
555 dst_slice_pitch, width, height, depth, WINED3DFMT_BC2_UNORM);
556}

◆ decompress_bc3()

static void decompress_bc3 ( 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 542 of file utils.c.

545{
546 decompress_dxtn(src, dst, src_row_pitch, src_slice_pitch, dst_row_pitch,
547 dst_slice_pitch, width, height, depth, WINED3DFMT_BC3_UNORM);
548}

◆ decompress_bc4()

static void decompress_bc4 ( const uint8_t *  src,
uint8_t *  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 618 of file utils.c.

621{
622 unsigned int block_w, block_h, x, y, z;
623 const uint8_t *src_row, *src_slice;
624 uint8_t *dst_row, *dst_slice;
625
626 for (z = 0; z < depth; ++z)
627 {
628 src_slice = &src[z * src_slice_pitch];
629 dst_slice = &dst[z * dst_slice_pitch];
630 for (y = 0; y < height; y += 4)
631 {
632 src_row = &src_slice[(y / 4) * src_row_pitch];
633 dst_row = &dst_slice[y * dst_row_pitch];
634 for (x = 0; x < width; x += 4)
635 {
636 block_w = min(width - x, 4);
637 block_h = min(height - y, 4);
638 decompress_rgtc_block(&src_row[(x / 4) * 8], &dst_row[x * 4], block_w, block_h, dst_row_pitch);
639 }
640 }
641 }
642}
static void decompress_rgtc_block(const uint8_t *src, uint8_t *dst, unsigned int width, unsigned int height, unsigned int dst_row_pitch)
Definition: utils.c:590
unsigned char uint8_t
Definition: stdint.h:33
#define min(a, b)
Definition: monoChain.cc:55

◆ decompress_dxtn()

static void decompress_dxtn ( 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,
enum wined3d_format_id  format_id 
)
static

Definition at line 510 of file utils.c.

513{
514 unsigned int block_byte_count, block_w, block_h;
515 const BYTE *src_row, *src_slice = src;
516 BYTE *dst_row, *dst_slice = dst;
517 unsigned int x, y, z;
518
519 block_byte_count = format_id == WINED3DFMT_BC1_UNORM ? 8 : 16;
520
521 for (z = 0; z < depth; ++z)
522 {
523 src_row = src_slice;
524 dst_row = dst_slice;
525 for (y = 0; y < height; y += 4)
526 {
527 for (x = 0; x < width; x += 4)
528 {
529 block_w = min(width - x, 4);
530 block_h = min(height - y, 4);
531 decompress_dxtn_block(&src_row[x * (block_byte_count / 4)],
532 &dst_row[x * 4], block_w, block_h, dst_row_pitch, format_id);
533 }
534 src_row += src_row_pitch;
535 dst_row += dst_row_pitch * 4;
536 }
537 src_slice += src_slice_pitch;
538 dst_slice += dst_slice_pitch;
539 }
540}
static void decompress_dxtn_block(const BYTE *src, BYTE *dst, unsigned int width, unsigned int height, unsigned int dst_row_pitch, enum wined3d_format_id format_id)
Definition: utils.c:439

Referenced by decompress_bc1(), decompress_bc2(), and decompress_bc3().

◆ decompress_dxtn_block()

static void decompress_dxtn_block ( const BYTE *  src,
BYTE *  dst,
unsigned int  width,
unsigned int  height,
unsigned int  dst_row_pitch,
enum wined3d_format_id  format_id 
)
static

Definition at line 439 of file utils.c.

441{
442 const UINT64 *s = (const UINT64 *)src;
443 BOOL bc1_alpha = FALSE;
444 DWORD colour_table[4];
445 BYTE alpha_table[8];
446 UINT64 alpha_bits;
447 DWORD colour_bits;
448 unsigned int x, y;
449 BYTE colour_idx;
450 DWORD *dst_row;
451 BYTE alpha;
452
454 {
455 WORD colour0, colour1;
456
457 alpha_bits = 0;
458
459 colour0 = s[0] & 0xffff;
460 colour1 = (s[0] >> 16) & 0xffff;
461 colour_bits = (s[0] >> 32) & 0xffffffff;
462 build_dxtn_colour_table(colour0, colour1, colour_table, format_id);
463 if (colour0 <= colour1)
464 bc1_alpha = TRUE;
465 }
466 else
467 {
468 alpha_bits = s[0];
470 {
471 build_bc3_alpha_table(alpha_bits & 0xff, (alpha_bits >> 8) & 0xff, alpha_table);
472 alpha_bits >>= 16;
473 }
474
475 colour_bits = (s[1] >> 32) & 0xffffffff;
476 build_dxtn_colour_table(s[1] & 0xffff, (s[1] >> 16) & 0xffff, colour_table, format_id);
477 }
478
479 for (y = 0; y < height; ++y)
480 {
481 dst_row = (DWORD *)&dst[y * dst_row_pitch];
482 for (x = 0; x < width; ++x)
483 {
484 colour_idx = (colour_bits >> (y * 8 + x * 2)) & 0x3;
485 switch (format_id)
486 {
488 alpha = bc1_alpha && colour_idx == 3 ? 0x00 : 0xff;
489 break;
490
492 alpha = (alpha_bits >> (y * 16 + x * 4)) & 0xf;
493 /* (2⁸ - 1) / (2⁴ - 1) ≈ 2⁸ / 2⁴ + 2⁸ / 2⁸ */
494 alpha |= alpha << 4;
495 break;
496
498 alpha = alpha_table[(alpha_bits >> (y * 12 + x * 3)) & 0x7];
499 break;
500
501 default:
502 alpha = 0xff;
503 break;
504 }
505 dst_row[x] = (alpha << 24) | colour_table[colour_idx];
506 }
507 }
508}
COMPILER_DEPENDENT_UINT64 UINT64
Definition: actypes.h:131
static void build_bc3_alpha_table(BYTE alpha0, BYTE alpha1, BYTE alpha_table[8])
Definition: utils.c:413
static void build_dxtn_colour_table(WORD colour0, WORD colour1, DWORD colour_table[4], enum wined3d_format_id format_id)
Definition: utils.c:375
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740

Referenced by decompress_dxtn().

◆ decompress_rgtc_block()

static void decompress_rgtc_block ( const uint8_t *  src,
uint8_t *  dst,
unsigned int  width,
unsigned int  height,
unsigned int  dst_row_pitch 
)
static

Definition at line 590 of file utils.c.

592{
593 const uint64_t *s = (const uint64_t *)src;
594 uint8_t red0, red1, red_idx;
595 uint8_t colour_table[8];
596 unsigned int x, y;
597 uint32_t *dst_row;
599
600 red0 = s[0] & 0xff;
601 red1 = (s[0] >> 8) & 0xff;
602 bits = s[0] >> 16;
603 build_rgtc_colour_table(red0, red1, colour_table);
604
605 for (y = 0; y < height; ++y)
606 {
607 dst_row = (uint32_t *)&dst[y * dst_row_pitch];
608 for (x = 0; x < width; ++x)
609 {
610 red_idx = (bits >> (y * 12 + x * 3)) & 0x7;
611 /* Decompressing to bgra32 is perhaps not ideal for RGTC formats.
612 * It's convenient though. */
613 dst_row[x] = 0xff000000 | (colour_table[red_idx] << 16);
614 }
615 }
616}
UINT64 uint64_t
Definition: types.h:77
static void build_rgtc_colour_table(uint8_t red0, uint8_t red1, uint8_t colour_table[8])
Definition: utils.c:566
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define bits
Definition: infblock.c:15

Referenced by decompress_bc4().

◆ 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 2249 of file utils.c.

2251{
2252 switch (d3d_type)
2253 {
2258 gl_info->gl_ops.gl.p_glDeleteTextures(1, &object);
2259 break;
2260
2262 gl_info->fbo_ops.glDeleteRenderbuffers(1, &object);
2263 break;
2264
2267 break;
2268 }
2269}

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 2371 of file utils.c.

2373{
2374 const struct wined3d_gl_info *gl_info = ctx->gl_info;
2375 static const struct wined3d_vec3 default_geometry[] =
2376 {
2377 {-1.0f, -1.0f, 0.0f},
2378 { 1.0f, -1.0f, 0.0f},
2379 {-1.0f, 1.0f, 0.0f},
2380 { 1.0f, 1.0f, 0.0f},
2381 };
2382 static const char vs_core_header[] =
2383 "#version 150\n"
2384 "in vec4 pos;\n"
2385 "in vec4 color;\n"
2386 "out vec4 out_color;\n"
2387 "\n";
2388 static const char vs_legacy_header[] =
2389 "#version 120\n"
2390 "attribute vec4 pos;\n"
2391 "attribute vec4 color;\n"
2392 "varying vec4 out_color;\n"
2393 "\n";
2394 static const char vs_body[] =
2395 "void main()\n"
2396 "{\n"
2397 " gl_Position = pos;\n"
2398 " out_color = color;\n"
2399 "}\n";
2400 static const char fs_core[] =
2401 "#version 150\n"
2402 "in vec4 out_color;\n"
2403 "out vec4 fragment_color;\n"
2404 "\n"
2405 "void main()\n"
2406 "{\n"
2407 " fragment_color = out_color;\n"
2408 "}\n";
2409 static const char fs_legacy[] =
2410 "#version 120\n"
2411 "varying vec4 out_color;\n"
2412 "\n"
2413 "void main()\n"
2414 "{\n"
2415 " gl_FragData[0] = out_color;\n"
2416 "}\n";
2417 const char *source[2];
2418 GLuint vs_id, fs_id;
2419 unsigned int i;
2420
2421 if (!geometry)
2422 geometry = default_geometry;
2423
2425 || !gl_info->supported[ARB_FRAGMENT_SHADER])
2426 {
2427 gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
2428 gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
2429 gl_info->gl_ops.gl.p_glLoadIdentity();
2430 gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
2431 gl_info->gl_ops.gl.p_glLoadIdentity();
2432
2433 gl_info->gl_ops.gl.p_glBegin(GL_TRIANGLE_STRIP);
2434 gl_info->gl_ops.gl.p_glColor4f(color->r, color->g, color->b, color->a);
2435 for (i = 0; i < 4; ++i)
2436 gl_info->gl_ops.gl.p_glVertex3fv(&geometry[i].x);
2437 gl_info->gl_ops.gl.p_glEnd();
2438 checkGLcall("draw quad");
2439 return;
2440 }
2441
2442 if (!ctx->test_vbo)
2443 GL_EXTCALL(glGenBuffers(1, &ctx->test_vbo));
2444 GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, ctx->test_vbo));
2445 GL_EXTCALL(glBufferData(GL_ARRAY_BUFFER, sizeof(struct wined3d_vec3) * 4, geometry, GL_STREAM_DRAW));
2446 GL_EXTCALL(glVertexAttribPointer(0, 3, GL_FLOAT, FALSE, 0, NULL));
2447 GL_EXTCALL(glVertexAttrib4f(1, color->r, color->g, color->b, color->a));
2448 GL_EXTCALL(glEnableVertexAttribArray(0));
2449 GL_EXTCALL(glDisableVertexAttribArray(1));
2450
2451 if (!ctx->test_program_id)
2452 {
2453 BOOL use_glsl_150 = gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50);
2454
2455 ctx->test_program_id = GL_EXTCALL(glCreateProgram());
2456
2457 vs_id = GL_EXTCALL(glCreateShader(GL_VERTEX_SHADER));
2458 source[0] = use_glsl_150 ? vs_core_header : vs_legacy_header;
2459 source[1] = vs_body;
2460 GL_EXTCALL(glShaderSource(vs_id, 2, source, NULL));
2461 GL_EXTCALL(glAttachShader(ctx->test_program_id, vs_id));
2462 GL_EXTCALL(glDeleteShader(vs_id));
2463
2464 fs_id = GL_EXTCALL(glCreateShader(GL_FRAGMENT_SHADER));
2465 source[0] = use_glsl_150 ? fs_core : fs_legacy;
2466 GL_EXTCALL(glShaderSource(fs_id, 1, source, NULL));
2467 GL_EXTCALL(glAttachShader(ctx->test_program_id, fs_id));
2468 GL_EXTCALL(glDeleteShader(fs_id));
2469
2470 GL_EXTCALL(glBindAttribLocation(ctx->test_program_id, 0, "pos"));
2471 GL_EXTCALL(glBindAttribLocation(ctx->test_program_id, 1, "color"));
2472
2473 if (use_glsl_150)
2474 GL_EXTCALL(glBindFragDataLocation(ctx->test_program_id, 0, "fragment_color"));
2475
2476 GL_EXTCALL(glCompileShader(vs_id));
2477 print_glsl_info_log(gl_info, vs_id, FALSE);
2478 GL_EXTCALL(glCompileShader(fs_id));
2479 print_glsl_info_log(gl_info, fs_id, FALSE);
2480 GL_EXTCALL(glLinkProgram(ctx->test_program_id));
2481 shader_glsl_validate_link(gl_info, ctx->test_program_id);
2482 }
2483 GL_EXTCALL(glUseProgram(ctx->test_program_id));
2484
2485 gl_info->gl_ops.gl.p_glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
2486
2487 GL_EXTCALL(glUseProgram(0));
2488 GL_EXTCALL(glDisableVertexAttribArray(0));
2489 GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, 0));
2490 checkGLcall("draw quad");
2491}
#define GL_FLOAT
Definition: gl.h:183
#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:617
void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLuint id, BOOL program)
Definition: glsl_shader.c:485
unsigned int glsl_version
Definition: wined3d_gl.h:343
@ ARB_VERTEX_BUFFER_OBJECT
Definition: wined3d_gl.h:153
#define MAKEDWORD_VERSION(maj, min)

Referenced by check_fbo_compat(), wined3d_adapter_find_polyoffset_scale(), wined3d_caps_gl_ctx_test_filling_convention(), 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 5540 of file utils.c.

5541{
5542 if (is_complex_fixup(fixup))
5543 {
5544 TRACE("\tComplex: %s\n", debug_complex_fixup(get_complex_fixup(fixup)));
5545 return;
5546 }
5547
5548 TRACE("\tX: %s%s\n", debug_fixup_channel_source(fixup.x_source), fixup.x_sign_fixup ? ", SIGN_FIXUP" : "");
5549 TRACE("\tY: %s%s\n", debug_fixup_channel_source(fixup.y_source), fixup.y_sign_fixup ? ", SIGN_FIXUP" : "");
5550 TRACE("\tZ: %s%s\n", debug_fixup_channel_source(fixup.z_source), fixup.z_sign_fixup ? ", SIGN_FIXUP" : "");
5551 TRACE("\tW: %s%s\n", debug_fixup_channel_source(fixup.w_source), fixup.w_sign_fixup ? ", SIGN_FIXUP" : "");
5552}
static const char * debug_fixup_channel_source(enum fixup_channel_source source)
Definition: utils.c:5502
static const char * debug_complex_fixup(enum complex_fixup fixup)
Definition: utils.c:5522
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().

◆ 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 6419 of file utils.c.

6421{
6422 struct wine_rb_entry *entry = wine_rb_get(fragment_shaders, settings);
6424}
struct mke2fs_defaults settings[]
uint32_t entry
Definition: isohybrid.c:63
#define wine_rb_entry
Definition: rbtree.h:404
#define WINE_RB_ENTRY_VALUE
Definition: rbtree.h:414
#define wine_rb_get
Definition: rbtree.h:409

Referenced by get_ffp_pixel_shader(), and shader_glsl_find_ffp_fragment_shader().

◆ fixup_sign_from_char()

static unsigned int fixup_sign_from_char ( char  c)
static

Definition at line 3463 of file utils.c.

3464{
3465 if (c == 'x' || c == 'y' || c == 'z' || c == 'w')
3466 return 1;
3467 return 0;
3468}

Referenced by create_color_fixup_desc_from_string().

◆ fixup_source_from_char()

static enum fixup_channel_source fixup_source_from_char ( char  c)
static

Definition at line 3439 of file utils.c.

3440{
3441 switch (c)
3442 {
3443 default:
3444 case '0':
3445 return CHANNEL_SOURCE_ZERO;
3446 case '1':
3447 return CHANNEL_SOURCE_ONE;
3448 case 'x':
3449 case 'X':
3450 return CHANNEL_SOURCE_X;
3451 case 'y':
3452 case 'Y':
3453 return CHANNEL_SOURCE_Y;
3454 case 'z':
3455 case 'Z':
3456 return CHANNEL_SOURCE_Z;
3457 case 'w':
3458 case 'W':
3459 return CHANNEL_SOURCE_W;
3460 }
3461}

Referenced by create_color_fixup_desc_from_string().

◆ format_clear_caps()

static void format_clear_caps ( struct wined3d_format *  format,
unsigned int  caps 
)
static

Definition at line 2009 of file utils.c.

2010{
2011 unsigned int i;
2012
2013 for (i = 0; i < ARRAY_SIZE(format->caps); ++i)
2014 format->caps[i] &= ~caps;
2015}

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

◆ format_set_caps()

static void format_set_caps ( struct wined3d_format *  format,
unsigned int  caps 
)
static

Definition at line 2001 of file utils.c.

2002{
2003 unsigned int i;
2004
2005 for (i = 0; i < ARRAY_SIZE(format->caps); ++i)
2006 format->caps[i] |= caps;
2007}

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

◆ 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 5703 of file utils.c.

5705{
5706 union
5707 {
5708 DWORD d;
5709 float f;
5710 } tmpvalue;
5711
5712 switch (context->fog_source)
5713 {
5714 case FOGSOURCE_VS:
5715 *start = 1.0f;
5716 *end = 0.0f;
5717 break;
5718
5719 case FOGSOURCE_FFP:
5720 tmpvalue.d = state->render_states[WINED3D_RS_FOGSTART];
5721 *start = tmpvalue.f;
5722 tmpvalue.d = state->render_states[WINED3D_RS_FOGEND];
5723 *end = tmpvalue.f;
5724 /* Special handling for fog_start == fog_end. In d3d with vertex
5725 * fog, everything is fogged. With table fog, everything with
5726 * fog_coord < fog_start is unfogged, and fog_coord > fog_start
5727 * is fogged. Windows drivers disagree when fog_coord == fog_start. */
5728 if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE && *start == *end)
5729 {
5730 *start = -INFINITY;
5731 *end = 0.0f;
5732 }
5733 break;
5734
5735 default:
5736 /* This should not happen, context->fog_source is set in wined3d, not the app. */
5737 ERR("Unexpected fog coordinate source.\n");
5738 *start = 0.0f;
5739 *end = 0.0f;
5740 }
5741}
#define INFINITY
Definition: math.h:272
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
Definition: http.c:7252
@ WINED3D_FOG_NONE
Definition: wined3d.h:480
@ FOGSOURCE_VS
@ FOGSOURCE_FFP

Referenced by shader_glsl_load_fog_uniform().

◆ get_format_by_idx()

static struct wined3d_format * get_format_by_idx ( const struct wined3d_adapter *  adapter,
int  fmt_idx 
)
static

◆ get_format_gl_by_idx()

static struct wined3d_format_gl * get_format_gl_by_idx ( const struct wined3d_adapter *  adapter,
int  fmt_idx 
)
static

Definition at line 1963 of file utils.c.

1964{
1966}
static struct wined3d_format * get_format_by_idx(const struct wined3d_adapter *adapter, int fmt_idx)
Definition: utils.c:1958
static struct wined3d_format_gl * wined3d_format_gl_mutable(struct wined3d_format *format)
Definition: utils.c:1948

Referenced by apply_format_fixups(), init_format_depth_bias_scale(), and init_format_fbo_compat_info().

◆ get_format_gl_internal()

static struct wined3d_format_gl * get_format_gl_internal ( const struct wined3d_adapter *  adapter,
enum wined3d_format_id  format_id 
)
static

Definition at line 1982 of file utils.c.

1984{
1985 struct wined3d_format *format;
1986
1989
1990 return NULL;
1991}
static struct wined3d_format * get_format_internal(const struct wined3d_adapter *adapter, enum wined3d_format_id format_id)
Definition: utils.c:1968

Referenced by apply_format_fixups(), init_format_filter_info(), init_format_texture_info(), and init_format_vertex_info().

◆ get_format_idx()

static int get_format_idx ( enum wined3d_format_id  format_id)
inlinestatic

Definition at line 1932 of file utils.c.

1933{
1934 unsigned int i;
1935
1936 if ((unsigned int)format_id < WINED3D_FORMAT_FOURCC_BASE)
1937 return format_id;
1938
1939 for (i = 0; i < ARRAY_SIZE(format_index_remap); ++i)
1940 {
1941 if (format_index_remap[i].id == format_id)
1942 return format_index_remap[i].idx;
1943 }
1944
1945 return -1;
1946}
#define WINED3D_FORMAT_FOURCC_BASE
Definition: utils.c:35
static const struct @343 format_index_remap[]

Referenced by get_format_internal(), and wined3d_get_format().

◆ get_format_internal()

static struct wined3d_format * get_format_internal ( const struct wined3d_adapter *  adapter,
enum wined3d_format_id  format_id 
)
static

Definition at line 1968 of file utils.c.

1970{
1971 int fmt_idx;
1972
1973 if ((fmt_idx = get_format_idx(format_id)) == -1)
1974 {
1975 ERR("Format %s (%#x) not found.\n", debug_d3dformat(format_id), format_id);
1976 return NULL;
1977 }
1978
1979 return get_format_by_idx(adapter, fmt_idx);
1980}
static int get_format_idx(enum wined3d_format_id format_id)
Definition: utils.c:1932

Referenced by get_format_gl_internal(), init_format_base_info(), init_format_block_info(), init_format_decompress_info(), init_srgb_formats(), init_typeless_formats(), wined3d_adapter_no3d_init_format_info(), and wined3d_get_format().

◆ get_identity_matrix()

void get_identity_matrix ( struct wined3d_matrix *  mat)

Definition at line 5575 of file utils.c.

5576{
5577 static const struct wined3d_matrix identity =
5578 {
5579 1.0f, 0.0f, 0.0f, 0.0f,
5580 0.0f, 1.0f, 0.0f, 0.0f,
5581 0.0f, 0.0f, 1.0f, 0.0f,
5582 0.0f, 0.0f, 0.0f, 1.0f,
5583 };
5584
5585 *mat = identity;
5586}

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

◆ get_modelview_matrix()

void get_modelview_matrix ( const struct wined3d_stateblock_state *  state,
unsigned int  index,
struct wined3d_matrix *  mat 
)

Definition at line 5588 of file utils.c.

5589{
5591}
void multiply_matrix(struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
Definition: utils.c:6112
GLuint index
Definition: glext.h:6031

Referenced by wined3d_device_apply_stateblock().

◆ 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 5684 of file utils.c.

5686{
5687 union
5688 {
5689 DWORD d;
5690 float f;
5691 } min, max;
5692
5693 min.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
5694 max.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
5695
5696 if (min.f > max.f)
5697 min.f = max.f;
5698
5699 *out_min = min.f;
5700 *out_max = max.f;
5701}
#define max(a, b)
Definition: svc.c:63

Referenced by shader_glsl_pointsize_uniform().

◆ get_texcoord_format()

static enum wined3d_format_id get_texcoord_format ( const struct wined3d_vertex_declaration *  decl,
unsigned int  index 
)
static

Definition at line 5659 of file utils.c.

5660{
5661 for (unsigned int i = 0; i < decl->element_count; ++i)
5662 {
5663 if (decl->elements[i].usage == WINED3D_DECL_USAGE_TEXCOORD
5664 && decl->elements[i].usage_idx == index)
5665 return decl->elements[i].format->id;
5666 }
5667
5668 return WINED3DFMT_UNKNOWN;
5669}
struct wined3d_vertex_declaration_element * elements

Referenced by get_texture_matrix().

◆ get_texture_matrix()

void get_texture_matrix ( const struct wined3d_stateblock_state *  state,
const unsigned int  tex,
struct wined3d_matrix *  mat 
)

Definition at line 5671 of file utils.c.

5673{
5674 BOOL generated = (state->texture_states[tex][WINED3D_TSS_TEXCOORD_INDEX] & 0xffff0000)
5676 unsigned int coord_idx = min(state->texture_states[tex][WINED3D_TSS_TEXCOORD_INDEX] & 0x0000ffff,
5678
5680 state->texture_states[tex][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS],
5681 generated, get_texcoord_format(state->vertex_declaration, coord_idx), mat);
5682}
static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t flags, BOOL calculated_coords, enum wined3d_format_id format_id, struct wined3d_matrix *out_matrix)
Definition: utils.c:5594
static enum wined3d_format_id get_texcoord_format(const struct wined3d_vertex_declaration *decl, unsigned int index)
Definition: utils.c:5659
#define WINED3DTSS_TCI_PASSTHRU
Definition: wined3d.h:874
#define WINED3D_MAX_FFP_TEXTURES
Definition: wined3d.h:1597

Referenced by wined3d_device_apply_stateblock().

◆ init_debug_buffer()

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

Definition at line 4803 of file utils.c.

4804{
4805 snprintf(buffer->str, sizeof(buffer->str), "%s", default_string);
4806 buffer->ptr = buffer->str;
4807 buffer->size = sizeof(buffer->str);
4808}

Referenced by debug_d3dusage(), wined3d_debug_bind_flags(), wined3d_debug_location(), wined3d_debug_resource_access(), and wined3d_debug_view_desc().

◆ init_format_base_info()

static BOOL init_format_base_info ( struct wined3d_adapter *  adapter)
static

Definition at line 2079 of file utils.c.

2080{
2081 struct wined3d_format *format;
2082 unsigned int i;
2083
2084 for (i = 0; i < ARRAY_SIZE(formats); ++i)
2085 {
2087 return FALSE;
2088
2089 format->id = formats[i].id;
2090 format->red_size = formats[i].red_size;
2091 format->green_size = formats[i].green_size;
2092 format->blue_size = formats[i].blue_size;
2093 format->alpha_size = formats[i].alpha_size;
2094 format->red_offset = formats[i].red_offset;
2095 format->green_offset = formats[i].green_offset;
2096 format->blue_offset = formats[i].blue_offset;
2097 format->alpha_offset = formats[i].alpha_offset;
2098 format->byte_count = formats[i].bpp;
2099 format->depth_size = formats[i].depth_size;
2100 format->stencil_size = formats[i].stencil_size;
2101 format->block_width = 1;
2102 format->block_height = 1;
2103 format->block_byte_count = formats[i].bpp;
2104
2105 if (formats[i].channels)
2107 }
2108
2109 for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
2110 {
2111 struct wined3d_format *typeless_format;
2112
2114 return FALSE;
2115
2116 if (!(typeless_format = get_format_internal(adapter, typed_formats[i].typeless_id)))
2117 return FALSE;
2118
2119 format->id = typed_formats[i].id;
2120 format->red_size = typeless_format->red_size;
2121 format->green_size = typeless_format->green_size;
2122 format->blue_size = typeless_format->blue_size;
2123 format->alpha_size = typeless_format->alpha_size;
2124 format->red_offset = typeless_format->red_offset;
2125 format->green_offset = typeless_format->green_offset;
2126 format->blue_offset = typeless_format->blue_offset;
2127 format->alpha_offset = typeless_format->alpha_offset;
2128 format->byte_count = typeless_format->byte_count;
2129 format->depth_size = typeless_format->depth_size;
2130 format->stencil_size = typeless_format->stencil_size;
2131 format->block_width = typeless_format->block_width;
2132 format->block_height = typeless_format->block_height;
2133 format->block_byte_count = typeless_format->block_byte_count;
2134 format->typeless_id = typeless_format->id;
2135
2136 typeless_format->typeless_id = typeless_format->id;
2137
2139 }
2140
2141 for (i = 0; i < ARRAY_SIZE(ddi_formats); ++i)
2142 {
2144 return FALSE;
2145
2146 format->ddi_format = ddi_formats[i].ddi_format;
2147 }
2148
2149 for (i = 0; i < ARRAY_SIZE(format_base_flags); ++i)
2150 {
2152 return FALSE;
2153
2154 format->attrs |= format_base_flags[i].attrs;
2156 }
2157
2158 return TRUE;
2159}
unsigned int channels
Definition: audiorecord.c:89
static const struct wined3d_typed_format_info typed_formats[]
Definition: utils.c:196
static const struct wined3d_format_ddi_info ddi_formats[]
Definition: utils.c:296
static const struct wined3d_format_channels formats[]
Definition: utils.c:82
static const struct wined3d_format_base_flags format_base_flags[]
Definition: utils.c:319
static void parse_channel_desc(struct wined3d_format *format, const char *channel_desc)
Definition: utils.c:2043
unsigned int caps[WINED3D_GL_RES_TYPE_COUNT]
enum wined3d_format_id id
enum wined3d_format_id typeless_id

Referenced by wined3d_adapter_init_format_info().

◆ init_format_block_info()

static BOOL init_format_block_info ( struct wined3d_adapter *  adapter)
static

Definition at line 2161 of file utils.c.

2162{
2163 struct wined3d_format *format;
2164 unsigned int i;
2165
2166 for (i = 0; i < ARRAY_SIZE(format_block_info); ++i)
2167 {
2169 return FALSE;
2170
2171 format->block_width = format_block_info[i].block_width;
2172 format->block_height = format_block_info[i].block_height;
2173 format->block_byte_count = format_block_info[i].block_byte_count;
2175 }
2176
2177 return TRUE;
2178}
static const struct wined3d_format_block_info format_block_info[]
Definition: utils.c:673
#define WINED3D_FORMAT_ATTR_BLOCKS

Referenced by wined3d_adapter_init_format_info().

◆ init_format_decompress_info()

static BOOL init_format_decompress_info ( struct wined3d_adapter *  adapter)
static

Definition at line 2191 of file utils.c.

2192{
2193 struct wined3d_format *format;
2194 unsigned int i;
2195
2196 for (i = 0; i < ARRAY_SIZE(format_decompress_info); ++i)
2197 {
2199 return FALSE;
2200
2202 format->decompress = format_decompress_info[i].decompress;
2203 }
2204
2205 return TRUE;
2206}
static const struct wined3d_format_decompress_info format_decompress_info[]
#define WINED3D_FORMAT_CAP_DECOMPRESS

Referenced by wined3d_adapter_init_format_info().

◆ init_format_depth_bias_scale()

static void init_format_depth_bias_scale ( struct wined3d_adapter *  adapter,
struct wined3d_caps_gl_ctx *  ctx 
)
static

Definition at line 4078 of file utils.c.

4080{
4081 const struct wined3d_d3d_info *d3d_info = &adapter->d3d_info;
4082 unsigned int i;
4083
4084 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
4085 {
4087
4088 if (format->f.depth_size && (format->f.caps[WINED3D_GL_RES_TYPE_RB] & WINED3D_FORMAT_CAP_DEPTH_STENCIL))
4089 {
4090 TRACE("Testing depth bias scale for format %s.\n", debug_d3dformat(format->f.id));
4091 format->f.depth_bias_scale = wined3d_adapter_find_polyoffset_scale(ctx, format->internal);
4092
4094 {
4095 /* The single-precision binary floating-point format has
4096 * a significand precision of 24 bits.
4097 */
4098 if (format->f.attrs & WINED3D_FORMAT_ATTR_FLOAT)
4099 format->f.depth_bias_scale /= 1u << 24;
4100 else
4101 format->f.depth_bias_scale /= 1u << format->f.depth_size;
4102 }
4103 }
4104 }
4105}
static float wined3d_adapter_find_polyoffset_scale(struct wined3d_caps_gl_ctx *ctx, GLenum format)
Definition: utils.c:3990
#define WINED3D_NORMALIZED_DEPTH_BIAS
Definition: wined3d.h:1334
#define WINED3D_FORMAT_ATTR_FLOAT

Referenced by wined3d_adapter_gl_init_format_info().

◆ init_format_fbo_compat_info()

static void init_format_fbo_compat_info ( const struct wined3d_adapter *  adapter,
struct wined3d_caps_gl_ctx *  ctx 
)
static

Definition at line 2788 of file utils.c.

2790{
2791 const struct wined3d_gl_info *gl_info = ctx->gl_info;
2792 unsigned int i, type;
2793 GLuint fbo;
2794
2796 {
2797 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
2798 {
2800 BOOL fallback_fmt_used = FALSE, regular_fmt_used = FALSE;
2801 GLenum rt_internal = format->rt_internal;
2802 GLint value;
2803
2804 if (!format->internal)
2805 continue;
2806
2807 for (type = 0; type < ARRAY_SIZE(format->f.caps); ++type)
2808 {
2809 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2810 format->internal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
2811 if (value == GL_FULL_SUPPORT)
2812 {
2813 TRACE("Format %s is supported as FBO color attachment, resource type %u.\n",
2814 debug_d3dformat(format->f.id), type);
2816 format->rt_internal = format->internal;
2817 regular_fmt_used = TRUE;
2818
2819 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2820 format->internal, GL_FRAMEBUFFER_BLEND, 1, &value);
2821 if (value == GL_FULL_SUPPORT)
2822 {
2823 TRACE("Format %s supports post-pixelshader blending, resource type %u.\n",
2824 debug_d3dformat(format->f.id), type);
2826 }
2827 else
2828 {
2829 TRACE("Format %s doesn't support post-pixelshader blending, resource typed %u.\n",
2830 debug_d3dformat(format->f.id), type);
2831 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING;
2832 }
2833 }
2834 else
2835 {
2836 if (!rt_internal)
2837 {
2839 {
2840 WARN("Format %s with rendertarget flag is not supported as FBO color attachment"
2841 " and no fallback specified, resource type %u.\n",
2842 debug_d3dformat(format->f.id), type);
2843 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_RENDERTARGET;
2844 }
2845 else
2846 TRACE("Format %s is not supported as FBO color attachment,"
2847 " resource type %u.\n", debug_d3dformat(format->f.id), type);
2848 format->rt_internal = format->internal;
2849 }
2850 else
2851 {
2852 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2854 if (value == GL_FULL_SUPPORT)
2855 {
2856 TRACE("Format %s rtInternal format is supported as FBO color attachment,"
2857 " resource type %u.\n", debug_d3dformat(format->f.id), type);
2858 fallback_fmt_used = TRUE;
2859 }
2860 else
2861 {
2862 WARN("Format %s rtInternal format is not supported as FBO color attachment,"
2863 " resource type %u.\n", debug_d3dformat(format->f.id), type);
2864 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_RENDERTARGET;
2865 }
2866 }
2867 }
2868
2869 if (format->internal != format->srgb_internal)
2870 {
2871 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2872 format->srgb_internal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
2873 if (value == GL_FULL_SUPPORT)
2874 {
2875 TRACE("Format %s's sRGB format is FBO attachable, resource type %u.\n",
2876 debug_d3dformat(format->f.id), type);
2878 if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
2879 format->internal = format->srgb_internal;
2880 }
2881 else
2882 {
2883 WARN("Format %s's sRGB format is not FBO attachable, resource type %u.\n",
2884 debug_d3dformat(format->f.id), type);
2886 }
2887 }
2888 else if (format->f.caps[type] & WINED3D_FORMAT_CAP_FBO_ATTACHABLE)
2890 }
2891
2892 if (fallback_fmt_used && regular_fmt_used)
2893 {
2894 FIXME("Format %s needs different render target formats for different resource types.\n",
2895 debug_d3dformat(format->f.id));
2898 }
2899 }
2900 return;
2901 }
2902
2903 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
2904 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
2905 gl_info->gl_ops.gl.p_glDrawBuffer(GL_COLOR_ATTACHMENT0);
2906 gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0);
2907
2908 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
2909 {
2911
2912 if (!format->internal)
2913 continue;
2914
2916 {
2917 TRACE("Skipping format %s because it's a compressed format.\n",
2918 debug_d3dformat(format->f.id));
2919 continue;
2920 }
2921
2922 TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(format->f.id));
2924 }
2925
2926 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
2927}
static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_format_gl *format)
Definition: utils.c:2494
int GLint
Definition: gl.h:156
Definition: pdh_main.c:64
#define GL_FRAMEBUFFER_BLEND
Definition: wgl.h:1490
#define GL_FRAMEBUFFER_RENDERABLE
Definition: wgl.h:1521
#define GL_FULL_SUPPORT
Definition: wgl.h:1542
@ ARB_INTERNALFORMAT_QUERY2
Definition: wined3d_gl.h:92
#define WINED3D_FORMAT_ATTR_COMPRESSED

Referenced by wined3d_adapter_gl_init_format_info().

◆ init_format_filter_info()

static void init_format_filter_info ( struct wined3d_adapter *  adapter,
struct wined3d_gl_info *  gl_info 
)
static

Definition at line 3373 of file utils.c.

3375{
3376 enum wined3d_pci_vendor vendor = adapter->driver_info.vendor;
3377 struct wined3d_format_gl *format;
3378 unsigned int i;
3379 static const enum wined3d_format_id fmts16[] =
3380 {
3384 };
3385 BOOL filtered;
3386
3387 /* This was already handled by init_format_texture_info(). */
3389 return;
3390
3391 if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
3392 {
3394 {
3395 TRACE("Nvidia card with texture_float support: Assuming float16 blending\n");
3396 filtered = TRUE;
3397 }
3398 else if (gl_info->limits.glsl_varyings > 44)
3399 {
3400 TRACE("More than 44 GLSL varyings - assuming d3d10 card with float16 blending\n");
3401 filtered = TRUE;
3402 }
3403 else
3404 {
3405 TRACE("Assuming no float16 blending\n");
3406 filtered = FALSE;
3407 }
3408
3409 if (filtered)
3410 {
3411 for (i = 0; i < ARRAY_SIZE(fmts16); ++i)
3412 {
3415 }
3416 }
3417 return;
3418 }
3419
3420 for (i = 0; i < ARRAY_SIZE(fmts16); ++i)
3421 {
3423 if (!format->internal)
3424 continue; /* Not supported by GL */
3425
3426 filtered = check_filter(gl_info, format->internal);
3427 if (filtered)
3428 {
3429 TRACE("Format %s supports filtering.\n", debug_d3dformat(format->f.id));
3431 }
3432 else
3433 {
3434 TRACE("Format %s does not support filtering.\n", debug_d3dformat(format->f.id));
3435 }
3436 }
3437}
#define HW_VENDOR_NVIDIA
Definition: builtin.c:4465
const WCHAR * vendor
Definition: db.cpp:873
static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal)
Definition: utils.c:3274
struct wined3d_gl_limits limits
Definition: wined3d_gl.h:344
@ ARB_TEXTURE_FLOAT
Definition: wined3d_gl.h:135
wined3d_pci_vendor
#define WINED3D_FORMAT_CAP_FILTERING

Referenced by wined3d_adapter_gl_init_format_info().

◆ init_format_gen_mipmap_info()

static void init_format_gen_mipmap_info ( const struct wined3d_adapter *  adapter,
struct wined3d_gl_info *  gl_info 
)
static

Definition at line 3831 of file utils.c.

3833{
3834 unsigned int i, j;
3835
3836 if (!gl_info->fbo_ops.glGenerateMipmap)
3837 return;
3838
3839 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
3840 {
3842
3843 for (j = 0; j < ARRAY_SIZE(format->caps); ++j)
3846 }
3847}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define WINED3D_FORMAT_CAP_GEN_MIPMAP

Referenced by wined3d_adapter_gl_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 3160 of file utils.c.

3161{
3162 struct wined3d_format_gl *format, *srgb_format;
3164 struct shader_caps shader_caps;
3165 unsigned int i, j;
3166
3167 adapter->fragment_pipe->get_caps(adapter, &fragment_caps);
3168 adapter->shader_backend->shader_get_caps(adapter, &shader_caps);
3169
3170 for (i = 0; i < ARRAY_SIZE(format_texture_info); ++i)
3171 {
3173 return FALSE;
3174
3175 if (!gl_info->supported[format_texture_info[i].extension])
3176 continue;
3177
3178 /* ARB_texture_rg defines floating point formats, but only if
3179 * ARB_texture_float is also supported. */
3180 if (!gl_info->supported[ARB_TEXTURE_FLOAT]
3181 && (format->f.attrs & WINED3D_FORMAT_ATTR_FLOAT))
3182 continue;
3183
3184 /* ARB_texture_rg defines integer formats if EXT_texture_integer is also supported. */
3185 if (!gl_info->supported[EXT_TEXTURE_INTEGER]
3186 && (format->f.attrs & WINED3D_FORMAT_ATTR_INTEGER))
3187 continue;
3188
3189 format->internal = format_texture_info[i].gl_internal;
3190 format->srgb_internal = format_texture_info[i].gl_srgb_internal;
3191 format->rt_internal = format_texture_info[i].gl_rt_internal;
3192 format->format = format_texture_info[i].gl_format;
3193 format->type = format_texture_info[i].gl_type;
3194 format->f.color_fixup = COLOR_FIXUP_IDENTITY;
3195 format->f.height_scale.numerator = 1;
3196 format->f.height_scale.denominator = 1;
3197
3201
3202 /* GL_ARB_depth_texture does not support 3D textures. It also says "cube textures are
3203 * problematic", but doesn't explicitly mandate that an error is generated. */
3206
3209
3211 format->f.caps[WINED3D_GL_RES_TYPE_RB] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3212
3213 if (format->srgb_internal != format->internal
3214 && !(adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
3215 {
3216 format->srgb_internal = format->internal;
3218 }
3219
3222
3224
3225 /* Texture conversion stuff */
3226 format->f.conv_byte_count = format_texture_info[i].conv_byte_count;
3227 format->f.upload = format_texture_info[i].upload;
3228 format->f.download = format_texture_info[i].download;
3229
3230 srgb_format = NULL;
3231 for (j = 0; j < ARRAY_SIZE(format_srgb_info); ++j)
3232 {
3233 if (format_srgb_info[j].base_format_id == format->f.id)
3234 {
3235 if (!(srgb_format = get_format_gl_internal(adapter, format_srgb_info[j].srgb_format_id)))
3236 return FALSE;
3237 break;
3238 }
3239 }
3240 if (!srgb_format)
3241 continue;
3242
3243 copy_format(adapter, &srgb_format->f, &format->f);
3244
3245 if (gl_info->supported[EXT_TEXTURE_SRGB]
3246 && !(adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
3247 {
3248 srgb_format->internal = format_texture_info[i].gl_srgb_internal;
3249 srgb_format->srgb_internal = format_texture_info[i].gl_srgb_internal;
3251 query_internal_format(adapter, srgb_format, &format_texture_info[i], gl_info, TRUE);
3252 }
3253 }
3254
3255 return TRUE;
3256}
static void copy_format(const struct wined3d_adapter *adapter, struct wined3d_format *dst_format, const struct wined3d_format *src_format)
Definition: utils.c:1993
static void query_internal_format(struct wined3d_adapter *adapter, struct wined3d_format_gl *format, const struct wined3d_format_texture_info *texture_info, struct wined3d_gl_info *gl_info, BOOL srgb_format)
Definition: utils.c:3060
static const struct wined3d_format_texture_info format_texture_info[]
Definition: utils.c:1353
static const struct wined3d_format_srgb_info format_srgb_info[]
Definition: utils.c:1921
if(dx< 0)
Definition: linetemp.h:194
#define WINED3D_SRGB_READ_WRITE_CONTROL
Definition: wined3d.h:1330
@ ARB_TEXTURE_CUBE_MAP
Definition: wined3d_gl.h:130
@ EXT_TEXTURE_INTEGER
Definition: wined3d_gl.h:196
@ EXT_TEXTURE3D
Definition: wined3d_gl.h:190
@ EXT_TEXTURE_SRGB
Definition: wined3d_gl.h:202
@ ARB_SHADOW
Definition: wined3d_gl.h:120
#define WINED3D_FORMAT_CAP_SHADOW
#define WINED3D_FORMAT_CAP_SRGB_READ

Referenced by wined3d_adapter_gl_init_format_info().

◆ init_format_vertex_info()

static BOOL init_format_vertex_info ( const struct wined3d_adapter *  adapter,
struct wined3d_gl_info *  gl_info 
)
static

Definition at line 3735 of file utils.c.

3737{
3738 struct wined3d_format_gl *format;
3739 unsigned int i;
3740
3741 for (i = 0; i < ARRAY_SIZE(format_vertex_info); ++i)
3742 {
3744 return FALSE;
3745
3746 if (!gl_info->supported[format_vertex_info[i].extension])
3747 continue;
3748
3749 format->f.emit_idx = format_vertex_info[i].emit_idx;
3750 format->vtx_type = format_vertex_info[i].gl_vtx_type;
3751 format->vtx_format = format->f.component_count;
3753 }
3754
3755 if (gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
3756 {
3758 format->vtx_format = GL_BGRA;
3759 }
3760
3761 return TRUE;
3762}
static const struct wined3d_format_vertex_info format_vertex_info[]
Definition: utils.c:705
@ ARB_VERTEX_ARRAY_BGRA
Definition: wined3d_gl.h:152
#define WINED3D_FORMAT_CAP_VERTEX_ATTRIBUTE

Referenced by wined3d_adapter_gl_init_format_info().

◆ init_srgb_formats()

static BOOL init_srgb_formats ( struct wined3d_adapter *  adapter)
static

Definition at line 2208 of file utils.c.

2209{
2210 struct wined3d_format *format, *srgb_format;
2211 unsigned int i;
2212
2213 for (i = 0; i < ARRAY_SIZE(format_srgb_info); ++i)
2214 {
2215 if (!(srgb_format = get_format_internal(adapter, format_srgb_info[i].srgb_format_id)))
2216 return FALSE;
2217 if (!(format = get_format_internal(adapter, format_srgb_info[i].base_format_id)))
2218 return FALSE;
2219
2220 copy_format(adapter, srgb_format, format);
2221 }
2222
2223 return TRUE;
2224}

Referenced by wined3d_adapter_init_format_info().

◆ init_typeless_formats()

static BOOL init_typeless_formats ( const struct wined3d_adapter *  adapter)
static

Definition at line 3764 of file utils.c.

3765{
3766 unsigned int caps[WINED3D_GL_RES_TYPE_COUNT];
3767 unsigned int attrs, i, j;
3768
3769 for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
3770 {
3771 struct wined3d_format *format, *typeless_format;
3772
3774 return FALSE;
3775 if (!(typeless_format = get_format_internal(adapter, typed_formats[i].typeless_id)))
3776 return FALSE;
3777
3778 attrs = typeless_format->attrs;
3779 memcpy(caps, typeless_format->caps, sizeof(caps));
3780 copy_format(adapter, typeless_format, format);
3781 typeless_format->attrs |= attrs;
3782 for (j = 0; j < ARRAY_SIZE(typeless_format->caps); ++j)
3783 typeless_format->caps[j] |= caps[j];
3784 }
3785
3787 {
3788 struct wined3d_format *typeless_format, *typeless_ds_format, *ds_format;
3789 struct wined3d_format *depth_view_format, *stencil_view_format;
3791
3793 return FALSE;
3794 if (!(ds_format = get_format_internal(adapter, typeless_depth_stencil_formats[i].depth_stencil_id)))
3795 return FALSE;
3796
3797 typeless_ds_format = get_format_by_idx(adapter, WINED3D_FORMAT_COUNT + i);
3798 typeless_ds_format->id = typeless_depth_stencil_formats[i].typeless_id;
3799 copy_format(adapter, typeless_ds_format, ds_format);
3800 typeless_ds_format->attrs = typeless_format->attrs;
3801 for (j = 0; j < ARRAY_SIZE(typeless_ds_format->caps); ++j)
3802 {
3803 typeless_ds_format->caps[j] = typeless_format->caps[j];
3804 typeless_format->caps[j] &= ~WINED3D_FORMAT_CAP_DEPTH_STENCIL;
3805 }
3806
3807 if ((format_id = typeless_depth_stencil_formats[i].depth_view_id)
3808 && typeless_depth_stencil_formats[i].separate_depth_view_format)
3809 {
3810 if (!(depth_view_format = get_format_internal(adapter, format_id)))
3811 return FALSE;
3812 copy_format(adapter, depth_view_format, ds_format);
3813 depth_view_format->red_size = depth_view_format->depth_size;
3814 depth_view_format->depth_size = 0;
3815 depth_view_format->stencil_size = 0;
3816 }
3817 if ((format_id = typeless_depth_stencil_formats[i].stencil_view_id))
3818 {
3819 if (!(stencil_view_format = get_format_internal(adapter, format_id)))
3820 return FALSE;
3821 copy_format(adapter, stencil_view_format, ds_format);
3822 stencil_view_format->green_size = stencil_view_format->stencil_size;
3823 stencil_view_format->depth_size = 0;
3824 stencil_view_format->stencil_size = 0;
3825 }
3826 }
3827
3828 return TRUE;
3829}
static const struct wined3d_typeless_format_depth_stencil_info typeless_depth_stencil_formats[]
Definition: utils.c:280
unsigned int attrs

Referenced by wined3d_adapter_gl_init_format_info(), and wined3d_adapter_vk_init_format_info().

◆ init_vulkan_format_info()

static void init_vulkan_format_info ( struct wined3d_format_vk *  format,
const struct wined3d_vk_info *  vk_info,
VkPhysicalDevice  vk_physical_device 
)
static

Definition at line 4203 of file utils.c.

4205{
4206 static const struct
4207 {
4208 enum wined3d_format_id id;
4209 VkFormat vk_format;
4210 const char *fixup;
4211 }
4212 vulkan_formats[] =
4213 {
4285 };
4286 VkFormat vk_format = VK_FORMAT_UNDEFINED;
4287 VkImageFormatProperties image_properties;
4288 VkFormatFeatureFlags texture_flags;
4290 VkImageUsageFlags vk_usage;
4291 unsigned int caps;
4292 const char *fixup;
4293 unsigned int i;
4294 uint32_t mask;
4295 VkResult vr;
4296
4297 for (i = 0; i < ARRAY_SIZE(vulkan_formats); ++i)
4298 {
4299 if (vulkan_formats[i].id == format->f.id)
4300 {
4301 vk_format = vulkan_formats[i].vk_format;
4302 fixup = vulkan_formats[i].fixup;
4303 break;
4304 }
4305 }
4306 if (!vk_format)
4307 {
4308 WARN("Unsupported format %s.\n", debug_d3dformat(format->f.id));
4309 return;
4310 }
4311
4312 format->vk_format = vk_format;
4313 if (fixup)
4314 format->f.color_fixup = create_color_fixup_desc_from_string(fixup);
4315 else
4316 format->f.color_fixup = COLOR_FIXUP_IDENTITY;
4317
4318 VK_CALL(vkGetPhysicalDeviceFormatProperties(vk_physical_device, vk_format, &properties));
4319 if (vk_format == VK_FORMAT_D24_UNORM_S8_UINT)
4320 {
4322 {
4323 /* AMD doesn't support VK_FORMAT_D24_UNORM_S8_UINT. */
4324 WARN("Mapping VK_FORMAT_D24_UNORM_S8_UINT to VK_FORMAT_D32_SFLOAT_S8_UINT.\n");
4325
4326 format->vk_format = vk_format = VK_FORMAT_D32_SFLOAT_S8_UINT;
4327 VK_CALL(vkGetPhysicalDeviceFormatProperties(vk_physical_device, vk_format, &properties));
4328 }
4329 }
4330
4335
4336 caps = 0;
4337 texture_flags = properties.linearTilingFeatures | properties.optimalTilingFeatures;
4338 if (texture_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)
4339 {
4341 }
4342 if (texture_flags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)
4343 {
4345 }
4347 {
4349 }
4351 {
4353 }
4355 {
4357 }
4358 if (texture_flags & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)
4359 {
4361 }
4362 if ((texture_flags & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT)
4363 && (texture_flags & VK_FORMAT_FEATURE_TRANSFER_DST_BIT))
4364 {
4366 }
4367
4370
4371 format->f.caps[WINED3D_GL_RES_TYPE_TEX_1D] |= caps;
4372 format->f.caps[WINED3D_GL_RES_TYPE_TEX_2D] |= caps;
4373 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] |= caps;
4374 format->f.caps[WINED3D_GL_RES_TYPE_TEX_CUBE] |= caps;
4375
4376 vk_usage = 0;
4377 if (texture_flags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)
4379 else if (texture_flags & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
4381 if (vk_usage)
4382 {
4383 if ((vr = VK_CALL(vkGetPhysicalDeviceImageFormatProperties(vk_physical_device, vk_format,
4384 VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, vk_usage, 0, &image_properties))) < 0)
4385 {
4386 ERR("Failed to get image format properties, vr %s.\n", wined3d_debug_vkresult(vr));
4387 return;
4388 }
4389
4390 mask = image_properties.sampleCounts & 0x3f;
4391 while (mask)
4392 {
4393 i = (1u << wined3d_bit_scan(&mask)) - 1;
4394 format->f.multisample_types |= 1u << i;
4395 }
4396 }
4397}
static const D2D1_CREATION_PROPERTIES * properties
Definition: d2d1.c:299
const char * wined3d_debug_vkresult(VkResult vr)
Definition: utils.c:5463
VkSampleCountFlags sampleCounts
Definition: vulkan.h:9003
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
Definition: vulkan.h:3140
@ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT
Definition: vulkan.h:3136
@ VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
Definition: vulkan.h:3137
@ VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
Definition: vulkan.h:3129
@ VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT
Definition: vulkan.h:3134
@ VK_FORMAT_FEATURE_TRANSFER_DST_BIT
Definition: vulkan.h:3143
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
Definition: vulkan.h:3128
@ VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
Definition: vulkan.h:3142
@ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT
Definition: vulkan.h:3135
@ VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT
Definition: vulkan.h:3131
VkFlags VkImageUsageFlags
Definition: vulkan.h:1050
@ VK_IMAGE_TILING_OPTIMAL
Definition: vulkan.h:3495
void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties)
@ VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
Definition: vulkan.h:3515
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
Definition: vulkan.h:3514
VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties)
VkFlags VkFormatFeatureFlags
Definition: vulkan.h:1029
@ VK_IMAGE_TYPE_2D
Definition: vulkan.h:3503
VkResult
Definition: vulkan.h:4639
VkFormat
Definition: vulkan.h:2815
@ VK_FORMAT_R16G16B16A16_UNORM
Definition: vulkan.h:2907
@ VK_FORMAT_A1R5G5B5_UNORM_PACK16
Definition: vulkan.h:2824
@ VK_FORMAT_R8G8B8A8_SRGB
Definition: vulkan.h:2859
@ VK_FORMAT_R32G32B32_UINT
Definition: vulkan.h:2920
@ VK_FORMAT_R16G16_SNORM
Definition: vulkan.h:2894
@ VK_FORMAT_BC2_UNORM_BLOCK
Definition: vulkan.h:2951
@ VK_FORMAT_D24_UNORM_S8_UINT
Definition: vulkan.h:2945
@ VK_FORMAT_D32_SFLOAT
Definition: vulkan.h:2942
@ VK_FORMAT_B8G8R8A8_UNORM
Definition: vulkan.h:2860
@ VK_FORMAT_R16G16B16A16_SNORM
Definition: vulkan.h:2908
@ VK_FORMAT_R8G8_SNORM
Definition: vulkan.h:2833
@ VK_FORMAT_BC7_SRGB_BLOCK
Definition: vulkan.h:2962
@ VK_FORMAT_R16G16_SFLOAT
Definition: vulkan.h:2899
@ VK_FORMAT_R32G32_SFLOAT
Definition: vulkan.h:2919
@ VK_FORMAT_R8_SNORM
Definition: vulkan.h:2826
@ VK_FORMAT_BC2_SRGB_BLOCK
Definition: vulkan.h:2952
@ VK_FORMAT_R16_SFLOAT
Definition: vulkan.h:2892
@ VK_FORMAT_R8G8_UNORM
Definition: vulkan.h:2832
@ VK_FORMAT_BC1_RGBA_SRGB_BLOCK
Definition: vulkan.h:2950
@ VK_FORMAT_R32_SINT
Definition: vulkan.h:2915
@ VK_FORMAT_R16G16_UINT
Definition: vulkan.h:2897
@ VK_FORMAT_E5B9G9R9_UFLOAT_PACK32
Definition: vulkan.h:2939
@ VK_FORMAT_BC3_UNORM_BLOCK
Definition: vulkan.h:2953
@ VK_FORMAT_R8_UNORM
Definition: vulkan.h:2825
@ VK_FORMAT_R32G32B32A32_SFLOAT
Definition: vulkan.h:2925
@ VK_FORMAT_R32G32B32A32_UINT
Definition: vulkan.h:2923
@ VK_FORMAT_BC6H_SFLOAT_BLOCK
Definition: vulkan.h:2960
@ VK_FORMAT_R5G6B5_UNORM_PACK16
Definition: vulkan.h:2820
@ VK_FORMAT_R32_SFLOAT
Definition: vulkan.h:2916
@ VK_FORMAT_R4G4B4A4_UNORM_PACK16
Definition: vulkan.h:2818
@ VK_FORMAT_R16G16B16A16_SINT
Definition: vulkan.h:2912
@ VK_FORMAT_A2B10G10R10_UNORM_PACK32
Definition: vulkan.h:2880
@ VK_FORMAT_B8G8R8A8_SRGB
Definition: vulkan.h:2866
@ VK_FORMAT_R8G8B8A8_UNORM
Definition: vulkan.h:2853
@ VK_FORMAT_R16G16_SINT
Definition: vulkan.h:2898
@ VK_FORMAT_R8G8_SINT
Definition: vulkan.h:2837
@ VK_FORMAT_UNDEFINED
Definition: vulkan.h:2816
@ VK_FORMAT_R16_SINT
Definition: vulkan.h:2891
@ VK_FORMAT_BC4_SNORM_BLOCK
Definition: vulkan.h:2956
@ VK_FORMAT_R32G32B32_SINT
Definition: vulkan.h:2921
@ VK_FORMAT_R16_UNORM
Definition: vulkan.h:2886
@ VK_FORMAT_BC6H_UFLOAT_BLOCK
Definition: vulkan.h:2959
@ VK_FORMAT_R8_SINT
Definition: vulkan.h:2830
@ VK_FORMAT_BC7_UNORM_BLOCK
Definition: vulkan.h:2961
@ VK_FORMAT_D16_UNORM
Definition: vulkan.h:2940
@ VK_FORMAT_R16_UINT
Definition: vulkan.h:2890
@ VK_FORMAT_R8_UINT
Definition: vulkan.h:2829
@ VK_FORMAT_R16G16B16A16_SFLOAT
Definition: vulkan.h:2913
@ VK_FORMAT_R16G16_UNORM
Definition: vulkan.h:2893
@ VK_FORMAT_BC5_UNORM_BLOCK
Definition: vulkan.h:2957
@ VK_FORMAT_R8G8B8A8_SINT
Definition: vulkan.h:2858
@ VK_FORMAT_R32G32_UINT
Definition: vulkan.h:2917
@ VK_FORMAT_R8G8B8A8_SNORM
Definition: vulkan.h:2854
@ VK_FORMAT_R16G16B16A16_UINT
Definition: vulkan.h:2911
@ VK_FORMAT_R32G32B32A32_SINT
Definition: vulkan.h:2924
@ VK_FORMAT_BC3_SRGB_BLOCK
Definition: vulkan.h:2954
@ VK_FORMAT_R32G32B32_SFLOAT
Definition: vulkan.h:2922
@ VK_FORMAT_R8G8B8A8_UINT
Definition: vulkan.h:2857
@ VK_FORMAT_BC1_RGBA_UNORM_BLOCK
Definition: vulkan.h:2949
@ VK_FORMAT_R16_SNORM
Definition: vulkan.h:2887
@ VK_FORMAT_B10G11R11_UFLOAT_PACK32
Definition: vulkan.h:2938
@ VK_FORMAT_R8G8_UINT
Definition: vulkan.h:2836
@ VK_FORMAT_BC5_SNORM_BLOCK
Definition: vulkan.h:2958
@ VK_FORMAT_BC4_UNORM_BLOCK
Definition: vulkan.h:2955
@ VK_FORMAT_D32_SFLOAT_S8_UINT
Definition: vulkan.h:2946
@ VK_FORMAT_R32G32_SINT
Definition: vulkan.h:2918
@ VK_FORMAT_R32_UINT
Definition: vulkan.h:2914
static int wined3d_bit_scan(unsigned int *x)
Definition: wined3d.h:2982
#define WINED3D_FORMAT_CAP_UNORDERED_ACCESS
#define WINED3D_FORMAT_CAP_VTF
#define VK_CALL(f)
Definition: wined3d_vk.h:272

Referenced by wined3d_adapter_vk_init_format_info().

◆ invert_matrix()

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

Definition at line 6775 of file utils.c.

6776{
6777 float wtmp[4][8];
6778 float m0, m1, m2, m3, s;
6779 float *r0, *r1, *r2, *r3;
6780
6781 r0 = wtmp[0];
6782 r1 = wtmp[1];
6783 r2 = wtmp[2];
6784 r3 = wtmp[3];
6785
6786 r0[0] = m->_11;
6787 r0[1] = m->_12;
6788 r0[2] = m->_13;
6789 r0[3] = m->_14;
6790 r0[4] = 1.0f;
6791 r0[5] = r0[6] = r0[7] = 0.0f;
6792
6793 r1[0] = m->_21;
6794 r1[1] = m->_22;
6795 r1[2] = m->_23;
6796 r1[3] = m->_24;
6797 r1[5] = 1.0f;
6798 r1[4] = r1[6] = r1[7] = 0.0f;
6799
6800 r2[0] = m->_31;
6801 r2[1] = m->_32;
6802 r2[2] = m->_33;
6803 r2[3] = m->_34;
6804 r2[6] = 1.0f;
6805 r2[4] = r2[5] = r2[7] = 0.0f;
6806
6807 r3[0] = m->_41;
6808 r3[1] = m->_42;
6809 r3[2] = m->_43;
6810 r3[3] = m->_44;
6811 r3[7] = 1.0f;
6812 r3[4] = r3[5] = r3[6] = 0.0f;
6813
6814 /* Choose pivot - or die. */
6815 if (fabsf(r3[0]) > fabsf(r2[0]))
6816 swap_rows(&r3, &r2);
6817 if (fabsf(r2[0]) > fabsf(r1[0]))
6818 swap_rows(&r2, &r1);
6819 if (fabsf(r1[0]) > fabsf(r0[0]))
6820 swap_rows(&r1, &r0);
6821 if (r0[0] == 0.0f)
6822 return FALSE;
6823
6824 /* Eliminate first variable. */
6825 m1 = r1[0] / r0[0]; m2 = r2[0] / r0[0]; m3 = r3[0] / r0[0];
6826 s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s;
6827 s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s;
6828 s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s;
6829 s = r0[4];
6830 if (s != 0.0f)
6831 {
6832 r1[4] -= m1 * s;
6833 r2[4] -= m2 * s;
6834 r3[4] -= m3 * s;
6835 }
6836 s = r0[5];
6837 if (s != 0.0f)
6838 {
6839 r1[5] -= m1 * s;
6840 r2[5] -= m2 * s;
6841 r3[5] -= m3 * s;
6842 }
6843 s = r0[6];
6844 if (s != 0.0f)
6845 {
6846 r1[6] -= m1 * s;
6847 r2[6] -= m2 * s;
6848 r3[6] -= m3 * s;
6849 }
6850 s = r0[7];
6851 if (s != 0.0f)
6852 {
6853 r1[7] -= m1 * s;
6854 r2[7] -= m2 * s;
6855 r3[7] -= m3 * s;
6856 }
6857
6858 /* Choose pivot - or die. */
6859 if (fabsf(r3[1]) > fabsf(r2[1]))
6860 swap_rows(&r3, &r2);
6861 if (fabsf(r2[1]) > fabsf(r1[1]))
6862 swap_rows(&r2, &r1);
6863 if (r1[1] == 0.0f)
6864 return FALSE;
6865
6866 /* Eliminate second variable. */
6867 m2 = r2[1] / r1[1]; m3 = r3[1] / r1[1];
6868 r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2];
6869 r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3];
6870 s = r1[4];
6871 if (s != 0.0f)
6872 {
6873 r2[4] -= m2 * s;
6874 r3[4] -= m3 * s;
6875 }
6876 s = r1[5];
6877 if (s != 0.0f)
6878 {
6879 r2[5] -= m2 * s;
6880 r3[5] -= m3 * s;
6881 }
6882 s = r1[6];
6883 if (s != 0.0f)
6884 {
6885 r2[6] -= m2 * s;
6886 r3[6] -= m3 * s;
6887 }
6888 s = r1[7];
6889 if (s != 0.0f)
6890 {
6891 r2[7] -= m2 * s;
6892 r3[7] -= m3 * s;
6893 }
6894
6895 /* Choose pivot - or die. */
6896 if (fabsf(r3[2]) > fabsf(r2[2]))
6897 swap_rows(&r3, &r2);
6898 if (r2[2] == 0.0f)
6899 return FALSE;
6900
6901 /* Eliminate third variable. */
6902 m3 = r3[2] / r2[2];
6903 r3[3] -= m3 * r2[3];
6904 r3[4] -= m3 * r2[4];
6905 r3[5] -= m3 * r2[5];
6906 r3[6] -= m3 * r2[6];
6907 r3[7] -= m3 * r2[7];
6908
6909 /* Last check. */
6910 if (r3[3] == 0.0f)
6911 return FALSE;
6912
6913 /* Back substitute row 3. */
6914 s = 1.0f / r3[3];
6915 r3[4] *= s;
6916 r3[5] *= s;
6917 r3[6] *= s;
6918 r3[7] *= s;
6919
6920 /* Back substitute row 2. */
6921 m2 = r2[3];
6922 s = 1.0f / r2[2];
6923 r2[4] = s * (r2[4] - r3[4] * m2);
6924 r2[5] = s * (r2[5] - r3[5] * m2);
6925 r2[6] = s * (r2[6] - r3[6] * m2);
6926 r2[7] = s * (r2[7] - r3[7] * m2);
6927 m1 = r1[3];
6928 r1[4] -= r3[4] * m1;
6929 r1[5] -= r3[5] * m1;
6930 r1[6] -= r3[6] * m1;
6931 r1[7] -= r3[7] * m1;
6932 m0 = r0[3];
6933 r0[4] -= r3[4] * m0;
6934 r0[5] -= r3[5] * m0;
6935 r0[6] -= r3[6] * m0;
6936 r0[7] -= r3[7] * m0;
6937
6938 /* Back substitute row 1. */
6939 m1 = r1[2];
6940 s = 1.0f / r1[1];
6941 r1[4] = s * (r1[4] - r2[4] * m1);
6942 r1[5] = s * (r1[5] - r2[5] * m1);
6943 r1[6] = s * (r1[6] - r2[6] * m1);
6944 r1[7] = s * (r1[7] - r2[7] * m1);
6945 m0 = r0[2];
6946 r0[4] -= r2[4] * m0;
6947 r0[5] -= r2[5] * m0;
6948 r0[6] -= r2[6] * m0;
6949 r0[7] -= r2[7] * m0;
6950
6951 /* Back substitute row 0. */
6952 m0 = r0[1];
6953 s = 1.0f / r0[0];
6954 r0[4] = s * (r0[4] - r1[4] * m0);
6955 r0[5] = s * (r0[5] - r1[5] * m0);
6956 r0[6] = s * (r0[6] - r1[6] * m0);
6957 r0[7] = s * (r0[7] - r1[7] * m0);
6958
6959 out->_11 = r0[4];
6960 out->_12 = r0[5];
6961 out->_13 = r0[6];
6962 out->_14 = r0[7];
6963 out->_21 = r1[4];
6964 out->_22 = r1[5];
6965 out->_23 = r1[6];
6966 out->_24 = r1[7];
6967 out->_31 = r2[4];
6968 out->_32 = r2[5];
6969 out->_33 = r2[6];
6970 out->_34 = r2[7];
6971 out->_41 = r3[4];
6972 out->_42 = r3[5];
6973 out->_43 = r3[6];
6974 out->_44 = r3[7];
6975
6976 return TRUE;
6977}
static void swap_rows(float **a, float **b)
Definition: utils.c:6767
_ACRTIMP float __cdecl fabsf(float)
const GLfloat * m
Definition: glext.h:10848
static DNS_RECORDW r3
Definition: record.c:39
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by compute_normal_matrix(), and wined3d_device_apply_stateblock().

◆ invert_matrix_3d()

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

Definition at line 6980 of file utils.c.

6981{
6982 float pos, neg, t, det;
6983 struct wined3d_matrix temp;
6984
6985 /* Calculate the determinant of upper left 3x3 submatrix and
6986 * determine if the matrix is singular. */
6987 pos = neg = 0.0f;
6988 t = in->_11 * in->_22 * in->_33;
6989 if (t >= 0.0f)
6990 pos += t;
6991 else
6992 neg += t;
6993
6994 t = in->_21 * in->_32 * in->_13;
6995 if (t >= 0.0f)
6996 pos += t;
6997 else
6998 neg += t;
6999 t = in->_31 * in->_12 * in->_23;
7000 if (t >= 0.0f)
7001 pos += t;
7002 else
7003 neg += t;
7004
7005 t = -in->_31 * in->_22 * in->_13;
7006 if (t >= 0.0f)
7007 pos += t;
7008 else
7009 neg += t;
7010 t = -in->_21 * in->_12 * in->_33;
7011 if (t >= 0.0f)
7012 pos += t;
7013 else
7014 neg += t;
7015
7016 t = -in->_11 * in->_32 * in->_23;
7017 if (t >= 0.0f)
7018 pos += t;
7019 else
7020 neg += t;
7021
7022 det = pos + neg;
7023
7024 if (fabsf(det) < 1e-25f)
7025 return FALSE;
7026
7027 det = 1.0f / det;
7028 temp._11 = (in->_22 * in->_33 - in->_32 * in->_23) * det;
7029 temp._12 = -(in->_12 * in->_33 - in->_32 * in->_13) * det;
7030 temp._13 = (in->_12 * in->_23 - in->_22 * in->_13) * det;
7031 temp._21 = -(in->_21 * in->_33 - in->_31 * in->_23) * det;
7032 temp._22 = (in->_11 * in->_33 - in->_31 * in->_13) * det;
7033 temp._23 = -(in->_11 * in->_23 - in->_21 * in->_13) * det;
7034 temp._31 = (in->_21 * in->_32 - in->_31 * in->_22) * det;
7035 temp._32 = -(in->_11 * in->_32 - in->_31 * in->_12) * det;
7036 temp._33 = (in->_11 * in->_22 - in->_21 * in->_12) * det;
7037
7038 *out = temp;
7039 return TRUE;
7040}
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 compute_normal_matrix().

◆ 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 5554 of file utils.c.

5556{
5557 if (op == WINED3D_TOP_DISABLE)
5558 return FALSE;
5560 return FALSE;
5561
5564 return TRUE;
5567 return TRUE;
5570 return TRUE;
5571
5572 return FALSE;
5573}
UINT op
Definition: effect.c:235
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:880
#define WINED3DTA_TEXTURE
Definition: wined3d.h:883
static struct wined3d_texture * wined3d_state_get_ffp_texture(const struct wined3d_state *state, unsigned int idx)

Referenced by wined3d_ffp_get_fs_settings().

◆ lookup_gl_view_class()

static GLenum lookup_gl_view_class ( GLenum  internal_format)
static

Definition at line 2929 of file utils.c.

2930{
2931 static const struct
2932 {
2933 GLenum internal_format;
2934 GLenum view_class;
2935 }
2936 view_classes[] =
2937 {
2938 /* 128-bit */
2942 /* 96-bit */
2946 /* 64-bit */
2955 /* 48-bit */
2961 /* 32-bit */
2979 /* 24-bit */
2985 /* 16-bit */
2995 /* 8-bit */
3000
3001 /* RGTC1 */
3004 /* RGTC2 */
3007
3008 /* BPTC unorm */
3011 /* BPTC float */
3014
3015 /* DXT1 RGB */
3018 /* DXT1 RGBA */
3021 /* DXT3 */
3024 /* DXT5 */
3027 };
3028
3029 unsigned int i;
3030
3031 for (i = 0; i < ARRAY_SIZE(view_classes); ++i)
3032 {
3033 if (view_classes[i].internal_format == internal_format)
3034 return view_classes[i].view_class;
3035 }
3036
3037 return GL_NONE;
3038}
#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:5007
#define GL_VIEW_CLASS_96_BITS
Definition: wgl.h:5013
#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
Definition: wgl.h:679
#define GL_VIEW_CLASS_S3TC_DXT1_RGB
Definition: wgl.h:5037
#define GL_VIEW_CLASS_128_BITS
Definition: wgl.h:5006
#define GL_VIEW_CLASS_S3TC_DXT5_RGBA
Definition: wgl.h:5040
#define GL_VIEW_CLASS_S3TC_DXT1_RGBA
Definition: wgl.h:5038
#define GL_VIEW_CLASS_24_BITS
Definition: wgl.h:5008
#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT
Definition: wgl.h:641
#define GL_VIEW_CLASS_8_BITS
Definition: wgl.h:5012
#define GL_VIEW_CLASS_BPTC_FLOAT
Definition: wgl.h:5028
#define GL_VIEW_CLASS_48_BITS
Definition: wgl.h:5010
#define GL_COMPRESSED_RGBA_BPTC_UNORM
Definition: wgl.h:634
#define GL_VIEW_CLASS_64_BITS
Definition: wgl.h:5011
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT
Definition: wgl.h:643
#define GL_VIEW_CLASS_BPTC_UNORM
Definition: wgl.h:5029
#define GL_VIEW_CLASS_32_BITS
Definition: wgl.h:5009
#define GL_VIEW_CLASS_RGTC1_RED
Definition: wgl.h:5035
#define GL_VIEW_CLASS_RGTC2_RG
Definition: wgl.h:5036
#define GL_VIEW_CLASS_S3TC_DXT3_RGBA
Definition: wgl.h:5039

Referenced by query_view_class().

◆ map_channel_type()

static enum wined3d_channel_type map_channel_type ( char  t)
static

Definition at line 2017 of file utils.c.

2018{
2019 switch (t)
2020 {
2021 case 'u':
2023 case 'i':
2025 case 'U':
2027 case 'I':
2029 case 'F':
2031 case 'D':
2033 case 'S':
2035 case 'X':
2037 default:
2038 ERR("Invalid channel type '%c'.\n", t);
2040 }
2041}
@ WINED3D_CHANNEL_TYPE_UNUSED
@ WINED3D_CHANNEL_TYPE_UNORM
@ WINED3D_CHANNEL_TYPE_STENCIL
@ WINED3D_CHANNEL_TYPE_FLOAT
@ WINED3D_CHANNEL_TYPE_SNORM
@ WINED3D_CHANNEL_TYPE_NONE
@ WINED3D_CHANNEL_TYPE_UINT
@ WINED3D_CHANNEL_TYPE_SINT
@ WINED3D_CHANNEL_TYPE_DEPTH

Referenced by parse_channel_desc(), and wined3d_get_typed_format_id().

◆ multiply_matrix()

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

Definition at line 6112 of file utils.c.

6113{
6114 struct wined3d_matrix tmp;
6115
6116 /* Now do the multiplication 'by hand'.
6117 I know that all this could be optimised, but this will be done later :-) */
6118 tmp._11 = (src1->_11 * src2->_11) + (src1->_21 * src2->_12) + (src1->_31 * src2->_13) + (src1->_41 * src2->_14);
6119 tmp._21 = (src1->_11 * src2->_21) + (src1->_21 * src2->_22) + (src1->_31 * src2->_23) + (src1->_41 * src2->_24);
6120 tmp._31 = (src1->_11 * src2->_31) + (src1->_21 * src2->_32) + (src1->_31 * src2->_33) + (src1->_41 * src2->_34);
6121 tmp._41 = (src1->_11 * src2->_41) + (src1->_21 * src2->_42) + (src1->_31 * src2->_43) + (src1->_41 * src2->_44);
6122
6123 tmp._12 = (src1->_12 * src2->_11) + (src1->_22 * src2->_12) + (src1->_32 * src2->_13) + (src1->_42 * src2->_14);
6124 tmp._22 = (src1->_12 * src2->_21) + (src1->_22 * src2->_22) + (src1->_32 * src2->_23) + (src1->_42 * src2->_24);
6125 tmp._32 = (src1->_12 * src2->_31) + (src1->_22 * src2->_32) + (src1->_32 * src2->_33) + (src1->_42 * src2->_34);
6126 tmp._42 = (src1->_12 * src2->_41) + (src1->_22 * src2->_42) + (src1->_32 * src2->_43) + (src1->_42 * src2->_44);
6127
6128 tmp._13 = (src1->_13 * src2->_11) + (src1->_23 * src2->_12) + (src1->_33 * src2->_13) + (src1->_43 * src2->_14);
6129 tmp._23 = (src1->_13 * src2->_21) + (src1->_23 * src2->_22) + (src1->_33 * src2->_23) + (src1->_43 * src2->_24);
6130 tmp._33 = (src1->_13 * src2->_31) + (src1->_23 * src2->_32) + (src1->_33 * src2->_33) + (src1->_43 * src2->_34);
6131 tmp._43 = (src1->_13 * src2->_41) + (src1->_23 * src2->_42) + (src1->_33 * src2->_43) + (src1->_43 * src2->_44);
6132
6133 tmp._14 = (src1->_14 * src2->_11) + (src1->_24 * src2->_12) + (src1->_34 * src2->_13) + (src1->_44 * src2->_14);
6134 tmp._24 = (src1->_14 * src2->_21) + (src1->_24 * src2->_22) + (src1->_34 * src2->_23) + (src1->_44 * src2->_24);
6135 tmp._34 = (src1->_14 * src2->_31) + (src1->_24 * src2->_32) + (src1->_34 * src2->_33) + (src1->_44 * src2->_34);
6136 tmp._44 = (src1->_14 * src2->_41) + (src1->_24 * src2->_42) + (src1->_34 * src2->_43) + (src1->_44 * src2->_44);
6137
6138 *dst = tmp;
6139}

Referenced by d3d_device3_MultiplyTransform(), d3d_device3_SetTransform(), d3d_viewport_TransformVertices(), get_projection_matrix(), init_transformed_lights(), prepare_clip_space_planes(), process_vertices_strided(), update_clip_space(), and wined3d_stateblock_multiply_transform().

◆ parse_channel_desc()

static void parse_channel_desc ( struct wined3d_format *  format,
const char *  channel_desc 
)
static

Definition at line 2043 of file utils.c.

2044{
2045 unsigned int component_count = 0;
2046 unsigned int attrs = 0;
2047 unsigned int j;
2048
2049 for (j = 0; j < strlen(channel_desc); ++j)
2050 {
2051 enum wined3d_channel_type channel_type = map_channel_type(channel_desc[j]);
2052
2053 if (channel_type == WINED3D_CHANNEL_TYPE_UNORM || channel_type == WINED3D_CHANNEL_TYPE_SNORM)
2055 if (channel_type == WINED3D_CHANNEL_TYPE_UINT || channel_type == WINED3D_CHANNEL_TYPE_SINT)
2057 if (channel_type == WINED3D_CHANNEL_TYPE_FLOAT)
2059 if (channel_type != WINED3D_CHANNEL_TYPE_UNUSED)
2061
2062 if (channel_type == WINED3D_CHANNEL_TYPE_DEPTH && !format->depth_size)
2063 {
2064 format->depth_size = format->red_size;
2065 format->red_size = format->red_offset = 0;
2066 }
2067
2068 if (channel_type == WINED3D_CHANNEL_TYPE_STENCIL && !format->stencil_size)
2069 {
2070 format->stencil_size = format->green_size;
2071 format->green_size = format->green_offset = 0;
2072 }
2073 }
2074
2075 format->attrs |= attrs;
2076 format->component_count = component_count;
2077}
unsigned int component_count
static enum wined3d_channel_type map_channel_type(char t)
Definition: utils.c:2017
wined3d_channel_type
#define WINED3D_FORMAT_ATTR_NORMALISED

Referenced by init_format_base_info().

◆ pixelformat_for_depth()

enum wined3d_format_id pixelformat_for_depth ( DWORD  depth)

Definition at line 6067 of file utils.c.

6068{
6069 switch (depth)
6070 {
6071 case 8: return WINED3DFMT_P8_UINT;
6072 case 15: return WINED3DFMT_B5G5R5X1_UNORM;
6073 case 16: return WINED3DFMT_B5G6R5_UNORM;
6074 case 24: return WINED3DFMT_B8G8R8X8_UNORM; /* Robots needs 24bit to be WINED3DFMT_B8G8R8X8_UNORM */
6075 case 32: return WINED3DFMT_B8G8R8X8_UNORM; /* EVE online and the Fur demo need 32bit AdapterDisplayMode to return WINED3DFMT_B8G8R8X8_UNORM */
6076 default: return WINED3DFMT_UNKNOWN;
6077 }
6078}

Referenced by adapter_format_from_backbuffer_format(), wined3d_output_get_display_mode(), wined3d_output_update_modes(), and wined3d_restore_display_modes().

◆ query_format_cap()

static void query_format_cap ( struct wined3d_gl_info *  gl_info,
struct wined3d_format_gl *  format,
GLint  internal,
GLenum  pname,
unsigned int  cap,
const char *  string 
)
static

Definition at line 2765 of file utils.c.

2767{
2768 GLint value;
2770
2771 for (type = 0; type < ARRAY_SIZE(format->f.caps); ++type)
2772 {
2773 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type), internal, pname, 1, &value);
2774 if (value == GL_FULL_SUPPORT)
2775 {
2776 TRACE("Format %s supports %s, resource type %u.\n", debug_d3dformat(format->f.id), string, type);
2777 format->f.caps[type] |= cap;
2778 }
2779 else
2780 {
2781 TRACE("Format %s doesn't support %s, resource type %u.\n", debug_d3dformat(format->f.id), string, type);
2782 format->f.caps[type] &= ~cap;
2783 }
2784 }
2785}
GLenum pname
Definition: glext.h:5645
GLenum cap
Definition: glext.h:9639
#define cap
Definition: glfuncs.h:226

Referenced by query_internal_format().

◆ query_internal_format()

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

Definition at line 3060 of file utils.c.

3063{
3064 GLint count, multisample_types[8];
3065 unsigned int i, max_log2;
3066 GLenum target;
3067
3069 {
3070 query_format_cap(gl_info, format, format->internal, GL_VERTEX_TEXTURE,
3071 WINED3D_FORMAT_CAP_VTF, "vertex texture usage");
3072 query_format_cap(gl_info, format, format->internal, GL_FILTER,
3073 WINED3D_FORMAT_CAP_FILTERING, "filtering");
3075 WINED3D_FORMAT_CAP_UNORDERED_ACCESS, "unordered access");
3076
3077 if (srgb_format || format->srgb_internal != format->internal)
3078 {
3079 query_format_cap(gl_info, format, format->srgb_internal, GL_SRGB_READ,
3080 WINED3D_FORMAT_CAP_SRGB_READ, "sRGB read");
3081 query_format_cap(gl_info, format, format->srgb_internal, GL_SRGB_WRITE,
3082 WINED3D_FORMAT_CAP_SRGB_WRITE, "sRGB write");
3083
3084 if (!(format->f.caps[WINED3D_GL_RES_TYPE_TEX_2D]
3086 format->srgb_internal = format->internal;
3087 else if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
3088 format->internal = format->srgb_internal;
3089 }
3090 }
3091 else
3092 {
3093 if (!gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX])
3095
3100
3101 if (srgb_format || format->srgb_internal != format->internal)
3102 {
3103 /* Filter sRGB capabilities if EXT_texture_sRGB is not supported. */
3104 if (!gl_info->supported[EXT_TEXTURE_SRGB])
3105 {
3106 format->srgb_internal = format->internal;
3108 }
3109 else if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
3110 {
3111 format->internal = format->srgb_internal;
3112 }
3113 }
3114 }
3115
3116 if (!gl_info->supported[ARB_DEPTH_TEXTURE] && (format->f.depth_size || format->f.stencil_size))
3117 {
3118 TRACE("Disabling texturing support for depth / stencil format %s.\n", debug_d3dformat(format->f.id));
3119 format->f.caps[WINED3D_GL_RES_TYPE_TEX_1D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3120 format->f.caps[WINED3D_GL_RES_TYPE_TEX_2D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3121 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3122 format->f.caps[WINED3D_GL_RES_TYPE_TEX_CUBE] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3123 }
3124
3126
3127 if (format->internal && format->f.caps[WINED3D_GL_RES_TYPE_RB]
3130 {
3131 if (gl_info->supported[ARB_INTERNALFORMAT_QUERY])
3132 {
3134 count = 0;
3135 GL_EXTCALL(glGetInternalformativ(target, format->internal,
3137 if (count > ARRAY_SIZE(multisample_types))
3138 FIXME("Unexpectedly high number of multisample types %d.\n", count);
3139 count = min(count, ARRAY_SIZE(multisample_types));
3140 GL_EXTCALL(glGetInternalformativ(target, format->internal,
3141 GL_SAMPLES, count, multisample_types));
3142 checkGLcall("query sample counts");
3143 for (i = 0; i < count; ++i)
3144 {
3145 if (multisample_types[i] > sizeof(format->f.multisample_types) * CHAR_BIT)
3146 continue;
3147 format->f.multisample_types |= 1u << (multisample_types[i] - 1);
3148 }
3149 }
3150 else
3151 {
3152 max_log2 = wined3d_log2i(min(gl_info->limits.samples,
3153 sizeof(format->f.multisample_types) * CHAR_BIT));
3154 for (i = 1; i <= max_log2; ++i)
3155 format->f.multisample_types |= 1u << ((1u << i) - 1);
3156 }
3157 }
3158}
static void query_format_cap(struct wined3d_gl_info *gl_info, struct wined3d_format_gl *format, GLint internal, GLenum pname, unsigned int cap, const char *string)
Definition: utils.c:2765
static void query_view_class(struct wined3d_format_gl *format)
Definition: utils.c:3040
#define CHAR_BIT
Definition: cabinet.h:45
#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
Definition: tools.h:99
#define GL_SRGB_WRITE
Definition: wgl.h:4024
#define GL_SRGB_READ
Definition: wgl.h:4023
#define GL_FILTER
Definition: wgl.h:1297
#define GL_SHADER_IMAGE_STORE
Definition: wgl.h:3857
#define GL_VERTEX_TEXTURE
Definition: wgl.h:4959
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2952
@ ARB_INTERNALFORMAT_QUERY
Definition: wined3d_gl.h:91
@ ARB_DEPTH_TEXTURE
Definition: wined3d_gl.h:68
@ ARB_TEXTURE_MULTISAMPLE
Definition: wined3d_gl.h:139
@ EXT_FRAMEBUFFER_MULTISAMPLE
Definition: wined3d_gl.h:176

Referenced by init_format_texture_info().

◆ query_view_class()

static void query_view_class ( struct wined3d_format_gl *  format)
static

Definition at line 3040 of file utils.c.

3041{
3042 GLenum internal_view_class, gamma_view_class, rt_view_class;
3043
3044 internal_view_class = lookup_gl_view_class(format->internal);
3045 gamma_view_class = lookup_gl_view_class(format->srgb_internal);
3046 rt_view_class = lookup_gl_view_class(format->rt_internal);
3047
3048 if (internal_view_class == gamma_view_class || gamma_view_class == rt_view_class)
3049 {
3050 format->view_class = internal_view_class;
3051 TRACE("Format %s is member of GL view class %#x.\n",
3052 debug_d3dformat(format->f.id), format->view_class);
3053 }
3054 else
3055 {
3056 format->view_class = GL_NONE;
3057 }
3058}
static GLenum lookup_gl_view_class(GLenum internal_format)
Definition: utils.c:2929

Referenced by query_internal_format().

◆ rgb888_from_rgb565()

static void rgb888_from_rgb565 ( WORD  rgb565,
BYTE *  r,
BYTE *  g,
BYTE *  b 
)
static

Definition at line 361 of file utils.c.

362{
363 BYTE c;
364
365 /* (2⁸ - 1) / (2⁵ - 1) ≈ 2⁸ / 2⁵ + 2⁸ / 2¹⁰
366 * (2⁸ - 1) / (2⁶ - 1) ≈ 2⁸ / 2⁶ + 2⁸ / 2¹² */
367 c = rgb565 >> 11;
368 *r = (c << 3) + (c >> 2);
369 c = (rgb565 >> 5) & 0x3f;
370 *g = (c << 2) + (c >> 4);
371 c = rgb565 & 0x1f;
372 *b = (c << 3) + (c >> 2);
373}
#define c
Definition: ke_i.h:80

Referenced by build_dxtn_colour_table().

◆ swap_rows()

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

Definition at line 6767 of file utils.c.

6768{
6769 float *tmp = *a;
6770
6771 *a = *b;
6772 *b = tmp;
6773}

Referenced by invert_matrix().

◆ 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 3990 of file utils.c.

3991{
3992 const struct wined3d_gl_info *gl_info = ctx->gl_info;
3993 static const struct wined3d_color blue = {0.0f, 0.0f, 1.0f, 1.0f};
3994 GLuint fbo, color, depth;
3995 unsigned int low = 0, high = 32, cur;
3996 uint32_t readback[256];
3997 static const struct wined3d_vec3 geometry[] =
3998 {
3999 {-1.0f, -1.0f, -1.0f},
4000 { 1.0f, -1.0f, 0.0f},
4001 {-1.0f, 1.0f, -1.0f},
4002 { 1.0f, 1.0f, 0.0f},
4003 };
4004
4005 /* Most drivers want 2^23 for fixed point depth buffers, including r300g, r600g,
4006 * Nvidia. Use this as a fallback if the detection fails. */
4007 unsigned int fallback = 23;
4008
4009 gl_info->gl_ops.gl.p_glGenTextures(1, &color);
4010 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, color);
4011 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
4012 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);
4013
4014 gl_info->fbo_ops.glGenRenderbuffers(1, &depth);
4015 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, depth);
4016 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, format, 256, 1);
4017
4018 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
4019 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
4020 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color, 0);
4021 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth);
4022 checkGLcall("Setup framebuffer");
4023
4024 gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 0.5f, 0.0f);
4025 gl_info->gl_ops.gl.p_glClearDepth(0.5f);
4026 gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_TEST);
4027 gl_info->gl_ops.gl.p_glEnable(GL_POLYGON_OFFSET_FILL);
4028 gl_info->gl_ops.gl.p_glViewport(0, 0, 256, 1);
4029 checkGLcall("Misc parameters");
4030
4031 for (;;)
4032 {
4033 if (high - low <= 1)
4034 {
4035 ERR("PolygonOffset scale factor detection failed, using fallback value 2^%u.\n", fallback);
4036 cur = fallback;
4037 break;
4038 }
4039 cur = (low + high) / 2;
4040
4041 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
4042 /* The post viewport transform Z of the geometry runs from 0.0 to 0.5. We want to push it another
4043 * 0.25 so that the Z buffer content (0.5) cuts the quad off at half the screen. */
4044 gl_info->gl_ops.gl.p_glPolygonOffset(0.0f, (float)(1u << cur) * 0.25f);
4045 draw_test_quad(ctx, geometry, &blue);
4046 checkGLcall("Test draw");
4047
4048 /* Rebinding texture to workaround a fglrx bug. */
4049 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, color);
4050 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, readback);
4051 checkGLcall("readback");
4052
4053 TRACE("low %02u, high %02u, cur %2u, 0=0x%08x, 125=0x%08x, 131=0x%08x, 255=0x%08x\n",
4054 low, high, cur, readback[0], readback[125], readback[131], readback[255]);
4055
4056 if ((readback[125] & 0xff) < 0xa0)
4057 high = cur;
4058 else if ((readback[131] & 0xff) > 0xa0)
4059 low = cur;
4060 else
4061 {
4062 TRACE("Found scale factor 2^%u for format %x.\n", cur, format);
4063 break;
4064 }
4065 }
4066
4067 gl_info->gl_ops.gl.p_glDeleteTextures(1, &color);
4068 gl_info->fbo_ops.glDeleteRenderbuffers(1, &depth);
4069 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
4070 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
4071 checkGLcall("Delete framebuffer");
4072
4073 gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
4074 gl_info->gl_ops.gl.p_glDisable(GL_POLYGON_OFFSET_FILL);
4075 return (float)(1u << cur);
4076}
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_gl_init_format_info()

BOOL wined3d_adapter_gl_init_format_info ( struct wined3d_adapter *  adapter,
struct wined3d_caps_gl_ctx *  ctx 
)

Definition at line 4177 of file utils.c.

4178{
4180
4182 return FALSE;
4183
4184 if (!init_format_texture_info(adapter, gl_info)) goto fail;
4185 if (!init_format_vertex_info(adapter, gl_info)) goto fail;
4186
4187 apply_format_fixups(adapter, gl_info);
4192
4193 if (!init_typeless_formats(adapter)) goto fail;
4194
4195 return TRUE;
4196
4197fail:
4198 free(adapter->formats);
4199 adapter->formats = NULL;
4200 return FALSE;
4201}
#define free
Definition: debug_ros.c:5
static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3160
static BOOL init_typeless_formats(const struct wined3d_adapter *adapter)
Definition: utils.c:3764
static BOOL init_format_vertex_info(const struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3735
static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3492
static void init_format_fbo_compat_info(const struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
Definition: utils.c:2788
static BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, size_t format_size)
Definition: utils.c:4107
static void init_format_gen_mipmap_info(const struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3831
static void init_format_depth_bias_scale(struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
Definition: utils.c:4078
static void init_format_filter_info(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3373
struct wined3d_gl_info gl_info
Definition: wined3d_gl.h:800

Referenced by wined3d_adapter_gl_init().

◆ wined3d_adapter_init_format_info()

static BOOL wined3d_adapter_init_format_info ( struct wined3d_adapter *  adapter,
size_t  format_size 
)
static

Definition at line 4107 of file utils.c.

4108{
4110
4111 if (!(adapter->formats = calloc(count, format_size)))
4112 {
4113 ERR("Failed to allocate memory.\n");
4114 return FALSE;
4115 }
4116 adapter->format_size = format_size;
4117
4119 goto fail;
4121 goto fail;
4123 goto fail;
4125 goto fail;
4126
4127 return TRUE;
4128
4129fail:
4130 free(adapter->formats);
4131 adapter->formats = NULL;
4132 return FALSE;
4133}
static BOOL init_format_block_info(struct wined3d_adapter *adapter)
Definition: utils.c:2161
static BOOL init_format_decompress_info(struct wined3d_adapter *adapter)
Definition: utils.c:2191
static BOOL init_format_base_info(struct wined3d_adapter *adapter)
Definition: utils.c:2079
static BOOL init_srgb_formats(struct wined3d_adapter *adapter)
Definition: utils.c:2208
void format_size(uint64_t size, wstring &s, bool show_bytes)
Definition: main.cpp:65
#define calloc
Definition: rosglue.h:14

Referenced by wined3d_adapter_gl_init_format_info(), wined3d_adapter_no3d_init_format_info(), and wined3d_adapter_vk_init_format_info().

◆ wined3d_adapter_no3d_init_format_info()

BOOL wined3d_adapter_no3d_init_format_info ( struct wined3d_adapter *  adapter)

Definition at line 4135 of file utils.c.

Referenced by wined3d_adapter_no3d_create().

◆ wined3d_adapter_vk_init_format_info()

BOOL wined3d_adapter_vk_init_format_info ( struct wined3d_adapter_vk *  adapter_vk,
const struct wined3d_vk_info *  vk_info 
)

Definition at line 4399 of file utils.c.

4401{
4402 VkPhysicalDevice vk_physical_device = adapter_vk->physical_device;
4403 struct wined3d_adapter *adapter = &adapter_vk->a;
4404 struct wined3d_format_vk *format;
4405 unsigned int i;
4406
4408 return FALSE;
4409
4410 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
4411 {
4413
4414 if (format->f.id)
4415 init_vulkan_format_info(format, vk_info, vk_physical_device);
4416 }
4417
4418 if (!init_typeless_formats(adapter)) goto fail;
4419
4420 return TRUE;
4421
4422fail:
4423 free(adapter->formats);
4424 adapter->formats = NULL;
4425 return FALSE;
4426}
static void init_vulkan_format_info(struct wined3d_format_vk *format, const struct wined3d_vk_info *vk_info, VkPhysicalDevice vk_physical_device)
Definition: utils.c:4203
static struct wined3d_format_vk * wined3d_format_vk_mutable(struct wined3d_format *format)
Definition: utils.c:1953
struct wined3d_adapter a
Definition: wined3d_vk.h:726
VkPhysicalDevice physical_device
Definition: wined3d_vk.h:731

Referenced by wined3d_adapter_vk_init().

◆ wined3d_allocator_acquire_block()

static struct wined3d_allocator_block * wined3d_allocator_acquire_block ( struct wined3d_allocator *  allocator)
static

Definition at line 7074 of file utils.c.

7075{
7077
7078 if (!allocator->free)
7079 return malloc(sizeof(*block));
7080
7081 block = allocator->free;
7082 allocator->free = block->parent;
7083
7084 return block;
7085}
#define malloc
Definition: debug_ros.c:4
static unsigned int block
Definition: xmlmemory.c:101

Referenced by wined3d_allocator_chunk_allocate(), and wined3d_allocator_chunk_init().

◆ wined3d_allocator_allocate()

struct wined3d_allocator_block * wined3d_allocator_allocate ( struct wined3d_allocator *  allocator,
struct wined3d_context *  context,
unsigned int  memory_type,
size_t  size 
)

Definition at line 7234 of file utils.c.

7236{
7239 unsigned int order;
7240
7242 return NULL;
7243
7246 else
7248
7249 LIST_FOR_EACH_ENTRY(chunk, &allocator->pools[memory_type].chunks, struct wined3d_allocator_chunk, entry)
7250 {
7252 return block;
7253 }
7254
7255 if (!(chunk = allocator->ops->allocator_create_chunk(allocator,
7256 context, memory_type, WINED3D_ALLOCATOR_CHUNK_SIZE)))
7257 return NULL;
7258
7260 return NULL;
7261
7262 return block;
7263}
static struct wined3d_allocator_block * wined3d_allocator_chunk_allocate(struct wined3d_allocator_chunk *chunk, unsigned int order)
Definition: utils.c:7187
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
#define WINED3D_ALLOCATOR_MIN_BLOCK_SIZE
#define WINED3D_ALLOCATOR_CHUNK_ORDER_COUNT
#define WINED3D_ALLOCATOR_CHUNK_SIZE

Referenced by wined3d_context_vk_allocate_memory(), and wined3d_device_gl_allocate_memory().

◆ wined3d_allocator_block_free()

void wined3d_allocator_block_free ( struct wined3d_allocator_block *  block)

Definition at line 7087 of file utils.c.

7088{
7089 struct wined3d_allocator *allocator = block->chunk->allocator;
7091
7092 while ((parent = block->parent) && block->sibling->free)
7093 {
7094 list_remove(&block->sibling->entry);
7097 block = parent;
7098 }
7099
7100 block->free = true;
7101 list_add_head(&block->chunk->available[block->order], &block->entry);
7102}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
static void wined3d_allocator_release_block(struct wined3d_allocator *allocator, struct wined3d_allocator_block *block)
Definition: utils.c:7067
r parent
Definition: btrfs.c:3010

Referenced by wined3d_context_vk_free_memory(), and wined3d_device_gl_free_memory().

◆ wined3d_allocator_block_init()

static void wined3d_allocator_block_init ( struct wined3d_allocator_block *  block,
struct wined3d_allocator_chunk *  chunk,
struct wined3d_allocator_block *  parent,
struct wined3d_allocator_block *  sibling,
unsigned int  order,
size_t  offset,
bool  free 
)
static

Definition at line 7104 of file utils.c.

7107{
7108 list_init(&block->entry);
7109 block->chunk = chunk;
7110 block->parent = parent;
7111 block->sibling = sibling;
7112 block->order = order;
7113 block->offset = offset;
7114 block->free = free;
7115}
static void list_init(struct list_entry *head)
Definition: list.h:51

Referenced by wined3d_allocator_chunk_allocate(), and wined3d_allocator_chunk_init().

◆ wined3d_allocator_chunk_allocate()

static struct wined3d_allocator_block * wined3d_allocator_chunk_allocate ( struct wined3d_allocator_chunk *  chunk,
unsigned int  order 
)
static

Definition at line 7187 of file utils.c.

7189{
7191 unsigned int i = order;
7192
7193 while (i)
7194 {
7195 if (!list_empty(&chunk->available[i]))
7196 break;
7197 --i;
7198 }
7199
7200 if (list_empty(&chunk->available[i]))
7201 return NULL;
7202
7203 block = LIST_ENTRY(list_head(&chunk->available[i]), struct wined3d_allocator_block, entry);
7204 list_remove(&block->entry);
7205 block->free = false;
7206
7207 while (i < order)
7208 {
7209 if (!(left = wined3d_allocator_acquire_block(chunk->allocator)))
7210 {
7211 ERR("Failed to allocate left.\n");
7212 break;
7213 }
7214
7215 if (!(right = wined3d_allocator_acquire_block(chunk->allocator)))
7216 {
7217 ERR("Failed to allocate right.\n");
7219 break;
7220 }
7221
7222 wined3d_allocator_block_init(left, chunk, block, right, block->order + 1, block->offset, false);
7224 block->offset + (WINED3D_ALLOCATOR_CHUNK_SIZE >> left->order), true);
7225 list_add_head(&chunk->available[right->order], &right->entry);
7226
7227 block = left;
7228 ++i;
7229 }
7230
7231 return block;
7232}
static int list_empty(struct list_entry *head)
Definition: list.h:58
static struct wined3d_allocator_block * wined3d_allocator_acquire_block(struct wined3d_allocator *allocator)
Definition: utils.c:7074
static void wined3d_allocator_block_init(struct wined3d_allocator_block *block, struct wined3d_allocator_chunk *chunk, struct wined3d_allocator_block *parent, struct wined3d_allocator_block *sibling, unsigned int order, size_t offset, bool free)
Definition: utils.c:7104
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
Definition: list.h:15
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by wined3d_allocator_allocate().

◆ wined3d_allocator_chunk_cleanup()

void wined3d_allocator_chunk_cleanup ( struct wined3d_allocator_chunk *  chunk)

Definition at line 7117 of file utils.c.

7118{
7120 size_t i;
7121
7122 if (list_empty(&chunk->available[0]))
7123 {
7124 ERR("Chunk %p is not empty.\n", chunk);
7125 return;
7126 }
7127
7128 for (i = 1; i < ARRAY_SIZE(chunk->available); ++i)
7129 {
7130 if (!list_empty(&chunk->available[i]))
7131 {
7132 ERR("Chunk %p is not empty.\n", chunk);
7133 return;
7134 }
7135 }
7136
7137 block = LIST_ENTRY(list_head(&chunk->available[0]), struct wined3d_allocator_block, entry);
7139}

Referenced by wined3d_allocator_gl_create_chunk(), wined3d_allocator_gl_destroy_chunk(), wined3d_allocator_vk_create_chunk(), and wined3d_allocator_vk_destroy_chunk().

◆ wined3d_allocator_chunk_init()

bool wined3d_allocator_chunk_init ( struct wined3d_allocator_chunk *  chunk,
struct wined3d_allocator *  allocator 
)

Definition at line 7141 of file utils.c.

7142{
7144 unsigned int i;
7145
7147 return false;
7149
7150 list_init(&chunk->entry);
7151 for (i = 0; i < ARRAY_SIZE(chunk->available); ++i)
7152 {
7153 list_init(&chunk->available[i]);
7154 }
7155 list_add_head(&chunk->available[0], &block->entry);
7156 chunk->allocator = allocator;
7157 chunk->map_count = 0;
7158 chunk->map_ptr = NULL;
7159
7160 return true;
7161}

Referenced by wined3d_allocator_gl_create_chunk(), and wined3d_allocator_vk_create_chunk().

◆ wined3d_allocator_cleanup()

void wined3d_allocator_cleanup ( struct wined3d_allocator *  allocator)

Definition at line 7163 of file utils.c.

7164{
7165 struct wined3d_allocator_chunk *chunk, *chunk2;
7167 size_t i;
7168
7169 for (i = 0; i < allocator->pool_count; ++i)
7170 {
7171 LIST_FOR_EACH_ENTRY_SAFE(chunk, chunk2, &allocator->pools[i].chunks, struct wined3d_allocator_chunk, entry)
7172 {
7173 list_remove(&chunk->entry);
7174 allocator->ops->allocator_destroy_chunk(chunk);
7175 }
7176 }
7177 free(allocator->pools);
7178
7179 next = allocator->free;
7180 while ((block = next))
7181 {
7182 next = block->parent;
7183 free(block);
7184 }
7185}
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242

Referenced by adapter_vk_create_device(), adapter_vk_destroy_device(), wined3d_device_gl_create_primary_opengl_context_cs(), and wined3d_device_gl_delete_opengl_contexts_cs().

◆ wined3d_allocator_init()

bool wined3d_allocator_init ( struct wined3d_allocator *  allocator,
size_t  pool_count,
const struct wined3d_allocator_ops *  allocator_ops 
)

Definition at line 7265 of file utils.c.

7267{
7268 size_t i;
7269
7270 allocator->ops = allocator_ops;
7271 allocator->pool_count = pool_count;
7272 if (!(allocator->pools = calloc(pool_count, sizeof(*allocator->pools))))
7273 return false;
7274 for (i = 0; i < pool_count; ++i)
7275 {
7276 list_init(&allocator->pools[i].chunks);
7277 }
7278
7279 allocator->free = NULL;
7280
7281 return true;
7282}

Referenced by adapter_vk_create_device(), and wined3d_device_gl_create_primary_opengl_context_cs().

◆ wined3d_allocator_release_block()

static void wined3d_allocator_release_block ( struct wined3d_allocator *  allocator,
struct wined3d_allocator_block *  block 
)
static

Definition at line 7067 of file utils.c.

7069{
7070 block->parent = allocator->free;
7071 allocator->free = block;
7072}

Referenced by wined3d_allocator_block_free(), wined3d_allocator_chunk_allocate(), and wined3d_allocator_chunk_cleanup().

◆ wined3d_array_reserve()

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

Definition at line 6740 of file utils.c.

6741{
6742 SIZE_T max_capacity, new_capacity;
6743 void *new_elements;
6744
6745 if (count <= *capacity)
6746 return TRUE;
6747
6748 max_capacity = ~(SIZE_T)0 / size;
6749 if (count > max_capacity)
6750 return FALSE;
6751
6752 new_capacity = max(1, *capacity);
6753 while (new_capacity < count && new_capacity <= max_capacity / 2)
6754 new_capacity *= 2;
6755 if (new_capacity < count)
6756 new_capacity = count;
6757
6758 new_elements = _recalloc(*elements, new_capacity, size);
6759 if (!new_elements)
6760 return FALSE;
6761
6762 *elements = new_elements;
6763 *capacity = new_capacity;
6764 return TRUE;
6765}
_ACRTIMP void *__cdecl _recalloc(void *, size_t, size_t) __WINE_ALLOC_SIZE(2
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by buffer_invalidate_bo_range(), shader_record_shader_phase(), shader_reg_maps_add_tgsm(), shader_spirv_find_graphics_program_variant_vk(), shader_spirv_resource_bindings_add_binding(), shader_spirv_resource_bindings_add_vk_binding(), wined3d_adapter_create_output(), wined3d_adapter_vk_init_device_extensions(), wined3d_buffer_init(), wined3d_context_gl_destroy_allocator_block(), wined3d_context_gl_free_fence(), wined3d_context_gl_free_occlusion_query(), wined3d_context_gl_free_pipeline_statistics_query(), wined3d_context_gl_free_so_statistics_query(), wined3d_context_gl_free_timestamp_query(), wined3d_context_gl_submit_command_fence(), wined3d_context_vk_get_retired_object_vk(), wined3d_context_vk_get_vk_descriptor_pool(), wined3d_context_vk_remove_command_buffer(), wined3d_context_vk_return_vk_descriptor_pool(), wined3d_context_vk_submit_command_buffer(), wined3d_deferred_context_issue_query(), wined3d_deferred_context_map_upload_bo(), wined3d_deferred_context_reference_command_list(), wined3d_deferred_context_reference_resource(), wined3d_deferred_context_require_space(), wined3d_output_update_modes(), wined3d_query_vk_suspend(), wined3d_register_window(), wined3d_shader_descriptor_writes_vk_add_write(), wined3d_shader_resource_bindings_add_binding(), wined3d_swapchain_state_register(), and wined3d_texture_dirty_region_add().

◆ wined3d_caps_gl_ctx_test_filling_convention()

bool wined3d_caps_gl_ctx_test_filling_convention ( struct wined3d_caps_gl_ctx *  ctx,
float  offset 
)

Definition at line 3896 of file utils.c.

3897{
3898 static const struct wined3d_color red = {1.0f, 0.0f, 0.0f, 1.0f};
3899 const struct wined3d_gl_info *gl_info = ctx->gl_info;
3900 unsigned int x, y, clear = 0, draw = 0;
3901 GLuint texture, fbo;
3902 uint32_t readback[8][8];
3903
3904 /* This is a very simple test to find out how GL handles polygon edges:
3905 * Draw a 1x1 quad exactly through 4 adjacent pixel centers in an 8x8
3906 * viewport and see which pixel it ends up in. So far we've seen top left
3907 * and bottom left conventions. This test may produce unexpected results
3908 * if the driver forces multisampling on us.
3909 *
3910 * If we find a bottom-left filling behavior we also move the x-axis
3911 * by the same amount. This is necessary to keep diagonals that go
3912 * through the pixel center intact.
3913 *
3914 * Note that we are ignoring some settings that might influence the
3915 * driver: How we switch GL to an upper-left coordinate system,
3916 * shaders vs fixed function GL. Testing these isn't possible with
3917 * the current draw_test_quad() infrastructure. Also the test is
3918 * skipped if we are not using FBOs. Drawing into the onscreen
3919 * frame buffer may also yield different driver behavior.
3920 *
3921 * The minimum offset also depends on the viewport size, although
3922 * the relation between those two is GPU dependent and not exactly
3923 * sensible. E.g. a 8192x8192 viewport on a GeForce 9 needs at
3924 * least an offset of 1/240.9, whereas a 8x8 one needs 1/255.982;
3925 * 32x32 needs 1/255.935. 4x4 and lower are happy with something
3926 * below 1/256. The 8x8 size below has been arbitrarily chosen to
3927 * get a useful result out of that card and avoid allocating a
3928 * gigantic texture during library init.
3929 *
3930 * Newer cards usually do the right thing anyway. In cases where
3931 * they do not (e.g. Radeon GPUs in a macbookpro14,3 running MacOS)
3932 * an offset of 1/2^20 is enough. */
3933 const struct wined3d_vec3 edge_geometry[] =
3934 {
3935 {(-1.0f + offset) / 8.0f, (-1.0f + offset) / 8.0f, 0.0f},
3936 {( 1.0f + offset) / 8.0f, (-1.0f + offset) / 8.0f, 0.0f},
3937 {(-1.0f + offset) / 8.0f, ( 1.0f + offset) / 8.0f, 0.0f},
3938 {( 1.0f + offset) / 8.0f, ( 1.0f + offset) / 8.0f, 0.0f},
3939 };
3940
3941 gl_info->gl_ops.gl.p_glGenTextures(1, &texture);
3942 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3943 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
3944 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 8, 8, 0,
3946 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
3947 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
3948 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
3950 checkGLcall("create resources");
3951
3952 gl_info->gl_ops.gl.p_glViewport(0, 0, 8, 8);
3953 gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
3954 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
3955
3956 draw_test_quad(ctx, edge_geometry, &red);
3957 checkGLcall("draw");
3958
3959 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3960 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0,
3962 checkGLcall("readback");
3963
3964 gl_info->gl_ops.gl.p_glDeleteTextures(1, &texture);
3965 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
3966 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3967 checkGLcall("delete resources");
3968
3969 /* We expect that exactly one fragment is generated. */
3970 for (y = 0; y < ARRAY_SIZE(readback); ++y)
3971 {
3972 for (x = 0; x < ARRAY_SIZE(readback[0]); ++x)
3973 {
3974 if (readback[y][x] == 0xff0000ff)
3975 clear++;
3976 else if (readback[y][x] == 0xffff0000)
3977 draw++;
3978 }
3979 }
3980
3981 if (clear != 63 || draw != 1)
3982 {
3983 FIXME("Unexpected filling convention test result.\n");
3984 return FALSE;
3985 }
3986
3987 /* One pixel was drawn, check if it is the expected one */
3988 return readback[3][3] == 0xffff0000;
3989}
GLenum GLuint texture
Definition: glext.h:6295

Referenced by wined3d_adapter_find_fill_offset().

◆ 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 3849 of file utils.c.

3850{
3851 static const struct wined3d_color red = {1.0f, 0.0f, 0.0f, 1.0f};
3852 const struct wined3d_gl_info *gl_info = ctx->gl_info;
3853 static const float offset = -63.0f / 128.0f;
3854 GLuint texture, fbo;
3855 uint32_t readback[4];
3856 unsigned int i;
3857
3858 gl_info->gl_ops.gl.p_glGenTextures(1, &texture);
3859 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3860 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
3861 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ARRAY_SIZE(readback), 1, 0,
3863 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
3864 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
3865 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
3867 checkGLcall("create resources");
3868
3869 gl_info->gl_ops.gl.p_glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
3870 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
3871 GL_EXTCALL(glViewportIndexedf(0, offset, offset, 4.0f, 1.0f));
3873 checkGLcall("draw");
3874
3875 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3876 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0,
3878 checkGLcall("readback");
3879
3880 TRACE("Readback colors are 0x%08x, 0x%08x, 0x%08x, 0x%08x.\n",
3881 readback[0], readback[1], readback[2], readback[3]);
3882
3883 gl_info->gl_ops.gl.p_glDeleteTextures(1, &texture);
3884 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
3885 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3886 checkGLcall("delete resources");
3887
3888 for (i = 0; i < ARRAY_SIZE(readback); ++i)
3889 {
3890 if (readback[i] != 0xffff0000)
3891 return FALSE;
3892 }
3893 return TRUE;
3894}

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 6672 of file utils.c.

6673{
6674 RECT orig = *clipped;
6675 float scale_x = (float)(orig.right - orig.left) / (float)(other->right - other->left);
6676 float scale_y = (float)(orig.bottom - orig.top) / (float)(other->bottom - other->top);
6677
6678 IntersectRect(clipped, clipped, clip_rect);
6679
6680 if (IsRectEmpty(clipped))
6681 {
6683 return FALSE;
6684 }
6685
6686 other->left += (LONG)((clipped->left - orig.left) / scale_x);
6687 other->top += (LONG)((clipped->top - orig.top) / scale_y);
6688 other->right -= (LONG)((orig.right - clipped->right) / scale_x);
6689 other->bottom -= (LONG)((orig.bottom - clipped->bottom) / scale_y);
6690
6691 return TRUE;
6692}
int other
Definition: msacm.c:1376
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29

Referenced by wined3d_cs_exec_present().

◆ wined3d_debug_bind_flags()

const char * wined3d_debug_bind_flags ( uint32_t  bind_flags)

Definition at line 4845 of file utils.c.

4846{
4847 struct debug_buffer buffer;
4848
4850#define BIND_FLAG_TO_STR(x) if (bind_flags & x) { debug_append(&buffer, #x, " | "); bind_flags &= ~x; }
4860#undef BIND_FLAG_TO_STR
4861 if (bind_flags)
4862 FIXME("Unrecognised bind flag(s) %#x.\n", bind_flags);
4863
4864 return wine_dbg_sprintf("%s", buffer.str);
4865}
#define BIND_FLAG_TO_STR(x)
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:909
#define WINED3D_BIND_UNORDERED_ACCESS
Definition: wined3d.h:916
#define WINED3D_BIND_SHADER_RESOURCE
Definition: wined3d.h:912
#define WINED3D_BIND_INDIRECT_BUFFER
Definition: wined3d.h:917
#define WINED3D_BIND_DEPTH_STENCIL
Definition: wined3d.h:915
#define WINED3D_BIND_RENDER_TARGET
Definition: wined3d.h:914
#define WINED3D_BIND_CONSTANT_BUFFER
Definition: wined3d.h:911
#define WINED3D_BIND_STREAM_OUTPUT
Definition: wined3d.h:913
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:910

Referenced by resource_init(), wined3d_buffer_init(), wined3d_buffer_vk_barrier(), wined3d_check_device_format(), wined3d_device_context_set_depth_stencil_view(), wined3d_device_context_set_render_targets_and_unordered_access_views(), wined3d_layout_from_bind_mask(), wined3d_texture_init(), wined3d_texture_vk_barrier(), and wined3d_texture_vk_prepare_texture().

◆ wined3d_debug_feature_level()

const char * wined3d_debug_feature_level ( enum wined3d_feature_level  level)

Definition at line 6619 of file utils.c.

6620{
6621 switch (level)
6622 {
6623#define LEVEL_TO_STR(level) case level: return #level
6635#undef LEVEL_TO_STR
6636 default:
6637 return wine_dbg_sprintf("%#x", level);
6638 }
6639}
#define LEVEL_TO_STR(level)
GLint level
Definition: gl.h:1546
@ WINED3D_FEATURE_LEVEL_11
Definition: wined3d.h:109
@ WINED3D_FEATURE_LEVEL_10_1
Definition: wined3d.h:108
@ WINED3D_FEATURE_LEVEL_8
Definition: wined3d.h:103
@ WINED3D_FEATURE_LEVEL_7
Definition: wined3d.h:102
@ WINED3D_FEATURE_LEVEL_6
Definition: wined3d.h:101
@ WINED3D_FEATURE_LEVEL_9_3
Definition: wined3d.h:106
@ WINED3D_FEATURE_LEVEL_10
Definition: wined3d.h:107
@ WINED3D_FEATURE_LEVEL_11_1
Definition: wined3d.h:110
@ WINED3D_FEATURE_LEVEL_5
Definition: wined3d.h:100
@ WINED3D_FEATURE_LEVEL_9_1
Definition: wined3d.h:104
@ WINED3D_FEATURE_LEVEL_9_2
Definition: wined3d.h:105

Referenced by wined3d_state_create().

◆ wined3d_debug_location()

const char * wined3d_debug_location ( uint32_t  location)

Definition at line 6588 of file utils.c.

6589{
6590 struct debug_buffer buffer;
6591 const char *prefix = "";
6592 const char *suffix = "";
6593
6594 if (wined3d_popcount(location) > 16)
6595 {
6596 prefix = "~(";
6598 suffix = ")";
6599 }
6600
6602#define LOCATION_TO_STR(x) if (location & x) { debug_append(&buffer, #x, " | "); location &= ~x; }
6612#undef LOCATION_TO_STR
6613 if (location)
6614 FIXME("Unrecognized location flag(s) %#x.\n", location);
6615
6616 return wine_dbg_sprintf("%s%s%s", prefix, buffer.str, suffix);
6617}
#define LOCATION_TO_STR(x)
Character const *const prefix
Definition: tempnam.cpp:195
#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_DRAWABLE
#define WINED3D_LOCATION_CLEARED
#define WINED3D_LOCATION_DISCARDED
#define WINED3D_LOCATION_RB_MULTISAMPLE
static unsigned int wined3d_popcount(unsigned int x)

Referenced by context_gl_apply_texture_draw_state(), cpu_blitter_clear_texture(), fbo_blitter_blit(), glsl_blitter_blit(), raw_blitter_blit(), surface_convert_format(), surface_cpu_blt(), texture2d_blt_fbo(), texture2d_depth_blt_fbo(), texture2d_read_from_framebuffer(), texture_resource_sub_resource_map(), vk_blitter_blit(), wined3d_buffer_get_memory(), wined3d_buffer_gl_prepare_location(), wined3d_buffer_gl_unload_location(), wined3d_buffer_invalidate_range(), wined3d_buffer_load_location(), wined3d_buffer_no3d_prepare_location(), wined3d_buffer_no3d_unload_location(), wined3d_buffer_validate_location(), wined3d_buffer_vk_prepare_location(), wined3d_buffer_vk_unload_location(), wined3d_cs_exec_add_dirty_texture_region(), wined3d_cs_exec_blt_sub_resource(), wined3d_texture_get_memory(), wined3d_texture_gl_download_data(), wined3d_texture_gl_load_location(), wined3d_texture_gl_load_sysmem(), wined3d_texture_gl_prepare_location(), wined3d_texture_gl_unload_location(), wined3d_texture_gl_upload_data(), wined3d_texture_invalidate_location(), wined3d_texture_load_drawable(), wined3d_texture_load_location(), wined3d_texture_load_renderbuffer(), wined3d_texture_no3d_load_location(), wined3d_texture_no3d_prepare_location(), wined3d_texture_no3d_unload_location(), wined3d_texture_update_map_binding(), wined3d_texture_validate_location(), wined3d_texture_vk_download_data(), wined3d_texture_vk_load_location(), wined3d_texture_vk_load_sysmem(), wined3d_texture_vk_load_texture(), wined3d_texture_vk_prepare_location(), wined3d_texture_vk_unload_location(), and wined3d_texture_vk_upload_data().

◆ wined3d_debug_resource_access()

const char * wined3d_debug_resource_access ( uint32_t  access)

Definition at line 4828 of file utils.c.

4829{
4830 struct debug_buffer buffer;
4831
4833#define ACCESS_TO_STR(x) if (access & x) { debug_append(&buffer, #x, " | "); access &= ~x; }
4838#undef ACCESS_TO_STR
4839 if (access)
4840 FIXME("Unrecognised access flag(s) %#x.\n", access);
4841
4842 return wine_dbg_sprintf("%s", buffer.str);
4843}
#define ACCESS_TO_STR(x)
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:51
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:52
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:53
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:54

Referenced by resource_init(), texture_resource_unload(), wined3d_buffer_init(), wined3d_texture_init(), and wined3d_texture_set_lod().

◆ wined3d_debug_view_desc()

const char * wined3d_debug_view_desc ( const struct wined3d_view_desc *  d,
const struct wined3d_resource *  resource 
)

Definition at line 4867 of file utils.c.

4868{
4869 struct debug_buffer buffer;
4870 unsigned int flags = d->flags;
4871
4873#define VIEW_FLAG_TO_STR(x) if (flags & x) { debug_append(&buffer, #x, " | "); flags &= ~x; }
4882#undef VIEW_FLAG_TO_STR
4883 if (flags)
4884 FIXME("Unrecognised view flag(s) %#x.\n", flags);
4885
4886 if (resource->type == WINED3D_RTYPE_BUFFER)
4887 return wine_dbg_sprintf("format %s, flags %s, start_idx %u, count %u",
4888 debug_d3dformat(d->format_id), buffer.str, d->u.buffer.start_idx, d->u.buffer.count);
4889 else
4890 return wine_dbg_sprintf("format %s, flags %s, level_idx %u, level_count %u, layer_idx %u, layer_count %u",
4891 debug_d3dformat(d->format_id), buffer.str, d->u.texture.level_idx, d->u.texture.level_count,
4892 d->u.texture.layer_idx, d->u.texture.layer_count);
4893}
#define VIEW_FLAG_TO_STR(x)
#define WINED3D_VIEW_READ_ONLY_DEPTH
Definition: wined3d.h:1584
#define WINED3D_VIEW_READ_ONLY_STENCIL
Definition: wined3d.h:1585
#define WINED3D_VIEW_TEXTURE_CUBE
Definition: wined3d.h:1582
#define WINED3D_VIEW_TEXTURE_ARRAY
Definition: wined3d.h:1583
#define WINED3D_VIEW_BUFFER_RAW
Definition: wined3d.h:1579
#define WINED3D_VIEW_FORWARD_REFERENCE
Definition: wined3d.h:1588
#define WINED3D_VIEW_BUFFER_APPEND
Definition: wined3d.h:1580
#define WINED3D_VIEW_BUFFER_COUNTER
Definition: wined3d.h:1581

Referenced by adapter_gl_create_rendertarget_view(), adapter_gl_create_shader_resource_view(), adapter_gl_create_unordered_access_view(), adapter_no3d_create_rendertarget_view(), adapter_no3d_create_shader_resource_view(), adapter_no3d_create_unordered_access_view(), adapter_vk_create_rendertarget_view(), adapter_vk_create_shader_resource_view(), adapter_vk_create_unordered_access_view(), wined3d_rendertarget_view_create(), wined3d_rendertarget_view_gl_init(), wined3d_rendertarget_view_no3d_init(), wined3d_rendertarget_view_vk_init(), wined3d_shader_resource_view_create(), wined3d_shader_resource_view_gl_init(), wined3d_shader_resource_view_vk_init(), wined3d_unordered_access_view_create(), wined3d_unordered_access_view_gl_init(), and wined3d_unordered_access_view_vk_init().

◆ wined3d_debug_vkresult()

const char * wined3d_debug_vkresult ( VkResult  vr)

Definition at line 5463 of file utils.c.

5464{
5465 switch (vr)
5466 {
5467#define WINED3D_TO_STR(x) case x: return #x
5496#undef WINED3D_TO_STR
5497 default:
5498 return wine_dbg_sprintf("unrecognised(%d)", vr);
5499 }
5500}
@ VK_ERROR_FRAGMENTATION_EXT
Definition: vulkan.h:4688
@ VK_ERROR_INVALID_SHADER_NV
Definition: vulkan.h:4654
@ VK_SUBOPTIMAL_KHR
Definition: vulkan.h:4678
@ VK_ERROR_EXTENSION_NOT_PRESENT
Definition: vulkan.h:4665
@ VK_INCOMPLETE
Definition: vulkan.h:4677
@ VK_ERROR_INVALID_EXTERNAL_HANDLE
Definition: vulkan.h:4646
@ VK_ERROR_DEVICE_LOST
Definition: vulkan.h:4668
@ VK_SUCCESS
Definition: vulkan.h:4672
@ VK_EVENT_SET
Definition: vulkan.h:4675
@ VK_EVENT_RESET
Definition: vulkan.h:4676
@ VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR
Definition: vulkan.h:4692
@ VK_ERROR_OUT_OF_HOST_MEMORY
Definition: vulkan.h:4671
@ VK_ERROR_INITIALIZATION_FAILED
Definition: vulkan.h:4669
@ VK_ERROR_OUT_OF_DEVICE_MEMORY
Definition: vulkan.h:4670
@ VK_ERROR_NATIVE_WINDOW_IN_USE_KHR
Definition: vulkan.h:4657
@ VK_ERROR_NOT_PERMITTED_EXT
Definition: vulkan.h:4689
@ VK_ERROR_OUT_OF_DATE_KHR
Definition: vulkan.h:4656
@ VK_TIMEOUT
Definition: vulkan.h:4674
@ VK_ERROR_FORMAT_NOT_SUPPORTED
Definition: vulkan.h:4661
@ VK_ERROR_FRAGMENTED_POOL
Definition: vulkan.h:4660
@ VK_ERROR_SURFACE_LOST_KHR
Definition: vulkan.h:4658
@ VK_NOT_READY
Definition: vulkan.h:4673
@ VK_ERROR_FEATURE_NOT_PRESENT
Definition: vulkan.h:4664
@ VK_ERROR_TOO_MANY_OBJECTS
Definition: vulkan.h:4662
@ VK_ERROR_MEMORY_MAP_FAILED
Definition: vulkan.h:4667
@ VK_ERROR_LAYER_NOT_PRESENT
Definition: vulkan.h:4666
@ VK_ERROR_INCOMPATIBLE_DRIVER
Definition: vulkan.h:4663
@ VK_ERROR_OUT_OF_POOL_MEMORY
Definition: vulkan.h:4647

Referenced by adapter_vk_create_device(), create_uav_pipeline(), enable_vulkan_instance_extensions(), get_vulkan_physical_device(), init_vulkan_format_info(), shader_spirv_compile_shader(), shader_spirv_find_compute_program_vk(), swapchain_vk_present(), vk_blitter_clear_rendertargets(), wined3d_adapter_vk_init_device_extensions(), wined3d_allocator_chunk_vk_map(), wined3d_bo_vk_map(), wined3d_context_vk_allocate_query(), wined3d_context_vk_allocate_vram_chunk_memory(), wined3d_context_vk_begin_render_pass(), wined3d_context_vk_create_bo(), wined3d_context_vk_create_image(), wined3d_context_vk_create_vk_descriptor_pool(), wined3d_context_vk_create_vk_descriptor_set(), wined3d_context_vk_create_vk_descriptor_set_layout(), wined3d_context_vk_get_command_buffer(), wined3d_context_vk_get_graphics_pipeline(), wined3d_context_vk_get_pipeline_layout(), wined3d_context_vk_get_vk_descriptor_pool(), wined3d_context_vk_init(), wined3d_context_vk_submit_command_buffer(), wined3d_device_vk_create_null_views(), wined3d_init_vulkan(), wined3d_query_event_vk_issue(), wined3d_query_pool_vk_init(), wined3d_query_vk_accumulate_data(), wined3d_sampler_vk_cs_init(), wined3d_swapchain_vk_blit(), wined3d_swapchain_vk_create_vulkan_swapchain(), wined3d_swapchain_vk_create_vulkan_swapchain_images(), wined3d_swapchain_vk_destroy_vulkan_swapchain(), wined3d_swapchain_vk_present_mode_supported(), wined3d_swapchain_vk_select_vk_format(), wined3d_texture_vk_get_default_image_info(), wined3d_unordered_access_view_vk_cs_init(), wined3d_view_vk_create_vk_buffer_view(), and wined3d_view_vk_create_vk_image_view().

◆ 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 6436 of file utils.c.

6437{
6438 const struct ffp_frag_settings *ka = key;
6439 const struct ffp_frag_settings *kb = &WINE_RB_ENTRY_VALUE(entry, const struct ffp_frag_desc, entry)->settings;
6440
6441 return memcmp(ka, kb, sizeof(*ka));
6442}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
Definition: copy.c:22

Referenced by glsl_fragment_pipe_alloc(), and wined3d_device_init().

◆ wined3d_ffp_get_fs_settings()

void wined3d_ffp_get_fs_settings ( const struct wined3d_state *  state,
const struct wined3d_d3d_info *  d3d_info,
struct ffp_frag_settings *  settings 
)

Definition at line 6141 of file utils.c.

6143{
6144#define ARG1 0x01
6145#define ARG2 0x02
6146#define ARG0 0x04
6147 static const unsigned char args[WINED3D_TOP_LERP + 1] =
6148 {
6149 /* undefined */ 0,
6150 /* D3DTOP_DISABLE */ 0,
6151 /* D3DTOP_SELECTARG1 */ ARG1,
6152 /* D3DTOP_SELECTARG2 */ ARG2,
6153 /* D3DTOP_MODULATE */ ARG1 | ARG2,
6154 /* D3DTOP_MODULATE2X */ ARG1 | ARG2,
6155 /* D3DTOP_MODULATE4X */ ARG1 | ARG2,
6156 /* D3DTOP_ADD */ ARG1 | ARG2,
6157 /* D3DTOP_ADDSIGNED */ ARG1 | ARG2,
6158 /* D3DTOP_ADDSIGNED2X */ ARG1 | ARG2,
6159 /* D3DTOP_SUBTRACT */ ARG1 | ARG2,
6160 /* D3DTOP_ADDSMOOTH */ ARG1 | ARG2,
6161 /* D3DTOP_BLENDDIFFUSEALPHA */ ARG1 | ARG2,
6162 /* D3DTOP_BLENDTEXTUREALPHA */ ARG1 | ARG2,
6163 /* D3DTOP_BLENDFACTORALPHA */ ARG1 | ARG2,
6164 /* D3DTOP_BLENDTEXTUREALPHAPM */ ARG1 | ARG2,
6165 /* D3DTOP_BLENDCURRENTALPHA */ ARG1 | ARG2,
6166 /* D3DTOP_PREMODULATE */ ARG1 | ARG2,
6167 /* D3DTOP_MODULATEALPHA_ADDCOLOR */ ARG1 | ARG2,
6168 /* D3DTOP_MODULATECOLOR_ADDALPHA */ ARG1 | ARG2,
6169 /* D3DTOP_MODULATEINVALPHA_ADDCOLOR */ ARG1 | ARG2,
6170 /* D3DTOP_MODULATEINVCOLOR_ADDALPHA */ ARG1 | ARG2,
6171 /* D3DTOP_BUMPENVMAP */ ARG1 | ARG2,
6172 /* D3DTOP_BUMPENVMAPLUMINANCE */ ARG1 | ARG2,
6173 /* D3DTOP_DOTPRODUCT3 */ ARG1 | ARG2,
6174 /* D3DTOP_MULTIPLYADD */ ARG1 | ARG2 | ARG0,
6175 /* D3DTOP_LERP */ ARG1 | ARG2 | ARG0
6176 };
6177 unsigned int i;
6178 DWORD ttff;
6179 DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2;
6180 struct wined3d_texture *texture;
6181
6182 settings->padding = 0;
6183
6184 for (i = 0; i < d3d_info->ffp_fragment_caps.max_blend_stages; ++i)
6185 {
6186 settings->op[i].padding = 0;
6187 if (state->texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_DISABLE)
6188 {
6189 settings->op[i].cop = WINED3D_TOP_DISABLE;
6190 settings->op[i].aop = WINED3D_TOP_DISABLE;
6191 settings->op[i].carg0 = settings->op[i].carg1 = settings->op[i].carg2 = ARG_UNUSED;
6192 settings->op[i].aarg0 = settings->op[i].aarg1 = settings->op[i].aarg2 = ARG_UNUSED;
6193 settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
6194 settings->op[i].tmp_dst = 0;
6195 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
6196 settings->op[i].projected = WINED3D_PROJECTION_NONE;
6197 i++;
6198 break;
6199 }
6200
6202 {
6203 if (can_use_texture_swizzle(d3d_info, texture->resource.format))
6204 settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
6205 else
6206 settings->op[i].color_fixup = texture->resource.format->color_fixup;
6207 settings->op[i].tex_type = texture->resource.gl_type;
6208 } else {
6209 settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
6210 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
6211 }
6212
6213 cop = state->texture_states[i][WINED3D_TSS_COLOR_OP];
6214 aop = state->texture_states[i][WINED3D_TSS_ALPHA_OP];
6215
6216 carg1 = (args[cop] & ARG1) ? state->texture_states[i][WINED3D_TSS_COLOR_ARG1] : ARG_UNUSED;
6217 carg2 = (args[cop] & ARG2) ? state->texture_states[i][WINED3D_TSS_COLOR_ARG2] : ARG_UNUSED;
6218 carg0 = (args[cop] & ARG0) ? state->texture_states[i][WINED3D_TSS_COLOR_ARG0] : ARG_UNUSED;
6219
6220 if (is_invalid_op(state, i, cop, carg1, carg2, carg0))
6221 {
6222 carg0 = ARG_UNUSED;
6223 carg2 = ARG_UNUSED;
6224 carg1 = WINED3DTA_CURRENT;
6226 }
6227
6228 if (cop == WINED3D_TOP_DOTPRODUCT3)
6229 {
6230 /* A dotproduct3 on the colorop overwrites the alphaop operation and replicates
6231 * the color result to the alpha component of the destination
6232 */
6233 aop = cop;
6234 aarg1 = carg1;
6235 aarg2 = carg2;
6236 aarg0 = carg0;
6237 }
6238 else
6239 {
6240 aarg1 = (args[aop] & ARG1) ? state->texture_states[i][WINED3D_TSS_ALPHA_ARG1] : ARG_UNUSED;
6241 aarg2 = (args[aop] & ARG2) ? state->texture_states[i][WINED3D_TSS_ALPHA_ARG2] : ARG_UNUSED;
6242 aarg0 = (args[aop] & ARG0) ? state->texture_states[i][WINED3D_TSS_ALPHA_ARG0] : ARG_UNUSED;
6243 }
6244
6245 if (!i && state->render_states[WINED3D_RS_COLORKEYENABLE]
6246 && texture && !(texture->resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP)
6247 && (texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT) && !texture->resource.format->alpha_size)
6248 {
6249 if (aop == WINED3D_TOP_DISABLE)
6250 {
6251 aarg1 = WINED3DTA_TEXTURE;
6253 }
6254 else if (aop == WINED3D_TOP_SELECT_ARG1 && aarg1 != WINED3DTA_TEXTURE)
6255 {
6256 if (state->blend_state && state->blend_state->desc.rt[0].enable)
6257 {
6258 aarg2 = WINED3DTA_TEXTURE;
6260 }
6261 else
6262 {
6263 aarg1 = WINED3DTA_TEXTURE;
6264 }
6265 }
6266 else if (aop == WINED3D_TOP_SELECT_ARG2 && aarg2 != WINED3DTA_TEXTURE)
6267 {
6268 if (state->blend_state && state->blend_state->desc.rt[0].enable)
6269 {
6270 aarg1 = WINED3DTA_TEXTURE;
6272 }
6273 else
6274 {
6275 aarg2 = WINED3DTA_TEXTURE;
6276 }
6277 }
6278 }
6279
6280 if (is_invalid_op(state, i, aop, aarg1, aarg2, aarg0))
6281 {
6282 aarg0 = ARG_UNUSED;
6283 aarg2 = ARG_UNUSED;
6284 aarg1 = WINED3DTA_CURRENT;
6286 }
6287
6288 if (carg1 == WINED3DTA_TEXTURE || carg2 == WINED3DTA_TEXTURE || carg0 == WINED3DTA_TEXTURE
6289 || aarg1 == WINED3DTA_TEXTURE || aarg2 == WINED3DTA_TEXTURE || aarg0 == WINED3DTA_TEXTURE)
6290 {
6291 ttff = state->texture_states[i][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS];
6293 settings->op[i].projected = WINED3D_PROJECTION_COUNT3;
6294 else if (ttff & WINED3D_TTFF_PROJECTED)
6295 settings->op[i].projected = WINED3D_PROJECTION_COUNT4;
6296 else
6297 settings->op[i].projected = WINED3D_PROJECTION_NONE;
6298 }
6299 else
6300 {
6301 settings->op[i].projected = WINED3D_PROJECTION_NONE;
6302 }
6303
6304 settings->op[i].cop = cop;
6305 settings->op[i].aop = aop;
6306 settings->op[i].carg0 = carg0;
6307 settings->op[i].carg1 = carg1;
6308 settings->op[i].carg2 = carg2;
6309 settings->op[i].aarg0 = aarg0;
6310 settings->op[i].aarg1 = aarg1;
6311 settings->op[i].aarg2 = aarg2;
6312 settings->op[i].tmp_dst = state->texture_states[i][WINED3D_TSS_RESULT_ARG] == WINED3DTA_TEMP;
6313 }
6314
6315 /* Clear unsupported stages */
6316 for (; i < WINED3D_MAX_FFP_TEXTURES; ++i)
6317 memset(&settings->op[i], 0xff, sizeof(settings->op[i]));
6318
6319 if (!state->render_states[WINED3D_RS_FOGENABLE])
6320 {
6322 }
6323 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE)
6324 {
6325 if (use_vs(state) || state->vertex_declaration->position_transformed)
6326 {
6328 }
6329 else
6330 {
6331 switch (state->render_states[WINED3D_RS_FOGVERTEXMODE])
6332 {
6333 case WINED3D_FOG_NONE:
6334 case WINED3D_FOG_LINEAR:
6336 break;
6337 case WINED3D_FOG_EXP:
6339 break;
6340 case WINED3D_FOG_EXP2:
6342 break;
6343 }
6344 }
6345 }
6346 else
6347 {
6348 switch (state->render_states[WINED3D_RS_FOGTABLEMODE])
6349 {
6350 case WINED3D_FOG_LINEAR:
6352 break;
6353 case WINED3D_FOG_EXP:
6355 break;
6356 case WINED3D_FOG_EXP2:
6358 break;
6359 }
6360 }
6361 settings->sRGB_write = !d3d_info->srgb_write_control && needs_srgb_write(d3d_info, state, &state->fb);
6362
6364 if (state->render_states[WINED3D_RS_COLORKEYENABLE]
6365 && texture && (texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT)
6366 && settings->op[0].cop != WINED3D_TOP_DISABLE)
6367 settings->color_key_enabled = 1;
6368 else
6369 settings->color_key_enabled = 0;
6370
6371 /* texcoords_initialized is set to meaningful values only when GL doesn't
6372 * support enough varyings to always pass around all the possible texture
6373 * coordinates.
6374 * This is used to avoid reading a varying not written by the vertex shader.
6375 * Reading uninitialized varyings on core profile contexts results in an
6376 * error while with builtin varyings on legacy contexts you get undefined
6377 * behavior. */
6378 if (d3d_info->limits.varying_count && !d3d_info->full_ffp_varyings)
6379 {
6380 settings->texcoords_initialized = 0;
6381 for (i = 0; i < WINED3D_MAX_FFP_TEXTURES; ++i)
6382 {
6383 if (use_vs(state))
6384 {
6385 if (state->shader[WINED3D_SHADER_TYPE_VERTEX]->reg_maps.output_registers & (1u << i))
6386 settings->texcoords_initialized |= 1u << i;
6387 }
6388 else
6389 {
6390 unsigned int coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6391 if ((state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX] >> WINED3D_FFP_TCI_SHIFT)
6393 || (coord_idx < WINED3D_MAX_FFP_TEXTURES && (state->vertex_declaration->texcoords & (1u << coord_idx))))
6394 settings->texcoords_initialized |= 1u << i;
6395 }
6396 }
6397 }
6398 else
6399 {
6401 }
6402
6403 settings->pointsprite = state->render_states[WINED3D_RS_POINTSPRITEENABLE]
6404 && state->primitive_type == WINED3D_PT_POINTLIST;
6405
6406 if (d3d_info->ffp_alpha_test)
6407 settings->alpha_test_func = WINED3D_CMP_ALWAYS - 1;
6408 else
6409 settings->alpha_test_func = (state->render_states[WINED3D_RS_ALPHATESTENABLE]
6411 : WINED3D_CMP_ALWAYS) - 1;
6412
6413 if (d3d_info->emulated_flatshading)
6414 settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
6415 else
6416 settings->flatshading = FALSE;
6417}
#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:5554
#define ARG1
#define ARG0
Definition: match.c:390
struct fragment_caps ffp_fragment_caps
uint32_t full_ffp_varyings
struct wined3d_d3d_limits limits
uint32_t emulated_flatshading
uint32_t srgb_write_control
@ WINED3D_SHADE_FLAT
Definition: wined3d.h:488
#define WINED3DTA_TEMP
Definition: wined3d.h:886
@ WINED3D_FOG_LINEAR
Definition: wined3d.h:483
@ WINED3D_FOG_EXP
Definition: wined3d.h:481
@ WINED3D_FOG_EXP2
Definition: wined3d.h:482
#define WINED3D_CKEY_SRC_BLT
Definition: wined3d.h:1341
#define WINED3DTA_CURRENT
Definition: wined3d.h:882
@ WINED3D_CMP_ALWAYS
Definition: wined3d.h:468
@ WINED3D_TTFF_COUNT3
Definition: wined3d.h:621
#define WINED3D_FFP_TCI_SHIFT
#define ARG_UNUSED
static BOOL use_vs(const struct wined3d_state *state)
#define WINED3D_FFP_TCI_MASK
static enum wined3d_cmp_func wined3d_sanitize_cmp_func(enum wined3d_cmp_func func)
static BOOL can_use_texture_swizzle(const struct wined3d_d3d_info *d3d_info, const struct wined3d_format *format)
static BOOL needs_srgb_write(const struct wined3d_d3d_info *d3d_info, 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
@ WINED3D_PROJECTION_COUNT3
@ WINED3D_PROJECTION_NONE
@ WINED3D_PROJECTION_COUNT4

Referenced by get_ffp_pixel_shader(), and set_glsl_shader_program().

◆ wined3d_ffp_get_vs_settings()

void wined3d_ffp_get_vs_settings ( const struct wined3d_state *  state,
const struct wined3d_stream_info *  si,
const struct wined3d_d3d_info *  d3d_info,
struct wined3d_ffp_vs_settings *  settings 
)

Definition at line 6444 of file utils.c.

6446{
6447 enum wined3d_material_color_source diffuse_source, emissive_source, ambient_source, specular_source;
6448 const struct wined3d_vertex_declaration *vdecl = state->vertex_declaration;
6449 unsigned int coord_idx, i;
6450
6451 memset(settings, 0, sizeof(*settings));
6452
6453 if (vdecl->position_transformed)
6454 {
6455 settings->transformed = 1;
6456 settings->point_size = state->primitive_type == WINED3D_PT_POINTLIST;
6457 settings->per_vertex_point_size = vdecl->point_size;
6458 settings->diffuse = vdecl->diffuse;
6459 if (!state->render_states[WINED3D_RS_FOGENABLE])
6460 settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
6461 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
6463 else
6465
6466 for (i = 0; i < WINED3D_MAX_FFP_TEXTURES; ++i)
6467 {
6468 coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6469 if (coord_idx < WINED3D_MAX_FFP_TEXTURES && (vdecl->texcoords & (1u << coord_idx)))
6470 settings->texcoords |= 1u << i;
6471 settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6472 }
6473 if (d3d_info->full_ffp_varyings)
6475
6476 if (d3d_info->emulated_flatshading)
6477 settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
6478 else
6479 settings->flatshading = FALSE;
6480
6481 settings->swizzle_map = si->swizzle_map;
6482
6483 return;
6484 }
6485
6486 switch (state->render_states[WINED3D_RS_VERTEXBLEND])
6487 {
6492 settings->vertexblends = state->render_states[WINED3D_RS_VERTEXBLEND];
6493 break;
6494 default:
6495 FIXME("Unsupported vertex blending: %d\n", state->render_states[WINED3D_RS_VERTEXBLEND]);
6496 break;
6497 }
6498
6499 settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
6500 && state->render_states[WINED3D_RS_CLIPPLANEENABLE];
6501 settings->diffuse = vdecl->diffuse;
6502 settings->normal = vdecl->normal;
6503 settings->normalize = settings->normal && state->render_states[WINED3D_RS_NORMALIZENORMALS];
6504 settings->lighting = !!state->render_states[WINED3D_RS_LIGHTING];
6505 settings->localviewer = !!state->render_states[WINED3D_RS_LOCALVIEWER];
6506 settings->specular_enable = !!state->render_states[WINED3D_RS_SPECULARENABLE];
6507 settings->point_size = state->primitive_type == WINED3D_PT_POINTLIST;
6508 settings->per_vertex_point_size = vdecl->point_size;
6509
6510 wined3d_get_material_colour_source(&diffuse_source, &emissive_source,
6511 &ambient_source, &specular_source, state);
6512 settings->diffuse_source = diffuse_source;
6513 settings->emissive_source = emissive_source;
6514 settings->ambient_source = ambient_source;
6515 settings->specular_source = specular_source;
6516
6517 for (i = 0; i < WINED3D_MAX_FFP_TEXTURES; ++i)
6518 {
6519 coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6520 if (coord_idx < WINED3D_MAX_FFP_TEXTURES && (vdecl->texcoords & (1u << coord_idx)))
6521 settings->texcoords |= 1u << i;
6522 settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6523 }
6524 if (d3d_info->full_ffp_varyings)
6526
6527 for (i = 0; i < WINED3D_MAX_ACTIVE_LIGHTS; ++i)
6528 {
6529 if (!state->light_state.lights[i])
6530 continue;
6531
6532 switch (state->light_state.lights[i]->OriginalParms.type)
6533 {
6535 ++settings->point_light_count;
6536 break;
6537 case WINED3D_LIGHT_SPOT:
6538 ++settings->spot_light_count;
6539 break;
6541 ++settings->directional_light_count;
6542 break;
6544 ++settings->parallel_point_light_count;
6545 break;
6546 default:
6547 FIXME("Unhandled light type %#x.\n", state->light_state.lights[i]->OriginalParms.type);
6548 break;
6549 }
6550 }
6551
6552 if (!state->render_states[WINED3D_RS_FOGENABLE])
6553 settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
6554 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
6555 {
6557
6558 if (state->transforms[WINED3D_TS_PROJECTION]._14 == 0.0f
6559 && state->transforms[WINED3D_TS_PROJECTION]._24 == 0.0f
6560 && state->transforms[WINED3D_TS_PROJECTION]._34 == 0.0f
6561 && state->transforms[WINED3D_TS_PROJECTION]._44 == 1.0f)
6562 settings->ortho_fog = 1;
6563 }
6564 else if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE)
6566 else if (state->render_states[WINED3D_RS_RANGEFOGENABLE])
6568 else
6570
6571 if (d3d_info->emulated_flatshading)
6572 settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
6573 else
6574 settings->flatshading = FALSE;
6575
6576 settings->swizzle_map = si->swizzle_map;
6577}
static SYSTEM_INFO si
Definition: virtual.c:39
wined3d_material_color_source
Definition: wined3d.h:520
@ WINED3D_LIGHT_SPOT
Definition: wined3d.h:67
@ WINED3D_LIGHT_PARALLELPOINT
Definition: wined3d.h:69
@ WINED3D_LIGHT_POINT
Definition: wined3d.h:66
@ WINED3D_LIGHT_DIRECTIONAL
Definition: wined3d.h:68
@ WINED3D_VBF_1WEIGHTS
Definition: wined3d.h:452
@ WINED3D_VBF_DISABLE
Definition: wined3d.h:451
@ WINED3D_VBF_3WEIGHTS
Definition: wined3d.h:454
@ WINED3D_VBF_2WEIGHTS
Definition: wined3d.h:453
#define WINED3D_MAX_ACTIVE_LIGHTS
static void wined3d_get_material_colour_source(enum wined3d_material_color_source *diffuse, enum wined3d_material_color_source *emissive, enum wined3d_material_color_source *ambient, enum wined3d_material_color_source *specular, const struct wined3d_state *state)
@ WINED3D_FFP_VS_FOG_FOGCOORD
@ WINED3D_FFP_VS_FOG_OFF
@ WINED3D_FFP_VS_FOG_DEPTH
@ WINED3D_FFP_VS_FOG_RANGE

Referenced by get_ffp_vertex_shader(), and 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 6579 of file utils.c.

6580{
6581 const struct wined3d_ffp_vs_settings *ka = key;
6583 const struct wined3d_ffp_vs_desc, entry)->settings;
6584
6585 return memcmp(ka, kb, sizeof(*ka));
6586}

Referenced by glsl_vertex_pipe_vp_alloc(), and wined3d_device_init().

◆ 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 4489 of file utils.c.

4491{
4492 /* For block based formats, pitch means the amount of bytes to the next
4493 * row of blocks rather than the next row of pixels. */
4495 {
4496 unsigned int row_block_count = (width + format->block_width - 1) / format->block_width;
4497 unsigned int slice_block_count = (height + format->block_height - 1) / format->block_height;
4498 *row_pitch = row_block_count * format->block_byte_count;
4499 *row_pitch = (*row_pitch + alignment - 1) & ~(alignment - 1);
4500 *slice_pitch = *row_pitch * slice_block_count;
4501 }
4502 else
4503 {
4504 *row_pitch = format->byte_count * width; /* Bytes / row */
4505 *row_pitch = (*row_pitch + alignment - 1) & ~(alignment - 1);
4506 *slice_pitch = *row_pitch * height;
4507 }
4508
4510 {
4511 /* The D3D format requirements make sure that the resulting format is an integer again */
4512 *slice_pitch *= format->height_scale.numerator;
4513 *slice_pitch /= format->height_scale.denominator;
4514 }
4515
4516 TRACE("Returning row pitch %u, slice pitch %u.\n", *row_pitch, *slice_pitch);
4517}
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
Definition: align.cpp:48

Referenced by get_map_pitch(), surface_cpu_blt(), wined3d_calculate_format_pitch(), wined3d_format_calculate_size(), wined3d_texture_get_pitch(), wined3d_texture_gl_download_data_slow_path(), wined3d_texture_gl_load_texture(), wined3d_texture_gl_upload_bo(), wined3d_texture_gl_upload_data(), wined3d_texture_update_desc(), and wined3d_texture_vk_upload_data().

◆ 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 4519 of file utils.c.

4521{
4522 unsigned int row_pitch, slice_pitch;
4523
4524 if (format->id == WINED3DFMT_UNKNOWN)
4525 return 0;
4526
4528 return width * height * depth * format->byte_count;
4529
4530 wined3d_format_calculate_pitch(format, alignment, width, height, &row_pitch, &slice_pitch);
4531
4532 return slice_pitch * depth;
4533}
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:4489
#define WINED3D_FORMAT_ATTR_BROKEN_PITCH

Referenced by wined3d_texture_init().

◆ wined3d_format_colour_to_vk()

void wined3d_format_colour_to_vk ( const struct wined3d_format *  format,
const struct wined3d_color *  c,
VkClearColorValue *  retval 
)

Definition at line 5790 of file utils.c.

5792{
5794 {
5795 retval->int32[0] = c->r;
5796 retval->int32[1] = c->g;
5797 retval->int32[2] = c->b;
5798 retval->int32[3] = c->a;
5799 }
5800 else
5801 {
5802 retval->float32[0] = c->r;
5803 retval->float32[1] = c->g;
5804 retval->float32[2] = c->b;
5805 retval->float32[3] = c->a;
5806 }
5807}
int retval
Definition: wcstombs.cpp:91

Referenced by vk_blitter_clear_rendertargets(), wined3d_context_vk_begin_render_pass(), and wined3d_texture_vk_clear().

◆ wined3d_format_convert_from_float()

void wined3d_format_convert_from_float ( const struct wined3d_format *  format,
const struct wined3d_color *  color,
void *  ret 
)

Definition at line 5817 of file utils.c.

5819{
5820 static const struct
5821 {
5823 struct wined3d_vec4 mul;
5824 struct wined3d_uvec4 shift;
5825 }
5826 float_conv[] =
5827 {
5828 {WINED3DFMT_P8_UINT, { 0.0f, 0.0f, 0.0f, 255.0f}, { 0, 0, 0, 0}},
5829 {WINED3DFMT_S1_UINT_D15_UNORM, { 32767.0f, 0.0f, 0.0f, 0.0f}, { 0, 0, 0, 0}},
5830 {WINED3DFMT_D16_UNORM, { 65535.0f, 0.0f, 0.0f, 0.0f}, { 0, 0, 0, 0}},
5831 };
5832 static const struct
5833 {
5835 struct wined3d_dvec4 mul;
5836 struct wined3d_uvec4 shift;
5837 }
5838 double_conv[] =
5839 {
5840 {WINED3DFMT_D24_UNORM_S8_UINT, { 16777215.0, 1.0, 0.0, 0.0}, {8, 0, 0, 0}},
5841 {WINED3DFMT_X8D24_UNORM, { 16777215.0, 0.0, 0.0, 0.0}, {0, 0, 0, 0}},
5842 {WINED3DFMT_D32_UNORM, {4294967295.0, 0.0, 0.0, 0.0}, {0, 0, 0, 0}},
5843 };
5845 struct wined3d_color colour_srgb;
5846 struct wined3d_uvec4 idx, shift;
5847 unsigned int i;
5848
5849 TRACE("Converting colour %s to format %s.\n", debug_color(color), debug_d3dformat(format_id));
5850 memset(ret, 0, max(sizeof(uint32_t), format->byte_count));
5851
5852 for (i = 0; i < ARRAY_SIZE(format_srgb_info); ++i)
5853 {
5854 if (format_id != format_srgb_info[i].srgb_format_id)
5855 continue;
5856
5858 format_id = format_srgb_info[i].base_format_id;
5859 color = &colour_srgb;
5860 break;
5861 }
5862
5863 for (i = 0; i < ARRAY_SIZE(float_conv); ++i)
5864 {
5865 uint32_t *ret_i = ret;
5866
5867 if (format_id != float_conv[i].format_id)
5868 continue;
5869
5870 idx.x = float_conv[i].shift.x / 32;
5871 idx.y = float_conv[i].shift.y / 32;
5872 idx.z = float_conv[i].shift.z / 32;
5873 idx.w = float_conv[i].shift.w / 32;
5874 shift.x = float_conv[i].shift.x % 32;
5875 shift.y = float_conv[i].shift.y % 32;
5876 shift.z = float_conv[i].shift.z % 32;
5877 shift.w = float_conv[i].shift.w % 32;
5878
5879 ret_i[idx.x] = ((uint32_t)((color->r * float_conv[i].mul.x) + 0.5f)) << shift.x;
5880 ret_i[idx.y] |= ((uint32_t)((color->g * float_conv[i].mul.y) + 0.5f)) << shift.y;
5881 ret_i[idx.z] |= ((uint32_t)((color->b * float_conv[i].mul.z) + 0.5f)) << shift.z;
5882 ret_i[idx.w] |= ((uint32_t)((color->a * float_conv[i].mul.w) + 0.5f)) << shift.w;
5883
5884 return;
5885 }
5886
5887 for (i = 0; i < ARRAY_SIZE(double_conv); ++i)
5888 {
5889 uint32_t *ret_i;
5890
5891 if (format_id != double_conv[i].format_id)
5892 continue;
5893
5894 idx.x = double_conv[i].shift.x / 32;
5895 idx.y = double_conv[i].shift.y / 32;
5896 idx.z = double_conv[i].shift.z / 32;
5897 idx.w = double_conv[i].shift.w / 32;
5898 shift.x = double_conv[i].shift.x % 32;
5899 shift.y = double_conv[i].shift.y % 32;
5900 shift.z = double_conv[i].shift.z % 32;
5901 shift.w = double_conv[i].shift.w % 32;
5902
5903 ret_i = ret;
5904 ret_i[idx.x] = ((uint32_t)((color->r * double_conv[i].mul.x) + 0.5)) << shift.x;
5905 ret_i[idx.y] |= ((uint32_t)((color->g * double_conv[i].mul.y) + 0.5)) << shift.y;
5906 ret_i[idx.z] |= ((uint32_t)((color->b * double_conv[i].mul.z) + 0.5)) << shift.z;
5907 ret_i[idx.w] |= ((uint32_t)((color->a * double_conv[i].mul.w) + 0.5)) << shift.w;
5908
5909 return;
5910 }
5911
5913 {
5914 uint32_t *ret_i = ret;
5915
5916 idx.x = format->red_offset / 32;
5917 idx.y = format->green_offset / 32;
5918 idx.z = format->blue_offset / 32;
5919 idx.w = format->alpha_offset / 32;
5920 shift.x = format->red_offset % 32;
5921 shift.y = format->green_offset % 32;
5922 shift.z = format->blue_offset % 32;
5923 shift.w = format->alpha_offset % 32;
5924
5925 ret_i[idx.x] = ((uint32_t)((color->r * wined3d_mask_from_size(format->red_size)) + 0.5f)) << shift.x;
5926 ret_i[idx.y] |= ((uint32_t)((color->g * wined3d_mask_from_size(format->green_size)) + 0.5f)) << shift.y;
5927 ret_i[idx.z] |= ((uint32_t)((color->b * wined3d_mask_from_size(format->blue_size)) + 0.5f)) << shift.z;
5928 ret_i[idx.w] |= ((uint32_t)((color->a * wined3d_mask_from_size(format->alpha_size)) + 0.5f)) << shift.w;
5929
5930 return;
5931 }
5932
5933 /* 32 bit float formats. We don't handle D32_FLOAT_S8X24_UINT for now. */
5934 if ((format->attrs & WINED3D_FORMAT_ATTR_FLOAT)
5935 && (format->red_size == 32 || format->depth_size == 32)
5936 && !format->stencil_size)
5937 {
5938 float *ret_f = ret;
5939
5940 switch (format->byte_count)
5941 {
5942 case 16: ret_f[3] = color->a;
5943 case 12: ret_f[2] = color->b;
5944 case 8: ret_f[1] = color->g;
5945 case 4: ret_f[0] = color->r;
5946 break;
5947
5948 default:
5949 ERR("Unexpected byte count %u, format %s.\n", format->byte_count, debug_d3dformat(format_id));
5950 break;
5951 }
5952
5953 return;
5954 }
5955
5956 if ((format->attrs & WINED3D_FORMAT_ATTR_FLOAT) && format->red_size == 16)
5957 {
5958 uint16_t *ret_s = ret;
5959
5960 switch (format->byte_count)
5961 {
5962 case 8:
5963 ret_s[3] = float_32_to_16(&color->a);
5964 ret_s[2] = float_32_to_16(&color->b);
5965 /* fall through */
5966 case 4:
5967 ret_s[1] = float_32_to_16(&color->g);
5968 /* fall through */
5969 case 2:
5970 ret_s[0] = float_32_to_16(&color->r);
5971 break;
5972
5973 default:
5974 ERR("Unexpected byte count %u, format %s.\n", format->byte_count, debug_d3dformat(format_id));
5975 break;
5976 }
5977
5978 return;
5979 }
5980
5981 FIXME("Conversion for format %s not implemented.\n", debug_d3dformat(format_id));
5982}
unsigned short float_32_to_16(const float in)
Definition: math.c:2102
unsigned int idx
Definition: utils.c:40
const char * debug_color(const struct wined3d_color *color)
Definition: utils.c:4561
unsigned short uint16_t
Definition: stdint.h:35
#define shift
Definition: input.c:3280
#define mul(aa, bb)
Definition: mvAesAlg.c:25
#define uint32_t
Definition: nsiface.idl:61
static void wined3d_colour_srgb_from_linear(struct wined3d_color *colour_srgb, const struct wined3d_color *colour)

Referenced by process_vertices_strided(), and wined3d_resource_memory_colour_fill().

◆ wined3d_format_copy_data()

void wined3d_format_copy_data ( const struct wined3d_format *  format,
const uint8_t *  src,
unsigned int  src_row_pitch,
unsigned int  src_slice_pitch,
uint8_t *  dst,
unsigned int  dst_row_pitch,
unsigned int  dst_slice_pitch,
unsigned int  w,
unsigned int  h,
unsigned int  d 
)

Definition at line 6080 of file utils.c.

6083{
6084 unsigned int row_block_count, row_count, row_size, slice, row;
6085 unsigned int slice_count = d, slice_size;
6086 const uint8_t *src_row;
6087 uint8_t *dst_row;
6088
6089 row_block_count = (w + format->block_width - 1) / format->block_width;
6090 row_count = (h + format->block_height - 1) / format->block_height;
6091 row_size = row_block_count * format->block_byte_count;
6092 slice_size = row_size * row_count;
6093
6094 if (src_row_pitch == row_size && dst_row_pitch == row_size
6095 && ((src_slice_pitch == slice_size && dst_slice_pitch == slice_size) || slice_count == 1))
6096 {
6097 memcpy(dst, src, slice_count * slice_size);
6098 return;
6099 }
6100
6101 for (slice = 0; slice < slice_count; ++slice)
6102 {
6103 for (row = 0; row < row_count; ++row)
6104 {
6105 src_row = &src[slice * src_slice_pitch + row * src_row_pitch];
6106 dst_row = &dst[slice * dst_slice_pitch + row * dst_row_pitch];
6107 memcpy(dst_row, src_row, row_size);
6108 }
6109 }
6110}
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723

Referenced by wined3d_device_context_emit_update_sub_resource(), wined3d_texture_vk_download_data(), and wined3d_texture_vk_upload_data().

◆ 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 1293 of file utils.c.

1295{
1296 const struct wined3d_format *format = texture->resource.format;
1297 unsigned int i;
1298
1299 static const struct
1300 {
1301 enum wined3d_format_id src_format;
1302 struct wined3d_color_key_conversion conversion;
1303 }
1304 color_key_info[] =
1305 {
1311 };
1312
1313 if (need_alpha_ck && (texture->async.flags & WINED3D_TEXTURE_ASYNC_COLOR_KEY))
1314 {
1315 for (i = 0; i < ARRAY_SIZE(color_key_info); ++i)
1316 {
1317 if (color_key_info[i].src_format == format->id)
1318 return &color_key_info[i].conversion;
1319 }
1320
1321 FIXME("Color-keying not supported with format %s.\n", debug_d3dformat(format->id));
1322 }
1323
1324 return NULL;
1325}
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_color_key *color_key)
Definition: utils.c:1204
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_color_key *color_key)
Definition: utils.c:1181
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_color_key *color_key)
Definition: utils.c:1271
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_color_key *color_key)
Definition: utils.c:1248
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_color_key *color_key)
Definition: utils.c:1227
#define WINED3D_TEXTURE_ASYNC_COLOR_KEY

Referenced by wined3d_texture_gl_load_texture(), and wined3d_texture_gl_prepare_texture().

◆ 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 5997 of file utils.c.

5999{
6000 struct wined3d_color slop = {INFINITY, INFINITY, INFINITY, INFINITY};
6001
6002 switch (format->id)
6003 {
6022 if (format->red_size)
6023 slop.r = 0.5f / wined3d_mask_from_size(format->red_size);
6024 if (format->green_size)
6025 slop.g = 0.5f / wined3d_mask_from_size(format->green_size);
6026 if (format->blue_size)
6027 slop.b = 0.5f / wined3d_mask_from_size(format->blue_size);
6028 if (format->alpha_size)
6029 slop.a = 0.5f / wined3d_mask_from_size(format->alpha_size);
6030
6031 float_colors[0].r = color_to_float(key->color_space_low_value, format->red_size, format->red_offset)
6032 - slop.r;
6033 float_colors[0].g = color_to_float(key->color_space_low_value, format->green_size, format->green_offset)
6034 - slop.g;
6035 float_colors[0].b = color_to_float(key->color_space_low_value, format->blue_size, format->blue_offset)
6036 - slop.b;
6037 float_colors[0].a = color_to_float(key->color_space_low_value, format->alpha_size, format->alpha_offset)
6038 - slop.a;
6039
6040 float_colors[1].r = color_to_float(key->color_space_high_value, format->red_size, format->red_offset)
6041 + slop.r;
6042 float_colors[1].g = color_to_float(key->color_space_high_value, format->green_size, format->green_offset)
6043 + slop.g;
6044 float_colors[1].b = color_to_float(key->color_space_high_value, format->blue_size, format->blue_offset)
6045 + slop.b;
6046 float_colors[1].a = color_to_float(key->color_space_high_value, format->alpha_size, format->alpha_offset)
6047 + slop.a;
6048 break;
6049
6050 case WINED3DFMT_P8_UINT:
6051 float_colors[0].r = 0.0f;
6052 float_colors[0].g = 0.0f;
6053 float_colors[0].b = 0.0f;
6054 float_colors[0].a = (key->color_space_low_value - 0.5f) / 255.0f;
6055
6056 float_colors[1].r = 0.0f;
6057 float_colors[1].g = 0.0f;
6058 float_colors[1].b = 0.0f;
6059 float_colors[1].a = (key->color_space_high_value + 0.5f) / 255.0f;
6060 break;
6061
6062 default:
6063 ERR("Unhandled color key to float conversion for format %s.\n", debug_d3dformat(format->id));
6064 }
6065}
static float color_to_float(DWORD color, DWORD size, DWORD offset)
Definition: utils.c:5984

Referenced by glsl_blitter_blit(), and wined3d_device_apply_stateblock().

◆ wined3d_format_gl_mutable()

static struct wined3d_format_gl * wined3d_format_gl_mutable ( struct wined3d_format *  format)
static

Definition at line 1948 of file utils.c.

1949{
1951}
GLfloat f
Definition: glext.h:7540
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by get_format_gl_by_idx(), and get_format_gl_internal().

◆ 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 4476 of file utils.c.

4478{
4479 unsigned int i;
4480
4482 {
4483 if (typeless_depth_stencil_formats[i].typeless_id == resource_format_id)
4484 return typeless_depth_stencil_formats[i].depth_view_id == view_format_id;
4485 }
4486 return FALSE;
4487}

Referenced by wined3d_shader_resource_view_gl_cs_init().

◆ wined3d_format_pack()

uint32_t wined3d_format_pack ( const struct wined3d_format *  format,
const struct wined3d_uvec4 *  value 
)

Definition at line 5778 of file utils.c.

5779{
5780 uint32_t p = 0;
5781
5782 p |= (value->x & wined3d_mask_from_size(format->red_size)) << format->red_offset;
5783 p |= (value->y & wined3d_mask_from_size(format->green_size)) << format->green_offset;
5784 p |= (value->z & wined3d_mask_from_size(format->blue_size)) << format->blue_offset;
5785 p |= (value->w & wined3d_mask_from_size(format->alpha_size)) << format->alpha_offset;
5786
5787 return p;
5788}
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by wined3d_unordered_access_view_gl_clear().

◆ wined3d_format_vk_mutable()

static struct wined3d_format_vk * wined3d_format_vk_mutable ( struct wined3d_format *  format)
static

Definition at line 1953 of file utils.c.

1954{
1956}

Referenced by wined3d_adapter_vk_init_format_info().

◆ wined3d_formats_are_srgb_variants()

BOOL wined3d_formats_are_srgb_variants ( enum wined3d_format_id  format1,
enum wined3d_format_id  format2 
)

Definition at line 4535 of file utils.c.

4536{
4537 unsigned int i;
4538
4539 for (i = 0; i < ARRAY_SIZE(format_srgb_info); ++i)
4540 {
4541 if (format1 == format_srgb_info[i].srgb_format_id)
4542 return format2 == format_srgb_info[i].base_format_id;
4543 if (format1 == format_srgb_info[i].base_format_id)
4544 return format2 == format_srgb_info[i].srgb_format_id;
4545 }
4546 return FALSE;
4547}

Referenced by validate_resource_view().

◆ wined3d_ftoa()

void wined3d_ftoa ( float  value,
char *  s 
)

Definition at line 6643 of file utils.c.

6644{
6645 int idx = 1;
6646
6647 if (copysignf(1.0f, value) < 0.0f)
6648 ++idx;
6649
6650 /* Be sure to allocate a buffer of at least 17 characters for the result
6651 as sprintf may return a 3 digit exponent when using the MSVC runtime
6652 instead of a 2 digit exponent. */
6653 sprintf(s, "%.8e", value);
6654 if (isfinite(value))
6655 s[idx] = '.';
6656}
#define isfinite(x)
Definition: math.h:363
#define copysignf(x, y)
Definition: math.h:254
#define sprintf
Definition: sprintf.c:45

Referenced by shader_glsl_append_imm_vec().

◆ wined3d_get_format()

const struct wined3d_format * wined3d_get_format ( const struct wined3d_adapter *  adapter,
enum wined3d_format_id  format_id,
unsigned int  bind_flags 
)

Definition at line 4428 of file utils.c.

4430{
4431 const struct wined3d_format *format;
4433 unsigned int i;
4434
4435 if (idx == -1)
4436 {
4437 FIXME("Can't find format %s (%#x) in the format lookup table.\n",
4440 }
4441
4443
4445 {
4447 {
4450 }
4451
4452 FIXME("Cannot find depth/stencil typeless format %s (%#x).\n",
4455 }
4456
4457 return format;
4458}
static BOOL wined3d_format_is_typeless(const struct wined3d_format *format)

Referenced by adapter_format_from_backbuffer_format(), append_decl_element(), blend_equation_from_wined3d(), mode_matches_filter(), process_vertices_strided(), surface_cpu_blt(), texture2d_blt(), validate_resource_view(), vertexdeclaration_init(), wined3d_buffer_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_context_gl_create_wgl_ctx(), wined3d_device_vk_create_null_resources(), wined3d_output_get_mode(), wined3d_output_get_mode_count(), wined3d_output_set_display_mode(), wined3d_resource_get_decompress_format(), wined3d_swapchain_apply_sample_count_override(), wined3d_swapchain_vk_select_vk_format(), wined3d_texture_create(), wined3d_texture_gl_load_texture(), wined3d_texture_gl_prepare_texture(), wined3d_texture_gl_upload_data(), wined3d_texture_init(), and wined3d_unordered_access_view_vk_clear().

◆ wined3d_get_primary_adapter_luid()

BOOL wined3d_get_primary_adapter_luid ( LUID *  luid)

Definition at line 5761 of file utils.c.

5762{
5763 D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_adapter_param;
5764 D3DKMT_CLOSEADAPTER close_adapter_param;
5765
5766 if (!wined3d_get_primary_display(open_adapter_param.DeviceName))
5767 return FALSE;
5768
5769 if (D3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_param))
5770 return FALSE;
5771
5772 *luid = open_adapter_param.AdapterLuid;
5773 close_adapter_param.hAdapter = open_adapter_param.hAdapter;
5774 D3DKMTCloseAdapter(&close_adapter_param);
5775 return TRUE;
5776}
static BOOL wined3d_get_primary_display(WCHAR *display)
Definition: utils.c:5743
D3DKMT_HANDLE hAdapter
Definition: d3dkmthk.h:156
NTSTATUS WINAPI D3DKMTCloseAdapter(const D3DKMT_CLOSEADAPTER *desc)
NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName(D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME *desc)

Referenced by wined3d_adapter_gl_init(), wined3d_adapter_no3d_create(), and wined3d_adapter_vk_init().

◆ wined3d_get_primary_display()

static BOOL wined3d_get_primary_display ( WCHAR *  display)
static

Definition at line 5743 of file utils.c.

5744{
5745 DISPLAY_DEVICEW display_device;
5746 DWORD device_idx = 0;
5747
5748 display_device.cb = sizeof(display_device);
5749 while (EnumDisplayDevicesW(NULL, device_idx++, &display_device, 0))
5750 {
5751 if (display_device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
5752 {
5753 lstrcpyW(display, display_device.DeviceName);
5754 return TRUE;
5755 }
5756 }
5757
5758 return FALSE;
5759}
#define lstrcpyW
Definition: compat.h:749
WCHAR DeviceName[32]
Definition: wingdi.h:3264
DWORD StateFlags
Definition: wingdi.h:3266
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:78
#define DISPLAY_DEVICE_PRIMARY_DEVICE
Definition: wingdi.h:1398
int * display
Definition: x11stubs.c:12

Referenced by wined3d_get_primary_adapter_luid().

◆ wined3d_get_typed_format_id()

enum wined3d_format_id wined3d_get_typed_format_id ( const struct wined3d_adapter *  adapter,
const struct wined3d_format *  format,
enum wined3d_channel_type  channel_type 
)

Definition at line 4460 of file utils.c.

4462{
4463 const struct wined3d_typed_format_info *info;
4464 uint32_t i;
4465
4466 for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
4467 {
4468 info = &typed_formats[i];
4469 if (info->typeless_id == format->typeless_id && map_channel_type(info->channels[0]) == channel_type)
4470 return info->id;
4471 }
4472
4473 return WINED3DFMT_UNKNOWN;
4474}

Referenced by wined3d_unordered_access_view_vk_clear().

◆ 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 6712 of file utils.c.

6714{
6715 unsigned int i;
6716
6718 {
6719 if (gl_limits->combined_samplers == gl_limits->graphics_samplers)
6720 *base = 0;
6721 else
6722 *base = gl_limits->graphics_samplers;
6724 return;
6725 }
6726
6727 *base = 0;
6728 for (i = 0; i < WINED3D_SHADER_TYPE_GRAPHICS_COUNT; ++i)
6729 {
6730 *count = gl_limits->samplers[i];
6731 if (i == shader_type)
6732 return;
6733 *base += *count;
6734 }
6735
6736 ERR("Unrecognized shader type %#x.\n", shader_type);
6737 *count = 0;
6738}
unsigned int samplers[WINED3D_SHADER_TYPE_COUNT]
Definition: wined3d_gl.h:284
unsigned int graphics_samplers
Definition: wined3d_gl.h:285
unsigned int combined_samplers
Definition: wined3d_gl.h:286
@ WINED3D_SHADER_TYPE_GRAPHICS_COUNT
Definition: wined3d.h:846

Referenced by wined3d_context_gl_get_tex_unit_mapping(), and wined3d_context_gl_init().

◆ 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 6694 of file utils.c.

6696{
6697 unsigned int i;
6698
6699 *base = 0;
6700 for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
6701 {
6702 *count = gl_limits->uniform_blocks[i];
6703 if (i == shader_type)
6704 return;
6705 *base += *count;
6706 }
6707
6708 ERR("Unrecognized shader type %#x.\n", shader_type);
6709 *count = 0;
6710}
unsigned int uniform_blocks[WINED3D_SHADER_TYPE_COUNT]
Definition: wined3d_gl.h:283
@ WINED3D_SHADER_TYPE_COUNT
Definition: wined3d.h:849

Referenced by create_resource_bindings(), 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 2226 of file utils.c.

2227{
2228 switch (type)
2229 {
2231 return GL_TEXTURE_1D;
2233 return GL_TEXTURE_2D;
2235 return GL_TEXTURE_3D;
2239 return GL_TEXTURE_2D; /* TODO: GL_TEXTURE_BUFFER. */
2241 return GL_RENDERBUFFER;
2243 break;
2244 }
2245 ERR("Unexpected GL resource type %u.\n", type);
2246 return 0;
2247}

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

◆ wined3d_release_dc()

void wined3d_release_dc ( HWND  window,
HDC  dc 
)

Definition at line 6658 of file utils.c.

6659{
6660 /* You'd figure ReleaseDC() would fail if the DC doesn't match the window.
6661 * However, that's not what actually happens, and there are user32 tests
6662 * that confirm ReleaseDC() with the wrong window is supposed to succeed.
6663 * So explicitly check that the DC belongs to the window, since we want to
6664 * avoid releasing a DC that belongs to some other window if the original
6665 * window was already destroyed. */
6666 if (WindowFromDC(dc) != window)
6667 WARN("DC %p does not belong to window %p.\n", dc, window);
6668 else if (!ReleaseDC(window, dc))
6669 ERR("Failed to release device context %p, last error %#lx.\n", dc, GetLastError());
6670}
HDC dc
Definition: cylfrac.c:34
static IHTMLWindow2 * window
Definition: events.c:77
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND WINAPI WindowFromDC(_In_ HDC hDC)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by wined3d_caps_gl_ctx_destroy(), wined3d_context_gl_cleanup(), wined3d_context_gl_create_wgl_ctx(), wined3d_context_gl_init(), wined3d_context_gl_set_gl_context(), wined3d_context_gl_update_window(), and wined3d_device_gl_delete_opengl_contexts_cs().

◆ 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 1151 of file utils.c.

1155{
1156 unsigned int x, y, z;
1157
1158 for (z = 0; z < depth; ++z)
1159 {
1160 for (y = 0; y < height; ++y)
1161 {
1162 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1163 DWORD *dest = (DWORD *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
1164
1165 for (x = 0; x < width; ++x)
1166 {
1167 dest[x] = source[x] >> 8;
1168 }
1169 }
1170 }
1171}
static char * dest
Definition: rtl.c:149

◆ 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 1129 of file utils.c.

1133{
1134 unsigned int x, y, z;
1135
1136 for (z = 0; z < depth; ++z)
1137 {
1138 for (y = 0; y < height; ++y)
1139 {
1140 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1141 DWORD *dest = (DWORD *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
1142
1143 for (x = 0; x < width; ++x)
1144 {
1145 dest[x] = source[x] << 8 | ((source[x] >> 16) & 0xff);
1146 }
1147 }
1148 }
1149}

Variable Documentation

◆ ddi_formats

◆ format_base_flags

const struct wined3d_format_base_flags format_base_flags[]
static

Definition at line 319 of file utils.c.

Referenced by init_format_base_info().

◆ format_block_info

const struct wined3d_format_block_info format_block_info[]
static
Initial value:

Definition at line 673 of file utils.c.

Referenced by init_format_block_info().

◆ format_decompress_info

const struct wined3d_format_decompress_info format_decompress_info[]
static
Initial value:
=
{
}
static void decompress_bc2(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)
Definition: utils.c:550
static void decompress_bc3(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)
Definition: utils.c:542
static void decompress_bc4(const uint8_t *src, uint8_t *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)
Definition: utils.c:618
static void decompress_bc1(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)
Definition: utils.c:558

Referenced by init_format_decompress_info().

◆ 

◆ format_srgb_info

◆ format_texture_info

const struct wined3d_format_texture_info format_texture_info[]
static

Definition at line 1353 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 705 of file utils.c.

Referenced by init_format_vertex_info().

◆ formats

◆ id

◆ idx

Definition at line 40 of file utils.c.

Referenced by __acrt_iob_func(), _get_child_item(), _ok_path_fudge(), _test_file_access(), _test_select_selidx(), add_dispinterface_typeinfo(), add_enum_typeinfo(), add_func_desc(), add_interface_typeinfo(), add_module_typeinfo(), add_structure_typeinfo(), add_union_typeinfo(), AddIconFromRegistry(), addItem(), CRegFolderEnum::AddItemsFromKey(), ADsBuildVarArrayStr(), ADsOpenObject(), AdvancedDlgProc(), af_face_globals_compute_style_coverage(), af_glyph_hints_reload(), af_shaper_get_elem(), alloc_device(), alloc_user_queue(), append_decl_element(), append_uia_runtime_id(), append_weights(), arabic_get_shaping_action(), arabic_set_shaping_action(), Arguments_prop_get(), Arguments_prop_put(), Array_slice(), assembly_get_external_files(), assembly_get_pubkey_token(), AtapiDmaInit(), attach_event_to_node_provider(), AutomationObject_GetIDsOfNames(), AVIFILE_SaveIndex(), CEnumMergedFolder::Begin(), bitmap_clear(), bitmap_is_set(), bitmap_set(), bnum_idx(), 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_runtime_id_(), check_system_palette_entries(), check_uia_prop_val(), check_uia_rect_val_(), check_vertical_metrics(), chmc_pmgi_add_entry(), chmc_pmgl_add_entry(), ClassInitializeDispatchTables(), cmap_format4_compare_range(), cmp_sorttab_addr(), codeview_jump_to_type(), COMBO_GetText(), COMBO_GetTextA(), COMBO_GetTextW(), compare_FindGlyph(), compute_method_indexes(), context_set_tls_idx(), Control_RegisterRegistryApplets(), convert_fvf_to_declaration(), copy_propagation_invalidate_variable_from_deref_recurse(), create_i4_safearray(), create_node_from_node_provider(), create_r8_safearray(), create_special_root_hkey(), create_uia_element_from_cache_req(), create_uia_node_safearray(), create_unk_safearray(), CreateMainShortcut(), d2d_figure_insert_bezier_controls(), d2d_figure_insert_vertex(), d2d_fp_estimate(), d2d_geometry_bezier_ccw(), d2d_geometry_get_bezier_segment_idx(), d2d_geometry_get_first_bezier_segment_idx(), d2d_geometry_get_next_bezier_segment_idx(), d2d_geometry_split_bezier(), D3D10StateBlockMaskGetSetting(), d3d12_root_signature_append_vk_binding(), d3d12_root_signature_init_push_constants(), 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(), dde_connect(), ddraw_allocate_handle(), DECLARE_INTERFACE_(), default_uia_provider_callback(), delete_test_key(), delItem(), device_invalidate_state(), device_manager_CloseDeviceHandle(), device_manager_get_handle_index(), device_manager_GetVideoService(), device_manager_LockDevice(), device_manager_TestDevice(), device_manager_UnlockDevice(), dir_sdi(), DisablePredefinedHandleTableInternal(), DispatchEx_GetMemberName(), DispatchEx_GetNextDispID(), DispatchEx_InvokeEx(), RdpClientUI::Display_DoGlyph(), DisplayParameter(), DisplayScreen(), do_install_gpe_handler(), do_match_gpe_methods(), do_read_one(), do_search_tables(), do_write_one(), domselection_get_dispid(), dst_param_init_output(), dst_param_init_ssa_bool(), dst_param_init_ssa_float(), dst_param_init_temp_bool(), dst_param_init_temp_float4(), dst_param_init_temp_uint(), ensure_valid_idx(), enum_components(), enum_compressors(), enum_patches(), enum_products(), CCharMapWindow::EnumDisplayFont(), EnumFontNames(), enumFontProc(), EnumSystemLocalesA(), EnumSystemLocalesEx(), EnumSystemLocalesW(), env_set(), exec_op(), expect(), FaceNameList_Initialize(), Fdo_EvtDevicePrepareHardware(), fetch_machine_component(), fetch_machine_product(), fetch_user_component(), fetch_user_product(), fill_geometry_sink(), fill_geometry_sink_bezier(), fill_pnpentity(), FilterMapper_EnumMatchingFilters(), find_class_data(), find_color_in_colortbl(), find_font_in_fonttbl(), find_insert_index(), find_registry_key(), find_table(), find_table_by_signature(), FontSizeList_SelectFontSize(), FormatBufferFat(), FT_Get_PS_Font_Value(), FT_Get_Sfnt_Name(), ft_list_get_node_at(), ft_stroke_border_export(), FT_Trace_Get_Name(), FTC_Manager_Done(), g2s(), gen_proxy(), generate_lighting(), generate_lighting_footer(), 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_comboexlist_selection(), get_cp(), get_element_variant_from_node_variant(), get_event_test_prov(), get_focus_from_node_provider(), get_format_info_idx(), get_glyph_indices(), get_gpe(), get_has_parent_from_node_provider(), get_item_idx(), get_locale_data(), get_navigate_from_node_provider(), get_node_provider_type_at_idx(), get_object(), get_priv_data(), get_prop(), get_prop_val_from_node_provider(), get_prov_opts_from_node_provider(), get_queue_obj(), get_reg(), get_safearray_for_elprov(), get_temp_buffer(), get_token(), get_unused_desc(), GetCustomIconPath(), getenv_helper(), getItem(), getopt_long(), gl_local_filename_completion_proc(), global_idx(), glsl_is_color_reg_read(), gpe_enable_disable_for_wake(), gpe_from_block(), gpe_get_mask_unmask(), gpe_suspend_resume(), guid2string(), handle_arg(), handle_arg_or_local(), handle_enhanced_keys(), handle_index(), handle_load(), handle_load_table(), handle_local(), handle_mid(), CDefView::HandleRename(), HEADER_Refresh(), HLPFILE_ReadFont(), HLPFILE_Uncompress3(), hlsl_component_index_range_from_deref(), hlsl_get_element_type_from_path_index(), hlsl_new_index(), hlsl_new_load_index(), hlsl_new_store_index(), hlsl_regset_index_from_deref(), hlsl_swizzle_get_component(), hlsl_type_get_component_offset(), HostObject_prop_get(), HostObject_prop_put(), 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(), IL_AddImagesForTest(), in_plane(), init_current_version(), init_registered_oid_info(), InitializeDefaultIcons(), insert_column(), insert_item(), instr_ps_1_0123_texld(), Internal_EnumUILanguages(), CSearchBar::Invoke(), IOAPICSetupIrqs(), IRQPolarity(), IRQTrigger(), is_used_desc_packed(), CMenuToolbarBase::IsTrackedItem(), jsdisp_delete_idx(), jsdisp_get_idx(), jsdisp_get_idx_id(), jsdisp_index_lookup(), jsdisp_next_prop(), jsdisp_propput_idx(), loader_EnableCache(), locale_return_strarray(), lookup_is_glyph_match(), lower_nonconstant_vector_derefs(), main(), make_decode_tables(), map_one(), MCI_FindCommand(), MCI_IsCommandTableValid(), ME_DrawParaDecoration(), ME_GetBorderPenWidth(), ME_GetParaBorderWidth(), MIDI_player(), MIDIMAP_LoadSettingsScheme(), MMDRV_Free(), MMDRV_Get(), MSACM_FindFormatTagInCache(), MsiEnumComponentsExW(), MsiEnumPatchesExW(), MsiEnumPatchesW(), MsiEnumProductsExW(), MSRLE32_GetNearestPaletteIndex(), NdisMWriteLogData(), NetGroupGetUsers(), netif_get_by_index(), netif_index_to_name(), new_offset_from_path_index(), Number_toString(), obtain_user_agent(), ok_path(), OnHScroll(), OnInitDialog(), CSearchBar::OnLocationEditChange(), opentype_cmap_format4_get_glyph(), opentype_decode_namerecord(), opentype_get_glyph_attach_type(), opentype_is_english_namerecord(), opentype_layout_apply_gsub_alt_substitution(), opentype_layout_apply_gsub_mult_substitution(), opentype_layout_context_apply_lookup(), opentype_layout_delete_glyph(), opentype_set_glyph_attach_type(), opentype_set_glyph_props(), opentype_set_subst_glyph_props(), parent_wnd_proc(), parse_fx10_property_assignment(), 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(), pixelshader_get_resource_type(), pp_add_define(), pp_add_macro(), pp_del_define(), pplookup(), PrepareFoldersToScan(), PrintStackBacktrace(), PropertyBag_Read(), PropertyBag_Write(), PROPSHEET_Back(), PROPSHEET_DialogProc(), PROPSHEET_Next(), PROPSHEET_SetCurSelId(), ProviderFragment_GetEmbeddedFragmentRoots(), ProviderFragment_GetRuntimeId(), 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(), push_event_queue_event(), put_unused_desc_chain(), CConfigParser::ReadSection(), RegExp2_Replace(), register_index_address_init(), CControlPanelEnum::RegisterRegistryCPanelApps(), RemapPredefinedHandleInternal(), Remove(), remove_attribute(), remove_style(), remove_subset_prefix(), respond_to_win_event_on_node_provider(), s_put_ascii(), SampleGrabber_IMemInputPin_ReceiveMultiple(), sanitize_device_and_find_gpe(), scope_prop_get(), scope_prop_put(), ScriptShapeOpenType(), CDefView::SelectAndPositionItem(), set_clipboard_formats(), setItem(), setItemUnicodeNotify(), SetupDiGetClassImageListExW(), SetupOpenAppendInfFileW(), sfnt_table_info(), shader_get_registers_used(), shader_get_stream_output_register_info(), shader_glsl_ffp_vertex_lighting(), shader_glsl_ffp_vertex_lighting_footer(), shader_glsl_get_descriptor(), shader_glsl_get_register_name(), shader_glsl_get_resource_info(), shader_glsl_load_constants_b(), shader_glsl_load_constants_i(), shader_glsl_print_image_name(), shader_glsl_print_sysval_name(), shader_instruction_array_insert_at(), shader_sm1_get_swizzle_component(), SHELL_execute(), show_image(), ShutdownOnInit(), sm4_generate_vsir_instr_dcl_indexable_temp(), sm4_generate_vsir_instr_dcl_semantic(), sm6_parser_get_value_idx_by_ref(), sm6_parser_get_value_index(), sm6_parser_get_value_safe(), source_get(), sparse_array_add(), sparse_array_find(), sparse_array_lookup(), spirv_compiler_get_register_name(), split_copy(), SPY_Bsearch_Msg(), SPY_Bsearch_Notify(), src_param_init_parameter(), src_param_init_ssa_bool(), src_param_init_ssa_float(), src_param_init_temp_bool(), src_param_init_temp_float(), src_param_init_temp_float4(), src_param_init_temp_uint(), stabs_add_include(), stabs_pts_read_aggregate(), stabs_pts_read_enum(), stabs_pts_read_type_def(), stack_unwind(), START_TEST(), stateblock_mask_get_bit(), STATUSBAR_SetTextT(), str_array_get_ref(), stream_out_para_num(), stream_out_table_props(), String_charCodeAt(), String_prop_get(), String_replace(), t1_decoder_parse_metrics(), T1_Get_Kerning(), T1_Open_Face(), t1_ps_get_font_value(), T42_Open_Face(), TAB_RemoveImage(), table_ctl(), table_info_by_index_unchecked(), td_get_offs(), test_ADsBuildVarArrayStr(), test_bitmap_data(), test_cache_req_sa_(), test_comboex_WM_LBUTTONDOWN(), test_CUIAutomation_value_conversion(), test_GetCharacterPlacement_kerning(), test_halftone_palette(), test_ImmMessages(), test_Installer_Products(), test_negative_width(), test_node_hwnd_provider_navigation_(), test_RtlFindCharInUnicodeString(), test_selection(), test_SetDIBits(), test_SetDIBitsToDevice(), test_ShowWindow(), test_Sign_Media(), test_specific_encoder_properties(), test_stylesheets(), test_UiaFind(), test_UiaGetUpdatedCache(), test_UiaNavigate(), test_WM_LBUTTONDOWN(), TIME_MMSysTimeCallback(), TLB_ReadTypeLib(), TOOLBAR_Restore(), TransformView_Create(), TREEVIEW_ProcessLetterKeys(), triangulation_get_next_point(), TT_Get_HMetrics(), TT_Get_VMetrics(), uacpi_clear_gpe(), uacpi_disable_gpe(), uacpi_disable_gpe_for_wake(), uacpi_enable_gpe(), uacpi_enable_gpe_for_wake(), uacpi_finish_handling_gpe(), uacpi_for_each_installed_table(), uacpi_gpe_info(), uacpi_install_gpe_handler(), uacpi_install_gpe_handler_raw(), uacpi_mask_gpe(), uacpi_resume_gpe(), uacpi_setup_gpe_for_wake(), uacpi_suspend_gpe(), uacpi_table_find_by_signature_at(), uacpi_table_get_by_index(), uacpi_table_info_get_by_index(), uacpi_table_load(), uacpi_table_load_with_cause(), uacpi_table_mark_as_loaded(), uacpi_uninstall_gpe_handler(), uacpi_unmask_gpe(), uia_cache_request_combine(), uia_compare_safearrays(), uia_element_array_GetElement(), uia_element_FindAllBuildCache(), uia_node_get_provider(), uia_provider_attach_event(), uia_provider_get_special_prop_val(), UiaFind(), UiaGetUpdatedCache(), UniataInitIoRes(), update_heap_entry(), update_margin_edits(), validate_component_index_range_from_deref(), validate_nonconstant_vector_store_derefs(), variant_from_registry_value(), vdecl_convert_fvf(), verify_and_install_table(), vers_write(), VfatCreateFile(), virtqueue_add_buf_split(), virtqueue_detach_unused_buf_split(), virtqueue_get_buf_split(), vkd3d_string_buffer_print_f32(), vkd3d_string_buffer_print_f64(), vsir_block_list_remove_index(), vsir_program_lower_tex(), vsir_program_lower_texldd(), vsir_src_param_init_resource(), vsir_src_param_init_sampler(), vsir_swizzle_get_component(), vsir_validate_signature_element(), walk_constant_heap(), walk_constant_heap_clamped(), warn_if_early_referenced(), wgetenv_helper(), widOpenHelper(), wine_compose(), wined3d_adapter_get_output(), wined3d_bitmap_clear(), wined3d_bitmap_is_set(), wined3d_bitmap_set(), wined3d_bo_slab_vk_free_slice(), wined3d_context_gl_attach_surface_fbo(), wined3d_context_gl_set_fbo_key_for_render_target(), wined3d_context_vk_allocate_query(), wined3d_context_vk_create_slab_bo(), wined3d_context_vk_destroy_bo(), wined3d_context_vk_destroy_bo_slab_slice(), wined3d_device_apply_stateblock(), wined3d_device_context_copy_resource(), wined3d_device_context_emit_set_light_enable(), wined3d_device_context_get_constant_buffer(), wined3d_device_context_get_sampler(), wined3d_device_context_get_shader_resource_view(), wined3d_device_context_get_stream_output(), wined3d_device_context_get_unordered_access_view(), wined3d_extract_bits(), wined3d_format_convert_from_float(), wined3d_ftoa(), wined3d_get_adapter(), wined3d_get_format(), wined3d_insert_bits(), wined3d_light_state_get_light(), wined3d_query_pool_vk_allocate_query(), wined3d_query_pool_vk_mark_complete(), wined3d_query_pool_vk_mark_free(), wined3d_query_vk_begin(), wined3d_query_vk_end(), wined3d_state_get_ffp_texture(), wined3d_stream_info_from_declaration(), wined3d_texture_create_dc(), wined3d_texture_destroy_dc(), wined3d_texture_init(), wodOpenHelper(), write_fx_4_state_assignment(), write_proxy(), write_runtime_id_base(), write_str_file(), xfwrite(), xmlMemDisplay(), xmlMemDisplayLast(), xmlnodelist_get_dispid(), xmlnodemap_get_dispid(), 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 196 of file utils.c.

Referenced by init_format_base_info(), init_typeless_formats(), and wined3d_get_typed_format_id().

◆ typeless_depth_stencil_formats