Commit 5b75c15b authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

Implemented some texture operations using ATI_texture_env_combine3.

Fixed D3DTOP_LERP. Fixed some checkGLcall error messages.
parent 0a5f3934
...@@ -594,6 +594,15 @@ typedef void (APIENTRY * PGLFNGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, ...@@ -594,6 +594,15 @@ typedef void (APIENTRY * PGLFNGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage,
#define GL_SIGNED_HILO8_NV 0x885F #define GL_SIGNED_HILO8_NV 0x885F
#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 #define GL_FORCE_BLUE_TO_ONE_NV 0x8860
#endif #endif
/* GL_ATI_texture_env_combine3 */
#ifndef GL_ATI_texture_env_combine3
#define GL_ATI_texture_env_combine3 1
#define GL_MODULATE_ADD_ATI 0x8744
#define GL_MODULATE_SIGNED_ADD_ATI 0x8745
#define GL_MODULATE_SUBTRACT_ATI 0x8746
/* #define ONE */
/* #define ZERO */
#endif
/******* /*******
* OpenGL Official Version * OpenGL Official Version
......
...@@ -1360,9 +1360,9 @@ void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP o ...@@ -1360,9 +1360,9 @@ void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP o
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1"); checkGLcall("GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA); glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1"); checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA");
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
...@@ -1562,10 +1562,10 @@ void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP o ...@@ -1562,10 +1562,10 @@ void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP o
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case D3DTOP_DOTPRODUCT3: case D3DTOP_DOTPRODUCT3:
if (GL_SUPPORT(ARB_TEXTURE_ENV_DOT3)) { if (GL_SUPPORT(ARB_TEXTURE_ENV_DOT3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB");
} else if (GL_SUPPORT(EXT_TEXTURE_ENV_DOT3)) { } else if (GL_SUPPORT(EXT_TEXTURE_ENV_DOT3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT");
} else { } else {
...@@ -1586,20 +1586,173 @@ void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP o ...@@ -1586,20 +1586,173 @@ void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP o
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)); glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)"); checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src2"); checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1); glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr2"); checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2); glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
checkGLcall("GL_TEXTURE_ENV, src1_target, src3"); checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2); glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr3"); checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
glTexEnvi(GL_TEXTURE_ENV, src2_target, src3); glTexEnvi(GL_TEXTURE_ENV, src2_target, src3);
checkGLcall("GL_TEXTURE_ENV, src2_target, src1"); checkGLcall("GL_TEXTURE_ENV, src2_target, src3");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, src3); glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr3);
checkGLcall("GL_TEXTURE_ENV, opr2_target, src1"); checkGLcall("GL_TEXTURE_ENV, opr2_target, opr3");
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case D3DTOP_ADDSMOOTH:
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI));
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI)");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
switch (opr1) {
case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_COLOR; break;
case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_COLOR; break;
case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
}
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
} else
Handled = FALSE;
break;
case D3DTOP_BLENDTEXTUREALPHAPM:
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI));
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI)");
glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_TEXTURE);
checkGLcall("GL_TEXTURE_ENV, src0_target, GL_TEXTURE");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_ALPHA);
checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_APHA");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
} else
Handled = FALSE;
break;
case D3DTOP_MODULATEALPHA_ADDCOLOR:
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI));
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI)");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_SRC_APHA");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
} else
Handled = FALSE;
break;
case D3DTOP_MODULATECOLOR_ADDALPHA:
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI));
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI)");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
checkGLcall("GL_TEXTURE_ENV, src2_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
} else
Handled = FALSE;
break;
case D3DTOP_MODULATEINVALPHA_ADDCOLOR:
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI));
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI)");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_ALPHA);
checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_APHA");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
} else
Handled = FALSE;
break;
case D3DTOP_MODULATEINVCOLOR_ADDALPHA:
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI));
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI)");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
checkGLcall("GL_TEXTURE_ENV, src2_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_ONE_MINUS_SRC_ALPHA);
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_ONE_MINUS_SRC_ALPHA");
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
} else
Handled = FALSE;
break;
case D3DTOP_MULTIPLYADD:
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI));
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_MODULATE_ADD_ATI)");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src3);
checkGLcall("GL_TEXTURE_ENV, src0_target, src3");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr3);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr3");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
} else
Handled = FALSE;
break;
default: default:
Handled = FALSE; Handled = FALSE;
} }
......
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