From 3ab4eb6545a1b9e4c6117b170f417ecb6fdde97e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 6 Feb 2003 21:47:33 +0000 Subject: [PATCH] Arkadi's mach64 patch --- include/QF/GL/qf_vid.h | 2 ++ libs/video/renderer/gl/gl_dyn_part.c | 7 +++++-- libs/video/renderer/gl/gl_dyn_textures.c | 8 +++++--- libs/video/targets/vid_common_gl.c | 5 +++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/QF/GL/qf_vid.h b/include/QF/GL/qf_vid.h index 87a1b3d1b..2b7333e5e 100644 --- a/include/QF/GL/qf_vid.h +++ b/include/QF/GL/qf_vid.h @@ -43,6 +43,8 @@ extern GLenum gl_mtex_enum; extern float gldepthmin, gldepthmax; extern int texture_extension_number; +extern qboolean gl_feature_mach64; + void GL_EndRendering (void); void GL_BeginRendering (int *x, int *y, int *width, int *height); diff --git a/libs/video/renderer/gl/gl_dyn_part.c b/libs/video/renderer/gl/gl_dyn_part.c index f58ee1120..572d1bd19 100644 --- a/libs/video/renderer/gl/gl_dyn_part.c +++ b/libs/video/renderer/gl/gl_dyn_part.c @@ -28,7 +28,7 @@ # include "config.h" #endif -static __attribute__ ((unused)) const char rcsid[] = +static __attribute__ ((unused)) const char rcsid[] = "$Id$"; #ifdef HAVE_STRING_H @@ -51,6 +51,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/GL/funcs.h" #include "QF/GL/qf_explosions.h" #include "QF/GL/qf_textures.h" +#include "QF/GL/qf_vid.h" #include "compat.h" #include "r_cvar.h" @@ -85,6 +86,8 @@ particle_new (ptype_t type, int texnum, const vec3_t org, float scale, return NULL; } */ + if(gl_feature_mach64 && type == pt_smokecloud && texnum == part_tex_smoke ) + return; part = &particles[numparticles++]; @@ -1057,7 +1060,7 @@ R_TeleportSplash_ID (const vec3_t org) VectorCopy (dir, pdir); VectorNormalize (pdir); - + rnd = rand (); porg[0] = org[0] + i + (rnd & 3); porg[1] = org[1] + j + ((rnd >> 2) & 3); diff --git a/libs/video/renderer/gl/gl_dyn_textures.c b/libs/video/renderer/gl/gl_dyn_textures.c index 314baf5f9..2fbafb200 100644 --- a/libs/video/renderer/gl/gl_dyn_textures.c +++ b/libs/video/renderer/gl/gl_dyn_textures.c @@ -54,6 +54,7 @@ int part_tex_spark; */ int part_tex; +GLint part_tex_internal_format = 2; static void @@ -67,7 +68,7 @@ GDT_InitParticleTexture (void) qfglBindTexture (GL_TEXTURE_2D, part_tex); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - qfglTexImage2D (GL_TEXTURE_2D, 0, 2, 64, 64, 0, GL_LUMINANCE_ALPHA, + qfglTexImage2D (GL_TEXTURE_2D, 0, part_tex_internal_format, 64, 64, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, data); } @@ -133,8 +134,7 @@ GDT_InitSmokeParticleTexture (void) noise_plasma (&noise1[0][0], 32); noise_diamondsquare (&noise2[0][0], 32, 4); - for (y = 0; y < 32; y++) - { + for (y = 0; y < 32; y++) { dy2 = y - 16; dy2 *= dy2; for (x = 0; x < 32; x++) { @@ -159,6 +159,8 @@ GDT_InitSmokeParticleTexture (void) void GDT_Init (void) { + if (gl_feature_mach64) + part_tex_internal_format = 4; GDT_InitParticleTexture (); GDT_InitDotParticleTexture (); GDT_InitSparkParticleTexture (); diff --git a/libs/video/targets/vid_common_gl.c b/libs/video/targets/vid_common_gl.c index 394ff92ca..954b0c528 100644 --- a/libs/video/targets/vid_common_gl.c +++ b/libs/video/targets/vid_common_gl.c @@ -86,6 +86,8 @@ GLenum gl_mtex_enum = GL_TEXTURE0_ARB; QF_glColorTableEXT qglColorTableEXT = NULL; qboolean is8bit = false; +qboolean gl_feature_mach64 = false; + cvar_t *gl_multitexture; cvar_t *gl_vaelements_max; cvar_t *gl_screenshot_byte_swap; @@ -297,6 +299,9 @@ GL_Init_Common (void) CheckMultiTextureExtensions (); CheckVertexArraySize (); + + if (strstr(gl_renderer, "Mesa DRI Mach64")) + gl_feature_mach64 = true; } void