From 89625ef6341054743c0c24e92ac0c34cabf9abf3 Mon Sep 17 00:00:00 2001 From: Daniel Borca Date: Mon, 9 Feb 2004 07:39:03 +0000 Subject: [PATCH] deal with combine_ext refactor --- docs/README.3DFX | 4 +- src/mesa/drivers/glide/fxdd.c | 6 +- src/mesa/drivers/glide/fxsetup.h | 124 +++++++++++++++---------------- src/mesa/drivers/glide/fxwgl.c | 9 ++- 4 files changed, 76 insertions(+), 67 deletions(-) diff --git a/docs/README.3DFX b/docs/README.3DFX index 4ad7c936585..4b8e13fb9cc 100644 --- a/docs/README.3DFX +++ b/docs/README.3DFX @@ -117,7 +117,7 @@ MESA_FX_INFO OS: all HW: all Desc: verbose to stderr - Value: "r" to redirect stderr to MESA.LOG + Value: any; special value "r" to redirect stderr to MESA.LOG MESA_FX_IGNORE_PALEXT OS: all HW: all @@ -129,7 +129,7 @@ MESA_FX_IGNORE_PIXEXT MESA_FX_IGNORE_TEXFMT OS: all HW: Napalm - Desc: disable 32bit textures; also max texture is 256x256 + Desc: disable 32bit textures MESA_FX_IGNORE_CMBEXT OS: all HW: Napalm diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 448fd043d07..2f0d4fc9b28 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1502,11 +1502,15 @@ fxDDInitExtensions(GLcontext * ctx) #if 1 _mesa_enable_extension(ctx, "GL_ARB_vertex_buffer_object"); #endif - /* not just yet */ #if 0 + /* not just yet */ _mesa_enable_extension(ctx, "GL_ARB_fragment_program"); _mesa_enable_extension(ctx, "GL_ARB_vertex_program"); #endif +#if 0 + /* not until texel fetchers are right */ + _mesa_enable_extension(ctx, "GL_SGIS_generate_mipmaps"); +#endif } diff --git a/src/mesa/drivers/glide/fxsetup.h b/src/mesa/drivers/glide/fxsetup.h index 236c9836624..5cec362f61d 100644 --- a/src/mesa/drivers/glide/fxsetup.h +++ b/src/mesa/drivers/glide/fxsetup.h @@ -385,61 +385,61 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) { #if 1 fprintf(stderr, "COMBINE_EXT: %s + %s\n", - _mesa_lookup_enum_by_nr(texUnit->CombineModeRGB), - _mesa_lookup_enum_by_nr(texUnit->CombineModeA)); + _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB), + _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA)); #else fprintf(stderr, "Texture Unit %d\n", textureset); fprintf(stderr, " GL_TEXTURE_ENV_MODE = %s\n", _mesa_lookup_enum_by_nr(texUnit->EnvMode)); - fprintf(stderr, " GL_COMBINE_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineModeRGB)); - fprintf(stderr, " GL_COMBINE_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineModeA)); - fprintf(stderr, " GL_SOURCE0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceRGB[0])); - fprintf(stderr, " GL_SOURCE1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceRGB[1])); - fprintf(stderr, " GL_SOURCE2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceRGB[2])); - fprintf(stderr, " GL_SOURCE0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceA[0])); - fprintf(stderr, " GL_SOURCE1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceA[1])); - fprintf(stderr, " GL_SOURCE2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceA[2])); - fprintf(stderr, " GL_OPERAND0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandRGB[0])); - fprintf(stderr, " GL_OPERAND1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandRGB[1])); - fprintf(stderr, " GL_OPERAND2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandRGB[2])); - fprintf(stderr, " GL_OPERAND0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandA[0])); - fprintf(stderr, " GL_OPERAND1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandA[1])); - fprintf(stderr, " GL_OPERAND2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandA[2])); - fprintf(stderr, " GL_RGB_SCALE = %d\n", 1 << texUnit->CombineScaleShiftRGB); - fprintf(stderr, " GL_ALPHA_SCALE = %d\n", 1 << texUnit->CombineScaleShiftA); + fprintf(stderr, " GL_COMBINE_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB)); + fprintf(stderr, " GL_COMBINE_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA)); + fprintf(stderr, " GL_SOURCE0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[0])); + fprintf(stderr, " GL_SOURCE1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[1])); + fprintf(stderr, " GL_SOURCE2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[2])); + fprintf(stderr, " GL_SOURCE0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[0])); + fprintf(stderr, " GL_SOURCE1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[1])); + fprintf(stderr, " GL_SOURCE2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[2])); + fprintf(stderr, " GL_OPERAND0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[0])); + fprintf(stderr, " GL_OPERAND1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[1])); + fprintf(stderr, " GL_OPERAND2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[2])); + fprintf(stderr, " GL_OPERAND0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[0])); + fprintf(stderr, " GL_OPERAND1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[1])); + fprintf(stderr, " GL_OPERAND2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[2])); + fprintf(stderr, " GL_RGB_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftRGB); + fprintf(stderr, " GL_ALPHA_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftA); fprintf(stderr, " GL_TEXTURE_ENV_COLOR = (%f, %f, %f, %f)\n", envColor[0], envColor[1], envColor[2], envColor[3]); #endif } - alphaComb.Shift = texUnit->CombineScaleShiftA; - colorComb.Shift = texUnit->CombineScaleShiftRGB; + alphaComb.Shift = texUnit->Combine.ScaleShiftA; + colorComb.Shift = texUnit->Combine.ScaleShiftRGB; - switch (texUnit->CombineModeRGB) { + switch (texUnit->Combine.ModeRGB) { case GL_MODULATE: /* Arg0 * Arg1 == (A + 0) * C + 0 */ TEXENV_SETUP_ARG_RGB(colorComb.SourceA, - texUnit->CombineSourceRGB[0], - texUnit->CombineOperandRGB[0], + texUnit->Combine.SourceRGB[0], + texUnit->Combine.OperandRGB[0], localc, locala); TEXENV_SETUP_MODE_RGB(colorComb.ModeA, - texUnit->CombineOperandRGB[0]); + texUnit->Combine.OperandRGB[0]); colorComb.SourceB = GR_CMBX_ZERO; colorComb.ModeB = GR_FUNC_MODE_ZERO; TEXENV_SETUP_ARG_RGB(colorComb.SourceC, - texUnit->CombineSourceRGB[1], - texUnit->CombineOperandRGB[1], + texUnit->Combine.SourceRGB[1], + texUnit->Combine.OperandRGB[1], localc, locala); colorComb.InvertC = TEXENV_OPERAND_INVERTED( - texUnit->CombineOperandRGB[1]); + texUnit->Combine.OperandRGB[1]); colorComb.SourceD = GR_CMBX_ZERO; break; case GL_REPLACE: /* Arg0 == (A + 0) * 1 + 0 */ TEXENV_SETUP_ARG_RGB(colorComb.SourceA, - texUnit->CombineSourceRGB[0], - texUnit->CombineOperandRGB[0], + texUnit->Combine.SourceRGB[0], + texUnit->Combine.OperandRGB[0], localc, locala); TEXENV_SETUP_MODE_RGB(colorComb.ModeA, - texUnit->CombineOperandRGB[0]); + texUnit->Combine.OperandRGB[0]); colorComb.SourceB = GR_CMBX_ZERO; colorComb.ModeB = GR_FUNC_MODE_ZERO; colorComb.SourceC = GR_CMBX_ZERO; @@ -449,17 +449,17 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G case GL_ADD: /* Arg0 + Arg1 = (A + B) * 1 + 0 */ TEXENV_SETUP_ARG_RGB(colorComb.SourceA, - texUnit->CombineSourceRGB[0], - texUnit->CombineOperandRGB[0], + texUnit->Combine.SourceRGB[0], + texUnit->Combine.OperandRGB[0], localc, locala); TEXENV_SETUP_MODE_RGB(colorComb.ModeA, - texUnit->CombineOperandRGB[0]); + texUnit->Combine.OperandRGB[0]); TEXENV_SETUP_ARG_RGB(colorComb.SourceB, - texUnit->CombineSourceRGB[1], - texUnit->CombineOperandRGB[1], + texUnit->Combine.SourceRGB[1], + texUnit->Combine.OperandRGB[1], localc, locala); TEXENV_SETUP_MODE_RGB(colorComb.ModeB, - texUnit->CombineOperandRGB[1]); + texUnit->Combine.OperandRGB[1]); colorComb.SourceC = GR_CMBX_ZERO; colorComb.InvertC = FXTRUE; colorComb.SourceD = GR_CMBX_ZERO; @@ -469,16 +469,16 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G * (Arg0 - Arg1) * Arg2 + Arg1 == (A - B) * C + D */ TEXENV_SETUP_ARG_RGB(colorComb.SourceA, - texUnit->CombineSourceRGB[0], - texUnit->CombineOperandRGB[0], + texUnit->Combine.SourceRGB[0], + texUnit->Combine.OperandRGB[0], localc, locala); TEXENV_SETUP_MODE_RGB(colorComb.ModeA, - texUnit->CombineOperandRGB[0]); + texUnit->Combine.OperandRGB[0]); TEXENV_SETUP_ARG_RGB(colorComb.SourceB, - texUnit->CombineSourceRGB[1], - texUnit->CombineOperandRGB[1], + texUnit->Combine.SourceRGB[1], + texUnit->Combine.OperandRGB[1], localc, locala); - if (TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) { + if (TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandRGB[1])) { /* Hack alert!!! This case is wrong!!! */ fprintf(stderr, "COMBINE_EXT_color: WRONG!!!\n"); colorComb.ModeB = GR_FUNC_MODE_NEGATIVE_X; @@ -490,44 +490,44 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G * specify some kind of alpha value. */ TEXENV_SETUP_ARG_A(colorComb.SourceC, - texUnit->CombineSourceRGB[2], - texUnit->CombineOperandRGB[2], + texUnit->Combine.SourceRGB[2], + texUnit->Combine.OperandRGB[2], locala); colorComb.InvertC = FXFALSE; colorComb.SourceD = GR_CMBX_B; break; default: fprintf(stderr, "COMBINE_EXT_color: %s\n", - _mesa_lookup_enum_by_nr(texUnit->CombineModeRGB)); + _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB)); } - switch (texUnit->CombineModeA) { + switch (texUnit->Combine.ModeA) { case GL_MODULATE: /* Arg0 * Arg1 == (A + 0) * C + 0 */ TEXENV_SETUP_ARG_A(alphaComb.SourceA, - texUnit->CombineSourceA[0], - texUnit->CombineOperandA[0], + texUnit->Combine.SourceA[0], + texUnit->Combine.OperandA[0], locala); TEXENV_SETUP_MODE_A(alphaComb.ModeA, - texUnit->CombineOperandA[0]); + texUnit->Combine.OperandA[0]); alphaComb.SourceB = GR_CMBX_ZERO; alphaComb.ModeB = GR_FUNC_MODE_ZERO; TEXENV_SETUP_ARG_A(alphaComb.SourceC, - texUnit->CombineSourceA[1], - texUnit->CombineOperandA[1], + texUnit->Combine.SourceA[1], + texUnit->Combine.OperandA[1], locala); alphaComb.InvertC = TEXENV_OPERAND_INVERTED( - texUnit->CombineOperandA[1]); + texUnit->Combine.OperandA[1]); alphaComb.SourceD = GR_CMBX_ZERO; break; case GL_REPLACE: /* Arg0 == (A + 0) * 1 + 0 */ TEXENV_SETUP_ARG_A(alphaComb.SourceA, - texUnit->CombineSourceA[0], - texUnit->CombineOperandA[0], + texUnit->Combine.SourceA[0], + texUnit->Combine.OperandA[0], locala); TEXENV_SETUP_MODE_A(alphaComb.ModeA, - texUnit->CombineOperandA[0]); + texUnit->Combine.OperandA[0]); alphaComb.SourceB = GR_CMBX_ZERO; alphaComb.ModeB = GR_FUNC_MODE_ZERO; alphaComb.SourceC = GR_CMBX_ZERO; @@ -537,24 +537,24 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G case GL_ADD: /* Arg0 + Arg1 = (A + B) * 1 + 0 */ TEXENV_SETUP_ARG_A(alphaComb.SourceA, - texUnit->CombineSourceA[0], - texUnit->CombineOperandA[0], + texUnit->Combine.SourceA[0], + texUnit->Combine.OperandA[0], locala); TEXENV_SETUP_MODE_A(alphaComb.ModeA, - texUnit->CombineOperandA[0]); + texUnit->Combine.OperandA[0]); TEXENV_SETUP_ARG_A(alphaComb.SourceB, - texUnit->CombineSourceA[1], - texUnit->CombineOperandA[1], + texUnit->Combine.SourceA[1], + texUnit->Combine.OperandA[1], locala); TEXENV_SETUP_MODE_A(alphaComb.ModeB, - texUnit->CombineOperandA[1]); + texUnit->Combine.OperandA[1]); alphaComb.SourceC = GR_CMBX_ZERO; alphaComb.InvertC = FXTRUE; alphaComb.SourceD = GR_CMBX_ZERO; break; default: fprintf(stderr, "COMBINE_EXT_alpha: %s\n", - _mesa_lookup_enum_by_nr(texUnit->CombineModeA)); + _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA)); } fxMesa->Glide.grConstantColorValueExt(tmu, diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c index f8450b1b014..c70bb3b8924 100644 --- a/src/mesa/drivers/glide/fxwgl.c +++ b/src/mesa/drivers/glide/fxwgl.c @@ -345,8 +345,13 @@ wglCreateContext(HDC hdc) ShowWindow(hWnd, SW_SHOWNORMAL); SetForegroundWindow(hWnd); Sleep(100); /* a hack for win95 */ - GetClientRect(hWnd, &cliRect); - error = !(ctx = fxMesaCreateBestContext((GLuint) hWnd, cliRect.right, cliRect.bottom, pix[curPFD - 1].mesaAttr)); + if (0 && !(GetWindowLong (hWnd, GWL_STYLE) & WS_POPUP)) { + /* [dBorca] Hack alert: unfinished business! */ + error = !(ctx = fxMesaCreateContext((GLuint) hWnd, GR_RESOLUTION_NONE, GR_REFRESH_NONE, pix[curPFD - 1].mesaAttr)); + } else { + GetClientRect(hWnd, &cliRect); + error = !(ctx = fxMesaCreateBestContext((GLuint) hWnd, cliRect.right, cliRect.bottom, pix[curPFD - 1].mesaAttr)); + } } /*if (getenv("SST_DUALHEAD")) -- 2.30.2