ReactOS  0.4.14-dev-41-g31d7680
directx.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include "wined3d_private.h"
#include "wine/winternl.h"
Include dependency graph for directx.c:

Go to the source code of this file.

Classes

struct  wined3d_extension_map
 
struct  driver_quirk
 
struct  driver_version_information
 
struct  gpu_description
 
struct  wined3d_renderer_table
 
struct  gl_vendor_selection
 

Macros

#define DEFAULT_REFRESH_RATE   0
 
#define USE_GL_FUNC(pfn)   gl_info->gl_ops.ext.p_##pfn = (void *)wglGetProcAddress(#pfn);
 
#define MAP_GL_FUNCTION(core_func, ext_func)
 
#define MAP_GL_FUNCTION_CAST(core_func, ext_func)
 

Enumerations

enum  wined3d_display_driver {
  DRIVER_AMD_RAGE_128PRO, DRIVER_AMD_R100, DRIVER_AMD_R300, DRIVER_AMD_R600,
  DRIVER_AMD_RX, DRIVER_INTEL_GMA800, DRIVER_INTEL_GMA900, DRIVER_INTEL_GMA950,
  DRIVER_INTEL_GMA3000, DRIVER_INTEL_HD4000, DRIVER_NVIDIA_TNT, DRIVER_NVIDIA_GEFORCE2MX,
  DRIVER_NVIDIA_GEFORCEFX, DRIVER_NVIDIA_GEFORCE6, DRIVER_NVIDIA_GEFORCE8, DRIVER_VMWARE,
  DRIVER_UNKNOWN
}
 
enum  wined3d_driver_model {
  DRIVER_MODEL_GENERIC, DRIVER_MODEL_WIN9X, DRIVER_MODEL_NT40, DRIVER_MODEL_NT5X,
  DRIVER_MODEL_NT6X
}
 
enum  wined3d_gl_vendor {
  GL_VENDOR_UNKNOWN, GL_VENDOR_APPLE, GL_VENDOR_FGLRX, GL_VENDOR_MESA,
  GL_VENDOR_NVIDIA
}
 
enum  wined3d_d3d_level {
  WINED3D_D3D_LEVEL_5, WINED3D_D3D_LEVEL_6, WINED3D_D3D_LEVEL_7, WINED3D_D3D_LEVEL_8,
  WINED3D_D3D_LEVEL_9_SM2, WINED3D_D3D_LEVEL_9_SM3, WINED3D_D3D_LEVEL_10, WINED3D_D3D_LEVEL_11,
  WINED3D_D3D_LEVEL_COUNT
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d)
 
 WINE_DECLARE_DEBUG_CHANNEL (d3d_perf)
 
 WINE_DECLARE_DEBUG_CHANNEL (winediag)
 
static void wined3d_caps_gl_ctx_destroy (const struct wined3d_caps_gl_ctx *ctx)
 
static BOOL wined3d_caps_gl_ctx_create_attribs (struct wined3d_caps_gl_ctx *caps_gl_ctx, struct wined3d_gl_info *gl_info)
 
