Commit f2989a25 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Only install emulation wrappers when required.

parent 6244735f
......@@ -5871,6 +5871,11 @@ static void arbfp_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen
caps->MaxSimultaneousTextures = min(gl_info->limits.fragment_samplers, 8);
}
static DWORD arbfp_get_emul_mask(const struct wined3d_gl_info *gl_info)
{
return GL_EXT_EMUL_ARB_MULTITEXTURE | GL_EXT_EMUL_EXT_FOG_COORD;
}
static void state_texfactor_arbfp(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id)
{
......@@ -6871,6 +6876,7 @@ static void arbfp_free_context_data(struct wined3d_context *context)
const struct fragment_pipeline arbfp_fragment_pipeline = {
arbfp_enable,
arbfp_get_caps,
arbfp_get_emul_mask,
arbfp_alloc,
arbfp_free,
arbfp_alloc_context_data,
......
......@@ -1310,6 +1310,11 @@ static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen
caps->MaxSimultaneousTextures = 6;
}
static DWORD atifs_get_emul_mask(const struct wined3d_gl_info *gl_info)
{
return GL_EXT_EMUL_ARB_MULTITEXTURE | GL_EXT_EMUL_EXT_FOG_COORD;
}
static void *atifs_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
{
struct atifs_private_data *priv;
......@@ -1386,6 +1391,7 @@ static void atifs_free_context_data(struct wined3d_context *context)
const struct fragment_pipeline atifs_fragment_pipeline = {
atifs_enable,
atifs_get_caps,
atifs_get_emul_mask,
atifs_alloc,
atifs_free,
atifs_alloc_context_data,
......
......@@ -3434,7 +3434,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
const char *WGL_Extensions = NULL;
enum wined3d_gl_vendor gl_vendor;
enum wined3d_pci_device device;
DWORD gl_version;
DWORD gl_version, gl_ext_emul_mask;
HDC hdc;
unsigned int i, j;
GLint context_profile = 0;
......@@ -3805,7 +3805,11 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
fixup_extensions(gl_info, gl_renderer_str, gl_vendor, card_vendor, device);
init_driver_info(driver_info, card_vendor, device);
gl_ext_emul_mask = adapter->vertex_pipe->vp_get_emul_mask(gl_info)
| adapter->fragment_pipe->get_emul_mask(gl_info);
if (gl_ext_emul_mask & GL_EXT_EMUL_ARB_MULTITEXTURE)
install_gl_compat_wrapper(gl_info, ARB_MULTITEXTURE);
if (gl_ext_emul_mask & GL_EXT_EMUL_EXT_FOG_COORD)
install_gl_compat_wrapper(gl_info, EXT_FOG_COORD);
return TRUE;
......
......@@ -7742,6 +7742,13 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_gl_info *gl_info,
caps->raster_caps = WINED3DPRASTERCAPS_FOGRANGE;
}
static DWORD glsl_vertex_pipe_vp_get_emul_mask(const struct wined3d_gl_info *gl_info)
{
if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
return GL_EXT_EMUL_ARB_MULTITEXTURE;
return 0;
}
static void *glsl_vertex_pipe_vp_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
{
struct shader_glsl_priv *priv;
......@@ -8121,6 +8128,7 @@ const struct wined3d_vertex_pipe_ops glsl_vertex_pipe =
{
glsl_vertex_pipe_vp_enable,
glsl_vertex_pipe_vp_get_caps,
glsl_vertex_pipe_vp_get_emul_mask,
glsl_vertex_pipe_vp_alloc,
glsl_vertex_pipe_vp_free,
glsl_vertex_pipe_vp_states,
......@@ -8167,6 +8175,13 @@ static void glsl_fragment_pipe_get_caps(const struct wined3d_gl_info *gl_info, s
caps->MaxSimultaneousTextures = min(gl_info->limits.fragment_samplers, 8);
}
static DWORD glsl_fragment_pipe_get_emul_mask(const struct wined3d_gl_info *gl_info)
{
if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
return GL_EXT_EMUL_ARB_MULTITEXTURE;
return 0;
}
static void *glsl_fragment_pipe_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
{
struct shader_glsl_priv *priv;
......@@ -8446,6 +8461,7 @@ const struct fragment_pipeline glsl_fragment_pipe =
{
glsl_fragment_pipe_enable,
glsl_fragment_pipe_get_caps,
glsl_fragment_pipe_get_emul_mask,
glsl_fragment_pipe_alloc,
glsl_fragment_pipe_free,
glsl_fragment_pipe_alloc_context_data,
......
......@@ -738,6 +738,11 @@ static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct
caps->MaxSimultaneousTextures = gl_info->limits.textures;
}
static DWORD nvrc_fragment_get_emul_mask(const struct wined3d_gl_info *gl_info)
{
return GL_EXT_EMUL_ARB_MULTITEXTURE | GL_EXT_EMUL_EXT_FOG_COORD;
}
static void *nvrc_fragment_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
{
return shader_priv;
......@@ -924,6 +929,7 @@ static void nvrc_context_free(struct wined3d_context *context)
const struct fragment_pipeline nvts_fragment_pipeline = {
nvts_enable,
nvrc_fragment_get_caps,
nvrc_fragment_get_emul_mask,
nvrc_fragment_alloc,
nvrc_fragment_free,
nvrc_context_alloc,
......@@ -935,6 +941,7 @@ const struct fragment_pipeline nvts_fragment_pipeline = {
const struct fragment_pipeline nvrc_fragment_pipeline = {
nvrc_enable,
nvrc_fragment_get_caps,
nvrc_fragment_get_emul_mask,
nvrc_fragment_alloc,
nvrc_fragment_free,
nvrc_context_alloc,
......
......@@ -5582,10 +5582,16 @@ static void vp_ffp_get_caps(const struct wined3d_gl_info *gl_info, struct wined3
caps->raster_caps |= WINED3DPRASTERCAPS_FOGRANGE;
}
static DWORD vp_ffp_get_emul_mask(const struct wined3d_gl_info *gl_info)
{
return GL_EXT_EMUL_ARB_MULTITEXTURE | GL_EXT_EMUL_EXT_FOG_COORD;
}
const struct wined3d_vertex_pipe_ops ffp_vertex_pipe =
{
ffp_enable,
vp_ffp_get_caps,
vp_ffp_get_emul_mask,
ffp_alloc,
ffp_free,
vp_ffp_states,
......@@ -5632,6 +5638,11 @@ static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct
caps->MaxSimultaneousTextures = gl_info->limits.textures;
}
static DWORD ffp_fragment_get_emul_mask(const struct wined3d_gl_info *gl_info)
{
return GL_EXT_EMUL_ARB_MULTITEXTURE | GL_EXT_EMUL_EXT_FOG_COORD;
}
static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup)
{
if (TRACE_ON(d3d))
......@@ -5663,6 +5674,7 @@ static void ffp_none_context_free(struct wined3d_context *context)
const struct fragment_pipeline ffp_fragment_pipeline = {
ffp_enable,
ffp_fragment_get_caps,
ffp_fragment_get_emul_mask,
ffp_alloc,
ffp_free,
ffp_none_context_alloc,
......@@ -5685,10 +5697,16 @@ static void vp_none_get_caps(const struct wined3d_gl_info *gl_info, struct wined
memset(caps, 0, sizeof(*caps));
}
static DWORD vp_none_get_emul_mask(const struct wined3d_gl_info *gl_info)
{
return 0;
}
const struct wined3d_vertex_pipe_ops none_vertex_pipe =
{
none_enable,
vp_none_get_caps,
vp_none_get_emul_mask,
none_alloc,
none_free,
NULL,
......@@ -5699,6 +5717,11 @@ static void fp_none_get_caps(const struct wined3d_gl_info *gl_info, struct fragm
memset(caps, 0, sizeof(*caps));
}
static DWORD fp_none_get_emul_mask(const struct wined3d_gl_info *gl_info)
{
return 0;
}
static BOOL fp_none_color_fixup_supported(struct color_fixup_desc fixup)
{
return is_identity_fixup(fixup);
......@@ -5708,6 +5731,7 @@ const struct fragment_pipeline none_fragment_pipe =
{
none_enable,
fp_none_get_caps,
fp_none_get_emul_mask,
none_alloc,
none_free,
ffp_none_context_alloc,
......
......@@ -1287,10 +1287,14 @@ struct fragment_caps
DWORD MaxSimultaneousTextures;
};
#define GL_EXT_EMUL_ARB_MULTITEXTURE 0x00000001
#define GL_EXT_EMUL_EXT_FOG_COORD 0x00000002
struct fragment_pipeline
{
void (*enable_extension)(const struct wined3d_gl_info *gl_info, BOOL enable);
void (*get_caps)(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps);
DWORD (*get_emul_mask)(const struct wined3d_gl_info *gl_info);
void *(*alloc_private)(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv);
void (*free_private)(struct wined3d_device *device);
BOOL (*allocate_context_data)(struct wined3d_context *context);
......@@ -1316,6 +1320,7 @@ struct wined3d_vertex_pipe_ops
{
void (*vp_enable)(const struct wined3d_gl_info *gl_info, BOOL enable);
void (*vp_get_caps)(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps);
DWORD (*vp_get_emul_mask)(const struct wined3d_gl_info *gl_info);
void *(*vp_alloc)(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv);
void (*vp_free)(struct wined3d_device *device);
const struct StateEntryTemplate *vp_states;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment