[PATCH 2/3] wined3d: Prefer the core glActiveTexture function. (v3)
Matteo Bruni
mbruni at codeweavers.com
Thu Jan 8 10:20:21 CST 2015
---
dlls/wined3d/arb_program_shader.c | 2 +-
dlls/wined3d/context.c | 8 ++++----
dlls/wined3d/directx.c | 13 +++++++++++++
dlls/wined3d/gl_compat.c | 5 +++--
4 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index bc66c4a..a7babda 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7294,7 +7294,7 @@ static void upload_palette(const struct wined3d_texture *texture, struct wined3d
if (!priv->palette_texture)
gl_info->gl_ops.gl.p_glGenTextures(1, &priv->palette_texture);
- GL_EXTCALL(glActiveTextureARB(GL_TEXTURE1));
+ GL_EXTCALL(glActiveTexture(GL_TEXTURE1));
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, priv->palette_texture);
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 4da8c7d..ead7e1b 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1328,8 +1328,8 @@ static void bind_dummy_textures(const struct wined3d_device *device, const struc
for (i = 0; i < count; ++i)
{
- GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
- checkGLcall("glActiveTextureARB");
+ GL_EXTCALL(glActiveTexture(GL_TEXTURE0 + i));
+ checkGLcall("glActiveTexture");
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, device->dummy_texture_2d[i]);
checkGLcall("glBindTexture");
@@ -2115,8 +2115,8 @@ void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer)
/* Context activation is done by the caller. */
void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info, unsigned int unit)
{
- GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0 + unit));
- checkGLcall("glActiveTextureARB");
+ GL_EXTCALL(glActiveTexture(GL_TEXTURE0 + unit));
+ checkGLcall("glActiveTexture");
context->active_texture = unit;
}
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index f4266a7..e004ecf 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2873,6 +2873,9 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
USE_GL_FUNC(wglGetPixelFormatAttribivARB)
USE_GL_FUNC(wglSetPixelFormatWINE)
USE_GL_FUNC(wglSwapIntervalEXT)
+
+ /* Newer core functions */
+ USE_GL_FUNC(glActiveTexture) /* OpenGL 1.3 */
#undef USE_GL_FUNC
#ifndef USE_WIN32_OPENGL
@@ -2880,6 +2883,16 @@ static void load_gl_funcs(struct wined3d_gl_info *gl_info)
/* note that we still need the above wglGetProcAddress calls to initialize the table */
gl_info->gl_ops.ext = ((struct opengl_funcs *)NtCurrentTeb()->glTable)->ext;
#endif
+
+ #define MAP_GL_FUNCTION(core_func, ext_func) \
+ 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(glActiveTexture, glActiveTextureARB);
+#undef MAP_GL_FUNCTION
}
static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
diff --git a/dlls/wined3d/gl_compat.c b/dlls/wined3d/gl_compat.c
index 4dd9062..a50d5c4 100644
--- a/dlls/wined3d/gl_compat.c
+++ b/dlls/wined3d/gl_compat.c
@@ -112,7 +112,8 @@ static void WINE_GLAPI wine_glMultiTexCoord4svARB(GLenum target, const GLshort *
context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4sv(v);
}
-static void WINE_GLAPI wine_glActiveTextureARB(GLenum texture) {
+static void WINE_GLAPI wine_glActiveTexture(GLenum texture)
+{
if(texture != GL_TEXTURE0) {
ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
return;
@@ -351,7 +352,7 @@ void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info)
if (!gl_info->supported[ARB_MULTITEXTURE])
{
TRACE("Applying GL_ARB_multitexture emulation hooks\n");
- gl_info->gl_ops.ext.p_glActiveTextureARB = wine_glActiveTextureARB;
+ gl_info->gl_ops.ext.p_glActiveTexture = wine_glActiveTexture;
gl_info->gl_ops.ext.p_glClientActiveTextureARB = wine_glClientActiveTextureARB;
gl_info->gl_ops.ext.p_glMultiTexCoord1fARB = wine_glMultiTexCoord1fARB;
gl_info->gl_ops.ext.p_glMultiTexCoord1fvARB = wine_glMultiTexCoord1fvARB;
--
2.0.5
More information about the wine-patches
mailing list