static BOOL wined3d_caps_gl_ctx_create (struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
 
UINT64 adapter_adjust_memory (struct wined3d_adapter *adapter, INT64 amount)
 
static void wined3d_adapter_cleanup (struct wined3d_adapter *adapter)
 
ULONG CDECL wined3d_incref (struct wined3d *wined3d)
 
ULONG CDECL wined3d_decref (struct wined3d *wined3d)
 
static BOOL test_arb_vs_offset_limit (const struct wined3d_gl_info *gl_info)
 
static BOOL match_amd_r300_to_500 (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_geforce5 (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_apple (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static void test_pbo_functionality (struct wined3d_gl_info *gl_info)
 
static BOOL match_apple_intel (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_apple_nonr500ati (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_dx10_capable (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_not_dx10_capable (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_allows_spec_alpha (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_broken_nv_clip (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_fbo_tex_update (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_broken_rgba16 (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_fglrx (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_r200 (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_broken_arb_fog (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static BOOL match_broken_viewport_subpixel_bits (const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static void quirk_apple_glsl_constants (struct wined3d_gl_info *gl_info)
 
static void quirk_amd_dx9 (struct wined3d_gl_info *gl_info)
 
static void quirk_no_np2 (struct wined3d_gl_info *gl_info)
 
static void quirk_texcoord_w (struct wined3d_gl_info *gl_info)
 
static void quirk_clip_varying (struct wined3d_gl_info *gl_info)
 
static void quirk_allows_specular_alpha (struct wined3d_gl_info *gl_info)
 
static void quirk_disable_nvvp_clip (struct wined3d_gl_info *gl_info)
 
static void quirk_fbo_tex_update (struct wined3d_gl_info *gl_info)
 
static void quirk_broken_rgba16 (struct wined3d_gl_info *gl_info)
 
static void quirk_infolog_spam (struct wined3d_gl_info *gl_info)
 
static void quirk_limited_tex_filtering (struct wined3d_gl_info *gl_info)
 
static void quirk_r200_constants (struct wined3d_gl_info *gl_info)
 
static void quirk_broken_arb_fog (struct wined3d_gl_info *gl_info)
 
static void quirk_broken_viewport_subpixel_bits (struct wined3d_gl_info *gl_info)
 
static const struct driver_version_informationget_driver_version_info (enum wined3d_display_driver driver, enum wined3d_driver_model driver_model)
 
static const struct gpu_descriptionget_gpu_description (enum wined3d_pci_vendor vendor, enum wined3d_pci_device device)
 
static const struct gpu_descriptionquery_gpu_description (const struct wined3d_gl_info *gl_info, UINT64 *vram_bytes)
 
static void init_driver_info (struct wined3d_driver_info *driver_info, const struct gpu_description *gpu_desc, UINT64 vram_bytes)
 
static void fixup_extensions (struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
 
static DWORD wined3d_parse_gl_version (const char *gl_version)
 
static enum wined3d_gl_vendor wined3d_guess_gl_vendor (const struct wined3d_gl_info *gl_info, const char *gl_vendor_string, const char *gl_renderer, const char *gl_version)
 
static enum wined3d_pci_vendor wined3d_guess_card_vendor (const char *gl_vendor_string, const char *gl_renderer)
 
static enum wined3d_d3d_level d3d_level_from_caps (const struct shader_caps *shader_caps, const struct fragment_caps *fragment_caps, DWORD glsl_version)
 
 C_ASSERT (ARRAY_SIZE(card_fallback_nvidia)==WINED3D_D3D_LEVEL_COUNT)
 
 C_ASSERT (ARRAY_SIZE(card_fallback_amd)==WINED3D_D3D_LEVEL_COUNT)
 
 C_ASSERT (ARRAY_SIZE(card_fallback_intel)==WINED3D_D3D_LEVEL_COUNT)
 
static enum wined3d_pci_device select_card_handler (const struct gl_vendor_selection *table, unsigned int table_size, enum wined3d_gl_vendor gl_vendor, const char *gl_renderer)
 
static enum wined3d_pci_device wined3d_guess_card (const struct shader_caps *shader_caps, const struct fragment_caps *fragment_caps, DWORD glsl_version, const char *gl_renderer, enum wined3d_gl_vendor *gl_vendor, enum wined3d_pci_vendor *card_vendor)
 
static const struct wined3d_vertex_pipe_opsselect_vertex_implementation (const struct wined3d_gl_info *gl_info, const struct wined3d_shader_backend_ops *shader_backend_ops)
 
static const struct fragment_pipelineselect_fragment_implementation (const struct wined3d_gl_info *gl_info, const struct wined3d_shader_backend_ops *shader_backend_ops)
 
static const struct wined3d_shader_backend_opsselect_shader_backend (const struct wined3d_gl_info *gl_info)
 
static void parse_extension_string (struct wined3d_gl_info *gl_info, const char *extensions, const struct wined3d_extension_map *map, UINT entry_count)
 
static void enumerate_gl_extensions (struct wined3d_gl_info *gl_info, const struct wined3d_extension_map *map, unsigned int map_entries_count)
 
static void load_gl_funcs (struct wined3d_gl_info *gl_info)
 
static void wined3d_adapter_init_limits (struct wined3d_gl_info *gl_info)
 
static BOOL wined3d_adapter_init_gl_caps (struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *caps_gl_ctx, DWORD wined3d_creation_flags)
 
UINT CDECL wined3d_get_adapter_count (const struct wined3d *wined3d)
 
HRESULT CDECL wined3d_register_software_device (struct wined3d *wined3d, void *init_function)
 
HRESULT CDECL wined3d_get_output_desc (const struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_output_desc *desc)
 
UINT CDECL wined3d_get_adapter_mode_count (const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering)
 
HRESULT CDECL wined3d_enum_adapter_modes (const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering, UINT mode_idx, struct wined3d_display_mode *mode)
 
HRESULT CDECL wined3d_find_closest_matching_adapter_mode (const struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_display_mode *mode)
 
HRESULT CDECL wined3d_get_adapter_display_mode (const struct wined3d *wined3d, UINT adapter_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
 
HRESULT CDECL wined3d_set_adapter_display_mode (struct wined3d *wined3d, UINT adapter_idx, const struct wined3d_display_mode *mode)
 
HRESULT CDECL wined3d_get_adapter_identifier (const struct wined3d *wined3d, UINT adapter_idx, DWORD flags, struct wined3d_adapter_identifier *identifier)
 
HRESULT CDECL wined3d_get_adapter_raster_status (const struct wined3d *wined3d, UINT adapter_idx, struct wined3d_raster_status *raster_status)
 
static BOOL wined3d_check_pixel_format_color (const struct wined3d_gl_info *gl_info, const struct wined3d_pixel_format *cfg, const struct wined3d_format *format)
 
static BOOL wined3d_check_pixel_format_depth (const struct wined3d_gl_info *gl_info, const struct wined3d_pixel_format *cfg, const struct wined3d_format *format)
 
HRESULT CDECL wined3d_check_depth_stencil_match (const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id)
 
HRESULT CDECL wined3d_check_device_multisample_type (const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id surface_format_id, BOOL windowed, enum wined3d_multisample_type multisample_type, DWORD *quality_levels)
 
static BOOL CheckDepthStencilCapability (const struct wined3d_adapter *adapter, const struct wined3d_format *display_format, const struct wined3d_format *ds_format, enum wined3d_gl_resource_type gl_type)
 
static BOOL CheckRenderTargetCapability (const struct wined3d_adapter *adapter, const struct wined3d_format *adapter_format, const struct wined3d_format *check_format, enum wined3d_gl_resource_type gl_type)
 
static BOOL wined3d_check_surface_capability (const struct wined3d_format *format, BOOL no3d)
 
HRESULT CDECL wined3d_check_device_format (const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
 
UINT CDECL wined3d_calculate_format_pitch (const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, UINT width)
 
HRESULT CDECL wined3d_check_device_format_conversion (const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id src_format, enum wined3d_format_id dst_format)
 
HRESULT CDECL wined3d_check_device_type (const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id display_format, enum wined3d_format_id backbuffer_format, BOOL windowed)
 
HRESULT CDECL wined3d_get_device_caps (const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, WINED3DCAPS *caps)
 
HRESULT CDECL wined3d_device_create (struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, HWND focus_window, DWORD flags, BYTE surface_alignment, struct wined3d_device_parent *device_parent, struct wined3d_device **device)
 
static void WINE_GLAPI invalid_func (const void *data)
 
static void WINE_GLAPI invalid_texcoord_func (GLenum unit, const void *data)
 
static void WINE_GLAPI invalid_generic_attrib_func (GLuint idx, const void *data)
 
static void WINE_GLAPI position_d3dcolor (const void *data)
 
static void WINE_GLAPI position_float4 (const void *data)
 
static void WINE_GLAPI diffuse_d3dcolor (const void *data)
 
static void WINE_GLAPI specular_d3dcolor (const void *data)
 
static void WINE_GLAPI warn_no_specular_func (const void *data)
 
static void WINE_GLAPI generic_d3dcolor (GLuint idx, const void *data)
 
static void WINE_GLAPI generic_short2n (GLuint idx, const void *data)
 
static void WINE_GLAPI generic_ushort2n (GLuint idx, const void *data)
 
static void WINE_GLAPI generic_float16_2 (GLuint idx, const void *data)
 
static void WINE_GLAPI generic_float16_4 (GLuint idx, const void *data)
 
static void wined3d_adapter_init_ffp_attrib_ops (struct wined3d_adapter *adapter)
 
static void wined3d_adapter_init_fb_cfgs (struct wined3d_adapter *adapter, HDC dc)
 
static DWORD get_max_gl_version (const struct wined3d_gl_info *gl_info, DWORD flags)
 
static BOOL has_extension (const char *list, const char *ext)
 
static BOOL wined3d_adapter_init (struct wined3d_adapter *adapter, UINT ordinal, DWORD wined3d_creation_flags)
 
static BOOL wined3d_adapter_init_nogl (struct wined3d_adapter *adapter, UINT ordinal)
 
static void STDMETHODCALLTYPE wined3d_null_wined3d_object_destroyed (void *parent)
 
HRESULT wined3d_init (struct wined3d *wined3d, DWORD flags)
 

Variables

static const GUID IID_D3DDEVICE_D3DUID = { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } }
 
static const struct wined3d_extension_map gl_extension_map []
 
static const struct wined3d_extension_map wgl_extension_map []
 
const struct min_lookup minMipLookup []
 
const GLenum magLookup []
 
static const struct driver_quirk quirk_table []
 
static const struct driver_version_information driver_version_table []
 
static const struct gpu_description gpu_description_table []
 
static const struct wined3d_renderer_table cards_nvidia_binary []
 
static const struct wined3d_renderer_table cards_amd_binary []
 
static const struct wined3d_renderer_table cards_intel []
 
static const struct wined3d_renderer_table cards_amd_mesa []
 
static const struct wined3d_renderer_table cards_nvidia_mesa []
 
static const struct wined3d_renderer_table cards_vmware []
 
static const struct gl_vendor_selection amd_gl_vendor_table []
 
static const struct gl_vendor_selection nvidia_gl_vendor_table []
 
static const struct gl_vendor_selection vmware_gl_vendor_table []
 
static const struct gl_vendor_selection intel_gl_vendor_table []
 
static enum wined3d_pci_device card_fallback_nvidia []
 
static enum wined3d_pci_device card_fallback_amd []
 
static enum wined3d_pci_device card_fallback_intel []
 
struct {
   enum wined3d_pci_vendor   card_vendor
 
   const char *   description
 
   const struct gl_vendor_selection *   gl_vendor_selection
 
   unsigned int   gl_vendor_count
 
   enum wined3d_pci_device *   card_fallback
 
card_vendor_table []
 
const struct wined3d_parent_ops wined3d_null_parent_ops
 

Macro Definition Documentation

◆ DEFAULT_REFRESH_RATE

#define DEFAULT_REFRESH_RATE   0

Definition at line 36 of file directx.c.

◆ MAP_GL_FUNCTION

#define MAP_GL_FUNCTION (   core_func,
  ext_func 
)
Value:
do \
{ \
if (!gl_info->gl_ops.ext.p_##core_func) \
gl_info->gl_ops.ext.p_##core_func = gl_info->gl_ops.ext.p_##ext_func; \
} while (0)

◆ MAP_GL_FUNCTION_CAST

#define MAP_GL_FUNCTION_CAST (   core_func,
  ext_func 
)
Value:
do \
{ \
if (!gl_info->gl_ops.ext.p_##core_func) \
gl_info->gl_ops.ext.p_##core_func = (void *)gl_info->gl_ops.ext.p_##ext_func; \
} while (0)

◆ USE_GL_FUNC

#define USE_GL_FUNC (   pfn)    gl_info->gl_ops.ext.p_##pfn = (void *)wglGetProcAddress(#pfn);

Enumeration Type Documentation

◆ wined3d_d3d_level

Enumerator
WINED3D_D3D_LEVEL_5 
WINED3D_D3D_LEVEL_6 
WINED3D_D3D_LEVEL_7 
WINED3D_D3D_LEVEL_8 
WINED3D_D3D_LEVEL_9_SM2 
WINED3D_D3D_LEVEL_9_SM3 
WINED3D_D3D_LEVEL_10 
WINED3D_D3D_LEVEL_11 
WINED3D_D3D_LEVEL_COUNT 

Definition at line 80 of file directx.c.

◆ wined3d_display_driver

Enumerator
DRIVER_AMD_RAGE_128PRO 
DRIVER_AMD_R100 
DRIVER_AMD_R300 
DRIVER_AMD_R600 
DRIVER_AMD_RX 
DRIVER_INTEL_GMA800 
DRIVER_INTEL_GMA900 
DRIVER_INTEL_GMA950 
DRIVER_INTEL_GMA3000 
DRIVER_INTEL_HD4000 
DRIVER_NVIDIA_TNT 
DRIVER_NVIDIA_GEFORCE2MX 
DRIVER_NVIDIA_GEFORCEFX 
DRIVER_NVIDIA_GEFORCE6 
DRIVER_NVIDIA_GEFORCE8 
DRIVER_VMWARE 
DRIVER_UNKNOWN 

Definition at line 41 of file directx.c.

◆ wined3d_driver_model

Enumerator
DRIVER_MODEL_GENERIC 
DRIVER_MODEL_WIN9X 
DRIVER_MODEL_NT40 
DRIVER_MODEL_NT5X 
DRIVER_MODEL_NT6X 

Definition at line 62 of file directx.c.

◆ wined3d_gl_vendor

Enumerator
GL_VENDOR_UNKNOWN 
GL_VENDOR_APPLE 
GL_VENDOR_FGLRX 
GL_VENDOR_MESA 
GL_VENDOR_NVIDIA 

Definition at line 71 of file directx.c.

Function Documentation

◆ adapter_adjust_memory()

UINT64 adapter_adjust_memory ( struct wined3d_adapter adapter,
INT64  amount 
)

Definition at line 441 of file directx.c.

442 {
443  adapter->vram_bytes_used += amount;
444  TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n",
445  wine_dbgstr_longlong(amount),
447  return adapter->vram_bytes_used;
448 }
#define TRACE(s)
Definition: solgame.cpp:4
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41

Referenced by resource_cleanup(), and resource_init().

◆ C_ASSERT() [1/3]

◆ C_ASSERT() [2/3]

◆ C_ASSERT() [3/3]

◆ CheckDepthStencilCapability()

static BOOL CheckDepthStencilCapability ( const struct wined3d_adapter adapter,
const struct wined3d_format display_format,
const struct wined3d_format ds_format,
enum wined3d_gl_resource_type  gl_type 
)
static

Definition at line 5190 of file directx.c.

5193 {
5194  /* Only allow depth/stencil formats */
5195  if (!(ds_format->depth_size || ds_format->stencil_size)) return FALSE;
5196 
5197  /* Blacklist formats not supported on Windows */
5198  switch (ds_format->id)
5199  {
5200  case WINED3DFMT_S1_UINT_D15_UNORM: /* Breaks the shadowvol2 dx7 sdk sample */
5202  TRACE("[FAILED] - not supported on windows.\n");
5203  return FALSE;
5204 
5205  default:
5206  break;
5207  }
5208 
5210  {
5211  /* With FBOs WGL limitations do not apply, but the format needs to be FBO attachable */
5212  if (ds_format->flags[gl_type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
5213  return TRUE;
5214  }
5215  else
5216  {
5217  unsigned int i;
5218 
5219  /* Walk through all WGL pixel formats to find a match */
5220  for (i = 0; i < adapter->cfg_count; ++i)
5221  {
5222  const struct wined3d_pixel_format *cfg = &adapter->cfgs[i];
5223  if (wined3d_check_pixel_format_color(&adapter->gl_info, cfg, display_format)
5224  && wined3d_check_pixel_format_depth(&adapter->gl_info, cfg, ds_format))
5225  return TRUE;
5226  }
5227  }
5228 
5229  return FALSE;
5230 }
#define ORM_FBO
#define WINED3DFMT_FLAG_STENCIL
#define TRUE
Definition: types.h:120
struct wined3d_pixel_format * cfgs
unsigned int cfg_count
static BOOL wined3d_check_pixel_format_color(const struct wined3d_gl_info *gl_info, const struct wined3d_pixel_format *cfg, const struct wined3d_format *format)
Definition: directx.c:5041
struct wined3d_gl_info gl_info
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL wined3d_check_pixel_format_depth(const struct wined3d_gl_info *gl_info, const struct wined3d_pixel_format *cfg, const struct wined3d_format *format)
Definition: directx.c:5061
enum wined3d_format_id id
unsigned int flags[WINED3D_GL_RES_TYPE_COUNT]
#define WINED3DFMT_FLAG_DEPTH

Referenced by wined3d_check_device_format().

◆ CheckRenderTargetCapability()

static BOOL CheckRenderTargetCapability ( const struct wined3d_adapter adapter,
const struct wined3d_format adapter_format,
const struct wined3d_format check_format,
enum wined3d_gl_resource_type  gl_type 
)
static

Definition at line 5233 of file directx.c.

5236 {
5237  /* Filter out non-RT formats */
5238  if (!(check_format->flags[gl_type] & WINED3DFMT_FLAG_RENDERTARGET))
5239  return FALSE;
5241  return TRUE;
5243  {
5244  const struct wined3d_pixel_format *cfgs = adapter->cfgs;
5245  unsigned int i;
5246 
5247  /* In backbuffer mode the front and backbuffer share the same WGL
5248  * pixelformat. The format must match in RGB, alpha is allowed to be
5249  * different. (Only the backbuffer can have alpha.) */
5250  if (adapter_format->red_size != check_format->red_size
5251  || adapter_format->green_size != check_format->green_size
5252  || adapter_format->blue_size != check_format->blue_size)
5253  {
5254  TRACE("[FAILED]\n");
5255  return FALSE;
5256  }
5257 
5258  /* Check if there is a WGL pixel format matching the requirements, the format should also be window
5259  * drawable (not offscreen; e.g. Nvidia offers R5G6B5 for pbuffers even when X is running at 24bit) */
5260  for (i = 0; i < adapter->cfg_count; ++i)
5261  {
5262  if (cfgs[i].windowDrawable
5263  && wined3d_check_pixel_format_color(&adapter->gl_info, &cfgs[i], check_format))
5264  {
5265  TRACE("Pixel format %d is compatible with format %s.\n",
5267  return TRUE;
5268  }
5269  }
5270  }
5271  return FALSE;
5272 }
#define ORM_FBO
#define TRUE
Definition: types.h:120
struct wined3d_pixel_format * cfgs
unsigned int cfg_count
static BOOL wined3d_check_pixel_format_color(const struct wined3d_gl_info *gl_info, const struct wined3d_pixel_format *cfg, const struct wined3d_format *format)
Definition: directx.c:5041
struct wined3d_gl_info gl_info
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static BOOL check_format(LPSTR path, LPSTR inf)
Definition: misc.c:87
#define ORM_BACKBUFFER
#define TRACE(s)
Definition: solgame.cpp:4
#define WINED3DFMT_FLAG_RENDERTARGET
_In_ LONG iPixelFormat
Definition: winddi.h:3488
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:3973

Referenced by wined3d_check_device_format().

◆ d3d_level_from_caps()

static enum wined3d_d3d_level d3d_level_from_caps ( const struct shader_caps shader_caps,
const struct fragment_caps fragment_caps,
DWORD  glsl_version 
)
static

Definition at line 1869 of file directx.c.

1870 {
1871  if (shader_caps->vs_version >= 5)
1872  return WINED3D_D3D_LEVEL_11;
1873  if (shader_caps->vs_version == 4)
1874  return WINED3D_D3D_LEVEL_10;
1875  if (shader_caps->vs_version == 3)
1876  {
1877  /* wined3d with default settings at the moment doesn't expose SM4+ on
1878  * Mesa drivers. */
1879  if (glsl_version >= MAKEDWORD_VERSION(4, 30))
1880  return WINED3D_D3D_LEVEL_11;
1881  if (glsl_version >= MAKEDWORD_VERSION(1, 30))
1882  return WINED3D_D3D_LEVEL_10;
1883  return WINED3D_D3D_LEVEL_9_SM3;
1884  }
1885  if (shader_caps->vs_version == 2)
1886  return WINED3D_D3D_LEVEL_9_SM2;
1887  if (shader_caps->vs_version == 1)
1888  return WINED3D_D3D_LEVEL_8;
1889 
1891  return WINED3D_D3D_LEVEL_7;
1893  return WINED3D_D3D_LEVEL_6;
1894 
1895  return WINED3D_D3D_LEVEL_5;
1896 }
unsigned int vs_version
#define WINED3DTEXOPCAPS_DOTPRODUCT3
Definition: wined3d.h:1168
DWORD MaxSimultaneousTextures
#define MAKEDWORD_VERSION(maj, min)

Referenced by wined3d_guess_card().

◆ diffuse_d3dcolor()

static void WINE_GLAPI diffuse_d3dcolor ( const void data)
static

Definition at line 6327 of file directx.c.

6328 {
6329  DWORD diffuseColor = *((const DWORD *)data);
6330 
6331  context_get_current()->gl_info->gl_ops.gl.p_glColor4ub(D3DCOLOR_B_R(diffuseColor),
6332  D3DCOLOR_B_G(diffuseColor),
6333  D3DCOLOR_B_B(diffuseColor),
6334  D3DCOLOR_B_A(diffuseColor));
6335 }
struct wined3d_context * context_get_current(void)
Definition: context.c:1507
#define D3DCOLOR_B_B(dw)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define D3DCOLOR_B_G(dw)
#define D3DCOLOR_B_R(dw)
#define D3DCOLOR_B_A(dw)

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ enumerate_gl_extensions()

static void enumerate_gl_extensions ( struct wined3d_gl_info gl_info,
const struct wined3d_extension_map map,
unsigned int  map_entries_count 
)
static

Definition at line 2672 of file directx.c.

2674 {
2675  const char *gl_extension_name;
2676  unsigned int i, j;
2677  GLint extensions_count;
2678 
2679  gl_info->gl_ops.gl.p_glGetIntegerv(GL_NUM_EXTENSIONS, &extensions_count);
2680  for (i = 0; i < extensions_count; ++i)
2681  {
2682  gl_extension_name = (const char *)GL_EXTCALL(glGetStringi(GL_EXTENSIONS, i));
2683  TRACE("- %s.\n", debugstr_a(gl_extension_name));
2684  for (j = 0; j < map_entries_count; ++j)
2685  {
2686  if (!strcmp(gl_extension_name, map[j].extension_string))
2687  {
2688  TRACE("FOUND: %s support.\n", map[j].extension_string);
2689  gl_info->supported[map[j].extension] = TRUE;
2690  break;
2691  }
2692  }
2693  }
2694 }
#define TRUE
Definition: types.h:120
struct opengl_funcs gl_ops
#define GL_EXTENSIONS
Definition: gl.h:690
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 supported[WINED3D_GL_EXT_COUNT]
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 GL_EXTCALL(f)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
Definition: _map.h:44
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int GLint
Definition: gl.h:156
#define GL_NUM_EXTENSIONS
Definition: glext.h:517

Referenced by wined3d_adapter_init_gl_caps().

◆ fixup_extensions()

static void fixup_extensions ( struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 1748 of file directx.c.

1751 {
1752  unsigned int i;
1753 
1754  for (i = 0; i < ARRAY_SIZE(quirk_table); ++i)
1755  {
1756  if (!quirk_table[i].match(gl_info, ctx, gl_renderer, gl_vendor, card_vendor, device)) continue;
1757  TRACE("Applying driver quirk \"%s\".\n", quirk_table[i].description);
1758  quirk_table[i].apply(gl_info);
1759  }
1760 
1761  /* Find out if PBOs work as they are supposed to. */
1762  test_pbo_functionality(gl_info);
1763 }
const char * description
Definition: directx.c:2497
static void test_pbo_functionality(struct wined3d_gl_info *gl_info)
Definition: directx.c:570
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: devices.h:37
struct match match
Definition: match.c:33
#define TRACE(s)
Definition: solgame.cpp:4
static const struct driver_quirk quirk_table[]
Definition: directx.c:1094
#define ARRAY_SIZE(a)
Definition: main.h:24
enum wined3d_pci_vendor card_vendor
Definition: directx.c:2496

Referenced by wined3d_adapter_init_gl_caps().

◆ generic_d3dcolor()

static void WINE_GLAPI generic_d3dcolor ( GLuint  idx,
const void data 
)
static

Definition at line 6355 of file directx.c.

6356 {
6357  DWORD color = *((const DWORD *)data);
6358 
6359  context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib4Nub(idx,
6362 }
GLuint color
Definition: glext.h:6243
unsigned int idx
Definition: utils.c:41
struct wined3d_context * context_get_current(void)
Definition: context.c:1507
#define D3DCOLOR_B_B(dw)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define D3DCOLOR_B_G(dw)
#define D3DCOLOR_B_R(dw)
#define D3DCOLOR_B_A(dw)

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ generic_float16_2()

static void WINE_GLAPI generic_float16_2 ( GLuint  idx,
const void data 
)
static

Definition at line 6378 of file directx.c.

6379 {
6380  float x = float_16_to_32(((const unsigned short *)data) + 0);
6381  float y = float_16_to_32(((const unsigned short *)data) + 1);
6382 
6383  context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib2f(idx, x, y);
6384 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned int idx
Definition: utils.c:41
struct wined3d_context * context_get_current(void)
Definition: context.c:1507
float float_16_to_32(const unsigned short in) DECLSPEC_HIDDEN
Definition: math.c:2247
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ generic_float16_4()

static void WINE_GLAPI generic_float16_4 ( GLuint  idx,
const void data 
)
static

Definition at line 6386 of file directx.c.

6387 {
6388  float x = float_16_to_32(((const unsigned short *)data) + 0);
6389  float y = float_16_to_32(((const unsigned short *)data) + 1);
6390  float z = float_16_to_32(((const unsigned short *)data) + 2);
6391  float w = float_16_to_32(((const unsigned short *)data) + 3);
6392 
6393  context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib4f(idx, x, y, z, w);
6394 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned int idx
Definition: utils.c:41
GLdouble GLdouble z
Definition: glext.h:5874
struct wined3d_context * context_get_current(void)
Definition: context.c:1507
float float_16_to_32(const unsigned short in) DECLSPEC_HIDDEN
Definition: math.c:2247
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ generic_short2n()

static void WINE_GLAPI generic_short2n ( GLuint  idx,
const void data 
)
static

Definition at line 6364 of file directx.c.

6365 {
6366  const GLshort s[] = {((const GLshort *)data)[0], ((const GLshort *)data)[1], 0, 1};
6367 
6368  context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib4Nsv(idx, s);
6369 }
unsigned int idx
Definition: utils.c:41
struct wined3d_context * context_get_current(void)
Definition: context.c:1507
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble s
Definition: gl.h:2039
short GLshort
Definition: gl.h:155

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ generic_ushort2n()

static void WINE_GLAPI generic_ushort2n ( GLuint  idx,
const void data 
)
static

Definition at line 6371 of file directx.c.

6372 {
6373  const GLushort s[] = {((const GLushort *)data)[0], ((const GLushort *)data)[1], 0, 1};
6374 
6375  context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib4Nusv(idx, s);
6376 }
unsigned int idx
Definition: utils.c:41
struct wined3d_context * context_get_current(void)
Definition: context.c:1507
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble s
Definition: gl.h:2039
unsigned short GLushort
Definition: gl.h:158

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ get_driver_version_info()

static const struct driver_version_information* get_driver_version_info ( enum wined3d_display_driver  driver,
enum wined3d_driver_model  driver_model 
)
static

Definition at line 1531 of file directx.c.

1533 {
1534  unsigned int i;
1535 
1536  TRACE("Looking up version info for driver=%d driver_model=%d\n", driver, driver_model);
1537  for (i = 0; i < ARRAY_SIZE(driver_version_table); ++i)
1538  {
1540 
1541  if (entry->driver == driver && (driver_model == DRIVER_MODEL_GENERIC
1542  || entry->driver_model == driver_model))
1543  {
1544  TRACE("Found driver \"%s\", version %u, subversion %u, build %u.\n",
1545  entry->driver_name, entry->version, entry->subversion, entry->build);
1546  return entry;
1547  }
1548  }
1549  return NULL;
1550 }
enum wined3d_driver_model driver_model
Definition: directx.c:1214
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
struct @1605::@1606 driver
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t entry
Definition: isohybrid.c:63
static const struct driver_version_information driver_version_table[]
Definition: directx.c:1222
#define ARRAY_SIZE(a)
Definition: main.h:24

Referenced by init_driver_info().

◆ get_gpu_description()

static const struct gpu_description* get_gpu_description ( enum wined3d_pci_vendor  vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 1552 of file directx.c.

1554 {
1555  unsigned int i;
1556 
1557  for (i = 0; i < ARRAY_SIZE(gpu_description_table); ++i)
1558  {
1560  return &gpu_description_table[i];
1561  }
1562 
1563  return NULL;
1564 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
static const struct gpu_description gpu_description_table[]
Definition: directx.c:1279
const WCHAR * vendor
Definition: db.cpp:863
#define ARRAY_SIZE(a)
Definition: main.h:24

Referenced by query_gpu_description(), and wined3d_adapter_init_gl_caps().

◆ get_max_gl_version()

static DWORD get_max_gl_version ( const struct wined3d_gl_info gl_info,
DWORD  flags 
)
static

Definition at line 6618 of file directx.c.

6619 {
6620  const char *gl_vendor, *gl_renderer;
6621 
6624 
6625  gl_vendor = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_VENDOR);
6626  gl_renderer = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_RENDERER);
6627  if (!gl_vendor || !gl_renderer
6628  || wined3d_guess_card_vendor(gl_vendor, gl_renderer) == HW_VENDOR_NVIDIA)
6630 
6631  return MAKEDWORD_VERSION(4, 4);
6632 }
struct opengl_funcs gl_ops
#define GL_RENDERER
Definition: gl.h:688
#define GL_VENDOR
Definition: gl.h:687
static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_string, const char *gl_renderer)
Definition: directx.c:1828
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1322
GLbitfield flags
Definition: glext.h:7161
#define MAKEDWORD_VERSION(maj, min)

Referenced by wined3d_adapter_init().

◆ has_extension()

static BOOL has_extension ( const char list,
const char ext 
)
static

Definition at line 6634 of file directx.c.

6635 {
6636  size_t len = strlen(ext);
6637  while (list)
6638  {
6639  while (*list == ' ') list++;
6640  if (!strncmp(list, ext, len) && (!list[len] || list[len] == ' ')) return TRUE;
6641  list = strchr(list, ' ');
6642  }
6643  return FALSE;
6644 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char ext[3]
Definition: mkdosfs.c:358
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
GLenum GLsizei len
Definition: glext.h:6722
Definition: _list.h:228
char * strchr(const char *String, int ch)
Definition: utclib.c:501

Referenced by wined3d_adapter_init().

◆ init_driver_info()

static void init_driver_info ( struct wined3d_driver_info driver_info,
const struct gpu_description gpu_desc,
UINT64  vram_bytes 
)
static

Diablo 2 crashes when the amount of video memory is greater than 0x7fffffff. In order to avoid this application bug we limit the amount of video memory to LONG_MAX for older Windows versions.

Definition at line 1623 of file directx.c.

1625 {
1626  OSVERSIONINFOW os_version;
1627  WORD driver_os_version;
1630  const struct driver_version_information *version_info;
1631 
1632  memset(&os_version, 0, sizeof(os_version));
1633  os_version.dwOSVersionInfoSize = sizeof(os_version);
1634  if (!GetVersionExW(&os_version))
1635  {
1636  ERR("Failed to get OS version, reporting 2000/XP.\n");
1637  driver_os_version = 6;
1639  }
1640  else
1641  {
1642  TRACE("OS version %u.%u.\n", os_version.dwMajorVersion, os_version.dwMinorVersion);
1643  switch (os_version.dwMajorVersion)
1644  {
1645  case 4:
1646  /* If needed we could distinguish between 9x and NT4, but this code won't make
1647  * sense for NT4 since it had no way to obtain this info through DirectDraw 3.0.
1648  */
1649  driver_os_version = 4;
1651  break;
1652 
1653  case 5:
1654  driver_os_version = 6;
1656  break;
1657 
1658  case 6:
1659  if (os_version.dwMinorVersion == 0)
1660  {
1661  driver_os_version = 7;
1663  }
1664  else if (os_version.dwMinorVersion == 1)
1665  {
1666  driver_os_version = 8;
1668  }
1669  else
1670  {
1671  if (os_version.dwMinorVersion > 2)
1672  {
1673  FIXME("Unhandled OS version %u.%u, reporting Win 8.\n",
1674  os_version.dwMajorVersion, os_version.dwMinorVersion);
1675  }
1676  driver_os_version = 9;
1678  }
1679  break;
1680 
1681  case 10:
1682  driver_os_version = 10;
1684  break;
1685 
1686  default:
1687  FIXME("Unhandled OS version %u.%u, reporting 2000/XP.\n",
1688  os_version.dwMajorVersion, os_version.dwMinorVersion);
1689  driver_os_version = 6;
1691  break;
1692  }
1693  }
1694 
1695  driver_info->vendor = gpu_desc->vendor;
1696  driver_info->device = gpu_desc->card;
1697  driver_info->description = gpu_desc->description;
1698  driver_info->vram_bytes = vram_bytes ? vram_bytes : (UINT64)gpu_desc->vidmem * 1024 * 1024;
1699  driver = gpu_desc->driver;
1700 
1706 #ifdef __i386__
1707  if (driver_model < DRIVER_MODEL_NT6X && driver_info->vram_bytes > LONG_MAX)
1708  {
1709  TRACE("Limiting amount of video memory to %#lx bytes for OS version older than Vista.\n", LONG_MAX);
1710  driver_info->vram_bytes = LONG_MAX;
1711  }
1712 #endif
1713 
1714  /* Try to obtain driver version information for the current Windows version. This fails in
1715  * some cases:
1716  * - the gpu is not available on the currently selected OS version:
1717  * - Geforce GTX480 on Win98. When running applications in compatibility mode on Windows,
1718  * version information for the current Windows version is returned instead of faked info.
1719  * We do the same and assume the default Windows version to emulate is WinXP.
1720  *
1721  * - Videocard is a Riva TNT but winver is set to win7 (there are no drivers for this beast)
1722  * For now return the XP driver info. Perhaps later on we should return VESA.
1723  *
1724  * - the gpu is not in our database (can happen when the user overrides the vendor_id / device_id)
1725  * This could be an indication that our database is not up to date, so this should be fixed.
1726  */
1727  if ((version_info = get_driver_version_info(driver, driver_model))
1728  || (version_info = get_driver_version_info(driver, DRIVER_MODEL_GENERIC)))
1729  {
1730  driver_info->name = version_info->driver_name;
1731  driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, version_info->version);
1732  driver_info->version_low = MAKEDWORD_VERSION(version_info->subversion, version_info->build);
1733  }
1734  else
1735  {
1736  ERR("No driver version info found for device %04x:%04x, driver model %#x.\n",
1737  driver_info->vendor, driver_info->device, driver_model);
1738  driver_info->name = "Display";
1739  driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, 15);
1740  driver_info->version_low = MAKEDWORD_VERSION(8, 6); /* Nvidia RIVA TNT, arbitrary */
1741  }
1742 
1743  TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n",
1744  driver_info->version_high, driver_info->version_low);
1745 }
enum wined3d_pci_vendor vendor
unsigned int vidmem
Definition: directx.c:1274
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
const char * description
Definition: directx.c:1272
wined3d_driver_model
Definition: directx.c:62
enum wined3d_driver_model driver_model
Definition: directx.c:1214
#define FIXME(fmt,...)
Definition: debug.h:110
struct @1605::@1606 driver
#define TRACE(s)
Definition: solgame.cpp:4
ULONG dwMajorVersion
Definition: rtltypes.h:243
if(!(yy_init))
Definition: macro.lex.yy.c:714
static const struct driver_version_information * get_driver_version_info(enum wined3d_display_driver driver, enum wined3d_driver_model driver_model)
Definition: directx.c:1531
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:242
unsigned short WORD
Definition: ntddk_ex.h:93
enum wined3d_pci_device device
#define LONG_MAX
Definition: limits.h:43
#define MAKEDWORD_VERSION(maj, min)
#define ERR(fmt,...)
Definition: debug.h:109
enum wined3d_display_driver driver
Definition: directx.c:1273
ULONG dwMinorVersion
Definition: rtltypes.h:244
const char * description
const char * driver_name
Definition: directx.c:1215
wined3d_display_driver
Definition: directx.c:41
unsigned long long UINT64
#define memset(x, y, z)
Definition: compat.h:39

Referenced by wined3d_adapter_init_gl_caps().

◆ invalid_func()

static void WINE_GLAPI invalid_func ( const void data)
static

Definition at line 6279 of file directx.c.

6280 {
6281  ERR("Invalid vertex attribute function called.\n");
6282  DebugBreak();
6283 }
void WINAPI DebugBreak(void)
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ invalid_generic_attrib_func()

static void WINE_GLAPI invalid_generic_attrib_func ( GLuint  idx,
const void data 
)
static

Definition at line 6291 of file directx.c.

6292 {
6293  ERR("Invalid attribute function called.\n");
6294  DebugBreak();
6295 }
void WINAPI DebugBreak(void)
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ invalid_texcoord_func()

static void WINE_GLAPI invalid_texcoord_func ( GLenum  unit,
const void data 
)
static

Definition at line 6285 of file directx.c.

6286 {
6287  ERR("Invalid texcoord function called.\n");
6288  DebugBreak();
6289 }
void WINAPI DebugBreak(void)
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ load_gl_funcs()

static void load_gl_funcs ( struct wined3d_gl_info gl_info)
static

Definition at line 2696 of file directx.c.

2697 {
2698 #define USE_GL_FUNC(pfn) gl_info->gl_ops.ext.p_##pfn = (void *)wglGetProcAddress(#pfn);
2699  /* GL_APPLE_fence */
2700  USE_GL_FUNC(glDeleteFencesAPPLE)
2701  USE_GL_FUNC(glFinishFenceAPPLE)
2702  USE_GL_FUNC(glFinishObjectAPPLE)
2703  USE_GL_FUNC(glGenFencesAPPLE)
2704  USE_GL_FUNC(glIsFenceAPPLE)
2705  USE_GL_FUNC(glSetFenceAPPLE)
2706  USE_GL_FUNC(glTestFenceAPPLE)
2707  USE_GL_FUNC(glTestObjectAPPLE)
2708  /* GL_APPLE_flush_buffer_range */
2709  USE_GL_FUNC(glBufferParameteriAPPLE)
2710  USE_GL_FUNC(glFlushMappedBufferRangeAPPLE)
2711  /* GL_ARB_base_instance */
2712  USE_GL_FUNC(glDrawArraysInstancedBaseInstance)
2713  USE_GL_FUNC(glDrawElementsInstancedBaseVertexBaseInstance)
2714  /* GL_ARB_blend_func_extended */
2715  USE_GL_FUNC(glBindFragDataLocationIndexed)
2716  USE_GL_FUNC(glGetFragDataIndex)
2717  /* GL_ARB_clear_buffer_object */
2718  USE_GL_FUNC(glClearBufferData)
2719  USE_GL_FUNC(glClearBufferSubData)
2720  /* GL_ARB_clear_texture */
2721  USE_GL_FUNC(glClearTexImage)
2722  USE_GL_FUNC(glClearTexSubImage)
2723  /* GL_ARB_clip_control */
2724  USE_GL_FUNC(glClipControl)
2725  /* GL_ARB_color_buffer_float */
2726  USE_GL_FUNC(glClampColorARB)
2727  /* GL_ARB_compute_shader */
2728  USE_GL_FUNC(glDispatchCompute)
2729  USE_GL_FUNC(glDispatchComputeIndirect)
2730  /* GL_ARB_copy_buffer */
2731  USE_GL_FUNC(glCopyBufferSubData)
2732  /* GL_ARB_copy_image */
2733  USE_GL_FUNC(glCopyImageSubData)
2734  /* GL_ARB_debug_output */
2735  USE_GL_FUNC(glDebugMessageCallbackARB)
2736  USE_GL_FUNC(glDebugMessageControlARB)
2737  USE_GL_FUNC(glDebugMessageInsertARB)
2738  USE_GL_FUNC(glGetDebugMessageLogARB)
2739  /* GL_ARB_draw_buffers */
2740  USE_GL_FUNC(glDrawBuffersARB)
2741  /* GL_ARB_draw_elements_base_vertex */
2742  USE_GL_FUNC(glDrawElementsBaseVertex)
2743  USE_GL_FUNC(glDrawElementsInstancedBaseVertex)
2744  USE_GL_FUNC(glDrawRangeElementsBaseVertex)
2745  USE_GL_FUNC(glMultiDrawElementsBaseVertex)
2746  /* GL_ARB_draw_indirect */
2747  USE_GL_FUNC(glDrawArraysIndirect)
2748  USE_GL_FUNC(glDrawElementsIndirect)
2749  /* GL_ARB_draw_instanced */
2750  USE_GL_FUNC(glDrawArraysInstancedARB)
2751  USE_GL_FUNC(glDrawElementsInstancedARB)
2752  /* GL_ARB_ES2_compatibility */
2753  USE_GL_FUNC(glReleaseShaderCompiler)
2754  USE_GL_FUNC(glShaderBinary)
2755  USE_GL_FUNC(glGetShaderPrecisionFormat)
2756  USE_GL_FUNC(glDepthRangef)
2757  USE_GL_FUNC(glClearDepthf)
2758  /* GL_ARB_framebuffer_no_attachments */
2759  USE_GL_FUNC(glFramebufferParameteri)
2760  /* GL_ARB_framebuffer_object */
2761  USE_GL_FUNC(glBindFramebuffer)
2762  USE_GL_FUNC(glBindRenderbuffer)
2763  USE_GL_FUNC(glBlitFramebuffer)
2764  USE_GL_FUNC(glCheckFramebufferStatus)
2765  USE_GL_FUNC(glDeleteFramebuffers)
2766  USE_GL_FUNC(glDeleteRenderbuffers)
2767  USE_GL_FUNC(glFramebufferRenderbuffer)
2768  USE_GL_FUNC(glFramebufferTexture)
2769  USE_GL_FUNC(glFramebufferTexture1D)
2770  USE_GL_FUNC(glFramebufferTexture2D)
2771  USE_GL_FUNC(glFramebufferTexture3D)
2772  USE_GL_FUNC(glFramebufferTextureLayer)
2773  USE_GL_FUNC(glGenFramebuffers)
2774  USE_GL_FUNC(glGenRenderbuffers)
2775  USE_GL_FUNC(glGenerateMipmap)
2776  USE_GL_FUNC(glGetFramebufferAttachmentParameteriv)
2777  USE_GL_FUNC(glGetRenderbufferParameteriv)
2778  USE_GL_FUNC(glIsFramebuffer)
2779  USE_GL_FUNC(glIsRenderbuffer)
2780  USE_GL_FUNC(glRenderbufferStorage)
2781  USE_GL_FUNC(glRenderbufferStorageMultisample)
2782  /* GL_ARB_geometry_shader4 */
2783  USE_GL_FUNC(glFramebufferTextureARB)
2784  USE_GL_FUNC(glFramebufferTextureFaceARB)
2785  USE_GL_FUNC(glFramebufferTextureLayerARB)
2786  USE_GL_FUNC(glProgramParameteriARB)
2787  /* GL_ARB_instanced_arrays */
2788  USE_GL_FUNC(glVertexAttribDivisorARB)
2789  /* GL_ARB_internalformat_query */
2790  USE_GL_FUNC(glGetInternalformativ)
2791  /* GL_ARB_internalformat_query2 */
2792  USE_GL_FUNC(glGetInternalformati64v)
2793  /* GL_ARB_map_buffer_range */
2794  USE_GL_FUNC(glFlushMappedBufferRange)
2795  USE_GL_FUNC(glMapBufferRange)
2796  /* GL_ARB_multisample */
2797  USE_GL_FUNC(glSampleCoverageARB)
2798  /* GL_ARB_multitexture */
2811  /* GL_ARB_occlusion_query */
2812  USE_GL_FUNC(glBeginQueryARB)
2813  USE_GL_FUNC(glDeleteQueriesARB)
2814  USE_GL_FUNC(glEndQueryARB)
2815  USE_GL_FUNC(glGenQueriesARB)
2816  USE_GL_FUNC(glGetQueryivARB)
2817  USE_GL_FUNC(glGetQueryObjectivARB)
2818  USE_GL_FUNC(glGetQueryObjectuivARB)
2819  USE_GL_FUNC(glIsQueryARB)
2820  /* GL_ARB_point_parameters */
2821  USE_GL_FUNC(glPointParameterfARB)
2822  USE_GL_FUNC(glPointParameterfvARB)
2823  /* GL_ARB_provoking_vertex */
2824  USE_GL_FUNC(glProvokingVertex)
2825  /* GL_ARB_sampler_objects */
2826  USE_GL_FUNC(glGenSamplers)
2827  USE_GL_FUNC(glDeleteSamplers)
2828  USE_GL_FUNC(glIsSampler)
2829  USE_GL_FUNC(glBindSampler)
2830  USE_GL_FUNC(glSamplerParameteri)
2831  USE_GL_FUNC(glSamplerParameterf)
2832  USE_GL_FUNC(glSamplerParameteriv)
2833  USE_GL_FUNC(glSamplerParameterfv)
2834  USE_GL_FUNC(glSamplerParameterIiv)
2835  USE_GL_FUNC(glSamplerParameterIuiv)
2836  USE_GL_FUNC(glGetSamplerParameteriv)
2837  USE_GL_FUNC(glGetSamplerParameterfv)
2838  USE_GL_FUNC(glGetSamplerParameterIiv)
2839  USE_GL_FUNC(glGetSamplerParameterIuiv)
2840  /* GL_ARB_shader_atomic_counters */
2841  USE_GL_FUNC(glGetActiveAtomicCounterBufferiv)
2842  /* GL_ARB_shader_image_load_store */
2843  USE_GL_FUNC(glBindImageTexture)
2844  USE_GL_FUNC(glMemoryBarrier)
2845  /* GL_ARB_shader_objects */
2846  USE_GL_FUNC(glAttachObjectARB)
2847  USE_GL_FUNC(glBindAttribLocationARB)
2848  USE_GL_FUNC(glCompileShaderARB)
2849  USE_GL_FUNC(glCreateProgramObjectARB)
2850  USE_GL_FUNC(glCreateShaderObjectARB)
2851  USE_GL_FUNC(glDeleteObjectARB)
2852  USE_GL_FUNC(glDetachObjectARB)
2853  USE_GL_FUNC(glGetActiveUniformARB)
2854  USE_GL_FUNC(glGetAttachedObjectsARB)
2855  USE_GL_FUNC(glGetAttribLocationARB)
2856  USE_GL_FUNC(glGetHandleARB)
2857  USE_GL_FUNC(glGetInfoLogARB)
2858  USE_GL_FUNC(glGetObjectParameterfvARB)
2859  USE_GL_FUNC(glGetObjectParameterivARB)
2860  USE_GL_FUNC(glGetShaderSourceARB)
2861  USE_GL_FUNC(glGetUniformLocationARB)
2862  USE_GL_FUNC(glGetUniformfvARB)
2863  USE_GL_FUNC(glGetUniformivARB)
2864  USE_GL_FUNC(glLinkProgramARB)
2865  USE_GL_FUNC(glShaderSourceARB)
2866  USE_GL_FUNC(glUniform1fARB)
2867  USE_GL_FUNC(glUniform1fvARB)
2868  USE_GL_FUNC(glUniform1iARB)
2869  USE_GL_FUNC(glUniform1ivARB)
2870  USE_GL_FUNC(glUniform2fARB)
2871  USE_GL_FUNC(glUniform2fvARB)
2872  USE_GL_FUNC(glUniform2iARB)
2873  USE_GL_FUNC(glUniform2ivARB)
2874  USE_GL_FUNC(glUniform3fARB)
2875  USE_GL_FUNC(glUniform3fvARB)
2876  USE_GL_FUNC(glUniform3iARB)
2877  USE_GL_FUNC(glUniform3ivARB)
2878  USE_GL_FUNC(glUniform4fARB)
2879  USE_GL_FUNC(glUniform4fvARB)
2880  USE_GL_FUNC(glUniform4iARB)
2881  USE_GL_FUNC(glUniform4ivARB)
2882  USE_GL_FUNC(glUniformMatrix2fvARB)
2883  USE_GL_FUNC(glUniformMatrix3fvARB)
2884  USE_GL_FUNC(glUniformMatrix4fvARB)
2885  USE_GL_FUNC(glUseProgramObjectARB)
2886  USE_GL_FUNC(glValidateProgramARB)
2887  /* GL_ARB_shader_storage_buffer_object */
2888  USE_GL_FUNC(glShaderStorageBlockBinding)
2889  /* GL_ARB_sync */
2890  USE_GL_FUNC(glClientWaitSync)
2891  USE_GL_FUNC(glDeleteSync)
2892  USE_GL_FUNC(glFenceSync)
2893  USE_GL_FUNC(glGetInteger64v)
2894  USE_GL_FUNC(glGetSynciv)
2895  USE_GL_FUNC(glIsSync)
2896  USE_GL_FUNC(glWaitSync)
2897  /* GL_ARB_tessellation_shader */
2898  USE_GL_FUNC(glPatchParameteri)
2899  USE_GL_FUNC(glPatchParameterfv)
2900  /* GL_ARB_texture_buffer_object */
2901  USE_GL_FUNC(glTexBufferARB)
2902  /* GL_ARB_texture_buffer_range */
2903  USE_GL_FUNC(glTexBufferRange)
2904  /* GL_ARB_texture_compression */
2905  USE_GL_FUNC(glCompressedTexImage2DARB)
2906  USE_GL_FUNC(glCompressedTexImage3DARB)
2907  USE_GL_FUNC(glCompressedTexSubImage2DARB)
2908  USE_GL_FUNC(glCompressedTexSubImage3DARB)
2909  USE_GL_FUNC(glGetCompressedTexImageARB)
2910  /* GL_ARB_texture_multisample */
2911  USE_GL_FUNC(glGetMultisamplefv);
2912  USE_GL_FUNC(glSampleMaski);
2913  USE_GL_FUNC(glTexImage2DMultisample);
2914  USE_GL_FUNC(glTexImage3DMultisample);
2915  /* GL_ARB_texture_storage */
2916  USE_GL_FUNC(glTexStorage1D)
2917  USE_GL_FUNC(glTexStorage2D)
2918  USE_GL_FUNC(glTexStorage3D)
2919  /* GL_ARB_texture_storage_multisample */
2920  USE_GL_FUNC(glTexStorage2DMultisample);
2921  USE_GL_FUNC(glTexStorage3DMultisample);
2922  /* GL_ARB_texture_view */
2923  USE_GL_FUNC(glTextureView)
2924  /* GL_ARB_timer_query */
2925  USE_GL_FUNC(glQueryCounter)
2926  USE_GL_FUNC(glGetQueryObjectui64v)
2927  /* GL_ARB_transform_feedback2 */
2928  USE_GL_FUNC(glBindTransformFeedback);
2929  USE_GL_FUNC(glDeleteTransformFeedbacks);
2930  USE_GL_FUNC(glDrawTransformFeedback);
2931  USE_GL_FUNC(glGenTransformFeedbacks);
2932  USE_GL_FUNC(glIsTransformFeedback);
2933  USE_GL_FUNC(glPauseTransformFeedback);
2934  USE_GL_FUNC(glResumeTransformFeedback);
2935  /* GL_ARB_transform_feedback3 */
2936  USE_GL_FUNC(glBeginQueryIndexed);
2937  USE_GL_FUNC(glDrawTransformFeedbackStream);
2938  USE_GL_FUNC(glEndQueryIndexed);
2939  USE_GL_FUNC(glGetQueryIndexediv);
2940  /* GL_ARB_uniform_buffer_object */
2941  USE_GL_FUNC(glBindBufferBase)
2942  USE_GL_FUNC(glBindBufferRange)
2943  USE_GL_FUNC(glGetActiveUniformBlockName)
2944  USE_GL_FUNC(glGetActiveUniformBlockiv)
2945  USE_GL_FUNC(glGetActiveUniformName)
2946  USE_GL_FUNC(glGetActiveUniformsiv)
2947  USE_GL_FUNC(glGetIntegeri_v)
2948  USE_GL_FUNC(glGetUniformBlockIndex)
2949  USE_GL_FUNC(glGetUniformIndices)
2950  USE_GL_FUNC(glUniformBlockBinding)
2951  /* GL_ARB_vertex_blend */
2952  USE_GL_FUNC(glVertexBlendARB)
2953  USE_GL_FUNC(glWeightPointerARB)
2954  USE_GL_FUNC(glWeightbvARB)
2955  USE_GL_FUNC(glWeightdvARB)
2956  USE_GL_FUNC(glWeightfvARB)
2957  USE_GL_FUNC(glWeightivARB)
2958  USE_GL_FUNC(glWeightsvARB)
2959  USE_GL_FUNC(glWeightubvARB)
2960  USE_GL_FUNC(glWeightuivARB)
2961  USE_GL_FUNC(glWeightusvARB)
2962  /* GL_ARB_vertex_buffer_object */
2963  USE_GL_FUNC(glBindBufferARB)
2964  USE_GL_FUNC(glBufferDataARB)
2965  USE_GL_FUNC(glBufferSubDataARB)
2966  USE_GL_FUNC(glDeleteBuffersARB)
2967  USE_GL_FUNC(glGenBuffersARB)
2968  USE_GL_FUNC(glGetBufferParameterivARB)
2969  USE_GL_FUNC(glGetBufferPointervARB)
2970  USE_GL_FUNC(glGetBufferSubDataARB)
2971  USE_GL_FUNC(glIsBufferARB)
2972  USE_GL_FUNC(glMapBufferARB)
2973  USE_GL_FUNC(glUnmapBufferARB)
2974  /* GL_ARB_vertex_program */
2975  USE_GL_FUNC(glBindProgramARB)
2976  USE_GL_FUNC(glDeleteProgramsARB)
2977  USE_GL_FUNC(glDisableVertexAttribArrayARB)
2978  USE_GL_FUNC(glEnableVertexAttribArrayARB)
2979  USE_GL_FUNC(glGenProgramsARB)
2980  USE_GL_FUNC(glGetProgramivARB)
2981  USE_GL_FUNC(glProgramEnvParameter4fvARB)
2982  USE_GL_FUNC(glProgramLocalParameter4fvARB)
2983  USE_GL_FUNC(glProgramStringARB)
2984  USE_GL_FUNC(glVertexAttrib1dARB)
2985  USE_GL_FUNC(glVertexAttrib1dvARB)
2986  USE_GL_FUNC(glVertexAttrib1fARB)
2987  USE_GL_FUNC(glVertexAttrib1fvARB)
2988  USE_GL_FUNC(glVertexAttrib1sARB)
2989  USE_GL_FUNC(glVertexAttrib1svARB)
2990  USE_GL_FUNC(glVertexAttrib2dARB)
2991  USE_GL_FUNC(glVertexAttrib2dvARB)
2992  USE_GL_FUNC(glVertexAttrib2fARB)
2993  USE_GL_FUNC(glVertexAttrib2fvARB)
2994  USE_GL_FUNC(glVertexAttrib2sARB)
2995  USE_GL_FUNC(glVertexAttrib2svARB)
2996  USE_GL_FUNC(glVertexAttrib3dARB)
2997  USE_GL_FUNC(glVertexAttrib3dvARB)
2998  USE_GL_FUNC(glVertexAttrib3fARB)
2999  USE_GL_FUNC(glVertexAttrib3fvARB)
3000  USE_GL_FUNC(glVertexAttrib3sARB)
3001  USE_GL_FUNC(glVertexAttrib3svARB)
3002  USE_GL_FUNC(glVertexAttrib4NbvARB)
3003  USE_GL_FUNC(glVertexAttrib4NivARB)
3004  USE_GL_FUNC(glVertexAttrib4NsvARB)
3005  USE_GL_FUNC(glVertexAttrib4NubARB)
3006  USE_GL_FUNC(glVertexAttrib4NubvARB)
3007  USE_GL_FUNC(glVertexAttrib4NuivARB)
3008  USE_GL_FUNC(glVertexAttrib4NusvARB)
3009  USE_GL_FUNC(glVertexAttrib4bvARB)
3010  USE_GL_FUNC(glVertexAttrib4dARB)
3011  USE_GL_FUNC(glVertexAttrib4dvARB)
3012  USE_GL_FUNC(glVertexAttrib4fARB)
3013  USE_GL_FUNC(glVertexAttrib4fvARB)
3014  USE_GL_FUNC(glVertexAttrib4ivARB)
3015  USE_GL_FUNC(glVertexAttrib4sARB)
3016  USE_GL_FUNC(glVertexAttrib4svARB)
3017  USE_GL_FUNC(glVertexAttrib4ubvARB)
3018  USE_GL_FUNC(glVertexAttrib4uivARB)
3019  USE_GL_FUNC(glVertexAttrib4usvARB)
3020  USE_GL_FUNC(glVertexAttribPointerARB)
3021  /* GL_ARB_viewport_array */
3022  USE_GL_FUNC(glDepthRangeArrayv)
3023  USE_GL_FUNC(glDepthRangeIndexed)
3024  USE_GL_FUNC(glGetDoublei_v)
3025  USE_GL_FUNC(glGetFloati_v)
3026  USE_GL_FUNC(glScissorArrayv)
3027  USE_GL_FUNC(glScissorIndexed)
3028  USE_GL_FUNC(glScissorIndexedv)
3029  USE_GL_FUNC(glViewportArrayv)
3030  USE_GL_FUNC(glViewportIndexedf)
3031  USE_GL_FUNC(glViewportIndexedfv)
3032  /* GL_ATI_fragment_shader */
3033  USE_GL_FUNC(glAlphaFragmentOp1ATI)
3034  USE_GL_FUNC(glAlphaFragmentOp2ATI)
3035  USE_GL_FUNC(glAlphaFragmentOp3ATI)
3036  USE_GL_FUNC(glBeginFragmentShaderATI)
3037  USE_GL_FUNC(glBindFragmentShaderATI)
3038  USE_GL_FUNC(glColorFragmentOp1ATI)
3039  USE_GL_FUNC(glColorFragmentOp2ATI)
3040  USE_GL_FUNC(glColorFragmentOp3ATI)
3041  USE_GL_FUNC(glDeleteFragmentShaderATI)
3042  USE_GL_FUNC(glEndFragmentShaderATI)
3043  USE_GL_FUNC(glGenFragmentShadersATI)
3044  USE_GL_FUNC(glPassTexCoordATI)
3045  USE_GL_FUNC(glSampleMapATI)
3046  USE_GL_FUNC(glSetFragmentShaderConstantATI)
3047  /* GL_ATI_separate_stencil */
3048  USE_GL_FUNC(glStencilOpSeparateATI)
3049  USE_GL_FUNC(glStencilFuncSeparateATI)
3050  /* GL_EXT_blend_color */
3051  USE_GL_FUNC(glBlendColorEXT)
3052  /* GL_EXT_blend_equation_separate */
3053  USE_GL_FUNC(glBlendFuncSeparateEXT)
3054  /* GL_EXT_blend_func_separate */
3055  USE_GL_FUNC(glBlendEquationSeparateEXT)
3056  /* GL_EXT_blend_minmax */
3057  USE_GL_FUNC(glBlendEquationEXT)
3058  /* GL_EXT_depth_bounds_test */
3059  USE_GL_FUNC(glDepthBoundsEXT)
3060  /* GL_EXT_draw_buffers2 */
3061  USE_GL_FUNC(glColorMaskIndexedEXT)
3062  USE_GL_FUNC(glDisableIndexedEXT)
3063  USE_GL_FUNC(glEnableIndexedEXT)
3064  USE_GL_FUNC(glGetBooleanIndexedvEXT)
3065  USE_GL_FUNC(glGetIntegerIndexedvEXT)
3066  USE_GL_FUNC(glIsEnabledIndexedEXT)
3067  /* GL_EXT_fog_coord */
3068  USE_GL_FUNC(glFogCoordPointerEXT)
3069  USE_GL_FUNC(glFogCoorddEXT)
3070  USE_GL_FUNC(glFogCoorddvEXT)
3071  USE_GL_FUNC(glFogCoordfEXT)
3072  USE_GL_FUNC(glFogCoordfvEXT)
3073  /* GL_EXT_framebuffer_blit */
3074  USE_GL_FUNC(glBlitFramebufferEXT)
3075  /* GL_EXT_framebuffer_multisample */
3076  USE_GL_FUNC(glRenderbufferStorageMultisampleEXT)
3077  /* GL_EXT_framebuffer_object */
3078  USE_GL_FUNC(glBindFramebufferEXT)
3079  USE_GL_FUNC(glBindRenderbufferEXT)
3080  USE_GL_FUNC(glCheckFramebufferStatusEXT)
3081  USE_GL_FUNC(glDeleteFramebuffersEXT)
3082  USE_GL_FUNC(glDeleteRenderbuffersEXT)
3083  USE_GL_FUNC(glFramebufferRenderbufferEXT)
3084  USE_GL_FUNC(glFramebufferTexture1DEXT)
3085  USE_GL_FUNC(glFramebufferTexture2DEXT)
3086  USE_GL_FUNC(glFramebufferTexture3DEXT)
3087  USE_GL_FUNC(glGenFramebuffersEXT)
3088  USE_GL_FUNC(glGenRenderbuffersEXT)
3089  USE_GL_FUNC(glGenerateMipmapEXT)
3090  USE_GL_FUNC(glGetFramebufferAttachmentParameterivEXT)
3091  USE_GL_FUNC(glGetRenderbufferParameterivEXT)
3092  USE_GL_FUNC(glIsFramebufferEXT)
3093  USE_GL_FUNC(glIsRenderbufferEXT)
3094  USE_GL_FUNC(glRenderbufferStorageEXT)
3095  /* GL_EXT_gpu_program_parameters */
3096  USE_GL_FUNC(glProgramEnvParameters4fvEXT)
3097  USE_GL_FUNC(glProgramLocalParameters4fvEXT)
3098  /* GL_EXT_gpu_shader4 */
3099  USE_GL_FUNC(glBindFragDataLocationEXT)
3100  USE_GL_FUNC(glGetFragDataLocationEXT)
3101  USE_GL_FUNC(glGetUniformuivEXT)
3102  USE_GL_FUNC(glGetVertexAttribIivEXT)
3103  USE_GL_FUNC(glGetVertexAttribIuivEXT)
3104  USE_GL_FUNC(glUniform1uiEXT)
3105  USE_GL_FUNC(glUniform1uivEXT)
3106  USE_GL_FUNC(glUniform2uiEXT)
3107  USE_GL_FUNC(glUniform2uivEXT)
3108  USE_GL_FUNC(glUniform3uiEXT)
3109  USE_GL_FUNC(glUniform3uivEXT)
3110  USE_GL_FUNC(glUniform4uiEXT)
3111  USE_GL_FUNC(glUniform4uivEXT)
3112  USE_GL_FUNC(glVertexAttribI1iEXT)
3113  USE_GL_FUNC(glVertexAttribI1ivEXT)
3114  USE_GL_FUNC(glVertexAttribI1uiEXT)
3115  USE_GL_FUNC(glVertexAttribI1uivEXT)
3116  USE_GL_FUNC(glVertexAttribI2iEXT)
3117  USE_GL_FUNC(glVertexAttribI2ivEXT)
3118  USE_GL_FUNC(glVertexAttribI2uiEXT)
3119  USE_GL_FUNC(glVertexAttribI2uivEXT)
3120  USE_GL_FUNC(glVertexAttribI3iEXT)
3121  USE_GL_FUNC(glVertexAttribI3ivEXT)
3122  USE_GL_FUNC(glVertexAttribI3uiEXT)
3123  USE_GL_FUNC(glVertexAttribI3uivEXT)
3124  USE_GL_FUNC(glVertexAttribI4bvEXT)
3125  USE_GL_FUNC(glVertexAttribI4iEXT)
3126  USE_GL_FUNC(glVertexAttribI4ivEXT)
3127  USE_GL_FUNC(glVertexAttribI4svEXT)
3128  USE_GL_FUNC(glVertexAttribI4ubvEXT)
3129  USE_GL_FUNC(glVertexAttribI4uiEXT)
3130  USE_GL_FUNC(glVertexAttribI4uivEXT)
3131  USE_GL_FUNC(glVertexAttribI4usvEXT)
3132  USE_GL_FUNC(glVertexAttribIPointerEXT)
3133  /* GL_EXT_point_parameters */
3134  USE_GL_FUNC(glPointParameterfEXT)
3135  USE_GL_FUNC(glPointParameterfvEXT)
3136  /* GL_EXT_polygon_offset_clamp */
3137  USE_GL_FUNC(glPolygonOffsetClampEXT)
3138  /* GL_EXT_provoking_vertex */
3139  USE_GL_FUNC(glProvokingVertexEXT)
3140  /* GL_EXT_secondary_color */
3141  USE_GL_FUNC(glSecondaryColor3fEXT)
3142  USE_GL_FUNC(glSecondaryColor3fvEXT)
3143  USE_GL_FUNC(glSecondaryColor3ubEXT)
3144  USE_GL_FUNC(glSecondaryColor3ubvEXT)
3145  USE_GL_FUNC(glSecondaryColorPointerEXT)
3146  /* GL_EXT_stencil_two_side */
3147  USE_GL_FUNC(glActiveStencilFaceEXT)
3148  /* GL_EXT_texture3D */
3150  USE_GL_FUNC(glTexImage3DEXT)
3152  USE_GL_FUNC(glTexSubImage3DEXT)
3153  /* GL_NV_fence */
3154  USE_GL_FUNC(glDeleteFencesNV)
3155  USE_GL_FUNC(glFinishFenceNV)
3156  USE_GL_FUNC(glGenFencesNV)
3157  USE_GL_FUNC(glGetFenceivNV)
3158  USE_GL_FUNC(glIsFenceNV)
3159  USE_GL_FUNC(glSetFenceNV)
3160  USE_GL_FUNC(glTestFenceNV)
3161  /* GL_NV_half_float */
3162  USE_GL_FUNC(glColor3hNV)
3163  USE_GL_FUNC(glColor3hvNV)
3164  USE_GL_FUNC(glColor4hNV)
3165  USE_GL_FUNC(glColor4hvNV)
3166  USE_GL_FUNC(glFogCoordhNV)
3167  USE_GL_FUNC(glFogCoordhvNV)
3168  USE_GL_FUNC(glMultiTexCoord1hNV)
3169  USE_GL_FUNC(glMultiTexCoord1hvNV)
3170  USE_GL_FUNC(glMultiTexCoord2hNV)
3171  USE_GL_FUNC(glMultiTexCoord2hvNV)
3172  USE_GL_FUNC(glMultiTexCoord3hNV)
3173  USE_GL_FUNC(glMultiTexCoord3hvNV)
3174  USE_GL_FUNC(glMultiTexCoord4hNV)
3175  USE_GL_FUNC(glMultiTexCoord4hvNV)
3176  USE_GL_FUNC(glNormal3hNV)
3177  USE_GL_FUNC(glNormal3hvNV)
3178  USE_GL_FUNC(glSecondaryColor3hNV)
3179  USE_GL_FUNC(glSecondaryColor3hvNV)
3180  USE_GL_FUNC(glTexCoord1hNV)
3181  USE_GL_FUNC(glTexCoord1hvNV)
3182  USE_GL_FUNC(glTexCoord2hNV)
3183  USE_GL_FUNC(glTexCoord2hvNV)
3184  USE_GL_FUNC(glTexCoord3hNV)
3185  USE_GL_FUNC(glTexCoord3hvNV)
3186  USE_GL_FUNC(glTexCoord4hNV)
3187  USE_GL_FUNC(glTexCoord4hvNV)
3188  USE_GL_FUNC(glVertex2hNV)
3189  USE_GL_FUNC(glVertex2hvNV)
3190  USE_GL_FUNC(glVertex3hNV)
3191  USE_GL_FUNC(glVertex3hvNV)
3192  USE_GL_FUNC(glVertex4hNV)
3193  USE_GL_FUNC(glVertex4hvNV)
3194  USE_GL_FUNC(glVertexAttrib1hNV)
3195  USE_GL_FUNC(glVertexAttrib1hvNV)
3196  USE_GL_FUNC(glVertexAttrib2hNV)
3197  USE_GL_FUNC(glVertexAttrib2hvNV)
3198  USE_GL_FUNC(glVertexAttrib3hNV)
3199  USE_GL_FUNC(glVertexAttrib3hvNV)
3200  USE_GL_FUNC(glVertexAttrib4hNV)
3201  USE_GL_FUNC(glVertexAttrib4hvNV)
3202  USE_GL_FUNC(glVertexAttribs1hvNV)
3203  USE_GL_FUNC(glVertexAttribs2hvNV)
3204  USE_GL_FUNC(glVertexAttribs3hvNV)
3205  USE_GL_FUNC(glVertexAttribs4hvNV)
3206  USE_GL_FUNC(glVertexWeighthNV)
3207  USE_GL_FUNC(glVertexWeighthvNV)
3208  /* GL_NV_point_sprite */
3209  USE_GL_FUNC(glPointParameteriNV)
3210  USE_GL_FUNC(glPointParameterivNV)
3211  /* GL_NV_register_combiners */
3212  USE_GL_FUNC(glCombinerInputNV)
3213  USE_GL_FUNC(glCombinerOutputNV)
3214  USE_GL_FUNC(glCombinerParameterfNV)
3215  USE_GL_FUNC(glCombinerParameterfvNV)
3216  USE_GL_FUNC(glCombinerParameteriNV)
3217  USE_GL_FUNC(glCombinerParameterivNV)
3218  USE_GL_FUNC(glFinalCombinerInputNV)
3219  /* WGL extensions */
3220  USE_GL_FUNC(wglChoosePixelFormatARB)
3221  USE_GL_FUNC(wglGetExtensionsStringARB)
3222  USE_GL_FUNC(wglGetPixelFormatAttribfvARB)
3223  USE_GL_FUNC(wglGetPixelFormatAttribivARB)
3224  USE_GL_FUNC(wglQueryCurrentRendererIntegerWINE)
3225  USE_GL_FUNC(wglQueryCurrentRendererStringWINE)
3226  USE_GL_FUNC(wglQueryRendererIntegerWINE)
3227  USE_GL_FUNC(wglQueryRendererStringWINE)
3228  USE_GL_FUNC(wglSetPixelFormatWINE)
3229  USE_GL_FUNC(wglSwapIntervalEXT)
3230 
3231  /* Newer core functions */
3232  USE_GL_FUNC(glActiveTexture) /* OpenGL 1.3 */
3233  USE_GL_FUNC(glAttachShader) /* OpenGL 2.0 */
3234  USE_GL_FUNC(glBeginQuery) /* OpenGL 1.5 */
3235  USE_GL_FUNC(glBeginTransformFeedback) /* OpenGL 3.0 */
3236  USE_GL_FUNC(glBindAttribLocation) /* OpenGL 2.0 */
3237  USE_GL_FUNC(glBindBuffer) /* OpenGL 1.5 */
3238  USE_GL_FUNC(glBindFragDataLocation) /* OpenGL 3.0 */
3239  USE_GL_FUNC(glBindVertexArray) /* OpenGL 3.0 */
3240  USE_GL_FUNC(glBlendColor) /* OpenGL 1.4 */
3241  USE_GL_FUNC(glBlendEquation) /* OpenGL 1.4 */
3242  USE_GL_FUNC(glBlendEquationSeparate) /* OpenGL 2.0 */
3243  USE_GL_FUNC(glBlendFuncSeparate) /* OpenGL 1.4 */
3244  USE_GL_FUNC(glBufferData) /* OpenGL 1.5 */
3245  USE_GL_FUNC(glBufferSubData) /* OpenGL 1.5 */
3246  USE_GL_FUNC(glColorMaski) /* OpenGL 3.0 */
3247  USE_GL_FUNC(glCompileShader) /* OpenGL 2.0 */
3248  USE_GL_FUNC(glCompressedTexImage2D) /* OpenGL 1.3 */
3249  USE_GL_FUNC(glCompressedTexImage3D) /* OpenGL 1.3 */
3250  USE_GL_FUNC(glCompressedTexSubImage2D) /* OpenGL 1.3 */
3251  USE_GL_FUNC(glCompressedTexSubImage3D) /* OpenGL 1.3 */
3252  USE_GL_FUNC(glCreateProgram) /* OpenGL 2.0 */
3253  USE_GL_FUNC(glCreateShader) /* OpenGL 2.0 */
3254  USE_GL_FUNC(glDebugMessageCallback) /* OpenGL 4.3 */
3255  USE_GL_FUNC(glDebugMessageControl) /* OpenGL 4.3 */
3256  USE_GL_FUNC(glDebugMessageInsert) /* OpenGL 4.3 */
3257  USE_GL_FUNC(glDeleteBuffers) /* OpenGL 1.5 */
3258  USE_GL_FUNC(glDeleteProgram) /* OpenGL 2.0 */
3259  USE_GL_FUNC(glDeleteQueries) /* OpenGL 1.5 */
3260  USE_GL_FUNC(glDeleteShader) /* OpenGL 2.0 */
3261  USE_GL_FUNC(glDeleteVertexArrays) /* OpenGL 3.0 */
3262  USE_GL_FUNC(glDetachShader) /* OpenGL 2.0 */
3263  USE_GL_FUNC(glDisablei) /* OpenGL 3.0 */
3264  USE_GL_FUNC(glDisableVertexAttribArray) /* OpenGL 2.0 */
3265  USE_GL_FUNC(glDrawArraysInstanced) /* OpenGL 3.1 */
3266  USE_GL_FUNC(glDrawBuffers) /* OpenGL 2.0 */
3267  USE_GL_FUNC(glDrawElementsInstanced) /* OpenGL 3.1 */
3268  USE_GL_FUNC(glEnablei) /* OpenGL 3.0 */
3269  USE_GL_FUNC(glEnableVertexAttribArray) /* OpenGL 2.0 */
3270  USE_GL_FUNC(glEndQuery) /* OpenGL 1.5 */
3271  USE_GL_FUNC(glEndTransformFeedback) /* OpenGL 3.0 */
3272  USE_GL_FUNC(glFramebufferTexture) /* OpenGL 3.2 */
3273  USE_GL_FUNC(glGenBuffers) /* OpenGL 1.5 */
3274  USE_GL_FUNC(glGenQueries) /* OpenGL 1.5 */
3275  USE_GL_FUNC(glGenVertexArrays) /* OpenGL 3.0 */
3276  USE_GL_FUNC(glGetActiveUniform) /* OpenGL 2.0 */
3277  USE_GL_FUNC(glGetAttachedShaders) /* OpenGL 2.0 */
3278  USE_GL_FUNC(glGetAttribLocation) /* OpenGL 2.0 */
3279  USE_GL_FUNC(glGetBooleani_v) /* OpenGL 3.0 */
3280  USE_GL_FUNC(glGetBufferSubData) /* OpenGL 1.5 */
3281  USE_GL_FUNC(glGetCompressedTexImage) /* OpenGL 1.3 */
3282  USE_GL_FUNC(glGetDebugMessageLog) /* OpenGL 4.3 */
3283  USE_GL_FUNC(glGetIntegeri_v) /* OpenGL 3.0 */
3284  USE_GL_FUNC(glGetProgramInfoLog) /* OpenGL 2.0 */
3285  USE_GL_FUNC(glGetProgramiv) /* OpenGL 2.0 */
3286  USE_GL_FUNC(glGetQueryiv) /* OpenGL 1.5 */
3287  USE_GL_FUNC(glGetQueryObjectuiv) /* OpenGL 1.5 */
3288  USE_GL_FUNC(glGetShaderInfoLog) /* OpenGL 2.0 */
3289  USE_GL_FUNC(glGetShaderiv) /* OpenGL 2.0 */
3290  USE_GL_FUNC(glGetShaderSource) /* OpenGL 2.0 */
3291  USE_GL_FUNC(glGetStringi) /* OpenGL 3.0 */
3292  USE_GL_FUNC(glGetTextureLevelParameteriv) /* OpenGL 4.5 */
3293  USE_GL_FUNC(glGetTextureParameteriv) /* OpenGL 4.5 */
3294  USE_GL_FUNC(glGetUniformfv) /* OpenGL 2.0 */
3295  USE_GL_FUNC(glGetUniformiv) /* OpenGL 2.0 */
3296  USE_GL_FUNC(glGetUniformLocation) /* OpenGL 2.0 */
3297  USE_GL_FUNC(glIsEnabledi) /* OpenGL 3.0 */
3298  USE_GL_FUNC(glLinkProgram) /* OpenGL 2.0 */
3299  USE_GL_FUNC(glMapBuffer) /* OpenGL 1.5 */
3300  USE_GL_FUNC(glPointParameteri) /* OpenGL 1.4 */
3301  USE_GL_FUNC(glPointParameteriv) /* OpenGL 1.4 */
3302  USE_GL_FUNC(glShaderSource) /* OpenGL 2.0 */
3303  USE_GL_FUNC(glStencilFuncSeparate) /* OpenGL 2.0 */
3304  USE_GL_FUNC(glStencilOpSeparate) /* OpenGL 2.0 */
3305  USE_GL_FUNC(glTexBuffer) /* OpenGL 3.1 */
3306  USE_GL_FUNC(glTexImage3D) /* OpenGL 1.2 */
3307  USE_GL_FUNC(glTexSubImage3D) /* OpenGL 1.2 */
3308  USE_GL_FUNC(glTransformFeedbackVaryings) /* OpenGL 3.0 */
3309  USE_GL_FUNC(glUniform1f) /* OpenGL 2.0 */
3310  USE_GL_FUNC(glUniform1fv) /* OpenGL 2.0 */
3311  USE_GL_FUNC(glUniform1i) /* OpenGL 2.0 */
3312  USE_GL_FUNC(glUniform1iv) /* OpenGL 2.0 */
3313  USE_GL_FUNC(glUniform2f) /* OpenGL 2.0 */
3314  USE_GL_FUNC(glUniform2fv) /* OpenGL 2.0 */
3315  USE_GL_FUNC(glUniform2i) /* OpenGL 2.0 */
3316  USE_GL_FUNC(glUniform2iv) /* OpenGL 2.0 */
3317  USE_GL_FUNC(glUniform3f) /* OpenGL 2.0 */
3318  USE_GL_FUNC(glUniform3fv) /* OpenGL 2.0 */
3319  USE_GL_FUNC(glUniform3i) /* OpenGL 2.0 */
3320  USE_GL_FUNC(glUniform3iv) /* OpenGL 2.0 */
3321  USE_GL_FUNC(glUniform4f) /* OpenGL 2.0 */
3322  USE_GL_FUNC(glUniform4fv) /* OpenGL 2.0 */
3323  USE_GL_FUNC(glUniform4i) /* OpenGL 2.0 */
3324  USE_GL_FUNC(glUniform4iv) /* OpenGL 2.0 */
3325  USE_GL_FUNC(glUniformMatrix2fv) /* OpenGL 2.0 */
3326  USE_GL_FUNC(glUniformMatrix3fv) /* OpenGL 2.0 */
3327  USE_GL_FUNC(glUniformMatrix4fv) /* OpenGL 2.0 */
3328  USE_GL_FUNC(glUnmapBuffer) /* OpenGL 1.5 */
3329  USE_GL_FUNC(glUseProgram) /* OpenGL 2.0 */
3330  USE_GL_FUNC(glValidateProgram) /* OpenGL 2.0 */
3331  USE_GL_FUNC(glVertexAttrib1f) /* OpenGL 2.0 */
3332  USE_GL_FUNC(glVertexAttrib1fv) /* OpenGL 2.0 */
3333  USE_GL_FUNC(glVertexAttrib2f) /* OpenGL 2.0 */
3334  USE_GL_FUNC(glVertexAttrib2fv) /* OpenGL 2.0 */
3335  USE_GL_FUNC(glVertexAttrib3f) /* OpenGL 2.0 */
3336  USE_GL_FUNC(glVertexAttrib3fv) /* OpenGL 2.0 */
3337  USE_GL_FUNC(glVertexAttrib4f) /* OpenGL 2.0 */
3338  USE_GL_FUNC(glVertexAttrib4fv) /* OpenGL 2.0 */
3339  USE_GL_FUNC(glVertexAttrib4Nsv) /* OpenGL 2.0 */
3340  USE_GL_FUNC(glVertexAttrib4Nub) /* OpenGL 2.0 */
3341  USE_GL_FUNC(glVertexAttrib4Nubv) /* OpenGL 2.0 */
3342  USE_GL_FUNC(glVertexAttrib4Nusv) /* OpenGL 2.0 */
3343  USE_GL_FUNC(glVertexAttrib4sv) /* OpenGL 2.0 */
3344  USE_GL_FUNC(glVertexAttrib4ubv) /* OpenGL 2.0 */
3345  USE_GL_FUNC(glVertexAttribDivisor) /* OpenGL 3.3 */
3346  USE_GL_FUNC(glVertexAttribIPointer) /* OpenGL 3.0 */
3347  USE_GL_FUNC(glVertexAttribPointer) /* OpenGL 2.0 */
3348 #undef USE_GL_FUNC
3349 
3350 #ifndef USE_WIN32_OPENGL
3351  /* hack: use the functions directly from the TEB table to bypass the thunks */
3352  /* note that we still need the above wglGetProcAddress calls to initialize the table */
3353  gl_info->gl_ops.ext = ((struct opengl_funcs *)NtCurrentTeb()->glTable)->ext;
3354 #endif
3355 
3356 #define MAP_GL_FUNCTION(core_func, ext_func) \
3357  do \
3358  { \
3359  if (!gl_info->gl_ops.ext.p_##core_func) \
3360  gl_info->gl_ops.ext.p_##core_func = gl_info->gl_ops.ext.p_##ext_func; \
3361  } while (0)
3362 #define MAP_GL_FUNCTION_CAST(core_func, ext_func) \
3363  do \
3364  { \
3365  if (!gl_info->gl_ops.ext.p_##core_func) \
3366  gl_info->gl_ops.ext.p_##core_func = (void *)gl_info->gl_ops.ext.p_##ext_func; \
3367  } while (0)
3368 
3370  MAP_GL_FUNCTION(glAttachShader, glAttachObjectARB);
3371  MAP_GL_FUNCTION(glBeginQuery, glBeginQueryARB);
3372  MAP_GL_FUNCTION(glBindAttribLocation, glBindAttribLocationARB);
3373  MAP_GL_FUNCTION(glBindBuffer, glBindBufferARB);
3374  MAP_GL_FUNCTION(glBindFragDataLocation, glBindFragDataLocationEXT);
3375  MAP_GL_FUNCTION(glBlendColor, glBlendColorEXT);
3376  MAP_GL_FUNCTION(glBlendEquation, glBlendEquationEXT);
3377  MAP_GL_FUNCTION(glBlendEquationSeparate, glBlendEquationSeparateEXT);
3378  MAP_GL_FUNCTION(glBlendFuncSeparate, glBlendFuncSeparateEXT);
3379  MAP_GL_FUNCTION(glBufferData, glBufferDataARB);
3380  MAP_GL_FUNCTION(glBufferSubData, glBufferSubDataARB);
3381  MAP_GL_FUNCTION(glColorMaski, glColorMaskIndexedEXT);
3382  MAP_GL_FUNCTION(glCompileShader, glCompileShaderARB);
3383  MAP_GL_FUNCTION(glCompressedTexImage2D, glCompressedTexImage2DARB);
3384  MAP_GL_FUNCTION(glCompressedTexImage3D, glCompressedTexImage3DARB);
3385  MAP_GL_FUNCTION(glCompressedTexSubImage2D, glCompressedTexSubImage2DARB);
3386  MAP_GL_FUNCTION(glCompressedTexSubImage3D, glCompressedTexSubImage3DARB);
3387  MAP_GL_FUNCTION(glCreateProgram, glCreateProgramObjectARB);
3388  MAP_GL_FUNCTION(glCreateShader, glCreateShaderObjectARB);
3389  MAP_GL_FUNCTION(glDebugMessageCallback, glDebugMessageCallbackARB);
3390  MAP_GL_FUNCTION(glDebugMessageControl, glDebugMessageControlARB);
3391  MAP_GL_FUNCTION(glDebugMessageInsert, glDebugMessageInsertARB);
3392  MAP_GL_FUNCTION(glDeleteBuffers, glDeleteBuffersARB);
3393  MAP_GL_FUNCTION(glDeleteProgram, glDeleteObjectARB);
3394  MAP_GL_FUNCTION(glDeleteQueries, glDeleteQueriesARB);
3395  MAP_GL_FUNCTION(glDeleteShader, glDeleteObjectARB);
3396  MAP_GL_FUNCTION(glDetachShader, glDetachObjectARB);
3397  MAP_GL_FUNCTION(glDisablei, glDisableIndexedEXT);
3398  MAP_GL_FUNCTION(glDisableVertexAttribArray, glDisableVertexAttribArrayARB);
3399  MAP_GL_FUNCTION(glDrawArraysInstanced, glDrawArraysInstancedARB);
3400  MAP_GL_FUNCTION(glDrawBuffers, glDrawBuffersARB);
3401  MAP_GL_FUNCTION(glDrawElementsInstanced, glDrawElementsInstancedARB);
3402  MAP_GL_FUNCTION(glEnablei, glEnableIndexedEXT);
3403  MAP_GL_FUNCTION(glEnableVertexAttribArray, glEnableVertexAttribArrayARB);
3404  MAP_GL_FUNCTION(glEndQuery, glEndQueryARB);
3405  MAP_GL_FUNCTION(glFramebufferTexture, glFramebufferTextureARB);
3406  MAP_GL_FUNCTION(glGenBuffers, glGenBuffersARB);
3407  MAP_GL_FUNCTION(glGenQueries, glGenQueriesARB);
3408  MAP_GL_FUNCTION(glGetActiveUniform, glGetActiveUniformARB);
3409  MAP_GL_FUNCTION(glGetAttachedShaders, glGetAttachedObjectsARB);
3410  MAP_GL_FUNCTION(glGetAttribLocation, glGetAttribLocationARB);
3411  MAP_GL_FUNCTION(glGetBooleani_v, glGetBooleanIndexedvEXT);
3412  MAP_GL_FUNCTION(glGetBufferSubData, glGetBufferSubDataARB);
3413  MAP_GL_FUNCTION(glGetCompressedTexImage, glGetCompressedTexImageARB);
3414  MAP_GL_FUNCTION(glGetDebugMessageLog, glGetDebugMessageLogARB);
3415  MAP_GL_FUNCTION(glGetIntegeri_v, glGetIntegerIndexedvEXT);
3416  MAP_GL_FUNCTION(glGetProgramInfoLog, glGetInfoLogARB);
3417  MAP_GL_FUNCTION(glGetProgramiv, glGetObjectParameterivARB);
3418  MAP_GL_FUNCTION(glGetQueryiv, glGetQueryivARB);
3419  MAP_GL_FUNCTION(glGetQueryObjectuiv, glGetQueryObjectuivARB);
3420  MAP_GL_FUNCTION(glGetShaderInfoLog, glGetInfoLogARB);
3421  MAP_GL_FUNCTION(glGetShaderiv, glGetObjectParameterivARB);
3422  MAP_GL_FUNCTION(glGetShaderSource, glGetShaderSourceARB);
3423  MAP_GL_FUNCTION(glGetUniformfv, glGetUniformfvARB);
3424  MAP_GL_FUNCTION(glGetUniformiv, glGetUniformivARB);
3425  MAP_GL_FUNCTION(glGetUniformLocation, glGetUniformLocationARB);
3426  MAP_GL_FUNCTION(glIsEnabledi, glIsEnabledIndexedEXT);
3427  MAP_GL_FUNCTION(glLinkProgram, glLinkProgramARB);
3428  MAP_GL_FUNCTION(glMapBuffer, glMapBufferARB);
3429  MAP_GL_FUNCTION_CAST(glShaderSource, glShaderSourceARB);
3430  MAP_GL_FUNCTION(glTexBuffer, glTexBufferARB);
3431  MAP_GL_FUNCTION_CAST(glTexImage3D, glTexImage3DEXT);
3432  MAP_GL_FUNCTION(glTexSubImage3D, glTexSubImage3DEXT);
3433  MAP_GL_FUNCTION(glUniform1f, glUniform1fARB);
3434  MAP_GL_FUNCTION(glUniform1fv, glUniform1fvARB);
3435  MAP_GL_FUNCTION(glUniform1i, glUniform1iARB);
3436  MAP_GL_FUNCTION(glUniform1iv, glUniform1ivARB);
3437  MAP_GL_FUNCTION(glUniform2f, glUniform2fARB);
3438  MAP_GL_FUNCTION(glUniform2fv, glUniform2fvARB);
3439  MAP_GL_FUNCTION(glUniform2i, glUniform2iARB);
3440  MAP_GL_FUNCTION(glUniform2iv, glUniform2ivARB);
3441  MAP_GL_FUNCTION(glUniform3f, glUniform3fARB);
3442  MAP_GL_FUNCTION(glUniform3fv, glUniform3fvARB);
3443  MAP_GL_FUNCTION(glUniform3i, glUniform3iARB);
3444  MAP_GL_FUNCTION(glUniform3iv, glUniform3ivARB);
3445  MAP_GL_FUNCTION(glUniform4f, glUniform4fARB);
3446  MAP_GL_FUNCTION(glUniform4fv, glUniform4fvARB);
3447  MAP_GL_FUNCTION(glUniform4i, glUniform4iARB);
3448  MAP_GL_FUNCTION(glUniform4iv, glUniform4ivARB);
3449  MAP_GL_FUNCTION(glUniformMatrix2fv, glUniformMatrix2fvARB);
3450  MAP_GL_FUNCTION(glUniformMatrix3fv, glUniformMatrix3fvARB);
3451  MAP_GL_FUNCTION(glUniformMatrix4fv, glUniformMatrix4fvARB);
3452  MAP_GL_FUNCTION(glUnmapBuffer, glUnmapBufferARB);
3453  MAP_GL_FUNCTION(glUseProgram, glUseProgramObjectARB);
3454  MAP_GL_FUNCTION(glValidateProgram, glValidateProgramARB);
3455  MAP_GL_FUNCTION(glVertexAttrib1f, glVertexAttrib1fARB);
3456  MAP_GL_FUNCTION(glVertexAttrib1fv, glVertexAttrib1fvARB);
3457  MAP_GL_FUNCTION(glVertexAttrib2f, glVertexAttrib2fARB);
3458  MAP_GL_FUNCTION(glVertexAttrib2fv, glVertexAttrib2fvARB);
3459  MAP_GL_FUNCTION(glVertexAttrib3f, glVertexAttrib3fARB);
3460  MAP_GL_FUNCTION(glVertexAttrib3fv, glVertexAttrib3fvARB);
3461  MAP_GL_FUNCTION(glVertexAttrib4f, glVertexAttrib4fARB);
3462  MAP_GL_FUNCTION(glVertexAttrib4fv, glVertexAttrib4fvARB);
3463  MAP_GL_FUNCTION(glVertexAttrib4Nsv, glVertexAttrib4NsvARB);
3464  MAP_GL_FUNCTION(glVertexAttrib4Nub, glVertexAttrib4NubARB);
3465  MAP_GL_FUNCTION(glVertexAttrib4Nubv, glVertexAttrib4NubvARB);
3466  MAP_GL_FUNCTION(glVertexAttrib4Nusv, glVertexAttrib4NusvARB);
3467  MAP_GL_FUNCTION(glVertexAttrib4sv, glVertexAttrib4svARB);
3468  MAP_GL_FUNCTION(glVertexAttrib4ubv, glVertexAttrib4ubvARB);
3469  MAP_GL_FUNCTION(glVertexAttribDivisor, glVertexAttribDivisorARB);
3470  MAP_GL_FUNCTION(glVertexAttribIPointer, glVertexAttribIPointerEXT);
3471  MAP_GL_FUNCTION(glVertexAttribPointer, glVertexAttribPointerARB);
3472 #undef MAP_GL_FUNCTION
3473 #undef MAP_GL_FUNCTION_CAST
3474 }
struct opengl_funcs gl_ops
GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v)
GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture)
GLAPI void GLAPIENTRY glBlendEquation(GLenum mode)
GLAPI void GLAPIENTRY glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
#define MAP_GL_FUNCTION_CAST(core_func, ext_func)
GLAPI void GLAPIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v)
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)
char ext[3]
Definition: mkdosfs.c:358
GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v)
GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v)
GLAPI void GLAPIENTRY glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
GLAPI void GLAPIENTRY glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
#define MAP_GL_FUNCTION(core_func, ext_func)
GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture)
GLAPI void GLAPIENTRY glGetCompressedTexImage(GLenum target, GLint lod, GLvoid *img)
GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v)
GLAPI void GLAPIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s)
GLAPI void GLAPIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
GLAPI void GLAPIENTRY glActiveTexture(GLenum texture)
GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
#define USE_GL_FUNC(pfn)
GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v)
GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r)

Referenced by wined3d_adapter_init_gl_caps().

◆ match_allows_spec_alpha()

static BOOL match_allows_spec_alpha ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 674 of file directx.c.

677 {
678  GLenum error;
679  DWORD data[16];
680 
681  if (!gl_info->supported[EXT_SECONDARY_COLOR])
682  return FALSE;
683 
684  while (gl_info->gl_ops.gl.p_glGetError());
685  GL_EXTCALL(glSecondaryColorPointerEXT)(4, GL_UNSIGNED_BYTE, 4, data);
686  error = gl_info->gl_ops.gl.p_glGetError();
687 
688  if (error == GL_NO_ERROR)
689  {
690  TRACE("GL Implementation accepts 4 component specular color pointers\n");
691  return TRUE;
692  }
693  else
694  {
695  TRACE("GL implementation does not accept 4 component specular colors, error %s\n",
697  return FALSE;
698  }
699 }
#define TRUE
Definition: types.h:120
struct opengl_funcs gl_ops
#define error(str)
Definition: mkdosfs.c:1605
#define GL_UNSIGNED_BYTE
Definition: gl.h:178
#define GL_NO_ERROR
Definition: gl.h:693
BOOL supported[WINED3D_GL_EXT_COUNT]
const char * debug_glerror(GLenum error)
Definition: utils.c:4789
#define GL_EXTCALL(f)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned int GLenum
Definition: gl.h:150

◆ match_amd_r300_to_500()

static BOOL match_amd_r300_to_500 ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 521 of file directx.c.

524 {
525  if (card_vendor != HW_VENDOR_AMD) return FALSE;
526  if (device == CARD_AMD_RADEON_9500) return TRUE;
527  if (device == CARD_AMD_RADEON_X700) return TRUE;
528  if (device == CARD_AMD_RADEON_X1600) return TRUE;
529  return FALSE;
530 }
#define TRUE
Definition: types.h:120
Definition: devices.h:37
enum wined3d_pci_vendor card_vendor
Definition: directx.c:2496

◆ match_apple()

static BOOL match_apple ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 548 of file directx.c.

551 {
552  /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
553  * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
554  * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
555  *
556  * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
557  * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
558  * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
559  * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
560  * is specific to the Mac OS X window management, and GL_APPLE_ycbcr_422 is QuickTime specific. So
561  * the chance that other implementations support them is rather small since Win32 QuickTime uses
562  * DirectDraw, not OpenGL.
563  *
564  * This test has been moved into wined3d_guess_gl_vendor()
565  */
566  return gl_vendor == GL_VENDOR_APPLE;
567 }

◆ match_apple_intel()

static BOOL match_apple_intel ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 635 of file directx.c.

638 {
639  return (card_vendor == HW_VENDOR_INTEL) && (gl_vendor == GL_VENDOR_APPLE);
640 }
enum wined3d_pci_vendor card_vendor
Definition: directx.c:2496

◆ match_apple_nonr500ati()

static BOOL match_apple_nonr500ati ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 642 of file directx.c.

645 {
646  if (gl_vendor != GL_VENDOR_APPLE) return FALSE;
647  if (card_vendor != HW_VENDOR_AMD) return FALSE;
648  if (device == CARD_AMD_RADEON_X1600) return FALSE;
649  return TRUE;
650 }
#define TRUE
Definition: types.h:120
Definition: devices.h:37
enum wined3d_pci_vendor card_vendor
Definition: directx.c:2496

◆ match_broken_arb_fog()

static BOOL match_broken_arb_fog ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 841 of file directx.c.

844 {
845  DWORD data[4];
846  GLuint tex, fbo;
847  GLenum status;
848  float color[4] = {0.0f, 1.0f, 0.0f, 0.0f};
849  GLuint prog;
850  GLint err_pos;
851  static const char program_code[] =
852  "!!ARBfp1.0\n"
853  "OPTION ARB_fog_linear;\n"
854  "MOV result.color, {1.0, 0.0, 0.0, 0.0};\n"
855  "END\n";
856 
858  return FALSE;
859  if (!gl_info->supported[ARB_FRAGMENT_PROGRAM])
860  return FALSE;
861 
862  gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
863  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
864  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
865  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
866  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 4, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
867  checkGLcall("glTexImage2D");
868 
869  gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
870  gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
871  gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
872  checkGLcall("glFramebufferTexture2D");
873 
874  status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
875  if (status != GL_FRAMEBUFFER_COMPLETE) ERR("FBO status %#x\n", status);
876  checkGLcall("glCheckFramebufferStatus");
877 
878  gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 1.0f, 0.0f);
879  gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
880  checkGLcall("glClear");
881  gl_info->gl_ops.gl.p_glViewport(0, 0, 4, 1);
882  checkGLcall("glViewport");
883 
884  gl_info->gl_ops.gl.p_glEnable(GL_FOG);
885  gl_info->gl_ops.gl.p_glFogf(GL_FOG_START, 0.5f);
886  gl_info->gl_ops.gl.p_glFogf(GL_FOG_END, 0.5f);
887  gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_LINEAR);
888  gl_info->gl_ops.gl.p_glHint(GL_FOG_HINT, GL_NICEST);
889  gl_info->gl_ops.gl.p_glFogfv(GL_FOG_COLOR, color);
890  checkGLcall("fog setup");
891 
892  GL_EXTCALL(glGenProgramsARB(1, &prog));
893  GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog));
895  strlen(program_code), program_code));
896  gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
897  checkGLcall("Test fragment program setup");
898 
899  gl_info->gl_ops.gl.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &err_pos);
900  if (err_pos != -1)
901  {
902  const char *error_str;
903  error_str = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB);
904  FIXME("Fog test program error at position %d: %s\n\n", err_pos, debugstr_a(error_str));
905  }
906 
907  gl_info->gl_ops.gl.p_glBegin(GL_TRIANGLE_STRIP);
908  gl_info->gl_ops.gl.p_glVertex3f(-1.0f, -1.0f, 0.0f);
909  gl_info->gl_ops.gl.p_glVertex3f( 1.0f, -1.0f, 1.0f);
910  gl_info->gl_ops.gl.p_glVertex3f(-1.0f, 1.0f, 0.0f);
911  gl_info->gl_ops.gl.p_glVertex3f( 1.0f, 1.0f, 1.0f);
912  gl_info->gl_ops.gl.p_glEnd();
913  checkGLcall("ARBfp fog test draw");
914 
915  gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
916  checkGLcall("glGetTexImage");
917  data[0] &= 0x00ffffff;
918  data[1] &= 0x00ffffff;
919  data[2] &= 0x00ffffff;
920  data[3] &= 0x00ffffff;
921 
922  gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
923  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, 0);
924 
925  gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
926  gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
927  gl_info->gl_ops.gl.p_glDisable(GL_FOG);
928  GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0));
929  gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_PROGRAM_ARB);
930  GL_EXTCALL(glDeleteProgramsARB(1, &prog));
931  checkGLcall("ARBfp fog test teardown");
932 
933  TRACE("Fog test data: %08x %08x %08x %08x\n", data[0], data[1], data[2], data[3]);
934  return data[0] != 0x00ff0000 || data[3] != 0x0000ff00;
935 }
#define ORM_FBO
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
struct opengl_funcs gl_ops
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * prog
Definition: isohybrid.c:47
#define GL_NEAREST
Definition: gl.h:678
#define GL_FOG_HINT
Definition: gl.h:582
#define GL_RGB8
Definition: gl.h:755
#define GL_FOG_END
Definition: gl.h:420
#define GL_BGRA
Definition: gl.h:1485
#define GL_PROGRAM_ERROR_POSITION_ARB
Definition: glext.h:1400
#define GL_COLOR_ATTACHMENT0
Definition: glext.h:1714
GLuint color
Definition: glext.h:6243
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL supported[WINED3D_GL_EXT_COUNT]
smooth NULL
Definition: ftsmooth.c:416
#define GL_FRAMEBUFFER
Definition: glext.h:1732
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
#define GL_FOG_MODE
Definition: gl.h:415
#define GL_FRAMEBUFFER_COMPLETE
Definition: glext.h:1707
#define GL_EXTCALL(f)
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
#define GL_FOG_COLOR
Definition: gl.h:417
#define debugstr_a
Definition: kernel32.h:31
#define GL_UNSIGNED_INT_8_8_8_8_REV
Definition: gl.h:1495
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GL_LINEAR
Definition: gl.h:421
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define GL_PROGRAM_ERROR_STRING_ARB
Definition: glext.h:1404
#define GL_NICEST
Definition: gl.h:585
#define GL_FOG
Definition: gl.h:414
unsigned int GLenum
Definition: gl.h:150
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int GLuint
Definition: gl.h:159
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
#define checkGLcall(A)
#define GL_TEXTURE_2D
Definition: gl.h:645
#define GL_PROGRAM_FORMAT_ASCII_ARB
Definition: glext.h:1405
struct wined3d_fbo_ops fbo_ops
int GLint
Definition: gl.h:156
#define GL_TRIANGLE_STRIP
Definition: gl.h:195
static SERVICE_STATUS status
Definition: service.c:31
#define GL_FOG_START
Definition: gl.h:419
#define GL_FRAGMENT_PROGRAM_ARB
Definition: glext.h:1466
Definition: ps.c:97

◆ match_broken_nv_clip()

static BOOL match_broken_nv_clip ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 702 of file directx.c.

705 {
706  GLuint prog;
707  BOOL ret = FALSE;
708  GLint pos;
709  static const char testcode[] =
710  "!!ARBvp1.0\n"
711  "OPTION NV_vertex_program2;\n"
712  "MOV result.clip[0], 0.0;\n"
713  "MOV result.position, 0.0;\n"
714  "END\n";
715 
716  if (!gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]) return FALSE;
717 
718  while (gl_info->gl_ops.gl.p_glGetError());
719 
720  GL_EXTCALL(glGenProgramsARB(1, &prog));
721  if(!prog)
722  {
723  ERR("Failed to create the NVvp clip test program\n");
724  return FALSE;
725  }
726  GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog));
728  strlen(testcode), testcode));
729  gl_info->gl_ops.gl.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &pos);
730  if(pos != -1)
731  {
732  WARN("GL_NV_vertex_program2_option result.clip[] test failed\n");
733  TRACE("error: %s\n", debugstr_a((const char *)gl_info->gl_ops.gl.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
734  ret = TRUE;
735  while (gl_info->gl_ops.gl.p_glGetError());
736  }
737  else TRACE("GL_NV_vertex_program2_option result.clip[] test passed\n");
738 
739  GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0));
740  GL_EXTCALL(glDeleteProgramsARB(1, &prog));
741  checkGLcall("GL_NV_vertex_program2_option result.clip[] test cleanup");
742 
743  return ret;
744 }
#define TRUE
Definition: types.h:120
struct opengl_funcs gl_ops
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * prog
Definition: isohybrid.c:47
#define WARN(fmt,...)
Definition: debug.h:111
#define GL_PROGRAM_ERROR_POSITION_ARB
Definition: glext.h:1400
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL supported[WINED3D_GL_EXT_COUNT]
#define GL_EXTCALL(f)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
int ret
#define GL_PROGRAM_ERROR_STRING_ARB
Definition: glext.h:1404
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int GLuint
Definition: gl.h:159
#define GL_VERTEX_PROGRAM_ARB
Definition: glext.h:1385
#define checkGLcall(A)
#define GL_PROGRAM_FORMAT_ASCII_ARB
Definition: glext.h:1405
int GLint
Definition: gl.h:156

