aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-03-07 13:28:57 +0000
committermarha <marha@users.sourceforge.net>2010-03-07 13:28:57 +0000
commit14b1cb8d5a27ec9716d3f790fce95f0469e35605 (patch)
tree6c94dc9f37b19b995bec603141442b1b93e8c9d2 /mesalib/src/mesa/drivers
parent93c85587c691f9b91e7c2d8bda50f453e0f6674d (diff)
downloadvcxsrv-14b1cb8d5a27ec9716d3f790fce95f0469e35605.tar.gz
vcxsrv-14b1cb8d5a27ec9716d3f790fce95f0469e35605.tar.bz2
vcxsrv-14b1cb8d5a27ec9716d3f790fce95f0469e35605.zip
Updated to Mesa 7.7
Diffstat (limited to 'mesalib/src/mesa/drivers')
-rw-r--r--mesalib/src/mesa/drivers/common/driverfuncs.c37
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c1516
-rw-r--r--mesalib/src/mesa/drivers/common/meta.h109
-rw-r--r--mesalib/src/mesa/drivers/dri/Makefile.template28
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c11
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c72
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h5
-rw-r--r--mesalib/src/mesa/drivers/dri/common/extension_helper.h6609
-rw-r--r--mesalib/src/mesa/drivers/dri/common/spantmp2.h211
-rw-r--r--mesalib/src/mesa/drivers/dri/common/texmem.c64
-rw-r--r--mesalib/src/mesa/drivers/dri/common/texmem.h21
-rw-r--r--mesalib/src/mesa/drivers/dri/common/utils.c94
-rw-r--r--mesalib/src/mesa/drivers/dri/common/utils.h32
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py191
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/Makefile1
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c96
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_span.c72
-rw-r--r--mesalib/src/mesa/drivers/windows/fx/fx.rc39
-rw-r--r--mesalib/src/mesa/drivers/windows/gdi/InitCritSections.cpp32
-rw-r--r--mesalib/src/mesa/drivers/windows/gdi/mesa.def19
-rw-r--r--mesalib/src/mesa/drivers/windows/gdi/wmesa.c5
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c1196
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h292
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h77
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c346
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c77
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c1448
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c2196
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c257
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c422
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c1613
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c1176
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h324
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h77
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c344
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c77
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c1446
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c2046
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c249
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c448
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c1336
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c1206
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h327
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h77
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c344
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c77
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c1446
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c2104
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c263
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c443
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c1346
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/gldirect.rc43
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/mesasw/colors.h520
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c1720
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/opengl32.ref495
-rw-r--r--mesalib/src/mesa/drivers/windows/icd/mesa.def18
56 files changed, 1836 insertions, 33304 deletions
diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c
index a9f3c8e72..4ca0e7bcc 100644
--- a/mesalib/src/mesa/drivers/common/driverfuncs.c
+++ b/mesalib/src/mesa/drivers/common/driverfuncs.c
@@ -56,6 +56,7 @@
#include "swrast/swrast.h"
#include "driverfuncs.h"
+#include "meta.h"
@@ -100,12 +101,12 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->TexSubImage2D = _mesa_store_texsubimage2d;
driver->TexSubImage3D = _mesa_store_texsubimage3d;
driver->GetTexImage = _mesa_get_teximage;
- driver->CopyTexImage1D = _swrast_copy_teximage1d;
- driver->CopyTexImage2D = _swrast_copy_teximage2d;
- driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- driver->GenerateMipmap = _mesa_generate_mipmap;
+ driver->CopyTexImage1D = _mesa_meta_CopyTexImage1D;
+ driver->CopyTexImage2D = _mesa_meta_CopyTexImage2D;
+ driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D;
+ driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D;
+ driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D;
+ driver->GenerateMipmap = _mesa_meta_GenerateMipmap;
driver->TestProxyTexImage = _mesa_test_proxy_teximage;
driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
@@ -114,7 +115,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
- driver->CompressedTextureSize = _mesa_compressed_texture_size;
driver->BindTexture = NULL;
driver->NewTextureObject = _mesa_new_texture_object;
driver->DeleteTexture = _mesa_delete_texture_object;
@@ -124,15 +124,14 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->UnmapTexture = NULL;
driver->TextureMemCpy = _mesa_memcpy;
driver->IsTextureResident = NULL;
- driver->PrioritizeTexture = NULL;
driver->ActiveTexture = NULL;
driver->UpdateTexturePalette = NULL;
/* imaging */
- driver->CopyColorTable = _swrast_CopyColorTable;
- driver->CopyColorSubTable = _swrast_CopyColorSubTable;
- driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
+ driver->CopyColorTable = _mesa_meta_CopyColorTable;
+ driver->CopyColorSubTable = _mesa_meta_CopyColorSubTable;
+ driver->CopyConvolutionFilter1D = _mesa_meta_CopyConvolutionFilter1D;
+ driver->CopyConvolutionFilter2D = _mesa_meta_CopyConvolutionFilter2D;
/* Vertex/fragment programs */
driver->BindProgram = NULL;
@@ -182,22 +181,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->TexGen = NULL;
driver->TexEnv = NULL;
driver->TexParameter = NULL;
- driver->TextureMatrix = NULL;
driver->Viewport = NULL;
- /* vertex arrays */
- driver->VertexPointer = NULL;
- driver->NormalPointer = NULL;
- driver->ColorPointer = NULL;
- driver->FogCoordPointer = NULL;
- driver->IndexPointer = NULL;
- driver->SecondaryColorPointer = NULL;
- driver->TexCoordPointer = NULL;
- driver->EdgeFlagPointer = NULL;
- driver->VertexAttribPointer = NULL;
- driver->LockArraysEXT = NULL;
- driver->UnlockArraysEXT = NULL;
-
/* state queries */
driver->GetBooleanv = NULL;
driver->GetDoublev = NULL;
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index b6c6ef70f..cd9075b39 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -37,18 +37,26 @@
#include "main/arrayobj.h"
#include "main/blend.h"
#include "main/bufferobj.h"
+#include "main/buffers.h"
+#include "main/colortab.h"
+#include "main/convolve.h"
#include "main/depth.h"
#include "main/enable.h"
+#include "main/fbobject.h"
+#include "main/formats.h"
#include "main/image.h"
#include "main/macros.h"
#include "main/matrix.h"
+#include "main/mipmap.h"
#include "main/polygon.h"
#include "main/readpix.h"
#include "main/scissor.h"
#include "main/shaders.h"
+#include "main/state.h"
#include "main/stencil.h"
#include "main/texobj.h"
#include "main/texenv.h"
+#include "main/texformat.h"
#include "main/teximage.h"
#include "main/texparam.h"
#include "main/texstate.h"
@@ -60,6 +68,33 @@
#include "drivers/common/meta.h"
+/** Return offset in bytes of the field within a vertex struct */
+#define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
+
+
+/**
+ * Flags passed to _mesa_meta_begin().
+ */
+/*@{*/
+#define META_ALL ~0x0
+#define META_ALPHA_TEST 0x1
+#define META_BLEND 0x2 /**< includes logicop */
+#define META_COLOR_MASK 0x4
+#define META_DEPTH_TEST 0x8
+#define META_FOG 0x10
+#define META_PIXEL_STORE 0x20
+#define META_PIXEL_TRANSFER 0x40
+#define META_RASTERIZATION 0x80
+#define META_SCISSOR 0x100
+#define META_SHADER 0x200
+#define META_STENCIL_TEST 0x400
+#define META_TRANSFORM 0x800 /**< modelview, projection, clip planes */
+#define META_TEXTURE 0x1000
+#define META_VERTEX 0x2000
+#define META_VIEWPORT 0x4000
+/*@}*/
+
+
/**
* State which we may save/restore across meta ops.
* XXX this may be incomplete...
@@ -87,6 +122,17 @@ struct save_state
/** META_PIXEL_STORE */
struct gl_pixelstore_attrib Pack, Unpack;
+ /** META_PIXEL_TRANSFER */
+ GLfloat RedBias, RedScale;
+ GLfloat GreenBias, GreenScale;
+ GLfloat BlueBias, BlueScale;
+ GLfloat AlphaBias, AlphaScale;
+ GLfloat DepthBias, DepthScale;
+ GLboolean MapColorFlag;
+ GLboolean Convolution1DEnabled;
+ GLboolean Convolution2DEnabled;
+ GLboolean Separable2DEnabled;
+
/** META_RASTERIZATION */
GLenum FrontPolygonMode, BackPolygonMode;
GLboolean PolygonOffset;
@@ -138,6 +184,24 @@ struct save_state
/**
+ * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
+ * This is currently shared by all the meta ops. But we could create a
+ * separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc.
+ */
+struct temp_texture
+{
+ GLuint TexObj;
+ GLenum Target; /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */
+ GLsizei MinSize; /**< Min texture size to allocate */
+ GLsizei MaxSize; /**< Max possible texture size */
+ GLboolean NPOT; /**< Non-power of two size OK? */
+ GLsizei Width, Height; /**< Current texture size */
+ GLenum IntFormat;
+ GLfloat Sright, Ttop; /**< right, top texcoords */
+};
+
+
+/**
* State for glBlitFramebufer()
*/
struct blit_state
@@ -181,19 +245,24 @@ struct drawpix_state
/**
- * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
- * This is currently shared by all the meta ops. But we could create a
- * separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc.
+ * State for glBitmap()
*/
-struct temp_texture
+struct bitmap_state
{
- GLuint TexObj;
- GLenum Target; /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */
- GLsizei MaxSize; /**< Max possible texture size */
- GLboolean NPOT; /**< Non-power of two size OK? */
- GLsizei Width, Height; /**< Current texture size */
- GLenum IntFormat;
- GLfloat Sright, Ttop; /**< right, top texcoords */
+ GLuint ArrayObj;
+ GLuint VBO;
+ struct temp_texture Tex; /**< separate texture from other meta ops */
+};
+
+
+/**
+ * State for _mesa_meta_generate_mipmap()
+ */
+struct gen_mipmap_state
+{
+ GLuint ArrayObj;
+ GLuint VBO;
+ GLuint FBO;
};
@@ -206,15 +275,12 @@ struct gl_meta_state
struct temp_texture TempTex;
- struct blit_state Blit; /**< For _mesa_meta_blit_framebuffer() */
- struct clear_state Clear; /**< For _mesa_meta_clear() */
- struct copypix_state CopyPix; /**< For _mesa_meta_copy_pixels() */
- struct drawpix_state DrawPix; /**< For _mesa_meta_draw_pixels() */
-
- /* other possible meta-ops:
- * glBitmap()
- * glGenerateMipmap()
- */
+ struct blit_state Blit; /**< For _mesa_meta_BlitFramebuffer() */
+ struct clear_state Clear; /**< For _mesa_meta_Clear() */
+ struct copypix_state CopyPix; /**< For _mesa_meta_CopyPixels() */
+ struct drawpix_state DrawPix; /**< For _mesa_meta_DrawPixels() */
+ struct bitmap_state Bitmap; /**< For _mesa_meta_Bitmap() */
+ struct gen_mipmap_state Mipmap; /**< For _mesa_meta_GenerateMipmap() */
};
@@ -264,16 +330,16 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
if (state & META_ALPHA_TEST) {
save->AlphaEnabled = ctx->Color.AlphaEnabled;
if (ctx->Color.AlphaEnabled)
- _mesa_Disable(GL_ALPHA_TEST);
+ _mesa_set_enable(ctx, GL_ALPHA_TEST, GL_FALSE);
}
if (state & META_BLEND) {
save->BlendEnabled = ctx->Color.BlendEnabled;
if (ctx->Color.BlendEnabled)
- _mesa_Disable(GL_BLEND);
+ _mesa_set_enable(ctx, GL_BLEND, GL_FALSE);
save->ColorLogicOpEnabled = ctx->Color.ColorLogicOpEnabled;
if (ctx->Color.ColorLogicOpEnabled)
- _mesa_Disable(GL_COLOR_LOGIC_OP);
+ _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, GL_FALSE);
}
if (state & META_COLOR_MASK) {
@@ -288,7 +354,7 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
if (state & META_DEPTH_TEST) {
save->Depth = ctx->Depth; /* struct copy */
if (ctx->Depth.Test)
- _mesa_Disable(GL_DEPTH_TEST);
+ _mesa_set_enable(ctx, GL_DEPTH_TEST, GL_FALSE);
}
if (state & META_FOG) {
@@ -304,6 +370,35 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
ctx->Unpack = ctx->DefaultPacking;
}
+ if (state & META_PIXEL_TRANSFER) {
+ save->RedScale = ctx->Pixel.RedScale;
+ save->RedBias = ctx->Pixel.RedBias;
+ save->GreenScale = ctx->Pixel.GreenScale;
+ save->GreenBias = ctx->Pixel.GreenBias;
+ save->BlueScale = ctx->Pixel.BlueScale;
+ save->BlueBias = ctx->Pixel.BlueBias;
+ save->AlphaScale = ctx->Pixel.AlphaScale;
+ save->AlphaBias = ctx->Pixel.AlphaBias;
+ save->MapColorFlag = ctx->Pixel.MapColorFlag;
+ save->Convolution1DEnabled = ctx->Pixel.Convolution1DEnabled;
+ save->Convolution2DEnabled = ctx->Pixel.Convolution2DEnabled;
+ save->Separable2DEnabled = ctx->Pixel.Separable2DEnabled;
+ ctx->Pixel.RedScale = 1.0F;
+ ctx->Pixel.RedBias = 0.0F;
+ ctx->Pixel.GreenScale = 1.0F;
+ ctx->Pixel.GreenBias = 0.0F;
+ ctx->Pixel.BlueScale = 1.0F;
+ ctx->Pixel.BlueBias = 0.0F;
+ ctx->Pixel.AlphaScale = 1.0F;
+ ctx->Pixel.AlphaBias = 0.0F;
+ ctx->Pixel.MapColorFlag = GL_FALSE;
+ ctx->Pixel.Convolution1DEnabled = GL_FALSE;
+ ctx->Pixel.Convolution2DEnabled = GL_FALSE;
+ ctx->Pixel.Separable2DEnabled = GL_FALSE;
+ /* XXX more state */
+ ctx->NewState |=_NEW_PIXEL;
+ }
+
if (state & META_RASTERIZATION) {
save->FrontPolygonMode = ctx->Polygon.FrontMode;
save->BackPolygonMode = ctx->Polygon.BackMode;
@@ -345,7 +440,7 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
if (state & META_STENCIL_TEST) {
save->Stencil = ctx->Stencil; /* struct copy */
if (ctx->Stencil.Enabled)
- _mesa_Disable(GL_STENCIL_TEST);
+ _mesa_set_enable(ctx, GL_STENCIL_TEST, GL_FALSE);
/* NOTE: other stencil state not reset */
}
@@ -499,6 +594,23 @@ _mesa_meta_end(GLcontext *ctx)
ctx->Unpack = save->Unpack;
}
+ if (state & META_PIXEL_TRANSFER) {
+ ctx->Pixel.RedScale = save->RedScale;
+ ctx->Pixel.RedBias = save->RedBias;
+ ctx->Pixel.GreenScale = save->GreenScale;
+ ctx->Pixel.GreenBias = save->GreenBias;
+ ctx->Pixel.BlueScale = save->BlueScale;
+ ctx->Pixel.BlueBias = save->BlueBias;
+ ctx->Pixel.AlphaScale = save->AlphaScale;
+ ctx->Pixel.AlphaBias = save->AlphaBias;
+ ctx->Pixel.MapColorFlag = save->MapColorFlag;
+ ctx->Pixel.Convolution1DEnabled = save->Convolution1DEnabled;
+ ctx->Pixel.Convolution2DEnabled = save->Convolution2DEnabled;
+ ctx->Pixel.Separable2DEnabled = save->Separable2DEnabled;
+ /* XXX more state */
+ ctx->NewState |=_NEW_PIXEL;
+ }
+
if (state & META_RASTERIZATION) {
_mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode);
_mesa_PolygonMode(GL_BACK, save->BackPolygonMode);
@@ -669,8 +781,35 @@ _mesa_meta_end(GLcontext *ctx)
/**
- * Return pointer to temp_texture info. This does some one-time init
- * if needed.
+ * One-time init for a temp_texture object.
+ * Choose tex target, compute max tex size, etc.
+ */
+static void
+init_temp_texture(GLcontext *ctx, struct temp_texture *tex)
+{
+ /* prefer texture rectangle */
+ if (ctx->Extensions.NV_texture_rectangle) {
+ tex->Target = GL_TEXTURE_RECTANGLE;
+ tex->MaxSize = ctx->Const.MaxTextureRectSize;
+ tex->NPOT = GL_TRUE;
+ }
+ else {
+ /* use 2D texture, NPOT if possible */
+ tex->Target = GL_TEXTURE_2D;
+ tex->MaxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+ tex->NPOT = ctx->Extensions.ARB_texture_non_power_of_two;
+ }
+ tex->MinSize = 16; /* 16 x 16 at least */
+ assert(tex->MaxSize > 0);
+
+ _mesa_GenTextures(1, &tex->TexObj);
+ _mesa_BindTexture(tex->Target, tex->TexObj);
+}
+
+
+/**
+ * Return pointer to temp_texture info for non-bitmap ops.
+ * This does some one-time init if needed.
*/
static struct temp_texture *
get_temp_texture(GLcontext *ctx)
@@ -678,24 +817,25 @@ get_temp_texture(GLcontext *ctx)
struct temp_texture *tex = &ctx->Meta->TempTex;
if (!tex->TexObj) {
- /* do one-time init */
+ init_temp_texture(ctx, tex);
+ }
- /* prefer texture rectangle */
- if (ctx->Extensions.NV_texture_rectangle) {
- tex->Target = GL_TEXTURE_RECTANGLE;
- tex->MaxSize = ctx->Const.MaxTextureRectSize;
- tex->NPOT = GL_TRUE;
- }
- else {
- /* use 2D texture, NPOT if possible */
- tex->Target = GL_TEXTURE_2D;
- tex->MaxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- tex->NPOT = ctx->Extensions.ARB_texture_non_power_of_two;
- }
- assert(tex->MaxSize > 0);
+ return tex;
+}
- _mesa_GenTextures(1, &tex->TexObj);
- _mesa_BindTexture(tex->Target, tex->TexObj);
+
+/**
+ * Return pointer to temp_texture info for _mesa_meta_bitmap().
+ * We use a separate texture for bitmaps to reduce texture
+ * allocation/deallocation.
+ */
+static struct temp_texture *
+get_bitmap_temp_texture(GLcontext *ctx)
+{
+ struct temp_texture *tex = &ctx->Meta->Bitmap.Tex;
+
+ if (!tex->TexObj) {
+ init_temp_texture(ctx, tex);
}
return tex;
@@ -717,6 +857,9 @@ alloc_texture(struct temp_texture *tex,
{
GLboolean newTex = GL_FALSE;
+ ASSERT(width <= tex->MaxSize);
+ ASSERT(height <= tex->MaxSize);
+
if (width > tex->Width ||
height > tex->Height ||
intFormat != tex->IntFormat) {
@@ -724,13 +867,13 @@ alloc_texture(struct temp_texture *tex,
if (tex->NPOT) {
/* use non-power of two size */
- tex->Width = width;
- tex->Height = height;
+ tex->Width = MAX2(tex->MinSize, width);
+ tex->Height = MAX2(tex->MinSize, height);
}
else {
/* find power of two size */
GLsizei w, h;
- w = h = 16;
+ w = h = tex->MinSize;
while (w < width)
w *= 2;
while (h < height)
@@ -803,7 +946,8 @@ setup_copypix_texture(struct temp_texture *tex,
* Setup/load texture for glDrawPixels.
*/
static void
-setup_drawpix_texture(struct temp_texture *tex,
+setup_drawpix_texture(GLcontext *ctx,
+ struct temp_texture *tex,
GLboolean newTex,
GLenum texIntFormat,
GLsizei width, GLsizei height,
@@ -824,9 +968,17 @@ setup_drawpix_texture(struct temp_texture *tex,
tex->Width, tex->Height, 0, format, type, pixels);
}
else {
+ struct gl_buffer_object *save_unpack_obj = NULL;
+
+ _mesa_reference_buffer_object(ctx, &save_unpack_obj,
+ ctx->Unpack.BufferObj);
+ _mesa_BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
/* create empty texture */
_mesa_TexImage2D(tex->Target, 0, tex->IntFormat,
tex->Width, tex->Height, 0, format, type, NULL);
+ if (save_unpack_obj != NULL)
+ _mesa_BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB,
+ save_unpack_obj->Name);
/* load image */
_mesa_TexSubImage2D(tex->Target, 0,
0, 0, width, height, format, type, pixels);
@@ -874,14 +1026,143 @@ init_blit_depth_pixels(GLcontext *ctx)
/**
+ * Try to do a glBlitFramebuffer using no-copy texturing.
+ * We can do this when the src renderbuffer is actually a texture.
+ * But if the src buffer == dst buffer we cannot do this.
+ *
+ * \return new buffer mask indicating the buffers left to blit using the
+ * normal path.
+ */
+static GLbitfield
+blitframebuffer_texture(GLcontext *ctx,
+ GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter)
+{
+ if (mask & GL_COLOR_BUFFER_BIT) {
+ const struct gl_framebuffer *drawFb = ctx->DrawBuffer;
+ const struct gl_framebuffer *readFb = ctx->ReadBuffer;
+ const struct gl_renderbuffer_attachment *drawAtt =
+ &drawFb->Attachment[drawFb->_ColorDrawBufferIndexes[0]];
+ const struct gl_renderbuffer_attachment *readAtt =
+ &readFb->Attachment[readFb->_ColorReadBufferIndex];
+
+ if (readAtt && readAtt->Texture) {
+ const struct gl_texture_object *texObj = readAtt->Texture;
+ const GLuint srcLevel = readAtt->TextureLevel;
+ const GLenum minFilterSave = texObj->MinFilter;
+ const GLenum magFilterSave = texObj->MagFilter;
+ const GLint baseLevelSave = texObj->BaseLevel;
+ const GLint maxLevelSave = texObj->MaxLevel;
+ const GLenum wrapSSave = texObj->WrapS;
+ const GLenum wrapTSave = texObj->WrapT;
+ const GLenum target = texObj->Target;
+
+ if (drawAtt->Texture == readAtt->Texture) {
+ /* Can't use same texture as both the source and dest. We need
+ * to handle overlapping blits and besides, some hw may not
+ * support this.
+ */
+ return mask;
+ }
+
+ if (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_ARB) {
+ /* Can't handle other texture types at this time */
+ return mask;
+ }
+
+ /*
+ printf("Blit from texture!\n");
+ printf(" srcAtt %p dstAtt %p\n", readAtt, drawAtt);
+ printf(" srcTex %p dstText %p\n", texObj, drawAtt->Texture);
+ */
+
+ /* Prepare src texture state */
+ _mesa_BindTexture(target, texObj->Name);
+ _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, filter);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, filter);
+ _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ _mesa_set_enable(ctx, target, GL_TRUE);
+
+ /* Prepare vertex data (the VBO was previously created and bound) */
+ {
+ struct vertex {
+ GLfloat x, y, s, t;
+ };
+ struct vertex verts[4];
+ GLfloat s0, t0, s1, t1;
+
+ if (target == GL_TEXTURE_2D) {
+ const struct gl_texture_image *texImage
+ = _mesa_select_tex_image(ctx, texObj, target, srcLevel);
+ s0 = srcX0 / (float) texImage->Width;
+ s1 = srcX1 / (float) texImage->Width;
+ t0 = srcY0 / (float) texImage->Height;
+ t1 = srcY1 / (float) texImage->Height;
+ }
+ else {
+ assert(target == GL_TEXTURE_RECTANGLE_ARB);
+ s0 = srcX0;
+ s1 = srcX1;
+ t0 = srcY0;
+ t1 = srcY1;
+ }
+
+ verts[0].x = (GLfloat) dstX0;
+ verts[0].y = (GLfloat) dstY0;
+ verts[1].x = (GLfloat) dstX1;
+ verts[1].y = (GLfloat) dstY0;
+ verts[2].x = (GLfloat) dstX1;
+ verts[2].y = (GLfloat) dstY1;
+ verts[3].x = (GLfloat) dstX0;
+ verts[3].y = (GLfloat) dstY1;
+
+ verts[0].s = s0;
+ verts[0].t = t0;
+ verts[1].s = s1;
+ verts[1].t = t0;
+ verts[2].s = s1;
+ verts[2].t = t1;
+ verts[3].s = s0;
+ verts[3].t = t1;
+
+ _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+ }
+
+ _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ /* Restore texture object state, the texture binding will
+ * be restored by _mesa_meta_end().
+ */
+ _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, wrapTSave);
+
+ /* Done with color buffer */
+ mask &= ~GL_COLOR_BUFFER_BIT;
+ }
+ }
+
+ return mask;
+}
+
+
+/**
* Meta implementation of ctx->Driver.BlitFramebuffer() in terms
* of texture mapping and polygon rendering.
*/
void
-_mesa_meta_blit_framebuffer(GLcontext *ctx,
- GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, GLenum filter)
+_mesa_meta_BlitFramebuffer(GLcontext *ctx,
+ GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter)
{
struct blit_state *blit = &ctx->Meta->Blit;
struct temp_texture *tex = get_temp_texture(ctx);
@@ -892,7 +1173,10 @@ _mesa_meta_blit_framebuffer(GLcontext *ctx,
const GLint srcH = abs(srcY1 - srcY0);
const GLboolean srcFlipX = srcX1 < srcX0;
const GLboolean srcFlipY = srcY1 < srcY0;
- GLfloat verts[4][4]; /* four verts of X,Y,S,T */
+ struct vertex {
+ GLfloat x, y, s, t;
+ };
+ struct vertex verts[4];
GLboolean newTex;
if (srcW > maxTexSize || srcH > maxTexSize) {
@@ -931,10 +1215,8 @@ _mesa_meta_blit_framebuffer(GLcontext *ctx,
NULL, GL_DYNAMIC_DRAW_ARB);
/* setup vertex arrays */
- _mesa_VertexPointer(2, GL_FLOAT, sizeof(verts[0]),
- (void *) (0 * sizeof(GLfloat)));
- _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]),
- (void *) (2 * sizeof(GLfloat)));
+ _mesa_VertexPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
+ _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s));
_mesa_EnableClientState(GL_VERTEX_ARRAY);
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
}
@@ -943,33 +1225,45 @@ _mesa_meta_blit_framebuffer(GLcontext *ctx,
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, blit->VBO);
}
+ /* Try faster, direct texture approach first */
+ mask = blitframebuffer_texture(ctx, srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1, mask, filter);
+ if (mask == 0x0) {
+ _mesa_meta_end(ctx);
+ return;
+ }
+
+ /* Continue with "normal" approach which involves copying the src rect
+ * into a temporary texture and is "blitted" by drawing a textured quad.
+ */
+
newTex = alloc_texture(tex, srcW, srcH, GL_RGBA);
/* vertex positions/texcoords (after texture allocation!) */
{
- verts[0][0] = (GLfloat) dstX0;
- verts[0][1] = (GLfloat) dstY0;
- verts[1][0] = (GLfloat) dstX1;
- verts[1][1] = (GLfloat) dstY0;
- verts[2][0] = (GLfloat) dstX1;
- verts[2][1] = (GLfloat) dstY1;
- verts[3][0] = (GLfloat) dstX0;
- verts[3][1] = (GLfloat) dstY1;
-
- verts[0][2] = 0.0F;
- verts[0][3] = 0.0F;
- verts[1][2] = tex->Sright;
- verts[1][3] = 0.0F;
- verts[2][2] = tex->Sright;
- verts[2][3] = tex->Ttop;
- verts[3][2] = 0.0F;
- verts[3][3] = tex->Ttop;
+ verts[0].x = (GLfloat) dstX0;
+ verts[0].y = (GLfloat) dstY0;
+ verts[1].x = (GLfloat) dstX1;
+ verts[1].y = (GLfloat) dstY0;
+ verts[2].x = (GLfloat) dstX1;
+ verts[2].y = (GLfloat) dstY1;
+ verts[3].x = (GLfloat) dstX0;
+ verts[3].y = (GLfloat) dstY1;
+
+ verts[0].s = 0.0F;
+ verts[0].t = 0.0F;
+ verts[1].s = tex->Sright;
+ verts[1].t = 0.0F;
+ verts[2].s = tex->Sright;
+ verts[2].t = tex->Ttop;
+ verts[3].s = 0.0F;
+ verts[3].t = tex->Ttop;
/* upload new vertex data */
_mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
}
- _mesa_Enable(tex->Target);
+ _mesa_set_enable(ctx, tex->Target, GL_TRUE);
if (mask & GL_COLOR_BUFFER_BIT) {
setup_copypix_texture(tex, newTex, srcX, srcY, srcW, srcH,
@@ -990,7 +1284,7 @@ _mesa_meta_blit_framebuffer(GLcontext *ctx,
_mesa_ReadPixels(srcX, srcY, srcW, srcH,
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp);
- setup_drawpix_texture(tex, newTex, GL_DEPTH_COMPONENT, srcW, srcH,
+ setup_drawpix_texture(ctx, tex, newTex, GL_DEPTH_COMPONENT, srcW, srcH,
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp);
_mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, blit->DepthFP);
@@ -1011,7 +1305,7 @@ _mesa_meta_blit_framebuffer(GLcontext *ctx,
/* XXX can't easily do stencil */
}
- _mesa_Disable(tex->Target);
+ _mesa_set_enable(ctx, tex->Target, GL_FALSE);
_mesa_meta_end(ctx);
@@ -1026,10 +1320,13 @@ _mesa_meta_blit_framebuffer(GLcontext *ctx,
* Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
*/
void
-_mesa_meta_clear(GLcontext *ctx, GLbitfield buffers)
+_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
{
struct clear_state *clear = &ctx->Meta->Clear;
- GLfloat verts[4][7]; /* four verts of X,Y,Z,R,G,B,A */
+ struct vertex {
+ GLfloat x, y, z, r, g, b, a;
+ };
+ struct vertex verts[4];
/* save all state but scissor, pixel pack/unpack */
GLbitfield metaSave = META_ALL - META_SCISSOR - META_PIXEL_STORE;
@@ -1050,14 +1347,10 @@ _mesa_meta_clear(GLcontext *ctx, GLbitfield buffers)
/* create vertex array buffer */
_mesa_GenBuffersARB(1, &clear->VBO);
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO);
- _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
- NULL, GL_DYNAMIC_DRAW_ARB);
/* setup vertex arrays */
- _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]),
- (void *) (0 * sizeof(GLfloat)));
- _mesa_ColorPointer(4, GL_FLOAT, sizeof(verts[0]),
- (void *) (3 * sizeof(GLfloat)));
+ _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
+ _mesa_ColorPointer(4, GL_FLOAT, sizeof(struct vertex), OFFSET(r));
_mesa_EnableClientState(GL_VERTEX_ARRAY);
_mesa_EnableClientState(GL_COLOR_ARRAY);
}
@@ -1107,26 +1400,30 @@ _mesa_meta_clear(GLcontext *ctx, GLbitfield buffers)
const GLfloat z = 1.0 - 2.0 * ctx->Depth.Clear;
GLuint i;
- verts[0][0] = x0;
- verts[0][1] = y0;
- verts[0][2] = z;
- verts[1][0] = x1;
- verts[1][1] = y0;
- verts[1][2] = z;
- verts[2][0] = x1;
- verts[2][1] = y1;
- verts[2][2] = z;
- verts[3][0] = x0;
- verts[3][1] = y1;
- verts[3][2] = z;
+ verts[0].x = x0;
+ verts[0].y = y0;
+ verts[0].z = z;
+ verts[1].x = x1;
+ verts[1].y = y0;
+ verts[1].z = z;
+ verts[2].x = x1;
+ verts[2].y = y1;
+ verts[2].z = z;
+ verts[3].x = x0;
+ verts[3].y = y1;
+ verts[3].z = z;
/* vertex colors */
for (i = 0; i < 4; i++) {
- COPY_4FV(&verts[i][3], ctx->Color.ClearColor);
+ verts[i].r = ctx->Color.ClearColor[0];
+ verts[i].g = ctx->Color.ClearColor[1];
+ verts[i].b = ctx->Color.ClearColor[2];
+ verts[i].a = ctx->Color.ClearColor[3];
}
/* upload new vertex data */
- _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+ _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts,
+ GL_DYNAMIC_DRAW_ARB);
}
/* draw quad */
@@ -1141,13 +1438,16 @@ _mesa_meta_clear(GLcontext *ctx, GLbitfield buffers)
* of texture mapping and polygon rendering.
*/
void
-_mesa_meta_copy_pixels(GLcontext *ctx, GLint srcX, GLint srcY,
- GLsizei width, GLsizei height,
- GLint dstX, GLint dstY, GLenum type)
+_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY,
+ GLsizei width, GLsizei height,
+ GLint dstX, GLint dstY, GLenum type)
{
struct copypix_state *copypix = &ctx->Meta->CopyPix;
struct temp_texture *tex = get_temp_texture(ctx);
- GLfloat verts[4][5]; /* four verts of X,Y,Z,S,T */
+ struct vertex {
+ GLfloat x, y, z, s, t;
+ };
+ struct vertex verts[4];
GLboolean newTex;
GLenum intFormat = GL_RGBA;
@@ -1185,10 +1485,8 @@ _mesa_meta_copy_pixels(GLcontext *ctx, GLint srcX, GLint srcY,
NULL, GL_DYNAMIC_DRAW_ARB);
/* setup vertex arrays */
- _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]),
- (void *) (0 * sizeof(GLfloat)));
- _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]),
- (void *) (3 * sizeof(GLfloat)));
+ _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
+ _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s));
_mesa_EnableClientState(GL_VERTEX_ARRAY);
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
}
@@ -1207,26 +1505,26 @@ _mesa_meta_copy_pixels(GLcontext *ctx, GLint srcX, GLint srcY,
const GLfloat dstY1 = dstY + height * ctx->Pixel.ZoomY;
const GLfloat z = ctx->Current.RasterPos[2];
- verts[0][0] = dstX0;
- verts[0][1] = dstY0;
- verts[0][2] = z;
- verts[0][3] = 0.0F;
- verts[0][4] = 0.0F;
- verts[1][0] = dstX1;
- verts[1][1] = dstY0;
- verts[1][2] = z;
- verts[1][3] = tex->Sright;
- verts[1][4] = 0.0F;
- verts[2][0] = dstX1;
- verts[2][1] = dstY1;
- verts[2][2] = z;
- verts[2][3] = tex->Sright;
- verts[2][4] = tex->Ttop;
- verts[3][0] = dstX0;
- verts[3][1] = dstY1;
- verts[3][2] = z;
- verts[3][3] = 0.0F;
- verts[3][4] = tex->Ttop;
+ verts[0].x = dstX0;
+ verts[0].y = dstY0;
+ verts[0].z = z;
+ verts[0].s = 0.0F;
+ verts[0].t = 0.0F;
+ verts[1].x = dstX1;
+ verts[1].y = dstY0;
+ verts[1].z = z;
+ verts[1].s = tex->Sright;
+ verts[1].t = 0.0F;
+ verts[2].x = dstX1;
+ verts[2].y = dstY1;
+ verts[2].z = z;
+ verts[2].s = tex->Sright;
+ verts[2].t = tex->Ttop;
+ verts[3].x = dstX0;
+ verts[3].y = dstY1;
+ verts[3].z = z;
+ verts[3].s = 0.0F;
+ verts[3].t = tex->Ttop;
/* upload new vertex data */
_mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
@@ -1236,12 +1534,12 @@ _mesa_meta_copy_pixels(GLcontext *ctx, GLint srcX, GLint srcY,
setup_copypix_texture(tex, newTex, srcX, srcY, width, height,
GL_RGBA, GL_NEAREST);
- _mesa_Enable(tex->Target);
+ _mesa_set_enable(ctx, tex->Target, GL_TRUE);
/* draw textured quad */
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
- _mesa_Disable(tex->Target);
+ _mesa_set_enable(ctx, tex->Target, GL_FALSE);
_mesa_meta_end(ctx);
}
@@ -1279,9 +1577,8 @@ tiled_draw_pixels(GLcontext *ctx,
tileUnpack.SkipRows = unpack->SkipRows + j;
- _mesa_meta_draw_pixels(ctx, tileX, tileY,
- tileWidth, tileHeight,
- format, type, &tileUnpack, pixels);
+ _mesa_meta_DrawPixels(ctx, tileX, tileY, tileWidth, tileHeight,
+ format, type, &tileUnpack, pixels);
}
}
}
@@ -1390,17 +1687,20 @@ init_draw_depth_pixels(GLcontext *ctx)
* of texture mapping and polygon rendering.
*/
void
-_mesa_meta_draw_pixels(GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels)
+_mesa_meta_DrawPixels(GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLvoid *pixels)
{
struct drawpix_state *drawpix = &ctx->Meta->DrawPix;
struct temp_texture *tex = get_temp_texture(ctx);
const struct gl_pixelstore_attrib unpackSave = ctx->Unpack;
const GLuint origStencilMask = ctx->Stencil.WriteMask[0];
- GLfloat verts[4][5]; /* four verts of X,Y,Z,S,T */
+ struct vertex {
+ GLfloat x, y, z, s, t;
+ };
+ struct vertex verts[4];
GLenum texIntFormat;
GLboolean fallback, newTex;
GLbitfield metaExtraSave = 0x0;
@@ -1494,26 +1794,26 @@ _mesa_meta_draw_pixels(GLcontext *ctx,
const GLfloat y1 = y + height * ctx->Pixel.ZoomY;
const GLfloat z = ctx->Current.RasterPos[2];
- verts[0][0] = x0;
- verts[0][1] = y0;
- verts[0][2] = z;
- verts[0][3] = 0.0F;
- verts[0][4] = 0.0F;
- verts[1][0] = x1;
- verts[1][1] = y0;
- verts[1][2] = z;
- verts[1][3] = tex->Sright;
- verts[1][4] = 0.0F;
- verts[2][0] = x1;
- verts[2][1] = y1;
- verts[2][2] = z;
- verts[2][3] = tex->Sright;
- verts[2][4] = tex->Ttop;
- verts[3][0] = x0;
- verts[3][1] = y1;
- verts[3][2] = z;
- verts[3][3] = 0.0F;
- verts[3][4] = tex->Ttop;
+ verts[0].x = x0;
+ verts[0].y = y0;
+ verts[0].z = z;
+ verts[0].s = 0.0F;
+ verts[0].t = 0.0F;
+ verts[1].x = x1;
+ verts[1].y = y0;
+ verts[1].z = z;
+ verts[1].s = tex->Sright;
+ verts[1].t = 0.0F;
+ verts[2].x = x1;
+ verts[2].y = y1;
+ verts[2].z = z;
+ verts[2].s = tex->Sright;
+ verts[2].t = tex->Ttop;
+ verts[3].x = x0;
+ verts[3].y = y1;
+ verts[3].z = z;
+ verts[3].s = 0.0F;
+ verts[3].t = tex->Ttop;
}
if (drawpix->ArrayObj == 0) {
@@ -1529,17 +1829,15 @@ _mesa_meta_draw_pixels(GLcontext *ctx,
verts, GL_DYNAMIC_DRAW_ARB);
/* setup vertex arrays */
- _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]),
- (void *) (0 * sizeof(GLfloat)));
- _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]),
- (void *) (3 * sizeof(GLfloat)));
+ _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
+ _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s));
_mesa_EnableClientState(GL_VERTEX_ARRAY);
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
/* set given unpack params */
ctx->Unpack = *unpack;
- _mesa_Enable(tex->Target);
+ _mesa_set_enable(ctx, tex->Target, GL_TRUE);
if (_mesa_is_stencil_format(format)) {
/* Drawing stencil */
@@ -1548,7 +1846,7 @@ _mesa_meta_draw_pixels(GLcontext *ctx,
if (!drawpix->StencilFP)
init_draw_stencil_pixels(ctx);
- setup_drawpix_texture(tex, newTex, texIntFormat, width, height,
+ setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height,
GL_ALPHA, type, pixels);
_mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@@ -1591,19 +1889,19 @@ _mesa_meta_draw_pixels(GLcontext *ctx,
_mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0,
ctx->Current.RasterColor);
- setup_drawpix_texture(tex, newTex, texIntFormat, width, height,
+ setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height,
format, type, pixels);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
else {
/* Drawing RGBA */
- setup_drawpix_texture(tex, newTex, texIntFormat, width, height,
+ setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height,
format, type, pixels);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
- _mesa_Disable(tex->Target);
+ _mesa_set_enable(ctx, tex->Target, GL_FALSE);
_mesa_DeleteBuffersARB(1, &vbo);
@@ -1612,3 +1910,889 @@ _mesa_meta_draw_pixels(GLcontext *ctx,
_mesa_meta_end(ctx);
}
+
+
+/**
+ * Do glBitmap with a alpha texture quad. Use the alpha test to
+ * cull the 'off' bits. If alpha test is already enabled, fall back
+ * to swrast (should be a rare case).
+ * A bitmap cache as in the gallium/mesa state tracker would
+ * improve performance a lot.
+ */
+void
+_mesa_meta_Bitmap(GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLubyte *bitmap1)
+{
+ struct bitmap_state *bitmap = &ctx->Meta->Bitmap;
+ struct temp_texture *tex = get_bitmap_temp_texture(ctx);
+ const GLenum texIntFormat = GL_ALPHA;
+ const struct gl_pixelstore_attrib unpackSave = *unpack;
+ struct vertex {
+ GLfloat x, y, z, s, t, r, g, b, a;
+ };
+ struct vertex verts[4];
+ GLboolean newTex;
+ GLubyte *bitmap8;
+
+ /*
+ * Check if swrast fallback is needed.
+ */
+ if (ctx->_ImageTransferState ||
+ ctx->Color.AlphaEnabled ||
+ ctx->Fog.Enabled ||
+ ctx->Texture._EnabledUnits ||
+ width > tex->MaxSize ||
+ height > tex->MaxSize) {
+ _swrast_Bitmap(ctx, x, y, width, height, unpack, bitmap1);
+ return;
+ }
+
+ /* Most GL state applies to glBitmap (like blending, stencil, etc),
+ * but a there's a few things we need to override:
+ */
+ _mesa_meta_begin(ctx, (META_ALPHA_TEST |
+ META_PIXEL_STORE |
+ META_RASTERIZATION |
+ META_SHADER |
+ META_TEXTURE |
+ META_TRANSFORM |
+ META_VERTEX |
+ META_VIEWPORT));
+
+ if (bitmap->ArrayObj == 0) {
+ /* one-time setup */
+
+ /* create vertex array object */
+ _mesa_GenVertexArraysAPPLE(1, &bitmap->ArrayObj);
+ _mesa_BindVertexArrayAPPLE(bitmap->ArrayObj);
+
+ /* create vertex array buffer */
+ _mesa_GenBuffersARB(1, &bitmap->VBO);
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, bitmap->VBO);
+ _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
+ NULL, GL_DYNAMIC_DRAW_ARB);
+
+ /* setup vertex arrays */
+ _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
+ _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s));
+ _mesa_ColorPointer(4, GL_FLOAT, sizeof(struct vertex), OFFSET(r));
+ _mesa_EnableClientState(GL_VERTEX_ARRAY);
+ _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
+ _mesa_EnableClientState(GL_COLOR_ARRAY);
+ }
+ else {
+ _mesa_BindVertexArray(bitmap->ArrayObj);
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, bitmap->VBO);
+ }
+
+ newTex = alloc_texture(tex, width, height, texIntFormat);
+
+ /* vertex positions, texcoords, colors (after texture allocation!) */
+ {
+ const GLfloat x0 = (GLfloat) x;
+ const GLfloat y0 = (GLfloat) y;
+ const GLfloat x1 = (GLfloat) (x + width);
+ const GLfloat y1 = (GLfloat) (y + height);
+ const GLfloat z = ctx->Current.RasterPos[2];
+ GLuint i;
+
+ verts[0].x = x0;
+ verts[0].y = y0;
+ verts[0].z = z;
+ verts[0].s = 0.0F;
+ verts[0].t = 0.0F;
+ verts[1].x = x1;
+ verts[1].y = y0;
+ verts[1].z = z;
+ verts[1].s = tex->Sright;
+ verts[1].t = 0.0F;
+ verts[2].x = x1;
+ verts[2].y = y1;
+ verts[2].z = z;
+ verts[2].s = tex->Sright;
+ verts[2].t = tex->Ttop;
+ verts[3].x = x0;
+ verts[3].y = y1;
+ verts[3].z = z;
+ verts[3].s = 0.0F;
+ verts[3].t = tex->Ttop;
+
+ for (i = 0; i < 4; i++) {
+ verts[i].r = ctx->Current.RasterColor[0];
+ verts[i].g = ctx->Current.RasterColor[1];
+ verts[i].b = ctx->Current.RasterColor[2];
+ verts[i].a = ctx->Current.RasterColor[3];
+ }
+
+ /* upload new vertex data */
+ _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+ }
+
+ bitmap1 = _mesa_map_pbo_source(ctx, &unpackSave, bitmap1);
+ if (!bitmap1)
+ return;
+
+ bitmap8 = (GLubyte *) _mesa_calloc(width * height);
+ if (bitmap8) {
+ _mesa_expand_bitmap(width, height, &unpackSave, bitmap1,
+ bitmap8, width, 0xff);
+
+ _mesa_set_enable(ctx, tex->Target, GL_TRUE);
+
+ _mesa_set_enable(ctx, GL_ALPHA_TEST, GL_TRUE);
+ _mesa_AlphaFunc(GL_GREATER, 0.0);
+
+ setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height,
+ GL_ALPHA, GL_UNSIGNED_BYTE, bitmap8);
+
+ _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ _mesa_set_enable(ctx, tex->Target, GL_FALSE);
+
+ _mesa_free(bitmap8);
+ }
+
+ _mesa_unmap_pbo_source(ctx, &unpackSave);
+
+ _mesa_meta_end(ctx);
+}
+
+
+/**
+ * Check if the call to _mesa_meta_GenerateMipmap() will require a
+ * software fallback. The fallback path will require that the texture
+ * images are mapped.
+ * \return GL_TRUE if a fallback is needed, GL_FALSE otherwise
+ */
+GLboolean
+_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *texObj)
+{
+ const GLuint fboSave = ctx->DrawBuffer->Name;
+ struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap;
+ struct gl_texture_image *baseImage;
+ GLuint srcLevel;
+ GLenum status;
+
+ /* check for fallbacks */
+ if (!ctx->Extensions.EXT_framebuffer_object ||
+ target == GL_TEXTURE_3D) {
+ return GL_TRUE;
+ }
+
+ srcLevel = texObj->BaseLevel;
+ baseImage = _mesa_select_tex_image(ctx, texObj, target, srcLevel);
+ if (!baseImage || _mesa_is_format_compressed(baseImage->TexFormat)) {
+ return GL_TRUE;
+ }
+
+ /*
+ * Test that we can actually render in the texture's format.
+ */
+ if (!mipmap->FBO)
+ _mesa_GenFramebuffersEXT(1, &mipmap->FBO);
+ _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);
+
+ if (target == GL_TEXTURE_1D) {
+ _mesa_FramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ target, texObj->Name, srcLevel);
+ }
+ else if (target == GL_TEXTURE_3D) {
+ GLint zoffset = 0;
+ _mesa_FramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ target, texObj->Name, srcLevel, zoffset);
+ }
+ else {
+ /* 2D / cube */
+ _mesa_FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ target, texObj->Name, srcLevel);
+ }
+
+ status = _mesa_CheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+
+ _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave);
+
+ if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ return GL_TRUE;
+ }
+
+ return GL_FALSE;
+}
+
+
+/**
+ * Called via ctx->Driver.GenerateMipmap()
+ * Note: texture borders and 3D texture support not yet complete.
+ */
+void
+_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *texObj)
+{
+ struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap;
+ struct vertex {
+ GLfloat x, y, s, t, r;
+ };
+ struct vertex verts[4];
+ const GLuint baseLevel = texObj->BaseLevel;
+ const GLuint maxLevel = texObj->MaxLevel;
+ const GLenum minFilterSave = texObj->MinFilter;
+ const GLenum magFilterSave = texObj->MagFilter;
+ const GLint baseLevelSave = texObj->BaseLevel;
+ const GLint maxLevelSave = texObj->MaxLevel;
+ const GLboolean genMipmapSave = texObj->GenerateMipmap;
+ const GLenum wrapSSave = texObj->WrapS;
+ const GLenum wrapTSave = texObj->WrapT;
+ const GLenum wrapRSave = texObj->WrapR;
+ const GLuint fboSave = ctx->DrawBuffer->Name;
+ const GLuint original_active_unit = ctx->Texture.CurrentUnit;
+ GLenum faceTarget;
+ GLuint dstLevel;
+ GLuint border = 0;
+
+ if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) {
+ _mesa_generate_mipmap(ctx, target, texObj);
+ return;
+ }
+
+ if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) {
+ faceTarget = target;
+ target = GL_TEXTURE_CUBE_MAP;
+ }
+ else {
+ faceTarget = target;
+ }
+
+ _mesa_meta_begin(ctx, META_ALL);
+
+ if (original_active_unit != 0)
+ _mesa_BindTexture(target, texObj->Name);
+
+ if (mipmap->ArrayObj == 0) {
+ /* one-time setup */
+
+ /* create vertex array object */
+ _mesa_GenVertexArraysAPPLE(1, &mipmap->ArrayObj);
+ _mesa_BindVertexArrayAPPLE(mipmap->ArrayObj);
+
+ /* create vertex array buffer */
+ _mesa_GenBuffersARB(1, &mipmap->VBO);
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
+ _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
+ NULL, GL_DYNAMIC_DRAW_ARB);
+
+ /* setup vertex arrays */
+ _mesa_VertexPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
+ _mesa_TexCoordPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(s));
+ _mesa_EnableClientState(GL_VERTEX_ARRAY);
+ _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
+ }
+ else {
+ _mesa_BindVertexArray(mipmap->ArrayObj);
+ _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, mipmap->VBO);
+ }
+
+ if (!mipmap->FBO) {
+ _mesa_GenFramebuffersEXT(1, &mipmap->FBO);
+ }
+ _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);
+
+ _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
+
+ _mesa_set_enable(ctx, target, GL_TRUE);
+
+ /* setup texcoords once (XXX what about border?) */
+ switch (faceTarget) {
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_2D:
+ verts[0].s = 0.0F;
+ verts[0].t = 0.0F;
+ verts[0].r = 0.0F;
+ verts[1].s = 1.0F;
+ verts[1].t = 0.0F;
+ verts[1].r = 0.0F;
+ verts[2].s = 1.0F;
+ verts[2].t = 1.0F;
+ verts[2].r = 0.0F;
+ verts[3].s = 0.0F;
+ verts[3].t = 1.0F;
+ verts[3].r = 0.0F;
+ break;
+ case GL_TEXTURE_3D:
+ abort();
+ break;
+ default:
+ /* cube face */
+ {
+ static const GLfloat st[4][2] = {
+ {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}
+ };
+ GLuint i;
+
+ /* loop over quad verts */
+ for (i = 0; i < 4; i++) {
+ /* Compute sc = +/-scale and tc = +/-scale.
+ * Not +/-1 to avoid cube face selection ambiguity near the edges,
+ * though that can still sometimes happen with this scale factor...
+ */
+ const GLfloat scale = 0.9999f;
+ const GLfloat sc = (2.0f * st[i][0] - 1.0f) * scale;
+ const GLfloat tc = (2.0f * st[i][1] - 1.0f) * scale;
+
+ switch (faceTarget) {
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ verts[i].s = 1.0f;
+ verts[i].t = -tc;
+ verts[i].r = -sc;
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ verts[i].s = -1.0f;
+ verts[i].t = -tc;
+ verts[i].r = sc;
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ verts[i].s = sc;
+ verts[i].t = 1.0f;
+ verts[i].r = tc;
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ verts[i].s = sc;
+ verts[i].t = -1.0f;
+ verts[i].r = -tc;
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ verts[i].s = sc;
+ verts[i].t = -tc;
+ verts[i].r = 1.0f;
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ verts[i].s = -sc;
+ verts[i].t = -tc;
+ verts[i].r = -1.0f;
+ break;
+ default:
+ assert(0);
+ }
+ }
+ }
+ }
+
+ _mesa_set_enable(ctx, target, GL_TRUE);
+
+ /* texture is already locked, unlock now */
+ _mesa_unlock_texture(ctx, texObj);
+
+ for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) {
+ const struct gl_texture_image *srcImage;
+ const GLuint srcLevel = dstLevel - 1;
+ GLsizei srcWidth, srcHeight, srcDepth;
+ GLsizei dstWidth, dstHeight, dstDepth;
+ GLenum status;
+
+ srcImage = _mesa_select_tex_image(ctx, texObj, faceTarget, srcLevel);
+ assert(srcImage->Border == 0); /* XXX we can fix this */
+
+ /* src size w/out border */
+ srcWidth = srcImage->Width - 2 * border;
+ srcHeight = srcImage->Height - 2 * border;
+ srcDepth = srcImage->Depth - 2 * border;
+
+ /* new dst size w/ border */
+ dstWidth = MAX2(1, srcWidth / 2) + 2 * border;
+ dstHeight = MAX2(1, srcHeight / 2) + 2 * border;
+ dstDepth = MAX2(1, srcDepth / 2) + 2 * border;
+
+ if (dstWidth == srcImage->Width &&
+ dstHeight == srcImage->Height &&
+ dstDepth == srcImage->Depth) {
+ /* all done */
+ break;
+ }
+
+ /* Create empty dest image */
+ if (target == GL_TEXTURE_1D) {
+ _mesa_TexImage1D(target, dstLevel, srcImage->InternalFormat,
+ dstWidth, border,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ }
+ else if (target == GL_TEXTURE_3D) {
+ _mesa_TexImage3D(target, dstLevel, srcImage->InternalFormat,
+ dstWidth, dstHeight, dstDepth, border,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ }
+ else {
+ /* 2D or cube */
+ _mesa_TexImage2D(faceTarget, dstLevel, srcImage->InternalFormat,
+ dstWidth, dstHeight, border,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+ if (target == GL_TEXTURE_CUBE_MAP) {
+ /* If texturing from a cube, we need to make sure all src faces
+ * have been defined (even if we're not sampling from them.)
+ * Otherwise the texture object will be 'incomplete' and
+ * texturing from it will not be allowed.
+ */
+ GLuint face;
+ for (face = 0; face < 6; face++) {
+ if (!texObj->Image[face][srcLevel] ||
+ texObj->Image[face][srcLevel]->Width != srcWidth) {
+ _mesa_TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face,
+ srcLevel, srcImage->InternalFormat,
+ srcWidth, srcHeight, border,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ }
+ }
+ }
+ }
+
+ /* setup vertex positions */
+ {
+ verts[0].x = 0.0F;
+ verts[0].y = 0.0F;
+ verts[1].x = (GLfloat) dstWidth;
+ verts[1].y = 0.0F;
+ verts[2].x = (GLfloat) dstWidth;
+ verts[2].y = (GLfloat) dstHeight;
+ verts[3].x = 0.0F;
+ verts[3].y = (GLfloat) dstHeight;
+
+ /* upload new vertex data */
+ _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+ }
+
+ /* limit sampling to src level */
+ _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
+
+ /* Set to draw into the current dstLevel */
+ if (target == GL_TEXTURE_1D) {
+ _mesa_FramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ target,
+ texObj->Name,
+ dstLevel);
+ }
+ else if (target == GL_TEXTURE_3D) {
+ GLint zoffset = 0; /* XXX unfinished */
+ _mesa_FramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ target,
+ texObj->Name,
+ dstLevel, zoffset);
+ }
+ else {
+ /* 2D / cube */
+ _mesa_FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ faceTarget,
+ texObj->Name,
+ dstLevel);
+ }
+
+ _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+
+ /* sanity check */
+ status = _mesa_CheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+ if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ abort();
+ break;
+ }
+
+ _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ }
+
+ _mesa_lock_texture(ctx, texObj); /* relock */
+
+ _mesa_meta_end(ctx);
+
+ _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
+ _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, wrapTSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, wrapRSave);
+
+ _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave);
+}
+
+
+/**
+ * Determine the GL data type to use for the temporary image read with
+ * ReadPixels() and passed to Tex[Sub]Image().
+ */
+static GLenum
+get_temp_image_type(GLcontext *ctx, GLenum baseFormat)
+{
+ switch (baseFormat) {
+ case GL_RGBA:
+ case GL_RGB:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_INTENSITY:
+ if (ctx->DrawBuffer->Visual.redBits <= 8)
+ return GL_UNSIGNED_BYTE;
+ else if (ctx->DrawBuffer->Visual.redBits <= 8)
+ return GL_UNSIGNED_SHORT;
+ else
+ return GL_FLOAT;
+ case GL_DEPTH_COMPONENT:
+ return GL_UNSIGNED_INT;
+ case GL_DEPTH_STENCIL:
+ return GL_UNSIGNED_INT_24_8;
+ default:
+ _mesa_problem(ctx, "Unexpected format in get_temp_image_type()");
+ return 0;
+ }
+}
+
+
+/**
+ * Helper for _mesa_meta_CopyTexImage1/2D() functions.
+ * Have to be careful with locking and meta state for pixel transfer.
+ */
+static void
+copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
+ GLenum internalFormat, GLint x, GLint y,
+ GLsizei width, GLsizei height, GLint border)
+{
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLsizei postConvWidth = width, postConvHeight = height;
+ GLenum format, type;
+ GLint bpp;
+ void *buf;
+
+ texObj = _mesa_get_current_tex_object(ctx, target);
+ texImage = _mesa_get_tex_image(ctx, texObj, target, level);
+
+ format = _mesa_base_tex_format(ctx, internalFormat);
+ type = get_temp_image_type(ctx, format);
+ bpp = _mesa_bytes_per_pixel(format, type);
+ if (bpp <= 0) {
+ _mesa_problem(ctx, "Bad bpp in meta copy_tex_image()");
+ return;
+ }
+
+ /*
+ * Alloc image buffer (XXX could use a PBO)
+ */
+ buf = _mesa_malloc(width * height * bpp);
+ if (!buf) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
+ return;
+ }
+
+ if (texImage->TexFormat == MESA_FORMAT_NONE)
+ texImage->TexFormat = ctx->Driver.ChooseTextureFormat(ctx,
+ internalFormat,
+ format,
+ type);
+
+ _mesa_unlock_texture(ctx, texObj); /* need to unlock first */
+
+ /*
+ * Read image from framebuffer (disable pixel transfer ops)
+ */
+ _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER);
+ ctx->Driver.ReadPixels(ctx, x, y, width, height,
+ format, type, &ctx->Pack, buf);
+ _mesa_meta_end(ctx);
+
+ /*
+ * Prepare for new texture image size/data
+ */
+#if FEATURE_convolve
+ if (_mesa_is_color_format(internalFormat)) {
+ _mesa_adjust_image_for_convolution(ctx, 2,
+ &postConvWidth, &postConvHeight);
+ }
+#endif
+
+ if (texImage->Data) {
+ ctx->Driver.FreeTexImageData(ctx, texImage);
+ }
+
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, postConvHeight, 1,
+ border, internalFormat);
+
+ /*
+ * Store texture data (with pixel transfer ops)
+ */
+ _mesa_meta_begin(ctx, META_PIXEL_STORE);
+
+ _mesa_update_state(ctx); /* to update pixel transfer state */
+
+ if (target == GL_TEXTURE_1D) {
+ ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
+ width, border, format, type,
+ buf, &ctx->Unpack, texObj, texImage);
+ }
+ else {
+ ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
+ width, height, border, format, type,
+ buf, &ctx->Unpack, texObj, texImage);
+ }
+ _mesa_meta_end(ctx);
+
+ _mesa_lock_texture(ctx, texObj); /* re-lock */
+
+ _mesa_free(buf);
+}
+
+
+void
+_mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat, GLint x, GLint y,
+ GLsizei width, GLint border)
+{
+ copy_tex_image(ctx, 1, target, level, internalFormat, x, y,
+ width, 1, border);
+}
+
+
+void
+_mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat, GLint x, GLint y,
+ GLsizei width, GLsizei height, GLint border)
+{
+ copy_tex_image(ctx, 2, target, level, internalFormat, x, y,
+ width, height, border);
+}
+
+
+
+/**
+ * Helper for _mesa_meta_CopyTexSubImage1/2/3D() functions.
+ * Have to be careful with locking and meta state for pixel transfer.
+ */
+static void
+copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height)
+{
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ GLenum format, type;
+ GLint bpp;
+ void *buf;
+
+ texObj = _mesa_get_current_tex_object(ctx, target);
+ texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+
+ format = _mesa_get_format_base_format(texImage->TexFormat);
+ type = get_temp_image_type(ctx, format);
+ bpp = _mesa_bytes_per_pixel(format, type);
+ if (bpp <= 0) {
+ _mesa_problem(ctx, "Bad bpp in meta copy_tex_sub_image()");
+ return;
+ }
+
+ /*
+ * Alloc image buffer (XXX could use a PBO)
+ */
+ buf = _mesa_malloc(width * height * bpp);
+ if (!buf) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage%uD", dims);
+ return;
+ }
+
+ _mesa_unlock_texture(ctx, texObj); /* need to unlock first */
+
+ /*
+ * Read image from framebuffer (disable pixel transfer ops)
+ */
+ _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER);
+ ctx->Driver.ReadPixels(ctx, x, y, width, height,
+ format, type, &ctx->Pack, buf);
+ _mesa_meta_end(ctx);
+
+ _mesa_update_state(ctx); /* to update pixel transfer state */
+
+ /*
+ * Store texture data (with pixel transfer ops)
+ */
+ _mesa_meta_begin(ctx, META_PIXEL_STORE);
+ if (target == GL_TEXTURE_1D) {
+ ctx->Driver.TexSubImage1D(ctx, target, level, xoffset,
+ width, format, type, buf,
+ &ctx->Unpack, texObj, texImage);
+ }
+ else if (target == GL_TEXTURE_3D) {
+ ctx->Driver.TexSubImage3D(ctx, target, level, xoffset, yoffset, zoffset,
+ width, height, 1, format, type, buf,
+ &ctx->Unpack, texObj, texImage);
+ }
+ else {
+ ctx->Driver.TexSubImage2D(ctx, target, level, xoffset, yoffset,
+ width, height, format, type, buf,
+ &ctx->Unpack, texObj, texImage);
+ }
+ _mesa_meta_end(ctx);
+
+ _mesa_lock_texture(ctx, texObj); /* re-lock */
+
+ _mesa_free(buf);
+}
+
+
+void
+_mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset,
+ GLint x, GLint y, GLsizei width)
+{
+ copy_tex_sub_image(ctx, 1, target, level, xoffset, 0, 0,
+ x, y, width, 1);
+}
+
+
+void
+_mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height)
+{
+ copy_tex_sub_image(ctx, 2, target, level, xoffset, yoffset, 0,
+ x, y, width, height);
+}
+
+
+void
+_mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height)
+{
+ copy_tex_sub_image(ctx, 3, target, level, xoffset, yoffset, zoffset,
+ x, y, width, height);
+}
+
+
+void
+_mesa_meta_CopyColorTable(GLcontext *ctx,
+ GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width)
+{
+ GLfloat *buf;
+
+ buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+ if (!buf) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorTable");
+ return;
+ }
+
+ /*
+ * Read image from framebuffer (disable pixel transfer ops)
+ */
+ _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER);
+ ctx->Driver.ReadPixels(ctx, x, y, width, 1,
+ GL_RGBA, GL_FLOAT, &ctx->Pack, buf);
+
+ _mesa_ColorTable(target, internalformat, width, GL_RGBA, GL_FLOAT, buf);
+
+ _mesa_meta_end(ctx);
+
+ _mesa_free(buf);
+}
+
+
+void
+_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width)
+{
+ GLfloat *buf;
+
+ buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+ if (!buf) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorSubTable");
+ return;
+ }
+
+ /*
+ * Read image from framebuffer (disable pixel transfer ops)
+ */
+ _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER);
+ ctx->Driver.ReadPixels(ctx, x, y, width, 1,
+ GL_RGBA, GL_FLOAT, &ctx->Pack, buf);
+
+ _mesa_ColorSubTable(target, start, width, GL_RGBA, GL_FLOAT, buf);
+
+ _mesa_meta_end(ctx);
+
+ _mesa_free(buf);
+}
+
+
+void
+_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width)
+{
+ GLfloat *buf;
+
+ buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+ if (!buf) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
+ return;
+ }
+
+ /*
+ * Read image from framebuffer (disable pixel transfer ops)
+ */
+ _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER);
+ _mesa_update_state(ctx);
+ ctx->Driver.ReadPixels(ctx, x, y, width, 1,
+ GL_RGBA, GL_FLOAT, &ctx->Pack, buf);
+
+ _mesa_ConvolutionFilter1D(target, internalFormat, width,
+ GL_RGBA, GL_FLOAT, buf);
+
+ _mesa_meta_end(ctx);
+
+ _mesa_free(buf);
+}
+
+
+void
+_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
+ GLenum internalFormat, GLint x, GLint y,
+ GLsizei width, GLsizei height)
+{
+ GLfloat *buf;
+
+ buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ if (!buf) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
+ return;
+ }
+
+ /*
+ * Read image from framebuffer (disable pixel transfer ops)
+ */
+ _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER);
+ _mesa_update_state(ctx);
+
+ ctx->Driver.ReadPixels(ctx, x, y, width, height,
+ GL_RGBA, GL_FLOAT, &ctx->Pack, buf);
+
+ _mesa_ConvolutionFilter2D(target, internalFormat, width, height,
+ GL_RGBA, GL_FLOAT, buf);
+
+ _mesa_meta_end(ctx);
+
+ _mesa_free(buf);
+}
diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h
index b03b64c48..6225b9418 100644
--- a/mesalib/src/mesa/drivers/common/meta.h
+++ b/mesalib/src/mesa/drivers/common/meta.h
@@ -27,29 +27,6 @@
#define META_H
-/**
- * Flags passed to _mesa_meta_begin().
- * XXX these flags may evolve...
- */
-/*@{*/
-#define META_ALPHA_TEST 0x1
-#define META_BLEND 0x2 /**< includes logicop */
-#define META_COLOR_MASK 0x4
-#define META_DEPTH_TEST 0x8
-#define META_FOG 0x10
-#define META_RASTERIZATION 0x20
-#define META_SCISSOR 0x40
-#define META_SHADER 0x80
-#define META_STENCIL_TEST 0x100
-#define META_TRANSFORM 0x200 /**< modelview, projection */
-#define META_TEXTURE 0x400
-#define META_VERTEX 0x800
-#define META_VIEWPORT 0x1000
-#define META_PIXEL_STORE 0x2000
-#define META_ALL ~0x0
-/*@}*/
-
-
extern void
_mesa_meta_init(GLcontext *ctx);
@@ -57,25 +34,85 @@ extern void
_mesa_meta_free(GLcontext *ctx);
extern void
-_mesa_meta_blit_framebuffer(GLcontext *ctx,
- GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, GLenum filter);
+_mesa_meta_BlitFramebuffer(GLcontext *ctx,
+ GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter);
+
+extern void
+_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers);
+
+extern void
+_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
+ GLsizei width, GLsizei height,
+ GLint dstx, GLint dsty, GLenum type);
+
+extern void
+_mesa_meta_DrawPixels(GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLvoid *pixels);
+
+extern void
+_mesa_meta_Bitmap(GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLubyte *bitmap);
+
+extern GLboolean
+_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *texObj);
+
+extern void
+_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *texObj);
+
+extern void
+_mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat, GLint x, GLint y,
+ GLsizei width, GLint border);
+
+extern void
+_mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat, GLint x, GLint y,
+ GLsizei width, GLsizei height, GLint border);
+
+extern void
+_mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset,
+ GLint x, GLint y, GLsizei width);
+
+extern void
+_mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height);
+
+extern void
+_mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height);
+
+extern void
+_mesa_meta_CopyColorTable(GLcontext *ctx,
+ GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width);
extern void
-_mesa_meta_clear(GLcontext *ctx, GLbitfield buffers);
+_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width);
extern void
-_mesa_meta_copy_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
- GLsizei width, GLsizei height,
- GLint dstx, GLint dsty, GLenum type);
+_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width);
extern void
-_mesa_meta_draw_pixels(GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels);
+_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
+ GLenum internalFormat, GLint x, GLint y,
+ GLsizei width, GLsizei height);
#endif /* META_H */
diff --git a/mesalib/src/mesa/drivers/dri/Makefile.template b/mesalib/src/mesa/drivers/dri/Makefile.template
index 18dbeba24..39d25ce3f 100644
--- a/mesalib/src/mesa/drivers/dri/Makefile.template
+++ b/mesalib/src/mesa/drivers/dri/Makefile.template
@@ -60,18 +60,40 @@ SHARED_INCLUDES = \
##### TARGETS #####
-default: symlinks depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
+default: subdirs lib
-$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
+.PHONY: lib
+lib: symlinks subdirs depend
+ @$(MAKE) $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
+
+$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) Makefile \
+ $(TOP)/src/mesa/drivers/dri/Makefile.template
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
+ $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) \
+ $(DRI_LIB_DEPS)
$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
$(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)
+# If the Makefile defined SUBDIRS, run make in each
+.PHONY: subdirs
+subdirs:
+ @if test -n "$(SUBDIRS)" ; then \
+ for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE)) || exit 1; \
+ fi \
+ done \
+ fi
+
+
+.PHONY: symlinks
+symlinks:
+
+
depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
@ echo "running $(MKDEP)"
@ rm -f depend
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index e48e10d7c..547f18a00 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -167,11 +167,12 @@ static int driBindContext(__DRIcontext *pcp,
__DRIdrawable *pdp,
__DRIdrawable *prp)
{
- __DRIscreenPrivate *psp = pcp->driScreenPriv;
+ __DRIscreenPrivate *psp = NULL;
/* Bind the drawable to the context */
if (pcp) {
+ psp = pcp->driScreenPriv;
pcp->driDrawablePriv = pdp;
pcp->driReadablePriv = prp;
if (pdp) {
@@ -498,11 +499,11 @@ static void dri_put_drawable(__DRIdrawable *pdp)
{
__DRIscreenPrivate *psp;
- pdp->refcount--;
- if (pdp->refcount)
- return;
-
if (pdp) {
+ pdp->refcount--;
+ if (pdp->refcount)
+ return;
+
psp = pdp->driScreenPriv;
(*psp->DriverAPI.DestroyBuffer)(pdp);
if (pdp->pClipRects) {
diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
index 15af99136..4e7e92c82 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -1,5 +1,6 @@
#include "main/mtypes.h"
+#include "main/formats.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "main/imports.h"
@@ -53,7 +54,7 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
* \param pitch pixels per row
*/
driRenderbuffer *
-driNewRenderbuffer(GLenum format, GLvoid *addr,
+driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
__DRIdrawablePrivate *dPriv)
{
@@ -79,56 +80,47 @@ driNewRenderbuffer(GLenum format, GLvoid *addr,
/* Make sure we're using a null-valued GetPointer routine */
assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL);
- drb->Base.InternalFormat = format;
-
- if (format == GL_RGBA || format == GL_RGB5 || format == GL_RGBA8) {
- /* Color */
- drb->Base._BaseFormat = GL_RGBA;
- drb->Base.DataType = GL_UNSIGNED_BYTE;
- if (format == GL_RGB5) {
- drb->Base.RedBits = 5;
- drb->Base.GreenBits = 6;
- drb->Base.BlueBits = 5;
+ switch (format) {
+ case MESA_FORMAT_ARGB8888:
+ if (cpp == 2) {
+ /* override format */
+ format = MESA_FORMAT_RGB565;
}
- else {
- drb->Base.RedBits =
- drb->Base.GreenBits =
- drb->Base.BlueBits =
- drb->Base.AlphaBits = 8;
- }
- }
- else if (format == GL_DEPTH_COMPONENT16) {
- /* Depth */
- drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- /* we always Get/Put 32-bit Z values */
- drb->Base.DataType = GL_UNSIGNED_INT;
- drb->Base.DepthBits = 16;
- }
- else if (format == GL_DEPTH_COMPONENT24) {
+ drb->Base.DataType = GL_UNSIGNED_BYTE;
+ break;
+ case MESA_FORMAT_Z16:
/* Depth */
- drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
- drb->Base.DepthBits = 24;
- }
- else if (format == GL_DEPTH_COMPONENT32) {
+ assert(cpp == 2);
+ break;
+ case MESA_FORMAT_Z32:
/* Depth */
- drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
- drb->Base.DepthBits = 32;
- }
- else {
+ assert(cpp == 4);
+ break;
+ case MESA_FORMAT_Z24_S8:
+ drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
+ assert(cpp == 4);
+ break;
+ case MESA_FORMAT_S8_Z24:
+ drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
+ assert(cpp == 4);
+ break;
+ case MESA_FORMAT_S8:
/* Stencil */
- ASSERT(format == GL_STENCIL_INDEX8_EXT);
- drb->Base._BaseFormat = GL_STENCIL_INDEX;
drb->Base.DataType = GL_UNSIGNED_BYTE;
- drb->Base.StencilBits = 8;
+ break;
+ default:
+ _mesa_problem(NULL, "Bad format 0x%x in driNewRenderbuffer", format);
+ return NULL;
}
- /* XXX if we were allocating a user-created renderbuffer, we'd have
- * to fill in the Red/Green/Blue/.../Bits values too.
- */
+ drb->Base.Format = format;
+
+ drb->Base.InternalFormat =
+ drb->Base._BaseFormat = _mesa_get_format_base_format(format);
drb->Base.AllocStorage = driRenderbufferStorage;
drb->Base.Delete = driDeleteRenderbuffer;
diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h
index cf55286b3..3a5cbcdaa 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h
+++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h
@@ -11,6 +11,7 @@
#define DRIRENDERBUFFER_H
#include "main/mtypes.h"
+#include "main/formats.h"
#include "dri_util.h"
@@ -56,14 +57,14 @@ typedef struct {
* A handy flag to know if this is the back color buffer.
*
* \note
- * This is currently only used by s3v and tdfx.
+ * This is currently only used by tdfx.
*/
GLboolean backBuffer;
} driRenderbuffer;
extern driRenderbuffer *
-driNewRenderbuffer(GLenum format, GLvoid *addr,
+driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
__DRIdrawablePrivate *dPriv);
diff --git a/mesalib/src/mesa/drivers/dri/common/extension_helper.h b/mesalib/src/mesa/drivers/dri/common/extension_helper.h
deleted file mode 100644
index 40a030ce0..000000000
--- a/mesalib/src/mesa/drivers/dri/common/extension_helper.h
+++ /dev/null
@@ -1,6609 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by extension_helper.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2005
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "utils.h"
-#include "glapi/dispatch.h"
-
-#ifndef NULL
-# define NULL 0
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char UniformMatrix3fvARB_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix3fv\0"
- "glUniformMatrix3fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_multisample)
-static const char SampleCoverageARB_names[] =
- "fi\0" /* Parameter signature */
- "glSampleCoverage\0"
- "glSampleCoverageARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionFilter1D_names[] =
- "iiiiip\0" /* Parameter signature */
- "glConvolutionFilter1D\0"
- "glConvolutionFilter1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char BeginQueryARB_names[] =
- "ii\0" /* Parameter signature */
- "glBeginQuery\0"
- "glBeginQueryARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite)
-static const char PointParameteriNV_names[] =
- "ii\0" /* Parameter signature */
- "glPointParameteri\0"
- "glPointParameteriNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char GetProgramiv_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramiv\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3sARB_names[] =
- "iiii\0" /* Parameter signature */
- "glMultiTexCoord3s\0"
- "glMultiTexCoord3sARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3iEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3i\0"
- "glSecondaryColor3iEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3fMESA_names[] =
- "fff\0" /* Parameter signature */
- "glWindowPos3f\0"
- "glWindowPos3fARB\0"
- "glWindowPos3fMESA\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char PixelTexGenParameterfvSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glPixelTexGenParameterfvSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char ActiveTextureARB_names[] =
- "i\0" /* Parameter signature */
- "glActiveTexture\0"
- "glActiveTextureARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_blit)
-static const char BlitFramebufferEXT_names[] =
- "iiiiiiiiii\0" /* Parameter signature */
- "glBlitFramebuffer\0"
- "glBlitFramebufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4ubvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4ubvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char GetProgramNamedParameterdvNV_names[] =
- "iipp\0" /* Parameter signature */
- "glGetProgramNamedParameterdvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char Histogram_names[] =
- "iiii\0" /* Parameter signature */
- "glHistogram\0"
- "glHistogramEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture4D)
-static const char TexImage4DSGIS_names[] =
- "iiiiiiiiiip\0" /* Parameter signature */
- "glTexImage4DSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2dvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos2dv\0"
- "glWindowPos2dvARB\0"
- "glWindowPos2dvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glReplacementCodeuiColor3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_EXT_blend_equation_separate) || defined(need_GL_ATI_blend_equation_separate)
-static const char BlendEquationSeparateEXT_names[] =
- "ii\0" /* Parameter signature */
- "glBlendEquationSeparate\0"
- "glBlendEquationSeparateEXT\0"
- "glBlendEquationSeparateATI\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char ListParameterfSGIX_names[] =
- "iif\0" /* Parameter signature */
- "glListParameterfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3bEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3b\0"
- "glSecondaryColor3bEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord4fColor4fNormal3fVertex4fvSUN_names[] =
- "pppp\0" /* Parameter signature */
- "glTexCoord4fColor4fNormal3fVertex4fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4svNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4svNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char GetBufferSubDataARB_names[] =
- "iiip\0" /* Parameter signature */
- "glGetBufferSubData\0"
- "glGetBufferSubDataARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char BufferSubDataARB_names[] =
- "iiip\0" /* Parameter signature */
- "glBufferSubData\0"
- "glBufferSubDataARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor4ubVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glTexCoord2fColor4ubVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char AttachShader_names[] =
- "ii\0" /* Parameter signature */
- "glAttachShader\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2fARB_names[] =
- "iff\0" /* Parameter signature */
- "glVertexAttrib2f\0"
- "glVertexAttrib2fARB\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_shader_debug)
-static const char GetDebugLogLengthMESA_names[] =
- "iii\0" /* Parameter signature */
- "glGetDebugLogLengthMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3fARB_names[] =
- "ifff\0" /* Parameter signature */
- "glVertexAttrib3f\0"
- "glVertexAttrib3fARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char GetQueryivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetQueryiv\0"
- "glGetQueryivARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture3D)
-static const char TexImage3D_names[] =
- "iiiiiiiiip\0" /* Parameter signature */
- "glTexImage3D\0"
- "glTexImage3DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glReplacementCodeuiVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char GetQueryObjectivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetQueryObjectiv\0"
- "glGetQueryObjectivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexSubImage2DARB_names[] =
- "iiiiiiiip\0" /* Parameter signature */
- "glCompressedTexSubImage2D\0"
- "glCompressedTexSubImage2DARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerOutputNV_names[] =
- "iiiiiiiiii\0" /* Parameter signature */
- "glCombinerOutputNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform2fARB_names[] =
- "iff\0" /* Parameter signature */
- "glUniform2f\0"
- "glUniform2fARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1svARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1sv\0"
- "glVertexAttrib1svARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs1dvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs1dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform2ivARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform2iv\0"
- "glUniform2ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char GetImageTransformParameterfvHP_names[] =
- "iip\0" /* Parameter signature */
- "glGetImageTransformParameterfvHP\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightubvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightubvARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1fvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char CopyConvolutionFilter1D_names[] =
- "iiiii\0" /* Parameter signature */
- "glCopyConvolutionFilter1D\0"
- "glCopyConvolutionFilter1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiNormal3fVertex3fSUN_names[] =
- "iffffff\0" /* Parameter signature */
- "glReplacementCodeuiNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_sync)
-static const char DeleteSync_names[] =
- "i\0" /* Parameter signature */
- "glDeleteSync\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentMaterialfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glFragmentMaterialfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_blend_color)
-static const char BlendColor_names[] =
- "ffff\0" /* Parameter signature */
- "glBlendColor\0"
- "glBlendColorEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char UniformMatrix4fvARB_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix4fv\0"
- "glUniformMatrix4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object)
-static const char DeleteVertexArraysAPPLE_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteVertexArrays\0"
- "glDeleteVertexArraysAPPLE\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char ReadInstrumentsSGIX_names[] =
- "i\0" /* Parameter signature */
- "glReadInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_1)
-static const char UniformMatrix2x4fv_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix2x4fv\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4ubVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glColor4ubVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_texture_array)
-static const char FramebufferTextureLayerEXT_names[] =
- "iiiii\0" /* Parameter signature */
- "glFramebufferTextureLayer\0"
- "glFramebufferTextureLayerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char GetListParameterfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetListParameterfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NusvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4Nusv\0"
- "glVertexAttrib4NusvARB\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4svMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos4svMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char CreateProgramObjectARB_names[] =
- "\0" /* Parameter signature */
- "glCreateProgramObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightModelivSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glFragmentLightModelivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_1)
-static const char UniformMatrix4x3fv_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix4x3fv\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char PrioritizeTextures_names[] =
- "ipp\0" /* Parameter signature */
- "glPrioritizeTextures\0"
- "glPrioritizeTexturesEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char AsyncMarkerSGIX_names[] =
- "i\0" /* Parameter signature */
- "glAsyncMarkerSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorubSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactorubSUN\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_shader_debug)
-static const char ClearDebugLogMESA_names[] =
- "iii\0" /* Parameter signature */
- "glClearDebugLogMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char ResetHistogram_names[] =
- "i\0" /* Parameter signature */
- "glResetHistogram\0"
- "glResetHistogramEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char GetProgramNamedParameterfvNV_names[] =
- "iipp\0" /* Parameter signature */
- "glGetProgramNamedParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters)
-static const char PointParameterfEXT_names[] =
- "if\0" /* Parameter signature */
- "glPointParameterf\0"
- "glPointParameterfARB\0"
- "glPointParameterfEXT\0"
- "glPointParameterfSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const char LoadIdentityDeformationMapSGIX_names[] =
- "i\0" /* Parameter signature */
- "glLoadIdentityDeformationMapSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char GenFencesNV_names[] =
- "ip\0" /* Parameter signature */
- "glGenFencesNV\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char ImageTransformParameterfHP_names[] =
- "iif\0" /* Parameter signature */
- "glImageTransformParameterfHP\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char MatrixIndexusvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMatrixIndexusvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char DisableVertexAttribArrayARB_names[] =
- "i\0" /* Parameter signature */
- "glDisableVertexAttribArray\0"
- "glDisableVertexAttribArrayARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char StencilMaskSeparate_names[] =
- "ii\0" /* Parameter signature */
- "glStencilMaskSeparate\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramLocalParameter4dARB_names[] =
- "iidddd\0" /* Parameter signature */
- "glProgramLocalParameter4dARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexImage3DARB_names[] =
- "iiiiiiiip\0" /* Parameter signature */
- "glCompressedTexImage3D\0"
- "glCompressedTexImage3DARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char GetConvolutionParameteriv_names[] =
- "iip\0" /* Parameter signature */
- "glGetConvolutionParameteriv\0"
- "glGetConvolutionParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1fARB_names[] =
- "if\0" /* Parameter signature */
- "glVertexAttrib1f\0"
- "glVertexAttrib1fARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char TestFenceNV_names[] =
- "i\0" /* Parameter signature */
- "glTestFenceNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord1fv\0"
- "glMultiTexCoord1fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char ColorFragmentOp2ATI_names[] =
- "iiiiiiiiii\0" /* Parameter signature */
- "glColorFragmentOp2ATI\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char SecondaryColorPointerListIBM_names[] =
- "iiipi\0" /* Parameter signature */
- "glSecondaryColorPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char GetPixelTexGenParameterivSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glGetPixelTexGenParameterivSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4fNV_names[] =
- "iffff\0" /* Parameter signature */
- "glVertexAttrib4fNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeubSUN_names[] =
- "i\0" /* Parameter signature */
- "glReplacementCodeubSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char FinishAsyncSGIX_names[] =
- "p\0" /* Parameter signature */
- "glFinishAsyncSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_shader_debug)
-static const char GetDebugLogMESA_names[] =
- "iiiipp\0" /* Parameter signature */
- "glGetDebugLogMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoorddEXT_names[] =
- "d\0" /* Parameter signature */
- "glFogCoordd\0"
- "glFogCoorddEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4ubVertex3fSUN_names[] =
- "iiiifff\0" /* Parameter signature */
- "glColor4ubVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoordfEXT_names[] =
- "f\0" /* Parameter signature */
- "glFogCoordf\0"
- "glFogCoordfEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fVertex3fSUN_names[] =
- "fffff\0" /* Parameter signature */
- "glTexCoord2fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactoriSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactoriSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2dNV_names[] =
- "idd\0" /* Parameter signature */
- "glVertexAttrib2dNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char GetProgramInfoLog_names[] =
- "iipp\0" /* Parameter signature */
- "glGetProgramInfoLog\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NbvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4Nbv\0"
- "glVertexAttrib4NbvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader)
-static const char GetActiveAttribARB_names[] =
- "iiipppp\0" /* Parameter signature */
- "glGetActiveAttrib\0"
- "glGetActiveAttribARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4ubNV_names[] =
- "iiiii\0" /* Parameter signature */
- "glVertexAttrib4ubNV\0"
- "";
-#endif
-
-#if defined(need_GL_APPLE_texture_range)
-static const char TextureRangeAPPLE_names[] =
- "iip\0" /* Parameter signature */
- "glTextureRangeAPPLE\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor4fNormal3fVertex3fSUN_names[] =
- "ffffffffffff\0" /* Parameter signature */
- "glTexCoord2fColor4fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerParameterfvNV_names[] =
- "ip\0" /* Parameter signature */
- "glCombinerParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs3dvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs3dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs4fvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_array_range)
-static const char VertexArrayRangeNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexArrayRangeNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightiSGIX_names[] =
- "iii\0" /* Parameter signature */
- "glFragmentLightiSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_polygon_offset)
-static const char PolygonOffsetEXT_names[] =
- "ff\0" /* Parameter signature */
- "glPolygonOffsetEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char PollAsyncSGIX_names[] =
- "p\0" /* Parameter signature */
- "glPollAsyncSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char DeleteFragmentShaderATI_names[] =
- "i\0" /* Parameter signature */
- "glDeleteFragmentShaderATI\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fNormal3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glTexCoord2fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix)
-static const char MultTransposeMatrixdARB_names[] =
- "p\0" /* Parameter signature */
- "glMultTransposeMatrixd\0"
- "glMultTransposeMatrixdARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2svMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos2sv\0"
- "glWindowPos2svARB\0"
- "glWindowPos2svMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexImage1DARB_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glCompressedTexImage1D\0"
- "glCompressedTexImage1DARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2sNV_names[] =
- "iii\0" /* Parameter signature */
- "glVertexAttrib2sNV\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char NormalPointerListIBM_names[] =
- "iipi\0" /* Parameter signature */
- "glNormalPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char IndexPointerEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glIndexPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char NormalPointerEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glNormalPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3dARB_names[] =
- "iddd\0" /* Parameter signature */
- "glMultiTexCoord3d\0"
- "glMultiTexCoord3dARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2iARB_names[] =
- "iii\0" /* Parameter signature */
- "glMultiTexCoord2i\0"
- "glMultiTexCoord2iARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names[] =
- "iffffffff\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2svARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord2sv\0"
- "glMultiTexCoord2svARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeubvSUN_names[] =
- "p\0" /* Parameter signature */
- "glReplacementCodeubvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform3iARB_names[] =
- "iiii\0" /* Parameter signature */
- "glUniform3i\0"
- "glUniform3iARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char GetFragmentMaterialfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetFragmentMaterialfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char GetShaderInfoLog_names[] =
- "iipp\0" /* Parameter signature */
- "glGetShaderInfoLog\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightivARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char PollInstrumentsSGIX_names[] =
- "p\0" /* Parameter signature */
- "glPollInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactordSUN_names[] =
- "d\0" /* Parameter signature */
- "glGlobalAlphaFactordSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs3fvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs3fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char GenerateMipmapEXT_names[] =
- "i\0" /* Parameter signature */
- "glGenerateMipmap\0"
- "glGenerateMipmapEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char SetFragmentShaderConstantATI_names[] =
- "ip\0" /* Parameter signature */
- "glSetFragmentShaderConstantATI\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapAttribParameterivNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetMapAttribParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char CreateShaderObjectARB_names[] =
- "i\0" /* Parameter signature */
- "glCreateShaderObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_sharpen_texture)
-static const char GetSharpenTexFuncSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glGetSharpenTexFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char BufferDataARB_names[] =
- "iipi\0" /* Parameter signature */
- "glBufferData\0"
- "glBufferDataARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_array_range)
-static const char FlushVertexArrayRangeNV_names[] =
- "\0" /* Parameter signature */
- "glFlushVertexArrayRangeNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char SampleMapATI_names[] =
- "iii\0" /* Parameter signature */
- "glSampleMapATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char VertexPointerEXT_names[] =
- "iiiip\0" /* Parameter signature */
- "glVertexPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture_filter4)
-static const char GetTexFilterFuncSGIS_names[] =
- "iip\0" /* Parameter signature */
- "glGetTexFilterFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetCombinerOutputParameterfvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetCombinerOutputParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_subtexture)
-static const char TexSubImage1D_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glTexSubImage1D\0"
- "glTexSubImage1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1sARB_names[] =
- "ii\0" /* Parameter signature */
- "glVertexAttrib1s\0"
- "glVertexAttrib1sARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_sync)
-static const char FenceSync_names[] =
- "ii\0" /* Parameter signature */
- "glFenceSync\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char FinalCombinerInputNV_names[] =
- "iiii\0" /* Parameter signature */
- "glFinalCombinerInputNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_flush_raster)
-static const char FlushRasterSGIX_names[] =
- "\0" /* Parameter signature */
- "glFlushRasterSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fVertex3fSUN_names[] =
- "ifffff\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform1fARB_names[] =
- "if\0" /* Parameter signature */
- "glUniform1f\0"
- "glUniform1fARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char AreTexturesResident_names[] =
- "ipp\0" /* Parameter signature */
- "glAreTexturesResident\0"
- "glAreTexturesResidentEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil)
-static const char StencilOpSeparate_names[] =
- "iiii\0" /* Parameter signature */
- "glStencilOpSeparate\0"
- "glStencilOpSeparateATI\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const char ColorTableParameteriv_names[] =
- "iip\0" /* Parameter signature */
- "glColorTableParameteriv\0"
- "glColorTableParameterivSGI\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char FogCoordPointerListIBM_names[] =
- "iipi\0" /* Parameter signature */
- "glFogCoordPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3dMESA_names[] =
- "ddd\0" /* Parameter signature */
- "glWindowPos3d\0"
- "glWindowPos3dARB\0"
- "glWindowPos3dMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters)
-static const char PointParameterfvEXT_names[] =
- "ip\0" /* Parameter signature */
- "glPointParameterfv\0"
- "glPointParameterfvARB\0"
- "glPointParameterfvEXT\0"
- "glPointParameterfvSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2fvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos2fv\0"
- "glWindowPos2fvARB\0"
- "glWindowPos2fvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3bvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3bv\0"
- "glSecondaryColor3bvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char VertexPointerListIBM_names[] =
- "iiipi\0" /* Parameter signature */
- "glVertexPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramLocalParameterfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramLocalParameterfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentMaterialfSGIX_names[] =
- "iif\0" /* Parameter signature */
- "glFragmentMaterialfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fNormal3fVertex3fSUN_names[] =
- "ffffffff\0" /* Parameter signature */
- "glTexCoord2fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char RenderbufferStorageEXT_names[] =
- "iiii\0" /* Parameter signature */
- "glRenderbufferStorage\0"
- "glRenderbufferStorageEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char IsFenceNV_names[] =
- "i\0" /* Parameter signature */
- "glIsFenceNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char AttachObjectARB_names[] =
- "ii\0" /* Parameter signature */
- "glAttachObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char GetFragmentLightivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetFragmentLightivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char UniformMatrix2fvARB_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix2fv\0"
- "glUniformMatrix2fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2fARB_names[] =
- "iff\0" /* Parameter signature */
- "glMultiTexCoord2f\0"
- "glMultiTexCoord2fARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture)
-static const char ColorTable_names[] =
- "iiiiip\0" /* Parameter signature */
- "glColorTable\0"
- "glColorTableSGI\0"
- "glColorTableEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char MapControlPointsNV_names[] =
- "iiiiiiiip\0" /* Parameter signature */
- "glMapControlPointsNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionFilter2D_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glConvolutionFilter2D\0"
- "glConvolutionFilter2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char MapParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glMapParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3dv\0"
- "glVertexAttrib3dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_PGI_misc_hints)
-static const char HintPGI_names[] =
- "ii\0" /* Parameter signature */
- "glHintPGI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionParameteriv_names[] =
- "iip\0" /* Parameter signature */
- "glConvolutionParameteriv\0"
- "glConvolutionParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_cull_vertex)
-static const char CullParameterdvEXT_names[] =
- "ip\0" /* Parameter signature */
- "glCullParameterdvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char ProgramNamedParameter4fNV_names[] =
- "iipffff\0" /* Parameter signature */
- "glProgramNamedParameter4fNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color3fVertex3fSUN_names[] =
- "ffffff\0" /* Parameter signature */
- "glColor3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char ProgramEnvParameter4fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glProgramEnvParameter4fvARB\0"
- "glProgramParameter4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightModeliSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glFragmentLightModeliSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionParameterfv_names[] =
- "iip\0" /* Parameter signature */
- "glConvolutionParameterfv\0"
- "glConvolutionParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_3DFX_tbuffer)
-static const char TbufferMask3DFX_names[] =
- "i\0" /* Parameter signature */
- "glTbufferMask3DFX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char LoadProgramNV_names[] =
- "iiip\0" /* Parameter signature */
- "glLoadProgramNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_sync)
-static const char WaitSync_names[] =
- "iii\0" /* Parameter signature */
- "glWaitSync\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4fvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetAttachedObjectsARB_names[] =
- "iipp\0" /* Parameter signature */
- "glGetAttachedObjectsARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform3fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform3fv\0"
- "glUniform3fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_draw_range_elements)
-static const char DrawRangeElements_names[] =
- "iiiiip\0" /* Parameter signature */
- "glDrawRangeElements\0"
- "glDrawRangeElementsEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const char SpriteParameterfvSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glSpriteParameterfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char CheckFramebufferStatusEXT_names[] =
- "i\0" /* Parameter signature */
- "glCheckFramebufferStatus\0"
- "glCheckFramebufferStatusEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactoruiSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactoruiSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetHandleARB_names[] =
- "i\0" /* Parameter signature */
- "glGetHandleARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char GetVertexAttribivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribiv\0"
- "glGetVertexAttribivARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetCombinerInputParameterfvNV_names[] =
- "iiiip\0" /* Parameter signature */
- "glGetCombinerInputParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char CreateProgram_names[] =
- "\0" /* Parameter signature */
- "glCreateProgram\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix)
-static const char LoadTransposeMatrixdARB_names[] =
- "p\0" /* Parameter signature */
- "glLoadTransposeMatrixd\0"
- "glLoadTransposeMatrixdARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetMinmax_names[] =
- "iiiip\0" /* Parameter signature */
- "glGetMinmax\0"
- "glGetMinmaxEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char StencilFuncSeparate_names[] =
- "iiii\0" /* Parameter signature */
- "glStencilFuncSeparate\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3sEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3s\0"
- "glSecondaryColor3sEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color3fVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glColor3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorbSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactorbSUN\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char ImageTransformParameterfvHP_names[] =
- "iip\0" /* Parameter signature */
- "glImageTransformParameterfvHP\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4iv\0"
- "glVertexAttrib4ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3fNV_names[] =
- "ifff\0" /* Parameter signature */
- "glVertexAttrib3fNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs2dvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs2dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_timer_query)
-static const char GetQueryObjectui64vEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetQueryObjectui64vEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord3fv\0"
- "glMultiTexCoord3fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3dEXT_names[] =
- "ddd\0" /* Parameter signature */
- "glSecondaryColor3d\0"
- "glSecondaryColor3dEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetProgramParameterfvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetProgramParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char TangentPointerEXT_names[] =
- "iip\0" /* Parameter signature */
- "glTangentPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4fNormal3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glColor4fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char GetInstrumentsSGIX_names[] =
- "\0" /* Parameter signature */
- "glGetInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char EvalMapsNV_names[] =
- "ii\0" /* Parameter signature */
- "glEvalMapsNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_subtexture)
-static const char TexSubImage2D_names[] =
- "iiiiiiiip\0" /* Parameter signature */
- "glTexSubImage2D\0"
- "glTexSubImage2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glFragmentLightivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_APPLE_texture_range)
-static const char GetTexParameterPointervAPPLE_names[] =
- "iip\0" /* Parameter signature */
- "glGetTexParameterPointervAPPLE\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const char PixelTransformParameterfvEXT_names[] =
- "iip\0" /* Parameter signature */
- "glPixelTransformParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4bvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4bv\0"
- "glVertexAttrib4bvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char AlphaFragmentOp2ATI_names[] =
- "iiiiiiiii\0" /* Parameter signature */
- "glAlphaFragmentOp2ATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4sARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glMultiTexCoord4s\0"
- "glMultiTexCoord4sARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char GetFragmentMaterialivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetFragmentMaterialivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4dMESA_names[] =
- "dddd\0" /* Parameter signature */
- "glWindowPos4dMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightPointerARB_names[] =
- "iiip\0" /* Parameter signature */
- "glWeightPointerARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2dMESA_names[] =
- "dd\0" /* Parameter signature */
- "glWindowPos2d\0"
- "glWindowPos2dARB\0"
- "glWindowPos2dMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char FramebufferTexture3DEXT_names[] =
- "iiiiii\0" /* Parameter signature */
- "glFramebufferTexture3D\0"
- "glFramebufferTexture3DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_blend_minmax)
-static const char BlendEquation_names[] =
- "i\0" /* Parameter signature */
- "glBlendEquation\0"
- "glBlendEquationEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3dNV_names[] =
- "iddd\0" /* Parameter signature */
- "glVertexAttrib3dNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3dARB_names[] =
- "iddd\0" /* Parameter signature */
- "glVertexAttrib3d\0"
- "glVertexAttrib3dARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names[] =
- "ppppp\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4fARB_names[] =
- "iffff\0" /* Parameter signature */
- "glVertexAttrib4f\0"
- "glVertexAttrib4fARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_index_func)
-static const char IndexFuncEXT_names[] =
- "if\0" /* Parameter signature */
- "glIndexFuncEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char FramebufferTexture2DEXT_names[] =
- "iiiii\0" /* Parameter signature */
- "glFramebufferTexture2D\0"
- "glFramebufferTexture2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord2dv\0"
- "glMultiTexCoord2dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_cull_vertex)
-static const char CullParameterfvEXT_names[] =
- "ip\0" /* Parameter signature */
- "glCullParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char ProgramNamedParameter4fvNV_names[] =
- "iipp\0" /* Parameter signature */
- "glProgramNamedParameter4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColorPointerEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glSecondaryColorPointer\0"
- "glSecondaryColorPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4fv\0"
- "glVertexAttrib4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char ColorPointerListIBM_names[] =
- "iiipi\0" /* Parameter signature */
- "glColorPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char GetActiveUniformARB_names[] =
- "iiipppp\0" /* Parameter signature */
- "glGetActiveUniform\0"
- "glGetActiveUniformARB\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char ImageTransformParameteriHP_names[] =
- "iii\0" /* Parameter signature */
- "glImageTransformParameteriHP\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1svARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord1sv\0"
- "glMultiTexCoord1svARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char EndQueryARB_names[] =
- "i\0" /* Parameter signature */
- "glEndQuery\0"
- "glEndQueryARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char DeleteFencesNV_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteFencesNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const char DeformationMap3dSGIX_names[] =
- "iddiiddiiddiip\0" /* Parameter signature */
- "glDeformationMap3dSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char IsShader_names[] =
- "i\0" /* Parameter signature */
- "glIsShader\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char GetImageTransformParameterivHP_names[] =
- "iip\0" /* Parameter signature */
- "glGetImageTransformParameterivHP\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4ivMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos4ivMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3svARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord3sv\0"
- "glMultiTexCoord3svARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4iARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glMultiTexCoord4i\0"
- "glMultiTexCoord4iARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3ivEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3ivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_resize_buffers)
-static const char ResizeBuffersMESA_names[] =
- "\0" /* Parameter signature */
- "glResizeBuffersMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char GetUniformivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetUniformiv\0"
- "glGetUniformivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char PixelTexGenParameteriSGIS_names[] =
- "ii\0" /* Parameter signature */
- "glPixelTexGenParameteriSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const char VertexPointervINTEL_names[] =
- "iip\0" /* Parameter signature */
- "glVertexPointervINTEL\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names[] =
- "pppp\0" /* Parameter signature */
- "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3uiEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3ui\0"
- "glSecondaryColor3uiEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char StartInstrumentsSGIX_names[] =
- "\0" /* Parameter signature */
- "glStartInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3usvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3usv\0"
- "glSecondaryColor3usvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2fvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramLocalParameter4dvARB_names[] =
- "iip\0" /* Parameter signature */
- "glProgramLocalParameter4dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char MatrixIndexuivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMatrixIndexuivARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object)
-static const char RenderbufferStorageMultisample_names[] =
- "iiiii\0" /* Parameter signature */
- "glRenderbufferStorageMultisample\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3sEXT_names[] =
- "iii\0" /* Parameter signature */
- "glTangent3sEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorfSUN_names[] =
- "f\0" /* Parameter signature */
- "glGlobalAlphaFactorfSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3iARB_names[] =
- "iiii\0" /* Parameter signature */
- "glMultiTexCoord3i\0"
- "glMultiTexCoord3iARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char IsProgram_names[] =
- "i\0" /* Parameter signature */
- "glIsProgram\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char TexCoordPointerListIBM_names[] =
- "iiipi\0" /* Parameter signature */
- "glTexCoordPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorusSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactorusSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2dvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char FramebufferRenderbufferEXT_names[] =
- "iiii\0" /* Parameter signature */
- "glFramebufferRenderbuffer\0"
- "glFramebufferRenderbufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1dvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char GenTextures_names[] =
- "ip\0" /* Parameter signature */
- "glGenTextures\0"
- "glGenTexturesEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char SetFenceNV_names[] =
- "ii\0" /* Parameter signature */
- "glSetFenceNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char FramebufferTexture1DEXT_names[] =
- "iiiii\0" /* Parameter signature */
- "glFramebufferTexture1D\0"
- "glFramebufferTexture1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetCombinerOutputParameterivNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetCombinerOutputParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char PixelTexGenParameterivSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glPixelTexGenParameterivSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_perturb_normal)
-static const char TextureNormalEXT_names[] =
- "i\0" /* Parameter signature */
- "glTextureNormalEXT\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char IndexPointerListIBM_names[] =
- "iipi\0" /* Parameter signature */
- "glIndexPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightfvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4fMESA_names[] =
- "ffff\0" /* Parameter signature */
- "glWindowPos4fMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3dvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos3dv\0"
- "glWindowPos3dvARB\0"
- "glWindowPos3dvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_timer_query)
-static const char GetQueryObjecti64vEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetQueryObjecti64vEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1dARB_names[] =
- "id\0" /* Parameter signature */
- "glMultiTexCoord1d\0"
- "glMultiTexCoord1dARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite)
-static const char PointParameterivNV_names[] =
- "ip\0" /* Parameter signature */
- "glPointParameteriv\0"
- "glPointParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform2fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform2fv\0"
- "glUniform2fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_APPLE_flush_buffer_range)
-static const char BufferParameteriAPPLE_names[] =
- "iii\0" /* Parameter signature */
- "glBufferParameteriAPPLE\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord3dv\0"
- "glMultiTexCoord3dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names[] =
- "pppp\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char DeleteObjectARB_names[] =
- "i\0" /* Parameter signature */
- "glDeleteObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char MatrixIndexPointerARB_names[] =
- "iiip\0" /* Parameter signature */
- "glMatrixIndexPointerARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char ProgramNamedParameter4dvNV_names[] =
- "iipp\0" /* Parameter signature */
- "glProgramNamedParameter4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3fvEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3fvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_array_object)
-static const char GenVertexArrays_names[] =
- "ip\0" /* Parameter signature */
- "glGenVertexArrays\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char BindFramebufferEXT_names[] =
- "ii\0" /* Parameter signature */
- "glBindFramebuffer\0"
- "glBindFramebufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_reference_plane)
-static const char ReferencePlaneSGIX_names[] =
- "p\0" /* Parameter signature */
- "glReferencePlaneSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char ValidateProgramARB_names[] =
- "i\0" /* Parameter signature */
- "glValidateProgram\0"
- "glValidateProgramARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_compiled_vertex_array)
-static const char UnlockArraysEXT_names[] =
- "\0" /* Parameter signature */
- "glUnlockArraysEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor3fVertex3fSUN_names[] =
- "ffffffff\0" /* Parameter signature */
- "glTexCoord2fColor3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3fvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos3fv\0"
- "glWindowPos3fvARB\0"
- "glWindowPos3fvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1svNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1svNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexSubImage3D_names[] =
- "iiiiiiiii\0" /* Parameter signature */
- "glCopyTexSubImage3D\0"
- "glCopyTexSubImage3DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2dARB_names[] =
- "idd\0" /* Parameter signature */
- "glVertexAttrib2d\0"
- "glVertexAttrib2dARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_sync)
-static const char GetInteger64v_names[] =
- "ip\0" /* Parameter signature */
- "glGetInteger64v\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture_color_mask)
-static const char TextureColorMaskSGIS_names[] =
- "iiii\0" /* Parameter signature */
- "glTextureColorMaskSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture)
-static const char GetColorTable_names[] =
- "iiip\0" /* Parameter signature */
- "glGetColorTable\0"
- "glGetColorTableSGI\0"
- "glGetColorTableEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const char CopyColorTable_names[] =
- "iiiii\0" /* Parameter signature */
- "glCopyColorTable\0"
- "glCopyColorTableSGI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetHistogramParameterfv_names[] =
- "iip\0" /* Parameter signature */
- "glGetHistogramParameterfv\0"
- "glGetHistogramParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const char ColorPointervINTEL_names[] =
- "iip\0" /* Parameter signature */
- "glColorPointervINTEL\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char AlphaFragmentOp1ATI_names[] =
- "iiiiii\0" /* Parameter signature */
- "glAlphaFragmentOp1ATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord3iv\0"
- "glMultiTexCoord3ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2sARB_names[] =
- "iii\0" /* Parameter signature */
- "glMultiTexCoord2s\0"
- "glMultiTexCoord2sARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1dv\0"
- "glVertexAttrib1dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char DeleteTextures_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteTextures\0"
- "glDeleteTexturesEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char TexCoordPointerEXT_names[] =
- "iiiip\0" /* Parameter signature */
- "glTexCoordPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture4D)
-static const char TexSubImage4DSGIS_names[] =
- "iiiiiiiiiiiip\0" /* Parameter signature */
- "glTexSubImage4DSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners2)
-static const char CombinerStageParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glCombinerStageParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char StopInstrumentsSGIX_names[] =
- "i\0" /* Parameter signature */
- "glStopInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord4fColor4fNormal3fVertex4fSUN_names[] =
- "fffffffffffffff\0" /* Parameter signature */
- "glTexCoord4fColor4fNormal3fVertex4fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const char DeformSGIX_names[] =
- "i\0" /* Parameter signature */
- "glDeformSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char GetVertexAttribfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribfv\0"
- "glGetVertexAttribfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3ivEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3iv\0"
- "glSecondaryColor3ivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_1)
-static const char UniformMatrix4x2fv_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix4x2fv\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_detail_texture)
-static const char GetDetailTexFuncSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glGetDetailTexFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners2)
-static const char GetCombinerStageParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetCombinerStageParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_array_object)
-static const char BindVertexArray_names[] =
- "i\0" /* Parameter signature */
- "glBindVertexArray\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4ubVertex2fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glColor4ubVertex2fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture_filter4)
-static const char TexFilterFuncSGIS_names[] =
- "iiip\0" /* Parameter signature */
- "glTexFilterFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample)
-static const char SampleMaskSGIS_names[] =
- "fi\0" /* Parameter signature */
- "glSampleMaskSGIS\0"
- "glSampleMaskEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader)
-static const char GetAttribLocationARB_names[] =
- "ip\0" /* Parameter signature */
- "glGetAttribLocation\0"
- "glGetAttribLocationARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4ubvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4ubv\0"
- "glVertexAttrib4ubvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_detail_texture)
-static const char DetailTexFuncSGIS_names[] =
- "iip\0" /* Parameter signature */
- "glDetailTexFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Normal3fVertex3fSUN_names[] =
- "ffffff\0" /* Parameter signature */
- "glNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexImage2D_names[] =
- "iiiiiiii\0" /* Parameter signature */
- "glCopyTexImage2D\0"
- "glCopyTexImage2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char GetBufferPointervARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetBufferPointerv\0"
- "glGetBufferPointervARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char ProgramEnvParameter4fARB_names[] =
- "iiffff\0" /* Parameter signature */
- "glProgramEnvParameter4fARB\0"
- "glProgramParameter4fNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform3ivARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform3iv\0"
- "glUniform3ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char GetFenceivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetFenceivNV\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4dvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos4dvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_color_subtable)
-static const char ColorSubTable_names[] =
- "iiiiip\0" /* Parameter signature */
- "glColorSubTable\0"
- "glColorSubTableEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord4iv\0"
- "glMultiTexCoord4ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_gpu_program_parameters)
-static const char ProgramLocalParameters4fvEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glProgramLocalParameters4fvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapAttribParameterfvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetMapAttribParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4sARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glVertexAttrib4s\0"
- "glVertexAttrib4sARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char GetQueryObjectuivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetQueryObjectuiv\0"
- "glGetQueryObjectuivARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char MapParameterivNV_names[] =
- "iip\0" /* Parameter signature */
- "glMapParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char GenRenderbuffersEXT_names[] =
- "ip\0" /* Parameter signature */
- "glGenRenderbuffers\0"
- "glGenRenderbuffersEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2dv\0"
- "glVertexAttrib2dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char EdgeFlagPointerEXT_names[] =
- "iip\0" /* Parameter signature */
- "glEdgeFlagPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs2svNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs2svNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightbvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightbvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2fv\0"
- "glVertexAttrib2fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char GetBufferParameterivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetBufferParameteriv\0"
- "glGetBufferParameterivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char ListParameteriSGIX_names[] =
- "iii\0" /* Parameter signature */
- "glListParameteriSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor4fNormal3fVertex3fSUN_names[] =
- "iffffffffff\0" /* Parameter signature */
- "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char InstrumentsBufferSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glInstrumentsBufferSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NivARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4Niv\0"
- "glVertexAttrib4NivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char GetAttachedShaders_names[] =
- "iipp\0" /* Parameter signature */
- "glGetAttachedShaders\0"
- "";
-#endif
-
-#if defined(need_GL_APPLE_vertex_array_object)
-static const char GenVertexArraysAPPLE_names[] =
- "ip\0" /* Parameter signature */
- "glGenVertexArraysAPPLE\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_gpu_program_parameters)
-static const char ProgramEnvParameters4fvEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glProgramEnvParameters4fvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor4fNormal3fVertex3fvSUN_names[] =
- "pppp\0" /* Parameter signature */
- "glTexCoord2fColor4fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2iMESA_names[] =
- "ii\0" /* Parameter signature */
- "glWindowPos2i\0"
- "glWindowPos2iARB\0"
- "glWindowPos2iMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3fvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3fv\0"
- "glSecondaryColor3fvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexSubImage1DARB_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glCompressedTexSubImage1D\0"
- "glCompressedTexSubImage1DARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetVertexAttribivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribivNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramStringARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramStringARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_envmap_bumpmap)
-static const char TexBumpParameterfvATI_names[] =
- "ip\0" /* Parameter signature */
- "glTexBumpParameterfvATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char CompileShaderARB_names[] =
- "i\0" /* Parameter signature */
- "glCompileShader\0"
- "glCompileShaderARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char DeleteShader_names[] =
- "i\0" /* Parameter signature */
- "glDeleteShader\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform3fARB_names[] =
- "ifff\0" /* Parameter signature */
- "glUniform3f\0"
- "glUniform3fARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char ListParameterfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glListParameterfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3dvEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3dvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetVertexAttribfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3sMESA_names[] =
- "iii\0" /* Parameter signature */
- "glWindowPos3s\0"
- "glWindowPos3sARB\0"
- "glWindowPos3sMESA\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2svNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2svNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs1fvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs1fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glTexCoord2fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4sMESA_names[] =
- "iiii\0" /* Parameter signature */
- "glWindowPos4sMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NuivARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4Nuiv\0"
- "glVertexAttrib4NuivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char ClientActiveTextureARB_names[] =
- "i\0" /* Parameter signature */
- "glClientActiveTexture\0"
- "glClientActiveTextureARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_pixel_texture)
-static const char PixelTexGenSGIX_names[] =
- "i\0" /* Parameter signature */
- "glPixelTexGenSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeusvSUN_names[] =
- "p\0" /* Parameter signature */
- "glReplacementCodeusvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform4fARB_names[] =
- "iffff\0" /* Parameter signature */
- "glUniform4f\0"
- "glUniform4fARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_map_buffer_range)
-static const char FlushMappedBufferRange_names[] =
- "iii\0" /* Parameter signature */
- "glFlushMappedBufferRange\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char IsProgramNV_names[] =
- "i\0" /* Parameter signature */
- "glIsProgramARB\0"
- "glIsProgramNV\0"
- "";
-#endif
-
-#if defined(need_GL_APPLE_flush_buffer_range)
-static const char FlushMappedBufferRangeAPPLE_names[] =
- "iii\0" /* Parameter signature */
- "glFlushMappedBufferRangeAPPLE\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodePointerSUN_names[] =
- "iip\0" /* Parameter signature */
- "glReplacementCodePointerSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char ProgramEnvParameter4dARB_names[] =
- "iidddd\0" /* Parameter signature */
- "glProgramEnvParameter4dARB\0"
- "glProgramParameter4dNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const char ColorTableParameterfv_names[] =
- "iip\0" /* Parameter signature */
- "glColorTableParameterfv\0"
- "glColorTableParameterfvSGI\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightModelfSGIX_names[] =
- "if\0" /* Parameter signature */
- "glFragmentLightModelfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3bvEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3bvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char IsTexture_names[] =
- "i\0" /* Parameter signature */
- "glIsTexture\0"
- "glIsTextureEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_weighting)
-static const char VertexWeightfvEXT_names[] =
- "p\0" /* Parameter signature */
- "glVertexWeightfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1dARB_names[] =
- "id\0" /* Parameter signature */
- "glVertexAttrib1d\0"
- "glVertexAttrib1dARB\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char ImageTransformParameterivHP_names[] =
- "iip\0" /* Parameter signature */
- "glImageTransformParameterivHP\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char DeleteQueriesARB_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteQueries\0"
- "glDeleteQueriesARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4ubVertex2fSUN_names[] =
- "iiiiff\0" /* Parameter signature */
- "glColor4ubVertex2fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentColorMaterialSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glFragmentColorMaterialSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char CurrentPaletteMatrixARB_names[] =
- "i\0" /* Parameter signature */
- "glCurrentPaletteMatrixARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample)
-static const char SamplePatternSGIS_names[] =
- "i\0" /* Parameter signature */
- "glSamplePatternSGIS\0"
- "glSamplePatternEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char IsQueryARB_names[] =
- "i\0" /* Parameter signature */
- "glIsQuery\0"
- "glIsQueryARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor4ubVertex3fSUN_names[] =
- "iiiiifff\0" /* Parameter signature */
- "glReplacementCodeuiColor4ubVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4usvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4usv\0"
- "glVertexAttrib4usvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char LinkProgramARB_names[] =
- "i\0" /* Parameter signature */
- "glLinkProgram\0"
- "glLinkProgramARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2fNV_names[] =
- "iff\0" /* Parameter signature */
- "glVertexAttrib2fNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char ShaderSourceARB_names[] =
- "iipp\0" /* Parameter signature */
- "glShaderSource\0"
- "glShaderSourceARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentMaterialiSGIX_names[] =
- "iii\0" /* Parameter signature */
- "glFragmentMaterialiSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3svARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3sv\0"
- "glVertexAttrib3svARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexSubImage3DARB_names[] =
- "iiiiiiiiiip\0" /* Parameter signature */
- "glCompressedTexSubImage3D\0"
- "glCompressedTexSubImage3DARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2ivMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos2iv\0"
- "glWindowPos2ivARB\0"
- "glWindowPos2ivMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char IsFramebufferEXT_names[] =
- "i\0" /* Parameter signature */
- "glIsFramebuffer\0"
- "glIsFramebufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform4ivARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform4iv\0"
- "glUniform4ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char GetVertexAttribdvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribdv\0"
- "glGetVertexAttribdvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_envmap_bumpmap)
-static const char TexBumpParameterivATI_names[] =
- "ip\0" /* Parameter signature */
- "glTexBumpParameterivATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char GetSeparableFilter_names[] =
- "iiippp\0" /* Parameter signature */
- "glGetSeparableFilter\0"
- "glGetSeparableFilterEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3dEXT_names[] =
- "ddd\0" /* Parameter signature */
- "glBinormal3dEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const char SpriteParameteriSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glSpriteParameteriSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char RequestResidentProgramsNV_names[] =
- "ip\0" /* Parameter signature */
- "glRequestResidentProgramsNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_tag_sample_buffer)
-static const char TagSampleBufferSGIX_names[] =
- "\0" /* Parameter signature */
- "glTagSampleBufferSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeusSUN_names[] =
- "i\0" /* Parameter signature */
- "glReplacementCodeusSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char ListParameterivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glListParameterivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays)
-static const char MultiDrawElementsEXT_names[] =
- "ipipi\0" /* Parameter signature */
- "glMultiDrawElements\0"
- "glMultiDrawElementsEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform1ivARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform1iv\0"
- "glUniform1ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2sMESA_names[] =
- "ii\0" /* Parameter signature */
- "glWindowPos2s\0"
- "glWindowPos2sARB\0"
- "glWindowPos2sMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightusvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightusvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoordPointerEXT_names[] =
- "iip\0" /* Parameter signature */
- "glFogCoordPointer\0"
- "glFogCoordPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_index_material)
-static const char IndexMaterialEXT_names[] =
- "ii\0" /* Parameter signature */
- "glIndexMaterialEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3ubvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3ubv\0"
- "glSecondaryColor3ubvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4dv\0"
- "glVertexAttrib4dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader)
-static const char BindAttribLocationARB_names[] =
- "iip\0" /* Parameter signature */
- "glBindAttribLocation\0"
- "glBindAttribLocationARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2dARB_names[] =
- "idd\0" /* Parameter signature */
- "glMultiTexCoord2d\0"
- "glMultiTexCoord2dARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ExecuteProgramNV_names[] =
- "iip\0" /* Parameter signature */
- "glExecuteProgramNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char LightEnviSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glLightEnviSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeuiSUN_names[] =
- "i\0" /* Parameter signature */
- "glReplacementCodeuiSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribPointerNV_names[] =
- "iiiip\0" /* Parameter signature */
- "glVertexAttribPointerNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char GetFramebufferAttachmentParameterivEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glGetFramebufferAttachmentParameteriv\0"
- "glGetFramebufferAttachmentParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const char PixelTransformParameterfEXT_names[] =
- "iif\0" /* Parameter signature */
- "glPixelTransformParameterfEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord4dv\0"
- "glMultiTexCoord4dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const char PixelTransformParameteriEXT_names[] =
- "iii\0" /* Parameter signature */
- "glPixelTransformParameteriEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor4ubVertex3fSUN_names[] =
- "ffiiiifff\0" /* Parameter signature */
- "glTexCoord2fColor4ubVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform1iARB_names[] =
- "ii\0" /* Parameter signature */
- "glUniform1i\0"
- "glUniform1iARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttribPointerARB_names[] =
- "iiiiip\0" /* Parameter signature */
- "glVertexAttribPointer\0"
- "glVertexAttribPointerARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_sharpen_texture)
-static const char SharpenTexFuncSGIS_names[] =
- "iip\0" /* Parameter signature */
- "glSharpenTexFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord4fv\0"
- "glMultiTexCoord4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_1)
-static const char UniformMatrix2x3fv_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix2x3fv\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char TrackMatrixNV_names[] =
- "iiii\0" /* Parameter signature */
- "glTrackMatrixNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerParameteriNV_names[] =
- "ii\0" /* Parameter signature */
- "glCombinerParameteriNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char DeleteAsyncMarkersSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glDeleteAsyncMarkersSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char IsAsyncMarkerSGIX_names[] =
- "i\0" /* Parameter signature */
- "glIsAsyncMarkerSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_framezoom)
-static const char FrameZoomSGIX_names[] =
- "i\0" /* Parameter signature */
- "glFrameZoomSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Normal3fVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NsvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4Nsv\0"
- "glVertexAttrib4NsvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3fv\0"
- "glVertexAttrib3fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_sync)
-static const char GetSynciv_names[] =
- "iiipp\0" /* Parameter signature */
- "glGetSynciv\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char DeleteFramebuffersEXT_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteFramebuffers\0"
- "glDeleteFramebuffersEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorsSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactorsSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture3D)
-static const char TexSubImage3D_names[] =
- "iiiiiiiiiip\0" /* Parameter signature */
- "glTexSubImage3D\0"
- "glTexSubImage3DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3fEXT_names[] =
- "fff\0" /* Parameter signature */
- "glTangent3fEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3uivEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3uiv\0"
- "glSecondaryColor3uivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char MatrixIndexubvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMatrixIndexubvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4fNormal3fVertex3fSUN_names[] =
- "ffffffffff\0" /* Parameter signature */
- "glColor4fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char PixelTexGenParameterfSGIS_names[] =
- "if\0" /* Parameter signature */
- "glPixelTexGenParameterfSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char CreateShader_names[] =
- "i\0" /* Parameter signature */
- "glCreateShader\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture)
-static const char GetColorTableParameterfv_names[] =
- "iip\0" /* Parameter signature */
- "glGetColorTableParameterfv\0"
- "glGetColorTableParameterfvSGI\0"
- "glGetColorTableParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightModelfvSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glFragmentLightModelfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3fARB_names[] =
- "ifff\0" /* Parameter signature */
- "glMultiTexCoord3f\0"
- "glMultiTexCoord3fARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char GetPixelTexGenParameterfvSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glGetPixelTexGenParameterfvSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char GenFramebuffersEXT_names[] =
- "ip\0" /* Parameter signature */
- "glGenFramebuffers\0"
- "glGenFramebuffersEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetProgramParameterdvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetProgramParameterdvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object)
-static const char IsVertexArrayAPPLE_names[] =
- "i\0" /* Parameter signature */
- "glIsVertexArray\0"
- "glIsVertexArrayAPPLE\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glFragmentLightfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char DetachShader_names[] =
- "ii\0" /* Parameter signature */
- "glDetachShader\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NubARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glVertexAttrib4Nub\0"
- "glVertexAttrib4NubARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramEnvParameterfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramEnvParameterfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetTrackMatrixivNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetTrackMatrixivNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3svNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3svNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform4fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform4fv\0"
- "glUniform4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix)
-static const char MultTransposeMatrixfARB_names[] =
- "p\0" /* Parameter signature */
- "glMultTransposeMatrixf\0"
- "glMultTransposeMatrixfARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char ColorFragmentOp1ATI_names[] =
- "iiiiiii\0" /* Parameter signature */
- "glColorFragmentOp1ATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char GetUniformfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetUniformfv\0"
- "glGetUniformfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names[] =
- "iffffffffffff\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char DetachObjectARB_names[] =
- "ii\0" /* Parameter signature */
- "glDetachObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char VertexBlendARB_names[] =
- "i\0" /* Parameter signature */
- "glVertexBlendARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3iMESA_names[] =
- "iii\0" /* Parameter signature */
- "glWindowPos3i\0"
- "glWindowPos3iARB\0"
- "glWindowPos3iMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char SeparableFilter2D_names[] =
- "iiiiiipp\0" /* Parameter signature */
- "glSeparableFilter2D\0"
- "glSeparableFilter2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor4ubVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glReplacementCodeuiColor4ubVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexImage2DARB_names[] =
- "iiiiiiip\0" /* Parameter signature */
- "glCompressedTexImage2D\0"
- "glCompressedTexImage2DARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char ArrayElement_names[] =
- "i\0" /* Parameter signature */
- "glArrayElement\0"
- "glArrayElementEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_depth_bounds_test)
-static const char DepthBoundsEXT_names[] =
- "dd\0" /* Parameter signature */
- "glDepthBoundsEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ProgramParameters4fvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glProgramParameters4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const char DeformationMap3fSGIX_names[] =
- "iffiiffiiffiip\0" /* Parameter signature */
- "glDeformationMap3fSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetProgramivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramivNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetMinmaxParameteriv_names[] =
- "iip\0" /* Parameter signature */
- "glGetMinmaxParameteriv\0"
- "glGetMinmaxParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexImage1D_names[] =
- "iiiiiii\0" /* Parameter signature */
- "glCopyTexImage1D\0"
- "glCopyTexImage1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char AlphaFragmentOp3ATI_names[] =
- "iiiiiiiiiiii\0" /* Parameter signature */
- "glAlphaFragmentOp3ATI\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetVertexAttribdvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribdvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3fvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetFinalCombinerInputParameterivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetFinalCombinerInputParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapParameterivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetMapParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform4iARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glUniform4i\0"
- "glUniform4iARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionParameteri_names[] =
- "iii\0" /* Parameter signature */
- "glConvolutionParameteri\0"
- "glConvolutionParameteriEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3sEXT_names[] =
- "iii\0" /* Parameter signature */
- "glBinormal3sEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionParameterf_names[] =
- "iif\0" /* Parameter signature */
- "glConvolutionParameterf\0"
- "glConvolutionParameterfEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture)
-static const char GetColorTableParameteriv_names[] =
- "iip\0" /* Parameter signature */
- "glGetColorTableParameteriv\0"
- "glGetColorTableParameterivSGI\0"
- "glGetColorTableParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char ProgramEnvParameter4dvARB_names[] =
- "iip\0" /* Parameter signature */
- "glProgramEnvParameter4dvARB\0"
- "glProgramParameter4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs2fvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs2fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char UseProgramObjectARB_names[] =
- "i\0" /* Parameter signature */
- "glUseProgram\0"
- "glUseProgramObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetMapParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char PassTexCoordATI_names[] =
- "iii\0" /* Parameter signature */
- "glPassTexCoordATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char DeleteProgram_names[] =
- "i\0" /* Parameter signature */
- "glDeleteProgram\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3ivEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3ivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3dEXT_names[] =
- "ddd\0" /* Parameter signature */
- "glTangent3dEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3dvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3dv\0"
- "glSecondaryColor3dvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays)
-static const char MultiDrawArraysEXT_names[] =
- "ippi\0" /* Parameter signature */
- "glMultiDrawArrays\0"
- "glMultiDrawArraysEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char BindRenderbufferEXT_names[] =
- "ii\0" /* Parameter signature */
- "glBindRenderbuffer\0"
- "glBindRenderbufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4dARB_names[] =
- "idddd\0" /* Parameter signature */
- "glMultiTexCoord4d\0"
- "glMultiTexCoord4dARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3usEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3us\0"
- "glSecondaryColor3usEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramLocalParameter4fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glProgramLocalParameter4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char DeleteProgramsNV_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteProgramsARB\0"
- "glDeleteProgramsNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1sARB_names[] =
- "ii\0" /* Parameter signature */
- "glMultiTexCoord1s\0"
- "glMultiTexCoord1sARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor3fVertex3fSUN_names[] =
- "iffffff\0" /* Parameter signature */
- "glReplacementCodeuiColor3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char GetVertexAttribPointervNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribPointerv\0"
- "glGetVertexAttribPointervARB\0"
- "glGetVertexAttribPointervNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord1dv\0"
- "glMultiTexCoord1dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform2iARB_names[] =
- "iii\0" /* Parameter signature */
- "glUniform2i\0"
- "glUniform2iARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetProgramStringNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramStringNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char ColorPointerEXT_names[] =
- "iiiip\0" /* Parameter signature */
- "glColorPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char MapBufferARB_names[] =
- "ii\0" /* Parameter signature */
- "glMapBuffer\0"
- "glMapBufferARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3svEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3svEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_light_texture)
-static const char ApplyTextureEXT_names[] =
- "i\0" /* Parameter signature */
- "glApplyTextureEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_light_texture)
-static const char TextureMaterialEXT_names[] =
- "ii\0" /* Parameter signature */
- "glTextureMaterialEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_light_texture)
-static const char TextureLightEXT_names[] =
- "i\0" /* Parameter signature */
- "glTextureLightEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char ResetMinmax_names[] =
- "i\0" /* Parameter signature */
- "glResetMinmax\0"
- "glResetMinmaxEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const char SpriteParameterfSGIX_names[] =
- "if\0" /* Parameter signature */
- "glSpriteParameterfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4sNV_names[] =
- "iiiii\0" /* Parameter signature */
- "glVertexAttrib4sNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char GetConvolutionParameterfv_names[] =
- "iip\0" /* Parameter signature */
- "glGetConvolutionParameterfv\0"
- "glGetConvolutionParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs4dvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_multimode_draw_arrays)
-static const char MultiModeDrawArraysIBM_names[] =
- "pppii\0" /* Parameter signature */
- "glMultiModeDrawArraysIBM\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4dARB_names[] =
- "idddd\0" /* Parameter signature */
- "glVertexAttrib4d\0"
- "glVertexAttrib4dARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_envmap_bumpmap)
-static const char GetTexBumpParameterfvATI_names[] =
- "ip\0" /* Parameter signature */
- "glGetTexBumpParameterfvATI\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char ProgramNamedParameter4dNV_names[] =
- "iipdddd\0" /* Parameter signature */
- "glProgramNamedParameter4dNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_weighting)
-static const char VertexWeightfEXT_names[] =
- "f\0" /* Parameter signature */
- "glVertexWeightfEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3fEXT_names[] =
- "fff\0" /* Parameter signature */
- "glBinormal3fEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoordfvEXT_names[] =
- "p\0" /* Parameter signature */
- "glFogCoordfv\0"
- "glFogCoordfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord1iv\0"
- "glMultiTexCoord1ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3ubEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3ub\0"
- "glSecondaryColor3ubEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord2iv\0"
- "glMultiTexCoord2ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_fog_function)
-static const char FogFuncSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glFogFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexSubImage2D_names[] =
- "iiiiiiii\0" /* Parameter signature */
- "glCopyTexSubImage2D\0"
- "glCopyTexSubImage2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetObjectParameterivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetObjectParameterivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord4fVertex4fSUN_names[] =
- "ffffffff\0" /* Parameter signature */
- "glTexCoord4fVertex4fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_APPLE_vertex_array_object)
-static const char BindVertexArrayAPPLE_names[] =
- "i\0" /* Parameter signature */
- "glBindVertexArrayAPPLE\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramLocalParameterdvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramLocalParameterdvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetHistogramParameteriv_names[] =
- "iip\0" /* Parameter signature */
- "glGetHistogramParameteriv\0"
- "glGetHistogramParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1iARB_names[] =
- "ii\0" /* Parameter signature */
- "glMultiTexCoord1i\0"
- "glMultiTexCoord1iARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char GetConvolutionFilter_names[] =
- "iiip\0" /* Parameter signature */
- "glGetConvolutionFilter\0"
- "glGetConvolutionFilterEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_blend_func_separate) || defined(need_GL_INGR_blend_func_separate)
-static const char BlendFuncSeparateEXT_names[] =
- "iiii\0" /* Parameter signature */
- "glBlendFuncSeparate\0"
- "glBlendFuncSeparateEXT\0"
- "glBlendFuncSeparateINGR\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_map_buffer_range)
-static const char MapBufferRange_names[] =
- "iiii\0" /* Parameter signature */
- "glMapBufferRange\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ProgramParameters4dvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glProgramParameters4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glTexCoord2fColor3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3dvEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3dvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char FinishFenceNV_names[] =
- "i\0" /* Parameter signature */
- "glFinishFenceNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_fog_function)
-static const char GetFogFuncSGIS_names[] =
- "p\0" /* Parameter signature */
- "glGetFogFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char GetUniformLocationARB_names[] =
- "ip\0" /* Parameter signature */
- "glGetUniformLocation\0"
- "glGetUniformLocationARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3fEXT_names[] =
- "fff\0" /* Parameter signature */
- "glSecondaryColor3f\0"
- "glSecondaryColor3fEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerInputNV_names[] =
- "iiiiii\0" /* Parameter signature */
- "glCombinerInputNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3sARB_names[] =
- "iiii\0" /* Parameter signature */
- "glVertexAttrib3s\0"
- "glVertexAttrib3sARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiNormal3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glReplacementCodeuiNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramStringARB_names[] =
- "iiip\0" /* Parameter signature */
- "glProgramStringARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord4fVertex4fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glTexCoord4fVertex4fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3sNV_names[] =
- "iiii\0" /* Parameter signature */
- "glVertexAttrib3sNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1fNV_names[] =
- "if\0" /* Parameter signature */
- "glVertexAttrib1fNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightfSGIX_names[] =
- "iif\0" /* Parameter signature */
- "glFragmentLightfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char GetCompressedTexImageARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetCompressedTexImage\0"
- "glGetCompressedTexImageARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_weighting)
-static const char VertexWeightPointerEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glVertexWeightPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetHistogram_names[] =
- "iiiip\0" /* Parameter signature */
- "glGetHistogram\0"
- "glGetHistogramEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_stencil_two_side)
-static const char ActiveStencilFaceEXT_names[] =
- "i\0" /* Parameter signature */
- "glActiveStencilFaceEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_separate_stencil)
-static const char StencilFuncSeparateATI_names[] =
- "iiii\0" /* Parameter signature */
- "glStencilFuncSeparateATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char GetShaderSourceARB_names[] =
- "iipp\0" /* Parameter signature */
- "glGetShaderSource\0"
- "glGetShaderSourceARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_igloo_interface)
-static const char IglooInterfaceSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glIglooInterfaceSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4dNV_names[] =
- "idddd\0" /* Parameter signature */
- "glVertexAttrib4dNV\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_multimode_draw_arrays)
-static const char MultiModeDrawElementsIBM_names[] =
- "ppipii\0" /* Parameter signature */
- "glMultiModeDrawElementsIBM\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4svARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord4sv\0"
- "glMultiTexCoord4svARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char GenQueriesARB_names[] =
- "ip\0" /* Parameter signature */
- "glGenQueries\0"
- "glGenQueriesARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiVertex3fSUN_names[] =
- "ifff\0" /* Parameter signature */
- "glReplacementCodeuiVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3iEXT_names[] =
- "iii\0" /* Parameter signature */
- "glTangent3iEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_mesh_array)
-static const char DrawMeshArraysSUN_names[] =
- "iiii\0" /* Parameter signature */
- "glDrawMeshArraysSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_sync)
-static const char IsSync_names[] =
- "i\0" /* Parameter signature */
- "glIsSync\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapControlPointsNV_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glGetMapControlPointsNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_draw_buffers) || defined(need_GL_ATI_draw_buffers)
-static const char DrawBuffersARB_names[] =
- "ip\0" /* Parameter signature */
- "glDrawBuffers\0"
- "glDrawBuffersARB\0"
- "glDrawBuffersATI\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramLocalParameter4fARB_names[] =
- "iiffff\0" /* Parameter signature */
- "glProgramLocalParameter4fARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const char SpriteParameterivSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glSpriteParameterivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_provoking_vertex)
-static const char ProvokingVertexEXT_names[] =
- "i\0" /* Parameter signature */
- "glProvokingVertexEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1fARB_names[] =
- "if\0" /* Parameter signature */
- "glMultiTexCoord1f\0"
- "glMultiTexCoord1fARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs4ubvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs4ubvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightsvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightsvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
-static const char Uniform1fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform1fv\0"
- "glUniform1fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexSubImage1D_names[] =
- "iiiiii\0" /* Parameter signature */
- "glCopyTexSubImage1D\0"
- "glCopyTexSubImage1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char BindTexture_names[] =
- "ii\0" /* Parameter signature */
- "glBindTexture\0"
- "glBindTextureEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char BeginFragmentShaderATI_names[] =
- "\0" /* Parameter signature */
- "glBeginFragmentShaderATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4fARB_names[] =
- "iffff\0" /* Parameter signature */
- "glMultiTexCoord4f\0"
- "glMultiTexCoord4fARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs3svNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs3svNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeuivSUN_names[] =
- "p\0" /* Parameter signature */
- "glReplacementCodeuivSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char EnableVertexAttribArrayARB_names[] =
- "i\0" /* Parameter signature */
- "glEnableVertexAttribArray\0"
- "glEnableVertexAttribArrayARB\0"
- "";
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const char NormalPointervINTEL_names[] =
- "ip\0" /* Parameter signature */
- "glNormalPointervINTEL\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char CopyConvolutionFilter2D_names[] =
- "iiiiii\0" /* Parameter signature */
- "glCopyConvolutionFilter2D\0"
- "glCopyConvolutionFilter2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3ivMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos3iv\0"
- "glWindowPos3ivARB\0"
- "glWindowPos3ivMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_copy_buffer)
-static const char CopyBufferSubData_names[] =
- "iiiii\0" /* Parameter signature */
- "glCopyBufferSubData\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char IsBufferARB_names[] =
- "i\0" /* Parameter signature */
- "glIsBuffer\0"
- "glIsBufferARB\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4iMESA_names[] =
- "iiii\0" /* Parameter signature */
- "glWindowPos4iMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4uivARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4uiv\0"
- "glVertexAttrib4uivARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3bvEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3bvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_1)
-static const char UniformMatrix3x4fv_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix3x4fv\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3fvEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3fvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const char TexCoordPointervINTEL_names[] =
- "iip\0" /* Parameter signature */
- "glTexCoordPointervINTEL\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char DeleteBuffersARB_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteBuffers\0"
- "glDeleteBuffersARB\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4fvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos4fvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1sNV_names[] =
- "ii\0" /* Parameter signature */
- "glVertexAttrib1sNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3svEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3sv\0"
- "glSecondaryColor3svEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix)
-static const char LoadTransposeMatrixfARB_names[] =
- "p\0" /* Parameter signature */
- "glLoadTransposeMatrixf\0"
- "glLoadTransposeMatrixfARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char GetPointerv_names[] =
- "ip\0" /* Parameter signature */
- "glGetPointerv\0"
- "glGetPointervEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3bEXT_names[] =
- "iii\0" /* Parameter signature */
- "glTangent3bEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerParameterfNV_names[] =
- "if\0" /* Parameter signature */
- "glCombinerParameterfNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char BindProgramNV_names[] =
- "ii\0" /* Parameter signature */
- "glBindProgramARB\0"
- "glBindProgramNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4svARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4sv\0"
- "glVertexAttrib4svARB\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_shader_debug)
-static const char CreateDebugObjectMESA_names[] =
- "\0" /* Parameter signature */
- "glCreateDebugObjectMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char GetShaderiv_names[] =
- "iip\0" /* Parameter signature */
- "glGetShaderiv\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_sync)
-static const char ClientWaitSync_names[] =
- "iii\0" /* Parameter signature */
- "glClientWaitSync\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char BindFragmentShaderATI_names[] =
- "i\0" /* Parameter signature */
- "glBindFragmentShaderATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char UnmapBufferARB_names[] =
- "i\0" /* Parameter signature */
- "glUnmapBuffer\0"
- "glUnmapBufferARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char Minmax_names[] =
- "iii\0" /* Parameter signature */
- "glMinmax\0"
- "glMinmaxEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoorddvEXT_names[] =
- "p\0" /* Parameter signature */
- "glFogCoorddv\0"
- "glFogCoorddvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUNX_constant_data)
-static const char FinishTextureSUNX_names[] =
- "\0" /* Parameter signature */
- "glFinishTextureSUNX\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char GetFragmentLightfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetFragmentLightfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetFinalCombinerInputParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetFinalCombinerInputParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char ColorFragmentOp3ATI_names[] =
- "iiiiiiiiiiiii\0" /* Parameter signature */
- "glColorFragmentOp3ATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2svARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2sv\0"
- "glVertexAttrib2svARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char AreProgramsResidentNV_names[] =
- "ipp\0" /* Parameter signature */
- "glAreProgramsResidentNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3svMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos3sv\0"
- "glWindowPos3svARB\0"
- "glWindowPos3svMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_color_subtable)
-static const char CopyColorSubTable_names[] =
- "iiiii\0" /* Parameter signature */
- "glCopyColorSubTable\0"
- "glCopyColorSubTableEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightdvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightdvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char DeleteRenderbuffersEXT_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteRenderbuffers\0"
- "glDeleteRenderbuffersEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NubvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4Nubv\0"
- "glVertexAttrib4NubvARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3dvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetObjectParameterfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetObjectParameterfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramEnvParameterdvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramEnvParameterdvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_compiled_vertex_array)
-static const char LockArraysEXT_names[] =
- "ii\0" /* Parameter signature */
- "glLockArraysEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const char PixelTransformParameterivEXT_names[] =
- "iip\0" /* Parameter signature */
- "glPixelTransformParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char BinormalPointerEXT_names[] =
- "iip\0" /* Parameter signature */
- "glBinormalPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1dNV_names[] =
- "id\0" /* Parameter signature */
- "glVertexAttrib1dNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetCombinerInputParameterivNV_names[] =
- "iiiip\0" /* Parameter signature */
- "glGetCombinerInputParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord2fv\0"
- "glMultiTexCoord2fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char GetRenderbufferParameterivEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetRenderbufferParameteriv\0"
- "glGetRenderbufferParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerParameterivNV_names[] =
- "ip\0" /* Parameter signature */
- "glCombinerParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char GenFragmentShadersATI_names[] =
- "i\0" /* Parameter signature */
- "glGenFragmentShadersATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char DrawArrays_names[] =
- "iii\0" /* Parameter signature */
- "glDrawArrays\0"
- "glDrawArraysEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightuivARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightuivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2sARB_names[] =
- "iii\0" /* Parameter signature */
- "glVertexAttrib2s\0"
- "glVertexAttrib2sARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char GenAsyncMarkersSGIX_names[] =
- "i\0" /* Parameter signature */
- "glGenAsyncMarkersSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3svEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3svEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char GetListParameterivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetListParameterivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char BindBufferARB_names[] =
- "ii\0" /* Parameter signature */
- "glBindBuffer\0"
- "glBindBufferARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetInfoLogARB_names[] =
- "iipp\0" /* Parameter signature */
- "glGetInfoLogARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs4svNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs4svNV\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char EdgeFlagPointerListIBM_names[] =
- "ipi\0" /* Parameter signature */
- "glEdgeFlagPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_1)
-static const char UniformMatrix3x2fv_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix3x2fv\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetMinmaxParameterfv_names[] =
- "iip\0" /* Parameter signature */
- "glGetMinmaxParameterfv\0"
- "glGetMinmaxParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1fv\0"
- "glVertexAttrib1fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char GenBuffersARB_names[] =
- "ip\0" /* Parameter signature */
- "glGenBuffers\0"
- "glGenBuffersARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs1svNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs1svNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_envmap_bumpmap)
-static const char GetTexBumpParameterivATI_names[] =
- "ip\0" /* Parameter signature */
- "glGetTexBumpParameterivATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3bEXT_names[] =
- "iii\0" /* Parameter signature */
- "glBinormal3bEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentMaterialivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glFragmentMaterialivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object)
-static const char IsRenderbufferEXT_names[] =
- "i\0" /* Parameter signature */
- "glIsRenderbuffer\0"
- "glIsRenderbufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char GenProgramsNV_names[] =
- "ip\0" /* Parameter signature */
- "glGenProgramsARB\0"
- "glGenProgramsNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4dvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char EndFragmentShaderATI_names[] =
- "\0" /* Parameter signature */
- "glEndFragmentShaderATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3iEXT_names[] =
- "iii\0" /* Parameter signature */
- "glBinormal3iEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2fMESA_names[] =
- "ff\0" /* Parameter signature */
- "glWindowPos2f\0"
- "glWindowPos2fARB\0"
- "glWindowPos2fMESA\0"
- "";
-#endif
-
-#if defined(need_GL_3DFX_tbuffer)
-static const struct dri_extension_function GL_3DFX_tbuffer_functions[] = {
- { TbufferMask3DFX_names, TbufferMask3DFX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_APPLE_flush_buffer_range)
-static const struct dri_extension_function GL_APPLE_flush_buffer_range_functions[] = {
- { BufferParameteriAPPLE_names, BufferParameteriAPPLE_remap_index, -1 },
- { FlushMappedBufferRangeAPPLE_names, FlushMappedBufferRangeAPPLE_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_APPLE_texture_range)
-static const struct dri_extension_function GL_APPLE_texture_range_functions[] = {
- { TextureRangeAPPLE_names, TextureRangeAPPLE_remap_index, -1 },
- { GetTexParameterPointervAPPLE_names, GetTexParameterPointervAPPLE_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_APPLE_vertex_array_object)
-static const struct dri_extension_function GL_APPLE_vertex_array_object_functions[] = {
- { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 },
- { GenVertexArraysAPPLE_names, GenVertexArraysAPPLE_remap_index, -1 },
- { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 },
- { BindVertexArrayAPPLE_names, BindVertexArrayAPPLE_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_copy_buffer)
-static const struct dri_extension_function GL_ARB_copy_buffer_functions[] = {
- { CopyBufferSubData_names, CopyBufferSubData_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_draw_buffers)
-static const struct dri_extension_function GL_ARB_draw_buffers_functions[] = {
- { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_framebuffer_object)
-static const struct dri_extension_function GL_ARB_framebuffer_object_functions[] = {
- { BlitFramebufferEXT_names, BlitFramebufferEXT_remap_index, -1 },
- { FramebufferTextureLayerEXT_names, FramebufferTextureLayerEXT_remap_index, -1 },
- { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 },
- { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 },
- { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 },
- { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 },
- { FramebufferTexture2DEXT_names, FramebufferTexture2DEXT_remap_index, -1 },
- { RenderbufferStorageMultisample_names, RenderbufferStorageMultisample_remap_index, -1 },
- { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 },
- { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 },
- { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 },
- { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 },
- { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 },
- { GetFramebufferAttachmentParameterivEXT_names, GetFramebufferAttachmentParameterivEXT_remap_index, -1 },
- { DeleteFramebuffersEXT_names, DeleteFramebuffersEXT_remap_index, -1 },
- { GenFramebuffersEXT_names, GenFramebuffersEXT_remap_index, -1 },
- { BindRenderbufferEXT_names, BindRenderbufferEXT_remap_index, -1 },
- { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 },
- { GetRenderbufferParameterivEXT_names, GetRenderbufferParameterivEXT_remap_index, -1 },
- { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_map_buffer_range)
-static const struct dri_extension_function GL_ARB_map_buffer_range_functions[] = {
- { FlushMappedBufferRange_names, FlushMappedBufferRange_remap_index, -1 },
- { MapBufferRange_names, MapBufferRange_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const struct dri_extension_function GL_ARB_matrix_palette_functions[] = {
- { MatrixIndexusvARB_names, MatrixIndexusvARB_remap_index, -1 },
- { MatrixIndexuivARB_names, MatrixIndexuivARB_remap_index, -1 },
- { MatrixIndexPointerARB_names, MatrixIndexPointerARB_remap_index, -1 },
- { CurrentPaletteMatrixARB_names, CurrentPaletteMatrixARB_remap_index, -1 },
- { MatrixIndexubvARB_names, MatrixIndexubvARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_multisample)
-static const struct dri_extension_function GL_ARB_multisample_functions[] = {
- { SampleCoverageARB_names, SampleCoverageARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_occlusion_query)
-static const struct dri_extension_function GL_ARB_occlusion_query_functions[] = {
- { BeginQueryARB_names, BeginQueryARB_remap_index, -1 },
- { GetQueryivARB_names, GetQueryivARB_remap_index, -1 },
- { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, -1 },
- { EndQueryARB_names, EndQueryARB_remap_index, -1 },
- { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, -1 },
- { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, -1 },
- { IsQueryARB_names, IsQueryARB_remap_index, -1 },
- { GenQueriesARB_names, GenQueriesARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_point_parameters)
-static const struct dri_extension_function GL_ARB_point_parameters_functions[] = {
- { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 },
- { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const struct dri_extension_function GL_ARB_shader_objects_functions[] = {
- { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, -1 },
- { Uniform2fARB_names, Uniform2fARB_remap_index, -1 },
- { Uniform2ivARB_names, Uniform2ivARB_remap_index, -1 },
- { UniformMatrix4fvARB_names, UniformMatrix4fvARB_remap_index, -1 },
- { CreateProgramObjectARB_names, CreateProgramObjectARB_remap_index, -1 },
- { Uniform3iARB_names, Uniform3iARB_remap_index, -1 },
- { CreateShaderObjectARB_names, CreateShaderObjectARB_remap_index, -1 },
- { Uniform1fARB_names, Uniform1fARB_remap_index, -1 },
- { AttachObjectARB_names, AttachObjectARB_remap_index, -1 },
- { UniformMatrix2fvARB_names, UniformMatrix2fvARB_remap_index, -1 },
- { GetAttachedObjectsARB_names, GetAttachedObjectsARB_remap_index, -1 },
- { Uniform3fvARB_names, Uniform3fvARB_remap_index, -1 },
- { GetHandleARB_names, GetHandleARB_remap_index, -1 },
- { GetActiveUniformARB_names, GetActiveUniformARB_remap_index, -1 },
- { GetUniformivARB_names, GetUniformivARB_remap_index, -1 },
- { Uniform2fvARB_names, Uniform2fvARB_remap_index, -1 },
- { DeleteObjectARB_names, DeleteObjectARB_remap_index, -1 },
- { ValidateProgramARB_names, ValidateProgramARB_remap_index, -1 },
- { Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 },
- { CompileShaderARB_names, CompileShaderARB_remap_index, -1 },
- { Uniform3fARB_names, Uniform3fARB_remap_index, -1 },
- { Uniform4fARB_names, Uniform4fARB_remap_index, -1 },
- { LinkProgramARB_names, LinkProgramARB_remap_index, -1 },
- { ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 },
- { Uniform4ivARB_names, Uniform4ivARB_remap_index, -1 },
- { Uniform1ivARB_names, Uniform1ivARB_remap_index, -1 },
- { Uniform1iARB_names, Uniform1iARB_remap_index, -1 },
- { Uniform4fvARB_names, Uniform4fvARB_remap_index, -1 },
- { GetUniformfvARB_names, GetUniformfvARB_remap_index, -1 },
- { DetachObjectARB_names, DetachObjectARB_remap_index, -1 },
- { Uniform4iARB_names, Uniform4iARB_remap_index, -1 },
- { UseProgramObjectARB_names, UseProgramObjectARB_remap_index, -1 },
- { Uniform2iARB_names, Uniform2iARB_remap_index, -1 },
- { GetObjectParameterivARB_names, GetObjectParameterivARB_remap_index, -1 },
- { GetUniformLocationARB_names, GetUniformLocationARB_remap_index, -1 },
- { GetShaderSourceARB_names, GetShaderSourceARB_remap_index, -1 },
- { Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 },
- { GetObjectParameterfvARB_names, GetObjectParameterfvARB_remap_index, -1 },
- { GetInfoLogARB_names, GetInfoLogARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_sync)
-static const struct dri_extension_function GL_ARB_sync_functions[] = {
- { DeleteSync_names, DeleteSync_remap_index, -1 },
- { FenceSync_names, FenceSync_remap_index, -1 },
- { WaitSync_names, WaitSync_remap_index, -1 },
- { GetInteger64v_names, GetInteger64v_remap_index, -1 },
- { GetSynciv_names, GetSynciv_remap_index, -1 },
- { IsSync_names, IsSync_remap_index, -1 },
- { ClientWaitSync_names, ClientWaitSync_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_texture_compression)
-static const struct dri_extension_function GL_ARB_texture_compression_functions[] = {
- { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, -1 },
- { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, -1 },
- { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, -1 },
- { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, -1 },
- { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, -1 },
- { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, -1 },
- { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_transpose_matrix)
-static const struct dri_extension_function GL_ARB_transpose_matrix_functions[] = {
- { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, -1 },
- { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, -1 },
- { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, -1 },
- { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_array_object)
-static const struct dri_extension_function GL_ARB_vertex_array_object_functions[] = {
- { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 },
- { GenVertexArrays_names, GenVertexArrays_remap_index, -1 },
- { BindVertexArray_names, BindVertexArray_remap_index, -1 },
- { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const struct dri_extension_function GL_ARB_vertex_blend_functions[] = {
- { WeightubvARB_names, WeightubvARB_remap_index, -1 },
- { WeightivARB_names, WeightivARB_remap_index, -1 },
- { WeightPointerARB_names, WeightPointerARB_remap_index, -1 },
- { WeightfvARB_names, WeightfvARB_remap_index, -1 },
- { WeightbvARB_names, WeightbvARB_remap_index, -1 },
- { WeightusvARB_names, WeightusvARB_remap_index, -1 },
- { VertexBlendARB_names, VertexBlendARB_remap_index, -1 },
- { WeightsvARB_names, WeightsvARB_remap_index, -1 },
- { WeightdvARB_names, WeightdvARB_remap_index, -1 },
- { WeightuivARB_names, WeightuivARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_buffer_object)
-static const struct dri_extension_function GL_ARB_vertex_buffer_object_functions[] = {
- { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, -1 },
- { BufferSubDataARB_names, BufferSubDataARB_remap_index, -1 },
- { BufferDataARB_names, BufferDataARB_remap_index, -1 },
- { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, -1 },
- { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, -1 },
- { MapBufferARB_names, MapBufferARB_remap_index, -1 },
- { IsBufferARB_names, IsBufferARB_remap_index, -1 },
- { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, -1 },
- { UnmapBufferARB_names, UnmapBufferARB_remap_index, -1 },
- { BindBufferARB_names, BindBufferARB_remap_index, -1 },
- { GenBuffersARB_names, GenBuffersARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const struct dri_extension_function GL_ARB_vertex_program_functions[] = {
- { VertexAttrib2fARB_names, VertexAttrib2fARB_remap_index, -1 },
- { VertexAttrib3fARB_names, VertexAttrib3fARB_remap_index, -1 },
- { VertexAttrib1svARB_names, VertexAttrib1svARB_remap_index, -1 },
- { VertexAttrib4NusvARB_names, VertexAttrib4NusvARB_remap_index, -1 },
- { DisableVertexAttribArrayARB_names, DisableVertexAttribArrayARB_remap_index, -1 },
- { ProgramLocalParameter4dARB_names, ProgramLocalParameter4dARB_remap_index, -1 },
- { VertexAttrib1fARB_names, VertexAttrib1fARB_remap_index, -1 },
- { VertexAttrib4NbvARB_names, VertexAttrib4NbvARB_remap_index, -1 },
- { VertexAttrib1sARB_names, VertexAttrib1sARB_remap_index, -1 },
- { GetProgramLocalParameterfvARB_names, GetProgramLocalParameterfvARB_remap_index, -1 },
- { VertexAttrib3dvARB_names, VertexAttrib3dvARB_remap_index, -1 },
- { ProgramEnvParameter4fvARB_names, ProgramEnvParameter4fvARB_remap_index, -1 },
- { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 },
- { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 },
- { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 },
- { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 },
- { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 },
- { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 },
- { ProgramLocalParameter4dvARB_names, ProgramLocalParameter4dvARB_remap_index, -1 },
- { VertexAttrib2dARB_names, VertexAttrib2dARB_remap_index, -1 },
- { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 },
- { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 },
- { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 },
- { ProgramEnvParameter4fARB_names, ProgramEnvParameter4fARB_remap_index, -1 },
- { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 },
- { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 },
- { VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, -1 },
- { VertexAttrib4NivARB_names, VertexAttrib4NivARB_remap_index, -1 },
- { GetProgramStringARB_names, GetProgramStringARB_remap_index, -1 },
- { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 },
- { IsProgramNV_names, IsProgramNV_remap_index, -1 },
- { ProgramEnvParameter4dARB_names, ProgramEnvParameter4dARB_remap_index, -1 },
- { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 },
- { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 },
- { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 },
- { GetVertexAttribdvARB_names, GetVertexAttribdvARB_remap_index, -1 },
- { VertexAttrib4dvARB_names, VertexAttrib4dvARB_remap_index, -1 },
- { VertexAttribPointerARB_names, VertexAttribPointerARB_remap_index, -1 },
- { VertexAttrib4NsvARB_names, VertexAttrib4NsvARB_remap_index, -1 },
- { VertexAttrib3fvARB_names, VertexAttrib3fvARB_remap_index, -1 },
- { VertexAttrib4NubARB_names, VertexAttrib4NubARB_remap_index, -1 },
- { GetProgramEnvParameterfvARB_names, GetProgramEnvParameterfvARB_remap_index, -1 },
- { ProgramEnvParameter4dvARB_names, ProgramEnvParameter4dvARB_remap_index, -1 },
- { ProgramLocalParameter4fvARB_names, ProgramLocalParameter4fvARB_remap_index, -1 },
- { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, -1 },
- { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 },
- { VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, -1 },
- { GetProgramLocalParameterdvARB_names, GetProgramLocalParameterdvARB_remap_index, -1 },
- { GetProgramivARB_names, GetProgramivARB_remap_index, -1 },
- { VertexAttrib3sARB_names, VertexAttrib3sARB_remap_index, -1 },
- { ProgramStringARB_names, ProgramStringARB_remap_index, -1 },
- { ProgramLocalParameter4fARB_names, ProgramLocalParameter4fARB_remap_index, -1 },
- { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 },
- { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 },
- { BindProgramNV_names, BindProgramNV_remap_index, -1 },
- { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 },
- { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 },
- { VertexAttrib4NubvARB_names, VertexAttrib4NubvARB_remap_index, -1 },
- { GetProgramEnvParameterdvARB_names, GetProgramEnvParameterdvARB_remap_index, -1 },
- { VertexAttrib2sARB_names, VertexAttrib2sARB_remap_index, -1 },
- { VertexAttrib1fvARB_names, VertexAttrib1fvARB_remap_index, -1 },
- { GenProgramsNV_names, GenProgramsNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_shader)
-static const struct dri_extension_function GL_ARB_vertex_shader_functions[] = {
- { GetActiveAttribARB_names, GetActiveAttribARB_remap_index, -1 },
- { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 },
- { BindAttribLocationARB_names, BindAttribLocationARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_window_pos)
-static const struct dri_extension_function GL_ARB_window_pos_functions[] = {
- { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 },
- { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 },
- { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 },
- { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 },
- { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 },
- { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 },
- { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 },
- { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 },
- { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 },
- { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 },
- { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 },
- { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 },
- { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 },
- { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 },
- { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 },
- { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ATI_blend_equation_separate)
-static const struct dri_extension_function GL_ATI_blend_equation_separate_functions[] = {
- { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ATI_draw_buffers)
-static const struct dri_extension_function GL_ATI_draw_buffers_functions[] = {
- { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ATI_envmap_bumpmap)
-static const struct dri_extension_function GL_ATI_envmap_bumpmap_functions[] = {
- { TexBumpParameterfvATI_names, TexBumpParameterfvATI_remap_index, -1 },
- { TexBumpParameterivATI_names, TexBumpParameterivATI_remap_index, -1 },
- { GetTexBumpParameterfvATI_names, GetTexBumpParameterfvATI_remap_index, -1 },
- { GetTexBumpParameterivATI_names, GetTexBumpParameterivATI_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = {
- { ColorFragmentOp2ATI_names, ColorFragmentOp2ATI_remap_index, -1 },
- { DeleteFragmentShaderATI_names, DeleteFragmentShaderATI_remap_index, -1 },
- { SetFragmentShaderConstantATI_names, SetFragmentShaderConstantATI_remap_index, -1 },
- { SampleMapATI_names, SampleMapATI_remap_index, -1 },
- { AlphaFragmentOp2ATI_names, AlphaFragmentOp2ATI_remap_index, -1 },
- { AlphaFragmentOp1ATI_names, AlphaFragmentOp1ATI_remap_index, -1 },
- { ColorFragmentOp1ATI_names, ColorFragmentOp1ATI_remap_index, -1 },
- { AlphaFragmentOp3ATI_names, AlphaFragmentOp3ATI_remap_index, -1 },
- { PassTexCoordATI_names, PassTexCoordATI_remap_index, -1 },
- { BeginFragmentShaderATI_names, BeginFragmentShaderATI_remap_index, -1 },
- { BindFragmentShaderATI_names, BindFragmentShaderATI_remap_index, -1 },
- { ColorFragmentOp3ATI_names, ColorFragmentOp3ATI_remap_index, -1 },
- { GenFragmentShadersATI_names, GenFragmentShadersATI_remap_index, -1 },
- { EndFragmentShaderATI_names, EndFragmentShaderATI_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ATI_separate_stencil)
-static const struct dri_extension_function GL_ATI_separate_stencil_functions[] = {
- { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 },
- { StencilFuncSeparateATI_names, StencilFuncSeparateATI_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_color)
-static const struct dri_extension_function GL_EXT_blend_color_functions[] = {
- { BlendColor_names, -1, 336 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_equation_separate)
-static const struct dri_extension_function GL_EXT_blend_equation_separate_functions[] = {
- { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_func_separate)
-static const struct dri_extension_function GL_EXT_blend_func_separate_functions[] = {
- { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_minmax)
-static const struct dri_extension_function GL_EXT_blend_minmax_functions[] = {
- { BlendEquation_names, -1, 337 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_color_subtable)
-static const struct dri_extension_function GL_EXT_color_subtable_functions[] = {
- { ColorSubTable_names, -1, 346 },
- { CopyColorSubTable_names, -1, 347 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_compiled_vertex_array)
-static const struct dri_extension_function GL_EXT_compiled_vertex_array_functions[] = {
- { UnlockArraysEXT_names, UnlockArraysEXT_remap_index, -1 },
- { LockArraysEXT_names, LockArraysEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const struct dri_extension_function GL_EXT_convolution_functions[] = {
- { ConvolutionFilter1D_names, -1, 348 },
- { CopyConvolutionFilter1D_names, -1, 354 },
- { GetConvolutionParameteriv_names, -1, 358 },
- { ConvolutionFilter2D_names, -1, 349 },
- { ConvolutionParameteriv_names, -1, 353 },
- { ConvolutionParameterfv_names, -1, 351 },
- { GetSeparableFilter_names, -1, 359 },
- { SeparableFilter2D_names, -1, 360 },
- { ConvolutionParameteri_names, -1, 352 },
- { ConvolutionParameterf_names, -1, 350 },
- { GetConvolutionParameterfv_names, -1, 357 },
- { GetConvolutionFilter_names, -1, 356 },
- { CopyConvolutionFilter2D_names, -1, 355 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const struct dri_extension_function GL_EXT_coordinate_frame_functions[] = {
- { TangentPointerEXT_names, TangentPointerEXT_remap_index, -1 },
- { Binormal3ivEXT_names, Binormal3ivEXT_remap_index, -1 },
- { Tangent3sEXT_names, Tangent3sEXT_remap_index, -1 },
- { Tangent3fvEXT_names, Tangent3fvEXT_remap_index, -1 },
- { Tangent3dvEXT_names, Tangent3dvEXT_remap_index, -1 },
- { Binormal3bvEXT_names, Binormal3bvEXT_remap_index, -1 },
- { Binormal3dEXT_names, Binormal3dEXT_remap_index, -1 },
- { Tangent3fEXT_names, Tangent3fEXT_remap_index, -1 },
- { Binormal3sEXT_names, Binormal3sEXT_remap_index, -1 },
- { Tangent3ivEXT_names, Tangent3ivEXT_remap_index, -1 },
- { Tangent3dEXT_names, Tangent3dEXT_remap_index, -1 },
- { Binormal3svEXT_names, Binormal3svEXT_remap_index, -1 },
- { Binormal3fEXT_names, Binormal3fEXT_remap_index, -1 },
- { Binormal3dvEXT_names, Binormal3dvEXT_remap_index, -1 },
- { Tangent3iEXT_names, Tangent3iEXT_remap_index, -1 },
- { Tangent3bvEXT_names, Tangent3bvEXT_remap_index, -1 },
- { Binormal3fvEXT_names, Binormal3fvEXT_remap_index, -1 },
- { Tangent3bEXT_names, Tangent3bEXT_remap_index, -1 },
- { BinormalPointerEXT_names, BinormalPointerEXT_remap_index, -1 },
- { Tangent3svEXT_names, Tangent3svEXT_remap_index, -1 },
- { Binormal3bEXT_names, Binormal3bEXT_remap_index, -1 },
- { Binormal3iEXT_names, Binormal3iEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const struct dri_extension_function GL_EXT_copy_texture_functions[] = {
- { CopyTexSubImage3D_names, -1, 373 },
- { CopyTexImage2D_names, -1, 324 },
- { CopyTexImage1D_names, -1, 323 },
- { CopyTexSubImage2D_names, -1, 326 },
- { CopyTexSubImage1D_names, -1, 325 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_cull_vertex)
-static const struct dri_extension_function GL_EXT_cull_vertex_functions[] = {
- { CullParameterdvEXT_names, CullParameterdvEXT_remap_index, -1 },
- { CullParameterfvEXT_names, CullParameterfvEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_depth_bounds_test)
-static const struct dri_extension_function GL_EXT_depth_bounds_test_functions[] = {
- { DepthBoundsEXT_names, DepthBoundsEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_draw_range_elements)
-static const struct dri_extension_function GL_EXT_draw_range_elements_functions[] = {
- { DrawRangeElements_names, -1, 338 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_fog_coord)
-static const struct dri_extension_function GL_EXT_fog_coord_functions[] = {
- { FogCoorddEXT_names, FogCoorddEXT_remap_index, -1 },
- { FogCoordfEXT_names, FogCoordfEXT_remap_index, -1 },
- { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, -1 },
- { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, -1 },
- { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_framebuffer_blit)
-static const struct dri_extension_function GL_EXT_framebuffer_blit_functions[] = {
- { BlitFramebufferEXT_names, BlitFramebufferEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = {
- { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 },
- { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 },
- { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 },
- { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 },
- { FramebufferTexture2DEXT_names, FramebufferTexture2DEXT_remap_index, -1 },
- { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 },
- { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 },
- { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 },
- { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 },
- { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 },
- { GetFramebufferAttachmentParameterivEXT_names, GetFramebufferAttachmentParameterivEXT_remap_index, -1 },
- { DeleteFramebuffersEXT_names, DeleteFramebuffersEXT_remap_index, -1 },
- { GenFramebuffersEXT_names, GenFramebuffersEXT_remap_index, -1 },
- { BindRenderbufferEXT_names, BindRenderbufferEXT_remap_index, -1 },
- { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 },
- { GetRenderbufferParameterivEXT_names, GetRenderbufferParameterivEXT_remap_index, -1 },
- { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_gpu_program_parameters)
-static const struct dri_extension_function GL_EXT_gpu_program_parameters_functions[] = {
- { ProgramLocalParameters4fvEXT_names, ProgramLocalParameters4fvEXT_remap_index, -1 },
- { ProgramEnvParameters4fvEXT_names, ProgramEnvParameters4fvEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const struct dri_extension_function GL_EXT_histogram_functions[] = {
- { Histogram_names, -1, 367 },
- { ResetHistogram_names, -1, 369 },
- { GetMinmax_names, -1, 364 },
- { GetHistogramParameterfv_names, -1, 362 },
- { GetMinmaxParameteriv_names, -1, 366 },
- { ResetMinmax_names, -1, 370 },
- { GetHistogramParameteriv_names, -1, 363 },
- { GetHistogram_names, -1, 361 },
- { Minmax_names, -1, 368 },
- { GetMinmaxParameterfv_names, -1, 365 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_index_func)
-static const struct dri_extension_function GL_EXT_index_func_functions[] = {
- { IndexFuncEXT_names, IndexFuncEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_index_material)
-static const struct dri_extension_function GL_EXT_index_material_functions[] = {
- { IndexMaterialEXT_names, IndexMaterialEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_light_texture)
-static const struct dri_extension_function GL_EXT_light_texture_functions[] = {
- { ApplyTextureEXT_names, ApplyTextureEXT_remap_index, -1 },
- { TextureMaterialEXT_names, TextureMaterialEXT_remap_index, -1 },
- { TextureLightEXT_names, TextureLightEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_multi_draw_arrays)
-static const struct dri_extension_function GL_EXT_multi_draw_arrays_functions[] = {
- { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, -1 },
- { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_multisample)
-static const struct dri_extension_function GL_EXT_multisample_functions[] = {
- { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, -1 },
- { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_paletted_texture)
-static const struct dri_extension_function GL_EXT_paletted_texture_functions[] = {
- { ColorTable_names, -1, 339 },
- { GetColorTable_names, -1, 343 },
- { GetColorTableParameterfv_names, -1, 344 },
- { GetColorTableParameteriv_names, -1, 345 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const struct dri_extension_function GL_EXT_pixel_transform_functions[] = {
- { PixelTransformParameterfvEXT_names, PixelTransformParameterfvEXT_remap_index, -1 },
- { PixelTransformParameterfEXT_names, PixelTransformParameterfEXT_remap_index, -1 },
- { PixelTransformParameteriEXT_names, PixelTransformParameteriEXT_remap_index, -1 },
- { PixelTransformParameterivEXT_names, PixelTransformParameterivEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_point_parameters)
-static const struct dri_extension_function GL_EXT_point_parameters_functions[] = {
- { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 },
- { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_polygon_offset)
-static const struct dri_extension_function GL_EXT_polygon_offset_functions[] = {
- { PolygonOffsetEXT_names, PolygonOffsetEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_provoking_vertex)
-static const struct dri_extension_function GL_EXT_provoking_vertex_functions[] = {
- { ProvokingVertexEXT_names, ProvokingVertexEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_secondary_color)
-static const struct dri_extension_function GL_EXT_secondary_color_functions[] = {
- { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, -1 },
- { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, -1 },
- { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, -1 },
- { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, -1 },
- { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, -1 },
- { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, -1 },
- { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, -1 },
- { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, -1 },
- { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, -1 },
- { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, -1 },
- { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, -1 },
- { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, -1 },
- { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, -1 },
- { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, -1 },
- { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, -1 },
- { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, -1 },
- { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_stencil_two_side)
-static const struct dri_extension_function GL_EXT_stencil_two_side_functions[] = {
- { ActiveStencilFaceEXT_names, ActiveStencilFaceEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_subtexture)
-static const struct dri_extension_function GL_EXT_subtexture_functions[] = {
- { TexSubImage1D_names, -1, 332 },
- { TexSubImage2D_names, -1, 333 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture3D)
-static const struct dri_extension_function GL_EXT_texture3D_functions[] = {
- { TexImage3D_names, -1, 371 },
- { TexSubImage3D_names, -1, 372 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture_array)
-static const struct dri_extension_function GL_EXT_texture_array_functions[] = {
- { FramebufferTextureLayerEXT_names, FramebufferTextureLayerEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const struct dri_extension_function GL_EXT_texture_object_functions[] = {
- { PrioritizeTextures_names, -1, 331 },
- { AreTexturesResident_names, -1, 322 },
- { GenTextures_names, -1, 328 },
- { DeleteTextures_names, -1, 327 },
- { IsTexture_names, -1, 330 },
- { BindTexture_names, -1, 307 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture_perturb_normal)
-static const struct dri_extension_function GL_EXT_texture_perturb_normal_functions[] = {
- { TextureNormalEXT_names, TextureNormalEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_timer_query)
-static const struct dri_extension_function GL_EXT_timer_query_functions[] = {
- { GetQueryObjectui64vEXT_names, GetQueryObjectui64vEXT_remap_index, -1 },
- { GetQueryObjecti64vEXT_names, GetQueryObjecti64vEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const struct dri_extension_function GL_EXT_vertex_array_functions[] = {
- { IndexPointerEXT_names, IndexPointerEXT_remap_index, -1 },
- { NormalPointerEXT_names, NormalPointerEXT_remap_index, -1 },
- { VertexPointerEXT_names, VertexPointerEXT_remap_index, -1 },
- { TexCoordPointerEXT_names, TexCoordPointerEXT_remap_index, -1 },
- { EdgeFlagPointerEXT_names, EdgeFlagPointerEXT_remap_index, -1 },
- { ArrayElement_names, -1, 306 },
- { ColorPointerEXT_names, ColorPointerEXT_remap_index, -1 },
- { GetPointerv_names, -1, 329 },
- { DrawArrays_names, -1, 310 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_vertex_weighting)
-static const struct dri_extension_function GL_EXT_vertex_weighting_functions[] = {
- { VertexWeightfvEXT_names, VertexWeightfvEXT_remap_index, -1 },
- { VertexWeightfEXT_names, VertexWeightfEXT_remap_index, -1 },
- { VertexWeightPointerEXT_names, VertexWeightPointerEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const struct dri_extension_function GL_HP_image_transform_functions[] = {
- { GetImageTransformParameterfvHP_names, GetImageTransformParameterfvHP_remap_index, -1 },
- { ImageTransformParameterfHP_names, ImageTransformParameterfHP_remap_index, -1 },
- { ImageTransformParameterfvHP_names, ImageTransformParameterfvHP_remap_index, -1 },
- { ImageTransformParameteriHP_names, ImageTransformParameteriHP_remap_index, -1 },
- { GetImageTransformParameterivHP_names, GetImageTransformParameterivHP_remap_index, -1 },
- { ImageTransformParameterivHP_names, ImageTransformParameterivHP_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_IBM_multimode_draw_arrays)
-static const struct dri_extension_function GL_IBM_multimode_draw_arrays_functions[] = {
- { MultiModeDrawArraysIBM_names, MultiModeDrawArraysIBM_remap_index, -1 },
- { MultiModeDrawElementsIBM_names, MultiModeDrawElementsIBM_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const struct dri_extension_function GL_IBM_vertex_array_lists_functions[] = {
- { SecondaryColorPointerListIBM_names, SecondaryColorPointerListIBM_remap_index, -1 },
- { NormalPointerListIBM_names, NormalPointerListIBM_remap_index, -1 },
- { FogCoordPointerListIBM_names, FogCoordPointerListIBM_remap_index, -1 },
- { VertexPointerListIBM_names, VertexPointerListIBM_remap_index, -1 },
- { ColorPointerListIBM_names, ColorPointerListIBM_remap_index, -1 },
- { TexCoordPointerListIBM_names, TexCoordPointerListIBM_remap_index, -1 },
- { IndexPointerListIBM_names, IndexPointerListIBM_remap_index, -1 },
- { EdgeFlagPointerListIBM_names, EdgeFlagPointerListIBM_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_INGR_blend_func_separate)
-static const struct dri_extension_function GL_INGR_blend_func_separate_functions[] = {
- { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const struct dri_extension_function GL_INTEL_parallel_arrays_functions[] = {
- { VertexPointervINTEL_names, VertexPointervINTEL_remap_index, -1 },
- { ColorPointervINTEL_names, ColorPointervINTEL_remap_index, -1 },
- { NormalPointervINTEL_names, NormalPointervINTEL_remap_index, -1 },
- { TexCoordPointervINTEL_names, TexCoordPointervINTEL_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_MESA_resize_buffers)
-static const struct dri_extension_function GL_MESA_resize_buffers_functions[] = {
- { ResizeBuffersMESA_names, ResizeBuffersMESA_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_MESA_shader_debug)
-static const struct dri_extension_function GL_MESA_shader_debug_functions[] = {
- { GetDebugLogLengthMESA_names, GetDebugLogLengthMESA_remap_index, -1 },
- { ClearDebugLogMESA_names, ClearDebugLogMESA_remap_index, -1 },
- { GetDebugLogMESA_names, GetDebugLogMESA_remap_index, -1 },
- { CreateDebugObjectMESA_names, CreateDebugObjectMESA_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const struct dri_extension_function GL_MESA_window_pos_functions[] = {
- { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 },
- { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 },
- { WindowPos4svMESA_names, WindowPos4svMESA_remap_index, -1 },
- { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 },
- { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 },
- { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 },
- { WindowPos4dMESA_names, WindowPos4dMESA_remap_index, -1 },
- { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 },
- { WindowPos4ivMESA_names, WindowPos4ivMESA_remap_index, -1 },
- { WindowPos4fMESA_names, WindowPos4fMESA_remap_index, -1 },
- { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 },
- { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 },
- { WindowPos4dvMESA_names, WindowPos4dvMESA_remap_index, -1 },
- { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 },
- { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 },
- { WindowPos4sMESA_names, WindowPos4sMESA_remap_index, -1 },
- { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 },
- { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 },
- { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 },
- { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 },
- { WindowPos4iMESA_names, WindowPos4iMESA_remap_index, -1 },
- { WindowPos4fvMESA_names, WindowPos4fvMESA_remap_index, -1 },
- { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 },
- { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const struct dri_extension_function GL_NV_evaluators_functions[] = {
- { GetMapAttribParameterivNV_names, GetMapAttribParameterivNV_remap_index, -1 },
- { MapControlPointsNV_names, MapControlPointsNV_remap_index, -1 },
- { MapParameterfvNV_names, MapParameterfvNV_remap_index, -1 },
- { EvalMapsNV_names, EvalMapsNV_remap_index, -1 },
- { GetMapAttribParameterfvNV_names, GetMapAttribParameterfvNV_remap_index, -1 },
- { MapParameterivNV_names, MapParameterivNV_remap_index, -1 },
- { GetMapParameterivNV_names, GetMapParameterivNV_remap_index, -1 },
- { GetMapParameterfvNV_names, GetMapParameterfvNV_remap_index, -1 },
- { GetMapControlPointsNV_names, GetMapControlPointsNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_fence)
-static const struct dri_extension_function GL_NV_fence_functions[] = {
- { GenFencesNV_names, GenFencesNV_remap_index, -1 },
- { TestFenceNV_names, TestFenceNV_remap_index, -1 },
- { IsFenceNV_names, IsFenceNV_remap_index, -1 },
- { DeleteFencesNV_names, DeleteFencesNV_remap_index, -1 },
- { SetFenceNV_names, SetFenceNV_remap_index, -1 },
- { GetFenceivNV_names, GetFenceivNV_remap_index, -1 },
- { FinishFenceNV_names, FinishFenceNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const struct dri_extension_function GL_NV_fragment_program_functions[] = {
- { GetProgramNamedParameterdvNV_names, GetProgramNamedParameterdvNV_remap_index, -1 },
- { GetProgramNamedParameterfvNV_names, GetProgramNamedParameterfvNV_remap_index, -1 },
- { ProgramNamedParameter4fNV_names, ProgramNamedParameter4fNV_remap_index, -1 },
- { ProgramNamedParameter4fvNV_names, ProgramNamedParameter4fvNV_remap_index, -1 },
- { ProgramNamedParameter4dvNV_names, ProgramNamedParameter4dvNV_remap_index, -1 },
- { ProgramNamedParameter4dNV_names, ProgramNamedParameter4dNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_point_sprite)
-static const struct dri_extension_function GL_NV_point_sprite_functions[] = {
- { PointParameteriNV_names, PointParameteriNV_remap_index, -1 },
- { PointParameterivNV_names, PointParameterivNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const struct dri_extension_function GL_NV_register_combiners_functions[] = {
- { CombinerOutputNV_names, CombinerOutputNV_remap_index, -1 },
- { CombinerParameterfvNV_names, CombinerParameterfvNV_remap_index, -1 },
- { GetCombinerOutputParameterfvNV_names, GetCombinerOutputParameterfvNV_remap_index, -1 },
- { FinalCombinerInputNV_names, FinalCombinerInputNV_remap_index, -1 },
- { GetCombinerInputParameterfvNV_names, GetCombinerInputParameterfvNV_remap_index, -1 },
- { GetCombinerOutputParameterivNV_names, GetCombinerOutputParameterivNV_remap_index, -1 },
- { CombinerParameteriNV_names, CombinerParameteriNV_remap_index, -1 },
- { GetFinalCombinerInputParameterivNV_names, GetFinalCombinerInputParameterivNV_remap_index, -1 },
- { CombinerInputNV_names, CombinerInputNV_remap_index, -1 },
- { CombinerParameterfNV_names, CombinerParameterfNV_remap_index, -1 },
- { GetFinalCombinerInputParameterfvNV_names, GetFinalCombinerInputParameterfvNV_remap_index, -1 },
- { GetCombinerInputParameterivNV_names, GetCombinerInputParameterivNV_remap_index, -1 },
- { CombinerParameterivNV_names, CombinerParameterivNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_register_combiners2)
-static const struct dri_extension_function GL_NV_register_combiners2_functions[] = {
- { CombinerStageParameterfvNV_names, CombinerStageParameterfvNV_remap_index, -1 },
- { GetCombinerStageParameterfvNV_names, GetCombinerStageParameterfvNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_vertex_array_range)
-static const struct dri_extension_function GL_NV_vertex_array_range_functions[] = {
- { VertexArrayRangeNV_names, VertexArrayRangeNV_remap_index, -1 },
- { FlushVertexArrayRangeNV_names, FlushVertexArrayRangeNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const struct dri_extension_function GL_NV_vertex_program_functions[] = {
- { VertexAttrib4ubvNV_names, VertexAttrib4ubvNV_remap_index, -1 },
- { VertexAttrib4svNV_names, VertexAttrib4svNV_remap_index, -1 },
- { VertexAttribs1dvNV_names, VertexAttribs1dvNV_remap_index, -1 },
- { VertexAttrib1fvNV_names, VertexAttrib1fvNV_remap_index, -1 },
- { VertexAttrib4fNV_names, VertexAttrib4fNV_remap_index, -1 },
- { VertexAttrib2dNV_names, VertexAttrib2dNV_remap_index, -1 },
- { VertexAttrib4ubNV_names, VertexAttrib4ubNV_remap_index, -1 },
- { VertexAttribs3dvNV_names, VertexAttribs3dvNV_remap_index, -1 },
- { VertexAttribs4fvNV_names, VertexAttribs4fvNV_remap_index, -1 },
- { VertexAttrib2sNV_names, VertexAttrib2sNV_remap_index, -1 },
- { VertexAttribs3fvNV_names, VertexAttribs3fvNV_remap_index, -1 },
- { ProgramEnvParameter4fvARB_names, ProgramEnvParameter4fvARB_remap_index, -1 },
- { LoadProgramNV_names, LoadProgramNV_remap_index, -1 },
- { VertexAttrib4fvNV_names, VertexAttrib4fvNV_remap_index, -1 },
- { VertexAttrib3fNV_names, VertexAttrib3fNV_remap_index, -1 },
- { VertexAttribs2dvNV_names, VertexAttribs2dvNV_remap_index, -1 },
- { GetProgramParameterfvNV_names, GetProgramParameterfvNV_remap_index, -1 },
- { VertexAttrib3dNV_names, VertexAttrib3dNV_remap_index, -1 },
- { VertexAttrib2fvNV_names, VertexAttrib2fvNV_remap_index, -1 },
- { VertexAttrib2dvNV_names, VertexAttrib2dvNV_remap_index, -1 },
- { VertexAttrib1dvNV_names, VertexAttrib1dvNV_remap_index, -1 },
- { VertexAttrib1svNV_names, VertexAttrib1svNV_remap_index, -1 },
- { ProgramEnvParameter4fARB_names, ProgramEnvParameter4fARB_remap_index, -1 },
- { VertexAttribs2svNV_names, VertexAttribs2svNV_remap_index, -1 },
- { GetVertexAttribivNV_names, GetVertexAttribivNV_remap_index, -1 },
- { GetVertexAttribfvNV_names, GetVertexAttribfvNV_remap_index, -1 },
- { VertexAttrib2svNV_names, VertexAttrib2svNV_remap_index, -1 },
- { VertexAttribs1fvNV_names, VertexAttribs1fvNV_remap_index, -1 },
- { IsProgramNV_names, IsProgramNV_remap_index, -1 },
- { ProgramEnvParameter4dARB_names, ProgramEnvParameter4dARB_remap_index, -1 },
- { VertexAttrib2fNV_names, VertexAttrib2fNV_remap_index, -1 },
- { RequestResidentProgramsNV_names, RequestResidentProgramsNV_remap_index, -1 },
- { ExecuteProgramNV_names, ExecuteProgramNV_remap_index, -1 },
- { VertexAttribPointerNV_names, VertexAttribPointerNV_remap_index, -1 },
- { TrackMatrixNV_names, TrackMatrixNV_remap_index, -1 },
- { GetProgramParameterdvNV_names, GetProgramParameterdvNV_remap_index, -1 },
- { GetTrackMatrixivNV_names, GetTrackMatrixivNV_remap_index, -1 },
- { VertexAttrib3svNV_names, VertexAttrib3svNV_remap_index, -1 },
- { ProgramParameters4fvNV_names, ProgramParameters4fvNV_remap_index, -1 },
- { GetProgramivNV_names, GetProgramivNV_remap_index, -1 },
- { GetVertexAttribdvNV_names, GetVertexAttribdvNV_remap_index, -1 },
- { VertexAttrib3fvNV_names, VertexAttrib3fvNV_remap_index, -1 },
- { ProgramEnvParameter4dvARB_names, ProgramEnvParameter4dvARB_remap_index, -1 },
- { VertexAttribs2fvNV_names, VertexAttribs2fvNV_remap_index, -1 },
- { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, -1 },
- { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 },
- { GetProgramStringNV_names, GetProgramStringNV_remap_index, -1 },
- { VertexAttrib4sNV_names, VertexAttrib4sNV_remap_index, -1 },
- { VertexAttribs4dvNV_names, VertexAttribs4dvNV_remap_index, -1 },
- { ProgramParameters4dvNV_names, ProgramParameters4dvNV_remap_index, -1 },
- { VertexAttrib3sNV_names, VertexAttrib3sNV_remap_index, -1 },
- { VertexAttrib1fNV_names, VertexAttrib1fNV_remap_index, -1 },
- { VertexAttrib4dNV_names, VertexAttrib4dNV_remap_index, -1 },
- { VertexAttribs4ubvNV_names, VertexAttribs4ubvNV_remap_index, -1 },
- { VertexAttribs3svNV_names, VertexAttribs3svNV_remap_index, -1 },
- { VertexAttrib1sNV_names, VertexAttrib1sNV_remap_index, -1 },
- { BindProgramNV_names, BindProgramNV_remap_index, -1 },
- { AreProgramsResidentNV_names, AreProgramsResidentNV_remap_index, -1 },
- { VertexAttrib3dvNV_names, VertexAttrib3dvNV_remap_index, -1 },
- { VertexAttrib1dNV_names, VertexAttrib1dNV_remap_index, -1 },
- { VertexAttribs4svNV_names, VertexAttribs4svNV_remap_index, -1 },
- { VertexAttribs1svNV_names, VertexAttribs1svNV_remap_index, -1 },
- { GenProgramsNV_names, GenProgramsNV_remap_index, -1 },
- { VertexAttrib4dvNV_names, VertexAttrib4dvNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_PGI_misc_hints)
-static const struct dri_extension_function GL_PGI_misc_hints_functions[] = {
- { HintPGI_names, HintPGI_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_detail_texture)
-static const struct dri_extension_function GL_SGIS_detail_texture_functions[] = {
- { GetDetailTexFuncSGIS_names, GetDetailTexFuncSGIS_remap_index, -1 },
- { DetailTexFuncSGIS_names, DetailTexFuncSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_fog_function)
-static const struct dri_extension_function GL_SGIS_fog_function_functions[] = {
- { FogFuncSGIS_names, FogFuncSGIS_remap_index, -1 },
- { GetFogFuncSGIS_names, GetFogFuncSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_multisample)
-static const struct dri_extension_function GL_SGIS_multisample_functions[] = {
- { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, -1 },
- { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const struct dri_extension_function GL_SGIS_pixel_texture_functions[] = {
- { PixelTexGenParameterfvSGIS_names, PixelTexGenParameterfvSGIS_remap_index, -1 },
- { GetPixelTexGenParameterivSGIS_names, GetPixelTexGenParameterivSGIS_remap_index, -1 },
- { PixelTexGenParameteriSGIS_names, PixelTexGenParameteriSGIS_remap_index, -1 },
- { PixelTexGenParameterivSGIS_names, PixelTexGenParameterivSGIS_remap_index, -1 },
- { PixelTexGenParameterfSGIS_names, PixelTexGenParameterfSGIS_remap_index, -1 },
- { GetPixelTexGenParameterfvSGIS_names, GetPixelTexGenParameterfvSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_point_parameters)
-static const struct dri_extension_function GL_SGIS_point_parameters_functions[] = {
- { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 },
- { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_sharpen_texture)
-static const struct dri_extension_function GL_SGIS_sharpen_texture_functions[] = {
- { GetSharpenTexFuncSGIS_names, GetSharpenTexFuncSGIS_remap_index, -1 },
- { SharpenTexFuncSGIS_names, SharpenTexFuncSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_texture4D)
-static const struct dri_extension_function GL_SGIS_texture4D_functions[] = {
- { TexImage4DSGIS_names, TexImage4DSGIS_remap_index, -1 },
- { TexSubImage4DSGIS_names, TexSubImage4DSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_texture_color_mask)
-static const struct dri_extension_function GL_SGIS_texture_color_mask_functions[] = {
- { TextureColorMaskSGIS_names, TextureColorMaskSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_texture_filter4)
-static const struct dri_extension_function GL_SGIS_texture_filter4_functions[] = {
- { GetTexFilterFuncSGIS_names, GetTexFilterFuncSGIS_remap_index, -1 },
- { TexFilterFuncSGIS_names, TexFilterFuncSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const struct dri_extension_function GL_SGIX_async_functions[] = {
- { AsyncMarkerSGIX_names, AsyncMarkerSGIX_remap_index, -1 },
- { FinishAsyncSGIX_names, FinishAsyncSGIX_remap_index, -1 },
- { PollAsyncSGIX_names, PollAsyncSGIX_remap_index, -1 },
- { DeleteAsyncMarkersSGIX_names, DeleteAsyncMarkersSGIX_remap_index, -1 },
- { IsAsyncMarkerSGIX_names, IsAsyncMarkerSGIX_remap_index, -1 },
- { GenAsyncMarkersSGIX_names, GenAsyncMarkersSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_flush_raster)
-static const struct dri_extension_function GL_SGIX_flush_raster_functions[] = {
- { FlushRasterSGIX_names, FlushRasterSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const struct dri_extension_function GL_SGIX_fragment_lighting_functions[] = {
- { FragmentMaterialfvSGIX_names, FragmentMaterialfvSGIX_remap_index, -1 },
- { FragmentLightModelivSGIX_names, FragmentLightModelivSGIX_remap_index, -1 },
- { FragmentLightiSGIX_names, FragmentLightiSGIX_remap_index, -1 },
- { GetFragmentMaterialfvSGIX_names, GetFragmentMaterialfvSGIX_remap_index, -1 },
- { FragmentMaterialfSGIX_names, FragmentMaterialfSGIX_remap_index, -1 },
- { GetFragmentLightivSGIX_names, GetFragmentLightivSGIX_remap_index, -1 },
- { FragmentLightModeliSGIX_names, FragmentLightModeliSGIX_remap_index, -1 },
- { FragmentLightivSGIX_names, FragmentLightivSGIX_remap_index, -1 },
- { GetFragmentMaterialivSGIX_names, GetFragmentMaterialivSGIX_remap_index, -1 },
- { FragmentLightModelfSGIX_names, FragmentLightModelfSGIX_remap_index, -1 },
- { FragmentColorMaterialSGIX_names, FragmentColorMaterialSGIX_remap_index, -1 },
- { FragmentMaterialiSGIX_names, FragmentMaterialiSGIX_remap_index, -1 },
- { LightEnviSGIX_names, LightEnviSGIX_remap_index, -1 },
- { FragmentLightModelfvSGIX_names, FragmentLightModelfvSGIX_remap_index, -1 },
- { FragmentLightfvSGIX_names, FragmentLightfvSGIX_remap_index, -1 },
- { FragmentLightfSGIX_names, FragmentLightfSGIX_remap_index, -1 },
- { GetFragmentLightfvSGIX_names, GetFragmentLightfvSGIX_remap_index, -1 },
- { FragmentMaterialivSGIX_names, FragmentMaterialivSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_framezoom)
-static const struct dri_extension_function GL_SGIX_framezoom_functions[] = {
- { FrameZoomSGIX_names, FrameZoomSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_igloo_interface)
-static const struct dri_extension_function GL_SGIX_igloo_interface_functions[] = {
- { IglooInterfaceSGIX_names, IglooInterfaceSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const struct dri_extension_function GL_SGIX_instruments_functions[] = {
- { ReadInstrumentsSGIX_names, ReadInstrumentsSGIX_remap_index, -1 },
- { PollInstrumentsSGIX_names, PollInstrumentsSGIX_remap_index, -1 },
- { GetInstrumentsSGIX_names, GetInstrumentsSGIX_remap_index, -1 },
- { StartInstrumentsSGIX_names, StartInstrumentsSGIX_remap_index, -1 },
- { StopInstrumentsSGIX_names, StopInstrumentsSGIX_remap_index, -1 },
- { InstrumentsBufferSGIX_names, InstrumentsBufferSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const struct dri_extension_function GL_SGIX_list_priority_functions[] = {
- { ListParameterfSGIX_names, ListParameterfSGIX_remap_index, -1 },
- { GetListParameterfvSGIX_names, GetListParameterfvSGIX_remap_index, -1 },
- { ListParameteriSGIX_names, ListParameteriSGIX_remap_index, -1 },
- { ListParameterfvSGIX_names, ListParameterfvSGIX_remap_index, -1 },
- { ListParameterivSGIX_names, ListParameterivSGIX_remap_index, -1 },
- { GetListParameterivSGIX_names, GetListParameterivSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_pixel_texture)
-static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = {
- { PixelTexGenSGIX_names, PixelTexGenSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = {
- { LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 },
- { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
- { DeformSGIX_names, DeformSGIX_remap_index, -1 },
- { DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_reference_plane)
-static const struct dri_extension_function GL_SGIX_reference_plane_functions[] = {
- { ReferencePlaneSGIX_names, ReferencePlaneSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const struct dri_extension_function GL_SGIX_sprite_functions[] = {
- { SpriteParameterfvSGIX_names, SpriteParameterfvSGIX_remap_index, -1 },
- { SpriteParameteriSGIX_names, SpriteParameteriSGIX_remap_index, -1 },
- { SpriteParameterfSGIX_names, SpriteParameterfSGIX_remap_index, -1 },
- { SpriteParameterivSGIX_names, SpriteParameterivSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_tag_sample_buffer)
-static const struct dri_extension_function GL_SGIX_tag_sample_buffer_functions[] = {
- { TagSampleBufferSGIX_names, TagSampleBufferSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const struct dri_extension_function GL_SGI_color_table_functions[] = {
- { ColorTableParameteriv_names, -1, 341 },
- { ColorTable_names, -1, 339 },
- { GetColorTable_names, -1, 343 },
- { CopyColorTable_names, -1, 342 },
- { ColorTableParameterfv_names, -1, 340 },
- { GetColorTableParameterfv_names, -1, 344 },
- { GetColorTableParameteriv_names, -1, 345 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUNX_constant_data)
-static const struct dri_extension_function GL_SUNX_constant_data_functions[] = {
- { FinishTextureSUNX_names, FinishTextureSUNX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const struct dri_extension_function GL_SUN_global_alpha_functions[] = {
- { GlobalAlphaFactorubSUN_names, GlobalAlphaFactorubSUN_remap_index, -1 },
- { GlobalAlphaFactoriSUN_names, GlobalAlphaFactoriSUN_remap_index, -1 },
- { GlobalAlphaFactordSUN_names, GlobalAlphaFactordSUN_remap_index, -1 },
- { GlobalAlphaFactoruiSUN_names, GlobalAlphaFactoruiSUN_remap_index, -1 },
- { GlobalAlphaFactorbSUN_names, GlobalAlphaFactorbSUN_remap_index, -1 },
- { GlobalAlphaFactorfSUN_names, GlobalAlphaFactorfSUN_remap_index, -1 },
- { GlobalAlphaFactorusSUN_names, GlobalAlphaFactorusSUN_remap_index, -1 },
- { GlobalAlphaFactorsSUN_names, GlobalAlphaFactorsSUN_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUN_mesh_array)
-static const struct dri_extension_function GL_SUN_mesh_array_functions[] = {
- { DrawMeshArraysSUN_names, DrawMeshArraysSUN_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const struct dri_extension_function GL_SUN_triangle_list_functions[] = {
- { ReplacementCodeubSUN_names, ReplacementCodeubSUN_remap_index, -1 },
- { ReplacementCodeubvSUN_names, ReplacementCodeubvSUN_remap_index, -1 },
- { ReplacementCodeusvSUN_names, ReplacementCodeusvSUN_remap_index, -1 },
- { ReplacementCodePointerSUN_names, ReplacementCodePointerSUN_remap_index, -1 },
- { ReplacementCodeusSUN_names, ReplacementCodeusSUN_remap_index, -1 },
- { ReplacementCodeuiSUN_names, ReplacementCodeuiSUN_remap_index, -1 },
- { ReplacementCodeuivSUN_names, ReplacementCodeuivSUN_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const struct dri_extension_function GL_SUN_vertex_functions[] = {
- { ReplacementCodeuiColor3fVertex3fvSUN_names, ReplacementCodeuiColor3fVertex3fvSUN_remap_index, -1 },
- { TexCoord4fColor4fNormal3fVertex4fvSUN_names, TexCoord4fColor4fNormal3fVertex4fvSUN_remap_index, -1 },
- { TexCoord2fColor4ubVertex3fvSUN_names, TexCoord2fColor4ubVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiVertex3fvSUN_names, ReplacementCodeuiVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiNormal3fVertex3fSUN_names, ReplacementCodeuiNormal3fVertex3fSUN_remap_index, -1 },
- { Color4ubVertex3fvSUN_names, Color4ubVertex3fvSUN_remap_index, -1 },
- { Color4ubVertex3fSUN_names, Color4ubVertex3fSUN_remap_index, -1 },
- { TexCoord2fVertex3fSUN_names, TexCoord2fVertex3fSUN_remap_index, -1 },
- { TexCoord2fColor4fNormal3fVertex3fSUN_names, TexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 },
- { TexCoord2fNormal3fVertex3fvSUN_names, TexCoord2fNormal3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fVertex3fSUN_names, ReplacementCodeuiTexCoord2fVertex3fSUN_remap_index, -1 },
- { TexCoord2fNormal3fVertex3fSUN_names, TexCoord2fNormal3fVertex3fSUN_remap_index, -1 },
- { Color3fVertex3fSUN_names, Color3fVertex3fSUN_remap_index, -1 },
- { Color3fVertex3fvSUN_names, Color3fVertex3fvSUN_remap_index, -1 },
- { Color4fNormal3fVertex3fvSUN_names, Color4fNormal3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_remap_index, -1 },
- { TexCoord2fColor3fVertex3fSUN_names, TexCoord2fColor3fVertex3fSUN_remap_index, -1 },
- { TexCoord4fColor4fNormal3fVertex4fSUN_names, TexCoord4fColor4fNormal3fVertex4fSUN_remap_index, -1 },
- { Color4ubVertex2fvSUN_names, Color4ubVertex2fvSUN_remap_index, -1 },
- { Normal3fVertex3fSUN_names, Normal3fVertex3fSUN_remap_index, -1 },
- { ReplacementCodeuiColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fSUN_remap_index, -1 },
- { TexCoord2fColor4fNormal3fVertex3fvSUN_names, TexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 },
- { TexCoord2fVertex3fvSUN_names, TexCoord2fVertex3fvSUN_remap_index, -1 },
- { Color4ubVertex2fSUN_names, Color4ubVertex2fSUN_remap_index, -1 },
- { ReplacementCodeuiColor4ubVertex3fSUN_names, ReplacementCodeuiColor4ubVertex3fSUN_remap_index, -1 },
- { TexCoord2fColor4ubVertex3fSUN_names, TexCoord2fColor4ubVertex3fSUN_remap_index, -1 },
- { Normal3fVertex3fvSUN_names, Normal3fVertex3fvSUN_remap_index, -1 },
- { Color4fNormal3fVertex3fSUN_names, Color4fNormal3fVertex3fSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 },
- { ReplacementCodeuiColor4ubVertex3fvSUN_names, ReplacementCodeuiColor4ubVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiColor3fVertex3fSUN_names, ReplacementCodeuiColor3fVertex3fSUN_remap_index, -1 },
- { TexCoord4fVertex4fSUN_names, TexCoord4fVertex4fSUN_remap_index, -1 },
- { TexCoord2fColor3fVertex3fvSUN_names, TexCoord2fColor3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiNormal3fVertex3fvSUN_names, ReplacementCodeuiNormal3fVertex3fvSUN_remap_index, -1 },
- { TexCoord4fVertex4fvSUN_names, TexCoord4fVertex4fvSUN_remap_index, -1 },
- { ReplacementCodeuiVertex3fSUN_names, ReplacementCodeuiVertex3fSUN_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const struct dri_extension_function GL_VERSION_1_3_functions[] = {
- { SampleCoverageARB_names, SampleCoverageARB_remap_index, -1 },
- { MultiTexCoord3sARB_names, -1, 398 },
- { ActiveTextureARB_names, -1, 374 },
- { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, -1 },
- { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, -1 },
- { MultiTexCoord1fvARB_names, -1, 379 },
- { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, -1 },
- { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, -1 },
- { MultiTexCoord3dARB_names, -1, 392 },
- { MultiTexCoord2iARB_names, -1, 388 },
- { MultiTexCoord2svARB_names, -1, 391 },
- { MultiTexCoord2fARB_names, -1, 386 },
- { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, -1 },
- { MultiTexCoord3fvARB_names, -1, 395 },
- { MultiTexCoord4sARB_names, -1, 406 },
- { MultiTexCoord2dvARB_names, -1, 385 },
- { MultiTexCoord1svARB_names, -1, 383 },
- { MultiTexCoord3svARB_names, -1, 399 },
- { MultiTexCoord4iARB_names, -1, 404 },
- { MultiTexCoord3iARB_names, -1, 396 },
- { MultiTexCoord1dARB_names, -1, 376 },
- { MultiTexCoord3dvARB_names, -1, 393 },
- { MultiTexCoord3ivARB_names, -1, 397 },
- { MultiTexCoord2sARB_names, -1, 390 },
- { MultiTexCoord4ivARB_names, -1, 405 },
- { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, -1 },
- { ClientActiveTextureARB_names, -1, 375 },
- { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, -1 },
- { MultiTexCoord2dARB_names, -1, 384 },
- { MultiTexCoord4dvARB_names, -1, 401 },
- { MultiTexCoord4fvARB_names, -1, 403 },
- { MultiTexCoord3fARB_names, -1, 394 },
- { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, -1 },
- { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, -1 },
- { MultiTexCoord4dARB_names, -1, 400 },
- { MultiTexCoord1sARB_names, -1, 382 },
- { MultiTexCoord1dvARB_names, -1, 377 },
- { MultiTexCoord1ivARB_names, -1, 381 },
- { MultiTexCoord2ivARB_names, -1, 389 },
- { MultiTexCoord1iARB_names, -1, 380 },
- { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, -1 },
- { MultiTexCoord4svARB_names, -1, 407 },
- { MultiTexCoord1fARB_names, -1, 378 },
- { MultiTexCoord4fARB_names, -1, 402 },
- { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, -1 },
- { MultiTexCoord2fvARB_names, -1, 387 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_VERSION_1_4)
-static const struct dri_extension_function GL_VERSION_1_4_functions[] = {
- { PointParameteriNV_names, PointParameteriNV_remap_index, -1 },
- { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, -1 },
- { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 },
- { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 },
- { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, -1 },
- { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 },
- { FogCoorddEXT_names, FogCoorddEXT_remap_index, -1 },
- { FogCoordfEXT_names, FogCoordfEXT_remap_index, -1 },
- { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 },
- { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 },
- { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 },
- { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 },
- { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, -1 },
- { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, -1 },
- { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, -1 },
- { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 },
- { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, -1 },
- { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, -1 },
- { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, -1 },
- { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 },
- { PointParameterivNV_names, PointParameterivNV_remap_index, -1 },
- { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 },
- { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, -1 },
- { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 },
- { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, -1 },
- { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 },
- { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 },
- { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, -1 },
- { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 },
- { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, -1 },
- { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, -1 },
- { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, -1 },
- { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 },
- { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, -1 },
- { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, -1 },
- { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, -1 },
- { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, -1 },
- { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, -1 },
- { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 },
- { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, -1 },
- { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 },
- { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, -1 },
- { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, -1 },
- { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 },
- { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_VERSION_1_5)
-static const struct dri_extension_function GL_VERSION_1_5_functions[] = {
- { BeginQueryARB_names, BeginQueryARB_remap_index, -1 },
- { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, -1 },
- { BufferSubDataARB_names, BufferSubDataARB_remap_index, -1 },
- { GetQueryivARB_names, GetQueryivARB_remap_index, -1 },
- { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, -1 },
- { BufferDataARB_names, BufferDataARB_remap_index, -1 },
- { EndQueryARB_names, EndQueryARB_remap_index, -1 },
- { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, -1 },
- { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, -1 },
- { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, -1 },
- { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, -1 },
- { IsQueryARB_names, IsQueryARB_remap_index, -1 },
- { MapBufferARB_names, MapBufferARB_remap_index, -1 },
- { GenQueriesARB_names, GenQueriesARB_remap_index, -1 },
- { IsBufferARB_names, IsBufferARB_remap_index, -1 },
- { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, -1 },
- { UnmapBufferARB_names, UnmapBufferARB_remap_index, -1 },
- { BindBufferARB_names, BindBufferARB_remap_index, -1 },
- { GenBuffersARB_names, GenBuffersARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
- { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, -1 },
- { GetProgramiv_names, GetProgramiv_remap_index, -1 },
- { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 },
- { AttachShader_names, AttachShader_remap_index, -1 },
- { VertexAttrib2fARB_names, VertexAttrib2fARB_remap_index, -1 },
- { VertexAttrib3fARB_names, VertexAttrib3fARB_remap_index, -1 },
- { Uniform2fARB_names, Uniform2fARB_remap_index, -1 },
- { VertexAttrib1svARB_names, VertexAttrib1svARB_remap_index, -1 },
- { Uniform2ivARB_names, Uniform2ivARB_remap_index, -1 },
- { UniformMatrix4fvARB_names, UniformMatrix4fvARB_remap_index, -1 },
- { VertexAttrib4NusvARB_names, VertexAttrib4NusvARB_remap_index, -1 },
- { DisableVertexAttribArrayARB_names, DisableVertexAttribArrayARB_remap_index, -1 },
- { StencilMaskSeparate_names, StencilMaskSeparate_remap_index, -1 },
- { VertexAttrib1fARB_names, VertexAttrib1fARB_remap_index, -1 },
- { GetProgramInfoLog_names, GetProgramInfoLog_remap_index, -1 },
- { VertexAttrib4NbvARB_names, VertexAttrib4NbvARB_remap_index, -1 },
- { GetActiveAttribARB_names, GetActiveAttribARB_remap_index, -1 },
- { Uniform3iARB_names, Uniform3iARB_remap_index, -1 },
- { GetShaderInfoLog_names, GetShaderInfoLog_remap_index, -1 },
- { VertexAttrib1sARB_names, VertexAttrib1sARB_remap_index, -1 },
- { Uniform1fARB_names, Uniform1fARB_remap_index, -1 },
- { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 },
- { UniformMatrix2fvARB_names, UniformMatrix2fvARB_remap_index, -1 },
- { VertexAttrib3dvARB_names, VertexAttrib3dvARB_remap_index, -1 },
- { Uniform3fvARB_names, Uniform3fvARB_remap_index, -1 },
- { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 },
- { CreateProgram_names, CreateProgram_remap_index, -1 },
- { StencilFuncSeparate_names, StencilFuncSeparate_remap_index, -1 },
- { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 },
- { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 },
- { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 },
- { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 },
- { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 },
- { GetActiveUniformARB_names, GetActiveUniformARB_remap_index, -1 },
- { IsShader_names, IsShader_remap_index, -1 },
- { GetUniformivARB_names, GetUniformivARB_remap_index, -1 },
- { IsProgram_names, IsProgram_remap_index, -1 },
- { Uniform2fvARB_names, Uniform2fvARB_remap_index, -1 },
- { ValidateProgramARB_names, ValidateProgramARB_remap_index, -1 },
- { VertexAttrib2dARB_names, VertexAttrib2dARB_remap_index, -1 },
- { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 },
- { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 },
- { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 },
- { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 },
- { Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 },
- { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 },
- { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 },
- { VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, -1 },
- { VertexAttrib4NivARB_names, VertexAttrib4NivARB_remap_index, -1 },
- { GetAttachedShaders_names, GetAttachedShaders_remap_index, -1 },
- { CompileShaderARB_names, CompileShaderARB_remap_index, -1 },
- { DeleteShader_names, DeleteShader_remap_index, -1 },
- { Uniform3fARB_names, Uniform3fARB_remap_index, -1 },
- { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 },
- { Uniform4fARB_names, Uniform4fARB_remap_index, -1 },
- { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 },
- { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 },
- { LinkProgramARB_names, LinkProgramARB_remap_index, -1 },
- { ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 },
- { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 },
- { Uniform4ivARB_names, Uniform4ivARB_remap_index, -1 },
- { GetVertexAttribdvARB_names, GetVertexAttribdvARB_remap_index, -1 },
- { Uniform1ivARB_names, Uniform1ivARB_remap_index, -1 },
- { VertexAttrib4dvARB_names, VertexAttrib4dvARB_remap_index, -1 },
- { BindAttribLocationARB_names, BindAttribLocationARB_remap_index, -1 },
- { Uniform1iARB_names, Uniform1iARB_remap_index, -1 },
- { VertexAttribPointerARB_names, VertexAttribPointerARB_remap_index, -1 },
- { VertexAttrib4NsvARB_names, VertexAttrib4NsvARB_remap_index, -1 },
- { VertexAttrib3fvARB_names, VertexAttrib3fvARB_remap_index, -1 },
- { CreateShader_names, CreateShader_remap_index, -1 },
- { DetachShader_names, DetachShader_remap_index, -1 },
- { VertexAttrib4NubARB_names, VertexAttrib4NubARB_remap_index, -1 },
- { Uniform4fvARB_names, Uniform4fvARB_remap_index, -1 },
- { GetUniformfvARB_names, GetUniformfvARB_remap_index, -1 },
- { Uniform4iARB_names, Uniform4iARB_remap_index, -1 },
- { UseProgramObjectARB_names, UseProgramObjectARB_remap_index, -1 },
- { DeleteProgram_names, DeleteProgram_remap_index, -1 },
- { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 },
- { Uniform2iARB_names, Uniform2iARB_remap_index, -1 },
- { VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, -1 },
- { GetUniformLocationARB_names, GetUniformLocationARB_remap_index, -1 },
- { VertexAttrib3sARB_names, VertexAttrib3sARB_remap_index, -1 },
- { GetShaderSourceARB_names, GetShaderSourceARB_remap_index, -1 },
- { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 },
- { Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 },
- { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 },
- { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 },
- { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 },
- { GetShaderiv_names, GetShaderiv_remap_index, -1 },
- { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 },
- { VertexAttrib4NubvARB_names, VertexAttrib4NubvARB_remap_index, -1 },
- { VertexAttrib2sARB_names, VertexAttrib2sARB_remap_index, -1 },
- { VertexAttrib1fvARB_names, VertexAttrib1fvARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_VERSION_2_1)
-static const struct dri_extension_function GL_VERSION_2_1_functions[] = {
- { UniformMatrix2x4fv_names, UniformMatrix2x4fv_remap_index, -1 },
- { UniformMatrix4x3fv_names, UniformMatrix4x3fv_remap_index, -1 },
- { UniformMatrix4x2fv_names, UniformMatrix4x2fv_remap_index, -1 },
- { UniformMatrix2x3fv_names, UniformMatrix2x3fv_remap_index, -1 },
- { UniformMatrix3x4fv_names, UniformMatrix3x4fv_remap_index, -1 },
- { UniformMatrix3x2fv_names, UniformMatrix3x2fv_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp2.h b/mesalib/src/mesa/drivers/dri/common/spantmp2.h
index 89c815722..447f3d15b 100644
--- a/mesalib/src/mesa/drivers/dri/common/spantmp2.h
+++ b/mesalib/src/mesa/drivers/dri/common/spantmp2.h
@@ -82,6 +82,72 @@
rgba[3] = 0xff; \
} while (0)
+#elif (SPANTMP_PIXEL_FMT == GL_RGB) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5_REV)
+
+/**
+ ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+ p = PACK_COLOR_565_REV( color[0], color[1], color[2] )
+
+#define WRITE_RGBA( _x, _y, r, g, b, a ) \
+ PUT_VALUE(_x, _y, PACK_COLOR_565_REV( r, g, b ))
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLushort p = GET_VALUE(_x, _y); \
+ p = p << 8 | p >> 8; \
+ rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
+ rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
+ rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
+ rgba[3] = 0xff; \
+ } while (0)
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+ p = PACK_COLOR_4444_REV(color[3], color[0], color[1], color[2])
+
+#define WRITE_RGBA( _x, _y, r, g, b, a ) \
+ PUT_VALUE(_x, _y, PACK_COLOR_4444_REV(a, r, g, b)) \
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLushort p = GET_VALUE(_x, _y); \
+ rgba[0] = ((p >> 0) & 0xf) * 0x11; \
+ rgba[1] = ((p >> 12) & 0xf) * 0x11; \
+ rgba[2] = ((p >> 4) & 0xf) * 0x11; \
+ rgba[3] = ((p >> 8) & 0xf) * 0x11; \
+ } while (0)
+
+
#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4_REV)
/**
@@ -147,6 +213,39 @@
rgba[3] = ((p >> 15) & 0x1) * 0xff; \
} while (0)
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+#define INIT_MONO_PIXEL(p, color) \
+ p = PACK_COLOR_1555_REV(color[3], color[0], color[1], color[2])
+
+#define WRITE_RGBA( _x, _y, r, g, b, a ) \
+ PUT_VALUE(_x, _y, PACK_COLOR_1555_REV(a, r, g, b)) \
+
+#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
+
+#define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLushort p = GET_VALUE(_x, _y); \
+ p = p << 8 | p >> 8; \
+ rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8; \
+ rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8; \
+ rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
+ rgba[3] = ((p >> 15) & 0x1) * 0xff; \
+ } while (0)
+
#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
/**
@@ -202,6 +301,118 @@
} while (0)
# endif
+#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8)
+
+/**
+ ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color) \
+ p = PACK_COLOR_8888(color[2], color[1], color[0], color[3])
+
+# define WRITE_RGBA(_x, _y, r, g, b, a) \
+ PUT_VALUE(_x, _y, ((r << 8) | \
+ (g << 16) | \
+ (b << 24) | \
+ (a << 0)))
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+# if defined( USE_X86_ASM )
+# define READ_RGBA(rgba, _x, _y) \
+ do { \
+ GLuint p = GET_VALUE(_x, _y); \
+ __asm__ __volatile__( "rorl $8, %0" \
+ : "=r" (p) : "0" (p) ); \
+ ((GLuint *)rgba)[0] = p; \
+ } while (0)
+# elif defined( MESA_BIG_ENDIAN )
+ /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
+ * rotlwi instruction. It also produces good code on SPARC.
+ */
+# define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLuint p = CPU_TO_LE32(GET_VALUE(_x, _y)); \
+ GLuint t = p; \
+ *((uint32_t *) rgba) = (t >> 24) | (p << 8); \
+ } while (0)
+# else
+# define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLuint p = GET_VALUE(_x, _y); \
+ rgba[0] = (p >> 8) & 0xff; \
+ rgba[1] = (p >> 16) & 0xff; \
+ rgba[2] = (p >> 24) & 0xff; \
+ rgba[3] = (p >> 0) & 0xff; \
+ } while (0)
+# endif
+
+#elif (SPANTMP_PIXEL_FMT == GL_BGR) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
+
+/**
+ ** GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV
+ **
+ ** This is really for MESA_FORMAT_XRGB8888. The spantmp code needs to be
+ ** kicked to the curb, and we need to just code-gen this.
+ **/
+
+#ifndef GET_VALUE
+#ifndef GET_PTR
+#define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch)
+#endif
+
+#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
+#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
+#endif /* GET_VALUE */
+
+# define INIT_MONO_PIXEL(p, color) \
+ p = PACK_COLOR_8888(0xff, color[0], color[1], color[2])
+
+# define WRITE_RGBA(_x, _y, r, g, b, a) \
+ PUT_VALUE(_x, _y, ((r << 16) | \
+ (g << 8) | \
+ (b << 0) | \
+ (0xff << 24)))
+
+#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
+
+# if defined( USE_X86_ASM )
+# define READ_RGBA(rgba, _x, _y) \
+ do { \
+ GLuint p = GET_VALUE(_x, _y); \
+ __asm__ __volatile__( "bswap %0; rorl $8, %0" \
+ : "=r" (p) : "0" (p) ); \
+ ((GLuint *)rgba)[0] = p | 0xff000000; \
+ } while (0)
+# elif defined( MESA_BIG_ENDIAN )
+ /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
+ * rotlwi instruction. It also produces good code on SPARC.
+ */
+# define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLuint p = GET_VALUE(_x, _y); \
+ *((uint32_t *) rgba) = (t << 8) | 0xff; \
+ } while (0)
+# else
+# define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLuint p = GET_VALUE(_x, _y); \
+ rgba[0] = (p >> 16) & 0xff; \
+ rgba[1] = (p >> 8) & 0xff; \
+ rgba[2] = (p >> 0) & 0xff; \
+ rgba[3] = 0xff; \
+ } while (0)
+# endif
+
#else
#error SPANTMP_PIXEL_FMT must be set to a valid value!
#endif
diff --git a/mesalib/src/mesa/drivers/dri/common/texmem.c b/mesalib/src/mesa/drivers/dri/common/texmem.c
index b64618a03..895139b55 100644
--- a/mesalib/src/mesa/drivers/dri/common/texmem.c
+++ b/mesalib/src/mesa/drivers/dri/common/texmem.c
@@ -42,14 +42,10 @@
* application.
*/
-#include "texmem.h"
-#include "main/simple_list.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "main/texformat.h"
-
-#include <assert.h>
-
+#include "main/simple_list.h"
+#include "texmem.h"
static unsigned dummy_swap_counter;
@@ -1302,46 +1298,44 @@ driCalculateTextureFirstLastLevel( driTextureObject * t )
/**
- * \name DRI texture formats. Pointers initialized to either the big- or
- * little-endian Mesa formats.
+ * \name DRI texture formats. These vars are initialized to either the
+ * big- or little-endian Mesa formats.
*/
/*@{*/
-const struct gl_texture_format *_dri_texformat_rgba8888 = NULL;
-const struct gl_texture_format *_dri_texformat_argb8888 = NULL;
-const struct gl_texture_format *_dri_texformat_rgb565 = NULL;
-const struct gl_texture_format *_dri_texformat_argb4444 = NULL;
-const struct gl_texture_format *_dri_texformat_argb1555 = NULL;
-const struct gl_texture_format *_dri_texformat_al88 = NULL;
-const struct gl_texture_format *_dri_texformat_a8 = &_mesa_texformat_a8;
-const struct gl_texture_format *_dri_texformat_ci8 = &_mesa_texformat_ci8;
-const struct gl_texture_format *_dri_texformat_i8 = &_mesa_texformat_i8;
-const struct gl_texture_format *_dri_texformat_l8 = &_mesa_texformat_l8;
+gl_format _dri_texformat_rgba8888 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_argb8888 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_rgb565 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_argb4444 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_argb1555 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_al88 = MESA_FORMAT_NONE;
+gl_format _dri_texformat_a8 = MESA_FORMAT_A8;
+gl_format _dri_texformat_ci8 = MESA_FORMAT_CI8;
+gl_format _dri_texformat_i8 = MESA_FORMAT_I8;
+gl_format _dri_texformat_l8 = MESA_FORMAT_L8;
/*@}*/
/**
- * Initialize little endian target, host byte order independent texture formats
+ * Initialize _dri_texformat_* vars according to whether we're on
+ * a big or little endian system.
*/
void
driInitTextureFormats(void)
{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- if (littleEndian) {
- _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888;
- _dri_texformat_argb8888 = &_mesa_texformat_argb8888;
- _dri_texformat_rgb565 = &_mesa_texformat_rgb565;
- _dri_texformat_argb4444 = &_mesa_texformat_argb4444;
- _dri_texformat_argb1555 = &_mesa_texformat_argb1555;
- _dri_texformat_al88 = &_mesa_texformat_al88;
+ if (_mesa_little_endian()) {
+ _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888;
+ _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888;
+ _dri_texformat_rgb565 = MESA_FORMAT_RGB565;
+ _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444;
+ _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555;
+ _dri_texformat_al88 = MESA_FORMAT_AL88;
}
else {
- _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888_rev;
- _dri_texformat_argb8888 = &_mesa_texformat_argb8888_rev;
- _dri_texformat_rgb565 = &_mesa_texformat_rgb565_rev;
- _dri_texformat_argb4444 = &_mesa_texformat_argb4444_rev;
- _dri_texformat_argb1555 = &_mesa_texformat_argb1555_rev;
- _dri_texformat_al88 = &_mesa_texformat_al88_rev;
+ _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888_REV;
+ _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888_REV;
+ _dri_texformat_rgb565 = MESA_FORMAT_RGB565_REV;
+ _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444_REV;
+ _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555_REV;
+ _dri_texformat_al88 = MESA_FORMAT_AL88_REV;
}
}
diff --git a/mesalib/src/mesa/drivers/dri/common/texmem.h b/mesalib/src/mesa/drivers/dri/common/texmem.h
index 9c065da8b..725ba2e11 100644
--- a/mesalib/src/mesa/drivers/dri/common/texmem.h
+++ b/mesalib/src/mesa/drivers/dri/common/texmem.h
@@ -39,6 +39,7 @@
#define DRI_TEXMEM_H
#include "main/mtypes.h"
+#include "main/formats.h"
#include "main/mm.h"
#include "xf86drm.h"
@@ -317,16 +318,16 @@ GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps,
extern void driCalculateTextureFirstLastLevel( driTextureObject * t );
-extern const struct gl_texture_format *_dri_texformat_rgba8888;
-extern const struct gl_texture_format *_dri_texformat_argb8888;
-extern const struct gl_texture_format *_dri_texformat_rgb565;
-extern const struct gl_texture_format *_dri_texformat_argb4444;
-extern const struct gl_texture_format *_dri_texformat_argb1555;
-extern const struct gl_texture_format *_dri_texformat_al88;
-extern const struct gl_texture_format *_dri_texformat_a8;
-extern const struct gl_texture_format *_dri_texformat_ci8;
-extern const struct gl_texture_format *_dri_texformat_i8;
-extern const struct gl_texture_format *_dri_texformat_l8;
+extern gl_format _dri_texformat_rgba8888;
+extern gl_format _dri_texformat_argb8888;
+extern gl_format _dri_texformat_rgb565;
+extern gl_format _dri_texformat_argb4444;
+extern gl_format _dri_texformat_argb1555;
+extern gl_format _dri_texformat_al88;
+extern gl_format _dri_texformat_a8;
+extern gl_format _dri_texformat_ci8;
+extern gl_format _dri_texformat_i8;
+extern gl_format _dri_texformat_l8;
extern void driInitTextureFormats( void );
diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c
index 66f277c10..b272eb74e 100644
--- a/mesalib/src/mesa/drivers/dri/common/utils.c
+++ b/mesalib/src/mesa/drivers/dri/common/utils.c
@@ -38,9 +38,6 @@
#include "utils.h"
-int driDispatchRemapTable[ driDispatchRemapTable_size ];
-
-
unsigned
driParseDebugString( const char * debug,
const struct dri_debug_control * control )
@@ -142,7 +139,7 @@ driGetRendererString( char * buffer, const char * hardware_name,
#define need_GL_EXT_blend_func_separate
#define need_GL_NV_vertex_program
-#include "extension_helper.h"
+#include "main/remap_helper.h"
static const struct dri_extension all_mesa_extensions[] = {
{ "GL_ARB_draw_buffers", GL_ARB_draw_buffers_functions },
@@ -165,8 +162,12 @@ static const struct dri_extension all_mesa_extensions[] = {
/**
- * Enable extensions supported by the driver.
+ * Enable and map extensions supported by the driver.
*
+ * When ctx is NULL, extensions are not enabled, but their functions
+ * are still mapped. When extensions_to_enable is NULL, all static
+ * functions known to mesa core are mapped.
+ *
* \bug
* ARB_imaging isn't handled properly. In Mesa, enabling ARB_imaging also
* enables all the sub-extensions that are folded into it. This means that
@@ -181,18 +182,23 @@ void driInitExtensions( GLcontext * ctx,
unsigned i;
if ( first_time ) {
- for ( i = 0 ; i < driDispatchRemapTable_size ; i++ ) {
- driDispatchRemapTable[i] = -1;
- }
-
first_time = 0;
- driInitExtensions( ctx, all_mesa_extensions, GL_FALSE );
+ driInitExtensions( NULL, all_mesa_extensions, GL_FALSE );
}
if ( (ctx != NULL) && enable_imaging ) {
_mesa_enable_imaging_extensions( ctx );
}
+ /* The caller is too lazy to list any extension */
+ if ( extensions_to_enable == NULL ) {
+ /* Map the static functions. Together with those mapped by remap
+ * table, this should cover everything mesa core knows.
+ */
+ _mesa_map_static_functions();
+ return;
+ }
+
for ( i = 0 ; extensions_to_enable[i].name != NULL ; i++ ) {
driInitSingleExtension( ctx, & extensions_to_enable[i] );
}
@@ -202,80 +208,18 @@ void driInitExtensions( GLcontext * ctx,
/**
- * Enable and add dispatch functions for a single extension
+ * Enable and map functions for a single extension
*
* \param ctx Context where extension is to be enabled.
* \param ext Extension that is to be enabled.
*
- * \sa driInitExtensions, _mesa_enable_extension, _glapi_add_entrypoint
- *
- * \todo
- * Determine if it would be better to use \c strlen instead of the hardcoded
- * for-loops.
+ * \sa driInitExtensions, _mesa_enable_extension, _mesa_map_function_array
*/
void driInitSingleExtension( GLcontext * ctx,
const struct dri_extension * ext )
{
- unsigned i;
-
-
if ( ext->functions != NULL ) {
- for ( i = 0 ; ext->functions[i].strings != NULL ; i++ ) {
- const char * functions[16];
- const char * parameter_signature;
- const char * str = ext->functions[i].strings;
- unsigned j;
- unsigned offset;
-
-
- /* Separate the parameter signature from the rest of the string.
- * If the parameter signature is empty (i.e., the string starts
- * with a NUL character), then the function has a void parameter
- * list.
- */
- parameter_signature = str;
- while ( str[0] != '\0' ) {
- str++;
- }
- str++;
-
-
- /* Divide the string into the substrings that name each
- * entry-point for the function.
- */
- for ( j = 0 ; j < 16 ; j++ ) {
- if ( str[0] == '\0' ) {
- functions[j] = NULL;
- break;
- }
-
- functions[j] = str;
-
- while ( str[0] != '\0' ) {
- str++;
- }
- str++;
- }
-
-
- /* Add each entry-point to the dispatch table.
- */
- offset = _glapi_add_dispatch( functions, parameter_signature );
- if (offset == -1) {
-#if 0 /* this causes noise with egl */
- fprintf(stderr, "DISPATCH ERROR! _glapi_add_dispatch failed "
- "to add %s!\n", functions[0]);
-#endif
- }
- else if (ext->functions[i].remap_index != -1) {
- driDispatchRemapTable[ ext->functions[i].remap_index ] =
- offset;
- }
- else if (ext->functions[i].offset != offset) {
- fprintf(stderr, "DISPATCH ERROR! %s -> %u != %u\n",
- functions[0], offset, ext->functions[i].offset);
- }
- }
+ _mesa_map_function_array(ext->functions);
}
if ( ctx != NULL ) {
diff --git a/mesalib/src/mesa/drivers/dri/common/utils.h b/mesalib/src/mesa/drivers/dri/common/utils.h
index 9e9e5bc22..2aa6de66c 100644
--- a/mesalib/src/mesa/drivers/dri/common/utils.h
+++ b/mesalib/src/mesa/drivers/dri/common/utils.h
@@ -31,6 +31,7 @@
#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
#include "main/context.h"
+#include "main/remap.h"
typedef struct __DRIutilversionRec2 __DRIutilversion2;
@@ -40,35 +41,6 @@ struct dri_debug_control {
};
/**
- * Description of the entry-points and parameters for an OpenGL function.
- */
-struct dri_extension_function {
- /**
- * \brief
- * Packed string describing the parameter signature and the entry-point
- * names.
- *
- * The parameter signature and the names of the entry-points for this
- * function are packed into a single string. The substrings are
- * separated by NUL characters. The whole string is terminated by
- * two consecutive NUL characters.
- */
- const char * strings;
-
-
- /**
- * Location in the remap table where the dispatch offset should be
- * stored.
- */
- int remap_index;
-
- /**
- * Offset of the function in the dispatch table.
- */
- int offset;
-};
-
-/**
* Description of the API for an extension to OpenGL.
*/
struct dri_extension {
@@ -83,7 +55,7 @@ struct dri_extension {
* is terminated by a structure with a \c NULL
* \c dri_extension_function::strings pointer.
*/
- const struct dri_extension_function * functions;
+ const struct gl_function_remap * functions;
};
/**
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py b/mesalib/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
deleted file mode 100644
index 7398c4cd0..000000000
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import gettext
-import re
-
-# List of supported languages
-languages = sys.argv[1:]
-
-# Escape special characters in C strings
-def escapeCString (s):
- escapeSeqs = {'\a' : '\\a', '\b' : '\\b', '\f' : '\\f', '\n' : '\\n',
- '\r' : '\\r', '\t' : '\\t', '\v' : '\\v', '\\' : '\\\\'}
- # " -> '' is a hack. Quotes (") aren't possible in XML attributes.
- # Better use Unicode characters for typographic quotes in option
- # descriptions and translations.
- i = 0
- r = ''
- while i < len(s):
- # Special case: escape double quote with \u201c or \u201d, depending
- # on whether it's an open or close quote. This is needed because plain
- # double quotes are not possible in XML attributes.
- if s[i] == '"':
- if i == len(s)-1 or s[i+1].isspace():
- # close quote
- q = u'\u201c'
- else:
- # open quote
- q = u'\u201d'
- r = r + q
- elif escapeSeqs.has_key(s[i]):
- r = r + escapeSeqs[s[i]]
- else:
- r = r + s[i]
- i = i + 1
- return r
-
-# Expand escape sequences in C strings (needed for gettext lookup)
-def expandCString (s):
- escapeSeqs = {'a' : '\a', 'b' : '\b', 'f' : '\f', 'n' : '\n',
- 'r' : '\r', 't' : '\t', 'v' : '\v',
- '"' : '"', '\\' : '\\'}
- i = 0
- escape = False
- hexa = False
- octa = False
- num = 0
- digits = 0
- r = ''
- while i < len(s):
- if not escape:
- if s[i] == '\\':
- escape = True
- else:
- r = r + s[i]
- elif hexa:
- if (s[i] >= '0' and s[i] <= '9') or \
- (s[i] >= 'a' and s[i] <= 'f') or \
- (s[i] >= 'A' and s[i] <= 'F'):
- num = num * 16 + int(s[i],16)
- digits = digits + 1
- else:
- digits = 2
- if digits >= 2:
- hexa = False
- escape = False
- r = r + chr(num)
- elif octa:
- if s[i] >= '0' and s[i] <= '7':
- num = num * 8 + int(s[i],8)
- digits = digits + 1
- else:
- digits = 3
- if digits >= 3:
- octa = False
- escape = False
- r = r + chr(num)
- else:
- if escapeSeqs.has_key(s[i]):
- r = r + escapeSeqs[s[i]]
- escape = False
- elif s[i] >= '0' and s[i] <= '7':
- octa = True
- num = int(s[i],8)
- if num <= 3:
- digits = 1
- else:
- digits = 2
- elif s[i] == 'x' or s[i] == 'X':
- hexa = True
- num = 0
- digits = 0
- else:
- r = r + s[i]
- escape = False
- i = i + 1
- return r
-
-# Expand matches. The first match is always a DESC or DESC_BEGIN match.
-# Subsequent matches are ENUM matches.
-#
-# DESC, DESC_BEGIN format: \1 \2=<lang> \3 \4=gettext(" \5=<text> \6=") \7
-# ENUM format: \1 \2=gettext(" \3=<text> \4=") \5
-def expandMatches (matches, translations, end=None):
- assert len(matches) > 0
- nTranslations = len(translations)
- i = 0
- # Expand the description+enums for all translations
- for lang,trans in translations:
- i = i + 1
- # Make sure that all but the last line of a simple description
- # are extended with a backslash.
- suffix = ''
- if len(matches) == 1 and i < len(translations) and \
- not matches[0].expand (r'\7').endswith('\\'):
- suffix = ' \\'
- # Expand the description line. Need to use ugettext in order to allow
- # non-ascii unicode chars in the original English descriptions.
- text = escapeCString (trans.ugettext (unicode (expandCString (
- matches[0].expand (r'\5')), "utf-8"))).encode("utf-8")
- print matches[0].expand (r'\1' + lang + r'\3"' + text + r'"\7') + suffix
- # Expand any subsequent enum lines
- for match in matches[1:]:
- text = escapeCString (trans.ugettext (unicode (expandCString (
- match.expand (r'\3')), "utf-8"))).encode("utf-8")
- print match.expand (r'\1"' + text + r'"\5')
-
- # Expand description end
- if end:
- print end,
-
-# Compile a list of translation classes to all supported languages.
-# The first translation is always a NullTranslations.
-translations = [("en", gettext.NullTranslations())]
-for lang in languages:
- try:
- trans = gettext.translation ("options", ".", [lang])
- except IOError:
- sys.stderr.write ("Warning: language '%s' not found.\n" % lang)
- continue
- translations.append ((lang, trans))
-
-# Regular expressions:
-reLibintl_h = re.compile (r'#\s*include\s*<libintl.h>')
-reDESC = re.compile (r'(\s*DRI_CONF_DESC\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
-reDESC_BEGIN = re.compile (r'(\s*DRI_CONF_DESC_BEGIN\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
-reENUM = re.compile (r'(\s*DRI_CONF_ENUM\s*\([^,]+,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
-reDESC_END = re.compile (r'\s*DRI_CONF_DESC_END')
-
-# Print a header
-print \
-"/***********************************************************************\n" \
-" *** THIS FILE IS GENERATED AUTOMATICALLY. DON'T EDIT! ***\n" \
-" ***********************************************************************/"
-
-# Process the options template and generate options.h with all
-# translations.
-template = file ("t_options.h", "r")
-descMatches = []
-for line in template:
- if len(descMatches) > 0:
- matchENUM = reENUM .match (line)
- matchDESC_END = reDESC_END.match (line)
- if matchENUM:
- descMatches.append (matchENUM)
- elif matchDESC_END:
- expandMatches (descMatches, translations, line)
- descMatches = []
- else:
- sys.stderr.write (
- "Warning: unexpected line inside description dropped:\n%s\n" \
- % line)
- continue
- if reLibintl_h.search (line):
- # Ignore (comment out) #include <libintl.h>
- print "/* %s * commented out by gen_xmlpool.py */" % line
- continue
- matchDESC = reDESC .match (line)
- matchDESC_BEGIN = reDESC_BEGIN.match (line)
- if matchDESC:
- assert len(descMatches) == 0
- expandMatches ([matchDESC], translations)
- elif matchDESC_BEGIN:
- assert len(descMatches) == 0
- descMatches = [matchDESC_BEGIN]
- else:
- print line,
-
-if len(descMatches) > 0:
- sys.stderr.write ("Warning: unterminated description at end of file.\n")
- expandMatches (descMatches, translations)
diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile b/mesalib/src/mesa/drivers/dri/swrast/Makefile
index 5f3a4f219..771169c1f 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/Makefile
+++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile
@@ -21,4 +21,3 @@ SWRAST_COMMON_SOURCES = \
include ../Makefile.template
-symlinks:
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index a858af30c..8340861af 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -33,6 +33,7 @@
#include "main/context.h"
#include "main/extensions.h"
+#include "main/formats.h"
#include "main/framebuffer.h"
#include "main/imports.h"
#include "main/renderbuffer.h"
@@ -43,78 +44,12 @@
#include "tnl/t_pipeline.h"
#include "vbo/vbo.h"
#include "drivers/common/driverfuncs.h"
+#include "drivers/common/meta.h"
#include "utils.h"
#include "swrast_priv.h"
-#define need_GL_VERSION_1_3
-#define need_GL_VERSION_1_4
-#define need_GL_VERSION_1_5
-#define need_GL_VERSION_2_0
-#define need_GL_VERSION_2_1
-
-/* sw extensions for imaging */
-#define need_GL_EXT_blend_color
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_convolution
-#define need_GL_EXT_histogram
-#define need_GL_SGI_color_table
-
-/* sw extensions not associated with some GL version */
-#define need_GL_ARB_shader_objects
-#define need_GL_ARB_vertex_array_object
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_sync
-#define need_GL_APPLE_vertex_array_object
-#define need_GL_ATI_fragment_shader
-#define need_GL_ATI_separate_stencil
-#define need_GL_EXT_depth_bounds_test
-#define need_GL_EXT_framebuffer_object
-#define need_GL_EXT_framebuffer_blit
-#define need_GL_EXT_gpu_program_parameters
-#define need_GL_EXT_paletted_texture
-#define need_GL_EXT_stencil_two_side
-#define need_GL_MESA_resize_buffers
-#define need_GL_NV_vertex_program
-#define need_GL_NV_fragment_program
-
-#include "extension_helper.h"
-
-const struct dri_extension card_extensions[] =
-{
- { "GL_VERSION_1_3", GL_VERSION_1_3_functions },
- { "GL_VERSION_1_4", GL_VERSION_1_4_functions },
- { "GL_VERSION_1_5", GL_VERSION_1_5_functions },
- { "GL_VERSION_2_0", GL_VERSION_2_0_functions },
- { "GL_VERSION_2_1", GL_VERSION_2_1_functions },
-
- { "GL_EXT_blend_color", GL_EXT_blend_color_functions },
- { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions },
- { "GL_EXT_convolution", GL_EXT_convolution_functions },
- { "GL_EXT_histogram", GL_EXT_histogram_functions },
- { "GL_SGI_color_table", GL_SGI_color_table_functions },
-
- { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
- { "GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions },
- { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
- { "GL_ARB_sync", GL_ARB_sync_functions },
- { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions },
- { "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions },
- { "GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions },
- { "GL_EXT_depth_bounds_test", GL_EXT_depth_bounds_test_functions },
- { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
- { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions },
- { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions },
- { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions },
- { "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions },
- { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions },
- { "GL_NV_vertex_program", GL_NV_vertex_program_functions },
- { "GL_NV_fragment_program", GL_NV_fragment_program_functions },
- { NULL, NULL }
-};
-
-
/**
* Screen and config-related functions
*/
@@ -238,7 +173,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
*driver_configs = (const __DRIconfig **)
driConcatConfigs(configs24, configs32);
- driInitExtensions( NULL, card_extensions, GL_FALSE );
+ driInitExtensions( NULL, NULL, GL_FALSE );
return psp;
}
@@ -372,50 +307,38 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
switch (pixel_format) {
case PF_A8R8G8B8:
+ xrb->Base.Format = MESA_FORMAT_ARGB8888;
xrb->Base.InternalFormat = GL_RGBA;
xrb->Base._BaseFormat = GL_RGBA;
xrb->Base.DataType = GL_UNSIGNED_BYTE;
- xrb->Base.RedBits = 8 * sizeof(GLubyte);
- xrb->Base.GreenBits = 8 * sizeof(GLubyte);
- xrb->Base.BlueBits = 8 * sizeof(GLubyte);
- xrb->Base.AlphaBits = 8 * sizeof(GLubyte);
xrb->bpp = 32;
break;
case PF_X8R8G8B8:
+ xrb->Base.Format = MESA_FORMAT_ARGB8888; /* XXX */
xrb->Base.InternalFormat = GL_RGB;
xrb->Base._BaseFormat = GL_RGB;
xrb->Base.DataType = GL_UNSIGNED_BYTE;
- xrb->Base.RedBits = 8 * sizeof(GLubyte);
- xrb->Base.GreenBits = 8 * sizeof(GLubyte);
- xrb->Base.BlueBits = 8 * sizeof(GLubyte);
- xrb->Base.AlphaBits = 0;
xrb->bpp = 32;
break;
case PF_R5G6B5:
+ xrb->Base.Format = MESA_FORMAT_RGB565;
xrb->Base.InternalFormat = GL_RGB;
xrb->Base._BaseFormat = GL_RGB;
xrb->Base.DataType = GL_UNSIGNED_BYTE;
- xrb->Base.RedBits = 5 * sizeof(GLubyte);
- xrb->Base.GreenBits = 6 * sizeof(GLubyte);
- xrb->Base.BlueBits = 5 * sizeof(GLubyte);
- xrb->Base.AlphaBits = 0;
xrb->bpp = 16;
break;
case PF_R3G3B2:
+ xrb->Base.Format = MESA_FORMAT_RGB332;
xrb->Base.InternalFormat = GL_RGB;
xrb->Base._BaseFormat = GL_RGB;
xrb->Base.DataType = GL_UNSIGNED_BYTE;
- xrb->Base.RedBits = 3 * sizeof(GLubyte);
- xrb->Base.GreenBits = 3 * sizeof(GLubyte);
- xrb->Base.BlueBits = 2 * sizeof(GLubyte);
- xrb->Base.AlphaBits = 0;
xrb->bpp = 8;
break;
case PF_CI8:
+ xrb->Base.Format = MESA_FORMAT_CI8;
xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT;
xrb->Base._BaseFormat = GL_COLOR_INDEX;
xrb->Base.DataType = GL_UNSIGNED_BYTE;
- xrb->Base.IndexBits = 8 * sizeof(GLubyte);
xrb->bpp = 8;
break;
default:
@@ -645,6 +568,8 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
_mesa_enable_2_0_extensions(mesaCtx);
_mesa_enable_2_1_extensions(mesaCtx);
+ _mesa_meta_init(mesaCtx);
+
return ctx;
}
@@ -656,6 +581,7 @@ driDestroyContext(__DRIcontext *ctx)
if (ctx) {
mesaCtx = &ctx->Base;
+ _mesa_meta_free(mesaCtx);
_swsetup_DestroyContext( mesaCtx );
_swrast_DestroyContext( mesaCtx );
_tnl_DestroyContext( mesaCtx );
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
index 2d3c25dcb..f8e503463 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
@@ -63,56 +63,42 @@ static const GLubyte kernel[16] = {
/* 32-bit BGRA */
#define STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE) \
- DST[3] = VALUE[ACOMP]; \
- DST[2] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[0] = VALUE[BCOMP]
+ *DST = VALUE[ACOMP] << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
#define STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE) \
- DST[3] = 0xff; \
- DST[2] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[0] = VALUE[BCOMP]
+ *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
#define FETCH_PIXEL_A8R8G8B8(DST, SRC) \
- DST[ACOMP] = SRC[3]; \
- DST[RCOMP] = SRC[2]; \
- DST[GCOMP] = SRC[1]; \
- DST[BCOMP] = SRC[0]
+ DST[ACOMP] = *SRC >> 24; \
+ DST[RCOMP] = (*SRC >> 16) & 0xff; \
+ DST[GCOMP] = (*SRC >> 8) & 0xff; \
+ DST[BCOMP] = *SRC & 0xff
/* 32-bit BGRX */
#define STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) \
- DST[3] = 0xff; \
- DST[2] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[0] = VALUE[BCOMP]
+ *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
#define STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE) \
- DST[3] = 0xff; \
- DST[2] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[0] = VALUE[BCOMP]
+ *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
#define FETCH_PIXEL_X8R8G8B8(DST, SRC) \
- DST[ACOMP] = 0xff; \
- DST[RCOMP] = SRC[2]; \
- DST[GCOMP] = SRC[1]; \
- DST[BCOMP] = SRC[0]
+ DST[ACOMP] = 0xff; \
+ DST[RCOMP] = (*SRC >> 16) & 0xff; \
+ DST[GCOMP] = (*SRC >> 8) & 0xff; \
+ DST[BCOMP] = *SRC & 0xff
/* 16-bit BGR */
#define STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) \
do { \
int d = DITHER_COMP(X, Y) >> 6; \
- GLushort *p = (GLushort *)DST; \
- *p = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xf8) << 8) | \
- ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xfc) << 3) | \
- ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xf8) >> 3) ); \
+ *DST = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xf8) << 8) | \
+ ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xfc) << 3) | \
+ ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xf8) >> 3) ); \
} while(0)
#define FETCH_PIXEL_R5G6B5(DST, SRC) \
do { \
- GLushort p = *(GLushort *)SRC; \
DST[ACOMP] = 0xff; \
- DST[RCOMP] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
- DST[GCOMP] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
- DST[BCOMP] = ((p << 3) & 0xf8) * 255 / 0xf8; \
+ DST[RCOMP] = ((*SRC >> 8) & 0xf8) * 255 / 0xf8; \
+ DST[GCOMP] = ((*SRC >> 3) & 0xfc) * 255 / 0xfc; \
+ DST[BCOMP] = ((*SRC << 3) & 0xf8) * 255 / 0xf8; \
} while(0)
@@ -145,8 +131,8 @@ static const GLubyte kernel[16] = {
#define SPAN_VARS \
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 4;
-#define INC_PIXEL_PTR(P) P += 4
+ GLuint *P = (GLuint *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 4 + (X)
+#define INC_PIXEL_PTR(P) P++
#define STORE_PIXEL(DST, X, Y, VALUE) \
STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE)
#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
@@ -163,8 +149,8 @@ static const GLubyte kernel[16] = {
#define SPAN_VARS \
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 4;
-#define INC_PIXEL_PTR(P) P += 4
+ GLuint *P = (GLuint *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 4 + (X);
+#define INC_PIXEL_PTR(P) P++
#define STORE_PIXEL(DST, X, Y, VALUE) \
STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE)
#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
@@ -181,8 +167,8 @@ static const GLubyte kernel[16] = {
#define SPAN_VARS \
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 2;
-#define INC_PIXEL_PTR(P) P += 2
+ GLushort *P = (GLushort *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 2 + (X);
+#define INC_PIXEL_PTR(P) P++
#define STORE_PIXEL(DST, X, Y, VALUE) \
STORE_PIXEL_R5G6B5(DST, X, Y, VALUE)
#define FETCH_PIXEL(DST, SRC) \
@@ -234,8 +220,8 @@ static const GLubyte kernel[16] = {
#define SPAN_VARS \
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)row;
-#define INC_PIXEL_PTR(P) P += 4
+ GLuint *P = (GLuint *)row;
+#define INC_PIXEL_PTR(P) P++
#define STORE_PIXEL(DST, X, Y, VALUE) \
STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE)
#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
@@ -252,8 +238,8 @@ static const GLubyte kernel[16] = {
#define SPAN_VARS \
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)row;
-#define INC_PIXEL_PTR(P) P += 4
+ GLuint *P = (GLuint *)row;
+#define INC_PIXEL_PTR(P) P++
#define STORE_PIXEL(DST, X, Y, VALUE) \
STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE)
#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
@@ -270,7 +256,7 @@ static const GLubyte kernel[16] = {
#define SPAN_VARS \
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)row;
+ GLushort *P = (GLushort *)row;
#define INC_PIXEL_PTR(P) P += 2
#define STORE_PIXEL(DST, X, Y, VALUE) \
STORE_PIXEL_R5G6B5(DST, X, Y, VALUE)
diff --git a/mesalib/src/mesa/drivers/windows/fx/fx.rc b/mesalib/src/mesa/drivers/windows/fx/fx.rc
deleted file mode 100644
index f920b8768..000000000
--- a/mesalib/src/mesa/drivers/windows/fx/fx.rc
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <windows.h>
-
-#define PRODNAME "Mesa 6.x"
-#define CONTACTSTR "http://www.mesa3d.org"
-#define HWSTR "3dfx Voodoo Graphics, Voodoo Rush, Voodoo^2, Voodoo Banshee, Velocity 100/200, Voodoo3, Voodoo4, Voodoo5"
-#define COPYRIGHTSTR "Copyright \251 Brian E. Paul"
-
-#define VERSIONSTR "6.3.0.1"
-#define MANVERSION 6
-#define MANREVISION 3
-#define BUILD_NUMBER 1
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
- PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
- FILEFLAGSMASK 0x0030003FL
-
- FILEOS VOS_DOS_WINDOWS32
- FILETYPE VFT_DRV
- FILESUBTYPE VFT2_DRV_INSTALLABLE
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904E4"
- BEGIN
- VALUE "FileDescription", PRODNAME
- VALUE "FileVersion", VERSIONSTR
- VALUE "LegalCopyright", COPYRIGHTSTR
- VALUE "ProductName", PRODNAME
- VALUE "Graphics Subsystem", HWSTR
- VALUE "Contact", CONTACTSTR
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- /* the following line should be extended for localized versions */
- VALUE "Translation", 0x409, 1252
- END
-END
diff --git a/mesalib/src/mesa/drivers/windows/gdi/InitCritSections.cpp b/mesalib/src/mesa/drivers/windows/gdi/InitCritSections.cpp
deleted file mode 100644
index 7145bffa5..000000000
--- a/mesalib/src/mesa/drivers/windows/gdi/InitCritSections.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "glapi.h"
-#include "glThread.h"
-
-#ifdef WIN32_THREADS
-extern "C" _glthread_Mutex OneTimeLock;
-extern "C" _glthread_Mutex GenTexturesLock;
-
-extern "C" void FreeAllTSD(void);
-
-class _CriticalSectionInit
-{
-public:
- static _CriticalSectionInit m_inst;
-
- _CriticalSectionInit()
- {
- _glthread_INIT_MUTEX(OneTimeLock);
- _glthread_INIT_MUTEX(GenTexturesLock);
- }
-
- ~_CriticalSectionInit()
- {
- _glthread_DESTROY_MUTEX(OneTimeLock);
- _glthread_DESTROY_MUTEX(GenTexturesLock);
- FreeAllTSD();
- }
-};
-
-_CriticalSectionInit _CriticalSectionInit::m_inst;
-
-
-#endif
diff --git a/mesalib/src/mesa/drivers/windows/gdi/mesa.def b/mesalib/src/mesa/drivers/windows/gdi/mesa.def
index 05817fde1..62f75d954 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/mesa.def
+++ b/mesalib/src/mesa/drivers/windows/gdi/mesa.def
@@ -932,6 +932,16 @@ EXPORTS
_mesa_update_framebuffer_visual
_mesa_use_program
_mesa_Viewport
+ _mesa_meta_CopyColorSubTable
+ _mesa_meta_CopyColorTable
+ _mesa_meta_CopyConvolutionFilter1D
+ _mesa_meta_CopyConvolutionFilter2D
+ _mesa_meta_CopyTexImage1D
+ _mesa_meta_CopyTexImage2D
+ _mesa_meta_CopyTexSubImage1D
+ _mesa_meta_CopyTexSubImage2D
+ _mesa_meta_CopyTexSubImage3D
+ _mesa_wait_query
_swrast_Accum
_swrast_Bitmap
_swrast_BlitFramebuffer
@@ -941,15 +951,6 @@ EXPORTS
_swrast_Clear
_swrast_choose_line
_swrast_choose_triangle
- _swrast_CopyColorSubTable
- _swrast_CopyColorTable
- _swrast_CopyConvolutionFilter1D
- _swrast_CopyConvolutionFilter2D
- _swrast_copy_teximage1d
- _swrast_copy_teximage2d
- _swrast_copy_texsubimage1d
- _swrast_copy_texsubimage2d
- _swrast_copy_texsubimage3d
_swrast_CreateContext
_swrast_DestroyContext
_swrast_exec_fragment_program
diff --git a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
index e1971db69..8929b22af 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
@@ -12,6 +12,7 @@
#include "framebuffer.h"
#include "renderbuffer.h"
#include "drivers/common/driverfuncs.h"
+#include "drivers/common/meta.h"
#include "vbo/vbo.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -1515,6 +1516,8 @@ WMesaContext WMesaCreateContext(HDC hDC,
_mesa_enable_2_0_extensions(ctx);
_mesa_enable_2_1_extensions(ctx);
+ _mesa_meta_init(ctx);
+
/* Initialize the software rasterizer and helper modules. */
if (!_swrast_CreateContext(ctx) ||
!_vbo_CreateContext(ctx) ||
@@ -1558,6 +1561,8 @@ void WMesaDestroyContext( WMesaContext pwc )
DeleteObject(pwc->clearPen);
DeleteObject(pwc->clearBrush);
+ _mesa_meta_free(ctx);
+
_swsetup_DestroyContext(ctx);
_tnl_DestroyContext(ctx);
_vbo_DestroyContext(ctx);
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c
deleted file mode 100644
index d5fa64280..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c
+++ /dev/null
@@ -1,1196 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Driver interface code to Mesa
-*
-****************************************************************************/
-
-//#include <windows.h>
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "vbo/vbo.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-extern BOOL dglSwapBuffers(HDC hDC);
-
-// HACK: Hack the _33 member of the OpenGL perspective projection matrix
-const float _fPersp_33 = 1.6f;
-
-//---------------------------------------------------------------------------
-// Internal functions
-//---------------------------------------------------------------------------
-
-void _gld_mesa_warning(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal warning mechanism
- gldLogPrintf(GLDLOG_WARN, "Mesa warning: %s", str);
-}
-
-//---------------------------------------------------------------------------
-
-void _gld_mesa_fatal(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal fatal-message mechanism
- gldLogPrintf(GLDLOG_CRITICAL, "Mesa FATAL: %s", str);
-
- // Mesa calls abort(0) here.
- ddlogClose();
- exit(0);
-}
-
-//---------------------------------------------------------------------------
-
-D3DSTENCILOP _gldConvertStencilOp(
- GLenum StencilOp)
-{
- // Used by Stencil: pass, fail and zfail
-
- switch (StencilOp) {
- case GL_KEEP:
- return D3DSTENCILOP_KEEP;
- case GL_ZERO:
- return D3DSTENCILOP_ZERO;
- case GL_REPLACE:
- return D3DSTENCILOP_REPLACE;
- case GL_INCR:
- return D3DSTENCILOP_INCRSAT;
- case GL_DECR:
- return D3DSTENCILOP_DECRSAT;
- case GL_INVERT:
- return D3DSTENCILOP_INVERT;
- case GL_INCR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_INCR;
- case GL_DECR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_DECR;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertStencilOp: Unknown StencilOp\n");
-#endif
-
- return D3DSTENCILOP_KEEP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DCMPFUNC _gldConvertCompareFunc(
- GLenum CmpFunc)
-{
- // Used for Alpha func, depth func and stencil func.
-
- switch (CmpFunc) {
- case GL_NEVER:
- return D3DCMP_NEVER;
- case GL_LESS:
- return D3DCMP_LESS;
- case GL_EQUAL:
- return D3DCMP_EQUAL;
- case GL_LEQUAL:
- return D3DCMP_LESSEQUAL;
- case GL_GREATER:
- return D3DCMP_GREATER;
- case GL_NOTEQUAL:
- return D3DCMP_NOTEQUAL;
- case GL_GEQUAL:
- return D3DCMP_GREATEREQUAL;
- case GL_ALWAYS:
- return D3DCMP_ALWAYS;
- };
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertCompareFunc: Unknown CompareFunc\n");
-#endif
-
- return D3DCMP_ALWAYS;
-}
-
-//---------------------------------------------------------------------------
-
-D3DBLEND _gldConvertBlendFunc(
- GLenum blend,
- GLenum DefaultBlend)
-{
- switch (blend) {
- case GL_ZERO:
- return D3DBLEND_ZERO;
- case GL_ONE:
- return D3DBLEND_ONE;
- case GL_DST_COLOR:
- return D3DBLEND_DESTCOLOR;
- case GL_SRC_COLOR:
- return D3DBLEND_SRCCOLOR;
- case GL_ONE_MINUS_DST_COLOR:
- return D3DBLEND_INVDESTCOLOR;
- case GL_ONE_MINUS_SRC_COLOR:
- return D3DBLEND_INVSRCCOLOR;
- case GL_SRC_ALPHA:
- return D3DBLEND_SRCALPHA;
- case GL_ONE_MINUS_SRC_ALPHA:
- return D3DBLEND_INVSRCALPHA;
- case GL_DST_ALPHA:
- return D3DBLEND_DESTALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return D3DBLEND_INVDESTALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return D3DBLEND_SRCALPHASAT;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertBlendFunc: Unknown BlendFunc\n");
-#endif
-
- return DefaultBlend;
-}
-
-//---------------------------------------------------------------------------
-// Misc. functions
-//---------------------------------------------------------------------------
-
-void gld_Noop_DX7(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Error_DX7(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- // Quite useless.
-// gldLogMessage(GLDLOG_ERROR, "ctx->Driver.Error called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Required Mesa functions
-//---------------------------------------------------------------------------
-
-static GLboolean gld_set_draw_buffer_DX7(
- GLcontext *ctx,
- GLenum mode)
-{
- (void) ctx;
- if ((mode==GL_FRONT_LEFT) || (mode == GL_BACK_LEFT)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_set_read_buffer_DX7(
- GLcontext *ctx,
- GLframebuffer *buffer,
- GLenum mode)
-{
- /* separate read buffer not supported */
-/*
- ASSERT(buffer == ctx->DrawBuffer);
- ASSERT(mode == GL_FRONT_LEFT);
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Clear_DX7(
- GLcontext *ctx,
- GLbitfield mask,
- GLboolean all,
- GLint x,
- GLint y,
- GLint width,
- GLint height)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DCOLOR Color = 0;
- float Z = 0.0f;
- DWORD Stencil = 0;
- D3DRECT d3dClearRect;
-
- // TODO: Colourmask
- const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
-
- if (!gld->pDev)
- return;
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- GLubyte col[4];
- CLAMPED_FLOAT_TO_UBYTE(col[0], ctx->Color.ClearColor[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], ctx->Color.ClearColor[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], ctx->Color.ClearColor[2]);
- CLAMPED_FLOAT_TO_UBYTE(col[3], ctx->Color.ClearColor[3]);
- dwFlags |= D3DCLEAR_TARGET;
- Color = D3DCOLOR_RGBA(col[0], col[1], col[2], col[3]);
-// ctx->Color.ClearColor[1],
-// ctx->Color.ClearColor[2],
-// ctx->Color.ClearColor[3]);
- }
-
- if (mask & DD_DEPTH_BIT) {
- // D3D7 will fail the Clear call if we try and clear a
- // depth buffer and we haven't created one.
- // Also, some apps try and clear a depth buffer,
- // when a depth buffer hasn't been requested by the app.
- if (ctx->Visual.depthBits == 0) {
- mask &= ~DD_DEPTH_BIT; // Remove depth bit from mask
- } else {
- dwFlags |= D3DCLEAR_ZBUFFER;
- Z = ctx->Depth.Clear;
- }
- }
-
- if (mask & DD_STENCIL_BIT) {
- if (ctx->Visual.stencilBits == 0) {
- // No stencil bits in depth buffer
- mask &= ~DD_STENCIL_BIT; // Remove stencil bit from mask
- } else {
- dwFlags |= D3DCLEAR_STENCIL;
- Stencil = ctx->Stencil.Clear;
- }
- }
-
- // Some apps do really weird things with the rect, such as Quake3.
- if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0)) {
- all = GL_TRUE;
- }
-
- if (!all) {
- // Calculate clear subrect
- d3dClearRect.x1 = x;
- d3dClearRect.y1 = gldCtx->dwHeight - (y + height);
- d3dClearRect.x2 = x + width;
- d3dClearRect.y2 = d3dClearRect.y1 + height;
- }
-
- // dwFlags will be zero if there's nothing to clear
- if (dwFlags) {
- _GLD_DX7_DEV(Clear(
- gld->pDev,
- all ? 0 : 1,
- all ? NULL : &d3dClearRect,
- dwFlags,
- Color, Z, Stencil));
- }
-
- if (mask & DD_ACCUM_BIT) {
- // Clear accumulation buffer
- }
-}
-
-//---------------------------------------------------------------------------
-
-// Mesa 5: Parameter change
-static void gld_buffer_size_DX7(
-// GLcontext *ctx,
- GLframebuffer *fb,
- GLuint *width,
- GLuint *height)
-{
-// GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
-
- *width = fb->Width; // gldCtx->dwWidth;
- *height = fb->Height; // gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Finish_DX7(
- GLcontext *ctx)
-{
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Flush_DX7(
- GLcontext *ctx)
-{
- GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- // TODO: Detect apps that glFlush() then SwapBuffers() ?
-
- if (gld->EmulateSingle) {
- // Emulating a single-buffered context.
- // [Direct3D doesn't allow rendering to front buffer]
- dglSwapBuffers(gld->hDC);
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_STENCIL(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Two-sided stencil. New for Mesa 5
- const GLuint uiFace = 0UL;
-
- struct gl_stencil_attrib *pStencil = &ctx->Stencil;
-
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILENABLE, pStencil->Enabled ? TRUE : FALSE));
- if (pStencil->Enabled) {
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILFUNC, _gldConvertCompareFunc(pStencil->Function[uiFace])));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILREF, pStencil->Ref[uiFace]));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILMASK, pStencil->ValueMask[uiFace]));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILWRITEMASK, pStencil->WriteMask[uiFace]));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILFAIL, _gldConvertStencilOp(pStencil->FailFunc[uiFace])));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILZFAIL, _gldConvertStencilOp(pStencil->ZFailFunc[uiFace])));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILPASS, _gldConvertStencilOp(pStencil->ZPassFunc[uiFace])));
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_COLOR(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DBLEND src;
- D3DBLEND dest;
-
- // Alpha func
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAFUNC, _gldConvertCompareFunc(ctx->Color.AlphaFunc)));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAREF, (DWORD)ctx->Color.AlphaRef));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHATESTENABLE, ctx->Color.AlphaEnabled));
-
- // Blend func
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHABLENDENABLE, ctx->Color.BlendEnabled));
- src = _gldConvertBlendFunc(ctx->Color.BlendSrcRGB, GL_ONE);
- dest = _gldConvertBlendFunc(ctx->Color.BlendDstRGB, GL_ZERO);
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SRCBLEND, src));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_DESTBLEND, dest));
-
-/*
- // Color mask - unsupported by DX7
- if (ctx->Color.ColorMask[0]) dwFlags |= D3DCOLORWRITEENABLE_RED;
- if (ctx->Color.ColorMask[1]) dwFlags |= D3DCOLORWRITEENABLE_GREEN;
- if (ctx->Color.ColorMask[2]) dwFlags |= D3DCOLORWRITEENABLE_BLUE;
- if (ctx->Color.ColorMask[3]) dwFlags |= D3DCOLORWRITEENABLE_ALPHA;
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_COLORWRITEENABLE, dwFlags));
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_DEPTH(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZENABLE, ctx->Depth.Test ? D3DZB_TRUE : D3DZB_FALSE));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZFUNC, _gldConvertCompareFunc(ctx->Depth.Func)));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZWRITEENABLE, ctx->Depth.Mask ? TRUE : FALSE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_POLYGON(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DFILLMODE d3dFillMode = D3DFILL_SOLID;
- D3DCULL d3dCullMode = D3DCULL_NONE;
- int iOffset = 0;
-
- // Fillmode
- switch (ctx->Polygon.FrontMode) {
- case GL_POINT:
- d3dFillMode = D3DFILL_POINT;
- break;
- case GL_LINE:
- d3dFillMode = D3DFILL_WIREFRAME;
- break;
- case GL_FILL:
- d3dFillMode = D3DFILL_SOLID;
- break;
- }
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FILLMODE, d3dFillMode));
-
- if (ctx->Polygon.CullFlag) {
- switch (ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CW;
- else
- d3dCullMode = D3DCULL_CCW;
- break;
- case GL_FRONT:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CCW;
- else
- d3dCullMode = D3DCULL_CW;
- break;
- case GL_FRONT_AND_BACK:
- d3dCullMode = D3DCULL_NONE;
- break;
- default:
- break;
- }
- } else {
- d3dCullMode = D3DCULL_NONE;
- }
-// d3dCullMode = D3DCULL_NONE; // TODO: DEBUGGING
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_CULLMODE, d3dCullMode));
-
- // Polygon offset
- // ZBIAS ranges from 0 to 16 and can only move towards the viewer
- // Mesa5: ctx->Polygon._OffsetAny removed
- if (ctx->Polygon.OffsetFill) {
- iOffset = (int)ctx->Polygon.OffsetUnits;
- if (iOffset < 0)
- iOffset = -iOffset;
- else
- iOffset = 0; // D3D can't push away
- }
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZBIAS, iOffset));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_FOG(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DCOLOR d3dFogColour;
- D3DFOGMODE d3dFogMode = D3DFOG_LINEAR;
-
- // TODO: Fog is calculated seperately in the Mesa pipeline
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGENABLE, FALSE));
- return;
-
- // Fog enable
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGENABLE, ctx->Fog.Enabled));
- if (!ctx->Fog.Enabled) {
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGTABLEMODE, D3DFOG_NONE));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_NONE));
- return; // If disabled, don't bother setting any fog state
- }
-
- // Fog colour
- d3dFogColour = D3DCOLOR_COLORVALUE( ctx->Fog.Color[0],
- ctx->Fog.Color[1],
- ctx->Fog.Color[2],
- ctx->Fog.Color[3]);
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGCOLOR, d3dFogColour));
-
- // Fog density
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGDENSITY, *((DWORD*) (&ctx->Fog.Density))));
-
- // Fog start
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGSTART, *((DWORD*) (&ctx->Fog.Start))));
-
- // Fog end
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGEND, *((DWORD*) (&ctx->Fog.End))));
-
- // Fog mode
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- d3dFogMode = D3DFOG_LINEAR;
- break;
- case GL_EXP:
- d3dFogMode = D3DFOG_EXP;
- break;
- case GL_EXP2:
- d3dFogMode = D3DFOG_EXP2;
- break;
- }
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGTABLEMODE, d3dFogMode));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_NONE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_LIGHT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
- DWORD dwSpecularEnable;
-
- // Shademode
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SHADEMODE, (ctx->Light.ShadeModel == GL_SMOOTH) ? D3DSHADE_GOURAUD : D3DSHADE_FLAT));
-
- // Separate specular colour
- if (ctx->Light.Enabled)
- dwSpecularEnable = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TRUE: FALSE;
- else
- dwSpecularEnable = FALSE;
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SPECULARENABLE, dwSpecularEnable));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_MODELVIEW(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ModelView.m;
- // Mesa5: Model-view is now a stack
- GLfloat *pM = ctx->ModelviewMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10];
- m._34 = pM[11];
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14];
- m._44 = pM[15];
-/* m[0][0] = pM[0];
- m[0][1] = pM[1];
- m[0][2] = pM[2];
- m[0][3] = pM[3];
- m[1][0] = pM[4];
- m[1][1] = pM[5];
- m[1][2] = pM[6];
- m[1][3] = pM[7];
- m[2][0] = pM[8];
- m[2][1] = pM[9];
- m[2][2] = pM[10];
- m[2][3] = pM[11];
- m[3][0] = pM[12];
- m[3][1] = pM[13];
- m[3][2] = pM[14];
- m[3][3] = pM[15];*/
-
- gld->matModelView = m;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_PROJECTION(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ProjectionMatrix.m;
- // Mesa 5: Now a stack
- GLfloat *pM = ctx->ProjectionMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
-
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
-
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10] / _fPersp_33; // / 1.6f;
- m._34 = pM[11];
-
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14] / 2.0f;
- m._44 = pM[15];
-
- gld->matProjection = m;
-}
-
-//---------------------------------------------------------------------------
-/*
-void gldFrustumHook_DX7(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Frustum(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = farval / (nearval - farval);
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Frustum: %f", farval/nearval);
-}
-
-//---------------------------------------------------------------------------
-
-void gldOrthoHook_DX7(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Ortho(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = 1.6f;
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Ortho: %f", farval/nearval);
-}
-*/
-//---------------------------------------------------------------------------
-
-void gld_NEW_VIEWPORT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DVIEWPORT7 d3dvp;
-// GLint x, y;
-// GLsizei w, h;
-
- // Set depth range
- _GLD_DX7_DEV(GetViewport(gld->pDev, &d3dvp));
- // D3D can't do Quake1/Quake2 z-trick
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.dvMinZ = ctx->Viewport.Near;
- d3dvp.dvMaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.dvMinZ = ctx->Viewport.Far;
- d3dvp.dvMaxZ = ctx->Viewport.Near;
- }
-/* x = ctx->Viewport.X;
- y = ctx->Viewport.Y;
- w = ctx->Viewport.Width;
- h = ctx->Viewport.Height;
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;*/
- _GLD_DX7_DEV(SetViewport(gld->pDev, &d3dvp));
-
-// gld->fFlipWindowY = (float)gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-__inline BOOL _gldAnyEvalEnabled(
- GLcontext *ctx)
-{
- struct gl_eval_attrib *eval = &ctx->Eval;
-
- if ((eval->AutoNormal) ||
- (eval->Map1Color4) ||
- (eval->Map1Index) ||
- (eval->Map1Normal) ||
- (eval->Map1TextureCoord1) ||
- (eval->Map1TextureCoord2) ||
- (eval->Map1TextureCoord3) ||
- (eval->Map1TextureCoord4) ||
- (eval->Map1Vertex3) ||
- (eval->Map1Vertex4) ||
- (eval->Map2Color4) ||
- (eval->Map2Index) ||
- (eval->Map2Normal) ||
- (eval->Map2TextureCoord1) ||
- (eval->Map2TextureCoord2) ||
- (eval->Map2TextureCoord3) ||
- (eval->Map2TextureCoord4) ||
- (eval->Map2Vertex3) ||
- (eval->Map2Vertex4)
- )
- return TRUE;
-
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL _gldChooseInternalPipeline(
- GLcontext *ctx,
- GLD_driver_dx7 *gld)
-{
-// return TRUE; // DEBUGGING: ALWAYS USE MESA
-// return FALSE; // DEBUGGING: ALWAYS USE D3D
-
- if ((glb.dwTnL == GLDS_TNL_MESA) || (gld->bHasHWTnL == FALSE))
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE; // Force Mesa TnL
- }
-
- if ((ctx->Light.Enabled) ||
- (1) ||
- (ctx->Texture._TexGenEnabled) ||
- (ctx->Texture._TexMatEnabled) ||
-// (ctx->Transform._AnyClip) ||
- (ctx->Scissor.Enabled) ||
- _gldAnyEvalEnabled(ctx) // Put this last so we can early-out
- )
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE;
- }
-
- gld->PipelineUsage.qwD3DFVF.QuadPart++;
- return FALSE;
-
-/* // Force Mesa pipeline?
- if (glb.dwTnL == GLDS_TNL_MESA) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Test for functionality not exposed in the D3D pathways
- if ((ctx->Texture._GenFlags)) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Now decide if vertex shader can be used.
- // If two sided lighting is enabled then we must either
- // use Mesa TnL or the vertex shader
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
- if (gld->VStwosidelight.hShader && !ctx->Fog.Enabled) {
- // Use Vertex Shader
- gld->PipelineUsage.dwD3D2SVS.QuadPart++;
- return GLD_PIPELINE_D3D_VS_TWOSIDE;
- } else {
- // Use Mesa TnL
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
- }
-
- // Must be D3D fixed-function pipeline
- gld->PipelineUsage.dwD3DFVF.QuadPart++;
- return GLD_PIPELINE_D3D_FVF;
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_update_state_DX7(
- GLcontext *ctx,
- GLuint new_state)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLD_pb_dx7 *gldPB;
-
- if (!gld || !gld->pDev)
- return;
-
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-
- // SetupIndex will be used in the pipelines for choosing setup function
- if ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_SEPARATE_SPECULAR)) ||
- (ctx->Fog.Enabled))
- {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT_EXTRAS;
- else
- gld->iSetupFunc = GLD_SI_SMOOTH_EXTRAS;
- } else {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT; // Setup flat shade + texture
- else
- gld->iSetupFunc = GLD_SI_SMOOTH; // Setup smooth shade + texture
- }
-
- gld->bUseMesaTnL = _gldChooseInternalPipeline(ctx, gld);
- if (gld->bUseMesaTnL) {
- gldPB = &gld->PB2d;
- // DX7 Does not implement D3DRS_SOFTWAREVERTEXPROCESSING
-// _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SOFTWAREVERTEXPROCESSING, TRUE));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_CLIPPING, FALSE));
-// _GLD_DX7_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
- } else {
- gldPB = &gld->PB3d;
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_CLIPPING, TRUE));
-// if (gld->TnLPipeline == GLD_PIPELINE_D3D_VS_TWOSIDE) {
-// _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware));
-// _GLD_DX7_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
-// } else {
- // DX7 Does not implement D3DRS_SOFTWAREVERTEXPROCESSING
-// _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SOFTWAREVERTEXPROCESSING, !gld->bHasHWTnL));
-// _GLD_DX7_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
-// }
- }
-
-#define _GLD_TEST_STATE(a) \
- if (new_state & (a)) { \
- gld##a(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_TEST_STATE_DX7(a) \
- if (new_state & (a)) { \
- gld##a##_DX7(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_IGNORE_STATE(a) new_state &= ~(a);
-
-// if (!gld->bUseMesaTnL) {
- // Not required if Mesa is doing the TnL.
- // Problem: If gld->bUseMesaTnL is TRUE when these are signaled,
- // then we'll miss updating the D3D TnL pipeline.
- // Therefore, don't test for gld->bUseMesaTnL
- _GLD_TEST_STATE(_NEW_MODELVIEW);
- _GLD_TEST_STATE(_NEW_PROJECTION);
-// }
-
- _GLD_TEST_STATE_DX7(_NEW_TEXTURE); // extern, so guard with _DX7
- _GLD_TEST_STATE(_NEW_COLOR);
- _GLD_TEST_STATE(_NEW_DEPTH);
- _GLD_TEST_STATE(_NEW_POLYGON);
- _GLD_TEST_STATE(_NEW_STENCIL);
- _GLD_TEST_STATE(_NEW_FOG);
- _GLD_TEST_STATE(_NEW_LIGHT);
- _GLD_TEST_STATE(_NEW_VIEWPORT);
-
- _GLD_IGNORE_STATE(_NEW_TRANSFORM);
-
-
-// Stubs for future use.
-/* _GLD_TEST_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_STATE(_NEW_ACCUM);
- _GLD_TEST_STATE(_NEW_EVAL);
- _GLD_TEST_STATE(_NEW_HINT);
- _GLD_TEST_STATE(_NEW_LINE);
- _GLD_TEST_STATE(_NEW_PIXEL);
- _GLD_TEST_STATE(_NEW_POINT);
- _GLD_TEST_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_STATE(_NEW_SCISSOR);
- _GLD_TEST_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_STATE(_NEW_ARRAY);
- _GLD_TEST_STATE(_NEW_RENDERMODE);
- _GLD_TEST_STATE(_NEW_BUFFERS);
- _GLD_TEST_STATE(_NEW_MULTISAMPLE);
-*/
-
-// For debugging.
-#if 0
-#define _GLD_TEST_UNHANDLED_STATE(a) \
- if (new_state & (a)) { \
- gldLogMessage(GLDLOG_ERROR, "Unhandled " #a "\n"); \
- }
- _GLD_TEST_UNHANDLED_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ACCUM);
- _GLD_TEST_UNHANDLED_STATE(_NEW_EVAL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_HINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_LINE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PIXEL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_SCISSOR);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ARRAY);
- _GLD_TEST_UNHANDLED_STATE(_NEW_RENDERMODE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_BUFFERS);
- _GLD_TEST_UNHANDLED_STATE(_NEW_MULTISAMPLE);
-#undef _GLD_UNHANDLED_STATE
-#endif
-
-#undef _GLD_TEST_STATE
-}
-
-//---------------------------------------------------------------------------
-// Viewport
-//---------------------------------------------------------------------------
-
-void gld_Viewport_DX7(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei w,
- GLsizei h)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DVIEWPORT7 d3dvp;
-
- if (!gld || !gld->pDev)
- return;
-
- // This is a hack. When the app is minimized, Mesa passes
- // w=1 and h=1 for viewport dimensions. Without this test
- // we get a GPF in gld_wgl_resize_buffers().
- if ((w==1) && (h==1))
- return;
-
- // Call ResizeBuffersMESA. This function will early-out
- // if no resize is needed.
- //ctx->Driver.ResizeBuffersMESA(ctx);
- // Mesa 5: Changed parameters
- ctx->Driver.ResizeBuffers(gldCtx->glBuffer);
-
-#if 0
- ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h);
-#endif
-
- // ** D3D viewport must not be outside the render target surface **
- // Sanity check the GL viewport dimensions
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
-
- d3dvp.dwX = x;
- d3dvp.dwY = gldCtx->dwHeight - (y + h);
- d3dvp.dwWidth = w;
- d3dvp.dwHeight = h;
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.dvMinZ = ctx->Viewport.Near;
- d3dvp.dvMaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.dvMinZ = ctx->Viewport.Far;
- d3dvp.dvMaxZ = ctx->Viewport.Near;
- }
-
- // TODO: DEBUGGING
-// d3dvp.MinZ = 0.0f;
-// d3dvp.MaxZ = 1.0f;
-
- _GLD_DX7_DEV(SetViewport(gld->pDev, &d3dvp));
-
-}
-
-//---------------------------------------------------------------------------
-
-extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
-
-// Mesa 5: Parameter change
-void gldResizeBuffers_DX7(
-// GLcontext *ctx)
- GLframebuffer *fb)
-{
- GET_CURRENT_CONTEXT(ctx);
- dglWglResizeBuffers(ctx, TRUE);
-}
-
-//---------------------------------------------------------------------------
-#ifdef _DEBUG
-// This is only for debugging.
-// To use, plug into ctx->Driver.Enable pointer below.
-void gld_Enable(
- GLcontext *ctx,
- GLenum e,
- GLboolean b)
-{
- char buf[1024];
- sprintf(buf, "Enable: %s (%s)\n", _mesa_lookup_enum_by_nr(e), b?"TRUE":"FALSE");
- ddlogMessage(DDLOG_SYSTEM, buf);
-}
-#endif
-//---------------------------------------------------------------------------
-// Driver pointer setup
-//---------------------------------------------------------------------------
-
-extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum);
-
-void gldSetupDriverPointers_DX7(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- // Mandatory functions
- ctx->Driver.GetString = _gldGetStringGeneric;
- ctx->Driver.UpdateState = gld_update_state_DX7;
- ctx->Driver.Clear = gld_Clear_DX7;
- ctx->Driver.DrawBuffer = gld_set_draw_buffer_DX7;
- ctx->Driver.GetBufferSize = gld_buffer_size_DX7;
- ctx->Driver.Finish = gld_Finish_DX7;
- ctx->Driver.Flush = gld_Flush_DX7;
- ctx->Driver.Error = gld_Error_DX7;
-
- // Hardware accumulation buffer
- ctx->Driver.Accum = NULL; // TODO: gld_Accum;
-
- // Bitmap functions
- ctx->Driver.CopyPixels = gld_CopyPixels_DX7;
- ctx->Driver.DrawPixels = gld_DrawPixels_DX7;
- ctx->Driver.ReadPixels = gld_ReadPixels_DX7;
- ctx->Driver.Bitmap = gld_Bitmap_DX7;
-
- // Buffer resize
- ctx->Driver.ResizeBuffers = gldResizeBuffers_DX7;
-
- // Texture image functions
- ctx->Driver.ChooseTextureFormat = gld_ChooseTextureFormat_DX7;
- ctx->Driver.TexImage1D = gld_TexImage1D_DX7;
- ctx->Driver.TexImage2D = gld_TexImage2D_DX7;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = gld_TexSubImage1D_DX7;
- ctx->Driver.TexSubImage2D = gld_TexSubImage2D_DX7;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
-
- ctx->Driver.CopyTexImage1D = gldCopyTexImage1D_DX7; //NULL;
- ctx->Driver.CopyTexImage2D = gldCopyTexImage2D_DX7; //NULL;
- ctx->Driver.CopyTexSubImage1D = gldCopyTexSubImage1D_DX7; //NULL;
- ctx->Driver.CopyTexSubImage2D = gldCopyTexSubImage2D_DX7; //NULL;
- ctx->Driver.CopyTexSubImage3D = gldCopyTexSubImage3D_DX7;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- // Texture object functions
- ctx->Driver.BindTexture = NULL;
- ctx->Driver.NewTextureObject = NULL; // Not yet implemented by Mesa!;
- ctx->Driver.DeleteTexture = gld_DeleteTexture_DX7;
- ctx->Driver.PrioritizeTexture = NULL;
-
- // Imaging functionality
- ctx->Driver.CopyColorTable = NULL;
- ctx->Driver.CopyColorSubTable = NULL;
- ctx->Driver.CopyConvolutionFilter1D = NULL;
- ctx->Driver.CopyConvolutionFilter2D = NULL;
-
- // State changing functions
- ctx->Driver.AlphaFunc = NULL; //gld_AlphaFunc;
- ctx->Driver.BlendFuncSeparate = NULL; //gld_BlendFunc;
- ctx->Driver.ClearColor = NULL; //gld_ClearColor;
- ctx->Driver.ClearDepth = NULL; //gld_ClearDepth;
- ctx->Driver.ClearStencil = NULL; //gld_ClearStencil;
- ctx->Driver.ColorMask = NULL; //gld_ColorMask;
- ctx->Driver.CullFace = NULL; //gld_CullFace;
- ctx->Driver.ClipPlane = NULL; //gld_ClipPlane;
- ctx->Driver.FrontFace = NULL; //gld_FrontFace;
- ctx->Driver.DepthFunc = NULL; //gld_DepthFunc;
- ctx->Driver.DepthMask = NULL; //gld_DepthMask;
- ctx->Driver.DepthRange = NULL;
- ctx->Driver.Enable = NULL; //gld_Enable;
- ctx->Driver.Fogfv = NULL; //gld_Fogfv;
- ctx->Driver.Hint = NULL; //gld_Hint;
- ctx->Driver.Lightfv = NULL; //gld_Lightfv;
- ctx->Driver.LightModelfv = NULL; //gld_LightModelfv;
- ctx->Driver.LineStipple = NULL; //gld_LineStipple;
- ctx->Driver.LineWidth = NULL; //gld_LineWidth;
- ctx->Driver.LogicOpcode = NULL; //gld_LogicOpcode;
- ctx->Driver.PointParameterfv = NULL; //gld_PointParameterfv;
- ctx->Driver.PointSize = NULL; //gld_PointSize;
- ctx->Driver.PolygonMode = NULL; //gld_PolygonMode;
- ctx->Driver.PolygonOffset = NULL; //gld_PolygonOffset;
- ctx->Driver.PolygonStipple = NULL; //gld_PolygonStipple;
- ctx->Driver.RenderMode = NULL; //gld_RenderMode;
- ctx->Driver.Scissor = NULL; //gld_Scissor;
- ctx->Driver.ShadeModel = NULL; //gld_ShadeModel;
- ctx->Driver.StencilFunc = NULL; //gld_StencilFunc;
- ctx->Driver.StencilMask = NULL; //gld_StencilMask;
- ctx->Driver.StencilOp = NULL; //gld_StencilOp;
- ctx->Driver.TexGen = NULL; //gld_TexGen;
- ctx->Driver.TexEnv = NULL;
- ctx->Driver.TexParameter = NULL;
- ctx->Driver.TextureMatrix = NULL; //gld_TextureMatrix;
- ctx->Driver.Viewport = gld_Viewport_DX7;
-
- _swsetup_Wakeup(ctx);
-
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- tnl->Driver.Render.ResetLineStipple = gld_ResetLineStipple_DX7;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
-
- // Hook into glFrustum() and glOrtho()
-// ctx->Exec->Frustum = gldFrustumHook_DX7;
-// ctx->Exec->Ortho = gldOrthoHook_DX7;
-
-}
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h
deleted file mode 100644
index b5a491e41..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 7.0a header file
-*
-****************************************************************************/
-
-#ifndef _GLD_DX7_H
-#define _GLD_DX7_H
-
-//---------------------------------------------------------------------------
-// Windows includes
-//---------------------------------------------------------------------------
-
-#define DIRECTDRAW_VERSION 0x0700
-#define DIRECT3D_VERSION 0x0700
-#include <d3d.h>
-#include <d3dx.h>
-
-// Typedef for obtaining function from d3d7.dll
-//typedef IDirect3D7* (WINAPI *FNDIRECT3DCREATE7) (UINT);
-
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-
-#ifdef _DEBUG
-// Debug build tests the return value of D3D calls
-#define _GLD_TEST_HRESULT(h) \
-{ \
- HRESULT _hr = (h); \
- if (FAILED(_hr)) { \
- gldLogError(GLDLOG_ERROR, #h, _hr); \
- } \
-}
-#define _GLD_DX7(func) _GLD_TEST_HRESULT(IDirect3D7_##func##)
-#define _GLD_DX7_DEV(func) _GLD_TEST_HRESULT(IDirect3DDevice7_##func##)
-#define _GLD_DX7_VB(func) _GLD_TEST_HRESULT(IDirect3DVertexBuffer7_##func##)
-#define _GLD_DX7_TEX(func) _GLD_TEST_HRESULT(IDirectDrawSurface7_##func##)
-#else
-#define _GLD_DX7(func) IDirect3D7_##func
-#define _GLD_DX7_DEV(func) IDirect3DDevice7_##func
-#define _GLD_DX7_VB(func) IDirect3DVertexBuffer7_##func
-#define _GLD_DX7_TEX(func) IDirectDrawSurface7_##func
-#endif
-
-#define SAFE_RELEASE(p) \
-{ \
- if (p) { \
- (p)->lpVtbl->Release(p); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_VB7(p) \
-{ \
- if (p) { \
- IDirect3DVertexBuffer7_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_SURFACE7(p) \
-{ \
- if (p) { \
- IDirectDrawSurface7_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-// Emulate some DX8 defines
-#define D3DCOLOR_ARGB(a,r,g,b) ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
-#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b)
-#define D3DCOLOR_COLORVALUE(r,g,b,a) D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
-
-
-// Setup index.
-enum {
- GLD_SI_FLAT = 0,
- GLD_SI_SMOOTH = 1,
- GLD_SI_FLAT_EXTRAS = 2,
- GLD_SI_SMOOTH_EXTRAS = 3,
-};
-
-//---------------------------------------------------------------------------
-// Vertex definitions for Fixed-Function pipeline
-//---------------------------------------------------------------------------
-
-//
-// NOTE: If the number of texture units is altered then most of
-// the texture code will need to be revised.
-//
-
-#define GLD_MAX_TEXTURE_UNITS_DX7 2
-
-//
-// 2D vertex transformed by Mesa
-//
-#define GLD_FVF_2D_VERTEX ( D3DFVF_XYZRHW | \
- D3DFVF_DIFFUSE | \
- D3DFVF_SPECULAR | \
- D3DFVF_TEX2)
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT sz; // Screen Z (depth)
- FLOAT rhw; // Reciprocal homogenous W
- DWORD diffuse; // Diffuse colour
- DWORD specular; // For separate-specular support
- FLOAT t0_u, t0_v; // 1st set of texture coords
- FLOAT t1_u, t1_v; // 2nd set of texture coords
-} GLD_2D_VERTEX;
-
-
-//
-// 3D vertex transformed by Direct3D
-//
-#define GLD_FVF_3D_VERTEX ( D3DFVF_XYZ | \
- D3DFVF_DIFFUSE | \
- D3DFVF_TEX2)
-
-typedef struct {
- D3DXVECTOR3 Position; // XYZ Vector in object space
- D3DCOLOR Diffuse; // Diffuse colour
- D3DXVECTOR2 TexUnit0; // Texture unit 0
- D3DXVECTOR2 TexUnit1; // Texture unit 1
-} GLD_3D_VERTEX;
-
-//---------------------------------------------------------------------------
-// Structs
-//---------------------------------------------------------------------------
-
-// This keeps a count of how many times we choose each individual internal
-// pathway. Useful for seeing if a certain pathway was ever used by an app, and
-// how much each pathway is biased.
-// Zero the members at context creation and dump stats at context deletion.
-typedef struct {
- // Note: DWORD is probably too small
- ULARGE_INTEGER qwMesa; // Mesa TnL pipeline
- ULARGE_INTEGER qwD3DFVF; // Direct3D Fixed-Function pipeline
-} GLD_pipeline_usage;
-
-// GLDirect Primitive Buffer (points, lines, triangles and quads)
-typedef struct {
- // Data for IDirect3D7::CreateVertexBuffer()
- DWORD dwStride; // Stride of vertex
- DWORD dwCreateFlags; // Create flags
- DWORD dwFVF; // Direct3D Flexible Vertex Format
-
- IDirect3DVertexBuffer7 *pVB; // Holds points, lines, tris and quads.
-
- // Point list is assumed to be at start of buffer
- DWORD iFirstLine; // Index of start of line list
- DWORD iFirstTriangle; // Index of start of triangle list
-
- BYTE *pPoints; // Pointer to next free point
- BYTE *pLines; // Pointer to next free line
- BYTE *pTriangles; // Pointer to next free triangle
-
- DWORD nPoints; // Number of points ready to render
- DWORD nLines; // Number of lines ready to render
- DWORD nTriangles; // Number of triangles ready to render
-} GLD_pb_dx7;
-
-// GLDirect DX7 driver data
-typedef struct {
- // GLDirect vars
- BOOL bDoublebuffer; // Doublebuffer (otherwise single-buffered)
- BOOL bDepthStencil; // Depth buffer needed (stencil optional)
- D3DX_SURFACEFORMAT RenderFormat; // Format of back/front buffer
- D3DX_SURFACEFORMAT DepthFormat; // Format of depth/stencil
-
- // Direct3D vars
- DDCAPS ddCaps;
- D3DDEVICEDESC7 d3dCaps;
- BOOL bHasHWTnL; // Device has Hardware Transform/Light?
- ID3DXContext *pD3DXContext; // Base D3DX context
- IDirectDraw7 *pDD; // DirectDraw7 interface
- IDirect3D7 *pD3D; // Base Direct3D7 interface
- IDirect3DDevice7 *pDev; // Direct3D7 Device interface
- GLD_pb_dx7 PB2d; // Vertices transformed by Mesa
- GLD_pb_dx7 PB3d; // Vertices transformed by Direct3D
- D3DPRIMITIVETYPE d3dpt; // Current Direct3D primitive type
- D3DMATRIX matProjection; // Projection matrix for D3D TnL
- D3DMATRIX matModelView; // Model/View matrix for D3D TnL
- int iSetupFunc; // Which setup functions to use
- BOOL bUseMesaTnL; // Whether to use Mesa or D3D for TnL
-
- GLD_pipeline_usage PipelineUsage;
-} GLD_driver_dx7;
-
-#define GLD_GET_DX7_DRIVER(c) (GLD_driver_dx7*)(c)->glPriv
-
-//---------------------------------------------------------------------------
-// Function prototypes
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX7(LPCSTR a);
-void gldEnableExtensions_DX7(GLcontext *ctx);
-void gldInstallPipeline_DX7(GLcontext *ctx);
-void gldSetupDriverPointers_DX7(GLcontext *ctx);
-void gldResizeBuffers_DX7(GLframebuffer *fb);
-
-
-// Texture functions
-
-void gldCopyTexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-void gldCopyTexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void gldCopyTexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-void gldCopyTexSubImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-void gldCopyTexSubImage3D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-
-void gld_NEW_TEXTURE_DX7(GLcontext *ctx);
-void gld_DrawPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
-void gld_ReadPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
-void gld_CopyPixels_DX7(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
-void gld_Bitmap_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
-const struct gl_texture_format* gld_ChooseTextureFormat_DX7(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
-void gld_TexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
-void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
-void gld_DeleteTexture_DX7(GLcontext *ctx, struct gl_texture_object *tObj);
-void gld_ResetLineStipple_DX7(GLcontext *ctx);
-
-// 2D primitive functions
-
-void gld_Points2D_DX7(GLcontext *ctx, GLuint first, GLuint last);
-
-void gld_Line2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-
-void gld_Triangle2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-
-void gld_Quad2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// 3D primitive functions
-
-void gld_Points3D_DX7(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Line3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// Primitive functions for Two-sided-lighting Vertex Shader
-
-void gld_Points2DTwoside_DX7(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-#endif
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h
deleted file mode 100644
index df6fceb43..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*==========================================================================;
- *
- *
- * File: dxerr8.h
- * Content: DirectX Error Library Include File
- *
- ****************************************************************************/
-
-#ifndef _GLD_DXERR7_H_
-#define _GLD_DXERR7_H_
-
-
-#include <d3d.h>
-
-//
-// DXGetErrorString8
-//
-// Desc: Converts an DirectX HRESULT to a string
-//
-// Args: HRESULT hr Can be any error code from
-// DPLAY D3D8 D3DX8 DMUSIC DSOUND
-//
-// Return: Converted string
-//
-const char* __stdcall DXGetErrorString8A(HRESULT hr);
-const WCHAR* __stdcall DXGetErrorString8W(HRESULT hr);
-
-#ifdef UNICODE
- #define DXGetErrorString8 DXGetErrorString8W
-#else
- #define DXGetErrorString8 DXGetErrorString8A
-#endif
-
-
-//
-// DXTrace
-//
-// Desc: Outputs a formatted error message to the debug stream
-//
-// Args: CHAR* strFile The current file, typically passed in using the
-// __FILE__ macro.
-// DWORD dwLine The current line number, typically passed in using the
-// __LINE__ macro.
-// HRESULT hr An HRESULT that will be traced to the debug stream.
-// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
-// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
-//
-// Return: The hr that was passed in.
-//
-//HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE );
-//HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE );
-HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox);
-HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox);
-
-#ifdef UNICODE
- #define DXTrace DXTraceW
-#else
- #define DXTrace DXTraceA
-#endif
-
-
-//
-// Helper macros
-//
-#if defined(DEBUG) | defined(_DEBUG)
- #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
- #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
- #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
-#else
- #define DXTRACE_MSG(str) (0L)
- #define DXTRACE_ERR(str,hr) (hr)
- #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
-#endif
-
-
-#endif
-
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c
deleted file mode 100644
index ba60980bb..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GL extensions
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "../gld_settings.h"
-
-#include <windows.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-//#include "ddlog.h"
-//#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "vbo/vbo.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "dglcontext.h"
-#include "extensions.h"
-
-// For some reason this is not defined in an above header...
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
-
-//---------------------------------------------------------------------------
-// Hack for the SGIS_multitexture extension that was removed from Mesa
-// NOTE: SGIS_multitexture enums also clash with GL_SGIX_async_pixel
-
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // To enable, uncomment:
- // _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
-//---------------------------------------------------------------------------
-
-enum {
- /* Quake2 GL_SGIS_multitexture */
- GL_SELECTED_TEXTURE_SGIS = 0x835B,
- GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835C,
- GL_MAX_TEXTURES_SGIS = 0x835D,
- GL_TEXTURE0_SGIS = 0x835E,
- GL_TEXTURE1_SGIS = 0x835F,
- GL_TEXTURE2_SGIS = 0x8360,
- GL_TEXTURE3_SGIS = 0x8361,
- GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363,
-};
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldSelectTextureSGIS(
- GLenum target)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glActiveTextureARB(ARB_target);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fSGIS(
- GLenum target,
- GLfloat s,
- GLfloat t)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fARB(ARB_target, s, t);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fvSGIS(
- GLenum target,
- const GLfloat *v)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fvARB(ARB_target, v);
-}
-
-//---------------------------------------------------------------------------
-// Extensions
-//---------------------------------------------------------------------------
-
-typedef struct {
- PROC proc;
- char *name;
-} GLD_extension;
-
-GLD_extension GLD_extList[] = {
-#ifdef GL_EXT_polygon_offset
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
-#endif
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
- { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
- { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
-
- { (PROC)glLockArraysEXT, "glLockArraysEXT" },
- { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" },
- { NULL, "\0" }
-};
-
-GLD_extension GLD_multitexList[] = {
-/*
- { (PROC)glMultiTexCoord1dSGIS, "glMTexCoord1dSGIS" },
- { (PROC)glMultiTexCoord1dvSGIS, "glMTexCoord1dvSGIS" },
- { (PROC)glMultiTexCoord1fSGIS, "glMTexCoord1fSGIS" },
- { (PROC)glMultiTexCoord1fvSGIS, "glMTexCoord1fvSGIS" },
- { (PROC)glMultiTexCoord1iSGIS, "glMTexCoord1iSGIS" },
- { (PROC)glMultiTexCoord1ivSGIS, "glMTexCoord1ivSGIS" },
- { (PROC)glMultiTexCoord1sSGIS, "glMTexCoord1sSGIS" },
- { (PROC)glMultiTexCoord1svSGIS, "glMTexCoord1svSGIS" },
- { (PROC)glMultiTexCoord2dSGIS, "glMTexCoord2dSGIS" },
- { (PROC)glMultiTexCoord2dvSGIS, "glMTexCoord2dvSGIS" },
- { (PROC)glMultiTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)glMultiTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
- { (PROC)glMultiTexCoord2iSGIS, "glMTexCoord2iSGIS" },
- { (PROC)glMultiTexCoord2ivSGIS, "glMTexCoord2ivSGIS" },
- { (PROC)glMultiTexCoord2sSGIS, "glMTexCoord2sSGIS" },
- { (PROC)glMultiTexCoord2svSGIS, "glMTexCoord2svSGIS" },
- { (PROC)glMultiTexCoord3dSGIS, "glMTexCoord3dSGIS" },
- { (PROC)glMultiTexCoord3dvSGIS, "glMTexCoord3dvSGIS" },
- { (PROC)glMultiTexCoord3fSGIS, "glMTexCoord3fSGIS" },
- { (PROC)glMultiTexCoord3fvSGIS, "glMTexCoord3fvSGIS" },
- { (PROC)glMultiTexCoord3iSGIS, "glMTexCoord3iSGIS" },
- { (PROC)glMultiTexCoord3ivSGIS, "glMTexCoord3ivSGIS" },
- { (PROC)glMultiTexCoord3sSGIS, "glMTexCoord3sSGIS" },
- { (PROC)glMultiTexCoord3svSGIS, "glMTexCoord3svSGIS" },
- { (PROC)glMultiTexCoord4dSGIS, "glMTexCoord4dSGIS" },
- { (PROC)glMultiTexCoord4dvSGIS, "glMTexCoord4dvSGIS" },
- { (PROC)glMultiTexCoord4fSGIS, "glMTexCoord4fSGIS" },
- { (PROC)glMultiTexCoord4fvSGIS, "glMTexCoord4fvSGIS" },
- { (PROC)glMultiTexCoord4iSGIS, "glMTexCoord4iSGIS" },
- { (PROC)glMultiTexCoord4ivSGIS, "glMTexCoord4ivSGIS" },
- { (PROC)glMultiTexCoord4sSGIS, "glMTexCoord4sSGIS" },
- { (PROC)glMultiTexCoord4svSGIS, "glMTexCoord4svSGIS" },
- { (PROC)glMultiTexCoordPointerSGIS, "glMTexCoordPointerSGIS" },
- { (PROC)glSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)glSelectTextureCoordSetSGIS, "glSelectTextureCoordSetSGIS" },
-*/
- { (PROC)glActiveTextureARB, "glActiveTextureARB" },
- { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" },
- { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" },
- { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" },
- { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" },
- { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" },
- { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" },
- { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" },
- { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" },
- { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" },
- { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" },
- { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" },
- { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" },
- { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" },
- { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" },
- { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" },
- { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" },
- { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" },
- { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" },
- { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" },
- { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" },
- { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" },
- { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" },
- { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" },
- { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" },
- { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" },
- { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" },
- { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" },
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" },
- { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" },
- { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" },
- { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" },
- { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" },
- { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" },
-
- // Descent3 doesn't use correct string, hence this hack
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4f" },
-
- // Quake2 SGIS multitexture
- { (PROC)gldSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)gldMTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)gldMTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
-
- { NULL, "\0" }
-};
-
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX(
- LPCSTR a)
-{
- int i;
- PROC proc = NULL;
-
- for (i=0; GLD_extList[i].proc; i++) {
- if (!strcmp(a, GLD_extList[i].name)) {
- proc = GLD_extList[i].proc;
- break;
- }
- }
-
- if (glb.bMultitexture) {
- for (i=0; GLD_multitexList[i].proc; i++) {
- if (!strcmp(a, GLD_multitexList[i].name)) {
- proc = GLD_multitexList[i].proc;
- break;
- }
- }
- }
-
- gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed");
-
- return proc;
-}
-
-//---------------------------------------------------------------------------
-
-void gldEnableExtensions_DX7(
- GLcontext *ctx)
-{
- GLuint i;
-
- // Mesa enables some extensions by default.
- // This table decides which ones we want to switch off again.
-
- // NOTE: GL_EXT_compiled_vertex_array appears broken.
-
- const char *gld_disable_extensions[] = {
-// "GL_ARB_transpose_matrix",
-// "GL_EXT_compiled_vertex_array",
-// "GL_EXT_polygon_offset",
-// "GL_EXT_rescale_normal",
- "GL_EXT_texture3D",
-// "GL_NV_texgen_reflection",
- "GL_EXT_abgr",
- "GL_EXT_bgra",
- NULL
- };
-
- const char *gld_multitex_extensions[] = {
- "GL_ARB_multitexture", // Quake 3
- NULL
- };
-
- // Quake 2 engines
- const char *szGL_SGIS_multitexture = "GL_SGIS_multitexture";
-
- const char *gld_enable_extensions[] = {
- "GL_EXT_texture_env_add", // Quake 3
- "GL_ARB_texture_env_add", // Quake 3
- NULL
- };
-
- for (i=0; gld_disable_extensions[i]; i++) {
- _mesa_disable_extension(ctx, gld_disable_extensions[i]);
- }
-
- for (i=0; gld_enable_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_enable_extensions[i]);
- }
-
- if (glb.bMultitexture) {
- for (i=0; gld_multitex_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_multitex_extensions[i]);
- }
-
- // GL_SGIS_multitexture
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // Fair bit slower on GeForce256,
- // Much slower on 3dfx Voodoo5 5500.
-// _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
- }
-
- _mesa_enable_imaging_extensions(ctx);
- _mesa_enable_1_3_extensions(ctx);
- _mesa_enable_1_4_extensions(ctx);
-}
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c
deleted file mode 100644
index 9ccec69b9..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Mesa transformation pipeline with GLDirect fastpath
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-extern struct tnl_pipeline_stage _gld_d3d_render_stage;
-extern struct tnl_pipeline_stage _gld_mesa_render_stage;
-
-static const struct tnl_pipeline_stage *gld_pipeline[] = {
- &_gld_d3d_render_stage, // Direct3D TnL
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage. ??? */
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
- &_gld_mesa_render_stage, // Mesa TnL, D3D rendering
- 0,
-};
-
-//---------------------------------------------------------------------------
-
-void gldInstallPipeline_DX7(
- GLcontext *ctx)
-{
- // Remove any existing pipeline stages,
- // then install GLDirect pipeline stages.
-
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, gld_pipeline);
-}
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
deleted file mode 100644
index c99ba0bba..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
+++ /dev/null
@@ -1,1448 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Primitive (points/lines/tris/quads) rendering
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "vbo/vbo.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "swrast/s_context.h"
-#include "swrast/s_depth.h"
-#include "swrast/s_lines.h"
-#include "swrast/s_triangle.h"
-#include "swrast/s_trispan.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-// Disable compiler complaints about unreferenced local variables
-#pragma warning (disable:4101)
-
-//---------------------------------------------------------------------------
-// Helper defines for primitives
-//---------------------------------------------------------------------------
-
-//static const float ooZ = 1.0f / 65536.0f; // One over Z
-
-#define GLD_COLOUR (D3DCOLOR_RGBA(swv->color[0], swv->color[1], swv->color[2], swv->color[3]))
-#define GLD_SPECULAR (D3DCOLOR_RGBA(swv->specular[0], swv->specular[1], swv->specular[2], swv->specular[3]))
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-//---------------------------------------------------------------------------
-// 2D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_2D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pPoints; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pLines; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_TRIANGLES \
- BOOL bFog = ctx->Fog.Enabled; \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pTriangles; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour; \
- GLuint facing = 0; \
- struct vertex_buffer *VB; \
- GLchan (*vbcolor)[4]; \
- GLchan (*vbspec)[4]
-
-#define GLD_SETUP_GET_SWVERT(s) \
- swv = &ss->verts[##s]
-
-#define GLD_SETUP_2D_VERTEX \
- pV->x = swv->win[0]; \
- pV->y = GLD_FLIP_Y(swv->win[1]); \
- pV->rhw = swv->win[3]
-
-#define GLD_SETUP_SMOOTH_COLOUR \
- pV->diffuse = GLD_COLOUR
-
-#define GLD_SETUP_GET_FLAT_COLOUR \
- dwFlatColour = GLD_COLOUR
-#define GLD_SETUP_GET_FLAT_FOG_COLOUR \
- dwFlatColour = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_USE_FLAT_COLOUR \
- pV->diffuse = dwFlatColour
-
-#define GLD_SETUP_GET_FLAT_SPECULAR \
- dwSpecularColour= GLD_SPECULAR
-
-#define GLD_SETUP_USE_FLAT_SPECULAR \
- pV->specular = dwSpecularColour
-
-#define GLD_SETUP_DEPTH \
- pV->sz = swv->win[2] / ctx->DepthMaxF
-// pV->z = swv->win[2] * ooZ;
-
-#define GLD_SETUP_SPECULAR \
- pV->specular = GLD_SPECULAR
-
-#define GLD_SETUP_FOG \
- pV->diffuse = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_TEX0 \
- pV->t0_u = swv->texcoord[0][0]; \
- pV->t0_v = swv->texcoord[0][1]
-
-#define GLD_SETUP_TEX1 \
- pV->t1_u = swv->texcoord[1][0]; \
- pV->t1_v = swv->texcoord[1][1]
-
-#define GLD_SETUP_LIGHTING(v) \
- if (facing == 1) { \
- pV->diffuse = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- pV->specular = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- } else { \
- if (bFog) \
- GLD_SETUP_FOG; \
- else \
- GLD_SETUP_SMOOTH_COLOUR; \
- GLD_SETUP_SPECULAR; \
- }
-
-#define GLD_SETUP_GET_FLAT_LIGHTING(v) \
- if (facing == 1) { \
- dwFlatColour = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- dwSpecularColour = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- }
-
-#define GLD_SETUP_TWOSIDED_LIGHTING \
- /* Two-sided lighting */ \
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { \
- SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; \
- SWvertex *v[3]; \
- GLfloat ex,ey,fx,fy,cc; \
- /* Get vars for later */ \
- VB = &TNL_CONTEXT(ctx)->vb; \
- vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \
- if (VB->SecondaryColorPtr[1]) { \
- vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \
- } else { \
- vbspec = NULL; \
- } \
- v[0] = &verts[v0]; \
- v[1] = &verts[v1]; \
- v[2] = &verts[v2]; \
- ex = v[0]->win[0] - v[2]->win[0]; \
- ey = v[0]->win[1] - v[2]->win[1]; \
- fx = v[1]->win[0] - v[2]->win[0]; \
- fy = v[1]->win[1] - v[2]->win[1]; \
- cc = ex*fy - ey*fx; \
- facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; \
- }
-
-//---------------------------------------------------------------------------
-// 3D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_3D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pPoints; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pLines; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_TRIANGLES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pTriangles; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VERTEX(v) \
- p4f = VB->ObjPtr->data; \
- pV->Position.x = p4f[##v][0]; \
- pV->Position.y = p4f[##v][1]; \
- pV->Position.z = p4f[##v][2];
-
-#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-
-#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-#define GLD_SETUP_USE_FLAT_COLOUR_3D \
- pV->Diffuse = dwColor;
-
-#define GLD_SETUP_TEX0_3D(v) \
- if (VB->TexCoordPtr[0]) { \
- tc = VB->TexCoordPtr[0]->data; \
- pV->TexUnit0.x = tc[##v][0]; \
- pV->TexUnit0.y = tc[##v][1]; \
- }
-
-#define GLD_SETUP_TEX1_3D(v) \
- if (VB->TexCoordPtr[1]) { \
- tc = VB->TexCoordPtr[1]->data; \
- pV->TexUnit1.x = tc[##v][0]; \
- pV->TexUnit1.y = tc[##v][1]; \
- }
-
-//---------------------------------------------------------------------------
-// Helper functions
-//---------------------------------------------------------------------------
-
-__inline DWORD _gldComputeFog(
- GLcontext *ctx,
- SWvertex *swv)
-{
- // Full fog calculation.
- // Based on Mesa code.
-
- GLchan rFog, gFog, bFog;
- GLchan fR, fG, fB;
- const GLfloat f = swv->fog;
- const GLfloat g = 1.0 - f;
-
- UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
- fR = f * swv->color[0] + g * rFog;
- fG = f * swv->color[1] + g * gFog;
- fB = f * swv->color[2] + g * bFog;
- return D3DCOLOR_RGBA(fR, fG, fB, swv->color[3]);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ResetLineStipple_DX7(
- GLcontext *ctx)
-{
- // TODO: Fake stipple with a 32x32 texture.
-}
-
-//---------------------------------------------------------------------------
-// 2D (post-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points2D_DX7(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_2D_VARS_POINTS;
-
- unsigned i;
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- // Not supported by DX7
-// IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
- GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- } else {
- GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, swv++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- }
-
- gld->PB2d.pPoints = (BYTE*)pV;
- gld->PB2d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
-
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatExtras_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v2);
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v2);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothExtras_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatExtras_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v3);
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v3);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothExtras_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v3);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// 3D (pre-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points3D_DX7(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_3D_VARS_POINTS
-
- unsigned i;
-// struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- // Not supported by DX7
-// IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
-// GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_3D_VERTEX(VB->Elts[i])
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- } else {
-// GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- }
-/*
- for (i=first; i<last; i++, pV++) {
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
-*/
- gld->PB3d.pPoints = (BYTE*)pV;
- gld->PB3d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-// Line functions
-//---------------------------------------------------------------------------
-
-void gld_Line3DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line3DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-// Triangle functions
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-// Quad functions
-//---------------------------------------------------------------------------
-
-void gld_Quad3DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad3DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_SMOOTH_COLOUR_3D(v3)
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// Vertex setup for two-sided-lighting vertex shader
-//---------------------------------------------------------------------------
-
-/*
-
-void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last)
-{
- // NOTE: Two-sided lighting does not apply to Points
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-*/
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c
deleted file mode 100644
index bbe673516..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c
+++ /dev/null
@@ -1,2196 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Texture / Bitmap functions
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-//#include <d3dx8tex.h>
-
-#include "texformat.h"
-#include "colormac.h"
-#include "texstore.h"
-#include "image.h"
-// #include "mem.h"
-
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_HEIGHT(y,h) (gldCtx->dwHeight - (y) - (h))
-
-D3DX_SURFACEFORMAT _gldD3DXFormatFromSurface(IDirectDrawSurface7 *pSurface);
-
-//---------------------------------------------------------------------------
-// 1D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + (i) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (i) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (i))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (i))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 2D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + ((t)->Width * (j) + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 3D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz)
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// Direct3D texture formats that have no Mesa equivalent
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format _gld_texformat_X8R8G8B8 = {
- MESA_FORMAT_ARGB8888, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 8, /* RedBits */
- 8, /* GreenBits */
- 8, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 4, /* TexelBytes */
- _mesa_texstore_argb8888, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */
- gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */
- gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X1R5G5B5 = {
- MESA_FORMAT_ARGB1555, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 5, /* RedBits */
- 5, /* GreenBits */
- 5, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb1555, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */
- gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */
- gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X4R4G4B4 = {
- MESA_FORMAT_ARGB4444, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 4, /* RedBits */
- 4, /* GreenBits */
- 4, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb4444, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */
- gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */
- gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */
-};
-
-//---------------------------------------------------------------------------
-// Texture unit constants
-//---------------------------------------------------------------------------
-
-// List of possible combinations of texture environments.
-// Example: GLD_TEXENV_MODULATE_RGBA means
-// GL_MODULATE, GL_RGBA base internal format.
-#define GLD_TEXENV_DECAL_RGB 0
-#define GLD_TEXENV_DECAL_RGBA 1
-#define GLD_TEXENV_DECAL_ALPHA 2
-#define GLD_TEXENV_REPLACE_RGB 3
-#define GLD_TEXENV_REPLACE_RGBA 4
-#define GLD_TEXENV_REPLACE_ALPHA 5
-#define GLD_TEXENV_MODULATE_RGB 6
-#define GLD_TEXENV_MODULATE_RGBA 7
-#define GLD_TEXENV_MODULATE_ALPHA 8
-#define GLD_TEXENV_BLEND_RGB 9
-#define GLD_TEXENV_BLEND_RGBA 10
-#define GLD_TEXENV_BLEND_ALPHA 11
-#define GLD_TEXENV_ADD_RGB 12
-#define GLD_TEXENV_ADD_RGBA 13
-#define GLD_TEXENV_ADD_ALPHA 14
-
-// Per-stage (i.e. per-unit) texture environment
-typedef struct {
- DWORD ColorArg1; // Colour argument 1
- D3DTEXTUREOP ColorOp; // Colour operation
- DWORD ColorArg2; // Colour argument 2
- DWORD AlphaArg1; // Alpha argument 1
- D3DTEXTUREOP AlphaOp; // Alpha operation
- DWORD AlphaArg2; // Alpha argument 2
-} GLD_texenv;
-
-// TODO: Do we really need to set ARG1 and ARG2 every time?
-// They seem to always be TEXTURE and CURRENT respectively.
-
-// C = Colour out
-// A = Alpha out
-// Ct = Colour from Texture
-// Cf = Colour from fragment (diffuse)
-// At = Alpha from Texture
-// Af = Alpha from fragment (diffuse)
-// Cc = GL_TEXTURE_ENV_COLOUR (GL_BLEND)
-const GLD_texenv gldTexEnv[] = {
- // DECAL_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_RGBA: C=Cf(1-At)+CtAt, A=Af
- {D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_ALPHA: <undefined> use DECAL_RGB
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
-
- // REPLACE_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // REPLACE_RGBA: C=Ct, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
- // REPLACE_ALPHA: C=Cf, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
-
- // MODULATE_RGB: C=CfCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // MODULATE_RGBA: C=CfCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // MODULATE_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- //
- // DX7 Does not support D3DTOP_LERP
- // Emulate(?) via D3DTOP_ADDSMOOTH
- //
-#if 0
- // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-#else
- // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_ADDSMOOTH, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_ADDSMOOTH, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-#endif
- // BLEND_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // ADD_RGB: C=Cf+Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // ADD_RGBA: C=Cf+Ct, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // ADD_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-};
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREADDRESS _gldConvertWrap(
- GLenum wrap)
-{
-// ASSERT(wrap==GL_CLAMP || wrap==GL_REPEAT);
- return (wrap == GL_CLAMP) ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREMAGFILTER _gldConvertMagFilter(
- GLenum magfilter)
-{
- ASSERT(magfilter==GL_LINEAR || magfilter==GL_NEAREST);
- return (magfilter == GL_LINEAR) ? D3DTFG_LINEAR : D3DTFG_POINT;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldConvertMinFilter(
- GLenum minfilter,
- D3DTEXTUREMINFILTER *min_filter,
- D3DTEXTUREMIPFILTER *mip_filter)
-{
- switch (minfilter) {
- case GL_NEAREST:
- *min_filter = D3DTFN_POINT;
- *mip_filter = D3DTFP_NONE;
- break;
- case GL_LINEAR:
- *min_filter = D3DTFN_LINEAR;
- *mip_filter = D3DTFP_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- *min_filter = D3DTFN_POINT;
- *mip_filter = D3DTFP_POINT;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- *min_filter = D3DTFN_LINEAR;
- *mip_filter = D3DTFP_POINT;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- *min_filter = D3DTFN_POINT;
- *mip_filter = D3DTFP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- *min_filter = D3DTFN_LINEAR;
- *mip_filter = D3DTFP_LINEAR;
- break;
- default:
- ASSERT(0);
- }
-}
-
-//---------------------------------------------------------------------------
-
-D3DX_SURFACEFORMAT _gldGLFormatToD3DFormat(
- GLenum internalFormat)
-{
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- // LUNIMANCE != INTENSITY, but D3D doesn't have I8 textures
- return D3DX_SF_L8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return D3DX_SF_L8;
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return D3DX_SF_A8;
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return D3DX_SF_X8R8G8B8;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return D3DX_SF_A8L8;
- case GL_R3_G3_B2:
- // TODO: Mesa does not support RGB332 internally
- return D3DX_SF_X4R4G4B4; //D3DFMT_R3G3B2;
- case GL_RGB4:
- return D3DX_SF_X4R4G4B4;
- case GL_RGB5:
- return D3DX_SF_R5G5B5;
- case 3:
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return D3DX_SF_R8G8B8;
- case GL_RGBA4:
- return D3DX_SF_A4R4G4B4;
- case 4:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return D3DX_SF_A8R8G8B8;
- case GL_RGB5_A1:
- return D3DX_SF_A1R5G5B5;
- }
-
- ASSERT(0);
-
- // Return an acceptable default
- return D3DX_SF_A8R8G8B8;
-}
-
-//---------------------------------------------------------------------------
-
-GLenum _gldDecodeBaseFormat(
- IDirectDrawSurface7 *pTex)
-{
- // Examine Direct3D texture and return base OpenGL internal texture format
- // NOTE: We can't use any base format info from Mesa because D3D might have
- // used a different texture format when we used D3DXCreateTexture().
-
- // Base internal format is one of (Red Book p355):
- // GL_ALPHA,
- // GL_LUMINANCE,
- // GL_LUMINANCE_ALPHA,
- // GL_INTENSITY,
- // GL_RGB,
- // GL_RGBA
-
- // NOTE: INTENSITY not used (not supported by Direct3D)
- // LUMINANCE has same texture functions as RGB
- // LUMINANCE_ALPHA has same texture functions as RGBA
-
- // TODO: cache format instead of using GetLevelDesc()
-// D3DSURFACE_DESC desc;
-// _GLD_DX7_TEX(GetLevelDesc(pTex, 0, &desc));
-
- D3DX_SURFACEFORMAT sf;
-
- sf = _gldD3DXFormatFromSurface(pTex);
-
- switch (sf) {
- case D3DX_SF_R8G8B8:
- case D3DX_SF_X8R8G8B8:
- case D3DX_SF_R5G6B5:
- case D3DX_SF_R5G5B5:
- case D3DX_SF_R3G3B2:
- case D3DX_SF_X4R4G4B4:
- case D3DX_SF_PALETTE8:
- case D3DX_SF_L8:
- return GL_RGB;
- case D3DX_SF_A8R8G8B8:
- case D3DX_SF_A1R5G5B5:
- case D3DX_SF_A4R4G4B4:
-// case D3DX_SF_A8R3G3B2: // Unsupported by DX7
-// case D3DX_SF_A8P8: // Unsupported by DX7
- case D3DX_SF_A8L8:
-// case D3DX_SF_A4L4: // Unsupported by DX7
- return GL_RGBA;
- case D3DX_SF_A8:
- return GL_ALPHA;
- // Compressed texture formats. Need to check these...
- case D3DX_SF_DXT1:
- return GL_RGBA;
-// case D3DX_SF_DXT2: // Unsupported by DX7
- return GL_RGB;
- case D3DX_SF_DXT3:
- return GL_RGBA;
-// case D3DX_SF_DXT4: // Unsupported by DX7
- return GL_RGB;
- case D3DX_SF_DXT5:
- return GL_RGBA;
- }
-
- // Fell through. Return arbitary default.
- ASSERT(0); // BANG!
- return GL_RGBA;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* _gldMesaFormatForD3DFormat(
- D3DX_SURFACEFORMAT d3dfmt)
-{
- switch (d3dfmt) {
- case D3DX_SF_A8R8G8B8:
- return &_mesa_texformat_argb8888;
- case D3DX_SF_R8G8B8:
- return &_mesa_texformat_rgb888;
- case D3DX_SF_R5G6B5:
- return &_mesa_texformat_rgb565;
- case D3DX_SF_A4R4G4B4:
- return &_mesa_texformat_argb4444;
- case D3DX_SF_A1R5G5B5:
- return &_mesa_texformat_argb1555;
- case D3DX_SF_A8L8:
- return &_mesa_texformat_al88;
- case D3DX_SF_R3G3B2:
- return &_mesa_texformat_rgb332;
- case D3DX_SF_A8:
- return &_mesa_texformat_a8;
- case D3DX_SF_L8:
- return &_mesa_texformat_l8;
- case D3DX_SF_X8R8G8B8:
- return &_gld_texformat_X8R8G8B8;
- case D3DX_SF_R5G5B5:
- return &_gld_texformat_X1R5G5B5;
- case D3DX_SF_X4R4G4B4:
- return &_gld_texformat_X4R4G4B4;
- }
-
- // If we reach here then we've made an error somewhere else
- // by allowing a format that is not supported.
- ASSERT(0);
-
- return NULL; // Shut up compiler warning
-}
-
-//---------------------------------------------------------------------------
-
-D3DX_SURFACEFORMAT _gldD3DXFormatFromSurface(
- IDirectDrawSurface7 *pSurface)
-{
- DDPIXELFORMAT ddpf;
-
- ddpf.dwSize = sizeof(ddpf);
-
- // Obtain pixel format of surface
- _GLD_DX7_TEX(GetPixelFormat(pSurface, &ddpf));
- // Decode to D3DX surface format
- return D3DXMakeSurfaceFormat(&ddpf);
-}
-
-//---------------------------------------------------------------------------
-
-void _gldClearSurface(
- IDirectDrawSurface *pSurface,
- D3DCOLOR dwColour)
-{
- DDBLTFX bltFX; // Used for colour fill
-
- // Initialise struct
- bltFX.dwSize = sizeof(bltFX);
- // Set clear colour
- bltFX.dwFillColor = dwColour;
- // Clear surface. HW accelerated if available.
- IDirectDrawSurface7_Blt(pSurface, NULL, NULL, NULL, DDBLT_COLORFILL, &bltFX);
-}
-
-//---------------------------------------------------------------------------
-// Copy* functions
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage1D_DX7(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y,
- GLsizei width, GLint border )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage2D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLenum internalFormat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage1D_DX7(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage2D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage3D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height )
-{
- // TODO ?
-}
-
-//---------------------------------------------------------------------------
-// Bitmap/Pixel functions
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-#define _GLD_FVF_IMAGE (D3DFVF_XYZRHW | D3DFVF_TEX1)
-
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT z; // depth value
- FLOAT rhw; // reciprocal homogenous W (always 1.0f)
- FLOAT tu, tv; // texture coords
-} _GLD_IMAGE_VERTEX;
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldDrawPixels(
- GLcontext *ctx,
- BOOL bChromakey, // Alpha test for glBitmap() images
- GLint x, // GL x position
- GLint y, // GL y position (needs flipping)
- GLsizei width, // Width of input image
- GLsizei height, // Height of input image
- IDirectDrawSurface7 *pImage)
-{
- //
- // Draw input image as texture implementing PixelZoom and clipping.
- // Any fragment operations currently enabled will be used.
- //
-
- // NOTE: This DX7 version does not create a new texture in which
- // to copy the input image, as the image is already a texture.
-
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- DDSURFACEDESC2 ddsd;
- _GLD_IMAGE_VERTEX v[4];
-
- float ZoomWidth, ZoomHeight;
- float ScaleWidth, ScaleHeight;
-
- // Fixup for rasterisation rules
- const float cfEpsilon = 1.0f / (float)height;
-
- //
- // Set up the quad like this (ascii-art ahead!)
- //
- // 3--2
- // | |
- // 0--1
- //
- //
-
- // Set depth
- v[0].z = v[1].z = v[2].z = v[3].z = ctx->Current.RasterPos[2];
- // Set Reciprocal Homogenous W
- v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw = 1.0f;
-
- // Set texcoords
- // Examine texture size - if different to input width and height
- // then we'll need to munge the texcoords to fit.
- ddsd.dwSize = sizeof(DDSURFACEDESC2);
- IDirectDrawSurface7_GetSurfaceDesc(pImage, &ddsd);
- ScaleWidth = (float)width / (float)ddsd.dwWidth;
- ScaleHeight = (float)height / (float)ddsd.dwHeight;
- v[0].tu = 0.0f; v[0].tv = 0.0f;
- v[1].tu = ScaleWidth; v[1].tv = 0.0f;
- v[2].tu = ScaleWidth; v[2].tv = ScaleHeight;
- v[3].tu = 0.0f; v[3].tv = ScaleHeight;
-
- // Set raster positions
- ZoomWidth = (float)width * ctx->Pixel.ZoomX;
- ZoomHeight = (float)height * ctx->Pixel.ZoomY;
-
- v[0].x = x; v[0].y = GLD_FLIP_Y(y+cfEpsilon);
- v[1].x = x+ZoomWidth; v[1].y = GLD_FLIP_Y(y+cfEpsilon);
- v[2].x = x+ZoomWidth; v[2].y = GLD_FLIP_Y(y+ZoomHeight+cfEpsilon);
- v[3].x = x; v[3].y = GLD_FLIP_Y(y+ZoomHeight+cfEpsilon);
-
- // Draw image with full HW acceleration
- // NOTE: Be nice to use a State Block for all this state...
- IDirect3DDevice7_SetTexture(gld->pDev, 0, pImage);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_CLIPPING, TRUE);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_MINFILTER, D3DTFN_POINT);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_MIPFILTER, D3DTFP_POINT);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_MAGFILTER, D3DTFG_POINT);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- // Ensure texture unit 1 is disabled
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
-
- //
- // Emulate Chromakey with an Alpha Test.
- // [Alpha Test is more widely supported anyway]
- //
- if (bChromakey) {
- // Switch on alpha testing
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE);
- // Fragment passes is alpha is greater than reference value
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAFUNC, D3DCMP_GREATER);
- // Set alpha reference value between Bitmap alpha values of
- // zero (transparent) and one (opaque).
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAREF, 0x7f);
- }
-
- IDirect3DDevice7_DrawPrimitive(gld->pDev, D3DPT_TRIANGLEFAN, _GLD_FVF_IMAGE, &v, 4, 0);
-
- // Reset state to before we messed it up
- FLUSH_VERTICES(ctx, _NEW_ALL);
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DrawPixels_DX7(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- GLD_context *gldCtx;
- GLD_driver_dx7 *gld;
-
- IDirectDrawSurface7 *pImage;
- HRESULT hr;
- DDSURFACEDESC2 ddsd;
- DWORD dwFlags;
- D3DX_SURFACEFORMAT sf;
- DWORD dwMipmaps;
-
- const struct gl_texture_format *MesaFormat;
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- dwFlags = D3DX_TEXTURE_NOMIPMAP;
- sf = D3DX_SF_A8R8G8B8;
- dwMipmaps = 1;
-
- hr = D3DXCreateTexture(
- gld->pDev,
- &dwFlags,
- &width, &height,
- &sf, // format
- NULL, // palette
- &pImage, // Output texture
- &dwMipmaps);
- if (FAILED(hr)) {
- return;
- }
-
- // D3DXCreateTexture() may not clear the texture is creates.
- _gldClearSurface(pImage, 0);
-
- //
- // Use Mesa to fill in image
- //
-
- // Lock all of surface
- ddsd.dwSize = sizeof(DDSURFACEDESC2);
- dwFlags = DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT;
- hr = IDirectDrawSurface7_Lock(pImage, NULL, &ddsd, dwFlags, NULL);
- if (FAILED(hr)) {
- SAFE_RELEASE_SURFACE7(pImage);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA,
- &_mesa_texformat_argb8888,
- ddsd.lpSurface,
- width, height, 1, 0, 0, 0,
- ddsd.lPitch,
- 0, /* dstImageStride */
- format, type, pixels, unpack);
-
- IDirectDrawSurface7_Unlock(pImage, NULL);
-
- _gldDrawPixels(ctx, FALSE, x, y, width, height, pImage);
-
- SAFE_RELEASE_SURFACE7(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ReadPixels_DX7(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *dest)
-{
-// TODO
-#if 0
- GLD_context *gldCtx;
- GLD_driver_dx7 *gld;
-
- IDirect3DSurface8 *pBackbuffer = NULL;
- IDirect3DSurface8 *pNativeImage = NULL;
- IDirect3DSurface8 *pCanonicalImage = NULL;
-
- D3DSURFACE_DESC d3dsd;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- struct gl_pixelstore_attrib srcPacking;
- int i;
- GLint DstRowStride;
- const struct gl_texture_format *MesaFormat;
-
- switch (format) {
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- return;
- }
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
- DstRowStride = _mesa_image_row_stride(pack, width, format, type);
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice8_GetBackBuffer(
- gld->pDev,
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- &pNativeImage);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, x, GLD_FLIP_HEIGHT(y, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels.
- //
- // This intermediate surface ensure that we can use CopyRects()
- // instead of relying on D3DXLoadSurfaceFromSurface(), which may
- // try and lock the backbuffer. This way seems safer.
- //
- hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pNativeImage,
- &ptDst);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // Create an RGBA8888 surface
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- &pCanonicalImage);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // Convert to RGBA8888
- hr = D3DXLoadSurfaceFromSurface(
- pCanonicalImage, // Dest surface
- NULL, NULL, // Dest palette, RECT
- pNativeImage, // Src surface
- NULL, NULL, // Src palette, RECT
- D3DX_FILTER_NONE, // Filter
- 0); // Colourkey
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- srcPacking.Alignment = 1;
- srcPacking.ImageHeight = height;
- srcPacking.LsbFirst = GL_FALSE;
- srcPacking.RowLength = 0;
- srcPacking.SkipImages = 0;
- srcPacking.SkipPixels = 0;
- srcPacking.SkipRows = 0;
- srcPacking.SwapBytes = GL_FALSE;
-
- // Lock all of image
- hr = IDirect3DSurface8_LockRect(pCanonicalImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // We need to flip the data. Yuck.
- // Perhaps Mesa has a span packer we can use in future...
- for (i=0; i<height; i++) {
- BYTE *pDestRow = (BYTE*)_mesa_image_address(2,pack, dest, width, height, format, type, 0, i, 0);
- BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1));
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA, // base format
- MesaFormat, // dst format
- pDestRow, // dest addr
- width, 1, 1, 0, 0, 0, // src x,y,z & dst offsets x,y,z
- DstRowStride, // dst row stride
- 0, // dstImageStride
- GL_BGRA, // src format
- GL_UNSIGNED_BYTE, // src type
- pSrcRow, // src addr
- &srcPacking); // packing params of source image
- }
-
- IDirect3DSurface8_UnlockRect(pCanonicalImage);
-
-gld_ReadPixels_DX7_return:
- SAFE_RELEASE_SURFACE8(pCanonicalImage);
- SAFE_RELEASE_SURFACE8(pNativeImage);
- SAFE_RELEASE_SURFACE8(pBackbuffer);
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_CopyPixels_DX7(
- GLcontext *ctx,
- GLint srcx,
- GLint srcy,
- GLsizei width,
- GLsizei height,
- GLint dstx,
- GLint dsty,
- GLenum type)
-{
-// TODO
-#if 0
- //
- // NOTE: Not allowed to copy vidmem to vidmem!
- // Therefore we use an intermediate image surface.
- //
-
- GLD_context *gldCtx;
- GLD_driver_dx7 *gld;
-
- IDirect3DSurface8 *pBackbuffer;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface8 *pImage;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
-
- // Only backbuffer
- if (type != GL_COLOR)
- return;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice8_GetBackBuffer(
- gld->pDev,
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pBackbuffer);
- return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- &pImage);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pBackbuffer);
- return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, srcx, GLD_FLIP_HEIGHT(srcy, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels
- hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pImage,
- &ptDst);
- IDirect3DSurface8_Release(pBackbuffer);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- _gldDrawPixels(ctx, FALSE, dstx, dsty, width, height, pImage);
-
- IDirect3DSurface8_Release(pImage);
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Bitmap_DX7(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- GLD_context *gldCtx;
- GLD_driver_dx7 *gld;
-
- IDirectDrawSurface7 *pImage; // Bitmap texture
- HRESULT hr;
- BYTE *pTempBitmap; // Pointer to unpacked bitmap
- D3DCOLOR clBitmapOne; // Opaque bitmap colour
- D3DCOLOR clBitmapZero; // Transparent bitmap colour
- D3DCOLOR *pBits; // Pointer to texture surface
- const GLubyte *src;
- int i, j, k;
-
- DDSURFACEDESC2 ddsd; // Surface desc returned by lock call
- DWORD dwFlags;
- D3DX_SURFACEFORMAT sf;
- DWORD dwMipmaps;
-
- // Keep a copy of width/height as D3DXCreateTexture() call may alter input dimensions
- GLsizei dwWidth = width;
- GLsizei dwHeight = height;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Bail if no bitmap (only raster pos is updated)
- if ((bitmap == NULL) && (width==0) && (height==0))
- return;
-
- //
- // TODO: Detect conditions when created texture (pImage) is non-pow2.
- // Texture coords may need to be adjusted to compensate.
- //
-
- clBitmapZero = D3DCOLOR_RGBA(0,0,0,0); // NOTE: Alpha is Zero
- clBitmapOne = D3DCOLOR_COLORVALUE(
- ctx->Current.RasterColor[0],
- ctx->Current.RasterColor[1],
- ctx->Current.RasterColor[2],
- 1.0f); // NOTE: Alpha is One
-
- // Use Mesa to unpack bitmap into a canonical format
- pTempBitmap = _mesa_unpack_bitmap(width, height, bitmap, unpack);
- if (pTempBitmap == NULL)
- return;
-
- // Flags for texture creation
- dwFlags = D3DX_TEXTURE_NOMIPMAP;
- sf = D3DX_SF_A8R8G8B8;
- dwMipmaps = 1;
-
- // Create a D3D texture to hold the bitmap
- hr = D3DXCreateTexture(
- gld->pDev,
- &dwFlags,
- &dwWidth, &dwHeight,
- &sf, // format
- NULL, // palette
- &pImage, // Output texture
- &dwMipmaps);
- if (FAILED(hr)) {
- FREE(pTempBitmap);
- return;
- }
-
- // D3DXCreateTexture may return a texture bigger than we asked for
- // (i.e. padded to POW2) so let's clear the entire image bitmap.
- // Additional: Looks like this is not strictly necessary.
-// _gldClearSurface(pImage, clBitmapZero);
-
- ddsd.dwSize = sizeof(DDSURFACEDESC2);
- dwFlags = DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT;
- hr = IDirectDrawSurface7_Lock(pImage, NULL, &ddsd, dwFlags, NULL);
- if (FAILED(hr)) {
- FREE(pTempBitmap);
- SAFE_RELEASE_SURFACE7(pImage);
- return;
- }
-
-#if 0
- // DEBUG CODE
- if (!(width==ddsd.dwWidth && height==ddsd.dwHeight))
- ddlogPrintf(GLDLOG_WARN, "gld_Bitmap: In=%d,%d / Tex=%d,%d", width,height,ddsd.dwWidth,ddsd.dwHeight);
-#endif
-
-#if 0
- // DEBUG CODE
- ddlogPrintf(GLDLOG_SYSTEM, "gld_Bitmap: In=%d,%d / Tex=%d,%d", width,height,ddsd.dwWidth,ddsd.dwHeight);
- ddlogPrintf(GLDLOG_SYSTEM, "gld_Bitmap: bpp=%d", ddsd.ddpfPixelFormat.dwRGBBitCount);
-#endif
-
- // Cast texel pointer to texture surface.
- // We can do this because we used D3DX_SF_A8R8G8B8 as the format
- pBits = (D3DCOLOR*)ddsd.lpSurface;
-
-
- // Copy from the input bitmap into the texture
- for (i=0; i<height; i++) {
- GLubyte byte;
- pBits = (D3DCOLOR*)((BYTE*)ddsd.lpSurface + (i*ddsd.lPitch));
- src = (const GLubyte *) _mesa_image_address(2,
- &ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP,
- 0, i, 0);
- for (j=0; j<(width>>3); j++) {
- byte = *src++;
- for (k=0; k<8; k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- // Fill remaining bits from bitmap
- if (width & 7) {
- byte = *src;
- for (k=0; k<(width & 7); k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- }
-
- // We're done with the unpacked bitmap
- FREE(pTempBitmap);
-
- // Finished with texture surface - unlock it
- IDirectDrawSurface7_Unlock(pImage, NULL);
-
- // Use internal function to draw bitmap onto rendertarget
- _gldDrawPixels(ctx, TRUE, x, y, width, height, pImage);
-
- // We're done with the bitmap texure - release it
- IDirectDrawSurface7_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-// Texture functions
-//---------------------------------------------------------------------------
-
-void _gldAllocateTexture(
- GLcontext *ctx,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- HRESULT hr;
- IDirectDrawSurface7 *pTex;
- D3DX_SURFACEFORMAT d3dFormat;
- DWORD dwFlags;
- DWORD dwMipmaps;
- DWORD dwWidth, dwHeight;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirectDrawSurface7*)tObj->DriverData;
- if (pTex) {
- // Decide whether we can keep existing D3D texture
- // by examining top-level surface.
- DDSURFACEDESC2 ddsd;
- ddsd.dwSize = sizeof(DDSURFACEDESC2);
- _GLD_DX7_TEX(GetSurfaceDesc(pTex, &ddsd));
- // Release existing texture if not compatible
- if ((ddsd.dwWidth == texImage->Width) ||
- (ddsd.dwHeight == texImage->Height))
- {
- return; // Keep the existing texture
- }
- tObj->DriverData = NULL;
- _GLD_DX7_TEX(Release(pTex));
- }
-
- dwFlags = (glb.bUseMipmaps) ? 0 : D3DX_TEXTURE_NOMIPMAP;
- dwMipmaps = (glb.bUseMipmaps) ? D3DX_DEFAULT : 1;
- dwWidth = texImage->Width;
- dwHeight = texImage->Height;
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->IntFormat);
- hr = D3DXCreateTexture(
- gld->pDev,
- &dwFlags,
- &dwWidth,
- &dwHeight,
- &d3dFormat,
- NULL,
- &pTex,
- &dwMipmaps);
- if (FAILED(hr)) {
- gldLogError(GLDLOG_ERROR, "AllocateTexture failed", hr);
- }
- tObj->DriverData = pTex;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* gld_ChooseTextureFormat_DX7(
- GLcontext *ctx,
- GLint internalFormat,
- GLenum srcFormat,
- GLenum srcType)
-{
- // [Based on mesa_choose_tex_format()]
- //
- // We will choose only texture formats that are supported
- // by Direct3D. If the hardware doesn't support a particular
- // texture format, then the D3DX texture calls that we use
- // will automatically use a HW supported format.
- //
- // The most critical aim is to reduce copying; if we can use
- // texture-image data directly then it will be a big performance assist.
- //
-
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_a8; // D3DFMT_A8
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_rgb565; // D3DFMT_R5G6B5
- // Mesa will convert this for us later...
- // return &_mesa_texformat_ci8; // D3DFMT_R5G6B5
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_al88; // D3DFMT_A8L8
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb332; // D3DFMT_R3G3B2
- case GL_RGB4:
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444; // D3DFMT_A4R4G4B4
- case 3:
- case GL_RGB:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_rgb565;
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb8888;
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
- default:
- _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
- return NULL;
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
-// Safer(?), slower version.
-void gld_TexImage2D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- RECT rcSrcRect;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
-
- if (!tObj || !texImage)
- return;
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture8_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface8_Release(pSurface);
- return;
- }
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- SetRect(&rcSrcRect, 0, 0, width, height);
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- NULL,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface8_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexImage2D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- IDirectDrawSurface7 *pTex = NULL;
- IDirectDrawSurface7 *pSurface = NULL;
- HRESULT hr;
- DDSURFACEDESC2 ddsd;
- int i;
- DDSCAPS2 ddsCaps;
-
- if (!tObj || !texImage)
- return;
-
- // GLQUAKE FIX
- // Test for input alpha data with non-alpha internalformat
- if (((internalFormat==3) || (internalFormat==GL_RGB)) && (format==GL_RGBA)) {
- // Input format has alpha, but a non-alpha format has been requested.
- texImage->IntFormat = GL_RGBA;
- internalFormat = GL_RGBA;
- }
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirectDrawSurface7*)tObj->DriverData;
- if (!pTex) {
- ASSERT(0);
- return; // Texture has not been created
- }
-
- pSurface = pTex;
- if (level != 0) {
- ddsd.dwSize = sizeof(ddsd);
- _GLD_DX7_TEX(GetSurfaceDesc(pTex, &ddsd));
- if ((level > 0) && (level >= ddsd.dwMipMapCount))
- return; // Level does not exist
- ZeroMemory(&ddsCaps, sizeof(ddsCaps));
- for (i=0; i<level; i++) {
- ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP;
- hr = IDirectDrawSurface7_GetAttachedSurface(
- pSurface,
- &ddsCaps,
- &pSurface);
- if (SUCCEEDED(hr)) {
- IDirectDrawSurface7_Release(pSurface);
- } else {
- ;
- }
- }
- }
-
- // Lock all of surface
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(pSurface, NULL, &ddsd, 0, 0);
- if (FAILED(hr)) {
- IDirectDrawSurface7_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- texImage->Format,
- //_gldMesaFormatForD3DFormat(d3dsd.Format),
- _gldMesaFormatForD3DFormat(_gldD3DXFormatFromSurface(pSurface)),
- ddsd.lpSurface,
- width, height, 1, 0, 0, 0,
- ddsd.lPitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- IDirectDrawSurface7_Unlock(pSurface, NULL);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- // A 1D texture is a 2D texture with a height of zero
- gld_TexImage2D_DX7(ctx, target, level, internalFormat, width, 1, border, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-/*
-void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_GET_CONTEXT
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- D3DFORMAT d3dFormat;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
- RECT rcSrcRect;
- RECT rcDstRect;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= _GLD_DX8_TEX(GetLevelCount(pTex))
- return; // Level does not exist
- hr = _GLD_DX8_TEX(GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->Format);
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface8_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- // Source rectangle is whole of input image
- SetRect(&rcSrcRect, 0, 0, width, height);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- &rcDstRect,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface8_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- IDirectDrawSurface7 *pTex;
- IDirectDrawSurface7 *pSurface;
- HRESULT hr;
- RECT rcDstRect;
- DDSURFACEDESC2 ddsd;
- int i;
- DDSCAPS2 ddsCaps;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirectDrawSurface7*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
-
- __try {
-
- ddsd.dwSize = sizeof(ddsd);
- _GLD_DX7_TEX(GetSurfaceDesc(pTex, &ddsd));
- if ((level > 0) && (level >= ddsd.dwMipMapCount))
- return; // Level does not exist
-
- ZeroMemory(&ddsCaps, sizeof(ddsCaps));
- pSurface = pTex;
- for (i=0; i<level; i++) {
- ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP;
- hr = IDirectDrawSurface7_GetAttachedSurface(
- pSurface,
- &ddsCaps,
- &pSurface);
- if(SUCCEEDED(hr)) {
- IDirectDrawSurface7_Release(pSurface);
- } else {
- return;
- }
- }
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- // Lock sub-rect of surface
- hr = IDirectDrawSurface7_Lock(pSurface, &rcDstRect, &ddsd, 0, 0);
- if (FAILED(hr)) {
- IDirectDrawSurface7_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- _gldMesaFormatForD3DFormat(_gldD3DXFormatFromSurface(pSurface)),
- ddsd.lpSurface,
- width, height, 1,
- 0, 0, 0, // NOTE: d3dLockedRect.pBits is already offset!!!
- ddsd.lPitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
-
- IDirectDrawSurface7_Unlock(pSurface, &rcDstRect);
- }
- __except(EXCEPTION_EXECUTE_HANDLER) {
- ;
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexSubImage1D_DX7( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gld_TexSubImage2D_DX7(ctx, target, level, xoffset, 0, width, 1, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DeleteTexture_DX7(
- GLcontext *ctx,
- struct gl_texture_object *tObj)
-{
- GLD_context *gld = (GLD_context*)(ctx->DriverCtx);
-
- __try {
-
- if (tObj) {
- IDirectDrawSurface7 *pTex = (IDirectDrawSurface7*)tObj->DriverData;
- if (pTex) {
-/* // Make sure texture is not bound to a stage before releasing it
- for (int i=0; i<MAX_TEXTURE_UNITS; i++) {
- if (gld->CurrentTexture[i] == pTex) {
- gld->pDev->SetTexture(i, NULL);
- gld->CurrentTexture[i] = NULL;
- }
- }*/
- _GLD_DX7_TEX(Release(pTex));
- tObj->DriverData = NULL;
- }
- }
-
- }
- __except(EXCEPTION_EXECUTE_HANDLER) {
- ;
- }
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetColorOps(
- const GLD_driver_dx7 *gld,
- GLuint unit,
- DWORD ColorArg1,
- D3DTEXTUREOP ColorOp,
- DWORD ColorArg2)
-{
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG1, ColorArg1));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLOROP, ColorOp));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG2, ColorArg2));
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetAlphaOps(
- const GLD_driver_dx7 *gld,
- GLuint unit,
- DWORD AlphaArg1,
- D3DTEXTUREOP AlphaOp,
- DWORD AlphaArg2)
-{
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG1, AlphaArg1));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAOP, AlphaOp));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG2, AlphaArg2));
-}
-
-//---------------------------------------------------------------------------
-
-void gldUpdateTextureUnit(
- GLcontext *ctx,
- GLuint unit,
- BOOL bPassThrough)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DTEXTUREMINFILTER minfilter;
- D3DTEXTUREMIPFILTER mipfilter;
- GLenum BaseFormat;
- DWORD dwColorArg0;
- int iTexEnv = 0;
- GLD_texenv *pTexenv;
-
- // NOTE: If bPassThrough is FALSE then texture stage can be
- // disabled otherwise it must pass-through it's current fragment.
-
- const struct gl_texture_unit *pUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = pUnit->_Current;
-
- IDirectDrawSurface7 *pTex = NULL;
- if (tObj) {
- pTex = (IDirectDrawSurface7*)tObj->DriverData;
- }
-
- __try {
-
- // Enable texturing if unit is enabled and a valid D3D texture exists
- // Mesa 5: TEXTUREn_x altered to TEXTURE_nD_BIT
- //if (pTex && (pUnit->Enabled & (TEXTURE0_1D | TEXTURE0_2D))) {
- if (pTex && (pUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT))) {
- // Enable texturing
- _GLD_DX7_DEV(SetTexture(gld->pDev, unit, pTex));
- } else {
- // Disable texturing, then return
- _GLD_DX7_DEV(SetTexture(gld->pDev, unit, NULL));
- if (bPassThrough) {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- } else {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- }
- return;
- }
-
- // Texture parameters
- _gldConvertMinFilter(tObj->MinFilter, &minfilter, &mipfilter);
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MINFILTER, minfilter));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MIPFILTER, mipfilter));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter)));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSU, _gldConvertWrap(tObj->WrapS)));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSV, _gldConvertWrap(tObj->WrapT)));
-
- // Texture priority
- _GLD_DX7_TEX(SetPriority(pTex, (DWORD)(tObj->Priority*65535.0f)));
-
- // Texture environment
- // TODO: Examine input texture for alpha and use specific alpha/non-alpha ops.
- // See Page 355 of the Red Book.
- BaseFormat = _gldDecodeBaseFormat(pTex);
-
- switch (BaseFormat) {
- case GL_RGB:
- iTexEnv = 0;
- break;
- case GL_RGBA:
- iTexEnv = 1;
- break;
- case GL_ALPHA:
- iTexEnv = 2;
- break;
- }
-
- switch (pUnit->EnvMode) {
- case GL_DECAL:
- iTexEnv += 0;
- break;
- case GL_REPLACE:
- iTexEnv += 3;
- break;
- case GL_MODULATE:
- iTexEnv += 6;
- break;
- case GL_BLEND:
- // Set blend colour
- // Unsupported by DX7
-// dwColorArg0 = D3DCOLOR_COLORVALUE(pUnit->EnvColor[0], pUnit->EnvColor[1], pUnit->EnvColor[2], pUnit->EnvColor[3]);
-// _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG0, dwColorArg0));
-// gldLogMessage(GLDLOG_WARN, "GL_BLEND\n");
- iTexEnv += 9;
- break;
- case GL_ADD:
- iTexEnv += 12;
- break;
- }
- pTexenv = (GLD_texenv*)&gldTexEnv[iTexEnv];
- _gldSetColorOps(gld, unit, pTexenv->ColorArg1, pTexenv->ColorOp, pTexenv->ColorArg2);
- _gldSetAlphaOps(gld, unit, pTexenv->AlphaArg1, pTexenv->AlphaOp, pTexenv->AlphaArg2);
-
- }
- __except(EXCEPTION_EXECUTE_HANDLER) {
- ;
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_TEXTURE_DX7(
- GLcontext *ctx)
-{
- // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units
-
- BOOL bUnit0Enabled;
- BOOL bUnit1Enabled;
-
- if (!ctx)
- return; // Sanity check
-
- if (ctx->Const.MaxTextureUnits == 1) {
- gldUpdateTextureUnit(ctx, 0, TRUE);
- return;
- }
-
- //
- // NOTE: THE FOLLOWING RELATES TO TWO TEXTURE UNITS, AND TWO ONLY!!
- //
-
- // Mesa 5: Texture Units altered
- bUnit0Enabled = (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
- bUnit1Enabled = (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
-
- // If Unit0 is disabled and Unit1 is enabled then we must pass-though
- gldUpdateTextureUnit(ctx, 0, (!bUnit0Enabled && bUnit1Enabled) ? TRUE : FALSE);
- // We can always disable the last texture unit
- gldUpdateTextureUnit(ctx, 1, FALSE);
-
-#ifdef _DEBUG
- {
- // Find out whether device supports current renderstates
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- DWORD dwPasses;
- _GLD_DX7_DEV(ValidateDevice(gld->pDev, &dwPasses));
-#if 0
- if (FAILED(hr)) {
- gldLogError(GLDLOG_ERROR, "ValidateDevice failed", hr);
- }
-#endif
- if (dwPasses != 1) {
- gldLogMessage(GLDLOG_ERROR, "ValidateDevice: Can't do in one pass\n");
- }
- }
-#endif
-};
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c
deleted file mode 100644
index a85620dde..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect fastpath pipeline stage
-*
-****************************************************************************/
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-/*
-__inline void _gldSetVertexShaderConstants(
- GLcontext *ctx,
- GLD_driver_dx8 *gld)
-{
- D3DXMATRIX mat, matView, matProj;
- GLfloat *pM;
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ModelView.m;
- pM = ctx->ModelviewMatrixStack.Top->m;
- matView._11 = pM[0];
- matView._12 = pM[1];
- matView._13 = pM[2];
- matView._14 = pM[3];
- matView._21 = pM[4];
- matView._22 = pM[5];
- matView._23 = pM[6];
- matView._24 = pM[7];
- matView._31 = pM[8];
- matView._32 = pM[9];
- matView._33 = pM[10];
- matView._34 = pM[11];
- matView._41 = pM[12];
- matView._42 = pM[13];
- matView._43 = pM[14];
- matView._44 = pM[15];
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ProjectionMatrix.m;
- pM = ctx->ProjectionMatrixStack.Top->m;
- matProj._11 = pM[0];
- matProj._12 = pM[1];
- matProj._13 = pM[2];
- matProj._14 = pM[3];
- matProj._21 = pM[4];
- matProj._22 = pM[5];
- matProj._23 = pM[6];
- matProj._24 = pM[7];
- matProj._31 = pM[8];
- matProj._32 = pM[9];
- matProj._33 = pM[10];
- matProj._34 = pM[11];
- matProj._41 = pM[12];
- matProj._42 = pM[13];
- matProj._43 = pM[14];
- matProj._44 = pM[15];
-
- D3DXMatrixMultiply( &mat, &matView, &matProj );
- D3DXMatrixTranspose( &mat, &mat );
-
- _GLD_DX8_DEV(SetVertexShaderConstant(gld->pDev, 0, &mat, 4));
-}
-*/
-//---------------------------------------------------------------------------
-
-static GLboolean gld_d3d_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- TNLcontext *tnl;
- struct vertex_buffer *VB;
- tnl_render_func *tab;
- GLint pass;
- GLD_pb_dx7 *gldPB = &gld->PB3d;
- DWORD dwFlags;
-
-/*
- static int count = 0;
- count++;
- if (count != 2)
- return GL_FALSE;
-*/
- // The "check" function should disable this stage,
- // but we'll test gld->bUseMesaTnL anyway.
- if (gld->bUseMesaTnL) {
- // Do nothing in this stage, but continue pipeline
- return GL_TRUE;
- }
-
- tnl = TNL_CONTEXT(ctx);
- VB = &tnl->vb;
- pass = 0;
-
- tnl->Driver.Render.Start( ctx );
-
-#if 0
- // For debugging: Useful to see if an app passes colour data in
- // an unusual format.
- switch (VB->ColorPtr[0]->Type) {
- case GL_FLOAT:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n");
- break;
- case GL_UNSIGNED_BYTE:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_UNSIGNED_BYTE\n");
- break;
- default:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: *?*\n");
- break;
- }
-#endif
-
- tnl->Driver.Render.Points = gld_Points3D_DX7;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line3DFlat_DX7;
- tnl->Driver.Render.Triangle = gld_Triangle3DFlat_DX7;
- tnl->Driver.Render.Quad = gld_Quad3DFlat_DX7;
- } else {
- tnl->Driver.Render.Line = gld_Line3DSmooth_DX7;
- tnl->Driver.Render.Triangle = gld_Triangle3DSmooth_DX7;
- tnl->Driver.Render.Quad = gld_Quad3DSmooth_DX7;
- }
-
-// _GLD_DX7_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- dwFlags = DDLOCK_DISCARDCONTENTS | DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY;
- _GLD_DX7_VB(Lock(gldPB->pVB, dwFlags, &gldPB->pPoints, NULL));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts);
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length)
- {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
- _GLD_DX7_VB(Unlock(gldPB->pVB));
-
-// _GLD_DX7_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, gldPB->dwStride));
-
- _GLD_DX7_DEV(SetTransform(gld->pDev, D3DTRANSFORMSTATE_PROJECTION, &gld->matProjection));
- _GLD_DX7_DEV(SetTransform(gld->pDev, D3DTRANSFORMSTATE_WORLD, &gld->matModelView));
-
- if (gldPB->nPoints) {
-// _GLD_DX7_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_POINTLIST, gldPB->pVB, 0, gldPB->nPoints, 0));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
-// _GLD_DX7_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_LINELIST, gldPB->pVB, gldPB->iFirstLine, gldPB->nLines, 0));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
-// _GLD_DX7_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_TRIANGLELIST, gldPB->pVB, gldPB->iFirstTriangle, gldPB->nTriangles, 0));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-//---------------------------------------------------------------------------
-
-const struct tnl_pipeline_stage _gld_d3d_render_stage =
-{
- "gld_d3d_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- gld_d3d_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c
deleted file mode 100644
index 72e5e1308..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c
+++ /dev/null
@@ -1,422 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keithw@valinux.com>
- */
-
-
-/*
- * Render whole vertex buffers, including projection of vertices from
- * clip space and clipping of primitives.
- *
- * This file makes calls to project vertices and to the point, line
- * and triangle rasterizers via the function pointers:
- *
- * context->Driver.Render.*
- *
- */
-
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-/**********************************************************************/
-/* Clip single primitives */
-/**********************************************************************/
-
-
-#if defined(USE_IEEE)
-#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
-//#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
-#else
-#define NEGATIVE(x) (x < 0)
-//#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0)
-/* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
-#endif
-
-
-#define W(i) coord[i][3]
-#define Z(i) coord[i][2]
-#define Y(i) coord[i][1]
-#define X(i) coord[i][0]
-#define SIZE 4
-#define TAG(x) x##_4
-#include "tnl/t_vb_cliptmp.h"
-
-
-
-/**********************************************************************/
-/* Clip and render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, with the possibility of clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte ormask = c1|c2; \
- if (!ormask) \
- LineFunc( ctx, v1, v2 ); \
- else if (!(c1 & c2 & 0x3f)) \
- clip_line_4( ctx, v1, v2, ormask ); \
-} while (0)
-
-#define RENDER_TRI( v1, v2, v3 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \
- GLubyte ormask = c1|c2|c3; \
- if (!ormask) \
- TriangleFunc( ctx, v1, v2, v3 ); \
- else if (!(c1 & c2 & c3 & 0x3f)) \
- clip_tri_4( ctx, v1, v2, v3, ormask ); \
-} while (0)
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte c3 = mask[v3], c4 = mask[v4]; \
- GLubyte ormask = c1|c2|c3|c4; \
- if (!ormask) \
- QuadFunc( ctx, v1, v2, v3, v4 ); \
- else if (!(c1 & c2 & c3 & c4 & 0x3f)) \
- clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \
-} while (0)
-
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const GLubyte *mask = VB->ClipMask; \
- const GLuint sz = VB->ClipPtr->size; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt; (void) mask; (void) sz; (void) stipple;
-
-#define TAG(x) clip_##x##_verts
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/* Elts, with the possibility of clipping.
- */
-#undef ELT
-#undef TAG
-#define ELT(x) elt[x]
-#define TAG(x) clip_##x##_elts
-#include "tnl/t_vb_rendertmp.h"
-
-/* TODO: do this for all primitives, verts and elts:
- */
-static void clip_elt_triangles( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES];
- struct vertex_buffer *VB = &tnl->vb;
- const GLuint * const elt = VB->Elts;
- GLubyte *mask = VB->ClipMask;
- GLuint last = count-2;
- GLuint j;
- (void) flags;
-
- tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES );
-
- for (j=start; j < last; j+=3 ) {
- GLubyte c1 = mask[elt[j]];
- GLubyte c2 = mask[elt[j+1]];
- GLubyte c3 = mask[elt[j+2]];
- GLubyte ormask = c1|c2|c3;
- if (ormask) {
- if (start < j)
- render_tris( ctx, start, j, 0 );
- if (!(c1&c2&c3&0x3f))
- clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask );
- start = j+3;
- }
- }
-
- if (start < j)
- render_tris( ctx, start, j, 0 );
-}
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, no clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
- LineFunc( ctx, v1, v2 )
-
-#define RENDER_TRI( v1, v2, v3 ) \
- TriangleFunc( ctx, v1, v2, v3 )
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
- QuadFunc( ctx, v1, v2, v3, v4 )
-
-#define TAG(x) _gld_tnl_##x##_verts
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt;
-
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RENDER_TAB_QUALIFIER
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-/* Elts, no clipping.
- */
-#undef ELT
-#define TAG(x) _gld_tnl_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Helper functions for drivers */
-/**********************************************************************/
-/*
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint *tmp = VB->Elts;
-
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
-}
-
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-*/
-
-
-/**********************************************************************/
-/* Clip and render whole vertex buffers */
-/**********************************************************************/
-
-tnl_points_func _gldSetupPoints[4] = {
- gld_Points2D_DX7,
- gld_Points2D_DX7,
- gld_Points2D_DX7,
- gld_Points2D_DX7
-};
-tnl_line_func _gldSetupLine[4] = {
- gld_Line2DFlat_DX7,
- gld_Line2DSmooth_DX7,
- gld_Line2DFlat_DX7,
- gld_Line2DSmooth_DX7,
-};
-tnl_triangle_func _gldSetupTriangle[4] = {
- gld_Triangle2DFlat_DX7,
- gld_Triangle2DSmooth_DX7,
- gld_Triangle2DFlatExtras_DX7,
- gld_Triangle2DSmoothExtras_DX7
-};
-tnl_quad_func _gldSetupQuad[4] = {
- gld_Quad2DFlat_DX7,
- gld_Quad2DSmooth_DX7,
- gld_Quad2DFlatExtras_DX7,
- gld_Quad2DSmoothExtras_DX7
-};
-
-//---------------------------------------------------------------------------
-
-static GLboolean _gld_mesa_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- tnl_render_func *tab;
- GLint pass = 0;
- GLD_pb_dx7 *gldPB;
- DWORD dwFlags;
-
- /* Allow the drivers to lock before projected verts are built so
- * that window coordinates are guarenteed not to change before
- * rendering.
- */
- ASSERT(tnl->Driver.Render.Start);
-
- tnl->Driver.Render.Start( ctx );
-
- gldPB = &gld->PB2d;
- tnl->Driver.Render.Points = _gldSetupPoints[gld->iSetupFunc];
- tnl->Driver.Render.Line = _gldSetupLine[gld->iSetupFunc];
- tnl->Driver.Render.Triangle = _gldSetupTriangle[gld->iSetupFunc];
- tnl->Driver.Render.Quad = _gldSetupQuad[gld->iSetupFunc];
-
- dwFlags = DDLOCK_DISCARDCONTENTS | DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY;
- _GLD_DX7_VB(Lock(gldPB->pVB, dwFlags, &gldPB->pPoints, NULL));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
-
- // Allocate primitive pointers - gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 );
-
- if (VB->ClipOrMask) {
- tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
- clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles;
- }
- else {
- tab = (VB->Elts ?
- tnl->Driver.Render.PrimTabElts :
- tnl->Driver.Render.PrimTabVerts);
- }
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length) {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
-
-// tnl->Driver.Render.Finish( ctx );
-
- _GLD_DX7_VB(Unlock(gldPB->pVB));
-
- if (gldPB->nPoints) {
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_POINTLIST, gldPB->pVB, 0, gldPB->nPoints, 0));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_LINELIST, gldPB->pVB, gldPB->iFirstLine, gldPB->nLines*2, 0));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_TRIANGLELIST, gldPB->pVB, gldPB->iFirstTriangle, gldPB->nTriangles*3, 0));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-
-const struct tnl_pipeline_stage _gld_mesa_render_stage =
-{
- "gld_mesa_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- _gld_mesa_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c b/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c
deleted file mode 100644
index fa44a952a..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c
+++ /dev/null
@@ -1,1613 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 8.x WGL (WindowsGL)
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "gld_driver.h"
-//#include "gld_dxerr8.h"
-#include "gld_dx7.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-// Copied from dglcontect.c
-#define GLDERR_NONE 0
-#define GLDERR_MEM 1
-#define GLDERR_DDRAW 2
-#define GLDERR_D3D 3
-#define GLDERR_BPP 4
-#define GLDERR_DDS 5
-// This external var keeps track of any error
-extern int nContextError;
-
-// Uncomment this for persistant resources
-//#define _GLD_PERSISTANT
-
-#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL
-
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
-
-//---------------------------------------------------------------------------
-
-static char szColorDepthWarning[] =
-"GLDirect does not support the current desktop\n\
-color depth.\n\n\
-You may need to change the display resolution to\n\
-16 bits per pixel or higher color depth using\n\
-the Windows Display Settings control panel\n\
-before running this OpenGL application.\n";
-
-// The only depth-stencil formats currently supported by Direct3D
-// Surface Format Depth Stencil Total Bits
-// D3DFMT_D32 32 - 32
-// D3DFMT_D15S1 15 1 16
-// D3DFMT_D24S8 24 8 32
-// D3DFMT_D16 16 - 16
-// D3DFMT_D24X8 24 - 32
-// D3DFMT_D24X4S4 24 4 32
-
-// This pixel format will be used as a template when compiling the list
-// of pixel formats supported by the hardware. Many fields will be
-// filled in at runtime.
-// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM
-static DGL_pixelFormat pfTemplateHW =
-{
- {
- sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure
- 1, // Structure version - should be 1
- // Flags:
- PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface.
- PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM)
- PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM)
- PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing.
- PFD_DOUBLEBUFFER | // The buffer is double-buffered.
- 0, // Placeholder for easy commenting of above flags
- PFD_TYPE_RGBA, // Pixel type RGBA.
- 16, // Total colour bitplanes (excluding alpha bitplanes)
- 5, 0, // Red bits, shift
- 5, 0, // Green bits, shift
- 5, 0, // Blue bits, shift
- 0, 0, // Alpha bits, shift (destination alpha)
- 0, // Accumulator bits (total)
- 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha
- 0, // Depth bits
- 0, // Stencil bits
- 0, // Number of auxiliary buffers
- 0, // Layer type
- 0, // Specifies the number of overlay and underlay planes.
- 0, // Layer mask
- 0, // Specifies the transparent color or index of an underlay plane.
- 0 // Damage mask
- },
- D3DX_SF_UNKNOWN, // No depth/stencil buffer
-};
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-/*
-// Vertex Shader Declaration
-static DWORD dwTwoSidedLightingDecl[] =
-{
- D3DVSD_STREAM(0),
- D3DVSD_REG(0, D3DVSDT_FLOAT3), // XYZ position
- D3DVSD_REG(1, D3DVSDT_FLOAT3), // XYZ normal
- D3DVSD_REG(2, D3DVSDT_D3DCOLOR), // Diffuse color
- D3DVSD_REG(3, D3DVSDT_D3DCOLOR), // Specular color
- D3DVSD_REG(4, D3DVSDT_FLOAT2), // 2D texture unit 0
- D3DVSD_REG(5, D3DVSDT_FLOAT2), // 2D texture unit 1
- D3DVSD_END()
-};
-
-// Vertex Shader for two-sided lighting
-static char *szTwoSidedLightingVS =
-// This is a test shader!
-"vs.1.0\n"
-"m4x4 oPos,v0,c0\n"
-"mov oD0,v2\n"
-"mov oD1,v3\n"
-"mov oT0,v4\n"
-"mov oT1,v5\n"
-;
-*/
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-typedef struct {
-// HINSTANCE hD3D8DLL; // Handle to d3d8.dll
-// FNDIRECT3DCREATE7 fnDirect3DCreate7; // Direct3DCreate8 function prototype
-// BOOL bDirect3D; // Persistant Direct3D7 exists
-// BOOL bDirect3DDevice; // Persistant Direct3DDevice7 exists
-// IDirect3D7 *pD3D; // Persistant Direct3D7
-// IDirect3DDevice7 *pDev; // Persistant Direct3DDevice7
- BOOL bD3DXStarted;
-} GLD_dx7_globals;
-
-// These are "global" to all DX7 contexts. KeithH
-static GLD_dx7_globals dx7Globals;
-
-// Added for correct clipping of multiple open windows. (DaveM)
-LPDIRECTDRAWSURFACE7 lpDDSPrimary = NULL;
-LPDIRECTDRAWCLIPPER lpDDClipper = NULL;
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-BOOL gldGetDXErrorString_DX(
- HRESULT hr,
- char *buf,
- int nBufSize)
-{
- //
- // Return a string describing the input HRESULT error code
- //
-
- D3DXGetErrorString(hr, nBufSize, buf);
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-//
-// DX7 does not support multisample
-/*
-static D3DMULTISAMPLE_TYPE _gldGetDeviceMultiSampleType(
- IDirect3D8 *pD3D8,
- D3DFORMAT SurfaceFormat,
- D3DDEVTYPE d3dDevType,
- BOOL Windowed)
-{
- int i;
- HRESULT hr;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_NONE)
- return D3DMULTISAMPLE_NONE;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_FASTEST) {
- // Find fastest multisample
- for (i=2; i<17; i++) {
- hr = IDirect3D8_CheckDeviceMultiSampleType(
- pD3D8,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- } else {
- // Find nicest multisample
- for (i=16; i>1; i--) {
- hr = IDirect3D8_CheckDeviceMultiSampleType(
- pD3D8,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- }
-
- // Nothing found - return default
- return D3DMULTISAMPLE_NONE;
-}
-*/
-//---------------------------------------------------------------------------
-
-void _gldDestroyPrimitiveBuffer(
- GLD_pb_dx7 *gldVB)
-{
- SAFE_RELEASE(gldVB->pVB);
-
- // Sanity check...
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
-}
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldCreatePrimitiveBuffer(
- GLcontext *ctx,
- GLD_driver_dx7 *lpCtx,
- GLD_pb_dx7 *gldVB)
-{
- HRESULT hResult;
- char *szCreateVertexBufferFailed = "CreateVertexBuffer failed";
- DWORD dwMaxVertices; // Max number of vertices in vertex buffer
- DWORD dwVBSize; // Total size of vertex buffer
- D3DVERTEXBUFFERDESC vbdesc;
-
- // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we
- // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize.
- // We'll use IMM_SIZE if it's larger (which it should not be).
- dwMaxVertices = MAX_ARRAY_LOCK_SIZE;
-
- // Max vertex buffer size limited in DX7. (DaveM)
- if (dwMaxVertices*9 > D3DMAXNUMVERTICES)
- dwMaxVertices = D3DMAXNUMVERTICES/9;
-
- // Now calculate how many vertices to allow for in total
- // 1 per point, 2 per line, 6 per quad = 9
- dwVBSize = dwMaxVertices * 9 * gldVB->dwStride;
-
- vbdesc.dwSize = sizeof(vbdesc);
- vbdesc.dwCaps = gldVB->dwCreateFlags;
- vbdesc.dwFVF = gldVB->dwFVF;
- vbdesc.dwNumVertices = dwMaxVertices * 9;
-
-/* hResult = IDirect3DDevice8_CreateVertexBuffer(
- lpCtx->pDev,
- dwVBSize,
-RAgldVB->dwUsage,
- gldVB->dwFVF,
- gldVB->dwPool,
- &gldVB->pVB);*/
- hResult = IDirect3D7_CreateVertexBuffer(
- lpCtx->pD3D,
- &vbdesc,
- &gldVB->pVB,
- 0);
- if (FAILED(hResult)) {
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, szCreateVertexBufferFailed);
- return hResult;
- }
-
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
- gldVB->pPoints = gldVB->pLines = gldVB->pTriangles = NULL;
- gldVB->iFirstLine = dwMaxVertices; // Index of first line in VB
- gldVB->iFirstTriangle = dwMaxVertices*3; // Index of first triangle in VB
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-// Function: _gldCreateVertexShaders
-// Create DX8 Vertex Shaders.
-//---------------------------------------------------------------------------
-/*
-void _gldCreateVertexShaders(
- GLD_driver_dx8 *gld)
-{
- DWORD dwFlags;
- LPD3DXBUFFER pVSOpcodeBuffer; // Vertex Shader opcode buffer
- HRESULT hr;
-
-#ifdef _DEBUG
- dwFlags = D3DXASM_DEBUG;
-#else
- dwFlags = 0; // D3DXASM_SKIPVALIDATION;
-#endif
-
- ddlogMessage(DDLOG_INFO, "Creating shaders...\n");
-
- // Init the shader handle
- gld->VStwosidelight.hShader = 0;
-
- if (gld->d3dCaps8.MaxStreams == 0) {
- // Lame DX8 driver doesn't support streams
- // Not fatal, as defaults will be used
- ddlogMessage(DDLOG_WARN, "Driver doesn't support Vertex Shaders (MaxStreams==0)\n");
- return;
- }
-
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-// return;
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-
- //
- // Two-sided lighting
- //
-
-#if 0
- //
- // DEBUGGING: Load shader from a text file
- //
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- hr = D3DXAssembleShaderFromFile(
- "twoside.vsh",
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#else
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- // Assemble ascii shader text into shader opcodes
- hr = D3DXAssembleShader(
- szTwoSidedLightingVS,
- strlen(szTwoSidedLightingVS),
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#endif
- if (FAILED(hr)) {
- ddlogError(DDLOG_WARN, "AssembleShader failed", hr);
- SAFE_RELEASE(pVSOpcodeBuffer);
- return;
- }
-
-// This is for debugging. Remove to enable vertex shaders in HW
-#define _GLD_FORCE_SW_VS 0
-
- if (_GLD_FORCE_SW_VS) {
- // _GLD_FORCE_SW_VS should be disabled for Final Release
- ddlogMessage(DDLOG_SYSTEM, "[Forcing shaders in SW]\n");
- }
-
- // Try and create shader in hardware.
- // NOTE: The D3D Ref device appears to succeed when trying to
- // create the device in hardware, but later complains
- // when trying to set it with SetVertexShader(). Go figure.
- if (_GLD_FORCE_SW_VS || glb.dwDriver == GLDS_DRIVER_REF) {
- // Don't try and create a hardware shader with the Ref device
- hr = E_FAIL; // COM error/fail result
- } else {
- gld->VStwosidelight.bHardware = TRUE;
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- 0);
- }
- if (FAILED(hr)) {
- ddlogMessage(DDLOG_INFO, "... HW failed, trying SW...\n");
- // Failed. Try and create shader for software processing
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- D3DUSAGE_SOFTWAREPROCESSING);
- if (FAILED(hr)) {
- gld->VStwosidelight.hShader = 0; // Sanity check
- ddlogError(DDLOG_WARN, "CreateVertexShader failed", hr);
- return;
- }
- // Succeeded, but for software processing
- gld->VStwosidelight.bHardware = FALSE;
- }
-
- SAFE_RELEASE(pVSOpcodeBuffer);
-
- ddlogMessage(DDLOG_INFO, "... OK\n");
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyVertexShaders(
- GLD_driver_dx8 *gld)
-{
- if (gld->VStwosidelight.hShader) {
- IDirect3DDevice8_DeleteVertexShader(gld->pDev, gld->VStwosidelight.hShader);
- gld->VStwosidelight.hShader = 0;
- }
-}
-*/
-//---------------------------------------------------------------------------
-
-BOOL gldCreateDrawable_DX(
- DGL_ctx *ctx,
-// BOOL bDefaultDriver,
- BOOL bDirectDrawPersistant,
- BOOL bPersistantBuffers)
-{
- //
- // bDirectDrawPersistant: applies to IDirect3D8
- // bPersistantBuffers: applies to IDirect3DDevice8
- //
-
-// D3DDEVTYPE d3dDevType;
-// D3DPRESENT_PARAMETERS d3dpp;
-// D3DDISPLAYMODE d3ddm;
-// DWORD dwBehaviourFlags;
-// D3DADAPTER_IDENTIFIER8 d3dIdent;
-
- HRESULT hr;
- GLD_driver_dx7 *lpCtx = NULL;
- D3DX_VIDMODEDESC d3ddm;
-
- // Parameters for D3DXCreateContextEx
- // These will be different for fullscreen and windowed
- DWORD dwDeviceIndex;
- DWORD dwFlags;
- HWND hwnd;
- HWND hwndFocus;
- DWORD numColorBits;
- DWORD numAlphaBits;
- DWORD numDepthBits;
- DWORD numStencilBits;
- DWORD numBackBuffers;
- DWORD dwWidth;
- DWORD dwHeight;
- DWORD refreshRate;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- if (ctx->glPriv) {
- lpCtx = ctx->glPriv;
- // Release any existing interfaces (in reverse order)
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- lpCtx->pD3DXContext->lpVtbl->Release(lpCtx->pD3DXContext);
- lpCtx->pD3DXContext = NULL;
- } else {
- lpCtx = (GLD_driver_dx7*)malloc(sizeof(GLD_driver_dx7));
- ZeroMemory(lpCtx, sizeof(lpCtx));
- }
-
-// d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- // Use REF device if requested. Otherwise D3DX_DEFAULT will choose highest level
- // of HW acceleration.
- dwDeviceIndex = (glb.dwDriver == GLDS_DRIVER_REF) ? D3DX_HWLEVEL_REFERENCE : D3DX_DEFAULT;
-
- // TODO: Check this
-// if (bDefaultDriver)
-// d3dDevType = D3DDEVTYPE_REF;
-
-#ifdef _GLD_PERSISTANT
- // Use persistant interface if needed
- if (bDirectDrawPersistant && dx7Globals.bDirect3D) {
- lpCtx->pD3D = dx7Globals.pD3D;
- IDirect3D7_AddRef(lpCtx->pD3D);
- goto SkipDirectDrawCreate;
- }
-#endif
-/*
- // Create Direct3D7 object
- lpCtx->pD3D = dx7Globals.fnDirect3DCreate8(D3D_SDK_VERSION_DX8_SUPPORT_WIN95);
- if (lpCtx->pD3D == NULL) {
- MessageBox(NULL, "Unable to initialize Direct3D8", "GLDirect", MB_OK);
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D8 interface");
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-*/
-
-#ifdef _GLD_PERSISTANT
- // Cache Direct3D interface for subsequent GLRCs
- if (bDirectDrawPersistant && !dx8Globals.bDirect3D) {
- dx7Globals.pD3D = lpCtx->pD3D;
- IDirect3D7_AddRef(dx7Globals.pD3D);
- dx7Globals.bDirect3D = TRUE;
- }
-SkipDirectDrawCreate:
-#endif
-/*
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-*/
-
-#if 0
- // Get device caps
- hResult = IDirect3D8_GetDeviceCaps(lpCtx->pD3D, glb.dwAdapter, d3dDevType, &lpCtx->d3dCaps8);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_GetDeviceCaps failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Check for hardware transform & lighting
- lpCtx->bHasHWTnL = lpCtx->d3dCaps8.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE;
-
- // If this flag is present then we can't default to Mesa
- // SW rendering between BeginScene() and EndScene().
- if (lpCtx->d3dCaps8.Caps2 & D3DCAPS2_NO2DDURING3DSCENE) {
- ddlogMessage(DDLOG_WARN,
- "Warning : No 2D allowed during 3D scene.\n");
- }
-#endif
-
- //
- // Create the Direct3D context
- //
-
-#ifdef _GLD_PERSISTANT
- // Re-use original IDirect3DDevice if persistant buffers exist.
- // Note that we test for persistant IDirect3D8 as well
- // bDirectDrawPersistant == persistant IDirect3D8 (DirectDraw8 does not exist)
- if (bDirectDrawPersistant && bPersistantBuffers && dx7Globals.pD3D && dx7Globals.pDev) {
- lpCtx->pDev = dx7Globals.pDev;
- IDirect3DDevice7_AddRef(dx7Globals.pDev);
- goto skip_direct3ddevice_create;
- }
-#endif
-/*
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(lpCtx->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
-
- // Support for vertical retrace synchronisation.
- // Set default presentation interval in case caps bits are missing
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- if (glb.bWaitForRetrace) {
- if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_ONE)
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- } else {
- if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE)
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
- }
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- // FullScreen_PresentationInterval must be default for Windowed mode
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
-
- // Decide if we can use hardware TnL
- dwBehaviourFlags = (lpCtx->bHasHWTnL) ?
- D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING;
- // Add flag to tell D3D to be thread-safe
- if (glb.bMultiThreaded)
- dwBehaviourFlags |= D3DCREATE_MULTITHREADED;
- hResult = IDirect3D8_CreateDevice(lpCtx->pD3D,
- glb.dwAdapter,
- d3dDevType,
- ctx->hWnd,
- dwBehaviourFlags,
- &d3dpp,
- &lpCtx->pDev);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_CreateDevice failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-*/
-
- // Create D3DX context
- if (ctx->bFullscreen) {
- //
- // FULLSCREEN
- //
-
- // Get display mode
- D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
-
- // Fullscreen Parameters
- dwFlags = D3DX_CONTEXT_FULLSCREEN;
- hwnd = ctx->hWnd;
- hwndFocus = ctx->hWnd;
- numColorBits = ctx->lpPF->pfd.cColorBits;
- numAlphaBits = ctx->lpPF->pfd.cAlphaBits;
- numDepthBits = ctx->lpPF->pfd.cDepthBits + ctx->lpPF->pfd.cStencilBits;
- numStencilBits = ctx->lpPF->pfd.cStencilBits;
- numBackBuffers = D3DX_DEFAULT; // Default is 1 backbuffer
- dwWidth = d3ddm.width;
- dwHeight = d3ddm.height;
- refreshRate = d3ddm.refreshRate; // D3DX_DEFAULT;
- } else {
- //
- // WINDOWED
- //
-
- // Windowed Parameters
- dwFlags = 0; // No flags means "windowed"
- hwnd = ctx->hWnd;
- hwndFocus = (HWND)D3DX_DEFAULT;
- numColorBits = D3DX_DEFAULT; // Use Desktop depth
- numAlphaBits = ctx->lpPF->pfd.cAlphaBits;
- numDepthBits = ctx->lpPF->pfd.cDepthBits + ctx->lpPF->pfd.cStencilBits;
- numStencilBits = ctx->lpPF->pfd.cStencilBits;
- numBackBuffers = D3DX_DEFAULT; // Default is 1 backbuffer
- dwWidth = ctx->dwWidth;
- dwHeight = ctx->dwHeight;
- refreshRate = D3DX_DEFAULT;
- }
- hr = D3DXCreateContextEx(dwDeviceIndex, dwFlags, hwnd, hwndFocus,
- numColorBits, numAlphaBits, numDepthBits, numStencilBits,
- numBackBuffers,
- dwWidth, dwHeight, refreshRate,
- &lpCtx->pD3DXContext);
- if (FAILED(hr)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "D3DXCreateContextEx failed", hr);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Obtain D3D7 interfaces from ID3DXContext
-// lpCtx->pDD = ID3DXContext_GetDD(lpCtx->pD3DXContext);
- lpCtx->pDD = lpCtx->pD3DXContext->lpVtbl->GetDD(lpCtx->pD3DXContext);
- if (lpCtx->pDD == NULL)
- goto return_with_error;
- lpCtx->pD3D = lpCtx->pD3DXContext->lpVtbl->GetD3D(lpCtx->pD3DXContext);
- if (lpCtx->pD3D == NULL)
- goto return_with_error;
- lpCtx->pDev = lpCtx->pD3DXContext->lpVtbl->GetD3DDevice(lpCtx->pD3DXContext);
- if (lpCtx->pDev == NULL)
- goto return_with_error;
-
- // Need to manage clipper manually for multiple windows
- // since DX7 D3DX utility lib does not appear to do that. (DaveM)
- if (!ctx->bFullscreen) {
- // Get primary surface too
- lpDDSPrimary = lpCtx->pD3DXContext->lpVtbl->GetPrimary(lpCtx->pD3DXContext);
- if (lpDDSPrimary == NULL) {
- ddlogPrintf(DDLOG_WARN, "GetPrimary");
- goto return_with_error;
- }
- // Create clipper for correct window updates
- if (IDirectDraw7_CreateClipper(lpCtx->pDD, 0, &lpDDClipper, NULL) != DD_OK) {
- ddlogPrintf(DDLOG_WARN, "CreateClipper");
- goto return_with_error;
- }
- // Set the window that the clipper belongs to
- if (IDirectDrawClipper_SetHWnd(lpDDClipper, 0, hwnd) != DD_OK) {
- ddlogPrintf(DDLOG_WARN, "SetHWnd");
- goto return_with_error;
- }
- // Attach the clipper to the primary surface
- if (IDirectDrawSurface7_SetClipper(lpDDSPrimary, lpDDClipper) != DD_OK) {
- ddlogPrintf(DDLOG_WARN, "SetClipper");
- goto return_with_error;
- }
- }
-
- // Get device caps
- IDirect3DDevice7_GetCaps(lpCtx->pDev, &lpCtx->d3dCaps);
-
- // Determine HW TnL
- lpCtx->bHasHWTnL = lpCtx->d3dCaps.dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE;
-
-#ifdef _GLD_PERSISTANT
- if (bDirectDrawPersistant && bPersistantBuffers && dx7Globals.pD3D) {
- dx7Globals.pDev = lpCtx->pDev;
- dx7Globals.bDirect3DDevice = TRUE;
- }
-#endif
-
-#if 0
- // Dump some useful stats
- hResult = IDirect3D8_GetAdapterIdentifier(
- lpCtx->pD3D,
- glb.dwAdapter,
- D3DENUM_NO_WHQL_LEVEL, // Avoids 1 to 2 second delay
- &d3dIdent);
- if (SUCCEEDED(hResult)) {
- ddlogPrintf(DDLOG_INFO, "[Driver Description: %s]", &d3dIdent.Description);
- ddlogPrintf(DDLOG_INFO, "[Driver file: %s %d.%d.%02d.%d]",
- d3dIdent.Driver,
- HIWORD(d3dIdent.DriverVersion.HighPart),
- LOWORD(d3dIdent.DriverVersion.HighPart),
- HIWORD(d3dIdent.DriverVersion.LowPart),
- LOWORD(d3dIdent.DriverVersion.LowPart));
- ddlogPrintf(DDLOG_INFO, "[VendorId: 0x%X, DeviceId: 0x%X, SubSysId: 0x%X, Revision: 0x%X]",
- d3dIdent.VendorId, d3dIdent.DeviceId, d3dIdent.SubSysId, d3dIdent.Revision);
- }
-#endif
-
- // Init projection matrix for D3D TnL
- D3DXMatrixIdentity((D3DXMATRIX*)&lpCtx->matProjection);
- lpCtx->matModelView = lpCtx->matProjection;
-// gld->bUseMesaProjection = TRUE;
-
-skip_direct3ddevice_create:
-
- // Create buffers to hold primitives
- lpCtx->PB2d.dwFVF = GLD_FVF_2D_VERTEX;
-// lpCtx->PB2d.dwPool = D3DPOOL_SYSTEMMEM;
- lpCtx->PB2d.dwStride = sizeof(GLD_2D_VERTEX);
- lpCtx->PB2d.dwCreateFlags = D3DVBCAPS_DONOTCLIP |
- D3DVBCAPS_SYSTEMMEMORY |
- D3DVBCAPS_WRITEONLY;
- hr = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB2d);
- if (FAILED(hr))
- goto return_with_error;
-
- lpCtx->PB3d.dwFVF = GLD_FVF_3D_VERTEX;
-// lpCtx->PB3d.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PB3d.dwStride = sizeof(GLD_3D_VERTEX);
- lpCtx->PB3d.dwCreateFlags = D3DVBCAPS_WRITEONLY;
-
- hr = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB3d);
- if (FAILED(hr))
- goto return_with_error;
-
- // Zero the pipeline usage counters
- lpCtx->PipelineUsage.qwMesa.QuadPart =
-// lpCtx->PipelineUsage.dwD3D2SVS.QuadPart =
- lpCtx->PipelineUsage.qwD3DFVF.QuadPart = 0;
-
- // Assign drawable to GL private
- ctx->glPriv = lpCtx;
- return TRUE;
-
-return_with_error:
- // Clean up and bail
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- //SAFE_RELEASE(lpCtx->pD3DXContext);
- lpCtx->pD3DXContext->lpVtbl->Release(lpCtx->pD3DXContext);
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldResizeDrawable_DX(
- DGL_ctx *ctx,
- BOOL bDefaultDriver,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- GLD_driver_dx7 *gld = NULL;
-// D3DDEVTYPE d3dDevType;
-// D3DPRESENT_PARAMETERS d3dpp;
-// D3DDISPLAYMODE d3ddm;
- D3DX_VIDMODEDESC d3ddm;
- HRESULT hr;
- DWORD dwWidth, dwHeight;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice7_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-/*
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- if (!bDefaultDriver)
- d3dDevType = D3DDEVTYPE_REF; // Force Direct3D Reference Rasterise (software)
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D8_GetAdapterDisplayMode(gld->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
-// goto return_with_error;
- return FALSE;
- }
-*/
- // Release objects before Reset()
- _gldDestroyPrimitiveBuffer(&gld->PB3d);
- _gldDestroyPrimitiveBuffer(&gld->PB2d);
-
-/*
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(gld->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- // TODO: Sync to refresh
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- // Get better benchmark results? KeithH
-// d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_UNLIMITED;
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
- hResult = IDirect3DDevice8_Reset(gld->pDev, &d3dpp);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Reset failed", hResult);
- return FALSE;
- //goto cleanup_and_return_with_error;
- }
-*/
- // Obtain dimensions of 'window'
- if (ctx->bFullscreen) {
- D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
- dwWidth = d3ddm.width;
- dwHeight = d3ddm.height;
- } else {
- dwWidth = ctx->dwWidth;
- dwHeight = ctx->dwHeight;
- }
-
- // Resize context
- hr = gld->pD3DXContext->lpVtbl->Resize(gld->pD3DXContext, dwWidth, dwHeight);
- if (FAILED(hr)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "gldResizeDrawable_DX: Resize failed", hr);
- return FALSE;
- }
-
- // Clear the resized surface (DaveM)
- {
- D3DVIEWPORT7 vp1, vp2;
- IDirect3DDevice7_GetViewport(gld->pDev, &vp1);
- IDirect3DDevice7_GetViewport(gld->pDev, &vp2);
- vp2.dwX = 0;
- vp2.dwY = 0;
- vp2.dwWidth = dwWidth;
- vp2.dwHeight = dwHeight;
- IDirect3DDevice7_SetViewport(gld->pDev, &vp2);
- hr = gld->pD3DXContext->lpVtbl->Clear(gld->pD3DXContext, D3DCLEAR_TARGET);
- if (FAILED(hr))
- ddlogError(DDLOG_WARN, "gldResizeDrawable_DX: Clear failed", hr);
- IDirect3DDevice7_SetViewport(gld->pDev, &vp1);
- }
-
- //
- // Recreate objects
- //
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB3d);
-
- // Signal a complete state update
- ctx->glCtx->Driver.UpdateState(ctx->glCtx, _NEW_ALL);
-
- // Begin a new scene
- IDirect3DDevice7_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyDrawable_DX(
- DGL_ctx *ctx)
-{
- GLD_driver_dx7 *lpCtx = NULL;
-
- // Error if context is NULL.
- if (!ctx)
- return FALSE;
-
- // Error if the drawable does not exist.
- if (!ctx->glPriv)
- return FALSE;
-
- lpCtx = ctx->glPriv;
-
-#ifdef _DEBUG
- // Dump out stats
- ddlogPrintf(DDLOG_SYSTEM, "Usage: M:0x%X%X, D:0x%X%X",
- lpCtx->PipelineUsage.qwMesa.HighPart,
- lpCtx->PipelineUsage.qwMesa.LowPart,
- lpCtx->PipelineUsage.qwD3DFVF.HighPart,
- lpCtx->PipelineUsage.qwD3DFVF.LowPart);
-#endif
-
- // Destroy Primtive Buffers
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- // Release DX interfaces (in reverse order)
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- //SAFE_RELEASE(lpCtx->pD3DXContext);
- lpCtx->pD3DXContext->lpVtbl->Release(lpCtx->pD3DXContext);
-
- // Free the private drawable data
- free(ctx->glPriv);
- ctx->glPriv = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldCreatePrivateGlobals_DX(void)
-{
-/*
- ZeroMemory(&dx7Globals, sizeof(dx7Globals));
-
- // Load d3d8.dll
- dx8Globals.hD3D8DLL = LoadLibrary("D3D8.DLL");
- if (dx8Globals.hD3D8DLL == NULL)
- return FALSE;
-
- // Now try and obtain Direct3DCreate8
- dx8Globals.fnDirect3DCreate8 = (FNDIRECT3DCREATE8)GetProcAddress(dx8Globals.hD3D8DLL, "Direct3DCreate8");
- if (dx8Globals.fnDirect3DCreate8 == NULL) {
- FreeLibrary(dx8Globals.hD3D8DLL);
- return FALSE;
- }
-*/
-
- // Initialise D3DX
- return FAILED(D3DXInitialize()) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyPrivateGlobals_DX(void)
-{
-/*
- if (dx7Globals.bDirect3DDevice) {
- SAFE_RELEASE(dx7Globals.pDev);
- dx7Globals.bDirect3DDevice = FALSE;
- }
- if (dx7Globals.bDirect3D) {
- SAFE_RELEASE(dx7Globals.pD3D);
- dx7Globals.bDirect3D = FALSE;
- }
-
- FreeLibrary(dx8Globals.hD3D8DLL);
- dx8Globals.hD3D8DLL = NULL;
- dx8Globals.fnDirect3DCreate8 = NULL;
-*/
- return FAILED(D3DXUninitialize()) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDisplayFormat(
- D3DX_SURFACEFORMAT fmt,
- BYTE *cColorBits,
- BYTE *cRedBits,
- BYTE *cGreenBits,
- BYTE *cBlueBits,
- BYTE *cAlphaBits)
-{
- switch (fmt) {
-/* case D3DX_SF_X1R5G5B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 5;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;*/
- case D3DX_SF_R5G5B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 5;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DX_SF_R5G6B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 6;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DX_SF_X8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
- return;
- case D3DX_SF_A8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 8;
- return;
- }
-
- // Should not get here!
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDepthStencilFormat(
- D3DX_SURFACEFORMAT fmt,
- BYTE *cDepthBits,
- BYTE *cStencilBits)
-{
- // NOTE: GL expects either 32 or 16 as depth bits.
- switch (fmt) {
- case D3DX_SF_Z16S0:
- *cDepthBits = 16;
- *cStencilBits = 0;
- return;
- case D3DX_SF_Z32S0:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DX_SF_Z15S1:
- *cDepthBits = 15;
- *cStencilBits = 1;
- return;
- case D3DX_SF_Z24S8:
- *cDepthBits = 24;
- *cStencilBits = 8;
- return;
- case D3DX_SF_S1Z15:
- *cDepthBits = 15;
- *cStencilBits = 1;
- return;
- case D3DX_SF_S8Z24:
- *cDepthBits = 24;
- *cStencilBits = 8;
- return;
- }
-}
-
-//---------------------------------------------------------------------------
-/*
-BOOL GLD_CheckDepthStencilMatch(
- DWORD dwDeviceIndex,
- D3DX_SURFACEFORMAT sfWant)
-{
- // Emulate function built in to DX9
- D3DX_SURFACEFORMAT sfFound;
- int i;
- int nFormats = D3DXGetMaxSurfaceFormats(dwDeviceIndex, NULL, D3DX_SC_DEPTHBUFFER);
- if (nFormats) {
- for (i=0; i<nFormats; i++) {
- D3DXGetSurfaceFormat(dwDeviceIndex, NULL, D3DX_SC_DEPTHBUFFER, i, &sfFound); }
- if (sfFound == sfWant)
- return TRUE;
- }
-
- return FALSE;
-}
-*/
-//---------------------------------------------------------------------------
-
-D3DX_SURFACEFORMAT _gldFindCompatibleDepthStencilFormat(
- DWORD dwDeviceIndex)
-{
- // Jump through some hoops...
-
- ID3DXContext *pD3DXContext = NULL;
- IDirectDrawSurface7 *pZBuffer = NULL;
- DDPIXELFORMAT ddpf;
- HWND hWnd;
-
- // Get an HWND - use Desktop's
- hWnd = GetDesktopWindow();
-
- // Create a fully specified default context.
- D3DXCreateContextEx(dwDeviceIndex, 0, hWnd, (HWND)D3DX_DEFAULT,
- D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT,
- D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT,
- &pD3DXContext);
-
- // Obtain depth buffer that was created in context
- pZBuffer = pD3DXContext->lpVtbl->GetZBuffer(pD3DXContext);
-
- // Get pixel format of depth buffer
- ddpf.dwSize = sizeof(ddpf);
- pZBuffer->lpVtbl->GetPixelFormat(pZBuffer, &ddpf);
- // Done with surface - release it
- pZBuffer->lpVtbl->Release(pZBuffer);
-
- // Done with D3DX context
- pD3DXContext->lpVtbl->Release(pD3DXContext);
-
- // Convert and return
- return D3DXMakeSurfaceFormat(&ddpf);
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldBuildPixelformatList_DX(void)
-{
- D3DX_DEVICEDESC d3dxdd;
- D3DX_VIDMODEDESC d3ddm;
- D3DX_SURFACEFORMAT fmt[64]; // 64 should be enough...
- DWORD dwDeviceIndex;
- DWORD surfClassFlags;
-// IDirect3D7 *pD3D = NULL;
- HRESULT hr;
- int nSupportedFormats = 0; // Total formats
- int nDepthOnlyFormats = 0;
- int nDepthStencilFormats = 0;
- int i;
- DGL_pixelFormat *pPF;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-// char buf[128];
-// char cat[8];
-
- // Direct3D (SW or HW)
- // These are arranged so that 'best' pixelformat
- // is higher in the list (for ChoosePixelFormat).
-/* const D3DFORMAT DepthStencil[4] = {
- D3DX_SF_Z16S0, //D3DX_SF_D16,
- D3DX_SF_Z15S1, //D3DX_SF_D15S1,
- D3DX_SF_Z32S0, //D3DX_SF_D32,
- D3DX_SF_Z24S8, //D3DX_SF_D24S8,
- //D3DX_SF_D24X8,
- //D3DX_SF_D24X4S4,
- };*/
-
- // Dump DX version
- ddlogMessage(GLDLOG_SYSTEM, "DirectX Version : 7.0\n");
-
- // Release any existing pixelformat list
- if (glb.lpPF) {
- free(glb.lpPF);
- }
-
- glb.nPixelFormatCount = 0;
- glb.lpPF = NULL;
-
- //
- // Pixelformats for Direct3D (SW or HW) rendering
- //
-
- dwDeviceIndex = (glb.dwDriver == GLDS_DRIVER_REF) ? D3DX_HWLEVEL_REFERENCE : D3DX_DEFAULT;
-
- // Dump description
- D3DXGetDeviceDescription(dwDeviceIndex, &d3dxdd);
- ddlogPrintf(GLDLOG_SYSTEM, "Device: %s", d3dxdd.driverDesc);
-
- // Get display mode
- D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
-
-#if 0
- // Phooey - this don't work...
-/*
- // Since D3DXGetMaxSurfaceFormats() can lie to us, we'll need a workaround.
- // Explicitly test for matching depth/stencil to display bpp.
- if (d3ddm.bpp <= 16) {
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z16S0))
- fmt[nSupportedFormats++] = D3DX_SF_Z16S0;
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z15S1))
- fmt[nSupportedFormats++] = D3DX_SF_Z15S1;
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_S1Z15))
- fmt[nSupportedFormats++] = D3DX_SF_S1Z15;
- // Didn't find anything? Try default
- if (nSupportedFormats == 0) {
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z32S0))
- fmt[nSupportedFormats++] = D3DX_SF_Z32S0;
- }
- } else {
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z32S0))
- fmt[nSupportedFormats++] = D3DX_SF_Z32S0;
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z24S8))
- fmt[nSupportedFormats++] = D3DX_SF_Z24S8;
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_S8Z24))
- fmt[nSupportedFormats++] = D3DX_SF_S8Z24;
- // Didn't find anything? Try default
- if (nSupportedFormats == 0) {
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z16S0))
- fmt[nSupportedFormats++] = D3DX_SF_Z16S0;
- }
- }
-*/
- // Go the Whole Hog...
- fmt[nSupportedFormats++] = _gldFindCompatibleDepthStencilFormat(dwDeviceIndex);
-#else
- //
- // Depth buffer formats WITHOUT stencil
- //
- surfClassFlags = D3DX_SC_DEPTHBUFFER;
- nDepthOnlyFormats = D3DXGetMaxSurfaceFormats(dwDeviceIndex, NULL, surfClassFlags);
- //
- // Depth buffer formats WITH stencil
- //
- surfClassFlags = D3DX_SC_DEPTHBUFFER | D3DX_SC_STENCILBUFFER;
- nDepthStencilFormats = D3DXGetMaxSurfaceFormats(dwDeviceIndex, NULL, surfClassFlags);
-
- // Work out how many formats we have in total
- if ((nDepthOnlyFormats + nDepthStencilFormats) == 0)
- return FALSE; // Bail: no compliant pixelformats
-
- // Get depth buffer formats WITHOUT stencil
- surfClassFlags = D3DX_SC_DEPTHBUFFER;
- for (i=0; i<nDepthOnlyFormats; i++) {
- D3DXGetSurfaceFormat(dwDeviceIndex, NULL, surfClassFlags, i, &fmt[nSupportedFormats++]);
- }
- // NOTE: For some reason we already get stencil formats when only specifying D3DX_SC_DEPTHBUFFER
- /*
- // Get depth buffer formats WITH stencil
- surfClassFlags = D3DX_SC_DEPTHBUFFER | D3DX_SC_STENCILBUFFER;
- for (i=0; i<nDepthStencilFormats; i++) {
- D3DXGetSurfaceFormat(dwDeviceIndex, NULL, surfClassFlags, i, &fmt[nSupportedFormats++]);
- }
- */
-#endif
-
- // Total count of pixelformats is:
- // (nSupportedFormats+1)*2
- glb.lpPF = (DGL_pixelFormat *)calloc((nSupportedFormats)*2, sizeof(DGL_pixelFormat));
- glb.nPixelFormatCount = (nSupportedFormats)*2;
- if (glb.lpPF == NULL) {
- glb.nPixelFormatCount = 0;
- return FALSE;
- }
-
- // Get a copy of pointer that we can alter
- pPF = glb.lpPF;
-
- // Cache colour bits from display format
-// _BitsFromDisplayFormat(d3ddm.Format, &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
- // Get display mode
- D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
- cColorBits = d3ddm.bpp;
- cAlphaBits = 0;
- switch (d3ddm.bpp) {
- case 15:
- cRedBits = 5; cGreenBits = 5; cBlueBits = 5;
- break;
- case 16:
- cRedBits = 5; cGreenBits = 6; cBlueBits = 5;
- break;
- case 24:
- case 32:
- cRedBits = 8; cGreenBits = 8; cBlueBits = 8;
- break;
- default:
- cRedBits = 5; cGreenBits = 5; cBlueBits = 5;
- }
-
- //
- // Add single-buffer formats
- //
-
-/* // Single-buffer, no depth-stencil buffer
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DX_SF_UNKNOWN;
- pPF++;*/
-
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- //
- // Add double-buffer formats
- //
-
-/* memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DX_SF_UNKNOWN;
- pPF++;*/
-
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- // Popup warning message if non RGB color mode
- {
- // This is a hack. KeithH
- HDC hdcDesktop = GetDC(NULL);
- DWORD dwDisplayBitDepth = GetDeviceCaps(hdcDesktop, BITSPIXEL);
- ReleaseDC(0, hdcDesktop);
- if (dwDisplayBitDepth <= 8) {
- ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth);
- MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING);
- }
- }
-
- // Mark list as 'current'
- glb.bPixelformatsDirty = FALSE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldInitialiseMesa_DX(
- DGL_ctx *lpCtx)
-{
- GLD_driver_dx7 *gld = NULL;
- int MaxTextureSize, TextureLevels;
- BOOL bSoftwareTnL;
-
- if (lpCtx == NULL)
- return FALSE;
-
- gld = lpCtx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (glb.bMultitexture) {
- lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps.wMaxSimultaneousTextures;
- // Only support MAX_TEXTURE_UNITS texture units.
- // ** If this is altered then the FVF formats must be reviewed **.
- if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX7)
- lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX7;
- } else {
- // Multitexture override
- lpCtx->glCtx->Const.MaxTextureUnits = 1;
- }
-
- lpCtx->glCtx->Const.MaxDrawBuffers = 1;
-
- // max texture size
-// MaxTextureSize = min(gld->d3dCaps8.MaxTextureHeight, gld->d3dCaps8.MaxTextureWidth);
- MaxTextureSize = min(gld->d3dCaps.dwMaxTextureHeight, gld->d3dCaps.dwMaxTextureWidth);
- if (MaxTextureSize == 0)
- MaxTextureSize = 256; // Sanity check
-
- //
- // HACK!!
- if (MaxTextureSize > 1024)
- MaxTextureSize = 1024; // HACK - CLAMP TO 1024
- // HACK!!
- //
-
- // TODO: Check this again for Mesa 5
- // Got to set MAX_TEXTURE_SIZE as max levels.
- // Who thought this stupid idea up? ;)
- TextureLevels = 0;
- // Calculate power-of-two.
- while (MaxTextureSize) {
- TextureLevels++;
- MaxTextureSize >>= 1;
- }
- lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8;
-
- // Defaults
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_LIGHTING, FALSE);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_DITHERENABLE, TRUE);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_SHADEMODE, D3DSHADE_GOURAUD);
-
- // Set texture coord set to be used with each stage
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_TEXCOORDINDEX, 0);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 1, D3DTSS_TEXCOORDINDEX, 1);
-
- // Set up Depth buffer
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ZENABLE,
- (lpCtx->lpPF->dwDriverData!=D3DX_SF_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE);
-
- // Set the view matrix
- {
- D3DXMATRIX vm;
-#if 1
- D3DXMatrixIdentity(&vm);
-#else
- D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f);
- D3DXVECTOR3 At(0.0f, 0.0f, -1.0f);
- D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f);
- D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up);
- vm._31 = -vm._31;
- vm._32 = -vm._32;
- vm._33 = -vm._33;
- vm._34 = -vm._34;
-#endif
- IDirect3DDevice7_SetTransform(gld->pDev, D3DTRANSFORMSTATE_VIEW, &vm);
- }
-
-// DX7 does not support D3DRS_SOFTWAREVERTEXPROCESSING
-/*
- if (gld->bHasHWTnL) {
- if (glb.dwTnL == GLDS_TNL_DEFAULT)
- bSoftwareTnL = FALSE; // HW TnL
- else {
- bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE;
- }
- } else {
- // No HW TnL, so no choice possible
- bSoftwareTnL = TRUE;
- }
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL);
-*/
-
-// Dump this in a Release build as well, now.
-//#ifdef _DEBUG
- ddlogPrintf(DDLOG_INFO, "HW TnL: %s",
-// gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable");
- gld->bHasHWTnL ? "Enabled" : "Unavailable");
-//#endif
-
- // Set up interfaces to Mesa
- gldEnableExtensions_DX7(lpCtx->glCtx);
- gldInstallPipeline_DX7(lpCtx->glCtx);
- gldSetupDriverPointers_DX7(lpCtx->glCtx);
-
- // Signal a complete state update
- lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL);
-
- // Start a scene
- IDirect3DDevice7_BeginScene(gld->pDev);
- lpCtx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldSwapBuffers_DX(
- DGL_ctx *ctx,
- HDC hDC,
- HWND hWnd)
-{
- HRESULT hr;
- GLD_driver_dx7 *gld = NULL;
- DWORD dwFlags;
-
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
-
- // End the scene if one is started
- if (ctx->bSceneStarted) {
- IDirect3DDevice7_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- // Needed by D3DX for MDI multi-window apps (DaveM)
- if (lpDDClipper)
- IDirectDrawClipper_SetHWnd(lpDDClipper, 0, hWnd);
-
- // Swap the buffers. hWnd may override the hWnd used for CreateDevice()
-// hr = IDirect3DDevice8_Present(gld->pDev, NULL, NULL, hWnd, NULL);
-
- // Set refresh sync flag
- dwFlags = glb.bWaitForRetrace ? 0 : D3DX_UPDATE_NOVSYNC;
- // Render and show frame
- hr = gld->pD3DXContext->lpVtbl->UpdateFrame(gld->pD3DXContext, dwFlags);
- if (FAILED(hr))
- ddlogError(DDLOG_WARN, "gldSwapBuffers_DX: UpdateFrame", hr);
-
- if (hr == DDERR_SURFACELOST) {
- hr = gld->pD3DXContext->lpVtbl->RestoreSurfaces(gld->pD3DXContext);
- if (FAILED(hr))
- ddlogError(DDLOG_WARN, "gldSwapBuffers_DX: RestoreSurfaces", hr);
- }
-
-exit_swap:
- // Begin a new scene
- IDirect3DDevice7_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return (FAILED(hr)) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldGetDisplayMode_DX(
- DGL_ctx *ctx,
- GLD_displayMode *glddm)
-{
-// D3DDISPLAYMODE d3ddm;
- D3DX_VIDMODEDESC d3ddm;
- HRESULT hr;
- GLD_driver_dx7 *lpCtx = NULL;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-
- if ((glddm == NULL) || (ctx == NULL))
- return FALSE;
-
- lpCtx = ctx->glPriv;
- if (lpCtx == NULL)
- return FALSE;
-
- if (lpCtx->pD3D == NULL)
- return FALSE;
-
-// hr = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- hr = D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
- if (FAILED(hr))
- return FALSE;
-
- // Get info from the display format
-// _BitsFromDisplayFormat(d3ddm.Format,
-// &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- glddm->Width = d3ddm.width;
- glddm->Height = d3ddm.height;
- glddm->BPP = d3ddm.bpp;
- glddm->Refresh = d3ddm.refreshRate;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c
deleted file mode 100644
index 7afa9190c..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c
+++ /dev/null
@@ -1,1176 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Driver interface code to Mesa
-*
-****************************************************************************/
-
-//#include <windows.h>
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "vbo/vbo.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-extern BOOL dglSwapBuffers(HDC hDC);
-
-// HACK: Hack the _33 member of the OpenGL perspective projection matrix
-const float _fPersp_33 = 1.6f;
-
-//---------------------------------------------------------------------------
-// Internal functions
-//---------------------------------------------------------------------------
-
-void _gld_mesa_warning(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal warning mechanism
- gldLogPrintf(GLDLOG_WARN, "Mesa warning: %s", str);
-}
-
-//---------------------------------------------------------------------------
-
-void _gld_mesa_fatal(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal fatal-message mechanism
- gldLogPrintf(GLDLOG_CRITICAL, "Mesa FATAL: %s", str);
-
- // Mesa calls abort(0) here.
- ddlogClose();
- exit(0);
-}
-
-//---------------------------------------------------------------------------
-
-D3DSTENCILOP _gldConvertStencilOp(
- GLenum StencilOp)
-{
- // Used by Stencil: pass, fail and zfail
-
- switch (StencilOp) {
- case GL_KEEP:
- return D3DSTENCILOP_KEEP;
- case GL_ZERO:
- return D3DSTENCILOP_ZERO;
- case GL_REPLACE:
- return D3DSTENCILOP_REPLACE;
- case GL_INCR:
- return D3DSTENCILOP_INCRSAT;
- case GL_DECR:
- return D3DSTENCILOP_DECRSAT;
- case GL_INVERT:
- return D3DSTENCILOP_INVERT;
- case GL_INCR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_INCR;
- case GL_DECR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_DECR;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertStencilOp: Unknown StencilOp\n");
-#endif
-
- return D3DSTENCILOP_KEEP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DCMPFUNC _gldConvertCompareFunc(
- GLenum CmpFunc)
-{
- // Used for Alpha func, depth func and stencil func.
-
- switch (CmpFunc) {
- case GL_NEVER:
- return D3DCMP_NEVER;
- case GL_LESS:
- return D3DCMP_LESS;
- case GL_EQUAL:
- return D3DCMP_EQUAL;
- case GL_LEQUAL:
- return D3DCMP_LESSEQUAL;
- case GL_GREATER:
- return D3DCMP_GREATER;
- case GL_NOTEQUAL:
- return D3DCMP_NOTEQUAL;
- case GL_GEQUAL:
- return D3DCMP_GREATEREQUAL;
- case GL_ALWAYS:
- return D3DCMP_ALWAYS;
- };
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertCompareFunc: Unknown CompareFunc\n");
-#endif
-
- return D3DCMP_ALWAYS;
-}
-
-//---------------------------------------------------------------------------
-
-D3DBLEND _gldConvertBlendFunc(
- GLenum blend,
- GLenum DefaultBlend)
-{
- switch (blend) {
- case GL_ZERO:
- return D3DBLEND_ZERO;
- case GL_ONE:
- return D3DBLEND_ONE;
- case GL_DST_COLOR:
- return D3DBLEND_DESTCOLOR;
- case GL_SRC_COLOR:
- return D3DBLEND_SRCCOLOR;
- case GL_ONE_MINUS_DST_COLOR:
- return D3DBLEND_INVDESTCOLOR;
- case GL_ONE_MINUS_SRC_COLOR:
- return D3DBLEND_INVSRCCOLOR;
- case GL_SRC_ALPHA:
- return D3DBLEND_SRCALPHA;
- case GL_ONE_MINUS_SRC_ALPHA:
- return D3DBLEND_INVSRCALPHA;
- case GL_DST_ALPHA:
- return D3DBLEND_DESTALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return D3DBLEND_INVDESTALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return D3DBLEND_SRCALPHASAT;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertBlendFunc: Unknown BlendFunc\n");
-#endif
-
- return DefaultBlend;
-}
-
-//---------------------------------------------------------------------------
-// Misc. functions
-//---------------------------------------------------------------------------
-
-void gld_Noop_DX8(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Error_DX8(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- // Quite useless.
-// gldLogMessage(GLDLOG_ERROR, "ctx->Driver.Error called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Required Mesa functions
-//---------------------------------------------------------------------------
-
-static GLboolean gld_set_draw_buffer_DX8(
- GLcontext *ctx,
- GLenum mode)
-{
- (void) ctx;
- if ((mode==GL_FRONT_LEFT) || (mode == GL_BACK_LEFT)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_set_read_buffer_DX8(
- GLcontext *ctx,
- GLframebuffer *buffer,
- GLenum mode)
-{
- /* separate read buffer not supported */
-/*
- ASSERT(buffer == ctx->DrawBuffer);
- ASSERT(mode == GL_FRONT_LEFT);
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Clear_DX8(
- GLcontext *ctx,
- GLbitfield mask,
- GLboolean all,
- GLint x,
- GLint y,
- GLint width,
- GLint height)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DCOLOR Color = 0;
- float Z = 0.0f;
- DWORD Stencil = 0;
- D3DRECT d3dClearRect;
-
- // TODO: Colourmask
- const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
-
- if (!gld->pDev)
- return;
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- GLubyte col[4];
- CLAMPED_FLOAT_TO_UBYTE(col[0], ctx->Color.ClearColor[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], ctx->Color.ClearColor[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], ctx->Color.ClearColor[2]);
- CLAMPED_FLOAT_TO_UBYTE(col[3], ctx->Color.ClearColor[3]);
- dwFlags |= D3DCLEAR_TARGET;
- Color = D3DCOLOR_RGBA(col[0], col[1], col[2], col[3]);
-// ctx->Color.ClearColor[1],
-// ctx->Color.ClearColor[2],
-// ctx->Color.ClearColor[3]);
- }
-
- if (mask & DD_DEPTH_BIT) {
- // D3D8 will fail the Clear call if we try and clear a
- // depth buffer and we haven't created one.
- // Also, some apps try and clear a depth buffer,
- // when a depth buffer hasn't been requested by the app.
- if (ctx->Visual.depthBits == 0) {
- mask &= ~DD_DEPTH_BIT; // Remove depth bit from mask
- } else {
- dwFlags |= D3DCLEAR_ZBUFFER;
- Z = ctx->Depth.Clear;
- }
- }
-
- if (mask & DD_STENCIL_BIT) {
- if (ctx->Visual.stencilBits == 0) {
- // No stencil bits in depth buffer
- mask &= ~DD_STENCIL_BIT; // Remove stencil bit from mask
- } else {
- dwFlags |= D3DCLEAR_STENCIL;
- Stencil = ctx->Stencil.Clear;
- }
- }
-
- // Some apps do really weird things with the rect, such as Quake3.
- if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0)) {
- all = GL_TRUE;
- }
-
- if (!all) {
- // Calculate clear subrect
- d3dClearRect.x1 = x;
- d3dClearRect.y1 = gldCtx->dwHeight - (y + height);
- d3dClearRect.x2 = x + width;
- d3dClearRect.y2 = d3dClearRect.y1 + height;
- }
-
- // dwFlags will be zero if there's nothing to clear
- if (dwFlags) {
- _GLD_DX8_DEV(Clear(
- gld->pDev,
- all ? 0 : 1,
- all ? NULL : &d3dClearRect,
- dwFlags,
- Color, Z, Stencil));
- }
-
- if (mask & DD_ACCUM_BIT) {
- // Clear accumulation buffer
- }
-}
-
-//---------------------------------------------------------------------------
-
-// Mesa 5: Parameter change
-static void gld_buffer_size_DX8(
-// GLcontext *ctx,
- GLframebuffer *fb,
- GLuint *width,
- GLuint *height)
-{
-// GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
-
- *width = fb->Width; // gldCtx->dwWidth;
- *height = fb->Height; // gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Finish_DX8(
- GLcontext *ctx)
-{
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Flush_DX8(
- GLcontext *ctx)
-{
- GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- // TODO: Detect apps that glFlush() then SwapBuffers() ?
-
- if (gld->EmulateSingle) {
- // Emulating a single-buffered context.
- // [Direct3D doesn't allow rendering to front buffer]
- dglSwapBuffers(gld->hDC);
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_STENCIL(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Two-sided stencil. New for Mesa 5
- const GLuint uiFace = 0UL;
-
- struct gl_stencil_attrib *pStencil = &ctx->Stencil;
-
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILENABLE, pStencil->Enabled ? TRUE : FALSE));
- if (pStencil->Enabled) {
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFUNC, _gldConvertCompareFunc(pStencil->Function[uiFace])));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILREF, pStencil->Ref[uiFace]));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILMASK, pStencil->ValueMask[uiFace]));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILWRITEMASK, pStencil->WriteMask[uiFace]));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFAIL, _gldConvertStencilOp(pStencil->FailFunc[uiFace])));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILZFAIL, _gldConvertStencilOp(pStencil->ZFailFunc[uiFace])));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILPASS, _gldConvertStencilOp(pStencil->ZPassFunc[uiFace])));
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_COLOR(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DBLEND src;
- D3DBLEND dest;
-
- // Alpha func
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, _gldConvertCompareFunc(ctx->Color.AlphaFunc)));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAREF, (DWORD)ctx->Color.AlphaRef));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, ctx->Color.AlphaEnabled));
-
- // Blend func
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHABLENDENABLE, ctx->Color.BlendEnabled));
- src = _gldConvertBlendFunc(ctx->Color.BlendSrcRGB, GL_ONE);
- dest = _gldConvertBlendFunc(ctx->Color.BlendDstRGB, GL_ZERO);
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SRCBLEND, src));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_DESTBLEND, dest));
-
- // Color mask
- if (ctx->Color.ColorMask[0]) dwFlags |= D3DCOLORWRITEENABLE_RED;
- if (ctx->Color.ColorMask[1]) dwFlags |= D3DCOLORWRITEENABLE_GREEN;
- if (ctx->Color.ColorMask[2]) dwFlags |= D3DCOLORWRITEENABLE_BLUE;
- if (ctx->Color.ColorMask[3]) dwFlags |= D3DCOLORWRITEENABLE_ALPHA;
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_COLORWRITEENABLE, dwFlags));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_DEPTH(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZENABLE, ctx->Depth.Test ? D3DZB_TRUE : D3DZB_FALSE));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZFUNC, _gldConvertCompareFunc(ctx->Depth.Func)));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZWRITEENABLE, ctx->Depth.Mask ? TRUE : FALSE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_POLYGON(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DFILLMODE d3dFillMode = D3DFILL_SOLID;
- D3DCULL d3dCullMode = D3DCULL_NONE;
- int iOffset = 0;
-
- // Fillmode
- switch (ctx->Polygon.FrontMode) {
- case GL_POINT:
- d3dFillMode = D3DFILL_POINT;
- break;
- case GL_LINE:
- d3dFillMode = D3DFILL_WIREFRAME;
- break;
- case GL_FILL:
- d3dFillMode = D3DFILL_SOLID;
- break;
- }
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FILLMODE, d3dFillMode));
-
- if (ctx->Polygon.CullFlag) {
- switch (ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CW;
- else
- d3dCullMode = D3DCULL_CCW;
- break;
- case GL_FRONT:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CCW;
- else
- d3dCullMode = D3DCULL_CW;
- break;
- case GL_FRONT_AND_BACK:
- d3dCullMode = D3DCULL_NONE;
- break;
- default:
- break;
- }
- } else {
- d3dCullMode = D3DCULL_NONE;
- }
-// d3dCullMode = D3DCULL_NONE; // TODO: DEBUGGING
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_CULLMODE, d3dCullMode));
-
- // Polygon offset
- // ZBIAS ranges from 0 to 16 and can only move towards the viewer
- // Mesa5: ctx->Polygon._OffsetAny removed
- if (ctx->Polygon.OffsetFill) {
- iOffset = (int)ctx->Polygon.OffsetUnits;
- if (iOffset < 0)
- iOffset = -iOffset;
- else
- iOffset = 0; // D3D can't push away
- }
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZBIAS, iOffset));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_FOG(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DCOLOR d3dFogColour;
- D3DFOGMODE d3dFogMode = D3DFOG_LINEAR;
-
- // TODO: Fog is calculated seperately in the Mesa pipeline
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, FALSE));
- return;
-
- // Fog enable
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, ctx->Fog.Enabled));
- if (!ctx->Fog.Enabled) {
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, D3DFOG_NONE));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE));
- return; // If disabled, don't bother setting any fog state
- }
-
- // Fog colour
- d3dFogColour = D3DCOLOR_COLORVALUE( ctx->Fog.Color[0],
- ctx->Fog.Color[1],
- ctx->Fog.Color[2],
- ctx->Fog.Color[3]);
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGCOLOR, d3dFogColour));
-
- // Fog density
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGDENSITY, *((DWORD*) (&ctx->Fog.Density))));
-
- // Fog start
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGSTART, *((DWORD*) (&ctx->Fog.Start))));
-
- // Fog end
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGEND, *((DWORD*) (&ctx->Fog.End))));
-
- // Fog mode
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- d3dFogMode = D3DFOG_LINEAR;
- break;
- case GL_EXP:
- d3dFogMode = D3DFOG_EXP;
- break;
- case GL_EXP2:
- d3dFogMode = D3DFOG_EXP2;
- break;
- }
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, d3dFogMode));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_LIGHT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- DWORD dwSpecularEnable;
-
- // Shademode
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SHADEMODE, (ctx->Light.ShadeModel == GL_SMOOTH) ? D3DSHADE_GOURAUD : D3DSHADE_FLAT));
-
- // Separate specular colour
- if (ctx->Light.Enabled)
- dwSpecularEnable = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TRUE: FALSE;
- else
- dwSpecularEnable = FALSE;
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SPECULARENABLE, dwSpecularEnable));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_MODELVIEW(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ModelView.m;
- // Mesa5: Model-view is now a stack
- GLfloat *pM = ctx->ModelviewMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10];
- m._34 = pM[11];
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14];
- m._44 = pM[15];
-
- gld->matModelView = m;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_PROJECTION(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ProjectionMatrix.m;
- // Mesa 5: Now a stack
- GLfloat *pM = ctx->ProjectionMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
-
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
-
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10] / _fPersp_33; // / 1.6f;
- m._34 = pM[11];
-
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14] / 2.0f;
- m._44 = pM[15];
-
- gld->matProjection = m;
-}
-
-//---------------------------------------------------------------------------
-/*
-void gldFrustumHook_DX8(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Frustum(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = farval / (nearval - farval);
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Frustum: %f", farval/nearval);
-}
-
-//---------------------------------------------------------------------------
-
-void gldOrthoHook_DX8(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Ortho(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = 1.6f;
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Ortho: %f", farval/nearval);
-}
-*/
-//---------------------------------------------------------------------------
-
-void gld_NEW_VIEWPORT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DVIEWPORT8 d3dvp;
-// GLint x, y;
-// GLsizei w, h;
-
- // Set depth range
- _GLD_DX8_DEV(GetViewport(gld->pDev, &d3dvp));
- // D3D can't do Quake1/Quake2 z-trick
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.MinZ = ctx->Viewport.Near;
- d3dvp.MaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.MinZ = ctx->Viewport.Far;
- d3dvp.MaxZ = ctx->Viewport.Near;
- }
-/* x = ctx->Viewport.X;
- y = ctx->Viewport.Y;
- w = ctx->Viewport.Width;
- h = ctx->Viewport.Height;
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;*/
- _GLD_DX8_DEV(SetViewport(gld->pDev, &d3dvp));
-
-// gld->fFlipWindowY = (float)gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-__inline BOOL _gldAnyEvalEnabled(
- GLcontext *ctx)
-{
- struct gl_eval_attrib *eval = &ctx->Eval;
-
- if ((eval->AutoNormal) ||
- (eval->Map1Color4) ||
- (eval->Map1Index) ||
- (eval->Map1Normal) ||
- (eval->Map1TextureCoord1) ||
- (eval->Map1TextureCoord2) ||
- (eval->Map1TextureCoord3) ||
- (eval->Map1TextureCoord4) ||
- (eval->Map1Vertex3) ||
- (eval->Map1Vertex4) ||
- (eval->Map2Color4) ||
- (eval->Map2Index) ||
- (eval->Map2Normal) ||
- (eval->Map2TextureCoord1) ||
- (eval->Map2TextureCoord2) ||
- (eval->Map2TextureCoord3) ||
- (eval->Map2TextureCoord4) ||
- (eval->Map2Vertex3) ||
- (eval->Map2Vertex4)
- )
- return TRUE;
-
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL _gldChooseInternalPipeline(
- GLcontext *ctx,
- GLD_driver_dx8 *gld)
-{
-// return TRUE; // DEBUGGING: ALWAYS USE MESA
-// return FALSE; // DEBUGGING: ALWAYS USE D3D
-
- if ((glb.dwTnL == GLDS_TNL_MESA) || (gld->bHasHWTnL == FALSE))
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE; // Force Mesa TnL
- }
-
- if ((ctx->Light.Enabled) ||
- (1) ||
- (ctx->Texture._TexGenEnabled) ||
- (ctx->Texture._TexMatEnabled) ||
-// (ctx->Transform._AnyClip) ||
- (ctx->Scissor.Enabled) ||
- _gldAnyEvalEnabled(ctx) // Put this last so we can early-out
- )
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE;
- }
-
- gld->PipelineUsage.qwD3DFVF.QuadPart++;
- return FALSE;
-
-/* // Force Mesa pipeline?
- if (glb.dwTnL == GLDS_TNL_MESA) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Test for functionality not exposed in the D3D pathways
- if ((ctx->Texture._GenFlags)) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Now decide if vertex shader can be used.
- // If two sided lighting is enabled then we must either
- // use Mesa TnL or the vertex shader
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
- if (gld->VStwosidelight.hShader && !ctx->Fog.Enabled) {
- // Use Vertex Shader
- gld->PipelineUsage.dwD3D2SVS.QuadPart++;
- return GLD_PIPELINE_D3D_VS_TWOSIDE;
- } else {
- // Use Mesa TnL
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
- }
-
- // Must be D3D fixed-function pipeline
- gld->PipelineUsage.dwD3DFVF.QuadPart++;
- return GLD_PIPELINE_D3D_FVF;
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_update_state_DX8(
- GLcontext *ctx,
- GLuint new_state)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLD_pb_dx8 *gldPB;
-
- if (!gld || !gld->pDev)
- return;
-
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-
- // SetupIndex will be used in the pipelines for choosing setup function
- if ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_SEPARATE_SPECULAR)) ||
- (ctx->Fog.Enabled))
- {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT_EXTRAS;
- else
- gld->iSetupFunc = GLD_SI_SMOOTH_EXTRAS;
- } else {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT; // Setup flat shade + texture
- else
- gld->iSetupFunc = GLD_SI_SMOOTH; // Setup smooth shade + texture
- }
-
- gld->bUseMesaTnL = _gldChooseInternalPipeline(ctx, gld);
- if (gld->bUseMesaTnL) {
- gldPB = &gld->PB2d;
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, TRUE));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, FALSE));
- _GLD_DX8_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
- } else {
- gldPB = &gld->PB3d;
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE));
-// if (gld->TnLPipeline == GLD_PIPELINE_D3D_VS_TWOSIDE) {
-// _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware));
-// _GLD_DX8_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
-// } else {
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->bHasHWTnL));
- _GLD_DX8_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
-// }
- }
-
-#define _GLD_TEST_STATE(a) \
- if (new_state & (a)) { \
- gld##a(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_TEST_STATE_DX8(a) \
- if (new_state & (a)) { \
- gld##a##_DX8(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_IGNORE_STATE(a) new_state &= ~(a);
-
-// if (!gld->bUseMesaTnL) {
- // Not required if Mesa is doing the TnL.
- // Problem: If gld->bUseMesaTnL is TRUE when these are signaled,
- // then we'll miss updating the D3D TnL pipeline.
- // Therefore, don't test for gld->bUseMesaTnL
- _GLD_TEST_STATE(_NEW_MODELVIEW);
- _GLD_TEST_STATE(_NEW_PROJECTION);
-// }
-
- _GLD_TEST_STATE_DX8(_NEW_TEXTURE); // extern, so guard with _DX8
- _GLD_TEST_STATE(_NEW_COLOR);
- _GLD_TEST_STATE(_NEW_DEPTH);
- _GLD_TEST_STATE(_NEW_POLYGON);
- _GLD_TEST_STATE(_NEW_STENCIL);
- _GLD_TEST_STATE(_NEW_FOG);
- _GLD_TEST_STATE(_NEW_LIGHT);
- _GLD_TEST_STATE(_NEW_VIEWPORT);
-
- _GLD_IGNORE_STATE(_NEW_TRANSFORM);
-
-
-// Stubs for future use.
-/* _GLD_TEST_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_STATE(_NEW_ACCUM);
- _GLD_TEST_STATE(_NEW_EVAL);
- _GLD_TEST_STATE(_NEW_HINT);
- _GLD_TEST_STATE(_NEW_LINE);
- _GLD_TEST_STATE(_NEW_PIXEL);
- _GLD_TEST_STATE(_NEW_POINT);
- _GLD_TEST_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_STATE(_NEW_SCISSOR);
- _GLD_TEST_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_STATE(_NEW_ARRAY);
- _GLD_TEST_STATE(_NEW_RENDERMODE);
- _GLD_TEST_STATE(_NEW_BUFFERS);
- _GLD_TEST_STATE(_NEW_MULTISAMPLE);
-*/
-
-// For debugging.
-#if 0
-#define _GLD_TEST_UNHANDLED_STATE(a) \
- if (new_state & (a)) { \
- gldLogMessage(GLDLOG_ERROR, "Unhandled " #a "\n"); \
- }
- _GLD_TEST_UNHANDLED_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ACCUM);
- _GLD_TEST_UNHANDLED_STATE(_NEW_EVAL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_HINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_LINE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PIXEL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_SCISSOR);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ARRAY);
- _GLD_TEST_UNHANDLED_STATE(_NEW_RENDERMODE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_BUFFERS);
- _GLD_TEST_UNHANDLED_STATE(_NEW_MULTISAMPLE);
-#undef _GLD_UNHANDLED_STATE
-#endif
-
-#undef _GLD_TEST_STATE
-}
-
-//---------------------------------------------------------------------------
-// Viewport
-//---------------------------------------------------------------------------
-
-void gld_Viewport_DX8(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei w,
- GLsizei h)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DVIEWPORT8 d3dvp;
-
- if (!gld || !gld->pDev)
- return;
-
- // This is a hack. When the app is minimized, Mesa passes
- // w=1 and h=1 for viewport dimensions. Without this test
- // we get a GPF in gld_wgl_resize_buffers().
- if ((w==1) && (h==1))
- return;
-
- // Call ResizeBuffersMESA. This function will early-out
- // if no resize is needed.
- //ctx->Driver.ResizeBuffersMESA(ctx);
- // Mesa 5: Changed parameters
- ctx->Driver.ResizeBuffers(gldCtx->glBuffer);
-
-#if 0
- ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h);
-#endif
-
- // ** D3D viewport must not be outside the render target surface **
- // Sanity check the GL viewport dimensions
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
-
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.MinZ = ctx->Viewport.Near;
- d3dvp.MaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.MinZ = ctx->Viewport.Far;
- d3dvp.MaxZ = ctx->Viewport.Near;
- }
-
- // TODO: DEBUGGING
-// d3dvp.MinZ = 0.0f;
-// d3dvp.MaxZ = 1.0f;
-
- _GLD_DX8_DEV(SetViewport(gld->pDev, &d3dvp));
-
-}
-
-//---------------------------------------------------------------------------
-
-extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
-
-// Mesa 5: Parameter change
-void gldResizeBuffers_DX8(
-// GLcontext *ctx)
- GLframebuffer *fb)
-{
- GET_CURRENT_CONTEXT(ctx);
- dglWglResizeBuffers(ctx, TRUE);
-}
-
-//---------------------------------------------------------------------------
-#ifdef _DEBUG
-// This is only for debugging.
-// To use, plug into ctx->Driver.Enable pointer below.
-void gld_Enable(
- GLcontext *ctx,
- GLenum e,
- GLboolean b)
-{
- char buf[1024];
- sprintf(buf, "Enable: %s (%s)\n", _mesa_lookup_enum_by_nr(e), b?"TRUE":"FALSE");
- ddlogMessage(DDLOG_SYSTEM, buf);
-}
-#endif
-//---------------------------------------------------------------------------
-// Driver pointer setup
-//---------------------------------------------------------------------------
-
-extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum);
-
-void gldSetupDriverPointers_DX8(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- // Mandatory functions
- ctx->Driver.GetString = _gldGetStringGeneric;
- ctx->Driver.UpdateState = gld_update_state_DX8;
- ctx->Driver.Clear = gld_Clear_DX8;
- ctx->Driver.DrawBuffer = gld_set_draw_buffer_DX8;
- ctx->Driver.GetBufferSize = gld_buffer_size_DX8;
- ctx->Driver.Finish = gld_Finish_DX8;
- ctx->Driver.Flush = gld_Flush_DX8;
- ctx->Driver.Error = gld_Error_DX8;
-
- // Hardware accumulation buffer
- ctx->Driver.Accum = NULL; // TODO: gld_Accum;
-
- // Bitmap functions
- ctx->Driver.CopyPixels = gld_CopyPixels_DX8;
- ctx->Driver.DrawPixels = gld_DrawPixels_DX8;
- ctx->Driver.ReadPixels = gld_ReadPixels_DX8;
- ctx->Driver.Bitmap = gld_Bitmap_DX8;
-
- // Buffer resize
- ctx->Driver.ResizeBuffers = gldResizeBuffers_DX8;
-
- // Texture image functions
- ctx->Driver.ChooseTextureFormat = gld_ChooseTextureFormat_DX8;
- ctx->Driver.TexImage1D = gld_TexImage1D_DX8;
- ctx->Driver.TexImage2D = gld_TexImage2D_DX8;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = gld_TexSubImage1D_DX8;
- ctx->Driver.TexSubImage2D = gld_TexSubImage2D_DX8;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
-
- ctx->Driver.CopyTexImage1D = gldCopyTexImage1D_DX8; //NULL;
- ctx->Driver.CopyTexImage2D = gldCopyTexImage2D_DX8; //NULL;
- ctx->Driver.CopyTexSubImage1D = gldCopyTexSubImage1D_DX8; //NULL;
- ctx->Driver.CopyTexSubImage2D = gldCopyTexSubImage2D_DX8; //NULL;
- ctx->Driver.CopyTexSubImage3D = gldCopyTexSubImage3D_DX8;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- // Texture object functions
- ctx->Driver.BindTexture = NULL;
- ctx->Driver.NewTextureObject = NULL; // Not yet implemented by Mesa!;
- ctx->Driver.DeleteTexture = gld_DeleteTexture_DX8;
- ctx->Driver.PrioritizeTexture = NULL;
-
- // Imaging functionality
- ctx->Driver.CopyColorTable = NULL;
- ctx->Driver.CopyColorSubTable = NULL;
- ctx->Driver.CopyConvolutionFilter1D = NULL;
- ctx->Driver.CopyConvolutionFilter2D = NULL;
-
- // State changing functions
- ctx->Driver.AlphaFunc = NULL; //gld_AlphaFunc;
- ctx->Driver.BlendFuncSeparate = NULL; //gld_BlendFunc;
- ctx->Driver.ClearColor = NULL; //gld_ClearColor;
- ctx->Driver.ClearDepth = NULL; //gld_ClearDepth;
- ctx->Driver.ClearStencil = NULL; //gld_ClearStencil;
- ctx->Driver.ColorMask = NULL; //gld_ColorMask;
- ctx->Driver.CullFace = NULL; //gld_CullFace;
- ctx->Driver.ClipPlane = NULL; //gld_ClipPlane;
- ctx->Driver.FrontFace = NULL; //gld_FrontFace;
- ctx->Driver.DepthFunc = NULL; //gld_DepthFunc;
- ctx->Driver.DepthMask = NULL; //gld_DepthMask;
- ctx->Driver.DepthRange = NULL;
- ctx->Driver.Enable = NULL; //gld_Enable;
- ctx->Driver.Fogfv = NULL; //gld_Fogfv;
- ctx->Driver.Hint = NULL; //gld_Hint;
- ctx->Driver.Lightfv = NULL; //gld_Lightfv;
- ctx->Driver.LightModelfv = NULL; //gld_LightModelfv;
- ctx->Driver.LineStipple = NULL; //gld_LineStipple;
- ctx->Driver.LineWidth = NULL; //gld_LineWidth;
- ctx->Driver.LogicOpcode = NULL; //gld_LogicOpcode;
- ctx->Driver.PointParameterfv = NULL; //gld_PointParameterfv;
- ctx->Driver.PointSize = NULL; //gld_PointSize;
- ctx->Driver.PolygonMode = NULL; //gld_PolygonMode;
- ctx->Driver.PolygonOffset = NULL; //gld_PolygonOffset;
- ctx->Driver.PolygonStipple = NULL; //gld_PolygonStipple;
- ctx->Driver.RenderMode = NULL; //gld_RenderMode;
- ctx->Driver.Scissor = NULL; //gld_Scissor;
- ctx->Driver.ShadeModel = NULL; //gld_ShadeModel;
- ctx->Driver.StencilFunc = NULL; //gld_StencilFunc;
- ctx->Driver.StencilMask = NULL; //gld_StencilMask;
- ctx->Driver.StencilOp = NULL; //gld_StencilOp;
- ctx->Driver.TexGen = NULL; //gld_TexGen;
- ctx->Driver.TexEnv = NULL;
- ctx->Driver.TexParameter = NULL;
- ctx->Driver.TextureMatrix = NULL; //gld_TextureMatrix;
- ctx->Driver.Viewport = gld_Viewport_DX8;
-
- _swsetup_Wakeup(ctx);
-
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- tnl->Driver.Render.ResetLineStipple = gld_ResetLineStipple_DX8;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
-
- // Hook into glFrustum() and glOrtho()
-// ctx->Exec->Frustum = gldFrustumHook_DX8;
-// ctx->Exec->Ortho = gldOrthoHook_DX8;
-
-}
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h
deleted file mode 100644
index 7efec7cae..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 8.0 header file
-*
-****************************************************************************/
-
-#ifndef _GLD_DX8_H
-#define _GLD_DX8_H
-
-//---------------------------------------------------------------------------
-// Windows includes
-//---------------------------------------------------------------------------
-
-//#ifndef STRICT
-//#define STRICT
-//#endif
-
-//#define WIN32_LEAN_AND_MEAN
-//#include <windows.h>
-#include <d3d8.h>
-#include <d3dx8.h>
-
-// MS screwed up with the DX8.1 SDK - there's no compile-time
-// method of compiling for 8.0 via the 8.1 SDK unless you
-// "make sure you don't use any 8.1 interfaces".
-// We CAN use 8.1 D3DX static functions, though - just not new 8.1 interfaces.
-//
-// D3D_SDK_VERSION is 120 for 8.0 (supported by Windows 95).
-// D3D_SDK_VERSION is 220 for 8.1 (NOT supported by Windows 95).
-//
-#define D3D_SDK_VERSION_DX8_SUPPORT_WIN95 120
-
-// Typedef for obtaining function from d3d8.dll
-typedef IDirect3D8* (WINAPI *FNDIRECT3DCREATE8) (UINT);
-
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-
-#ifdef _DEBUG
-#define _GLD_TEST_HRESULT(h) \
-{ \
- HRESULT _hr = (h); \
- if (FAILED(_hr)) { \
- gldLogError(GLDLOG_ERROR, #h, _hr); \
- } \
-}
-#define _GLD_DX8(func) _GLD_TEST_HRESULT(IDirect3D8_##func##)
-#define _GLD_DX8_DEV(func) _GLD_TEST_HRESULT(IDirect3DDevice8_##func##)
-#define _GLD_DX8_VB(func) _GLD_TEST_HRESULT(IDirect3DVertexBuffer8_##func##)
-#define _GLD_DX8_TEX(func) _GLD_TEST_HRESULT(IDirect3DTexture8_##func##)
-#else
-#define _GLD_DX8(func) IDirect3D8_##func
-#define _GLD_DX8_DEV(func) IDirect3DDevice8_##func
-#define _GLD_DX8_VB(func) IDirect3DVertexBuffer8_##func
-#define _GLD_DX8_TEX(func) IDirect3DTexture8_##func
-#endif
-
-#define SAFE_RELEASE(p) \
-{ \
- if (p) { \
- (p)->lpVtbl->Release(p); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_VB8(p) \
-{ \
- if (p) { \
- IDirect3DVertexBuffer8_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_SURFACE8(p) \
-{ \
- if (p) { \
- IDirect3DSurface8_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-// Setup index.
-enum {
- GLD_SI_FLAT = 0,
- GLD_SI_SMOOTH = 1,
- GLD_SI_FLAT_EXTRAS = 2,
- GLD_SI_SMOOTH_EXTRAS = 3,
-};
-/*
-// Internal pipeline
-typedef enum {
- GLD_PIPELINE_MESA = 0, // Mesa pipeline
- GLD_PIPELINE_D3D_FVF = 1, // Direct3D Fixed-function pipeline
- GLD_PIPELINE_D3D_VS_TWOSIDE = 2 // Direct3D two-sided-lighting vertex shader
-} GLD_tnl_pipeline;
-*/
-//---------------------------------------------------------------------------
-// Vertex definitions for Fixed-Function pipeline
-//---------------------------------------------------------------------------
-
-//
-// NOTE: If the number of texture units is altered then most of
-// the texture code will need to be revised.
-//
-
-#define GLD_MAX_TEXTURE_UNITS_DX8 2
-
-//
-// 2D vertex transformed by Mesa
-//
-#define GLD_FVF_2D_VERTEX ( D3DFVF_XYZRHW | \
- D3DFVF_DIFFUSE | \
- D3DFVF_SPECULAR | \
- D3DFVF_TEX2)
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT sz; // Screen Z (depth)
- FLOAT rhw; // Reciprocal homogenous W
- DWORD diffuse; // Diffuse colour
- DWORD specular; // For separate-specular support
- FLOAT t0_u, t0_v; // 1st set of texture coords
- FLOAT t1_u, t1_v; // 2nd set of texture coords
-} GLD_2D_VERTEX;
-
-
-//
-// 3D vertex transformed by Direct3D
-//
-#define GLD_FVF_3D_VERTEX ( D3DFVF_XYZ | \
- D3DFVF_DIFFUSE | \
- D3DFVF_TEX2)
-
-typedef struct {
- D3DXVECTOR3 Position; // XYZ Vector in object space
- D3DCOLOR Diffuse; // Diffuse colour
- D3DXVECTOR2 TexUnit0; // Texture unit 0
- D3DXVECTOR2 TexUnit1; // Texture unit 1
-} GLD_3D_VERTEX;
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-/*
-// DX8 Vertex Shader
-typedef struct {
- DWORD hShader; // If NULL, shader is invalid and cannot be used
- BOOL bHardware; // If TRUE then shader was created for hardware,
- // otherwise shader was created for software.
-} GLD_vertexShader;
-*/
-//---------------------------------------------------------------------------
-// Structs
-//---------------------------------------------------------------------------
-
-// This keeps a count of how many times we choose each individual internal
-// pathway. Useful for seeing if a certain pathway was ever used by an app, and
-// how much each pathway is biased.
-// Zero the members at context creation and dump stats at context deletion.
-typedef struct {
- // Note: DWORD is probably too small
- ULARGE_INTEGER qwMesa; // Mesa TnL pipeline
- ULARGE_INTEGER qwD3DFVF; // Direct3D Fixed-Function pipeline
-// ULARGE_INTEGER dwD3D2SVS; // Direct3D Two-Sided Vertex Shader pipeline
-} GLD_pipeline_usage;
-
-// GLDirect Primitive Buffer (points, lines, triangles and quads)
-typedef struct {
- // Data for IDirect3DDevice8::CreateVertexBuffer()
- DWORD dwStride; // Stride of vertex
- DWORD dwUsage; // Usage flags
- DWORD dwFVF; // Direct3D Flexible Vertex Format
- DWORD dwPool; // Pool flags
-
- IDirect3DVertexBuffer8 *pVB; // Holds points, lines, tris and quads.
-
- // Point list is assumed to be at start of buffer
- DWORD iFirstLine; // Index of start of line list
- DWORD iFirstTriangle; // Index of start of triangle list
-
- BYTE *pPoints; // Pointer to next free point
- BYTE *pLines; // Pointer to next free line
- BYTE *pTriangles; // Pointer to next free triangle
-
- DWORD nPoints; // Number of points ready to render
- DWORD nLines; // Number of lines ready to render
- DWORD nTriangles; // Number of triangles ready to render
-} GLD_pb_dx8;
-
-// GLDirect DX8 driver data
-typedef struct {
- // GLDirect vars
- BOOL bDoublebuffer; // Doublebuffer (otherwise single-buffered)
- BOOL bDepthStencil; // Depth buffer needed (stencil optional)
- D3DFORMAT RenderFormat; // Format of back/front buffer
- D3DFORMAT DepthFormat; // Format of depth/stencil
-// float fFlipWindowY; // Value for flipping viewport Y coord
-
- // Direct3D vars
- D3DCAPS8 d3dCaps8;
- BOOL bHasHWTnL; // Device has Hardware Transform/Light?
- IDirect3D8 *pD3D; // Base Direct3D8 interface
- IDirect3DDevice8 *pDev; // Direct3D8 Device interface
- GLD_pb_dx8 PB2d; // Vertices transformed by Mesa
- GLD_pb_dx8 PB3d; // Vertices transformed by Direct3D
- D3DPRIMITIVETYPE d3dpt; // Current Direct3D primitive type
- D3DXMATRIX matProjection; // Projection matrix for D3D TnL
- D3DXMATRIX matModelView; // Model/View matrix for D3D TnL
- int iSetupFunc; // Which setup functions to use
- BOOL bUseMesaTnL; // Whether to use Mesa or D3D for TnL
-
- // Direct3D vars for two-sided lighting
-// GLD_vertexShader VStwosidelight; // Vertex Shader for two-sided lighting
-// D3DXMATRIX matWorldViewProj;// World/View/Projection matrix for shaders
-
-
-// GLD_tnl_pipeline TnLPipeline; // Index of current internal pipeline
- GLD_pipeline_usage PipelineUsage;
-} GLD_driver_dx8;
-
-#define GLD_GET_DX8_DRIVER(c) (GLD_driver_dx8*)(c)->glPriv
-
-//---------------------------------------------------------------------------
-// Function prototypes
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX8(LPCSTR a);
-void gldEnableExtensions_DX8(GLcontext *ctx);
-void gldInstallPipeline_DX8(GLcontext *ctx);
-void gldSetupDriverPointers_DX8(GLcontext *ctx);
-//void gldResizeBuffers_DX8(GLcontext *ctx);
-void gldResizeBuffers_DX8(GLframebuffer *fb);
-
-
-// Texture functions
-
-void gldCopyTexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-void gldCopyTexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void gldCopyTexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-void gldCopyTexSubImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-void gldCopyTexSubImage3D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-
-void gld_NEW_TEXTURE_DX8(GLcontext *ctx);
-void gld_DrawPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
-void gld_ReadPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
-void gld_CopyPixels_DX8(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
-void gld_Bitmap_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
-const struct gl_texture_format* gld_ChooseTextureFormat_DX8(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
-void gld_TexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
-void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
-void gld_DeleteTexture_DX8(GLcontext *ctx, struct gl_texture_object *tObj);
-void gld_ResetLineStipple_DX8(GLcontext *ctx);
-
-// 2D primitive functions
-
-void gld_Points2D_DX8(GLcontext *ctx, GLuint first, GLuint last);
-
-void gld_Line2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-
-void gld_Triangle2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-
-void gld_Quad2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// 3D primitive functions
-
-void gld_Points3D_DX8(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Line3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// Primitive functions for Two-sided-lighting Vertex Shader
-
-void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-#endif
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h
deleted file mode 100644
index f8e92b936..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*==========================================================================;
- *
- *
- * File: dxerr8.h
- * Content: DirectX Error Library Include File
- *
- ****************************************************************************/
-
-#ifndef _GLD_DXERR8_H_
-#define _GLD_DXERR8_H_
-
-
-#include <d3d8.h>
-
-//
-// DXGetErrorString8
-//
-// Desc: Converts an DirectX HRESULT to a string
-//
-// Args: HRESULT hr Can be any error code from
-// DPLAY D3D8 D3DX8 DMUSIC DSOUND
-//
-// Return: Converted string
-//
-const char* __stdcall DXGetErrorString8A(HRESULT hr);
-const WCHAR* __stdcall DXGetErrorString8W(HRESULT hr);
-
-#ifdef UNICODE
- #define DXGetErrorString8 DXGetErrorString8W
-#else
- #define DXGetErrorString8 DXGetErrorString8A
-#endif
-
-
-//
-// DXTrace
-//
-// Desc: Outputs a formatted error message to the debug stream
-//
-// Args: CHAR* strFile The current file, typically passed in using the
-// __FILE__ macro.
-// DWORD dwLine The current line number, typically passed in using the
-// __LINE__ macro.
-// HRESULT hr An HRESULT that will be traced to the debug stream.
-// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
-// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
-//
-// Return: The hr that was passed in.
-//
-//HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE );
-//HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE );
-HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox);
-HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox);
-
-#ifdef UNICODE
- #define DXTrace DXTraceW
-#else
- #define DXTrace DXTraceA
-#endif
-
-
-//
-// Helper macros
-//
-#if defined(DEBUG) | defined(_DEBUG)
- #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
- #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
- #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
-#else
- #define DXTRACE_MSG(str) (0L)
- #define DXTRACE_ERR(str,hr) (hr)
- #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
-#endif
-
-
-#endif
-
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c
deleted file mode 100644
index b51bba9b3..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GL extensions
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "../gld_settings.h"
-
-#include <windows.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-//#include "ddlog.h"
-//#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "vbo/vbo.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "dglcontext.h"
-#include "extensions.h"
-
-// For some reason this is not defined in an above header...
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
-
-//---------------------------------------------------------------------------
-// Hack for the SGIS_multitexture extension that was removed from Mesa
-// NOTE: SGIS_multitexture enums also clash with GL_SGIX_async_pixel
-
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // To enable, uncomment:
- // _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
-//---------------------------------------------------------------------------
-
-enum {
- /* Quake2 GL_SGIS_multitexture */
- GL_SELECTED_TEXTURE_SGIS = 0x835B,
- GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835C,
- GL_MAX_TEXTURES_SGIS = 0x835D,
- GL_TEXTURE0_SGIS = 0x835E,
- GL_TEXTURE1_SGIS = 0x835F,
- GL_TEXTURE2_SGIS = 0x8360,
- GL_TEXTURE3_SGIS = 0x8361,
- GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363,
-};
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldSelectTextureSGIS(
- GLenum target)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glActiveTextureARB(ARB_target);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fSGIS(
- GLenum target,
- GLfloat s,
- GLfloat t)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fARB(ARB_target, s, t);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fvSGIS(
- GLenum target,
- const GLfloat *v)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fvARB(ARB_target, v);
-}
-
-//---------------------------------------------------------------------------
-// Extensions
-//---------------------------------------------------------------------------
-
-typedef struct {
- PROC proc;
- char *name;
-} GLD_extension;
-
-GLD_extension GLD_extList[] = {
-#ifdef GL_EXT_polygon_offset
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
-#endif
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
- { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
- { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
-
- { (PROC)glLockArraysEXT, "glLockArraysEXT" },
- { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" },
- { NULL, "\0" }
-};
-
-GLD_extension GLD_multitexList[] = {
-/*
- { (PROC)glMultiTexCoord1dSGIS, "glMTexCoord1dSGIS" },
- { (PROC)glMultiTexCoord1dvSGIS, "glMTexCoord1dvSGIS" },
- { (PROC)glMultiTexCoord1fSGIS, "glMTexCoord1fSGIS" },
- { (PROC)glMultiTexCoord1fvSGIS, "glMTexCoord1fvSGIS" },
- { (PROC)glMultiTexCoord1iSGIS, "glMTexCoord1iSGIS" },
- { (PROC)glMultiTexCoord1ivSGIS, "glMTexCoord1ivSGIS" },
- { (PROC)glMultiTexCoord1sSGIS, "glMTexCoord1sSGIS" },
- { (PROC)glMultiTexCoord1svSGIS, "glMTexCoord1svSGIS" },
- { (PROC)glMultiTexCoord2dSGIS, "glMTexCoord2dSGIS" },
- { (PROC)glMultiTexCoord2dvSGIS, "glMTexCoord2dvSGIS" },
- { (PROC)glMultiTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)glMultiTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
- { (PROC)glMultiTexCoord2iSGIS, "glMTexCoord2iSGIS" },
- { (PROC)glMultiTexCoord2ivSGIS, "glMTexCoord2ivSGIS" },
- { (PROC)glMultiTexCoord2sSGIS, "glMTexCoord2sSGIS" },
- { (PROC)glMultiTexCoord2svSGIS, "glMTexCoord2svSGIS" },
- { (PROC)glMultiTexCoord3dSGIS, "glMTexCoord3dSGIS" },
- { (PROC)glMultiTexCoord3dvSGIS, "glMTexCoord3dvSGIS" },
- { (PROC)glMultiTexCoord3fSGIS, "glMTexCoord3fSGIS" },
- { (PROC)glMultiTexCoord3fvSGIS, "glMTexCoord3fvSGIS" },
- { (PROC)glMultiTexCoord3iSGIS, "glMTexCoord3iSGIS" },
- { (PROC)glMultiTexCoord3ivSGIS, "glMTexCoord3ivSGIS" },
- { (PROC)glMultiTexCoord3sSGIS, "glMTexCoord3sSGIS" },
- { (PROC)glMultiTexCoord3svSGIS, "glMTexCoord3svSGIS" },
- { (PROC)glMultiTexCoord4dSGIS, "glMTexCoord4dSGIS" },
- { (PROC)glMultiTexCoord4dvSGIS, "glMTexCoord4dvSGIS" },
- { (PROC)glMultiTexCoord4fSGIS, "glMTexCoord4fSGIS" },
- { (PROC)glMultiTexCoord4fvSGIS, "glMTexCoord4fvSGIS" },
- { (PROC)glMultiTexCoord4iSGIS, "glMTexCoord4iSGIS" },
- { (PROC)glMultiTexCoord4ivSGIS, "glMTexCoord4ivSGIS" },
- { (PROC)glMultiTexCoord4sSGIS, "glMTexCoord4sSGIS" },
- { (PROC)glMultiTexCoord4svSGIS, "glMTexCoord4svSGIS" },
- { (PROC)glMultiTexCoordPointerSGIS, "glMTexCoordPointerSGIS" },
- { (PROC)glSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)glSelectTextureCoordSetSGIS, "glSelectTextureCoordSetSGIS" },
-*/
- { (PROC)glActiveTextureARB, "glActiveTextureARB" },
- { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" },
- { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" },
- { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" },
- { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" },
- { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" },
- { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" },
- { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" },
- { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" },
- { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" },
- { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" },
- { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" },
- { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" },
- { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" },
- { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" },
- { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" },
- { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" },
- { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" },
- { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" },
- { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" },
- { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" },
- { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" },
- { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" },
- { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" },
- { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" },
- { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" },
- { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" },
- { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" },
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" },
- { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" },
- { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" },
- { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" },
- { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" },
- { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" },
-
- // Descent3 doesn't use correct string, hence this hack
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4f" },
-
- // Quake2 SGIS multitexture
- { (PROC)gldSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)gldMTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)gldMTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
-
- { NULL, "\0" }
-};
-
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX(
- LPCSTR a)
-{
- int i;
- PROC proc = NULL;
-
- for (i=0; GLD_extList[i].proc; i++) {
- if (!strcmp(a, GLD_extList[i].name)) {
- proc = GLD_extList[i].proc;
- break;
- }
- }
-
- if (glb.bMultitexture) {
- for (i=0; GLD_multitexList[i].proc; i++) {
- if (!strcmp(a, GLD_multitexList[i].name)) {
- proc = GLD_multitexList[i].proc;
- break;
- }
- }
- }
-
- gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed");
-
- return proc;
-}
-
-//---------------------------------------------------------------------------
-
-void gldEnableExtensions_DX8(
- GLcontext *ctx)
-{
- GLuint i;
-
- // Mesa enables some extensions by default.
- // This table decides which ones we want to switch off again.
-
- // NOTE: GL_EXT_compiled_vertex_array appears broken.
-
- const char *gld_disable_extensions[] = {
-// "GL_ARB_transpose_matrix",
-// "GL_EXT_compiled_vertex_array",
-// "GL_EXT_polygon_offset",
-// "GL_EXT_rescale_normal",
- "GL_EXT_texture3D",
-// "GL_NV_texgen_reflection",
- NULL
- };
-
- const char *gld_multitex_extensions[] = {
- "GL_ARB_multitexture", // Quake 3
- NULL
- };
-
- // Quake 2 engines
- const char *szGL_SGIS_multitexture = "GL_SGIS_multitexture";
-
- const char *gld_enable_extensions[] = {
- "GL_EXT_texture_env_add", // Quake 3
- "GL_ARB_texture_env_add", // Quake 3
- NULL
- };
-
- for (i=0; gld_disable_extensions[i]; i++) {
- _mesa_disable_extension(ctx, gld_disable_extensions[i]);
- }
-
- for (i=0; gld_enable_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_enable_extensions[i]);
- }
-
- if (glb.bMultitexture) {
- for (i=0; gld_multitex_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_multitex_extensions[i]);
- }
-
- // GL_SGIS_multitexture
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // Fair bit slower on GeForce256,
- // Much slower on 3dfx Voodoo5 5500.
-// _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
- }
-
- _mesa_enable_imaging_extensions(ctx);
- _mesa_enable_1_3_extensions(ctx);
- _mesa_enable_1_4_extensions(ctx);
-}
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c
deleted file mode 100644
index 2baea5744..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Mesa transformation pipeline with GLDirect fastpath
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-extern struct tnl_pipeline_stage _gld_d3d_render_stage;
-extern struct tnl_pipeline_stage _gld_mesa_render_stage;
-
-static const struct tnl_pipeline_stage *gld_pipeline[] = {
- &_gld_d3d_render_stage, // Direct3D TnL
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage. ??? */
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
- &_gld_mesa_render_stage, // Mesa TnL, D3D rendering
- 0,
-};
-
-//---------------------------------------------------------------------------
-
-void gldInstallPipeline_DX8(
- GLcontext *ctx)
-{
- // Remove any existing pipeline stages,
- // then install GLDirect pipeline stages.
-
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, gld_pipeline);
-}
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
deleted file mode 100644
index a5b5462f0..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
+++ /dev/null
@@ -1,1446 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Primitive (points/lines/tris/quads) rendering
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "vbo/vbo.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "swrast/s_context.h"
-#include "swrast/s_depth.h"
-#include "swrast/s_lines.h"
-#include "swrast/s_triangle.h"
-#include "swrast/s_trispan.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-// Disable compiler complaints about unreferenced local variables
-#pragma warning (disable:4101)
-
-//---------------------------------------------------------------------------
-// Helper defines for primitives
-//---------------------------------------------------------------------------
-
-//static const float ooZ = 1.0f / 65536.0f; // One over Z
-
-#define GLD_COLOUR (D3DCOLOR_RGBA(swv->color[0], swv->color[1], swv->color[2], swv->color[3]))
-#define GLD_SPECULAR (D3DCOLOR_RGBA(swv->specular[0], swv->specular[1], swv->specular[2], swv->specular[3]))
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-//---------------------------------------------------------------------------
-// 2D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_2D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pPoints; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pLines; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_TRIANGLES \
- BOOL bFog = ctx->Fog.Enabled; \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pTriangles; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour; \
- GLuint facing = 0; \
- struct vertex_buffer *VB; \
- GLchan (*vbcolor)[4]; \
- GLchan (*vbspec)[4]
-
-#define GLD_SETUP_GET_SWVERT(s) \
- swv = &ss->verts[##s]
-
-#define GLD_SETUP_2D_VERTEX \
- pV->x = swv->win[0]; \
- pV->y = GLD_FLIP_Y(swv->win[1]); \
- pV->rhw = swv->win[3]
-
-#define GLD_SETUP_SMOOTH_COLOUR \
- pV->diffuse = GLD_COLOUR
-
-#define GLD_SETUP_GET_FLAT_COLOUR \
- dwFlatColour = GLD_COLOUR
-#define GLD_SETUP_GET_FLAT_FOG_COLOUR \
- dwFlatColour = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_USE_FLAT_COLOUR \
- pV->diffuse = dwFlatColour
-
-#define GLD_SETUP_GET_FLAT_SPECULAR \
- dwSpecularColour= GLD_SPECULAR
-
-#define GLD_SETUP_USE_FLAT_SPECULAR \
- pV->specular = dwSpecularColour
-
-#define GLD_SETUP_DEPTH \
- pV->sz = swv->win[2] / ctx->DepthMaxF
-// pV->z = swv->win[2] * ooZ;
-
-#define GLD_SETUP_SPECULAR \
- pV->specular = GLD_SPECULAR
-
-#define GLD_SETUP_FOG \
- pV->diffuse = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_TEX0 \
- pV->t0_u = swv->texcoord[0][0]; \
- pV->t0_v = swv->texcoord[0][1]
-
-#define GLD_SETUP_TEX1 \
- pV->t1_u = swv->texcoord[1][0]; \
- pV->t1_v = swv->texcoord[1][1]
-
-#define GLD_SETUP_LIGHTING(v) \
- if (facing == 1) { \
- pV->diffuse = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- pV->specular = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- } else { \
- if (bFog) \
- GLD_SETUP_FOG; \
- else \
- GLD_SETUP_SMOOTH_COLOUR; \
- GLD_SETUP_SPECULAR; \
- }
-
-#define GLD_SETUP_GET_FLAT_LIGHTING(v) \
- if (facing == 1) { \
- dwFlatColour = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- dwSpecularColour = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- }
-
-#define GLD_SETUP_TWOSIDED_LIGHTING \
- /* Two-sided lighting */ \
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { \
- SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; \
- SWvertex *v[3]; \
- GLfloat ex,ey,fx,fy,cc; \
- /* Get vars for later */ \
- VB = &TNL_CONTEXT(ctx)->vb; \
- vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \
- if (VB->SecondaryColorPtr[1]) { \
- vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \
- } else { \
- vbspec = NULL; \
- } \
- v[0] = &verts[v0]; \
- v[1] = &verts[v1]; \
- v[2] = &verts[v2]; \
- ex = v[0]->win[0] - v[2]->win[0]; \
- ey = v[0]->win[1] - v[2]->win[1]; \
- fx = v[1]->win[0] - v[2]->win[0]; \
- fy = v[1]->win[1] - v[2]->win[1]; \
- cc = ex*fy - ey*fx; \
- facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; \
- }
-
-//---------------------------------------------------------------------------
-// 3D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_3D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pPoints; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pLines; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_TRIANGLES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pTriangles; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VERTEX(v) \
- p4f = VB->ObjPtr->data; \
- pV->Position.x = p4f[##v][0]; \
- pV->Position.y = p4f[##v][1]; \
- pV->Position.z = p4f[##v][2];
-
-#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-
-#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-#define GLD_SETUP_USE_FLAT_COLOUR_3D \
- pV->Diffuse = dwColor;
-
-#define GLD_SETUP_TEX0_3D(v) \
- if (VB->TexCoordPtr[0]) { \
- tc = VB->TexCoordPtr[0]->data; \
- pV->TexUnit0.x = tc[##v][0]; \
- pV->TexUnit0.y = tc[##v][1]; \
- }
-
-#define GLD_SETUP_TEX1_3D(v) \
- if (VB->TexCoordPtr[1]) { \
- tc = VB->TexCoordPtr[1]->data; \
- pV->TexUnit1.x = tc[##v][0]; \
- pV->TexUnit1.y = tc[##v][1]; \
- }
-
-//---------------------------------------------------------------------------
-// Helper functions
-//---------------------------------------------------------------------------
-
-__inline DWORD _gldComputeFog(
- GLcontext *ctx,
- SWvertex *swv)
-{
- // Full fog calculation.
- // Based on Mesa code.
-
- GLchan rFog, gFog, bFog;
- GLchan fR, fG, fB;
- const GLfloat f = swv->fog;
- const GLfloat g = 1.0f - f;
-
- UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
- fR = f * swv->color[0] + g * rFog;
- fG = f * swv->color[1] + g * gFog;
- fB = f * swv->color[2] + g * bFog;
- return D3DCOLOR_RGBA(fR, fG, fB, swv->color[3]);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ResetLineStipple_DX8(
- GLcontext *ctx)
-{
- // TODO: Fake stipple with a 32x32 texture.
-}
-
-//---------------------------------------------------------------------------
-// 2D (post-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points2D_DX8(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_2D_VARS_POINTS;
-
- unsigned i;
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
- GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- } else {
- GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, swv++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- }
-
- gld->PB2d.pPoints = (BYTE*)pV;
- gld->PB2d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
-
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatExtras_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v2);
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v2);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothExtras_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatExtras_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v3);
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v3);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothExtras_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v3);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// 3D (pre-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points3D_DX8(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_3D_VARS_POINTS
-
- unsigned i;
-// struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
-// GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_3D_VERTEX(VB->Elts[i])
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- } else {
-// GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- }
-/*
- for (i=first; i<last; i++, pV++) {
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
-*/
- gld->PB3d.pPoints = (BYTE*)pV;
- gld->PB3d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-// Line functions
-//---------------------------------------------------------------------------
-
-void gld_Line3DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line3DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-// Triangle functions
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-// Quad functions
-//---------------------------------------------------------------------------
-
-void gld_Quad3DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad3DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_SMOOTH_COLOUR_3D(v3)
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// Vertex setup for two-sided-lighting vertex shader
-//---------------------------------------------------------------------------
-
-/*
-
-void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last)
-{
- // NOTE: Two-sided lighting does not apply to Points
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-*/
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c
deleted file mode 100644
index f24b3cfb7..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c
+++ /dev/null
@@ -1,2046 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Texture / Bitmap functions
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-#include <d3dx8tex.h>
-
-#include "texformat.h"
-#include "colormac.h"
-#include "texstore.h"
-#include "image.h"
-// #include "mem.h"
-
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_HEIGHT(y,h) (gldCtx->dwHeight - (y) - (h))
-
-//---------------------------------------------------------------------------
-// 1D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + (i) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (i) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (i))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (i))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 2D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + ((t)->Width * (j) + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 3D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz)
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// Direct3D texture formats that have no Mesa equivalent
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format _gld_texformat_X8R8G8B8 = {
- MESA_FORMAT_ARGB8888, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 8, /* RedBits */
- 8, /* GreenBits */
- 8, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 4, /* TexelBytes */
- _mesa_texstore_argb8888, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */
- gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */
- gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X1R5G5B5 = {
- MESA_FORMAT_ARGB1555, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 5, /* RedBits */
- 5, /* GreenBits */
- 5, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb1555, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */
- gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */
- gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X4R4G4B4 = {
- MESA_FORMAT_ARGB4444, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 4, /* RedBits */
- 4, /* GreenBits */
- 4, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb4444, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */
- gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */
- gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */
-};
-
-//---------------------------------------------------------------------------
-// Texture unit constants
-//---------------------------------------------------------------------------
-
-// List of possible combinations of texture environments.
-// Example: GLD_TEXENV_MODULATE_RGBA means
-// GL_MODULATE, GL_RGBA base internal format.
-#define GLD_TEXENV_DECAL_RGB 0
-#define GLD_TEXENV_DECAL_RGBA 1
-#define GLD_TEXENV_DECAL_ALPHA 2
-#define GLD_TEXENV_REPLACE_RGB 3
-#define GLD_TEXENV_REPLACE_RGBA 4
-#define GLD_TEXENV_REPLACE_ALPHA 5
-#define GLD_TEXENV_MODULATE_RGB 6
-#define GLD_TEXENV_MODULATE_RGBA 7
-#define GLD_TEXENV_MODULATE_ALPHA 8
-#define GLD_TEXENV_BLEND_RGB 9
-#define GLD_TEXENV_BLEND_RGBA 10
-#define GLD_TEXENV_BLEND_ALPHA 11
-#define GLD_TEXENV_ADD_RGB 12
-#define GLD_TEXENV_ADD_RGBA 13
-#define GLD_TEXENV_ADD_ALPHA 14
-
-// Per-stage (i.e. per-unit) texture environment
-typedef struct {
- DWORD ColorArg1; // Colour argument 1
- D3DTEXTUREOP ColorOp; // Colour operation
- DWORD ColorArg2; // Colour argument 2
- DWORD AlphaArg1; // Alpha argument 1
- D3DTEXTUREOP AlphaOp; // Alpha operation
- DWORD AlphaArg2; // Alpha argument 2
-} GLD_texenv;
-
-// TODO: Do we really need to set ARG1 and ARG2 every time?
-// They seem to always be TEXTURE and CURRENT respectively.
-
-// C = Colour out
-// A = Alpha out
-// Ct = Colour from Texture
-// Cf = Colour from fragment (diffuse)
-// At = Alpha from Texture
-// Af = Alpha from fragment (diffuse)
-// Cc = GL_TEXTURE_ENV_COLOUR (GL_BLEND)
-const GLD_texenv gldTexEnv[] = {
- // DECAL_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_RGBA: C=Cf(1-At)+CtAt, A=Af
- {D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_ALPHA: <undefined> use DECAL_RGB
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
-
- // REPLACE_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // REPLACE_RGBA: C=Ct, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
- // REPLACE_ALPHA: C=Cf, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
-
- // MODULATE_RGB: C=CfCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // MODULATE_RGBA: C=CfCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // MODULATE_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // BLEND_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // ADD_RGB: C=Cf+Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // ADD_RGBA: C=Cf+Ct, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // ADD_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-};
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREADDRESS _gldConvertWrap(
- GLenum wrap)
-{
- return (wrap == GL_CLAMP) ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREFILTERTYPE _gldConvertMagFilter(
- GLenum magfilter)
-{
- return (magfilter == GL_LINEAR) ? D3DTEXF_LINEAR : D3DTEXF_POINT;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldConvertMinFilter(
- GLenum minfilter,
- D3DTEXTUREFILTERTYPE *min_filter,
- D3DTEXTUREFILTERTYPE *mip_filter)
-{
- switch (minfilter) {
- case GL_NEAREST:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_NONE;
- break;
- case GL_LINEAR:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_POINT;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_POINT;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_LINEAR;
- break;
- }
-}
-
-//---------------------------------------------------------------------------
-
-D3DFORMAT _gldGLFormatToD3DFormat(
- GLenum internalFormat)
-{
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- // LUNIMANCE != INTENSITY, but D3D doesn't have I8 textures
- return D3DFMT_L8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return D3DFMT_L8;
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return D3DFMT_A8;
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return D3DFMT_X8R8G8B8;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return D3DFMT_A8L8;
- case GL_R3_G3_B2:
- // TODO: Mesa does not support RGB332 internally
- return D3DFMT_X4R4G4B4; //D3DFMT_R3G3B2;
- case GL_RGB4:
- return D3DFMT_X4R4G4B4;
- case GL_RGB5:
- return D3DFMT_X1R5G5B5;
- case 3:
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return D3DFMT_R8G8B8;
- case GL_RGBA4:
- return D3DFMT_A4R4G4B4;
- case 4:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return D3DFMT_A8R8G8B8;
- case GL_RGB5_A1:
- return D3DFMT_A1R5G5B5;
- }
-
- // Return an acceptable default
- return D3DFMT_A8R8G8B8;
-}
-
-//---------------------------------------------------------------------------
-
-GLenum _gldDecodeBaseFormat(
- IDirect3DTexture8 *pTex)
-{
- // Examine Direct3D texture and return base OpenGL internal texture format
- // NOTE: We can't use any base format info from Mesa because D3D might have
- // used a different texture format when we used D3DXCreateTexture().
-
- // Base internal format is one of (Red Book p355):
- // GL_ALPHA,
- // GL_LUMINANCE,
- // GL_LUMINANCE_ALPHA,
- // GL_INTENSITY,
- // GL_RGB,
- // GL_RGBA
-
- // NOTE: INTENSITY not used (not supported by Direct3D)
- // LUMINANCE has same texture functions as RGB
- // LUMINANCE_ALPHA has same texture functions as RGBA
-
- // TODO: cache format instead of using GetLevelDesc()
- D3DSURFACE_DESC desc;
- _GLD_DX8_TEX(GetLevelDesc(pTex, 0, &desc));
-
- switch (desc.Format) {
- case D3DFMT_R8G8B8:
- case D3DFMT_X8R8G8B8:
- case D3DFMT_R5G6B5:
- case D3DFMT_X1R5G5B5:
- case D3DFMT_R3G3B2:
- case D3DFMT_X4R4G4B4:
- case D3DFMT_P8:
- case D3DFMT_L8:
- return GL_RGB;
- case D3DFMT_A8R8G8B8:
- case D3DFMT_A1R5G5B5:
- case D3DFMT_A4R4G4B4:
- case D3DFMT_A8R3G3B2:
- case D3DFMT_A8P8:
- case D3DFMT_A8L8:
- case D3DFMT_A4L4:
- return GL_RGBA;
- case D3DFMT_A8:
- return GL_ALPHA;
- // Compressed texture formats. Need to check these...
- case D3DFMT_DXT1:
- return GL_RGBA;
- case D3DFMT_DXT2:
- return GL_RGB;
- case D3DFMT_DXT3:
- return GL_RGBA;
- case D3DFMT_DXT4:
- return GL_RGB;
- case D3DFMT_DXT5:
- return GL_RGBA;
- }
-
- // Fell through. Return arbitary default.
- return GL_RGBA;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* _gldMesaFormatForD3DFormat(
- D3DFORMAT d3dfmt)
-{
- switch (d3dfmt) {
- case D3DFMT_A8R8G8B8:
- return &_mesa_texformat_argb8888;
- case D3DFMT_R8G8B8:
- return &_mesa_texformat_rgb888;
- case D3DFMT_R5G6B5:
- return &_mesa_texformat_rgb565;
- case D3DFMT_A4R4G4B4:
- return &_mesa_texformat_argb4444;
- case D3DFMT_A1R5G5B5:
- return &_mesa_texformat_argb1555;
- case D3DFMT_A8L8:
- return &_mesa_texformat_al88;
- case D3DFMT_R3G3B2:
- return &_mesa_texformat_rgb332;
- case D3DFMT_A8:
- return &_mesa_texformat_a8;
- case D3DFMT_L8:
- return &_mesa_texformat_l8;
- case D3DFMT_X8R8G8B8:
- return &_gld_texformat_X8R8G8B8;
- case D3DFMT_X1R5G5B5:
- return &_gld_texformat_X1R5G5B5;
- case D3DFMT_X4R4G4B4:
- return &_gld_texformat_X4R4G4B4;
- }
-
- // If we reach here then we've made an error somewhere else
- // by allowing a format that is not supported.
- assert(0);
-
- return NULL; // Shut up compiler warning
-}
-
-//---------------------------------------------------------------------------
-// Copy* functions
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage1D_DX8(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y,
- GLsizei width, GLint border )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage2D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLenum internalFormat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage1D_DX8(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage2D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage3D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height )
-{
- // TODO ?
-}
-
-//---------------------------------------------------------------------------
-// Bitmap/Pixel functions
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-#define _GLD_FVF_IMAGE (D3DFVF_XYZRHW | D3DFVF_TEX1)
-
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT z; // depth value
- FLOAT rhw; // reciprocal homogenous W (always 1.0f)
- FLOAT tu, tv; // texture coords
-} _GLD_IMAGE_VERTEX;
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldDrawPixels(
- GLcontext *ctx,
- BOOL bChromakey, // Alpha test for glBitmap() images
- GLint x, // GL x position
- GLint y, // GL y position (needs flipping)
- GLsizei width, // Width of input image
- GLsizei height, // Height of input image
- IDirect3DSurface8 *pImage)
-{
- //
- // Draw input image as texture implementing PixelZoom and clipping.
- // Any fragment operations currently enabled will be used.
- //
-
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTexture;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface8 *pSurface;
- _GLD_IMAGE_VERTEX v[4];
- HRESULT hr;
-
- float ZoomWidth, ZoomHeight;
- float ScaleWidth, ScaleHeight;
-
- // Create a texture to hold image
- hr = D3DXCreateTexture(
- gld->pDev,
- width, height,
- 1, // miplevels
- 0, // usage
- D3DFMT_A8R8G8B8, // format
- D3DPOOL_MANAGED, // pool
- &pTexture);
- if (FAILED(hr))
- return hr;
-
- hr = IDirect3DTexture8_GetSurfaceLevel(pTexture, 0, &pSurface);
- if (FAILED(hr)) {
- IDirect3DTexture8_Release(pTexture);
- return hr;
- }
-
- // Copy image into texture
- hr = D3DXLoadSurfaceFromSurface(
- pSurface, NULL, NULL, // Dest surface
- pImage, NULL, NULL, // Src surface
- D3DX_FILTER_NONE,
- 0);
- IDirect3DSurface8_Release(pSurface);
- if (FAILED(hr)) {
- IDirect3DTexture8_Release(pTexture);
- return hr;
- }
-
- //
- // Set up the quad like this (ascii-art ahead!)
- //
- // 3--2
- // | |
- // 0--1
- //
- //
-
- // Set depth
- v[0].z = v[1].z = v[2].z = v[3].z = ctx->Current.RasterPos[2];
- // Set Reciprocal Homogenous W
- v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw = 1.0f;
-
- // Set texcoords
- // Examine texture size - if different to input width and height
- // then we'll need to munge the texcoords to fit.
- IDirect3DTexture8_GetLevelDesc(pTexture, 0, &d3dsd);
- ScaleWidth = (float)width / (float)d3dsd.Width;
- ScaleHeight = (float)height / (float)d3dsd.Height;
- v[0].tu = 0.0f; v[0].tv = 0.0f;
- v[1].tu = ScaleWidth; v[1].tv = 0.0f;
- v[2].tu = ScaleWidth; v[2].tv = ScaleHeight;
- v[3].tu = 0.0f; v[3].tv = ScaleHeight;
-
- // Set raster positions
- ZoomWidth = (float)width * ctx->Pixel.ZoomX;
- ZoomHeight = (float)height * ctx->Pixel.ZoomY;
-
- v[0].x = x; v[0].y = GLD_FLIP_Y(y);
- v[1].x = x+ZoomWidth; v[1].y = GLD_FLIP_Y(y);
- v[2].x = x+ZoomWidth; v[2].y = GLD_FLIP_Y(y+ZoomHeight);
- v[3].x = x; v[3].y = GLD_FLIP_Y(y+ZoomHeight);
-
- // Draw image with full HW acceleration
- // NOTE: Be nice to use a State Block for all this state...
- IDirect3DDevice8_SetTexture(gld->pDev, 0, pTexture);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_MINFILTER, D3DTEXF_POINT);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_MIPFILTER, D3DTEXF_POINT);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_MAGFILTER, D3DTEXF_POINT);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
- IDirect3DDevice8_SetVertexShader(gld->pDev, _GLD_FVF_IMAGE);
-
- //
- // Emulate Chromakey with an Alpha Test.
- // [Alpha Test is more widely supported anyway]
- //
- if (bChromakey) {
- // Switch on alpha testing
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, TRUE);
- // Fragment passes is alpha is greater than reference value
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, D3DCMP_GREATER);
- // Set alpha reference value between Bitmap alpha values of
- // zero (transparent) and one (opaque).
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ALPHAREF, 0x7f);
- }
-
- IDirect3DDevice8_DrawPrimitiveUP(gld->pDev, D3DPT_TRIANGLEFAN, 2, &v, sizeof(_GLD_IMAGE_VERTEX));
-
- // Release texture
- IDirect3DDevice8_SetTexture(gld->pDev, 0, NULL);
- IDirect3DTexture8_Release(pTexture);
-
- // Reset state to before we messed it up
- FLUSH_VERTICES(ctx, _NEW_ALL);
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DrawPixels_DX8(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- GLD_context *gldCtx;
- GLD_driver_dx8 *gld;
-
- IDirect3DSurface8 *pImage;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
-
- const struct gl_texture_format *MesaFormat;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- &pImage);
- if (FAILED(hr)) {
- return;
- }
-
- //
- // Use Mesa to fill in image
- //
-
- // Lock all of surface
- hr = IDirect3DSurface8_LockRect(pImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
-
- // unpack image, apply transfer ops and store directly in texture
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA,
- &_mesa_texformat_argb8888,
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, /* dstImageStride */
- format, type, pixels, unpack);
-
- IDirect3DSurface8_UnlockRect(pImage);
-
- _gldDrawPixels(ctx, FALSE, x, y, width, height, pImage);
-
- IDirect3DSurface8_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ReadPixels_DX8(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *dest)
-{
-
- GLD_context *gldCtx;
- GLD_driver_dx8 *gld;
-
- IDirect3DSurface8 *pBackbuffer = NULL;
- IDirect3DSurface8 *pNativeImage = NULL;
- IDirect3DSurface8 *pCanonicalImage = NULL;
-
- D3DSURFACE_DESC d3dsd;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- struct gl_pixelstore_attrib srcPacking;
- int i;
- GLint DstRowStride;
- const struct gl_texture_format *MesaFormat;
-
- switch (format) {
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- return;
- }
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
- DstRowStride = _mesa_image_row_stride(pack, width, format, type);
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice8_GetBackBuffer(
- gld->pDev,
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- &pNativeImage);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, x, GLD_FLIP_HEIGHT(y, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels.
- //
- // This intermediate surface ensure that we can use CopyRects()
- // instead of relying on D3DXLoadSurfaceFromSurface(), which may
- // try and lock the backbuffer. This way seems safer.
- //
- hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pNativeImage,
- &ptDst);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // Create an RGBA8888 surface
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- &pCanonicalImage);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // Convert to RGBA8888
- hr = D3DXLoadSurfaceFromSurface(
- pCanonicalImage, // Dest surface
- NULL, NULL, // Dest palette, RECT
- pNativeImage, // Src surface
- NULL, NULL, // Src palette, RECT
- D3DX_FILTER_NONE, // Filter
- 0); // Colourkey
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- srcPacking.Alignment = 1;
- srcPacking.ImageHeight = height;
- srcPacking.LsbFirst = GL_FALSE;
- srcPacking.RowLength = 0;
- srcPacking.SkipImages = 0;
- srcPacking.SkipPixels = 0;
- srcPacking.SkipRows = 0;
- srcPacking.SwapBytes = GL_FALSE;
-
- // Lock all of image
- hr = IDirect3DSurface8_LockRect(pCanonicalImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // We need to flip the data. Yuck.
- // Perhaps Mesa has a span packer we can use in future...
- for (i=0; i<height; i++) {
- BYTE *pDestRow = (BYTE*)_mesa_image_address(2,pack, dest, width, height, format, type, 0, i, 0);
- BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1));
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA, // base format
- MesaFormat, // dst format
- pDestRow, // dest addr
- width, 1, 1, 0, 0, 0, // src x,y,z & dst offsets x,y,z
- DstRowStride, // dst row stride
- 0, // dstImageStride
- GL_BGRA, // src format
- GL_UNSIGNED_BYTE, // src type
- pSrcRow, // src addr
- &srcPacking); // packing params of source image
- }
-
- IDirect3DSurface8_UnlockRect(pCanonicalImage);
-
-gld_ReadPixels_DX8_return:
- SAFE_RELEASE_SURFACE8(pCanonicalImage);
- SAFE_RELEASE_SURFACE8(pNativeImage);
- SAFE_RELEASE_SURFACE8(pBackbuffer);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_CopyPixels_DX8(
- GLcontext *ctx,
- GLint srcx,
- GLint srcy,
- GLsizei width,
- GLsizei height,
- GLint dstx,
- GLint dsty,
- GLenum type)
-{
- //
- // NOTE: Not allowed to copy vidmem to vidmem!
- // Therefore we use an intermediate image surface.
- //
-
- GLD_context *gldCtx;
- GLD_driver_dx8 *gld;
-
- IDirect3DSurface8 *pBackbuffer;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface8 *pImage;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
-
- // Only backbuffer
- if (type != GL_COLOR)
- return;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice8_GetBackBuffer(
- gld->pDev,
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pBackbuffer);
- return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- &pImage);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pBackbuffer);
- return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, srcx, GLD_FLIP_HEIGHT(srcy, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels
- hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pImage,
- &ptDst);
- IDirect3DSurface8_Release(pBackbuffer);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- _gldDrawPixels(ctx, FALSE, dstx, dsty, width, height, pImage);
-
- IDirect3DSurface8_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Bitmap_DX8(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- GLD_context *gldCtx;
- GLD_driver_dx8 *gld;
-
- IDirect3DSurface8 *pImage;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- BYTE *pTempBitmap;
- D3DCOLOR clBitmapOne, clBitmapZero;
- D3DCOLOR *pBits;
- const GLubyte *src;
- int i, j, k;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- clBitmapZero = D3DCOLOR_RGBA(0,0,0,0); // NOTE: Alpha is Zero
- clBitmapOne = D3DCOLOR_COLORVALUE(
- ctx->Current.RasterColor[0],
- ctx->Current.RasterColor[1],
- ctx->Current.RasterColor[2],
- 1.0f); // NOTE: Alpha is One
-
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- &pImage);
- if (FAILED(hr)) {
- return;
- }
-
- // Lock all of surface
- hr = IDirect3DSurface8_LockRect(pImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- pTempBitmap = _mesa_unpack_bitmap(width, height, bitmap, unpack);
- if (pTempBitmap == NULL) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- pBits = (D3DCOLOR*)d3dLockedRect.pBits;
-
- for (i=0; i<height; i++) {
- GLubyte byte;
- pBits = (D3DCOLOR*)((BYTE*)d3dLockedRect.pBits + (i*d3dLockedRect.Pitch));
- src = (const GLubyte *) _mesa_image_address(2,
- &ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP,
- 0, i, 0);
- for (j=0; j<(width>>3); j++) {
- byte = *src++;
- for (k=0; k<8; k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- // Fill remaining bits from bitmap
- if (width & 7) {
- byte = *src;
- for (k=0; k<(width & 7); k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- }
-
- FREE(pTempBitmap);
-
-/*
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- GL_BITMAP,
- &_mesa_texformat_argb8888,
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- GL_BITMAP, GL_COLOR_INDEX, bitmap, unpack);
-*/
- IDirect3DSurface8_UnlockRect(pImage);
-
- _gldDrawPixels(ctx, TRUE, x, y, width, height, pImage);
-
- IDirect3DSurface8_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-// Texture functions
-//---------------------------------------------------------------------------
-
-void _gldAllocateTexture(
- GLcontext *ctx,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- D3DFORMAT d3dFormat;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (pTex) {
- // Decide whether we can keep existing D3D texture
- // by examining top-level surface.
- D3DSURFACE_DESC d3dsd;
- _GLD_DX8_TEX(GetLevelDesc(pTex, 0, &d3dsd));
- // Release existing texture if not compatible
- if ((d3dsd.Width == texImage->Width) ||
- (d3dsd.Height == texImage->Height))
- {
- return; // Keep the existing texture
- }
- tObj->DriverData = NULL;
- _GLD_DX8_TEX(Release(pTex));
- }
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->IntFormat);
- D3DXCreateTexture(
- gld->pDev,
- texImage->Width,
- texImage->Height,
- // TODO: Re-evaluate mipmapping
- (glb.bUseMipmaps) ? D3DX_DEFAULT : 1,
- 0, // Usage
- d3dFormat,
- D3DPOOL_MANAGED,
- &pTex);
- tObj->DriverData = pTex;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* gld_ChooseTextureFormat_DX8(
- GLcontext *ctx,
- GLint internalFormat,
- GLenum srcFormat,
- GLenum srcType)
-{
- // [Based on mesa_choose_tex_format()]
- //
- // We will choose only texture formats that are supported
- // by Direct3D. If the hardware doesn't support a particular
- // texture format, then the D3DX texture calls that we use
- // will automatically use a HW supported format.
- //
- // The most critical aim is to reduce copying; if we can use
- // texture-image data directly then it will be a big performance assist.
- //
-
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_a8; // D3DFMT_A8
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_rgb565; // D3DFMT_R5G6B5
- // Mesa will convert this for us later...
- // return &_mesa_texformat_ci8; // D3DFMT_R5G6B5
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_al88; // D3DFMT_A8L8
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb332; // D3DFMT_R3G3B2
- case GL_RGB4:
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444; // D3DFMT_A4R4G4B4
- case 3:
- case GL_RGB:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_rgb565;
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb8888;
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
- default:
- _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
- return NULL;
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
-// Safer(?), slower version.
-void gld_TexImage2D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- RECT rcSrcRect;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
-
- if (!tObj || !texImage)
- return;
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture8_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface8_Release(pSurface);
- return;
- }
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- SetRect(&rcSrcRect, 0, 0, width, height);
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- NULL,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface8_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexImage2D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- D3DSURFACE_DESC d3dsd;
-
- if (!tObj || !texImage)
- return;
-
- // GLQUAKE FIX
- // Test for input alpha data with non-alpha internalformat
- if (((internalFormat==3) || (internalFormat==GL_RGB)) && (format==GL_RGBA)) {
- // Input format has alpha, but a non-alpha format has been requested.
- texImage->IntFormat = GL_RGBA;
- internalFormat = GL_RGBA;
- }
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture8_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- IDirect3DSurface8_GetDesc(pSurface, &d3dsd);
-
- // Lock all of surface
- hr = IDirect3DSurface8_LockRect(pSurface, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- texImage->Format,
- _gldMesaFormatForD3DFormat(d3dsd.Format),
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- IDirect3DSurface8_UnlockRect(pSurface);
- IDirect3DSurface8_Release(pSurface);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- // A 1D texture is a 2D texture with a height of zero
- gld_TexImage2D_DX8(ctx, target, level, internalFormat, width, 1, border, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-/*
-void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_GET_CONTEXT
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- D3DFORMAT d3dFormat;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
- RECT rcSrcRect;
- RECT rcDstRect;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= _GLD_DX8_TEX(GetLevelCount(pTex))
- return; // Level does not exist
- hr = _GLD_DX8_TEX(GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->Format);
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface8_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- // Source rectangle is whole of input image
- SetRect(&rcSrcRect, 0, 0, width, height);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- &rcDstRect,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface8_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- HRESULT hr;
- RECT rcDstRect;
- D3DLOCKED_RECT d3dLockedRect;
- D3DSURFACE_DESC d3dsd;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture8_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- IDirect3DSurface8_GetDesc(pSurface, &d3dsd);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- // Lock sub-rect of surface
- hr = IDirect3DSurface8_LockRect(pSurface, &d3dLockedRect, &rcDstRect, 0);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- _gldMesaFormatForD3DFormat(d3dsd.Format),
- d3dLockedRect.pBits,
- width, height, 1,
- 0, 0, 0, // NOTE: d3dLockedRect.pBits is already offset!!!
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
-
- IDirect3DSurface8_UnlockRect(pSurface);
- IDirect3DSurface8_Release(pSurface);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexSubImage1D_DX8( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gld_TexSubImage2D_DX8(ctx, target, level, xoffset, 0, width, 1, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DeleteTexture_DX8(
- GLcontext *ctx,
- struct gl_texture_object *tObj)
-{
- GLD_context *gld = (GLD_context*)(ctx->DriverCtx);
-
- if (tObj) {
- IDirect3DTexture8 *pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (pTex) {
-/* // Make sure texture is not bound to a stage before releasing it
- for (int i=0; i<MAX_TEXTURE_UNITS; i++) {
- if (gld->CurrentTexture[i] == pTex) {
- gld->pDev->SetTexture(i, NULL);
- gld->CurrentTexture[i] = NULL;
- }
- }*/
- _GLD_DX8_TEX(Release(pTex));
- tObj->DriverData = NULL;
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetColorOps(
- const GLD_driver_dx8 *gld,
- GLuint unit,
- DWORD ColorArg1,
- D3DTEXTUREOP ColorOp,
- DWORD ColorArg2)
-{
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG1, ColorArg1));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLOROP, ColorOp));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG2, ColorArg2));
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetAlphaOps(
- const GLD_driver_dx8 *gld,
- GLuint unit,
- DWORD AlphaArg1,
- D3DTEXTUREOP AlphaOp,
- DWORD AlphaArg2)
-{
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG1, AlphaArg1));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAOP, AlphaOp));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG2, AlphaArg2));
-}
-
-//---------------------------------------------------------------------------
-
-void gldUpdateTextureUnit(
- GLcontext *ctx,
- GLuint unit,
- BOOL bPassThrough)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DTEXTUREFILTERTYPE minfilter;
- D3DTEXTUREFILTERTYPE mipfilter;
- GLenum BaseFormat;
- DWORD dwColorArg0;
- int iTexEnv = 0;
- GLD_texenv *pTexenv;
-
- // NOTE: If bPassThrough is FALSE then texture stage can be
- // disabled otherwise it must pass-through it's current fragment.
-
- const struct gl_texture_unit *pUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = pUnit->_Current;
-
- IDirect3DTexture8 *pTex = NULL;
- if (tObj) {
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- }
-
- // Enable texturing if unit is enabled and a valid D3D texture exists
- // Mesa 5: TEXTUREn_x altered to TEXTURE_nD_BIT
- //if (pTex && (pUnit->Enabled & (TEXTURE0_1D | TEXTURE0_2D))) {
- if (pTex && (pUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT))) {
- // Enable texturing
- _GLD_DX8_DEV(SetTexture(gld->pDev, unit, pTex));
- } else {
- // Disable texturing, then return
- _GLD_DX8_DEV(SetTexture(gld->pDev, unit, NULL));
- if (bPassThrough) {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- } else {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- }
- return;
- }
-
- // Texture parameters
- _gldConvertMinFilter(tObj->MinFilter, &minfilter, &mipfilter);
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MINFILTER, minfilter));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MIPFILTER, mipfilter));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter)));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSU, _gldConvertWrap(tObj->WrapS)));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSV, _gldConvertWrap(tObj->WrapT)));
-
- // Texture priority
- _GLD_DX8_TEX(SetPriority(pTex, (DWORD)(tObj->Priority*65535.0f)));
-
- // Texture environment
- // TODO: Examine input texture for alpha and use specific alpha/non-alpha ops.
- // See Page 355 of the Red Book.
- BaseFormat = _gldDecodeBaseFormat(pTex);
-
- switch (BaseFormat) {
- case GL_RGB:
- iTexEnv = 0;
- break;
- case GL_RGBA:
- iTexEnv = 1;
- break;
- case GL_ALPHA:
- iTexEnv = 2;
- break;
- }
-
- switch (pUnit->EnvMode) {
- case GL_DECAL:
- iTexEnv += 0;
- break;
- case GL_REPLACE:
- iTexEnv += 3;
- break;
- case GL_MODULATE:
- iTexEnv += 6;
- break;
- case GL_BLEND:
- // Set blend colour
- dwColorArg0 = D3DCOLOR_COLORVALUE(pUnit->EnvColor[0], pUnit->EnvColor[1], pUnit->EnvColor[2], pUnit->EnvColor[3]);
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG0, dwColorArg0));
- iTexEnv += 9;
- break;
- case GL_ADD:
- iTexEnv += 12;
- break;
- }
- pTexenv = (GLD_texenv*)&gldTexEnv[iTexEnv];
- _gldSetColorOps(gld, unit, pTexenv->ColorArg1, pTexenv->ColorOp, pTexenv->ColorArg2);
- _gldSetAlphaOps(gld, unit, pTexenv->AlphaArg1, pTexenv->AlphaOp, pTexenv->AlphaArg2);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_TEXTURE_DX8(
- GLcontext *ctx)
-{
- // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units
-
- BOOL bUnit0Enabled;
- BOOL bUnit1Enabled;
-
- if (!ctx)
- return; // Sanity check
-
- if (ctx->Const.MaxTextureUnits == 1) {
- gldUpdateTextureUnit(ctx, 0, TRUE);
- return;
- }
-
- //
- // NOTE: THE FOLLOWING RELATES TO TWO TEXTURE UNITS, AND TWO ONLY!!
- //
-
- // Mesa 5: Texture Units altered
- //bUnit0Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE0_1D | TEXTURE0_2D)) ? TRUE : FALSE;
- //bUnit1Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE1_1D | TEXTURE1_2D)) ? TRUE : FALSE;
- bUnit0Enabled = (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
- bUnit1Enabled = (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
-
- // If Unit0 is disabled and Unit1 is enabled then we must pass-though
- gldUpdateTextureUnit(ctx, 0, (!bUnit0Enabled && bUnit1Enabled) ? TRUE : FALSE);
- // We can always disable the last texture unit
- gldUpdateTextureUnit(ctx, 1, FALSE);
-
-#ifdef _DEBUG
- {
- // Find out whether device supports current renderstates
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-// GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- DWORD dwPasses;
- _GLD_DX8_DEV(ValidateDevice(gld->pDev, &dwPasses));
-// if (FAILED(hr)) {
-// gldLogError(GLDLOG_ERROR, "ValidateDevice failed", hr);
-// }
- if (dwPasses != 1) {
- gldLogMessage(GLDLOG_ERROR, "ValidateDevice: Can't do in one pass\n");
- }
- }
-#endif
-};
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c
deleted file mode 100644
index cafbf4f5c..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect fastpath pipeline stage
-*
-****************************************************************************/
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetVertexShaderConstants(
- GLcontext *ctx,
- GLD_driver_dx8 *gld)
-{
- D3DXMATRIX mat, matView, matProj;
- GLfloat *pM;
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ModelView.m;
- pM = ctx->ModelviewMatrixStack.Top->m;
- matView._11 = pM[0];
- matView._12 = pM[1];
- matView._13 = pM[2];
- matView._14 = pM[3];
- matView._21 = pM[4];
- matView._22 = pM[5];
- matView._23 = pM[6];
- matView._24 = pM[7];
- matView._31 = pM[8];
- matView._32 = pM[9];
- matView._33 = pM[10];
- matView._34 = pM[11];
- matView._41 = pM[12];
- matView._42 = pM[13];
- matView._43 = pM[14];
- matView._44 = pM[15];
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ProjectionMatrix.m;
- pM = ctx->ProjectionMatrixStack.Top->m;
- matProj._11 = pM[0];
- matProj._12 = pM[1];
- matProj._13 = pM[2];
- matProj._14 = pM[3];
- matProj._21 = pM[4];
- matProj._22 = pM[5];
- matProj._23 = pM[6];
- matProj._24 = pM[7];
- matProj._31 = pM[8];
- matProj._32 = pM[9];
- matProj._33 = pM[10];
- matProj._34 = pM[11];
- matProj._41 = pM[12];
- matProj._42 = pM[13];
- matProj._43 = pM[14];
- matProj._44 = pM[15];
-
- D3DXMatrixMultiply( &mat, &matView, &matProj );
- D3DXMatrixTranspose( &mat, &mat );
-
- _GLD_DX8_DEV(SetVertexShaderConstant(gld->pDev, 0, &mat, 4));
-}
-
-//---------------------------------------------------------------------------
-
-static GLboolean gld_d3d_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- TNLcontext *tnl;
- struct vertex_buffer *VB;
- tnl_render_func *tab;
- GLint pass;
- GLD_pb_dx8 *gldPB = &gld->PB3d;
-/*
- static int count = 0;
- count++;
- if (count != 2)
- return GL_FALSE;
-*/
- // The "check" function should disable this stage,
- // but we'll test gld->bUseMesaTnL anyway.
- if (gld->bUseMesaTnL) {
- // Do nothing in this stage, but continue pipeline
- return GL_TRUE;
- }
-
- tnl = TNL_CONTEXT(ctx);
- VB = &tnl->vb;
- pass = 0;
-
- tnl->Driver.Render.Start( ctx );
-
-#if 0
- // For debugging: Useful to see if an app passes colour data in
- // an unusual format.
- switch (VB->ColorPtr[0]->Type) {
- case GL_FLOAT:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n");
- break;
- case GL_UNSIGNED_BYTE:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_UNSIGNED_BYTE\n");
- break;
- default:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: *?*\n");
- break;
- }
-#endif
-
- tnl->Driver.Render.Points = gld_Points3D_DX8;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line3DFlat_DX8;
- tnl->Driver.Render.Triangle = gld_Triangle3DFlat_DX8;
- tnl->Driver.Render.Quad = gld_Quad3DFlat_DX8;
- } else {
- tnl->Driver.Render.Line = gld_Line3DSmooth_DX8;
- tnl->Driver.Render.Triangle = gld_Triangle3DSmooth_DX8;
- tnl->Driver.Render.Quad = gld_Quad3DSmooth_DX8;
- }
-
- _GLD_DX8_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts);
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length)
- {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
- _GLD_DX8_VB(Unlock(gldPB->pVB));
-
- _GLD_DX8_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, gldPB->dwStride));
-
- _GLD_DX8_DEV(SetTransform(gld->pDev, D3DTS_PROJECTION, &gld->matProjection));
- _GLD_DX8_DEV(SetTransform(gld->pDev, D3DTS_WORLD, &gld->matModelView));
-
- if (gldPB->nPoints) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-//---------------------------------------------------------------------------
-
-const struct tnl_pipeline_stage _gld_d3d_render_stage =
-{
- "gld_d3d_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- gld_d3d_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c
deleted file mode 100644
index 9ab562010..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c
+++ /dev/null
@@ -1,448 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keithw@valinux.com>
- */
-
-
-/*
- * Render whole vertex buffers, including projection of vertices from
- * clip space and clipping of primitives.
- *
- * This file makes calls to project vertices and to the point, line
- * and triangle rasterizers via the function pointers:
- *
- * context->Driver.Render.*
- *
- */
-
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-/**********************************************************************/
-/* Clip single primitives */
-/**********************************************************************/
-
-
-#if defined(USE_IEEE)
-#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
-//#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
-#else
-#define NEGATIVE(x) (x < 0)
-//#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0)
-/* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
-#endif
-
-
-#define W(i) coord[i][3]
-#define Z(i) coord[i][2]
-#define Y(i) coord[i][1]
-#define X(i) coord[i][0]
-#define SIZE 4
-#define TAG(x) x##_4
-#include "tnl/t_vb_cliptmp.h"
-
-
-
-/**********************************************************************/
-/* Clip and render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, with the possibility of clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte ormask = c1|c2; \
- if (!ormask) \
- LineFunc( ctx, v1, v2 ); \
- else if (!(c1 & c2 & 0x3f)) \
- clip_line_4( ctx, v1, v2, ormask ); \
-} while (0)
-
-#define RENDER_TRI( v1, v2, v3 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \
- GLubyte ormask = c1|c2|c3; \
- if (!ormask) \
- TriangleFunc( ctx, v1, v2, v3 ); \
- else if (!(c1 & c2 & c3 & 0x3f)) \
- clip_tri_4( ctx, v1, v2, v3, ormask ); \
-} while (0)
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte c3 = mask[v3], c4 = mask[v4]; \
- GLubyte ormask = c1|c2|c3|c4; \
- if (!ormask) \
- QuadFunc( ctx, v1, v2, v3, v4 ); \
- else if (!(c1 & c2 & c3 & c4 & 0x3f)) \
- clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \
-} while (0)
-
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const GLubyte *mask = VB->ClipMask; \
- const GLuint sz = VB->ClipPtr->size; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt; (void) mask; (void) sz; (void) stipple;
-
-#define TAG(x) clip_##x##_verts
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/* Elts, with the possibility of clipping.
- */
-#undef ELT
-#undef TAG
-#define ELT(x) elt[x]
-#define TAG(x) clip_##x##_elts
-#include "tnl/t_vb_rendertmp.h"
-
-/* TODO: do this for all primitives, verts and elts:
- */
-static void clip_elt_triangles( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES];
- struct vertex_buffer *VB = &tnl->vb;
- const GLuint * const elt = VB->Elts;
- GLubyte *mask = VB->ClipMask;
- GLuint last = count-2;
- GLuint j;
- (void) flags;
-
- tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES );
-
- for (j=start; j < last; j+=3 ) {
- GLubyte c1 = mask[elt[j]];
- GLubyte c2 = mask[elt[j+1]];
- GLubyte c3 = mask[elt[j+2]];
- GLubyte ormask = c1|c2|c3;
- if (ormask) {
- if (start < j)
- render_tris( ctx, start, j, 0 );
- if (!(c1&c2&c3&0x3f))
- clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask );
- start = j+3;
- }
- }
-
- if (start < j)
- render_tris( ctx, start, j, 0 );
-}
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, no clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
- LineFunc( ctx, v1, v2 )
-
-#define RENDER_TRI( v1, v2, v3 ) \
- TriangleFunc( ctx, v1, v2, v3 )
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
- QuadFunc( ctx, v1, v2, v3, v4 )
-
-#define TAG(x) _gld_tnl_##x##_verts
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt;
-
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RENDER_TAB_QUALIFIER
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-/* Elts, no clipping.
- */
-#undef ELT
-#define TAG(x) _gld_tnl_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Helper functions for drivers */
-/**********************************************************************/
-/*
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint *tmp = VB->Elts;
-
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
-}
-
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-*/
-
-
-/**********************************************************************/
-/* Clip and render whole vertex buffers */
-/**********************************************************************/
-
-tnl_points_func _gldSetupPoints[4] = {
- gld_Points2D_DX8,
- gld_Points2D_DX8,
- gld_Points2D_DX8,
- gld_Points2D_DX8
-};
-tnl_line_func _gldSetupLine[4] = {
- gld_Line2DFlat_DX8,
- gld_Line2DSmooth_DX8,
- gld_Line2DFlat_DX8,
- gld_Line2DSmooth_DX8,
-};
-tnl_triangle_func _gldSetupTriangle[4] = {
- gld_Triangle2DFlat_DX8,
- gld_Triangle2DSmooth_DX8,
- gld_Triangle2DFlatExtras_DX8,
- gld_Triangle2DSmoothExtras_DX8
-};
-tnl_quad_func _gldSetupQuad[4] = {
- gld_Quad2DFlat_DX8,
- gld_Quad2DSmooth_DX8,
- gld_Quad2DFlatExtras_DX8,
- gld_Quad2DSmoothExtras_DX8
-};
-
-//---------------------------------------------------------------------------
-
-static GLboolean _gld_mesa_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- tnl_render_func *tab;
- GLint pass = 0;
- GLD_pb_dx8 *gldPB;
-
- /* Allow the drivers to lock before projected verts are built so
- * that window coordinates are guarenteed not to change before
- * rendering.
- */
- ASSERT(tnl->Driver.Render.Start);
-
- tnl->Driver.Render.Start( ctx );
-
- // NOTE: Setting D3DRS_SOFTWAREVERTEXPROCESSING for a mixed-mode device resets
- // stream, indices and shader to default values of NULL or 0.
-/* if ((ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) &&
- gld->VStwosidelight.hShader &&
- !ctx->Fog.Enabled)
- {
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware);
- _GLD_DX8_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
- gldPB = &gld->PBtwosidelight;
- tnl->Driver.Render.Points = gld_Points2DTwoside_DX8;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line2DFlatTwoside_DX8;
- tnl->Driver.Render.Triangle = gld_Triangle2DFlatTwoside_DX8;
- tnl->Driver.Render.Quad = gld_Quad2DFlatTwoside_DX8;
- } else {
- tnl->Driver.Render.Line = gld_Line2DSmoothTwoside_DX8;
- tnl->Driver.Render.Triangle = gld_Triangle2DSmoothTwoside_DX8;
- tnl->Driver.Render.Quad = gld_Quad2DSmoothTwoside_DX8;
- }
- } else {*/
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, TRUE);
- gldPB = &gld->PB2d;
- _GLD_DX8_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
- tnl->Driver.Render.Points = _gldSetupPoints[gld->iSetupFunc];
- tnl->Driver.Render.Line = _gldSetupLine[gld->iSetupFunc];
- tnl->Driver.Render.Triangle = _gldSetupTriangle[gld->iSetupFunc];
- tnl->Driver.Render.Quad = _gldSetupQuad[gld->iSetupFunc];
-// }
-
- _GLD_DX8_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 );
-
- if (VB->ClipOrMask) {
- tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
- clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles;
- }
- else {
- tab = (VB->Elts ?
- tnl->Driver.Render.PrimTabElts :
- tnl->Driver.Render.PrimTabVerts);
- }
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length) {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
-
-// tnl->Driver.Render.Finish( ctx );
-
- _GLD_DX8_VB(Unlock(gldPB->pVB));
-
- _GLD_DX8_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, gldPB->dwStride));
-
- if (gldPB->nPoints) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-
-
-//---------------------------------------------------------------------------
-
-const struct tnl_pipeline_stage _gld_mesa_render_stage =
-{
- "gld_mesa_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- _gld_mesa_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c b/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c
deleted file mode 100644
index 011d810e9..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c
+++ /dev/null
@@ -1,1336 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 8.x WGL (WindowsGL)
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "gld_driver.h"
-#include "gld_dxerr8.h"
-#include "gld_dx8.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-// Copied from dglcontect.c
-#define GLDERR_NONE 0
-#define GLDERR_MEM 1
-#define GLDERR_DDRAW 2
-#define GLDERR_D3D 3
-#define GLDERR_BPP 4
-#define GLDERR_DDS 5
-// This external var keeps track of any error
-extern int nContextError;
-
-#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL
-
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
-
-//---------------------------------------------------------------------------
-
-static char szColorDepthWarning[] =
-"GLDirect does not support the current desktop\n\
-color depth.\n\n\
-You may need to change the display resolution to\n\
-16 bits per pixel or higher color depth using\n\
-the Windows Display Settings control panel\n\
-before running this OpenGL application.\n";
-
-// The only depth-stencil formats currently supported by Direct3D
-// Surface Format Depth Stencil Total Bits
-// D3DFMT_D32 32 - 32
-// D3DFMT_D15S1 15 1 16
-// D3DFMT_D24S8 24 8 32
-// D3DFMT_D16 16 - 16
-// D3DFMT_D24X8 24 - 32
-// D3DFMT_D24X4S4 24 4 32
-
-// This pixel format will be used as a template when compiling the list
-// of pixel formats supported by the hardware. Many fields will be
-// filled in at runtime.
-// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM
-static DGL_pixelFormat pfTemplateHW =
-{
- {
- sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure
- 1, // Structure version - should be 1
- // Flags:
- PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface.
- PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM)
- PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM)
- PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing.
- PFD_DOUBLEBUFFER | // The buffer is double-buffered.
- 0, // Placeholder for easy commenting of above flags
- PFD_TYPE_RGBA, // Pixel type RGBA.
- 16, // Total colour bitplanes (excluding alpha bitplanes)
- 5, 0, // Red bits, shift
- 5, 0, // Green bits, shift
- 5, 0, // Blue bits, shift
- 0, 0, // Alpha bits, shift (destination alpha)
- 0, // Accumulator bits (total)
- 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha
- 0, // Depth bits
- 0, // Stencil bits
- 0, // Number of auxiliary buffers
- 0, // Layer type
- 0, // Specifies the number of overlay and underlay planes.
- 0, // Layer mask
- 0, // Specifies the transparent color or index of an underlay plane.
- 0 // Damage mask
- },
- D3DFMT_UNKNOWN, // No depth/stencil buffer
-};
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-
-// Vertex Shader Declaration
-static DWORD dwTwoSidedLightingDecl[] =
-{
- D3DVSD_STREAM(0),
- D3DVSD_REG(0, D3DVSDT_FLOAT3), // XYZ position
- D3DVSD_REG(1, D3DVSDT_FLOAT3), // XYZ normal
- D3DVSD_REG(2, D3DVSDT_D3DCOLOR), // Diffuse color
- D3DVSD_REG(3, D3DVSDT_D3DCOLOR), // Specular color
- D3DVSD_REG(4, D3DVSDT_FLOAT2), // 2D texture unit 0
- D3DVSD_REG(5, D3DVSDT_FLOAT2), // 2D texture unit 1
- D3DVSD_END()
-};
-
-// Vertex Shader for two-sided lighting
-static char *szTwoSidedLightingVS =
-// This is a test shader!
-"vs.1.0\n"
-"m4x4 oPos,v0,c0\n"
-"mov oD0,v2\n"
-"mov oD1,v3\n"
-"mov oT0,v4\n"
-"mov oT1,v5\n"
-;
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-typedef struct {
- HINSTANCE hD3D8DLL; // Handle to d3d8.dll
- FNDIRECT3DCREATE8 fnDirect3DCreate8; // Direct3DCreate8 function prototype
- BOOL bDirect3D; // Persistant Direct3D8 exists
- BOOL bDirect3DDevice; // Persistant Direct3DDevice8 exists
- IDirect3D8 *pD3D; // Persistant Direct3D8
- IDirect3DDevice8 *pDev; // Persistant Direct3DDevice8
-} GLD_dx8_globals;
-
-// These are "global" to all DX8 contexts. KeithH
-static GLD_dx8_globals dx8Globals;
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-BOOL gldGetDXErrorString_DX(
- HRESULT hr,
- char *buf,
- int nBufSize)
-{
- //
- // Return a string describing the input HRESULT error code
- //
-
- D3DXGetErrorString(hr, buf, nBufSize);
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static D3DMULTISAMPLE_TYPE _gldGetDeviceMultiSampleType(
- IDirect3D8 *pD3D8,
- D3DFORMAT SurfaceFormat,
- D3DDEVTYPE d3dDevType,
- BOOL Windowed)
-{
- int i;
- HRESULT hr;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_NONE)
- return D3DMULTISAMPLE_NONE;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_FASTEST) {
- // Find fastest multisample
- for (i=2; i<17; i++) {
- hr = IDirect3D8_CheckDeviceMultiSampleType(
- pD3D8,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- } else {
- // Find nicest multisample
- for (i=16; i>1; i--) {
- hr = IDirect3D8_CheckDeviceMultiSampleType(
- pD3D8,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- }
-
- // Nothing found - return default
- return D3DMULTISAMPLE_NONE;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyPrimitiveBuffer(
- GLD_pb_dx8 *gldVB)
-{
- SAFE_RELEASE(gldVB->pVB);
-
- // Sanity check...
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
-}
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldCreatePrimitiveBuffer(
- GLcontext *ctx,
- GLD_driver_dx8 *lpCtx,
- GLD_pb_dx8 *gldVB)
-{
- HRESULT hResult;
- char *szCreateVertexBufferFailed = "CreateVertexBuffer failed";
- DWORD dwMaxVertices; // Max number of vertices in vertex buffer
- DWORD dwVBSize; // Total size of vertex buffer
-
- // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we
- // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize.
- // We'll use IMM_SIZE if it's larger (which it should not be).
- dwMaxVertices = MAX_ARRAY_LOCK_SIZE;
-
- // Now calculate how many vertices to allow for in total
- // 1 per point, 2 per line, 6 per quad = 9
- dwVBSize = dwMaxVertices * 9 * gldVB->dwStride;
-
- hResult = IDirect3DDevice8_CreateVertexBuffer(
- lpCtx->pDev,
- dwVBSize,
- gldVB->dwUsage,
- gldVB->dwFVF,
- gldVB->dwPool,
- &gldVB->pVB);
- if (FAILED(hResult)) {
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, szCreateVertexBufferFailed);
- return hResult;
- }
-
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
- gldVB->pPoints = gldVB->pLines = gldVB->pTriangles = NULL;
- gldVB->iFirstLine = dwMaxVertices; // Index of first line in VB
- gldVB->iFirstTriangle = dwMaxVertices*3; // Index of first triangle in VB
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-// Function: _gldCreateVertexShaders
-// Create DX8 Vertex Shaders.
-//---------------------------------------------------------------------------
-/*
-void _gldCreateVertexShaders(
- GLD_driver_dx8 *gld)
-{
- DWORD dwFlags;
- LPD3DXBUFFER pVSOpcodeBuffer; // Vertex Shader opcode buffer
- HRESULT hr;
-
-#ifdef _DEBUG
- dwFlags = D3DXASM_DEBUG;
-#else
- dwFlags = 0; // D3DXASM_SKIPVALIDATION;
-#endif
-
- ddlogMessage(DDLOG_INFO, "Creating shaders...\n");
-
- // Init the shader handle
- gld->VStwosidelight.hShader = 0;
-
- if (gld->d3dCaps8.MaxStreams == 0) {
- // Lame DX8 driver doesn't support streams
- // Not fatal, as defaults will be used
- ddlogMessage(DDLOG_WARN, "Driver doesn't support Vertex Shaders (MaxStreams==0)\n");
- return;
- }
-
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-// return;
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-
- //
- // Two-sided lighting
- //
-
-#if 0
- //
- // DEBUGGING: Load shader from a text file
- //
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- hr = D3DXAssembleShaderFromFile(
- "twoside.vsh",
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#else
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- // Assemble ascii shader text into shader opcodes
- hr = D3DXAssembleShader(
- szTwoSidedLightingVS,
- strlen(szTwoSidedLightingVS),
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#endif
- if (FAILED(hr)) {
- ddlogError(DDLOG_WARN, "AssembleShader failed", hr);
- SAFE_RELEASE(pVSOpcodeBuffer);
- return;
- }
-
-// This is for debugging. Remove to enable vertex shaders in HW
-#define _GLD_FORCE_SW_VS 0
-
- if (_GLD_FORCE_SW_VS) {
- // _GLD_FORCE_SW_VS should be disabled for Final Release
- ddlogMessage(DDLOG_SYSTEM, "[Forcing shaders in SW]\n");
- }
-
- // Try and create shader in hardware.
- // NOTE: The D3D Ref device appears to succeed when trying to
- // create the device in hardware, but later complains
- // when trying to set it with SetVertexShader(). Go figure.
- if (_GLD_FORCE_SW_VS || glb.dwDriver == GLDS_DRIVER_REF) {
- // Don't try and create a hardware shader with the Ref device
- hr = E_FAIL; // COM error/fail result
- } else {
- gld->VStwosidelight.bHardware = TRUE;
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- 0);
- }
- if (FAILED(hr)) {
- ddlogMessage(DDLOG_INFO, "... HW failed, trying SW...\n");
- // Failed. Try and create shader for software processing
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- D3DUSAGE_SOFTWAREPROCESSING);
- if (FAILED(hr)) {
- gld->VStwosidelight.hShader = 0; // Sanity check
- ddlogError(DDLOG_WARN, "CreateVertexShader failed", hr);
- return;
- }
- // Succeeded, but for software processing
- gld->VStwosidelight.bHardware = FALSE;
- }
-
- SAFE_RELEASE(pVSOpcodeBuffer);
-
- ddlogMessage(DDLOG_INFO, "... OK\n");
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyVertexShaders(
- GLD_driver_dx8 *gld)
-{
- if (gld->VStwosidelight.hShader) {
- IDirect3DDevice8_DeleteVertexShader(gld->pDev, gld->VStwosidelight.hShader);
- gld->VStwosidelight.hShader = 0;
- }
-}
-*/
-//---------------------------------------------------------------------------
-
-LPVOID lpOpaque1 = NULL;
-LPVOID lpOpaque2 = NULL;
-
-BOOL gldCreateDrawable_DX(
- DGL_ctx *ctx,
-// BOOL bDefaultDriver,
- BOOL bDirectDrawPersistant,
- BOOL bPersistantBuffers)
-{
- //
- // bDirectDrawPersistant: applies to IDirect3D8
- // bPersistantBuffers: applies to IDirect3DDevice8
- //
-
- HRESULT hResult;
- GLD_driver_dx8 *lpCtx = NULL;
- D3DDEVTYPE d3dDevType;
- D3DPRESENT_PARAMETERS d3dpp;
- D3DDISPLAYMODE d3ddm;
- DWORD dwBehaviourFlags;
- D3DADAPTER_IDENTIFIER8 d3dIdent;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- if (ctx->glPriv) {
- lpCtx = ctx->glPriv;
- // Release any existing interfaces
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- } else {
- lpCtx = (GLD_driver_dx8*)malloc(sizeof(GLD_driver_dx8));
- ZeroMemory(lpCtx, sizeof(lpCtx));
- }
-
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- // TODO: Check this
-// if (bDefaultDriver)
-// d3dDevType = D3DDEVTYPE_REF;
-
- // Use persistant interface if needed
- if (bDirectDrawPersistant && dx8Globals.bDirect3D) {
- lpCtx->pD3D = dx8Globals.pD3D;
- IDirect3D8_AddRef(lpCtx->pD3D);
- goto SkipDirectDrawCreate;
- }
-
- // Create Direct3D8 object
- lpCtx->pD3D = dx8Globals.fnDirect3DCreate8(D3D_SDK_VERSION_DX8_SUPPORT_WIN95);
- if (lpCtx->pD3D == NULL) {
- MessageBox(NULL, "Unable to initialize Direct3D8", "GLDirect", MB_OK);
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D8 interface");
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Cache Direct3D interface for subsequent GLRCs
- if (bDirectDrawPersistant && !dx8Globals.bDirect3D) {
- dx8Globals.pD3D = lpCtx->pD3D;
- IDirect3D8_AddRef(dx8Globals.pD3D);
- dx8Globals.bDirect3D = TRUE;
- }
-SkipDirectDrawCreate:
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Get device caps
- hResult = IDirect3D8_GetDeviceCaps(lpCtx->pD3D, glb.dwAdapter, d3dDevType, &lpCtx->d3dCaps8);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_GetDeviceCaps failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Check for hardware transform & lighting
- lpCtx->bHasHWTnL = lpCtx->d3dCaps8.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE;
-
- // If this flag is present then we can't default to Mesa
- // SW rendering between BeginScene() and EndScene().
- if (lpCtx->d3dCaps8.Caps2 & D3DCAPS2_NO2DDURING3DSCENE) {
- ddlogMessage(DDLOG_WARN,
- "Warning : No 2D allowed during 3D scene.\n");
- }
-
- //
- // Create the Direct3D context
- //
-
- // Re-use original IDirect3DDevice if persistant buffers exist.
- // Note that we test for persistant IDirect3D8 as well
- // bDirectDrawPersistant == persistant IDirect3D8 (DirectDraw8 does not exist)
- if (bDirectDrawPersistant && bPersistantBuffers && dx8Globals.pD3D && dx8Globals.pDev) {
- lpCtx->pDev = dx8Globals.pDev;
- IDirect3DDevice8_AddRef(dx8Globals.pDev);
- goto skip_direct3ddevice_create;
- }
-
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(lpCtx->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
-
- // Support for vertical retrace synchronisation.
- // Set default presentation interval in case caps bits are missing
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- if (glb.bWaitForRetrace) {
- if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_ONE)
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- } else {
- if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE)
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
- }
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- // FullScreen_PresentationInterval must be default for Windowed mode
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
-
- // Decide if we can use hardware TnL
- dwBehaviourFlags = (lpCtx->bHasHWTnL) ?
- D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING;
- // Add flag to tell D3D to be thread-safe
- if (glb.bMultiThreaded)
- dwBehaviourFlags |= D3DCREATE_MULTITHREADED;
- // Add flag to tell D3D to be FPU-safe
- if (!glb.bFastFPU)
- dwBehaviourFlags |= D3DCREATE_FPU_PRESERVE;
- hResult = IDirect3D8_CreateDevice(lpCtx->pD3D,
- glb.dwAdapter,
- d3dDevType,
- ctx->hWnd,
- dwBehaviourFlags,
- &d3dpp,
- &lpCtx->pDev);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_CreateDevice failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- if (bDirectDrawPersistant && bPersistantBuffers && dx8Globals.pD3D) {
- dx8Globals.pDev = lpCtx->pDev;
- dx8Globals.bDirect3DDevice = TRUE;
- }
-
-/*
- // See if DDraw interfaces are available (DaveM)
- hResult = IDirect3D8_QueryInterface(lpCtx->pDev,
- &IID_IDirectDraw7, (LPVOID*)&lpOpaque1);
- if (FAILED(hResult) || lpOpaque1 == NULL) {
- ddlogMessage(DDLOG_INFO, "DirectDraw QueryInterface unavailable\n");
- }
-
- hResult = IDirect3DDevice8_QueryInterface(lpCtx->pDev,
- &IID_IDirectDrawSurface7, (LPVOID*)&lpOpaque2);
- if (FAILED(hResult) || lpOpaque2 == NULL) {
- ddlogMessage(DDLOG_INFO, "DirectDrawSurface QueryInterface unavialable\n");
- }
-*/
- // Dump some useful stats
- hResult = IDirect3D8_GetAdapterIdentifier(
- lpCtx->pD3D,
- glb.dwAdapter,
- D3DENUM_NO_WHQL_LEVEL, // Avoids 1 to 2 second delay
- &d3dIdent);
- if (SUCCEEDED(hResult)) {
- ddlogPrintf(DDLOG_INFO, "[Driver Description: %s]", &d3dIdent.Description);
- ddlogPrintf(DDLOG_INFO, "[Driver file: %s %d.%d.%02d.%d]",
- d3dIdent.Driver,
- HIWORD(d3dIdent.DriverVersion.HighPart),
- LOWORD(d3dIdent.DriverVersion.HighPart),
- HIWORD(d3dIdent.DriverVersion.LowPart),
- LOWORD(d3dIdent.DriverVersion.LowPart));
- ddlogPrintf(DDLOG_INFO, "[VendorId: 0x%X, DeviceId: 0x%X, SubSysId: 0x%X, Revision: 0x%X]",
- d3dIdent.VendorId, d3dIdent.DeviceId, d3dIdent.SubSysId, d3dIdent.Revision);
- }
-
- // Init projection matrix for D3D TnL
- D3DXMatrixIdentity(&lpCtx->matProjection);
- lpCtx->matModelView = lpCtx->matProjection;
-// gld->bUseMesaProjection = TRUE;
-
-skip_direct3ddevice_create:
-
- // Create buffers to hold primitives
- lpCtx->PB2d.dwFVF = GLD_FVF_2D_VERTEX;
- lpCtx->PB2d.dwPool = D3DPOOL_SYSTEMMEM;
- lpCtx->PB2d.dwStride = sizeof(GLD_2D_VERTEX);
- lpCtx->PB2d.dwUsage = D3DUSAGE_DONOTCLIP |
- D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB2d);
- if (FAILED(hResult))
- goto return_with_error;
-
- lpCtx->PB3d.dwFVF = GLD_FVF_3D_VERTEX;
- lpCtx->PB3d.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PB3d.dwStride = sizeof(GLD_3D_VERTEX);
- lpCtx->PB3d.dwUsage = D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB3d);
- if (FAILED(hResult))
- goto return_with_error;
-
-/* // NOTE: A FVF code of zero indicates a non-FVF vertex buffer (for vertex shaders)
- lpCtx->PBtwosidelight.dwFVF = 0; //GLD_FVF_TWOSIDED_VERTEX;
- lpCtx->PBtwosidelight.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PBtwosidelight.dwStride = sizeof(GLD_TWOSIDED_VERTEX);
- lpCtx->PBtwosidelight.dwUsage = D3DUSAGE_DONOTCLIP |
- D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PBtwosidelight);
- if (FAILED(hResult))
- goto return_with_error;*/
-
- // Now try and create the DX8 Vertex Shaders
-// _gldCreateVertexShaders(lpCtx);
-
- // Zero the pipeline usage counters
- lpCtx->PipelineUsage.qwMesa.QuadPart =
-// lpCtx->PipelineUsage.dwD3D2SVS.QuadPart =
- lpCtx->PipelineUsage.qwD3DFVF.QuadPart = 0;
-
- // Assign drawable to GL private
- ctx->glPriv = lpCtx;
- return TRUE;
-
-return_with_error:
- // Clean up and bail
-
-// _gldDestroyVertexShaders(lpCtx);
-
-// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldResizeDrawable_DX(
- DGL_ctx *ctx,
- BOOL bDefaultDriver,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- GLD_driver_dx8 *gld = NULL;
- D3DDEVTYPE d3dDevType;
- D3DPRESENT_PARAMETERS d3dpp;
- D3DDISPLAYMODE d3ddm;
- HRESULT hResult;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice8_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- if (!bDefaultDriver)
- d3dDevType = D3DDEVTYPE_REF; // Force Direct3D Reference Rasterise (software)
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D8_GetAdapterDisplayMode(gld->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
-// goto return_with_error;
- return FALSE;
- }
-
- // Destroy DX8 Vertex Shaders before Reset()
-// _gldDestroyVertexShaders(gld);
-
- // Release POOL_DEFAULT objects before Reset()
- if (gld->PB2d.dwPool == D3DPOOL_DEFAULT)
- _gldDestroyPrimitiveBuffer(&gld->PB2d);
- if (gld->PB3d.dwPool == D3DPOOL_DEFAULT)
- _gldDestroyPrimitiveBuffer(&gld->PB3d);
-// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT)
-// _gldDestroyPrimitiveBuffer(&gld->PBtwosidelight);
-
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(gld->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- // TODO: Sync to refresh
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- // Get better benchmark results? KeithH
-// d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_UNLIMITED;
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
- hResult = IDirect3DDevice8_Reset(gld->pDev, &d3dpp);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Reset failed", hResult);
- return FALSE;
- //goto cleanup_and_return_with_error;
- }
-
- // Explicitly Clear resized surfaces (DaveM)
- {
- D3DVIEWPORT8 d3dvp1, d3dvp2;
- IDirect3DDevice8_GetViewport(gld->pDev, &d3dvp1);
- IDirect3DDevice8_GetViewport(gld->pDev, &d3dvp2);
- d3dvp1.X = 0;
- d3dvp1.Y = 0;
- d3dvp1.Width = ctx->dwWidth;
- d3dvp1.Height = ctx->dwHeight;
- IDirect3DDevice8_SetViewport(gld->pDev, &d3dvp1);
- IDirect3DDevice8_Clear(gld->pDev,0,NULL,D3DCLEAR_TARGET,0,0,0);
- IDirect3DDevice8_SetViewport(gld->pDev, &d3dvp2);
- }
-
- //
- // Recreate POOL_DEFAULT objects
- //
- if (gld->PB2d.dwPool == D3DPOOL_DEFAULT) {
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
- }
- if (gld->PB3d.dwPool == D3DPOOL_DEFAULT) {
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB3d);
- }
-// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT) {
-// _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
-// }
-
- // Recreate DX8 Vertex Shaders
-// _gldCreateVertexShaders(gld);
-
- // Signal a complete state update
- ctx->glCtx->Driver.UpdateState(ctx->glCtx, _NEW_ALL);
-
- // Begin a new scene
- IDirect3DDevice8_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyDrawable_DX(
- DGL_ctx *ctx)
-{
- GLD_driver_dx8 *lpCtx = NULL;
-
- // Error if context is NULL.
- if (!ctx)
- return FALSE;
-
- // Error if the drawable does not exist.
- if (!ctx->glPriv)
- return FALSE;
-
- lpCtx = ctx->glPriv;
-
-#ifdef _DEBUG
- // Dump out stats
- ddlogPrintf(DDLOG_SYSTEM, "Usage: M:0x%X%X, D:0x%X%X",
- lpCtx->PipelineUsage.qwMesa.HighPart,
- lpCtx->PipelineUsage.qwMesa.LowPart,
- lpCtx->PipelineUsage.qwD3DFVF.HighPart,
- lpCtx->PipelineUsage.qwD3DFVF.LowPart);
-#endif
-
-// _gldDestroyVertexShaders(lpCtx);
-
-// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
-
- // Free the private drawable data
- free(ctx->glPriv);
- ctx->glPriv = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldCreatePrivateGlobals_DX(void)
-{
- ZeroMemory(&dx8Globals, sizeof(dx8Globals));
-
- // Load d3d8.dll
- dx8Globals.hD3D8DLL = LoadLibrary("D3D8.DLL");
- if (dx8Globals.hD3D8DLL == NULL)
- return FALSE;
-
- // Now try and obtain Direct3DCreate8
- dx8Globals.fnDirect3DCreate8 = (FNDIRECT3DCREATE8)GetProcAddress(dx8Globals.hD3D8DLL, "Direct3DCreate8");
- if (dx8Globals.fnDirect3DCreate8 == NULL) {
- FreeLibrary(dx8Globals.hD3D8DLL);
- return FALSE;
- }
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyPrivateGlobals_DX(void)
-{
- if (dx8Globals.bDirect3DDevice) {
- SAFE_RELEASE(dx8Globals.pDev);
- dx8Globals.bDirect3DDevice = FALSE;
- }
- if (dx8Globals.bDirect3D) {
- SAFE_RELEASE(dx8Globals.pD3D);
- dx8Globals.bDirect3D = FALSE;
- }
-
- FreeLibrary(dx8Globals.hD3D8DLL);
- dx8Globals.hD3D8DLL = NULL;
- dx8Globals.fnDirect3DCreate8 = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDisplayFormat(
- D3DFORMAT fmt,
- BYTE *cColorBits,
- BYTE *cRedBits,
- BYTE *cGreenBits,
- BYTE *cBlueBits,
- BYTE *cAlphaBits)
-{
- switch (fmt) {
- case D3DFMT_X1R5G5B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 5;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DFMT_R5G6B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 6;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DFMT_X8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
- return;
- case D3DFMT_A8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 8;
- return;
- }
-
- // Should not get here!
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDepthStencilFormat(
- D3DFORMAT fmt,
- BYTE *cDepthBits,
- BYTE *cStencilBits)
-{
- // NOTE: GL expects either 32 or 16 as depth bits.
- switch (fmt) {
- case D3DFMT_D32:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DFMT_D15S1:
- *cDepthBits = 16;
- *cStencilBits = 1;
- return;
- case D3DFMT_D24S8:
- *cDepthBits = 32;
- *cStencilBits = 8;
- return;
- case D3DFMT_D16:
- *cDepthBits = 16;
- *cStencilBits = 0;
- return;
- case D3DFMT_D24X8:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DFMT_D24X4S4:
- *cDepthBits = 32;
- *cStencilBits = 4;
- return;
- }
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldBuildPixelformatList_DX(void)
-{
- D3DDISPLAYMODE d3ddm;
- D3DFORMAT fmt[6];
- IDirect3D8 *pD3D = NULL;
- HRESULT hr;
- int nSupportedFormats = 0;
- int i;
- DGL_pixelFormat *pPF;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-// char buf[128];
-// char cat[8];
-
- // Direct3D (SW or HW)
- // These are arranged so that 'best' pixelformat
- // is higher in the list (for ChoosePixelFormat).
- const D3DFORMAT DepthStencil[6] = {
- D3DFMT_D15S1,
- D3DFMT_D16,
- D3DFMT_D24X8,
- D3DFMT_D24X4S4,
- D3DFMT_D24S8,
- D3DFMT_D32,
- };
-
- // Dump DX version
- ddlogMessage(GLDLOG_SYSTEM, "DirectX Version : 8.0\n");
-
- // Release any existing pixelformat list
- if (glb.lpPF) {
- free(glb.lpPF);
- }
-
- glb.nPixelFormatCount = 0;
- glb.lpPF = NULL;
-
- //
- // Pixelformats for Direct3D (SW or HW) rendering
- //
-
- // Get a Direct3D 8.0 interface
- pD3D = dx8Globals.fnDirect3DCreate8(D3D_SDK_VERSION_DX8_SUPPORT_WIN95);
- if (!pD3D) {
- return FALSE;
- }
-
- // We will use the display mode format when finding compliant
- // rendertarget/depth-stencil surfaces.
- hr = IDirect3D8_GetAdapterDisplayMode(pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hr)) {
- IDirect3D8_Release(pD3D);
- return FALSE;
- }
-
- // Run through the possible formats and detect supported formats
- for (i=0; i<6; i++) {
- hr = IDirect3D8_CheckDeviceFormat(
- pD3D,
- glb.dwAdapter,
- glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF,
- d3ddm.Format,
- D3DUSAGE_DEPTHSTENCIL,
- D3DRTYPE_SURFACE,
- DepthStencil[i]);
- if (FAILED(hr))
- // A failure here is not fatal.
- continue;
-
- // Verify that the depth format is compatible.
- hr = IDirect3D8_CheckDepthStencilMatch(
- pD3D,
- glb.dwAdapter,
- glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF,
- d3ddm.Format,
- d3ddm.Format,
- DepthStencil[i]);
- if (FAILED(hr))
- // A failure here is not fatal, just means depth-stencil
- // format is not compatible with this display mode.
- continue;
-
- fmt[nSupportedFormats++] = DepthStencil[i];
- }
-
- IDirect3D8_Release(pD3D);
-
- if (nSupportedFormats == 0)
- return FALSE; // Bail: no compliant pixelformats
-
- // Total count of pixelformats is:
- // (nSupportedFormats+1)*2
- glb.lpPF = (DGL_pixelFormat *)calloc((nSupportedFormats)*2, sizeof(DGL_pixelFormat));
- glb.nPixelFormatCount = (nSupportedFormats)*2;
- if (glb.lpPF == NULL) {
- glb.nPixelFormatCount = 0;
- return FALSE;
- }
-
- // Get a copy of pointer that we can alter
- pPF = glb.lpPF;
-
- // Cache colour bits from display format
- _BitsFromDisplayFormat(d3ddm.Format, &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- //
- // Add single-buffer formats
- //
-
- // Single-buffer, no depth-stencil buffer
-/* memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DFMT_UNKNOWN;
- pPF++;*/
-
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- //
- // Add double-buffer formats
- //
-
-/* memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DFMT_UNKNOWN;
- pPF++;*/
-
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- // Popup warning message if non RGB color mode
- {
- // This is a hack. KeithH
- HDC hdcDesktop = GetDC(NULL);
- DWORD dwDisplayBitDepth = GetDeviceCaps(hdcDesktop, BITSPIXEL);
- ReleaseDC(0, hdcDesktop);
- if (dwDisplayBitDepth <= 8) {
- ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth);
- MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING);
- }
- }
-
- // Mark list as 'current'
- glb.bPixelformatsDirty = FALSE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldInitialiseMesa_DX(
- DGL_ctx *lpCtx)
-{
- GLD_driver_dx8 *gld = NULL;
- int MaxTextureSize, TextureLevels;
- BOOL bSoftwareTnL;
-
- if (lpCtx == NULL)
- return FALSE;
-
- gld = lpCtx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (glb.bMultitexture) {
- lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps8.MaxSimultaneousTextures;
- // Only support MAX_TEXTURE_UNITS texture units.
- // ** If this is altered then the FVF formats must be reviewed **.
- if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX8)
- lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX8;
- } else {
- // Multitexture override
- lpCtx->glCtx->Const.MaxTextureUnits = 1;
- }
-
- // max texture size
- MaxTextureSize = min(gld->d3dCaps8.MaxTextureHeight, gld->d3dCaps8.MaxTextureWidth);
- if (MaxTextureSize == 0)
- MaxTextureSize = 256; // Sanity check
-
- //
- // HACK!!
- if (MaxTextureSize > 1024)
- MaxTextureSize = 1024; // HACK - CLAMP TO 1024
- // HACK!!
- //
-
- // Got to set MAX_TEXTURE_SIZE as max levels.
- // Who thought this stupid idea up? ;)
- TextureLevels = 0;
- // Calculate power-of-two.
- while (MaxTextureSize) {
- TextureLevels++;
- MaxTextureSize >>= 1;
- }
- lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8;
- lpCtx->glCtx->Const.MaxDrawBuffers = 1;
-
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_LIGHTING, FALSE);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_DITHERENABLE, TRUE);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
-
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ZENABLE,
- (lpCtx->lpPF->dwDriverData!=D3DFMT_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE);
-
- // Set the view matrix
- {
- D3DXMATRIX vm;
-#if 1
- D3DXMatrixIdentity(&vm);
-#else
- D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f);
- D3DXVECTOR3 At(0.0f, 0.0f, -1.0f);
- D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f);
- D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up);
- vm._31 = -vm._31;
- vm._32 = -vm._32;
- vm._33 = -vm._33;
- vm._34 = -vm._34;
-#endif
- IDirect3DDevice8_SetTransform(gld->pDev, D3DTS_VIEW, &vm);
- }
-
- if (gld->bHasHWTnL) {
- if (glb.dwTnL == GLDS_TNL_DEFAULT)
- bSoftwareTnL = FALSE; // HW TnL
- else {
- bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE;
- }
- } else {
- // No HW TnL, so no choice possible
- bSoftwareTnL = TRUE;
- }
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL);
-
-// Dump this in a Release build as well, now.
-//#ifdef _DEBUG
- ddlogPrintf(DDLOG_INFO, "HW TnL: %s",
- gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable");
-//#endif
-
- gldEnableExtensions_DX8(lpCtx->glCtx);
- gldInstallPipeline_DX8(lpCtx->glCtx);
- gldSetupDriverPointers_DX8(lpCtx->glCtx);
-
- // Signal a complete state update
- lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL);
-
- // Start a scene
- IDirect3DDevice8_BeginScene(gld->pDev);
- lpCtx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldSwapBuffers_DX(
- DGL_ctx *ctx,
- HDC hDC,
- HWND hWnd)
-{
- HRESULT hr;
- GLD_driver_dx8 *gld = NULL;
-
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice8_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- // Swap the buffers. hWnd may override the hWnd used for CreateDevice()
- hr = IDirect3DDevice8_Present(gld->pDev, NULL, NULL, hWnd, NULL);
-
- IDirect3DDevice8_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return (FAILED(hr)) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldGetDisplayMode_DX(
- DGL_ctx *ctx,
- GLD_displayMode *glddm)
-{
- D3DDISPLAYMODE d3ddm;
- HRESULT hr;
- GLD_driver_dx8 *lpCtx = NULL;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-
- if ((glddm == NULL) || (ctx == NULL))
- return FALSE;
-
- lpCtx = ctx->glPriv;
- if (lpCtx == NULL)
- return FALSE;
-
- if (lpCtx->pD3D == NULL)
- return FALSE;
-
- hr = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hr))
- return FALSE;
-
- // Get info from the display format
- _BitsFromDisplayFormat(d3ddm.Format,
- &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- glddm->Width = d3ddm.Width;
- glddm->Height = d3ddm.Height;
- glddm->BPP = cColorBits;
- glddm->Refresh = d3ddm.RefreshRate;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c
deleted file mode 100644
index c191564d6..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c
+++ /dev/null
@@ -1,1206 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Driver interface code to Mesa
-*
-****************************************************************************/
-
-//#include <windows.h>
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "vbo/vbo.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-extern BOOL dglSwapBuffers(HDC hDC);
-
-// HACK: Hack the _33 member of the OpenGL perspective projection matrix
-const float _fPersp_33 = 1.6f;
-
-//---------------------------------------------------------------------------
-// Internal functions
-//---------------------------------------------------------------------------
-
-void _gld_mesa_warning(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal warning mechanism
- gldLogPrintf(GLDLOG_WARN, "Mesa warning: %s", str);
-}
-
-//---------------------------------------------------------------------------
-
-void _gld_mesa_fatal(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal fatal-message mechanism
- gldLogPrintf(GLDLOG_CRITICAL, "Mesa FATAL: %s", str);
-
- // Mesa calls abort(0) here.
- ddlogClose();
- exit(0);
-}
-
-//---------------------------------------------------------------------------
-
-D3DSTENCILOP _gldConvertStencilOp(
- GLenum StencilOp)
-{
- // Used by Stencil: pass, fail and zfail
-
- switch (StencilOp) {
- case GL_KEEP:
- return D3DSTENCILOP_KEEP;
- case GL_ZERO:
- return D3DSTENCILOP_ZERO;
- case GL_REPLACE:
- return D3DSTENCILOP_REPLACE;
- case GL_INCR:
- return D3DSTENCILOP_INCRSAT;
- case GL_DECR:
- return D3DSTENCILOP_DECRSAT;
- case GL_INVERT:
- return D3DSTENCILOP_INVERT;
- case GL_INCR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_INCR;
- case GL_DECR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_DECR;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertStencilOp: Unknown StencilOp\n");
-#endif
-
- return D3DSTENCILOP_KEEP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DCMPFUNC _gldConvertCompareFunc(
- GLenum CmpFunc)
-{
- // Used for Alpha func, depth func and stencil func.
-
- switch (CmpFunc) {
- case GL_NEVER:
- return D3DCMP_NEVER;
- case GL_LESS:
- return D3DCMP_LESS;
- case GL_EQUAL:
- return D3DCMP_EQUAL;
- case GL_LEQUAL:
- return D3DCMP_LESSEQUAL;
- case GL_GREATER:
- return D3DCMP_GREATER;
- case GL_NOTEQUAL:
- return D3DCMP_NOTEQUAL;
- case GL_GEQUAL:
- return D3DCMP_GREATEREQUAL;
- case GL_ALWAYS:
- return D3DCMP_ALWAYS;
- };
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertCompareFunc: Unknown CompareFunc\n");
-#endif
-
- return D3DCMP_ALWAYS;
-}
-
-//---------------------------------------------------------------------------
-
-D3DBLEND _gldConvertBlendFunc(
- GLenum blend,
- GLenum DefaultBlend)
-{
- switch (blend) {
- case GL_ZERO:
- return D3DBLEND_ZERO;
- case GL_ONE:
- return D3DBLEND_ONE;
- case GL_DST_COLOR:
- return D3DBLEND_DESTCOLOR;
- case GL_SRC_COLOR:
- return D3DBLEND_SRCCOLOR;
- case GL_ONE_MINUS_DST_COLOR:
- return D3DBLEND_INVDESTCOLOR;
- case GL_ONE_MINUS_SRC_COLOR:
- return D3DBLEND_INVSRCCOLOR;
- case GL_SRC_ALPHA:
- return D3DBLEND_SRCALPHA;
- case GL_ONE_MINUS_SRC_ALPHA:
- return D3DBLEND_INVSRCALPHA;
- case GL_DST_ALPHA:
- return D3DBLEND_DESTALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return D3DBLEND_INVDESTALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return D3DBLEND_SRCALPHASAT;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertBlendFunc: Unknown BlendFunc\n");
-#endif
-
- return DefaultBlend;
-}
-
-//---------------------------------------------------------------------------
-// Misc. functions
-//---------------------------------------------------------------------------
-
-void gld_Noop_DX9(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Error_DX9(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- // Quite useless.
-// gldLogMessage(GLDLOG_ERROR, "ctx->Driver.Error called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Required Mesa functions
-//---------------------------------------------------------------------------
-
-static GLboolean gld_set_draw_buffer_DX9(
- GLcontext *ctx,
- GLenum mode)
-{
- (void) ctx;
- if ((mode==GL_FRONT_LEFT) || (mode == GL_BACK_LEFT)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_set_read_buffer_DX9(
- GLcontext *ctx,
- GLframebuffer *buffer,
- GLenum mode)
-{
- /* separate read buffer not supported */
-/*
- ASSERT(buffer == ctx->DrawBuffer);
- ASSERT(mode == GL_FRONT_LEFT);
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Clear_DX9(
- GLcontext *ctx,
- GLbitfield mask,
- GLboolean all,
- GLint x,
- GLint y,
- GLint width,
- GLint height)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DCOLOR Color = 0;
- float Z = 0.0f;
- DWORD Stencil = 0;
- D3DRECT d3dClearRect;
-
- // TODO: Colourmask
- const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
-
- if (!gld->pDev)
- return;
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- GLubyte col[4];
- CLAMPED_FLOAT_TO_UBYTE(col[0], ctx->Color.ClearColor[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], ctx->Color.ClearColor[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], ctx->Color.ClearColor[2]);
- CLAMPED_FLOAT_TO_UBYTE(col[3], ctx->Color.ClearColor[3]);
- dwFlags |= D3DCLEAR_TARGET;
- Color = D3DCOLOR_RGBA(col[0], col[1], col[2], col[3]);
- }
-
- if (mask & DD_DEPTH_BIT) {
- // D3D8 will fail the Clear call if we try and clear a
- // depth buffer and we haven't created one.
- // Also, some apps try and clear a depth buffer,
- // when a depth buffer hasn't been requested by the app.
- if (ctx->Visual.depthBits == 0) {
- mask &= ~DD_DEPTH_BIT; // Remove depth bit from mask
- } else {
- dwFlags |= D3DCLEAR_ZBUFFER;
- Z = ctx->Depth.Clear;
- }
- }
-
- if (mask & DD_STENCIL_BIT) {
- if (ctx->Visual.stencilBits == 0) {
- // No stencil bits in depth buffer
- mask &= ~DD_STENCIL_BIT; // Remove stencil bit from mask
- } else {
- dwFlags |= D3DCLEAR_STENCIL;
- Stencil = ctx->Stencil.Clear;
- }
- }
-
- // Some apps do really weird things with the rect, such as Quake3.
- if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0)) {
- all = GL_TRUE;
- }
-
- if (!all) {
- // Calculate clear subrect
- d3dClearRect.x1 = x;
- d3dClearRect.y1 = gldCtx->dwHeight - (y + height);
- d3dClearRect.x2 = x + width;
- d3dClearRect.y2 = d3dClearRect.y1 + height;
-// gldLogPrintf(GLDLOG_INFO, "Rect %d,%d %d,%d", x,y,width,height);
- }
-
- // dwFlags will be zero if there's nothing to clear
- if (dwFlags) {
- _GLD_DX9_DEV(Clear(
- gld->pDev,
- all ? 0 : 1,
- all ? NULL : &d3dClearRect,
- dwFlags,
- Color, Z, Stencil));
- }
-
- if (mask & DD_ACCUM_BIT) {
- // Clear accumulation buffer
- }
-}
-
-//---------------------------------------------------------------------------
-
-// Mesa 5: Parameter change
-static void gld_buffer_size_DX9(
-// GLcontext *ctx,
- GLframebuffer *fb,
- GLuint *width,
- GLuint *height)
-{
-// GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
-
- *width = fb->Width; // gldCtx->dwWidth;
- *height = fb->Height; // gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Finish_DX9(
- GLcontext *ctx)
-{
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Flush_DX9(
- GLcontext *ctx)
-{
- GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- // TODO: Detect apps that glFlush() then SwapBuffers() ?
-
- if (gld->EmulateSingle) {
- // Emulating a single-buffered context.
- // [Direct3D doesn't allow rendering to front buffer]
- dglSwapBuffers(gld->hDC);
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_STENCIL(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Two-sided stencil. New for Mesa 5
- const GLuint uiFace = 0UL;
-
- struct gl_stencil_attrib *pStencil = &ctx->Stencil;
-
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILENABLE, pStencil->Enabled ? TRUE : FALSE));
- if (pStencil->Enabled) {
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFUNC, _gldConvertCompareFunc(pStencil->Function[uiFace])));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILREF, pStencil->Ref[uiFace]));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILMASK, pStencil->ValueMask[uiFace]));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILWRITEMASK, pStencil->WriteMask[uiFace]));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFAIL, _gldConvertStencilOp(pStencil->FailFunc[uiFace])));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILZFAIL, _gldConvertStencilOp(pStencil->ZFailFunc[uiFace])));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILPASS, _gldConvertStencilOp(pStencil->ZPassFunc[uiFace])));
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_COLOR(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DBLEND src;
- D3DBLEND dest;
-
- // Alpha func
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, _gldConvertCompareFunc(ctx->Color.AlphaFunc)));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAREF, (DWORD)ctx->Color.AlphaRef));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, ctx->Color.AlphaEnabled));
-
- // Blend func
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHABLENDENABLE, ctx->Color.BlendEnabled));
- src = _gldConvertBlendFunc(ctx->Color.BlendSrcRGB, GL_ONE);
- dest = _gldConvertBlendFunc(ctx->Color.BlendDstRGB, GL_ZERO);
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SRCBLEND, src));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_DESTBLEND, dest));
-
- // Color mask
- if (ctx->Color.ColorMask[0]) dwFlags |= D3DCOLORWRITEENABLE_RED;
- if (ctx->Color.ColorMask[1]) dwFlags |= D3DCOLORWRITEENABLE_GREEN;
- if (ctx->Color.ColorMask[2]) dwFlags |= D3DCOLORWRITEENABLE_BLUE;
- if (ctx->Color.ColorMask[3]) dwFlags |= D3DCOLORWRITEENABLE_ALPHA;
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_COLORWRITEENABLE, dwFlags));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_DEPTH(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ZENABLE, ctx->Depth.Test ? D3DZB_TRUE : D3DZB_FALSE));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ZFUNC, _gldConvertCompareFunc(ctx->Depth.Func)));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ZWRITEENABLE, ctx->Depth.Mask ? TRUE : FALSE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_POLYGON(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DFILLMODE d3dFillMode = D3DFILL_SOLID;
- D3DCULL d3dCullMode = D3DCULL_NONE;
- float fOffset = 0; // Changed from int to float for DX9
-
- // Fillmode
- switch (ctx->Polygon.FrontMode) {
- case GL_POINT:
- d3dFillMode = D3DFILL_POINT;
- break;
- case GL_LINE:
- d3dFillMode = D3DFILL_WIREFRAME;
- break;
- case GL_FILL:
- d3dFillMode = D3DFILL_SOLID;
- break;
- }
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FILLMODE, d3dFillMode));
-
- if (ctx->Polygon.CullFlag) {
- switch (ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CW;
- else
- d3dCullMode = D3DCULL_CCW;
- break;
- case GL_FRONT:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CCW;
- else
- d3dCullMode = D3DCULL_CW;
- break;
- case GL_FRONT_AND_BACK:
- d3dCullMode = D3DCULL_NONE;
- break;
- default:
- break;
- }
- } else {
- d3dCullMode = D3DCULL_NONE;
- }
-// d3dCullMode = D3DCULL_NONE; // FOR DEBUGGING
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_CULLMODE, d3dCullMode));
-
- // Polygon offset
- // ZBIAS ranges from 0 to 16 and can only move towards the viewer
- // Mesa5: ctx->Polygon._OffsetAny removed
- if (ctx->Polygon.OffsetFill) {
- fOffset = ctx->Polygon.OffsetUnits;
-// if (iOffset < 0.0f)
-// iOffset = -iOffset;
-// else
-// iOffset = 0.0f; // D3D can't push away
- }
- // NOTE: SetRenderState() required a DWORD, so need to cast
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_DEPTHBIAS, *((DWORD*)&fOffset)));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_FOG(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DCOLOR d3dFogColour;
- D3DFOGMODE d3dFogMode = D3DFOG_LINEAR;
-
- // TODO: Fog is calculated seperately in the Mesa pipeline
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, FALSE));
- return;
-
- // Fog enable
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, ctx->Fog.Enabled));
- if (!ctx->Fog.Enabled) {
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, D3DFOG_NONE));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE));
- return; // If disabled, don't bother setting any fog state
- }
-
- // Fog colour
- d3dFogColour = D3DCOLOR_COLORVALUE( ctx->Fog.Color[0],
- ctx->Fog.Color[1],
- ctx->Fog.Color[2],
- ctx->Fog.Color[3]);
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGCOLOR, d3dFogColour));
-
- // Fog density
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGDENSITY, *((DWORD*) (&ctx->Fog.Density))));
-
- // Fog start
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGSTART, *((DWORD*) (&ctx->Fog.Start))));
-
- // Fog end
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGEND, *((DWORD*) (&ctx->Fog.End))));
-
- // Fog mode
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- d3dFogMode = D3DFOG_LINEAR;
- break;
- case GL_EXP:
- d3dFogMode = D3DFOG_EXP;
- break;
- case GL_EXP2:
- d3dFogMode = D3DFOG_EXP2;
- break;
- }
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, d3dFogMode));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_LIGHT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- DWORD dwSpecularEnable;
-
- // Shademode
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SHADEMODE, (ctx->Light.ShadeModel == GL_SMOOTH) ? D3DSHADE_GOURAUD : D3DSHADE_FLAT));
-
- // Separate specular colour
- if (ctx->Light.Enabled)
- dwSpecularEnable = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TRUE: FALSE;
- else
- dwSpecularEnable = FALSE;
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SPECULARENABLE, dwSpecularEnable));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_MODELVIEW(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ModelView.m;
- // Mesa5: Model-view is now a stack
- GLfloat *pM = ctx->ModelviewMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10];
- m._34 = pM[11];
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14];
- m._44 = pM[15];
-
- gld->matModelView = m;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_PROJECTION(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ProjectionMatrix.m;
- // Mesa 5: Now a stack
- GLfloat *pM = ctx->ProjectionMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
-
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
-
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10] / _fPersp_33; // / 1.6f;
- m._34 = pM[11];
-
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14] / 2.0f;
- m._44 = pM[15];
-
- gld->matProjection = m;
-}
-
-//---------------------------------------------------------------------------
-/*
-void gldFrustumHook_DX9(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Frustum(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = farval / (nearval - farval);
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Frustum: %f", farval/nearval);
-}
-
-//---------------------------------------------------------------------------
-
-void gldOrthoHook_DX9(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Ortho(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = 1.6f;
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Ortho: %f", farval/nearval);
-}
-*/
-//---------------------------------------------------------------------------
-
-void gld_NEW_VIEWPORT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DVIEWPORT9 d3dvp;
-// GLint x, y;
-// GLsizei w, h;
-
- // Set depth range
- _GLD_DX9_DEV(GetViewport(gld->pDev, &d3dvp));
- // D3D can't do Quake1/Quake2 z-trick
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.MinZ = ctx->Viewport.Near;
- d3dvp.MaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.MinZ = ctx->Viewport.Far;
- d3dvp.MaxZ = ctx->Viewport.Near;
- }
-/* x = ctx->Viewport.X;
- y = ctx->Viewport.Y;
- w = ctx->Viewport.Width;
- h = ctx->Viewport.Height;
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;*/
- _GLD_DX9_DEV(SetViewport(gld->pDev, &d3dvp));
-
-// gld->fFlipWindowY = (float)gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_SCISSOR(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Bail if IHV driver cannot scissor
- if (!gld->bCanScissor)
- return;
-
- // Set scissor rect
- if (ctx->Scissor.Enabled) {
- RECT rcRect;
- // Keep in mind that RECT's need an extra row and column
- rcRect.left = ctx->Scissor.X;
- rcRect.right = ctx->Scissor.X + ctx->Scissor.Width; // + 1;
- rcRect.top = gldCtx->dwHeight - (ctx->Scissor.Y + ctx->Scissor.Height);
- rcRect.bottom = rcRect.top + ctx->Scissor.Height;
- IDirect3DDevice9_SetScissorRect(gld->pDev, &rcRect);
- }
-
- // Enable/disable scissor as required
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SCISSORTESTENABLE, ctx->Scissor.Enabled));
-}
-
-//---------------------------------------------------------------------------
-
-__inline BOOL _gldAnyEvalEnabled(
- GLcontext *ctx)
-{
- struct gl_eval_attrib *eval = &ctx->Eval;
-
- if ((eval->AutoNormal) ||
- (eval->Map1Color4) ||
- (eval->Map1Index) ||
- (eval->Map1Normal) ||
- (eval->Map1TextureCoord1) ||
- (eval->Map1TextureCoord2) ||
- (eval->Map1TextureCoord3) ||
- (eval->Map1TextureCoord4) ||
- (eval->Map1Vertex3) ||
- (eval->Map1Vertex4) ||
- (eval->Map2Color4) ||
- (eval->Map2Index) ||
- (eval->Map2Normal) ||
- (eval->Map2TextureCoord1) ||
- (eval->Map2TextureCoord2) ||
- (eval->Map2TextureCoord3) ||
- (eval->Map2TextureCoord4) ||
- (eval->Map2Vertex3) ||
- (eval->Map2Vertex4)
- )
- return TRUE;
-
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL _gldChooseInternalPipeline(
- GLcontext *ctx,
- GLD_driver_dx9 *gld)
-{
-// return TRUE; // DEBUGGING: ALWAYS USE MESA
-// return FALSE; // DEBUGGING: ALWAYS USE D3D
-
- if ((glb.dwTnL == GLDS_TNL_MESA) || (gld->bHasHWTnL == FALSE))
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE; // Force Mesa TnL
- }
-
- if ((ctx->Light.Enabled) ||
- (1) ||
- (ctx->Texture._TexGenEnabled) ||
- (ctx->Texture._TexMatEnabled) ||
-// (ctx->Transform._AnyClip) ||
- (ctx->Scissor.Enabled) ||
- _gldAnyEvalEnabled(ctx) // Put this last so we can early-out
- )
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE;
- }
-
- gld->PipelineUsage.qwD3DFVF.QuadPart++;
- return FALSE;
-
-/* // Force Mesa pipeline?
- if (glb.dwTnL == GLDS_TNL_MESA) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Test for functionality not exposed in the D3D pathways
- if ((ctx->Texture._GenFlags)) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Now decide if vertex shader can be used.
- // If two sided lighting is enabled then we must either
- // use Mesa TnL or the vertex shader
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
- if (gld->VStwosidelight.hShader && !ctx->Fog.Enabled) {
- // Use Vertex Shader
- gld->PipelineUsage.dwD3D2SVS.QuadPart++;
- return GLD_PIPELINE_D3D_VS_TWOSIDE;
- } else {
- // Use Mesa TnL
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
- }
-
- // Must be D3D fixed-function pipeline
- gld->PipelineUsage.dwD3DFVF.QuadPart++;
- return GLD_PIPELINE_D3D_FVF;
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_update_state_DX9(
- GLcontext *ctx,
- GLuint new_state)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLD_pb_dx9 *gldPB;
-
- if (!gld || !gld->pDev)
- return;
-
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-
- // SetupIndex will be used in the pipelines for choosing setup function
- if ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_SEPARATE_SPECULAR)) ||
- (ctx->Fog.Enabled))
- {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT_EXTRAS;
- else
- gld->iSetupFunc = GLD_SI_SMOOTH_EXTRAS;
- } else {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT; // Setup flat shade + texture
- else
- gld->iSetupFunc = GLD_SI_SMOOTH; // Setup smooth shade + texture
- }
-
- gld->bUseMesaTnL = _gldChooseInternalPipeline(ctx, gld);
- if (gld->bUseMesaTnL) {
- gldPB = &gld->PB2d;
- _GLD_DX9_DEV(SetSoftwareVertexProcessing(gld->pDev, TRUE));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, FALSE));
- _GLD_DX9_DEV(SetVertexShader(gld->pDev, NULL));
- _GLD_DX9_DEV(SetFVF(gld->pDev, gldPB->dwFVF));
- } else {
- gldPB = &gld->PB3d;
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE));
-// if (gld->TnLPipeline == GLD_PIPELINE_D3D_VS_TWOSIDE) {
-// _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware));
-// _GLD_DX9_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
-// } else {
-// _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->bHasHWTnL));
- _GLD_DX9_DEV(SetSoftwareVertexProcessing(gld->pDev, !gld->bHasHWTnL));
- _GLD_DX9_DEV(SetVertexShader(gld->pDev, NULL));
- _GLD_DX9_DEV(SetFVF(gld->pDev, gldPB->dwFVF));
-// }
- }
-
-#define _GLD_TEST_STATE(a) \
- if (new_state & (a)) { \
- gld##a(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_TEST_STATE_DX9(a) \
- if (new_state & (a)) { \
- gld##a##_DX9(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_IGNORE_STATE(a) new_state &= ~(a);
-
-// if (!gld->bUseMesaTnL) {
- // Not required if Mesa is doing the TnL.
- // Problem: If gld->bUseMesaTnL is TRUE when these are signaled,
- // then we'll miss updating the D3D TnL pipeline.
- // Therefore, don't test for gld->bUseMesaTnL
- _GLD_TEST_STATE(_NEW_MODELVIEW);
- _GLD_TEST_STATE(_NEW_PROJECTION);
-// }
-
- _GLD_TEST_STATE_DX9(_NEW_TEXTURE); // extern, so guard with _DX9
- _GLD_TEST_STATE(_NEW_COLOR);
- _GLD_TEST_STATE(_NEW_DEPTH);
- _GLD_TEST_STATE(_NEW_POLYGON);
- _GLD_TEST_STATE(_NEW_STENCIL);
- _GLD_TEST_STATE(_NEW_FOG);
- _GLD_TEST_STATE(_NEW_LIGHT);
- _GLD_TEST_STATE(_NEW_VIEWPORT);
-
- _GLD_IGNORE_STATE(_NEW_TRANSFORM);
-
- // Scissor Test: New for DX9
- _GLD_TEST_STATE(_NEW_SCISSOR);
-
-// Stubs for future use.
-/* _GLD_TEST_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_STATE(_NEW_ACCUM);
- _GLD_TEST_STATE(_NEW_EVAL);
- _GLD_TEST_STATE(_NEW_HINT);
- _GLD_TEST_STATE(_NEW_LINE);
- _GLD_TEST_STATE(_NEW_PIXEL);
- _GLD_TEST_STATE(_NEW_POINT);
- _GLD_TEST_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_STATE(_NEW_ARRAY);
- _GLD_TEST_STATE(_NEW_RENDERMODE);
- _GLD_TEST_STATE(_NEW_BUFFERS);
- _GLD_TEST_STATE(_NEW_MULTISAMPLE);
-*/
-
-// For debugging.
-#if 0
-#define _GLD_TEST_UNHANDLED_STATE(a) \
- if (new_state & (a)) { \
- gldLogMessage(GLDLOG_ERROR, "Unhandled " #a "\n"); \
- }
- _GLD_TEST_UNHANDLED_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ACCUM);
- _GLD_TEST_UNHANDLED_STATE(_NEW_EVAL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_HINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_LINE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PIXEL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POLYGONSTIPPLE);
-// _GLD_TEST_UNHANDLED_STATE(_NEW_SCISSOR);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ARRAY);
- _GLD_TEST_UNHANDLED_STATE(_NEW_RENDERMODE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_BUFFERS);
- _GLD_TEST_UNHANDLED_STATE(_NEW_MULTISAMPLE);
-#undef _GLD_UNHANDLED_STATE
-#endif
-
-#undef _GLD_TEST_STATE
-}
-
-//---------------------------------------------------------------------------
-// Viewport
-//---------------------------------------------------------------------------
-
-void gld_Viewport_DX9(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei w,
- GLsizei h)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DVIEWPORT9 d3dvp;
-
- if (!gld || !gld->pDev)
- return;
-
- // This is a hack. When the app is minimized, Mesa passes
- // w=1 and h=1 for viewport dimensions. Without this test
- // we get a GPF in gld_wgl_resize_buffers().
- if ((w==1) && (h==1))
- return;
-
- // Call ResizeBuffersMESA. This function will early-out
- // if no resize is needed.
- //ctx->Driver.ResizeBuffersMESA(ctx);
- // Mesa 5: Changed parameters
- ctx->Driver.ResizeBuffers(gldCtx->glBuffer);
-
-#if 0
- ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h);
-#endif
-
- // ** D3D viewport must not be outside the render target surface **
- // Sanity check the GL viewport dimensions
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
-
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.MinZ = ctx->Viewport.Near;
- d3dvp.MaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.MinZ = ctx->Viewport.Far;
- d3dvp.MaxZ = ctx->Viewport.Near;
- }
-
- // TODO: DEBUGGING
-// d3dvp.MinZ = 0.0f;
-// d3dvp.MaxZ = 1.0f;
-
- _GLD_DX9_DEV(SetViewport(gld->pDev, &d3dvp));
-
-}
-
-//---------------------------------------------------------------------------
-
-extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
-
-// Mesa 5: Parameter change
-void gldResizeBuffers_DX9(
-// GLcontext *ctx)
- GLframebuffer *fb)
-{
- GET_CURRENT_CONTEXT(ctx);
- dglWglResizeBuffers(ctx, TRUE);
-}
-
-//---------------------------------------------------------------------------
-#ifdef _DEBUG
-// This is only for debugging.
-// To use, plug into ctx->Driver.Enable pointer below.
-void gld_Enable(
- GLcontext *ctx,
- GLenum e,
- GLboolean b)
-{
- char buf[1024];
- sprintf(buf, "Enable: %s (%s)\n", _mesa_lookup_enum_by_nr(e), b?"TRUE":"FALSE");
- ddlogMessage(DDLOG_SYSTEM, buf);
-}
-#endif
-//---------------------------------------------------------------------------
-// Driver pointer setup
-//---------------------------------------------------------------------------
-
-extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum);
-
-void gldSetupDriverPointers_DX9(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- // Mandatory functions
- ctx->Driver.GetString = _gldGetStringGeneric;
- ctx->Driver.UpdateState = gld_update_state_DX9;
- ctx->Driver.Clear = gld_Clear_DX9;
- ctx->Driver.DrawBuffer = gld_set_draw_buffer_DX9;
- ctx->Driver.GetBufferSize = gld_buffer_size_DX9;
- ctx->Driver.Finish = gld_Finish_DX9;
- ctx->Driver.Flush = gld_Flush_DX9;
- ctx->Driver.Error = gld_Error_DX9;
-
- // Hardware accumulation buffer
- ctx->Driver.Accum = NULL; // TODO: gld_Accum;
-
- // Bitmap functions
- ctx->Driver.CopyPixels = gld_CopyPixels_DX9;
- ctx->Driver.DrawPixels = gld_DrawPixels_DX9;
- ctx->Driver.ReadPixels = gld_ReadPixels_DX9;
- ctx->Driver.Bitmap = gld_Bitmap_DX9;
-
- // Buffer resize
- ctx->Driver.ResizeBuffers = gldResizeBuffers_DX9;
-
- // Texture image functions
- ctx->Driver.ChooseTextureFormat = gld_ChooseTextureFormat_DX9;
- ctx->Driver.TexImage1D = gld_TexImage1D_DX9;
- ctx->Driver.TexImage2D = gld_TexImage2D_DX9;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = gld_TexSubImage1D_DX9;
- ctx->Driver.TexSubImage2D = gld_TexSubImage2D_DX9;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
-
- ctx->Driver.CopyTexImage1D = gldCopyTexImage1D_DX9; //NULL;
- ctx->Driver.CopyTexImage2D = gldCopyTexImage2D_DX9; //NULL;
- ctx->Driver.CopyTexSubImage1D = gldCopyTexSubImage1D_DX9; //NULL;
- ctx->Driver.CopyTexSubImage2D = gldCopyTexSubImage2D_DX9; //NULL;
- ctx->Driver.CopyTexSubImage3D = gldCopyTexSubImage3D_DX9;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- // Texture object functions
- ctx->Driver.BindTexture = NULL;
- ctx->Driver.NewTextureObject = NULL; // Not yet implemented by Mesa!;
- ctx->Driver.DeleteTexture = gld_DeleteTexture_DX9;
- ctx->Driver.PrioritizeTexture = NULL;
-
- // Imaging functionality
- ctx->Driver.CopyColorTable = NULL;
- ctx->Driver.CopyColorSubTable = NULL;
- ctx->Driver.CopyConvolutionFilter1D = NULL;
- ctx->Driver.CopyConvolutionFilter2D = NULL;
-
- // State changing functions
- ctx->Driver.AlphaFunc = NULL; //gld_AlphaFunc;
- ctx->Driver.BlendFuncSeparate = NULL; //gld_BlendFunc;
- ctx->Driver.ClearColor = NULL; //gld_ClearColor;
- ctx->Driver.ClearDepth = NULL; //gld_ClearDepth;
- ctx->Driver.ClearStencil = NULL; //gld_ClearStencil;
- ctx->Driver.ColorMask = NULL; //gld_ColorMask;
- ctx->Driver.CullFace = NULL; //gld_CullFace;
- ctx->Driver.ClipPlane = NULL; //gld_ClipPlane;
- ctx->Driver.FrontFace = NULL; //gld_FrontFace;
- ctx->Driver.DepthFunc = NULL; //gld_DepthFunc;
- ctx->Driver.DepthMask = NULL; //gld_DepthMask;
- ctx->Driver.DepthRange = NULL;
- ctx->Driver.Enable = NULL; //gld_Enable;
- ctx->Driver.Fogfv = NULL; //gld_Fogfv;
- ctx->Driver.Hint = NULL; //gld_Hint;
- ctx->Driver.Lightfv = NULL; //gld_Lightfv;
- ctx->Driver.LightModelfv = NULL; //gld_LightModelfv;
- ctx->Driver.LineStipple = NULL; //gld_LineStipple;
- ctx->Driver.LineWidth = NULL; //gld_LineWidth;
- ctx->Driver.LogicOpcode = NULL; //gld_LogicOpcode;
- ctx->Driver.PointParameterfv = NULL; //gld_PointParameterfv;
- ctx->Driver.PointSize = NULL; //gld_PointSize;
- ctx->Driver.PolygonMode = NULL; //gld_PolygonMode;
- ctx->Driver.PolygonOffset = NULL; //gld_PolygonOffset;
- ctx->Driver.PolygonStipple = NULL; //gld_PolygonStipple;
- ctx->Driver.RenderMode = NULL; //gld_RenderMode;
- ctx->Driver.Scissor = NULL; //gld_Scissor;
- ctx->Driver.ShadeModel = NULL; //gld_ShadeModel;
- ctx->Driver.StencilFunc = NULL; //gld_StencilFunc;
- ctx->Driver.StencilMask = NULL; //gld_StencilMask;
- ctx->Driver.StencilOp = NULL; //gld_StencilOp;
- ctx->Driver.TexGen = NULL; //gld_TexGen;
- ctx->Driver.TexEnv = NULL;
- ctx->Driver.TexParameter = NULL;
- ctx->Driver.TextureMatrix = NULL; //gld_TextureMatrix;
- ctx->Driver.Viewport = gld_Viewport_DX9;
-
- _swsetup_Wakeup(ctx);
-
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- tnl->Driver.Render.ResetLineStipple = gld_ResetLineStipple_DX9;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
-
- // Hook into glFrustum() and glOrtho()
-// ctx->Exec->Frustum = gldFrustumHook_DX9;
-// ctx->Exec->Ortho = gldOrthoHook_DX9;
-
-}
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h
deleted file mode 100644
index aec40ac9d..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h
+++ /dev/null
@@ -1,327 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 9.0 header file
-*
-****************************************************************************/
-
-#ifndef _GLD_DX9_H
-#define _GLD_DX9_H
-
-//---------------------------------------------------------------------------
-// Windows includes
-//---------------------------------------------------------------------------
-
-//#ifndef STRICT
-//#define STRICT
-//#endif
-
-//#define WIN32_LEAN_AND_MEAN
-//#include <windows.h>
-#include <d3d9.h>
-#include <d3dx9.h>
-
-// MS screwed up with the DX8.1 SDK - there's no compile-time
-// method of compiling for 8.0 via the 8.1 SDK unless you
-// "make sure you don't use any 8.1 interfaces".
-// We CAN use 8.1 D3DX static functions, though - just not new 8.1 interfaces.
-//
-// D3D_SDK_VERSION is 120 for 8.0 (supported by Windows 95).
-// D3D_SDK_VERSION is 220 for 8.1 (NOT supported by Windows 95).
-//
-//#define D3D_SDK_VERSION_DX9_SUPPORT_WIN95 120
-//#define D3D_SDK_VERSION_DX91 220
-
-// Typedef for obtaining function from d3d8.dll
-typedef IDirect3D9* (WINAPI *FNDIRECT3DCREATE9) (UINT);
-
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-
-#ifdef _DEBUG
-#define _GLD_TEST_HRESULT(h) \
-{ \
- HRESULT _hr = (h); \
- if (FAILED(_hr)) { \
- gldLogError(GLDLOG_ERROR, #h, _hr); \
- } \
-}
-#define _GLD_DX9(func) _GLD_TEST_HRESULT(IDirect3D9_##func##)
-#define _GLD_DX9_DEV(func) _GLD_TEST_HRESULT(IDirect3DDevice9_##func##)
-#define _GLD_DX9_VB(func) _GLD_TEST_HRESULT(IDirect3DVertexBuffer9_##func##)
-#define _GLD_DX9_TEX(func) _GLD_TEST_HRESULT(IDirect3DTexture9_##func##)
-#else
-#define _GLD_DX9(func) IDirect3D9_##func
-#define _GLD_DX9_DEV(func) IDirect3DDevice9_##func
-#define _GLD_DX9_VB(func) IDirect3DVertexBuffer9_##func
-#define _GLD_DX9_TEX(func) IDirect3DTexture9_##func
-#endif
-
-#define SAFE_RELEASE(p) \
-{ \
- if (p) { \
- (p)->lpVtbl->Release(p); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_VB9(p) \
-{ \
- if (p) { \
- IDirect3DVertexBuffer9_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_SURFACE9(p) \
-{ \
- if (p) { \
- IDirect3DSurface9_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-// Setup index.
-enum {
- GLD_SI_FLAT = 0,
- GLD_SI_SMOOTH = 1,
- GLD_SI_FLAT_EXTRAS = 2,
- GLD_SI_SMOOTH_EXTRAS = 3,
-};
-/*
-// Internal pipeline
-typedef enum {
- GLD_PIPELINE_MESA = 0, // Mesa pipeline
- GLD_PIPELINE_D3D_FVF = 1, // Direct3D Fixed-function pipeline
- GLD_PIPELINE_D3D_VS_TWOSIDE = 2 // Direct3D two-sided-lighting vertex shader
-} GLD_tnl_pipeline;
-*/
-//---------------------------------------------------------------------------
-// Vertex definitions for Fixed-Function pipeline
-//---------------------------------------------------------------------------
-
-//
-// NOTE: If the number of texture units is altered then most of
-// the texture code will need to be revised.
-//
-
-#define GLD_MAX_TEXTURE_UNITS_DX9 2
-
-//
-// 2D vertex transformed by Mesa
-//
-#define GLD_FVF_2D_VERTEX ( D3DFVF_XYZRHW | \
- D3DFVF_DIFFUSE | \
- D3DFVF_SPECULAR | \
- D3DFVF_TEX2)
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT sz; // Screen Z (depth)
- FLOAT rhw; // Reciprocal homogenous W
- DWORD diffuse; // Diffuse colour
- DWORD specular; // For separate-specular support
- FLOAT t0_u, t0_v; // 1st set of texture coords
- FLOAT t1_u, t1_v; // 2nd set of texture coords
-} GLD_2D_VERTEX;
-
-
-//
-// 3D vertex transformed by Direct3D
-//
-#define GLD_FVF_3D_VERTEX ( D3DFVF_XYZ | \
- D3DFVF_DIFFUSE | \
- D3DFVF_TEX2)
-
-typedef struct {
- D3DXVECTOR3 Position; // XYZ Vector in object space
- D3DCOLOR Diffuse; // Diffuse colour
- D3DXVECTOR2 TexUnit0; // Texture unit 0
- D3DXVECTOR2 TexUnit1; // Texture unit 1
-} GLD_3D_VERTEX;
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-/*
-// DX8 Vertex Shader
-typedef struct {
- DWORD hShader; // If NULL, shader is invalid and cannot be used
- BOOL bHardware; // If TRUE then shader was created for hardware,
- // otherwise shader was created for software.
-} GLD_vertexShader;
-*/
-//---------------------------------------------------------------------------
-// Structs
-//---------------------------------------------------------------------------
-
-// This keeps a count of how many times we choose each individual internal
-// pathway. Useful for seeing if a certain pathway was ever used by an app, and
-// how much each pathway is biased.
-// Zero the members at context creation and dump stats at context deletion.
-typedef struct {
- // Note: DWORD is probably too small
- ULARGE_INTEGER qwMesa; // Mesa TnL pipeline
- ULARGE_INTEGER qwD3DFVF; // Direct3D Fixed-Function pipeline
-// ULARGE_INTEGER dwD3D2SVS; // Direct3D Two-Sided Vertex Shader pipeline
-} GLD_pipeline_usage;
-
-// GLDirect Primitive Buffer (points, lines, triangles and quads)
-typedef struct {
- // Data for IDirect3DDevice9::CreateVertexBuffer()
- DWORD dwStride; // Stride of vertex
- DWORD dwUsage; // Usage flags
- DWORD dwFVF; // Direct3D Flexible Vertex Format
- DWORD dwPool; // Pool flags
-
- IDirect3DVertexBuffer9 *pVB; // Holds points, lines, tris and quads.
-
- // Point list is assumed to be at start of buffer
- DWORD iFirstLine; // Index of start of line list
- DWORD iFirstTriangle; // Index of start of triangle list
-
- BYTE *pPoints; // Pointer to next free point
- BYTE *pLines; // Pointer to next free line
- BYTE *pTriangles; // Pointer to next free triangle
-
- DWORD nPoints; // Number of points ready to render
- DWORD nLines; // Number of lines ready to render
- DWORD nTriangles; // Number of triangles ready to render
-} GLD_pb_dx9;
-
-// GLDirect DX9 driver data
-typedef struct {
- // GLDirect vars
- BOOL bDoublebuffer; // Doublebuffer (otherwise single-buffered)
- BOOL bDepthStencil; // Depth buffer needed (stencil optional)
- D3DFORMAT RenderFormat; // Format of back/front buffer
- D3DFORMAT DepthFormat; // Format of depth/stencil
-// float fFlipWindowY; // Value for flipping viewport Y coord
-
- // Direct3D vars
- D3DCAPS9 d3dCaps9;
- BOOL bHasHWTnL; // Device has Hardware Transform/Light?
- IDirect3D9 *pD3D; // Base Direct3D9 interface
- IDirect3DDevice9 *pDev; // Direct3D9 Device interface
- GLD_pb_dx9 PB2d; // Vertices transformed by Mesa
- GLD_pb_dx9 PB3d; // Vertices transformed by Direct3D
- D3DPRIMITIVETYPE d3dpt; // Current Direct3D primitive type
- D3DXMATRIX matProjection; // Projection matrix for D3D TnL
- D3DXMATRIX matModelView; // Model/View matrix for D3D TnL
- int iSetupFunc; // Which setup functions to use
- BOOL bUseMesaTnL; // Whether to use Mesa or D3D for TnL
-
- // Direct3D vars for two-sided lighting
-// GLD_vertexShader VStwosidelight; // Vertex Shader for two-sided lighting
-// D3DXMATRIX matWorldViewProj;// World/View/Projection matrix for shaders
-
-
-// GLD_tnl_pipeline TnLPipeline; // Index of current internal pipeline
- GLD_pipeline_usage PipelineUsage;
-
- BOOL bCanScissor; // Scissor test - new for DX9
-} GLD_driver_dx9;
-
-#define GLD_GET_DX9_DRIVER(c) (GLD_driver_dx9*)(c)->glPriv
-
-//---------------------------------------------------------------------------
-// Function prototypes
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX9(LPCSTR a);
-void gldEnableExtensions_DX9(GLcontext *ctx);
-void gldInstallPipeline_DX9(GLcontext *ctx);
-void gldSetupDriverPointers_DX9(GLcontext *ctx);
-//void gldResizeBuffers_DX9(GLcontext *ctx);
-void gldResizeBuffers_DX9(GLframebuffer *fb);
-
-
-// Texture functions
-
-void gldCopyTexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-void gldCopyTexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void gldCopyTexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-void gldCopyTexSubImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-void gldCopyTexSubImage3D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-
-void gld_NEW_TEXTURE_DX9(GLcontext *ctx);
-void gld_DrawPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
-void gld_ReadPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
-void gld_CopyPixels_DX9(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
-void gld_Bitmap_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
-const struct gl_texture_format* gld_ChooseTextureFormat_DX9(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
-void gld_TexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
-void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
-void gld_DeleteTexture_DX9(GLcontext *ctx, struct gl_texture_object *tObj);
-void gld_ResetLineStipple_DX9(GLcontext *ctx);
-
-// 2D primitive functions
-
-void gld_Points2D_DX9(GLcontext *ctx, GLuint first, GLuint last);
-
-void gld_Line2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-
-void gld_Triangle2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-
-void gld_Quad2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// 3D primitive functions
-
-void gld_Points3D_DX9(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Line3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// Primitive functions for Two-sided-lighting Vertex Shader
-
-void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-#endif
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h
deleted file mode 100644
index 1d6b7b1c7..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*==========================================================================;
- *
- *
- * File: dxerr9.h
- * Content: DirectX Error Library Include File
- *
- ****************************************************************************/
-
-#ifndef _GLD_DXERR9_H_
-#define _GLD_DXERR9_H_
-
-
-#include <d3d9.h>
-
-//
-// DXGetErrorString9
-//
-// Desc: Converts an DirectX HRESULT to a string
-//
-// Args: HRESULT hr Can be any error code from
-// DPLAY D3D8 D3DX8 DMUSIC DSOUND
-//
-// Return: Converted string
-//
-const char* __stdcall DXGetErrorString9A(HRESULT hr);
-const WCHAR* __stdcall DXGetErrorString9W(HRESULT hr);
-
-#ifdef UNICODE
- #define DXGetErrorString9 DXGetErrorString9W
-#else
- #define DXGetErrorString9 DXGetErrorString9A
-#endif
-
-
-//
-// DXTrace
-//
-// Desc: Outputs a formatted error message to the debug stream
-//
-// Args: CHAR* strFile The current file, typically passed in using the
-// __FILE__ macro.
-// DWORD dwLine The current line number, typically passed in using the
-// __LINE__ macro.
-// HRESULT hr An HRESULT that will be traced to the debug stream.
-// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
-// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
-//
-// Return: The hr that was passed in.
-//
-//HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE );
-//HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE );
-HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox);
-HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox);
-
-#ifdef UNICODE
- #define DXTrace DXTraceW
-#else
- #define DXTrace DXTraceA
-#endif
-
-
-//
-// Helper macros
-//
-#if defined(DEBUG) | defined(_DEBUG)
- #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
- #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
- #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
-#else
- #define DXTRACE_MSG(str) (0L)
- #define DXTRACE_ERR(str,hr) (hr)
- #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
-#endif
-
-
-#endif
-
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c
deleted file mode 100644
index e8c73a6ff..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GL extensions
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "../gld_settings.h"
-
-#include <windows.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-//#include "ddlog.h"
-//#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "vbo/vbo.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "dglcontext.h"
-#include "extensions.h"
-
-// For some reason this is not defined in an above header...
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
-
-//---------------------------------------------------------------------------
-// Hack for the SGIS_multitexture extension that was removed from Mesa
-// NOTE: SGIS_multitexture enums also clash with GL_SGIX_async_pixel
-
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // To enable, uncomment:
- // _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
-//---------------------------------------------------------------------------
-
-enum {
- /* Quake2 GL_SGIS_multitexture */
- GL_SELECTED_TEXTURE_SGIS = 0x835B,
- GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835C,
- GL_MAX_TEXTURES_SGIS = 0x835D,
- GL_TEXTURE0_SGIS = 0x835E,
- GL_TEXTURE1_SGIS = 0x835F,
- GL_TEXTURE2_SGIS = 0x8360,
- GL_TEXTURE3_SGIS = 0x8361,
- GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363,
-};
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldSelectTextureSGIS(
- GLenum target)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glActiveTextureARB(ARB_target);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fSGIS(
- GLenum target,
- GLfloat s,
- GLfloat t)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fARB(ARB_target, s, t);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fvSGIS(
- GLenum target,
- const GLfloat *v)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fvARB(ARB_target, v);
-}
-
-//---------------------------------------------------------------------------
-// Extensions
-//---------------------------------------------------------------------------
-
-typedef struct {
- PROC proc;
- char *name;
-} GLD_extension;
-
-GLD_extension GLD_extList[] = {
-#ifdef GL_EXT_polygon_offset
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
-#endif
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
- { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
- { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
-
- { (PROC)glLockArraysEXT, "glLockArraysEXT" },
- { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" },
- { NULL, "\0" }
-};
-
-GLD_extension GLD_multitexList[] = {
-/*
- { (PROC)glMultiTexCoord1dSGIS, "glMTexCoord1dSGIS" },
- { (PROC)glMultiTexCoord1dvSGIS, "glMTexCoord1dvSGIS" },
- { (PROC)glMultiTexCoord1fSGIS, "glMTexCoord1fSGIS" },
- { (PROC)glMultiTexCoord1fvSGIS, "glMTexCoord1fvSGIS" },
- { (PROC)glMultiTexCoord1iSGIS, "glMTexCoord1iSGIS" },
- { (PROC)glMultiTexCoord1ivSGIS, "glMTexCoord1ivSGIS" },
- { (PROC)glMultiTexCoord1sSGIS, "glMTexCoord1sSGIS" },
- { (PROC)glMultiTexCoord1svSGIS, "glMTexCoord1svSGIS" },
- { (PROC)glMultiTexCoord2dSGIS, "glMTexCoord2dSGIS" },
- { (PROC)glMultiTexCoord2dvSGIS, "glMTexCoord2dvSGIS" },
- { (PROC)glMultiTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)glMultiTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
- { (PROC)glMultiTexCoord2iSGIS, "glMTexCoord2iSGIS" },
- { (PROC)glMultiTexCoord2ivSGIS, "glMTexCoord2ivSGIS" },
- { (PROC)glMultiTexCoord2sSGIS, "glMTexCoord2sSGIS" },
- { (PROC)glMultiTexCoord2svSGIS, "glMTexCoord2svSGIS" },
- { (PROC)glMultiTexCoord3dSGIS, "glMTexCoord3dSGIS" },
- { (PROC)glMultiTexCoord3dvSGIS, "glMTexCoord3dvSGIS" },
- { (PROC)glMultiTexCoord3fSGIS, "glMTexCoord3fSGIS" },
- { (PROC)glMultiTexCoord3fvSGIS, "glMTexCoord3fvSGIS" },
- { (PROC)glMultiTexCoord3iSGIS, "glMTexCoord3iSGIS" },
- { (PROC)glMultiTexCoord3ivSGIS, "glMTexCoord3ivSGIS" },
- { (PROC)glMultiTexCoord3sSGIS, "glMTexCoord3sSGIS" },
- { (PROC)glMultiTexCoord3svSGIS, "glMTexCoord3svSGIS" },
- { (PROC)glMultiTexCoord4dSGIS, "glMTexCoord4dSGIS" },
- { (PROC)glMultiTexCoord4dvSGIS, "glMTexCoord4dvSGIS" },
- { (PROC)glMultiTexCoord4fSGIS, "glMTexCoord4fSGIS" },
- { (PROC)glMultiTexCoord4fvSGIS, "glMTexCoord4fvSGIS" },
- { (PROC)glMultiTexCoord4iSGIS, "glMTexCoord4iSGIS" },
- { (PROC)glMultiTexCoord4ivSGIS, "glMTexCoord4ivSGIS" },
- { (PROC)glMultiTexCoord4sSGIS, "glMTexCoord4sSGIS" },
- { (PROC)glMultiTexCoord4svSGIS, "glMTexCoord4svSGIS" },
- { (PROC)glMultiTexCoordPointerSGIS, "glMTexCoordPointerSGIS" },
- { (PROC)glSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)glSelectTextureCoordSetSGIS, "glSelectTextureCoordSetSGIS" },
-*/
- { (PROC)glActiveTextureARB, "glActiveTextureARB" },
- { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" },
- { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" },
- { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" },
- { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" },
- { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" },
- { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" },
- { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" },
- { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" },
- { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" },
- { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" },
- { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" },
- { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" },
- { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" },
- { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" },
- { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" },
- { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" },
- { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" },
- { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" },
- { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" },
- { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" },
- { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" },
- { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" },
- { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" },
- { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" },
- { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" },
- { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" },
- { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" },
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" },
- { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" },
- { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" },
- { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" },
- { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" },
- { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" },
-
- // Descent3 doesn't use correct string, hence this hack
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4f" },
-
- // Quake2 SGIS multitexture
- { (PROC)gldSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)gldMTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)gldMTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
-
- { NULL, "\0" }
-};
-
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX(
- LPCSTR a)
-{
- int i;
- PROC proc = NULL;
-
- for (i=0; GLD_extList[i].proc; i++) {
- if (!strcmp(a, GLD_extList[i].name)) {
- proc = GLD_extList[i].proc;
- break;
- }
- }
-
- if (glb.bMultitexture) {
- for (i=0; GLD_multitexList[i].proc; i++) {
- if (!strcmp(a, GLD_multitexList[i].name)) {
- proc = GLD_multitexList[i].proc;
- break;
- }
- }
- }
-
- gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed");
-
- return proc;
-}
-
-//---------------------------------------------------------------------------
-
-void gldEnableExtensions_DX9(
- GLcontext *ctx)
-{
- GLuint i;
-
- // Mesa enables some extensions by default.
- // This table decides which ones we want to switch off again.
-
- // NOTE: GL_EXT_compiled_vertex_array appears broken.
-
- const char *gld_disable_extensions[] = {
-// "GL_ARB_transpose_matrix",
-// "GL_EXT_compiled_vertex_array",
-// "GL_EXT_polygon_offset",
-// "GL_EXT_rescale_normal",
- "GL_EXT_texture3D",
-// "GL_NV_texgen_reflection",
- NULL
- };
-
- const char *gld_multitex_extensions[] = {
- "GL_ARB_multitexture", // Quake 3
- NULL
- };
-
- // Quake 2 engines
- const char *szGL_SGIS_multitexture = "GL_SGIS_multitexture";
-
- const char *gld_enable_extensions[] = {
- "GL_EXT_texture_env_add", // Quake 3
- "GL_ARB_texture_env_add", // Quake 3
- NULL
- };
-
- for (i=0; gld_disable_extensions[i]; i++) {
- _mesa_disable_extension(ctx, gld_disable_extensions[i]);
- }
-
- for (i=0; gld_enable_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_enable_extensions[i]);
- }
-
- if (glb.bMultitexture) {
- for (i=0; gld_multitex_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_multitex_extensions[i]);
- }
-
- // GL_SGIS_multitexture
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // Fair bit slower on GeForce256,
- // Much slower on 3dfx Voodoo5 5500.
-// _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
- }
-
- _mesa_enable_imaging_extensions(ctx);
- _mesa_enable_1_3_extensions(ctx);
- _mesa_enable_1_4_extensions(ctx);
-}
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c
deleted file mode 100644
index 2b272aa62..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Mesa transformation pipeline with GLDirect fastpath
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-extern struct tnl_pipeline_stage _gld_d3d_render_stage;
-extern struct tnl_pipeline_stage _gld_mesa_render_stage;
-
-static const struct tnl_pipeline_stage *gld_pipeline[] = {
- &_gld_d3d_render_stage, // Direct3D TnL
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage. ??? */
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
- &_gld_mesa_render_stage, // Mesa TnL, D3D rendering
- 0,
-};
-
-//---------------------------------------------------------------------------
-
-void gldInstallPipeline_DX9(
- GLcontext *ctx)
-{
- // Remove any existing pipeline stages,
- // then install GLDirect pipeline stages.
-
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, gld_pipeline);
-}
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
deleted file mode 100644
index 403a9d5f8..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
+++ /dev/null
@@ -1,1446 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Primitive (points/lines/tris/quads) rendering
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "vbo/vbo.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "swrast/s_context.h"
-#include "swrast/s_depth.h"
-#include "swrast/s_lines.h"
-#include "swrast/s_triangle.h"
-#include "swrast/s_trispan.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-// Disable compiler complaints about unreferenced local variables
-#pragma warning (disable:4101)
-
-//---------------------------------------------------------------------------
-// Helper defines for primitives
-//---------------------------------------------------------------------------
-
-//static const float ooZ = 1.0f / 65536.0f; // One over Z
-
-#define GLD_COLOUR (D3DCOLOR_RGBA(swv->color[0], swv->color[1], swv->color[2], swv->color[3]))
-#define GLD_SPECULAR (D3DCOLOR_RGBA(swv->specular[0], swv->specular[1], swv->specular[2], swv->specular[3]))
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-//---------------------------------------------------------------------------
-// 2D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_2D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pPoints; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pLines; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_TRIANGLES \
- BOOL bFog = ctx->Fog.Enabled; \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pTriangles; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour; \
- GLuint facing = 0; \
- struct vertex_buffer *VB; \
- GLchan (*vbcolor)[4]; \
- GLchan (*vbspec)[4]
-
-#define GLD_SETUP_GET_SWVERT(s) \
- swv = &ss->verts[##s]
-
-#define GLD_SETUP_2D_VERTEX \
- pV->x = swv->win[0]; \
- pV->y = GLD_FLIP_Y(swv->win[1]); \
- pV->rhw = swv->win[3]
-
-#define GLD_SETUP_SMOOTH_COLOUR \
- pV->diffuse = GLD_COLOUR
-
-#define GLD_SETUP_GET_FLAT_COLOUR \
- dwFlatColour = GLD_COLOUR
-#define GLD_SETUP_GET_FLAT_FOG_COLOUR \
- dwFlatColour = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_USE_FLAT_COLOUR \
- pV->diffuse = dwFlatColour
-
-#define GLD_SETUP_GET_FLAT_SPECULAR \
- dwSpecularColour= GLD_SPECULAR
-
-#define GLD_SETUP_USE_FLAT_SPECULAR \
- pV->specular = dwSpecularColour
-
-#define GLD_SETUP_DEPTH \
- pV->sz = swv->win[2] / ctx->DepthMaxF
-// pV->z = swv->win[2] * ooZ;
-
-#define GLD_SETUP_SPECULAR \
- pV->specular = GLD_SPECULAR
-
-#define GLD_SETUP_FOG \
- pV->diffuse = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_TEX0 \
- pV->t0_u = swv->texcoord[0][0]; \
- pV->t0_v = swv->texcoord[0][1]
-
-#define GLD_SETUP_TEX1 \
- pV->t1_u = swv->texcoord[1][0]; \
- pV->t1_v = swv->texcoord[1][1]
-
-#define GLD_SETUP_LIGHTING(v) \
- if (facing == 1) { \
- pV->diffuse = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- pV->specular = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- } else { \
- if (bFog) \
- GLD_SETUP_FOG; \
- else \
- GLD_SETUP_SMOOTH_COLOUR; \
- GLD_SETUP_SPECULAR; \
- }
-
-#define GLD_SETUP_GET_FLAT_LIGHTING(v) \
- if (facing == 1) { \
- dwFlatColour = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- dwSpecularColour = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- }
-
-#define GLD_SETUP_TWOSIDED_LIGHTING \
- /* Two-sided lighting */ \
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { \
- SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; \
- SWvertex *v[3]; \
- GLfloat ex,ey,fx,fy,cc; \
- /* Get vars for later */ \
- VB = &TNL_CONTEXT(ctx)->vb; \
- vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \
- if (VB->SecondaryColorPtr[1]) { \
- vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \
- } else { \
- vbspec = NULL; \
- } \
- v[0] = &verts[v0]; \
- v[1] = &verts[v1]; \
- v[2] = &verts[v2]; \
- ex = v[0]->win[0] - v[2]->win[0]; \
- ey = v[0]->win[1] - v[2]->win[1]; \
- fx = v[1]->win[0] - v[2]->win[0]; \
- fy = v[1]->win[1] - v[2]->win[1]; \
- cc = ex*fy - ey*fx; \
- facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; \
- }
-
-//---------------------------------------------------------------------------
-// 3D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_3D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pPoints; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pLines; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_TRIANGLES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pTriangles; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VERTEX(v) \
- p4f = VB->ObjPtr->data; \
- pV->Position.x = p4f[##v][0]; \
- pV->Position.y = p4f[##v][1]; \
- pV->Position.z = p4f[##v][2];
-
-#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-
-#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-#define GLD_SETUP_USE_FLAT_COLOUR_3D \
- pV->Diffuse = dwColor;
-
-#define GLD_SETUP_TEX0_3D(v) \
- if (VB->TexCoordPtr[0]) { \
- tc = VB->TexCoordPtr[0]->data; \
- pV->TexUnit0.x = tc[##v][0]; \
- pV->TexUnit0.y = tc[##v][1]; \
- }
-
-#define GLD_SETUP_TEX1_3D(v) \
- if (VB->TexCoordPtr[1]) { \
- tc = VB->TexCoordPtr[1]->data; \
- pV->TexUnit1.x = tc[##v][0]; \
- pV->TexUnit1.y = tc[##v][1]; \
- }
-
-//---------------------------------------------------------------------------
-// Helper functions
-//---------------------------------------------------------------------------
-
-__inline DWORD _gldComputeFog(
- GLcontext *ctx,
- SWvertex *swv)
-{
- // Full fog calculation.
- // Based on Mesa code.
-
- GLchan rFog, gFog, bFog;
- GLchan fR, fG, fB;
- const GLfloat f = swv->fog;
- const GLfloat g = 1.0 - f;
-
- UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
- fR = f * swv->color[0] + g * rFog;
- fG = f * swv->color[1] + g * gFog;
- fB = f * swv->color[2] + g * bFog;
- return D3DCOLOR_RGBA(fR, fG, fB, swv->color[3]);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ResetLineStipple_DX9(
- GLcontext *ctx)
-{
- // TODO: Fake stipple with a 32x32 texture.
-}
-
-//---------------------------------------------------------------------------
-// 2D (post-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points2D_DX9(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_2D_VARS_POINTS;
-
- unsigned i;
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
- GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- } else {
- GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, swv++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- }
-
- gld->PB2d.pPoints = (BYTE*)pV;
- gld->PB2d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
-
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatExtras_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v2);
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v2);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothExtras_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatExtras_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v3);
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v3);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothExtras_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v3);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// 3D (pre-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points3D_DX9(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_3D_VARS_POINTS
-
- unsigned i;
-// struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
-// GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_3D_VERTEX(VB->Elts[i])
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- } else {
-// GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- }
-/*
- for (i=first; i<last; i++, pV++) {
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
-*/
- gld->PB3d.pPoints = (BYTE*)pV;
- gld->PB3d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-// Line functions
-//---------------------------------------------------------------------------
-
-void gld_Line3DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line3DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-// Triangle functions
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-// Quad functions
-//---------------------------------------------------------------------------
-
-void gld_Quad3DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad3DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_SMOOTH_COLOUR_3D(v3)
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// Vertex setup for two-sided-lighting vertex shader
-//---------------------------------------------------------------------------
-
-/*
-
-void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last)
-{
- // NOTE: Two-sided lighting does not apply to Points
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-*/
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c
deleted file mode 100644
index 5a8223561..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c
+++ /dev/null
@@ -1,2104 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Texture / Bitmap functions
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-#include <d3dx9tex.h>
-
-#include "texformat.h"
-#include "colormac.h"
-#include "texstore.h"
-#include "image.h"
-// #include "mem.h"
-
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_HEIGHT(y,h) (gldCtx->dwHeight - (y) - (h))
-
-//---------------------------------------------------------------------------
-// 1D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + (i) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (i) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (i))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (i))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 2D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + ((t)->Width * (j) + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 3D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz)
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// Direct3D texture formats that have no Mesa equivalent
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format _gld_texformat_X8R8G8B8 = {
- MESA_FORMAT_ARGB8888, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 8, /* RedBits */
- 8, /* GreenBits */
- 8, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 4, /* TexelBytes */
- _mesa_texstore_argb8888, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */
- gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */
- gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X1R5G5B5 = {
- MESA_FORMAT_ARGB1555, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 5, /* RedBits */
- 5, /* GreenBits */
- 5, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb1555, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */
- gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */
- gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X4R4G4B4 = {
- MESA_FORMAT_ARGB4444, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 4, /* RedBits */
- 4, /* GreenBits */
- 4, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb4444, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */
- gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */
- gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */
-};
-
-//---------------------------------------------------------------------------
-// Texture unit constants
-//---------------------------------------------------------------------------
-
-// List of possible combinations of texture environments.
-// Example: GLD_TEXENV_MODULATE_RGBA means
-// GL_MODULATE, GL_RGBA base internal format.
-#define GLD_TEXENV_DECAL_RGB 0
-#define GLD_TEXENV_DECAL_RGBA 1
-#define GLD_TEXENV_DECAL_ALPHA 2
-#define GLD_TEXENV_REPLACE_RGB 3
-#define GLD_TEXENV_REPLACE_RGBA 4
-#define GLD_TEXENV_REPLACE_ALPHA 5
-#define GLD_TEXENV_MODULATE_RGB 6
-#define GLD_TEXENV_MODULATE_RGBA 7
-#define GLD_TEXENV_MODULATE_ALPHA 8
-#define GLD_TEXENV_BLEND_RGB 9
-#define GLD_TEXENV_BLEND_RGBA 10
-#define GLD_TEXENV_BLEND_ALPHA 11
-#define GLD_TEXENV_ADD_RGB 12
-#define GLD_TEXENV_ADD_RGBA 13
-#define GLD_TEXENV_ADD_ALPHA 14
-
-// Per-stage (i.e. per-unit) texture environment
-typedef struct {
- DWORD ColorArg1; // Colour argument 1
- D3DTEXTUREOP ColorOp; // Colour operation
- DWORD ColorArg2; // Colour argument 2
- DWORD AlphaArg1; // Alpha argument 1
- D3DTEXTUREOP AlphaOp; // Alpha operation
- DWORD AlphaArg2; // Alpha argument 2
-} GLD_texenv;
-
-// TODO: Do we really need to set ARG1 and ARG2 every time?
-// They seem to always be TEXTURE and CURRENT respectively.
-
-// C = Colour out
-// A = Alpha out
-// Ct = Colour from Texture
-// Cf = Colour from fragment (diffuse)
-// At = Alpha from Texture
-// Af = Alpha from fragment (diffuse)
-// Cc = GL_TEXTURE_ENV_COLOUR (GL_BLEND)
-const GLD_texenv gldTexEnv[] = {
- // DECAL_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_RGBA: C=Cf(1-At)+CtAt, A=Af
- {D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_ALPHA: <undefined> use DECAL_RGB
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
-
- // REPLACE_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // REPLACE_RGBA: C=Ct, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
- // REPLACE_ALPHA: C=Cf, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
-
- // MODULATE_RGB: C=CfCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // MODULATE_RGBA: C=CfCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // MODULATE_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // BLEND_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // ADD_RGB: C=Cf+Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // ADD_RGBA: C=Cf+Ct, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // ADD_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-};
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREADDRESS _gldConvertWrap(
- GLenum wrap)
-{
- return (wrap == GL_CLAMP) ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREFILTERTYPE _gldConvertMagFilter(
- GLenum magfilter)
-{
- return (magfilter == GL_LINEAR) ? D3DTEXF_LINEAR : D3DTEXF_POINT;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldConvertMinFilter(
- GLenum minfilter,
- D3DTEXTUREFILTERTYPE *min_filter,
- D3DTEXTUREFILTERTYPE *mip_filter)
-{
- switch (minfilter) {
- case GL_NEAREST:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_NONE;
- break;
- case GL_LINEAR:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_POINT;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_POINT;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_LINEAR;
- break;
- }
-}
-
-//---------------------------------------------------------------------------
-
-D3DFORMAT _gldGLFormatToD3DFormat(
- GLenum internalFormat)
-{
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- // LUNIMANCE != INTENSITY, but D3D doesn't have I8 textures
- return D3DFMT_L8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return D3DFMT_L8;
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return D3DFMT_A8;
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return D3DFMT_X8R8G8B8;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return D3DFMT_A8L8;
- case GL_R3_G3_B2:
- // TODO: Mesa does not support RGB332 internally
- return D3DFMT_X4R4G4B4; //D3DFMT_R3G3B2;
- case GL_RGB4:
- return D3DFMT_X4R4G4B4;
- case GL_RGB5:
- return D3DFMT_X1R5G5B5;
- case 3:
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return D3DFMT_R8G8B8;
- case GL_RGBA4:
- return D3DFMT_A4R4G4B4;
- case 4:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return D3DFMT_A8R8G8B8;
- case GL_RGB5_A1:
- return D3DFMT_A1R5G5B5;
- }
-
- // Return an acceptable default
- return D3DFMT_A8R8G8B8;
-}
-
-//---------------------------------------------------------------------------
-
-GLenum _gldDecodeBaseFormat(
- IDirect3DTexture9 *pTex)
-{
- // Examine Direct3D texture and return base OpenGL internal texture format
- // NOTE: We can't use any base format info from Mesa because D3D might have
- // used a different texture format when we used D3DXCreateTexture().
-
- // Base internal format is one of (Red Book p355):
- // GL_ALPHA,
- // GL_LUMINANCE,
- // GL_LUMINANCE_ALPHA,
- // GL_INTENSITY,
- // GL_RGB,
- // GL_RGBA
-
- // NOTE: INTENSITY not used (not supported by Direct3D)
- // LUMINANCE has same texture functions as RGB
- // LUMINANCE_ALPHA has same texture functions as RGBA
-
- // TODO: cache format instead of using GetLevelDesc()
- D3DSURFACE_DESC desc;
- _GLD_DX9_TEX(GetLevelDesc(pTex, 0, &desc));
-
- switch (desc.Format) {
- case D3DFMT_R8G8B8:
- case D3DFMT_X8R8G8B8:
- case D3DFMT_R5G6B5:
- case D3DFMT_X1R5G5B5:
- case D3DFMT_R3G3B2:
- case D3DFMT_X4R4G4B4:
- case D3DFMT_P8:
- case D3DFMT_L8:
- return GL_RGB;
- case D3DFMT_A8R8G8B8:
- case D3DFMT_A1R5G5B5:
- case D3DFMT_A4R4G4B4:
- case D3DFMT_A8R3G3B2:
- case D3DFMT_A8P8:
- case D3DFMT_A8L8:
- case D3DFMT_A4L4:
- return GL_RGBA;
- case D3DFMT_A8:
- return GL_ALPHA;
- // Compressed texture formats. Need to check these...
- case D3DFMT_DXT1:
- return GL_RGBA;
- case D3DFMT_DXT2:
- return GL_RGB;
- case D3DFMT_DXT3:
- return GL_RGBA;
- case D3DFMT_DXT4:
- return GL_RGB;
- case D3DFMT_DXT5:
- return GL_RGBA;
- }
-
- // Fell through. Return arbitary default.
- return GL_RGBA;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* _gldMesaFormatForD3DFormat(
- D3DFORMAT d3dfmt)
-{
- switch (d3dfmt) {
- case D3DFMT_A8R8G8B8:
- return &_mesa_texformat_argb8888;
- case D3DFMT_R8G8B8:
- return &_mesa_texformat_rgb888;
- case D3DFMT_R5G6B5:
- return &_mesa_texformat_rgb565;
- case D3DFMT_A4R4G4B4:
- return &_mesa_texformat_argb4444;
- case D3DFMT_A1R5G5B5:
- return &_mesa_texformat_argb1555;
- case D3DFMT_A8L8:
- return &_mesa_texformat_al88;
- case D3DFMT_R3G3B2:
- return &_mesa_texformat_rgb332;
- case D3DFMT_A8:
- return &_mesa_texformat_a8;
- case D3DFMT_L8:
- return &_mesa_texformat_l8;
- case D3DFMT_X8R8G8B8:
- return &_gld_texformat_X8R8G8B8;
- case D3DFMT_X1R5G5B5:
- return &_gld_texformat_X1R5G5B5;
- case D3DFMT_X4R4G4B4:
- return &_gld_texformat_X4R4G4B4;
- }
-
- // If we reach here then we've made an error somewhere else
- // by allowing a format that is not supported.
- assert(0);
-
- return NULL; // Shut up compiler warning
-}
-
-//---------------------------------------------------------------------------
-// Copy* functions
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage1D_DX9(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y,
- GLsizei width, GLint border )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage2D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLenum internalFormat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage1D_DX9(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage2D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage3D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height )
-{
- // TODO ?
-}
-
-//---------------------------------------------------------------------------
-// Bitmap/Pixel functions
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-#define _GLD_FVF_IMAGE (D3DFVF_XYZRHW | D3DFVF_TEX1)
-
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT z; // depth value
- FLOAT rhw; // reciprocal homogenous W (always 1.0f)
- FLOAT tu, tv; // texture coords
-} _GLD_IMAGE_VERTEX;
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldDrawPixels(
- GLcontext *ctx,
- BOOL bChromakey, // Alpha test for glBitmap() images
- GLint x, // GL x position
- GLint y, // GL y position (needs flipping)
- GLsizei width, // Width of input image
- GLsizei height, // Height of input image
- IDirect3DSurface9 *pImage)
-{
- //
- // Draw input image as texture implementing PixelZoom and clipping.
- // Any fragment operations currently enabled will be used.
- //
-
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTexture;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface9 *pSurface;
- _GLD_IMAGE_VERTEX v[4];
- HRESULT hr;
-
- float ZoomWidth, ZoomHeight;
- float ScaleWidth, ScaleHeight;
-
- // Create a texture to hold image
- hr = D3DXCreateTexture(
- gld->pDev,
- width, height,
- 1, // miplevels
- 0, // usage
- D3DFMT_A8R8G8B8, // format
- D3DPOOL_MANAGED, // pool
- &pTexture);
- if (FAILED(hr))
- return hr;
-
- hr = IDirect3DTexture9_GetSurfaceLevel(pTexture, 0, &pSurface);
- if (FAILED(hr)) {
- IDirect3DTexture9_Release(pTexture);
- return hr;
- }
-
- // Copy image into texture
- hr = D3DXLoadSurfaceFromSurface(
- pSurface, NULL, NULL, // Dest surface
- pImage, NULL, NULL, // Src surface
- D3DX_FILTER_NONE,
- 0);
- IDirect3DSurface9_Release(pSurface);
- if (FAILED(hr)) {
- IDirect3DTexture9_Release(pTexture);
- return hr;
- }
-
- //
- // Set up the quad like this (ascii-art ahead!)
- //
- // 3--2
- // | |
- // 0--1
- //
- //
-
- // Set depth
- v[0].z = v[1].z = v[2].z = v[3].z = ctx->Current.RasterPos[2];
- // Set Reciprocal Homogenous W
- v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw = 1.0f;
-
- // Set texcoords
- // Examine texture size - if different to input width and height
- // then we'll need to munge the texcoords to fit.
- IDirect3DTexture9_GetLevelDesc(pTexture, 0, &d3dsd);
- ScaleWidth = (float)width / (float)d3dsd.Width;
- ScaleHeight = (float)height / (float)d3dsd.Height;
- v[0].tu = 0.0f; v[0].tv = 0.0f;
- v[1].tu = ScaleWidth; v[1].tv = 0.0f;
- v[2].tu = ScaleWidth; v[2].tv = ScaleHeight;
- v[3].tu = 0.0f; v[3].tv = ScaleHeight;
-
- // Set raster positions
- ZoomWidth = (float)width * ctx->Pixel.ZoomX;
- ZoomHeight = (float)height * ctx->Pixel.ZoomY;
-
- v[0].x = x; v[0].y = GLD_FLIP_Y(y);
- v[1].x = x+ZoomWidth; v[1].y = GLD_FLIP_Y(y);
- v[2].x = x+ZoomWidth; v[2].y = GLD_FLIP_Y(y+ZoomHeight);
- v[3].x = x; v[3].y = GLD_FLIP_Y(y+ZoomHeight);
-
- // Draw image with full HW acceleration
- // NOTE: Be nice to use a State Block for all this state...
- IDirect3DDevice9_SetTexture(gld->pDev, 0, pTexture);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE);
-
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_MINFILTER, D3DTEXF_POINT);
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_MIPFILTER, D3DTEXF_POINT);
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_MAGFILTER, D3DTEXF_POINT);
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
-
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
-
- IDirect3DDevice9_SetVertexShader(gld->pDev, NULL);
- IDirect3DDevice9_SetFVF(gld->pDev, _GLD_FVF_IMAGE);
-
- //
- // Emulate Chromakey with an Alpha Test.
- // [Alpha Test is more widely supported anyway]
- //
- if (bChromakey) {
- // Switch on alpha testing
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, TRUE);
- // Fragment passes is alpha is greater than reference value
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, D3DCMP_GREATER);
- // Set alpha reference value between Bitmap alpha values of
- // zero (transparent) and one (opaque).
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ALPHAREF, 0x7f);
- }
-
- IDirect3DDevice9_DrawPrimitiveUP(gld->pDev, D3DPT_TRIANGLEFAN, 2, &v, sizeof(_GLD_IMAGE_VERTEX));
-
- // Release texture
- IDirect3DDevice9_SetTexture(gld->pDev, 0, NULL);
- IDirect3DTexture9_Release(pTexture);
-
- // Reset state to before we messed it up
- FLUSH_VERTICES(ctx, _NEW_ALL);
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DrawPixels_DX9(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- GLD_context *gldCtx;
- GLD_driver_dx9 *gld;
-
- IDirect3DSurface9 *pImage;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
-
- const struct gl_texture_format *MesaFormat;
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
-
- // Mesa does not currently handle this format.
- if (format == GL_BGR)
- return;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- D3DPOOL_SCRATCH,
- &pImage,
- NULL);
- if (FAILED(hr)) {
- return;
- }
-
- //
- // Use Mesa to fill in image
- //
-
- // Lock all of surface
- hr = IDirect3DSurface9_LockRect(pImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pImage);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA,
- &_mesa_texformat_argb8888,
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, /* dstImageStride */
- format, type, pixels, unpack);
-
- IDirect3DSurface9_UnlockRect(pImage);
-
- _gldDrawPixels(ctx, FALSE, x, y, width, height, pImage);
-
- IDirect3DSurface9_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ReadPixels_DX9(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *dest)
-{
-
- GLD_context *gldCtx;
- GLD_driver_dx9 *gld;
-
- IDirect3DSurface9 *pBackbuffer = NULL;
- IDirect3DSurface9 *pNativeImage = NULL;
- IDirect3DSurface9 *pCanonicalImage = NULL;
-
- D3DSURFACE_DESC d3dsd;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- struct gl_pixelstore_attrib srcPacking;
- int i;
- GLint DstRowStride;
- const struct gl_texture_format *MesaFormat;
-
- switch (format) {
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- return;
- }
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
- DstRowStride = _mesa_image_row_stride(pack, width, format, type);
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice9_GetBackBuffer(
- gld->pDev,
- 0, // First swapchain
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface9_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- D3DPOOL_SCRATCH,
- &pNativeImage,
- NULL);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, x, GLD_FLIP_HEIGHT(y, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels.
- //
- // This intermediate surface ensure that we can use CopyRects()
- // instead of relying on D3DXLoadSurfaceFromSurface(), which may
- // try and lock the backbuffer. This way seems safer.
- //
- // CopyRects has been removed for DX9.
- //
-/* hr = IDirect3DDevice9_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pNativeImage,
- &ptDst);*/
- hr = D3DXLoadSurfaceFromSurface(
- pNativeImage, // Dest surface
- NULL, // Dest palette
- &rcSrc, // Dest rect
- pBackbuffer, // Src surface
- NULL, // Src palette
- &rcSrc, // Src rect
- D3DX_FILTER_NONE, // Filter
- 0 // Colorkey (0=no colorkey)
- );
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // Create an RGBA8888 surface
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- D3DPOOL_SCRATCH,
- &pCanonicalImage,
- NULL);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // Convert to RGBA8888
- hr = D3DXLoadSurfaceFromSurface(
- pCanonicalImage, // Dest surface
- NULL, NULL, // Dest palette, RECT
- pNativeImage, // Src surface
- NULL, NULL, // Src palette, RECT
- D3DX_FILTER_NONE, // Filter
- 0); // Colourkey
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- srcPacking.Alignment = 1;
- srcPacking.ImageHeight = height;
- srcPacking.LsbFirst = GL_FALSE;
- srcPacking.RowLength = 0;
- srcPacking.SkipImages = 0;
- srcPacking.SkipPixels = 0;
- srcPacking.SkipRows = 0;
- srcPacking.SwapBytes = GL_FALSE;
-
- // Lock all of image
- hr = IDirect3DSurface9_LockRect(pCanonicalImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // We need to flip the data. Yuck.
- // Perhaps Mesa has a span packer we can use in future...
- for (i=0; i<height; i++) {
- BYTE *pDestRow = (BYTE*)_mesa_image_address(2,pack, dest, width, height, format, type, 0, i, 0);
- BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1));
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA, // base format
- MesaFormat, // dst format
- pDestRow, // dest addr
- width, 1, 1, 0, 0, 0, // src x,y,z & dst offsets x,y,z
- DstRowStride, // dst row stride
- 0, // dstImageStride
- GL_BGRA, // src format
- GL_UNSIGNED_BYTE, // src type
- pSrcRow, // src addr
- &srcPacking); // packing params of source image
- }
-
- IDirect3DSurface9_UnlockRect(pCanonicalImage);
-
-gld_ReadPixels_DX9_return:
- SAFE_RELEASE_SURFACE9(pCanonicalImage);
- SAFE_RELEASE_SURFACE9(pNativeImage);
- SAFE_RELEASE_SURFACE9(pBackbuffer);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_CopyPixels_DX9(
- GLcontext *ctx,
- GLint srcx,
- GLint srcy,
- GLsizei width,
- GLsizei height,
- GLint dstx,
- GLint dsty,
- GLenum type)
-{
- //
- // NOTE: Not allowed to copy vidmem to vidmem!
- // Therefore we use an intermediate image surface.
- //
-
- GLD_context *gldCtx;
- GLD_driver_dx9 *gld;
-
- IDirect3DSurface9 *pBackbuffer;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface9 *pImage;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
-
- // Only backbuffer
- if (type != GL_COLOR)
- return;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice9_GetBackBuffer(
- gld->pDev,
- 0, // First swapchain
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface9_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pBackbuffer);
- return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- D3DPOOL_SCRATCH,
- &pImage,
- NULL);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pBackbuffer);
- return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, srcx, GLD_FLIP_HEIGHT(srcy, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels
-/* hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pImage,
- &ptDst);*/
- hr = D3DXLoadSurfaceFromSurface(
- pImage, // Dest surface
- NULL, // Dest palette
- &rcSrc, // Dest rect
- pBackbuffer, // Src surface
- NULL, // Src palette
- &rcSrc, // Src rect
- D3DX_FILTER_NONE, // Filter
- 0 // Colorkey (0=no colorkey)
- );
- IDirect3DSurface9_Release(pBackbuffer);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pImage);
- return;
- }
-
- _gldDrawPixels(ctx, FALSE, dstx, dsty, width, height, pImage);
-
- IDirect3DSurface9_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Bitmap_DX9(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- GLD_context *gldCtx;
- GLD_driver_dx9 *gld;
-
- IDirect3DSurface9 *pImage;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- BYTE *pTempBitmap;
- D3DCOLOR clBitmapOne, clBitmapZero;
- D3DCOLOR *pBits;
- const GLubyte *src;
- int i, j, k;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // A NULL bitmap is valid, but merely advances the raster position
- if ((bitmap == NULL) || (width == 0) || (height == 0))
- return;
-
- clBitmapZero = D3DCOLOR_RGBA(0,0,0,0); // NOTE: Alpha is Zero
- clBitmapOne = D3DCOLOR_COLORVALUE(
- ctx->Current.RasterColor[0],
- ctx->Current.RasterColor[1],
- ctx->Current.RasterColor[2],
- 1.0f); // NOTE: Alpha is One
-
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- D3DPOOL_SCRATCH,
- &pImage,
- NULL);
- if (FAILED(hr)) {
- return;
- }
-
- // Lock all of surface
- hr = IDirect3DSurface9_LockRect(pImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pImage);
- return;
- }
-
- pTempBitmap = _mesa_unpack_bitmap(width, height, bitmap, unpack);
- if (pTempBitmap == NULL) {
- IDirect3DSurface9_Release(pImage);
- return;
- }
-
- pBits = (D3DCOLOR*)d3dLockedRect.pBits;
-
- for (i=0; i<height; i++) {
- GLubyte byte;
- pBits = (D3DCOLOR*)((BYTE*)d3dLockedRect.pBits + (i*d3dLockedRect.Pitch));
- src = (const GLubyte *) _mesa_image_address(2,
- &ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP,
- 0, i, 0);
- for (j=0; j<(width>>3); j++) {
- byte = *src++;
- for (k=0; k<8; k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- // Fill remaining bits from bitmap
- if (width & 7) {
- byte = *src;
- for (k=0; k<(width & 7); k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- }
-
- FREE(pTempBitmap);
-
-/*
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- GL_BITMAP,
- &_mesa_texformat_argb8888,
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- GL_BITMAP, GL_COLOR_INDEX, bitmap, unpack);
-*/
- IDirect3DSurface9_UnlockRect(pImage);
-
- _gldDrawPixels(ctx, TRUE, x, y, width, height, pImage);
-
- IDirect3DSurface9_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-// Texture functions
-//---------------------------------------------------------------------------
-
-void _gldAllocateTexture(
- GLcontext *ctx,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTex;
- D3DFORMAT d3dFormat;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (pTex) {
- // Decide whether we can keep existing D3D texture
- // by examining top-level surface.
- D3DSURFACE_DESC d3dsd;
- _GLD_DX9_TEX(GetLevelDesc(pTex, 0, &d3dsd));
- // Release existing texture if not compatible
- if ((d3dsd.Width == texImage->Width) ||
- (d3dsd.Height == texImage->Height))
- {
- return; // Keep the existing texture
- }
- tObj->DriverData = NULL;
- _GLD_DX9_TEX(Release(pTex));
- }
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->IntFormat);
- D3DXCreateTexture(
- gld->pDev,
- texImage->Width,
- texImage->Height,
- // TODO: Re-evaluate mipmapping
- (glb.bUseMipmaps) ? D3DX_DEFAULT : 1,
- 0, // Usage
- d3dFormat,
- D3DPOOL_MANAGED,
- &pTex);
- tObj->DriverData = pTex;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* gld_ChooseTextureFormat_DX9(
- GLcontext *ctx,
- GLint internalFormat,
- GLenum srcFormat,
- GLenum srcType)
-{
- // [Based on mesa_choose_tex_format()]
- //
- // We will choose only texture formats that are supported
- // by Direct3D. If the hardware doesn't support a particular
- // texture format, then the D3DX texture calls that we use
- // will automatically use a HW supported format.
- //
- // The most critical aim is to reduce copying; if we can use
- // texture-image data directly then it will be a big performance assist.
- //
-
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_a8; // D3DFMT_A8
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_rgb565; // D3DFMT_R5G6B5
- // Mesa will convert this for us later...
- // return &_mesa_texformat_ci8; // D3DFMT_R5G6B5
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_al88; // D3DFMT_A8L8
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb332; // D3DFMT_R3G3B2
- case GL_RGB4:
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444; // D3DFMT_A4R4G4B4
- case 3:
- case GL_RGB:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_rgb565;
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb8888;
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
- default:
- _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
- return NULL;
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
-// Safer(?), slower version.
-void gld_TexImage2D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTex;
- IDirect3DSurface9 *pSurface;
- RECT rcSrcRect;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
-
- if (!tObj || !texImage)
- return;
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture9_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture9_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface9_Release(pSurface);
- return;
- }
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- SetRect(&rcSrcRect, 0, 0, width, height);
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- NULL,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface9_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexImage2D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTex;
- IDirect3DSurface9 *pSurface;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- D3DSURFACE_DESC d3dsd;
-
- if (!tObj || !texImage)
- return;
-
- // GLQUAKE FIX
- // Test for input alpha data with non-alpha internalformat
- if (((internalFormat==3) || (internalFormat==GL_RGB)) && (format==GL_RGBA)) {
- // Input format has alpha, but a non-alpha format has been requested.
- texImage->IntFormat = GL_RGBA;
- internalFormat = GL_RGBA;
- }
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture9_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture9_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- IDirect3DSurface9_GetDesc(pSurface, &d3dsd);
-
- // Lock all of surface
- hr = IDirect3DSurface9_LockRect(pSurface, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- texImage->Format,
- _gldMesaFormatForD3DFormat(d3dsd.Format),
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- IDirect3DSurface9_UnlockRect(pSurface);
- IDirect3DSurface9_Release(pSurface);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- // A 1D texture is a 2D texture with a height of zero
- gld_TexImage2D_DX9(ctx, target, level, internalFormat, width, 1, border, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-/*
-void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_GET_CONTEXT
- IDirect3DTexture9 *pTex;
- IDirect3DSurface9 *pSurface;
- D3DFORMAT d3dFormat;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
- RECT rcSrcRect;
- RECT rcDstRect;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= _GLD_DX9_TEX(GetLevelCount(pTex))
- return; // Level does not exist
- hr = _GLD_DX9_TEX(GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->Format);
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface9_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- // Source rectangle is whole of input image
- SetRect(&rcSrcRect, 0, 0, width, height);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- &rcDstRect,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface9_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTex;
- IDirect3DSurface9 *pSurface;
- HRESULT hr;
- RECT rcDstRect;
- D3DLOCKED_RECT d3dLockedRect;
- D3DSURFACE_DESC d3dsd;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture9_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture9_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- IDirect3DSurface9_GetDesc(pSurface, &d3dsd);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- // Lock sub-rect of surface
- hr = IDirect3DSurface9_LockRect(pSurface, &d3dLockedRect, &rcDstRect, 0);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- _gldMesaFormatForD3DFormat(d3dsd.Format),
- d3dLockedRect.pBits,
- width, height, 1,
- 0, 0, 0, // NOTE: d3dLockedRect.pBits is already offset!!!
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
-
- IDirect3DSurface9_UnlockRect(pSurface);
- IDirect3DSurface9_Release(pSurface);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexSubImage1D_DX9( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gld_TexSubImage2D_DX9(ctx, target, level, xoffset, 0, width, 1, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DeleteTexture_DX9(
- GLcontext *ctx,
- struct gl_texture_object *tObj)
-{
- GLD_context *gld = (GLD_context*)(ctx->DriverCtx);
-
- if (tObj) {
- IDirect3DTexture9 *pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (pTex) {
-/* // Make sure texture is not bound to a stage before releasing it
- for (int i=0; i<MAX_TEXTURE_UNITS; i++) {
- if (gld->CurrentTexture[i] == pTex) {
- gld->pDev->SetTexture(i, NULL);
- gld->CurrentTexture[i] = NULL;
- }
- }*/
- _GLD_DX9_TEX(Release(pTex));
- tObj->DriverData = NULL;
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetColorOps(
- const GLD_driver_dx9 *gld,
- GLuint unit,
- DWORD ColorArg1,
- D3DTEXTUREOP ColorOp,
- DWORD ColorArg2)
-{
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG1, ColorArg1));
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLOROP, ColorOp));
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG2, ColorArg2));
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetAlphaOps(
- const GLD_driver_dx9 *gld,
- GLuint unit,
- DWORD AlphaArg1,
- D3DTEXTUREOP AlphaOp,
- DWORD AlphaArg2)
-{
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG1, AlphaArg1));
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAOP, AlphaOp));
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG2, AlphaArg2));
-}
-
-//---------------------------------------------------------------------------
-
-void gldUpdateTextureUnit(
- GLcontext *ctx,
- GLuint unit,
- BOOL bPassThrough)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DTEXTUREFILTERTYPE minfilter;
- D3DTEXTUREFILTERTYPE mipfilter;
- GLenum BaseFormat;
- DWORD dwColorArg0;
- int iTexEnv = 0;
- GLD_texenv *pTexenv;
-
- // NOTE: If bPassThrough is FALSE then texture stage can be
- // disabled otherwise it must pass-through it's current fragment.
-
- const struct gl_texture_unit *pUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = pUnit->_Current;
-
- IDirect3DTexture9 *pTex = NULL;
- if (tObj) {
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- }
-
- // Enable texturing if unit is enabled and a valid D3D texture exists
- // Mesa 5: TEXTUREn_x altered to TEXTURE_nD_BIT
- //if (pTex && (pUnit->Enabled & (TEXTURE0_1D | TEXTURE0_2D))) {
- if (pTex && (pUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT))) {
- // Enable texturing
- _GLD_DX9_DEV(SetTexture(gld->pDev, unit, pTex));
- } else {
- // Disable texturing, then return
- _GLD_DX9_DEV(SetTexture(gld->pDev, unit, NULL));
- if (bPassThrough) {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- } else {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- }
- return;
- }
-
- // Texture parameters
- _gldConvertMinFilter(tObj->MinFilter, &minfilter, &mipfilter);
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MINFILTER, minfilter));
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MIPFILTER, mipfilter));
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter)));
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSU, _gldConvertWrap(tObj->WrapS)));
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSV, _gldConvertWrap(tObj->WrapT)));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_MINFILTER, minfilter));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_MIPFILTER, mipfilter));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter)));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_ADDRESSU, _gldConvertWrap(tObj->WrapS)));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_ADDRESSV, _gldConvertWrap(tObj->WrapT)));
-
- // Texture priority
- _GLD_DX9_TEX(SetPriority(pTex, (DWORD)(tObj->Priority*65535.0f)));
-
- // Texture environment
- // TODO: Examine input texture for alpha and use specific alpha/non-alpha ops.
- // See Page 355 of the Red Book.
- BaseFormat = _gldDecodeBaseFormat(pTex);
-
- switch (BaseFormat) {
- case GL_RGB:
- iTexEnv = 0;
- break;
- case GL_RGBA:
- iTexEnv = 1;
- break;
- case GL_ALPHA:
- iTexEnv = 2;
- break;
- }
-
- switch (pUnit->EnvMode) {
- case GL_DECAL:
- iTexEnv += 0;
- break;
- case GL_REPLACE:
- iTexEnv += 3;
- break;
- case GL_MODULATE:
- iTexEnv += 6;
- break;
- case GL_BLEND:
- // Set blend colour
- dwColorArg0 = D3DCOLOR_COLORVALUE(pUnit->EnvColor[0], pUnit->EnvColor[1], pUnit->EnvColor[2], pUnit->EnvColor[3]);
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG0, dwColorArg0));
- iTexEnv += 9;
- break;
- case GL_ADD:
- iTexEnv += 12;
- break;
- }
- pTexenv = (GLD_texenv*)&gldTexEnv[iTexEnv];
- _gldSetColorOps(gld, unit, pTexenv->ColorArg1, pTexenv->ColorOp, pTexenv->ColorArg2);
- _gldSetAlphaOps(gld, unit, pTexenv->AlphaArg1, pTexenv->AlphaOp, pTexenv->AlphaArg2);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_TEXTURE_DX9(
- GLcontext *ctx)
-{
- // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units
-
- BOOL bUnit0Enabled;
- BOOL bUnit1Enabled;
-
- if (!ctx)
- return; // Sanity check
-
- if (ctx->Const.MaxTextureUnits == 1) {
- gldUpdateTextureUnit(ctx, 0, TRUE);
- return;
- }
-
- //
- // NOTE: THE FOLLOWING RELATES TO TWO TEXTURE UNITS, AND TWO ONLY!!
- //
-
- // Mesa 5: Texture Units altered
- //bUnit0Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE0_1D | TEXTURE0_2D)) ? TRUE : FALSE;
- //bUnit1Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE1_1D | TEXTURE1_2D)) ? TRUE : FALSE;
- bUnit0Enabled = (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
- bUnit1Enabled = (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
-
- // If Unit0 is disabled and Unit1 is enabled then we must pass-though
- gldUpdateTextureUnit(ctx, 0, (!bUnit0Enabled && bUnit1Enabled) ? TRUE : FALSE);
- // We can always disable the last texture unit
- gldUpdateTextureUnit(ctx, 1, FALSE);
-
-#ifdef _DEBUG
-#if 0
- {
- // Find out whether device supports current renderstates
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-// GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- DWORD dwPasses;
- _GLD_DX9_DEV(ValidateDevice(gld->pDev, &dwPasses));
-// if (FAILED(hr)) {
-// gldLogError(GLDLOG_ERROR, "ValidateDevice failed", hr);
-// }
- if (dwPasses != 1) {
- gldLogMessage(GLDLOG_ERROR, "ValidateDevice: Can't do in one pass\n");
- }
- }
-#endif
-#endif
-};
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c
deleted file mode 100644
index 4fa6bcaf1..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect fastpath pipeline stage
-*
-****************************************************************************/
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetVertexShaderConstants(
- GLcontext *ctx,
- GLD_driver_dx9 *gld)
-{
- D3DXMATRIX mat, matView, matProj;
- GLfloat *pM;
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ModelView.m;
- pM = ctx->ModelviewMatrixStack.Top->m;
- matView._11 = pM[0];
- matView._12 = pM[1];
- matView._13 = pM[2];
- matView._14 = pM[3];
- matView._21 = pM[4];
- matView._22 = pM[5];
- matView._23 = pM[6];
- matView._24 = pM[7];
- matView._31 = pM[8];
- matView._32 = pM[9];
- matView._33 = pM[10];
- matView._34 = pM[11];
- matView._41 = pM[12];
- matView._42 = pM[13];
- matView._43 = pM[14];
- matView._44 = pM[15];
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ProjectionMatrix.m;
- pM = ctx->ProjectionMatrixStack.Top->m;
- matProj._11 = pM[0];
- matProj._12 = pM[1];
- matProj._13 = pM[2];
- matProj._14 = pM[3];
- matProj._21 = pM[4];
- matProj._22 = pM[5];
- matProj._23 = pM[6];
- matProj._24 = pM[7];
- matProj._31 = pM[8];
- matProj._32 = pM[9];
- matProj._33 = pM[10];
- matProj._34 = pM[11];
- matProj._41 = pM[12];
- matProj._42 = pM[13];
- matProj._43 = pM[14];
- matProj._44 = pM[15];
-
- D3DXMatrixMultiply( &mat, &matView, &matProj );
- D3DXMatrixTranspose( &mat, &mat );
-
- _GLD_DX9_DEV(SetVertexShaderConstantF(gld->pDev, 0, (float*)&mat, 4));
-}
-
-//---------------------------------------------------------------------------
-
-static GLboolean gld_d3d_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- TNLcontext *tnl;
- struct vertex_buffer *VB;
- tnl_render_func *tab;
- GLint pass;
- GLD_pb_dx9 *gldPB = &gld->PB3d;
-/*
- static int count = 0;
- count++;
- if (count != 2)
- return GL_FALSE;
-*/
- // The "check" function should disable this stage,
- // but we'll test gld->bUseMesaTnL anyway.
- if (gld->bUseMesaTnL) {
- // Do nothing in this stage, but continue pipeline
- return GL_TRUE;
- }
-
- tnl = TNL_CONTEXT(ctx);
- VB = &tnl->vb;
- pass = 0;
-
- tnl->Driver.Render.Start( ctx );
-
-#if 0
- // For debugging: Useful to see if an app passes colour data in
- // an unusual format.
- switch (VB->ColorPtr[0]->Type) {
- case GL_FLOAT:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n");
- break;
- case GL_UNSIGNED_BYTE:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_UNSIGNED_BYTE\n");
- break;
- default:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: *?*\n");
- break;
- }
-#endif
-
- tnl->Driver.Render.Points = gld_Points3D_DX9;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line3DFlat_DX9;
- tnl->Driver.Render.Triangle = gld_Triangle3DFlat_DX9;
- tnl->Driver.Render.Quad = gld_Quad3DFlat_DX9;
- } else {
- tnl->Driver.Render.Line = gld_Line3DSmooth_DX9;
- tnl->Driver.Render.Triangle = gld_Triangle3DSmooth_DX9;
- tnl->Driver.Render.Quad = gld_Quad3DSmooth_DX9;
- }
-
- _GLD_DX9_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts);
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length)
- {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
- _GLD_DX9_VB(Unlock(gldPB->pVB));
-
- _GLD_DX9_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, 0, gldPB->dwStride));
-
- _GLD_DX9_DEV(SetTransform(gld->pDev, D3DTS_PROJECTION, &gld->matProjection));
- _GLD_DX9_DEV(SetTransform(gld->pDev, D3DTS_WORLD, &gld->matModelView));
-
- if (gldPB->nPoints) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_d3d_render_stage_check(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- // Is this thread safe?
- stage->active = (gld->bUseMesaTnL) ? GL_FALSE : GL_TRUE;
- return;
-}
-
-
-//---------------------------------------------------------------------------
-
-const struct tnl_pipeline_stage _gld_d3d_render_stage =
-{
- "gld_d3d_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- gld_d3d_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c
deleted file mode 100644
index 64acab2d2..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c
+++ /dev/null
@@ -1,443 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keithw@valinux.com>
- */
-
-
-/*
- * Render whole vertex buffers, including projection of vertices from
- * clip space and clipping of primitives.
- *
- * This file makes calls to project vertices and to the point, line
- * and triangle rasterizers via the function pointers:
- *
- * context->Driver.Render.*
- *
- */
-
-
-//---------------------------------------------------------------------------
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-/**********************************************************************/
-/* Clip single primitives */
-/**********************************************************************/
-
-
-#if defined(USE_IEEE)
-#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
-//#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
-#else
-#define NEGATIVE(x) (x < 0)
-//#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0)
-/* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
-#endif
-
-
-#define W(i) coord[i][3]
-#define Z(i) coord[i][2]
-#define Y(i) coord[i][1]
-#define X(i) coord[i][0]
-#define SIZE 4
-#define TAG(x) x##_4
-#include "tnl/t_vb_cliptmp.h"
-
-
-
-/**********************************************************************/
-/* Clip and render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, with the possibility of clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte ormask = c1|c2; \
- if (!ormask) \
- LineFunc( ctx, v1, v2 ); \
- else if (!(c1 & c2 & 0x3f)) \
- clip_line_4( ctx, v1, v2, ormask ); \
-} while (0)
-
-#define RENDER_TRI( v1, v2, v3 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \
- GLubyte ormask = c1|c2|c3; \
- if (!ormask) \
- TriangleFunc( ctx, v1, v2, v3 ); \
- else if (!(c1 & c2 & c3 & 0x3f)) \
- clip_tri_4( ctx, v1, v2, v3, ormask ); \
-} while (0)
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte c3 = mask[v3], c4 = mask[v4]; \
- GLubyte ormask = c1|c2|c3|c4; \
- if (!ormask) \
- QuadFunc( ctx, v1, v2, v3, v4 ); \
- else if (!(c1 & c2 & c3 & c4 & 0x3f)) \
- clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \
-} while (0)
-
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const GLubyte *mask = VB->ClipMask; \
- const GLuint sz = VB->ClipPtr->size; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt; (void) mask; (void) sz; (void) stipple;
-
-#define TAG(x) clip_##x##_verts
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/* Elts, with the possibility of clipping.
- */
-#undef ELT
-#undef TAG
-#define ELT(x) elt[x]
-#define TAG(x) clip_##x##_elts
-#include "tnl/t_vb_rendertmp.h"
-
-/* TODO: do this for all primitives, verts and elts:
- */
-static void clip_elt_triangles( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES];
- struct vertex_buffer *VB = &tnl->vb;
- const GLuint * const elt = VB->Elts;
- GLubyte *mask = VB->ClipMask;
- GLuint last = count-2;
- GLuint j;
- (void) flags;
-
- tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES );
-
- for (j=start; j < last; j+=3 ) {
- GLubyte c1 = mask[elt[j]];
- GLubyte c2 = mask[elt[j+1]];
- GLubyte c3 = mask[elt[j+2]];
- GLubyte ormask = c1|c2|c3;
- if (ormask) {
- if (start < j)
- render_tris( ctx, start, j, 0 );
- if (!(c1&c2&c3&0x3f))
- clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask );
- start = j+3;
- }
- }
-
- if (start < j)
- render_tris( ctx, start, j, 0 );
-}
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, no clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
- LineFunc( ctx, v1, v2 )
-
-#define RENDER_TRI( v1, v2, v3 ) \
- TriangleFunc( ctx, v1, v2, v3 )
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
- QuadFunc( ctx, v1, v2, v3, v4 )
-
-#define TAG(x) _gld_tnl_##x##_verts
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt;
-
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RENDER_TAB_QUALIFIER
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-/* Elts, no clipping.
- */
-#undef ELT
-#define TAG(x) _gld_tnl_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Helper functions for drivers */
-/**********************************************************************/
-/*
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint *tmp = VB->Elts;
-
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
-}
-
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-*/
-
-
-/**********************************************************************/
-/* Clip and render whole vertex buffers */
-/**********************************************************************/
-
-tnl_points_func _gldSetupPoints[4] = {
- gld_Points2D_DX9,
- gld_Points2D_DX9,
- gld_Points2D_DX9,
- gld_Points2D_DX9
-};
-tnl_line_func _gldSetupLine[4] = {
- gld_Line2DFlat_DX9,
- gld_Line2DSmooth_DX9,
- gld_Line2DFlat_DX9,
- gld_Line2DSmooth_DX9,
-};
-tnl_triangle_func _gldSetupTriangle[4] = {
- gld_Triangle2DFlat_DX9,
- gld_Triangle2DSmooth_DX9,
- gld_Triangle2DFlatExtras_DX9,
- gld_Triangle2DSmoothExtras_DX9
-};
-tnl_quad_func _gldSetupQuad[4] = {
- gld_Quad2DFlat_DX9,
- gld_Quad2DSmooth_DX9,
- gld_Quad2DFlatExtras_DX9,
- gld_Quad2DSmoothExtras_DX9
-};
-
-//---------------------------------------------------------------------------
-
-static GLboolean _gld_mesa_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- tnl_render_func *tab;
- GLint pass = 0;
- GLD_pb_dx9 *gldPB;
-
- /* Allow the drivers to lock before projected verts are built so
- * that window coordinates are guarenteed not to change before
- * rendering.
- */
- ASSERT(tnl->Driver.Render.Start);
-
- tnl->Driver.Render.Start( ctx );
-
- // NOTE: Setting D3DRS_SOFTWAREVERTEXPROCESSING for a mixed-mode device resets
- // stream, indices and shader to default values of NULL or 0.
-/* if ((ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) &&
- gld->VStwosidelight.hShader &&
- !ctx->Fog.Enabled)
- {
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware);
- _GLD_DX9_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
- gldPB = &gld->PBtwosidelight;
- tnl->Driver.Render.Points = gld_Points2DTwoside_DX9;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line2DFlatTwoside_DX9;
- tnl->Driver.Render.Triangle = gld_Triangle2DFlatTwoside_DX9;
- tnl->Driver.Render.Quad = gld_Quad2DFlatTwoside_DX9;
- } else {
- tnl->Driver.Render.Line = gld_Line2DSmoothTwoside_DX9;
- tnl->Driver.Render.Triangle = gld_Triangle2DSmoothTwoside_DX9;
- tnl->Driver.Render.Quad = gld_Quad2DSmoothTwoside_DX9;
- }
- } else {*/
-// IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, TRUE);
- IDirect3DDevice9_SetSoftwareVertexProcessing(gld->pDev, TRUE);
- gldPB = &gld->PB2d;
- _GLD_DX9_DEV(SetVertexShader(gld->pDev, NULL));
- _GLD_DX9_DEV(SetFVF(gld->pDev, gldPB->dwFVF));
- tnl->Driver.Render.Points = _gldSetupPoints[gld->iSetupFunc];
- tnl->Driver.Render.Line = _gldSetupLine[gld->iSetupFunc];
- tnl->Driver.Render.Triangle = _gldSetupTriangle[gld->iSetupFunc];
- tnl->Driver.Render.Quad = _gldSetupQuad[gld->iSetupFunc];
-// }
-
- _GLD_DX9_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 );
-
- if (VB->ClipOrMask) {
- tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
- clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles;
- }
- else {
- tab = (VB->Elts ?
- tnl->Driver.Render.PrimTabElts :
- tnl->Driver.Render.PrimTabVerts);
- }
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length) {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
-
-// tnl->Driver.Render.Finish( ctx );
-
- _GLD_DX9_VB(Unlock(gldPB->pVB));
-
- _GLD_DX9_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, 0, gldPB->dwStride));
-
- if (gldPB->nPoints) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-
-
-const struct tnl_pipeline_stage _gld_mesa_render_stage =
-{
- "gld_mesa_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- _gld_mesa_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c b/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c
deleted file mode 100644
index a03b865bb..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c
+++ /dev/null
@@ -1,1346 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 8.x WGL (WindowsGL)
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "gld_driver.h"
-#include "gld_dxerr9.h"
-#include "gld_dx9.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-// Copied from dglcontect.c
-#define GLDERR_NONE 0
-#define GLDERR_MEM 1
-#define GLDERR_DDRAW 2
-#define GLDERR_D3D 3
-#define GLDERR_BPP 4
-#define GLDERR_DDS 5
-// This external var keeps track of any error
-extern int nContextError;
-
-#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL
-
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
-
-//---------------------------------------------------------------------------
-
-static char szColorDepthWarning[] =
-"GLDirect does not support the current desktop\n\
-color depth.\n\n\
-You may need to change the display resolution to\n\
-16 bits per pixel or higher color depth using\n\
-the Windows Display Settings control panel\n\
-before running this OpenGL application.\n";
-
-// The only depth-stencil formats currently supported by Direct3D
-// Surface Format Depth Stencil Total Bits
-// D3DFMT_D32 32 - 32
-// D3DFMT_D15S1 15 1 16
-// D3DFMT_D24S8 24 8 32
-// D3DFMT_D16 16 - 16
-// D3DFMT_D24X8 24 - 32
-// D3DFMT_D24X4S4 24 4 32
-
-// This pixel format will be used as a template when compiling the list
-// of pixel formats supported by the hardware. Many fields will be
-// filled in at runtime.
-// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM
-static DGL_pixelFormat pfTemplateHW =
-{
- {
- sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure
- 1, // Structure version - should be 1
- // Flags:
- PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface.
- PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM)
- PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM)
- PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing.
- PFD_DOUBLEBUFFER | // The buffer is double-buffered.
- 0, // Placeholder for easy commenting of above flags
- PFD_TYPE_RGBA, // Pixel type RGBA.
- 16, // Total colour bitplanes (excluding alpha bitplanes)
- 5, 0, // Red bits, shift
- 5, 0, // Green bits, shift
- 5, 0, // Blue bits, shift
- 0, 0, // Alpha bits, shift (destination alpha)
- 0, // Accumulator bits (total)
- 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha
- 0, // Depth bits
- 0, // Stencil bits
- 0, // Number of auxiliary buffers
- 0, // Layer type
- 0, // Specifies the number of overlay and underlay planes.
- 0, // Layer mask
- 0, // Specifies the transparent color or index of an underlay plane.
- 0 // Damage mask
- },
- D3DFMT_UNKNOWN, // No depth/stencil buffer
-};
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-/*
-// Vertex Shader Declaration
-static DWORD dwTwoSidedLightingDecl[] =
-{
- D3DVSD_STREAM(0),
- D3DVSD_REG(0, D3DVSDT_FLOAT3), // XYZ position
- D3DVSD_REG(1, D3DVSDT_FLOAT3), // XYZ normal
- D3DVSD_REG(2, D3DVSDT_D3DCOLOR), // Diffuse color
- D3DVSD_REG(3, D3DVSDT_D3DCOLOR), // Specular color
- D3DVSD_REG(4, D3DVSDT_FLOAT2), // 2D texture unit 0
- D3DVSD_REG(5, D3DVSDT_FLOAT2), // 2D texture unit 1
- D3DVSD_END()
-};
-
-// Vertex Shader for two-sided lighting
-static char *szTwoSidedLightingVS =
-// This is a test shader!
-"vs.1.0\n"
-"m4x4 oPos,v0,c0\n"
-"mov oD0,v2\n"
-"mov oD1,v3\n"
-"mov oT0,v4\n"
-"mov oT1,v5\n"
-;
-*/
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-typedef struct {
- HINSTANCE hD3D9DLL; // Handle to d3d9.dll
- FNDIRECT3DCREATE9 fnDirect3DCreate9; // Direct3DCreate9 function prototype
- BOOL bDirect3D; // Persistant Direct3D9 exists
- BOOL bDirect3DDevice; // Persistant Direct3DDevice9 exists
- IDirect3D9 *pD3D; // Persistant Direct3D9
- IDirect3DDevice9 *pDev; // Persistant Direct3DDevice9
-} GLD_dx9_globals;
-
-// These are "global" to all DX9 contexts. KeithH
-static GLD_dx9_globals dx9Globals;
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-BOOL gldGetDXErrorString_DX(
- HRESULT hr,
- char *buf,
- int nBufSize)
-{
- //
- // Return a string describing the input HRESULT error code
- //
-
- const char *pStr = DXGetErrorString9(hr);
-
- if (pStr == NULL)
- return FALSE;
-
- if (strlen(pStr) > nBufSize)
- strncpy(buf, pStr, nBufSize);
- else
- strcpy(buf, pStr);
-
-// D3DXGetErrorString(hr, buf, nBufSize);
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static D3DMULTISAMPLE_TYPE _gldGetDeviceMultiSampleType(
- IDirect3D9 *pD3D9,
- D3DFORMAT SurfaceFormat,
- D3DDEVTYPE d3dDevType,
- BOOL Windowed)
-{
- int i;
- HRESULT hr;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_NONE)
- return D3DMULTISAMPLE_NONE;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_FASTEST) {
- // Find fastest multisample
- for (i=2; i<17; i++) {
- hr = IDirect3D9_CheckDeviceMultiSampleType(
- pD3D9,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i,
- NULL);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- } else {
- // Find nicest multisample
- for (i=16; i>1; i--) {
- hr = IDirect3D9_CheckDeviceMultiSampleType(
- pD3D9,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i,
- NULL);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- }
-
- // Nothing found - return default
- return D3DMULTISAMPLE_NONE;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyPrimitiveBuffer(
- GLD_pb_dx9 *gldVB)
-{
- SAFE_RELEASE(gldVB->pVB);
-
- // Sanity check...
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
-}
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldCreatePrimitiveBuffer(
- GLcontext *ctx,
- GLD_driver_dx9 *lpCtx,
- GLD_pb_dx9 *gldVB)
-{
- HRESULT hResult;
- char *szCreateVertexBufferFailed = "CreateVertexBuffer failed";
- DWORD dwMaxVertices; // Max number of vertices in vertex buffer
- DWORD dwVBSize; // Total size of vertex buffer
-
- // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we
- // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize.
- // We'll use IMM_SIZE if it's larger (which it should not be).
- dwMaxVertices = MAX_ARRAY_LOCK_SIZE;
-
- // Now calculate how many vertices to allow for in total
- // 1 per point, 2 per line, 6 per quad = 9
- dwVBSize = dwMaxVertices * 9 * gldVB->dwStride;
-
- hResult = IDirect3DDevice9_CreateVertexBuffer(
- lpCtx->pDev,
- dwVBSize,
- gldVB->dwUsage,
- gldVB->dwFVF,
- gldVB->dwPool,
- &gldVB->pVB,
- NULL);
- if (FAILED(hResult)) {
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, szCreateVertexBufferFailed);
- return hResult;
- }
-
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
- gldVB->pPoints = gldVB->pLines = gldVB->pTriangles = NULL;
- gldVB->iFirstLine = dwMaxVertices; // Index of first line in VB
- gldVB->iFirstTriangle = dwMaxVertices*3; // Index of first triangle in VB
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-// Function: _gldCreateVertexShaders
-// Create DX9 Vertex Shaders.
-//---------------------------------------------------------------------------
-/*
-void _gldCreateVertexShaders(
- GLD_driver_dx9 *gld)
-{
- DWORD dwFlags;
- LPD3DXBUFFER pVSOpcodeBuffer; // Vertex Shader opcode buffer
- HRESULT hr;
-
-#ifdef _DEBUG
- dwFlags = D3DXASM_DEBUG;
-#else
- dwFlags = 0; // D3DXASM_SKIPVALIDATION;
-#endif
-
- ddlogMessage(DDLOG_INFO, "Creating shaders...\n");
-
- // Init the shader handle
- gld->VStwosidelight.hShader = 0;
-
- if (gld->d3dCaps8.MaxStreams == 0) {
- // Lame DX8 driver doesn't support streams
- // Not fatal, as defaults will be used
- ddlogMessage(DDLOG_WARN, "Driver doesn't support Vertex Shaders (MaxStreams==0)\n");
- return;
- }
-
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-// return;
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-
- //
- // Two-sided lighting
- //
-
-#if 0
- //
- // DEBUGGING: Load shader from a text file
- //
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- hr = D3DXAssembleShaderFromFile(
- "twoside.vsh",
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#else
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- // Assemble ascii shader text into shader opcodes
- hr = D3DXAssembleShader(
- szTwoSidedLightingVS,
- strlen(szTwoSidedLightingVS),
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#endif
- if (FAILED(hr)) {
- ddlogError(DDLOG_WARN, "AssembleShader failed", hr);
- SAFE_RELEASE(pVSOpcodeBuffer);
- return;
- }
-
-// This is for debugging. Remove to enable vertex shaders in HW
-#define _GLD_FORCE_SW_VS 0
-
- if (_GLD_FORCE_SW_VS) {
- // _GLD_FORCE_SW_VS should be disabled for Final Release
- ddlogMessage(DDLOG_SYSTEM, "[Forcing shaders in SW]\n");
- }
-
- // Try and create shader in hardware.
- // NOTE: The D3D Ref device appears to succeed when trying to
- // create the device in hardware, but later complains
- // when trying to set it with SetVertexShader(). Go figure.
- if (_GLD_FORCE_SW_VS || glb.dwDriver == GLDS_DRIVER_REF) {
- // Don't try and create a hardware shader with the Ref device
- hr = E_FAIL; // COM error/fail result
- } else {
- gld->VStwosidelight.bHardware = TRUE;
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- 0);
- }
- if (FAILED(hr)) {
- ddlogMessage(DDLOG_INFO, "... HW failed, trying SW...\n");
- // Failed. Try and create shader for software processing
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- D3DUSAGE_SOFTWAREPROCESSING);
- if (FAILED(hr)) {
- gld->VStwosidelight.hShader = 0; // Sanity check
- ddlogError(DDLOG_WARN, "CreateVertexShader failed", hr);
- return;
- }
- // Succeeded, but for software processing
- gld->VStwosidelight.bHardware = FALSE;
- }
-
- SAFE_RELEASE(pVSOpcodeBuffer);
-
- ddlogMessage(DDLOG_INFO, "... OK\n");
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyVertexShaders(
- GLD_driver_dx9 *gld)
-{
- if (gld->VStwosidelight.hShader) {
- IDirect3DDevice8_DeleteVertexShader(gld->pDev, gld->VStwosidelight.hShader);
- gld->VStwosidelight.hShader = 0;
- }
-}
-*/
-//---------------------------------------------------------------------------
-
-BOOL gldCreateDrawable_DX(
- DGL_ctx *ctx,
-// BOOL bDefaultDriver,
- BOOL bDirectDrawPersistant,
- BOOL bPersistantBuffers)
-{
- //
- // bDirectDrawPersistant: applies to IDirect3D9
- // bPersistantBuffers: applies to IDirect3DDevice9
- //
-
- HRESULT hResult;
- GLD_driver_dx9 *lpCtx = NULL;
- D3DDEVTYPE d3dDevType;
- D3DPRESENT_PARAMETERS d3dpp;
- D3DDISPLAYMODE d3ddm;
- DWORD dwBehaviourFlags;
- D3DADAPTER_IDENTIFIER9 d3dIdent;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- if (ctx->glPriv) {
- lpCtx = ctx->glPriv;
- // Release any existing interfaces
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- } else {
- lpCtx = (GLD_driver_dx9*)malloc(sizeof(GLD_driver_dx9));
- ZeroMemory(lpCtx, sizeof(lpCtx));
- }
-
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- // TODO: Check this
-// if (bDefaultDriver)
-// d3dDevType = D3DDEVTYPE_REF;
-
- // Use persistant interface if needed
- if (bDirectDrawPersistant && dx9Globals.bDirect3D) {
- lpCtx->pD3D = dx9Globals.pD3D;
- IDirect3D9_AddRef(lpCtx->pD3D);
- goto SkipDirectDrawCreate;
- }
-
- // Create Direct3D9 object
- lpCtx->pD3D = dx9Globals.fnDirect3DCreate9(D3D_SDK_VERSION);
- if (lpCtx->pD3D == NULL) {
- MessageBox(NULL, "Unable to initialize Direct3D9", "GLDirect", MB_OK);
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D9 interface");
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Cache Direct3D interface for subsequent GLRCs
- if (bDirectDrawPersistant && !dx9Globals.bDirect3D) {
- dx9Globals.pD3D = lpCtx->pD3D;
- IDirect3D9_AddRef(dx9Globals.pD3D);
- dx9Globals.bDirect3D = TRUE;
- }
-SkipDirectDrawCreate:
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D9_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Get device caps
- hResult = IDirect3D9_GetDeviceCaps(lpCtx->pD3D, glb.dwAdapter, d3dDevType, &lpCtx->d3dCaps9);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D9_GetDeviceCaps failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Check for hardware transform & lighting
- lpCtx->bHasHWTnL = lpCtx->d3dCaps9.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE;
-
-/*
- //
- // GONE FOR DX9?
- //
- // If this flag is present then we can't default to Mesa
- // SW rendering between BeginScene() and EndScene().
- if (lpCtx->d3dCaps9.Caps2 & D3DCAPS2_NO2DDURING3DSCENE) {
- ddlogMessage(DDLOG_WARN,
- "Warning : No 2D allowed during 3D scene.\n");
- }
-*/
-
- //
- // Create the Direct3D context
- //
-
- // Re-use original IDirect3DDevice if persistant buffers exist.
- // Note that we test for persistant IDirect3D9 as well
- // bDirectDrawPersistant == persistant IDirect3D9 (DirectDraw9 does not exist)
- if (bDirectDrawPersistant && bPersistantBuffers && dx9Globals.pD3D && dx9Globals.pDev) {
- lpCtx->pDev = dx9Globals.pDev;
- IDirect3DDevice9_AddRef(dx9Globals.pDev);
- goto skip_direct3ddevice_create;
- }
-
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 2; //1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(lpCtx->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
-
- // Support for vertical retrace synchronisation.
- // Set default presentation interval in case caps bits are missing
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- if (glb.bWaitForRetrace) {
- if (lpCtx->d3dCaps9.PresentationIntervals & D3DPRESENT_INTERVAL_ONE)
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- } else {
- if (lpCtx->d3dCaps9.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE)
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
- }
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- // PresentationInterval Windowed mode is optional now in DX9 (DaveM)
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- if (glb.bWaitForRetrace) {
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- } else {
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
- }
- }
-
- // Decide if we can use hardware TnL
- dwBehaviourFlags = (lpCtx->bHasHWTnL) ?
- D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING;
- // Add flag to tell D3D to be thread-safe
- if (glb.bMultiThreaded)
- dwBehaviourFlags |= D3DCREATE_MULTITHREADED;
- // Add flag to tell D3D to be FPU-safe
- if (!glb.bFastFPU)
- dwBehaviourFlags |= D3DCREATE_FPU_PRESERVE;
- hResult = IDirect3D9_CreateDevice(lpCtx->pD3D,
- glb.dwAdapter,
- d3dDevType,
- ctx->hWnd,
- dwBehaviourFlags,
- &d3dpp,
- &lpCtx->pDev);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D9_CreateDevice failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- if (bDirectDrawPersistant && bPersistantBuffers && dx9Globals.pD3D) {
- dx9Globals.pDev = lpCtx->pDev;
- dx9Globals.bDirect3DDevice = TRUE;
- }
-
- // Dump some useful stats
- hResult = IDirect3D9_GetAdapterIdentifier(
- lpCtx->pD3D,
- glb.dwAdapter,
- 0, // No WHQL detection (avoid few seconds delay)
- &d3dIdent);
- if (SUCCEEDED(hResult)) {
- ddlogPrintf(DDLOG_INFO, "[Driver Description: %s]", &d3dIdent.Description);
- ddlogPrintf(DDLOG_INFO, "[Driver file: %s %d.%d.%02d.%d]",
- d3dIdent.Driver,
- HIWORD(d3dIdent.DriverVersion.HighPart),
- LOWORD(d3dIdent.DriverVersion.HighPart),
- HIWORD(d3dIdent.DriverVersion.LowPart),
- LOWORD(d3dIdent.DriverVersion.LowPart));
- ddlogPrintf(DDLOG_INFO, "[VendorId: 0x%X, DeviceId: 0x%X, SubSysId: 0x%X, Revision: 0x%X]",
- d3dIdent.VendorId, d3dIdent.DeviceId, d3dIdent.SubSysId, d3dIdent.Revision);
- }
-
- // Test to see if IHV driver exposes Scissor Test (new for DX9)
- lpCtx->bCanScissor = lpCtx->d3dCaps9.RasterCaps & D3DPRASTERCAPS_SCISSORTEST;
- ddlogPrintf(DDLOG_INFO, "Can Scissor: %s", lpCtx->bCanScissor ? "Yes" : "No");
-
- // Init projection matrix for D3D TnL
- D3DXMatrixIdentity(&lpCtx->matProjection);
- lpCtx->matModelView = lpCtx->matProjection;
-// gld->bUseMesaProjection = TRUE;
-
-skip_direct3ddevice_create:
-
- // Create buffers to hold primitives
- lpCtx->PB2d.dwFVF = GLD_FVF_2D_VERTEX;
- lpCtx->PB2d.dwPool = D3DPOOL_SYSTEMMEM;
- lpCtx->PB2d.dwStride = sizeof(GLD_2D_VERTEX);
- lpCtx->PB2d.dwUsage = D3DUSAGE_DONOTCLIP |
- D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB2d);
- if (FAILED(hResult))
- goto return_with_error;
-
- lpCtx->PB3d.dwFVF = GLD_FVF_3D_VERTEX;
- lpCtx->PB3d.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PB3d.dwStride = sizeof(GLD_3D_VERTEX);
- lpCtx->PB3d.dwUsage = D3DUSAGE_DYNAMIC |
-//DaveM D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB3d);
- if (FAILED(hResult))
- goto return_with_error;
-
-/* // NOTE: A FVF code of zero indicates a non-FVF vertex buffer (for vertex shaders)
- lpCtx->PBtwosidelight.dwFVF = 0; //GLD_FVF_TWOSIDED_VERTEX;
- lpCtx->PBtwosidelight.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PBtwosidelight.dwStride = sizeof(GLD_TWOSIDED_VERTEX);
- lpCtx->PBtwosidelight.dwUsage = D3DUSAGE_DONOTCLIP |
- D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PBtwosidelight);
- if (FAILED(hResult))
- goto return_with_error;*/
-
- // Now try and create the DX9 Vertex Shaders
-// _gldCreateVertexShaders(lpCtx);
-
- // Zero the pipeline usage counters
- lpCtx->PipelineUsage.qwMesa.QuadPart =
-// lpCtx->PipelineUsage.dwD3D2SVS.QuadPart =
- lpCtx->PipelineUsage.qwD3DFVF.QuadPart = 0;
-
- // Assign drawable to GL private
- ctx->glPriv = lpCtx;
- return TRUE;
-
-return_with_error:
- // Clean up and bail
-
-// _gldDestroyVertexShaders(lpCtx);
-
-// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldResizeDrawable_DX(
- DGL_ctx *ctx,
- BOOL bDefaultDriver,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- GLD_driver_dx9 *gld = NULL;
- D3DDEVTYPE d3dDevType;
- D3DPRESENT_PARAMETERS d3dpp;
- D3DDISPLAYMODE d3ddm;
- HRESULT hResult;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice9_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- if (!bDefaultDriver)
- d3dDevType = D3DDEVTYPE_REF; // Force Direct3D Reference Rasterise (software)
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D9_GetAdapterDisplayMode(gld->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
-// goto return_with_error;
- return FALSE;
- }
-
- // Destroy DX9 Vertex Shaders before Reset()
-// _gldDestroyVertexShaders(gld);
-
- // Release POOL_DEFAULT objects before Reset()
- if (gld->PB2d.dwPool == D3DPOOL_DEFAULT)
- _gldDestroyPrimitiveBuffer(&gld->PB2d);
- if (gld->PB3d.dwPool == D3DPOOL_DEFAULT)
- _gldDestroyPrimitiveBuffer(&gld->PB3d);
-// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT)
-// _gldDestroyPrimitiveBuffer(&gld->PBtwosidelight);
-
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(gld->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- // TODO: Sync to refresh
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- // Get better benchmark results? KeithH
-// d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_UNLIMITED;
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
- hResult = IDirect3DDevice9_Reset(gld->pDev, &d3dpp);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Reset failed", hResult);
- return FALSE;
- //goto cleanup_and_return_with_error;
- }
-
- //
- // Recreate POOL_DEFAULT objects
- //
- if (gld->PB2d.dwPool == D3DPOOL_DEFAULT) {
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
- }
- if (gld->PB3d.dwPool == D3DPOOL_DEFAULT) {
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB3d);
- }
-// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT) {
-// _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
-// }
-
- // Recreate DX9 Vertex Shaders
-// _gldCreateVertexShaders(gld);
-
- // Signal a complete state update
- ctx->glCtx->Driver.UpdateState(ctx->glCtx, _NEW_ALL);
-
- // Begin a new scene
- IDirect3DDevice9_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyDrawable_DX(
- DGL_ctx *ctx)
-{
- GLD_driver_dx9 *lpCtx = NULL;
-
- // Error if context is NULL.
- if (!ctx)
- return FALSE;
-
- // Error if the drawable does not exist.
- if (!ctx->glPriv)
- return FALSE;
-
- lpCtx = ctx->glPriv;
-
-#ifdef _DEBUG
- // Dump out stats
- ddlogPrintf(DDLOG_SYSTEM, "Usage: M:0x%X%X, D:0x%X%X",
- lpCtx->PipelineUsage.qwMesa.HighPart,
- lpCtx->PipelineUsage.qwMesa.LowPart,
- lpCtx->PipelineUsage.qwD3DFVF.HighPart,
- lpCtx->PipelineUsage.qwD3DFVF.LowPart);
-#endif
-
-// _gldDestroyVertexShaders(lpCtx);
-
-// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
-
- // Free the private drawable data
- free(ctx->glPriv);
- ctx->glPriv = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldCreatePrivateGlobals_DX(void)
-{
- ZeroMemory(&dx9Globals, sizeof(dx9Globals));
-
- // Load d3d9.dll
- dx9Globals.hD3D9DLL = LoadLibrary("D3D9.DLL");
- if (dx9Globals.hD3D9DLL == NULL)
- return FALSE;
-
- // Now try and obtain Direct3DCreate9
- dx9Globals.fnDirect3DCreate9 = (FNDIRECT3DCREATE9)GetProcAddress(dx9Globals.hD3D9DLL, "Direct3DCreate9");
- if (dx9Globals.fnDirect3DCreate9 == NULL) {
- FreeLibrary(dx9Globals.hD3D9DLL);
- return FALSE;
- }
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyPrivateGlobals_DX(void)
-{
- if (dx9Globals.bDirect3DDevice) {
- SAFE_RELEASE(dx9Globals.pDev);
- dx9Globals.bDirect3DDevice = FALSE;
- }
- if (dx9Globals.bDirect3D) {
- SAFE_RELEASE(dx9Globals.pD3D);
- dx9Globals.bDirect3D = FALSE;
- }
-
- FreeLibrary(dx9Globals.hD3D9DLL);
- dx9Globals.hD3D9DLL = NULL;
- dx9Globals.fnDirect3DCreate9 = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDisplayFormat(
- D3DFORMAT fmt,
- BYTE *cColorBits,
- BYTE *cRedBits,
- BYTE *cGreenBits,
- BYTE *cBlueBits,
- BYTE *cAlphaBits)
-{
- switch (fmt) {
- case D3DFMT_X1R5G5B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 5;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DFMT_R5G6B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 6;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DFMT_X8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
- return;
- case D3DFMT_A8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 8;
- return;
- }
-
- // Should not get here!
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDepthStencilFormat(
- D3DFORMAT fmt,
- BYTE *cDepthBits,
- BYTE *cStencilBits)
-{
- // NOTE: GL expects either 32 or 16 as depth bits.
- switch (fmt) {
- case D3DFMT_D32:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DFMT_D15S1:
- *cDepthBits = 16;
- *cStencilBits = 1;
- return;
- case D3DFMT_D24S8:
- *cDepthBits = 32;
- *cStencilBits = 8;
- return;
- case D3DFMT_D16:
- *cDepthBits = 16;
- *cStencilBits = 0;
- return;
- case D3DFMT_D24X8:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DFMT_D24X4S4:
- *cDepthBits = 32;
- *cStencilBits = 4;
- return;
- }
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldBuildPixelformatList_DX(void)
-{
- D3DDISPLAYMODE d3ddm;
- D3DFORMAT fmt[6];
- IDirect3D9 *pD3D = NULL;
- HRESULT hr;
- int nSupportedFormats = 0;
- int i;
- DGL_pixelFormat *pPF;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-// char buf[128];
-// char cat[8];
-
- // Direct3D (SW or HW)
- // These are arranged so that 'best' pixelformat
- // is higher in the list (for ChoosePixelFormat).
- const D3DFORMAT DepthStencil[6] = {
-// New order: increaing Z, then increasing stencil
- D3DFMT_D15S1,
- D3DFMT_D16,
- D3DFMT_D24X4S4,
- D3DFMT_D24X8,
- D3DFMT_D24S8,
- D3DFMT_D32,
- };
-
- // Dump DX version
- ddlogMessage(GLDLOG_SYSTEM, "DirectX Version : 9.0\n");
-
- // Release any existing pixelformat list
- if (glb.lpPF) {
- free(glb.lpPF);
- }
-
- glb.nPixelFormatCount = 0;
- glb.lpPF = NULL;
-
- //
- // Pixelformats for Direct3D (SW or HW) rendering
- //
-
- // Get a Direct3D 9.0 interface
- pD3D = dx9Globals.fnDirect3DCreate9(D3D_SDK_VERSION);
- if (!pD3D) {
- return FALSE;
- }
-
- // We will use the display mode format when finding compliant
- // rendertarget/depth-stencil surfaces.
- hr = IDirect3D9_GetAdapterDisplayMode(pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hr)) {
- IDirect3D9_Release(pD3D);
- return FALSE;
- }
-
- // Run through the possible formats and detect supported formats
- for (i=0; i<6; i++) {
- hr = IDirect3D9_CheckDeviceFormat(
- pD3D,
- glb.dwAdapter,
- glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF,
- d3ddm.Format,
- D3DUSAGE_DEPTHSTENCIL,
- D3DRTYPE_SURFACE,
- DepthStencil[i]);
- if (FAILED(hr))
- // A failure here is not fatal.
- continue;
-
- // Verify that the depth format is compatible.
- hr = IDirect3D9_CheckDepthStencilMatch(
- pD3D,
- glb.dwAdapter,
- glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF,
- d3ddm.Format,
- d3ddm.Format,
- DepthStencil[i]);
- if (FAILED(hr))
- // A failure here is not fatal, just means depth-stencil
- // format is not compatible with this display mode.
- continue;
-
- fmt[nSupportedFormats++] = DepthStencil[i];
- }
-
- IDirect3D9_Release(pD3D);
-
- if (nSupportedFormats == 0)
- return FALSE; // Bail: no compliant pixelformats
-
- // Total count of pixelformats is:
- // (nSupportedFormats+1)*2
- // UPDATED: nSupportedFormats*2
- glb.lpPF = (DGL_pixelFormat *)calloc(nSupportedFormats*2, sizeof(DGL_pixelFormat));
- glb.nPixelFormatCount = nSupportedFormats*2;
- if (glb.lpPF == NULL) {
- glb.nPixelFormatCount = 0;
- return FALSE;
- }
-
- // Get a copy of pointer that we can alter
- pPF = glb.lpPF;
-
- // Cache colour bits from display format
- _BitsFromDisplayFormat(d3ddm.Format, &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- //
- // Add single-buffer formats
- //
-/*
- // NOTE: No longer returning pixelformats that don't contain depth
- // Single-buffer, no depth-stencil buffer
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DFMT_UNKNOWN;
- pPF++;
-*/
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- //
- // Add double-buffer formats
- //
-
- // NOTE: No longer returning pixelformats that don't contain depth
-/*
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DFMT_UNKNOWN;
- pPF++;
-*/
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- // Popup warning message if non RGB color mode
- {
- // This is a hack. KeithH
- HDC hdcDesktop = GetDC(NULL);
- DWORD dwDisplayBitDepth = GetDeviceCaps(hdcDesktop, BITSPIXEL);
- ReleaseDC(0, hdcDesktop);
- if (dwDisplayBitDepth <= 8) {
- ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth);
- MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING);
- }
- }
-
- // Mark list as 'current'
- glb.bPixelformatsDirty = FALSE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldInitialiseMesa_DX(
- DGL_ctx *lpCtx)
-{
- GLD_driver_dx9 *gld = NULL;
- int MaxTextureSize, TextureLevels;
- BOOL bSoftwareTnL;
-
- if (lpCtx == NULL)
- return FALSE;
-
- gld = lpCtx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (glb.bMultitexture) {
- lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps9.MaxSimultaneousTextures;
- // Only support MAX_TEXTURE_UNITS texture units.
- // ** If this is altered then the FVF formats must be reviewed **.
- if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX9)
- lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX9;
- } else {
- // Multitexture override
- lpCtx->glCtx->Const.MaxTextureUnits = 1;
- }
-
- // max texture size
- MaxTextureSize = min(gld->d3dCaps9.MaxTextureHeight, gld->d3dCaps9.MaxTextureWidth);
- if (MaxTextureSize == 0)
- MaxTextureSize = 256; // Sanity check
-
- //
- // HACK!!
- if (MaxTextureSize > 1024)
- MaxTextureSize = 1024; // HACK - CLAMP TO 1024
- // HACK!!
- //
-
- // Got to set MAX_TEXTURE_SIZE as max levels.
- // Who thought this stupid idea up? ;)
- TextureLevels = 0;
- // Calculate power-of-two.
- while (MaxTextureSize) {
- TextureLevels++;
- MaxTextureSize >>= 1;
- }
- lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8;
- lpCtx->glCtx->Const.MaxDrawBuffers = 1;
-
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_LIGHTING, FALSE);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_DITHERENABLE, TRUE);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
-
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ZENABLE,
- (lpCtx->lpPF->dwDriverData!=D3DFMT_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE);
-
- // Set the view matrix
- {
- D3DXMATRIX vm;
-#if 1
- D3DXMatrixIdentity(&vm);
-#else
- D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f);
- D3DXVECTOR3 At(0.0f, 0.0f, -1.0f);
- D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f);
- D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up);
- vm._31 = -vm._31;
- vm._32 = -vm._32;
- vm._33 = -vm._33;
- vm._34 = -vm._34;
-#endif
- IDirect3DDevice9_SetTransform(gld->pDev, D3DTS_VIEW, &vm);
- }
-
- if (gld->bHasHWTnL) {
- if (glb.dwTnL == GLDS_TNL_DEFAULT)
- bSoftwareTnL = FALSE; // HW TnL
- else {
- bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE;
- }
- } else {
- // No HW TnL, so no choice possible
- bSoftwareTnL = TRUE;
- }
-// IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL);
- IDirect3DDevice9_SetSoftwareVertexProcessing(gld->pDev, bSoftwareTnL);
-
-// Dump this in a Release build as well, now.
-//#ifdef _DEBUG
- ddlogPrintf(DDLOG_INFO, "HW TnL: %s",
- gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable");
-//#endif
-
- gldEnableExtensions_DX9(lpCtx->glCtx);
- gldInstallPipeline_DX9(lpCtx->glCtx);
- gldSetupDriverPointers_DX9(lpCtx->glCtx);
-
- // Signal a complete state update
- lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL);
-
- // Start a scene
- IDirect3DDevice9_BeginScene(gld->pDev);
- lpCtx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldSwapBuffers_DX(
- DGL_ctx *ctx,
- HDC hDC,
- HWND hWnd)
-{
- HRESULT hr;
- GLD_driver_dx9 *gld = NULL;
-
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice9_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- // Swap the buffers. hWnd may override the hWnd used for CreateDevice()
- hr = IDirect3DDevice9_Present(gld->pDev, NULL, NULL, hWnd, NULL);
-
-exit_swap:
-
- IDirect3DDevice9_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
-// Debugging code
-#ifdef _DEBUG
-// ddlogMessage(GLDLOG_WARN, "SwapBuffers\n");
-#endif
-
- return (FAILED(hr)) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldGetDisplayMode_DX(
- DGL_ctx *ctx,
- GLD_displayMode *glddm)
-{
- D3DDISPLAYMODE d3ddm;
- HRESULT hr;
- GLD_driver_dx9 *lpCtx = NULL;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-
- if ((glddm == NULL) || (ctx == NULL))
- return FALSE;
-
- lpCtx = ctx->glPriv;
- if (lpCtx == NULL)
- return FALSE;
-
- if (lpCtx->pD3D == NULL)
- return FALSE;
-
- hr = IDirect3D9_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hr))
- return FALSE;
-
- // Get info from the display format
- _BitsFromDisplayFormat(d3ddm.Format,
- &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- glddm->Width = d3ddm.Width;
- glddm->Height = d3ddm.Height;
- glddm->BPP = cColorBits;
- glddm->Refresh = d3ddm.RefreshRate;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/gldirect.rc b/mesalib/src/mesa/drivers/windows/gldirect/gldirect.rc
deleted file mode 100644
index ba0963153..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/gldirect.rc
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: Windows Resource Compiler
-* Environment: Windows 95
-*
-****************************************************************************/
-
-#ifndef WORKSHOP_INVOKED
- #include <windows.h>
-#endif
-
-#define FILE_DESCRIPTION "SciTech GLDirect"
-#define ORIG_FILENAME "opengl32.dll"
-#define FILE_TYPE VFT_DLL
-
-#include "gldirect/gldver.ver"
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/mesasw/colors.h b/mesalib/src/mesa/drivers/windows/gldirect/mesasw/colors.h
deleted file mode 100644
index 9c1f2a054..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/mesasw/colors.h
+++ /dev/null
@@ -1,520 +0,0 @@
-/* File name : colors.h
- * Version : 2.3
- *
- * Header file for display driver for Mesa 2.3 under
- * Windows95 and WindowsNT
- * This file defines macros and global variables needed
- * for converting color format
- *
- * Copyright (C) 1996- Li Wei
- * Address : Institute of Artificial Intelligence
- * : & Robotics
- * : Xi'an Jiaotong University
- * Email : liwei@aiar.xjtu.edu.cn
- * Web page : http://sun.aiar.xjtu.edu.cn
- *
- * This file and its associations are partially based on the
- * Windows NT driver for Mesa, written by Mark Leaming
- * (mark@rsinc.com).
- */
-
-/*
- * Macros for pixel format defined
- */
-
-/*
- * Revision 1.1 2004/04/20 11:13:11 alanh
- * add SciTech's GLDirect driver for Windows.
- *
- * This code is donated to Mesa which allows the usage of
- * a Direct3D layer (DX7, DX8, DX9 or complete software fallback).
- *
- * No build system exists for this code yet, that will come.....
- *
- * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
- * Imported sources
- *
- * Revision 1.2 1999/01/03 03:08:57 brianp
- * Ted Jump's changes
- *
- * Revision 1.1 1999/01/03 03:08:12 brianp
- * Initial revision
- *
- * Revision 2.0.2 1997/4/30 15:58:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
- * Add LUTs need for dithering
- */
-
-/*
- * Revision 1.1 2004/04/20 11:13:11 alanh
- * add SciTech's GLDirect driver for Windows.
- *
- * This code is donated to Mesa which allows the usage of
- * a Direct3D layer (DX7, DX8, DX9 or complete software fallback).
- *
- * No build system exists for this code yet, that will come.....
- *
- * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
- * Imported sources
- *
- * Revision 1.2 1999/01/03 03:08:57 brianp
- * Ted Jump's changes
- *
- * Revision 1.1 1999/01/03 03:08:12 brianp
- * Initial revision
- *
- * Revision 2.0.1 1997/4/29 15:52:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
- * Add BGR8 Macro
- */
-
-/*
- * Revision 1.1 2004/04/20 11:13:11 alanh
- * add SciTech's GLDirect driver for Windows.
- *
- * This code is donated to Mesa which allows the usage of
- * a Direct3D layer (DX7, DX8, DX9 or complete software fallback).
- *
- * No build system exists for this code yet, that will come.....
- *
- * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
- * Imported sources
- *
- * Revision 1.2 1999/01/03 03:08:57 brianp
- * Ted Jump's changes
- *
- * Revision 1.1 1999/01/03 03:08:12 brianp
- * Initial revision
- *
- * Revision 2.0 1996/11/15 10:55:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
- * Initial revision
- */
-/* Values for wmesa->pixelformat: */
-
-#define PF_8A8B8G8R 3 /* 32-bit TrueColor: 8-A, 8-B, 8-G, 8-R */
-#define PF_8R8G8B 4 /* 32-bit TrueColor: 8-R, 8-G, 8-B */
-#define PF_5R6G5B 5 /* 16-bit TrueColor: 5-R, 6-G, 5-B bits */
-#define PF_DITHER8 6 /* Dithered RGB using a lookup table */
-#define PF_LOOKUP 7 /* Undithered RGB using a lookup table */
-#define PF_GRAYSCALE 10 /* Grayscale or StaticGray */
-#define PF_BADFORMAT 11
-#define PF_INDEX8 12
-
-char ColorMap16[] = {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
-0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
-0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,
-0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,
-0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,
-0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
-0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,
-0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,
-0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,
-0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,
-0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,
-0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,
-0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
-0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
-0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
-0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
-0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
-0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,
-0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
-0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,
-0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
-0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
-0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,
-0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
-0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,
-0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,
-0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,
-0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
-0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F};
-
-#define BGR8(r,g,b) (unsigned)(((BYTE)(b & 0xc0 | (g & 0xe0)>>2 | (r & 0xe0)>>5)))
-#ifdef DDRAW
-#define BGR16(r,g,b) ((WORD)(((BYTE)(ColorMap16[b]) | ((BYTE)(g&0xfc) << 3)) | (((WORD)(BYTE)(ColorMap16[r])) << 11)))
-#else
-#define BGR16(r,g,b) ((WORD)(((BYTE)(ColorMap16[b]) | ((BYTE)(ColorMap16[g]) << 5)) | (((WORD)(BYTE)(ColorMap16[r])) << 10)))
-#endif
-#define BGR24(r,g,b) (unsigned long)(((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16))) << 8)
-#define BGR32(r,g,b) (unsigned long)((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16)))
-
-
-
-/*
- * If pixelformat==PF_8A8B8G8R:
- */
-#define PACK_8A8B8G8R( R, G, B, A ) \
- ( ((A) << 24) | ((B) << 16) | ((G) << 8) | (R) )
-
-
-/*
- * If pixelformat==PF_8R8G8B:
- */
-#define PACK_8R8G8B( R, G, B) ( ((R) << 16) | ((G) << 8) | (B) )
-
-
-/*
- * If pixelformat==PF_5R6G5B:
- */
-
-
-#ifdef DDRAW
-#define PACK_5R6G5B( R, G, B) ((WORD)(((BYTE)(ColorMap16[B]) | ((BYTE)(G&0xfc) << 3)) | (((WORD)(BYTE)(ColorMap16[R])) << 11)))
-#else
-#define PACK_5R6G5B( R, G, B) ((WORD)(((BYTE)(ColorMap16[B]) | ((BYTE)(ColorMap16[G]) << 5)) | (((WORD)(BYTE)(ColorMap16[R])) << 10)))
-#endif
-/*----------------------------------------------------------------------------
-
-Division lookup tables. These tables compute 0-255 divided by 51 and
-modulo 51. These tables could approximate gamma correction.
-
-*/
-
-char unsigned const aDividedBy51Rounded[256] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-};
-
-char unsigned const aDividedBy51[256] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
-};
-
-char unsigned const aModulo51[256] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3,
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0,
-};
-
-/*----------------------------------------------------------------------------
-
-Multiplication LUTs. These compute 0-5 times 6 and 36.
-
-*/
-
-char unsigned const aTimes6[6] =
-{
- 0, 6, 12, 18, 24, 30
-};
-
-char unsigned const aTimes36[6] =
-{
- 0, 36, 72, 108, 144, 180
-};
-
-
-/*----------------------------------------------------------------------------
-
-Dither matrices for 8 bit to 2.6 bit halftones.
-
-*/
-
-char unsigned const aHalftone16x16[256] =
-{
- 0, 44, 9, 41, 3, 46, 12, 43, 1, 44, 10, 41, 3, 46, 12, 43,
- 34, 16, 25, 19, 37, 18, 28, 21, 35, 16, 26, 19, 37, 18, 28, 21,
- 38, 6, 47, 3, 40, 9, 50, 6, 38, 7, 47, 4, 40, 9, 49, 6,
- 22, 28, 13, 31, 25, 31, 15, 34, 22, 29, 13, 32, 24, 31, 15, 34,
- 2, 46, 12, 43, 1, 45, 10, 42, 2, 45, 11, 42, 1, 45, 11, 42,
- 37, 18, 27, 21, 35, 17, 26, 20, 36, 17, 27, 20, 36, 17, 26, 20,
- 40, 8, 49, 5, 38, 7, 48, 4, 39, 8, 48, 5, 39, 7, 48, 4,
- 24, 30, 15, 33, 23, 29, 13, 32, 23, 30, 14, 33, 23, 29, 14, 32,
- 2, 46, 12, 43, 0, 44, 10, 41, 3, 47, 12, 44, 0, 44, 10, 41,
- 37, 18, 27, 21, 35, 16, 25, 19, 37, 19, 28, 22, 35, 16, 25, 19,
- 40, 9, 49, 5, 38, 7, 47, 4, 40, 9, 50, 6, 38, 6, 47, 3,
- 24, 30, 15, 34, 22, 29, 13, 32, 25, 31, 15, 34, 22, 28, 13, 31,
- 1, 45, 11, 42, 2, 46, 11, 42, 1, 45, 10, 41, 2, 46, 11, 43,
- 36, 17, 26, 20, 36, 17, 27, 21, 35, 16, 26, 20, 36, 18, 27, 21,
- 39, 8, 48, 4, 39, 8, 49, 5, 38, 7, 48, 4, 39, 8, 49, 5,
- 23, 29, 14, 33, 24, 30, 14, 33, 23, 29, 13, 32, 24, 30, 14, 33,
-};
-
-char unsigned const aHalftone8x8[64] =
-{
- 0, 38, 9, 47, 2, 40, 11, 50,
- 25, 12, 35, 22, 27, 15, 37, 24,
- 6, 44, 3, 41, 8, 47, 5, 43,
- 31, 19, 28, 15, 34, 21, 31, 18,
- 1, 39, 11, 49, 0, 39, 10, 48,
- 27, 14, 36, 23, 26, 13, 35, 23,
- 7, 46, 4, 43, 7, 45, 3, 42,
- 33, 20, 30, 17, 32, 19, 29, 16,
-};
-
-char unsigned const aHalftone4x4_1[16] =
-{
- 0, 25, 6, 31,
- 38, 12, 44, 19,
- 9, 35, 3, 28,
- 47, 22, 41, 15
-};
-
-char unsigned const aHalftone4x4_2[16] =
-{
- 41, 3, 9, 28,
- 35, 15, 22, 47,
- 6, 25, 38, 0,
- 19, 44, 31, 12
-};
-
-/***************************************************************************
- aWinGHalftoneTranslation
-
- Translates a 2.6 bit-per-pixel halftoned representation into the
- slightly rearranged WinG Halftone Palette.
-*/
-
-char unsigned const aWinGHalftoneTranslation[216] =
-{
- 0,
- 29,
- 30,
- 31,
- 32,
- 249,
- 33,
- 34,
- 35,
- 36,
- 37,
- 38,
- 39,
- 40,
- 41,
- 42,
- 43,
- 44,
- 45,
- 46,
- 47,
- 48,
- 49,
- 50,
- 51,
- 52,
- 53,
- 54,
- 55,
- 56,
- 250,
- 250,
- 57,
- 58,
- 59,
- 251,
- 60,
- 61,
- 62,
- 63,
- 64,
- 65,
- 66,
- 67,
- 68,
- 69,
- 70,
- 71,
- 72,
- 73,
- 74,
- 75,
- 76,
- 77,
- 78,
- 79,
- 80,
- 81,
- 82,
- 83,
- 84,
- 85,
- 86,
- 87,
- 88,
- 89,
- 250,
- 90,
- 91,
- 92,
- 93,
- 94,
- 95,
- 96,
- 97,
- 98,
- 99,
- 100,
- 101,
- 102,
- 103,
- 104,
- 105,
- 106,
- 107,
- 108,
- 109,
- 110,
- 111,
- 227,
- 112,
- 113,
- 114,
- 115,
- 116,
- 117,
- 118,
- 119,
- 151,
- 120,
- 121,
- 122,
- 123,
- 124,
- 228,
- 125,
- 126,
- 229,
- 133,
- 162,
- 135,
- 131,
- 132,
- 137,
- 166,
- 134,
- 140,
- 130,
- 136,
- 143,
- 138,
- 139,
- 174,
- 141,
- 142,
- 177,
- 129,
- 144,
- 145,
- 146,
- 147,
- 148,
- 149,
- 150,
- 157,
- 152,
- 153,
- 154,
- 155,
- 156,
- 192,
- 158,
- 159,
- 160,
- 161,
- 196,
- 163,
- 164,
- 165,
- 127,
- 199,
- 167,
- 168,
- 169,
- 170,
- 171,
- 172,
- 173,
- 207,
- 175,
- 176,
- 210,
- 178,
- 179,
- 180,
- 181,
- 182,
- 183,
- 184,
- 185,
- 186,
- 187,
- 188,
- 189,
- 190,
- 191,
- 224,
- 193,
- 194,
- 195,
- 252,
- 252,
- 197,
- 198,
- 128,
- 253,
- 252,
- 200,
- 201,
- 202,
- 203,
- 204,
- 205,
- 206,
- 230,
- 208,
- 209,
- 231,
- 211,
- 212,
- 213,
- 214,
- 215,
- 216,
- 217,
- 218,
- 219,
- 220,
- 221,
- 222,
- 254,
- 223,
- 232,
- 225,
- 226,
- 255,
-};
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c b/mesalib/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c
deleted file mode 100644
index 342a74286..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c
+++ /dev/null
@@ -1,1720 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Mesa Software WGL (WindowsGL)
-*
-****************************************************************************/
-
-#include <windows.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-#include "glheader.h"
-#include "colors.h"
-#include "context.h"
-#include "colormac.h"
-#include "dd.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "teximage.h"
-#include "vbo/vbo.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/s_context.h"
-#include "swrast/s_depth.h"
-#include "swrast/s_lines.h"
-#include "swrast/s_triangle.h"
-#include "swrast/s_trispan.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "dglcontext.h"
-#include "gld_driver.h"
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-DGL_pixelFormat pfTemplateMesaSW =
-{
- {
- sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure
- 1, // Structure version - should be 1
- // Flags:
- PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface.
- PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM)
- PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM)
- PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing.
- PFD_DOUBLEBUFFER | // The buffer is double-buffered.
- 0, // Placeholder for easy commenting of above flags
- PFD_TYPE_RGBA, // Pixel type RGBA.
- 32, // Total colour bitplanes (excluding alpha bitplanes)
- 8, 0, // Red bits, shift
- 8, 8, // Green bits, shift
- 8, 16, // Blue bits, shift
- 8, 24, // Alpha bits, shift (destination alpha)
- 64, // Accumulator bits (total)
- 16, 16, 16, 16, // Accumulator bits: Red, Green, Blue, Alpha
- 16, // Depth bits
- 8, // Stencil bits
- 0, // Number of auxiliary buffers
- 0, // Layer type
- 0, // Specifies the number of overlay and underlay planes.
- 0, // Layer mask
- 0, // Specifies the transparent color or index of an underlay plane.
- 0 // Damage mask
- },
- 0, // Unused
-};
-
-//---------------------------------------------------------------------------
-// Extensions
-//---------------------------------------------------------------------------
-
-typedef struct {
- PROC proc;
- char *name;
-} GLD_extension;
-
-static GLD_extension GLD_extList[] = {
-#ifdef GL_EXT_polygon_offset
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
-#endif
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
- { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
- { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
- { (PROC)glLockArraysEXT, "glLockArraysEXT" },
- { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" },
- { NULL, "\0" }
-};
-
-//---------------------------------------------------------------------------
-// WMesa Internal Functions
-//---------------------------------------------------------------------------
-
-#define PAGE_FILE 0xffffffff
-
-#define REDBITS 0x03
-#define REDSHIFT 0x00
-#define GREENBITS 0x03
-#define GREENSHIFT 0x03
-#define BLUEBITS 0x02
-#define BLUESHIFT 0x06
-
-typedef struct _dibSection {
- HDC hDC;
- HANDLE hFileMap;
- BOOL fFlushed;
- LPVOID base;
-} WMDIBSECTION, *PWMDIBSECTION;
-
-typedef struct wmesa_context {
- HWND Window;
- HDC hDC;
- HPALETTE hPalette;
- HPALETTE hOldPalette;
- HPEN hPen;
- HPEN hOldPen;
- HCURSOR hOldCursor;
- COLORREF crColor;
- // 3D projection stuff
- RECT drawRect;
- UINT uiDIBoffset;
- // OpenGL stuff
- HPALETTE hGLPalette;
- GLuint width;
- GLuint height;
- GLuint ScanWidth;
- GLboolean db_flag; //* double buffered?
- GLboolean rgb_flag; //* RGB mode?
- GLboolean dither_flag; //* use dither when 256 color mode for RGB?
- GLuint depth; //* bits per pixel (1, 8, 24, etc)
- ULONG pixel; // current color index or RGBA pixel value
- ULONG clearpixel; //* pixel for clearing the color buffers
- PBYTE ScreenMem; // WinG memory
- BITMAPINFO *IndexFormat;
- HPALETTE hPal; // Current Palette
- HPALETTE hPalHalfTone;
-
-
- WMDIBSECTION dib;
- BITMAPINFO bmi;
- HBITMAP hbmDIB;
- HBITMAP hOldBitmap;
- HBITMAP Old_Compat_BM;
- HBITMAP Compat_BM; // Bitmap for double buffering
- PBYTE pbPixels;
- int nColors;
- BYTE cColorBits;
- int pixelformat;
-
- RECT rectOffScreen;
- RECT rectSurface;
-// HWND hwnd;
- DWORD pitch;
- PBYTE addrOffScreen;
-
- // We always double-buffer, for performance reasons, but
- // we need to know which of SwapBuffers() or glFlush() to
- // handle. If we're emulating, then we update on Flush(),
- // otherwise we update on SwapBufers(). KeithH
- BOOL bEmulateSingleBuffer;
-} WMesaContext, *PWMC;
-
-#define GLD_GET_WMESA_DRIVER(c) (WMesaContext*)(c)->glPriv
-
-// TODO:
-GLint stereo_flag = 0 ;
-
-/* If we are double-buffering, we want to get the DC for the
- * off-screen DIB, otherwise the DC for the window.
- */
-#define DD_GETDC ((Current->db_flag) ? Current->dib.hDC : Current->hDC )
-#define DD_RELEASEDC
-
-#define FLIP(Y) (Current->height-(Y)-1)
-
-struct DISPLAY_OPTIONS {
- int stereo;
- int fullScreen;
- int mode;
- int bpp;
-};
-
-struct DISPLAY_OPTIONS displayOptions;
-
-//---------------------------------------------------------------------------
-
-static unsigned char threeto8[8] = {
- 0, 0111>>1, 0222>>1, 0333>>1, 0444>>1, 0555>>1, 0666>>1, 0377
-};
-
-static unsigned char twoto8[4] = {
- 0, 0x55, 0xaa, 0xff
-};
-
-static unsigned char oneto8[2] = {
- 0, 255
-};
-
-//---------------------------------------------------------------------------
-
-BYTE DITHER_RGB_2_8BIT( int red, int green, int blue, int pixel, int scanline)
-{
- char unsigned redtemp, greentemp, bluetemp, paletteindex;
-
- //*** now, look up each value in the halftone matrix
- //*** using an 8x8 ordered dither.
- redtemp = aDividedBy51[red]
- + (aModulo51[red] > aHalftone8x8[(pixel%8)*8
- + scanline%8]);
- greentemp = aDividedBy51[(char unsigned)green]
- + (aModulo51[green] > aHalftone8x8[
- (pixel%8)*8 + scanline%8]);
- bluetemp = aDividedBy51[(char unsigned)blue]
- + (aModulo51[blue] > aHalftone8x8[
- (pixel%8)*8 +scanline%8]);
-
- //*** recombine the halftoned rgb values into a palette index
- paletteindex =
- redtemp + aTimes6[greentemp] + aTimes36[bluetemp];
-
- //*** and translate through the wing halftone palette
- //*** translation vector to give the correct value.
- return aWinGHalftoneTranslation[paletteindex];
-}
-
-//---------------------------------------------------------------------------
-
-static unsigned char componentFromIndex(UCHAR i, UINT nbits, UINT shift)
-{
- unsigned char val;
-
- val = i >> shift;
- switch (nbits) {
-
- case 1:
- val &= 0x1;
- return oneto8[val];
-
- case 2:
- val &= 0x3;
- return twoto8[val];
-
- case 3:
- val &= 0x7;
- return threeto8[val];
-
- default:
- return 0;
- }
-}
-
-//---------------------------------------------------------------------------
-
-
-void wmSetPixel(PWMC pwc, int iScanLine, int iPixel, BYTE r, BYTE g, BYTE b)
-{
- WMesaContext *Current = pwc;
-
- // Test for invalid scanline parameter. KeithH
- if ((iScanLine < 0) || (iScanLine >= pwc->height))
- return;
-
- if (Current->db_flag) {
- LPBYTE lpb = pwc->pbPixels;
- UINT nBypp = pwc->cColorBits >> 3;
- UINT nOffset = iPixel % nBypp;
-
- lpb += pwc->ScanWidth * iScanLine;
- lpb += iPixel * nBypp;
-
- if(nBypp == 1){
- if(pwc->dither_flag)
- *lpb = DITHER_RGB_2_8BIT(r,g,b,iScanLine,iPixel);
- else
- *lpb = BGR8(r,g,b);
- }
- else if(nBypp == 2)
- *((LPWORD)lpb) = BGR16(r,g,b);
- else if (nBypp == 3)
- *((LPDWORD)lpb) = BGR24(r,g,b);
- else if (nBypp == 4)
- *((LPDWORD)lpb) = BGR32(r,g,b);
- }
- else{
- SetPixel(Current->hDC, iPixel, iScanLine, RGB(r,g,b));
- }
-}
-
-//---------------------------------------------------------------------------
-
-void wmCreateDIBSection(
- HDC hDC,
- PWMC pwc, // handle of device context
- CONST BITMAPINFO *pbmi, // bitmap size, format, and color data
- UINT iUsage // color data type indicator: RGB values or palette indices
- )
-{
- DWORD dwSize = 0;
- DWORD dwScanWidth;
- UINT nBypp = pwc->cColorBits / 8;
- HDC hic;
-
- dwScanWidth = (((pwc->ScanWidth * nBypp)+ 3) & ~3);
-
- pwc->ScanWidth =pwc->pitch = dwScanWidth;
-
- if (stereo_flag)
- pwc->ScanWidth = 2* pwc->pitch;
-
- dwSize = sizeof(BITMAPINFO) + (dwScanWidth * pwc->height);
-
- pwc->dib.hFileMap = CreateFileMapping((HANDLE)PAGE_FILE,
- NULL,
- PAGE_READWRITE | SEC_COMMIT,
- 0,
- dwSize,
- NULL);
-
- if (!pwc->dib.hFileMap)
- return;
-
- pwc->dib.base = MapViewOfFile(pwc->dib.hFileMap,
- FILE_MAP_ALL_ACCESS,
- 0,
- 0,
- 0);
-
- if(!pwc->dib.base){
- CloseHandle(pwc->dib.hFileMap);
- return;
- }
-
-
- CopyMemory(pwc->dib.base, pbmi, sizeof(BITMAPINFO));
-
- hic = CreateIC("display", NULL, NULL, NULL);
- pwc->dib.hDC = CreateCompatibleDC(hic);
-
-
- pwc->hbmDIB = CreateDIBSection(hic,
- &(pwc->bmi),
- (iUsage ? DIB_PAL_COLORS : DIB_RGB_COLORS),
- &(pwc->pbPixels),
- pwc->dib.hFileMap,
- 0);
- pwc->ScreenMem = pwc->addrOffScreen = pwc->pbPixels;
- pwc->hOldBitmap = SelectObject(pwc->dib.hDC, pwc->hbmDIB);
-
- DeleteDC(hic);
-
- return;
-
-}
-
-//---------------------------------------------------------------------------
-
-void wmCreatePalette( PWMC pwdc )
-{
- /* Create a compressed and re-expanded 3:3:2 palette */
- int i;
- LOGPALETTE *pPal;
- BYTE rb, rs, gb, gs, bb, bs;
-
- pwdc->nColors = 0x100;
-
- pPal = (PLOGPALETTE)malloc(sizeof(LOGPALETTE) +
- pwdc->nColors * sizeof(PALETTEENTRY));
- memset( pPal, 0, sizeof(LOGPALETTE) + pwdc->nColors * sizeof(PALETTEENTRY) );
-
- pPal->palVersion = 0x300;
-
- rb = REDBITS;
- rs = REDSHIFT;
- gb = GREENBITS;
- gs = GREENSHIFT;
- bb = BLUEBITS;
- bs = BLUESHIFT;
-
- if (pwdc->db_flag) {
-
- /* Need to make two palettes: one for the screen DC and one for the DIB. */
- pPal->palNumEntries = pwdc->nColors;
- for (i = 0; i < pwdc->nColors; i++) {
- pPal->palPalEntry[i].peRed = componentFromIndex( i, rb, rs );
- pPal->palPalEntry[i].peGreen = componentFromIndex( i, gb, gs );
- pPal->palPalEntry[i].peBlue = componentFromIndex( i, bb, bs );
- pPal->palPalEntry[i].peFlags = 0;
- }
- pwdc->hGLPalette = CreatePalette( pPal );
- pwdc->hPalette = CreatePalette( pPal );
- }
-
- else {
- pPal->palNumEntries = pwdc->nColors;
- for (i = 0; i < pwdc->nColors; i++) {
- pPal->palPalEntry[i].peRed = componentFromIndex( i, rb, rs );
- pPal->palPalEntry[i].peGreen = componentFromIndex( i, gb, gs );
- pPal->palPalEntry[i].peBlue = componentFromIndex( i, bb, bs );
- pPal->palPalEntry[i].peFlags = 0;
- }
- pwdc->hGLPalette = CreatePalette( pPal );
- }
-
- free(pPal);
-
-}
-
-//---------------------------------------------------------------------------
-
-/* This function sets the color table of a DIB section
- * to match that of the destination DC
- */
-BOOL wmSetDibColors(PWMC pwc)
-{
- RGBQUAD *pColTab, *pRGB;
- PALETTEENTRY *pPal, *pPE;
- int i, nColors;
- BOOL bRet=TRUE;
- DWORD dwErr=0;
-
- /* Build a color table in the DIB that maps to the
- * selected palette in the DC.
- */
- nColors = 1 << pwc->cColorBits;
- pPal = (PALETTEENTRY *)malloc( nColors * sizeof(PALETTEENTRY));
- memset( pPal, 0, nColors * sizeof(PALETTEENTRY) );
- GetPaletteEntries( pwc->hGLPalette, 0, nColors, pPal );
- pColTab = (RGBQUAD *)malloc( nColors * sizeof(RGBQUAD));
- for (i = 0, pRGB = pColTab, pPE = pPal; i < nColors; i++, pRGB++, pPE++) {
- pRGB->rgbRed = pPE->peRed;
- pRGB->rgbGreen = pPE->peGreen;
- pRGB->rgbBlue = pPE->peBlue;
- }
- if(pwc->db_flag)
- bRet = SetDIBColorTable(pwc->dib.hDC, 0, nColors, pColTab );
-
- if(!bRet)
- dwErr = GetLastError();
-
- free( pColTab );
- free( pPal );
-
- return bRet;
-}
-
-//---------------------------------------------------------------------------
-
-static void wmSetPixelFormat( PWMC wc, HDC hDC)
-{
- if(wc->rgb_flag)
- wc->cColorBits = GetDeviceCaps(hDC, BITSPIXEL);
- else
- wc->cColorBits = 8;
- switch(wc->cColorBits){
- case 8:
- if(wc->dither_flag != GL_TRUE)
- wc->pixelformat = PF_INDEX8;
- else
- wc->pixelformat = PF_DITHER8;
- break;
- case 16:
- wc->pixelformat = PF_5R6G5B;
- break;
- case 32:
- wc->pixelformat = PF_8R8G8B;
- break;
- default:
- wc->pixelformat = PF_BADFORMAT;
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * This function creates the DIB section that is used for combined
- * GL and GDI calls
- */
-BOOL wmCreateBackingStore(PWMC pwc, long lxSize, long lySize)
-{
- HDC hdc = pwc->hDC;
- LPBITMAPINFO pbmi = &(pwc->bmi);
- int iUsage;
-
- pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- pbmi->bmiHeader.biWidth = lxSize;
- pbmi->bmiHeader.biHeight= -lySize;
- pbmi->bmiHeader.biPlanes = 1;
- if(pwc->rgb_flag)
- pbmi->bmiHeader.biBitCount = GetDeviceCaps(pwc->hDC, BITSPIXEL);
- else
- pbmi->bmiHeader.biBitCount = 8;
- pbmi->bmiHeader.biCompression = BI_RGB;
- pbmi->bmiHeader.biSizeImage = 0;
- pbmi->bmiHeader.biXPelsPerMeter = 0;
- pbmi->bmiHeader.biYPelsPerMeter = 0;
- pbmi->bmiHeader.biClrUsed = 0;
- pbmi->bmiHeader.biClrImportant = 0;
-
- iUsage = (pbmi->bmiHeader.biBitCount <= 8) ? DIB_PAL_COLORS : DIB_RGB_COLORS;
-
- pwc->cColorBits = pbmi->bmiHeader.biBitCount;
- pwc->ScanWidth = pwc->pitch = lxSize;
- pwc->width = lxSize;
- pwc->height = lySize;
-
- wmCreateDIBSection(hdc, pwc, pbmi, iUsage);
-
- if ((iUsage == DIB_PAL_COLORS) && !(pwc->hGLPalette)) {
- wmCreatePalette( pwc );
- wmSetDibColors( pwc );
- }
- wmSetPixelFormat(pwc, pwc->hDC);
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * Free up the dib section that was created
- */
-BOOL wmDeleteBackingStore(PWMC pwc)
-{
- SelectObject(pwc->dib.hDC, pwc->hOldBitmap);
- DeleteDC(pwc->dib.hDC);
- DeleteObject(pwc->hbmDIB);
- UnmapViewOfFile(pwc->dib.base);
- CloseHandle(pwc->dib.hFileMap);
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * Blit memory DC to screen DC
- */
-BOOL wmFlush(PWMC pwc, HDC hDC)
-{
- BOOL bRet = 0;
- DWORD dwErr = 0;
-
-// Now using bEmulateSingleBuffer in the calling function. KeithH
-
-// if(pwc->db_flag){
- bRet = BitBlt(hDC, 0, 0, pwc->width, pwc->height,
- pwc->dib.hDC, 0, 0, SRCCOPY);
-// }
-
- return bRet;
-
-}
-
-//---------------------------------------------------------------------------
-// Support Functions
-//---------------------------------------------------------------------------
-
-static void flush(GLcontext* ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
-/*
- if((Current->rgb_flag &&!(Current->db_flag))
- ||(!Current->rgb_flag))
- {
- wmFlush(Current, Current->hDC);
- }
-*/
- // Only flush if we're not in double-buffer mode. KeithH
- // The demo fractal.c calls glutSwapBuffers() then glFlush()!
- if (Current->bEmulateSingleBuffer) {
- wmFlush(Current, Current->hDC);
- }
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Set the color index used to clear the color buffer.
- */
-static void clear_index(GLcontext* ctx, GLuint index)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- Current->clearpixel = index;
-}
-
-
-
-//---------------------------------------------------------------------------
-
-/*
- * Set the color used to clear the color buffer.
- */
-//static void clear_color( GLcontext* ctx, const GLchan color[4] )
-// Changed for Mesa 5.x. KeithH
-static void clear_color(
- GLcontext* ctx,
- const GLfloat color[4])
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLubyte col[4];
- CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
- Current->clearpixel = RGB(col[0], col[1], col[2]);
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Clear the specified region of the color buffer using the clear color
- * or index as specified by one of the two functions above.
- *
- * This procedure clears either the front and/or the back COLOR buffers.
- * Only the "left" buffer is cleared since we are not stereo.
- * Clearing of the other non-color buffers is left to the swrast.
- * We also only clear the color buffers if the color masks are all 1's.
- * Otherwise, we let swrast do it.
- */
-
-static clear(GLcontext* ctx, GLbitfield mask,
- GLboolean all, GLint x, GLint y, GLint width, GLint height)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- DWORD dwColor;
- WORD wColor;
- BYTE bColor;
- LPDWORD lpdw = (LPDWORD)Current->pbPixels;
- LPWORD lpw = (LPWORD)Current->pbPixels;
- LPBYTE lpb = Current->pbPixels;
- int lines;
- const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
-
- if (all){
- x=y=0;
- width=Current->width;
- height=Current->height;
- }
-
-
- /* sanity check - can't have right(stereo) buffers */
- assert((mask & (DD_FRONT_RIGHT_BIT | DD_BACK_RIGHT_BIT)) == 0);
-
- /* clear alpha */
- if ((mask & (DD_FRONT_LEFT_BIT | DD_BACK_RIGHT_BIT)) &&
- ctx->DrawBuffer->UseSoftwareAlphaBuffers &&
- ctx->Color.ColorMask[ACOMP]) {
- _swrast_clear_alpha_buffers( ctx );
- }
-
- if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) {
- if (mask & DD_BACK_LEFT_BIT) {
- /* Double-buffering - clear back buffer */
- UINT nBypp = Current->cColorBits / 8;
- int i = 0;
- int iSize = 0;
-
- assert(Current->db_flag==GL_TRUE); /* we'd better be double buffer */
- if(nBypp ==1 ){
- iSize = Current->width/4;
- bColor = BGR8(GetRValue(Current->clearpixel),
- GetGValue(Current->clearpixel),
- GetBValue(Current->clearpixel));
- wColor = MAKEWORD(bColor,bColor);
- dwColor = MAKELONG(wColor, wColor);
- }
- if(nBypp == 2){
- iSize = Current->width / 2;
- wColor = BGR16(GetRValue(Current->clearpixel),
- GetGValue(Current->clearpixel),
- GetBValue(Current->clearpixel));
- dwColor = MAKELONG(wColor, wColor);
- }
- else if(nBypp == 4){
- iSize = Current->width;
- dwColor = BGR32(GetRValue(Current->clearpixel),
- GetGValue(Current->clearpixel),
- GetBValue(Current->clearpixel));
- }
-
- /* clear a line */
- while(i < iSize){
- *lpdw = dwColor;
- lpdw++;
- i++;
- }
-
- /* This is the 24bit case */
- if (nBypp == 3) {
- iSize = Current->width *3/4;
- dwColor = BGR24(GetRValue(Current->clearpixel),
- GetGValue(Current->clearpixel),
- GetBValue(Current->clearpixel));
- while(i < iSize){
- *lpdw = dwColor;
- lpb += nBypp;
- lpdw = (LPDWORD)lpb;
- i++;
- }
- }
-
- i = 0;
- if (stereo_flag)
- lines = height /2;
- else
- lines = height;
- /* copy cleared line to other lines in buffer */
- do {
- memcpy(lpb, Current->pbPixels, iSize*4);
- lpb += Current->ScanWidth;
- i++;
- }
- while (i<lines-1);
- mask &= ~DD_BACK_LEFT_BIT;
- } /* double-buffer */
-
- if (mask & DD_FRONT_LEFT_BIT) {
- /* single-buffer */
- HDC DC=DD_GETDC;
- HPEN Pen=CreatePen(PS_SOLID,1,Current->clearpixel);
- HBRUSH Brush=CreateSolidBrush(Current->clearpixel);
- HPEN Old_Pen=SelectObject(DC,Pen);
- HBRUSH Old_Brush=SelectObject(DC,Brush);
- Rectangle(DC,x,y,x+width,y+height);
- SelectObject(DC,Old_Pen);
- SelectObject(DC,Old_Brush);
- DeleteObject(Pen);
- DeleteObject(Brush);
- DD_RELEASEDC;
- mask &= ~DD_FRONT_LEFT_BIT;
- } /* single-buffer */
- } /* if masks are all 1's */
-
- /* Call swrast if there is anything left to clear (like DEPTH) */
- if (mask)
- _swrast_Clear( ctx, mask, all, x, y, width, height );
-}
-
-
-//---------------------------------------------------------------------------
-
-
-static void enable( GLcontext* ctx, GLenum pname, GLboolean enable )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
-
- if (!Current)
- return;
-
- if (pname == GL_DITHER) {
- if(enable == GL_FALSE){
- Current->dither_flag = GL_FALSE;
- if(Current->cColorBits == 8)
- Current->pixelformat = PF_INDEX8;
- }
- else{
- if (Current->rgb_flag && Current->cColorBits == 8){
- Current->pixelformat = PF_DITHER8;
- Current->dither_flag = GL_TRUE;
- }
- else
- Current->dither_flag = GL_FALSE;
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode )
-{
- /* TODO: this could be better */
- if (mode==GL_FRONT_LEFT || mode==GL_BACK_LEFT) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-//---------------------------------------------------------------------------
-
-
-static void set_read_buffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLenum buffer )
-{
- /* XXX todo */
- return;
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/* Return characteristics of the output buffer. */
-//static void buffer_size( GLcontext* ctx, GLuint *width, GLuint *height )
-// Altered for Mesa 5.x. KeithH
-static void buffer_size(
- GLframebuffer *buffer,
- GLuint *width,
- GLuint *height)
-{
- // For some reason the context is not passed into this function.
- // Therefore we have to explicitly retrieve it.
- GET_CURRENT_CONTEXT(ctx);
-
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- int New_Size;
- RECT CR;
-
- GetClientRect(Current->Window,&CR);
-
- *width=CR.right;
- *height=CR.bottom;
-
- New_Size=((*width)!=Current->width) || ((*height)!=Current->height);
-
- if (New_Size){
- Current->width=*width;
- Current->height=*height;
- Current->ScanWidth=Current->width;
- if ((Current->ScanWidth%sizeof(long))!=0)
- Current->ScanWidth+=(sizeof(long)-(Current->ScanWidth%sizeof(long)));
-
- if (Current->db_flag){
- if (Current->rgb_flag==GL_TRUE && Current->dither_flag!=GL_TRUE){
- wmDeleteBackingStore(Current);
- wmCreateBackingStore(Current, Current->width, Current->height);
- }
- }
-
- }
-}
-
-
-
-/**********************************************************************/
-/***** Accelerated point, line, polygon rendering *****/
-/**********************************************************************/
-
-/* Accelerated routines are not implemented in 4.0. See OSMesa for ideas. */
-
-static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last )
-{
-}
-
-//---------------------------------------------------------------------------
-
-/* Return pointer to accelerated points function */
-extern tnl_points_func choose_points_function( GLcontext* ctx )
-{
- return NULL;
-}
-
-//---------------------------------------------------------------------------
-
-static void fast_flat_rgb_line( GLcontext* ctx, GLuint v0,
- GLuint v1, GLuint pv )
-{
-}
-
-//---------------------------------------------------------------------------
-
-static tnl_line_func choose_line_function( GLcontext* ctx )
-{
-}
-
-
-/**********************************************************************/
-/***** Span-based pixel drawing *****/
-/**********************************************************************/
-
-
-/* Write a horizontal span of 32-bit color-index pixels with a boolean mask. */
-static void write_ci32_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- const GLuint index[],
- const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- PBYTE Mem=Current->ScreenMem+FLIP(y)*Current->ScanWidth+x;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i]=index[i];
-}
-
-
-//---------------------------------------------------------------------------
-
-/* Write a horizontal span of 8-bit color-index pixels with a boolean mask. */
-static void write_ci8_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte index[],
- const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- PBYTE Mem=Current->ScreenMem+FLIP(y)*Current->ScanWidth+x;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i]=index[i];
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Write a horizontal span of pixels with a boolean mask. The current
- * color index is used for all pixels.
- */
-static void write_mono_ci_span(const GLcontext* ctx,
- GLuint n,GLint x,GLint y,
- GLuint colorIndex, const GLubyte mask[])
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- BYTE *Mem=Current->ScreenMem+FLIP(y)*Current->ScanWidth+x;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i]=colorIndex;
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * To improve the performance of this routine, frob the data into an actual
- * scanline and call bitblt on the complete scan line instead of SetPixel.
- */
-
-/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span( const GLcontext* ctx, GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- PWMC pwc = Current;
-
- if (pwc->rgb_flag==GL_TRUE)
- {
- GLuint i;
- HDC DC=DD_GETDC;
- y=FLIP(y);
- if (mask) {
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc, y, x + i,
- rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);
- }
- else {
- for (i=0; i<n; i++)
- wmSetPixel(pwc, y, x + i,
- rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
- }
- DD_RELEASEDC;
- }
- else
- {
- GLuint i;
- BYTE *Mem=Current->ScreenMem+y*Current->ScanWidth+x;
- y = FLIP(y);
- if (mask) {
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i] = GetNearestPaletteIndex(Current->hPal,
- RGB(rgba[i][RCOMP],
- rgba[i][GCOMP],
- rgba[i][BCOMP]));
- }
- else {
- for (i=0; i<n; i++)
- Mem[i] = GetNearestPaletteIndex(Current->hPal,
- RGB(rgba[i][RCOMP],
- rgba[i][GCOMP],
- rgba[i][BCOMP]));
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- PWMC pwc = Current;
-
- if (pwc->rgb_flag==GL_TRUE)
- {
- GLuint i;
- HDC DC=DD_GETDC;
- y=FLIP(y);
- if (mask) {
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc, y, x + i,
- rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);
- }
- else {
- for (i=0; i<n; i++)
- wmSetPixel(pwc, y, x + i,
- rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );
- }
- DD_RELEASEDC;
- }
- else
- {
- GLuint i;
- BYTE *Mem=Current->ScreenMem+y*Current->ScanWidth+x;
- y = FLIP(y);
- if (mask) {
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i] = GetNearestPaletteIndex(Current->hPal,
- RGB(rgb[i][RCOMP],
- rgb[i][GCOMP],
- rgb[i][BCOMP]));
- }
- else {
- for (i=0; i<n; i++)
- Mem[i] = GetNearestPaletteIndex(Current->hPal,
- RGB(rgb[i][RCOMP],
- rgb[i][GCOMP],
- rgb[i][BCOMP]));
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * Write a horizontal span of pixels with a boolean mask. The current color
- * is used for all pixels.
- */
-static void write_mono_rgba_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[])
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- ULONG pixel = RGB( color[RCOMP], color[GCOMP], color[BCOMP] );
- GLuint i;
- HDC DC=DD_GETDC;
- PWMC pwc = Current;
- assert(Current->rgb_flag==GL_TRUE);
- y=FLIP(y);
- if(Current->rgb_flag==GL_TRUE){
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc,y,x+i,color[RCOMP], color[GCOMP], color[BCOMP]);
- }
- else {
- for (i=0; i<n; i++)
- if (mask[i])
- SetPixel(DC, y, x+i, pixel);
- }
- DD_RELEASEDC;
-}
-
-
-
-/**********************************************************************/
-/***** Array-based pixel drawing *****/
-/**********************************************************************/
-
-
-/* Write an array of 32-bit index pixels with a boolean mask. */
-static void write_ci32_pixels( const GLcontext* ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint index[], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++) {
- if (mask[i]) {
- BYTE *Mem=Current->ScreenMem+FLIP(y[i])*Current->ScanWidth+x[i];
- *Mem = index[i];
- }
- }
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Write an array of pixels with a boolean mask. The current color
- * index is used for all pixels.
- */
-static void write_mono_ci_pixels( const GLcontext* ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- GLuint colorIndex, const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++) {
- if (mask[i]) {
- BYTE *Mem=Current->ScreenMem+FLIP(y[i])*Current->ScanWidth+x[i];
- *Mem = colorIndex;
- }
- }
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels( const GLcontext* ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- PWMC pwc = Current;
- HDC DC=DD_GETDC;
- assert(Current->rgb_flag==GL_TRUE);
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc, FLIP(y[i]), x[i],
- rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);
- DD_RELEASEDC;
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Write an array of pixels with a boolean mask. The current color
- * is used for all pixels.
- */
-static void write_mono_rgba_pixels( const GLcontext* ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- const GLchan color[4],
- const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- PWMC pwc = Current;
- HDC DC=DD_GETDC;
- assert(Current->rgb_flag==GL_TRUE);
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc, FLIP(y[i]),x[i],color[RCOMP],
- color[GCOMP], color[BCOMP]);
- DD_RELEASEDC;
-}
-
-/**********************************************************************/
-/***** Read spans/arrays of pixels *****/
-/**********************************************************************/
-
-/* Read a horizontal span of color-index pixels. */
-static void read_ci32_span( const GLcontext* ctx, GLuint n, GLint x, GLint y,
- GLuint index[])
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- BYTE *Mem=Current->ScreenMem+FLIP(y)*Current->ScanWidth+x;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++)
- index[i]=Mem[i];
-}
-
-//---------------------------------------------------------------------------
-
-/* Read an array of color index pixels. */
-static void read_ci32_pixels( const GLcontext* ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint indx[], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++) {
- if (mask[i]) {
- indx[i]=*(Current->ScreenMem+FLIP(y[i])*Current->ScanWidth+x[i]);
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-/* Read a horizontal span of color pixels. */
-static void read_rgba_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- UINT i;
- COLORREF Color;
- HDC DC=DD_GETDC;
- assert(Current->rgb_flag==GL_TRUE);
- y = Current->height - y - 1;
- for (i=0; i<n; i++) {
- Color=GetPixel(DC,x+i,y);
- rgba[i][RCOMP] = GetRValue(Color);
- rgba[i][GCOMP] = GetGValue(Color);
- rgba[i][BCOMP] = GetBValue(Color);
- rgba[i][ACOMP] = 255;
- }
- DD_RELEASEDC;
-}
-
-//---------------------------------------------------------------------------
-
-/* Read an array of color pixels. */
-static void read_rgba_pixels( const GLcontext* ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- COLORREF Color;
- HDC DC=DD_GETDC;
- assert(Current->rgb_flag==GL_TRUE);
- for (i=0; i<n; i++) {
- if (mask[i]) {
- GLint y2 = Current->height - y[i] - 1;
- Color=GetPixel(DC,x[i],y2);
- rgba[i][RCOMP] = GetRValue(Color);
- rgba[i][GCOMP] = GetGValue(Color);
- rgba[i][BCOMP] = GetBValue(Color);
- rgba[i][ACOMP] = 255;
- }
- }
- DD_RELEASEDC;
-}
-
-//---------------------------------------------------------------------------
-
-static void wmesa_update_state(
- GLcontext *ctx,
- GLuint new_state)
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-}
-
-//---------------------------------------------------------------------------
-
-static void wmesa_viewport(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei w,
- GLsizei h)
-{
-// ctx->Driver.ResizeBuffersMESA(ctx);
-}
-
-//---------------------------------------------------------------------------
-
-static void wmesa_update_state_first_time(
- GLcontext *ctx,
- GLuint new_state)
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- /*
- * XXX these function pointers could be initialized just once during
- * context creation since they don't depend on any state changes.
- * kws - This is true - this function gets called a lot and it
- * would be good to minimize setting all this when not needed.
- */
- // Good idea, so I'll do it. KeithH. :-)
-
- ctx->Driver.GetString = _gldGetStringGeneric;
- ctx->Driver.UpdateState = wmesa_update_state;
- ctx->Driver.DrawBuffer = set_draw_buffer;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetBufferSize = buffer_size;
-
- ctx->Driver.Viewport = wmesa_viewport;
-
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.Clear = clear;
-
- ctx->Driver.Flush = flush;
- ctx->Driver.ClearIndex = clear_index;
- ctx->Driver.ClearColor = clear_color;
- ctx->Driver.Enable = enable;
-
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = _mesa_store_teximage2d;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- // Does not apply for Mesa 5.x
- //ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;
- //ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;
- //ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;
-
- swdd->SetBuffer = set_read_buffer;
-
-
- /* Pixel/span writing functions: */
- swdd->WriteRGBASpan = write_rgba_span;
- swdd->WriteRGBSpan = write_rgb_span;
- swdd->WriteMonoRGBASpan = write_mono_rgba_span;
- swdd->WriteRGBAPixels = write_rgba_pixels;
- swdd->WriteMonoRGBAPixels = write_mono_rgba_pixels;
- swdd->WriteCI32Span = write_ci32_span;
- swdd->WriteCI8Span = write_ci8_span;
- swdd->WriteMonoCISpan = write_mono_ci_span;
- swdd->WriteCI32Pixels = write_ci32_pixels;
- swdd->WriteMonoCIPixels = write_mono_ci_pixels;
-
- swdd->ReadCI32Span = read_ci32_span;
- swdd->ReadRGBASpan = read_rgba_span;
- swdd->ReadCI32Pixels = read_ci32_pixels;
- swdd->ReadRGBAPixels = read_rgba_pixels;
-
-
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
-
- wmesa_update_state(ctx, new_state);
-}
-
-//---------------------------------------------------------------------------
-// Driver interface functions
-//---------------------------------------------------------------------------
-
-BOOL gldCreateDrawable_MesaSW(
- DGL_ctx *pCtx,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- WMesaContext *c;
- GLboolean true_color_flag;
- GLboolean rgb_flag = GL_TRUE;
- GLboolean db_flag = GL_TRUE;
-
- if (pCtx == NULL)
- return FALSE;
-
- c = (struct wmesa_context * ) calloc(1,sizeof(struct wmesa_context));
- if (!c)
- return FALSE;
-
- pCtx->glPriv = c;
-
- c->hDC = pCtx->hDC;
- c->Window = pCtx->hWnd;
-
- true_color_flag = GetDeviceCaps(pCtx->hDC, BITSPIXEL) > 8;
-
-
-#ifdef DITHER
- if ((true_color_flag==GL_FALSE) && (rgb_flag == GL_TRUE)){
- c->dither_flag = GL_TRUE;
- c->hPalHalfTone = WinGCreateHalftonePalette();
- }
- else
- c->dither_flag = GL_FALSE;
-#else
- c->dither_flag = GL_FALSE;
-#endif
-
-
- if (rgb_flag==GL_FALSE)
- {
- c->rgb_flag = GL_FALSE;
-#if 0
- /* Old WinG stuff???? */
- c->db_flag = db_flag =GL_TRUE; /* WinG requires double buffering */
- printf("Single buffer is not supported in color index mode, ",
- "setting to double buffer.\n");
-#endif
- }
- else
- {
- c->rgb_flag = GL_TRUE;
- }
-
-// db_flag = pCtx->lpPF->pfd.dwFlags & PFD_DOUBLEBUFFER ? GL_TRUE : GL_FALSE;
- db_flag = GL_TRUE; // Force double-buffer
- if (db_flag) {
- c->db_flag = 1;
- /* Double buffered */
- {
- wmCreateBackingStore(c, pCtx->dwWidth, pCtx->dwHeight);
-
- }
- } else {
- /* Single Buffered */
- if (c->rgb_flag)
- c->db_flag = 0;
- }
-
- c->bEmulateSingleBuffer = (pCtx->lpPF->pfd.dwFlags & PFD_DOUBLEBUFFER)
- ? FALSE : TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldResizeDrawable_MesaSW(
- DGL_ctx *ctx,
- BOOL bDefaultDriver,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- WMesaContext *c;
-
- if (ctx == NULL)
- return FALSE;
-
- c = ctx->glPriv;
- if (c == NULL)
- return FALSE;
-
- c->hDC = ctx->hDC;
- c->Window = ctx->hWnd;
-// c->width = ctx->dwWidth;
-// c->height = ctx->dwHeight;
-
- if (c->db_flag) {
- wmDeleteBackingStore(c);
- wmCreateBackingStore(c, ctx->dwWidth, ctx->dwHeight);
- }
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyDrawable_MesaSW(
- DGL_ctx *ctx)
-{
- WMesaContext *c;
-
- if (ctx == NULL)
- return FALSE;
-
- c = ctx->glPriv;
- if (c == NULL)
- return FALSE;
-
- if (c->hPalHalfTone != NULL)
- DeleteObject(c->hPalHalfTone);
-
- if (c->db_flag)
- wmDeleteBackingStore(c);
-
- free(c);
-
- ctx->glPriv = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldCreatePrivateGlobals_MesaSW(void)
-{
- // Mesa Software driver needs no private globals
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyPrivateGlobals_MesaSW(void)
-{
- // Mesa Software driver needs no private globals
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldBuildPixelformatList_MesaSW(void)
-{
- // Release any existing pixelformat list
- if (glb.lpPF) {
- free(glb.lpPF);
- }
-
- glb.nPixelFormatCount = 0;
- glb.lpPF = NULL;
-
- glb.lpPF = (DGL_pixelFormat *)calloc(2, sizeof(DGL_pixelFormat));
- if (glb.lpPF == NULL)
- return FALSE;
- // Single-buffered
- memcpy(&glb.lpPF[0], &pfTemplateMesaSW, sizeof(DGL_pixelFormat));
- glb.lpPF[0].pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- // Double-buffered
- memcpy(&glb.lpPF[1], &pfTemplateMesaSW, sizeof(DGL_pixelFormat));
- glb.nPixelFormatCount = 2;
-
- // Mark list as 'current'
- glb.bPixelformatsDirty = FALSE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldInitialiseMesa_MesaSW(
- DGL_ctx *gld)
-{
- GLcontext *ctx;
-
- if (gld == NULL)
- return FALSE;
-
- ctx = gld->glCtx;
-
- // Set max texture size to 256
- ctx->Const.MaxTextureLevels = 8;
-
- // Multitexture enable/disable
- ctx->Const.MaxTextureUnits = (glb.bMultitexture) ? MAX_TEXTURE_UNITS : 1;
-
- /* Initialize the software rasterizer and helper modules.*/
-
- // Added this to force max texture diminsion to 256. KeithH
- ctx->Const.MaxTextureLevels = 8;
- ctx->Const.MaxDrawBuffers = 1;
-
- _mesa_enable_sw_extensions(ctx);
- _mesa_enable_imaging_extensions(ctx);
- _mesa_enable_1_3_extensions(ctx);
-
-// _swrast_CreateContext( ctx );
-// _vbo_CreateContext( ctx );
-// _tnl_CreateContext( ctx );
-// _swsetup_CreateContext( ctx );
-
- _swsetup_Wakeup( ctx );
-
- wmesa_update_state_first_time(ctx, ~0);
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldSwapBuffers_MesaSW(
- DGL_ctx *ctx,
- HDC hDC,
- HWND hWnd)
-{
- WMesaContext *c;
-
- if (ctx == NULL)
- return FALSE;
-
- c = ctx->glPriv;
- if (c == NULL)
- return FALSE;
-
- /* If we're swapping the buffer associated with the current context
- * we have to flush any pending rendering commands first.
- */
-
- // Altered to respect bEmulateSingleBuffer. KeithH
-// if (c->db_flag)
- if (!c->bEmulateSingleBuffer)
- wmFlush(c, hDC);
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_MesaSW(
- LPCSTR a)
-{
- int i;
- PROC proc = NULL;
-
- for (i=0; GLD_extList[i].proc; i++) {
- if (!strcmp(a, GLD_extList[i].name)) {
- proc = GLD_extList[i].proc;
- break;
- }
- }
-
- gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed");
-
- return proc;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldGetDisplayMode_MesaSW(
- DGL_ctx *ctx,
- GLD_displayMode *glddm)
-{
- HDC hdcDesktop;
-
- if (glddm == NULL)
- return FALSE;
-
- //
- // A bit hacky... KeithH
- //
-
- hdcDesktop = GetDC(NULL);
- glddm->Width = GetDeviceCaps(hdcDesktop, HORZRES);
- glddm->Height = GetDeviceCaps(hdcDesktop, VERTRES);
- glddm->BPP = GetDeviceCaps(hdcDesktop, BITSPIXEL);
- glddm->Refresh = 0;
- ReleaseDC(0, hdcDesktop);
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/opengl32.ref b/mesalib/src/mesa/drivers/windows/gldirect/opengl32.ref
deleted file mode 100644
index 2f71faf21..000000000
--- a/mesalib/src/mesa/drivers/windows/gldirect/opengl32.ref
+++ /dev/null
@@ -1,495 +0,0 @@
-;****************************************************************************
-;*
-;* Mesa 3-D graphics library
-;* Direct3D Driver Interface
-;*
-;* ========================================================================
-;*
-;* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-;*
-;* Permission is hereby granted, free of charge, to any person obtaining a
-;* copy of this software and associated documentation files (the "Software"),
-;* to deal in the Software without restriction, including without limitation
-;* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-;* and/or sell copies of the Software, and to permit persons to whom the
-;* Software is furnished to do so, subject to the following conditions:
-;*
-;* The above copyright notice and this permission notice shall be included
-;* in all copies or substantial portions of the Software.
-;*
-;* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-;* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-;* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-;* SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-;* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-;* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;* SOFTWARE.
-;*
-;* ======================================================================
-;*
-;* Language: ANSI C
-;* Environment: Windows 9x/2000/XP/XBox (Win32)
-;*
-;* Description: DLL Module definition file
-;*
-;****************************************************************************/
-
-DESCRIPTION 'GLDirect'
-
-VERSION 3.0
-
-EXPORTS
- glAccum
- glAlphaFunc
- glAreTexturesResident
- glArrayElement
- glBegin
- glBindTexture
- glBitmap
- glBlendFunc
- glCallList
- glCallLists
- glClear
- glClearAccum
- glClearIndex
- glClearColor
- glClearDepth
- glClearStencil
- glClipPlane
- glColor3b
- glColor3d
- glColor3f
- glColor3i
- glColor3s
- glColor3ub
- glColor3ui
- glColor3us
- glColor4b
- glColor4d
- glColor4f
- glColor4i
- glColor4s
- glColor4ub
- glColor4ui
- glColor4us
- glColor3bv
- glColor3dv
- glColor3fv
- glColor3iv
- glColor3sv
- glColor3ubv
- glColor3uiv
- glColor3usv
- glColor4bv
- glColor4dv
- glColor4fv
- glColor4iv
- glColor4sv
- glColor4ubv
- glColor4uiv
- glColor4usv
- glColorMask
- glColorMaterial
- glColorPointer
- glColorTableEXT
- glColorSubTableEXT
- glCopyPixels
- glCopyTexImage1D
- glCopyTexImage2D
- glCopyTexSubImage1D
- glCopyTexSubImage2D
- glCullFace
- glDepthFunc
- glDepthMask
- glDepthRange
- glDeleteLists
- glDeleteTextures
- glDisable
- glDisableClientState
- glDrawArrays
- glDrawBuffer
- glDrawElements
- glDrawPixels
- glEnable
- glEnableClientState
- glEnd
- glEndList
- glEvalCoord1d
- glEvalCoord1f
- glEvalCoord1dv
- glEvalCoord1fv
- glEvalCoord2d
- glEvalCoord2f
- glEvalCoord2dv
- glEvalCoord2fv
- glEvalPoint1
- glEvalPoint2
- glEvalMesh1
- glEdgeFlag
- glEdgeFlagv
- glEdgeFlagPointer
- glEvalMesh2
- glFeedbackBuffer
- glFinish
- glFlush
- glFogf
- glFogi
- glFogfv
- glFogiv
- glFrontFace
- glFrustum
- glGenLists
- glGenTextures
- glGetBooleanv
- glGetClipPlane
- glGetColorTableEXT
- glGetColorTableParameterivEXT
- glGetColorTableParameterfvEXT
- glGetDoublev
- glGetError
- glGetFloatv
- glGetIntegerv
- glGetLightfv
- glGetLightiv
- glGetMapdv
- glGetMapfv
- glGetMapiv
- glGetMaterialfv
- glGetMaterialiv
- glGetPixelMapfv
- glGetPixelMapuiv
- glGetPixelMapusv
- glGetPointerv
- glGetPolygonStipple
- glGetString
- glGetTexEnvfv
- glGetTexEnviv
- glGetTexGeniv
- glGetTexGendv
- glGetTexGenfv
- glGetTexImage
- glGetTexLevelParameterfv
- glGetTexLevelParameteriv
- glGetTexParameterfv
- glGetTexParameteriv
- glHint
- glIndexd
- glIndexf
- glIndexi
- glIndexs
- glIndexub
- glIndexdv
- glIndexfv
- glIndexiv
- glIndexsv
- glIndexubv
- glIndexMask
- glIndexPointer
- glInterleavedArrays
- glInitNames
- glIsList
- glIsTexture
- glLightf
- glLighti
- glLightfv
- glLightiv
- glLightModelf
- glLightModeli
- glLightModelfv
- glLightModeliv
- glLineWidth
- glLineStipple
- glListBase
- glLoadIdentity
- glLoadMatrixd
- glLoadMatrixf
- glLoadName
- glLogicOp
- glMap1d
- glMap1f
- glMap2d
- glMap2f
- glMapGrid1d
- glMapGrid1f
- glMapGrid2d
- glMapGrid2f
- glMaterialf
- glMateriali
- glMaterialfv
- glMaterialiv
- glMatrixMode
- glMultMatrixd
- glMultMatrixf
- glNewList
- glNormal3b
- glNormal3d
- glNormal3f
- glNormal3i
- glNormal3s
- glNormal3bv
- glNormal3dv
- glNormal3fv
- glNormal3iv
- glNormal3sv
- glNormalPointer
- glOrtho
- glPassThrough
- glPixelMapfv
- glPixelMapuiv
- glPixelMapusv
- glPixelStoref
- glPixelStorei
- glPixelTransferf
- glPixelTransferi
- glPixelZoom
- glPointSize
- glPolygonMode
- glPolygonOffset
- glPolygonOffsetEXT
- glPolygonStipple
- glPopAttrib
- glPopClientAttrib
- glPopMatrix
- glPopName
- glPrioritizeTextures
- glPushMatrix
- glRasterPos2d
- glRasterPos2f
- glRasterPos2i
- glRasterPos2s
- glRasterPos3d
- glRasterPos3f
- glRasterPos3i
- glRasterPos3s
- glRasterPos4d
- glRasterPos4f
- glRasterPos4i
- glRasterPos4s
- glRasterPos2dv
- glRasterPos2fv
- glRasterPos2iv
- glRasterPos2sv
- glRasterPos3dv
- glRasterPos3fv
- glRasterPos3iv
- glRasterPos3sv
- glRasterPos4dv
- glRasterPos4fv
- glRasterPos4iv
- glRasterPos4sv
- glReadBuffer
- glReadPixels
- glRectd
- glRectf
- glRecti
- glRects
- glRectdv
- glRectfv
- glRectiv
- glRectsv
- glScissor
- glIsEnabled
- glPushAttrib
- glPushClientAttrib
- glPushName
- glRenderMode
- glRotated
- glRotatef
- glSelectBuffer
- glScaled
- glScalef
- glShadeModel
- glStencilFunc
- glStencilMask
- glStencilOp
- glTexCoord1d
- glTexCoord1f
- glTexCoord1i
- glTexCoord1s
- glTexCoord2d
- glTexCoord2f
- glTexCoord2i
- glTexCoord2s
- glTexCoord3d
- glTexCoord3f
- glTexCoord3i
- glTexCoord3s
- glTexCoord4d
- glTexCoord4f
- glTexCoord4i
- glTexCoord4s
- glTexCoord1dv
- glTexCoord1fv
- glTexCoord1iv
- glTexCoord1sv
- glTexCoord2dv
- glTexCoord2fv
- glTexCoord2iv
- glTexCoord2sv
- glTexCoord3dv
- glTexCoord3fv
- glTexCoord3iv
- glTexCoord3sv
- glTexCoord4dv
- glTexCoord4fv
- glTexCoord4iv
- glTexCoord4sv
- glTexCoordPointer
- glTexGend
- glTexGenf
- glTexGeni
- glTexGendv
- glTexGeniv
- glTexGenfv
- glTexEnvf
- glTexEnvi
- glTexEnvfv
- glTexEnviv
- glTexImage1D
- glTexImage2D
- glTexParameterf
- glTexParameteri
- glTexParameterfv
- glTexParameteriv
- glTexSubImage1D
- glTexSubImage2D
- glTranslated
- glTranslatef
- glVertex2d
- glVertex2f
- glVertex2i
- glVertex2s
- glVertex3d
- glVertex3f
- glVertex3i
- glVertex3s
- glVertex4d
- glVertex4f
- glVertex4i
- glVertex4s
- glVertex2dv
- glVertex2fv
- glVertex2iv
- glVertex2sv
- glVertex3dv
- glVertex3fv
- glVertex3iv
- glVertex3sv
- glVertex4dv
- glVertex4fv
- glVertex4iv
- glVertex4sv
- glVertexPointer
- glViewport
-
- glBlendEquationEXT
- glBlendColorEXT
- glVertexPointerEXT
- glNormalPointerEXT
- glColorPointerEXT
- glIndexPointerEXT
- glTexCoordPointerEXT
- glEdgeFlagPointerEXT
- glGetPointervEXT
- glArrayElementEXT
- glDrawArraysEXT
- glBindTextureEXT
- glDeleteTexturesEXT
- glGenTexturesEXT
- glPrioritizeTexturesEXT
- glCopyTexSubImage3DEXT
- glTexImage3DEXT
- glTexSubImage3DEXT
-
- glWindowPos4fMESA
- glWindowPos2iMESA
- glWindowPos2sMESA
- glWindowPos2fMESA
- glWindowPos2dMESA
- glWindowPos2ivMESA
- glWindowPos2svMESA
- glWindowPos2fvMESA
- glWindowPos2dvMESA
- glWindowPos3iMESA
- glWindowPos3sMESA
- glWindowPos3fMESA
- glWindowPos3dMESA
- glWindowPos3ivMESA
- glWindowPos3svMESA
- glWindowPos3fvMESA
- glWindowPos3dvMESA
- glWindowPos4iMESA
- glWindowPos4sMESA
- glWindowPos4dMESA
- glWindowPos4ivMESA
- glWindowPos4svMESA
- glWindowPos4fvMESA
- glWindowPos4dvMESA
- glResizeBuffersMESA
-
- wglCopyContext
- wglCreateContext
- wglCreateLayerContext
- wglDeleteContext
- wglDescribeLayerPlane
- wglGetCurrentContext
- wglGetCurrentDC
- wglGetLayerPaletteEntries
- wglGetProcAddress
- wglMakeCurrent
- wglRealizeLayerPalette
- wglSetLayerPaletteEntries
- wglShareLists
- wglSwapLayerBuffers
- wglUseFontBitmapsA
- wglUseFontBitmapsW
- wglUseFontOutlinesA
- wglUseFontOutlinesW
-
-;These functions are identical and therefore share the same addresses
- ChoosePixelFormat = wglChoosePixelFormat
- DescribePixelFormat = wglDescribePixelFormat
- GetPixelFormat = wglGetPixelFormat
- SetPixelFormat = wglSetPixelFormat
- SwapBuffers = wglSwapBuffers
-
- wglChoosePixelFormat
- wglDescribePixelFormat
- wglGetPixelFormat
- wglSetPixelFormat
- wglSwapBuffers
-
- glActiveTextureARB
- glClientActiveTextureARB
- glMultiTexCoord1dARB
- glMultiTexCoord1dvARB
- glMultiTexCoord1fARB
- glMultiTexCoord1fvARB
- glMultiTexCoord1iARB
- glMultiTexCoord1ivARB
- glMultiTexCoord1sARB
- glMultiTexCoord1svARB
- glMultiTexCoord2dARB
- glMultiTexCoord2dvARB
- glMultiTexCoord2fARB
- glMultiTexCoord2fvARB
- glMultiTexCoord2iARB
- glMultiTexCoord2ivARB
- glMultiTexCoord2sARB
- glMultiTexCoord2svARB
- glMultiTexCoord3dARB
- glMultiTexCoord3dvARB
- glMultiTexCoord3fARB
- glMultiTexCoord3fvARB
- glMultiTexCoord3iARB
- glMultiTexCoord3ivARB
- glMultiTexCoord3sARB
- glMultiTexCoord3svARB
- glMultiTexCoord4dARB
- glMultiTexCoord4dvARB
- glMultiTexCoord4fARB
- glMultiTexCoord4fvARB
- glMultiTexCoord4iARB
- glMultiTexCoord4ivARB
- glMultiTexCoord4sARB
- glMultiTexCoord4svARB
diff --git a/mesalib/src/mesa/drivers/windows/icd/mesa.def b/mesalib/src/mesa/drivers/windows/icd/mesa.def
index 465b380a0..25ac08a2f 100644
--- a/mesalib/src/mesa/drivers/windows/icd/mesa.def
+++ b/mesalib/src/mesa/drivers/windows/icd/mesa.def
@@ -75,6 +75,15 @@ EXPORTS
_mesa_strcmp
_mesa_test_proxy_teximage
_mesa_Viewport
+ _mesa_meta_CopyColorSubTable
+ _mesa_meta_CopyColorTable
+ _mesa_meta_CopyConvolutionFilter1D
+ _mesa_meta_CopyConvolutionFilter2D
+ _mesa_meta_CopyTexImage1D
+ _mesa_meta_CopyTexImage2D
+ _mesa_meta_CopyTexSubImage1D
+ _mesa_meta_CopyTexSubImage2D
+ _mesa_meta_CopyTexSubImage3D
_swrast_Accum
_swrast_Bitmap
_swrast_CopyPixels
@@ -84,15 +93,6 @@ EXPORTS
_swrast_Clear
_swrast_choose_line
_swrast_choose_triangle
- _swrast_CopyColorSubTable
- _swrast_CopyColorTable
- _swrast_CopyConvolutionFilter1D
- _swrast_CopyConvolutionFilter2D
- _swrast_copy_teximage1d
- _swrast_copy_teximage2d
- _swrast_copy_texsubimage1d
- _swrast_copy_texsubimage2d
- _swrast_copy_texsubimage3d
_swrast_CreateContext
_swrast_DestroyContext
_swrast_InvalidateState