mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-24 18:54:10 +08:00
updates from Daniel Borca
This commit is contained in:
parent
d6643331ab
commit
a75246f8f5
@ -1,12 +1,12 @@
|
||||
Mesa 5.0.1 DOS/DJGPP Port v1.4
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Mesa 5.1 DOS/DJGPP Port v1.4
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
Description:
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Well, guess what... this is the DOS port of Mesa 5.0.1, for DJGPP fans... Whoa!
|
||||
Well, guess what... this is the DOS port of Mesa 5.1, for DJGPP fans... Whoa!
|
||||
The driver has its origins in ddsample.c, written by Brian Paul and found by me
|
||||
in Mesa 3.4.2.
|
||||
|
||||
@ -209,7 +209,7 @@ v1.3 (mar-2003)
|
||||
* revamped GLUT
|
||||
* switched to DXE3
|
||||
|
||||
v1.4 (aug-2003)
|
||||
v1.4 (oct-2003)
|
||||
+ enabled GLUT fonts with DXE
|
||||
+ truly added multi-window support in GLUT (for Adrian Woodward)
|
||||
* accomodated makefiles with the new sourcetree
|
||||
|
@ -38,7 +38,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define FXMESA_MAJOR_VERSION 4
|
||||
#define FXMESA_MAJOR_VERSION 5
|
||||
#define FXMESA_MINOR_VERSION 0
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ extern "C" {
|
||||
#define FXMESA_STENCIL_SIZE 13 /* followed by an integer */
|
||||
#define FXMESA_ACCUM_SIZE 14 /* followed by an integer */
|
||||
#define FXMESA_COLORDEPTH 20 /* followed by an integer */
|
||||
#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */
|
||||
|
||||
|
||||
|
||||
@ -84,7 +85,7 @@ GLAPI void GLAPIENTRY fxMesaSetNearFar(GLfloat nearVal, GLfloat farVal);
|
||||
|
||||
GLAPI void GLAPIENTRY fxMesaUpdateScreenSize(fxMesaContext ctx);
|
||||
|
||||
GLAPI int GLAPIENTRY fxQueryHardware(void);
|
||||
GLAPI GLboolean GLAPIENTRY fxQueryHardware(void);
|
||||
|
||||
GLAPI void GLAPIENTRY fxCloseHardware(void);
|
||||
|
||||
|
67
progs/samples/Makefile.mgw
Normal file
67
progs/samples/Makefile.mgw
Normal file
@ -0,0 +1,67 @@
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 4.0
|
||||
#
|
||||
# Copyright (C) 1999 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.
|
||||
|
||||
# MinGW samples makefile v1.0 for Mesa
|
||||
#
|
||||
# Copyright (C) 2002 - Borca Daniel
|
||||
# Email : dborca@users.sourceforge.net
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
|
||||
#
|
||||
# Available options:
|
||||
#
|
||||
# Environment variables:
|
||||
# CPU optimize for the given processor.
|
||||
# default = pentium
|
||||
#
|
||||
# Targets:
|
||||
# <file.exe> build a specific file
|
||||
#
|
||||
|
||||
|
||||
|
||||
.PHONY : all
|
||||
.SUFFIXES : .c .o .exe
|
||||
|
||||
TOP = ../..
|
||||
CPU ?= pentium
|
||||
|
||||
CC = mingw32-gcc
|
||||
CFLAGS = -Wall -W -pedantic
|
||||
CFLAGS += -O2 -ffast-math -mcpu=$(CPU)
|
||||
CFLAGS += -I$(TOP)/include -I../util
|
||||
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK
|
||||
CFLAGS += -D_WINDEF_ -D_WINGDI_
|
||||
|
||||
LD = mingw32-g++
|
||||
LDFLAGS = -s -L$(TOP)/lib
|
||||
|
||||
LDLIBS = -lglut32 -lglu32 -lopengl32
|
||||
|
||||
.c.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
.o.exe:
|
||||
$(LD) -o $@ $(LDFLAGS) $< $(LDLIBS)
|
||||
|
||||
all:
|
||||
$(error Must specify <filename.exe> to build)
|
@ -37,7 +37,7 @@
|
||||
GLUTwindow *g_curwin;
|
||||
static GLuint swaptime, swapcount;
|
||||
|
||||
static DMesaVisual visual = NULL;
|
||||
static DMesaVisual visual = NULL;
|
||||
GLUTwindow *g_windows[MAX_WINDOWS];
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ static void clean (void)
|
||||
for (i=1; i<=MAX_WINDOWS; i++) {
|
||||
glutDestroyWindow(i);
|
||||
}
|
||||
if (visual) DMesaDestroyVisual(visual);
|
||||
if (visual) DMesaDestroyVisual(visual);
|
||||
|
||||
pc_close_stdout();
|
||||
pc_close_stderr();
|
||||
|
@ -304,7 +304,8 @@ DRIVER_SOURCES += \
|
||||
drivers/glide/fxtexman.c \
|
||||
drivers/glide/fxtris.c \
|
||||
drivers/glide/fxvb.c \
|
||||
drivers/glide/fxglidew.c
|
||||
drivers/glide/fxglidew.c \
|
||||
drivers/glide/fxg.c
|
||||
else
|
||||
ifeq ($(MATROX),1)
|
||||
DRIVER_SOURCES += \
|
||||
|
@ -60,6 +60,7 @@
|
||||
|
||||
.PHONY: all clean
|
||||
.INTERMEDIATE: x86/gen_matypes.exe
|
||||
.SUFFIXES: .rc .res
|
||||
|
||||
TOP = ../..
|
||||
GLIDE ?= $(TOP)/glide3
|
||||
@ -75,8 +76,9 @@ CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi
|
||||
ifeq ($(FX),1)
|
||||
CFLAGS += -DH3
|
||||
CFLAGS += -I$(GLIDE)/include -DFX
|
||||
LDLIBS += -L$(GLIDE)/lib -lglide3
|
||||
LDLIBS += -L$(GLIDE)/lib -lglide3x
|
||||
GL_DEF = drivers/glide/fxopengl.def
|
||||
GL_RES = drivers/glide/fx.rc
|
||||
else
|
||||
GL_DEF = drivers/windows/gdi/mesa.def
|
||||
endif
|
||||
@ -135,6 +137,7 @@ MAIN_SOURCES = \
|
||||
main/pixel.c \
|
||||
main/points.c \
|
||||
main/polygon.c \
|
||||
main/program.c \
|
||||
main/rastpos.c \
|
||||
main/state.c \
|
||||
main/stencil.c \
|
||||
@ -293,6 +296,7 @@ DRIVER_SOURCES = \
|
||||
drivers/glide/fxtris.c \
|
||||
drivers/glide/fxvb.c \
|
||||
drivers/glide/fxglidew.c \
|
||||
drivers/glide/fxg.c \
|
||||
drivers/glide/fxwgl.c
|
||||
else
|
||||
DRIVER_SOURCES = \
|
||||
@ -306,16 +310,20 @@ OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
|
||||
|
||||
X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
|
||||
|
||||
RESOURCE = $(GL_RES:.rc=.res)
|
||||
|
||||
.c.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
.S.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
.s.o:
|
||||
$(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
|
||||
.rc.res:
|
||||
windres -o $@ -Irc -Ocoff $<
|
||||
|
||||
all: $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
|
||||
|
||||
$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS)
|
||||
$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
|
||||
dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) --target i386-mingw32 --def $(GL_DEF) $^ $(LDLIBS)
|
||||
|
||||
$(X86_OBJECTS): x86/matypes.h
|
||||
@ -326,6 +334,12 @@ x86/matypes.h: x86/gen_matypes.exe
|
||||
x86/gen_matypes.exe: x86/gen_matypes.c
|
||||
$(CC) -o $@ $(CFLAGS) -s $<
|
||||
|
||||
# [dBorca] Hack alert:
|
||||
# use standard API, to work around Win32 @x names
|
||||
# also glapi_x86.S is protected against __WIN32__
|
||||
main/dispatch.o: main/dispatch.c
|
||||
$(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
|
||||
|
||||
clean:
|
||||
-$(call UNLINK,array_cache/*.o)
|
||||
-$(call UNLINK,glapi/*.o)
|
||||
@ -337,3 +351,4 @@ clean:
|
||||
-$(call UNLINK,x86/*.o)
|
||||
-$(call UNLINK,drivers/windows/gdi/*.o)
|
||||
-$(call UNLINK,drivers/glide/*.o)
|
||||
-$(call UNLINK,drivers/glide/*.res)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: fxapi.c,v 1.37 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxapi.c,v 1.38 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -44,6 +44,22 @@
|
||||
#if defined(FX)
|
||||
#include "fxdrv.h"
|
||||
|
||||
#ifndef TDFX_DEBUG
|
||||
int TDFX_DEBUG = (0
|
||||
/* | VERBOSE_VARRAY */
|
||||
/* | VERBOSE_TEXTURE */
|
||||
/* | VERBOSE_IMMEDIATE */
|
||||
/* | VERBOSE_PIPELINE */
|
||||
/* | VERBOSE_DRIVER */
|
||||
/* | VERBOSE_STATE */
|
||||
/* | VERBOSE_API */
|
||||
/* | VERBOSE_DISPLAY_LIST */
|
||||
/* | VERBOSE_LIGHTING */
|
||||
/* | VERBOSE_PRIMS */
|
||||
/* | VERBOSE_VERTS */
|
||||
);
|
||||
#endif
|
||||
|
||||
static fxMesaContext fxMesaCurrentCtx = NULL;
|
||||
|
||||
/*
|
||||
@ -54,8 +70,8 @@ static int glbGlideInitialized = 0;
|
||||
static int glb3DfxPresent = 0;
|
||||
static int glbTotNumCtx = 0;
|
||||
|
||||
GrHwConfiguration glbHWConfig;
|
||||
int glbCurrentBoard = 0;
|
||||
static GrHwConfiguration glbHWConfig;
|
||||
static int glbCurrentBoard = 0;
|
||||
|
||||
|
||||
#if defined(__WIN32__)
|
||||
@ -78,7 +94,7 @@ cleangraphics(void)
|
||||
static void
|
||||
cleangraphics_handler(int s)
|
||||
{
|
||||
fprintf(stderr, "fxmesa: Received a not handled signal %d\n", s);
|
||||
fprintf(stderr, "fxmesa: ERROR: received a not handled signal %d\n", s);
|
||||
|
||||
cleangraphics();
|
||||
/* abort(); */
|
||||
@ -91,8 +107,7 @@ cleangraphics_handler(int s)
|
||||
* Select the Voodoo board to use when creating
|
||||
* a new context.
|
||||
*/
|
||||
GLboolean GLAPIENTRY
|
||||
fxMesaSelectCurrentBoard(int n)
|
||||
GLboolean GLAPIENTRY fxMesaSelectCurrentBoard (int n)
|
||||
{
|
||||
fxQueryHardware();
|
||||
|
||||
@ -142,13 +157,14 @@ gl3DfxSetPaletteEXT(GLuint * pal)
|
||||
{
|
||||
fxMesaContext fxMesa = fxMesaCurrentCtx;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
int i;
|
||||
|
||||
fprintf(stderr, "fxmesa: gl3DfxSetPaletteEXT()\n");
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
fprintf(stderr, "%x\n", pal[i]);
|
||||
for (i = 0; i < 256; i++) {
|
||||
fprintf(stderr, "\t%x\n", pal[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (fxMesa) {
|
||||
@ -159,53 +175,34 @@ gl3DfxSetPaletteEXT(GLuint * pal)
|
||||
}
|
||||
|
||||
|
||||
static GrScreenResolution_t
|
||||
fxBestResolution(int width, int height, int aux)
|
||||
static GrScreenResolution_t fxBestResolution (int width, int height)
|
||||
{
|
||||
static int resolutions[][5] = {
|
||||
{320, 200, GR_RESOLUTION_320x200, 2, 2},
|
||||
{320, 240, GR_RESOLUTION_320x240, 2, 2},
|
||||
{512, 384, GR_RESOLUTION_512x384, 2, 2},
|
||||
{640, 400, GR_RESOLUTION_640x400, 2, 2},
|
||||
{640, 480, GR_RESOLUTION_640x480, 2, 2},
|
||||
{800, 600, GR_RESOLUTION_800x600, 4, 2},
|
||||
{960, 720, GR_RESOLUTION_960x720, 6, 4}
|
||||
#ifdef GR_RESOLUTION_1024x768
|
||||
, {1024, 768, GR_RESOLUTION_1024x768, 8, 4}
|
||||
#endif
|
||||
#ifdef GR_RESOLUTION_1280x1024
|
||||
, {1280, 1024, GR_RESOLUTION_1280x1024, 8, 8}
|
||||
#endif
|
||||
#ifdef GR_RESOLUTION_1600x1200
|
||||
, {1600, 1200, GR_RESOLUTION_1600x1200, 16, 8}
|
||||
#endif
|
||||
};
|
||||
int NUM_RESOLUTIONS = sizeof(resolutions) / (sizeof(int) * 5);
|
||||
int i, fbmem;
|
||||
GrScreenResolution_t lastvalidres = resolutions[4][2];
|
||||
static int resolutions[][5] = {
|
||||
{ 320, 200, GR_RESOLUTION_320x200 },
|
||||
{ 320, 240, GR_RESOLUTION_320x240 },
|
||||
{ 512, 384, GR_RESOLUTION_512x384 },
|
||||
{ 640, 400, GR_RESOLUTION_640x400 },
|
||||
{ 640, 480, GR_RESOLUTION_640x480 },
|
||||
{ 800, 600, GR_RESOLUTION_800x600 },
|
||||
{1024, 768, GR_RESOLUTION_1024x768 },
|
||||
{1280, 1024, GR_RESOLUTION_1280x1024},
|
||||
{1600, 1200, GR_RESOLUTION_1600x1200},
|
||||
};
|
||||
|
||||
fxQueryHardware();
|
||||
int i, NUM_RESOLUTIONS = sizeof(resolutions) / sizeof(resolutions[0]);
|
||||
int lastvalidres = 4; /* set default to GR_RESOLUTION_640x480 */
|
||||
int min = 2048 * 2048; /* max is GR_RESOLUTION_2048x2048 */
|
||||
|
||||
fbmem = glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig.fbRam
|
||||
* glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig.numChips;
|
||||
for (i = 0; i < NUM_RESOLUTIONS; i++) {
|
||||
if ((width <= resolutions[i][0]) && (height <= resolutions[i][1])) {
|
||||
if (min > (resolutions[i][0] * resolutions[i][1])) {
|
||||
min = resolutions[i][0] * resolutions[i][1];
|
||||
lastvalidres = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* A work around for BZFlag */
|
||||
|
||||
if ((width == 1) && (height == 1)) {
|
||||
width = 640;
|
||||
height = 480;
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_RESOLUTIONS; i++) {
|
||||
if (resolutions[i][4 - aux] <= fbmem) {
|
||||
if ((width <= resolutions[i][0]) && (height <= resolutions[i][1])) {
|
||||
return resolutions[i][2];
|
||||
}
|
||||
lastvalidres = resolutions[i][2];
|
||||
}
|
||||
}
|
||||
|
||||
return lastvalidres;
|
||||
return resolutions[lastvalidres][2];
|
||||
}
|
||||
|
||||
|
||||
@ -213,63 +210,16 @@ fxMesaContext GLAPIENTRY
|
||||
fxMesaCreateBestContext(GLuint win, GLint width, GLint height,
|
||||
const GLint attribList[])
|
||||
{
|
||||
GrScreenRefresh_t refresh;
|
||||
int i;
|
||||
int res, aux;
|
||||
refresh = GR_REFRESH_75Hz;
|
||||
int res = fxBestResolution(width, height);
|
||||
|
||||
if (getenv("SST_SCREENREFRESH")) {
|
||||
if (!strcmp(getenv("SST_SCREENREFRESH"), "60"))
|
||||
refresh = GR_REFRESH_60Hz;
|
||||
if (!strcmp(getenv("SST_SCREENREFRESH"), "70"))
|
||||
refresh = GR_REFRESH_70Hz;
|
||||
if (!strcmp(getenv("SST_SCREENREFRESH"), "72"))
|
||||
refresh = GR_REFRESH_72Hz;
|
||||
if (!strcmp(getenv("SST_SCREENREFRESH"), "75"))
|
||||
refresh = GR_REFRESH_75Hz;
|
||||
if (!strcmp(getenv("SST_SCREENREFRESH"), "80"))
|
||||
refresh = GR_REFRESH_80Hz;
|
||||
if (!strcmp(getenv("SST_SCREENREFRESH"), "85"))
|
||||
refresh = GR_REFRESH_85Hz;
|
||||
if (!strcmp(getenv("SST_SCREENREFRESH"), "90"))
|
||||
refresh = GR_REFRESH_90Hz;
|
||||
if (!strcmp(getenv("SST_SCREENREFRESH"), "100"))
|
||||
refresh = GR_REFRESH_100Hz;
|
||||
if (!strcmp(getenv("SST_SCREENREFRESH"), "120"))
|
||||
refresh = GR_REFRESH_120Hz;
|
||||
}
|
||||
if (res == -1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
aux = 0;
|
||||
for (i = 0; attribList[i] != FXMESA_NONE; i++)
|
||||
if ((attribList[i] == FXMESA_ALPHA_SIZE) ||
|
||||
(attribList[i] == FXMESA_DEPTH_SIZE)) {
|
||||
if (attribList[++i] > 0) {
|
||||
aux = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
res = fxBestResolution(width, height, aux);
|
||||
|
||||
return fxMesaCreateContext(win, res, refresh, attribList);
|
||||
return fxMesaCreateContext(win, res, GR_REFRESH_60Hz/*ZZZ: GR_REFRESH_75Hz*/, attribList);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void
|
||||
fxsignals()
|
||||
{
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGFPE, SIG_IGN);
|
||||
signal(SIGBUS, SIG_IGN);
|
||||
signal(SIGILL, SIG_IGN);
|
||||
signal(SIGSEGV, SIG_IGN);
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Create a new FX/Mesa context and return a handle to it.
|
||||
*/
|
||||
@ -278,149 +228,269 @@ fxMesaCreateContext(GLuint win,
|
||||
GrScreenResolution_t res,
|
||||
GrScreenRefresh_t ref, const GLint attribList[])
|
||||
{
|
||||
fxMesaContext fxMesa = NULL;
|
||||
int i, type;
|
||||
int aux;
|
||||
GLboolean doubleBuffer = GL_FALSE;
|
||||
GLboolean alphaBuffer = GL_FALSE;
|
||||
GLboolean verbose = GL_FALSE;
|
||||
GLint depthSize = 0;
|
||||
GLint stencilSize = 0;
|
||||
GLint accumSize = 0;
|
||||
GLcontext *shareCtx = NULL;
|
||||
GLcontext *ctx = 0;
|
||||
/*FX_GrContext_t glideContext = 0; */
|
||||
char *errorstr;
|
||||
GLboolean useBGR;
|
||||
GLuint pixFmt, colDepth = 16;
|
||||
GLint redBits, greenBits, blueBits, alphaBits;
|
||||
fxMesaContext fxMesa = NULL;
|
||||
GLcontext *ctx = NULL, *shareCtx = NULL;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxMesaCreateContext() Start\n");
|
||||
}
|
||||
int i;
|
||||
const char *str;
|
||||
int numChips, sliaa, fsaa;
|
||||
struct SstCard_St *voodoo;
|
||||
struct tdfx_glide *Glide;
|
||||
|
||||
if (getenv("MESA_FX_INFO"))
|
||||
verbose = GL_TRUE;
|
||||
GLboolean aux;
|
||||
GLboolean doubleBuffer;
|
||||
GLuint colDepth;
|
||||
GLuint depthSize, alphaSize, stencilSize, accumSize;
|
||||
GLuint redBits, greenBits, blueBits, alphaBits;
|
||||
GrPixelFormat_t pixFmt;
|
||||
|
||||
GLboolean useBGR;
|
||||
GLboolean verbose = GL_FALSE;
|
||||
|
||||
aux = 0;
|
||||
i = 0;
|
||||
while (attribList[i] != FXMESA_NONE) {
|
||||
switch (attribList[i]) {
|
||||
case FXMESA_COLORDEPTH:
|
||||
colDepth = attribList[++i];
|
||||
break;
|
||||
case FXMESA_DOUBLEBUFFER:
|
||||
doubleBuffer = GL_TRUE;
|
||||
break;
|
||||
case FXMESA_ALPHA_SIZE:
|
||||
i++;
|
||||
alphaBuffer = attribList[i] > 0;
|
||||
if (alphaBuffer) {
|
||||
aux = 1;
|
||||
}
|
||||
break;
|
||||
case FXMESA_DEPTH_SIZE:
|
||||
i++;
|
||||
depthSize = attribList[i];
|
||||
if (depthSize) {
|
||||
aux = 1;
|
||||
}
|
||||
break;
|
||||
case FXMESA_STENCIL_SIZE:
|
||||
i++;
|
||||
stencilSize = attribList[i];
|
||||
break;
|
||||
case FXMESA_ACCUM_SIZE:
|
||||
i++;
|
||||
accumSize = attribList[i];
|
||||
break;
|
||||
/* XXX ugly hack here for sharing display lists */
|
||||
#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */
|
||||
case FXMESA_SHARE_CONTEXT:
|
||||
i++;
|
||||
{
|
||||
const void *vPtr = &attribList[i];
|
||||
GLcontext **ctx = (GLcontext **) vPtr;
|
||||
shareCtx = *ctx;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: bad FXMESA_* switch\n");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (depthSize) {
|
||||
depthSize = (colDepth == 32) ? 24 : 16;
|
||||
}
|
||||
if (getenv("MESA_FX_INFO")) {
|
||||
verbose = GL_TRUE;
|
||||
}
|
||||
|
||||
/* A workaround for Linux GLQuake */
|
||||
if (depthSize && alphaBuffer)
|
||||
alphaBuffer = 0;
|
||||
/* Okay, first process the user flags */
|
||||
aux = GL_FALSE;
|
||||
doubleBuffer = GL_FALSE;
|
||||
colDepth = 16;
|
||||
depthSize = alphaSize = stencilSize = accumSize = 0;
|
||||
|
||||
if ((type = fxQueryHardware()) < 0) {
|
||||
fprintf(stderr, "fxmesa: ERROR no Voodoo hardware!\n");
|
||||
return NULL;
|
||||
}
|
||||
i = 0;
|
||||
while (attribList[i] != FXMESA_NONE) {
|
||||
switch (attribList[i]) {
|
||||
case FXMESA_COLORDEPTH:
|
||||
colDepth = attribList[++i];
|
||||
break;
|
||||
case FXMESA_DOUBLEBUFFER:
|
||||
doubleBuffer = GL_TRUE;
|
||||
break;
|
||||
case FXMESA_ALPHA_SIZE:
|
||||
if ((alphaSize = attribList[++i])) {
|
||||
aux = GL_TRUE;
|
||||
}
|
||||
break;
|
||||
case FXMESA_DEPTH_SIZE:
|
||||
if ((depthSize = attribList[++i])) {
|
||||
aux = GL_TRUE;
|
||||
}
|
||||
break;
|
||||
case FXMESA_STENCIL_SIZE:
|
||||
stencilSize = attribList[++i];
|
||||
break;
|
||||
case FXMESA_ACCUM_SIZE:
|
||||
accumSize = attribList[++i];
|
||||
break;
|
||||
/* XXX ugly hack here for sharing display lists */
|
||||
case FXMESA_SHARE_CONTEXT:
|
||||
{
|
||||
const void *vPtr = &attribList[++i];
|
||||
GLcontext **ctx = (GLcontext **)vPtr;
|
||||
shareCtx = *ctx;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: ERROR: wrong parameter (%d) passed\n", __FUNCTION__, attribList[i]);
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
grSstSelect(glbCurrentBoard);
|
||||
if (!fxQueryHardware()) {
|
||||
fprintf(stderr, "%s: ERROR: no Voodoo hardware!\n", __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fxMesa = (fxMesaContext) calloc(1, sizeof(struct tfxMesaContext));
|
||||
if (!fxMesa) {
|
||||
errorstr = "malloc";
|
||||
goto errorhandler;
|
||||
}
|
||||
grSstSelect(glbCurrentBoard);
|
||||
/*grEnable(GR_OPENGL_MODE_EXT);*/ /* ZZZ: trick to make GL happy.
|
||||
Glide3 will unmap memory for card when grSstWinClose is called.
|
||||
This also forces the SLI band height to be 32 (above 1024x768) or 16
|
||||
and disables the splash screen due to y-origin swapping.
|
||||
Note: We only want the former. */
|
||||
voodoo = &glbHWConfig.SSTs[glbCurrentBoard];
|
||||
numChips = voodoo->numChips;
|
||||
|
||||
fxMesa->haveTwoTMUs = (glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig.nTexelfx > 1);
|
||||
fxMesa->haveDoubleBuffer = doubleBuffer;
|
||||
fxMesa->haveAlphaBuffer = alphaBuffer;
|
||||
fxMesa->haveGlobalPaletteTexture = GL_FALSE;
|
||||
fxMesa->haveZBuffer = depthSize ? 1 : 0;
|
||||
fxMesa->verbose = verbose;
|
||||
fxMesa->board = glbCurrentBoard;
|
||||
fxMesa->maxTextureSize = glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig.maxTextureSize; /* [koolsmoky] */
|
||||
fxMesa = (fxMesaContext)CALLOC_STRUCT(tfxMesaContext);
|
||||
if (!fxMesa) {
|
||||
str = "private context";
|
||||
goto errorhandler;
|
||||
}
|
||||
|
||||
fxMesa->type = voodoo->type;
|
||||
fxMesa->HavePixExt = voodoo->HavePixExt;
|
||||
fxMesa->HaveTexFmt = voodoo->HaveTexFmt;
|
||||
fxMesa->HaveCmbExt = voodoo->HaveCmbExt;
|
||||
fxMesa->HaveMirExt = voodoo->HaveMirExt;
|
||||
fxMesa->HaveTexus2 = voodoo->HaveTexus2;
|
||||
fxMesa->Glide = glbHWConfig.Glide;
|
||||
Glide = &fxMesa->Glide;
|
||||
sprintf(fxMesa->rendererString, "Mesa %s v0.51 %s %dMB FB, %dMB TM, %d TMU, %s",
|
||||
grGetString(GR_RENDERER),
|
||||
grGetString(GR_HARDWARE),
|
||||
voodoo->fbRam,
|
||||
(voodoo->tmuConfig[GR_TMU0].tmuRam + ((voodoo->nTexelfx > 1) ? voodoo->tmuConfig[GR_TMU1].tmuRam : 0)),
|
||||
voodoo->nTexelfx,
|
||||
(numChips > 1) ? "SLI" : "NOSLI");
|
||||
|
||||
switch (fxMesa->colDepth = colDepth) {
|
||||
case 15:
|
||||
redBits = 5;
|
||||
greenBits = 5;
|
||||
blueBits = 5;
|
||||
alphaBits = 1;
|
||||
pixFmt = GR_PIXFMT_ARGB_1555;
|
||||
break;
|
||||
case 16:
|
||||
redBits = 5;
|
||||
greenBits = 6;
|
||||
blueBits = 5;
|
||||
alphaBits = 0;
|
||||
pixFmt = GR_PIXFMT_RGB_565;
|
||||
break;
|
||||
case 32:
|
||||
redBits = 8;
|
||||
greenBits = 8;
|
||||
blueBits = 8;
|
||||
alphaBits = 8;
|
||||
pixFmt = GR_PIXFMT_ARGB_8888;
|
||||
break;
|
||||
default:
|
||||
errorstr = "pixelFormat";
|
||||
goto errorhandler;
|
||||
}
|
||||
switch (fxMesa->colDepth = colDepth) {
|
||||
case 15:
|
||||
redBits = 5;
|
||||
greenBits = 5;
|
||||
blueBits = 5;
|
||||
alphaBits = 1;
|
||||
pixFmt = GR_PIXFMT_ARGB_1555;
|
||||
break;
|
||||
case 16:
|
||||
redBits = 5;
|
||||
greenBits = 6;
|
||||
blueBits = 5;
|
||||
alphaBits = depthSize ? 0 : 8;
|
||||
pixFmt = GR_PIXFMT_RGB_565;
|
||||
break;
|
||||
case 32:
|
||||
redBits = 8;
|
||||
greenBits = 8;
|
||||
blueBits = 8;
|
||||
alphaBits = 8;
|
||||
pixFmt = GR_PIXFMT_ARGB_8888;
|
||||
break;
|
||||
default:
|
||||
str = "pixelFormat";
|
||||
goto errorhandler;
|
||||
}
|
||||
|
||||
/* Tips:
|
||||
* 1. we don't bother setting/checking AUX for stencil, because we'll decide
|
||||
* later whether we have HW stencil, based on depth buffer (thus AUX is
|
||||
* properly set)
|
||||
* 2. when both DEPTH and ALPHA are enabled, depth should win. However, it is
|
||||
* not clear whether 15bpp and 32bpp require AUX alpha buffer. Furthermore,
|
||||
* alpha buffering is required only if destination alpha is used in alpha
|
||||
* blending; alpha blending modes that do not use destination alpha can be
|
||||
* used w/o alpha buffer.
|
||||
* 3. `alphaBits' is what we can provide
|
||||
* `alphaSize' is what app requests
|
||||
* if we cannot provide enough bits for alpha buffer, we should fallback to
|
||||
* SW alpha. However, setting `alphaBits' to `alphaSize' might confuse some
|
||||
* of the span functions...
|
||||
*/
|
||||
|
||||
fxMesa->glideContext = FX_grSstWinOpen(&glbHWConfig.SSTs[glbCurrentBoard],
|
||||
(FxU32)win, res, ref,
|
||||
GR_COLORFORMAT_ABGR,
|
||||
pixFmt,
|
||||
GR_ORIGIN_LOWER_LEFT, 2, aux);
|
||||
if (!fxMesa->glideContext) {
|
||||
errorstr = "grSstWinOpen";
|
||||
goto errorhandler;
|
||||
}
|
||||
fxMesa->haveHwAlpha = GL_FALSE;
|
||||
if (alphaSize && (alphaSize <= alphaBits)) {
|
||||
alphaSize = alphaBits;
|
||||
fxMesa->haveHwAlpha = GL_TRUE;
|
||||
}
|
||||
|
||||
fxMesa->haveHwStencil = (fxMesa->HavePixExt && stencilSize && depthSize == 24);
|
||||
|
||||
fxMesa->haveZBuffer = depthSize > 0;
|
||||
fxMesa->haveDoubleBuffer = doubleBuffer;
|
||||
fxMesa->haveGlobalPaletteTexture = GL_FALSE;
|
||||
fxMesa->verbose = verbose;
|
||||
fxMesa->board = glbCurrentBoard;
|
||||
|
||||
fxMesa->haveTwoTMUs = (voodoo->nTexelfx > 1);
|
||||
|
||||
if ((str = Glide->grGetRegistryOrEnvironmentStringExt("FX_GLIDE_NUM_TMU"))) {
|
||||
if (atoi(str) <= 1) {
|
||||
fxMesa->haveTwoTMUs = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((str = Glide->grGetRegistryOrEnvironmentStringExt("FX_GLIDE_SWAPPENDINGCOUNT"))) {
|
||||
fxMesa->maxPendingSwapBuffers = atoi(str);
|
||||
if (fxMesa->maxPendingSwapBuffers > 3) {
|
||||
fxMesa->maxPendingSwapBuffers = 3;
|
||||
} else if (fxMesa->maxPendingSwapBuffers < 0) {
|
||||
fxMesa->maxPendingSwapBuffers = 0;
|
||||
}
|
||||
} else {
|
||||
fxMesa->maxPendingSwapBuffers = 2;
|
||||
}
|
||||
|
||||
if ((str = Glide->grGetRegistryOrEnvironmentStringExt("FX_GLIDE_SWAPINTERVAL"))) {
|
||||
fxMesa->swapInterval = atoi(str);
|
||||
} else {
|
||||
fxMesa->swapInterval = 0;
|
||||
}
|
||||
|
||||
if ((str = Glide->grGetRegistryOrEnvironmentStringExt("SSTH3_SLI_AA_CONFIGURATION"))) {
|
||||
sliaa = atoi(str);
|
||||
} else {
|
||||
sliaa = 0;
|
||||
}
|
||||
switch (colDepth) {
|
||||
case 15:
|
||||
if ((numChips == 4) && (sliaa == 8)) {
|
||||
pixFmt = GR_PIXFMT_AA_8_ARGB_1555;
|
||||
fsaa = 8;
|
||||
} else if (((numChips == 4) && (sliaa == 7)) || ((numChips == 2) && (sliaa == 4))) {
|
||||
pixFmt = GR_PIXFMT_AA_4_ARGB_1555;
|
||||
fsaa = 4;
|
||||
} else if (((numChips == 4) && (sliaa == 6)) || ((numChips == 2) && (sliaa == 3)) || ((numChips == 1) && (sliaa == 1))) {
|
||||
pixFmt = GR_PIXFMT_AA_2_ARGB_1555;
|
||||
fsaa = 2;
|
||||
} else {
|
||||
fsaa = 0;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
if ((numChips == 4) && (sliaa == 8)) {
|
||||
pixFmt = GR_PIXFMT_AA_8_RGB_565;
|
||||
fsaa = 8;
|
||||
} else if (((numChips == 4) && (sliaa == 7)) || ((numChips == 2) && (sliaa == 4))) {
|
||||
pixFmt = GR_PIXFMT_AA_4_RGB_565;
|
||||
fsaa = 4;
|
||||
} else if (((numChips == 4) && (sliaa == 6)) || ((numChips == 2) && (sliaa == 3)) || ((numChips == 1) && (sliaa == 1))) {
|
||||
pixFmt = GR_PIXFMT_AA_2_RGB_565;
|
||||
fsaa = 2;
|
||||
} else {
|
||||
fsaa = 0;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
if ((numChips == 4) && (sliaa == 8)) {
|
||||
pixFmt = GR_PIXFMT_AA_8_ARGB_8888;
|
||||
fsaa = 8;
|
||||
} else if (((numChips == 4) && (sliaa == 7)) || ((numChips == 2) && (sliaa == 4))) {
|
||||
pixFmt = GR_PIXFMT_AA_4_ARGB_8888;
|
||||
fsaa = 4;
|
||||
} else if (((numChips == 4) && (sliaa == 6)) || ((numChips == 2) && (sliaa == 3)) || ((numChips == 1) && (sliaa == 1))) {
|
||||
pixFmt = GR_PIXFMT_AA_2_ARGB_8888;
|
||||
fsaa = 2;
|
||||
} else {
|
||||
fsaa = 0;
|
||||
}
|
||||
break;
|
||||
default: /* NOTREACHED */
|
||||
str = "pixelFormat";
|
||||
goto errorhandler;
|
||||
}
|
||||
fxMesa->fsaa = fsaa;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
if (fxMesa->HavePixExt) {
|
||||
fxMesa->glideContext = Glide->grSstWinOpenExt((FxU32)win, res, ref,
|
||||
GR_COLORFORMAT_ABGR, GR_ORIGIN_LOWER_LEFT,
|
||||
pixFmt,
|
||||
2, aux);
|
||||
} else if (pixFmt == GR_PIXFMT_RGB_565) {
|
||||
fxMesa->glideContext = grSstWinOpen((FxU32)win, res, ref,
|
||||
GR_COLORFORMAT_ABGR, GR_ORIGIN_LOWER_LEFT,
|
||||
2, aux);
|
||||
} else {
|
||||
fxMesa->glideContext = 0;
|
||||
}
|
||||
END_BOARD_LOCK();
|
||||
if (!fxMesa->glideContext) {
|
||||
str = "grSstWinOpen";
|
||||
goto errorhandler;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pixel tables are used during pixel read-back
|
||||
@ -429,7 +499,7 @@ fxMesaCreateContext(GLuint win,
|
||||
* As a consequence, 32bit read-back is not swizzled!
|
||||
* Also determine if we need vertex snapping.
|
||||
*/
|
||||
switch (glbHWConfig.SSTs[glbCurrentBoard].type) {
|
||||
switch (voodoo->type) {
|
||||
case GR_SSTTYPE_VOODOO:
|
||||
case GR_SSTTYPE_Banshee:
|
||||
useBGR = GL_TRUE;
|
||||
@ -448,12 +518,6 @@ fxMesaCreateContext(GLuint win,
|
||||
break;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "Voodoo pixel order = %s, vertex snapping = %d\n",
|
||||
useBGR ? "BGR" : "RGB",
|
||||
fxMesa->snapVertices);
|
||||
}
|
||||
|
||||
fxInitPixelTables(fxMesa, useBGR);
|
||||
|
||||
fxMesa->width = FX_grSstScreenWidth();
|
||||
@ -467,22 +531,40 @@ fxMesaCreateContext(GLuint win,
|
||||
fxMesa->screen_width = fxMesa->width;
|
||||
fxMesa->screen_height = fxMesa->height;
|
||||
|
||||
fxMesa->new_state = ~0;
|
||||
if (verbose) {
|
||||
char buf[80];
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "Voodoo screen: %dx%dx%d\n",
|
||||
(int)FX_grSstScreenWidth(), (int)FX_grSstScreenHeight(), colDepth);
|
||||
strcpy(buf, grGetString(GR_VERSION));
|
||||
fprintf(stderr, "Voodoo Using Glide %s\n", buf);
|
||||
fprintf(stderr, "Voodoo Number of boards: %d\n", glbHWConfig.num_sst);
|
||||
fprintf(stderr, "Voodoo Number of TMUs: %d\n", voodoo->nTexelfx);
|
||||
fprintf(stderr, "Voodoo fbRam: %d\n", voodoo->fbRam);
|
||||
fprintf(stderr, "Voodoo fbiRev: %d\n", voodoo->fbiRev);
|
||||
fprintf(stderr, "Voodoo chips detected: %d\n", voodoo->numChips);
|
||||
fprintf(stderr, "Voodoo pixel order = %s, vertex snapping = %d\n",
|
||||
useBGR ? "BGR" : "RGB",
|
||||
fxMesa->snapVertices);
|
||||
fprintf(stderr, "Voodoo screen: %dx%d.%d\n",
|
||||
fxMesa->screen_width, fxMesa->screen_height, colDepth);
|
||||
}
|
||||
|
||||
fxMesa->glVis = _mesa_create_visual(GL_TRUE, /* RGB mode */
|
||||
doubleBuffer, GL_FALSE, /* stereo */
|
||||
redBits, greenBits, blueBits, alphaBits, /* RGBA bits */
|
||||
0, /* index bits */
|
||||
fxMesa->glVis = _mesa_create_visual(GL_TRUE, /* RGB mode */
|
||||
doubleBuffer,
|
||||
GL_FALSE, /* stereo */
|
||||
redBits, /* RGBA.R bits */
|
||||
greenBits, /* RGBA.G bits */
|
||||
blueBits, /* RGBA.B bits */
|
||||
alphaSize, /* RGBA.A bits */
|
||||
0, /* index bits */
|
||||
depthSize, /* depth_size */
|
||||
stencilSize, /* stencil_size */
|
||||
accumSize, accumSize, accumSize,
|
||||
accumSize, 1);
|
||||
accumSize,
|
||||
accumSize,
|
||||
accumSize,
|
||||
alphaSize ? accumSize : 0,
|
||||
1);
|
||||
if (!fxMesa->glVis) {
|
||||
errorstr = "_mesa_create_visual";
|
||||
str = "_mesa_create_visual";
|
||||
goto errorhandler;
|
||||
}
|
||||
|
||||
@ -490,24 +572,24 @@ fxMesaCreateContext(GLuint win,
|
||||
shareCtx,
|
||||
(void *) fxMesa, GL_TRUE);
|
||||
if (!ctx) {
|
||||
errorstr = "_mesa_create_context";
|
||||
str = "_mesa_create_context";
|
||||
goto errorhandler;
|
||||
}
|
||||
|
||||
|
||||
if (!fxDDInitFxMesaContext(fxMesa)) {
|
||||
errorstr = "fxDDInitFxMesaContext failed";
|
||||
str = "fxDDInitFxMesaContext";
|
||||
goto errorhandler;
|
||||
}
|
||||
|
||||
|
||||
fxMesa->glBuffer = _mesa_create_framebuffer(fxMesa->glVis, GL_FALSE, /* no software depth */
|
||||
fxMesa->glVis->stencilBits > 0,
|
||||
fxMesa->glVis->accumRedBits >
|
||||
0,
|
||||
fxMesa->glVis->alphaBits > 0);
|
||||
fxMesa->glBuffer = _mesa_create_framebuffer(fxMesa->glVis,
|
||||
GL_FALSE, /* no software depth */
|
||||
stencilSize && !fxMesa->haveHwStencil,
|
||||
fxMesa->glVis->accumRedBits > 0,
|
||||
alphaSize && !fxMesa->haveHwAlpha);
|
||||
if (!fxMesa->glBuffer) {
|
||||
errorstr = "_mesa_create_framebuffer";
|
||||
str = "_mesa_create_framebuffer";
|
||||
goto errorhandler;
|
||||
}
|
||||
|
||||
@ -528,35 +610,35 @@ fxMesaCreateContext(GLuint win,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxMesaCreateContext() End\n");
|
||||
}
|
||||
|
||||
return fxMesa;
|
||||
|
||||
errorhandler:
|
||||
if (fxMesa) {
|
||||
if (fxMesa->glideContext)
|
||||
grSstWinClose(fxMesa->glideContext);
|
||||
fxMesa->glideContext = 0;
|
||||
errorhandler:
|
||||
if (fxMesa) {
|
||||
if (fxMesa->glideContext) {
|
||||
grSstWinClose(fxMesa->glideContext);
|
||||
fxMesa->glideContext = 0;
|
||||
}
|
||||
|
||||
if (fxMesa->state)
|
||||
free(fxMesa->state);
|
||||
if (fxMesa->fogTable)
|
||||
free(fxMesa->fogTable);
|
||||
if (fxMesa->glBuffer)
|
||||
_mesa_destroy_framebuffer(fxMesa->glBuffer);
|
||||
if (fxMesa->glVis)
|
||||
_mesa_destroy_visual(fxMesa->glVis);
|
||||
if (fxMesa->glCtx)
|
||||
_mesa_destroy_context(fxMesa->glCtx);
|
||||
free(fxMesa);
|
||||
}
|
||||
if (fxMesa->state) {
|
||||
FREE(fxMesa->state);
|
||||
}
|
||||
if (fxMesa->fogTable) {
|
||||
FREE(fxMesa->fogTable);
|
||||
}
|
||||
if (fxMesa->glBuffer) {
|
||||
_mesa_destroy_framebuffer(fxMesa->glBuffer);
|
||||
}
|
||||
if (fxMesa->glVis) {
|
||||
_mesa_destroy_visual(fxMesa->glVis);
|
||||
}
|
||||
if (fxMesa->glCtx) {
|
||||
_mesa_destroy_context(fxMesa->glCtx);
|
||||
}
|
||||
FREE(fxMesa);
|
||||
}
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: ERROR (%s)\n", errorstr);
|
||||
}
|
||||
return NULL;
|
||||
fprintf(stderr, "%s: ERROR: %s\n", __FUNCTION__, str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -577,8 +659,8 @@ fxMesaUpdateScreenSize(fxMesaContext fxMesa)
|
||||
void GLAPIENTRY
|
||||
fxMesaDestroyContext(fxMesaContext fxMesa)
|
||||
{
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxMesaDestroyContext()\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (!fxMesa)
|
||||
@ -621,10 +703,10 @@ fxMesaDestroyContext(fxMesaContext fxMesa)
|
||||
_mesa_destroy_context(fxMesa->glCtx);
|
||||
_mesa_destroy_framebuffer(fxMesa->glBuffer);
|
||||
|
||||
fxCloseHardware();
|
||||
grSstWinClose(fxMesa->glideContext);
|
||||
fxCloseHardware();
|
||||
|
||||
free(fxMesa);
|
||||
FREE(fxMesa);
|
||||
|
||||
if (fxMesa == fxMesaCurrentCtx)
|
||||
fxMesaCurrentCtx = NULL;
|
||||
@ -637,16 +719,12 @@ fxMesaDestroyContext(fxMesaContext fxMesa)
|
||||
void GLAPIENTRY
|
||||
fxMesaMakeCurrent(fxMesaContext fxMesa)
|
||||
{
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxMesaMakeCurrent(...) Start\n");
|
||||
}
|
||||
|
||||
if (!fxMesa) {
|
||||
_mesa_make_current(NULL, NULL);
|
||||
fxMesaCurrentCtx = NULL;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxMesaMakeCurrent(NULL) End\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(NULL)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -655,14 +733,17 @@ fxMesaMakeCurrent(fxMesaContext fxMesa)
|
||||
/* if this context is already the current one, we can return early */
|
||||
if (fxMesaCurrentCtx == fxMesa
|
||||
&& fxMesaCurrentCtx->glCtx == _mesa_get_current_context()) {
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr,
|
||||
"fxmesa: fxMesaMakeCurrent(fxMesaCurrentCtx==fxMesa) End\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(fxMesaCurrentCtx==fxMesa)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (fxMesaCurrentCtx)
|
||||
grGlideGetState((GrState *) fxMesaCurrentCtx->state);
|
||||
|
||||
@ -678,43 +759,17 @@ fxMesaMakeCurrent(fxMesaContext fxMesa)
|
||||
/* The first time we call MakeCurrent we set the initial viewport size */
|
||||
if (fxMesa->glCtx->Viewport.Width == 0)
|
||||
_mesa_set_viewport(fxMesa->glCtx, 0, 0, fxMesa->width, fxMesa->height);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxMesaMakeCurrent(...) End\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static void
|
||||
QueryCounters(void)
|
||||
{
|
||||
static GLuint prevPassed = 0;
|
||||
static GLuint prevFailed = 0;
|
||||
GLuint failed, passed;
|
||||
GrSstPerfStats_t st;
|
||||
|
||||
FX_grSstPerfStats(&st);
|
||||
failed = st.zFuncFail - st.aFuncFail - st.chromaFail;
|
||||
passed = st.pixelsIn - failed;
|
||||
printf("failed: %d passed: %d\n", failed - prevFailed,
|
||||
passed - prevPassed);
|
||||
|
||||
prevPassed = passed;
|
||||
prevFailed = failed;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Swap front/back buffers for current context if double buffered.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
fxMesaSwapBuffers(void)
|
||||
{
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr,
|
||||
"fxmesa: ------------------------------- fxMesaSwapBuffers() -------------------------------\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s()\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (fxMesaCurrentCtx) {
|
||||
@ -745,53 +800,29 @@ fxMesaSwapBuffers(void)
|
||||
/*
|
||||
* Query 3Dfx hardware presence/kind
|
||||
*/
|
||||
int GLAPIENTRY
|
||||
fxQueryHardware(void)
|
||||
GLboolean GLAPIENTRY fxQueryHardware (void)
|
||||
{
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxQueryHardware() Start\n");
|
||||
}
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s()\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (!glbGlideInitialized) {
|
||||
grGlideInit();
|
||||
if (FX_grSstQueryHardware(&glbHWConfig)) {
|
||||
grSstSelect(glbCurrentBoard);
|
||||
glb3DfxPresent = 1;
|
||||
if (!glbGlideInitialized) {
|
||||
grGlideInit();
|
||||
glb3DfxPresent = FX_grSstQueryHardware(&glbHWConfig);
|
||||
|
||||
if (getenv("MESA_FX_INFO")) {
|
||||
char buf[80];
|
||||
GrVoodooConfig_t *voodoo = &glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig;
|
||||
|
||||
strcpy(buf, grGetString(GR_VERSION));
|
||||
fprintf(stderr, "Voodoo Using Glide %s\n", buf);
|
||||
fprintf(stderr, "Voodoo Number of boards: %d\n", glbHWConfig.num_sst);
|
||||
fprintf(stderr, "Voodoo Number of TMUs: %d\n", voodoo->nTexelfx);
|
||||
fprintf(stderr, "Voodoo fbRam: %d\n", voodoo->fbRam);
|
||||
fprintf(stderr, "Voodoo fbiRev: %d\n", voodoo->fbiRev);
|
||||
fprintf(stderr, "Voodoo chips detected: %d\n", voodoo->numChips);
|
||||
}
|
||||
}
|
||||
else {
|
||||
glb3DfxPresent = 0;
|
||||
}
|
||||
|
||||
glbGlideInitialized = 1;
|
||||
glbGlideInitialized = 1;
|
||||
|
||||
#if defined(__WIN32__)
|
||||
_onexit((_onexit_t) cleangraphics);
|
||||
_onexit((_onexit_t) cleangraphics);
|
||||
#elif defined(__linux__)
|
||||
/* Only register handler if environment variable is not defined. */
|
||||
if (!getenv("MESA_FX_NO_SIGNALS")) {
|
||||
atexit(cleangraphics);
|
||||
}
|
||||
/* Only register handler if environment variable is not defined. */
|
||||
if (!getenv("MESA_FX_NO_SIGNALS")) {
|
||||
atexit(cleangraphics);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxQueryHardware() End (voodooo)\n");
|
||||
}
|
||||
|
||||
return glbHWConfig.SSTs[glbCurrentBoard].type;
|
||||
return glb3DfxPresent;
|
||||
}
|
||||
|
||||
|
||||
@ -802,7 +833,7 @@ void GLAPIENTRY
|
||||
fxCloseHardware(void)
|
||||
{
|
||||
if (glbGlideInitialized) {
|
||||
if (getenv("MESA_FX_INFO")) {
|
||||
if (fxMesaCurrentCtx && fxMesaCurrentCtx->verbose) {
|
||||
GrSstPerfStats_t st;
|
||||
|
||||
FX_grSstPerfStats(&st);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* fxDDReadPixels888 does not convert 8A8R8G8B into 5R5G5B
|
||||
*/
|
||||
|
||||
/* $Id: fxdd.c,v 1.99 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxdd.c,v 1.100 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -63,8 +63,6 @@
|
||||
|
||||
|
||||
|
||||
float gl_ubyte_to_float_255_color_tab[256];
|
||||
|
||||
/* These lookup table are used to extract RGB values in [0,255] from
|
||||
* 16-bit pixel values.
|
||||
*/
|
||||
@ -72,6 +70,12 @@ GLubyte FX_PixelToR[0x10000];
|
||||
GLubyte FX_PixelToG[0x10000];
|
||||
GLubyte FX_PixelToB[0x10000];
|
||||
|
||||
/* lookup table for scaling 4 bit colors up to 8 bits */
|
||||
GLuint FX_rgb_scale_4[16] = {
|
||||
0, 17, 34, 51, 68, 85, 102, 119,
|
||||
136, 153, 170, 187, 204, 221, 238, 255
|
||||
};
|
||||
|
||||
/* lookup table for scaling 5 bit colors up to 8 bits */
|
||||
GLuint FX_rgb_scale_5[32] = {
|
||||
0, 8, 16, 25, 33, 41, 49, 58,
|
||||
@ -80,6 +84,18 @@ GLuint FX_rgb_scale_5[32] = {
|
||||
197, 206, 214, 222, 230, 239, 247, 255
|
||||
};
|
||||
|
||||
/* lookup table for scaling 6 bit colors up to 8 bits */
|
||||
GLuint FX_rgb_scale_6[64] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
32, 36, 40, 45, 49, 53, 57, 61,
|
||||
65, 69, 73, 77, 81, 85, 89, 93,
|
||||
97, 101, 105, 109, 113, 117, 121, 125,
|
||||
130, 134, 138, 142, 146, 150, 154, 158,
|
||||
162, 166, 170, 174, 178, 182, 186, 190,
|
||||
194, 198, 202, 206, 210, 215, 219, 223,
|
||||
227, 231, 235, 239, 243, 247, 251, 255
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the FX_PixelTo{RGB} arrays.
|
||||
@ -120,22 +136,18 @@ fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder)
|
||||
|
||||
/* Return buffer size information */
|
||||
static void
|
||||
fxDDBufferSize(GLframebuffer *buffer, GLuint * width, GLuint * height)
|
||||
fxDDBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
if (ctx && ctx->DriverCtx) {
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
if (ctx && FX_CONTEXT(ctx)) {
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDBufferSize(...) Start\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
*width = fxMesa->width;
|
||||
*height = fxMesa->height;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDBufferSize(...) End\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,11 +156,11 @@ fxDDBufferSize(GLframebuffer *buffer, GLuint * width, GLuint * height)
|
||||
static void
|
||||
fxDDClearColor(GLcontext * ctx, const GLfloat color[4])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLubyte col[4];
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDClearColor(%f,%f,%f,%f)\n",
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%f, %f, %f, %f)\n", __FUNCTION__,
|
||||
color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
@ -163,122 +175,264 @@ fxDDClearColor(GLcontext * ctx, const GLfloat color[4])
|
||||
|
||||
|
||||
/* Clear the color and/or depth buffers */
|
||||
static void
|
||||
fxDDClear(GLcontext * ctx, GLbitfield mask, GLboolean all,
|
||||
GLint x, GLint y, GLint width, GLint height)
|
||||
static void fxDDClear( GLcontext *ctx,
|
||||
GLbitfield mask, GLboolean all,
|
||||
GLint x, GLint y, GLint width, GLint height )
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask);
|
||||
/* [dBorca] should use an adequate scaler for 16 vs 32bit (GR_ZDEPTH_MIN_MAX) */
|
||||
const FxU32 clearD = (FxU32) (ctx->Depth.Clear * 0x00ffffff);
|
||||
GLbitfield softwareMask = mask & (DD_STENCIL_BIT | DD_ACCUM_BIT);
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLbitfield softwareMask = mask & (DD_ACCUM_BIT);
|
||||
const GLuint stencil_size = fxMesa->haveHwStencil ? ctx->Visual.stencilBits : 0;
|
||||
const FxU32 clearD = (FxU32) (((1 << ctx->Visual.depthBits) - 1) * ctx->Depth.Clear);
|
||||
const FxU8 clearS = (FxU8) (ctx->Stencil.Clear & 0xff);
|
||||
|
||||
/* we can't clear stencil or accum buffers */
|
||||
mask &= ~(DD_STENCIL_BIT | DD_ACCUM_BIT);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDClear(%d,%d,%d,%d)\n", (int) x, (int) y,
|
||||
(int) width, (int) height);
|
||||
if ( TDFX_DEBUG & MESA_VERBOSE ) {
|
||||
fprintf( stderr, "%s( %d, %d, %d, %d )\n",
|
||||
__FUNCTION__, (int) x, (int) y, (int) width, (int) height );
|
||||
}
|
||||
|
||||
if (colorMask != 0xffffffff) {
|
||||
/* do masked color buffer clears in software */
|
||||
softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
|
||||
mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
|
||||
/*jejeje*/
|
||||
/* Need this check to respond to glScissor and clipping updates */
|
||||
if (fxMesa->new_state & FX_NEW_SCISSOR) {
|
||||
extern void fxSetupScissor(GLcontext * ctx);
|
||||
fxSetupScissor(ctx);
|
||||
}
|
||||
|
||||
/* we can't clear accum buffers */
|
||||
mask &= ~(DD_ACCUM_BIT);
|
||||
|
||||
if (mask & DD_STENCIL_BIT) {
|
||||
if (!fxMesa->haveHwStencil || fxMesa->unitsState.stencilWriteMask != 0xff) {
|
||||
/* Napalm seems to have trouble with stencil write masks != 0xff */
|
||||
/* do stencil clear in software */
|
||||
mask &= ~(DD_STENCIL_BIT);
|
||||
softwareMask |= DD_STENCIL_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->Visual.greenBits != 8 && ctx->Visual.greenBits != 5) {
|
||||
/* can only do color masking if running in 24/32bpp on Napalm */
|
||||
if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] ||
|
||||
ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]) {
|
||||
softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
|
||||
mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
if (fxMesa->haveHwStencil) {
|
||||
/*
|
||||
* If we want to clear stencil, it must be enabled
|
||||
* in the HW, even if the stencil test is not enabled
|
||||
* in the OGL state.
|
||||
*/
|
||||
BEGIN_BOARD_LOCK();
|
||||
if (mask & DD_STENCIL_BIT) {
|
||||
fxMesa->Glide.grStencilMaskExt(0xff /*fxMesa->unitsState.stencilWriteMask*/);
|
||||
/* set stencil ref value = desired clear value */
|
||||
fxMesa->Glide.grStencilFuncExt(GR_CMP_ALWAYS, clearS, 0xff);
|
||||
fxMesa->Glide.grStencilOpExt(GR_STENCILOP_REPLACE,
|
||||
GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE);
|
||||
grEnable(GR_STENCIL_MODE_EXT);
|
||||
}
|
||||
else {
|
||||
grDisable(GR_STENCIL_MODE_EXT);
|
||||
}
|
||||
END_BOARD_LOCK();
|
||||
}
|
||||
|
||||
/*
|
||||
* This could probably be done fancier but doing each possible case
|
||||
* explicitly is less error prone.
|
||||
* This may be ugly, but it's needed in order to work around a number
|
||||
* of Glide bugs.
|
||||
*/
|
||||
switch (mask) {
|
||||
case DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
|
||||
/* back buffer & depth */
|
||||
grDepthMask(FXTRUE);
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
if (!ctx->Depth.Mask) {
|
||||
grDepthMask(FXFALSE);
|
||||
}
|
||||
break;
|
||||
case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT:
|
||||
/* XXX it appears that the depth buffer isn't cleared when
|
||||
* glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set.
|
||||
* This is a work-around/
|
||||
BEGIN_CLIP_LOOP();
|
||||
{
|
||||
/*
|
||||
* This could probably be done fancier but doing each possible case
|
||||
* explicitly is less error prone.
|
||||
*/
|
||||
/* clear depth */
|
||||
grDepthMask(FXTRUE);
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
grColorMask(FXFALSE, FXFALSE);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
/* clear front */
|
||||
grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
/* back buffer only */
|
||||
grDepthMask(FXFALSE);
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
if (ctx->Depth.Mask) {
|
||||
switch (mask & ~DD_STENCIL_BIT) {
|
||||
case DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
|
||||
/* back buffer & depth */
|
||||
fxColorMask(fxMesa, GL_TRUE); /* work around Voodoo3 bug */
|
||||
grDepthMask(FXTRUE);
|
||||
}
|
||||
break;
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
/* front buffer only */
|
||||
grDepthMask(FXFALSE);
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
if (ctx->Depth.Mask) {
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
if (stencil_size > 0) {
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
}
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
if (!ctx->Depth.Mask || !ctx->Depth.Test) {
|
||||
grDepthMask(FXFALSE);
|
||||
}
|
||||
break;
|
||||
case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT:
|
||||
/* XXX it appears that the depth buffer isn't cleared when
|
||||
* glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set.
|
||||
* This is a work-around/
|
||||
*/
|
||||
/* clear depth */
|
||||
grDepthMask(FXTRUE);
|
||||
}
|
||||
break;
|
||||
case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT:
|
||||
/* front and back */
|
||||
grDepthMask(FXFALSE);
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
if (ctx->Depth.Mask) {
|
||||
grDepthMask(FXTRUE);
|
||||
}
|
||||
break;
|
||||
case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
|
||||
/* clear front */
|
||||
grDepthMask(FXFALSE);
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
/* clear back and depth */
|
||||
grDepthMask(FXTRUE);
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
if (!ctx->Depth.Mask) {
|
||||
grDepthMask(FXFALSE);
|
||||
}
|
||||
break;
|
||||
case DD_DEPTH_BIT:
|
||||
/* just the depth buffer */
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
grColorMask(FXFALSE, FXFALSE);
|
||||
grDepthMask(FXTRUE);
|
||||
FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
|
||||
grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
|
||||
if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
fxColorMask(fxMesa, GL_FALSE);
|
||||
if (stencil_size > 0)
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
/* clear front */
|
||||
fxColorMask(fxMesa, GL_TRUE);
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
if (!ctx->Depth.Test || !ctx->Depth.Mask)
|
||||
if (stencil_size > 0)
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
if (!ctx->Depth.Mask || !ctx->Depth.Test) {
|
||||
grDepthMask(FXFALSE);
|
||||
}
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
/* back buffer only */
|
||||
grDepthMask(FXFALSE);
|
||||
break;
|
||||
default:
|
||||
/* error */
|
||||
;
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
if (stencil_size > 0)
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
if (ctx->Depth.Mask && ctx->Depth.Test) {
|
||||
grDepthMask(FXTRUE);
|
||||
}
|
||||
break;
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
/* front buffer only */
|
||||
grDepthMask(FXFALSE);
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
if (stencil_size > 0)
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
if (ctx->Depth.Mask && ctx->Depth.Test) {
|
||||
grDepthMask(FXTRUE);
|
||||
}
|
||||
break;
|
||||
case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT:
|
||||
/* front and back */
|
||||
grDepthMask(FXFALSE);
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
if (stencil_size > 0)
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
if (stencil_size > 0)
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
if (ctx->Depth.Mask && ctx->Depth.Test) {
|
||||
grDepthMask(FXTRUE);
|
||||
}
|
||||
break;
|
||||
case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
|
||||
/* clear front */
|
||||
grDepthMask(FXFALSE);
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
if (stencil_size > 0)
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
/* clear back and depth */
|
||||
grDepthMask(FXTRUE);
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
if (stencil_size > 0)
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
if (!ctx->Depth.Mask || !ctx->Depth.Mask) {
|
||||
grDepthMask(FXFALSE);
|
||||
}
|
||||
break;
|
||||
case DD_DEPTH_BIT:
|
||||
/* just the depth buffer */
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
fxColorMask(fxMesa, GL_FALSE);
|
||||
grDepthMask(FXTRUE);
|
||||
if (stencil_size > 0)
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
else
|
||||
grBufferClear(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD);
|
||||
fxColorMask(fxMesa, GL_TRUE);
|
||||
if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
if (!ctx->Depth.Test || !ctx->Depth.Mask)
|
||||
grDepthMask(FXFALSE);
|
||||
break;
|
||||
default:
|
||||
/* clear no color buffers or depth buffer but might clear stencil */
|
||||
if (stencil_size > 0 && (mask & DD_STENCIL_BIT)) {
|
||||
/* XXX need this RenderBuffer call to work around Glide bug */
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
grDepthMask(FXFALSE);
|
||||
fxColorMask(fxMesa, GL_FALSE);
|
||||
fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
|
||||
fxMesa->clearA,
|
||||
clearD, clearS);
|
||||
if (ctx->Depth.Mask && ctx->Depth.Test) {
|
||||
grDepthMask(FXTRUE);
|
||||
}
|
||||
fxColorMask(fxMesa, GL_TRUE);
|
||||
if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
}
|
||||
}
|
||||
}
|
||||
END_CLIP_LOOP();
|
||||
|
||||
if (fxMesa->haveHwStencil && (mask & DD_STENCIL_BIT)) {
|
||||
/* We changed the stencil state above. Signal that we need to
|
||||
* upload it again.
|
||||
*/
|
||||
fxMesa->new_state |= FX_NEW_STENCIL;
|
||||
}
|
||||
|
||||
/* Clear any remaining buffers:
|
||||
*/
|
||||
if (softwareMask)
|
||||
_swrast_Clear(ctx, softwareMask, all, x, y, width, height);
|
||||
_swrast_Clear( ctx, softwareMask, all, x, y, width, height );
|
||||
}
|
||||
|
||||
|
||||
@ -287,10 +441,10 @@ fxDDClear(GLcontext * ctx, GLbitfield mask, GLboolean all,
|
||||
static void
|
||||
fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) mode);
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%x)\n", __FUNCTION__, (int)mode);
|
||||
}
|
||||
|
||||
if (mode == GL_FRONT_LEFT) {
|
||||
@ -302,7 +456,7 @@ fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode)
|
||||
grRenderBuffer(fxMesa->currentFB);
|
||||
}
|
||||
else if (mode == GL_NONE) {
|
||||
grColorMask(FXFALSE, FXFALSE);
|
||||
fxColorMask(fxMesa, GL_FALSE);
|
||||
}
|
||||
else {
|
||||
/* we'll need a software fallback */
|
||||
@ -323,7 +477,7 @@ fxDDDrawBitmap(GLcontext * ctx, GLint px, GLint py,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
const GLubyte * bitmap)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrLfbInfo_t info;
|
||||
FxU16 color;
|
||||
const struct gl_pixelstore_attrib *finalUnpack;
|
||||
@ -409,9 +563,7 @@ fxDDDrawBitmap(GLcontext * ctx, GLint px, GLint py,
|
||||
fxMesa->currentFB,
|
||||
GR_LFBWRITEMODE_565,
|
||||
GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
|
||||
#ifndef FX_SILENT
|
||||
fprintf(stderr, "fx Driver: error locking the linear frame buffer\n");
|
||||
#endif
|
||||
fprintf(stderr, "%s: ERROR: locking the linear frame buffer\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -493,7 +645,7 @@ fxDDReadPixels(GLcontext * ctx, GLint x, GLint y,
|
||||
return;
|
||||
}
|
||||
else {
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrLfbInfo_t info;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
@ -608,7 +760,7 @@ static void fxDDReadPixels555 (GLcontext * ctx,
|
||||
return;
|
||||
}
|
||||
else {
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrLfbInfo_t info;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
@ -719,7 +871,7 @@ static void fxDDReadPixels888 (GLcontext * ctx,
|
||||
return;
|
||||
}
|
||||
else {
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrLfbInfo_t info;
|
||||
|
||||
BEGIN_BOARD_LOCK();
|
||||
@ -798,20 +950,11 @@ fxDDFinish(GLcontext * ctx)
|
||||
static const GLubyte *
|
||||
fxDDGetString(GLcontext * ctx, GLenum name)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
switch (name) {
|
||||
case GL_RENDERER:
|
||||
{
|
||||
static char buf[80];
|
||||
GrVoodooConfig_t *vc = &glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig;
|
||||
sprintf(buf, "Mesa %s v0.31 %s %dMB FB, %dMB TM, %d TMU, %s",
|
||||
grGetString(GR_RENDERER),
|
||||
grGetString(GR_HARDWARE),
|
||||
vc->fbRam,
|
||||
(vc->tmuConfig[GR_TMU0].tmuRam + ((vc->nTexelfx > 1) ? vc->tmuConfig[GR_TMU1].tmuRam : 0)),
|
||||
(vc->nTexelfx * vc->numChips),
|
||||
(vc->numChips > 1) ? "SLI" : "NOSLI");
|
||||
return (GLubyte *)buf;
|
||||
}
|
||||
return (GLubyte *)fxMesa->rendererString;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@ -821,10 +964,10 @@ static const struct gl_pipeline_stage *fx_pipeline[] = {
|
||||
&_tnl_vertex_transform_stage, /* TODO: Add the fastpath here */
|
||||
&_tnl_normal_transform_stage,
|
||||
&_tnl_lighting_stage,
|
||||
&_tnl_fog_coordinate_stage, /* TODO: Omit fog stage */
|
||||
/*&_tnl_fog_coordinate_stage,*/ /* TODO: Omit fog stage ZZZ ZZZ ZZZ */
|
||||
&_tnl_texgen_stage,
|
||||
&_tnl_texture_transform_stage,
|
||||
&_tnl_point_attenuation_stage,
|
||||
/*&_tnl_point_attenuation_stage,*/ /* TODO: For AA primitives ZZZ ZZZ ZZZ */
|
||||
&_tnl_render_stage,
|
||||
0,
|
||||
};
|
||||
@ -836,31 +979,10 @@ int
|
||||
fxDDInitFxMesaContext(fxMesaContext fxMesa)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
gl_ubyte_to_float_255_color_tab[i] = (float) i;
|
||||
}
|
||||
GLcontext *ctx = fxMesa->glCtx;
|
||||
|
||||
FX_setupGrVertexLayout();
|
||||
|
||||
if (getenv("FX_EMULATE_SINGLE_TMU"))
|
||||
fxMesa->haveTwoTMUs = GL_FALSE;
|
||||
|
||||
if (getenv("FX_GLIDE_SWAPINTERVAL"))
|
||||
fxMesa->swapInterval = atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
|
||||
else
|
||||
fxMesa->swapInterval = 1;
|
||||
|
||||
if (getenv("MESA_FX_SWAP_PENDING"))
|
||||
fxMesa->maxPendingSwapBuffers = atoi(getenv("MESA_FX_SWAP_PENDING"));
|
||||
else
|
||||
fxMesa->maxPendingSwapBuffers = 2;
|
||||
|
||||
if (getenv("MESA_FX_INFO"))
|
||||
fxMesa->verbose = GL_TRUE;
|
||||
else
|
||||
fxMesa->verbose = GL_FALSE;
|
||||
|
||||
fxMesa->color = 0xffffffff;
|
||||
fxMesa->clearC = 0;
|
||||
fxMesa->clearA = 0;
|
||||
@ -877,7 +999,7 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
|
||||
/* FX units setup */
|
||||
|
||||
fxMesa->unitsState.alphaTestEnabled = GL_FALSE;
|
||||
fxMesa->unitsState.alphaTestFunc = GR_CMP_ALWAYS;
|
||||
fxMesa->unitsState.alphaTestFunc = GL_ALWAYS;
|
||||
fxMesa->unitsState.alphaTestRefValue = 0.0;
|
||||
|
||||
fxMesa->unitsState.blendEnabled = GL_FALSE;
|
||||
@ -888,9 +1010,12 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
|
||||
|
||||
fxMesa->unitsState.depthTestEnabled = GL_FALSE;
|
||||
fxMesa->unitsState.depthMask = GL_TRUE;
|
||||
fxMesa->unitsState.depthTestFunc = GR_CMP_LESS;
|
||||
fxMesa->unitsState.depthTestFunc = GL_LESS;
|
||||
fxMesa->unitsState.depthBias = 0;
|
||||
|
||||
grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
|
||||
fxMesa->unitsState.stencilWriteMask = 0xff;
|
||||
|
||||
fxColorMask(fxMesa, GL_TRUE);
|
||||
if (fxMesa->haveDoubleBuffer) {
|
||||
fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
@ -900,15 +1025,15 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
}
|
||||
|
||||
fxMesa->state = malloc(FX_grGetInteger(GR_GLIDE_STATE_SIZE));
|
||||
fxMesa->fogTable = (GrFog_t *) malloc(FX_grGetInteger(GR_FOG_TABLE_ENTRIES) *
|
||||
fxMesa->state = MALLOC(FX_grGetInteger(GR_GLIDE_STATE_SIZE));
|
||||
fxMesa->fogTable = (GrFog_t *) MALLOC(FX_grGetInteger(GR_FOG_TABLE_ENTRIES) *
|
||||
sizeof(GrFog_t));
|
||||
|
||||
if (!fxMesa->state || !fxMesa->fogTable) {
|
||||
if (fxMesa->state)
|
||||
free(fxMesa->state);
|
||||
FREE(fxMesa->state);
|
||||
if (fxMesa->fogTable)
|
||||
free(fxMesa->fogTable);
|
||||
FREE(fxMesa->fogTable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -920,42 +1045,50 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
|
||||
fxMesa->textureAlign = FX_grGetInteger(GR_TEXTURE_ALIGN);
|
||||
/* [koolsmoky] */
|
||||
{
|
||||
int textureSize = ((fxMesa->maxTextureSize > 2048) ? 2048 : fxMesa->maxTextureSize);
|
||||
fxMesa->glCtx->Const.MaxTextureLevels = 0;
|
||||
int textureLevels = 0;
|
||||
int textureSize = FX_grGetInteger(GR_MAX_TEXTURE_SIZE);
|
||||
do {
|
||||
fxMesa->glCtx->Const.MaxTextureLevels++;
|
||||
textureLevels++;
|
||||
} while ((textureSize >>= 0x1) & 0x7ff);
|
||||
ctx->Const.MaxTextureLevels = textureLevels;
|
||||
}
|
||||
fxMesa->glCtx->Const.MaxTextureUnits = fxMesa->haveTwoTMUs ? 2 : 1;
|
||||
ctx->Const.MaxTextureCoordUnits = fxMesa->haveTwoTMUs ? 2 : 1;
|
||||
ctx->Const.MaxTextureImageUnits = fxMesa->haveTwoTMUs ? 2 : 1;
|
||||
ctx->Const.MaxTextureUnits = MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits);
|
||||
|
||||
fxMesa->new_state = _NEW_ALL;
|
||||
if (!fxMesa->haveHwStencil) {
|
||||
/* don't touch stencil if there is none */
|
||||
fxMesa->new_state &= ~FX_NEW_STENCIL;
|
||||
}
|
||||
|
||||
/* Initialize the software rasterizer and helper modules.
|
||||
*/
|
||||
_swrast_CreateContext(fxMesa->glCtx);
|
||||
_ac_CreateContext(fxMesa->glCtx);
|
||||
_tnl_CreateContext(fxMesa->glCtx);
|
||||
_swsetup_CreateContext(fxMesa->glCtx);
|
||||
_swrast_CreateContext(ctx);
|
||||
_ac_CreateContext(ctx);
|
||||
_tnl_CreateContext(ctx);
|
||||
_swsetup_CreateContext(ctx);
|
||||
|
||||
/* Install customized pipeline */
|
||||
_tnl_destroy_pipeline(fxMesa->glCtx);
|
||||
_tnl_install_pipeline(fxMesa->glCtx, fx_pipeline);
|
||||
_tnl_destroy_pipeline(ctx);
|
||||
_tnl_install_pipeline(ctx, fx_pipeline);
|
||||
|
||||
fxAllocVB(fxMesa->glCtx);
|
||||
fxAllocVB(ctx);
|
||||
|
||||
fxSetupDDPointers(fxMesa->glCtx);
|
||||
fxDDInitTriFuncs(fxMesa->glCtx);
|
||||
fxSetupDDPointers(ctx);
|
||||
fxDDInitTriFuncs(ctx);
|
||||
|
||||
/* Tell the software rasterizer to use pixel fog always.
|
||||
*/
|
||||
_swrast_allow_vertex_fog(fxMesa->glCtx, GL_FALSE);
|
||||
_swrast_allow_pixel_fog(fxMesa->glCtx, GL_TRUE);
|
||||
_swrast_allow_vertex_fog(ctx, GL_FALSE);
|
||||
_swrast_allow_pixel_fog(ctx, GL_TRUE);
|
||||
|
||||
/* Tell tnl not to calculate or use vertex fog factors. (Needed to
|
||||
* tell render stage not to clip fog coords).
|
||||
*/
|
||||
/* _tnl_calculate_vertex_fog( fxMesa->glCtx, GL_FALSE ); */
|
||||
/* _tnl_calculate_vertex_fog( ctx, GL_FALSE ); */
|
||||
|
||||
fxDDInitExtensions(fxMesa->glCtx);
|
||||
fxDDInitExtensions(ctx);
|
||||
|
||||
grGlideGetState((GrState *) fxMesa->state);
|
||||
|
||||
@ -973,9 +1106,9 @@ fxDDDestroyFxMesaContext(fxMesaContext fxMesa)
|
||||
_swrast_DestroyContext(fxMesa->glCtx);
|
||||
|
||||
if (fxMesa->state)
|
||||
free(fxMesa->state);
|
||||
FREE(fxMesa->state);
|
||||
if (fxMesa->fogTable)
|
||||
free(fxMesa->fogTable);
|
||||
FREE(fxMesa->fogTable);
|
||||
fxTMClose(fxMesa);
|
||||
fxFreeVB(fxMesa->glCtx);
|
||||
}
|
||||
@ -986,7 +1119,7 @@ fxDDDestroyFxMesaContext(fxMesaContext fxMesa)
|
||||
void
|
||||
fxDDInitExtensions(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
/*_mesa_add_extension(ctx, GL_TRUE, "3DFX_set_global_palette", 0);*/
|
||||
_mesa_enable_extension(ctx, "GL_EXT_point_parameters");
|
||||
@ -994,11 +1127,32 @@ fxDDInitExtensions(GLcontext * ctx)
|
||||
_mesa_enable_extension(ctx, "GL_EXT_texture_lod_bias");
|
||||
_mesa_enable_extension(ctx, "GL_EXT_shared_texture_palette");
|
||||
|
||||
if (fxMesa->haveTwoTMUs)
|
||||
if (fxMesa->haveTwoTMUs) {
|
||||
_mesa_enable_extension(ctx, "GL_EXT_texture_env_add");
|
||||
|
||||
if (fxMesa->haveTwoTMUs)
|
||||
_mesa_enable_extension(ctx, "GL_ARB_multitexture");
|
||||
}
|
||||
|
||||
if (fxMesa->haveHwStencil) {
|
||||
_mesa_enable_extension( ctx, "GL_EXT_stencil_wrap" );
|
||||
}
|
||||
|
||||
#if 0 /* not ready yet */
|
||||
/* banshee/avenger should enable this for NCC */
|
||||
_mesa_enable_extension( ctx, "GL_ARB_texture_compression" );
|
||||
#endif
|
||||
if (0/*IS_NAPALM*/) {
|
||||
/* tex_compress: not ready yet */
|
||||
_mesa_enable_extension( ctx, "GL_3DFX_texture_compression_FXT1" );
|
||||
_mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
|
||||
/*_mesa_enable_extension( ctx, "GL_S3_s3tc" );*/
|
||||
|
||||
/* env_combine: not ready yet */
|
||||
/*_mesa_enable_extension( ctx, "GL_EXT_texture_env_combine" );*/
|
||||
}
|
||||
|
||||
if (fxMesa->HaveMirExt) {
|
||||
_mesa_enable_extension(ctx, "GL_ARB_texture_mirrored_repeat");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1010,38 +1164,52 @@ fxDDInitExtensions(GLcontext * ctx)
|
||||
*
|
||||
* Performs similar work to fxDDChooseRenderState() - should be merged.
|
||||
*/
|
||||
GLboolean
|
||||
GLuint
|
||||
fx_check_IsInHardware(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
if (ctx->RenderMode != GL_RENDER)
|
||||
return GL_FALSE;
|
||||
|
||||
if (ctx->Stencil.Enabled ||
|
||||
(ctx->Color._DrawDestMask != FRONT_LEFT_BIT &&
|
||||
ctx->Color._DrawDestMask != BACK_LEFT_BIT) ||
|
||||
((ctx->Color.BlendEnabled)
|
||||
&& (ctx->Color.BlendEquation != GL_FUNC_ADD_EXT))
|
||||
|| ((ctx->Color.ColorLogicOpEnabled)
|
||||
&& (ctx->Color.LogicOp != GL_COPY))
|
||||
|| (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
|
||||
||
|
||||
(!((ctx->
|
||||
Color.ColorMask[RCOMP] == ctx->Color.ColorMask[GCOMP])
|
||||
&& (ctx->Color.ColorMask[GCOMP] == ctx->Color.ColorMask[BCOMP])
|
||||
&& (ctx->Color.ColorMask[ACOMP] == ctx->Color.ColorMask[ACOMP])))
|
||||
) {
|
||||
return GL_FALSE;
|
||||
if (ctx->RenderMode != GL_RENDER) {
|
||||
return FX_FALLBACK_RENDER_MODE;
|
||||
}
|
||||
|
||||
if (ctx->Stencil.Enabled && !fxMesa->haveHwStencil) {
|
||||
return FX_FALLBACK_STENCIL;
|
||||
}
|
||||
|
||||
if (ctx->Color._DrawDestMask != FRONT_LEFT_BIT && ctx->Color._DrawDestMask != BACK_LEFT_BIT) {
|
||||
return FX_FALLBACK_DRAW_BUFFER;
|
||||
}
|
||||
|
||||
if (ctx->Color.BlendEnabled && (ctx->Color.BlendEquation != GL_FUNC_ADD_EXT)) {
|
||||
return FX_FALLBACK_BLEND;
|
||||
}
|
||||
|
||||
if (ctx->Color.ColorLogicOpEnabled && (ctx->Color.LogicOp != GL_COPY)) {
|
||||
return FX_FALLBACK_LOGICOP;
|
||||
}
|
||||
|
||||
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) {
|
||||
return FX_FALLBACK_SPECULAR;
|
||||
}
|
||||
|
||||
if ((ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP])
|
||||
||
|
||||
(ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP])
|
||||
||
|
||||
(ctx->Color.ColorMask[BCOMP] != ctx->Color.ColorMask[ACOMP])
|
||||
) {
|
||||
return FX_FALLBACK_COLORMASK;
|
||||
}
|
||||
|
||||
/* Unsupported texture/multitexture cases */
|
||||
|
||||
if (fxMesa->haveTwoTMUs) {
|
||||
/* we can only do 2D textures */
|
||||
if (ctx->Texture.Unit[0]._ReallyEnabled & ~TEXTURE_2D_BIT)
|
||||
return GL_FALSE;
|
||||
return FX_FALLBACK_TEXTURE_1D_3D;
|
||||
if (ctx->Texture.Unit[1]._ReallyEnabled & ~TEXTURE_2D_BIT)
|
||||
return GL_FALSE;
|
||||
return FX_FALLBACK_TEXTURE_1D_3D;
|
||||
|
||||
if (ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) {
|
||||
if (ctx->Texture.Unit[0].EnvMode == GL_BLEND &&
|
||||
@ -1050,21 +1218,21 @@ fx_check_IsInHardware(GLcontext * ctx)
|
||||
ctx->Texture.Unit[0].EnvColor[1] != 0 ||
|
||||
ctx->Texture.Unit[0].EnvColor[2] != 0 ||
|
||||
ctx->Texture.Unit[0].EnvColor[3] != 1)) {
|
||||
return GL_FALSE;
|
||||
return FX_FALLBACK_TEXTURE_ENV;
|
||||
}
|
||||
if (ctx->Texture.Unit[0]._Current->Image[0]->Border > 0)
|
||||
return GL_FALSE;
|
||||
return FX_FALLBACK_TEXTURE_BORDER;
|
||||
}
|
||||
|
||||
if (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_2D_BIT) {
|
||||
if (ctx->Texture.Unit[1].EnvMode == GL_BLEND)
|
||||
return GL_FALSE;
|
||||
return FX_FALLBACK_TEXTURE_ENV;
|
||||
if (ctx->Texture.Unit[1]._Current->Image[0]->Border > 0)
|
||||
return GL_FALSE;
|
||||
return FX_FALLBACK_TEXTURE_BORDER;
|
||||
}
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "fxMesa: fxIsInHardware, envmode is %s/%s\n",
|
||||
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "%s: envmode is %s/%s\n", __FUNCTION__,
|
||||
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
|
||||
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
|
||||
|
||||
@ -1078,96 +1246,51 @@ fx_check_IsInHardware(GLcontext * ctx)
|
||||
* back to software.
|
||||
*/
|
||||
if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled) {
|
||||
return GL_FALSE;
|
||||
return FX_FALLBACK_TEXTURE_MULTI;
|
||||
}
|
||||
|
||||
if ((ctx->Texture.Unit[0].EnvMode != ctx->Texture.Unit[1].EnvMode) &&
|
||||
(ctx->Texture.Unit[0].EnvMode != GL_MODULATE) &&
|
||||
(ctx->Texture.Unit[0].EnvMode != GL_REPLACE)) { /* q2, seems ok... */
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER)
|
||||
fprintf(stderr, "fxMesa: unsupported multitex env mode\n");
|
||||
return GL_FALSE;
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER)
|
||||
fprintf(stderr, "%s: unsupported multitex env mode\n", __FUNCTION__);
|
||||
return FX_FALLBACK_TEXTURE_MULTI;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* we have just one texture unit */
|
||||
if (ctx->Texture._EnabledUnits > 0x1) {
|
||||
return GL_FALSE;
|
||||
return FX_FALLBACK_TEXTURE_MULTI;
|
||||
}
|
||||
|
||||
if ((ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) &&
|
||||
(ctx->Texture.Unit[0].EnvMode == GL_BLEND)) {
|
||||
return GL_FALSE;
|
||||
return FX_FALLBACK_TEXTURE_ENV;
|
||||
}
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
update_texture_scales(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
struct gl_texture_unit *t0 = &ctx->Texture.Unit[fxMesa->tmu_source[0]];
|
||||
struct gl_texture_unit *t1 = &ctx->Texture.Unit[fxMesa->tmu_source[1]];
|
||||
|
||||
if (t0 && t0->_Current && FX_TEXTURE_DATA(t0)) {
|
||||
fxMesa->s0scale = FX_TEXTURE_DATA(t0)->sScale;
|
||||
fxMesa->t0scale = FX_TEXTURE_DATA(t0)->tScale;
|
||||
fxMesa->inv_s0scale = 1.0 / fxMesa->s0scale;
|
||||
fxMesa->inv_t0scale = 1.0 / fxMesa->t0scale;
|
||||
}
|
||||
|
||||
if (t1 && t1->_Current && FX_TEXTURE_DATA(t1)) {
|
||||
fxMesa->s1scale = FX_TEXTURE_DATA(t1)->sScale;
|
||||
fxMesa->t1scale = FX_TEXTURE_DATA(t1)->tScale;
|
||||
fxMesa->inv_s1scale = 1.0 / fxMesa->s1scale;
|
||||
fxMesa->inv_t1scale = 1.0 / fxMesa->t1scale;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state)
|
||||
{
|
||||
/* TNLcontext *tnl = TNL_CONTEXT(ctx);*/
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxDDUpdateDDPointers(%08x)\n", new_state);
|
||||
}
|
||||
|
||||
_swrast_InvalidateState(ctx, new_state);
|
||||
_ac_InvalidateState(ctx, new_state);
|
||||
_tnl_InvalidateState(ctx, new_state);
|
||||
_swsetup_InvalidateState(ctx, new_state);
|
||||
|
||||
/* Recalculate fog table on projection matrix changes. This used to
|
||||
* be triggered by the NearFar callback.
|
||||
*/
|
||||
if (new_state & _NEW_PROJECTION)
|
||||
fxMesa->new_state |= FX_NEW_FOG;
|
||||
|
||||
if (new_state & (_FX_NEW_IS_IN_HARDWARE |
|
||||
_FX_NEW_RENDERSTATE |
|
||||
_FX_NEW_SETUP_FUNCTION |
|
||||
_NEW_TEXTURE)) {
|
||||
|
||||
if (new_state & _FX_NEW_IS_IN_HARDWARE)
|
||||
fxCheckIsInHardware(ctx);
|
||||
|
||||
if (fxMesa->new_state)
|
||||
fxSetupFXUnits(ctx);
|
||||
|
||||
if (fxMesa->is_in_hardware) {
|
||||
if (new_state & _FX_NEW_RENDERSTATE)
|
||||
fxDDChooseRenderState(ctx);
|
||||
|
||||
if (new_state & _FX_NEW_SETUP_FUNCTION)
|
||||
fxChooseVertexState(ctx);
|
||||
}
|
||||
|
||||
if (new_state & _NEW_TEXTURE)
|
||||
update_texture_scales(ctx);
|
||||
}
|
||||
fxMesa->new_gl_state |= new_state;
|
||||
}
|
||||
|
||||
|
||||
@ -1176,10 +1299,11 @@ fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state)
|
||||
void
|
||||
fxSetupDDPointers(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxSetupDDPointers()\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s()\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
ctx->Driver.UpdateState = fxDDUpdateDDPointers;
|
||||
@ -1193,8 +1317,6 @@ fxSetupDDPointers(GLcontext * ctx)
|
||||
ctx->Driver.Bitmap = fxDDDrawBitmap;
|
||||
ctx->Driver.CopyPixels = _swrast_CopyPixels;
|
||||
ctx->Driver.DrawPixels = _swrast_DrawPixels;
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
switch (fxMesa->colDepth) {
|
||||
case 15:
|
||||
ctx->Driver.ReadPixels = fxDDReadPixels555;
|
||||
@ -1206,7 +1328,6 @@ fxSetupDDPointers(GLcontext * ctx)
|
||||
ctx->Driver.ReadPixels = fxDDReadPixels888;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||
ctx->Driver.Finish = fxDDFinish;
|
||||
ctx->Driver.Flush = NULL;
|
||||
@ -1249,8 +1370,11 @@ fxSetupDDPointers(GLcontext * ctx)
|
||||
ctx->Driver.CullFace = fxDDCullFace;
|
||||
ctx->Driver.ShadeModel = fxDDShadeModel;
|
||||
ctx->Driver.Enable = fxDDEnable;
|
||||
|
||||
tnl->Driver.RunPipeline = _tnl_run_pipeline;
|
||||
if (fxMesa->haveHwStencil) {
|
||||
ctx->Driver.StencilFunc = fxDDStencilFunc;
|
||||
ctx->Driver.StencilMask = fxDDStencilMask;
|
||||
ctx->Driver.StencilOp = fxDDStencilOp;
|
||||
}
|
||||
|
||||
fxSetupDDSpanPointers(ctx);
|
||||
fxDDUpdateDDPointers(ctx, ~0);
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Optimize and check endianess for `read_R8G8B8_pixels'
|
||||
*/
|
||||
|
||||
/* $Id: fxddspan.c,v 1.24 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxddspan.c,v 1.25 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -98,12 +98,12 @@ fxDDWriteRGBASpan(const GLcontext * ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLubyte rgba[][4], const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDWriteRGBASpan(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (mask) {
|
||||
@ -140,13 +140,13 @@ fxDDWriteRGBSpan(const GLcontext * ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLubyte rgb[][3], const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
GLubyte rgba[MAX_WIDTH][4];
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDWriteRGBSpan()\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (mask) {
|
||||
@ -195,14 +195,14 @@ fxDDWriteMonoRGBASpan(const GLcontext * ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLchan color[4], const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
GLuint data[MAX_WIDTH];
|
||||
GrColor_t gColor = FXCOLOR4(color);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDWriteMonoRGBASpan(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (mask) {
|
||||
@ -244,14 +244,13 @@ static void
|
||||
fxDDReadRGBASpan(const GLcontext * ctx,
|
||||
GLuint n, GLint x, GLint y, GLubyte rgba[][4])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLushort data[MAX_WIDTH];
|
||||
GLuint i;
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
|
||||
printf("read span %d, %d, %d\n", x, y, n);
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDReadRGBASpan(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
assert(n < MAX_WIDTH);
|
||||
@ -277,7 +276,7 @@ static void
|
||||
read_R5G6B5_span(const GLcontext * ctx,
|
||||
GLuint n, GLint x, GLint y, GLubyte rgba[][4])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrLfbInfo_t info;
|
||||
BEGIN_BOARD_LOCK();
|
||||
if (grLfbLock(GR_LFB_READ_ONLY,
|
||||
@ -327,7 +326,7 @@ static void read_R5G5B5_span (const GLcontext * ctx,
|
||||
GLint x, GLint y,
|
||||
GLubyte rgba[][4])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrLfbInfo_t info;
|
||||
BEGIN_BOARD_LOCK();
|
||||
if (grLfbLock(GR_LFB_READ_ONLY,
|
||||
@ -375,7 +374,7 @@ static void read_R8G8B8_span (const GLcontext * ctx,
|
||||
GLint x, GLint y,
|
||||
GLubyte rgba[][4])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
BEGIN_BOARD_LOCK();
|
||||
grLfbReadRegion(fxMesa->currentFB, x, fxMesa->height - 1 - y, n, 1, n * 4, rgba);
|
||||
END_BOARD_LOCK();
|
||||
@ -391,12 +390,12 @@ fxDDWriteRGBAPixels(const GLcontext * ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
CONST GLubyte rgba[][4], const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDWriteRGBAPixels(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
@ -410,13 +409,13 @@ fxDDWriteMonoRGBAPixels(const GLcontext * ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
const GLchan color[4], const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLuint i;
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
GrColor_t gColor = FXCOLOR4(color);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDWriteMonoRGBAPixels(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
@ -431,7 +430,7 @@ read_R5G6B5_pixels(const GLcontext * ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
GLubyte rgba[][4], const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrLfbInfo_t info;
|
||||
BEGIN_BOARD_LOCK();
|
||||
if (grLfbLock(GR_LFB_READ_ONLY,
|
||||
@ -464,7 +463,7 @@ static void read_R5G5B5_pixels (const GLcontext * ctx,
|
||||
GLubyte rgba[][4],
|
||||
const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrLfbInfo_t info;
|
||||
BEGIN_BOARD_LOCK();
|
||||
if (grLfbLock(GR_LFB_READ_ONLY,
|
||||
@ -496,7 +495,7 @@ read_R8G8B8_pixels(const GLcontext * ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
GLubyte rgba[][4], const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrLfbInfo_t info;
|
||||
BEGIN_BOARD_LOCK();
|
||||
if (grLfbLock(GR_LFB_READ_ONLY,
|
||||
@ -530,11 +529,11 @@ fxDDWriteDepthSpan(GLcontext * ctx,
|
||||
GLuint n, GLint x, GLint y, const GLdepth depth[],
|
||||
const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDWriteDepthSpan(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
@ -565,12 +564,12 @@ fxDDWriteDepth32Span(GLcontext * ctx,
|
||||
GLuint n, GLint x, GLint y, const GLdepth depth[],
|
||||
const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
GLint i;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDWriteDepth32Span(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
@ -598,13 +597,13 @@ void
|
||||
fxDDReadDepthSpan(GLcontext * ctx,
|
||||
GLuint n, GLint x, GLint y, GLdepth depth[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
GLushort depth16[MAX_WIDTH];
|
||||
GLuint i;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDReadDepthSpan(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16);
|
||||
@ -618,11 +617,11 @@ void
|
||||
fxDDReadDepth32Span(GLcontext * ctx,
|
||||
GLuint n, GLint x, GLint y, GLdepth depth[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDReadDepth32Span(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth);
|
||||
@ -635,12 +634,12 @@ fxDDWriteDepthPixels(GLcontext * ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
const GLdepth depth[], const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
GLuint i;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDWriteDepthPixels(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
@ -660,12 +659,12 @@ fxDDWriteDepth32Pixels(GLcontext * ctx,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
const GLdepth depth[], const GLubyte mask[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
GLuint i;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDWriteDepth32Pixels(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
@ -684,12 +683,12 @@ void
|
||||
fxDDReadDepthPixels(GLcontext * ctx, GLuint n,
|
||||
const GLint x[], const GLint y[], GLdepth depth[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
GLuint i;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDReadDepthPixels(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
@ -706,12 +705,12 @@ void
|
||||
fxDDReadDepth32Pixels(GLcontext * ctx, GLuint n,
|
||||
const GLint x[], const GLint y[], GLdepth depth[])
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLint bottom = fxMesa->height - 1;
|
||||
GLuint i;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDReadDepth32Pixels(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
@ -728,11 +727,11 @@ fxDDReadDepth32Pixels(GLcontext * ctx, GLuint n,
|
||||
static void
|
||||
fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLuint bufferBit)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
(void) buffer;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) bufferBit);
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%x)\n", __FUNCTION__, (int)bufferBit);
|
||||
}
|
||||
|
||||
if (bufferBit == FRONT_LEFT_BIT) {
|
||||
@ -765,7 +764,7 @@ fxSetupDDSpanPointers(GLcontext * ctx)
|
||||
|
||||
/* swdd->ReadRGBASpan =fxDDReadRGBASpan; */
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
switch (fxMesa->colDepth) {
|
||||
case 15:
|
||||
swdd->ReadRGBASpan = read_R5G5B5_span;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: fxddtex.c,v 1.47 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxddtex.c,v 1.48 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -76,8 +76,6 @@ fxPrintTextureData(tfxTexInfo * ti)
|
||||
fprintf(stderr, "\tClamps: s %d t %d\n", (int) ti->sClamp,
|
||||
(int) ti->tClamp);
|
||||
fprintf(stderr, "\tScales: s %f t %f\n", ti->sScale, ti->tScale);
|
||||
fprintf(stderr, "\tInt Scales: s %d t %d\n",
|
||||
ti->int_sScale / 0x800000, ti->int_tScale / 0x800000);
|
||||
fprintf(stderr, "\t%s\n",
|
||||
(ti->fixedPalette) ? "Fixed palette" : "Non fixed palette");
|
||||
fprintf(stderr, "\t%s\n", (ti->validated) ? "Validated" : "Not validated");
|
||||
@ -91,7 +89,7 @@ fxPrintTextureData(tfxTexInfo * ti)
|
||||
static void
|
||||
fxTexInvalidate(GLcontext * ctx, struct gl_texture_object *tObj)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxTexInfo *ti;
|
||||
|
||||
ti = fxTMGetTexInfo(tObj);
|
||||
@ -108,7 +106,7 @@ fxAllocTexObjData(fxMesaContext fxMesa)
|
||||
tfxTexInfo *ti;
|
||||
|
||||
if (!(ti = CALLOC(sizeof(tfxTexInfo)))) {
|
||||
fprintf(stderr, "fx Driver: out of memory !\n");
|
||||
fprintf(stderr, "%s: ERROR: out of memory !\n", __FUNCTION__);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
}
|
||||
@ -136,11 +134,11 @@ fxAllocTexObjData(fxMesaContext fxMesa)
|
||||
void
|
||||
fxDDTexBind(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxTexInfo *ti;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDTexBind(%d,%x)\n", tObj->Name,
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%d, %x)\n", __FUNCTION__, tObj->Name,
|
||||
(GLuint) tObj->DriverData);
|
||||
}
|
||||
|
||||
@ -163,13 +161,13 @@ void
|
||||
fxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname,
|
||||
const GLfloat * param)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
if (param)
|
||||
fprintf(stderr, "fxmesa: texenv(%x,%x)\n", pname, (GLint) (*param));
|
||||
fprintf(stderr, "%s(%x, %x)\n", __FUNCTION__, pname, (GLint) (*param));
|
||||
else
|
||||
fprintf(stderr, "fxmesa: texenv(%x)\n", pname);
|
||||
fprintf(stderr, "%s(%x)\n", __FUNCTION__, pname);
|
||||
}
|
||||
|
||||
/* apply any lod biasing right now */
|
||||
@ -189,13 +187,13 @@ void
|
||||
fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
|
||||
GLenum pname, const GLfloat * params)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLenum param = (GLenum) (GLint) params[0];
|
||||
tfxTexInfo *ti;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDTexParam(%d,%x,%x,%x)\n", tObj->Name,
|
||||
(GLuint) tObj->DriverData, pname, param);
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%d, %x, %x, %x)\n", __FUNCTION__,
|
||||
tObj->Name, (GLuint) tObj->DriverData, pname, param);
|
||||
}
|
||||
|
||||
if (target != GL_TEXTURE_2D)
|
||||
@ -220,16 +218,6 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
|
||||
ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
|
||||
ti->LODblend = FXFALSE;
|
||||
break;
|
||||
case GL_NEAREST_MIPMAP_NEAREST:
|
||||
ti->mmMode = GR_MIPMAP_NEAREST;
|
||||
ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
|
||||
ti->LODblend = FXFALSE;
|
||||
break;
|
||||
case GL_LINEAR_MIPMAP_NEAREST:
|
||||
ti->mmMode = GR_MIPMAP_NEAREST;
|
||||
ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
|
||||
ti->LODblend = FXFALSE;
|
||||
break;
|
||||
case GL_NEAREST_MIPMAP_LINEAR:
|
||||
if (fxMesa->haveTwoTMUs) {
|
||||
ti->mmMode = GR_MIPMAP_NEAREST;
|
||||
@ -240,8 +228,16 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
|
||||
ti->LODblend = FXFALSE;
|
||||
}
|
||||
ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
|
||||
break; /* ZZZ: we may have to fall through here for V3 */
|
||||
case GL_NEAREST_MIPMAP_NEAREST:
|
||||
ti->mmMode = GR_MIPMAP_NEAREST;
|
||||
ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
|
||||
ti->LODblend = FXFALSE;
|
||||
break;
|
||||
case GL_LINEAR_MIPMAP_LINEAR:
|
||||
/* ZZZ: HACK ALERT! trilinear is bugged! mipmap blending produce
|
||||
incorrect filtered colors for the smallest mipmap levels. */
|
||||
#if 0
|
||||
if (fxMesa->haveTwoTMUs) {
|
||||
ti->mmMode = GR_MIPMAP_NEAREST;
|
||||
ti->LODblend = FXTRUE;
|
||||
@ -251,6 +247,12 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
|
||||
ti->LODblend = FXFALSE;
|
||||
}
|
||||
ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
|
||||
break; /* ZZZ: we may have to fall through here for V3 */
|
||||
#endif
|
||||
case GL_LINEAR_MIPMAP_NEAREST:
|
||||
ti->mmMode = GR_MIPMAP_NEAREST;
|
||||
ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
|
||||
ti->LODblend = FXFALSE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -274,6 +276,9 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
|
||||
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
switch (param) {
|
||||
case GL_MIRRORED_REPEAT:
|
||||
ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
break;
|
||||
case GL_CLAMP:
|
||||
ti->sClamp = GR_TEXTURECLAMP_CLAMP;
|
||||
break;
|
||||
@ -288,6 +293,9 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
|
||||
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
switch (param) {
|
||||
case GL_MIRRORED_REPEAT:
|
||||
ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
break;
|
||||
case GL_CLAMP:
|
||||
ti->tClamp = GR_TEXTURECLAMP_CLAMP;
|
||||
break;
|
||||
@ -328,8 +336,8 @@ fxDDTexDel(GLcontext * ctx, struct gl_texture_object *tObj)
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDTexDel(%d,%p)\n", tObj->Name, (void *) ti);
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%d, %p)\n", __FUNCTION__, tObj->Name, (void *) ti);
|
||||
}
|
||||
|
||||
if (!ti)
|
||||
@ -419,8 +427,8 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)
|
||||
if (tObj) {
|
||||
/* per-texture palette */
|
||||
tfxTexInfo *ti;
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDTexPalette(%d,%x)\n",
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%d, %x)\n", __FUNCTION__,
|
||||
tObj->Name, (GLuint) tObj->DriverData);
|
||||
}
|
||||
if (!tObj->DriverData)
|
||||
@ -431,8 +439,8 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)
|
||||
}
|
||||
else {
|
||||
/* global texture palette */
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDTexPalette(global)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(global)\n", __FUNCTION__);
|
||||
}
|
||||
convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette);
|
||||
fxMesa->new_state |= FX_NEW_TEXTURING;
|
||||
@ -445,8 +453,8 @@ fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDTexUseGlbPalette(%d)\n", state);
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%d)\n", __FUNCTION__, state);
|
||||
}
|
||||
|
||||
if (state) {
|
||||
@ -492,261 +500,107 @@ logbase2(int n)
|
||||
}
|
||||
}
|
||||
|
||||
/* Need different versions for different cpus.
|
||||
*/
|
||||
#define INT_TRICK(l2) (0x800000 * l2)
|
||||
|
||||
|
||||
int
|
||||
fxTexGetInfo(int w, int h, GrLOD_t * lodlevel, GrAspectRatio_t * ar,
|
||||
float *sscale, float *tscale,
|
||||
int *i_sscale, int *i_tscale, int *wscale, int *hscale)
|
||||
int *wscale, int *hscale)
|
||||
{
|
||||
/* [koolsmoky] */
|
||||
static GrLOD_t lod[12] = { GR_LOD_2048, GR_LOD_1024, GR_LOD_512, GR_LOD_256, GR_LOD_128, GR_LOD_64, GR_LOD_32,
|
||||
GR_LOD_16, GR_LOD_8, GR_LOD_4, GR_LOD_2, GR_LOD_1
|
||||
static GrLOD_t lod[12] = {
|
||||
GR_LOD_LOG2_1,
|
||||
GR_LOD_LOG2_2,
|
||||
GR_LOD_LOG2_4,
|
||||
GR_LOD_LOG2_8,
|
||||
GR_LOD_LOG2_16,
|
||||
GR_LOD_LOG2_32,
|
||||
GR_LOD_LOG2_64,
|
||||
GR_LOD_LOG2_128,
|
||||
GR_LOD_LOG2_256,
|
||||
GR_LOD_LOG2_512,
|
||||
GR_LOD_LOG2_1024,
|
||||
GR_LOD_LOG2_2048
|
||||
};
|
||||
|
||||
int logw, logh, ws, hs;
|
||||
GrLOD_t l;
|
||||
GrAspectRatio_t aspectratio;
|
||||
float s, t;
|
||||
int is, it;
|
||||
|
||||
logw = logbase2(w);
|
||||
logh = logbase2(h);
|
||||
|
||||
switch (logw - logh) {
|
||||
case 0:
|
||||
aspectratio = GR_ASPECT_1x1;
|
||||
l = lod[11 - logw];
|
||||
aspectratio = GR_ASPECT_LOG2_1x1;
|
||||
l = lod[logw];
|
||||
s = t = 256.0f;
|
||||
is = it = INT_TRICK(8);
|
||||
ws = hs = 1;
|
||||
break;
|
||||
case 1:
|
||||
aspectratio = GR_ASPECT_2x1;
|
||||
l = lod[11 - logw];
|
||||
aspectratio = GR_ASPECT_LOG2_2x1;
|
||||
l = lod[logw];
|
||||
s = 256.0f;
|
||||
t = 128.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(7);
|
||||
ws = 1;
|
||||
hs = 1;
|
||||
break;
|
||||
case 2:
|
||||
aspectratio = GR_ASPECT_4x1;
|
||||
l = lod[11 - logw];
|
||||
aspectratio = GR_ASPECT_LOG2_4x1;
|
||||
l = lod[logw];
|
||||
s = 256.0f;
|
||||
t = 64.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(6);
|
||||
ws = 1;
|
||||
hs = 1;
|
||||
break;
|
||||
case 3:
|
||||
aspectratio = GR_ASPECT_8x1;
|
||||
l = lod[11 - logw];
|
||||
aspectratio = GR_ASPECT_LOG2_8x1;
|
||||
l = lod[logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(5);
|
||||
ws = 1;
|
||||
hs = 1;
|
||||
break;
|
||||
case 4:
|
||||
aspectratio = GR_ASPECT_8x1;
|
||||
l = lod[11 - logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(5);
|
||||
ws = 1;
|
||||
hs = 2;
|
||||
break;
|
||||
case 5:
|
||||
aspectratio = GR_ASPECT_8x1;
|
||||
l = lod[11 - logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(5);
|
||||
ws = 1;
|
||||
hs = 4;
|
||||
break;
|
||||
case 6:
|
||||
aspectratio = GR_ASPECT_8x1;
|
||||
l = lod[11 - logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(5);
|
||||
ws = 1;
|
||||
hs = 8;
|
||||
break;
|
||||
case 7:
|
||||
aspectratio = GR_ASPECT_8x1;
|
||||
l = lod[11 - logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(5);
|
||||
ws = 1;
|
||||
hs = 16;
|
||||
break;
|
||||
case 8:
|
||||
aspectratio = GR_ASPECT_8x1;
|
||||
l = lod[11 - logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(5);
|
||||
ws = 1;
|
||||
hs = 32;
|
||||
break;
|
||||
case 9:
|
||||
aspectratio = GR_ASPECT_8x1;
|
||||
l = lod[11 - logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(5);
|
||||
ws = 1;
|
||||
hs = 64;
|
||||
break;
|
||||
case 10:
|
||||
aspectratio = GR_ASPECT_8x1;
|
||||
l = lod[11 - logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(5);
|
||||
ws = 1;
|
||||
hs = 128;
|
||||
break;
|
||||
case 11:
|
||||
aspectratio = GR_ASPECT_8x1;
|
||||
l = lod[11 - logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
is = INT_TRICK(8);
|
||||
it = INT_TRICK(5);
|
||||
ws = 1;
|
||||
hs = 256;
|
||||
break;
|
||||
case -1:
|
||||
aspectratio = GR_ASPECT_1x2;
|
||||
l = lod[11 - logh];
|
||||
aspectratio = GR_ASPECT_LOG2_1x2;
|
||||
l = lod[logh];
|
||||
s = 128.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(7);
|
||||
it = INT_TRICK(8);
|
||||
ws = 1;
|
||||
hs = 1;
|
||||
break;
|
||||
case -2:
|
||||
aspectratio = GR_ASPECT_1x4;
|
||||
l = lod[11 - logh];
|
||||
aspectratio = GR_ASPECT_LOG2_1x4;
|
||||
l = lod[logh];
|
||||
s = 64.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(6);
|
||||
it = INT_TRICK(8);
|
||||
ws = 1;
|
||||
hs = 1;
|
||||
break;
|
||||
case -3:
|
||||
aspectratio = GR_ASPECT_1x8;
|
||||
l = lod[11 - logh];
|
||||
aspectratio = GR_ASPECT_LOG2_1x8;
|
||||
l = lod[logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(5);
|
||||
it = INT_TRICK(8);
|
||||
ws = 1;
|
||||
hs = 1;
|
||||
break;
|
||||
case -4:
|
||||
aspectratio = GR_ASPECT_1x8;
|
||||
l = lod[11 - logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(5);
|
||||
it = INT_TRICK(8);
|
||||
ws = 2;
|
||||
hs = 1;
|
||||
break;
|
||||
case -5:
|
||||
aspectratio = GR_ASPECT_1x8;
|
||||
l = lod[11 - logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(5);
|
||||
it = INT_TRICK(8);
|
||||
ws = 4;
|
||||
hs = 1;
|
||||
break;
|
||||
case -6:
|
||||
aspectratio = GR_ASPECT_1x8;
|
||||
l = lod[11 - logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(5);
|
||||
it = INT_TRICK(8);
|
||||
ws = 8;
|
||||
hs = 1;
|
||||
break;
|
||||
case -7:
|
||||
aspectratio = GR_ASPECT_1x8;
|
||||
l = lod[11 - logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(5);
|
||||
it = INT_TRICK(8);
|
||||
ws = 16;
|
||||
hs = 1;
|
||||
break;
|
||||
case -8:
|
||||
aspectratio = GR_ASPECT_1x8;
|
||||
l = lod[11 - logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(5);
|
||||
it = INT_TRICK(8);
|
||||
ws = 32;
|
||||
hs = 1;
|
||||
break;
|
||||
case -9:
|
||||
aspectratio = GR_ASPECT_1x8;
|
||||
l = lod[11 - logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(5);
|
||||
it = INT_TRICK(8);
|
||||
ws = 64;
|
||||
hs = 1;
|
||||
break;
|
||||
case -10:
|
||||
aspectratio = GR_ASPECT_1x8;
|
||||
l = lod[11 - logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(5);
|
||||
it = INT_TRICK(8);
|
||||
ws = 128;
|
||||
hs = 1;
|
||||
break;
|
||||
case -11:
|
||||
aspectratio = GR_ASPECT_1x8;
|
||||
l = lod[11 - logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
is = INT_TRICK(5);
|
||||
it = INT_TRICK(8);
|
||||
ws = 256;
|
||||
hs = 1;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
if ((logw - logh) > 3) {
|
||||
aspectratio = GR_ASPECT_LOG2_8x1;
|
||||
l = lod[logw];
|
||||
s = 256.0f;
|
||||
t = 32.0f;
|
||||
ws = 1;
|
||||
hs = 1 << (logw - logh - 3);
|
||||
} else /*if ((logw - logh) < -3)*/ {
|
||||
aspectratio = GR_ASPECT_LOG2_1x8;
|
||||
l = lod[logh];
|
||||
s = 32.0f;
|
||||
t = 256.0f;
|
||||
ws = 1 << (logh - logw - 3);
|
||||
hs = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (lodlevel)
|
||||
@ -767,12 +621,6 @@ fxTexGetInfo(int w, int h, GrLOD_t * lodlevel, GrAspectRatio_t * ar,
|
||||
if (hscale)
|
||||
(*hscale) = hs;
|
||||
|
||||
if (i_sscale)
|
||||
*i_sscale = is;
|
||||
|
||||
if (i_tscale)
|
||||
*i_tscale = it;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -785,6 +633,7 @@ void
|
||||
fxTexGetFormat(GLcontext *ctx, GLenum glformat, GrTextureFormat_t * tfmt, GLint * ifmt) /* [koolsmoky] */
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLboolean allow32bpt = fxMesa->HaveTexFmt;
|
||||
|
||||
switch (glformat) {
|
||||
case 1:
|
||||
@ -845,19 +694,10 @@ fxTexGetFormat(GLcontext *ctx, GLenum glformat, GrTextureFormat_t * tfmt, GLint
|
||||
case GL_RGB10:
|
||||
case GL_RGB12:
|
||||
case GL_RGB16:
|
||||
#if 0 /* [koolsmoky] getting ready for 32bpp textures */
|
||||
if (fxMesa->colDepth == 32) {
|
||||
if (tfmt) (*tfmt) = GR_TEXFMT_ARGB_8888;
|
||||
} else {
|
||||
if (tfmt) (*tfmt) = GR_TEXFMT_RGB_565;
|
||||
}
|
||||
if (ifmt) (*ifmt) = GL_RGB;
|
||||
#else
|
||||
if (tfmt)
|
||||
(*tfmt) = GR_TEXFMT_RGB_565;
|
||||
(*tfmt) = allow32bpt ? GR_TEXFMT_ARGB_8888 : GR_TEXFMT_RGB_565;
|
||||
if (ifmt)
|
||||
(*ifmt) = GL_RGB;
|
||||
#endif
|
||||
break;
|
||||
case GL_RGBA2:
|
||||
case GL_RGBA4:
|
||||
@ -872,20 +712,11 @@ fxTexGetFormat(GLcontext *ctx, GLenum glformat, GrTextureFormat_t * tfmt, GLint
|
||||
case GL_RGB10_A2:
|
||||
case GL_RGBA12:
|
||||
case GL_RGBA16:
|
||||
#if 0 /* [koolsmoky] getting ready for 32bpp textures */
|
||||
if (fxMesa->colDepth == 32) {
|
||||
if (tfmt) (*tfmt) = GR_TEXFMT_ARGB_8888;
|
||||
} else {
|
||||
if (tfmt) (*tfmt) = GR_TEXFMT_ARGB_4444;
|
||||
}
|
||||
if (ifmt) (*ifmt) = GL_RGBA;
|
||||
#else
|
||||
if (tfmt)
|
||||
(*tfmt) = GR_TEXFMT_ARGB_4444;
|
||||
(*tfmt) = allow32bpt ? GR_TEXFMT_ARGB_8888 : GR_TEXFMT_ARGB_4444;
|
||||
if (ifmt)
|
||||
(*ifmt) = GL_RGBA;
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
case GL_RGB5_A1:
|
||||
if (tfmt)
|
||||
(*tfmt) = GR_TEXFMT_ARGB_1555;
|
||||
@ -905,9 +736,8 @@ fxTexGetFormat(GLcontext *ctx, GLenum glformat, GrTextureFormat_t * tfmt, GLint
|
||||
(*ifmt) = GL_RGBA; /* XXX why is this RGBA? */
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"fx Driver: unsupported internalFormat (0x%x) in fxTexGetFormat()\n",
|
||||
glformat);
|
||||
fprintf(stderr, "%s: ERROR: unsupported internalFormat (0x%x)\n",
|
||||
__FUNCTION__, glformat);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
break;
|
||||
@ -921,9 +751,8 @@ fxIsTexSupported(GLenum target, GLint internalFormat,
|
||||
if (target != GL_TEXTURE_2D)
|
||||
return GL_FALSE;
|
||||
|
||||
if (!fxTexGetInfo
|
||||
(image->Width, image->Height, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL)) return GL_FALSE;
|
||||
if (!fxTexGetInfo(image->Width, image->Height, NULL, NULL, NULL, NULL, NULL, NULL))
|
||||
return GL_FALSE;
|
||||
|
||||
if (image->Border > 0)
|
||||
return GL_FALSE;
|
||||
@ -1051,9 +880,9 @@ fetch_r5g6b5(const struct gl_texture_image *texImage,
|
||||
j = j * mml->hScale;
|
||||
|
||||
texel = ((GLushort *) texImage->Data) + j * mml->width + i;
|
||||
rgba[RCOMP] = (((*texel) >> 11) & 0x1f) * 255 / 31;
|
||||
rgba[GCOMP] = (((*texel) >> 5) & 0x3f) * 255 / 63;
|
||||
rgba[BCOMP] = (((*texel) >> 0) & 0x1f) * 255 / 31;
|
||||
rgba[RCOMP] = FX_rgb_scale_5[(*texel >> 11) & 0x1F];
|
||||
rgba[GCOMP] = FX_rgb_scale_6[(*texel >> 5) & 0x3F];
|
||||
rgba[BCOMP] = FX_rgb_scale_5[ *texel & 0x1F];
|
||||
rgba[ACOMP] = 255;
|
||||
}
|
||||
|
||||
@ -1070,10 +899,10 @@ fetch_r4g4b4a4(const struct gl_texture_image *texImage,
|
||||
j = j * mml->hScale;
|
||||
|
||||
texel = ((GLushort *) texImage->Data) + j * mml->width + i;
|
||||
rgba[RCOMP] = (((*texel) >> 12) & 0xf) * 255 / 15;
|
||||
rgba[GCOMP] = (((*texel) >> 8) & 0xf) * 255 / 15;
|
||||
rgba[BCOMP] = (((*texel) >> 4) & 0xf) * 255 / 15;
|
||||
rgba[ACOMP] = (((*texel) >> 0) & 0xf) * 255 / 15;
|
||||
rgba[RCOMP] = FX_rgb_scale_4[(*texel >> 12) & 0xF];
|
||||
rgba[GCOMP] = FX_rgb_scale_4[(*texel >> 8) & 0xF];
|
||||
rgba[BCOMP] = FX_rgb_scale_4[(*texel >> 4) & 0xF];
|
||||
rgba[ACOMP] = FX_rgb_scale_4[ *texel & 0xF];
|
||||
}
|
||||
|
||||
|
||||
@ -1089,14 +918,13 @@ fetch_r5g5b5a1(const struct gl_texture_image *texImage,
|
||||
j = j * mml->hScale;
|
||||
|
||||
texel = ((GLushort *) texImage->Data) + j * mml->width + i;
|
||||
rgba[RCOMP] = (((*texel) >> 11) & 0x1f) * 255 / 31;
|
||||
rgba[GCOMP] = (((*texel) >> 6) & 0x1f) * 255 / 31;
|
||||
rgba[BCOMP] = (((*texel) >> 1) & 0x1f) * 255 / 31;
|
||||
rgba[ACOMP] = (((*texel) >> 0) & 0x01) * 255;
|
||||
rgba[RCOMP] = FX_rgb_scale_5[(*texel >> 11) & 0x1F];
|
||||
rgba[GCOMP] = FX_rgb_scale_5[(*texel >> 6) & 0x1F];
|
||||
rgba[BCOMP] = FX_rgb_scale_5[(*texel >> 1) & 0x1F];
|
||||
rgba[ACOMP] = ((*texel) & 0x01) * 255;
|
||||
}
|
||||
|
||||
|
||||
#if 0 /* [koolsmoky] getting ready for 32bpp textures */
|
||||
static void
|
||||
fetch_a8r8g8b8(const struct gl_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLvoid * texelOut)
|
||||
@ -1110,11 +938,10 @@ fetch_a8r8g8b8(const struct gl_texture_image *texImage,
|
||||
|
||||
texel = ((GLuint *) texImage->Data) + j * mml->width + i;
|
||||
rgba[RCOMP] = (((*texel) >> 16) & 0xff);
|
||||
rgba[GCOMP] = (((*texel) >> 8) & 0xff);
|
||||
rgba[BCOMP] = (((*texel)) & 0xff);
|
||||
rgba[GCOMP] = (((*texel) >> 8) & 0xff);
|
||||
rgba[BCOMP] = (((*texel) ) & 0xff);
|
||||
rgba[ACOMP] = (((*texel) >> 24) & 0xff);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
@ -1124,12 +951,12 @@ PrintTexture(int w, int h, int c, const GLubyte * data)
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
if (c == 2)
|
||||
printf("%02x %02x ", data[0], data[1]);
|
||||
fprintf(stderr, "%02x %02x ", data[0], data[1]);
|
||||
else if (c == 3)
|
||||
printf("%02x %02x %02x ", data[0], data[1], data[2]);
|
||||
fprintf(stderr, "%02x %02x %02x ", data[0], data[1], data[2]);
|
||||
data += c;
|
||||
}
|
||||
printf("\n");
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1139,6 +966,11 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
|
||||
GLenum srcFormat, GLenum srcType )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLboolean allow32bpt = fxMesa->HaveTexFmt;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
|
||||
fprintf(stderr, "fxDDChooseTextureFormat(...)\n");
|
||||
}
|
||||
|
||||
switch (internalFormat) {
|
||||
case GL_INTENSITY:
|
||||
@ -1146,6 +978,7 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
|
||||
case GL_INTENSITY8:
|
||||
case GL_INTENSITY12:
|
||||
case GL_INTENSITY16:
|
||||
case GL_COMPRESSED_INTENSITY:
|
||||
return &_mesa_texformat_i8;
|
||||
case 1:
|
||||
case GL_LUMINANCE:
|
||||
@ -1153,12 +986,14 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
|
||||
case GL_LUMINANCE8:
|
||||
case GL_LUMINANCE12:
|
||||
case GL_LUMINANCE16:
|
||||
case GL_COMPRESSED_LUMINANCE:
|
||||
return &_mesa_texformat_l8;
|
||||
case GL_ALPHA:
|
||||
case GL_ALPHA4:
|
||||
case GL_ALPHA8:
|
||||
case GL_ALPHA12:
|
||||
case GL_ALPHA16:
|
||||
case GL_COMPRESSED_ALPHA:
|
||||
return &_mesa_texformat_a8;
|
||||
case GL_COLOR_INDEX:
|
||||
case GL_COLOR_INDEX1_EXT:
|
||||
@ -1176,6 +1011,7 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
|
||||
case GL_LUMINANCE12_ALPHA4:
|
||||
case GL_LUMINANCE12_ALPHA12:
|
||||
case GL_LUMINANCE16_ALPHA16:
|
||||
case GL_COMPRESSED_LUMINANCE_ALPHA:
|
||||
return &_mesa_texformat_al88;
|
||||
case GL_R3_G3_B2:
|
||||
case GL_RGB4:
|
||||
@ -1183,33 +1019,57 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
|
||||
return &_mesa_texformat_rgb565;
|
||||
case 3:
|
||||
case GL_RGB:
|
||||
case GL_COMPRESSED_RGB:
|
||||
if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) {
|
||||
return &_mesa_texformat_rgb565;
|
||||
}
|
||||
/* intentional fall through */
|
||||
case GL_RGB8:
|
||||
case GL_RGB10:
|
||||
case GL_RGB12:
|
||||
case GL_RGB16:
|
||||
#if 0 /* [koolsmoky] getting ready for 32bpp textures */
|
||||
return (fxMesa->colDepth == 32) ? &_mesa_texformat_argb8888
|
||||
: &_mesa_texformat_rgb565;
|
||||
#else
|
||||
return &_mesa_texformat_rgb565;
|
||||
#endif
|
||||
return (allow32bpt) ? &_mesa_texformat_argb8888
|
||||
: &_mesa_texformat_rgb565;
|
||||
case GL_RGBA2:
|
||||
case GL_RGBA4:
|
||||
return &_mesa_texformat_argb4444;
|
||||
case 4:
|
||||
case GL_RGBA:
|
||||
case GL_COMPRESSED_RGBA:
|
||||
if ( srcFormat == GL_BGRA ) {
|
||||
if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) {
|
||||
return &_mesa_texformat_argb8888;
|
||||
}
|
||||
else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
|
||||
return &_mesa_texformat_argb4444;
|
||||
}
|
||||
else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
|
||||
return &_mesa_texformat_argb1555;
|
||||
}
|
||||
}
|
||||
/* intentional fall through */
|
||||
case GL_RGBA8:
|
||||
case GL_RGB10_A2:
|
||||
case GL_RGBA12:
|
||||
case GL_RGBA16:
|
||||
#if 0 /* [koolsmoky] getting ready for 32bpp textures */
|
||||
return (fxMesa->colDepth == 32) ? &_mesa_texformat_argb8888
|
||||
: &_mesa_texformat_argb4444;
|
||||
#else
|
||||
return &_mesa_texformat_argb4444;
|
||||
#endif
|
||||
return (allow32bpt) ? &_mesa_texformat_argb8888
|
||||
: &_mesa_texformat_argb4444;
|
||||
case GL_RGB5_A1:
|
||||
return &_mesa_texformat_argb1555;
|
||||
#if 0
|
||||
/* GL_EXT_texture_compression_s3tc */
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
return &_mesa_texformat_rgb_dxt1;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
return &_mesa_texformat_rgba_dxt1;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
return &_mesa_texformat_rgba_dxt3;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
return &_mesa_texformat_rgba_dxt5;
|
||||
/*case GL_COMPRESSED_RGB_FXT1_3DFX:
|
||||
case GL_COMPRESSED_RGBA_FXT1_3DFX:
|
||||
return blah;*/
|
||||
#endif
|
||||
default:
|
||||
_mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
|
||||
return NULL;
|
||||
@ -1237,9 +1097,22 @@ fxGlideFormat(GLint mesaFormat)
|
||||
return GR_TEXFMT_ARGB_4444;
|
||||
case MESA_FORMAT_ARGB1555:
|
||||
return GR_TEXFMT_ARGB_1555;
|
||||
#if 0 /* [koolsmoky] getting ready for 32bpp textures */
|
||||
#if 1 /* [koolsmoky] getting ready for 32bpp textures */
|
||||
case MESA_FORMAT_ARGB8888:
|
||||
return GR_TEXFMT_ARGB_8888;
|
||||
#endif
|
||||
#if 0
|
||||
case MESA_FORMAT_RGB_DXT1:
|
||||
case MESA_FORMAT_RGBA_DXT1:
|
||||
return GR_TEXFMT_ARGB_CMP_DXT1;
|
||||
case MESA_FORMAT_RGBA_DXT3:
|
||||
return GR_TEXFMT_ARGB_CMP_DXT3;
|
||||
case MESA_FORMAT_RGBA_DXT5:
|
||||
return GR_TEXFMT_ARGB_CMP_DXT5;
|
||||
/*case MESA_FORMAT_ARGB_CMP_FXT1:
|
||||
return GR_TEXFMT_ARGB_CMP_FXT1;
|
||||
case MESA_FORMAT_RGB_CMP_FXT1:
|
||||
return GL_COMPRESSED_RGBA_FXT1_3DFX;*/
|
||||
#endif
|
||||
default:
|
||||
_mesa_problem(NULL, "Unexpected format in fxGlideFormat");
|
||||
@ -1268,12 +1141,19 @@ fxFetchFunction(GLint mesaFormat)
|
||||
return fetch_r4g4b4a4;
|
||||
case MESA_FORMAT_ARGB1555:
|
||||
return fetch_r5g5b5a1;
|
||||
#if 0 /* [koolsmoky] getting ready for 32bpp textures */
|
||||
#if 1 /* [koolsmoky] getting ready for 32bpp textures */
|
||||
case MESA_FORMAT_ARGB8888:
|
||||
return fetch_a8r8g8b8;
|
||||
#endif
|
||||
#if 0
|
||||
case MESA_FORMAT_RGB_DXT1:
|
||||
case MESA_FORMAT_RGBA_DXT1:
|
||||
case MESA_FORMAT_RGBA_DXT3:
|
||||
case MESA_FORMAT_RGBA_DXT5:
|
||||
return fetch_r4g4b4a4;
|
||||
#endif
|
||||
default:
|
||||
_mesa_problem(NULL, "Unexpected format in fxGlideFormat");
|
||||
_mesa_problem(NULL, "Unexpected format in fxFetchFunction");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -1286,11 +1166,17 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxTexInfo *ti;
|
||||
tfxMipMapLevel *mml;
|
||||
GLint texelBytes;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
|
||||
fprintf(stderr, "fxDDTexImage2D: id=%d int 0x%x format 0x%x type 0x%x %dx%d\n",
|
||||
texObj->Name, texImage->IntFormat, format, type,
|
||||
texImage->Width, texImage->Height);
|
||||
}
|
||||
|
||||
if (!fxIsTexSupported(target, internalFormat, texImage)) {
|
||||
_mesa_problem(NULL, "fx Driver: unsupported texture in fxDDTexImg()\n");
|
||||
return;
|
||||
@ -1306,7 +1192,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
ti = fxTMGetTexInfo(texObj);
|
||||
|
||||
if (!texImage->DriverData) {
|
||||
texImage->DriverData = MALLOC(sizeof(tfxMipMapLevel));
|
||||
texImage->DriverData = CALLOC(sizeof(tfxMipMapLevel));
|
||||
if (!texImage->DriverData) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
|
||||
return;
|
||||
@ -1315,7 +1201,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
mml = FX_MIPMAP_DATA(texImage);
|
||||
|
||||
fxTexGetInfo(width, height, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, &mml->wScale, &mml->hScale);
|
||||
&mml->wScale, &mml->hScale);
|
||||
|
||||
mml->width = width * mml->wScale;
|
||||
mml->height = height * mml->hScale;
|
||||
@ -1327,7 +1213,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
internalFormat, format, type);
|
||||
assert(texImage->TexFormat);
|
||||
texelBytes = texImage->TexFormat->TexelBytes;
|
||||
assert(texelBytes == 1 || texelBytes == 2);
|
||||
/*if (!fxMesa->HaveTexFmt) assert(texelBytes == 1 || texelBytes == 2);*/
|
||||
|
||||
if (mml->wScale != 1 || mml->hScale != 1) {
|
||||
/* rescale image to overcome 1:8 aspect limitation */
|
||||
@ -1346,7 +1232,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
0, /* dstImageStride */
|
||||
format, type, pixels, packing);
|
||||
assert(!texImage->Data);
|
||||
texImage->Data = MALLOC(mml->width * mml->height * texelBytes);
|
||||
texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes);
|
||||
if (!texImage->Data) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
|
||||
FREE(tempImage);
|
||||
@ -1362,7 +1248,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
else {
|
||||
/* no rescaling needed */
|
||||
assert(!texImage->Data);
|
||||
texImage->Data = MALLOC(mml->width * mml->height * texelBytes);
|
||||
texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes);
|
||||
if (!texImage->Data) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
|
||||
return;
|
||||
@ -1377,16 +1263,18 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
}
|
||||
|
||||
mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat);
|
||||
ti->info.format = mml->glideFormat;
|
||||
texImage->FetchTexel = fxFetchFunction(texImage->TexFormat->MesaFormat);
|
||||
|
||||
fxTexInvalidate(ctx, texObj);
|
||||
|
||||
if (ti->validated && ti->isInTM) {
|
||||
/*printf("reloadmipmaplevels\n"); */
|
||||
/* [dBorca]
|
||||
* Hack alert: unsure...
|
||||
*/
|
||||
if (!(fxMesa->new_state & FX_NEW_TEXTURING) && ti->validated && ti->isInTM) {
|
||||
/*fprintf(stderr, "reloadmipmaplevels\n"); */
|
||||
fxTMReloadMipMapLevel(fxMesa, texObj, level);
|
||||
}
|
||||
else {
|
||||
/*printf("invalidate2\n"); */
|
||||
/*fprintf(stderr, "invalidate2\n"); */
|
||||
fxTexInvalidate(ctx, texObj);
|
||||
}
|
||||
}
|
||||
@ -1401,11 +1289,15 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxTexInfo *ti;
|
||||
tfxMipMapLevel *mml;
|
||||
GLint texelBytes;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
|
||||
fprintf(stderr, "fxDDTexSubImage2D: id=%d\n", texObj->Name);
|
||||
}
|
||||
|
||||
if (!texObj->DriverData) {
|
||||
_mesa_problem(ctx, "problem in fxDDTexSubImage2D");
|
||||
return;
|
||||
@ -1425,7 +1317,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
/* need to rescale subimage to match mipmap level's rescale factors */
|
||||
const GLint newWidth = width * mml->wScale;
|
||||
const GLint newHeight = height * mml->hScale;
|
||||
GLvoid *scaledImage, *tempImage;
|
||||
GLvoid *tempImage;
|
||||
GLubyte *destAddr;
|
||||
tempImage = MALLOC(width * height * texelBytes);
|
||||
if (!tempImage) {
|
||||
@ -1443,13 +1335,6 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
format, type, pixels, packing);
|
||||
|
||||
/* now rescale */
|
||||
scaledImage = MALLOC(newWidth * newHeight * texelBytes);
|
||||
if (!scaledImage) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
|
||||
FREE(tempImage);
|
||||
return;
|
||||
}
|
||||
|
||||
/* compute address of dest subimage within the overal tex image */
|
||||
destAddr = (GLubyte *) texImage->Data
|
||||
+ (yoffset * mml->hScale * mml->width
|
||||
@ -1462,7 +1347,6 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
tempImage, destAddr);
|
||||
|
||||
FREE(tempImage);
|
||||
FREE(scaledImage);
|
||||
}
|
||||
else {
|
||||
/* no rescaling needed */
|
||||
@ -1476,7 +1360,10 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
|
||||
format, type, pixels, packing);
|
||||
}
|
||||
|
||||
if (ti->validated && ti->isInTM)
|
||||
/* [dBorca]
|
||||
* Hack alert: unsure...
|
||||
*/
|
||||
if (!(fxMesa->new_state & FX_NEW_TEXTURING) && ti->validated && ti->isInTM)
|
||||
fxTMReloadMipMapLevel(fxMesa, texObj, level);
|
||||
else
|
||||
fxTexInvalidate(ctx, texObj);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: fxdrv.h,v 1.58 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxdrv.h,v 1.59 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -69,25 +69,12 @@
|
||||
#define ZCOORD GR_VERTEX_OOZ_OFFSET
|
||||
#define OOWCOORD GR_VERTEX_OOW_OFFSET
|
||||
|
||||
#define RCOORD GR_VERTEX_R_OFFSET
|
||||
#define GCOORD GR_VERTEX_G_OFFSET
|
||||
#define BCOORD GR_VERTEX_B_OFFSET
|
||||
#define ACOORD GR_VERTEX_A_OFFSET
|
||||
|
||||
#define S0COORD GR_VERTEX_SOW_TMU0_OFFSET
|
||||
#define T0COORD GR_VERTEX_TOW_TMU0_OFFSET
|
||||
#define S1COORD GR_VERTEX_SOW_TMU1_OFFSET
|
||||
#define T1COORD GR_VERTEX_TOW_TMU1_OFFSET
|
||||
|
||||
|
||||
extern float gl_ubyte_to_float_255_color_tab[256];
|
||||
#define UBYTE_COLOR_TO_FLOAT_255_COLOR(c) gl_ubyte_to_float_255_color_tab[c]
|
||||
#define UBYTE_COLOR_TO_FLOAT_255_COLOR2(f,c) \
|
||||
(*(int *)&(f)) = ((int *)gl_ubyte_to_float_255_color_tab)[c]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __i386__
|
||||
#define FXCOLOR4( c ) (* (int *)c)
|
||||
@ -208,10 +195,6 @@ typedef struct tfxTexInfo_t
|
||||
GrMipMapMode_t mmMode;
|
||||
|
||||
GLfloat sScale, tScale;
|
||||
GLint int_sScale, int_tScale; /* x86 floating point trick for
|
||||
* multiplication by powers of 2.
|
||||
* Used in fxfasttmp.h
|
||||
*/
|
||||
|
||||
GuTexPalette palette;
|
||||
|
||||
@ -252,6 +235,19 @@ typedef struct
|
||||
GLboolean depthTestEnabled;
|
||||
GLboolean depthMask;
|
||||
GrCmpFnc_t depthTestFunc;
|
||||
FxI32 depthBias;
|
||||
|
||||
/* Stencil */
|
||||
|
||||
GLboolean stencilEnabled;
|
||||
GrCmpFnc_t stencilFunction; /* Stencil function */
|
||||
GrStencil_t stencilRefValue; /* Stencil reference value */
|
||||
GrStencil_t stencilValueMask; /* Value mask */
|
||||
GrStencil_t stencilWriteMask; /* Write mask */
|
||||
GrCmpFnc_t stencilFailFunc; /* Stencil fail function */
|
||||
GrCmpFnc_t stencilZFailFunc; /* Stencil pass, depth fail function */
|
||||
GrCmpFnc_t stencilZPassFunc; /* Stencil pass, depth pass function */
|
||||
GrStencil_t stencilClear; /* Buffer clear value */
|
||||
}
|
||||
tfxUnitsState;
|
||||
|
||||
@ -268,6 +264,7 @@ tfxUnitsState;
|
||||
#define FX_NEW_SCISSOR 0x20
|
||||
#define FX_NEW_COLOR_MASK 0x40
|
||||
#define FX_NEW_CULL 0x80
|
||||
#define FX_NEW_STENCIL 0x100
|
||||
|
||||
|
||||
#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
|
||||
@ -327,8 +324,10 @@ extern GLubyte FX_PixelToR[0x10000];
|
||||
extern GLubyte FX_PixelToG[0x10000];
|
||||
extern GLubyte FX_PixelToB[0x10000];
|
||||
|
||||
/* lookup table for scaling 5 bit colors up to 8 bits */
|
||||
GLuint FX_rgb_scale_5[32];
|
||||
/* lookup table for scaling y bit colors up to 8 bits */
|
||||
extern GLuint FX_rgb_scale_4[16];
|
||||
extern GLuint FX_rgb_scale_5[32];
|
||||
extern GLuint FX_rgb_scale_6[64];
|
||||
|
||||
typedef void (*fx_tri_func) (fxMesaContext, GrVertex *, GrVertex *, GrVertex *);
|
||||
typedef void (*fx_line_func) (fxMesaContext, GrVertex *, GrVertex *);
|
||||
@ -359,6 +358,7 @@ struct tfxMesaContext
|
||||
|
||||
|
||||
GLuint new_state;
|
||||
GLuint new_gl_state;
|
||||
|
||||
/* Texture Memory Manager Data
|
||||
*/
|
||||
@ -387,7 +387,7 @@ struct tfxMesaContext
|
||||
/* Rasterization:
|
||||
*/
|
||||
GLuint render_index;
|
||||
GLuint is_in_hardware;
|
||||
GLuint fallback;
|
||||
GLenum render_primitive;
|
||||
GLenum raster_primitive;
|
||||
|
||||
@ -419,7 +419,8 @@ struct tfxMesaContext
|
||||
|
||||
GLboolean verbose;
|
||||
GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
|
||||
GLboolean haveAlphaBuffer;
|
||||
GLboolean haveHwAlpha;
|
||||
GLboolean haveHwStencil;
|
||||
GLboolean haveZBuffer;
|
||||
GLboolean haveDoubleBuffer;
|
||||
GLboolean haveGlobalPaletteTexture;
|
||||
@ -430,20 +431,28 @@ struct tfxMesaContext
|
||||
|
||||
int screen_width;
|
||||
int screen_height;
|
||||
int initDone;
|
||||
int clipMinX;
|
||||
int clipMaxX;
|
||||
int clipMinY;
|
||||
int clipMaxY;
|
||||
|
||||
int colDepth;
|
||||
int maxTextureSize; /* [koolsmoky] */
|
||||
GLboolean fsaa;
|
||||
|
||||
/* Glide (per card) capabilities. These get mirrored
|
||||
* from `glbHWConfig' when creating a new context...
|
||||
*/
|
||||
GrSstType type;
|
||||
FxBool HavePixExt; /* PIXEXT */
|
||||
FxBool HaveTexFmt; /* TEXFMT */
|
||||
FxBool HaveCmbExt; /* COMBINE */
|
||||
FxBool HaveMirExt; /* TEXMIRROR */
|
||||
FxBool HaveTexus2; /* Texus 2 - FXT1 */
|
||||
struct tdfx_glide Glide;
|
||||
char rendererString[100];
|
||||
};
|
||||
|
||||
|
||||
extern GrHwConfiguration glbHWConfig;
|
||||
extern int glbCurrentBoard;
|
||||
|
||||
extern void fxSetupFXUnits(GLcontext *);
|
||||
extern void fxSetupDDPointers(GLcontext *);
|
||||
|
||||
@ -505,6 +514,9 @@ extern void fxDDAlphaFunc(GLcontext *, GLenum, GLfloat);
|
||||
extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum);
|
||||
extern void fxDDDepthMask(GLcontext *, GLboolean);
|
||||
extern void fxDDDepthFunc(GLcontext *, GLenum);
|
||||
extern void fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
|
||||
extern void fxDDStencilMask (GLcontext *ctx, GLuint mask);
|
||||
extern void fxDDStencilOp (GLcontext *ctx, GLenum sfail, GLenum zfail, GLenum zpass);
|
||||
|
||||
extern void fxDDInitExtensions(GLcontext * ctx);
|
||||
|
||||
@ -524,7 +536,7 @@ extern void fxTMReloadSubMipMapLevel(fxMesaContext,
|
||||
extern void fxTexGetFormat(GLcontext *, GLenum, GrTextureFormat_t *, GLint *); /* [koolsmoky] */
|
||||
|
||||
extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *,
|
||||
float *, float *, int *, int *, int *, int *);
|
||||
float *, float *, int *, int *);
|
||||
|
||||
extern void fxDDScissor(GLcontext * ctx,
|
||||
GLint x, GLint y, GLsizei w, GLsizei h);
|
||||
@ -558,6 +570,7 @@ extern int fxDDInitFxMesaContext(fxMesaContext fxMesa);
|
||||
extern void fxDDDestroyFxMesaContext(fxMesaContext fxMesa);
|
||||
|
||||
|
||||
void fxColorMask (fxMesaContext fxMesa, GLboolean enable);
|
||||
|
||||
|
||||
extern void fxSetScissorValues(GLcontext * ctx);
|
||||
@ -567,6 +580,19 @@ extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
|
||||
|
||||
extern void fxCheckIsInHardware(GLcontext *ctx);
|
||||
|
||||
extern GLboolean fx_check_IsInHardware(GLcontext *ctx);
|
||||
/* Flags for software fallback cases */
|
||||
#define FX_FALLBACK_TEXTURE_1D_3D 0x0001
|
||||
#define FX_FALLBACK_DRAW_BUFFER 0x0002
|
||||
#define FX_FALLBACK_SPECULAR 0x0004
|
||||
#define FX_FALLBACK_STENCIL 0x0008
|
||||
#define FX_FALLBACK_RENDER_MODE 0x0010
|
||||
#define FX_FALLBACK_LOGICOP 0x0020
|
||||
#define FX_FALLBACK_TEXTURE_ENV 0x0040
|
||||
#define FX_FALLBACK_TEXTURE_BORDER 0x0080
|
||||
#define FX_FALLBACK_COLORMASK 0x0100
|
||||
#define FX_FALLBACK_BLEND 0x0200
|
||||
#define FX_FALLBACK_TEXTURE_MULTI 0x0400
|
||||
|
||||
extern GLuint fx_check_IsInHardware(GLcontext *ctx);
|
||||
|
||||
#endif
|
||||
|
2135
src/mesa/drivers/glide/fxg.c
Normal file
2135
src/mesa/drivers/glide/fxg.c
Normal file
File diff suppressed because it is too large
Load Diff
352
src/mesa/drivers/glide/fxg.h
Normal file
352
src/mesa/drivers/glide/fxg.h
Normal file
@ -0,0 +1,352 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 5.0.1
|
||||
*
|
||||
* Copyright (C) 1999-2003 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa/FX device driver. Interface to Glide3.
|
||||
*
|
||||
* Copyright (c) 2003 - Daniel Borca
|
||||
* Email : dborca@users.sourceforge.net
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TDFX_GLIDE_H_included
|
||||
#define TDFX_GLIDE_H_included
|
||||
|
||||
#include <glide.h>
|
||||
#include <g3ext.h>
|
||||
|
||||
#define DEBUG_TRAP 0
|
||||
|
||||
#if DEBUG_TRAP
|
||||
/*
|
||||
** rendering functions
|
||||
*/
|
||||
void FX_CALL trap_grDrawPoint (const void *pt);
|
||||
void FX_CALL trap_grDrawLine (const void *v1, const void *v2);
|
||||
void FX_CALL trap_grDrawTriangle (const void *a, const void *b, const void *c);
|
||||
void FX_CALL trap_grVertexLayout (FxU32 param, FxI32 offset, FxU32 mode);
|
||||
void FX_CALL trap_grDrawVertexArray (FxU32 mode, FxU32 Count, void *pointers);
|
||||
void FX_CALL trap_grDrawVertexArrayContiguous (FxU32 mode, FxU32 Count, void *pointers, FxU32 stride);
|
||||
|
||||
/*
|
||||
** Antialiasing Functions
|
||||
*/
|
||||
void FX_CALL trap_grAADrawTriangle (const void *a, const void *b, const void *c, FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias);
|
||||
|
||||
/*
|
||||
** buffer management
|
||||
*/
|
||||
void FX_CALL trap_grBufferClear (GrColor_t color, GrAlpha_t alpha, FxU32 depth);
|
||||
void FX_CALL trap_grBufferSwap (FxU32 swap_interval);
|
||||
void FX_CALL trap_grRenderBuffer (GrBuffer_t buffer);
|
||||
|
||||
/*
|
||||
** error management
|
||||
*/
|
||||
void FX_CALL trap_grErrorSetCallback (GrErrorCallbackFnc_t fnc);
|
||||
|
||||
/*
|
||||
** SST routines
|
||||
*/
|
||||
void FX_CALL trap_grFinish (void);
|
||||
void FX_CALL trap_grFlush (void);
|
||||
GrContext_t FX_CALL trap_grSstWinOpen (FxU32 hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers);
|
||||
FxBool FX_CALL trap_grSstWinClose (GrContext_t context);
|
||||
void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers);
|
||||
FxBool FX_CALL trap_grSelectContext (GrContext_t context);
|
||||
void FX_CALL trap_grSstOrigin (GrOriginLocation_t origin);
|
||||
void FX_CALL trap_grSstSelect (int which_sst);
|
||||
|
||||
/*
|
||||
** Glide configuration and special effect maintenance functions
|
||||
*/
|
||||
void FX_CALL trap_grAlphaBlendFunction (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df);
|
||||
void FX_CALL trap_grAlphaCombine (GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, FxBool invert);
|
||||
void FX_CALL trap_grAlphaControlsITRGBLighting (FxBool enable);
|
||||
void FX_CALL trap_grAlphaTestFunction (GrCmpFnc_t function);
|
||||
void FX_CALL trap_grAlphaTestReferenceValue (GrAlpha_t value);
|
||||
void FX_CALL trap_grChromakeyMode (GrChromakeyMode_t mode);
|
||||
void FX_CALL trap_grChromakeyValue (GrColor_t value);
|
||||
void FX_CALL trap_grClipWindow (FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy);
|
||||
void FX_CALL trap_grColorCombine (GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, FxBool invert);
|
||||
void FX_CALL trap_grColorMask (FxBool rgb, FxBool a);
|
||||
void FX_CALL trap_grCullMode (GrCullMode_t mode);
|
||||
void FX_CALL trap_grConstantColorValue (GrColor_t value);
|
||||
void FX_CALL trap_grDepthBiasLevel (FxI32 level);
|
||||
void FX_CALL trap_grDepthBufferFunction (GrCmpFnc_t function);
|
||||
void FX_CALL trap_grDepthBufferMode (GrDepthBufferMode_t mode);
|
||||
void FX_CALL trap_grDepthMask (FxBool mask);
|
||||
void FX_CALL trap_grDisableAllEffects (void);
|
||||
void FX_CALL trap_grDitherMode (GrDitherMode_t mode);
|
||||
void FX_CALL trap_grFogColorValue (GrColor_t fogcolor);
|
||||
void FX_CALL trap_grFogMode (GrFogMode_t mode);
|
||||
void FX_CALL trap_grFogTable (const GrFog_t ft[]);
|
||||
void FX_CALL trap_grLoadGammaTable (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
|
||||
void FX_CALL trap_grSplash (float x, float y, float width, float height, FxU32 frame);
|
||||
FxU32 FX_CALL trap_grGet (FxU32 pname, FxU32 plength, FxI32 *params);
|
||||
const char * FX_CALL trap_grGetString (FxU32 pname);
|
||||
FxI32 FX_CALL trap_grQueryResolutions (const GrResolution *resTemplate, GrResolution *output);
|
||||
FxBool FX_CALL trap_grReset (FxU32 what);
|
||||
GrProc FX_CALL trap_grGetProcAddress (char *procName);
|
||||
void FX_CALL trap_grEnable (GrEnableMode_t mode);
|
||||
void FX_CALL trap_grDisable (GrEnableMode_t mode);
|
||||
void FX_CALL trap_grCoordinateSpace (GrCoordinateSpaceMode_t mode);
|
||||
void FX_CALL trap_grDepthRange (FxFloat n, FxFloat f);
|
||||
void FX_CALL trap_grStippleMode (GrStippleMode_t mode);
|
||||
void FX_CALL trap_grStipplePattern (GrStipplePattern_t mode);
|
||||
void FX_CALL trap_grViewport (FxI32 x, FxI32 y, FxI32 width, FxI32 height);
|
||||
|
||||
/*
|
||||
** texture mapping control functions
|
||||
*/
|
||||
FxU32 FX_CALL trap_grTexCalcMemRequired (GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt);
|
||||
FxU32 FX_CALL trap_grTexTextureMemRequired (FxU32 evenOdd, GrTexInfo *info);
|
||||
FxU32 FX_CALL trap_grTexMinAddress (GrChipID_t tmu);
|
||||
FxU32 FX_CALL trap_grTexMaxAddress (GrChipID_t tmu);
|
||||
void FX_CALL trap_grTexNCCTable (GrNCCTable_t table);
|
||||
void FX_CALL trap_grTexSource (GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info);
|
||||
void FX_CALL trap_grTexClampMode (GrChipID_t tmu, GrTextureClampMode_t s_clampmode, GrTextureClampMode_t t_clampmode);
|
||||
void FX_CALL trap_grTexCombine (GrChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, FxBool rgb_invert, FxBool alpha_invert);
|
||||
void FX_CALL trap_grTexDetailControl (GrChipID_t tmu, int lod_bias, FxU8 detail_scale, float detail_max);
|
||||
void FX_CALL trap_grTexFilterMode (GrChipID_t tmu, GrTextureFilterMode_t minfilter_mode, GrTextureFilterMode_t magfilter_mode);
|
||||
void FX_CALL trap_grTexLodBiasValue (GrChipID_t tmu, float bias);
|
||||
void FX_CALL trap_grTexDownloadMipMap (GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info);
|
||||
void FX_CALL trap_grTexDownloadMipMapLevel (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, GrLOD_t largeLod, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 evenOdd, void *data);
|
||||
FxBool FX_CALL trap_grTexDownloadMipMapLevelPartial (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, GrLOD_t largeLod, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 evenOdd, void *data, int start, int end);
|
||||
void FX_CALL trap_grTexDownloadTable (GrTexTable_t type, void *data);
|
||||
void FX_CALL trap_grTexDownloadTablePartial (GrTexTable_t type, void *data, int start, int end);
|
||||
void FX_CALL trap_grTexMipMapMode (GrChipID_t tmu, GrMipMapMode_t mode, FxBool lodBlend);
|
||||
void FX_CALL trap_grTexMultibase (GrChipID_t tmu, FxBool enable);
|
||||
void FX_CALL trap_grTexMultibaseAddress (GrChipID_t tmu, GrTexBaseRange_t range, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info);
|
||||
|
||||
/*
|
||||
** linear frame buffer functions
|
||||
*/
|
||||
FxBool FX_CALL trap_grLfbLock (GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, FxBool pixelPipeline, GrLfbInfo_t *info);
|
||||
FxBool FX_CALL trap_grLfbUnlock (GrLock_t type, GrBuffer_t buffer);
|
||||
void FX_CALL trap_grLfbConstantAlpha (GrAlpha_t alpha);
|
||||
void FX_CALL trap_grLfbConstantDepth (FxU32 depth);
|
||||
void FX_CALL trap_grLfbWriteColorSwizzle (FxBool swizzleBytes, FxBool swapWords);
|
||||
void FX_CALL trap_grLfbWriteColorFormat (GrColorFormat_t colorFormat);
|
||||
FxBool FX_CALL trap_grLfbWriteRegion (GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, FxU32 src_width, FxU32 src_height, FxBool pixelPipeline, FxI32 src_stride, void *src_data);
|
||||
FxBool FX_CALL trap_grLfbReadRegion (GrBuffer_t src_buffer, FxU32 src_x, FxU32 src_y, FxU32 src_width, FxU32 src_height, FxU32 dst_stride, void *dst_data);
|
||||
|
||||
/*
|
||||
** glide management functions
|
||||
*/
|
||||
void FX_CALL trap_grGlideInit (void);
|
||||
void FX_CALL trap_grGlideShutdown (void);
|
||||
void FX_CALL trap_grGlideGetState (void *state);
|
||||
void FX_CALL trap_grGlideSetState (const void *state);
|
||||
void FX_CALL trap_grGlideGetVertexLayout (void *layout);
|
||||
void FX_CALL trap_grGlideSetVertexLayout (const void *layout);
|
||||
|
||||
/*
|
||||
** glide utility functions
|
||||
*/
|
||||
void FX_CALL trap_guGammaCorrectionRGB (FxFloat red, FxFloat green, FxFloat blue);
|
||||
float FX_CALL trap_guFogTableIndexToW (int i);
|
||||
void FX_CALL trap_guFogGenerateExp (GrFog_t *fogtable, float density);
|
||||
void FX_CALL trap_guFogGenerateExp2 (GrFog_t *fogtable, float density);
|
||||
void FX_CALL trap_guFogGenerateLinear (GrFog_t *fogtable, float nearZ, float farZ);
|
||||
|
||||
#ifndef DEBUG_TRAP_internal
|
||||
/*
|
||||
** rendering functions
|
||||
*/
|
||||
#define grDrawPoint trap_grDrawPoint
|
||||
#define grDrawLine trap_grDrawLine
|
||||
#define grDrawTriangle trap_grDrawTriangle
|
||||
#define grVertexLayout trap_grVertexLayout
|
||||
#define grDrawVertexArray trap_grDrawVertexArray
|
||||
#define grDrawVertexArrayContiguous trap_grDrawVertexArrayContiguous
|
||||
|
||||
/*
|
||||
** Antialiasing Functions
|
||||
*/
|
||||
#define grAADrawTriangle trap_grAADrawTriangle
|
||||
|
||||
/*
|
||||
** buffer management
|
||||
*/
|
||||
#define grBufferClear trap_grBufferClear
|
||||
#define grBufferSwap trap_grBufferSwap
|
||||
#define grRenderBuffer trap_grRenderBuffer
|
||||
|
||||
/*
|
||||
** error management
|
||||
*/
|
||||
#define grErrorSetCallback trap_grErrorSetCallback
|
||||
|
||||
/*
|
||||
** SST routines
|
||||
*/
|
||||
#define grFinish trap_grFinish
|
||||
#define grFlush trap_grFlush
|
||||
#define grSstWinOpen trap_grSstWinOpen
|
||||
#define grSstWinClose trap_grSstWinClose
|
||||
#define grSetNumPendingBuffers trap_grSetNumPendingBuffers
|
||||
#define grSelectContext trap_grSelectContext
|
||||
#define grSstOrigin trap_grSstOrigin
|
||||
#define grSstSelect trap_grSstSelect
|
||||
|
||||
/*
|
||||
** Glide configuration and special effect maintenance functions
|
||||
*/
|
||||
#define grAlphaBlendFunction trap_grAlphaBlendFunction
|
||||
#define grAlphaCombine trap_grAlphaCombine
|
||||
#define grAlphaControlsITRGBLighting trap_grAlphaControlsITRGBLighting
|
||||
#define grAlphaTestFunction trap_grAlphaTestFunction
|
||||
#define grAlphaTestReferenceValue trap_grAlphaTestReferenceValue
|
||||
#define grChromakeyMode trap_grChromakeyMode
|
||||
#define grChromakeyValue trap_grChromakeyValue
|
||||
#define grClipWindow trap_grClipWindow
|
||||
#define grColorCombine trap_grColorCombine
|
||||
#define grColorMask trap_grColorMask
|
||||
#define grCullMode trap_grCullMode
|
||||
#define grConstantColorValue trap_grConstantColorValue
|
||||
#define grDepthBiasLevel trap_grDepthBiasLevel
|
||||
#define grDepthBufferFunction trap_grDepthBufferFunction
|
||||
#define grDepthBufferMode trap_grDepthBufferMode
|
||||
#define grDepthMask trap_grDepthMask
|
||||
#define grDisableAllEffects trap_grDisableAllEffects
|
||||
#define grDitherMode trap_grDitherMode
|
||||
#define grFogColorValue trap_grFogColorValue
|
||||
#define grFogMode trap_grFogMode
|
||||
#define grFogTable trap_grFogTable
|
||||
#define grLoadGammaTable trap_grLoadGammaTable
|
||||
#define grSplash trap_grSplash
|
||||
#define grGet trap_grGet
|
||||
#define grGetString trap_grGetString
|
||||
#define grQueryResolutions trap_grQueryResolutions
|
||||
#define grReset trap_grReset
|
||||
#define grGetProcAddress trap_grGetProcAddress
|
||||
#define grEnable trap_grEnable
|
||||
#define grDisable trap_grDisable
|
||||
#define grCoordinateSpace trap_grCoordinateSpace
|
||||
#define grDepthRange trap_grDepthRange
|
||||
#define grStippleMode trap_grStippleMode
|
||||
#define grStipplePattern trap_grStipplePattern
|
||||
#define grViewport trap_grViewport
|
||||
|
||||
/*
|
||||
** texture mapping control functions
|
||||
*/
|
||||
#define grTexCalcMemRequired trap_grTexCalcMemRequired
|
||||
#define grTexTextureMemRequired trap_grTexTextureMemRequired
|
||||
#define grTexMinAddress trap_grTexMinAddress
|
||||
#define grTexMaxAddress trap_grTexMaxAddress
|
||||
#define grTexNCCTable trap_grTexNCCTable
|
||||
#define grTexSource trap_grTexSource
|
||||
#define grTexClampMode trap_grTexClampMode
|
||||
#define grTexCombine trap_grTexCombine
|
||||
#define grTexDetailControl trap_grTexDetailControl
|
||||
#define grTexFilterMode trap_grTexFilterMode
|
||||
#define grTexLodBiasValue trap_grTexLodBiasValue
|
||||
#define grTexDownloadMipMap trap_grTexDownloadMipMap
|
||||
#define grTexDownloadMipMapLevel trap_grTexDownloadMipMapLevel
|
||||
#define grTexDownloadMipMapLevelPartial trap_grTexDownloadMipMapLevelPartial
|
||||
#define grTexDownloadTable trap_grTexDownloadTable
|
||||
#define grTexDownloadTablePartial trap_grTexDownloadTablePartial
|
||||
#define grTexMipMapMode trap_grTexMipMapMode
|
||||
#define grTexMultibase trap_grTexMultibase
|
||||
#define grTexMultibaseAddress trap_grTexMultibaseAddress
|
||||
|
||||
/*
|
||||
** linear frame buffer functions
|
||||
*/
|
||||
#define grLfbLock trap_grLfbLock
|
||||
#define grLfbUnlock trap_grLfbUnlock
|
||||
#define grLfbConstantAlpha trap_grLfbConstantAlpha
|
||||
#define grLfbConstantDepth trap_grLfbConstantDepth
|
||||
#define grLfbWriteColorSwizzle trap_grLfbWriteColorSwizzle
|
||||
#define grLfbWriteColorFormat trap_grLfbWriteColorFormat
|
||||
#define grLfbWriteRegion trap_grLfbWriteRegion
|
||||
#define grLfbReadRegion trap_grLfbReadRegion
|
||||
|
||||
/*
|
||||
** glide management functions
|
||||
*/
|
||||
#define grGlideInit trap_grGlideInit
|
||||
#define grGlideShutdown trap_grGlideShutdown
|
||||
#define grGlideGetState trap_grGlideGetState
|
||||
#define grGlideSetState trap_grGlideSetState
|
||||
#define grGlideGetVertexLayout trap_grGlideGetVertexLayout
|
||||
#define grGlideSetVertexLayout trap_grGlideSetVertexLayout
|
||||
|
||||
/*
|
||||
** glide utility functions
|
||||
*/
|
||||
#define guGammaCorrectionRGB trap_guGammaCorrectionRGB
|
||||
#define guFogTableIndexToW trap_guFogTableIndexToW
|
||||
#define guFogGenerateExp trap_guFogGenerateExp
|
||||
#define guFogGenerateExp2 trap_guFogGenerateExp2
|
||||
#define guFogGenerateLinear trap_guFogGenerateLinear
|
||||
#endif /* DEBUG_TRAP_internal */
|
||||
#endif /* DEBUG_TRAP */
|
||||
|
||||
struct tdfx_glide {
|
||||
/*
|
||||
** glide extensions
|
||||
*/
|
||||
char * (FX_CALL *grGetRegistryOrEnvironmentStringExt) (char *theEntry);
|
||||
void (FX_CALL *grGetGammaTableExt) (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
|
||||
void (FX_CALL *grChromaRangeModeExt) (GrChromakeyMode_t mode);
|
||||
void (FX_CALL *grChromaRangeExt) (GrColor_t color, GrColor_t range, GrChromaRangeMode_t match_mode);
|
||||
void (FX_CALL *grTexChromaModeExt) (GrChipID_t tmu, GrChromakeyMode_t mode);
|
||||
void (FX_CALL *grTexChromaRangeExt) (GrChipID_t tmu, GrColor_t min, GrColor_t max, GrTexChromakeyMode_t mode);
|
||||
|
||||
/* tbext */
|
||||
void (FX_CALL *grTextureBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
|
||||
void (FX_CALL *grTextureAuxBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
|
||||
void (FX_CALL *grAuxBufferExt) (GrBuffer_t buffer);
|
||||
|
||||
/* napalm */
|
||||
GrContext_t (FX_CALL *grSstWinOpenExt) (FxU32 hWnd, GrScreenResolution_t resolution, GrScreenRefresh_t refresh, GrColorFormat_t format, GrOriginLocation_t origin, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers);
|
||||
void (FX_CALL *grStencilFuncExt) (GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask);
|
||||
void (FX_CALL *grStencilMaskExt) (GrStencil_t value);
|
||||
void (FX_CALL *grStencilOpExt) (GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass);
|
||||
void (FX_CALL *grLfbConstantStencilExt) (GrStencil_t value);
|
||||
void (FX_CALL *grBufferClearExt) (GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil);
|
||||
void (FX_CALL *grColorCombineExt) (GrCCUColor_t a, GrCombineMode_t a_mode, GrCCUColor_t b, GrCombineMode_t b_mode, GrCCUColor_t c, FxBool c_invert, GrCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
|
||||
void (FX_CALL *grAlphaCombineExt) (GrACUColor_t a, GrCombineMode_t a_mode, GrACUColor_t b, GrCombineMode_t b_mode, GrACUColor_t c, FxBool c_invert, GrACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
|
||||
void (FX_CALL *grTexColorCombineExt) (GrChipID_t tmu, GrTCCUColor_t a, GrCombineMode_t a_mode, GrTCCUColor_t b, GrCombineMode_t b_mode, GrTCCUColor_t c, FxBool c_invert, GrTCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
|
||||
void (FX_CALL *grTexAlphaCombineExt) (GrChipID_t tmu, GrTACUColor_t a, GrCombineMode_t a_mode, GrTACUColor_t b, GrCombineMode_t b_mode, GrTACUColor_t c, FxBool c_invert, GrTACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
|
||||
void (FX_CALL *grConstantColorValueExt) (GrChipID_t tmu, GrColor_t value);
|
||||
void (FX_CALL *grColorMaskExt) (FxBool r, FxBool g, FxBool b, FxBool a);
|
||||
void (FX_CALL *grAlphaBlendFunctionExt) (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendOp_t rgb_op, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df, GrAlphaBlendOp_t alpha_op);
|
||||
void (FX_CALL *grTBufferWriteMaskExt) (FxU32 tmask);
|
||||
|
||||
/*
|
||||
** Texus2 functions
|
||||
*/
|
||||
void (*txImgQuantize) (void *xxx_unknown_arguments);
|
||||
void (*txImgDequantizeFXT1) (void *txMip, void *pxMip);
|
||||
void (*txErrorSetCallback) (void *fnc);
|
||||
};
|
||||
|
||||
void tdfx_hook_glide (struct tdfx_glide *Glide);
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
/* $Id: fxglidew.c,v 1.21 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxglidew.c,v 1.22 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -41,7 +41,6 @@
|
||||
#endif
|
||||
|
||||
#if defined(FX)
|
||||
#include "glide.h"
|
||||
#include "fxglidew.h"
|
||||
#include "fxdrv.h"
|
||||
|
||||
@ -57,8 +56,8 @@ FX_grGetInteger_NoLock(FxU32 pname)
|
||||
return result;
|
||||
}
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s: wrong parameter (%lx)\n", __FUNCTION__, pname);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -121,23 +120,6 @@ FX_grSstPerfStats(GrSstPerfStats_t * st)
|
||||
st->pixelsOut = n;
|
||||
}
|
||||
|
||||
void
|
||||
FX_grAADrawLine(GrVertex * a, GrVertex * b)
|
||||
{
|
||||
/* ToDo */
|
||||
BEGIN_CLIP_LOOP();
|
||||
grDrawLine(a, b);
|
||||
END_CLIP_LOOP();
|
||||
}
|
||||
|
||||
void
|
||||
FX_grAADrawPoint(GrVertex * a)
|
||||
{
|
||||
BEGIN_CLIP_LOOP();
|
||||
grDrawPoint(a);
|
||||
END_CLIP_LOOP();
|
||||
}
|
||||
|
||||
void
|
||||
FX_setupGrVertexLayout(void)
|
||||
{
|
||||
@ -146,8 +128,7 @@ FX_setupGrVertexLayout(void)
|
||||
|
||||
grCoordinateSpace(GR_WINDOW_COORDS);
|
||||
grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2,
|
||||
@ -229,87 +210,43 @@ FX_grSstQueryHardware(GrHwConfiguration * config)
|
||||
}
|
||||
|
||||
grGet(GR_MEMORY_FB, 4, &result);
|
||||
config->SSTs[i].VoodooConfig.fbRam = result / (1024 * 1024);
|
||||
config->SSTs[i].fbRam = result / (1024 * 1024);
|
||||
|
||||
grGet(GR_NUM_TMU, 4, &result);
|
||||
config->SSTs[i].VoodooConfig.nTexelfx = result;
|
||||
config->SSTs[i].nTexelfx = result;
|
||||
|
||||
grGet(GR_REVISION_FB, 4, &result);
|
||||
config->SSTs[i].VoodooConfig.fbiRev = result;
|
||||
config->SSTs[i].fbiRev = result;
|
||||
|
||||
for (j = 0; j < config->SSTs[i].VoodooConfig.nTexelfx; j++) {
|
||||
for (j = 0; j < config->SSTs[i].nTexelfx; j++) {
|
||||
grGet(GR_MEMORY_TMU, 4, &result);
|
||||
config->SSTs[i].VoodooConfig.tmuConfig[j].tmuRam = result / (1024 * 1024);
|
||||
config->SSTs[i].tmuConfig[j].tmuRam = result / (1024 * 1024);
|
||||
grGet(GR_REVISION_TMU, 4, &result);
|
||||
config->SSTs[i].VoodooConfig.tmuConfig[j].tmuRev = result;
|
||||
config->SSTs[i].tmuConfig[j].tmuRev = result;
|
||||
}
|
||||
|
||||
extension = grGetString(GR_EXTENSION);
|
||||
if (strstr(extension, " PIXEXT ")) {
|
||||
config->SSTs[i].VoodooConfig.grSstWinOpenExt = grGetProcAddress("grSstWinOpenExt");
|
||||
}
|
||||
|
||||
/* [koolsmoky] */
|
||||
grGet(GR_MAX_TEXTURE_SIZE, 4, &result);
|
||||
config->SSTs[i].VoodooConfig.maxTextureSize = result;
|
||||
config->SSTs[i].HavePixExt = (strstr(extension, " PIXEXT ") != NULL);
|
||||
config->SSTs[i].HaveTexFmt = (strstr(extension, " TEXFMT ") != NULL);
|
||||
config->SSTs[i].HaveCmbExt = (strstr(extension, " COMBINE ") != NULL);
|
||||
config->SSTs[i].HaveMirExt = (strstr(extension, " TEXMIRROR ") != NULL);
|
||||
config->SSTs[i].HaveTexus2 = GL_FALSE;
|
||||
|
||||
/* need to get the number of SLI units for napalm */
|
||||
grGet(GR_NUM_FB, 4, (void *) &numFB);
|
||||
config->SSTs[i].VoodooConfig.numChips = numFB;
|
||||
config->SSTs[i].numChips = numFB;
|
||||
/* this can only be useful for Voodoo2:
|
||||
* sliDetect = ((config->SSTs[i].type == GR_SSTTYPE_Voodoo2) && (numFB > 1));
|
||||
*/
|
||||
}
|
||||
|
||||
tdfx_hook_glide(&config->Glide);
|
||||
|
||||
END_BOARD_LOCK();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* It appears to me that this function is needed either way. */
|
||||
GrContext_t
|
||||
FX_grSstWinOpen(struct SstCard_St *c,
|
||||
FxU32 hWnd,
|
||||
GrScreenResolution_t screen_resolution,
|
||||
GrScreenRefresh_t refresh_rate,
|
||||
GrColorFormat_t color_format,
|
||||
GrPixelFormat_t pixel_format,
|
||||
GrOriginLocation_t origin_location,
|
||||
int nColBuffers, int nAuxBuffers)
|
||||
{
|
||||
GrContext_t i;
|
||||
BEGIN_BOARD_LOCK();
|
||||
if (c->VoodooConfig.grSstWinOpenExt) {
|
||||
i = c->VoodooConfig.grSstWinOpenExt(hWnd,
|
||||
screen_resolution,
|
||||
refresh_rate,
|
||||
color_format, origin_location,
|
||||
pixel_format,
|
||||
nColBuffers, nAuxBuffers);
|
||||
} else
|
||||
i = grSstWinOpen(hWnd,
|
||||
screen_resolution,
|
||||
refresh_rate,
|
||||
color_format, origin_location, nColBuffers, nAuxBuffers);
|
||||
|
||||
/*
|
||||
fprintf(stderr,
|
||||
"grSstWinOpen( win %d res %d ref %d fmt %d\n"
|
||||
" org %d ncol %d naux %d )\n"
|
||||
" ==> %d\n",
|
||||
hWnd,
|
||||
screen_resolution,
|
||||
refresh_rate,
|
||||
color_format,
|
||||
origin_location,
|
||||
nColBuffers,
|
||||
nAuxBuffers,
|
||||
i);
|
||||
*/
|
||||
END_BOARD_LOCK();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: fxglidew.h,v 1.15 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxglidew.h,v 1.16 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -38,43 +38,10 @@
|
||||
#define __FX_GLIDE_WARPER__
|
||||
|
||||
|
||||
#include <glide.h>
|
||||
#include <g3ext.h>
|
||||
#include "fxg.h"
|
||||
|
||||
|
||||
|
||||
#define FX_grGetInteger FX_grGetInteger_NoLock
|
||||
extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
|
||||
|
||||
|
||||
|
||||
#define GR_ASPECT_1x1 GR_ASPECT_LOG2_1x1
|
||||
#define GR_ASPECT_2x1 GR_ASPECT_LOG2_2x1
|
||||
#define GR_ASPECT_4x1 GR_ASPECT_LOG2_4x1
|
||||
#define GR_ASPECT_8x1 GR_ASPECT_LOG2_8x1
|
||||
#define GR_ASPECT_1x2 GR_ASPECT_LOG2_1x2
|
||||
#define GR_ASPECT_1x4 GR_ASPECT_LOG2_1x4
|
||||
#define GR_ASPECT_1x8 GR_ASPECT_LOG2_1x8
|
||||
|
||||
#define GR_LOD_2048 GR_LOD_LOG2_2048 /* [koolsmoky] big texture support for napalm */
|
||||
#define GR_LOD_1024 GR_LOD_LOG2_1024
|
||||
#define GR_LOD_512 GR_LOD_LOG2_512
|
||||
#define GR_LOD_256 GR_LOD_LOG2_256
|
||||
#define GR_LOD_128 GR_LOD_LOG2_128
|
||||
#define GR_LOD_64 GR_LOD_LOG2_64
|
||||
#define GR_LOD_32 GR_LOD_LOG2_32
|
||||
#define GR_LOD_16 GR_LOD_LOG2_16
|
||||
#define GR_LOD_8 GR_LOD_LOG2_8
|
||||
#define GR_LOD_4 GR_LOD_LOG2_4
|
||||
#define GR_LOD_2 GR_LOD_LOG2_2
|
||||
#define GR_LOD_1 GR_LOD_LOG2_1
|
||||
|
||||
#define GR_FOG_WITH_TABLE GR_FOG_WITH_TABLE_ON_Q
|
||||
|
||||
|
||||
|
||||
typedef int GrSstType;
|
||||
|
||||
#define MAX_NUM_SST 4
|
||||
|
||||
enum {
|
||||
@ -88,29 +55,33 @@ enum {
|
||||
GR_SSTTYPE_Voodoo5 = 7
|
||||
};
|
||||
|
||||
#define GrState void
|
||||
|
||||
typedef int GrSstType;
|
||||
|
||||
typedef struct GrTMUConfig_St {
|
||||
int tmuRev; /* Rev of Texelfx chip */
|
||||
int tmuRam; /* 1, 2, or 4 MB */
|
||||
} GrTMUConfig_t;
|
||||
|
||||
typedef struct GrVoodooConfig_St {
|
||||
int fbRam; /* 1, 2, or 4 MB */
|
||||
int fbiRev; /* Rev of Pixelfx chip */
|
||||
int nTexelfx; /* How many texelFX chips are there? */
|
||||
GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
|
||||
int maxTextureSize;
|
||||
int numChips; /* Number of Voodoo chips [koolsmoky] */
|
||||
/* Glide3 extensions */
|
||||
GrProc grSstWinOpenExt;
|
||||
} GrVoodooConfig_t;
|
||||
|
||||
typedef struct {
|
||||
int num_sst; /* # of HW units in the system */
|
||||
struct SstCard_St {
|
||||
GrSstType type; /* Which hardware is it? */
|
||||
GrVoodooConfig_t VoodooConfig;
|
||||
int fbRam; /* 1, 2, or 4 MB */
|
||||
int fbiRev; /* Rev of Pixelfx chip */
|
||||
int nTexelfx; /* How many texelFX chips are there? */
|
||||
int numChips; /* Number of Voodoo chips [koolsmoky] */
|
||||
GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
|
||||
/* Glide3 extensions */
|
||||
FxBool HavePixExt; /* PIXEXT */
|
||||
FxBool HaveTexFmt; /* TEXFMT */
|
||||
FxBool HaveCmbExt; /* COMBINE */
|
||||
FxBool HaveMirExt; /* TEXMIRROR */
|
||||
FxBool HaveTexus2; /* Texus 2 - FXT1 */
|
||||
}
|
||||
SSTs[MAX_NUM_SST]; /* configuration for each board */
|
||||
struct tdfx_glide Glide;
|
||||
} GrHwConfiguration;
|
||||
|
||||
|
||||
@ -133,10 +104,6 @@ typedef FxU32 GrSTWHint_t;
|
||||
|
||||
|
||||
|
||||
#define GrState void
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** move the vertex layout defintion to application
|
||||
*/
|
||||
@ -147,29 +114,38 @@ typedef struct {
|
||||
} GrTmuVertex;
|
||||
|
||||
typedef struct {
|
||||
float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */
|
||||
float r, g, b; /* R, G, B, ([0..255.0]) */
|
||||
float x, y; /* X and Y in screen space */
|
||||
float ooz; /* 65535/Z (used for Z-buffering) */
|
||||
float a; /* Alpha [0..255.0] */
|
||||
float oow; /* 1/W (used for W-buffering, texturing) */
|
||||
unsigned char pargb[4]; /* B, G, R, A [0..255] */
|
||||
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
|
||||
long pad[16 - 11]; /* future use; also ensure 64b structure */
|
||||
} GrVertex;
|
||||
|
||||
#define GR_VERTEX_X_OFFSET 0
|
||||
#define GR_VERTEX_Y_OFFSET 1
|
||||
#define GR_VERTEX_Z_OFFSET 2
|
||||
#define GR_VERTEX_R_OFFSET 3
|
||||
#define GR_VERTEX_G_OFFSET 4
|
||||
#define GR_VERTEX_B_OFFSET 5
|
||||
#define GR_VERTEX_OOZ_OFFSET 6
|
||||
#define GR_VERTEX_A_OFFSET 7
|
||||
#define GR_VERTEX_OOW_OFFSET 8
|
||||
#define GR_VERTEX_SOW_TMU0_OFFSET 9
|
||||
#define GR_VERTEX_TOW_TMU0_OFFSET 10
|
||||
#define GR_VERTEX_OOW_TMU0_OFFSET 11
|
||||
#define GR_VERTEX_SOW_TMU1_OFFSET 12
|
||||
#define GR_VERTEX_TOW_TMU1_OFFSET 13
|
||||
#define GR_VERTEX_OOW_TMU1_OFFSET 14
|
||||
#define GR_VERTEX_OOZ_OFFSET 2
|
||||
#define GR_VERTEX_OOW_OFFSET 3
|
||||
#define GR_VERTEX_PARGB_OFFSET 4
|
||||
#define GR_VERTEX_SOW_TMU0_OFFSET 5
|
||||
#define GR_VERTEX_TOW_TMU0_OFFSET 6
|
||||
#define GR_VERTEX_OOW_TMU0_OFFSET 7
|
||||
#define GR_VERTEX_SOW_TMU1_OFFSET 8
|
||||
#define GR_VERTEX_TOW_TMU1_OFFSET 9
|
||||
#define GR_VERTEX_OOW_TMU1_OFFSET 10
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* For Lod/LodLog2 conversion.
|
||||
*/
|
||||
#define FX_largeLodLog2(info) (info).largeLodLog2
|
||||
#define FX_aspectRatioLog2(info) (info).aspectRatioLog2
|
||||
#define FX_smallLodLog2(info) (info).smallLodLog2
|
||||
#define FX_lodToValue(val) ((int)(GR_LOD_LOG2_256-val))
|
||||
#define FX_largeLodValue(info) ((int)(GR_LOD_LOG2_256-(info).largeLodLog2))
|
||||
#define FX_smallLodValue(info) ((int)(GR_LOD_LOG2_256-(info).smallLodLog2))
|
||||
#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_LOG2_256-val))
|
||||
|
||||
|
||||
|
||||
@ -193,31 +169,6 @@ typedef struct {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Draw triangle
|
||||
*/
|
||||
#define FX_grDrawTriangle(a,b,c)\
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grDrawTriangle(a,b,c); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* For Lod/LodLog2 conversion.
|
||||
*/
|
||||
#define FX_largeLodLog2(info) (info).largeLodLog2
|
||||
#define FX_aspectRatioLog2(info) (info).aspectRatioLog2
|
||||
#define FX_smallLodLog2(info) (info).smallLodLog2
|
||||
#define FX_lodToValue(val) ((int)(GR_LOD_256-val))
|
||||
#define FX_largeLodValue(info) ((int)(GR_LOD_256-(info).largeLodLog2))
|
||||
#define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2))
|
||||
#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val))
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ScreenWidth/Height stuff.
|
||||
*/
|
||||
@ -231,6 +182,8 @@ extern int FX_grSstScreenHeight(void);
|
||||
*/
|
||||
extern void FX_grSstPerfStats(GrSstPerfStats_t *st);
|
||||
extern int FX_grSstQueryHardware(GrHwConfiguration *config);
|
||||
#define FX_grGetInteger FX_grGetInteger_NoLock
|
||||
extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
|
||||
|
||||
|
||||
|
||||
@ -242,14 +195,6 @@ extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Antialiashed line+point drawing.
|
||||
*/
|
||||
extern void FX_grAADrawLine(GrVertex *a, GrVertex *b);
|
||||
extern void FX_grAADrawPoint(GrVertex *a);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Needed for Glide3 only, to set up Glide2 compatible vertex layout.
|
||||
*/
|
||||
@ -262,39 +207,6 @@ extern void FX_setupGrVertexLayout(void);
|
||||
*/
|
||||
extern FxBool FX_grSstControl(FxU32 code);
|
||||
|
||||
|
||||
|
||||
extern GrContext_t FX_grSstWinOpen(struct SstCard_St *c,
|
||||
FxU32 hWnd,
|
||||
GrScreenResolution_t screen_resolution,
|
||||
GrScreenRefresh_t refresh_rate,
|
||||
GrColorFormat_t color_format,
|
||||
GrPixelFormat_t pixel_format,
|
||||
GrOriginLocation_t origin_location,
|
||||
int nColBuffers, int nAuxBuffers);
|
||||
|
||||
|
||||
#define FX_grDrawLine(v1, v2) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grDrawLine(v1, v2); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDrawPoint(p) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grDrawPoint(p); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grDrawPolygonVertexList(n, v) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grDrawVertexArrayContiguous(GR_POLYGON, n, v, sizeof(GrVertex)); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
#define FX_grBufferClear(c, a, d) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
@ -303,21 +215,12 @@ extern GrContext_t FX_grSstWinOpen(struct SstCard_St *c,
|
||||
} while (0)
|
||||
|
||||
|
||||
#define FX_grAADrawTriangle(a, b, c, ab, bc, ca) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grAADrawTriangle(a, b, c, ab, bc, ca); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
#define FX_grDrawVertexArray(m, c, p) \
|
||||
do { \
|
||||
BEGIN_CLIP_LOOP(); \
|
||||
grDrawVertexArray(m, c, p); \
|
||||
END_CLIP_LOOP(); \
|
||||
} while (0)
|
||||
#if FX_DEBUG
|
||||
extern int TDFX_DEBUG;
|
||||
#else
|
||||
#define TDFX_DEBUG 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $Id: fxsetup.c,v 1.39 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxsetup.c,v 1.40 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -52,18 +52,17 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
|
||||
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
|
||||
GLint minl, maxl;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxTexValidate(...) Start\n");
|
||||
}
|
||||
|
||||
if (ti->validated) {
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr,
|
||||
"fxmesa: fxTexValidate(...) End (validated=GL_TRUE)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s: validated=GL_TRUE\n", __FUNCTION__);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
|
||||
}
|
||||
|
||||
ti->tObj = tObj;
|
||||
minl = ti->minLevel = tObj->BaseLevel;
|
||||
maxl = ti->maxLevel = MIN2(tObj->MaxLevel, tObj->Image[0]->MaxLog2);
|
||||
@ -71,38 +70,48 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
|
||||
fxTexGetInfo(tObj->Image[minl]->Width, tObj->Image[minl]->Height,
|
||||
&(FX_largeLodLog2(ti->info)), &(FX_aspectRatioLog2(ti->info)),
|
||||
&(ti->sScale), &(ti->tScale),
|
||||
&(ti->int_sScale), &(ti->int_tScale), NULL, NULL);
|
||||
NULL, NULL);
|
||||
|
||||
if ((tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR))
|
||||
fxTexGetInfo(tObj->Image[maxl]->Width, tObj->Image[maxl]->Height,
|
||||
&(FX_smallLodLog2(ti->info)), NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
NULL, NULL, NULL, NULL);
|
||||
else
|
||||
FX_smallLodLog2(ti->info) = FX_largeLodLog2(ti->info);
|
||||
|
||||
/*jejeje*/
|
||||
ti->baseLevelInternalFormat = tObj->Image[minl]->Format;
|
||||
#if 0
|
||||
fxTexGetFormat(ctx, tObj->Image[minl]->TexFormat->BaseFormat, &(ti->info.format),
|
||||
&(ti->baseLevelInternalFormat)); /* [koolsmoky] */
|
||||
#endif
|
||||
|
||||
switch (tObj->WrapS) {
|
||||
case GL_MIRRORED_REPEAT:
|
||||
ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
break;
|
||||
case GL_CLAMP_TO_EDGE:
|
||||
/* What's this really mean compared to GL_CLAMP? */
|
||||
case GL_CLAMP:
|
||||
ti->sClamp = 1;
|
||||
ti->sClamp = GR_TEXTURECLAMP_CLAMP;
|
||||
break;
|
||||
case GL_REPEAT:
|
||||
ti->sClamp = 0;
|
||||
ti->sClamp = GR_TEXTURECLAMP_WRAP;
|
||||
break;
|
||||
default:
|
||||
; /* silence compiler warning */
|
||||
}
|
||||
switch (tObj->WrapT) {
|
||||
case GL_MIRRORED_REPEAT:
|
||||
ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT;
|
||||
break;
|
||||
case GL_CLAMP_TO_EDGE:
|
||||
/* What's this really mean compared to GL_CLAMP? */
|
||||
case GL_CLAMP:
|
||||
ti->tClamp = 1;
|
||||
ti->tClamp = GR_TEXTURECLAMP_CLAMP;
|
||||
break;
|
||||
case GL_REPEAT:
|
||||
ti->tClamp = 0;
|
||||
ti->tClamp = GR_TEXTURECLAMP_WRAP;
|
||||
break;
|
||||
default:
|
||||
; /* silence compiler warning */
|
||||
@ -111,10 +120,6 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
|
||||
ti->validated = GL_TRUE;
|
||||
|
||||
ti->info.data = NULL;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxTexValidate(...) End\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -274,8 +279,8 @@ fxGetTexSetConfiguration(GLcontext * ctx,
|
||||
|
||||
unitsmode |= (ifmt | envmode);
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
|
||||
fxPrintUnitsMode("unitsmode", unitsmode);
|
||||
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
|
||||
fxPrintUnitsMode(__FUNCTION__, unitsmode);
|
||||
|
||||
return unitsmode;
|
||||
}
|
||||
@ -292,6 +297,10 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
|
||||
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
|
||||
int tmu;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
|
||||
}
|
||||
|
||||
/* Make sure we're not loaded incorrectly */
|
||||
if (ti->isInTM) {
|
||||
if (ti->LODblend) {
|
||||
@ -309,7 +318,10 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
|
||||
if (ti->LODblend)
|
||||
fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU_SPLIT);
|
||||
else {
|
||||
if (fxMesa->haveTwoTMUs) {
|
||||
/* XXX putting textures into the second memory bank when the
|
||||
* first bank is full is not working at this time.
|
||||
*/
|
||||
if (/*[dBorca]: fixme*/0 && fxMesa->haveTwoTMUs) {
|
||||
if (fxMesa->freeTexMem[FX_TMU0] >
|
||||
grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
|
||||
&(ti->info))) {
|
||||
@ -327,8 +339,8 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
|
||||
if (ti->LODblend && ti->whichTMU == FX_TMU_SPLIT) {
|
||||
if ((ti->info.format == GR_TEXFMT_P_8)
|
||||
&& (!fxMesa->haveGlobalPaletteTexture)) {
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: uploading texture palette\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s: uploading texture palette\n", __FUNCTION__);
|
||||
}
|
||||
grTexDownloadTable(GR_TEXTABLE_PALETTE, &(ti->palette));
|
||||
}
|
||||
@ -353,8 +365,8 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
|
||||
|
||||
if ((ti->info.format == GR_TEXFMT_P_8)
|
||||
&& (!fxMesa->haveGlobalPaletteTexture)) {
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: uploading texture palette\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s: uploading texture palette\n", __FUNCTION__);
|
||||
}
|
||||
grTexDownloadTable(GR_TEXTABLE_PALETTE, &(ti->palette));
|
||||
}
|
||||
@ -363,8 +375,9 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
|
||||
* we get to this point, I think it means we are thrashing the
|
||||
* texture memory, so perhaps it's not a good idea.
|
||||
*/
|
||||
if (ti->LODblend && (MESA_VERBOSE & VERBOSE_DRIVER))
|
||||
fprintf(stderr, "fxmesa: not blending texture - only on one tmu\n");
|
||||
if (ti->LODblend && (TDFX_DEBUG & VERBOSE_DRIVER)) {
|
||||
fprintf(stderr, "%s: not blending texture - only one tmu\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
grTexClampMode(tmu, ti->sClamp, ti->tClamp);
|
||||
grTexFilterMode(tmu, ti->minFilt, ti->maxFilt);
|
||||
@ -377,8 +390,8 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
|
||||
static void
|
||||
fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
|
||||
{
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxSelectSingleTMUSrc(%d,%d)\n", tmu, LODblend);
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%d, %d)\n", __FUNCTION__, tmu, LODblend);
|
||||
}
|
||||
|
||||
if (LODblend) {
|
||||
@ -436,7 +449,7 @@ fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
|
||||
static void
|
||||
fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrCombineLocal_t localc, locala;
|
||||
GLuint unitsmode;
|
||||
GLint ifmt;
|
||||
@ -444,8 +457,8 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
|
||||
struct gl_texture_object *tObj = ctx->Texture.Unit[textureset].Current2D;
|
||||
int tmu;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxSetupTextureSingleTMU(...) Start\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
ti = fxTMGetTexInfo(tObj);
|
||||
@ -486,8 +499,8 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
|
||||
else
|
||||
localc = GR_COMBINE_LOCAL_CONSTANT;
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "fxMesa: fxSetupTextureSingleTMU, envmode is %s\n",
|
||||
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "%s: envmode is %s\n", __FUNCTION__,
|
||||
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode));
|
||||
|
||||
switch (ctx->Texture.Unit[textureset].EnvMode) {
|
||||
@ -515,8 +528,8 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
|
||||
localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
|
||||
break;
|
||||
case GL_BLEND:
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER)
|
||||
fprintf(stderr, "fx Driver: GL_BLEND not yet supported\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER)
|
||||
fprintf(stderr, "%s: GL_BLEND not yet supported\n", __FUNCTION__);
|
||||
break;
|
||||
case GL_REPLACE:
|
||||
if ((ifmt == GL_RGB) || (ifmt == GL_LUMINANCE))
|
||||
@ -538,15 +551,11 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
|
||||
localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
|
||||
break;
|
||||
default:
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER)
|
||||
fprintf(stderr, "fx Driver: %x Texture.EnvMode not yet supported\n",
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER)
|
||||
fprintf(stderr, "%s: %x Texture.EnvMode not yet supported\n", __FUNCTION__,
|
||||
ctx->Texture.Unit[textureset].EnvMode);
|
||||
break;
|
||||
}
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxSetupTextureSingleTMU(...) End\n");
|
||||
}
|
||||
}
|
||||
|
||||
#if 00
|
||||
@ -579,8 +588,8 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
|
||||
GLuint tstate = 0;
|
||||
int tmu0 = 0, tmu1 = 1;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxSetupDoubleTMU(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
/* We shouldn't need to do this. There is something wrong with
|
||||
@ -675,8 +684,8 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
|
||||
* The next test shouldn't be TMU specific...
|
||||
*/
|
||||
if (ti0->info.format == GR_TEXFMT_P_8) {
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: uploading texture palette TMU0\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s: uploading texture palette TMU0\n", __FUNCTION__);
|
||||
}
|
||||
grTexDownloadTable(GR_TEXTABLE_PALETTE, &(ti0->palette));
|
||||
}
|
||||
@ -705,7 +714,7 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
|
||||
static void
|
||||
fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrCombineLocal_t localc, locala;
|
||||
tfxTexInfo *ti0, *ti1;
|
||||
struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].Current2D;
|
||||
@ -713,8 +722,8 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
|
||||
GLuint envmode, ifmt, unitsmode;
|
||||
int tmu0 = 0, tmu1 = 1;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxSetupTextureDoubleTMU(...) Start\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
ti0 = fxTMGetTexInfo(tObj0);
|
||||
@ -749,8 +758,8 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
|
||||
localc = GR_COMBINE_LOCAL_CONSTANT;
|
||||
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "fxMesa: fxSetupTextureDoubleTMU, envmode is %s/%s\n",
|
||||
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "%s: envmode is %s/%s\n", __FUNCTION__,
|
||||
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
|
||||
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
|
||||
|
||||
@ -765,15 +774,8 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
|
||||
{
|
||||
GLboolean isalpha[FX_NUM_TMU];
|
||||
|
||||
if (ti0->baseLevelInternalFormat == GL_ALPHA)
|
||||
isalpha[tmu0] = GL_TRUE;
|
||||
else
|
||||
isalpha[tmu0] = GL_FALSE;
|
||||
|
||||
if (ti1->baseLevelInternalFormat == GL_ALPHA)
|
||||
isalpha[tmu1] = GL_TRUE;
|
||||
else
|
||||
isalpha[tmu1] = GL_FALSE;
|
||||
isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA);
|
||||
isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA);
|
||||
|
||||
if (isalpha[FX_TMU1])
|
||||
grTexCombine(GR_TMU1,
|
||||
@ -896,15 +898,8 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
|
||||
{
|
||||
GLboolean isalpha[FX_NUM_TMU];
|
||||
|
||||
if (ti0->baseLevelInternalFormat == GL_ALPHA)
|
||||
isalpha[tmu0] = GL_TRUE;
|
||||
else
|
||||
isalpha[tmu0] = GL_FALSE;
|
||||
|
||||
if (ti1->baseLevelInternalFormat == GL_ALPHA)
|
||||
isalpha[tmu1] = GL_TRUE;
|
||||
else
|
||||
isalpha[tmu1] = GL_FALSE;
|
||||
isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA);
|
||||
isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA);
|
||||
|
||||
if (isalpha[FX_TMU1])
|
||||
grTexCombine(GR_TMU1,
|
||||
@ -942,13 +937,9 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf(stderr, "Unexpected dual texture mode encountered\n");
|
||||
fprintf(stderr, "%s: Unexpected dual texture mode encountered\n", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxSetupTextureDoubleTMU(...) End\n");
|
||||
}
|
||||
}
|
||||
|
||||
/************************* No Texture ***************************/
|
||||
@ -956,11 +947,11 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
|
||||
static void
|
||||
fxSetupTextureNone_NoLock(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrCombineLocal_t localc, locala;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxSetupTextureNone(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if ((ctx->Light.ShadeModel == GL_SMOOTH) || 1 ||
|
||||
@ -993,10 +984,10 @@ fxSetupTextureNone_NoLock(GLcontext * ctx)
|
||||
static void
|
||||
fxSetupTexture_NoLock(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxSetupTexture(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(...)\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
/* Texture Combine, Color Combine and Alpha Combine. */
|
||||
@ -1032,7 +1023,7 @@ fxSetupTexture(GLcontext * ctx)
|
||||
void
|
||||
fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
GrAlphaBlendFnc_t sfact, dfact, asfact, adfact;
|
||||
|
||||
@ -1149,7 +1140,7 @@ fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor)
|
||||
static void
|
||||
fxSetupBlend(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
|
||||
if (us->blendEnabled)
|
||||
@ -1167,48 +1158,15 @@ fxSetupBlend(GLcontext * ctx)
|
||||
void
|
||||
fxDDAlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
GrCmpFnc_t newfunc;
|
||||
|
||||
switch (func) {
|
||||
case GL_NEVER:
|
||||
newfunc = GR_CMP_NEVER;
|
||||
break;
|
||||
case GL_LESS:
|
||||
newfunc = GR_CMP_LESS;
|
||||
break;
|
||||
case GL_EQUAL:
|
||||
newfunc = GR_CMP_EQUAL;
|
||||
break;
|
||||
case GL_LEQUAL:
|
||||
newfunc = GR_CMP_LEQUAL;
|
||||
break;
|
||||
case GL_GREATER:
|
||||
newfunc = GR_CMP_GREATER;
|
||||
break;
|
||||
case GL_NOTEQUAL:
|
||||
newfunc = GR_CMP_NOTEQUAL;
|
||||
break;
|
||||
case GL_GEQUAL:
|
||||
newfunc = GR_CMP_GEQUAL;
|
||||
break;
|
||||
case GL_ALWAYS:
|
||||
newfunc = GR_CMP_ALWAYS;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "fx Driver: internal error in fxDDAlphaFunc()\n");
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (newfunc != us->alphaTestFunc) {
|
||||
us->alphaTestFunc = newfunc;
|
||||
fxMesa->new_state |= FX_NEW_ALPHA;
|
||||
}
|
||||
|
||||
if (ref != us->alphaTestRefValue) {
|
||||
if (
|
||||
(us->alphaTestFunc != func)
|
||||
||
|
||||
(us->alphaTestRefValue != ref)
|
||||
) {
|
||||
us->alphaTestFunc = func;
|
||||
us->alphaTestRefValue = ref;
|
||||
fxMesa->new_state |= FX_NEW_ALPHA;
|
||||
}
|
||||
@ -1217,12 +1175,12 @@ fxDDAlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
|
||||
static void
|
||||
fxSetupAlphaTest(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
|
||||
if (us->alphaTestEnabled) {
|
||||
GrAlpha_t ref = (GLint) (us->alphaTestRefValue * 255.0);
|
||||
grAlphaTestFunction(us->alphaTestFunc);
|
||||
grAlphaTestFunction(us->alphaTestFunc - GL_NEVER + GR_CMP_NEVER);
|
||||
grAlphaTestReferenceValue(ref);
|
||||
}
|
||||
else
|
||||
@ -1236,53 +1194,19 @@ fxSetupAlphaTest(GLcontext * ctx)
|
||||
void
|
||||
fxDDDepthFunc(GLcontext * ctx, GLenum func)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
GrCmpFnc_t dfunc;
|
||||
|
||||
switch (func) {
|
||||
case GL_NEVER:
|
||||
dfunc = GR_CMP_NEVER;
|
||||
break;
|
||||
case GL_LESS:
|
||||
dfunc = GR_CMP_LESS;
|
||||
break;
|
||||
case GL_GEQUAL:
|
||||
dfunc = GR_CMP_GEQUAL;
|
||||
break;
|
||||
case GL_LEQUAL:
|
||||
dfunc = GR_CMP_LEQUAL;
|
||||
break;
|
||||
case GL_GREATER:
|
||||
dfunc = GR_CMP_GREATER;
|
||||
break;
|
||||
case GL_NOTEQUAL:
|
||||
dfunc = GR_CMP_NOTEQUAL;
|
||||
break;
|
||||
case GL_EQUAL:
|
||||
dfunc = GR_CMP_EQUAL;
|
||||
break;
|
||||
case GL_ALWAYS:
|
||||
dfunc = GR_CMP_ALWAYS;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "fx Driver: internal error in fxDDDepthFunc()\n");
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dfunc != us->depthTestFunc) {
|
||||
us->depthTestFunc = dfunc;
|
||||
if (us->depthTestFunc != func) {
|
||||
us->depthTestFunc = func;
|
||||
fxMesa->new_state |= FX_NEW_DEPTH;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
fxDDDepthMask(GLcontext * ctx, GLboolean flag)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
|
||||
if (flag != us->depthMask) {
|
||||
@ -1294,11 +1218,11 @@ fxDDDepthMask(GLcontext * ctx, GLboolean flag)
|
||||
static void
|
||||
fxSetupDepthTest(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
|
||||
if (us->depthTestEnabled) {
|
||||
grDepthBufferFunction(us->depthTestFunc);
|
||||
grDepthBufferFunction(us->depthTestFunc - GL_NEVER + GR_CMP_NEVER);
|
||||
grDepthMask(us->depthMask);
|
||||
}
|
||||
else {
|
||||
@ -1307,15 +1231,135 @@ fxSetupDepthTest(GLcontext * ctx)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************** Stencil SetUp *******************************/
|
||||
/************************************************************************/
|
||||
|
||||
static GrStencil_t convertGLStencilOp( GLenum op )
|
||||
{
|
||||
switch ( op ) {
|
||||
case GL_KEEP:
|
||||
return GR_STENCILOP_KEEP;
|
||||
case GL_ZERO:
|
||||
return GR_STENCILOP_ZERO;
|
||||
case GL_REPLACE:
|
||||
return GR_STENCILOP_REPLACE;
|
||||
case GL_INCR:
|
||||
return GR_STENCILOP_INCR_CLAMP;
|
||||
case GL_DECR:
|
||||
return GR_STENCILOP_DECR_CLAMP;
|
||||
case GL_INVERT:
|
||||
return GR_STENCILOP_INVERT;
|
||||
case GL_INCR_WRAP_EXT:
|
||||
return GR_STENCILOP_INCR_WRAP;
|
||||
case GL_DECR_WRAP_EXT:
|
||||
return GR_STENCILOP_DECR_WRAP;
|
||||
default:
|
||||
_mesa_problem( NULL, "bad stencil op in convertGLStencilOp" );
|
||||
}
|
||||
return GR_STENCILOP_KEEP; /* never get, silence compiler warning */
|
||||
}
|
||||
|
||||
void
|
||||
fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
|
||||
if (
|
||||
(us->stencilFunction != func)
|
||||
||
|
||||
(us->stencilRefValue != ref)
|
||||
||
|
||||
(us->stencilValueMask != mask)
|
||||
) {
|
||||
us->stencilFunction = func;
|
||||
us->stencilRefValue = ref;
|
||||
us->stencilValueMask = mask;
|
||||
fxMesa->new_state |= FX_NEW_STENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fxDDStencilMask (GLcontext *ctx, GLuint mask)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
|
||||
if (us->stencilWriteMask != mask) {
|
||||
us->stencilWriteMask = mask;
|
||||
fxMesa->new_state |= FX_NEW_STENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fxDDStencilOp (GLcontext *ctx, GLenum sfail, GLenum zfail, GLenum zpass)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
|
||||
if (
|
||||
(us->stencilFailFunc != sfail)
|
||||
||
|
||||
(us->stencilZFailFunc != zfail)
|
||||
||
|
||||
(us->stencilZPassFunc != zpass)
|
||||
) {
|
||||
us->stencilFailFunc = sfail;
|
||||
us->stencilZFailFunc = zfail;
|
||||
us->stencilZPassFunc = zpass;
|
||||
fxMesa->new_state |= FX_NEW_STENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fxSetupStencil (GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
|
||||
if (us->stencilEnabled) {
|
||||
grEnable(GR_STENCIL_MODE_EXT);
|
||||
fxMesa->Glide.grStencilOpExt(convertGLStencilOp(us->stencilFailFunc),
|
||||
convertGLStencilOp(us->stencilZFailFunc),
|
||||
convertGLStencilOp(us->stencilZPassFunc));
|
||||
fxMesa->Glide.grStencilFuncExt(us->stencilFunction - GL_NEVER + GR_CMP_NEVER,
|
||||
us->stencilRefValue,
|
||||
us->stencilValueMask);
|
||||
fxMesa->Glide.grStencilMaskExt(us->stencilWriteMask);
|
||||
} else {
|
||||
grDisable(GR_STENCIL_MODE_EXT);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/**************************** Color Mask SetUp **************************/
|
||||
/************************************************************************/
|
||||
|
||||
void fxColorMask (fxMesaContext fxMesa, GLboolean enable)
|
||||
{
|
||||
/* These are used in calls to FX_grColorMask() */
|
||||
static const FxBool false4[4] = { FXFALSE, FXFALSE, FXFALSE, FXFALSE };
|
||||
static const FxBool true4[4] = { FXTRUE, FXTRUE, FXTRUE, FXTRUE };
|
||||
|
||||
const FxBool *rgba = enable ? true4 : false4;
|
||||
|
||||
if (fxMesa->colDepth != 16) {
|
||||
/* 32bpp mode or 15bpp mode */
|
||||
fxMesa->Glide.grColorMaskExt(rgba[RCOMP], rgba[GCOMP],
|
||||
rgba[BCOMP], rgba[ACOMP] && fxMesa->haveHwAlpha);
|
||||
}
|
||||
else {
|
||||
/* 16 bpp mode */
|
||||
grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], rgba[ACOMP] && fxMesa->haveHwAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fxDDColorMask(GLcontext * ctx,
|
||||
GLboolean r, GLboolean g, GLboolean b, GLboolean a)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
fxMesa->new_state |= FX_NEW_COLOR_MASK;
|
||||
(void) r;
|
||||
(void) g;
|
||||
@ -1329,13 +1373,10 @@ fxSetupColorMask(GLcontext * ctx)
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
if (ctx->Color.DrawBuffer == GL_NONE) {
|
||||
grColorMask(FXFALSE, FXFALSE);
|
||||
fxColorMask(fxMesa, GL_FALSE);
|
||||
}
|
||||
else {
|
||||
grColorMask(ctx->Color.ColorMask[RCOMP] ||
|
||||
ctx->Color.ColorMask[GCOMP] ||
|
||||
ctx->Color.ColorMask[BCOMP],
|
||||
ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
|
||||
fxColorMask(fxMesa, GL_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1389,7 +1430,7 @@ fxSetupFog(GLcontext * ctx)
|
||||
}
|
||||
|
||||
grFogTable(fxMesa->fogTable);
|
||||
grFogMode(GR_FOG_WITH_TABLE);
|
||||
grFogMode(GR_FOG_WITH_TABLE_ON_Q);
|
||||
}
|
||||
else {
|
||||
grFogMode(GR_FOG_DISABLE);
|
||||
@ -1410,7 +1451,7 @@ fxDDFogfv(GLcontext * ctx, GLenum pname, const GLfloat * params)
|
||||
void
|
||||
fxSetScissorValues(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
int xmin, xmax;
|
||||
int ymin, ymax, check;
|
||||
|
||||
@ -1439,7 +1480,7 @@ fxSetScissorValues(GLcontext * ctx)
|
||||
grClipWindow(xmin, ymin, xmax, ymax);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
fxSetupScissor(GLcontext * ctx)
|
||||
{
|
||||
BEGIN_BOARD_LOCK();
|
||||
@ -1473,35 +1514,42 @@ fxDDFrontFace(GLcontext * ctx, GLenum mode)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
void
|
||||
fxSetupCull(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrCullMode_t mode = GR_CULL_DISABLE;
|
||||
|
||||
if (ctx->Polygon.CullFlag) {
|
||||
switch (ctx->Polygon.CullFaceMode) {
|
||||
case GL_BACK:
|
||||
if (ctx->Polygon.FrontFace == GL_CCW)
|
||||
FX_CONTEXT(ctx)->cullMode = GR_CULL_NEGATIVE;
|
||||
mode = GR_CULL_NEGATIVE;
|
||||
else
|
||||
FX_CONTEXT(ctx)->cullMode = GR_CULL_POSITIVE;
|
||||
mode = GR_CULL_POSITIVE;
|
||||
break;
|
||||
case GL_FRONT:
|
||||
if (ctx->Polygon.FrontFace == GL_CCW)
|
||||
FX_CONTEXT(ctx)->cullMode = GR_CULL_POSITIVE;
|
||||
mode = GR_CULL_POSITIVE;
|
||||
else
|
||||
FX_CONTEXT(ctx)->cullMode = GR_CULL_NEGATIVE;
|
||||
mode = GR_CULL_NEGATIVE;
|
||||
break;
|
||||
case GL_FRONT_AND_BACK:
|
||||
FX_CONTEXT(ctx)->cullMode = GR_CULL_DISABLE;
|
||||
break;
|
||||
/* Handled as a fallback on triangles in tdfx_tris.c */
|
||||
return;
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
FX_CONTEXT(ctx)->cullMode = GR_CULL_DISABLE;
|
||||
|
||||
if (FX_CONTEXT(ctx)->raster_primitive == GL_TRIANGLES)
|
||||
grCullMode(FX_CONTEXT(ctx)->cullMode);
|
||||
/* KW: don't need to check raster_primitive here as we don't
|
||||
* attempt to draw lines or points with triangles.
|
||||
*/
|
||||
if (fxMesa->cullMode != mode) {
|
||||
fxMesa->cullMode = mode;
|
||||
grCullMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1512,11 +1560,12 @@ fxSetupCull(GLcontext * ctx)
|
||||
void
|
||||
fxDDEnable(GLcontext * ctx, GLenum cap, GLboolean state)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
tfxUnitsState *us = &fxMesa->unitsState;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxDDEnable(...)\n");
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%s)\n", state ? __FUNCTION__ : "fxDDDisable",
|
||||
_mesa_lookup_enum_by_nr(cap));
|
||||
}
|
||||
|
||||
switch (cap) {
|
||||
@ -1538,6 +1587,12 @@ fxDDEnable(GLcontext * ctx, GLenum cap, GLboolean state)
|
||||
fxMesa->new_state |= FX_NEW_DEPTH;
|
||||
}
|
||||
break;
|
||||
case GL_STENCIL_TEST:
|
||||
if (fxMesa->haveHwStencil && state != us->stencilEnabled) {
|
||||
us->stencilEnabled = state;
|
||||
fxMesa->new_state |= FX_NEW_STENCIL;
|
||||
}
|
||||
break;
|
||||
case GL_DITHER:
|
||||
if (state) {
|
||||
grDitherMode(GR_DITHER_4x4);
|
||||
@ -1595,7 +1650,7 @@ static void
|
||||
fx_print_state_flags(const char *msg, GLuint flags)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: (0x%x) %s%s%s%s%s%s%s\n",
|
||||
"%s: (0x%x) %s%s%s%s%s%s%s%s\n",
|
||||
msg,
|
||||
flags,
|
||||
(flags & FX_NEW_TEXTURING) ? "texture, " : "",
|
||||
@ -1604,17 +1659,18 @@ fx_print_state_flags(const char *msg, GLuint flags)
|
||||
(flags & FX_NEW_FOG) ? "fog, " : "",
|
||||
(flags & FX_NEW_SCISSOR) ? "scissor, " : "",
|
||||
(flags & FX_NEW_COLOR_MASK) ? "colormask, " : "",
|
||||
(flags & FX_NEW_CULL) ? "cull, " : "");
|
||||
(flags & FX_NEW_CULL) ? "cull, " : "",
|
||||
(flags & FX_NEW_STENCIL) ? "stencil, " : "");
|
||||
}
|
||||
|
||||
void
|
||||
fxSetupFXUnits(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLuint newstate = fxMesa->new_state;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER)
|
||||
fx_print_state_flags("fxmesa: fxSetupFXUnits", newstate);
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER)
|
||||
fx_print_state_flags(__FUNCTION__, newstate);
|
||||
|
||||
if (newstate) {
|
||||
if (newstate & FX_NEW_TEXTURING)
|
||||
@ -1629,6 +1685,9 @@ fxSetupFXUnits(GLcontext * ctx)
|
||||
if (newstate & FX_NEW_DEPTH)
|
||||
fxSetupDepthTest(ctx);
|
||||
|
||||
if (newstate & FX_NEW_STENCIL)
|
||||
fxSetupStencil(ctx);
|
||||
|
||||
if (newstate & FX_NEW_FOG)
|
||||
fxSetupFog(ctx);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: fxtexman.c,v 1.16 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxtexman.c,v 1.17 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -116,10 +116,11 @@ fxTMNewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end)
|
||||
}
|
||||
else {
|
||||
if (!(result = MALLOC(sizeof(MemRange)))) {
|
||||
fprintf(stderr, "fxDriver: out of memory!\n");
|
||||
fprintf(stderr, "%s: ERROR: out of memory!\n", __FUNCTION__);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
}
|
||||
result->next = NULL;
|
||||
}
|
||||
result->startAddr = start;
|
||||
result->endAddr = end;
|
||||
@ -137,11 +138,13 @@ static void
|
||||
fxTMUInit(fxMesaContext fxMesa, int tmu)
|
||||
{
|
||||
MemRange *tmn, *last;
|
||||
FxU32 start, end, blockstart, blockend;
|
||||
FxU32 start, end, blockstart, blockend, boundary;
|
||||
|
||||
start = grTexMinAddress(tmu);
|
||||
end = grTexMaxAddress(tmu);
|
||||
|
||||
boundary = (fxMesa->type >= GR_SSTTYPE_Banshee) ? (end - start) : FX_2MB_SPLIT;
|
||||
|
||||
if (fxMesa->verbose) {
|
||||
fprintf(stderr, "Voodoo %s configuration:\n",
|
||||
(tmu == FX_TMU0) ? "TMU0" : "TMU1");
|
||||
@ -149,7 +152,7 @@ fxTMUInit(fxMesaContext fxMesa, int tmu)
|
||||
(unsigned int) start);
|
||||
fprintf(stderr, "Voodoo Higher texture memory address (%u)\n",
|
||||
(unsigned int) end);
|
||||
fprintf(stderr, "Voodoo Splitting Texture memory in 2b blocks:\n");
|
||||
fprintf(stderr, "Voodoo Splitting Texture memory in %luMB blocks:\n", boundary >> 20);
|
||||
}
|
||||
|
||||
fxMesa->freeTexMem[tmu] = end - start;
|
||||
@ -158,17 +161,16 @@ fxTMUInit(fxMesaContext fxMesa, int tmu)
|
||||
last = 0;
|
||||
blockstart = start;
|
||||
while (blockstart < end) {
|
||||
if (blockstart + FX_2MB_SPLIT > end)
|
||||
if (blockstart + boundary > end)
|
||||
blockend = end;
|
||||
else
|
||||
blockend = blockstart + FX_2MB_SPLIT;
|
||||
blockend = blockstart + boundary;
|
||||
|
||||
if (fxMesa->verbose)
|
||||
fprintf(stderr, "Voodoo %07u-%07u\n",
|
||||
(unsigned int) blockstart, (unsigned int) blockend);
|
||||
|
||||
tmn = fxTMNewRangeNode(fxMesa, blockstart, blockend);
|
||||
tmn->next = 0;
|
||||
|
||||
if (last)
|
||||
last->next = tmn;
|
||||
@ -176,7 +178,7 @@ fxTMUInit(fxMesaContext fxMesa, int tmu)
|
||||
fxMesa->tmFree[tmu] = tmn;
|
||||
last = tmn;
|
||||
|
||||
blockstart += FX_2MB_SPLIT;
|
||||
blockstart += boundary;
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,9 +212,12 @@ fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size)
|
||||
tmp = tmp->next;
|
||||
}
|
||||
/* No free space. Discard oldest */
|
||||
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
|
||||
fprintf(stderr, "%s: No free space. Discard oldest\n", __FUNCTION__);
|
||||
}
|
||||
obj = fxTMFindOldestObject(fxMesa, tmu);
|
||||
if (!obj) {
|
||||
fprintf(stderr, "fx Driver: No space for texture\n");
|
||||
fprintf(stderr, "%s: ERROR: No space for texture\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
fxTMMoveOutTM(fxMesa, obj);
|
||||
@ -224,6 +229,7 @@ static void
|
||||
fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range)
|
||||
{
|
||||
MemRange *tmp, *prev;
|
||||
FxU32 boundary = (fxMesa->type >= GR_SSTTYPE_Banshee) ? -1 : (FX_2MB_SPLIT - 1);
|
||||
|
||||
if (range->startAddr == range->endAddr) {
|
||||
fxTMDeleteRangeNode(fxMesa, range);
|
||||
@ -246,7 +252,7 @@ fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range)
|
||||
range->next = tmp;
|
||||
if (tmp) {
|
||||
if (range->endAddr == tmp->startAddr
|
||||
&& tmp->startAddr & (FX_2MB_SPLIT - 1)) {
|
||||
&& tmp->startAddr & boundary) {
|
||||
/* Combine */
|
||||
tmp->startAddr = range->startAddr;
|
||||
fxTMDeleteRangeNode(fxMesa, range);
|
||||
@ -255,7 +261,7 @@ fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range)
|
||||
}
|
||||
if (prev) {
|
||||
if (prev->endAddr == range->startAddr
|
||||
&& range->startAddr & (FX_2MB_SPLIT - 1)) {
|
||||
&& range->startAddr & boundary) {
|
||||
/* Combine */
|
||||
prev->endAddr = range->endAddr;
|
||||
prev->next = range->next;
|
||||
@ -273,15 +279,19 @@ static struct gl_texture_object *
|
||||
fxTMFindOldestObject(fxMesaContext fxMesa, int tmu)
|
||||
{
|
||||
GLuint age, old, lasttime, bindnumber;
|
||||
GLfloat lowestPriority;
|
||||
tfxTexInfo *info;
|
||||
struct gl_texture_object *obj, *tmp;
|
||||
struct gl_texture_object *obj, *tmp, *lowestPriorityObj;
|
||||
|
||||
tmp = fxMesa->glCtx->Shared->TexObjectList;
|
||||
if (!tmp)
|
||||
return 0;
|
||||
obj = 0;
|
||||
obj = NULL;
|
||||
old = 0;
|
||||
|
||||
lowestPriorityObj = NULL;
|
||||
lowestPriority = 1.0F;
|
||||
|
||||
bindnumber = fxMesa->texBindNumber;
|
||||
while (tmp) {
|
||||
info = fxTMGetTexInfo(tmp);
|
||||
@ -300,10 +310,29 @@ fxTMFindOldestObject(fxMesaContext fxMesa, int tmu)
|
||||
old = age;
|
||||
obj = tmp;
|
||||
}
|
||||
|
||||
/* examine priority */
|
||||
if (obj->Priority < lowestPriority) {
|
||||
lowestPriority = tmp->Priority;
|
||||
lowestPriorityObj = tmp;
|
||||
}
|
||||
}
|
||||
tmp = tmp->Next;
|
||||
}
|
||||
return obj;
|
||||
|
||||
if (lowestPriority < 1.0) {
|
||||
ASSERT(lowestPriorityObj);
|
||||
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
|
||||
fprintf(stderr, "fxTMFindOldestObject: %d pri=%f\n", lowestPriorityObj->Name, lowestPriority);
|
||||
}
|
||||
return lowestPriorityObj;
|
||||
}
|
||||
else {
|
||||
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
|
||||
fprintf(stderr, "fxTMFindOldestObject: %d age=%d\n", obj->Name, old);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
static MemRange *
|
||||
@ -330,15 +359,14 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
int i, l;
|
||||
int texmemsize;
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxTMMoveInTM(%d)\n", tObj->Name);
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%d)\n", __FUNCTION__, tObj->Name);
|
||||
}
|
||||
|
||||
fxMesa->stats.reqTexUpload++;
|
||||
|
||||
if (!ti->validated) {
|
||||
fprintf(stderr,
|
||||
"fx Driver: internal error in fxTMMoveInTM() -> not validated\n");
|
||||
fprintf(stderr, "%s: INTERNAL ERROR: not validated\n", __FUNCTION__);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
}
|
||||
@ -355,9 +383,9 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
}
|
||||
}
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) {
|
||||
fprintf(stderr, "fxmesa: downloading %x (%d) in texture memory in %d\n",
|
||||
(GLuint) tObj, tObj->Name, where);
|
||||
if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) {
|
||||
fprintf(stderr, "%s: downloading %p (%d) in texture memory in %d\n",
|
||||
__FUNCTION__, (void *)tObj, tObj->Name, where);
|
||||
}
|
||||
|
||||
ti->whichTMU = (FxU32) where;
|
||||
@ -419,9 +447,9 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
ti->tm[FX_TMU0] = fxTMAddObj(fxMesa, tObj, FX_TMU0, texmemsize);
|
||||
fxMesa->stats.memTexUpload += texmemsize;
|
||||
|
||||
texmemsize = (int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
|
||||
/*texmemsize = (int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &(ti->info));*/
|
||||
ti->tm[FX_TMU1] = fxTMAddObj(fxMesa, tObj, FX_TMU1, texmemsize);
|
||||
fxMesa->stats.memTexUpload += texmemsize;
|
||||
fxMesa->stats.memTexUpload += texmemsize; /* ZZZ: required? */
|
||||
|
||||
for (i = FX_largeLodValue(ti->info), l = ti->minLevel;
|
||||
i <= FX_smallLodValue(ti->info); i++, l++) {
|
||||
@ -446,9 +474,7 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"fx Driver: internal error in fxTMMoveInTM() -> wrong tmu (%d)\n",
|
||||
where);
|
||||
fprintf(stderr, "%s: INTERNAL ERROR: wrong tmu (%d)\n", __FUNCTION__, where);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
}
|
||||
@ -479,14 +505,17 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
struct gl_texture_image *texImage = tObj->Image[level];
|
||||
tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
|
||||
fprintf(stderr, "fxTMReloadMipMapLevel(%p (%d), %d)\n", (void *)tObj, tObj->Name, level);
|
||||
}
|
||||
|
||||
assert(mml);
|
||||
assert(mml->width > 0);
|
||||
assert(mml->height > 0);
|
||||
assert(mml->glideFormat > 0);
|
||||
|
||||
if (!ti->validated) {
|
||||
fprintf(stderr,
|
||||
"fx Driver: internal error in fxTMReloadMipMapLevel() -> not validated\n");
|
||||
fprintf(stderr, "%s: INTERNAL ERROR: not validated\n", __FUNCTION__);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
}
|
||||
@ -494,16 +523,14 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
tmu = (int) ti->whichTMU;
|
||||
fxTMMoveInTM(fxMesa, tObj, tmu);
|
||||
|
||||
fxTexGetInfo(mml->width, mml->height,
|
||||
&lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
lodlevel = ti->info.largeLodLog2 - (level - ti->minLevel);
|
||||
|
||||
lodlevel -= level;
|
||||
switch (tmu) {
|
||||
case FX_TMU0:
|
||||
case FX_TMU1:
|
||||
grTexDownloadMipMapLevel(tmu,
|
||||
ti->tm[tmu]->startAddr,
|
||||
FX_valueToLod(FX_lodToValue(lodlevel)),
|
||||
lodlevel,
|
||||
FX_largeLodLog2(ti->info),
|
||||
FX_aspectRatioLog2(ti->info),
|
||||
ti->info.format,
|
||||
@ -512,7 +539,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
case FX_TMU_SPLIT:
|
||||
grTexDownloadMipMapLevel(GR_TMU0,
|
||||
ti->tm[GR_TMU0]->startAddr,
|
||||
FX_valueToLod(FX_lodToValue(lodlevel)),
|
||||
lodlevel,
|
||||
FX_largeLodLog2(ti->info),
|
||||
FX_aspectRatioLog2(ti->info),
|
||||
ti->info.format,
|
||||
@ -520,7 +547,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
|
||||
grTexDownloadMipMapLevel(GR_TMU1,
|
||||
ti->tm[GR_TMU1]->startAddr,
|
||||
FX_valueToLod(FX_lodToValue(lodlevel)),
|
||||
lodlevel,
|
||||
FX_largeLodLog2(ti->info),
|
||||
FX_aspectRatioLog2(ti->info),
|
||||
ti->info.format,
|
||||
@ -529,7 +556,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
case FX_TMU_BOTH:
|
||||
grTexDownloadMipMapLevel(GR_TMU0,
|
||||
ti->tm[GR_TMU0]->startAddr,
|
||||
FX_valueToLod(FX_lodToValue(lodlevel)),
|
||||
lodlevel,
|
||||
FX_largeLodLog2(ti->info),
|
||||
FX_aspectRatioLog2(ti->info),
|
||||
ti->info.format,
|
||||
@ -537,7 +564,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
|
||||
grTexDownloadMipMapLevel(GR_TMU1,
|
||||
ti->tm[GR_TMU1]->startAddr,
|
||||
FX_valueToLod(FX_lodToValue(lodlevel)),
|
||||
lodlevel,
|
||||
FX_largeLodLog2(ti->info),
|
||||
FX_aspectRatioLog2(ti->info),
|
||||
ti->info.format,
|
||||
@ -545,9 +572,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"fx Driver: internal error in fxTMReloadMipMapLevel() -> wrong tmu (%d)\n",
|
||||
tmu);
|
||||
fprintf(stderr, "%s: INTERNAL ERROR: wrong tmu (%d)\n", __FUNCTION__, tmu);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
}
|
||||
@ -568,8 +593,7 @@ fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
|
||||
assert(mml);
|
||||
|
||||
if (!ti->validated) {
|
||||
fprintf(stderr,
|
||||
"fx Driver: internal error in fxTMReloadSubMipMapLevel() -> not validated\n");
|
||||
fprintf(stderr, "%s: INTERNAL ERROR: not validated\n", __FUNCTION__);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
}
|
||||
@ -578,7 +602,7 @@ fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
|
||||
fxTMMoveInTM(fxMesa, tObj, tmu);
|
||||
|
||||
fxTexGetInfo(mml->width, mml->height,
|
||||
&lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
&lodlevel, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if ((ti->info.format == GR_TEXFMT_INTENSITY_8) ||
|
||||
(ti->info.format == GR_TEXFMT_P_8) ||
|
||||
@ -643,9 +667,7 @@ fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
|
||||
yoffset, yoffset + height - 1);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"fx Driver: internal error in fxTMReloadSubMipMapLevel() -> wrong tmu (%d)\n",
|
||||
tmu);
|
||||
fprintf(stderr, "%s: INTERNAL ERROR: wrong tmu (%d)\n", __FUNCTION__, tmu);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
}
|
||||
@ -656,9 +678,8 @@ fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
|
||||
{
|
||||
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "fxmesa: fxTMMoveOutTM(%x (%d))\n", (GLuint) tObj,
|
||||
tObj->Name);
|
||||
if (TDFX_DEBUG & VERBOSE_DRIVER) {
|
||||
fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
|
||||
}
|
||||
|
||||
if (!ti->isInTM)
|
||||
@ -675,7 +696,7 @@ fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
|
||||
fxTMRemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "fx Driver: internal error in fxTMMoveOutTM()\n");
|
||||
fprintf(stderr, "%s: INTERNAL ERROR: bad TMU (%ld)\n", __FUNCTION__, ti->whichTMU);
|
||||
fxCloseHardware();
|
||||
exit(-1);
|
||||
}
|
||||
@ -690,13 +711,17 @@ fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
|
||||
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
|
||||
int i;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_TEXTURE) {
|
||||
fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
|
||||
}
|
||||
|
||||
fxTMMoveOutTM(fxMesa, tObj);
|
||||
|
||||
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
|
||||
struct gl_texture_image *texImage = tObj->Image[i];
|
||||
if (texImage) {
|
||||
if (texImage->Data) {
|
||||
FREE(texImage->Data);
|
||||
MESA_PBUFFER_FREE(texImage->Data);
|
||||
texImage->Data = NULL;
|
||||
}
|
||||
if (texImage->DriverData) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: fxtris.c,v 1.23 2003/09/23 14:41:02 brianp Exp $ */
|
||||
/* $Id: fxtris.c,v 1.24 2003/10/02 17:36:44 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -136,10 +136,10 @@ fx_translate_vertex( GLcontext *ctx, const GrVertex *src, SWvertex *dst)
|
||||
dst->win[2] = src->ooz;
|
||||
dst->win[3] = src->oow;
|
||||
|
||||
dst->color[0] = (GLubyte) src->r;
|
||||
dst->color[1] = (GLubyte) src->g;
|
||||
dst->color[2] = (GLubyte) src->b;
|
||||
dst->color[3] = (GLubyte) src->a;
|
||||
dst->color[0] = src->pargb[2];
|
||||
dst->color[1] = src->pargb[1];
|
||||
dst->color[2] = src->pargb[0];
|
||||
dst->color[3] = src->pargb[3];
|
||||
|
||||
dst->texcoord[ts0][0] = fxMesa->inv_s0scale * src->tmuvtx[0].sow * w;
|
||||
dst->texcoord[ts0][1] = fxMesa->inv_t0scale * src->tmuvtx[0].tow * w;
|
||||
@ -208,17 +208,14 @@ fx_fallback_point( fxMesaContext fxMesa,
|
||||
|
||||
static void fx_print_vertex( GLcontext *ctx, const GrVertex *v )
|
||||
{
|
||||
fprintf(stderr, "vertex at %p\n", (void *) v);
|
||||
fprintf(stderr, "%s:\n", __FUNCTION__);
|
||||
|
||||
fprintf(stderr, "x %f y %f z %f oow %f\n",
|
||||
v->x, v->y, v->ooz, v->oow);
|
||||
fprintf(stderr, "r %f g %f b %f a %f\n",
|
||||
v->r,
|
||||
v->g,
|
||||
v->b,
|
||||
v->a);
|
||||
fprintf(stderr, "\tvertex at %p\n", (void *) v);
|
||||
|
||||
fprintf(stderr, "\tx %f y %f z %f oow %f\n", v->x, v->y, v->ooz, v->oow);
|
||||
fprintf(stderr, "\tr %d g %d b %d a %d\n", v->pargb[2], v->pargb[1], v->pargb[0], v->pargb[3]);
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
#define DO_FALLBACK 0
|
||||
@ -233,7 +230,9 @@ static void fx_draw_quad( fxMesaContext fxMesa,
|
||||
GrVertex *v2,
|
||||
GrVertex *v3 )
|
||||
{
|
||||
BEGIN_CLIP_LOOP();
|
||||
QUAD( v0, v1, v2, v3 );
|
||||
END_CLIP_LOOP();
|
||||
}
|
||||
|
||||
static void fx_draw_triangle( fxMesaContext fxMesa,
|
||||
@ -241,7 +240,9 @@ static void fx_draw_triangle( fxMesaContext fxMesa,
|
||||
GrVertex *v1,
|
||||
GrVertex *v2 )
|
||||
{
|
||||
BEGIN_CLIP_LOOP();
|
||||
TRI( v0, v1, v2 );
|
||||
END_CLIP_LOOP();
|
||||
}
|
||||
|
||||
static void fx_draw_line( fxMesaContext fxMesa,
|
||||
@ -250,7 +251,9 @@ static void fx_draw_line( fxMesaContext fxMesa,
|
||||
{
|
||||
/* No support for wide lines (avoid wide/aa line fallback).
|
||||
*/
|
||||
BEGIN_CLIP_LOOP();
|
||||
LINE(v0, v1);
|
||||
END_CLIP_LOOP();
|
||||
}
|
||||
|
||||
static void fx_draw_point( fxMesaContext fxMesa,
|
||||
@ -258,7 +261,9 @@ static void fx_draw_point( fxMesaContext fxMesa,
|
||||
{
|
||||
/* No support for wide points.
|
||||
*/
|
||||
BEGIN_CLIP_LOOP();
|
||||
POINT( v0 );
|
||||
END_CLIP_LOOP();
|
||||
}
|
||||
|
||||
#undef DO_FALLBACK
|
||||
@ -307,41 +312,26 @@ static struct {
|
||||
|
||||
#define VERT_SET_RGBA( dst, f ) \
|
||||
do { \
|
||||
dst->r = (GLfloat)f[0]; \
|
||||
dst->g = (GLfloat)f[1]; \
|
||||
dst->b = (GLfloat)f[2]; \
|
||||
dst->a = (GLfloat)f[3]; \
|
||||
dst->pargb[2] = f[0]; \
|
||||
dst->pargb[1] = f[1]; \
|
||||
dst->pargb[0] = f[2]; \
|
||||
dst->pargb[3] = f[3]; \
|
||||
} while (0)
|
||||
|
||||
#define VERT_COPY_RGBA( v0, v1 ) \
|
||||
do { \
|
||||
v0->r = v1->r; \
|
||||
v0->g = v1->g; \
|
||||
v0->b = v1->b; \
|
||||
v0->a = v1->a; \
|
||||
} while (0)
|
||||
*(GLuint *)&v0->pargb = *(GLuint *)&v1->pargb
|
||||
|
||||
#define VERT_SAVE_RGBA( idx ) \
|
||||
do { \
|
||||
color[idx][0] = v[idx]->r; \
|
||||
color[idx][1] = v[idx]->g; \
|
||||
color[idx][2] = v[idx]->b; \
|
||||
color[idx][3] = v[idx]->a; \
|
||||
} while (0)
|
||||
*(GLuint *)&color[idx] = *(GLuint *)&v[idx]->pargb
|
||||
|
||||
|
||||
#define VERT_RESTORE_RGBA( idx ) \
|
||||
do { \
|
||||
v[idx]->r = color[idx][0]; \
|
||||
v[idx]->g = color[idx][1]; \
|
||||
v[idx]->b = color[idx][2]; \
|
||||
v[idx]->a = color[idx][3]; \
|
||||
} while (0)
|
||||
*(GLuint *)&v[idx]->pargb = *(GLuint *)&color[idx]
|
||||
|
||||
|
||||
#define LOCAL_VARS(n) \
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx); \
|
||||
GLfloat color[n][4]; \
|
||||
GLubyte color[n][4]; \
|
||||
(void) color;
|
||||
|
||||
|
||||
@ -534,6 +524,321 @@ static void init_rast_tab( void )
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* Render whole begin/end objects */
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
/* Accelerate vertex buffer rendering when renderindex == 0 and
|
||||
* there is no clipping.
|
||||
*/
|
||||
|
||||
static void fx_render_vb_points( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
GLint i;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_points\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_POINTS);
|
||||
|
||||
/* Adjust point coords */
|
||||
for (i = start; i < count; i++) {
|
||||
fxVB[i].x += PNT_X_OFFSET - TRI_X_OFFSET;
|
||||
fxVB[i].y += PNT_Y_OFFSET - TRI_Y_OFFSET;
|
||||
}
|
||||
|
||||
grDrawVertexArrayContiguous( GR_POINTS, count-start,
|
||||
fxVB + start, sizeof(GrVertex));
|
||||
/* restore point coords */
|
||||
for (i = start; i < count; i++) {
|
||||
fxVB[i].x -= PNT_X_OFFSET - TRI_X_OFFSET;
|
||||
fxVB[i].y -= PNT_Y_OFFSET - TRI_Y_OFFSET;
|
||||
}
|
||||
}
|
||||
|
||||
static void fx_render_vb_line_strip( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
GLint i;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_line_strip\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_LINE_STRIP);
|
||||
|
||||
/* adjust line coords */
|
||||
for (i = start; i < count; i++) {
|
||||
fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;
|
||||
fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;
|
||||
}
|
||||
|
||||
grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start,
|
||||
fxVB + start, sizeof(GrVertex));
|
||||
|
||||
/* restore line coords */
|
||||
for (i = start; i < count; i++) {
|
||||
fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;
|
||||
fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
|
||||
}
|
||||
}
|
||||
|
||||
static void fx_render_vb_line_loop( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
GLint i;
|
||||
GLint j = start;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_line_loop\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_LINE_LOOP);
|
||||
|
||||
if (!(flags & PRIM_BEGIN)) {
|
||||
j++;
|
||||
}
|
||||
|
||||
/* adjust line coords */
|
||||
for (i = start; i < count; i++) {
|
||||
fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;
|
||||
fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;
|
||||
}
|
||||
|
||||
grDrawVertexArrayContiguous( GR_LINE_STRIP, count-j,
|
||||
fxVB + j, sizeof(GrVertex));
|
||||
|
||||
if (flags & PRIM_END)
|
||||
grDrawLine( fxVB + (count - 1),
|
||||
fxVB + start );
|
||||
|
||||
/* restore line coords */
|
||||
for (i = start; i < count; i++) {
|
||||
fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;
|
||||
fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
|
||||
}
|
||||
}
|
||||
|
||||
static void fx_render_vb_lines( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
GLint i;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_lines\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_LINES);
|
||||
|
||||
/* adjust line coords */
|
||||
for (i = start; i < count; i++) {
|
||||
fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;
|
||||
fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;
|
||||
}
|
||||
|
||||
grDrawVertexArrayContiguous( GR_LINES, count-start,
|
||||
fxVB + start, sizeof(GrVertex));
|
||||
|
||||
/* restore line coords */
|
||||
for (i = start; i < count; i++) {
|
||||
fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;
|
||||
fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
|
||||
}
|
||||
}
|
||||
|
||||
static void fx_render_vb_triangles( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_triangles\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_TRIANGLES);
|
||||
|
||||
#if 0
|
||||
/* [dBorca]
|
||||
* apparently, this causes troubles with some programs (GLExcess);
|
||||
* might be a bug in Glide... However, "grDrawVertexArrayContiguous"
|
||||
* eventually calls "grDrawTriangle" for GR_TRIANGLES, so we're better
|
||||
* off doing it by hand...
|
||||
*/
|
||||
grDrawVertexArrayContiguous( GR_TRIANGLES, count-start,
|
||||
fxVB + start, sizeof(GrVertex));
|
||||
#else
|
||||
{
|
||||
GLuint j;
|
||||
for (j=start+2; j<count; j+=3) {
|
||||
grDrawTriangle(fxVB + (j-2), fxVB + (j-1), fxVB + j);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void fx_render_vb_tri_strip( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
int mode;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_tri_strip\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_TRIANGLE_STRIP);
|
||||
|
||||
if (flags & PRIM_PARITY)
|
||||
mode = GR_TRIANGLE_STRIP_CONTINUE;
|
||||
else
|
||||
mode = GR_TRIANGLE_STRIP;
|
||||
|
||||
grDrawVertexArrayContiguous( mode, count-start,
|
||||
fxVB + start, sizeof(GrVertex));
|
||||
}
|
||||
|
||||
|
||||
static void fx_render_vb_tri_fan( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_tri_fan\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_TRIANGLE_FAN);
|
||||
|
||||
grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start,
|
||||
fxVB + start, sizeof(GrVertex) );
|
||||
}
|
||||
|
||||
static void fx_render_vb_quads( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
GLuint i;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_quads\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_QUADS);
|
||||
|
||||
for (i = start ; i < count-3 ; i += 4 ) {
|
||||
#define VERT(x) (fxVB + (x))
|
||||
grDrawTriangle( VERT(i), VERT(i+1), VERT(i+3) );
|
||||
grDrawTriangle( VERT(i+1), VERT(i+2), VERT(i+3) );
|
||||
#undef VERT
|
||||
}
|
||||
}
|
||||
|
||||
static void fx_render_vb_quad_strip( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_quad_strip\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_QUAD_STRIP);
|
||||
|
||||
count -= (count-start)&1;
|
||||
|
||||
grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP,
|
||||
count-start, fxVB + start, sizeof(GrVertex));
|
||||
}
|
||||
|
||||
static void fx_render_vb_poly( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GrVertex *fxVB = fxMesa->verts;
|
||||
(void) flags;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_VARRAY) {
|
||||
fprintf(stderr, "fx_render_vb_poly\n");
|
||||
}
|
||||
|
||||
fxRenderPrimitive(ctx, GL_POLYGON);
|
||||
|
||||
grDrawVertexArrayContiguous( GR_POLYGON, count-start,
|
||||
fxVB + start, sizeof(GrVertex));
|
||||
}
|
||||
|
||||
static void fx_render_vb_noop( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint flags )
|
||||
{
|
||||
(void) (ctx && start && count && flags);
|
||||
}
|
||||
|
||||
static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
|
||||
GLuint,
|
||||
GLuint,
|
||||
GLuint) =
|
||||
{
|
||||
fx_render_vb_points,
|
||||
fx_render_vb_lines,
|
||||
fx_render_vb_line_loop,
|
||||
fx_render_vb_line_strip,
|
||||
fx_render_vb_triangles,
|
||||
fx_render_vb_tri_strip,
|
||||
fx_render_vb_tri_fan,
|
||||
fx_render_vb_quads,
|
||||
fx_render_vb_quad_strip,
|
||||
fx_render_vb_poly,
|
||||
fx_render_vb_noop,
|
||||
};
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* Render whole (indexed) begin/end objects */
|
||||
@ -582,7 +887,7 @@ static void init_rast_tab( void )
|
||||
#undef TAG
|
||||
#define TAG(x) fx_##x##_verts
|
||||
#define ELT(x) x
|
||||
#include "../common/t_dd_rendertmp.h"
|
||||
/*#include "../common/t_dd_rendertmp.h"*/ /* we have fx_render_vb_* now */
|
||||
|
||||
|
||||
|
||||
@ -621,7 +926,7 @@ static void fxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
|
||||
GLuint n )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT( ctx );
|
||||
GrVertex *vertptr = fxMesa->verts;
|
||||
GrVertex *vertptr = fxMesa->verts;
|
||||
const GrVertex *start = VERT(elts[0]);
|
||||
int i;
|
||||
for (i = 2 ; i < n ; i++) {
|
||||
@ -650,8 +955,6 @@ void fxDDChooseRenderState(GLcontext *ctx)
|
||||
GLuint flags = ctx->_TriangleCaps;
|
||||
GLuint index = 0;
|
||||
|
||||
/* fprintf(stderr, "%s\n", __FUNCTION__); */
|
||||
|
||||
if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
|
||||
if (flags & ANY_RASTER_FLAGS) {
|
||||
if (flags & DD_TRI_LIGHT_TWOSIDE) index |= FX_TWOSIDE_BIT;
|
||||
@ -665,30 +968,31 @@ void fxDDChooseRenderState(GLcontext *ctx)
|
||||
fxMesa->draw_tri = fx_draw_triangle;
|
||||
|
||||
/* Hook in fallbacks for specific primitives.
|
||||
*
|
||||
*
|
||||
* [dBorca] Hack alert:
|
||||
* If we're in FSAA mode, we always do anti-aliased primitives.
|
||||
*/
|
||||
if (flags & (POINT_FALLBACK|
|
||||
LINE_FALLBACK|
|
||||
TRI_FALLBACK))
|
||||
{
|
||||
if (fxMesa->verbose) {
|
||||
fprintf(stderr, "Voodoo ! fallback (%x), raster (%x)\n",
|
||||
flags & ANY_FALLBACK_FLAGS, flags & ANY_RASTER_FLAGS);
|
||||
}
|
||||
|
||||
if (flags & POINT_FALLBACK)
|
||||
fxMesa->draw_point = fx_fallback_point;
|
||||
|
||||
if (flags & LINE_FALLBACK)
|
||||
fxMesa->draw_line = fx_fallback_line;
|
||||
|
||||
if (flags & TRI_FALLBACK) {
|
||||
/* fprintf(stderr, "tri fallback\n"); */
|
||||
if (flags & TRI_FALLBACK)
|
||||
fxMesa->draw_tri = fx_fallback_tri;
|
||||
}
|
||||
|
||||
index |= FX_FALLBACK_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
/* fprintf(stderr, "render index %x\n", index); */
|
||||
|
||||
tnl->Driver.Render.Points = rast_tab[index].points;
|
||||
tnl->Driver.Render.Line = rast_tab[index].line;
|
||||
tnl->Driver.Render.ClippedLine = rast_tab[index].line;
|
||||
@ -699,14 +1003,13 @@ void fxDDChooseRenderState(GLcontext *ctx)
|
||||
tnl->Driver.Render.PrimTabVerts = fx_render_tab_verts;
|
||||
tnl->Driver.Render.PrimTabElts = fx_render_tab_elts;
|
||||
tnl->Driver.Render.ClippedPolygon = fxFastRenderClippedPoly;
|
||||
|
||||
tnl->Driver.Render.ClippedPolygon = fxRenderClippedPoly;
|
||||
|
||||
} else {
|
||||
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
|
||||
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
|
||||
tnl->Driver.Render.ClippedPolygon = fxRenderClippedPoly;
|
||||
}
|
||||
|
||||
fxMesa->render_index = index;
|
||||
}
|
||||
|
||||
|
||||
@ -714,6 +1017,65 @@ void fxDDChooseRenderState(GLcontext *ctx)
|
||||
/* Runtime render state and callbacks */
|
||||
/**********************************************************************/
|
||||
|
||||
static void fxRunPipeline( GLcontext *ctx )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLuint new_gl_state = fxMesa->new_gl_state;
|
||||
|
||||
if (TDFX_DEBUG & VERBOSE_PIPELINE) {
|
||||
fprintf(stderr, "fxRunPipeline()\n");
|
||||
}
|
||||
|
||||
/* Recalculate fog table on projection matrix changes. This used to
|
||||
* be triggered by the NearFar callback.
|
||||
*/
|
||||
if (new_gl_state & _NEW_PROJECTION)
|
||||
fxMesa->new_state |= FX_NEW_FOG;
|
||||
|
||||
if (new_gl_state & (_FX_NEW_IS_IN_HARDWARE |
|
||||
_FX_NEW_RENDERSTATE |
|
||||
_FX_NEW_SETUP_FUNCTION |
|
||||
_NEW_TEXTURE)) {
|
||||
|
||||
if (new_gl_state & _FX_NEW_IS_IN_HARDWARE)
|
||||
fxCheckIsInHardware(ctx);
|
||||
|
||||
if (fxMesa->new_state)
|
||||
fxSetupFXUnits(ctx);
|
||||
|
||||
if (!fxMesa->fallback) {
|
||||
if (new_gl_state & _FX_NEW_RENDERSTATE)
|
||||
fxDDChooseRenderState(ctx);
|
||||
|
||||
if (new_gl_state & _FX_NEW_SETUP_FUNCTION)
|
||||
fxChooseVertexState(ctx);
|
||||
}
|
||||
|
||||
if (new_gl_state & _NEW_TEXTURE) {
|
||||
struct gl_texture_unit *t0 = &ctx->Texture.Unit[fxMesa->tmu_source[0]];
|
||||
struct gl_texture_unit *t1 = &ctx->Texture.Unit[fxMesa->tmu_source[1]];
|
||||
|
||||
if (t0 && t0->_Current && FX_TEXTURE_DATA(t0)) {
|
||||
fxMesa->s0scale = FX_TEXTURE_DATA(t0)->sScale;
|
||||
fxMesa->t0scale = FX_TEXTURE_DATA(t0)->tScale;
|
||||
fxMesa->inv_s0scale = 1.0 / fxMesa->s0scale;
|
||||
fxMesa->inv_t0scale = 1.0 / fxMesa->t0scale;
|
||||
}
|
||||
|
||||
if (t1 && t1->_Current && FX_TEXTURE_DATA(t1)) {
|
||||
fxMesa->s1scale = FX_TEXTURE_DATA(t1)->sScale;
|
||||
fxMesa->t1scale = FX_TEXTURE_DATA(t1)->tScale;
|
||||
fxMesa->inv_s1scale = 1.0 / fxMesa->s1scale;
|
||||
fxMesa->inv_t1scale = 1.0 / fxMesa->t1scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fxMesa->new_gl_state = 0;
|
||||
|
||||
_tnl_run_pipeline( ctx );
|
||||
}
|
||||
|
||||
|
||||
static GLenum reduced_prim[GL_POLYGON+1] = {
|
||||
GL_POINTS,
|
||||
@ -735,18 +1097,19 @@ static GLenum reduced_prim[GL_POLYGON+1] = {
|
||||
*/
|
||||
static void fxRasterPrimitive( GLcontext *ctx, GLenum prim )
|
||||
{
|
||||
extern void fxSetupCull (GLcontext *ctx);
|
||||
|
||||
fxMesaContext fxMesa = FX_CONTEXT( ctx );
|
||||
|
||||
fxMesa->raster_primitive = prim;
|
||||
if (prim == GL_TRIANGLES)
|
||||
grCullMode( fxMesa->cullMode );
|
||||
else
|
||||
grCullMode( GR_CULL_DISABLE );
|
||||
|
||||
fxSetupCull(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Determine the rasterized primitive when drawing filled polygons.
|
||||
/* Determine the rasterized primitive when not drawing unfilled
|
||||
* polygons.
|
||||
*/
|
||||
static void fxRenderPrimitive( GLcontext *ctx, GLenum prim )
|
||||
{
|
||||
@ -755,9 +1118,7 @@ static void fxRenderPrimitive( GLcontext *ctx, GLenum prim )
|
||||
|
||||
fxMesa->render_primitive = prim;
|
||||
|
||||
if (rprim == GL_TRIANGLES &&
|
||||
(ctx->Polygon.FrontMode != GL_FILL ||
|
||||
ctx->Polygon.BackMode != GL_FILL))
|
||||
if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
|
||||
return;
|
||||
|
||||
if (fxMesa->raster_primitive != rprim) {
|
||||
@ -765,35 +1126,66 @@ static void fxRenderPrimitive( GLcontext *ctx, GLenum prim )
|
||||
}
|
||||
}
|
||||
|
||||
static void fxRenderFinish( GLcontext *ctx )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
if (fxMesa->render_index & FX_FALLBACK_BIT)
|
||||
_swrast_flush( ctx );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* Manage total rasterization fallbacks */
|
||||
/**********************************************************************/
|
||||
|
||||
static char *fallbackStrings[] = {
|
||||
"1D/3D Texture map",
|
||||
"glDrawBuffer(GL_FRONT_AND_BACK)",
|
||||
"Separate specular color",
|
||||
"glEnable/Disable(GL_STENCIL_TEST)",
|
||||
"glRenderMode(selection or feedback)",
|
||||
"glLogicOp()",
|
||||
"Texture env mode",
|
||||
"Texture border",
|
||||
"glColorMask",
|
||||
"blend mode",
|
||||
"line stipple"
|
||||
};
|
||||
|
||||
|
||||
static char *getFallbackString(GLuint bit)
|
||||
{
|
||||
int i = 0;
|
||||
while (bit > 1) {
|
||||
i++;
|
||||
bit >>= 1;
|
||||
}
|
||||
return fallbackStrings[i];
|
||||
}
|
||||
|
||||
|
||||
void fxCheckIsInHardware( GLcontext *ctx )
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
GLuint oldfallback = !fxMesa->is_in_hardware;
|
||||
GLuint newfallback;
|
||||
|
||||
fxMesa->is_in_hardware = fx_check_IsInHardware( ctx );
|
||||
newfallback = !fxMesa->is_in_hardware;
|
||||
GLuint oldfallback = fxMesa->fallback;
|
||||
GLuint newfallback = fxMesa->fallback = fx_check_IsInHardware( ctx );
|
||||
|
||||
if (newfallback) {
|
||||
if (oldfallback == 0) {
|
||||
/* fprintf(stderr, "goint to fallback\n"); */
|
||||
if (fxMesa->verbose) {
|
||||
fprintf(stderr, "Voodoo ! begin SW 0x08%x %s\n", newfallback, getFallbackString(newfallback));
|
||||
}
|
||||
_swsetup_Wakeup( ctx );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (oldfallback) {
|
||||
/* fprintf(stderr, "leaving fallback\n"); */
|
||||
_swrast_flush( ctx );
|
||||
tnl->Driver.Render.Start = fxCheckTexSizes;
|
||||
tnl->Driver.Render.Finish = _swrast_flush;
|
||||
tnl->Driver.Render.Finish = fxRenderFinish;
|
||||
tnl->Driver.Render.PrimitiveNotify = fxRenderPrimitive;
|
||||
tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
|
||||
tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
|
||||
@ -804,6 +1196,9 @@ void fxCheckIsInHardware( GLcontext *ctx )
|
||||
tnl->Driver.Render.Multipass = 0;
|
||||
fxChooseVertexState(ctx);
|
||||
fxDDChooseRenderState(ctx);
|
||||
if (fxMesa->verbose) {
|
||||
fprintf(stderr, "Voodoo ! end SW 0x08%x %s\n", oldfallback, getFallbackString(oldfallback));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -818,8 +1213,9 @@ void fxDDInitTriFuncs( GLcontext *ctx )
|
||||
firsttime = 0;
|
||||
}
|
||||
|
||||
tnl->Driver.RunPipeline = fxRunPipeline;
|
||||
tnl->Driver.Render.Start = fxCheckTexSizes;
|
||||
tnl->Driver.Render.Finish = _swrast_flush;
|
||||
tnl->Driver.Render.Finish = fxRenderFinish;
|
||||
tnl->Driver.Render.PrimitiveNotify = fxRenderPrimitive;
|
||||
tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
|
||||
tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $Id: fxvb.c,v 1.19 2003/10/02 17:36:45 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 5.1
|
||||
@ -37,7 +39,6 @@
|
||||
#include "mtypes.h"
|
||||
#include "imports.h"
|
||||
#include "macros.h"
|
||||
#include "context.h"
|
||||
#include "colormac.h"
|
||||
|
||||
#include "math/m_translate.h"
|
||||
@ -55,10 +56,7 @@ static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
|
||||
GrVertex *dst = fxMesa->verts + edst;
|
||||
GrVertex *src = fxMesa->verts + esrc;
|
||||
|
||||
dst->r = src->r;
|
||||
dst->g = src->g;
|
||||
dst->b = src->b;
|
||||
dst->a = src->a;
|
||||
*(GLuint *)&dst->pargb = *(GLuint *)&src->pargb;
|
||||
}
|
||||
|
||||
typedef void (*emit_func)( GLcontext *, GLuint, GLuint, void * );
|
||||
@ -104,7 +102,8 @@ static void import_float_colors( GLcontext *ctx )
|
||||
}
|
||||
|
||||
|
||||
#define GET_COLOR(ptr, idx) (((GLfloat (*)[4])((ptr)->Ptr))[idx])
|
||||
/* Hack alert: assume chan is 8 bits */
|
||||
#define GET_COLOR(ptr, idx) (((GLchan (*)[4])((ptr)->Ptr))[idx])
|
||||
|
||||
|
||||
static void interp_extras( GLcontext *ctx,
|
||||
@ -114,20 +113,19 @@ static void interp_extras( GLcontext *ctx,
|
||||
{
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
|
||||
/*fprintf(stderr, "%s\n", __FUNCTION__);*/
|
||||
|
||||
if (VB->ColorPtr[1]) {
|
||||
INTERP_4F( t,
|
||||
INTERP_4CHAN( t,
|
||||
GET_COLOR(VB->ColorPtr[1], dst),
|
||||
GET_COLOR(VB->ColorPtr[1], out),
|
||||
GET_COLOR(VB->ColorPtr[1], in) );
|
||||
|
||||
#if 0 /* [dBorca] leaving disabled for now */
|
||||
if (VB->SecondaryColorPtr[1]) {
|
||||
INTERP_3F( t,
|
||||
INTERP_3CHAN( t,
|
||||
GET_COLOR(VB->SecondaryColorPtr[1], dst),
|
||||
GET_COLOR(VB->SecondaryColorPtr[1], out),
|
||||
GET_COLOR(VB->SecondaryColorPtr[1], in) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (VB->EdgeFlag) {
|
||||
@ -143,13 +141,14 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
|
||||
if (VB->ColorPtr[1]) {
|
||||
COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
|
||||
COPY_CHAN4( GET_COLOR(VB->ColorPtr[1], dst),
|
||||
GET_COLOR(VB->ColorPtr[1], src) );
|
||||
|
||||
#if 0 /* [dBorca] leaving disabled for now */
|
||||
if (VB->SecondaryColorPtr[1]) {
|
||||
COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
|
||||
COPY_CHAN4( GET_COLOR(VB->SecondaryColorPtr[1], dst),
|
||||
GET_COLOR(VB->SecondaryColorPtr[1], src) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
copy_pv(ctx, dst, src);
|
||||
@ -285,9 +284,7 @@ void fxCheckTexSizes( GLcontext *ctx )
|
||||
* In the unfilled and twosided cases we are using the
|
||||
* Extras ones anyway, so leave them in place.
|
||||
*/
|
||||
if (!(NEED_TWO_SIDED_LIGHTING(ctx) ||
|
||||
ctx->Polygon.FrontMode != GL_FILL ||
|
||||
ctx->Polygon.BackMode != GL_FILL)) {
|
||||
if (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
|
||||
tnl->Driver.Render.Interp = setup_tab[fxMesa->SetupIndex].interp;
|
||||
}
|
||||
}
|
||||
@ -358,13 +355,10 @@ void fxChooseVertexState( GLcontext *ctx )
|
||||
|
||||
fxMesa->SetupIndex = ind;
|
||||
|
||||
if (NEED_TWO_SIDED_LIGHTING(ctx) ||
|
||||
ctx->Polygon.FrontMode != GL_FILL ||
|
||||
ctx->Polygon.BackMode != GL_FILL) {
|
||||
if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
|
||||
tnl->Driver.Render.Interp = interp_extras;
|
||||
tnl->Driver.Render.CopyPV = copy_pv_extras;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tnl->Driver.Render.Interp = setup_tab[ind].interp;
|
||||
tnl->Driver.Render.CopyPV = copy_pv;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: fxvbtmp.h,v 1.12 2002/10/29 20:28:57 brianp Exp $ */
|
||||
/* $Id: fxvbtmp.h,v 1.13 2003/10/02 17:36:45 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -45,6 +45,7 @@ static void TAG(emit)( GLcontext *ctx,
|
||||
GLuint proj_stride = VB->NdcPtr->stride;
|
||||
GrVertex *v = (GrVertex *)dest;
|
||||
GLfloat u0scale,v0scale,u1scale,v1scale;
|
||||
const GLubyte *mask = VB->ClipMask;
|
||||
const GLfloat *const s = ctx->Viewport._WindowMap.m;
|
||||
int i;
|
||||
|
||||
@ -86,11 +87,16 @@ static void TAG(emit)( GLcontext *ctx,
|
||||
|
||||
for (i=start; i < end; i++, v++) {
|
||||
if (IND & SETUP_XYZW) {
|
||||
/* unclipped */
|
||||
v->x = s[0] * proj[0][0] + s[12];
|
||||
v->y = s[5] * proj[0][1] + s[13];
|
||||
v->ooz = s[10] * proj[0][2] + s[14];
|
||||
v->oow = proj[0][3];
|
||||
if (mask[i] == 0) {
|
||||
/* unclipped */
|
||||
v->x = s[0] * proj[0][0] + s[12];
|
||||
v->y = s[5] * proj[0][1] + s[13];
|
||||
v->ooz = s[10] * proj[0][2] + s[14];
|
||||
v->oow = proj[0][3];
|
||||
} else {
|
||||
/* clipped */
|
||||
v->oow = 1.0;
|
||||
}
|
||||
|
||||
if (IND & SETUP_SNAP) {
|
||||
#if defined(USE_IEEE)
|
||||
@ -108,10 +114,10 @@ static void TAG(emit)( GLcontext *ctx,
|
||||
proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
|
||||
}
|
||||
if (IND & SETUP_RGBA) {
|
||||
v->r = (GLfloat) col[0][0];
|
||||
v->g = (GLfloat) col[0][1];
|
||||
v->b = (GLfloat) col[0][2];
|
||||
v->a = (GLfloat) col[0][3];
|
||||
v->pargb[2] = col[0][0];
|
||||
v->pargb[1] = col[0][1];
|
||||
v->pargb[0] = col[0][2];
|
||||
v->pargb[3] = col[0][3];
|
||||
STRIDE_4UB(col, col_stride);
|
||||
}
|
||||
if (IND & SETUP_TMU0) {
|
||||
@ -210,10 +216,10 @@ static void TAG(interp)( GLcontext *ctx,
|
||||
}
|
||||
|
||||
|
||||
INTERP_F( t, dst->r, out->r, in->r );
|
||||
INTERP_F( t, dst->g, out->g, in->g );
|
||||
INTERP_F( t, dst->b, out->b, in->b );
|
||||
INTERP_F( t, dst->a, out->a, in->a );
|
||||
INTERP_UB( t, dst->pargb[0], out->pargb[0], in->pargb[0] );
|
||||
INTERP_UB( t, dst->pargb[1], out->pargb[1], in->pargb[1] );
|
||||
INTERP_UB( t, dst->pargb[2], out->pargb[2], in->pargb[2] );
|
||||
INTERP_UB( t, dst->pargb[3], out->pargb[3], in->pargb[3] );
|
||||
|
||||
if (IND & SETUP_TMU0) {
|
||||
if (IND & SETUP_PTEX) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: fxwgl.c,v 1.17 2003/08/19 15:52:53 brianp Exp $ */
|
||||
/* $Id: fxwgl.c,v 1.18 2003/10/02 17:36:45 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __WIN32__
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
@ -51,11 +51,11 @@ extern "C"
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "GL/fxmesa.h"
|
||||
#include "glheader.h"
|
||||
#include "fxdrv.h"
|
||||
#include "glapi.h"
|
||||
#include "imports.h"
|
||||
#include "fxdrv.h"
|
||||
|
||||
#define MAX_MESA_ATTRS 20
|
||||
|
||||
@ -71,73 +71,16 @@ struct __pixelformat__
|
||||
GLint mesaAttr[MAX_MESA_ATTRS];
|
||||
};
|
||||
|
||||
WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
|
||||
//WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
|
||||
|
||||
struct __pixelformat__ pix[] = {
|
||||
#if 0
|
||||
/* None */
|
||||
/* 16bit RGB565 single buffer with depth */
|
||||
{
|
||||
{
|
||||
sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
{sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
|
||||
PFD_TYPE_RGBA,
|
||||
16,
|
||||
5, 11, 6, 5, 5, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{
|
||||
FXMESA_COLORDEPTH, 16,
|
||||
FXMESA_DOUBLEBUFFER,
|
||||
FXMESA_ALPHA_SIZE, 0,
|
||||
FXMESA_DEPTH_SIZE, 0,
|
||||
FXMESA_STENCIL_SIZE, 0,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
,
|
||||
|
||||
/* Alpha */
|
||||
{
|
||||
{
|
||||
sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
PFD_TYPE_RGBA,
|
||||
16,
|
||||
5, 10, 5, 5, 5, 0, 1, 15,
|
||||
0, 0, 0, 0, 0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{
|
||||
FXMESA_COLORDEPTH, 15,
|
||||
FXMESA_DOUBLEBUFFER,
|
||||
FXMESA_ALPHA_SIZE, 1,
|
||||
FXMESA_DEPTH_SIZE, 0,
|
||||
FXMESA_STENCIL_SIZE, 0,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
,
|
||||
|
||||
/* Depth */
|
||||
{
|
||||
{
|
||||
sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
PFD_TYPE_RGBA,
|
||||
16,
|
||||
5, 11, 6, 5, 5, 0, 0, 0,
|
||||
5, 0, 6, 5, 5, 11, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
16,
|
||||
0,
|
||||
@ -145,105 +88,22 @@ struct __pixelformat__ pix[] = {
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{
|
||||
FXMESA_COLORDEPTH, 16,
|
||||
FXMESA_DOUBLEBUFFER,
|
||||
{FXMESA_COLORDEPTH, 16,
|
||||
FXMESA_ALPHA_SIZE, 0,
|
||||
FXMESA_DEPTH_SIZE, 16,
|
||||
FXMESA_STENCIL_SIZE, 0,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
}
|
||||
,
|
||||
|
||||
/* None */
|
||||
{
|
||||
{
|
||||
sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
PFD_TYPE_RGBA,
|
||||
32,
|
||||
8, 16, 8, 8, 8, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{
|
||||
FXMESA_COLORDEPTH, 32,
|
||||
FXMESA_DOUBLEBUFFER,
|
||||
FXMESA_ALPHA_SIZE, 0,
|
||||
FXMESA_DEPTH_SIZE, 0,
|
||||
FXMESA_STENCIL_SIZE, 0,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
,
|
||||
|
||||
/* Alpha */
|
||||
{
|
||||
{
|
||||
sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
PFD_TYPE_RGBA,
|
||||
32,
|
||||
8, 16, 8, 8, 8, 0, 8, 24,
|
||||
0, 0, 0, 0, 0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{
|
||||
FXMESA_COLORDEPTH, 32,
|
||||
FXMESA_DOUBLEBUFFER,
|
||||
FXMESA_ALPHA_SIZE, 8,
|
||||
FXMESA_DEPTH_SIZE, 0,
|
||||
FXMESA_STENCIL_SIZE, 0,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
,
|
||||
|
||||
/* Depth */
|
||||
{
|
||||
{
|
||||
sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
PFD_TYPE_RGBA,
|
||||
32,
|
||||
8, 16, 8, 8, 8, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
16,
|
||||
0,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{
|
||||
FXMESA_COLORDEPTH, 32,
|
||||
FXMESA_DOUBLEBUFFER,
|
||||
FXMESA_ALPHA_SIZE, 0,
|
||||
FXMESA_DEPTH_SIZE, 16,
|
||||
FXMESA_STENCIL_SIZE, 0,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
#endif
|
||||
/* 16bit RGB565 */
|
||||
/* 16bit RGB565 double buffer with depth */
|
||||
{
|
||||
{sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
PFD_TYPE_RGBA,
|
||||
16,
|
||||
5, 11, 6, 5, 5, 0, 0, 0,
|
||||
5, 0, 6, 5, 5, 11, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
16,
|
||||
0,
|
||||
@ -260,14 +120,36 @@ struct __pixelformat__ pix[] = {
|
||||
FXMESA_NONE}
|
||||
}
|
||||
,
|
||||
/* 16bit ARGB1555 */
|
||||
/* 16bit ARGB1555 single buffer with depth */
|
||||
{
|
||||
{sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
|
||||
PFD_TYPE_RGBA,
|
||||
16,
|
||||
5, 0, 5, 5, 5, 10, 1, 15,
|
||||
0, 0, 0, 0, 0,
|
||||
16,
|
||||
0,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{FXMESA_COLORDEPTH, 15,
|
||||
FXMESA_ALPHA_SIZE, 1,
|
||||
FXMESA_DEPTH_SIZE, 16,
|
||||
FXMESA_STENCIL_SIZE, 0,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
,
|
||||
/* 16bit ARGB1555 double buffer with depth */
|
||||
{
|
||||
{sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
PFD_TYPE_RGBA,
|
||||
16,
|
||||
5, 10, 5, 5, 5, 0, 1, 15,
|
||||
5, 0, 5, 5, 5, 10, 1, 15,
|
||||
0, 0, 0, 0, 0,
|
||||
16,
|
||||
0,
|
||||
@ -284,17 +166,40 @@ struct __pixelformat__ pix[] = {
|
||||
FXMESA_NONE}
|
||||
}
|
||||
,
|
||||
/* 32bit ARGB8888 */
|
||||
#if 1
|
||||
/* 24bit RGB888 single buffer with depth */
|
||||
{
|
||||
{sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
|
||||
PFD_TYPE_RGBA,
|
||||
24,
|
||||
8, 0, 8, 8, 8, 16, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
24,
|
||||
8,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{FXMESA_COLORDEPTH, 32,
|
||||
FXMESA_ALPHA_SIZE, 8,
|
||||
FXMESA_DEPTH_SIZE, 24,
|
||||
FXMESA_STENCIL_SIZE, 8,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
,
|
||||
/* 24bit RGB888 double buffer with depth */
|
||||
{
|
||||
{sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
PFD_TYPE_RGBA,
|
||||
32,
|
||||
8, 16, 8, 8, 8, 0, 8, 24,
|
||||
24,
|
||||
8, 0, 8, 8, 8, 16, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
24,
|
||||
0,
|
||||
8,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
@ -303,7 +208,53 @@ struct __pixelformat__ pix[] = {
|
||||
FXMESA_DOUBLEBUFFER,
|
||||
FXMESA_ALPHA_SIZE, 8,
|
||||
FXMESA_DEPTH_SIZE, 24,
|
||||
FXMESA_STENCIL_SIZE, 0,
|
||||
FXMESA_STENCIL_SIZE, 8,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
},
|
||||
#endif
|
||||
/* 32bit ARGB8888 single buffer with depth */
|
||||
{
|
||||
{sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
|
||||
PFD_TYPE_RGBA,
|
||||
32,
|
||||
8, 0, 8, 8, 8, 16, 8, 24,
|
||||
0, 0, 0, 0, 0,
|
||||
24,
|
||||
8,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{FXMESA_COLORDEPTH, 32,
|
||||
FXMESA_ALPHA_SIZE, 8,
|
||||
FXMESA_DEPTH_SIZE, 24,
|
||||
FXMESA_STENCIL_SIZE, 8,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
,
|
||||
/* 32bit ARGB8888 double buffer with depth */
|
||||
{
|
||||
{sizeof(PIXELFORMATDESCRIPTOR), 1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
|
||||
PFD_TYPE_RGBA,
|
||||
32,
|
||||
8, 0, 8, 8, 8, 16, 8, 24,
|
||||
0, 0, 0, 0, 0,
|
||||
24,
|
||||
8,
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0, 0, 0, 0}
|
||||
,
|
||||
{FXMESA_COLORDEPTH, 32,
|
||||
FXMESA_DOUBLEBUFFER,
|
||||
FXMESA_ALPHA_SIZE, 8,
|
||||
FXMESA_DEPTH_SIZE, 24,
|
||||
FXMESA_STENCIL_SIZE, 8,
|
||||
FXMESA_ACCUM_SIZE, 0,
|
||||
FXMESA_NONE}
|
||||
}
|
||||
@ -331,7 +282,7 @@ static BITMAPINFO *dibBMI;
|
||||
static HBITMAP dibHBM;
|
||||
static HWND dibWnd;
|
||||
|
||||
LONG GLAPIENTRY
|
||||
static LRESULT APIENTRY
|
||||
__wglMonitor(HWND hwnd, UINT message, UINT wParam, LONG lParam)
|
||||
{
|
||||
long ret; /* Now gives the resized window at the end to hWNDOldProc */
|
||||
@ -343,6 +294,7 @@ __wglMonitor(HWND hwnd, UINT message, UINT wParam, LONG lParam)
|
||||
break;
|
||||
case WM_DISPLAYCHANGE:
|
||||
case WM_SIZE:
|
||||
#if 0
|
||||
if (wParam != SIZE_MINIMIZED) {
|
||||
static int moving = 0;
|
||||
if (!moving) {
|
||||
@ -361,6 +313,7 @@ __wglMonitor(HWND hwnd, UINT message, UINT wParam, LONG lParam)
|
||||
fxMesaUpdateScreenSize(ctx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case WM_ACTIVATE:
|
||||
break;
|
||||
@ -379,13 +332,13 @@ __wglMonitor(HWND hwnd, UINT message, UINT wParam, LONG lParam)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
HGLRC GLAPIENTRY
|
||||
GLAPI HGLRC GLAPIENTRY
|
||||
wglCreateContext(HDC hdc)
|
||||
{
|
||||
HWND hWnd;
|
||||
@ -412,7 +365,7 @@ wglCreateContext(HDC hdc)
|
||||
SetWindowLong(hWnd, GWL_WNDPROC, (LONG) __wglMonitor);
|
||||
}
|
||||
|
||||
#ifndef FX_SILENT
|
||||
#ifdef FX_DEBUG
|
||||
freopen("MESA.LOG", "w", stderr);
|
||||
#endif
|
||||
|
||||
@ -425,11 +378,11 @@ wglCreateContext(HDC hdc)
|
||||
error = !(ctx = fxMesaCreateBestContext((GLuint) hWnd, cliRect.right, cliRect.bottom, pix[curPFD - 1].mesaAttr));
|
||||
}
|
||||
|
||||
if (getenv("SST_DUALHEAD"))
|
||||
/*if (getenv("SST_DUALHEAD"))
|
||||
haveDualHead =
|
||||
((atoi(getenv("SST_DUALHEAD")) == 1) ? GL_TRUE : GL_FALSE);
|
||||
else
|
||||
haveDualHead = GL_FALSE;
|
||||
haveDualHead = GL_FALSE;*/
|
||||
|
||||
if (error) {
|
||||
SetLastError(0);
|
||||
@ -445,14 +398,14 @@ wglCreateContext(HDC hdc)
|
||||
return ((HGLRC) 1);
|
||||
}
|
||||
|
||||
HGLRC GLAPIENTRY
|
||||
GLAPI HGLRC GLAPIENTRY
|
||||
wglCreateLayerContext(HDC hdc, int iLayerPlane)
|
||||
{
|
||||
SetLastError(0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglDeleteContext(HGLRC hglrc)
|
||||
{
|
||||
if (ctx && hglrc == (HGLRC) 1) {
|
||||
@ -471,7 +424,7 @@ wglDeleteContext(HGLRC hglrc)
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
HGLRC GLAPIENTRY
|
||||
GLAPI HGLRC GLAPIENTRY
|
||||
wglGetCurrentContext(VOID)
|
||||
{
|
||||
if (ctx)
|
||||
@ -481,7 +434,7 @@ wglGetCurrentContext(VOID)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
HDC GLAPIENTRY
|
||||
GLAPI HDC GLAPIENTRY
|
||||
wglGetCurrentDC(VOID)
|
||||
{
|
||||
if (ctx)
|
||||
@ -491,10 +444,11 @@ wglGetCurrentDC(VOID)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
PROC GLAPIENTRY
|
||||
GLAPI PROC GLAPIENTRY
|
||||
wglGetProcAddress(LPCSTR lpszProc)
|
||||
{
|
||||
{
|
||||
PROC p = (PROC) _glapi_get_proc_address((const char *) lpszProc);
|
||||
|
||||
if (p)
|
||||
return p;
|
||||
|
||||
@ -502,7 +456,7 @@ wglGetProcAddress(LPCSTR lpszProc)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglMakeCurrent(HDC hdc, HGLRC hglrc)
|
||||
{
|
||||
if ((hdc == NULL) && (hglrc == NULL))
|
||||
@ -520,7 +474,7 @@ wglMakeCurrent(HDC hdc, HGLRC hglrc)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglShareLists(HGLRC hglrc1, HGLRC hglrc2)
|
||||
{
|
||||
if (!ctx || hglrc1 != (HGLRC) 1 || hglrc1 != hglrc2) {
|
||||
@ -531,19 +485,17 @@ wglShareLists(HGLRC hglrc1, HGLRC hglrc2)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
|
||||
DWORD listBase)
|
||||
static BOOL
|
||||
wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar, DWORD numChars,
|
||||
DWORD listBase)
|
||||
{
|
||||
#define VERIFY(a) a
|
||||
|
||||
TEXTMETRIC metric;
|
||||
BITMAPINFO *dibInfo;
|
||||
HDC bitDevice;
|
||||
COLORREF tempColor;
|
||||
int i;
|
||||
|
||||
VERIFY(GetTextMetrics(fontDevice, &metric));
|
||||
GetTextMetrics(fontDevice, &metric);
|
||||
|
||||
dibInfo = (BITMAPINFO *) calloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD), 1);
|
||||
dibInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
@ -552,8 +504,6 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
|
||||
dibInfo->bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
bitDevice = CreateCompatibleDC(fontDevice);
|
||||
// HDC bitDevice = CreateDC("DISPLAY", NULL, NULL, NULL);
|
||||
// VERIFY(bitDevice);
|
||||
|
||||
// Swap fore and back colors so the bitmap has the right polarity
|
||||
tempColor = GetBkColor(bitDevice);
|
||||
@ -561,7 +511,7 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
|
||||
SetTextColor(bitDevice, tempColor);
|
||||
|
||||
// Place chars based on base line
|
||||
VERIFY(SetTextAlign(bitDevice, TA_BASELINE) >= 0 ? 1 : 0);
|
||||
SetTextAlign(bitDevice, TA_BASELINE);
|
||||
|
||||
for (i = 0; i < (int)numChars; i++) {
|
||||
SIZE size;
|
||||
@ -574,8 +524,8 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
|
||||
curChar = (char)(i + firstChar); // [koolsmoky] explicit cast
|
||||
|
||||
// Find how high/wide this character is
|
||||
VERIFY(GetTextExtentPoint32(bitDevice, &curChar, 1, &size));
|
||||
|
||||
GetTextExtentPoint32(bitDevice, &curChar, 1, &size);
|
||||
|
||||
// Create the output bitmap
|
||||
charWidth = size.cx;
|
||||
charHeight = size.cy;
|
||||
@ -586,18 +536,17 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
|
||||
|
||||
// Assign the output bitmap to the device
|
||||
origBmap = SelectObject(bitDevice, bitObject);
|
||||
VERIFY(origBmap);
|
||||
|
||||
VERIFY(PatBlt(bitDevice, 0, 0, bmapWidth, bmapHeight, BLACKNESS));
|
||||
PatBlt(bitDevice, 0, 0, bmapWidth, bmapHeight, BLACKNESS);
|
||||
|
||||
// Use our source font on the device
|
||||
VERIFY(SelectObject(bitDevice, GetCurrentObject(fontDevice, OBJ_FONT)));
|
||||
SelectObject(bitDevice, GetCurrentObject(fontDevice, OBJ_FONT));
|
||||
|
||||
// Draw the character
|
||||
VERIFY(TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1));
|
||||
TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1);
|
||||
|
||||
// Unselect our bmap object
|
||||
VERIFY(SelectObject(bitDevice, origBmap));
|
||||
SelectObject(bitDevice, origBmap);
|
||||
|
||||
// Convert the display dependant representation to a 1 bit deep DIB
|
||||
numBytes = (bmapWidth * bmapHeight) / 8;
|
||||
@ -606,7 +555,6 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
|
||||
dibInfo->bmiHeader.biHeight = bmapHeight;
|
||||
res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap,
|
||||
dibInfo, DIB_RGB_COLORS);
|
||||
//VERIFY(res);
|
||||
|
||||
// Create the GL object
|
||||
glNewList(i + listBase, GL_COMPILE);
|
||||
@ -623,21 +571,20 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
|
||||
}
|
||||
|
||||
// Destroy the DC
|
||||
VERIFY(DeleteDC(bitDevice));
|
||||
DeleteDC(bitDevice);
|
||||
|
||||
FREE(dibInfo);
|
||||
|
||||
return TRUE;
|
||||
#undef VERIFY
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglUseFontOutlinesA(HDC hdc, DWORD first, DWORD count,
|
||||
DWORD listBase, FLOAT deviation,
|
||||
FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
|
||||
@ -646,7 +593,7 @@ wglUseFontOutlinesA(HDC hdc, DWORD first, DWORD count,
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglUseFontOutlinesW(HDC hdc, DWORD first, DWORD count,
|
||||
DWORD listBase, FLOAT deviation,
|
||||
FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
|
||||
@ -656,7 +603,7 @@ wglUseFontOutlinesW(HDC hdc, DWORD first, DWORD count,
|
||||
}
|
||||
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglSwapLayerBuffers(HDC hdc, UINT fuPlanes)
|
||||
{
|
||||
if (ctx && WindowFromDC(hdc) == hWND) {
|
||||
@ -669,11 +616,46 @@ wglSwapLayerBuffers(HDC hdc, UINT fuPlanes)
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
int GLAPIENTRY
|
||||
wglChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR * ppfd)
|
||||
GLAPI int GLAPIENTRY
|
||||
wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd)
|
||||
{
|
||||
int i, best = -1, qt_valid_pix;
|
||||
|
||||
#if 0
|
||||
FILE *pix_file;
|
||||
pix_file = fopen("pix_log.txt", "a");
|
||||
if (pix_file) {
|
||||
fprintf(pix_file, "wglChoosePixelFormat\n");
|
||||
fprintf(pix_file, "nSize = %d\n",ppfd->nSize);
|
||||
fprintf(pix_file, "nVersion = %d\n",ppfd->nVersion);
|
||||
fprintf(pix_file, "dwFlags = %d\n",ppfd->dwFlags);
|
||||
fprintf(pix_file, "iPixelType = %d\n",ppfd->iPixelType);
|
||||
fprintf(pix_file, "cColorBits = %d\n",ppfd->cColorBits);
|
||||
fprintf(pix_file, "cRedBits = %d\n",ppfd->cRedBits);
|
||||
fprintf(pix_file, "cRedShift = %d\n",ppfd->cRedShift);
|
||||
fprintf(pix_file, "cGreenBits = %d\n",ppfd->cGreenBits);
|
||||
fprintf(pix_file, "cGreenShift = %d\n",ppfd->cGreenShift);
|
||||
fprintf(pix_file, "cBlueBits = %d\n",ppfd->cBlueBits);
|
||||
fprintf(pix_file, "cBlueShift = %d\n",ppfd->cBlueShift);
|
||||
fprintf(pix_file, "cAlphaBits = %d\n",ppfd->cAlphaBits);
|
||||
fprintf(pix_file, "cAlphaShift = %d\n",ppfd->cAlphaShift);
|
||||
fprintf(pix_file, "cAccumBits = %d\n",ppfd->cAccumBits);
|
||||
fprintf(pix_file, "cAccumRedBits = %d\n",ppfd->cAccumRedBits);
|
||||
fprintf(pix_file, "cAccumGreenBits = %d\n",ppfd->cAccumGreenBits);
|
||||
fprintf(pix_file, "cAccumBlueBits = %d\n",ppfd->cAccumBlueBits);
|
||||
fprintf(pix_file, "cAccumAlphaBits = %d\n",ppfd->cAccumAlphaBits);
|
||||
fprintf(pix_file, "cDepthBits = %d\n",ppfd->cDepthBits);
|
||||
fprintf(pix_file, "cStencilBits = %d\n",ppfd->cStencilBits);
|
||||
fprintf(pix_file, "cAuxBuffers = %d\n",ppfd->cAuxBuffers);
|
||||
fprintf(pix_file, "iLayerType = %d\n",ppfd->iLayerType);
|
||||
fprintf(pix_file, "bReserved = %d\n",ppfd->bReserved);
|
||||
fprintf(pix_file, "dwLayerMask = %d\n",ppfd->dwLayerMask);
|
||||
fprintf(pix_file, "dwVisibleMask = %d\n",ppfd->dwVisibleMask);
|
||||
fprintf(pix_file, "dwDamageMask = %d\n",ppfd->dwDamageMask);
|
||||
}
|
||||
fclose(pix_file);
|
||||
#endif
|
||||
|
||||
qt_valid_pix = qt_pix;
|
||||
|
||||
if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR) || ppfd->nVersion != 1) {
|
||||
@ -706,6 +688,11 @@ wglChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR * ppfd)
|
||||
if (ppfd->cAlphaBits > 0 && pix[i].pfd.cAlphaBits == 0)
|
||||
continue; /* need alpha buffer */
|
||||
|
||||
#if 0
|
||||
if ((ppfd->cColorBits == 32) && (ppfd->cStencilBits > 0 && pix[i].pfd.cStencilBits == 0))
|
||||
continue; /* need stencil */
|
||||
#endif
|
||||
|
||||
if (ppfd->iPixelType == pix[i].pfd.iPixelType) {
|
||||
best = i + 1;
|
||||
break;
|
||||
@ -720,13 +707,14 @@ wglChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR * ppfd)
|
||||
return (best);
|
||||
}
|
||||
|
||||
int GLAPIENTRY
|
||||
ChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR * ppfd)
|
||||
GLAPI int GLAPIENTRY
|
||||
ChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd)
|
||||
{
|
||||
|
||||
return wglChoosePixelFormat(hdc, ppfd);
|
||||
}
|
||||
|
||||
int GLAPIENTRY
|
||||
GLAPI int GLAPIENTRY
|
||||
wglDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes,
|
||||
LPPIXELFORMATDESCRIPTOR ppfd)
|
||||
{
|
||||
@ -746,14 +734,14 @@ wglDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes,
|
||||
return (qt_valid_pix);
|
||||
}
|
||||
|
||||
int GLAPIENTRY
|
||||
GLAPI int GLAPIENTRY
|
||||
DescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes,
|
||||
LPPIXELFORMATDESCRIPTOR ppfd)
|
||||
{
|
||||
return wglDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd);
|
||||
}
|
||||
|
||||
int GLAPIENTRY
|
||||
GLAPI int GLAPIENTRY
|
||||
wglGetPixelFormat(HDC hdc)
|
||||
{
|
||||
if (curPFD == 0) {
|
||||
@ -764,15 +752,14 @@ wglGetPixelFormat(HDC hdc)
|
||||
return (curPFD);
|
||||
}
|
||||
|
||||
int GLAPIENTRY
|
||||
GLAPI int GLAPIENTRY
|
||||
GetPixelFormat(HDC hdc)
|
||||
{
|
||||
return wglGetPixelFormat(hdc);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
wglSetPixelFormat(HDC hdc, int iPixelFormat,
|
||||
CONST PIXELFORMATDESCRIPTOR * ppfd)
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglSetPixelFormat(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR * ppfd)
|
||||
{
|
||||
int qt_valid_pix;
|
||||
|
||||
@ -788,7 +775,7 @@ wglSetPixelFormat(HDC hdc, int iPixelFormat,
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglSwapBuffers(HDC hdc)
|
||||
{
|
||||
if (!ctx) {
|
||||
@ -801,16 +788,152 @@ wglSwapBuffers(HDC hdc)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
SetPixelFormat(HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR * ppfd)
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
SetPixelFormat(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR * ppfd)
|
||||
{
|
||||
return wglSetPixelFormat(hdc, iPixelFormat, ppfd);
|
||||
}
|
||||
|
||||
BOOL GLAPIENTRY
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
SwapBuffers(HDC hdc)
|
||||
{
|
||||
return wglSwapBuffers(hdc);
|
||||
}
|
||||
|
||||
static FIXED FixedFromDouble(double d)
|
||||
{
|
||||
long l = (long) (d * 65536L);
|
||||
return *(FIXED *)&l;
|
||||
}
|
||||
|
||||
/*
|
||||
** This was yanked from windows/gdi/wgl.c
|
||||
*/
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase)
|
||||
{
|
||||
int i;
|
||||
GLuint font_list;
|
||||
DWORD size;
|
||||
GLYPHMETRICS gm;
|
||||
HANDLE hBits;
|
||||
LPSTR lpBits;
|
||||
MAT2 mat;
|
||||
int success = TRUE;
|
||||
|
||||
if (first<0)
|
||||
return FALSE;
|
||||
if (count<0)
|
||||
return FALSE;
|
||||
if (listBase<0)
|
||||
return FALSE;
|
||||
|
||||
font_list = listBase;
|
||||
|
||||
mat.eM11 = FixedFromDouble(1);
|
||||
mat.eM12 = FixedFromDouble(0);
|
||||
mat.eM21 = FixedFromDouble(0);
|
||||
mat.eM22 = FixedFromDouble(-1);
|
||||
|
||||
memset(&gm,0,sizeof(gm));
|
||||
|
||||
/*
|
||||
** If we can't get the glyph outline, it may be because this is a fixed
|
||||
** font. Try processing it that way.
|
||||
*/
|
||||
if( GetGlyphOutline(hdc, first, GGO_BITMAP, &gm, 0, NULL, &mat)
|
||||
== GDI_ERROR )
|
||||
{
|
||||
return wglUseFontBitmaps_FX( hdc, first, count, listBase );
|
||||
}
|
||||
|
||||
/*
|
||||
** Otherwise process all desired characters.
|
||||
*/
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
DWORD err;
|
||||
|
||||
glNewList( font_list+i, GL_COMPILE );
|
||||
|
||||
/* allocate space for the bitmap/outline */
|
||||
size = GetGlyphOutline(hdc, first + i, GGO_BITMAP, &gm, 0, NULL, &mat);
|
||||
if (size == GDI_ERROR)
|
||||
{
|
||||
glEndList( );
|
||||
err = GetLastError();
|
||||
success = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
hBits = GlobalAlloc(GHND, size+1);
|
||||
lpBits = GlobalLock(hBits);
|
||||
|
||||
err = GetGlyphOutline(hdc, /* handle to device context */
|
||||
first + i, /* character to query */
|
||||
GGO_BITMAP, /* format of data to return */
|
||||
&gm, /* pointer to structure for metrics*/
|
||||
size, /* size of buffer for data */
|
||||
lpBits, /* pointer to buffer for data */
|
||||
&mat /* pointer to transformation */
|
||||
/* matrix structure */
|
||||
);
|
||||
|
||||
if (err == GDI_ERROR)
|
||||
{
|
||||
GlobalUnlock(hBits);
|
||||
GlobalFree(hBits);
|
||||
|
||||
glEndList( );
|
||||
err = GetLastError();
|
||||
success = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
glBitmap(gm.gmBlackBoxX,gm.gmBlackBoxY,
|
||||
-gm.gmptGlyphOrigin.x,
|
||||
gm.gmptGlyphOrigin.y,
|
||||
gm.gmCellIncX,gm.gmCellIncY,
|
||||
(const GLubyte * )lpBits);
|
||||
|
||||
GlobalUnlock(hBits);
|
||||
GlobalFree(hBits);
|
||||
|
||||
glEndList( );
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglDescribeLayerPlane(HDC hdc, int iPixelFormat, int iLayerPlane,
|
||||
UINT nBytes, LPLAYERPLANEDESCRIPTOR ppfd)
|
||||
{
|
||||
SetLastError(0);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
GLAPI int GLAPIENTRY
|
||||
wglGetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart,
|
||||
int cEntries, CONST COLORREF *pcr)
|
||||
{
|
||||
SetLastError(0);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
GLAPI BOOL GLAPIENTRY
|
||||
wglRealizeLayerPalette(HDC hdc,int iLayerPlane,BOOL bRealize)
|
||||
{
|
||||
SetLastError(0);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
GLAPI int GLAPIENTRY
|
||||
wglSetLayerPaletteEntries(HDC hdc,int iLayerPlane, int iStart,
|
||||
int cEntries, CONST COLORREF *pcr)
|
||||
{
|
||||
SetLastError(0);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
#endif /* FX */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: assyntax.h,v 1.21 2002/06/11 01:26:58 brianp Exp $ */
|
||||
/* $Id: assyntax.h,v 1.22 2003/10/02 17:36:45 brianp Exp $ */
|
||||
|
||||
#ifndef __ASSYNTAX_H__
|
||||
#define __ASSYNTAX_H__
|
||||
@ -254,7 +254,7 @@
|
||||
#endif /* ACK_ASSEMBLER */
|
||||
|
||||
|
||||
#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(DJGPP)
|
||||
#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__)
|
||||
#define GLNAME(a) a
|
||||
#else
|
||||
#define GLNAME(a) CONCAT(_,a)
|
||||
|
Loading…
Reference in New Issue
Block a user