◆ match_broken_rgba16()

static BOOL match_broken_rgba16 ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 799 of file directx.c.

802 {
803  /* GL_RGBA16 uses GL_RGBA8 internally on Geforce 7 and older cards.
804  * This leads to graphical bugs in Half Life 2 and Unreal engine games. */
805  GLuint tex;
806  GLint size;
807 
808  gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
809  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
810  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT, NULL);
811  checkGLcall("glTexImage2D");
812 
813  gl_info->gl_ops.gl.p_glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &size);
814  checkGLcall("glGetTexLevelParameteriv");
815  TRACE("Real color depth is %d\n", size);
816 
817  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, 0);
818  checkGLcall("glBindTexture");
819  gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
820  checkGLcall("glDeleteTextures");
821 
822  return size < 16;
823 }
#define GL_UNSIGNED_SHORT
Definition: gl.h:180
struct opengl_funcs gl_ops
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
unsigned int GLuint
Definition: gl.h:159
#define checkGLcall(A)
#define GL_TEXTURE_2D
Definition: gl.h:645
#define GL_TEXTURE_RED_SIZE
Definition: gl.h:661
int GLint
Definition: gl.h:156
#define GL_RGBA
Definition: gl.h:503
#define GL_RGBA16
Definition: gl.h:765

◆ match_broken_viewport_subpixel_bits()

static BOOL match_broken_viewport_subpixel_bits ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 937 of file directx.c.

940 {
941  if (!gl_info->supported[ARB_VIEWPORT_ARRAY])
942  return FALSE;
944  return FALSE;
946 }
#define ORM_FBO
BOOL supported[WINED3D_GL_EXT_COUNT]
BOOL wined3d_caps_gl_ctx_test_viewport_subpixel_bits(struct wined3d_caps_gl_ctx *ctx)
Definition: utils.c:3625

◆ match_dx10_capable()

static BOOL match_dx10_capable ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 652 of file directx.c.

655 {
656  /* DX9 cards support 40 single float varyings in hardware, most drivers report 32. ATI misreports
657  * 44 varyings. So assume that if we have more than 44 varyings we have a dx10 card.
658  * This detection is for the gl_ClipPos varying quirk. If a d3d9 card really supports more than 44
659  * varyings and we subtract one in dx9 shaders it's not going to hurt us because the dx9 limit is
660  * hardcoded
661  *
662  * dx10 cards usually have 64 varyings */
663  return gl_info->limits.glsl_varyings > 44;
664 }
struct wined3d_gl_limits limits

Referenced by match_not_dx10_capable().

◆ match_fbo_tex_update()

static BOOL match_fbo_tex_update ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 747 of file directx.c.

