wined3d: Dynamicly load GL_ARB_multitexture functions.
This commit is contained in:
parent
5b8b776431
commit
54e5f9c465
|
@ -243,7 +243,8 @@ void WINAPI IWineD3DDeviceImpl_SetupTextureStates(IWineD3DDevice *iface, DWORD S
|
|||
VTRACE(("Activating appropriate texture state %ld\n", Sampler));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
ENTER_GL();
|
||||
GLACTIVETEXTURE(Sampler);
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + Sampler));
|
||||
checkGLcall("glActiveTextureARB");
|
||||
LEAVE_GL();
|
||||
/* Could we use bindTexture and then apply the states instead of GLACTIVETEXTURE */
|
||||
} else if (Sampler > 0) {
|
||||
|
@ -3358,7 +3359,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
|
|||
/* Note the D3DRS value applies to all textures, but GL has one
|
||||
per texture, so apply it now ready to be used! */
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GLACTIVETEXTURE(i);
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
|
||||
checkGLcall("glActiveTextureARB");
|
||||
} else if (i>0) {
|
||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
}
|
||||
|
|
|
@ -1185,28 +1185,28 @@ static void loadVertexData(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
|||
/* Texture coords -------------------------------------------*/
|
||||
|
||||
for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) {
|
||||
/* The code below uses glClientActiveTexture and glMultiTexCoord* which are all part of the GL_ARB_multitexture extension. */
|
||||
/* Abort if we don't support the extension. */
|
||||
if (!GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Select the correct texture stage */
|
||||
GLCLIENTACTIVETEXTURE(textureNo);
|
||||
GL_EXTCALL(glClientActiveTextureARB(textureNo));
|
||||
if (This->stateBlock->textures[textureNo] != NULL) {
|
||||
int coordIdx = This->stateBlock->textureState[textureNo][D3DTSS_TEXCOORDINDEX];
|
||||
TRACE("Setting up texture %u, cordindx %u, data %p\n", textureNo, coordIdx, sd->u.s.texCoords[coordIdx].lpData);
|
||||
if (!GL_SUPPORT(ARB_MULTITEXTURE) && textureNo > 0) {
|
||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (coordIdx >= MAX_TEXTURES) {
|
||||
VTRACE(("tex: %d - Skip tex coords, as being system generated\n", textureNo));
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1);
|
||||
GL_EXTCALL(glMultiTexCoord4fARB(textureNo, 0, 0, 0, 1));
|
||||
|
||||
} else if (sd->u.s.texCoords[coordIdx].lpData == NULL) {
|
||||
VTRACE(("Bound texture but no texture coordinates supplied, so skipping\n"));
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1);
|
||||
GL_EXTCALL(glMultiTexCoord4fARB(textureNo, 0, 0, 0, 1));
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -1217,7 +1217,7 @@ static void loadVertexData(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
|||
|
||||
} else {
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1);
|
||||
GL_EXTCALL(glMultiTexCoord4fARB(textureNo, 0, 0, 0, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1444,7 +1444,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
|||
case D3DTTFF_COUNT1:
|
||||
VTRACE(("tex:%d, s=%f\n", textureNo, s));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GLMULTITEXCOORD1F(textureNo, s);
|
||||
GL_EXTCALL(glMultiTexCoord1fARB(textureNo, s));
|
||||
} else {
|
||||
glTexCoord1f(s);
|
||||
}
|
||||
|
@ -1452,7 +1452,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
|||
case D3DTTFF_COUNT2:
|
||||
VTRACE(("tex:%d, s=%f, t=%f\n", textureNo, s, t));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GLMULTITEXCOORD2F(textureNo, s, t);
|
||||
GL_EXTCALL(glMultiTexCoord2fARB(textureNo, s, t));
|
||||
} else {
|
||||
glTexCoord2f(s, t);
|
||||
}
|
||||
|
@ -1460,7 +1460,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
|||
case D3DTTFF_COUNT3:
|
||||
VTRACE(("tex:%d, s=%f, t=%f, r=%f\n", textureNo, s, t, r));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GLMULTITEXCOORD3F(textureNo, s, t, r);
|
||||
GL_EXTCALL(glMultiTexCoord3fARB(textureNo, s, t, r));
|
||||
} else {
|
||||
glTexCoord3f(s, t, r);
|
||||
}
|
||||
|
@ -1468,7 +1468,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
|||
case D3DTTFF_COUNT4:
|
||||
VTRACE(("tex:%d, s=%f, t=%f, r=%f, q=%f\n", textureNo, s, t, r, q));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GLMULTITEXCOORD4F(textureNo, s, t, r, q);
|
||||
GL_EXTCALL(glMultiTexCoord4fARB(textureNo, s, t, r, q));
|
||||
} else {
|
||||
glTexCoord4f(s, t, r, q);
|
||||
}
|
||||
|
@ -1968,7 +1968,8 @@ void inline drawPrimitiveUploadTextures(IWineD3DDeviceImpl* This) {
|
|||
for (i = 0; i< GL_LIMITS(textures); ++i) {
|
||||
/* Bind the texture to the stage here */
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GLACTIVETEXTURE(i);
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
|
||||
checkGLcall("glActiveTextureARB");
|
||||
} else if (0 < i) {
|
||||
/* This isn't so much a warn as a message to the user about lack of hardware support */
|
||||
WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
|
|
|
@ -815,7 +815,8 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
|
|||
|
||||
/* Make appropriate texture active */
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GLACTIVETEXTURE(i);
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
|
||||
checkGLcall("glActiveTextureARB");
|
||||
} else if (i > 0) {
|
||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
}
|
||||
|
|
|
@ -2100,8 +2100,13 @@ HRESULT WINAPI IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
|
|||
/* Unbind the old texture */
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
/* We use texture unit 0 for blts */
|
||||
GLACTIVETEXTURE(0);
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB));
|
||||
checkGLcall("glActiveTextureARB");
|
||||
} else {
|
||||
WARN("Multi-texturing is unsupported in the local OpenGL implementation\n");
|
||||
}
|
||||
|
||||
/* Disable some fancy graphics effects */
|
||||
glDisable(GL_LIGHTING);
|
||||
|
|
|
@ -195,38 +195,7 @@ extern int num_lock;
|
|||
(vec)[2] = D3DCOLOR_B(dw); \
|
||||
(vec)[3] = D3DCOLOR_A(dw);
|
||||
|
||||
/* Note: The following is purely to keep the source code as clear from #ifdefs as possible */
|
||||
#if defined(GL_VERSION_1_3)
|
||||
#define GLACTIVETEXTURE(textureNo) \
|
||||
glActiveTexture(GL_TEXTURE0 + textureNo); \
|
||||
checkGLcall("glActiveTexture");
|
||||
#define GLCLIENTACTIVETEXTURE(textureNo) \
|
||||
glClientActiveTexture(GL_TEXTURE0 + textureNo);
|
||||
#define GLMULTITEXCOORD1F(a,b) \
|
||||
glMultiTexCoord1f(GL_TEXTURE0 + a, b);
|
||||
#define GLMULTITEXCOORD2F(a,b,c) \
|
||||
glMultiTexCoord2f(GL_TEXTURE0 + a, b, c);
|
||||
#define GLMULTITEXCOORD3F(a,b,c,d) \
|
||||
glMultiTexCoord3f(GL_TEXTURE0 + a, b, c, d);
|
||||
#define GLMULTITEXCOORD4F(a,b,c,d,e) \
|
||||
glMultiTexCoord4f(GL_TEXTURE0 + a, b, c, d, e);
|
||||
#define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP
|
||||
#else
|
||||
#define GLACTIVETEXTURE(textureNo) \
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + textureNo); \
|
||||
checkGLcall("glActiveTextureARB");
|
||||
#define GLCLIENTACTIVETEXTURE(textureNo) \
|
||||
glClientActiveTextureARB(GL_TEXTURE0_ARB + textureNo);
|
||||
#define GLMULTITEXCOORD1F(a,b) \
|
||||
glMultiTexCoord1fARB(GL_TEXTURE0_ARB + a, b);
|
||||
#define GLMULTITEXCOORD2F(a,b,c) \
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB + a, b, c);
|
||||
#define GLMULTITEXCOORD3F(a,b,c,d) \
|
||||
glMultiTexCoord3fARB(GL_TEXTURE0_ARB + a, b, c, d);
|
||||
#define GLMULTITEXCOORD4F(a,b,c,d,e) \
|
||||
glMultiTexCoord4fARB(GL_TEXTURE0_ARB + a, b, c, d, e);
|
||||
#define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP_ARB
|
||||
#endif
|
||||
|
||||
/* DirectX Device Limits */
|
||||
/* --------------------- */
|
||||
|
|
|
@ -131,6 +131,51 @@
|
|||
#endif
|
||||
typedef void (APIENTRY *PGLFNBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
typedef void (APIENTRY *PGLFNBLENDEQUATIONPROC) (GLenum mode);
|
||||
/* GL_ARB_multitexture */
|
||||
#ifndef GL_ARB_multitexture
|
||||
#define GL_ARB_multitexture 1
|
||||
#define GL_TEXTURE0_ARB 0x84C0
|
||||
#define GL_TEXTURE1_ARB 0x84C1
|
||||
#define GL_TEXTURE2_ARB 0x84C2
|
||||
#define GL_TEXTURE3_ARB 0x84C3
|
||||
#define GL_TEXTURE4_ARB 0x84C4
|
||||
#define GL_TEXTURE5_ARB 0x84C5
|
||||
#define GL_TEXTURE6_ARB 0x84C6
|
||||
#define GL_TEXTURE7_ARB 0x84C7
|
||||
#define GL_TEXTURE8_ARB 0x84C8
|
||||
#define GL_TEXTURE9_ARB 0x84C9
|
||||
#define GL_TEXTURE10_ARB 0x84CA
|
||||
#define GL_TEXTURE11_ARB 0x84CB
|
||||
#define GL_TEXTURE12_ARB 0x84CC
|
||||
#define GL_TEXTURE13_ARB 0x84CD
|
||||
#define GL_TEXTURE14_ARB 0x84CE
|
||||
#define GL_TEXTURE15_ARB 0x84CF
|
||||
#define GL_TEXTURE16_ARB 0x84D0
|
||||
#define GL_TEXTURE17_ARB 0x84D1
|
||||
#define GL_TEXTURE18_ARB 0x84D2
|
||||
#define GL_TEXTURE19_ARB 0x84D3
|
||||
#define GL_TEXTURE20_ARB 0x84D4
|
||||
#define GL_TEXTURE21_ARB 0x84D5
|
||||
#define GL_TEXTURE22_ARB 0x84D6
|
||||
#define GL_TEXTURE23_ARB 0x84D7
|
||||
#define GL_TEXTURE24_ARB 0x84D8
|
||||
#define GL_TEXTURE25_ARB 0x84D9
|
||||
#define GL_TEXTURE26_ARB 0x84DA
|
||||
#define GL_TEXTURE27_ARB 0x84DB
|
||||
#define GL_TEXTURE28_ARB 0x84DC
|
||||
#define GL_TEXTURE29_ARB 0x84DD
|
||||
#define GL_TEXTURE30_ARB 0x84DE
|
||||
#define GL_TEXTURE31_ARB 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE_ARB 0x84E0
|
||||
#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
|
||||
#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
|
||||
#endif
|
||||
typedef void (APIENTRY *WINED3D_PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
|
||||
typedef void (APIENTRY *WINED3D_PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
|
||||
typedef void (APIENTRY *WINED3D_PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
|
||||
typedef void (APIENTRY *WINED3D_PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
|
||||
typedef void (APIENTRY *WINED3D_PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
|
||||
typedef void (APIENTRY *WINED3D_PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
|
||||
/* GL_ARB_point_parameters */
|
||||
#ifndef GL_ARB_point_parameters
|
||||
#define GL_ARB_point_parameters 1
|
||||
|
@ -1346,6 +1391,13 @@ typedef enum _GL_SupportedExt {
|
|||
/* GL_ARB_imaging */ \
|
||||
USE_GL_FUNC(PGLFNBLENDCOLORPROC, glBlendColor); \
|
||||
USE_GL_FUNC(PGLFNBLENDEQUATIONPROC, glBlendEquation); \
|
||||
/* GL_ARB_multitexture */ \
|
||||
USE_GL_FUNC(WINED3D_PFNGLACTIVETEXTUREARBPROC, glActiveTextureARB); \
|
||||
USE_GL_FUNC(WINED3D_PFNGLCLIENTACTIVETEXTUREARBPROC, glClientActiveTextureARB); \
|
||||
USE_GL_FUNC(WINED3D_PFNGLMULTITEXCOORD1FARBPROC, glMultiTexCoord1fARB); \
|
||||
USE_GL_FUNC(WINED3D_PFNGLMULTITEXCOORD2FARBPROC, glMultiTexCoord2fARB); \
|
||||
USE_GL_FUNC(WINED3D_PFNGLMULTITEXCOORD3FARBPROC, glMultiTexCoord3fARB); \
|
||||
USE_GL_FUNC(WINED3D_PFNGLMULTITEXCOORD4FARBPROC, glMultiTexCoord4fARB); \
|
||||
/* GL_ARB_point_parameters */ \
|
||||
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFARBPROC, glPointParameterfARB); \
|
||||
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFVARBPROC, glPointParameterfvARB); \
|
||||
|
|
Loading…
Reference in New Issue