750 {
751  char data[4 * 4 * 4];
752  GLuint tex, fbo;
753  GLenum status;
754 
756 
757  memset(data, 0xcc, sizeof(data));
758 
759  gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
760  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
761  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
762  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
763  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 4, 4, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
764  checkGLcall("glTexImage2D");
765 
766  gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
767  gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
768  gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
769  checkGLcall("glFramebufferTexture2D");
770 
771  status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
772  if (status != GL_FRAMEBUFFER_COMPLETE) ERR("FBO status %#x\n", status);
773  checkGLcall("glCheckFramebufferStatus");
774 
775  memset(data, 0x11, sizeof(data));
776  gl_info->gl_ops.gl.p_glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
777  checkGLcall("glTexSubImage2D");
778 
779  gl_info->gl_ops.gl.p_glClearColor(0.996f, 0.729f, 0.745f, 0.792f);
780  gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
781  checkGLcall("glClear");
782 
783  gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
784  checkGLcall("glGetTexImage");
785 
786  gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
787  gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
788  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, 0);
789  checkGLcall("glBindTexture");
790 
791  gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
792  gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
793  checkGLcall("glDeleteTextures");
794 
795  return *(DWORD *)data == 0x11111111;
796 }
#define ORM_FBO
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
struct opengl_funcs gl_ops
#define GL_NEAREST
Definition: gl.h:678
#define GL_BGRA
Definition: gl.h:1485
#define GL_COLOR_ATTACHMENT0
Definition: glext.h:1714
smooth NULL
Definition: ftsmooth.c:416
#define GL_FRAMEBUFFER
Definition: glext.h:1732
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
#define GL_FRAMEBUFFER_COMPLETE
Definition: glext.h:1707
GLfloat f
Definition: glext.h:7540
#define GL_UNSIGNED_INT_8_8_8_8_REV
Definition: gl.h:1495
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define GL_RGBA8
Definition: gl.h:762
unsigned int GLenum
Definition: gl.h:150
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int GLuint
Definition: gl.h:159
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
#define checkGLcall(A)
#define GL_TEXTURE_2D
Definition: gl.h:645
struct wined3d_fbo_ops fbo_ops
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ match_fglrx()

static BOOL match_fglrx ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 825 of file directx.c.

828 {
829  return gl_vendor == GL_VENDOR_FGLRX;
830 }

◆ match_geforce5()

static BOOL match_geforce5 ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 532 of file directx.c.

535 {
537  {
541  {
542  return TRUE;
543  }
544  }
545  return FALSE;
546 }
#define TRUE
Definition: types.h:120
Definition: devices.h:37
enum wined3d_pci_vendor card_vendor
Definition: directx.c:2496

◆ match_not_dx10_capable()

static BOOL match_not_dx10_capable ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 666 of file directx.c.

669 {
670  return !match_dx10_capable(gl_info, ctx, gl_renderer, gl_vendor, card_vendor, device);
671 }
static BOOL match_dx10_capable(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
Definition: directx.c:652
Definition: devices.h:37
enum wined3d_pci_vendor card_vendor
Definition: directx.c:2496

◆ match_r200()

static BOOL match_r200 ( const struct wined3d_gl_info gl_info,
struct wined3d_caps_gl_ctx ctx,
const char gl_renderer,
enum wined3d_gl_vendor  gl_vendor,
enum wined3d_pci_vendor  card_vendor,
enum wined3d_pci_device  device 
)
static

Definition at line 832 of file directx.c.

835 {
836  if (card_vendor != HW_VENDOR_AMD) return FALSE;
837  if (device == CARD_AMD_RADEON_8500) return TRUE;
838  return FALSE;
839 }
#define TRUE
Definition: types.h:120
Definition: devices.h:37
enum wined3d_pci_vendor card_vendor
Definition: directx.c:2496

◆ parse_extension_string()

static void parse_extension_string ( struct wined3d_gl_info gl_info,
const char extensions,
const struct wined3d_extension_map map,
UINT  entry_count 
)
static

Definition at line 2638 of file directx.c.

2640 {
2641  while (*extensions)
2642  {
2643  const char *start;
2644  size_t len;
2645  UINT i;
2646 
2647  while (isspace(*extensions))
2648  ++extensions;
2649  start = extensions;
2650  while (!isspace(*extensions) && *extensions)
2651  ++extensions;
2652 
2653  len = extensions - start;
2654  if (!len)
2655  continue;
2656 
2657  TRACE("- %s.\n", debugstr_an(start, len));
2658 
2659  for (i = 0; i < entry_count; ++i)
2660  {
2661  if (len == strlen(map[i].extension_string)
2662  && !memcmp(start, map[i].extension_string, len))
2663  {
2664  TRACE(" FOUND: %s support.\n", map[i].extension_string);
2665  gl_info->supported[map[i].extension] = TRUE;
2666  break;
2667  }
2668  }
2669  }
2670 }
#define isspace(c)
Definition: acclib.h:69
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
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 supported[WINED3D_GL_EXT_COUNT]
#define TRACE(s)
Definition: solgame.cpp:4
Definition: _map.h:44
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:47
GLenum GLsizei len
Definition: glext.h:6722
GLuint start
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50

Referenced by wined3d_adapter_init_gl_caps().

◆ position_d3dcolor()

static void WINE_GLAPI position_d3dcolor ( const void data)
static

Definition at line 6300 of file directx.c.

6301 {
6302  DWORD pos = *((const DWORD *)data);
6303 
6304  FIXME("Add a test for fixed function position from d3dcolor type.\n");
6305  context_get_current()->gl_info->gl_ops.gl.p_glVertex4s(D3DCOLOR_B_R(pos),
6306  D3DCOLOR_B_G(pos),
6307  D3DCOLOR_B_B(pos),
6308  D3DCOLOR_B_A(pos));
6309 }
#define FIXME(fmt,...)
Definition: debug.h:110
struct wined3d_context * context_get_current(void)
Definition: context.c:1507
#define D3DCOLOR_B_B(dw)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define D3DCOLOR_B_G(dw)
#define D3DCOLOR_B_R(dw)
#define D3DCOLOR_B_A(dw)

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ position_float4()

static void WINE_GLAPI position_float4 ( const void data)
static

Definition at line 6311 of file directx.c.

6312 {
6313  const GLfloat *pos = data;
6314 
6315  if (pos[3] != 0.0f && pos[3] != 1.0f)
6316  {
6317  float w = 1.0f / pos[3];
6318 
6319  context_get_current()->gl_info->gl_ops.gl.p_glVertex4f(pos[0] * w, pos[1] * w, pos[2] * w, w);
6320  }
6321  else
6322  {
6323  context_get_current()->gl_info->gl_ops.gl.p_glVertex3fv(pos);
6324  }
6325 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
struct wined3d_context * context_get_current(void)
Definition: context.c:1507
GLfloat f
Definition: glext.h:7540
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
float GLfloat
Definition: gl.h:161

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ query_gpu_description()

static const struct gpu_description* query_gpu_description ( const struct wined3d_gl_info gl_info,
UINT64 vram_bytes 
)
static

Definition at line 1566 of file directx.c.

1567 {
1570  const struct gpu_description *gpu_description;
1571  static unsigned int once;
1572 
1573  if (gl_info->supported[WGL_WINE_QUERY_RENDERER])
1574  {
1575  GLuint value;
1576 
1577  if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VENDOR_ID_WINE, &value)))
1578  vendor = value;
1579  if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_DEVICE_ID_WINE, &value)))
1580  device = value;
1581  if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VIDEO_MEMORY_WINE, &value)))
1582  *vram_bytes = (UINT64)value * 1024 * 1024;
1583  TRACE("Card reports vendor PCI ID 0x%04x, device PCI ID 0x%04x, 0x%s bytes of video memory.\n",
1584  vendor, device, wine_dbgstr_longlong(*vram_bytes));
1585  }
1586  else if (gl_info->supported[NVX_GPU_MEMORY_INFO])
1587  {
1588  GLint vram_kb;
1589  gl_info->gl_ops.gl.p_glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &vram_kb);
1590 
1591  *vram_bytes = (UINT64)vram_kb * 1024;
1592  TRACE("Got 0x%s as video memory from NVX_GPU_MEMORY_INFO extension.\n",
1593  wine_dbgstr_longlong(*vram_bytes));
1594  }
1595 
1597  {
1599  TRACE("Overriding vendor PCI ID with 0x%04x.\n", vendor);
1600  }
1601 
1603  {
1605  TRACE("Overriding device PCI ID with 0x%04x.\n", device);
1606  }
1607 
1609  {
1610  *vram_bytes = wined3d_settings.emulated_textureram;
1611  TRACE("Overriding amount of video memory with 0x%s bytes.\n",
1612  wine_dbgstr_longlong(*vram_bytes));
1613  }
1614 
1618  ERR_(winediag)("Invalid GPU override %04x:%04x specified, ignoring.\n", vendor, device);
1619 
1620  return gpu_description;
1621 }
wined3d_pci_device
struct opengl_funcs gl_ops
#define ERR_(ch,...)
Definition: debug.h:156
#define WGL_RENDERER_DEVICE_ID_WINE
Definition: wgl.h:5048
#define PCI_DEVICE_NONE
Definition: devices.h:37
BOOL supported[WINED3D_GL_EXT_COUNT]
#define WGL_RENDERER_VIDEO_MEMORY_WINE
Definition: wgl.h:5058
#define WGL_RENDERER_VENDOR_ID_WINE
Definition: wgl.h:5056
#define GL_EXTCALL(f)
#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
Definition: wgl.h:1585
#define TRACE(s)
Definition: solgame.cpp:4
const WCHAR * vendor
Definition: db.cpp:863
unsigned short pci_vendor_id
#define PCI_VENDOR_NONE
unsigned short pci_device_id
GLsizei const GLfloat * value
Definition: glext.h:6069
static const struct gpu_description * get_gpu_description(enum wined3d_pci_vendor vendor, enum wined3d_pci_device device)
Definition: directx.c:1552
unsigned int GLuint
Definition: gl.h:159
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
int GLint
Definition: gl.h:156
unsigned long long UINT64
wined3d_pci_vendor

Referenced by wined3d_adapter_init_gl_caps().

◆ quirk_allows_specular_alpha()

static void quirk_allows_specular_alpha ( struct wined3d_gl_info gl_info)
static

Definition at line 1023 of file directx.c.

1024 {
1026 }
#define WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA

◆ quirk_amd_dx9()

static void quirk_amd_dx9 ( struct wined3d_gl_info gl_info)
static

Definition at line 957 of file directx.c.

958 {
959  /* MacOS advertises GL_ARB_texture_non_power_of_two on ATI r500 and earlier cards, although
960  * these cards only support GL_ARB_texture_rectangle(D3DPTEXTURECAPS_NONPOW2CONDITIONAL).
961  * If real NP2 textures are used, the driver falls back to software. We could just remove the
962  * extension and use GL_ARB_texture_rectangle instead, but texture_rectangle is inconvenient
963  * due to the non-normalized texture coordinates. Thus set an internal extension flag,
964  * GL_WINE_normalized_texrect, which signals the code that it can use non power of two textures
965  * as per GL_ARB_texture_non_power_of_two, but has to stick to the texture_rectangle limits.
966  *
967  * fglrx doesn't advertise GL_ARB_texture_non_power_of_two, but it advertises opengl 2.0 which
968  * has this extension promoted to core. The extension loading code sets this extension supported
969  * due to that, so this code works on fglrx as well. */
971  {
972  TRACE("GL_ARB_texture_non_power_of_two advertised on R500 or earlier card, removing.\n");
975  }
976 }
#define TRUE
Definition: types.h:120
BOOL supported[WINED3D_GL_EXT_COUNT]
#define TRACE(s)
Definition: solgame.cpp:4

◆ quirk_apple_glsl_constants()

static void quirk_apple_glsl_constants ( struct wined3d_gl_info gl_info)
static

Definition at line 948 of file directx.c.

949 {
950  /* MacOS needs uniforms for relative addressing offsets. This can accumulate to quite a few uniforms.
951  * Beyond that the general uniform isn't optimal, so reserve a number of uniforms. 12 vec4's should
952  * allow 48 different offsets or other helper immediate values. */
953  TRACE("Reserving 12 GLSL constants for compiler private use.\n");
954  gl_info->reserved_glsl_constants = max(gl_info->reserved_glsl_constants, 12);
955 }
#define max(a, b)
Definition: svc.c:63
#define TRACE(s)
Definition: solgame.cpp:4

◆ quirk_broken_arb_fog()

static void quirk_broken_arb_fog ( struct wined3d_gl_info gl_info)
static

Definition at line 1071 of file directx.c.

1072 {
1074 }
#define WINED3D_QUIRK_BROKEN_ARB_FOG

◆ quirk_broken_rgba16()

static void quirk_broken_rgba16 ( struct wined3d_gl_info gl_info)
static

Definition at line 1038 of file directx.c.

1039 {
1040  gl_info->quirks |= WINED3D_QUIRK_BROKEN_RGBA16;
1041 }
#define WINED3D_QUIRK_BROKEN_RGBA16

◆ quirk_broken_viewport_subpixel_bits()

static void quirk_broken_viewport_subpixel_bits ( struct wined3d_gl_info gl_info)
static

Definition at line 1076 of file directx.c.

1077 {
1078  if (gl_info->supported[ARB_CLIP_CONTROL])
1079  {
1080  TRACE("Disabling ARB_clip_control.\n");
1081  gl_info->supported[ARB_CLIP_CONTROL] = FALSE;
1082  }
1083 }
BOOL supported[WINED3D_GL_EXT_COUNT]
#define TRACE(s)
Definition: solgame.cpp:4

◆ quirk_clip_varying()

static void quirk_clip_varying ( struct wined3d_gl_info gl_info)
static

Definition at line 1018 of file directx.c.

1019 {
1021 }
#define WINED3D_QUIRK_GLSL_CLIP_VARYING

◆ quirk_disable_nvvp_clip()

static void quirk_disable_nvvp_clip ( struct wined3d_gl_info gl_info)
static

Definition at line 1028 of file directx.c.

1029 {
1031 }
#define WINED3D_QUIRK_NV_CLIP_BROKEN

◆ quirk_fbo_tex_update()

static void quirk_fbo_tex_update ( struct wined3d_gl_info gl_info)
static

Definition at line 1033 of file directx.c.

1034 {
1036 }
#define WINED3D_QUIRK_FBO_TEX_UPDATE

◆ quirk_infolog_spam()

static void quirk_infolog_spam ( struct wined3d_gl_info gl_info)
static

Definition at line 1043 of file directx.c.

1044 {
1045  gl_info->quirks |= WINED3D_QUIRK_INFO_LOG_SPAM;
1046 }
#define WINED3D_QUIRK_INFO_LOG_SPAM

◆ quirk_limited_tex_filtering()

static void quirk_limited_tex_filtering ( struct wined3d_gl_info gl_info)
static

Definition at line 1048 of file directx.c.

1049 {
1050  /* Nvidia GeForce 6xxx and 7xxx support accelerated VTF only on a few
1051  selected texture formats. They are apparently the only DX9 class GPUs
1052  supporting VTF.
1053  Also, DX9-era GPUs are somewhat limited with float textures
1054  filtering and blending. */
1056 }
#define WINED3D_QUIRK_LIMITED_TEX_FILTERING

◆ quirk_no_np2()

static void quirk_no_np2 ( struct wined3d_gl_info gl_info)
static

Definition at line 978 of file directx.c.

979 {
980  /* The nVidia GeForceFX series reports OpenGL 2.0 capabilities with the latest drivers versions, but
981  * doesn't explicitly advertise the ARB_tex_npot extension in the GL extension string.
982  * This usually means that ARB_tex_npot is supported in hardware as long as the application is staying
983  * within the limits enforced by the ARB_texture_rectangle extension. This however is not true for the
984  * FX series, which instantly falls back to a slower software path as soon as ARB_tex_npot is used.
985  * We therefore completely remove ARB_tex_npot from the list of supported extensions.
986  *
987  * Note that wine_normalized_texrect can't be used in this case because internally it uses ARB_tex_npot,
988  * triggering the software fallback. There is not much we can do here apart from disabling the
989  * software-emulated extension and re-enable ARB_tex_rect (which was previously disabled
990  * in wined3d_adapter_init_gl_caps).
991  * This fixup removes performance problems on both the FX 5900 and FX 5700 (e.g. for framebuffer
992  * post-processing effects in the game "Max Payne 2").
993  * The behaviour can be verified through a simple test app attached in bugreport #14724. */
994  TRACE("GL_ARB_texture_non_power_of_two advertised through OpenGL 2.0 on NV FX card, removing.\n");
997 }
#define TRUE
Definition: types.h:120
BOOL supported[WINED3D_GL_EXT_COUNT]
#define TRACE(s)
Definition: solgame.cpp:4

◆ quirk_r200_constants()

static void quirk_r200_constants ( struct wined3d_gl_info gl_info)
static

Definition at line 1058 of file directx.c.

1059 {
1060  /* The Mesa r200 driver (and there is no other driver for this GPU Wine would run on)
1061  * loads some fog parameters (start, end, exponent, but not the color) into the
1062  * program.
1063  *
1064  * Apparently the fog hardware is only able to handle linear fog with a range of 0.0;1.0,
1065  * and it is the responsibility of the vertex pipeline to handle non-linear fog and
1066  * linear fog with start and end other than 0.0 and 1.0. */
1067  TRACE("Reserving 1 ARB constant for compiler private use.\n");
1068  gl_info->reserved_arb_constants = max(gl_info->reserved_arb_constants, 1);
1069 }
#define max(a, b)
Definition: svc.c:63
#define TRACE(s)
Definition: solgame.cpp:4

◆ quirk_texcoord_w()

static void quirk_texcoord_w ( struct wined3d_gl_info gl_info)
static

Definition at line 999 of file directx.c.

1000 {
1001  /* The Intel GPUs on MacOS set the .w register of texcoords to 0.0 by default, which causes problems
1002  * with fixed function fragment processing. Ideally this flag should be detected with a test shader
1003  * and OpenGL feedback mode, but some GL implementations (MacOS ATI at least, probably all MacOS ones)
1004  * do not like vertex shaders in feedback mode and return an error, even though it should be valid
1005  * according to the spec.
1006  *
1007  * We don't want to enable this on all cards, as it adds an extra instruction per texcoord used. This
1008  * makes the shader slower and eats instruction slots which should be available to the d3d app.
1009  *
1010  * ATI Radeon HD 2xxx cards on MacOS have the issue. Instead of checking for the buggy cards, blacklist
1011  * all radeon cards on Macs and whitelist the good ones. That way we're prepared for the future. If
1012  * this workaround is activated on cards that do not need it, it won't break things, just affect
1013  * performance negatively. */
1014  TRACE("Enabling vertex texture coord fixes in vertex shaders.\n");
1016 }
#define TRACE(s)
Definition: solgame.cpp:4
#define WINED3D_QUIRK_SET_TEXCOORD_W

◆ select_card_handler()

static enum wined3d_pci_device select_card_handler ( const struct gl_vendor_selection table,
unsigned int  table_size,
enum wined3d_gl_vendor  gl_vendor,
const char gl_renderer 
)
static

Definition at line 2469 of file directx.c.

2471 {
2472  unsigned int i, j;
2473 
2474  for (i = 0; i < table_size; ++i)
2475  {
2476  if (table[i].gl_vendor != gl_vendor)
2477  continue;
2478 
2479  TRACE("Applying card selector \"%s\".\n", table[i].description);
2480 
2481  for (j = 0; j < table[i].cards_size; ++j)
2482  {
2483  if (strstr(gl_renderer, table[i].cards[j].renderer))
2484  return table[i].cards[j].id;
2485  }
2486  return PCI_DEVICE_NONE;
2487  }
2488  FIXME("Couldn't find a suitable card selector for GL vendor %04x (using GL_RENDERER %s)\n",
2489  gl_vendor, debugstr_a(gl_renderer));
2490 
2491  return PCI_DEVICE_NONE;
2492 }
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
const char * description
Definition: directx.c:2497
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define PCI_DEVICE_NONE
#define FIXME(fmt,...)
Definition: debug.h:110
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LOCAL int table_size
Definition: write.c:65

Referenced by wined3d_guess_card().

◆ select_fragment_implementation()

static const struct fragment_pipeline* select_fragment_implementation ( const struct wined3d_gl_info gl_info,
const struct wined3d_shader_backend_ops shader_backend_ops 
)
static

Definition at line 2607 of file directx.c.

2609 {
2610  if (shader_backend_ops == &glsl_shader_backend && gl_info->supported[ARB_FRAGMENT_SHADER])
2611  return &glsl_fragment_pipe;
2612  if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
2613  return &arbfp_fragment_pipeline;
2614  if (gl_info->supported[ATI_FRAGMENT_SHADER])
2615  return &atifs_fragment_pipeline;
2616  if (gl_info->supported[NV_REGISTER_COMBINERS] && gl_info->supported[NV_TEXTURE_SHADER2])
2617  return &nvts_fragment_pipeline;
2618  if (gl_info->supported[NV_REGISTER_COMBINERS])
2619  return &nvrc_fragment_pipeline;
2620  return &ffp_fragment_pipeline;
2621 }
const struct fragment_pipeline nvrc_fragment_pipeline
const struct fragment_pipeline glsl_fragment_pipe
const struct fragment_pipeline ffp_fragment_pipeline
Definition: state.c:5918
const struct fragment_pipeline atifs_fragment_pipeline
BOOL supported[WINED3D_GL_EXT_COUNT]
const struct fragment_pipeline nvts_fragment_pipeline
const struct fragment_pipeline arbfp_fragment_pipeline
const struct wined3d_shader_backend_ops glsl_shader_backend

Referenced by wined3d_adapter_init_gl_caps().

◆ select_shader_backend()

static const struct wined3d_shader_backend_ops* select_shader_backend ( const struct wined3d_gl_info gl_info)
static

Definition at line 2623 of file directx.c.

2624 {
2625  BOOL glsl = wined3d_settings.glslRequested && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
2626 
2627  if (glsl && gl_info->supported[ARB_VERTEX_SHADER] && gl_info->supported[ARB_FRAGMENT_SHADER])
2628  return &glsl_shader_backend;
2629  if (gl_info->supported[ARB_VERTEX_PROGRAM] && gl_info->supported[ARB_FRAGMENT_PROGRAM])
2631  if (glsl && (gl_info->supported[ARB_VERTEX_SHADER] || gl_info->supported[ARB_FRAGMENT_SHADER]))
2632  return &glsl_shader_backend;
2633  if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_FRAGMENT_PROGRAM])
2635  return &none_shader_backend;
2636 }
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL supported[WINED3D_GL_EXT_COUNT]
const struct wined3d_shader_backend_ops none_shader_backend
Definition: shader.c:3245
#define MAKEDWORD_VERSION(maj, min)
const struct wined3d_shader_backend_ops glsl_shader_backend
const struct wined3d_shader_backend_ops arb_program_shader_backend

Referenced by wined3d_adapter_init_gl_caps().

◆ select_vertex_implementation()

static const struct wined3d_vertex_pipe_ops* select_vertex_implementation ( const struct wined3d_gl_info gl_info,
const struct wined3d_shader_backend_ops shader_backend_ops 
)
static

Definition at line 2599 of file directx.c.

2601 {
2602  if (shader_backend_ops == &glsl_shader_backend && gl_info->supported[ARB_VERTEX_SHADER])
2603  return &glsl_vertex_pipe;
2604  return &ffp_vertex_pipe;
2605 }
const struct wined3d_vertex_pipe_ops ffp_vertex_pipe
Definition: state.c:5847
const struct wined3d_vertex_pipe_ops glsl_vertex_pipe
BOOL supported[WINED3D_GL_EXT_COUNT]
const struct wined3d_shader_backend_ops glsl_shader_backend

Referenced by wined3d_adapter_init_gl_caps().

◆ specular_d3dcolor()

static void WINE_GLAPI specular_d3dcolor ( const void data)
static

Definition at line 6337 of file directx.c.

6338 {
6339  DWORD specularColor = *((const DWORD *)data);
6340  GLubyte d[] =
6341  {
6342  D3DCOLOR_B_R(specularColor),
6343  D3DCOLOR_B_G(specularColor),
6344  D3DCOLOR_B_B(specularColor)
6345  };
6346 
6347  context_get_current()->gl_info->gl_ops.ext.p_glSecondaryColor3ubvEXT(d);
6348 }
unsigned char GLubyte
Definition: gl.h:157
struct wined3d_context * context_get_current(void)
Definition: context.c:1507
#define D3DCOLOR_B_B(dw)
#define d
Definition: ke_i.h:81
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define D3DCOLOR_B_G(dw)
#define D3DCOLOR_B_R(dw)

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ test_arb_vs_offset_limit()

static BOOL test_arb_vs_offset_limit ( const struct wined3d_gl_info gl_info)
static

Definition at line 486 of file directx.c.

487 {
488  GLuint prog;
489  BOOL ret = FALSE;
490  static const char testcode[] =
491  "!!ARBvp1.0\n"
492  "PARAM C[66] = { program.env[0..65] };\n"
493  "ADDRESS A0;"
494  "PARAM zero = {0.0, 0.0, 0.0, 0.0};\n"
495  "ARL A0.x, zero.x;\n"
496  "MOV result.position, C[A0.x + 65];\n"
497  "END\n";
498 
499  while (gl_info->gl_ops.gl.p_glGetError());
500  GL_EXTCALL(glGenProgramsARB(1, &prog));
501  if(!prog) {
502  ERR("Failed to create an ARB offset limit test program\n");
503  }
504  GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog));
506  strlen(testcode), testcode));
507  if (gl_info->gl_ops.gl.p_glGetError())
508  {
509  TRACE("OpenGL implementation does not allow indirect addressing offsets > 63\n");
510  TRACE("error: %s\n", debugstr_a((const char *)gl_info->gl_ops.gl.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
511  ret = TRUE;
512  } else TRACE("OpenGL implementation allows offsets > 63\n");
513 
514  GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0));
515  GL_EXTCALL(glDeleteProgramsARB(1, &prog));
516  checkGLcall("ARB vp offset limit test cleanup");
517 
518  return ret;
519 }
#define TRUE
Definition: types.h:120
struct opengl_funcs gl_ops
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * prog
Definition: isohybrid.c:47
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GL_EXTCALL(f)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
int ret
#define GL_PROGRAM_ERROR_STRING_ARB
Definition: glext.h:1404
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int GLuint
Definition: gl.h:159
#define GL_VERTEX_PROGRAM_ARB
Definition: glext.h:1385
#define checkGLcall(A)
#define GL_PROGRAM_FORMAT_ASCII_ARB
Definition: glext.h:1405

Referenced by wined3d_adapter_init_gl_caps().

◆ test_pbo_functionality()

static void test_pbo_functionality ( struct wined3d_gl_info gl_info)
static

Definition at line 570 of file directx.c.

571 {
572  /* Some OpenGL implementations, namely Apple's Geforce 8 driver, advertises PBOs,
573  * but glTexSubImage from a PBO fails miserably, with the first line repeated over
574  * all the texture. This function detects this bug by its symptom and disables PBOs
575  * if the test fails.
576  *
577  * The test uploads a 4x4 texture via the PBO in the "native" format GL_BGRA,
578  * GL_UNSIGNED_INT_8_8_8_8_REV. This format triggers the bug, and it is what we use
579  * for D3DFMT_A8R8G8B8. Then the texture is read back without any PBO and the data
580  * read back is compared to the original. If they are equal PBOs are assumed to work,
581  * otherwise the PBO extension is disabled. */
582  GLuint texture, pbo;
583  static const unsigned int pattern[] =
584  {
585  0x00000000, 0x000000ff, 0x0000ff00, 0x40ff0000,
586  0x80ffffff, 0x40ffff00, 0x00ff00ff, 0x0000ffff,
587  0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x000000ff,
588  0x80ff00ff, 0x0000ffff, 0x00ff00ff, 0x40ff00ff
589  };
590  unsigned int check[ARRAY_SIZE(pattern)];
591 
592  /* No PBO -> No point in testing them. */
593  if (!gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]) return;
594 
595  while (gl_info->gl_ops.gl.p_glGetError());
596  gl_info->gl_ops.gl.p_glGenTextures(1, &texture);
597  gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
598 
599  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
600  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 4, 4, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
601  checkGLcall("Specifying the PBO test texture");
602 
603  GL_EXTCALL(glGenBuffers(1, &pbo));
604  GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo));
606  checkGLcall("Specifying the PBO test pbo");
607 
608  gl_info->gl_ops.gl.p_glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
609  checkGLcall("Loading the PBO test texture");
610 
611  GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
612 
613  gl_info->gl_ops.gl.p_glFinish(); /* just to be sure */
614 
615  memset(check, 0, sizeof(check));
616  gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, check);
617  checkGLcall("Reading back the PBO test texture");
618 
619  gl_info->gl_ops.gl.p_glDeleteTextures(1, &texture);
620  GL_EXTCALL(glDeleteBuffers(1, &pbo));
621  checkGLcall("PBO test cleanup");
622 
623  if (memcmp(check, pattern, sizeof(check)))
624  {
625  WARN_(d3d_perf)("PBO test failed, read back data doesn't match original.\n"
626  "Disabling PBOs. This may result in slower performance.\n");
628  }
629  else
630  {
631  TRACE("PBO test successful.\n");
632  }
633 }
struct opengl_funcs gl_ops
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define GL_STREAM_DRAW
Definition: glext.h:347
#define GL_BGRA
Definition: gl.h:1485
BOOL supported[WINED3D_GL_EXT_COUNT]
#define GL_PIXEL_UNPACK_BUFFER
Definition: glext.h:477
smooth NULL
Definition: ftsmooth.c:416
#define GL_EXTCALL(f)
#define TRACE(s)
Definition: solgame.cpp:4
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL _In_opt_ BRUSHOBJ * pbo
Definition: winddi.h:3433
GLenum GLuint texture
Definition: glext.h:6295
#define GL_UNSIGNED_INT_8_8_8_8_REV
Definition: gl.h:1495
void check(CONTEXT *pContext)
Definition: NtContinue.c:61
#define GL_RGBA8
Definition: gl.h:762
unsigned int GLuint
Definition: gl.h:159
#define ARRAY_SIZE(a)
Definition: main.h:24
#define checkGLcall(A)
#define GL_TEXTURE_2D
Definition: gl.h:645
#define memset(x, y, z)
Definition: compat.h:39
#define WARN_(ch,...)
Definition: debug.h:157
#define GL_TEXTURE_MAX_LEVEL
Definition: gl.h:1504
GLubyte * pattern
Definition: glext.h:7787

Referenced by fixup_extensions().

◆ warn_no_specular_func()

static void WINE_GLAPI warn_no_specular_func ( const void data)
static

Definition at line 6350 of file directx.c.

6351 {
6352  WARN("GL_EXT_secondary_color not supported.\n");
6353 }
#define WARN(fmt,...)
Definition: debug.h:111

Referenced by wined3d_adapter_init_ffp_attrib_ops().

◆ WINE_DECLARE_DEBUG_CHANNEL() [1/2]

WINE_DECLARE_DEBUG_CHANNEL ( d3d_perf  )

◆ WINE_DECLARE_DEBUG_CHANNEL() [2/2]

WINE_DECLARE_DEBUG_CHANNEL ( winediag  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d  )

◆ wined3d_adapter_cleanup()

static void wined3d_adapter_cleanup ( struct wined3d_adapter adapter)
static

Definition at line 450 of file directx.c.

451 {
452  heap_free(adapter->gl_info.formats);
453  heap_free(adapter->cfgs);
454 }
struct wined3d_pixel_format * cfgs
struct wined3d_gl_info gl_info
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by wined3d_decref().

◆ wined3d_adapter_init()

static BOOL wined3d_adapter_init ( struct wined3d_adapter adapter,
UINT  ordinal,
DWORD  wined3d_creation_flags 
)
static

Definition at line 6646 of file directx.c.

6647 {
6648  static const DWORD supported_gl_versions[] =
6649  {
6650  MAKEDWORD_VERSION(4, 4),
6651  MAKEDWORD_VERSION(3, 2),
6652  MAKEDWORD_VERSION(1, 0),
6653  };
6654  struct wined3d_gl_info *gl_info = &adapter->gl_info;
6655  struct wined3d_caps_gl_ctx caps_gl_ctx = {0};
6656  unsigned int i;
6657  DISPLAY_DEVICEW display_device;
6658  DWORD max_gl_version;
6659 
6660  TRACE("adapter %p, ordinal %u.\n", adapter, ordinal);
6661 
6662  adapter->ordinal = ordinal;
6663 
6664 /* Dynamically load all GL core functions */
6665 #ifdef USE_WIN32_OPENGL
6666  {
6667  HMODULE mod_gl = GetModuleHandleA("opengl32.dll");
6668 #define USE_GL_FUNC(f) gl_info->gl_ops.gl.p_##f = (void *)GetProcAddress(mod_gl, #f);
6670 #undef USE_GL_FUNC
6671  gl_info->gl_ops.wgl.p_wglSwapBuffers = (void *)GetProcAddress(mod_gl, "wglSwapBuffers");
6672  gl_info->gl_ops.wgl.p_wglGetPixelFormat = (void *)GetProcAddress(mod_gl, "wglGetPixelFormat");
6673  }
6674 #else
6675  /* To bypass the opengl32 thunks retrieve functions from the WGL driver instead of opengl32 */
6676  {
6677  HDC hdc = GetDC( 0 );
6678  const struct opengl_funcs *wgl_driver = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION );
6679  ReleaseDC( 0, hdc );
6680  if (!wgl_driver || wgl_driver == (void *)-1) return FALSE;
6681  gl_info->gl_ops.wgl = wgl_driver->wgl;
6682  gl_info->gl_ops.gl = wgl_driver->gl;
6683  }
6684 #endif
6685 
6686  glEnableWINE = gl_info->gl_ops.gl.p_glEnable;
6687  glDisableWINE = gl_info->gl_ops.gl.p_glDisable;
6688 
6689  if (!AllocateLocallyUniqueId(&adapter->luid))
6690  {
6691  ERR("Failed to set adapter LUID (%#x).\n", GetLastError());
6692  return FALSE;
6693  }
6694  TRACE("Allocated LUID %08x:%08x for adapter %p.\n",
6695  adapter->luid.HighPart, adapter->luid.LowPart, adapter);
6696 
6697  if (!wined3d_caps_gl_ctx_create(adapter, &caps_gl_ctx))
6698  {
6699  ERR("Failed to get a GL context for adapter %p.\n", adapter);
6700  return FALSE;
6701  }
6702 
6703  max_gl_version = get_max_gl_version(gl_info, wined3d_creation_flags);
6704 
6705  if (wined3d_creation_flags & WINED3D_REQUEST_D3D10)
6706  {
6707  const char *gl_extensions = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_EXTENSIONS);
6708  if (!has_extension(gl_extensions, "GL_ARB_compatibility"))
6709  {
6710  ERR_(winediag)("GL_ARB_compatibility not supported, requesting context with GL version 3.2.\n");
6711  max_gl_version = MAKEDWORD_VERSION(3, 2);
6712  }
6713  }
6714 
6715  for (i = 0; i < ARRAY_SIZE(supported_gl_versions); ++i)
6716  {
6717  if (supported_gl_versions[i] <= max_gl_version)
6718  break;
6719  }
6720  if (i == ARRAY_SIZE(supported_gl_versions))
6721  {
6722  ERR_(winediag)("Requested invalid GL version %u.%u.\n",
6723  max_gl_version >> 16, max_gl_version & 0xffff);
6724  i = ARRAY_SIZE(supported_gl_versions) - 1;
6725  }
6726 
6727  for (; i < ARRAY_SIZE(supported_gl_versions); ++i)
6728  {
6729  gl_info->selected_gl_version = supported_gl_versions[i];
6730 
6731  if (wined3d_caps_gl_ctx_create_attribs(&caps_gl_ctx, gl_info))
6732  break;
6733 
6734  WARN("Couldn't create an OpenGL %u.%u context, trying fallback to a lower version.\n",
6735  supported_gl_versions[i] >> 16, supported_gl_versions[i] & 0xffff);
6736  }
6737 
6738  if (!wined3d_adapter_init_gl_caps(adapter, &caps_gl_ctx, wined3d_creation_flags))
6739  {
6740  ERR("Failed to initialize GL caps for adapter %p.\n", adapter);
6741  wined3d_caps_gl_ctx_destroy(&caps_gl_ctx);
6742  return FALSE;
6743  }
6744 
6746  ERR_(winediag)("You are using the backbuffer for offscreen rendering. "
6747  "This is unsupported, and will be removed in a future version.\n");
6748 
6749  wined3d_adapter_init_fb_cfgs(adapter, caps_gl_ctx.dc);
6750  /* We haven't found any suitable formats. This should only happen in
6751  * case of GDI software rendering, which is pretty useless anyway. */
6752  if (!adapter->cfg_count)
6753  {
6754  WARN("No suitable pixel formats found.\n");
6755  wined3d_caps_gl_ctx_destroy(&caps_gl_ctx);
6756  heap_free(adapter->cfgs);
6757  return FALSE;
6758  }
6759 
6760  if (!wined3d_adapter_init_format_info(adapter, &caps_gl_ctx))
6761  {
6762  ERR("Failed to initialize GL format info.\n");
6763  wined3d_caps_gl_ctx_destroy(&caps_gl_ctx);
6764  heap_free(adapter->cfgs);
6765  return FALSE;
6766  }
6767 
6768  adapter->vram_bytes = adapter->driver_info.vram_bytes;
6769  adapter->vram_bytes_used = 0;
6770  TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->vram_bytes));
6771 
6772  display_device.cb = sizeof(display_device);