Compare commits
36 Commits
SLIAA-1-0-
...
Glide3-Fre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
747e6ee3df | ||
|
|
5653005997 | ||
|
|
cbe7c38855 | ||
|
|
d58fb3563c | ||
|
|
6eb73cf6c1 | ||
|
|
77a9dd13d3 | ||
|
|
3093a8a5f4 | ||
|
|
95b6aa00da | ||
|
|
c025951e50 | ||
|
|
5345122667 | ||
|
|
4e5ad8319b | ||
|
|
ef07fcc06b | ||
|
|
9bcd91c23a | ||
|
|
21130b308d | ||
|
|
7816b80116 | ||
|
|
985b19361e | ||
|
|
2de5d67c15 | ||
|
|
9f97da914e | ||
|
|
ccf55bd6d7 | ||
|
|
32c9fceb2b | ||
|
|
b17cdee744 | ||
|
|
65e9e693f1 | ||
|
|
68adba47ab | ||
|
|
08ef754384 | ||
|
|
bc03716156 | ||
|
|
fc7d1171eb | ||
|
|
5b2cccf44f | ||
|
|
3f90077226 | ||
|
|
f69716c149 | ||
|
|
f3f29b54f5 | ||
|
|
8b7ff82e87 | ||
|
|
13692f96c6 | ||
|
|
f0e606b604 | ||
|
|
ef7301331f | ||
|
|
bc31dae192 | ||
|
|
6acad1fd79 |
@@ -199,8 +199,6 @@ if files_are_equal "${PWD}" "${BUILD_DIRECTORY}" ; then
|
||||
BUILD_IS_DOT=YES
|
||||
fi
|
||||
if [ "$DO_CONFIGURE" = YES ] ; then
|
||||
SRCDIR="${PWD}"
|
||||
CFGDIR=${SRCIDR}
|
||||
if [ "$BUILD_IS_DOT" = NO ] ; then
|
||||
#
|
||||
# Get rid of the build directory.
|
||||
@@ -208,12 +206,6 @@ if [ "$DO_CONFIGURE" = YES ] ; then
|
||||
echo -n 'Getting rid of the old build directory...'
|
||||
/bin/rm -rf $BUILD_DIRECTORY
|
||||
echo 'Done.'
|
||||
#
|
||||
# Now, create a new build directory with lndir.
|
||||
#
|
||||
mkdir -p $BUILD_DIRECTORY
|
||||
(cd $BUILD_DIRECTORY; lndir -silent -ignorelinks $SRCDIR)
|
||||
CFGDIR="."
|
||||
else
|
||||
echo 'Old build directory is current directory.'
|
||||
fi
|
||||
@@ -229,7 +221,8 @@ if [ "$DO_CONFIGURE" = YES ] ; then
|
||||
# Configure.
|
||||
#
|
||||
echo -n "Configuring..."
|
||||
(cd $BUILD_DIRECTORY; ${CFGDIR}/configure --quiet $CONFIGURE_OPTIONS)
|
||||
SRCDIR="${PWD}"
|
||||
(cd $BUILD_DIRECTORY; ${SRCDIR}/configure --quiet $CONFIGURE_OPTIONS)
|
||||
echo 'Done.'
|
||||
fi
|
||||
if [ "$DO_BUILD" = YES ] ; then
|
||||
|
||||
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# $Date$
|
||||
#
|
||||
AC_INIT(h5/glide3/src/glfb.c)
|
||||
#AM_INIT_AUTOMAKE(glide, 3.0)
|
||||
AM_INIT_AUTOMAKE(glide, 3.0)
|
||||
AM_CONFIG_HEADER(swlibs/include/config.h)
|
||||
AC_PREFIX_DEFAULT([/usr])
|
||||
includedir='${prefix}/include/glide3'
|
||||
@@ -35,40 +35,58 @@ AC_SUBST(FX_HW_PROJECTS)
|
||||
# --enable-fx-glide-hw chooses which ASIC to build for.
|
||||
#
|
||||
AC_ARG_ENABLE([fx-glide-hw],
|
||||
[dnl
|
||||
[
|
||||
--enable-fx-glide-hw=ASIC Build for the given ASIC
|
||||
h5: VoodooV
|
||||
h5: Voodoo5
|
||||
h3: Voodoo3
|
||||
cvg: Voodoo2
|
||||
[default=h5]],
|
||||
[case ${enableval} in
|
||||
h3|h5|cvg)
|
||||
FX_GLIDE_HW="${enableval}"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Illegal value ($enable_fx_glide_hw) for --enable-fx-glide-hw])
|
||||
;;
|
||||
esac],[FX_GLIDE_HW=h5])
|
||||
[FX_GLIDE_HW="${enableval}"],[FX_GLIDE_HW=h5])
|
||||
case ${FX_GLIDE_HW} in
|
||||
h3)
|
||||
FX_GLIDE_H3=1
|
||||
AC_DEFINE(FX_GLIDE_H3)
|
||||
;;
|
||||
h5)
|
||||
FX_GLIDE_H5=1
|
||||
AC_DEFINE(FX_GLIDE_H5)
|
||||
;;
|
||||
cvg)
|
||||
FX_GLIDE_CVG=1
|
||||
AC_DEFINE(FX_GLIDE_CVG)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Illegal value ($enable_fx_glide_hw) for --enable-fx-glide-hw])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(FX_GLIDE_HW)
|
||||
AM_CONDITIONAL(FX_GLIDE_H3, test x$FX_GLIDE_H3 = x1)
|
||||
AM_CONDITIONAL(FX_GLIDE_H5, test x$FX_GLIDE_H5 = x1)
|
||||
AM_CONDITIONAL(FX_GLIDE_CVG, test x$FX_GLIDE_CVG = x1)
|
||||
#
|
||||
# --enable-fx-dri-build chooses to build with or without DRI.
|
||||
#
|
||||
AC_ARG_ENABLE([fx-dri-build],
|
||||
[dnl
|
||||
[
|
||||
--enable-fx-build-dri Build for DRI. [default=yes]],
|
||||
[case ${enableval} in
|
||||
true|yes)
|
||||
DRI_BUILD=true
|
||||
DRI_BUILD=1
|
||||
;;
|
||||
false|no)
|
||||
DRI_BUILD=false
|
||||
DRI_BUILD=0
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Illegal value (${enableval}) for --enable-fx-build-dri])
|
||||
;;
|
||||
esac],[DRI_BUILD=true])
|
||||
AM_CONDITIONAL(DRI_BUILD,test x$DRI_BUILD = xtrue)
|
||||
esac],[DRI_BUILD=1])
|
||||
AM_CONDITIONAL(DRI_BUILD,test x$DRI_BUILD = x1)
|
||||
AC_SUBST(DRI_BUILD)
|
||||
if test "$DRI_BUILD" = "1"
|
||||
then
|
||||
AC_DEFINE(DRI_BUILD)
|
||||
fi
|
||||
#
|
||||
# This is makefile.linux behavior. I don't know exactly
|
||||
# what this does.
|
||||
@@ -78,26 +96,31 @@ AM_CONDITIONAL(HAL_HW, test "$FX_GLIDE_HW"=cvg && test ! -z "$HAL_HW")
|
||||
# Define debugging
|
||||
#
|
||||
AC_ARG_ENABLE([fx-debug],
|
||||
[dnl
|
||||
[
|
||||
--enable-fx-debug Enable a debugging glide build [default=no]],
|
||||
[case ${enableval} in
|
||||
true|yes)
|
||||
GLIDE_DEBUG=true
|
||||
GLIDE_DEBUG=1
|
||||
;;
|
||||
false|no)
|
||||
GLIDE_DEBUG=false
|
||||
GLIDE_DEBUG=0
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Illegal value (${enableval}) for --enable-fx-debug])
|
||||
;;
|
||||
esac],[GLIDE_DEBUG=false])
|
||||
AM_CONDITIONAL(GLIDE_DEBUG,test x$GLIDE_DEBUG = xtrue)
|
||||
esac],[GLIDE_DEBUG=0])
|
||||
AM_CONDITIONAL(GLIDE_DEBUG,test x$GLIDE_DEBUG = x1)
|
||||
AC_SUBST(GLIDE_DEBUG)
|
||||
if test "$GLIDE_DEBUG" = "1"
|
||||
then
|
||||
AC_DEFINE(GLIDE_DEBUG)
|
||||
fi
|
||||
|
||||
#
|
||||
# Define --enable-amd3d
|
||||
#
|
||||
AC_ARG_ENABLE([amd3d],
|
||||
[dnl
|
||||
[
|
||||
--enable-amd3d Enable AMD 3DNow instructions [default=no]],
|
||||
[case ${enableval} in
|
||||
true|yes)
|
||||
@@ -115,7 +138,7 @@ AM_CONDITIONAL(GL_AMD3D, test x$enable_amd3d = xtrue)
|
||||
# --enable-fx-texlib=texus2 enables new texus library.
|
||||
#
|
||||
AC_ARG_ENABLE([fx-texlib],
|
||||
[dnl
|
||||
[
|
||||
--enable-fx-tex=dir Enable enhanced texture utilities library
|
||||
texus - original library
|
||||
texus2 - library for compressed textures
|
||||
@@ -129,18 +152,12 @@ AC_ARG_ENABLE([fx-texlib],
|
||||
;;
|
||||
esac],[TEXTURE_UTILITIES_DIR=texus2])
|
||||
AC_SUBST(TEXTURE_UTILITIES_DIR)
|
||||
#
|
||||
# These are conditional variables whose value is set by
|
||||
# one of the other enable macros.
|
||||
#
|
||||
AM_CONDITIONAL(FX_GLIDE_H3, test x$FX_GLIDE_HW = xh3)
|
||||
AM_CONDITIONAL(FX_GLIDE_H5, test x$FX_GLIDE_HW = xh5)
|
||||
AM_CONDITIONAL(FX_GLIDE_CVG, test x$FX_GLIDE_HW = xcvg)
|
||||
|
||||
#
|
||||
# Architecture
|
||||
#
|
||||
AC_ARG_ENABLE([build-architecture],
|
||||
[dnl
|
||||
[
|
||||
--enable-build-architecture Enable AMD 3DNow instructions [default=current]],
|
||||
[case ${enableval} in
|
||||
i[3456]86|alpha)
|
||||
@@ -171,7 +188,17 @@ GLIDE_SANITY_ALL=false
|
||||
GLIDE_SANITY_SIZE=false
|
||||
FX_DLL_BUILD=false
|
||||
FX_GLIDE_HW_CULL=false
|
||||
# Here we define whether we use C versions of cpu detection and triangle setup
|
||||
FX_GLIDE_CTRISETUP=false
|
||||
FX_GLIDE_C_CPU_DETECT=false
|
||||
# Override based on architecture
|
||||
if test "$FX_GLIDE_BUILD_ARCHITECTURE" = "alpha"; then
|
||||
FX_GLIDE_CTRISETUP=true
|
||||
FX_GLIDE_C_CPU_DETECT=true
|
||||
fi
|
||||
if test "$FX_GLIDE_BUILD_ARCHITECTURE" = "ia64"; then
|
||||
FX_GLIDE_CTRISETUP=true
|
||||
fi
|
||||
# Next, we read some configuration options
|
||||
# statically. This is to avoid creating a bunch of
|
||||
# not-terribly-useful --enable options.
|
||||
@@ -209,6 +236,8 @@ AM_CONDITIONAL(FX_GLIDE_HW_CULL,dnl
|
||||
test x$FX_GLIDE_HW_CULL = xtrue)
|
||||
AM_CONDITIONAL(FX_GLIDE_CTRISETUP,dnl
|
||||
test x$FX_GLIDE_CTRISETUP = xtrue)
|
||||
AM_CONDITIONAL(FX_GLIDE_C_CPU_DETECT,dnl
|
||||
test x$FX_GLIDE_C_CPU_DETECT = xtrue)
|
||||
AM_CONDITIONAL(FX_GLIDE_PACKET_FIFO,dnl
|
||||
test x$FX_GLIDE_PACKET_FIFO = xtrue)
|
||||
AM_CONDITIONAL(FX_GLIDE_VERTEX_TABLE,dnl
|
||||
@@ -225,12 +254,13 @@ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(CP, cp, false)
|
||||
AC_PROG_INSTALL
|
||||
AM_PROG_LIBTOOL
|
||||
MAKE="make -f makefile.autoconf"
|
||||
MAKE="gmake -f makefile.autoconf"
|
||||
AC_SUBST(MAKE)
|
||||
dnl Checks for libraries.
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_PATH_X
|
||||
AC_SUBST(x_includes)
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/ioctl.h sys/time.h unistd.h)
|
||||
@@ -286,3 +316,33 @@ AC_OUTPUT(build.3dfx
|
||||
)
|
||||
AC_OUTPUT_COMMANDS([chmod +x build.3dfx])
|
||||
|
||||
echo "Configuration complete."
|
||||
echo ""
|
||||
echo -n "Chipset configured : "
|
||||
if test "$FX_GLIDE_HW" = "cvg"
|
||||
then
|
||||
echo "cvg (Voodoo2)"
|
||||
elif test "$FX_GLIDE_HW" = "h3"
|
||||
then
|
||||
echo "h3 (Voodoo3)"
|
||||
elif test "$FX_GLIDE_HW" = "h5"
|
||||
then
|
||||
echo "h5 (Voodoo5)"
|
||||
fi
|
||||
|
||||
echo -n "DRI Build: "
|
||||
if test "$DRI_BUILD" = "1"
|
||||
then
|
||||
echo "enabled"
|
||||
else
|
||||
echo "disabled"
|
||||
fi
|
||||
|
||||
echo -n "Debug code: "
|
||||
if test "$GLIDE_DEBUG" = "1"
|
||||
then
|
||||
echo "enabled"
|
||||
else
|
||||
echo "disabled"
|
||||
fi
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
*/
|
||||
|
||||
/* $Header$ */
|
||||
/* $Log$ */
|
||||
/* $Log$
|
||||
/* Revision 1.1.1.1 1999/11/24 21:44:53 joseph
|
||||
/* Initial checkin for SourceForge
|
||||
/* */
|
||||
/* */
|
||||
/* 4 4/06/99 3:54p Dow */
|
||||
/* Alt tab again. */
|
||||
@@ -45,7 +48,19 @@
|
||||
/* 2 3/04/97 9:10p Dow */
|
||||
/* Neutered mutiplatform multiheaded monster. */
|
||||
|
||||
#ifdef __ia64__
|
||||
|
||||
.align 32
|
||||
.global _cpu_detect_asm
|
||||
.proc _cpu_detect_asm
|
||||
|
||||
_cpu_detect_asm:
|
||||
mov ret0=0
|
||||
br.ret.sptk.few b0
|
||||
|
||||
.end _cpu_detect_asm
|
||||
|
||||
#else /* !__ia64__ */
|
||||
|
||||
.file "cpudtect.asm"
|
||||
|
||||
@@ -321,3 +336,4 @@ double_precision_asm:
|
||||
.size double_precision_asm,.L_END_double_precision_asm-double_precision_asm
|
||||
|
||||
.end
|
||||
#endif
|
||||
|
||||
21
glide3x/h3/glide3/src/cpudtect.c
Normal file
21
glide3x/h3/glide3/src/cpudtect.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifdef __alpha__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
#include "fxglide.h"
|
||||
|
||||
#define NOT_PENTIUM 4 /* see cpudetect.S */
|
||||
|
||||
extern FxI32 GR_CDECL
|
||||
_cpu_detect_asm(void)
|
||||
{
|
||||
return(NOT_PENTIUM);
|
||||
}
|
||||
#endif
|
||||
@@ -19,6 +19,12 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:54 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 5 5/24/99 2:48p Jamesb
|
||||
** Added ptrLostContext to exported cmdTransport struct.
|
||||
@@ -255,6 +261,7 @@
|
||||
*/
|
||||
#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -612,10 +619,10 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params))
|
||||
break;
|
||||
|
||||
case GR_SURFACE_TEXTURE:
|
||||
if (plength == 4) {
|
||||
if (plength == sizeof(long)) {
|
||||
GR_DCL_GC;
|
||||
|
||||
*params = (FxU32) &gc->tBuffer;
|
||||
*params = (AnyPtr) &gc->tBuffer;
|
||||
retVal = plength;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:54 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -126,6 +129,8 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:54 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -115,6 +121,7 @@
|
||||
#include <string.h>
|
||||
#include <3dfx.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <glidesys.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
@@ -180,7 +187,7 @@ GR_DIENTRY(grSstSelect, void, ( int which ))
|
||||
GrErrorCallback( "grSstSelect: non-existent SST", FXTRUE );
|
||||
|
||||
_GlideRoot.current_sst = which;
|
||||
setThreadValue( (FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
setThreadValue( (AnyPtr)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
|
||||
#ifdef GLIDE_MULTIPLATFORM
|
||||
_GlideRoot.curGCFuncs = _GlideRoot.curGC->gcFuncs;
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.1 2000/11/24 18:38:46 alanh
|
||||
** Add new grStippleMode and grStipplePattern functions for Voodoo3 and Voodoo5.
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:54 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
@@ -175,6 +178,7 @@
|
||||
|
||||
#ifdef GLIDE3
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -549,7 +553,7 @@ GR_DIENTRY(grDepthBufferMode, void , (GrDepthBufferMode_t mode) )
|
||||
|
||||
Return:
|
||||
-------------------------------------------------------------------*/
|
||||
#ifdef __linux__
|
||||
#if defined(DRI_BUILD)
|
||||
GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple))
|
||||
{
|
||||
#define FN_NAME "grStipplePattern"
|
||||
@@ -562,7 +566,7 @@ GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple))
|
||||
|
||||
#undef FN_NAME
|
||||
} /* grStipplePattern */
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grStippleMode
|
||||
@@ -574,7 +578,7 @@ GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple))
|
||||
|
||||
Return:
|
||||
-------------------------------------------------------------------*/
|
||||
#ifdef __linux__
|
||||
#if defined(DRI_BUILD)
|
||||
GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) )
|
||||
{
|
||||
#define FN_NAME "grStippleMode"
|
||||
@@ -587,7 +591,7 @@ GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) )
|
||||
|
||||
#undef FN_NAME
|
||||
} /* grStippleMode */
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grDitherMode
|
||||
@@ -948,9 +952,9 @@ _grValidateState()
|
||||
_grDepthBufferFunction(LOADARG(grDepthBufferFunction, fnc));
|
||||
_grDepthBufferMode(LOADARG(grDepthBufferMode, mode));
|
||||
_grDitherMode(LOADARG(grDitherMode, mode));
|
||||
#ifdef __linux__
|
||||
#if defined(DRI_BUILD)
|
||||
_grStippleMode(LOADARG(grStippleMode, mode));
|
||||
#endif /* __linux__ */
|
||||
#endif
|
||||
_grSstOrigin(LOADARG(grSstOrigin, origin));
|
||||
_grRenderBuffer(LOADARG(grRenderBuffer, buffer));
|
||||
|
||||
@@ -982,19 +986,19 @@ _grValidateState()
|
||||
|
||||
if (enableColorMask) fbzMode |= SST_RGBWRMASK;
|
||||
if (enableDepthMask) {
|
||||
GR_CHECK_COMPATABILITY(FN_NAME,
|
||||
/*GR_CHECK_COMPATABILITY(FN_NAME,
|
||||
((enableAlphaMask != 0) && (gc->state.shadow.fbzMode & SST_ENALPHABUFFER)),
|
||||
"alpha writes enabled even though depth buffering");
|
||||
"alpha writes enabled even though depth buffering");*/
|
||||
|
||||
fbzMode |= SST_ZAWRMASK;
|
||||
} else if (enableAlphaMask > 0) {
|
||||
GR_CHECK_COMPATABILITY(FN_NAME,
|
||||
/*GR_CHECK_COMPATABILITY(FN_NAME,
|
||||
(fbzMode & SST_ENDEPTHBUFFER),
|
||||
"alpha writes enabled even though depth buffering");
|
||||
|
||||
GR_CHECK_COMPATABILITY(FN_NAME,
|
||||
(gc->grAuxBuf == 0),
|
||||
"cannot enable alpha buffering w/o allocating one");
|
||||
"cannot enable alpha buffering w/o allocating one");*/
|
||||
|
||||
fbzMode |= SST_ENALPHABUFFER | SST_ZAWRMASK;
|
||||
}
|
||||
@@ -1009,7 +1013,7 @@ _grValidateState()
|
||||
reg_cnt++;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(DRI_BUILD)
|
||||
if (NOTVALID(stipple)) {
|
||||
gc->state.shadow.stipple = LOADARG(grStipplePattern, stipple);
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, stipple, 1, 0x01);
|
||||
@@ -1018,7 +1022,7 @@ _grValidateState()
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
if (NOTVALID(lfbMode)) {
|
||||
FxU32
|
||||
@@ -1388,7 +1392,7 @@ GR_DIENTRY(grViewport, void , (FxI32 x, FxI32 y, FxI32 width, FxI32 height) )
|
||||
#undef FN_NAME
|
||||
} /* grViewport */
|
||||
|
||||
#ifdef __linux__
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
void
|
||||
_grInvalidateAll()
|
||||
{
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:54 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -164,6 +170,7 @@
|
||||
*/
|
||||
#ifdef GLIDE3
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -541,10 +548,10 @@ GR_DIENTRY(grDrawVertexArrayContiguous, void , (FxU32 mode, FxU32 Count, void *p
|
||||
else {
|
||||
void *b_ptr, *c_ptr;
|
||||
while ((int)Count >= 3) {
|
||||
b_ptr = (void *)((FxU32)pointers + stride);
|
||||
c_ptr = (void *)((FxU32)pointers + stride*2);
|
||||
b_ptr = (void *)((AnyPtr)pointers + stride);
|
||||
c_ptr = (void *)((AnyPtr)pointers + stride*2);
|
||||
TRISETUP(pointers, b_ptr, c_ptr);
|
||||
pointers = (void *)((FxU32)c_ptr + stride);
|
||||
pointers = (void *)((AnyPtr)c_ptr + stride);
|
||||
Count -= 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:54 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 6 6/10/99 12:17p Stb_mmcclure
|
||||
** Cleaned up comments made in grTexMinAddress
|
||||
@@ -148,7 +151,9 @@
|
||||
*/
|
||||
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#include "config.h"
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
@@ -555,7 +560,7 @@ GR_DIENTRY(grTexMinAddress, FxU32, ( GrChipID_t tmu ))
|
||||
|
||||
FXUNUSED(hw);
|
||||
|
||||
#ifndef __linux__
|
||||
#if !defined(DRI_BUILD)
|
||||
if (!gc->lostContext)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:55 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 6 4/16/99 4:27p Kcd
|
||||
** SET*_FIFO macros.
|
||||
@@ -161,6 +167,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -472,7 +479,7 @@ static const char * h3SstIORegNames[] = {
|
||||
} ;
|
||||
|
||||
|
||||
#define GEN_INDEX(a) ((((FxU32) a) - ((FxU32) gc->reg_ptr)) >> 2)
|
||||
#define GEN_INDEX(a) ((((AnyPtr) a) - ((AnyPtr) gc->reg_ptr)) >> 2)
|
||||
|
||||
void
|
||||
_grFifoWriteDebug(FxU32 addr, FxU32 val, FxU32 fifoPtr)
|
||||
@@ -691,7 +698,7 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 400);
|
||||
|
||||
if ( gc->windowed ) {
|
||||
#if defined( GLIDE_INIT_HWC ) && !defined(__linux__)
|
||||
#if defined( GLIDE_INIT_HWC ) && !defined(DRI_BUILD)
|
||||
struct cmdTransportInfo*
|
||||
gcFifo = &gc->cmdTransportInfo;
|
||||
HwcWinFifo
|
||||
@@ -824,13 +831,13 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
|
||||
* we wrap check the current hw fifo pointer which is going to be the
|
||||
* 2d driver's fifo if we lost our context.
|
||||
*/
|
||||
#if defined(GLIDE_INIT_HWC) && !defined(__linux__)
|
||||
#if defined(GLIDE_INIT_HWC) && !defined(DRI_BUILD)
|
||||
gc->contextP = hwcQueryContext(gc->bInfo);
|
||||
#else
|
||||
gc->contextP = 1;
|
||||
#endif
|
||||
if (gc->contextP) {
|
||||
FxU32 wrapAddr = 0x00UL;
|
||||
AnyPtr wrapAddr = 0x00UL;
|
||||
FxU32 checks;
|
||||
|
||||
GR_ASSERT(blockSize > 0);
|
||||
@@ -876,11 +883,11 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
|
||||
again:
|
||||
/* do we need to stall? */
|
||||
{
|
||||
FxU32 lastHwRead = gc->cmdTransportInfo.fifoRead;
|
||||
AnyPtr lastHwRead = gc->cmdTransportInfo.fifoRead;
|
||||
FxI32 roomToReadPtr = gc->cmdTransportInfo.roomToReadPtr;
|
||||
|
||||
while (roomToReadPtr < blockSize) {
|
||||
FxU32 curReadPtr = HW_FIFO_PTR(FXTRUE);
|
||||
AnyPtr curReadPtr = HW_FIFO_PTR(FXTRUE);
|
||||
FxU32 curReadDist = curReadPtr - lastHwRead;
|
||||
|
||||
checks++;
|
||||
@@ -913,8 +920,8 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
|
||||
checks = 0;
|
||||
}
|
||||
#endif /* GLIDE_DEBUG */
|
||||
GR_ASSERT((curReadPtr >= (FxU32)gc->cmdTransportInfo.fifoStart) &&
|
||||
(curReadPtr < (FxU32)gc->cmdTransportInfo.fifoEnd));
|
||||
GR_ASSERT((curReadPtr >= (AnyPtr)gc->cmdTransportInfo.fifoStart) &&
|
||||
(curReadPtr < (AnyPtr)gc->cmdTransportInfo.fifoEnd));
|
||||
|
||||
roomToReadPtr += curReadDist;
|
||||
|
||||
@@ -926,8 +933,8 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
|
||||
lastHwRead = curReadPtr;
|
||||
}
|
||||
|
||||
GR_ASSERT((lastHwRead >= (FxU32)gc->cmdTransportInfo.fifoStart) &&
|
||||
(lastHwRead < (FxU32)gc->cmdTransportInfo.fifoEnd));
|
||||
GR_ASSERT((lastHwRead >= (AnyPtr)gc->cmdTransportInfo.fifoStart) &&
|
||||
(lastHwRead < (AnyPtr)gc->cmdTransportInfo.fifoEnd));
|
||||
|
||||
/* Update cached copies */
|
||||
gc->cmdTransportInfo.fifoRead = lastHwRead;
|
||||
@@ -970,7 +977,7 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
|
||||
|
||||
P6FENCE;
|
||||
|
||||
wrapAddr = (FxU32)gc->cmdTransportInfo.fifoPtr;
|
||||
wrapAddr = (AnyPtr)gc->cmdTransportInfo.fifoPtr;
|
||||
|
||||
/* Update roomXXX fields for the actual wrap */
|
||||
gc->cmdTransportInfo.roomToReadPtr -= gc->cmdTransportInfo.roomToEnd;
|
||||
@@ -999,12 +1006,12 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
|
||||
"\tfifoBlock: (0x%X : 0x%X)\n"
|
||||
"\tfifoRoom: (0x%X : 0x%X : 0x%X)\n"
|
||||
"\tfifo hw: (0x%X : 0x%X) : (0x%X : 0x%X : 0x%X)\n",
|
||||
(((FxU32)gc->cmdTransportInfo.fifoPtr - (FxU32)gc->cmdTransportInfo.fifoStart) +
|
||||
(FxU32)gc->cmdTransportInfo.fifoOffset),
|
||||
(((AnyPtr)gc->cmdTransportInfo.fifoPtr - (AnyPtr)gc->cmdTransportInfo.fifoStart) +
|
||||
(AnyPtr)gc->cmdTransportInfo.fifoOffset),
|
||||
blockSize,
|
||||
gc->cmdTransportInfo.roomToReadPtr,
|
||||
gc->cmdTransportInfo.roomToEnd, gc->cmdTransportInfo.fifoRoom,
|
||||
HW_FIFO_PTR(FXTRUE) - (FxU32)gc->rawLfb, gc->cmdTransportInfo.fifoRead,
|
||||
HW_FIFO_PTR(FXTRUE) - (AnyPtr)gc->rawLfb, gc->cmdTransportInfo.fifoRead,
|
||||
GR_CAGP_GET(depth), GR_CAGP_GET(holeCount), GR_GET(hw->status));
|
||||
|
||||
FIFO_ASSERT();
|
||||
@@ -1044,10 +1051,10 @@ _grH3FifoDump_Linear(const FxU32* const linearPacketAddr)
|
||||
}
|
||||
|
||||
|
||||
FxU32
|
||||
AnyPtr
|
||||
_grHwFifoPtr(FxBool ignored)
|
||||
{
|
||||
FxU32 rVal = 0;
|
||||
AnyPtr rVal = 0;
|
||||
|
||||
FxU32 status, readPtrL1, readPtrL2;
|
||||
GR_DCL_GC;
|
||||
@@ -1066,7 +1073,7 @@ _grHwFifoPtr(FxBool ignored)
|
||||
#endif
|
||||
readPtrL2 = GET(gc->cRegs->cmdFifo0.readPtrL);
|
||||
} while (readPtrL1 != readPtrL2);
|
||||
rVal = (((FxU32)gc->cmdTransportInfo.fifoStart) +
|
||||
rVal = (((AnyPtr)gc->cmdTransportInfo.fifoStart) +
|
||||
readPtrL2 -
|
||||
(FxU32)gc->cmdTransportInfo.fifoOffset);
|
||||
}
|
||||
@@ -1168,9 +1175,25 @@ _reg_group_begin_internal_wax( FxU32 __regBase,
|
||||
#endif /* GLIDE_DEBUG */
|
||||
#endif /* USE_PACKET_FIFO */
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
|
||||
#ifdef __alpha__
|
||||
unsigned char _fxget8( unsigned char *pval ) {
|
||||
__asm__ __volatile__("mb": : :"memory");
|
||||
return( *pval );
|
||||
}
|
||||
unsigned short _fxget16( unsigned short *pval ) {
|
||||
__asm__ __volatile__("mb": : :"memory");
|
||||
return( *pval );
|
||||
}
|
||||
unsigned int _fxget32( unsigned int *pval ) {
|
||||
__asm__ __volatile__("mb": : :"memory");
|
||||
return( *pval );
|
||||
}
|
||||
#endif /* __alpha__ */
|
||||
|
||||
void
|
||||
_grImportFifo(int fifoPtr, int fifoRead) {
|
||||
_grImportFifo(AnyPtr fifoPtr, AnyPtr fifoRead) {
|
||||
struct cmdTransportInfo* gcFifo;
|
||||
FxU32 readPos;
|
||||
GR_DCL_GC;
|
||||
@@ -1188,13 +1211,13 @@ _grImportFifo(int fifoPtr, int fifoRead) {
|
||||
gcFifo=&gc->cmdTransportInfo;
|
||||
readPos=readPos-gcFifo->fifoOffset;
|
||||
gcFifo->fifoPtr = gcFifo->fifoStart + (readPos>>2);
|
||||
gcFifo->fifoRead = (FxU32)gcFifo->fifoPtr;
|
||||
gcFifo->fifoRead = (AnyPtr)gcFifo->fifoPtr;
|
||||
#else
|
||||
gcFifo=&gc->cmdTransportInfo;
|
||||
gcFifo->fifoPtr = gc->rawLfb+(fifoPtr>>2);
|
||||
gcFifo->fifoRead = ((int)gc->rawLfb)+fifoRead;
|
||||
#endif
|
||||
gcFifo->roomToReadPtr = gcFifo->fifoRead-((int)gcFifo->fifoPtr)-FIFO_END_ADJUST-sizeof(FxU32);
|
||||
gcFifo->roomToReadPtr = gcFifo->fifoRead-((AnyPtr)gcFifo->fifoPtr)-FIFO_END_ADJUST-sizeof(FxU32);
|
||||
if (gcFifo->roomToReadPtr<0) gcFifo->roomToReadPtr+=gcFifo->fifoSize;
|
||||
gcFifo->roomToEnd = gcFifo->fifoSize -
|
||||
((gcFifo->fifoPtr-gcFifo->fifoStart)<<2) -
|
||||
@@ -1207,13 +1230,13 @@ _grImportFifo(int fifoPtr, int fifoRead) {
|
||||
}
|
||||
|
||||
void
|
||||
_grExportFifo(int *fifoPtr, int *fifoRead) {
|
||||
_grExportFifo(FxU32 *fifoPtr, FxU32 *fifoRead) {
|
||||
struct cmdTransportInfo* gcFifo;
|
||||
GR_DCL_GC;
|
||||
gcFifo=&gc->cmdTransportInfo;
|
||||
*fifoPtr=(gcFifo->fifoPtr-gc->rawLfb)<<2;
|
||||
*fifoRead=(gcFifo->fifoRead-(int)gc->rawLfb);
|
||||
*fifoRead=(gcFifo->fifoRead-(AnyPtr)gc->rawLfb);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
|
||||
@@ -21,6 +21,15 @@
|
||||
** $Revision$
|
||||
** $Date$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.2 2000/09/07 15:29:52 alanh
|
||||
** fix white space
|
||||
**
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:55 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 6 4/16/99 4:27p Kcd
|
||||
** SET*_FIFO macros.
|
||||
@@ -133,6 +142,10 @@
|
||||
#ifndef __FX_CMD_H__
|
||||
#define __FX_CMD_H__
|
||||
|
||||
#ifndef GLIDE_PLATFORM
|
||||
#error no glidesys.h
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------------
|
||||
Command Transport Macros and Functions
|
||||
--------------------------------------------------------*/
|
||||
@@ -145,6 +158,12 @@ extern FxU32
|
||||
_grGet32(volatile FxU32* const sstAddr);
|
||||
#endif /* USE_PACKET_FIFO */
|
||||
|
||||
#if defined(DRI_BUILD)
|
||||
void _grImportFifo(AnyPtr fifoPtr, AnyPtr fifoRead);
|
||||
void _grExportFifo(FxU32 *fifoPtr, FxU32 *fifoRead);
|
||||
void _grInvalidateAll(void);
|
||||
#endif /* DRI_BUILD*/
|
||||
|
||||
#if !USE_PACKET_FIFO
|
||||
/* NOTE: fifoFree is the number of entries, each is 8 bytes */
|
||||
#define GR_CHECK_FOR_ROOM(n,p) \
|
||||
@@ -179,7 +198,7 @@ do { \
|
||||
/* NB: This should be used sparingly because it does a 'real' hw read
|
||||
* which is *SLOW*.
|
||||
*/
|
||||
FxU32 _grHwFifoPtr(FxBool);
|
||||
AnyPtr _grHwFifoPtr(FxBool);
|
||||
#define HW_FIFO_PTR(a) _grHwFifoPtr(a)
|
||||
|
||||
#if FIFO_ASSERT_FULL
|
||||
@@ -190,7 +209,7 @@ FxU32 _grHwFifoPtr(FxBool);
|
||||
#else /* !FIFO_ASSERT_FULL */
|
||||
#define FIFO_ASSERT() \
|
||||
ASSERT_FAULT_IMMED((FxU32)gc->cmdTransportInfo.fifoRoom < gc->cmdTransportInfo.fifoSize); \
|
||||
ASSERT_FAULT_IMMED((FxU32)gc->cmdTransportInfo.fifoPtr < (FxU32)gc->cmdTransportInfo.fifoEnd)
|
||||
ASSERT_FAULT_IMMED((AnyPtr)gc->cmdTransportInfo.fifoPtr < (AnyPtr)gc->cmdTransportInfo.fifoEnd)
|
||||
#endif /* !FIFO_ASSERT_FULL */
|
||||
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
|
||||
@@ -231,7 +250,7 @@ extern void _grBumpNGrind(void);
|
||||
#define GR_CHECK_FOR_ROOM(__n, __p) \
|
||||
do { \
|
||||
const FxU32 writeSize = (__n) + ((__p) * sizeof(FxU32)); /* Adjust for size of hdrs */ \
|
||||
ASSERT(((FxU32)(gc->cmdTransportInfo.fifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
ASSERT(((AnyPtr)(gc->cmdTransportInfo.fifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
ASSERT(writeSize < gc->cmdTransportInfo.fifoSize - sizeof(FxU32)); \
|
||||
FIFO_ASSERT(); \
|
||||
if (gc->cmdTransportInfo.fifoRoom < (FxI32)writeSize) { \
|
||||
@@ -259,7 +278,7 @@ if (gc->cmdTransportInfo.autoBump) {\
|
||||
}
|
||||
|
||||
#define GR_SET_FIFO_PTR(__n, __p) \
|
||||
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkPtr = (AnyPtr)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkCounter = ((__n) + ((__p) << 2))
|
||||
#else
|
||||
#define GR_CHECK_FIFO_PTR()
|
||||
@@ -271,7 +290,7 @@ if (gc->cmdTransportInfo.autoBump) {\
|
||||
GDBG_ERROR("GR_ASSERT_SIZE","byte counter should be %d but is %d\n", \
|
||||
gc->expected_counter,gc->counter); \
|
||||
GR_CHECK_FIFO_PTR(); \
|
||||
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkPtr = (AnyPtr)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkCounter = 0; \
|
||||
ASSERT(gc->counter == gc->expected_counter); \
|
||||
gc->counter = gc->expected_counter = 0
|
||||
@@ -306,7 +325,7 @@ if (gc->cmdTransportInfo.autoBump) {\
|
||||
|
||||
|
||||
#if USE_PACKET_FIFO
|
||||
#if GLIDE_DEBUG
|
||||
#if GDBG_INFO_ON
|
||||
void _grFifoWriteDebug(FxU32 addr, FxU32 val, FxU32 fifoPtr);
|
||||
#define DEBUGFIFOWRITE(a,b,c) \
|
||||
_grFifoWriteDebug((FxU32) a, (FxU32) b, (FxU32) c)
|
||||
@@ -646,7 +665,7 @@ do { \
|
||||
GDBG_INFO(120, "REG_GROUP_SET:\n"); \
|
||||
} \
|
||||
GDBG_INFO(120, "\tFile: %s Line %d\n", __FILE__, __LINE__); \
|
||||
GDBG_INFO(120, "\tfifoPtr: 0x%x, Val: 0x%x\n", (FxU32) _regGroupFifoPtr - (FxU32)gc->rawLfb, __val);\
|
||||
GDBG_INFO(120, "\tfifoPtr: 0x%x, Val: 0x%x\n", (AnyPtr) _regGroupFifoPtr - (AnyPtr)gc->rawLfb, __val);\
|
||||
SET_FIFO(*_regGroupFifoPtr++, (__val)); \
|
||||
GR_INC_SIZE(sizeof(FxU32)); \
|
||||
} while(0)
|
||||
@@ -667,7 +686,7 @@ do { \
|
||||
GDBG_INFO(120, "REG_GROUP_SET:\n"); \
|
||||
} \
|
||||
GDBG_INFO(120, "\tFile: %s Line %d\n", __FILE__, __LINE__); \
|
||||
GDBG_INFO(120, "\tfifoPtr: 0x%x, Val: 0x%x\n", (FxU32) _regGroupFifoPtr - (FxU32)gc->rawLfb, __val);\
|
||||
GDBG_INFO(120, "\tfifoPtr: 0x%x, Val: 0x%x\n", (AnyPtr) _regGroupFifoPtr - (AnyPtr)gc->rawLfb, __val);\
|
||||
SET_FIFO(*_regGroupFifoPtr++, (__val)); \
|
||||
GR_INC_SIZE(sizeof(FxU32)); \
|
||||
} while(0)
|
||||
@@ -683,7 +702,7 @@ do { \
|
||||
} \
|
||||
GDBG_INFO(220, "REG_GROUP_SET_WAX:\n");\
|
||||
GDBG_INFO(220, "\tFile: %s Line %d\n", __FILE__, __LINE__);\
|
||||
GDBG_INFO(220, "\tfifoPtr: 0x%x, Val: 0x%x\n", (FxU32) _regGroupFifoPtr - (FxU32)gc->rawLfb, __val);\
|
||||
GDBG_INFO(220, "\tfifoPtr: 0x%x, Val: 0x%x\n", (AnyPtr) _regGroupFifoPtr - (AnyPtr)gc->rawLfb, __val);\
|
||||
SET_FIFO(*_regGroupFifoPtr++, (__val)); \
|
||||
GR_INC_SIZE(sizeof(FxU32)); \
|
||||
} while(0)
|
||||
@@ -713,8 +732,8 @@ do { \
|
||||
|
||||
#define REG_GROUP_END() \
|
||||
ASSERT(_checkP); \
|
||||
ASSERT((((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) >> 2) == _groupNum + 1); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
ASSERT((((AnyPtr)_regGroupFifoPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr) >> 2) == _groupNum + 1); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)_regGroupFifoPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = (FxU32*)_regGroupFifoPtr; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\tGroupEnd: (0x%X : 0x%X)\n", \
|
||||
gc->cmdTransportInfo.fifoPtr, gc->cmdTransportInfo.fifoRoom); \
|
||||
@@ -727,7 +746,7 @@ do { \
|
||||
if (gc->contextP) { \
|
||||
FxU32* curFifoPtr = gc->cmdTransportInfo.fifoPtr; \
|
||||
FXUNUSED(__base); \
|
||||
GR_ASSERT(((FxU32)(curFifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT(((AnyPtr)(curFifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_CHECK_COMPATABILITY(FN_NAME, \
|
||||
!gc->open, \
|
||||
"Called before grSstWinOpen()"); \
|
||||
@@ -770,7 +789,7 @@ do { \
|
||||
if (gc->contextP) { \
|
||||
FxU32* curFifoPtr = gc->cmdTransportInfo.fifoPtr; \
|
||||
FXUNUSED(__base); \
|
||||
GR_ASSERT(((FxU32)(curFifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT(((AnyPtr)(curFifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_CHECK_COMPATABILITY(FN_NAME, \
|
||||
!gc->open, \
|
||||
"Called before grSstWinOpen()"); \
|
||||
@@ -940,27 +959,27 @@ _grH3FifoDump_Linear(const FxU32* const linearPacketAddr);
|
||||
pCount++; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\t(0x%X) : V#: 0x%X - P#: 0x%X - ParamVal: (%f : 0x%X)\n", \
|
||||
(FxU32)tPackPtr, \
|
||||
((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
(((__val) < 786432.875) ? (__val) : ((__val) - 786432.875)), \
|
||||
(__floatVal))
|
||||
#define SETF_DUMP(__val) \
|
||||
pCount++; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\t(0x%X) : V#: 0x%X - P#: 0x%X - ParamVal: %f\n", \
|
||||
(FxU32)tPackPtr, \
|
||||
((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
(((__val) < 786432.875) ? (__val) : ((__val) - 786432.875)))
|
||||
#define SET_DUMP(__val) \
|
||||
pCount++; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\t(0x%X) : V#: 0x%X - P#: 0x%X - ParamVal: 0x%X\n", \
|
||||
(FxU32)tPackPtr, \
|
||||
((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
(__val))
|
||||
#define TRI_ASSERT() \
|
||||
GR_ASSERT(pCount == (nVertex * (sVertex >> 2))); \
|
||||
ASSERT(((FxU32)tPackPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) == (nVertex * sVertex) + sizeof(FxU32))
|
||||
ASSERT(((AnyPtr)tPackPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr) == (nVertex * sVertex) + sizeof(FxU32))
|
||||
#else /* !GDBG_INFO_ON */
|
||||
#define DEBUGFIFODUMP_TRI(__packetAddr)
|
||||
#define DEBUGFIFODUMP_LINEAR(__packetAddr)
|
||||
@@ -1025,7 +1044,7 @@ do { \
|
||||
|
||||
#define TRI_END \
|
||||
TRI_ASSERT(); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)tPackPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)tPackPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = tPackPtr; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\tTriEnd: (0x%X : 0x%X)\n", tPackPtr, gc->cmdTransportInfo.fifoRoom); \
|
||||
FIFO_ASSERT(); \
|
||||
@@ -1044,12 +1063,12 @@ do { \
|
||||
GR_CHECK_COMPATABILITY(FN_NAME, \
|
||||
!gc->open, \
|
||||
"Called before grSstWinOpen()"); \
|
||||
GR_ASSERT(((FxU32)(packetPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT(((AnyPtr)(packetPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT((__numWords) > 0); /* packet size */ \
|
||||
GR_ASSERT((__numWords) < ((0x01 << 19) - 2)); \
|
||||
GR_ASSERT((((FxU32)(__numWords) + 2) << 2) <= (FxU32)gc->cmdTransportInfo.fifoRoom); \
|
||||
GR_ASSERT(((FxU32)packetPtr + (((__numWords) + 2) << 2)) < \
|
||||
(FxU32)gc->cmdTransportInfo.fifoEnd); \
|
||||
GR_ASSERT(((AnyPtr)packetPtr + (((__numWords) + 2) << 2)) < \
|
||||
(AnyPtr)gc->cmdTransportInfo.fifoEnd); \
|
||||
GR_ASSERT((hdr2 & 0xE0000000UL) == 0x00UL); \
|
||||
GR_ASSERT(((__addr) & 0x03UL) == 0x00UL); \
|
||||
FIFO_ASSERT(); \
|
||||
@@ -1094,8 +1113,8 @@ do { \
|
||||
|
||||
#define FIFO_LINEAR_WRITE_END \
|
||||
DEBUGFIFODUMP_LINEAR(gc->cmdTransportInfo.fifoPtr); \
|
||||
GR_ASSERT((((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) >> 2) == __writeSize + 2); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
GR_ASSERT((((AnyPtr)packetPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr) >> 2) == __writeSize + 2); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)packetPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = packetPtr; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\tLinearEnd: (0x%X : 0x%X)\n", \
|
||||
packetPtr, gc->cmdTransportInfo.fifoRoom); \
|
||||
@@ -1309,7 +1328,7 @@ do { \
|
||||
#define REG_GROUP_SETF_CLAMP(__regBase, __regAddr, __val) \
|
||||
do { \
|
||||
const FxU32 fpClampVal = FP_FLOAT_CLAMP(__val); \
|
||||
REG_GROUP_ASSERT(__regAddr, fpClampVal, FXTRUE); \
|
||||
REG_GROUP_ASSERT(__regAddr, fpClampVal, FXTRUE); \
|
||||
SET(((FxU32*)(__regBase))[offsetof(SstRegs, __regAddr) >> 2], fpClampVal); \
|
||||
GR_INC_SIZE(sizeof(FxU32)); \
|
||||
} while(0)
|
||||
@@ -1509,7 +1528,7 @@ GR_CHECK_SIZE()
|
||||
} \
|
||||
else { \
|
||||
FxU32 argb; \
|
||||
argb = *((FxU32 *)((int)_s + i)) & 0x00ffffff; \
|
||||
argb = *((FxU32 *)((long)_s + i)) & 0x00ffffff; \
|
||||
TRI_SETF(*((float *)&argb)); \
|
||||
dataElem++; \
|
||||
i = gc->tsuDataList[dataElem]; \
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -37,7 +38,7 @@
|
||||
* macros for creating assembler offset files
|
||||
*----------------------------------------------------------------------*/
|
||||
|
||||
#if !defined(__linux__) && !defined(__FreeBSD__)
|
||||
#if !(GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
#define NEWLINE printf("\n")
|
||||
#define COMMENT printf(";----------------------------------------------------------------------\n")
|
||||
|
||||
|
||||
@@ -19,6 +19,15 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.3 2000/11/24 18:38:46 alanh
|
||||
** Add new grStippleMode and grStipplePattern functions for Voodoo3 and Voodoo5.
|
||||
**
|
||||
** Revision 1.1.1.1.2.2 2000/10/03 08:18:09 alanh
|
||||
** merge trunk into Glide3-64bit branch.
|
||||
**
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:56 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
@@ -266,6 +275,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
/* 3dfx */
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
#include <gdebug.h>
|
||||
@@ -769,14 +779,14 @@ typedef struct {
|
||||
struct {
|
||||
GrDitherMode_t mode;
|
||||
} grDitherModeArgs;
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
struct {
|
||||
GrStippleMode_t mode;
|
||||
} grStippleModeArgs;
|
||||
struct {
|
||||
GrStipplePattern_t stipple;
|
||||
} grStipplePatternArgs;
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
struct {
|
||||
GrBuffer_t buffer;
|
||||
} grRenderBufferArgs;
|
||||
@@ -825,7 +835,7 @@ typedef struct {
|
||||
*/
|
||||
#define GR_MEMTYPE GR_GET_RESERVED_1
|
||||
|
||||
#ifndef __linux__
|
||||
#if !defined(DRI_BUILD)
|
||||
#define TRISETUPARGS const void *a, const void *b, const void *c
|
||||
#else
|
||||
#define TRISETUPARGS const void *g, const void *a, const void *b, const void *c
|
||||
@@ -1049,7 +1059,7 @@ typedef struct GrGC_s
|
||||
SET(*curFifoPtr++, *curPktData++); \
|
||||
} \
|
||||
GR_INC_SIZE((__writeCount) * sizeof(FxU32)); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)curFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)curFifoPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = curFifoPtr; \
|
||||
} \
|
||||
GR_CHECK_SIZE(); \
|
||||
@@ -1168,7 +1178,7 @@ typedef struct GrGC_s
|
||||
*/
|
||||
|
||||
FxU32* fifoPtr; /* Current write pointer into fifo */
|
||||
FxU32 fifoRead; /* Last known hw read ptr.
|
||||
AnyPtr fifoRead; /* Last known hw read ptr.
|
||||
* If on an sli enabled system this will be
|
||||
* the 'closest' hw read ptr of the sli
|
||||
* master and slave.
|
||||
@@ -1234,7 +1244,7 @@ typedef struct GrGC_s
|
||||
windowedState;
|
||||
#endif /* GLIDE_INIT_HWC */
|
||||
} cmdTransportInfo;
|
||||
#ifndef __linux__
|
||||
#if !defined(DRI_BUILD)
|
||||
FxI32 (FX_CALL *triSetupProc)(const void *a, const void *b, const void *c);
|
||||
#else
|
||||
FxI32 (FX_CALL *triSetupProc)(const void *gc, const void *a, const void *b, const void *c);
|
||||
@@ -1253,12 +1263,13 @@ typedef struct GrGC_s
|
||||
nBuffers,
|
||||
curBuffer,
|
||||
frontBuffer,
|
||||
backBuffer,
|
||||
backBuffer;
|
||||
AnyPtr
|
||||
buffers[4],
|
||||
lfbBuffers[4]; /* Tile relative addresses of the color/aux
|
||||
* buffers for lfbReads.
|
||||
*/
|
||||
FxU32 lockPtrs[2]; /* pointers to locked buffers */
|
||||
AnyPtr lockPtrs[2]; /* pointers to locked buffers */
|
||||
FxU32 fbStride;
|
||||
|
||||
struct {
|
||||
@@ -1293,7 +1304,7 @@ typedef struct GrGC_s
|
||||
FxI32 expected_counter; /* the number of bytes expected to be sent */
|
||||
|
||||
FxU32 checkCounter;
|
||||
FxU32 checkPtr;
|
||||
AnyPtr checkPtr;
|
||||
|
||||
FxVideoTimingInfo* vidTimings;/* init code overrides */
|
||||
|
||||
@@ -1485,6 +1496,10 @@ extern GrGCFuncs _curGCFuncs;
|
||||
# define P6FENCE __eieio()
|
||||
#elif defined(__GNUC__) && defined(__i386__)
|
||||
#define P6FENCE asm("xchg %%eax, %0" : : "m" (_GlideRoot.p6Fencer) : "eax");
|
||||
#elif defined(__GNUC__) && defined(__ia64__)
|
||||
#define P6FENCE asm volatile("mf.a" ::: "memory")
|
||||
#elif defined(__GNUC__) && defined(__alpha__)
|
||||
#define P6FENCE asm volatile("mb" ::: "memory")
|
||||
#else /* !defined ( P6FENCE ) */
|
||||
# error "P6 Fencing code needs to be added for this compiler"
|
||||
#endif /* !defined ( P6FENCE ) */
|
||||
@@ -1616,7 +1631,7 @@ _trisetup_noclip_valid(TRISETUPARGS);
|
||||
|
||||
#else
|
||||
|
||||
#if defined( __linux__ )
|
||||
#ifdef DRI_BUILD
|
||||
|
||||
#define TRISETUP(a, b, c) (gc->triSetupProc)(gc, a, b, c)
|
||||
|
||||
@@ -1660,11 +1675,11 @@ _grColorCombine(
|
||||
FxBool invert );
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
void FX_CALL
|
||||
grStipplePattern(
|
||||
GrStipplePattern_t stipple);
|
||||
#endif /* __linux__ */
|
||||
#endif
|
||||
|
||||
void FX_CALL
|
||||
grChromaRangeMode(GrChromaRangeMode_t mode);
|
||||
@@ -1708,10 +1723,10 @@ _grDepthBufferMode( GrDepthBufferMode_t mode );
|
||||
void
|
||||
_grDitherMode( GrDitherMode_t mode );
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
void
|
||||
_grStippleMode( GrStippleMode_t mode );
|
||||
#endif /* __linux__ */
|
||||
#endif
|
||||
|
||||
void
|
||||
_grRenderBuffer( GrBuffer_t buffer );
|
||||
@@ -1819,8 +1834,8 @@ getThreadValueFast() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
extern FxU32 threadValueLinux;
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
extern AnyPtr threadValueLinux;
|
||||
#define getThreadValueFast() threadValueLinux
|
||||
#endif
|
||||
|
||||
@@ -1835,9 +1850,9 @@ void
|
||||
initThreadStorage( void );
|
||||
|
||||
void
|
||||
setThreadValue( FxU32 value );
|
||||
setThreadValue( AnyPtr value );
|
||||
|
||||
FxU32
|
||||
AnyPtr
|
||||
getThreadValueSLOW( void );
|
||||
|
||||
void
|
||||
@@ -2185,7 +2200,7 @@ void i3(void);
|
||||
#define HW_TEX_PTR(__b) ((FxU32*)(((FxU32)(__b)) + HW_TEXTURE_OFFSET))
|
||||
|
||||
/* access a floating point array with a byte index */
|
||||
#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
|
||||
#define FARRAY(p,i) (*(float *)((i)+(long)(p)))
|
||||
#define ArraySize(__a) (sizeof(__a) / sizeof((__a)[0]))
|
||||
|
||||
#if GDBG_INFO_ON
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:56 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -67,10 +73,12 @@
|
||||
* Added GR_DIENTRY for di glide functions
|
||||
**
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <3dfx.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
** __WIN32__ Defined for 32-bit Windows applications
|
||||
** __sparc__ Defined for Sun Solaris/SunOS
|
||||
** __linux__ Defined for Linux applications
|
||||
** __FreeBSD__ Defined for FreeBSD applications
|
||||
** __IRIX__ Defined for SGI Irix applications
|
||||
**
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,21 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.2 2000/11/02 10:27:24 alanh
|
||||
** Commit some of Dave Mosberger's code:
|
||||
**
|
||||
** If mode is not zero, initialize "stride" to the
|
||||
** number of floats that corresponds to the size of a pointer (1 on a
|
||||
** 32-bit platform, 2 on a 64-bit platform). This code works
|
||||
** properly as long as sizeof(void*)==N*sizeof(float) for some
|
||||
** integer constant N.
|
||||
**
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:56 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 5 5/12/99 10:22a Atai
|
||||
** fixed PRS 5815
|
||||
@@ -242,6 +257,7 @@
|
||||
#define SLOW_SETF 1
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
@@ -375,8 +391,8 @@ aaVpDrawArrayEdgeSense(float *a, float *b, float *c, float oowa, float oowb)
|
||||
}
|
||||
else {
|
||||
ia = gc->state.vData.pargbInfo.offset;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((int)a + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((int)b + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((long)a + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((long)b + ia))&0x00ffffff;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -574,7 +590,7 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
FxU32 ia;
|
||||
FxU32 i;
|
||||
FxU32 vsize;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
FxU32 tmp_cullStripHdr;
|
||||
|
||||
GDBG_INFO(94,"_grAADrawPoints(0x%x)\n",e);
|
||||
@@ -582,8 +598,10 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
GDBG_INFO_MORE(gc->myLevel, "(count = %d, pointers = 0x%x)\n",
|
||||
count, pointers);
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
@@ -675,7 +693,7 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
FxU32 argb;
|
||||
|
||||
if (i == ia) {
|
||||
argb = *((FxU32 *)((int)e + i)) & 0x00ffffff;
|
||||
argb = *((FxU32 *)((long)e + i)) & 0x00ffffff;
|
||||
TRI_SETF(*((float *)&argb));
|
||||
}
|
||||
else {
|
||||
@@ -798,7 +816,7 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
FxU32 ia, vNum = 0;
|
||||
FxU32 vsize;
|
||||
FxU32 sCount;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
FxU32 tmp_cullStripHdr;
|
||||
|
||||
GDBG_INFO(95,"_grAADrawLineStrip(count = %d, pointers = 0x%x)\n",
|
||||
@@ -814,8 +832,11 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
if (ltype == GR_LINES)
|
||||
sCount = count >> 1; /* line list */
|
||||
else
|
||||
@@ -852,8 +873,8 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
ady = -ady;
|
||||
|
||||
if (gc->state.vData.colorType != GR_FLOAT) {
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((int)v1 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((int)v2 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((long)v1 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((long)v2 + ia))&0x00ffffff;
|
||||
}
|
||||
|
||||
if (adx >= ady) { /* X major line */
|
||||
@@ -1059,8 +1080,8 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
ady = -ady;
|
||||
/*
|
||||
if (gc->state.vData.colorType != GR_FLOAT) {
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((int)v1 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((int)v2 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((long)v1 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((long)v2 + ia))&0x00ffffff;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -1252,8 +1273,8 @@ aaDrawArrayEdgeSense(float *a, float *b, float *c)
|
||||
}
|
||||
else {
|
||||
ia = gc->state.vData.pargbInfo.offset;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((int)a + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((int)b + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((long)a + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((long)b + ia))&0x00ffffff;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1329,7 +1350,7 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
float **lPtr = (float **)pointers;
|
||||
FxI32 tCount = 3;
|
||||
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
|
||||
FxI32 yindex = xindex + 1;
|
||||
|
||||
@@ -1346,8 +1367,10 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
/* gc->state.invalid |= fbzModeBIT; */
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
/* backfaced or zero area */
|
||||
while (tCount <= count) {
|
||||
@@ -1502,7 +1525,7 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
float **lPtr = (float **)pointers;
|
||||
FxI32 tCount = 3;
|
||||
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
|
||||
FxI32 yindex = xindex + 1;
|
||||
|
||||
@@ -1519,8 +1542,10 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
/* gc->state.invalid |= fbzModeBIT; */
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
/* backfaced or zero area */
|
||||
while (tCount <= count) {
|
||||
@@ -1684,7 +1709,7 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
|
||||
float *v[3];
|
||||
FxBool flip = FXFALSE;
|
||||
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
|
||||
if (sCount <= 2) return;
|
||||
|
||||
@@ -1695,8 +1720,10 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
|
||||
gc->state.shadow.fbzMode &= ~(SST_ZAWRMASK);
|
||||
/* gc->state.invalid |= fbzModeBIT; */
|
||||
GR_FLUSH_STATE();
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
sCount-=2;
|
||||
if (type == kSetupFan) {
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:56 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -94,6 +97,7 @@
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#include "config.h"
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
|
||||
@@ -19,6 +19,24 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.2.2.3 2000/11/20 16:30:11 alanh
|
||||
** cast &ADY and &DX to int* instead of long*
|
||||
**
|
||||
** Revision 1.2.2.2 2000/11/02 10:27:24 alanh
|
||||
** Commit some of Dave Mosberger's code:
|
||||
**
|
||||
** If mode is not zero, initialize "stride" to the
|
||||
** number of floats that corresponds to the size of a pointer (1 on a
|
||||
** 32-bit platform, 2 on a 64-bit platform). This code works
|
||||
** properly as long as sizeof(void*)==N*sizeof(float) for some
|
||||
** integer constant N.
|
||||
**
|
||||
** Revision 1.2.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.2 2000/02/15 22:35:58 joseph
|
||||
** Changes to support FreeBSD (patch submitted by Doug Rabson)
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:56 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
@@ -166,7 +184,9 @@
|
||||
|
||||
#include <memory.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
@@ -229,14 +249,15 @@ GR_ENTRY(grDrawPoint, void, (const void *p))
|
||||
|
||||
GR_ENTRY(grDrawLine, void, (const void *a, const void *b))
|
||||
{
|
||||
const void *vertices[2] = {a, b};
|
||||
#define FN_NAME "grDrawLine"
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 91);
|
||||
GDBG_INFO_MORE(gc->myLevel, "(a = 0x%x, b = 0x%x)\n", a, b);
|
||||
|
||||
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)
|
||||
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
|
||||
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, vertices);
|
||||
else
|
||||
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
|
||||
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, vertices);
|
||||
#undef FN_NAME
|
||||
} /* grDrawLine */
|
||||
|
||||
@@ -285,7 +306,7 @@ GR_ENTRY(grDrawTriangle, void, (const void *a, const void *b, const void *c))
|
||||
}
|
||||
lostContext: ; /* <-- my, that's odd, but MSVC was insistent */
|
||||
}
|
||||
#elif defined( __linux__ ) || defined(__FreeBSD__)
|
||||
#elif (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
{
|
||||
GR_BEGIN_NOFIFOCHECK("grDrawTriangle",92);
|
||||
TRISETUP(a, b, c);
|
||||
@@ -320,7 +341,7 @@ GR_ENTRY(grDrawTriangle, void, (const void *a, const void *b, const void *c))
|
||||
GR_INC_SIZE(sizeof(FxU32))
|
||||
|
||||
#define DA_END \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)packetPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = packetPtr; \
|
||||
FIFO_ASSERT(); \
|
||||
}
|
||||
@@ -345,7 +366,7 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
* except the data set up is from the pointer array and
|
||||
* its data layout
|
||||
*/
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
|
||||
/* we snap to an integer by adding a large enough number that it
|
||||
* shoves all fraction bits off the right side of the mantissa.
|
||||
@@ -379,8 +400,10 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
*/
|
||||
#define POINTS_BUFFER 100
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
if (gc->state.grCoordinateSpaceArgs.coordinate_space_mode == GR_WINDOW_COORDS) {
|
||||
while (count > 0) {
|
||||
@@ -570,7 +593,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
int j;
|
||||
FxI32 sCount;
|
||||
FxU32 vertexParamOffset;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
|
||||
#define DX gc->pool.ftemp1
|
||||
#define ADY gc->pool.ftemp2
|
||||
@@ -586,8 +609,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
|
||||
#define LINES_BUFFER 100
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
if (ltype == GR_LINES)
|
||||
sCount = count >> 1; /* line list */
|
||||
else
|
||||
@@ -615,16 +641,16 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
|
||||
i = *(long *)&ADY;
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
float *tv;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(long *)&ADY) = i;
|
||||
(*(int *)&ADY) = i;
|
||||
}
|
||||
|
||||
DX = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
|
||||
j = *(long *)&DX;
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
@@ -794,7 +820,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = tmp2 - tmp1;
|
||||
i = *(long *)&ADY;
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
float *tv;
|
||||
owa = oowb; owb = oowa;
|
||||
@@ -802,7 +828,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
fby = tmp1;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(long *)&ADY) = i;
|
||||
(*(int *)&ADY) = i;
|
||||
}
|
||||
fax = FARRAY(a, gc->state.vData.vertexInfo.offset)
|
||||
*owa*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
@@ -810,7 +836,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
*owb*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
|
||||
DX = fbx - fax;
|
||||
j = *(long *)&DX;
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
@@ -898,7 +924,7 @@ _grDrawTriangles_Default(FxI32 mode, FxI32 count, void *pointers)
|
||||
vSize,
|
||||
#endif
|
||||
k;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
float *vPtr;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
|
||||
@@ -914,8 +940,10 @@ _grDrawTriangles_Default(FxI32 mode, FxI32 count, void *pointers)
|
||||
GDBG_INFO(110, "%s: paramMask = 0x%x\n", FN_NAME, gc->cmdTransportInfo.paramMask);
|
||||
#endif
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
|
||||
gc->stats.trisProcessed+=(count/3);
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.2.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.2 2000/02/15 22:35:58 joseph
|
||||
** Changes to support FreeBSD (patch submitted by Doug Rabson)
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:56 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
@@ -150,7 +156,10 @@
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
@@ -237,7 +246,7 @@ int _guHeapCheck( void )
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(__linux__) && !defined(__FreeBSD__)
|
||||
#if !(GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
void
|
||||
i3(void)
|
||||
{
|
||||
@@ -277,7 +286,7 @@ _grAssert(char *exp, char *fileName, int lineNo)
|
||||
|
||||
gdbg_printf("Command Fifo:\n");
|
||||
gdbg_printf("\tSoftware:\n");
|
||||
gdbg_printf("\t\tfifoPtr: 0x%X\n", (FxU32)gc->cmdTransportInfo.fifoPtr - (FxU32) gc->rawLfb);
|
||||
gdbg_printf("\t\tfifoPtr: 0x%X\n", (AnyPtr)gc->cmdTransportInfo.fifoPtr - (AnyPtr) gc->rawLfb);
|
||||
gdbg_printf("\t\tfifoOffset: 0x%X\n", gc->cmdTransportInfo.fifoOffset);
|
||||
gdbg_printf("\t\tfifoEnd: 0x%X\n", gc->cmdTransportInfo.fifoEnd - gc->rawLfb);
|
||||
gdbg_printf("\t\tfifoSize: 0x%X\n", gc->cmdTransportInfo.fifoSize);
|
||||
@@ -287,7 +296,7 @@ _grAssert(char *exp, char *fileName, int lineNo)
|
||||
|
||||
if ( !gc->windowed ) {
|
||||
gdbg_printf("\tHardware:\n");
|
||||
gdbg_printf("\t\treadPtrL: 0x%X\n", HW_FIFO_PTR(FXTRUE) - (FxU32)gc->rawLfb);
|
||||
gdbg_printf("\t\treadPtrL: 0x%X\n", HW_FIFO_PTR(FXTRUE) - (AnyPtr)gc->rawLfb);
|
||||
gdbg_printf("\t\tdepth: 0x%X\n", GR_CAGP_GET(depth));
|
||||
gdbg_printf("\t\tholeCount: 0x%X\n", GR_CAGP_GET(holeCount));
|
||||
gdbg_printf("\t\tbaseAddrL: 0x%X\n", GR_CAGP_GET(baseAddrL));
|
||||
@@ -296,7 +305,7 @@ _grAssert(char *exp, char *fileName, int lineNo)
|
||||
gdbg_printf("\t\tStatus: 0x%X\n", GR_GET(hw->status));
|
||||
}
|
||||
}
|
||||
#endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) && USE_PACKET_FIFO */
|
||||
#endif /* USE_PACKET_FIFO */
|
||||
|
||||
gdbg_printf("ABNORMAL TERMINATION\n");
|
||||
|
||||
|
||||
@@ -19,16 +19,23 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.4 2000/11/16 20:25:38 alanh
|
||||
** Revision 1.1.1.1.2.4 2000/11/16 20:25:59 alanh
|
||||
** fix a typo
|
||||
**
|
||||
** Revision 1.3 2000/11/16 18:58:27 alanh
|
||||
** add linux specific grRenderBuffer to fix problems switching between FRONT and
|
||||
** Revision 1.1.1.1.2.3 2000/11/16 18:56:48 alanh
|
||||
** add a linux specific grRenderBuffer to fix switching between FRONT and
|
||||
** BACK buffers.
|
||||
**
|
||||
** Revision 1.1.1.1.2.2 2000/11/14 14:11:19 alanh
|
||||
** merge in trunk updates, fixup pci code, and fix texus2 code pointers.
|
||||
**
|
||||
**
|
||||
** Revision 1.2 2000/10/27 07:54:51 alanh
|
||||
** fix readPtr0/1 -> depth0/1 check
|
||||
**
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:45:01 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
@@ -1087,8 +1094,8 @@ GR_ENTRY(grBufferSwap, void, (FxU32 swapInterval))
|
||||
for ( i = 0; i < MAX_BUFF_PENDING && j == -1; i++) {
|
||||
if (gc->bufferSwaps[i] == 0xffffffff) {
|
||||
gc->bufferSwaps[i] =
|
||||
(FxU32) gc->cmdTransportInfo.fifoPtr -
|
||||
(FxU32) gc->cmdTransportInfo.fifoStart;
|
||||
(AnyPtr) gc->cmdTransportInfo.fifoPtr -
|
||||
(AnyPtr) gc->cmdTransportInfo.fifoStart;
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
@@ -1189,8 +1196,8 @@ GR_ENTRY(grDRIBufferSwap, void, (FxU32 swapInterval))
|
||||
for ( i = 0; i < MAX_BUFF_PENDING && j == -1; i++) {
|
||||
if (gc->bufferSwaps[i] == 0xffffffff) {
|
||||
gc->bufferSwaps[i] =
|
||||
(FxU32) gc->cmdTransportInfo.fifoPtr -
|
||||
(FxU32) gc->cmdTransportInfo.fifoStart;
|
||||
(AnyPtr) gc->cmdTransportInfo.fifoPtr -
|
||||
(AnyPtr) gc->cmdTransportInfo.fifoStart;
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
@@ -1232,7 +1239,7 @@ GR_ENTRY(grDRIBufferSwap, void, (FxU32 swapInterval))
|
||||
REG_GROUP_SET_WAX(hw, srcXY, x | ((driInfo.y+(y-driInfo.y))<<16));
|
||||
REG_GROUP_SET_WAX(hw, dstSize, (w&0x1FFF)|((h&0x1FFF)<<16));
|
||||
REG_GROUP_SET_WAX(hw, dstXY, (x&0x1FFF) | ((y&0x1FFF)<<16));
|
||||
REG_GROUP_SET_WAX(hw, command, (0xCC<<24) | 0x1 | BIT(8));
|
||||
REG_GROUP_SET_WAX(hw, command, (0xCCu<<24) | 0x1 | BIT(8));
|
||||
REG_GROUP_END();
|
||||
} while (cnt);
|
||||
|
||||
@@ -2164,7 +2171,7 @@ GR_ENTRY(grGlideShutdown, void, (void))
|
||||
* continuing so that any internal glide calls have a valid
|
||||
* gc from tls via GR_DCL_GC. F*ck this up at your own peril.
|
||||
*/
|
||||
setThreadValue((FxU32)gc);
|
||||
setThreadValue((AnyPtr)gc);
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
|
||||
/* Flush any remaining commands and cleanup any per gc state */
|
||||
grSurfaceReleaseContext((GrContext_t)gc);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:45:02 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -709,7 +712,7 @@ _grLfbWriteRegion(FxBool pixPipelineP,
|
||||
case GR_LFB_SRC_FMT_ZA16:
|
||||
dstData = (FxU32*)(((FxU16*)dstData) + dst_x);
|
||||
length = src_width * 2;
|
||||
aligned = !((int)dstData&0x2);
|
||||
aligned = !((long)dstData&0x2);
|
||||
srcJump = src_stride - length;
|
||||
dstJump = info.strideInBytes - length;
|
||||
if (aligned) {
|
||||
@@ -914,7 +917,7 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
|
||||
length = src_width * 2;
|
||||
dstJump = dst_stride - length;
|
||||
srcJump = info.strideInBytes - length;
|
||||
aligned = !((int)srcData&0x2);
|
||||
aligned = !((long)srcData&0x2);
|
||||
odd = (src_y+src_height) & 0x1;
|
||||
|
||||
if (aligned) {
|
||||
|
||||
@@ -52,11 +52,11 @@ extern "C" {
|
||||
typedef FxU32 GrColor_t;
|
||||
typedef FxU8 GrAlpha_t;
|
||||
typedef FxU32 GrMipMapId_t;
|
||||
#ifdef __linux__
|
||||
#if defined(DRI_BUILD)
|
||||
typedef FxU32 GrStipplePattern_t;
|
||||
#endif /* __linux__ */
|
||||
#endif
|
||||
typedef FxU8 GrFog_t;
|
||||
typedef FxU32 GrContext_t;
|
||||
typedef AnyPtr GrContext_t;
|
||||
typedef int (FX_CALL *GrProc)();
|
||||
|
||||
/*
|
||||
@@ -253,12 +253,12 @@ typedef FxI32 GrDitherMode_t;
|
||||
#define GR_DITHER_2x2 0x1
|
||||
#define GR_DITHER_4x4 0x2
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(DRI_BUILD)
|
||||
typedef FxI32 GrStippleMode_t;
|
||||
#define GR_STIPPLE_DISABLE 0x0
|
||||
#define GR_STIPPLE_PATTERN 0x1
|
||||
#define GR_STIPPLE_ROTATE 0x2
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
typedef FxI32 GrFogMode_t;
|
||||
#define GR_FOG_DISABLE 0x0
|
||||
@@ -709,13 +709,13 @@ grDisableAllEffects( void );
|
||||
FX_ENTRY void FX_CALL
|
||||
grDitherMode( GrDitherMode_t mode );
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(DRI_BUILD)
|
||||
FX_ENTRY void FX_CALL
|
||||
grStippleMode( GrStippleMode_t mode );
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grStipplePattern( GrStipplePattern_t mode );
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grFogColorValue( GrColor_t fogcolor );
|
||||
|
||||
@@ -19,6 +19,15 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.2 2001/03/05 15:04:08 alanh
|
||||
** set FX_GLIDE_SWAPINTERVAL to 0 by default
|
||||
**
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 10 5/21/99 12:48p Stb_gkincade
|
||||
** Syntax correction
|
||||
@@ -327,6 +336,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -415,14 +425,14 @@ static GrTriSetupProc _triSetupProcs[][2][2][2] =
|
||||
{
|
||||
/* Window coords */
|
||||
{
|
||||
{ _trisetup_null, _trisetup_null },
|
||||
{ _trisetup_null, _trisetup_null },
|
||||
{ (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
|
||||
{ (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
|
||||
},
|
||||
|
||||
/* Clip coordinates */
|
||||
{
|
||||
{ _trisetup_null, _trisetup_null },
|
||||
{ _trisetup_null, _trisetup_null },
|
||||
{ (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
|
||||
{ (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -886,7 +896,7 @@ _GlideInitEnvironment(void)
|
||||
GDBG_INFO(80," nAuxBuffer: %d\n",_GlideRoot.environment.nAuxBuffer);
|
||||
_GlideRoot.environment.swFifoLWM = GLIDE_GETENV("FX_GLIDE_LWM", -1L);
|
||||
GDBG_INFO(80," swFifoLWM: %d\n",_GlideRoot.environment.swFifoLWM);
|
||||
_GlideRoot.environment.swapInterval = GLIDE_GETENV("FX_GLIDE_SWAPINTERVAL", -1L);
|
||||
_GlideRoot.environment.swapInterval = GLIDE_GETENV("FX_GLIDE_SWAPINTERVAL", 0);
|
||||
GDBG_INFO(80," swapInterval: %d\n",_GlideRoot.environment.swapInterval);
|
||||
_GlideRoot.environment.snapshot = GLIDE_GETENV("FX_SNAPSHOT", -1L);
|
||||
GDBG_INFO(80," snapshot: %d\n",_GlideRoot.environment.snapshot);
|
||||
@@ -1021,7 +1031,7 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
GR_DCL_GC;
|
||||
|
||||
/* If there is no current gc in tls then set the current context. */
|
||||
if (gc == NULL) setThreadValue((FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst]);
|
||||
if (gc == NULL) setThreadValue((AnyPtr)&_GlideRoot.GCs[_GlideRoot.current_sst]);
|
||||
}
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 11 6/24/99 1:46a Stb_mmcclure
|
||||
** Modifications to fix PRS 6627. Added hwcUnmapMemory9x for revised 9x
|
||||
@@ -171,6 +174,7 @@
|
||||
*/
|
||||
|
||||
/* Surface extension currently only really works on Windows anyway */
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -154,6 +157,7 @@
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:45:01 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 11 6/24/99 1:28a Stb_mmcclure
|
||||
** Modifications to fix PRS 6627. Added hwcUnmapMemory9x for revised 9x
|
||||
@@ -753,8 +756,8 @@ initGC ( GrGC *gc )
|
||||
gc->bufferSwaps[t] = 0xffffffff;
|
||||
}
|
||||
|
||||
gc->bufferSwaps[0] = ((FxU32) gc->cmdTransportInfo.fifoPtr -
|
||||
(FxU32) gc->cmdTransportInfo.fifoStart);
|
||||
gc->bufferSwaps[0] = ((AnyPtr) gc->cmdTransportInfo.fifoPtr -
|
||||
(AnyPtr) gc->cmdTransportInfo.fifoStart);
|
||||
|
||||
gc->swapsPending = 1;
|
||||
|
||||
@@ -943,7 +946,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
* current gc. This gc is valid for all threads in the fullscreen
|
||||
* context.
|
||||
*/
|
||||
setThreadValue( (FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
setThreadValue( (AnyPtr)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
|
||||
{
|
||||
/* Partial Argument Validation */
|
||||
@@ -1073,12 +1076,12 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
for (buffer = 0; buffer < nColBuffers; buffer++) {
|
||||
gc->buffers[buffer] = bufInfo->colBuffStart[buffer];
|
||||
GDBG_INFO(80, "Buffer %d: Start: 0x%x\n", buffer, gc->buffers[buffer]);
|
||||
gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr[buffer];
|
||||
gc->lfbBuffers[buffer] = (AnyPtr)gc->rawLfb + bufInfo->lfbBuffAddr[buffer];
|
||||
}
|
||||
if (nAuxBuffers != 0) {
|
||||
gc->buffers[buffer] = bufInfo->auxBuffStart;
|
||||
GDBG_INFO(80, "Aux Buffer: Start: 0x%x\n", gc->buffers[buffer]);
|
||||
gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr[buffer];
|
||||
gc->lfbBuffers[buffer] = (AnyPtr)gc->rawLfb + bufInfo->lfbBuffAddr[buffer];
|
||||
}
|
||||
|
||||
vInfo->hWnd = gc->grHwnd;
|
||||
@@ -1187,7 +1190,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
gc->tBuffer.bufBPP = 0xffffffff; /* Don't matter to me */
|
||||
|
||||
GDBG_INFO(1, "autoBump: 0x%x\n", _GlideRoot.environment.autoBump);
|
||||
if (gc->cmdTransportInfo.autoBump = _GlideRoot.environment.autoBump) {
|
||||
if ((gc->cmdTransportInfo.autoBump = _GlideRoot.environment.autoBump)!=0) {
|
||||
if (!hwcInitFifo( bInfo, gc->cmdTransportInfo.autoBump)) {
|
||||
hwcRestoreVideo(bInfo);
|
||||
GrErrorCallback(hwcGetErrorString(), FXFALSE);
|
||||
@@ -1223,7 +1226,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
gc->tmu_state[0].total_mem = gc->tramSize;
|
||||
#else
|
||||
/* gc->fbOffset = (FxU32)fxHalFbiGetMemory((SstRegs*)gc->reg_ptr); */
|
||||
gc->fbOffset = (FxU32)gc->rawLfb;
|
||||
gc->fbOffset = (AnyPtr)gc->rawLfb;
|
||||
gc->tmuMemInfo[0].tramOffset = 0x200000;
|
||||
gc->tmuMemInfo[0].tramSize = 0x200000;
|
||||
gc->tmuMemInfo[1].tramOffset = gc->tmuMemInfo[0].tramSize + gc->tmuMemInfo[0].tramOffset;
|
||||
@@ -1437,7 +1440,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
gcFifo->fifoPtr );
|
||||
|
||||
#ifdef __linux__
|
||||
_grImportFifo(*driInfo.fifoPtr, *driInfo.fifoRead);
|
||||
_grImportFifo((AnyPtr)*driInfo.fifoPtr, (AnyPtr)*driInfo.fifoRead);
|
||||
#endif
|
||||
|
||||
/* The hw is now in a usable state from the fifo macros.
|
||||
@@ -1588,7 +1591,7 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
* the tls gc explicitly otherwise other whacky-ness (read 'random
|
||||
* crashes' will ensue).
|
||||
*/
|
||||
setThreadValue((FxU32)gc);
|
||||
setThreadValue((AnyPtr)gc);
|
||||
if ((gc != NULL) && gc->open) grFlush();
|
||||
|
||||
/* Make sure that the user specified gc is not whacked */
|
||||
@@ -1853,8 +1856,8 @@ GR_ENTRY(grFlush, void, (void))
|
||||
if ( gc->windowed ) {
|
||||
#ifdef GLIDE_INIT_HWC
|
||||
GDBG_INFO(gc->myLevel + 200, FN_NAME": cmdSize(0x%X)\n",
|
||||
((FxU32)gc->cmdTransportInfo.fifoPtr -
|
||||
(FxU32)gc->cmdTransportInfo.hwcFifoInfo.cmdBuf.baseAddr));
|
||||
((AnyPtr)gc->cmdTransportInfo.fifoPtr -
|
||||
(AnyPtr)gc->cmdTransportInfo.hwcFifoInfo.cmdBuf.baseAddr));
|
||||
#endif
|
||||
_FifoFlush();
|
||||
} else if (!gc->cmdTransportInfo.autoBump) {
|
||||
|
||||
@@ -19,6 +19,18 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.1 2000/11/02 10:27:24 alanh
|
||||
** Commit some of Dave Mosberger's code:
|
||||
**
|
||||
** If mode is not zero, initialize "stride" to the
|
||||
** number of floats that corresponds to the size of a pointer (1 on a
|
||||
** 32-bit platform, 2 on a 64-bit platform). This code works
|
||||
** properly as long as sizeof(void*)==N*sizeof(float) for some
|
||||
** integer constant N.
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -116,6 +128,7 @@
|
||||
**
|
||||
*/
|
||||
#ifdef GLIDE3
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -146,7 +159,7 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
|
||||
** simplified code
|
||||
*/
|
||||
FxU32 vSize;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
|
||||
|
||||
@@ -156,8 +169,10 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
vSize = gc->state.vData.vSize;
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof (float *) / sizeof (float);
|
||||
|
||||
/* Draw the first (or possibly only) set. This is necessary because
|
||||
the packet is 3_BDDDDDD, and in the next set, the packet is
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -244,6 +247,7 @@
|
||||
**
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 5 5/26/99 9:22a Stb_acampbel
|
||||
** Removed an extra string format parameter from a debug output statement
|
||||
@@ -256,6 +262,7 @@
|
||||
**
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
@@ -414,7 +421,7 @@ GR_DDFUNC(_grTexDownloadPalette,
|
||||
while(i < start + slopCount) {
|
||||
FxU32 entry;
|
||||
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | (pal->data[i] & 0xFFFFFF));
|
||||
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
|
||||
@@ -432,7 +439,7 @@ GR_DDFUNC(_grTexDownloadPalette,
|
||||
while(i < endIndex) {
|
||||
FxU32 entry;
|
||||
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | (pal->data[i] & 0xFFFFFF));
|
||||
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
|
||||
@@ -451,7 +458,7 @@ GR_DDFUNC(_grTexDownloadPalette,
|
||||
while(i <= end) {
|
||||
FxU32 entry;
|
||||
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | (pal->data[i] & 0xFFFFFF));
|
||||
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
/* NOTE: This file is compiled to naught if we aren't
|
||||
running under Win32 */
|
||||
|
||||
#if defined( __WIN32__ )
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -39,6 +38,8 @@
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
#if defined( __WIN32__ )
|
||||
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@@ -63,13 +64,13 @@ initThreadStorage( void )
|
||||
|
||||
} /* initThreadStorage */
|
||||
|
||||
void setThreadValue( FxU32 value ) {
|
||||
void setThreadValue( AnyPtr value ) {
|
||||
GR_CHECK_F( "setThreadValue", !threadInit, "Thread storage not initialized\n" );
|
||||
TlsSetValue( _GlideRoot.tlsIndex, (void*)value );
|
||||
}
|
||||
|
||||
#pragma warning (4:4035) /* No return value */
|
||||
FxU32 getThreadValueSLOW( void ) {
|
||||
AnyPtr getThreadValueSLOW( void ) {
|
||||
GR_CHECK_F( "getThreadValue", !threadInit, "Thread storage not initialized\n" );
|
||||
|
||||
#if 0
|
||||
@@ -104,30 +105,20 @@ void endCriticalSection( void ) {
|
||||
LeaveCriticalSection( &criticalSectionObject );
|
||||
}
|
||||
|
||||
#elif defined(macintosh)
|
||||
#elif (GLIDE_PLATFORM & GLIDE_OS_MACOS)
|
||||
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
FxU32 _threadValueMacOS;
|
||||
AnyPtr _threadValueMacOS;
|
||||
|
||||
void initThreadStorage(void)
|
||||
{
|
||||
}
|
||||
|
||||
void setThreadValue( FxU32 value )
|
||||
void setThreadValue( AnyPtr value )
|
||||
{
|
||||
_threadValueMacOS = value;
|
||||
}
|
||||
|
||||
FxU32 getThreadValueSLOW( void )
|
||||
AnyPtr getThreadValueSLOW( void )
|
||||
{
|
||||
return _threadValueMacOS;
|
||||
}
|
||||
@@ -144,31 +135,20 @@ void endCriticalSection(void)
|
||||
{
|
||||
}
|
||||
|
||||
#elif defined(__linux__) || defined(__FreeBSD__)
|
||||
#elif (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
|
||||
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
FxU32 threadValueLinux;
|
||||
AnyPtr threadValueLinux;
|
||||
|
||||
void initThreadStorage(void)
|
||||
{
|
||||
}
|
||||
|
||||
void setThreadValue( FxU32 value )
|
||||
void setThreadValue( AnyPtr value )
|
||||
{
|
||||
threadValueLinux = value;
|
||||
}
|
||||
|
||||
FxU32 getThreadValueSLOW( void )
|
||||
AnyPtr getThreadValueSLOW( void )
|
||||
{
|
||||
return threadValueLinux;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -66,6 +69,7 @@
|
||||
|
||||
#include <3dfx.h>
|
||||
|
||||
#include "config.h"
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -161,6 +164,7 @@
|
||||
**
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ VINCLUDES = $(HAL_CSIM_INCLUDES)
|
||||
#
|
||||
# Special rules for assembly files.
|
||||
#
|
||||
PREPROCESSOR=/lib/cpp -$$ -I.
|
||||
xdraw2.o : xdraw2.S xdraw2.inc.S fxgasm.h
|
||||
$(CC) $(AFLAGS) -c -o $@ xdraw2.S
|
||||
|
||||
@@ -166,6 +167,18 @@ xtexdl_3dnow.o: xtexdl.S fxgasm.h
|
||||
|
||||
endif
|
||||
|
||||
if FX_GLIDE_C_CPU_DETECT
|
||||
CPUSOURCES = cpudtect.c
|
||||
else
|
||||
CPUSOURCES = cpudtect.S
|
||||
|
||||
cpudtect.o cpudtect.lo: cpudtect.S
|
||||
$(PREPROCESSOR) -DUSE_PACKET_FIFO=1 $< > $*.tmp.s
|
||||
$(CC) $(AFLAGS) -c -o $*.o $*.tmp.s
|
||||
$(CP) $*.o $*.lo
|
||||
$(RM) -f $*.tmp.s
|
||||
endif
|
||||
|
||||
if DRI_BUILD
|
||||
gglide.c: $(top_srcdir)/h3/glide3/src/gglide.c.dri
|
||||
rm -f gglide.c
|
||||
@@ -217,7 +230,7 @@ libglide3_la_SOURCES = fxinline.h fxgasm.h \
|
||||
gbanner.c gerror.c gaa.c gdraw.c \
|
||||
gglide.c distate.c gstrip.c distrip.c \
|
||||
diget.c glfb.c gsst.c gtex.c gtexdl.c \
|
||||
fifo.c xtexdl_def.c cpudtect.S \
|
||||
fifo.c xtexdl_def.c $(CPUSOURCES) \
|
||||
$(VGLIDE_SRC) $(ASMTRISETUP) $(GL_AMD3D_SRC)
|
||||
|
||||
libglide3_la_LDFLAGS = -version-info 13:0:10
|
||||
|
||||
@@ -22,6 +22,12 @@
|
||||
/* $Header$ */
|
||||
/* $Revision$ */
|
||||
/* $Log$
|
||||
/* Revision 1.3 2000/10/20 19:07:00 billwhite
|
||||
/* 1.) Added changes for AMD 3DNow instructions in h5/glide3 and
|
||||
/* h3/glide3.
|
||||
/* 2.) Fixed a typographical error in configure.in. The default
|
||||
/* texture utility library is texus2, not texus.
|
||||
/*
|
||||
/* Revision 1.2 2000/02/15 22:35:59 joseph
|
||||
/* Changes to support FreeBSD (patch submitted by Doug Rabson)
|
||||
/*
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.2.1 2000/08/30 08:47:03 alanh
|
||||
** Changes for Voodoo3 for 64bit architectures
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:45:00 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -46,6 +52,7 @@
|
||||
**
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
@@ -213,7 +220,7 @@ _grTexDownload_Default_8_4(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
|
||||
const FxU32 t0 = *(const FxU32*)src8;
|
||||
|
||||
GDBG_INFO(195, "s = %d, t= %d, address = 0x%x\n", s, t,
|
||||
(FxU32) tex_address - (FxU32) gc->tex_ptr + 0x200000);
|
||||
(AnyPtr) tex_address - (AnyPtr) gc->tex_ptr + 0x200000);
|
||||
|
||||
LINEAR_WRITE_SET_8(tex_address, t0);
|
||||
|
||||
@@ -251,7 +258,7 @@ _grTexDownload_Default_8_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
|
||||
t1 = *(const FxU32*)(src8 + 4);
|
||||
|
||||
GDBG_INFO(195, "s = %d, t= %d, address = 0x%x\n", s, t,
|
||||
(FxU32) tex_address - (FxU32) gc->tex_ptr + 0x200000);
|
||||
(AnyPtr) tex_address - (AnyPtr) gc->tex_ptr + 0x200000);
|
||||
|
||||
LINEAR_WRITE_SET_8(tex_address + 0, t0);
|
||||
LINEAR_WRITE_SET_8(tex_address + 4, t1);
|
||||
@@ -351,7 +358,7 @@ _grTexDownload_Default_16_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
|
||||
const FxU32 t1 = *(const FxU32*)(src16 + 2);
|
||||
|
||||
GDBG_INFO(195, "s = %d, t= %d, address = 0x%x\n", s, t,
|
||||
(FxU32) tex_address - (FxU32) gc->tex_ptr + 0x200000);
|
||||
(AnyPtr) tex_address - (AnyPtr) gc->tex_ptr + 0x200000);
|
||||
|
||||
LINEAR_WRITE_SET_16(tex_address + 0, t0);
|
||||
LINEAR_WRITE_SET_16(tex_address + 4, t1);
|
||||
|
||||
@@ -147,9 +147,18 @@ fxHalInitVideoOverlaySurface(
|
||||
extern int DRIlock;
|
||||
|
||||
// Here are the macro defines for talking to hardware
|
||||
#ifdef __alpha__
|
||||
extern unsigned char _fxget8(unsigned char *);
|
||||
extern unsigned short _fxget16(unsigned short *);
|
||||
extern unsigned int _fxget32(unsigned int *);
|
||||
#define GET8(s) _fxget8((unsigned byte *)&s);
|
||||
#define GET16(s) _fxget16((unsigned short *)&s);
|
||||
#define GET(s) _fxget32((unsigned int *)&s);
|
||||
#else
|
||||
#define GET8(s) s
|
||||
#define GET16(s) s
|
||||
#define GET(s) s
|
||||
#endif
|
||||
#define SET8(d,s) d = s
|
||||
#define SET16(d,s) d = s
|
||||
#define SET(d,s) d = s
|
||||
|
||||
@@ -56,11 +56,21 @@
|
||||
|
||||
// this crazy macro tests the sign bit of a float by loading it into
|
||||
// an integer register and then testing the sign bit of the integer
|
||||
#if defined(__LP64__)
|
||||
/* On IA-64, it's faster to do this the obvious way... -davidm 00/08/09 */
|
||||
#define FLOAT_ISNEG(f) ((f) < 0.0)
|
||||
#else
|
||||
#define FLOAT_ISNEG(f) ((*(int *)(&(f))) < 0)
|
||||
#endif
|
||||
|
||||
// these crazy macros returns the sign of a number (1 if >= 0; -1 if < 0)
|
||||
#if defined(__LP64__)
|
||||
#define ISIGN(x) ((x) >= 0 ? 1 : -1)
|
||||
#define FSIGN(f) ((f) >= 0.0 ? 1 : -1)
|
||||
#else
|
||||
#define ISIGN(x) (((x) | 0x40000000L) >> 30)
|
||||
#define FSIGN(f) ISIGN(*(long *)&f)
|
||||
#endif
|
||||
|
||||
#define BIT(n) (1UL<<(n))
|
||||
#define SST_MASK(n) (0xFFFFFFFFL >> (32-(n)))
|
||||
@@ -1257,9 +1267,9 @@
|
||||
|
||||
//----------------- useful addressing macros -----------------------
|
||||
// return pointer to SST at specified WRAP, CHIP, or TREX
|
||||
#define SST_WRAP(sst,n) ((SstRegs *)((n)*0x4000+(FxI32)(sst)))
|
||||
#define SST_CHIP(sst,n) ((SstRegs *)((n)*0x400+(FxI32)(sst)))
|
||||
#define SST_TMU(sst,n) ((SstRegs *)((0x800<<(n))+(FxI32)(sst)))
|
||||
#define SST_WRAP(sst,n) ((SstRegs *)((n)*0x4000+(AnyPtr)(sst)))
|
||||
#define SST_CHIP(sst,n) ((SstRegs *)((n)*0x400+(AnyPtr)(sst)))
|
||||
#define SST_TMU(sst,n) ((SstRegs *)((0x800<<(n))+(AnyPtr)(sst)))
|
||||
#define SST_TREX(sst,n) SST_TMU(sst,n)
|
||||
|
||||
// offsets from the base of memBaseAddr0
|
||||
@@ -1304,7 +1314,7 @@
|
||||
|
||||
#define SST_IS_REGISTER_ADDR(a) ( (a) >= SST_IO_OFFSET && (a) < SST_TEX_OFFSET )
|
||||
|
||||
#define SST_BASE_ADDRESS(sst) ((FxI32)(sst)-SST_3D_OFFSET)
|
||||
#define SST_BASE_ADDRESS(sst) ((AnyPtr)(sst)-SST_3D_OFFSET)
|
||||
#define SST_IO_ADDRESS(sst) (SST_IO_OFFSET+SST_BASE_ADDRESS(sst))
|
||||
#define SST_CMDAGP_ADDRESS(sst) (SST_CMDAGP_OFFSET+SST_BASE_ADDRESS(sst))
|
||||
#define SST_GUI_ADDRESS(sst) (SST_2D_OFFSET+SST_BASE_ADDRESS(sst))
|
||||
|
||||
@@ -208,11 +208,19 @@ typedef volatile struct sstgregs { // THE 2D CHIP
|
||||
#ifndef _H2INC
|
||||
// STB End changes
|
||||
|
||||
#if defined(__alpha__) || defined(__LP64__)
|
||||
typedef unsigned int Reg32u;
|
||||
typedef int Reg32;
|
||||
#else
|
||||
typedef unsigned long Reg32u;
|
||||
typedef long Reg32;
|
||||
#endif
|
||||
|
||||
//----------------- SST chip 3D layout -------------------------
|
||||
// registers are in groups of 8 for easy decode
|
||||
typedef struct vertex_Rec {
|
||||
unsigned long x; // 12.4 format
|
||||
unsigned long y; // 12.4
|
||||
Reg32u x; // 12.4 format
|
||||
Reg32u y; // 12.4
|
||||
} vtxRec;
|
||||
|
||||
typedef volatile struct sstregs { // THE 3D CHIP
|
||||
@@ -223,118 +231,118 @@ typedef volatile struct sstregs { // THE 3D CHIP
|
||||
vtxRec vB;
|
||||
vtxRec vC;
|
||||
|
||||
long r; // 12.12 Parameters
|
||||
long g; // 12.12
|
||||
long b; // 12.12
|
||||
long z; // 20.12
|
||||
long a; // 12.12
|
||||
long s; // 14.18
|
||||
long t; // 14.18
|
||||
long w; // 2.30
|
||||
Reg32 r; // 12.12 Parameters
|
||||
Reg32 g; // 12.12
|
||||
Reg32 b; // 12.12
|
||||
Reg32 z; // 20.12
|
||||
Reg32 a; // 12.12
|
||||
Reg32 s; // 14.18
|
||||
Reg32 t; // 14.18
|
||||
Reg32 w; // 2.30
|
||||
|
||||
long drdx; // X Gradients
|
||||
long dgdx;
|
||||
long dbdx;
|
||||
long dzdx;
|
||||
long dadx;
|
||||
long dsdx;
|
||||
long dtdx;
|
||||
long dwdx;
|
||||
Reg32 drdx; // X Gradients
|
||||
Reg32 dgdx;
|
||||
Reg32 dbdx;
|
||||
Reg32 dzdx;
|
||||
Reg32 dadx;
|
||||
Reg32 dsdx;
|
||||
Reg32 dtdx;
|
||||
Reg32 dwdx;
|
||||
|
||||
long drdy; // Y Gradients
|
||||
long dgdy;
|
||||
long dbdy;
|
||||
long dzdy;
|
||||
long dady;
|
||||
long dsdy;
|
||||
long dtdy;
|
||||
long dwdy;
|
||||
Reg32 drdy; // Y Gradients
|
||||
Reg32 dgdy;
|
||||
Reg32 dbdy;
|
||||
Reg32 dzdy;
|
||||
Reg32 dady;
|
||||
Reg32 dsdy;
|
||||
Reg32 dtdy;
|
||||
Reg32 dwdy;
|
||||
|
||||
unsigned long triangleCMD; // execute a triangle command (float)
|
||||
unsigned long reservedA;
|
||||
Reg32u triangleCMD; // execute a triangle command (float)
|
||||
Reg32u reservedA;
|
||||
vtxRec FvA; // floating point version
|
||||
vtxRec FvB;
|
||||
vtxRec FvC;
|
||||
|
||||
long Fr; // floating point version
|
||||
long Fg;
|
||||
long Fb;
|
||||
long Fz;
|
||||
long Fa;
|
||||
long Fs;
|
||||
long Ft;
|
||||
long Fw;
|
||||
Reg32 Fr; // floating point version
|
||||
Reg32 Fg;
|
||||
Reg32 Fb;
|
||||
Reg32 Fz;
|
||||
Reg32 Fa;
|
||||
Reg32 Fs;
|
||||
Reg32 Ft;
|
||||
Reg32 Fw;
|
||||
|
||||
long Fdrdx;
|
||||
long Fdgdx;
|
||||
long Fdbdx;
|
||||
long Fdzdx;
|
||||
long Fdadx;
|
||||
long Fdsdx;
|
||||
long Fdtdx;
|
||||
long Fdwdx;
|
||||
Reg32 Fdrdx;
|
||||
Reg32 Fdgdx;
|
||||
Reg32 Fdbdx;
|
||||
Reg32 Fdzdx;
|
||||
Reg32 Fdadx;
|
||||
Reg32 Fdsdx;
|
||||
Reg32 Fdtdx;
|
||||
Reg32 Fdwdx;
|
||||
|
||||
long Fdrdy;
|
||||
long Fdgdy;
|
||||
long Fdbdy;
|
||||
long Fdzdy;
|
||||
long Fdady;
|
||||
long Fdsdy;
|
||||
long Fdtdy;
|
||||
long Fdwdy;
|
||||
Reg32 Fdrdy;
|
||||
Reg32 Fdgdy;
|
||||
Reg32 Fdbdy;
|
||||
Reg32 Fdzdy;
|
||||
Reg32 Fdady;
|
||||
Reg32 Fdsdy;
|
||||
Reg32 Fdtdy;
|
||||
Reg32 Fdwdy;
|
||||
|
||||
unsigned long FtriangleCMD; // execute a triangle command
|
||||
unsigned long fbzColorPath; // color select and combine
|
||||
unsigned long fogMode; // fog Mode
|
||||
unsigned long alphaMode; // alpha Mode
|
||||
unsigned long fbzMode; // framebuffer and Z mode
|
||||
unsigned long lfbMode; // linear framebuffer Mode
|
||||
unsigned long clipLeftRight; // (6)10(6)10
|
||||
unsigned long clipBottomTop; // (6)10(6)10
|
||||
Reg32u FtriangleCMD; // execute a triangle command
|
||||
Reg32u fbzColorPath; // color select and combine
|
||||
Reg32u fogMode; // fog Mode
|
||||
Reg32u alphaMode; // alpha Mode
|
||||
Reg32u fbzMode; // framebuffer and Z mode
|
||||
Reg32u lfbMode; // linear framebuffer Mode
|
||||
Reg32u clipLeftRight; // (6)10(6)10
|
||||
Reg32u clipBottomTop; // (6)10(6)10
|
||||
|
||||
unsigned long nopCMD; // execute a nop command
|
||||
unsigned long fastfillCMD; // execute a fast fill command
|
||||
unsigned long swapbufferCMD;// execute a swapbuffer command
|
||||
unsigned long fogColor; // (8)888
|
||||
unsigned long zaColor; // 8(8)16
|
||||
unsigned long chromaKey; // (8)888
|
||||
unsigned long chromaRange;
|
||||
unsigned long userIntrCmd;
|
||||
Reg32u nopCMD; // execute a nop command
|
||||
Reg32u fastfillCMD; // execute a fast fill command
|
||||
Reg32u swapbufferCMD;// execute a swapbuffer command
|
||||
Reg32u fogColor; // (8)888
|
||||
Reg32u zaColor; // 8(8)16
|
||||
Reg32u chromaKey; // (8)888
|
||||
Reg32u chromaRange;
|
||||
Reg32u userIntrCmd;
|
||||
|
||||
unsigned long stipple; // 32 bits, MSB masks pixels
|
||||
unsigned long c0; // 8.8.8.8 (ARGB)
|
||||
unsigned long c1; // 8.8.8.8 (ARGB)
|
||||
Reg32u stipple; // 32 bits, MSB masks pixels
|
||||
Reg32u c0; // 8.8.8.8 (ARGB)
|
||||
Reg32u c1; // 8.8.8.8 (ARGB)
|
||||
struct { // statistic gathering variables
|
||||
unsigned long fbiPixelsIn;
|
||||
unsigned long fbiChromaFail;
|
||||
unsigned long fbiZfuncFail;
|
||||
unsigned long fbiAfuncFail;
|
||||
unsigned long fbiPixelsOut;
|
||||
Reg32u fbiPixelsIn;
|
||||
Reg32u fbiChromaFail;
|
||||
Reg32u fbiZfuncFail;
|
||||
Reg32u fbiAfuncFail;
|
||||
Reg32u fbiPixelsOut;
|
||||
} stats;
|
||||
|
||||
unsigned long fogTable[32]; // 64 entries, 2 per word, 2 bytes each
|
||||
Reg32u fogTable[32]; // 64 entries, 2 per word, 2 bytes each
|
||||
|
||||
unsigned long reservedB[3];
|
||||
Reg32u reservedB[3];
|
||||
|
||||
unsigned long colBufferAddr;
|
||||
unsigned long colBufferStride;
|
||||
unsigned long auxBufferAddr;
|
||||
unsigned long auxBufferStride;
|
||||
unsigned long reservedC;
|
||||
Reg32u colBufferAddr;
|
||||
Reg32u colBufferStride;
|
||||
Reg32u auxBufferAddr;
|
||||
Reg32u auxBufferStride;
|
||||
Reg32u reservedC;
|
||||
|
||||
unsigned long clipLeftRight1;
|
||||
unsigned long clipBottomTop1;
|
||||
unsigned long reservedD[6]; // NOTE: used to store TMUprivate ptr
|
||||
Reg32u clipLeftRight1;
|
||||
Reg32u clipBottomTop1;
|
||||
Reg32u reservedD[6]; // NOTE: used to store TMUprivate ptr
|
||||
|
||||
|
||||
unsigned long reservedE[8];
|
||||
Reg32u reservedE[8];
|
||||
|
||||
unsigned long reservedF[3];
|
||||
unsigned long swapBufferPend;
|
||||
unsigned long leftOverlayBuf;
|
||||
unsigned long rightOverlayBuf;
|
||||
unsigned long fbiSwapHistory;
|
||||
unsigned long fbiTrianglesOut; // triangles out counter
|
||||
Reg32u reservedF[3];
|
||||
Reg32u swapBufferPend;
|
||||
Reg32u leftOverlayBuf;
|
||||
Reg32u rightOverlayBuf;
|
||||
Reg32u fbiSwapHistory;
|
||||
Reg32u fbiTrianglesOut; // triangles out counter
|
||||
|
||||
FxU32 sSetupMode;
|
||||
FxU32 sVx;
|
||||
@@ -356,27 +364,27 @@ typedef volatile struct sstregs { // THE 3D CHIP
|
||||
|
||||
FxU32 sDrawTriCMD;
|
||||
FxU32 sBeginTriCMD;
|
||||
unsigned long reservedG[6];
|
||||
Reg32u reservedG[6];
|
||||
|
||||
unsigned long reservedH[8];
|
||||
Reg32u reservedH[8];
|
||||
|
||||
unsigned long reservedI[8];
|
||||
Reg32u reservedI[8];
|
||||
|
||||
unsigned long textureMode; // texture Mode
|
||||
unsigned long tLOD; // texture LOD settings
|
||||
unsigned long tDetail; // texture detail settings
|
||||
unsigned long texBaseAddr; // current texture base address
|
||||
unsigned long texBaseAddr1;
|
||||
unsigned long texBaseAddr2;
|
||||
unsigned long texBaseAddr38;
|
||||
unsigned long trexInit0; // hardware init bits
|
||||
unsigned long trexInit1; // hardware init bits
|
||||
Reg32u textureMode; // texture Mode
|
||||
Reg32u tLOD; // texture LOD settings
|
||||
Reg32u tDetail; // texture detail settings
|
||||
Reg32u texBaseAddr; // current texture base address
|
||||
Reg32u texBaseAddr1;
|
||||
Reg32u texBaseAddr2;
|
||||
Reg32u texBaseAddr38;
|
||||
Reg32u trexInit0; // hardware init bits
|
||||
Reg32u trexInit1; // hardware init bits
|
||||
|
||||
unsigned long nccTable0[12]; // NCC decode tables, bits are packed
|
||||
unsigned long nccTable1[12]; // 4 words Y, 4 words I, 4 words Q
|
||||
Reg32u nccTable0[12]; // NCC decode tables, bits are packed
|
||||
Reg32u nccTable1[12]; // 4 words Y, 4 words I, 4 words Q
|
||||
|
||||
unsigned long tChromaKeyMin;
|
||||
unsigned long tChromaKeyMax;
|
||||
Reg32u tChromaKeyMin;
|
||||
Reg32u tChromaKeyMax;
|
||||
} SstRegs;
|
||||
|
||||
// STB Begin changes
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#if __MWERKS__
|
||||
/* Dork w/ the console window */
|
||||
@@ -97,7 +98,7 @@ extern int __cdecl klvfprintf(FILE *stream,
|
||||
static FILE *gdbg_msgfile; // GDBG info/error file
|
||||
#else /* #ifdef KERNEL */
|
||||
|
||||
#ifndef __linux__
|
||||
#if !(GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
static FILE *gdbg_msgfile = stdout; // GDBG info/error file
|
||||
#else
|
||||
static FILE *gdbg_msgfile;
|
||||
@@ -168,7 +169,7 @@ gdbg_init(void)
|
||||
SIOUXSettings.asktosaveonclose = false;
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
gdbg_msgfile = stderr;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -193,7 +193,8 @@ typedef struct hwcExtLinearAddrReq_s {
|
||||
/* Returned from HWCEXT_GETLINEARADDR */
|
||||
typedef struct hwcExtLinearAddrRes_s {
|
||||
FxU32
|
||||
numBaseAddrs, /* # base addresses */
|
||||
numBaseAddrs; /* # base addresses */
|
||||
AnyPtr
|
||||
baseAddresses[HWCEXT_MAX_BASEADDR]; /* linear Addresses */
|
||||
} hwcExtLinearAddrRes_t;
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:45:04 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 3 4/06/99 3:36p Dow
|
||||
** Alt tab stuff
|
||||
@@ -38,46 +41,57 @@ extern char *cmdAGPRegNames[];
|
||||
extern char *waxRegNames[];
|
||||
extern char *sstRegNames[];
|
||||
|
||||
#ifdef __alpha__
|
||||
extern unsigned int _fxget32(unsigned int *);
|
||||
#define GET(s) _fxget32((unsigned int *)&s);
|
||||
#define SET(d,s) d = s
|
||||
#endif
|
||||
|
||||
#ifndef GET
|
||||
#define GET(s) s
|
||||
#define SET(d,s) d = s
|
||||
#endif
|
||||
|
||||
/*
|
||||
** I/O Macros
|
||||
*/
|
||||
#define HWC_IO_STORE(regInfo, reg, val)\
|
||||
GDBG_INFO(120, "Storing 0x%x to IO Register %s\n", val,\
|
||||
ioRegNames[(offsetof(SstIORegs, reg)) >> 2]);\
|
||||
((SstIORegs *) regInfo.ioMemBase)->reg = val
|
||||
SET(((SstIORegs *) regInfo.ioMemBase)->reg,val)
|
||||
|
||||
#define HWC_IO_LOAD(regInfo, reg, val)\
|
||||
val = ((SstIORegs *) regInfo.ioMemBase)->reg;\
|
||||
val = GET(((SstIORegs *) regInfo.ioMemBase)->reg);\
|
||||
GDBG_INFO(120, "Loaded 0x%x from IO Register %s\n", val,\
|
||||
ioRegNames[(offsetof(SstIORegs, reg)) >> 2]);
|
||||
|
||||
#define HWC_CAGP_STORE(regInfo, reg, val)\
|
||||
GDBG_INFO(120, "Storing 0x%x to CAGP Register %s\n", val,\
|
||||
cmdAGPRegNames[(offsetof(SstCRegs, reg)) >> 2]);\
|
||||
((SstCRegs *) (regInfo.cmdAGPBase))->reg = val
|
||||
SET(((SstCRegs *) (regInfo.cmdAGPBase))->reg,val)
|
||||
|
||||
#define HWC_CAGP_LOAD(regInfo, reg, val)\
|
||||
val = ((SstCRegs *) (regInfo).cmdAGPBase)->reg;\
|
||||
val = GET(((SstCRegs *) (regInfo).cmdAGPBase)->reg);\
|
||||
GDBG_INFO(120, "Loaded 0x%x from CAGP Register %s\n", val,\
|
||||
cmdAGPRegNames[(offsetof(SstCRegs, reg)) >> 2]);
|
||||
|
||||
#define HWC_WAX_STORE(regInfo, reg, val)\
|
||||
GDBG_INFO(120, "Storing 0x%x to WAX Register %s\n", val,\
|
||||
waxRegnames[(offsetof(SstGRegs, reg)) >> 2]);\
|
||||
((SstGRegs *) regInfo.waxBase)->reg = val
|
||||
SET(((SstGRegs *) regInfo.waxBase)->reg,val)
|
||||
|
||||
#define HWC_WAX_LOAD(regInfo, reg, val)\
|
||||
val = ((SstGRegs *) regInfo.waxBase)->reg;\
|
||||
val = GET(((SstGRegs *) regInfo.waxBase)->reg);\
|
||||
GDBG_INFO(120, "Loaded 0x%x from WAX Register %s\n", val,\
|
||||
waxRegnames[(offsetof(SstGRegs, reg)) >> 2]);
|
||||
|
||||
#define HWC_SST_STORE(regInfo, reg, val)\
|
||||
GDBG_INFO(120, "Storing 0x%x to 3D Register %s\n", val,\
|
||||
sstRegNames[(offsetof(SstRegs, reg)) >> 2]);\
|
||||
((SstRegs *) regInfo.sstBase)->reg = val
|
||||
SET(((SstRegs *) regInfo.sstBase)->reg,val)
|
||||
|
||||
#define HWC_SST_LOAD(regInfo, reg, val)\
|
||||
val = ((SstRegs *) regInfo.sstBase)->reg;\
|
||||
val = GET(((SstRegs *) regInfo.sstBase)->reg);\
|
||||
GDBG_INFO(120, "Loaded 0x%x from WAX Register %s\n", val,\
|
||||
sstRegNames[(offsetof(SstRegs, reg)) >> 2]);
|
||||
|
||||
|
||||
@@ -67,7 +67,15 @@ hwcCheckMemSize(hwcBoardInfo *bInfo, FxU32 xres, FxU32 yres, FxU32 nColBuffers,
|
||||
#include "lindri.h"
|
||||
|
||||
static FxU32 fenceVar;
|
||||
#ifdef __ia64__
|
||||
#define P6FENCE asm volatile("mf.a" ::: "memory");
|
||||
#elif __alpha__
|
||||
#define P6FENCE asm volatile("mb" ::: "memory");
|
||||
#elif __i386__
|
||||
#define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax");
|
||||
#elif
|
||||
Error Need to Define P6FENCE for this architecture
|
||||
#endif
|
||||
|
||||
#define MAXFIFOSIZE 0x40000
|
||||
#define FIFOPAD 0x0000
|
||||
@@ -142,7 +150,7 @@ static void loadEnvFile() {
|
||||
char data[128];
|
||||
char *env, *val;
|
||||
envitem *item;
|
||||
int first=1;
|
||||
int is_first=1;
|
||||
|
||||
if (envinit) return;
|
||||
envinit=1;
|
||||
@@ -154,9 +162,9 @@ static void loadEnvFile() {
|
||||
if (*data=='\n') continue;
|
||||
val=strchr(data, '=');
|
||||
if (!val) {
|
||||
if (first) {
|
||||
if (is_first) {
|
||||
fprintf(stderr, "In config file /etc/conf.3dfx/voodoo3:\n");
|
||||
first=0;
|
||||
is_first=0;
|
||||
}
|
||||
fprintf(stderr, "Malformed line: %s\n", data);
|
||||
continue;
|
||||
@@ -229,8 +237,8 @@ hwcMapBoard(hwcBoardInfo *bInfo, FxU32 bAddrMask) {
|
||||
}
|
||||
|
||||
bInfo->linearInfo.initialized = FXTRUE;
|
||||
bInfo->linearInfo.linearAddress[0]=(FxU32)driInfo.pRegs;
|
||||
bInfo->linearInfo.linearAddress[1]=(FxU32)driInfo.pFB;
|
||||
bInfo->linearInfo.linearAddress[0]=(AnyPtr)driInfo.pRegs;
|
||||
bInfo->linearInfo.linearAddress[1]=(AnyPtr)driInfo.pFB;
|
||||
return FXTRUE;
|
||||
}
|
||||
|
||||
@@ -829,7 +837,11 @@ hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res)
|
||||
#undef FN_NAME
|
||||
} /* hwcResolutionSupported */
|
||||
|
||||
void grDRIImportFifo(int fifoPtr, int fifoRead)
|
||||
extern void _grDRIImportFifo(FxU32 fifoPtr, FxU32 fifoRead);
|
||||
extern void _grDRIInvalidateAll(void);
|
||||
extern void _grDRIExportFifo(FxU32 *fifoPtr, FxU32 *fifoRead);
|
||||
|
||||
void grDRIImportFifo(FxU32 fifoPtr, FxU32 fifoRead)
|
||||
{
|
||||
_grImportFifo(fifoPtr, fifoRead);
|
||||
}
|
||||
@@ -840,5 +852,5 @@ void grDRIInvalidateAll() {
|
||||
|
||||
void grDRIResetSAREA()
|
||||
{
|
||||
_grExportFifo(driInfo.fifoPtr, driInfo.fifoRead);
|
||||
_grExportFifo((FxU32*)driInfo.fifoPtr, (FxU32*)driInfo.fifoRead);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:45:07 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 27 6/24/99 12:45a Stb_mmcclure
|
||||
** Modifications to fix PRS 6627. Added hwcUnmapMemory9x for revised 9x
|
||||
@@ -1075,7 +1078,7 @@ hwcMapBoard(hwcBoardInfo *bInfo, FxU32 bAddrMask)
|
||||
for (bAddr = 0; bAddr < 2; bAddr++) {
|
||||
if ((bAddrMask & (0x01UL << bAddr)) != 0x00UL) {
|
||||
bInfo->linearInfo.linearAddress[bAddr] =
|
||||
(FxU32)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
(AnyPtr)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
0x1000000, &bInfo->deviceNum, bInfo->boardNum, bAddr);
|
||||
}
|
||||
}
|
||||
@@ -1084,13 +1087,13 @@ hwcMapBoard(hwcBoardInfo *bInfo, FxU32 bAddrMask)
|
||||
* unconditionally
|
||||
*/
|
||||
bInfo->linearInfo.linearAddress[2] =
|
||||
(FxU32)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
(AnyPtr)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
0x1000000, &bInfo->deviceNum, bInfo->boardNum, 2);
|
||||
|
||||
/* Does the caller want the rom bios? */
|
||||
if ((bAddrMask & 0x08UL) != 0x00UL) {
|
||||
bInfo->linearInfo.linearAddress[3] =
|
||||
(FxU32)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
(AnyPtr)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
0x1000000, &bInfo->deviceNum, bInfo->boardNum, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,14 +238,14 @@ typedef struct hwcPCIInfo_s {
|
||||
typedef struct hwcLinearInfo_s {
|
||||
FxBool
|
||||
initialized;
|
||||
FxU32
|
||||
AnyPtr
|
||||
linearAddress[HWC_NUM_BASE_ADDR];
|
||||
} hwcLinearInfo;
|
||||
|
||||
typedef struct hwcRegInfo_s {
|
||||
FxBool
|
||||
initialized;
|
||||
volatile FxU32
|
||||
volatile AnyPtr
|
||||
ioMemBase, /* mem base for I/O aliases */
|
||||
cmdAGPBase, /* CMD/AGP register base */
|
||||
waxBase, /* 2D register base */
|
||||
@@ -253,7 +253,7 @@ typedef struct hwcRegInfo_s {
|
||||
lfbBase, /* 3D lfb base */
|
||||
rawLfbBase; /* Raw LFB base (base address 1) */
|
||||
#if __POWERPC__
|
||||
ioPortBase; /* PPC does I/O via a 32-bit address */
|
||||
FxU32 ioPortBase; /* PPC does I/O via a 32-bit address */
|
||||
#else
|
||||
volatile FxU16
|
||||
ioPortBase, /* I/O base address */
|
||||
@@ -558,16 +558,6 @@ hwcAllocAuxRenderingBuffer(hwcBoardInfo *bInfo,
|
||||
|
||||
#endif /* __WIN32__ */
|
||||
|
||||
#ifdef __linux__
|
||||
/*
|
||||
* Setup for full screen mode in Linux.
|
||||
*
|
||||
* The parameter "state" is true just in case we are
|
||||
* entering full screen mode.
|
||||
*/
|
||||
extern Bool hwcSetupFullScreen(hwcBoardInfo *bInfo, FxBool state);
|
||||
#endif /* defined(__linux__) */
|
||||
|
||||
FxBool
|
||||
hwcGammaRGB(hwcBoardInfo *bInfo, float r, float g, float b);
|
||||
|
||||
|
||||
21
glide3x/h5/glide3/src/cpudtect.c
Normal file
21
glide3x/h5/glide3/src/cpudtect.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifdef __alpha__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
#include "fxglide.h"
|
||||
|
||||
#define NOT_PENTIUM 4 /* see cpudetect.S */
|
||||
|
||||
extern FxI32 GR_CDECL
|
||||
_cpu_detect_asm(void)
|
||||
{
|
||||
return(NOT_PENTIUM);
|
||||
}
|
||||
#endif
|
||||
@@ -23,6 +23,10 @@ cpudtect.asm Page 1 - 1
|
||||
;;
|
||||
;; $Header$
|
||||
;; $Log$
|
||||
;; Revision 1.3 2000/11/15 23:32:52 joseph
|
||||
;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
;; number of bug fixes.
|
||||
;;
|
||||
;; Revision 1.1 2000/06/15 00:27:42 joseph
|
||||
;; Initial checkin into SourceForge.
|
||||
;;
|
||||
|
||||
@@ -20,10 +20,27 @@
|
||||
|
||||
/* $Header$ *
|
||||
/* $Log$
|
||||
/* Revision 1.4 2000/11/17 21:31:05 joseph
|
||||
/* Restored changes that were lost when I imported new sources from 3dfx's
|
||||
/* internal source repository.
|
||||
/*
|
||||
/* Revision 1.3 2000/11/15 23:32:52 joseph
|
||||
/* Syncing up with 3dfx internal source repository. These changes contain a
|
||||
/* number of bug fixes.
|
||||
/*
|
||||
/* Revision 1.2.2.3 2000/11/16 20:01:29 alanh
|
||||
/* merge trunk into 64bit branch.
|
||||
/*
|
||||
/* Revision 1.2.2.2 2000/11/16 19:32:33 alanh
|
||||
/* merge trunk into 64bit branch.
|
||||
/*
|
||||
/* Revision 1.2.2.1 2000/08/30 08:37:51 alanh
|
||||
/* Voodoo5 changes for 64bit architectures
|
||||
/*
|
||||
/* Revision 1.2 2000/06/27 19:59:34 joseph
|
||||
/* Previous checkin of asm files were already preprocessed.
|
||||
/* Fixed build rules for 3DNow optimized assembly.
|
||||
/*
|
||||
/* Revision 1.1 2000/06/15 00:27:42 josep
|
||||
/* Initial checkin into SourceForge
|
||||
/
|
||||
@@ -51,6 +68,20 @@
|
||||
/* 2 3/04/97 9:10p Dow */
|
||||
|
||||
|
||||
#ifdef __ia64__
|
||||
|
||||
.align 32
|
||||
.global _cpu_detect_asm
|
||||
.proc _cpu_detect_asm
|
||||
|
||||
_cpu_detect_asm:
|
||||
mov ret0=0
|
||||
br.ret.sptk.few b0
|
||||
|
||||
.end _cpu_detect_asm
|
||||
|
||||
#else /* !__ia64__ */
|
||||
|
||||
|
||||
.file "cpudtect.asm"
|
||||
|
||||
@@ -326,3 +357,4 @@ double_precision_asm:
|
||||
.size double_precision_asm,.L_END_double_precision_asm-double_precision_asm
|
||||
|
||||
.end
|
||||
#endif
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
/*
|
||||
** Copyright (c) 1997, 3Dfx Interactive, Inc.
|
||||
** All Rights Reserved.
|
||||
**
|
||||
** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.;
|
||||
** the contents of this file may not be disclosed to third parties, copied or
|
||||
** duplicated in any form, in whole or in part, without the prior written
|
||||
** permission of 3Dfx Interactive, Inc.
|
||||
**
|
||||
** RESTRICTED RIGHTS LEGEND:
|
||||
** Use, duplication or disclosure by the Government is subject to restrictions
|
||||
** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
||||
** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
||||
** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
||||
** rights reserved under the Copyright Laws of the United States.
|
||||
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
|
||||
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
|
||||
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
|
||||
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
|
||||
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
|
||||
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
|
||||
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
|
||||
**
|
||||
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
|
||||
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
|
||||
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
|
||||
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
|
||||
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
|
||||
** THE UNITED STATES.
|
||||
**
|
||||
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
|
||||
**
|
||||
** $Header$
|
||||
** $Log:
|
||||
@@ -396,10 +399,6 @@
|
||||
#include "gsfc.h"
|
||||
#include "rcver.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include "lindri.h"
|
||||
#endif /* defined(__linux__) */
|
||||
|
||||
#if (GLIDE_PLATFORM & GLIDE_SST_SIM)
|
||||
#if HAL_CSIM
|
||||
#include <csim.h>
|
||||
@@ -602,10 +601,10 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params))
|
||||
case GR_NUM_FB:
|
||||
if (plength == 4) {
|
||||
GR_DCL_GC;
|
||||
GR_DCL_NUMCHIPS;
|
||||
|
||||
if ((gc) && numChips)
|
||||
*params = numChips;
|
||||
if ((gc) &&
|
||||
(gc->chipCount))
|
||||
*params = gc->chipCount ;
|
||||
else
|
||||
*params = 1 ;
|
||||
|
||||
@@ -808,11 +807,11 @@ GR_DIENTRY(grGet, FxU32, (FxU32 pname, FxU32 plength, FxI32 *params))
|
||||
break;
|
||||
|
||||
case GR_SURFACE_TEXTURE:
|
||||
if (plength == 4) {
|
||||
if (plength == sizeof(long)) {
|
||||
GR_DCL_GC;
|
||||
|
||||
#ifdef GLIDE_INIT_HWC
|
||||
*params = (FxU32) &gc->tBuffer;
|
||||
*params = (AnyPtr) &gc->tBuffer;
|
||||
retVal = plength;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ GR_DIENTRY(grSstSelect, void, ( int which ))
|
||||
GrErrorCallback( "grSstSelect: non-existent SST", FXTRUE );
|
||||
|
||||
_GlideRoot.current_sst = which;
|
||||
setThreadValue( (FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
setThreadValue( (AnyPtr)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
|
||||
#ifdef GLIDE_MULTIPLATFORM
|
||||
_GlideRoot.curGCFuncs = _GlideRoot.curGC->gcFuncs;
|
||||
|
||||
@@ -325,6 +325,7 @@
|
||||
|
||||
#ifdef GLIDE3
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -335,10 +336,6 @@
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include "lindri.h"
|
||||
#endif /* defined(__linux__) */
|
||||
|
||||
/*=============================================================================
|
||||
** Replacement state routines.
|
||||
**
|
||||
@@ -844,7 +841,7 @@ GR_EXT_ENTRY(grLfbConstantStencil, void , (GrStencil_t value) )
|
||||
|
||||
Return:
|
||||
-------------------------------------------------------------------*/
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple))
|
||||
{
|
||||
#define FN_NAME "grStipplePattern"
|
||||
@@ -857,7 +854,7 @@ GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple))
|
||||
|
||||
#undef FN_NAME
|
||||
} /* grStipplePattern */
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
@@ -1020,7 +1017,7 @@ GR_EXT_ENTRY(grAlphaCombineExt, void , (GrACUColor_t a,
|
||||
|
||||
Return:
|
||||
-------------------------------------------------------------------*/
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) )
|
||||
{
|
||||
#define FN_NAME "grStippleMode"
|
||||
@@ -1033,7 +1030,7 @@ GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) )
|
||||
|
||||
#undef FN_NAME
|
||||
} /* grStippleMode */
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grDitherMode
|
||||
@@ -2075,9 +2072,9 @@ _grValidateState()
|
||||
_grDepthBufferFunction(LOADARG(grDepthBufferFunction, fnc));
|
||||
_grDepthBufferMode(LOADARG(grDepthBufferMode, mode));
|
||||
_grDitherMode(LOADARG(grDitherMode, mode));
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
_grStippleMode(LOADARG(grStippleMode, mode));
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
_grSstOrigin(LOADARG(grSstOrigin, origin));
|
||||
_grRenderBuffer(LOADARG(grRenderBuffer, buffer));
|
||||
/* tbext */
|
||||
@@ -2290,7 +2287,7 @@ _grValidateState()
|
||||
REG_GROUP_END();
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
if (NOTVALID(stipple)) {
|
||||
gc->state.shadow.stipple = LOADARG(grStipplePattern, stipple);
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, stipple, 1, 0x01);
|
||||
@@ -2299,7 +2296,7 @@ _grValidateState()
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
if (NOTVALID(stencilOp)) {
|
||||
FxU32 stencilOp = gc->state.shadow.stencilOp;
|
||||
@@ -2496,11 +2493,10 @@ _grValidateState()
|
||||
REG_GROUP_SET(hw, fogMode, fogMode);
|
||||
REG_GROUP_END();
|
||||
} else {
|
||||
GR_DCL_NUMCHIPS;
|
||||
/* Even chips use one rotation, odd chips use the other one */
|
||||
FxU32 chipIndex, fogMode;
|
||||
fogMode = gc->state.shadow.fogMode;
|
||||
for(chipIndex = 0; chipIndex < numChips; chipIndex++) {
|
||||
for(chipIndex = 0; chipIndex < gc->chipCount; chipIndex++) {
|
||||
if(chipIndex & 1) { /* Sample 1 */
|
||||
fogMode &= ~(SST_DITHER_ROTATE | SST_DITHER_ROTATE_BLEND |
|
||||
SST_DITHER_ROTATE_AA | SST_DITHER_ROTATE_BLEND_AA) ;
|
||||
@@ -2525,9 +2521,8 @@ _grValidateState()
|
||||
}
|
||||
} else if(gc->grPixelSample == 4) {
|
||||
FxU32 chipIndex, fogMode;
|
||||
GR_DCL_NUMCHIPS;
|
||||
fogMode = gc->state.shadow.fogMode;
|
||||
for(chipIndex = 0; chipIndex < numChips; chipIndex++) {
|
||||
for(chipIndex = 0; chipIndex < gc->chipCount; chipIndex++) {
|
||||
if(chipIndex & 1) { /* Samples 2 and 3 */
|
||||
fogMode &= ~(SST_DITHER_ROTATE | SST_DITHER_ROTATE_BLEND |
|
||||
SST_DITHER_ROTATE_AA | SST_DITHER_ROTATE_BLEND_AA) ;
|
||||
@@ -2842,7 +2837,7 @@ GR_DIENTRY(grViewport, void , (FxI32 x, FxI32 y, FxI32 width, FxI32 height) )
|
||||
#undef FN_NAME
|
||||
} /* grViewport */
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
void
|
||||
_grInvalidateAll()
|
||||
{
|
||||
@@ -2850,6 +2845,7 @@ _grInvalidateAll()
|
||||
|
||||
grGlideSetState(&gc->state);
|
||||
}
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
#endif /* GLIDE3 */
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ GR_DIENTRY(grDrawVertexArrayContiguous, void , (FxU32 mode, FxU32 Count, void *p
|
||||
FxU32 i;
|
||||
for (i = 0; i < Count; i++)
|
||||
GDBG_INFO(110, "%s: pointers[%d] = 0x%x\n",
|
||||
FN_NAME, i, (int)pointers + gc->state.vData.vStride * i);
|
||||
FN_NAME, i, (long)pointers + gc->state.vData.vStride * i);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -552,10 +552,10 @@ GR_DIENTRY(grDrawVertexArrayContiguous, void , (FxU32 mode, FxU32 Count, void *p
|
||||
else {
|
||||
void *b_ptr, *c_ptr;
|
||||
while ((int)Count >= 3) {
|
||||
b_ptr = (void *)((FxU32)pointers + stride);
|
||||
c_ptr = (void *)((FxU32)pointers + stride*2);
|
||||
b_ptr = (void *)((AnyPtr)pointers + stride);
|
||||
c_ptr = (void *)((AnyPtr)pointers + stride*2);
|
||||
TRISETUP(pointers, b_ptr, c_ptr);
|
||||
pointers = (void *)((FxU32)c_ptr + stride);
|
||||
pointers = (void *)((AnyPtr)c_ptr + stride);
|
||||
Count -= 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,6 +217,7 @@
|
||||
**
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
@@ -1444,7 +1445,7 @@ GR_DIENTRY(grTexMinAddress, FxU32, ( GrChipID_t tmu ))
|
||||
|
||||
FXUNUSED(hw);
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
if (!gc->lostContext)
|
||||
return 0;
|
||||
|
||||
@@ -1453,7 +1454,7 @@ GR_DIENTRY(grTexMinAddress, FxU32, ( GrChipID_t tmu ))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d)\n",tmu);
|
||||
GR_CHECK_TMU(FN_NAME, tmu);
|
||||
@@ -1510,7 +1511,7 @@ GR_DIENTRY(grTexMaxAddress, FxU32, ( GrChipID_t tmu ))
|
||||
|
||||
FXUNUSED(hw);
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
if (!gc->lostContext)
|
||||
return 0;
|
||||
|
||||
@@ -1519,7 +1520,7 @@ GR_DIENTRY(grTexMaxAddress, FxU32, ( GrChipID_t tmu ))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d)\n",tmu);
|
||||
GR_CHECK_TMU(FN_NAME, tmu );
|
||||
@@ -1756,3 +1757,4 @@ GR_DIENTRY(grTexDownloadMipMapLevel, void,
|
||||
GR_END();
|
||||
} /* grTexDownloadMipmapLevel */
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -176,6 +176,7 @@
|
||||
#ifndef __FX_CMD_H__
|
||||
#define __FX_CMD_H__
|
||||
|
||||
#include "config.h"
|
||||
/*--------------------------------------------------------
|
||||
Command Transport Macros and Functions
|
||||
--------------------------------------------------------*/
|
||||
@@ -188,6 +189,12 @@ extern FxU32
|
||||
_grGet32(volatile FxU32* const sstAddr);
|
||||
#endif /* USE_PACKET_FIFO */
|
||||
|
||||
#ifdef DRI_BUILD
|
||||
void _grImportFifo(AnyPtr fifoPtr, AnyPtr fifoRead);
|
||||
void _grExportFifo(FxU32 *fifoPtr, FxU32 *fifoRead);
|
||||
void _grInvalidateAll(void);
|
||||
#endif
|
||||
|
||||
#if !USE_PACKET_FIFO
|
||||
/* NOTE: fifoFree is the number of entries, each is 8 bytes */
|
||||
#define GR_CHECK_FOR_ROOM(n,p) \
|
||||
@@ -222,7 +229,7 @@ do { \
|
||||
/* NB: This should be used sparingly because it does a 'real' hw read
|
||||
* which is *SLOW*.
|
||||
*/
|
||||
FxU32 _grHwFifoPtr(FxBool);
|
||||
AnyPtr _grHwFifoPtr(FxBool);
|
||||
#define HW_FIFO_PTR(a) _grHwFifoPtr(a)
|
||||
|
||||
#if FIFO_ASSERT_FULL
|
||||
@@ -233,7 +240,7 @@ FxU32 _grHwFifoPtr(FxBool);
|
||||
#else /* !FIFO_ASSERT_FULL */
|
||||
#define FIFO_ASSERT() \
|
||||
ASSERT_FAULT_IMMED((FxU32)gc->cmdTransportInfo.fifoRoom < gc->cmdTransportInfo.fifoSize); \
|
||||
ASSERT_FAULT_IMMED((FxU32)gc->cmdTransportInfo.fifoPtr < (FxU32)gc->cmdTransportInfo.fifoEnd)
|
||||
ASSERT_FAULT_IMMED((AnyPtr)gc->cmdTransportInfo.fifoPtr < (AnyPtr)gc->cmdTransportInfo.fifoEnd)
|
||||
#endif /* !FIFO_ASSERT_FULL */
|
||||
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
|
||||
@@ -296,7 +303,7 @@ do {\
|
||||
#define GR_CHECK_FOR_ROOM(__n, __p) \
|
||||
do { \
|
||||
const FxU32 writeSize = (__n) + ((__p) * sizeof(FxU32)); /* Adjust for size of hdrs */ \
|
||||
ASSERT(((FxU32)(gc->cmdTransportInfo.fifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
ASSERT(((AnyPtr)(gc->cmdTransportInfo.fifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
ASSERT(writeSize < gc->cmdTransportInfo.fifoSize - sizeof(FxU32)); \
|
||||
FIFO_ASSERT(); \
|
||||
if (gc->cmdTransportInfo.fifoRoom < (FxI32)writeSize) { \
|
||||
@@ -325,7 +332,7 @@ if (gc->cmdTransportInfo.autoBump) {\
|
||||
}
|
||||
|
||||
#define GR_SET_FIFO_PTR(__n, __p) \
|
||||
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkPtr = (AnyPtr)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkCounter = ((__n) + ((__p) << 2))
|
||||
#else
|
||||
#define GR_CHECK_FIFO_PTR()
|
||||
@@ -337,7 +344,7 @@ if (gc->cmdTransportInfo.autoBump) {\
|
||||
GDBG_ERROR("GR_ASSERT_SIZE","byte counter should be %d but is %d\n", \
|
||||
gc->expected_counter,gc->counter); \
|
||||
GR_CHECK_FIFO_PTR(); \
|
||||
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkPtr = (AnyPtr)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkCounter = 0; \
|
||||
ASSERT(gc->counter == gc->expected_counter); \
|
||||
gc->counter = gc->expected_counter = 0
|
||||
@@ -373,12 +380,17 @@ if (gc->cmdTransportInfo.autoBump) {\
|
||||
|
||||
#if USE_PACKET_FIFO
|
||||
#if GLIDE_DEBUG
|
||||
#if defined(__alpha__) || defined(__LP64__)
|
||||
#define DEBUGFIFOWRITE(a,b,c)
|
||||
#define DEBUGFIFOFWRITE(a,b,c)
|
||||
#else
|
||||
void _grFifoWriteDebug(FxU32 addr, FxU32 val, FxU32 fifoPtr);
|
||||
#define DEBUGFIFOWRITE(a,b,c) \
|
||||
_grFifoWriteDebug((FxU32) a, (FxU32) b, (FxU32) c)
|
||||
void _grFifoFWriteDebug(FxU32 addr, float val, FxU32 fifoPtr);
|
||||
#define DEBUGFIFOFWRITE(a,b,c) \
|
||||
_grFifoFWriteDebug((FxU32) a, (float) b, (FxU32) c)
|
||||
#endif
|
||||
|
||||
extern void _reg_group_begin_internal_wax( FxU32 regBase,
|
||||
FxU32 groupNum,
|
||||
@@ -758,7 +770,7 @@ do { \
|
||||
GDBG_INFO(120, "REG_GROUP_SET:\n"); \
|
||||
} \
|
||||
GDBG_INFO(120, "\tFile: %s Line %d\n", __FILE__, __LINE__); \
|
||||
GDBG_INFO(120, "\tfifoPtr: 0x%x, Val: 0x%x\n", (FxU32) _regGroupFifoPtr - (FxU32)gc->rawLfb, __val);\
|
||||
GDBG_INFO(120, "\tfifoPtr: 0x%x, Val: 0x%x\n", (AnyPtr) _regGroupFifoPtr - (AnyPtr)gc->rawLfb, __val);\
|
||||
SET_FIFO(*_regGroupFifoPtr++, (__val)); \
|
||||
GR_INC_SIZE(sizeof(FxU32)); \
|
||||
} while(0)
|
||||
@@ -779,7 +791,7 @@ do { \
|
||||
GDBG_INFO(120, "REG_GROUP_SET:\n"); \
|
||||
} \
|
||||
GDBG_INFO(120, "\tFile: %s Line %d\n", __FILE__, __LINE__); \
|
||||
GDBG_INFO(120, "\tfifoPtr: 0x%x, Val: 0x%x\n", (FxU32) _regGroupFifoPtr - (FxU32)gc->rawLfb, __val);\
|
||||
GDBG_INFO(120, "\tfifoPtr: 0x%x, Val: 0x%x\n", (AnyPtr) _regGroupFifoPtr - (AnyPtr)gc->rawLfb, __val);\
|
||||
SET_FIFO(*_regGroupFifoPtr++, (__val)); \
|
||||
GR_INC_SIZE(sizeof(FxU32)); \
|
||||
} while(0)
|
||||
@@ -795,7 +807,7 @@ do { \
|
||||
} \
|
||||
GDBG_INFO(220, "REG_GROUP_SET_WAX:\n");\
|
||||
GDBG_INFO(220, "\tFile: %s Line %d\n", __FILE__, __LINE__);\
|
||||
GDBG_INFO(220, "\tfifoPtr: 0x%x, Val: 0x%x\n", (FxU32) _regGroupFifoPtr - (FxU32)gc->rawLfb, __val);\
|
||||
GDBG_INFO(220, "\tfifoPtr: 0x%x, Val: 0x%x\n", (AnyPtr) _regGroupFifoPtr - (AnyPtr)gc->rawLfb, __val);\
|
||||
SET_FIFO(*_regGroupFifoPtr++, (__val)); \
|
||||
GR_INC_SIZE(sizeof(FxU32)); \
|
||||
} while(0)
|
||||
@@ -825,8 +837,8 @@ do { \
|
||||
|
||||
#define REG_GROUP_END() \
|
||||
ASSERT(_checkP); \
|
||||
ASSERT((((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) >> 2) == _groupNum + 1); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
ASSERT((((AnyPtr)_regGroupFifoPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr) >> 2) == _groupNum + 1); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)_regGroupFifoPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = (FxU32*)_regGroupFifoPtr; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\tGroupEnd: (0x%X : 0x%X)\n", \
|
||||
gc->cmdTransportInfo.fifoPtr, gc->cmdTransportInfo.fifoRoom); \
|
||||
@@ -839,7 +851,7 @@ do { \
|
||||
if (gc->contextP) { \
|
||||
FxU32* curFifoPtr = gc->cmdTransportInfo.fifoPtr; \
|
||||
FXUNUSED(__base); \
|
||||
GR_ASSERT(((FxU32)(curFifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT(((AnyPtr)(curFifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_CHECK_COMPATABILITY(FN_NAME, \
|
||||
!gc->open, \
|
||||
"Called before grSstWinOpen()"); \
|
||||
@@ -882,7 +894,7 @@ do { \
|
||||
if (gc->contextP) { \
|
||||
FxU32* curFifoPtr = gc->cmdTransportInfo.fifoPtr; \
|
||||
FXUNUSED(__base); \
|
||||
GR_ASSERT(((FxU32)(curFifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT(((AnyPtr)(curFifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_CHECK_COMPATABILITY(FN_NAME, \
|
||||
!gc->open, \
|
||||
"Called before grSstWinOpen()"); \
|
||||
@@ -1038,10 +1050,10 @@ _grH3FifoDump_Linear(const FxU32* const linearPacketAddr);
|
||||
GR_CHECK_COMPATABILITY(FN_NAME, \
|
||||
!gc->open, \
|
||||
"Called before grSstWinOpen()"); \
|
||||
GR_ASSERT(((FxU32)(tPackPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT(((AnyPtr)(tPackPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT((((__nVerts) * (__vertSize)) + sizeof(FxU32)) <= (FxU32)gc->cmdTransportInfo.fifoRoom); \
|
||||
GR_ASSERT((((FxU32)tPackPtr) + ((__nVerts) * (__vertSize)) + sizeof(FxU32)) < \
|
||||
(FxU32)gc->cmdTransportInfo.fifoEnd); \
|
||||
GR_ASSERT((((AnyPtr)tPackPtr) + ((__nVerts) * (__vertSize)) + sizeof(FxU32)) < \
|
||||
(AnyPtr)gc->cmdTransportInfo.fifoEnd); \
|
||||
GR_ASSERT(nVertex < 0x10); \
|
||||
GR_ASSERT(nVertex > 0x00); \
|
||||
GR_ASSERT(((__packetHdr) & 0xE0000000UL) == 0x00UL); \
|
||||
@@ -1052,27 +1064,27 @@ _grH3FifoDump_Linear(const FxU32* const linearPacketAddr);
|
||||
pCount++; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\t(0x%X) : V#: 0x%X - P#: 0x%X - ParamVal: (%f : 0x%X)\n", \
|
||||
(FxU32)tPackPtr, \
|
||||
((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
(((__val) < 786432.875) ? (__val) : ((__val) - 786432.875)), \
|
||||
(__floatVal))
|
||||
#define SETF_DUMP(__val) \
|
||||
pCount++; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\t(0x%X) : V#: 0x%X - P#: 0x%X - ParamVal: %f\n", \
|
||||
(FxU32)tPackPtr, \
|
||||
((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
(((__val) < 786432.875) ? (__val) : ((__val) - 786432.875)))
|
||||
#define SET_DUMP(__val) \
|
||||
pCount++; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\t(0x%X) : V#: 0x%X - P#: 0x%X - ParamVal: 0x%X\n", \
|
||||
(FxU32)tPackPtr, \
|
||||
((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
|
||||
(((AnyPtr)tPackPtr - ((AnyPtr)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
|
||||
(__val))
|
||||
#define TRI_ASSERT() \
|
||||
GR_ASSERT(pCount == (nVertex * (sVertex >> 2))); \
|
||||
ASSERT(((FxU32)tPackPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) == (nVertex * sVertex) + sizeof(FxU32))
|
||||
ASSERT(((AnyPtr)tPackPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr) == (nVertex * sVertex) + sizeof(FxU32))
|
||||
#else /* !GDBG_INFO_ON */
|
||||
#define DEBUGFIFODUMP_TRI(__packetAddr)
|
||||
#define DEBUGFIFODUMP_LINEAR(__packetAddr)
|
||||
@@ -1137,7 +1149,7 @@ do { \
|
||||
|
||||
#define TRI_END \
|
||||
TRI_ASSERT(); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)tPackPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)tPackPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = tPackPtr; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\tTriEnd: (0x%X : 0x%X)\n", tPackPtr, gc->cmdTransportInfo.fifoRoom); \
|
||||
FIFO_ASSERT(); \
|
||||
@@ -1156,12 +1168,12 @@ do { \
|
||||
GR_CHECK_COMPATABILITY(FN_NAME, \
|
||||
!gc->open, \
|
||||
"Called before grSstWinOpen()"); \
|
||||
GR_ASSERT(((FxU32)(packetPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT(((AnyPtr)(packetPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
|
||||
GR_ASSERT((__numWords) > 0); /* packet size */ \
|
||||
GR_ASSERT((__numWords) < ((0x01 << 19) - 2)); \
|
||||
GR_ASSERT((((FxU32)(__numWords) + 2) << 2) <= (FxU32)gc->cmdTransportInfo.fifoRoom); \
|
||||
GR_ASSERT(((FxU32)packetPtr + (((__numWords) + 2) << 2)) < \
|
||||
(FxU32)gc->cmdTransportInfo.fifoEnd); \
|
||||
GR_ASSERT(((AnyPtr)packetPtr + (((__numWords) + 2) << 2)) < \
|
||||
(AnyPtr)gc->cmdTransportInfo.fifoEnd); \
|
||||
GR_ASSERT((hdr2 & 0xE0000000UL) == 0x00UL); \
|
||||
GR_ASSERT(((__addr) & 0x03UL) == 0x00UL); \
|
||||
FIFO_ASSERT(); \
|
||||
@@ -1206,8 +1218,8 @@ do { \
|
||||
|
||||
#define FIFO_LINEAR_WRITE_END \
|
||||
DEBUGFIFODUMP_LINEAR(gc->cmdTransportInfo.fifoPtr); \
|
||||
GR_ASSERT((((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) >> 2) == __writeSize + 2); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
GR_ASSERT((((AnyPtr)packetPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr) >> 2) == __writeSize + 2); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)packetPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = packetPtr; \
|
||||
GDBG_INFO(gc->myLevel + 200, "\tLinearEnd: (0x%X : 0x%X)\n", \
|
||||
packetPtr, gc->cmdTransportInfo.fifoRoom); \
|
||||
@@ -1425,7 +1437,7 @@ do { \
|
||||
#define REG_GROUP_SETF_CLAMP(__regBase, __regAddr, __val) \
|
||||
do { \
|
||||
const FxU32 fpClampVal = FP_FLOAT_CLAMP(__val); \
|
||||
REG_GROUP_ASSERT(__regAddr, fpClampVal, FXTRUE); \
|
||||
REG_GROUP_ASSERT(__regAddr, fpClampVal, FXTRUE); \
|
||||
SET(((FxU32*)(__regBase))[offsetof(SstRegs, __regAddr) >> 2], fpClampVal); \
|
||||
GR_INC_SIZE(sizeof(FxU32)); \
|
||||
} while(0)
|
||||
@@ -1625,7 +1637,7 @@ GR_CHECK_SIZE()
|
||||
} \
|
||||
else { \
|
||||
FxU32 argb; \
|
||||
argb = *((FxU32 *)((int)_s + i)) & 0x00ffffff; \
|
||||
argb = *((FxU32 *)((long)_s + i)) & 0x00ffffff; \
|
||||
TRI_SETF(*((float *)&argb)); \
|
||||
dataElem++; \
|
||||
i = gc->tsuDataList[dataElem]; \
|
||||
@@ -1691,8 +1703,5 @@ GR_CHECK_SIZE()
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
extern void _grImportFifo(int fifoPtr, int fifoRead);
|
||||
#endif /* defined(__linux__) */
|
||||
|
||||
#endif /* __FX_CMD_H__ */
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -37,7 +38,7 @@
|
||||
* macros for creating assembler offset files
|
||||
*----------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __linux
|
||||
#if !(GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
#define NEWLINE printf("\n")
|
||||
#define COMMENT printf(";----------------------------------------------------------------------\n")
|
||||
|
||||
@@ -57,7 +58,7 @@
|
||||
printf("SIZEOF_%s\t= %08xh\n",pname,sizeof(p)); \
|
||||
else printf("SIZEOF_%s\t= %10d\n",pname,sizeof(p))
|
||||
|
||||
#else /* defined(__linux__) */
|
||||
#else /* !(GLIDE_PLATFORM & GLIDE_OS_UNIX) */
|
||||
|
||||
#define NEWLINE printf("\n");
|
||||
#define COMMENT printf("/*----------------------------------------------------------------------*/\n")
|
||||
@@ -77,7 +78,7 @@
|
||||
#define SIZEOF(p,pname) if (hex) \
|
||||
printf("#define SIZEOF_%s 0x%08x\n",pname,sizeof(p)); \
|
||||
else printf("#define SIZEOF_%s %10d\n",pname,sizeof(p))
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* !(GLIDE_PLATFORM & GLIDE_OS_UNIX) */
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
@@ -240,3 +241,4 @@ main (int argc, char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1136,14 +1136,14 @@ typedef struct {
|
||||
struct {
|
||||
GrDitherMode_t mode;
|
||||
} grDitherModeArgs;
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
struct {
|
||||
GrStippleMode_t mode;
|
||||
} grStippleModeArgs;
|
||||
struct {
|
||||
GrStipplePattern_t stipple;
|
||||
} grStipplePatternArgs;
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
struct {
|
||||
GrBuffer_t buffer;
|
||||
} grRenderBufferArgs;
|
||||
@@ -1282,11 +1282,11 @@ typedef struct {
|
||||
* the _archXXXX proc list that is selected at grGlideInit time.
|
||||
*/
|
||||
|
||||
#ifndef __linux__
|
||||
#if !defined(DRI_BUILD) || defined(GLIDE_USE_C_TRISETUP)
|
||||
typedef FxI32 (FX_CALL* GrTriSetupProc)(const void *a, const void *b, const void *c);
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
typedef FxI32 (FX_CALL* GrTriSetupProc)(const void *g, const void *a, const void *b, const void *c);
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
typedef void (FX_CALL* GrVertexListProc)(FxU32 pkType, FxU32 type, FxI32 mode, FxI32 count, void* ptrs);
|
||||
typedef void (FX_CALL* GrDrawTrianglesProc)(FxI32 mode, FxI32 count, void* vPtrs);
|
||||
@@ -1339,11 +1339,11 @@ void FX_CSTYLE _grDrawVertexList_3DNow_Window(FxU32 pktype, FxU32 type, FxI32 mo
|
||||
void FX_CSTYLE _grDrawVertexList_3DNow_Clip(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *pointers);
|
||||
#endif /* GL_AMD3D */
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
/* Define this structure otherwise it assumes the structure only exists
|
||||
within the function */
|
||||
struct GrGC_s;
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
/* _GlideRoot.curTexProcs is an array of (possibly specialized)
|
||||
* function pointers indexed by texture format size (8/16 bits for
|
||||
@@ -1564,7 +1564,7 @@ typedef struct GrGC_s
|
||||
SET_FIFO(*curFifoPtr++, *curPktData++); \
|
||||
} \
|
||||
GR_INC_SIZE((__writeCount) * sizeof(FxU32)); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)curFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)curFifoPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = curFifoPtr; \
|
||||
} \
|
||||
GR_CHECK_SIZE(); \
|
||||
@@ -1684,7 +1684,7 @@ typedef struct GrGC_s
|
||||
*/
|
||||
|
||||
FxU32* fifoPtr; /* Current write pointer into fifo */
|
||||
FxU32 fifoRead; /* Last known hw read ptr.
|
||||
AnyPtr fifoRead; /* Last known hw read ptr.
|
||||
* If on an sli enabled system this will be
|
||||
* the 'closest' hw read ptr of the sli
|
||||
* master and slave.
|
||||
@@ -1756,11 +1756,11 @@ typedef struct GrGC_s
|
||||
occur every 64K writes. */
|
||||
|
||||
} cmdTransportInfo;
|
||||
#ifndef __linux__
|
||||
#if !defined(DRI_BUILD) || defined(GLIDE_USE_C_TRISETUP)
|
||||
FxI32 (FX_CALL *triSetupProc)(const void *a, const void *b, const void *c);
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
FxI32 (FX_CALL *triSetupProc)(const void *g, const void *a, const void *b, const void *c);
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
SstIORegs
|
||||
*ioRegs; /* I/O remap regs */
|
||||
@@ -1775,17 +1775,19 @@ typedef struct GrGC_s
|
||||
SstCRegs
|
||||
*slaveCRegs[3] ; /* AJB - ptrs to slave chips cmd regs */
|
||||
FxU32
|
||||
*rawLfb,
|
||||
*rawLfb;
|
||||
FxU32
|
||||
nBuffers,
|
||||
curBuffer,
|
||||
frontBuffer,
|
||||
backBuffer,
|
||||
backBuffer;
|
||||
AnyPtr
|
||||
buffers0[4],
|
||||
buffers1[4],
|
||||
lfbBuffers[4]; /* Tile relative addresses of the color/aux
|
||||
* buffers for lfbReads.
|
||||
*/
|
||||
FxU32 lockPtrs[2]; /* pointers to locked buffers */
|
||||
AnyPtr lockPtrs[2]; /* pointers to locked buffers */
|
||||
FxU32 fbStride;
|
||||
|
||||
FxBool colTiled, // AJB - grBufferClear needs to know when target surfaces
|
||||
@@ -1865,7 +1867,7 @@ typedef struct GrGC_s
|
||||
FxI32 expected_counter; /* the number of bytes expected to be sent */
|
||||
|
||||
FxU32 checkCounter;
|
||||
FxU32 checkPtr;
|
||||
AnyPtr checkPtr;
|
||||
|
||||
FxVideoTimingInfo* vidTimings;/* init code overrides */
|
||||
|
||||
@@ -2096,6 +2098,10 @@ extern GrGCFuncs _curGCFuncs;
|
||||
* This is the __linux__ code.
|
||||
*/
|
||||
#define P6FENCE asm("xchg %%eax, %0" : : "m" (_GlideRoot.p6Fencer) : "eax");
|
||||
#elif defined(__GNUC__) && defined(__alpha__)
|
||||
#define P6FENCE asm volatile("mb" ::: "memory")
|
||||
#elif defined(__GNUC__) && defined(__ia64__)
|
||||
#define P6FENCE asm volatile("mf.a" ::: "memory")
|
||||
#else /* !defined ( P6FENCE ) */
|
||||
# error "P6 Fencing code needs to be added for this compiler"
|
||||
#endif /* !defined ( P6FENCE ) */
|
||||
@@ -2253,12 +2259,16 @@ _trisetup_noclip_valid(const void *va, const void *vb, const void *vc );
|
||||
#elif defined(__POWERPC__)
|
||||
#define TRISETUP(_a, _b, _c) \
|
||||
((FxI32 (*)(const void *va, const void *vb, const void *vc, GrGC *gc))*gc->triSetupProc)(_a, _b, _c, gc)
|
||||
#elif defined(__linux__)
|
||||
#elif defined(DRI_BUILD)
|
||||
#ifdef GLIDE_USE_C_TRISETUP
|
||||
#define TRISETUP(a, b, c) (gc->triSetupProc)(a, b, c)
|
||||
#else
|
||||
#define TRISETUP(a, b, c) (gc->triSetupProc)(gc, a, b, c)
|
||||
#else /* defined(__linux__) */
|
||||
#endif
|
||||
#else /* defined(DRI_BUILD) */
|
||||
#define TRISETUP \
|
||||
(*gc->triSetupProc)
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
void
|
||||
_grValidateState();
|
||||
|
||||
@@ -2327,11 +2337,11 @@ grStencilFunc(GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask);
|
||||
void FX_CALL
|
||||
grStencilMask(GrStencil_t write_mask);
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
void FX_CALL
|
||||
grStipplePattern(
|
||||
GrStipplePattern_t stipple);
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
void FX_CALL
|
||||
grStencilOp(
|
||||
@@ -2507,10 +2517,10 @@ _grDepthBufferMode( GrDepthBufferMode_t mode );
|
||||
void
|
||||
_grDitherMode( GrDitherMode_t mode );
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
void
|
||||
_grStippleMode( GrStippleMode_t mode );
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
void
|
||||
_grRenderBuffer( GrBuffer_t buffer );
|
||||
@@ -2611,17 +2621,17 @@ getThreadValueFast() {
|
||||
#endif
|
||||
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_MACOS)
|
||||
extern FxU32 _threadValueMacOS;
|
||||
__inline FxU32
|
||||
extern AnyPtr _threadValueMacOS;
|
||||
__inline AnyPtr
|
||||
getThreadValueFast() {
|
||||
return _threadValueMacOS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
extern FxU32 threadValueLinux;
|
||||
#ifdef DRI_BUILD
|
||||
extern AnyPtr threadValueLinux;
|
||||
#define getThreadValueFast() threadValueLinux
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
#define CUR_TRI_PROC(__checkValidP, __cullP) \
|
||||
(*gc->archDispatchProcs.coorModeTriVector)[__checkValidP][__cullP]
|
||||
@@ -2642,9 +2652,9 @@ void
|
||||
freeThreadStorage( void );
|
||||
|
||||
void
|
||||
setThreadValue( FxU32 value );
|
||||
setThreadValue( AnyPtr value );
|
||||
|
||||
FxU32
|
||||
AnyPtr
|
||||
getThreadValueSLOW( void );
|
||||
|
||||
void
|
||||
@@ -2864,17 +2874,6 @@ assertDefaultState( void );
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Declare the number of chips. For Linux, we only use
|
||||
* one chip unless we are fullscreen.
|
||||
*/
|
||||
#ifdef __linux__
|
||||
#define GR_DCL_NUMCHIPS \
|
||||
int numChips=(driInfo.isFullScreen ? gc->chipCount : 1)
|
||||
#else /* defined(__linux__) */
|
||||
int numChips = gc->chipCount
|
||||
#endif /* defined(__linux__) */
|
||||
|
||||
#define GR_DCL_GC GrGC *gc = (GrGC*)getThreadValueFast()
|
||||
|
||||
#define GR_DCL_HW_INIT SstRegs *hw
|
||||
@@ -2893,7 +2892,7 @@ assertDefaultState( void );
|
||||
saveLevel = gc->myLevel; \
|
||||
myName = name; \
|
||||
gc->myLevel = level; \
|
||||
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkPtr = (AnyPtr)gc->cmdTransportInfo.fifoPtr; \
|
||||
GDBG_INFO(gc->myLevel,myName); \
|
||||
FXUNUSED(saveLevel); \
|
||||
FXUNUSED(hw); \
|
||||
@@ -2904,7 +2903,7 @@ assertDefaultState( void );
|
||||
const char* myName = name; \
|
||||
GR_ASSERT(gc != NULL); \
|
||||
gc->myLevel = level; \
|
||||
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr; \
|
||||
gc->checkPtr = (AnyPtr)gc->cmdTransportInfo.fifoPtr; \
|
||||
GDBG_INFO(gc->myLevel,myName); \
|
||||
FXUNUSED(saveLevel); \
|
||||
FXUNUSED(hw); \
|
||||
@@ -3067,7 +3066,7 @@ extern FxU32 SST_TEXTURE_ALIGN;
|
||||
#define HW_TEX_PTR(__b) ((FxU32*)(((FxU32)(__b)) + HW_TEXTURE_OFFSET))
|
||||
|
||||
/* access a floating point array with a byte index */
|
||||
#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
|
||||
#define FARRAY(p,i) (*(float *)((i)+(long)(p)))
|
||||
#define ArraySize(__a) (sizeof(__a) / sizeof((__a)[0]))
|
||||
|
||||
#if GDBG_INFO_ON
|
||||
@@ -3176,3 +3175,4 @@ extern FxBool MultitextureAndTrilinear(void);
|
||||
|
||||
#endif /* __FXGLIDE_H__ */
|
||||
|
||||
|
||||
|
||||
@@ -388,8 +388,8 @@ aaVpDrawArrayEdgeSense(float *a, float *b, float *c, float oowa, float oowb)
|
||||
}
|
||||
else {
|
||||
ia = gc->state.vData.pargbInfo.offset;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((int)a + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((int)b + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((long)a + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((long)b + ia))&0x00ffffff;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -589,7 +589,7 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
FxU32 ia;
|
||||
FxU32 i;
|
||||
FxU32 vsize;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
FxU32 tmp_cullStripHdr;
|
||||
|
||||
GDBG_INFO(94,"_grAADrawPoints(0x%x, %d, 0x%x)\n", mode, count, pointers);
|
||||
@@ -597,8 +597,10 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
GDBG_INFO_MORE(gc->myLevel, "(count = %d, pointers = 0x%x)\n",
|
||||
count, pointers);
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof (float *)/sizeof (float);
|
||||
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
@@ -690,7 +692,7 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
FxU32 argb;
|
||||
|
||||
if (i == ia) {
|
||||
argb = *((FxU32 *)((int)e + i)) & 0x00ffffff;
|
||||
argb = *((FxU32 *)((long)e + i)) & 0x00ffffff;
|
||||
TRI_SETF(*((float *)&argb));
|
||||
}
|
||||
else {
|
||||
@@ -815,7 +817,7 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
FxU32 ia, vNum = 0;
|
||||
FxU32 vsize;
|
||||
FxU32 sCount;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
FxU32 tmp_cullStripHdr;
|
||||
|
||||
GDBG_INFO(95,"_grAADrawLineStrip(count = %d, pointers = 0x%x)\n",
|
||||
@@ -831,8 +833,11 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof (float *) / sizeof(float);
|
||||
|
||||
if (ltype == GR_LINES)
|
||||
sCount = count >> 1; /* line list */
|
||||
else
|
||||
@@ -869,8 +874,8 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
ady = -ady;
|
||||
|
||||
if (gc->state.vData.colorType != GR_FLOAT) {
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((int)v1 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((int)v2 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((long)v1 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((long)v2 + ia))&0x00ffffff;
|
||||
}
|
||||
|
||||
if (adx >= ady) { /* X major line */
|
||||
@@ -1076,8 +1081,8 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
ady = -ady;
|
||||
/*
|
||||
if (gc->state.vData.colorType != GR_FLOAT) {
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((int)v1 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((int)v2 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((long)v1 + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((long)v2 + ia))&0x00ffffff;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -1270,8 +1275,8 @@ aaDrawArrayEdgeSense(float *a, float *b, float *c)
|
||||
}
|
||||
else {
|
||||
ia = gc->state.vData.pargbInfo.offset;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((int)a + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((int)b + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v1a)=*((FxU32 *)((long)a + ia))&0x00ffffff;
|
||||
*((FxU32 *)&v2a)=*((FxU32 *)((long)b + ia))&0x00ffffff;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1350,7 +1355,7 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
float **lPtr = (float **)pointers;
|
||||
FxI32 tCount = 3;
|
||||
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
|
||||
FxI32 yindex = xindex + 1;
|
||||
|
||||
@@ -1367,8 +1372,10 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
/* gc->state.invalid |= fbzModeBIT; */
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof (float *) / sizeof(float);
|
||||
|
||||
/* backfaced or zero area */
|
||||
while (tCount <= count) {
|
||||
@@ -1523,7 +1530,7 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
float **lPtr = (float **)pointers;
|
||||
FxI32 tCount = 3;
|
||||
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
|
||||
FxI32 yindex = xindex + 1;
|
||||
|
||||
@@ -1540,8 +1547,10 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
|
||||
/* gc->state.invalid |= fbzModeBIT; */
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float *) / sizeof(float);
|
||||
|
||||
/* backfaced or zero area */
|
||||
while (tCount <= count) {
|
||||
@@ -1705,7 +1714,7 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
|
||||
float *v[3];
|
||||
FxBool flip = FXFALSE;
|
||||
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
|
||||
if (sCount <= 2) return;
|
||||
|
||||
@@ -1716,8 +1725,10 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
|
||||
gc->state.shadow.fbzMode &= ~(SST_ZAWRMASK);
|
||||
/* gc->state.invalid |= fbzModeBIT; */
|
||||
GR_FLUSH_STATE();
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof (float *) / sizeof(float);
|
||||
|
||||
sCount-=2;
|
||||
if (type == kSetupFan) {
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
#define OUTBOUNDS(a) (OUTBOUNDSX(a) || OUTBOUNDSY(a))
|
||||
|
||||
/* access an array of four-byte opaque datums with a byte index */
|
||||
#define ARRAY(p,i) (*(int *)((i)+(int)(p)))
|
||||
#define ARRAY(p,i) (*(int *)((i)+(long)(p)))
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** grDrawPoint
|
||||
@@ -281,17 +281,20 @@ GR_ENTRY(grDrawLine, void, (const void *a, const void *b))
|
||||
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, verts);
|
||||
}
|
||||
#else
|
||||
#ifdef __linux__
|
||||
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)
|
||||
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
|
||||
else
|
||||
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
|
||||
#else /* defined(__linux__) */
|
||||
#ifdef DRI_BUILD
|
||||
{
|
||||
const void *verts[2] = { a,b };
|
||||
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)
|
||||
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, verts);
|
||||
else
|
||||
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, verts);
|
||||
}
|
||||
#else /* defined(DRI_BUILD) */
|
||||
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)
|
||||
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, &(void *)a);
|
||||
else
|
||||
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, &(void *)a);
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
#endif
|
||||
|
||||
#undef FN_NAME
|
||||
@@ -302,9 +305,9 @@ GR_ENTRY(grDrawLine, void, (const void *a, const void *b))
|
||||
*/
|
||||
|
||||
#if !defined(__POWERPC__) || GLIDE_USE_C_TRISETUP
|
||||
#if !defined(GLIDE_DEBUG) && !defined(__linux__)
|
||||
#if !defined(GLIDE_DEBUG) && !defined(DRI_BUILD)
|
||||
__declspec( naked )
|
||||
#endif /* !defined(GLIDE_DEBUG) && !defined(__linux__) */
|
||||
#endif /* !defined(GLIDE_DEBUG) && !defined(DRI_BUILD) */
|
||||
GR_ENTRY(grDrawTriangle, void, (const void *a, const void *b, const void *c))
|
||||
{
|
||||
#define FN_NAME "grDrawTriangle"
|
||||
@@ -327,7 +330,7 @@ GR_ENTRY(grDrawTriangle, void, (const void *a, const void *b, const void *c))
|
||||
/* HackAlert: Nuke the fifo ptr checking stuff here if we're just
|
||||
* debugging the asm tri code.
|
||||
*/
|
||||
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr;
|
||||
gc->checkPtr = (AnyPtr)gc->cmdTransportInfo.fifoPtr;
|
||||
gc->checkCounter = 0;
|
||||
#else /* GLIDE_DEBUG */
|
||||
GR_END();
|
||||
@@ -352,14 +355,14 @@ GR_ENTRY(grDrawTriangle, void, (const void *a, const void *b, const void *c))
|
||||
}
|
||||
lostContext: ; /* <-- my, that's odd, but MSVC was insistent */
|
||||
}
|
||||
#elif defined(__linux__)
|
||||
#elif defined(DRI_BUILD)
|
||||
{
|
||||
GR_BEGIN_NOFIFOCHECK("grDrawTriangle",92);
|
||||
TRISETUP(a, b, c);
|
||||
GR_END();
|
||||
}
|
||||
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
#error "Write triangle proc dispatch for this compiler"
|
||||
#endif /* Triangle proc dispatch routine */
|
||||
#undef FN_NAME
|
||||
@@ -388,7 +391,7 @@ GR_ENTRY(grDrawTriangle, void, (const void *a, const void *b, const void *c))
|
||||
GR_INC_SIZE(sizeof(FxU32))
|
||||
|
||||
#define DA_END \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoRoom -= ((AnyPtr)packetPtr - (AnyPtr)gc->cmdTransportInfo.fifoPtr); \
|
||||
gc->cmdTransportInfo.fifoPtr = packetPtr; \
|
||||
FIFO_ASSERT(); \
|
||||
}
|
||||
@@ -414,7 +417,7 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
* except the data set up is from the pointer array and
|
||||
* its data layout
|
||||
*/
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
|
||||
/* we snap to an integer by adding a large enough number that it
|
||||
* shoves all fraction bits off the right side of the mantissa.
|
||||
@@ -449,8 +452,10 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
|
||||
*/
|
||||
#define POINTS_BUFFER 100
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float *) / sizeof(float);
|
||||
|
||||
if (gc->state.grCoordinateSpaceArgs.coordinate_space_mode == GR_WINDOW_COORDS) {
|
||||
#ifndef FX_GLIDE_H5_CSIM
|
||||
@@ -757,7 +762,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
int j;
|
||||
FxI32 sCount;
|
||||
FxU32 vertexParamOffset;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
|
||||
#define DX gc->pool.ftemp1
|
||||
#define ADY gc->pool.ftemp2
|
||||
@@ -773,8 +778,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
|
||||
#define LINES_BUFFER 100
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float *) / sizeof(float);
|
||||
|
||||
if (ltype == GR_LINES)
|
||||
sCount = count >> 1; /* line list */
|
||||
else
|
||||
@@ -802,16 +810,16 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
|
||||
i = *(long *)&ADY;
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
float *tv;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(long *)&ADY) = i;
|
||||
(*(int *)&ADY) = i;
|
||||
}
|
||||
|
||||
DX = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
|
||||
j = *(long *)&DX;
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
@@ -981,7 +989,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
** compute absolute deltas and draw from low Y to high Y
|
||||
*/
|
||||
ADY = tmp2 - tmp1;
|
||||
i = *(long *)&ADY;
|
||||
i = *(int *)&ADY;
|
||||
if (i < 0) {
|
||||
float *tv;
|
||||
owa = oowb; owb = oowa;
|
||||
@@ -989,7 +997,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
fby = tmp1;
|
||||
tv = a; a = b; b = tv;
|
||||
i ^= 0x80000000; /* ady = -ady; */
|
||||
(*(long *)&ADY) = i;
|
||||
(*(int *)&ADY) = i;
|
||||
}
|
||||
fax = FARRAY(a, gc->state.vData.vertexInfo.offset)
|
||||
*owa*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
@@ -997,7 +1005,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
|
||||
*owb*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
|
||||
|
||||
DX = fbx - fax;
|
||||
j = *(long *)&DX;
|
||||
j = *(int *)&DX;
|
||||
if (j < 0) {
|
||||
j ^= 0x80000000; /* adx = -adx; */
|
||||
}
|
||||
@@ -1083,7 +1091,7 @@ _grDrawTriangles_Default(FxI32 mode, FxI32 count, void *pointers)
|
||||
#if GLIDE_HW_TRI_SETUP && GLIDE_PACKET3_TRI_SETUP
|
||||
FxI32
|
||||
k;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
float *vPtr;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
|
||||
@@ -1097,9 +1105,10 @@ _grDrawTriangles_Default(FxI32 mode, FxI32 count, void *pointers)
|
||||
GDBG_INFO(110, "%s: paramMask = 0x%x\n", FN_NAME, gc->cmdTransportInfo.paramMask);
|
||||
#endif
|
||||
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
|
||||
else
|
||||
stride = sizeof (float *) / sizeof (float);
|
||||
|
||||
gc->stats.trisProcessed+=(count/3);
|
||||
|
||||
@@ -1170,3 +1179,4 @@ _grDrawTriangles_Default(FxI32 mode, FxI32 count, void *pointers)
|
||||
#undef FN_NAME
|
||||
} /* _grDrawTriangles */
|
||||
|
||||
|
||||
|
||||
@@ -254,13 +254,13 @@ int _guHeapCheck( void )
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !__POWERPC__ && !defined(__linux__)
|
||||
#if !__POWERPC__ && !(GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
void
|
||||
i3(void)
|
||||
{
|
||||
__asm int 3;
|
||||
}
|
||||
#endif /* !__POWERPC__ && !defined(__linux__) */
|
||||
#endif /* !__POWERPC__ && !(GLIDE_PLATFORM & GLIDE_OS_UNIX) */
|
||||
|
||||
void
|
||||
_grAssert(char *exp, char *fileName, int lineNo)
|
||||
@@ -293,7 +293,7 @@ _grAssert(char *exp, char *fileName, int lineNo)
|
||||
|
||||
gdbg_printf("Command Fifo:\n");
|
||||
gdbg_printf("\tSoftware:\n");
|
||||
gdbg_printf("\t\tfifoPtr: 0x%X\n", (FxU32)gc->cmdTransportInfo.fifoPtr - (FxU32) gc->rawLfb);
|
||||
gdbg_printf("\t\tfifoPtr: 0x%X\n", (AnyPtr)gc->cmdTransportInfo.fifoPtr - (AnyPtr) gc->rawLfb);
|
||||
gdbg_printf("\t\tfifoOffset: 0x%X\n", gc->cmdTransportInfo.fifoOffset);
|
||||
gdbg_printf("\t\tfifoEnd: 0x%X\n", gc->cmdTransportInfo.fifoEnd - gc->rawLfb);
|
||||
gdbg_printf("\t\tfifoSize: 0x%X\n", gc->cmdTransportInfo.fifoSize);
|
||||
@@ -303,7 +303,7 @@ _grAssert(char *exp, char *fileName, int lineNo)
|
||||
|
||||
if ( !gc->windowed ) {
|
||||
gdbg_printf("\tHardware:\n");
|
||||
gdbg_printf("\t\treadPtrL: 0x%X\n", HW_FIFO_PTR(FXTRUE) - (FxU32)gc->rawLfb);
|
||||
gdbg_printf("\t\treadPtrL: 0x%X\n", HW_FIFO_PTR(FXTRUE) - (AnyPtr)gc->rawLfb);
|
||||
gdbg_printf("\t\tdepth: 0x%X\n", GR_CAGP_GET(depth));
|
||||
gdbg_printf("\t\tholeCount: 0x%X\n", GR_CAGP_GET(holeCount));
|
||||
gdbg_printf("\t\tbaseAddrL: 0x%X\n", GR_CAGP_GET(baseAddrL));
|
||||
@@ -323,3 +323,5 @@ _grAssert(char *exp, char *fileName, int lineNo)
|
||||
exit(-1);
|
||||
|
||||
} /* _grAssert */
|
||||
|
||||
|
||||
|
||||
@@ -632,6 +632,8 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -651,7 +653,7 @@
|
||||
#endif /* !HAL_CSIM */
|
||||
#endif /* (GLIDE_PLATFORM & GLIDE_SST_SIM) */
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
#include <lindri.h>
|
||||
#endif
|
||||
|
||||
@@ -700,7 +702,7 @@ GR_STATE_ENTRY(grAlphaBlendFunction, void,
|
||||
alpha_sf = GR_BLEND_ONE;
|
||||
break;
|
||||
}
|
||||
switch (alpha_sf) {
|
||||
switch (alpha_df) {
|
||||
case GR_BLEND_ZERO:
|
||||
case GR_BLEND_SRC_ALPHA:
|
||||
case GR_BLEND_DST_ALPHA:
|
||||
@@ -1300,7 +1302,7 @@ _grTriFill(GrColor_t color, FxU32 depth, GrStencil_t stencil)
|
||||
{
|
||||
REG_GROUP_SET(hw, stencilMode, (GR_CMP_ALWAYS << SST_STENCIL_FUNC_SHIFT) |
|
||||
(stencil << SST_STENCIL_REF_SHIFT) |
|
||||
stencilMode & (SST_STENCIL_WMASK | SST_STENCIL_MASK) |
|
||||
(stencilMode & (SST_STENCIL_WMASK | SST_STENCIL_MASK)) |
|
||||
SST_STENCIL_ENABLE) ;
|
||||
REG_GROUP_SET(hw, stencilOp, (GR_STENCILOP_REPLACE << SST_STENCIL_SFAIL_OP_SHIFT) |
|
||||
(GR_STENCILOP_REPLACE << SST_STENCIL_ZFAIL_OP_SHIFT) |
|
||||
@@ -1768,7 +1770,12 @@ GR_ENTRY(grBufferClear, void, (GrColor_t color, GrAlpha_t alpha, FxU32 depth))
|
||||
/* tbext */
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 2, 0x3);
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.auxBufferAddr );
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.auxBufferStride);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer)? driInfo.stride :
|
||||
gc->state.shadow.auxBufferStride);
|
||||
#else /* defined(DRI_BUILD) */
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.auxBufferStride );
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
REG_GROUP_END();
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
if (IS_NAPALM(gc->bInfo->pciInfo.deviceID))
|
||||
@@ -1814,7 +1821,12 @@ GR_ENTRY(grBufferClear, void, (GrColor_t color, GrAlpha_t alpha, FxU32 depth))
|
||||
} else {
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 2, 0x3);
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers0[gc->windowed ? 0 : gc->curBuffer]);
|
||||
REG_GROUP_SET(hw, colBufferStride,gc->state.shadow.colBufferStride);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
REG_GROUP_END();
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
if (IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
|
||||
@@ -2293,7 +2305,12 @@ GR_EXT_ENTRY(grBufferClearExt, void, (GrColor_t color, GrAlpha_t alpha, FxU32 de
|
||||
/* tbext */
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 2, 0x3) ;
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.auxBufferAddr) ;
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.auxBufferStride) ;
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.auxBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.auxBufferStride );
|
||||
#endif
|
||||
REG_GROUP_END() ;
|
||||
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
@@ -2338,7 +2355,12 @@ GR_EXT_ENTRY(grBufferClearExt, void, (GrColor_t color, GrAlpha_t alpha, FxU32 de
|
||||
} else {
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 2, 0x3) ;
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers0[gc->windowed ? 0 : gc->curBuffer]) ;
|
||||
REG_GROUP_SET(hw, colBufferStride,gc->state.shadow.colBufferStride) ;
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
REG_GROUP_END() ;
|
||||
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
@@ -2494,7 +2516,7 @@ GR_ENTRY(grBufferClear, void, (GrColor_t color, GrAlpha_t alpha, FxU32 depth))
|
||||
} /* grBufferClear */
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef DRI_BUILD
|
||||
/*---------------------------------------------------------------------------
|
||||
** grBufferSwap
|
||||
**
|
||||
@@ -2619,6 +2641,7 @@ GR_ENTRY(grBufferSwap, void, (FxU32 swapInterval))
|
||||
*bufPtrs[i] = curBufIndex;
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_PACKET_FIFO
|
||||
{
|
||||
int i, j = -1;
|
||||
@@ -2740,9 +2763,9 @@ GR_ENTRY(grBufferSwap, void, (FxU32 swapInterval))
|
||||
GR_END();
|
||||
#undef FN_NAME
|
||||
} /* grBufferSwap */
|
||||
|
||||
#else /* defined(DRI_BUILD) */
|
||||
/*---------------------------------------------------------------------------
|
||||
** grDRIBufferSwap
|
||||
** grBufferSwap
|
||||
**
|
||||
** NOTE: This routine should be COMPLETELY device-independant,
|
||||
** but it isn't right now because we need to move all the
|
||||
@@ -2758,13 +2781,6 @@ GR_ENTRY(grDRIBufferSwap, void, (FxU32 swapInterval))
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME,86);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d)\n",swapInterval);
|
||||
|
||||
#ifdef __linux__
|
||||
if (driInfo.isFullScreen) {
|
||||
grBufferSwap(swapInterval);
|
||||
return;
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
if (IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
|
||||
_grChipMask( SST_CHIP_MASK_ALL_CHIPS );
|
||||
@@ -2792,8 +2808,8 @@ GR_ENTRY(grDRIBufferSwap, void, (FxU32 swapInterval))
|
||||
for ( i = 0; i < MAX_BUFF_PENDING && j == -1; i++) {
|
||||
if (gc->bufferSwaps[i] == 0xffffffff) {
|
||||
gc->bufferSwaps[i] =
|
||||
(FxU32) gc->cmdTransportInfo.fifoPtr -
|
||||
(FxU32) gc->cmdTransportInfo.fifoStart;
|
||||
(AnyPtr) gc->cmdTransportInfo.fifoPtr -
|
||||
(AnyPtr) gc->cmdTransportInfo.fifoStart;
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
@@ -2889,6 +2905,7 @@ GR_ENTRY(grDRIBufferSwap, void, (FxU32 swapInterval))
|
||||
GR_END();
|
||||
#undef FN_NAME
|
||||
} /* grBufferSwap */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** grBufferNumPending
|
||||
@@ -3587,7 +3604,7 @@ GR_ENTRY(grDisableAllEffects, void, (void))
|
||||
** grStippleMode
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
GR_STATE_ENTRY(grStippleMode, void, (GrStippleMode_t mode))
|
||||
{
|
||||
#define FN_NAME "_grStippleMode"
|
||||
@@ -3621,7 +3638,7 @@ GR_STATE_ENTRY(grStippleMode, void, (GrStippleMode_t mode))
|
||||
#endif /* !GLIDE3 */
|
||||
#undef FN_NAME
|
||||
} /* grStippleMode */
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** grDitherMode
|
||||
@@ -3888,7 +3905,7 @@ GR_ENTRY(grGlideShutdown, void, (void))
|
||||
* continuing so that any internal glide calls have a valid
|
||||
* gc from tls via GR_DCL_GC. F*ck this up at your own peril.
|
||||
*/
|
||||
setThreadValue((FxU32)gc);
|
||||
setThreadValue((AnyPtr)gc);
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
|
||||
/* Flush any remaining commands and cleanup any per gc state */
|
||||
grSurfaceReleaseContext((GrContext_t)gc);
|
||||
@@ -4093,6 +4110,7 @@ GR_ENTRY(grGlideSetState, void, (const void *state))
|
||||
** and the only drawbuffer modes supported by the fbzMode register are 0
|
||||
** (back) and 1 (front)
|
||||
*/
|
||||
#ifndef DRI_BUILD
|
||||
GR_STATE_ENTRY(grRenderBuffer, void, (GrBuffer_t buffer))
|
||||
{
|
||||
#define FN_NAME "_grRenderBuffer"
|
||||
@@ -4112,16 +4130,9 @@ GR_STATE_ENTRY(grRenderBuffer, void, (GrBuffer_t buffer))
|
||||
? gc->frontBuffer
|
||||
: gc->backBuffer);
|
||||
if (oldBuffer != gc->curBuffer) {
|
||||
#ifdef __linux__
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 2, 0x3);
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers0[gc->curBuffer]);
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride);
|
||||
REG_GROUP_END();
|
||||
#else /* defined(__linux__) */
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 1, 0x1);
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers0[gc->curBuffer]);
|
||||
REG_GROUP_END();
|
||||
#endif /* defined(__linux__) */
|
||||
gc->state.shadow.colBufferAddr = gc->buffers0[gc->curBuffer];
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
if (IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
|
||||
@@ -4139,6 +4150,46 @@ GR_STATE_ENTRY(grRenderBuffer, void, (GrBuffer_t buffer))
|
||||
#undef FN_NAME
|
||||
} /* grRenderBuffer */
|
||||
|
||||
#else /* DRI_BUILD */
|
||||
|
||||
GR_STATE_ENTRY(grRenderBuffer, void, (GrBuffer_t buffer))
|
||||
{
|
||||
#define FN_NAME "_grRenderBuffer"
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 85);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d)\n",buffer);
|
||||
/* tbext */
|
||||
GR_CHECK_F(myName, ((buffer != GR_BUFFER_TEXTUREBUFFER_EXT )
|
||||
&& (buffer != GR_BUFFER_FRONTBUFFER )
|
||||
&& (buffer != GR_BUFFER_BACKBUFFER )), "invalid buffer");
|
||||
{
|
||||
/* tbext */
|
||||
if ( !(buffer == GR_BUFFER_TEXTUREBUFFER_EXT ) ) {
|
||||
gc->curBuffer = ((buffer == GR_BUFFER_FRONTBUFFER)
|
||||
? gc->frontBuffer
|
||||
: gc->backBuffer);
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 2, 0x3);
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers0[gc->curBuffer]);
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride);
|
||||
REG_GROUP_END();
|
||||
gc->state.shadow.colBufferAddr = gc->buffers0[gc->curBuffer];
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
if (IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
|
||||
if (gc->enableSecondaryBuffer) {
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 1, 0x1);
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers1[gc->curBuffer] | SST_BUFFER_BASE_SELECT);
|
||||
REG_GROUP_END();
|
||||
}
|
||||
}
|
||||
#endif /* FX_GLIDE_NAPALM */
|
||||
}/* endif ! buffer == GR_BUFFER_TEXTUREBUFFER_EXT */
|
||||
}
|
||||
GR_END();
|
||||
#undef FN_NAME
|
||||
} /* grRenderBuffer */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
|
||||
GR_ENTRY(grCheckForRoom, void, (FxI32 n))
|
||||
{
|
||||
#define FN_NAME "grCheckForRoom"
|
||||
@@ -5042,97 +5093,100 @@ GR_EXT_ENTRY(grTBufferWriteMaskExt, void , (FxU32 tmask) )
|
||||
|
||||
chipEnList = gc->chipmask;
|
||||
|
||||
{
|
||||
GR_DCL_NUMCHIPS;
|
||||
for (chipIndex = 0; chipIndex < numChips; chipIndex++) {
|
||||
/*
|
||||
* In a two-chip config, chip 0 does samples 0 and 1, and
|
||||
* chip 1 does samples 2 and 3
|
||||
*
|
||||
* In a four-chip config, chips 0 and 2 do samples 0 and 1,
|
||||
* and chips 1 and 3 do samples 2 and 3
|
||||
*/
|
||||
FxU32 chipaamode = (tmask >> ((chipIndex & 0x01) ? 2:0)) & 0x03;
|
||||
switch (chipaamode) {
|
||||
case 0:
|
||||
/*
|
||||
* disable the chip, don't care about the buffers
|
||||
*/
|
||||
chipEnList &= ~(1 << chipIndex);
|
||||
break;
|
||||
case 1:
|
||||
/*
|
||||
* We are only rendering to the primary buffer
|
||||
* (sample 0 or 2) so just set up the primary buffer jitter
|
||||
* values and disable the secondary buffer.
|
||||
*/
|
||||
chipEnList |= (1 << chipIndex);
|
||||
_grChipMask(1 << chipIndex);
|
||||
_grAAOffsetValue(defaultXOffset0, defaultYOffset0,
|
||||
chipIndex, chipIndex, FXTRUE, FXFALSE);
|
||||
/* setup color/aux buffer */
|
||||
gc->state.shadow.colBufferAddr = gc->buffers0[gc->curBuffer];
|
||||
gc->state.shadow.auxBufferAddr = gc->buffers0[gc->grColBuf];
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.colBufferAddr);
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride);
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->state.shadow.auxBufferAddr);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
break;
|
||||
case 2:
|
||||
/*
|
||||
* We are only rendering to the secondary buffer
|
||||
* (sample 1 or 3), so point the primary color buffer
|
||||
* address at the secondary buffer, and use the secondary
|
||||
* jitter values for this chip as the primary values, and
|
||||
* disable the second
|
||||
* buffer.
|
||||
*/
|
||||
chipEnList |= (1 << chipIndex);
|
||||
_grChipMask(1 << chipIndex);
|
||||
_grAAOffsetValue(defaultXOffset0, defaultYOffset0, chipIndex, chipIndex, FXTRUE, FXFALSE);
|
||||
/* setup color/aux buffer */
|
||||
gc->state.shadow.colBufferAddr = gc->buffers1[gc->curBuffer];
|
||||
gc->state.shadow.auxBufferAddr = gc->buffers1[gc->grColBuf];
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.colBufferAddr);
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride);
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->state.shadow.auxBufferAddr);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
break;
|
||||
case 3:
|
||||
/* This chip is doing both 0 and 1 or 2 and 3, so enable both sets
|
||||
of buffers. */
|
||||
chipEnList |= (1 << chipIndex);
|
||||
_grChipMask(1 << chipIndex);
|
||||
_grAAOffsetValue(defaultXOffset0, defaultYOffset0, chipIndex, chipIndex, FXTRUE, gc->enableSecondaryBuffer);
|
||||
/* setup color/aux buffer */
|
||||
gc->state.shadow.colBufferAddr = gc->buffers0[gc->curBuffer];
|
||||
gc->state.shadow.auxBufferAddr = gc->buffers0[gc->grColBuf];
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.colBufferAddr);
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride);
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->state.shadow.auxBufferAddr);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers1[gc->curBuffer] | SST_BUFFER_BASE_SELECT);
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride);
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->buffers1[gc->grColBuf] | SST_BUFFER_BASE_SELECT);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
break;
|
||||
for (chipIndex = 0; chipIndex < gc->chipCount; chipIndex++) {
|
||||
/* In a two-chip config, chip 0 does samples 0 and 1, and chip 1 does samples 2 and 3 */
|
||||
/* In a four-chip config, chips 0 and 2 do samples 0 and 1, and chips 1 and 3 do samples 2 and 3 */
|
||||
FxU32 chipaamode = (tmask >> ((chipIndex & 0x01) ? 2:0)) & 0x03;
|
||||
switch (chipaamode) {
|
||||
case 0:
|
||||
/* disable the chip, don't care about the buffers */
|
||||
chipEnList &= ~(1 << chipIndex);
|
||||
break;
|
||||
case 1:
|
||||
/* We are only rendering to the primary buffer (sample 0 or 2) so just set up the
|
||||
primary buffer jitter values and disable the secondary buffer. */
|
||||
chipEnList |= (1 << chipIndex);
|
||||
_grChipMask(1 << chipIndex);
|
||||
_grAAOffsetValue(defaultXOffset0, defaultYOffset0,
|
||||
chipIndex, chipIndex, FXTRUE, FXFALSE);
|
||||
/* setup color/aux buffer */
|
||||
gc->state.shadow.colBufferAddr = gc->buffers0[gc->curBuffer];
|
||||
gc->state.shadow.auxBufferAddr = gc->buffers0[gc->grColBuf];
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.colBufferAddr);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->state.shadow.auxBufferAddr);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
break;
|
||||
case 2:
|
||||
/* We are only rendering to the secondary buffer (sample 1 or 3), so point the
|
||||
primary color buffer address at the secondary buffer, and use the secondary
|
||||
jitter values for this chip as the primary values, and disable the second
|
||||
buffer. */
|
||||
chipEnList |= (1 << chipIndex);
|
||||
_grChipMask(1 << chipIndex);
|
||||
_grAAOffsetValue(defaultXOffset0, defaultYOffset0, chipIndex, chipIndex, FXTRUE, FXFALSE);
|
||||
/* setup color/aux buffer */
|
||||
gc->state.shadow.colBufferAddr = gc->buffers1[gc->curBuffer];
|
||||
gc->state.shadow.auxBufferAddr = gc->buffers1[gc->grColBuf];
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.colBufferAddr);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->state.shadow.auxBufferAddr);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
break;
|
||||
case 3:
|
||||
/* This chip is doing both 0 and 1 or 2 and 3, so enable both sets
|
||||
of buffers. */
|
||||
chipEnList |= (1 << chipIndex);
|
||||
_grChipMask(1 << chipIndex);
|
||||
_grAAOffsetValue(defaultXOffset0, defaultYOffset0, chipIndex, chipIndex, FXTRUE, gc->enableSecondaryBuffer);
|
||||
/* setup color/aux buffer */
|
||||
gc->state.shadow.colBufferAddr = gc->buffers0[gc->curBuffer];
|
||||
gc->state.shadow.auxBufferAddr = gc->buffers0[gc->grColBuf];
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.colBufferAddr);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->state.shadow.auxBufferAddr);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers1[gc->curBuffer] | SST_BUFFER_BASE_SELECT);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->buffers1[gc->grColBuf] | SST_BUFFER_BASE_SELECT);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5678,11 +5732,11 @@ GR_DDFUNC(_grInitializeGCFuncs, void, (GrGC *gc))
|
||||
gc->gcFuncs.grBufferClear = (void *) GR_DDNAME(grBufferClear);
|
||||
gc->gcFuncs.grBufferNumPending = (void *)
|
||||
GR_DDNAME(grBufferNumPending);
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
gc->gcFuncs.grBufferSwap = (void *) GR_DDNAME(grDRIBufferSwap);
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
gc->gcFuncs.grBufferSwap = (void *) GR_DDNAME(grBufferSwap);
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
gc->gcFuncs.grChromakeyMode = (void *) GR_DDNAME(grChromakeyMode);
|
||||
gc->gcFuncs.grChromakeyValue = (void *) GR_DDNAME(grChromakeyValue);
|
||||
gc->gcFuncs.grClipWindow = (void *) GR_DDNAME(grClipWindow);
|
||||
@@ -5761,3 +5815,4 @@ GR_DDFUNC(_grInitializeGCFuncs, void, (GrGC *gc))
|
||||
gc->gcFuncs.grCheckForRoom=(void *) GR_DDNAME(grCheckForRoom);
|
||||
} /* _grInitializeGCFuncs */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -272,6 +272,7 @@
|
||||
*
|
||||
**
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
@@ -280,9 +281,9 @@
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
#include <lindri.h>
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** grLfbConstantAlpha
|
||||
@@ -604,7 +605,7 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
/* Get the current lfb buffer */
|
||||
{
|
||||
/* FixMe: Is this true if we're triple buffering? */
|
||||
FxU32 colBufferIndex;
|
||||
FxU32 colBufferIndex = 0;
|
||||
|
||||
switch(buffer) {
|
||||
case GR_BUFFER_FRONTBUFFER:
|
||||
@@ -643,17 +644,19 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
}
|
||||
|
||||
if (rv) {
|
||||
#ifdef __linux__
|
||||
if (!colBufferIndex)
|
||||
info->strideInBytes = driInfo.stride;
|
||||
else
|
||||
info->strideInBytes = 0x1000; /* This is the default for 3D LFBs,
|
||||
* which are always 2048
|
||||
pixels wide. */
|
||||
#else /* defined(__linux__) */
|
||||
info->strideInBytes = 0x1000; /* This is the default for 3D LFBs,
|
||||
* which are always 2048 pixels wide. */
|
||||
#endif /* defined(__linux__) */
|
||||
#ifdef DRI_BUILD
|
||||
if (!colBufferIndex) {
|
||||
info->strideInBytes = driInfo.stride;
|
||||
} else {
|
||||
info->strideInBytes = gc->bInfo->buffInfo.bufLfbStride;
|
||||
}
|
||||
#else /* defined(DRI_BUILD) */
|
||||
/*
|
||||
* This is the default for 3D LFBs,
|
||||
* which are always 2048 pixels wide.
|
||||
*/
|
||||
info->strideInBytes = 0x1000;
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
info->origin = origin;
|
||||
|
||||
/* tbext. Kind of ugly. Kind of duplicate / unfolded code
|
||||
@@ -669,7 +672,7 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
if ( gc->textureBuffer.on &&
|
||||
( buffer == GR_BUFFER_TEXTUREBUFFER_EXT || buffer == GR_BUFFER_TEXTUREAUXBUFFER_EXT )) {
|
||||
if (type == GR_LFB_READ_ONLY) {
|
||||
info->lfbPtr = (void *)((FxU32)gc->rawLfb + gc->textureBuffer.addr);
|
||||
info->lfbPtr = (void *)((AnyPtr)gc->rawLfb + gc->textureBuffer.addr);
|
||||
info->strideInBytes = gc->textureBuffer.stride ;
|
||||
#if __POWERPC__
|
||||
if(IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
|
||||
@@ -691,16 +694,21 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
(!pixelPipeline) &&
|
||||
/* Origin must be upper left since we will return raw lfb */
|
||||
(origin != GR_ORIGIN_LOWER_LEFT)){
|
||||
info->lfbPtr = (void *)((FxU32)gc->rawLfb + gc->textureBuffer.addr);
|
||||
info->lfbPtr = (void *)((AnyPtr)gc->rawLfb + gc->textureBuffer.addr);
|
||||
info->strideInBytes = gc->textureBuffer.stride ;
|
||||
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
#ifdef defined(DRI_BUILD)
|
||||
/*
|
||||
* For Linux, we just return the correct address and
|
||||
* stride.
|
||||
*/
|
||||
info->strideInBytes = gc->bInfo->buffInfo.bufLfbStride;
|
||||
info->lfbPtr = (void *)gc->lfbBuffers[colBufferIndex];
|
||||
#else /* defined(DRI_BUILD) */
|
||||
info->lfbPtr = (void *)gc->lfb_ptr;
|
||||
#ifdef __linux__
|
||||
info->strideInBytes = 0x1000;
|
||||
#endif /* defined(__linux__) */
|
||||
switch (writeMode) {
|
||||
case GR_LFBWRITEMODE_565_DEPTH:
|
||||
case GR_LFBWRITEMODE_555_DEPTH:
|
||||
@@ -711,6 +719,7 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
info->strideInBytes <<= 1;
|
||||
break;
|
||||
}
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
}
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 2, 0x3);
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->textureBuffer.addr );
|
||||
@@ -719,7 +728,15 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
} else /* else !gc->textureBuffer.on */ {
|
||||
if (type == GR_LFB_READ_ONLY) {
|
||||
info->lfbPtr = (void *)gc->lfbBuffers[colBufferIndex];
|
||||
#if defined(DRI_BUILD)
|
||||
if (colBufferIndex == 0) {
|
||||
info->strideInBytes = driInfo.stride;
|
||||
} else {
|
||||
info->strideInBytes = gc->bInfo->buffInfo.bufLfbStride;
|
||||
}
|
||||
#else /* defined(DRI_BUILD) */
|
||||
info->strideInBytes = gc->bInfo->buffInfo.bufLfbStride;
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
#if __POWERPC__
|
||||
if(IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
|
||||
if(gc->grPixelSize == 2) {
|
||||
@@ -769,8 +786,15 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
/* Make sure dither rotation is disabled for 3D LFBs. */
|
||||
_3dlfb = FXTRUE;
|
||||
|
||||
#if defined(DRI_BUILD)
|
||||
/*
|
||||
* For Linux, we just return the correct address and
|
||||
* stride.
|
||||
*/
|
||||
info->strideInBytes = gc->bInfo->buffInfo.bufLfbStride;
|
||||
info->lfbPtr = (void *)gc->lfbBuffers[colBufferIndex];
|
||||
#else /* defined(DRI_BUILD) */
|
||||
info->lfbPtr = (void *)gc->lfb_ptr;
|
||||
|
||||
switch (writeMode) {
|
||||
case GR_LFBWRITEMODE_565_DEPTH:
|
||||
case GR_LFBWRITEMODE_555_DEPTH:
|
||||
@@ -781,6 +805,7 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
info->strideInBytes <<= 1;
|
||||
break;
|
||||
}
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -828,14 +853,11 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
|
||||
#if LFB_DISABLE_SLAVE_FIFO
|
||||
/* Disable slave command FIFO */
|
||||
{
|
||||
GR_DCL_NUMCHIPS;
|
||||
if(numChips > 1) {
|
||||
FxU32 depth;
|
||||
do {
|
||||
depth = GR_SLAVE_CAGP_GET(0, depth);
|
||||
} while(depth != 0);
|
||||
}
|
||||
if(gc->chipCount > 1) {
|
||||
FxU32 depth;
|
||||
do {
|
||||
depth = GR_SLAVE_CAGP_GET(0, depth);
|
||||
} while(depth != 0);
|
||||
}
|
||||
slaveBaseSize = GR_SLAVE_CAGP_GET(0, baseSize);
|
||||
GR_SLAVE_CAGP_SET(0, baseSize, 0);
|
||||
@@ -906,11 +928,8 @@ GR_ENTRY(grLfbUnlock, FxBool, (GrLock_t type, GrBuffer_t buffer))
|
||||
|
||||
#if LFB_DISABLE_SLAVE_FIFO
|
||||
/* Enable slave command FIFO */
|
||||
{
|
||||
GR_DCL_NUMCHIPS;
|
||||
if (numChips > 1) {
|
||||
GR_SLAVE_CAGP_SET(0, baseSize, slaveBaseSize);
|
||||
}
|
||||
if(gc->chipCount > 1) {
|
||||
GR_SLAVE_CAGP_SET(0, baseSize, slaveBaseSize);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1091,7 +1110,7 @@ _grLfbWriteRegion(FxBool pixPipelineP,
|
||||
case GR_LFB_SRC_FMT_ZA16:
|
||||
dstData = (FxU32*)(((FxU16*)dstData) + dst_x);
|
||||
length = src_width * 2;
|
||||
aligned = !((int)dstData&0x2);
|
||||
aligned = !((long)dstData&0x2);
|
||||
srcJump = src_stride - length;
|
||||
dstJump = info.strideInBytes - length;
|
||||
if (aligned) {
|
||||
@@ -1299,7 +1318,7 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
|
||||
scanline=src_height;
|
||||
|
||||
/* set length - alignment fix*/
|
||||
tmp=(((FxU32)src)&2);
|
||||
tmp=(((AnyPtr)src)&2);
|
||||
length=src_width * bpp - tmp;
|
||||
src_adjust=info.strideInBytes - tmp;
|
||||
dst_adjust=dst_stride - tmp;
|
||||
@@ -1310,7 +1329,7 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
|
||||
while(src_height--)
|
||||
{
|
||||
/* adjust starting alignment */
|
||||
if (((FxU32)src)&3)
|
||||
if (((AnyPtr)src)&3)
|
||||
*((FxU16 *)dst)++=*((FxU16 *)src)++;
|
||||
|
||||
/* read in dwords of pixels */
|
||||
@@ -1322,12 +1341,12 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
|
||||
/* copies aligned dwords */
|
||||
do
|
||||
{
|
||||
*((FxU32 *)(((FxU32)dst) + byte_index))=*((FxU32 *)(((FxU32)src) + byte_index));
|
||||
*((FxU32 *)(((AnyPtr)dst) + byte_index))=*((FxU32 *)(((AnyPtr)src) + byte_index));
|
||||
}while((byte_index+=4)<aligned);
|
||||
|
||||
/* handle backend misalignment */
|
||||
if (byte_index!=(FxU32)length)
|
||||
*((FxU16 *)(((FxU32)dst) + byte_index))=*((FxU16 *)(((FxU32)src) + byte_index));
|
||||
*((FxU16 *)(((AnyPtr)dst) + byte_index))=*((FxU16 *)(((AnyPtr)src) + byte_index));
|
||||
}
|
||||
/* adjust for next line */
|
||||
((FxU8 *)src)+=src_adjust;
|
||||
@@ -1381,7 +1400,7 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
|
||||
length = src_width * 2;
|
||||
dstJump = dst_stride - length;
|
||||
srcJump = info.strideInBytes - length;
|
||||
aligned = !((int)srcData&0x2);
|
||||
aligned = !((long)srcData&0x2);
|
||||
odd = (src_y+src_height) & 0x1;
|
||||
|
||||
#if __POWERPC__
|
||||
@@ -1478,3 +1497,4 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
|
||||
}/* grLfbReadRegion */
|
||||
#endif /* if __POWERPC__ */
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#ifndef __GLIDE_H__
|
||||
#define __GLIDE_H__
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
#include <sst1vid.h>
|
||||
@@ -52,11 +53,11 @@ extern "C" {
|
||||
typedef FxU32 GrColor_t;
|
||||
typedef FxU8 GrAlpha_t;
|
||||
typedef FxU32 GrMipMapId_t;
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
typedef FxU32 GrStipplePattern_t;
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
typedef FxU8 GrFog_t;
|
||||
typedef FxU32 GrContext_t;
|
||||
typedef AnyPtr GrContext_t;
|
||||
typedef int (FX_CALL *GrProc)();
|
||||
|
||||
/*
|
||||
@@ -243,12 +244,12 @@ typedef FxI32 GrDitherMode_t;
|
||||
#define GR_DITHER_2x2 0x1
|
||||
#define GR_DITHER_4x4 0x2
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
typedef FxI32 GrStippleMode_t;
|
||||
#define GR_STIPPLE_DISABLE 0x0
|
||||
#define GR_STIPPLE_PATTERN 0x1
|
||||
#define GR_STIPPLE_ROTATE 0x2
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
typedef FxI32 GrFogMode_t;
|
||||
#define GR_FOG_DISABLE 0x0
|
||||
@@ -744,13 +745,13 @@ grCoordinateSpace( GrCoordinateSpaceMode_t mode );
|
||||
FX_ENTRY void FX_CALL
|
||||
grDepthRange( FxFloat n, FxFloat f );
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
FX_ENTRY void FX_CALL
|
||||
grStippleMode( GrStippleMode_t mode );
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grStipplePattern( GrStipplePattern_t mode );
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grViewport( FxI32 x, FxI32 y, FxI32 width, FxI32 height );
|
||||
@@ -932,10 +933,6 @@ grGlideGetVertexLayout( void *layout );
|
||||
FX_ENTRY void FX_CALL
|
||||
grGlideSetVertexLayout( const void *layout );
|
||||
|
||||
#ifdef __linux__
|
||||
FX_ENTRY FxBool FX_CALL
|
||||
grDRISetupFullScreen(FxBool state);
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* FX_GLIDE_NO_FUNC_PROTO */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -945,3 +942,4 @@ grDRISetupFullScreen(FxBool state);
|
||||
#include <glideutl.h>
|
||||
|
||||
#endif /* __GLIDE_H__ */
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ n** -----------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
/* Check for OS */
|
||||
#if defined(__IRIX__) || defined(__sparc__) || defined(__linux__)
|
||||
#if defined(__IRIX__) || defined(__sparc__) || defined(__linux__) || defined(__FreeBSD__)
|
||||
# define GLIDE_OS GLIDE_OS_UNIX
|
||||
#elif defined(__DOS__)
|
||||
# define GLIDE_OS GLIDE_OS_DOS32
|
||||
|
||||
@@ -559,7 +559,7 @@ static GrTriSetupProc _triSetupProcs[][2][2][2] =
|
||||
{
|
||||
/* Window coords */
|
||||
{
|
||||
{ _trisetup_Default_win_nocull_valid, _trisetup_Default_win_cull_valid },
|
||||
{ _trisetup_Default_win_nocull_valid, _trisetup_Default_win_cull_valid },
|
||||
{ _trisetup_Default_win_nocull_invalid, _trisetup_Default_win_cull_invalid },
|
||||
},
|
||||
|
||||
@@ -574,8 +574,8 @@ static GrTriSetupProc _triSetupProcs[][2][2][2] =
|
||||
{
|
||||
/* Window coords */
|
||||
{
|
||||
{ _trisetup_3DNow_win_nocull_valid, _trisetup_3DNow_win_cull_valid },
|
||||
{ _trisetup_3DNow_win_nocull_invalid, _trisetup_3DNow_win_cull_invalid },
|
||||
{ _trisetup_3DNow_win_nocull_valid, _trisetup_3DNow_win_cull_valid },
|
||||
{ _trisetup_3DNow_win_nocull_invalid, _trisetup_3DNow_win_cull_invalid },
|
||||
},
|
||||
/* Clip coordinates */
|
||||
{
|
||||
@@ -588,14 +588,14 @@ static GrTriSetupProc _triSetupProcs[][2][2][2] =
|
||||
{
|
||||
/* Window coords */
|
||||
{
|
||||
{ _trisetup_null, _trisetup_null },
|
||||
{ _trisetup_null, _trisetup_null },
|
||||
{ (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
|
||||
{ (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
|
||||
},
|
||||
|
||||
/* Clip coordinates */
|
||||
{
|
||||
{ _trisetup_null, _trisetup_null },
|
||||
{ _trisetup_null, _trisetup_null },
|
||||
{ (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
|
||||
{ (GrTriSetupProc) _trisetup_null, (GrTriSetupProc) _trisetup_null },
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -604,7 +604,7 @@ static GrTriSetupProc _triSetupProcs[][2][2][2] =
|
||||
* unset for C_TRISETUP. Currently, teh grDrawTriangle code will only
|
||||
* vector to the asm code if C_TRISETUP is not set.
|
||||
*/
|
||||
#if GLIDE_USE_C_TRISETUP || __POWERPC__
|
||||
#if GLIDE_USE_C_TRISETUP || __alpha__ || __POWERPC__
|
||||
static GrVertexListProc _vertexListProcs[][2] = {
|
||||
{ _grDrawVertexList, _grDrawVertexList },
|
||||
#if GL_AMD3D
|
||||
@@ -995,13 +995,13 @@ _grSstDetectResources(void)
|
||||
chipCount = atoi(envChipNum);
|
||||
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
if ((hInfo = hwcInit(0x121a, 0x3)) == NULL)
|
||||
goto __errExit;
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
if ((hInfo = hwcInit(0x121a, 0x9)) == NULL)
|
||||
goto __errExit;
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
/* Iterate through boards found */
|
||||
for (ctx = 0; ctx < hInfo->nBoards; ctx++) {
|
||||
@@ -1543,7 +1543,7 @@ _GlideInitEnvironment(void)
|
||||
GDBG_INFO(80," nAuxBuffer: %d\n",_GlideRoot.environment.nAuxBuffer);
|
||||
_GlideRoot.environment.swFifoLWM = GLIDE_GETENV("FX_GLIDE_LWM", -1L);
|
||||
GDBG_INFO(80," swFifoLWM: %d\n",_GlideRoot.environment.swFifoLWM);
|
||||
_GlideRoot.environment.swapInterval = GLIDE_GETENV("FX_GLIDE_SWAPINTERVAL", -1L);
|
||||
_GlideRoot.environment.swapInterval = GLIDE_GETENV("FX_GLIDE_SWAPINTERVAL", 0);
|
||||
GDBG_INFO(80," swapInterval: %d\n",_GlideRoot.environment.swapInterval);
|
||||
_GlideRoot.environment.snapshot = GLIDE_GETENV("FX_SNAPSHOT", -1L);
|
||||
GDBG_INFO(80," snapshot: %d\n",_GlideRoot.environment.snapshot);
|
||||
@@ -1710,7 +1710,7 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
GR_DCL_GC;
|
||||
|
||||
/* If there is no current gc in tls then set the current context. */
|
||||
if (gc == NULL) setThreadValue((FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst]);
|
||||
if (gc == NULL) setThreadValue((AnyPtr)&_GlideRoot.GCs[_GlideRoot.current_sst]);
|
||||
}
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
@@ -1725,3 +1725,4 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
|
||||
} /* DllMain */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -803,6 +803,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include <3dfx.h>
|
||||
|
||||
#include <glidesys.h>
|
||||
@@ -833,7 +835,7 @@ static FxU32 lostcontext_csim;
|
||||
#endif
|
||||
#endif /* (GLIDE_PLATFORM & GLIDE_SST_SIM) */
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
#include <lindri.h>
|
||||
#endif
|
||||
|
||||
@@ -1036,7 +1038,7 @@ assertDefaultState( void )
|
||||
gc->state.mode2ppcTMU = 0xFFFFFFFF;
|
||||
} /* assertDefaultState */
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
static void
|
||||
clearBuffers( GrGC *gc )
|
||||
{
|
||||
@@ -1056,7 +1058,7 @@ clearBuffers( GrGC *gc )
|
||||
grRenderBuffer( GR_BUFFER_FRONTBUFFER );
|
||||
}
|
||||
} /* clearBuffers */
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
static void
|
||||
clearBuffers( GrGC *gc )
|
||||
{
|
||||
@@ -1076,7 +1078,7 @@ clearBuffers( GrGC *gc )
|
||||
grRenderBuffer( GR_BUFFER_FRONTBUFFER );
|
||||
}
|
||||
} /* clearBuffers */
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
static void
|
||||
doSplash( void )
|
||||
@@ -1159,21 +1161,21 @@ initGC ( GrGC *gc )
|
||||
GDBG_INFO(95, FN_NAME"(0x%X)\n", gc);
|
||||
|
||||
/* Setup the indices of the logical buffers */
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
gc->curBuffer = (gc->grColBuf > 1) ? 1 : 0;
|
||||
gc->frontBuffer = 0;
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
gc->curBuffer = 0;
|
||||
gc->frontBuffer = ((gc->grColBuf > 1) ? 1 : 0);
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
gc->backBuffer = (gc->grColBuf > 2) ? 2 : gc->curBuffer;
|
||||
|
||||
for (t = 0; t < 7; t++) {
|
||||
gc->bufferSwaps[t] = 0xffffffff;
|
||||
}
|
||||
|
||||
gc->bufferSwaps[0] = ((FxU32) gc->cmdTransportInfo.fifoPtr -
|
||||
(FxU32) gc->cmdTransportInfo.fifoStart);
|
||||
gc->bufferSwaps[0] = ((AnyPtr) gc->cmdTransportInfo.fifoPtr -
|
||||
(AnyPtr) gc->cmdTransportInfo.fifoStart);
|
||||
|
||||
gc->swapsPending = 1;
|
||||
|
||||
@@ -1373,17 +1375,17 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
GrContext_t retVal = 0;
|
||||
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
if (!hWnd)
|
||||
GrErrorCallback("grSstWinOpen: need to use a valid window handle",
|
||||
FXTRUE);
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
/* NB: TLS must be setup before the 'declaration' which grabs the
|
||||
* current gc. This gc is valid for all threads in the fullscreen
|
||||
* context.
|
||||
*/
|
||||
setThreadValue( (FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
setThreadValue( (AnyPtr)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
|
||||
{
|
||||
/* Partial Argument Validation */
|
||||
@@ -1531,16 +1533,16 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
GrContext_t retVal = 0;
|
||||
FxU32 tramShift, tmu1Offset;
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
if (!hWnd)
|
||||
GrErrorCallback("grSstWinOpen: need to use a valid window handle",
|
||||
FXTRUE);
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
/* NB: TLS must be setup before the 'declaration' which grabs the
|
||||
* current gc. This gc is valid for all threads in the fullscreen
|
||||
* context.
|
||||
*/
|
||||
setThreadValue( (FxU32)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
setThreadValue( (AnyPtr)&_GlideRoot.GCs[_GlideRoot.current_sst] );
|
||||
|
||||
{
|
||||
/* Partial Argument Validation */
|
||||
@@ -1569,10 +1571,10 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
? GR_RESOLUTION_640x480
|
||||
: resolution;
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
gc->state.screen_width = driInfo.screenWidth;
|
||||
gc->state.screen_height = driInfo.screenHeight;
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
gc->state.screen_width = _resTable[resolution].xres;
|
||||
gc->state.screen_height = _resTable[resolution].yres;
|
||||
GR_CHECK_F( FN_NAME,
|
||||
@@ -1582,7 +1584,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
gc->state.screen_width = gc->vidTimings->xDimension;
|
||||
gc->state.screen_height = gc->vidTimings->yDimension;
|
||||
}
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
|
||||
/* this is a stupid hack but... */
|
||||
@@ -1663,7 +1665,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
/* The DRI knows how the framebuffer should be configured */
|
||||
if (driInfo.cpp==3 || driInfo.cpp==4) { /* 24 or 32bpp modes */
|
||||
/* XXX Check for AA flags here too */
|
||||
@@ -2181,24 +2183,13 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
/* At this point we force SLI mode off. It'll be turned on later */
|
||||
driInfo.fullScreenPixFmt = hwPixelFormat;
|
||||
if (driInfo.cpp==2) driInfo.windowedPixFmt = GR_PIXFMT_RGB_565;
|
||||
else driInfo.windowedPixFmt = GR_PIXFMT_ARGB_8888;
|
||||
driInfo.sliCount=gc->sliCount;
|
||||
hwPixelFormat=driInfo.windowedPixFmt;
|
||||
gc->sliCount=1;
|
||||
/* gc->chipCount=1; */
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
vInfo->xRes = driInfo.w;
|
||||
vInfo->yRes = driInfo.h;
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
vInfo->xRes = gc->state.screen_width;
|
||||
vInfo->yRes = gc->state.screen_height;
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
vInfo->refresh = gc->grSstRefresh;
|
||||
vInfo->tiled = FXTRUE;
|
||||
vInfo->initialized = FXTRUE;
|
||||
@@ -2219,7 +2210,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
for (buffer = 0; buffer < nColBuffers; buffer++) {
|
||||
gc->buffers0[buffer] = bufInfo->colBuffStart0[buffer];
|
||||
GDBG_INFO(80, "Buffer %d: Start: 0x%x\n", buffer, gc->buffers0[buffer]);
|
||||
gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
gc->lfbBuffers[buffer] = (AnyPtr)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
if (bInfo->buffInfo.enable2ndbuffer) {
|
||||
gc->buffers1[buffer] = bufInfo->colBuffStart1[buffer];
|
||||
GDBG_INFO(80, "Buffer %d: Start: 0x%x\n", buffer, gc->buffers1[buffer]);
|
||||
@@ -2228,7 +2219,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
if (nAuxBuffers != 0) {
|
||||
gc->buffers0[buffer] = bufInfo->auxBuffStart0;
|
||||
GDBG_INFO(80, "Aux Buffer: Start: 0x%x\n", gc->buffers0[buffer]);
|
||||
gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
gc->lfbBuffers[buffer] = (AnyPtr)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
if (bInfo->buffInfo.enable2ndbuffer) {
|
||||
gc->buffers1[buffer] = bufInfo->auxBuffStart1;
|
||||
GDBG_INFO(80, "Aux Buffer: Start: 0x%x\n", gc->buffers1[buffer]);
|
||||
@@ -2266,7 +2257,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
/* This actually gets taken in hwcInitVideo */
|
||||
gc->contextP = FXTRUE;
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
/* CSR - Set up flag for display driver to tell us that context was lost */
|
||||
if ( !gc->open ) /* If we already have a context open, then lets not
|
||||
re-initialize the pointers */
|
||||
@@ -2278,7 +2269,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
/* This actually gets taken in hwcInitVideo */
|
||||
gc->contextP = FXTRUE;
|
||||
*gc->lostContext = FXFALSE;
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
if (_GlideRoot.environment.gammaR != -1.f &&
|
||||
_GlideRoot.environment.gammaG != -1.f &&
|
||||
@@ -2357,11 +2348,10 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
} else {
|
||||
/* %%KCD - I pass in true because I know this will just fall through to hwcInitFifo() */
|
||||
#if __POWERPC__
|
||||
if (!hwcInitAGPFifo(bInfo, FXFALSE))
|
||||
if (!hwcInitAGPFifo(bInfo, FXFALSE)) {
|
||||
#else
|
||||
if (!hwcInitAGPFifo(bInfo, FXTRUE))
|
||||
#endif
|
||||
{
|
||||
if (!hwcInitAGPFifo(bInfo, FXTRUE)) {
|
||||
#endif
|
||||
hwcRestoreVideo(bInfo);
|
||||
GrErrorCallback(hwcGetErrorString(), FXFALSE);
|
||||
GDBG_INFO(gc->myLevel, "hwcInitFifo failed\n");
|
||||
@@ -2434,7 +2424,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
for ( buffer = 0; buffer < nColBuffers; buffer++ ) {
|
||||
gc->buffers0[buffer] = bufInfo->colBuffStart0[buffer];
|
||||
GDBG_INFO(80, "Buffer %d: Start: 0x%x\n", buffer, gc->buffers0[buffer]);
|
||||
gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
gc->lfbBuffers[buffer] = (AnyPtr)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
if (bInfo->buffInfo.enable2ndbuffer) {
|
||||
gc->buffers1[buffer] = bufInfo->colBuffStart1[buffer];
|
||||
GDBG_INFO(80, "Buffer %d: Start: 0x%x\n", buffer, gc->buffers1[buffer]);
|
||||
@@ -2443,7 +2433,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
if (nAuxBuffers != 0) {
|
||||
gc->buffers0[buffer] = bufInfo->auxBuffStart0;
|
||||
GDBG_INFO(80, "Aux Buffer: Start: 0x%x\n", gc->buffers0[buffer]);
|
||||
gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
gc->lfbBuffers[buffer] = (AnyPtr)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
if (bInfo->buffInfo.enable2ndbuffer) {
|
||||
gc->buffers1[buffer] = bufInfo->auxBuffStart1;
|
||||
GDBG_INFO(80, "Aux Buffer: Start: 0x%x\n", gc->buffers1[buffer]);
|
||||
@@ -2541,7 +2531,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
gc->buffers0[gc->curBuffer], /* board address of beginning of OS */
|
||||
gc->strideInTiles ); /* distance between scanlines of the OS, in*/
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
/*
|
||||
** initialize context checking
|
||||
*/
|
||||
@@ -2550,7 +2540,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
*gc->lostContext = FXFALSE;
|
||||
gc->contextP = 1;
|
||||
}
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
#endif /* defined( GLIDE_INIT_HAL ) */
|
||||
#else /* !defined( USE_PACKET_FIFO ) */
|
||||
@@ -2593,7 +2583,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
for ( buffer = 0; buffer < nColBuffers; buffer++ ) {
|
||||
gc->buffers0[buffer] = bufInfo->colBuffStart0[buffer];
|
||||
GDBG_INFO(80, "Buffer %d: Start: 0x%x\n", buffer, gc->buffers0[buffer]);
|
||||
gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
gc->lfbBuffers[buffer] = (AnyPtr)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
if (bInfo->buffInfo.enable2ndbuffer) {
|
||||
gc->buffers1[buffer] = bufInfo->colBuffStart1[buffer];
|
||||
GDBG_INFO(80, "Buffer %d: Start: 0x%x\n", buffer, gc->buffers1[buffer]);
|
||||
@@ -2602,7 +2592,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
if (nAuxBuffers != 0) {
|
||||
gc->buffers0[buffer] = bufInfo->auxBuffStart0;
|
||||
GDBG_INFO(80, "Aux Buffer: Start: 0x%x\n", gc->buffers0[buffer]);
|
||||
gc->lfbBuffers[buffer] = (FxU32)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
gc->lfbBuffers[buffer] = (AnyPtr)gc->rawLfb + bufInfo->lfbBuffAddr0[buffer];
|
||||
if (bInfo->buffInfo.enable2ndbuffer) {
|
||||
gc->buffers1[buffer] = bufInfo->auxBuffStart1;
|
||||
GDBG_INFO(80, "Aux Buffer: Start: 0x%x\n", gc->buffers1[buffer]);
|
||||
@@ -2659,7 +2649,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
gc->buffers0[gc->curBuffer], /* board address of beginning of OS */
|
||||
gc->strideInTiles ); /* distance between scanlines of the OS, in*/
|
||||
_grReCacheFifo(0);
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
/*
|
||||
** initialize context checking
|
||||
*/
|
||||
@@ -2668,7 +2658,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
*gc->lostContext = FXFALSE;
|
||||
gc->contextP = 1;
|
||||
}
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
#endif /* !defined( USE_PACKET_FIFO ) */
|
||||
|
||||
@@ -2677,9 +2667,10 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
if (bInfo->fifoInfo.agpFifo) {
|
||||
gcFifo->fifoStart = (FxU32 *) bInfo->fifoInfo.agpVirtAddr;
|
||||
gcFifo->fifoOffset = bInfo->fifoInfo.agpPhysAddr;
|
||||
} else
|
||||
#endif
|
||||
} else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
gcFifo->fifoStart = gc->rawLfb + ( gcFifo->fifoOffset >> 2 );
|
||||
}
|
||||
gcFifo->fifoEnd = gcFifo->fifoStart + ( gcFifo->fifoSize >> 2 );
|
||||
@@ -2703,7 +2694,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
gcFifo->fifoRead = HW_FIFO_PTR( FXTRUE );
|
||||
#endif /* USE_PACKET_FIFO */
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
if ( (void*)gcFifo->fifoPtr != (void*)gcFifo->fifoRead ) {
|
||||
#ifdef GLIDE_INIT_HWC
|
||||
hwcRestoreVideo( bInfo );
|
||||
@@ -2711,7 +2702,7 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
GDBG_INFO( gc->myLevel, "Initial fifo state is incorrect\n" );
|
||||
return 0;
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
#endif /* DRI_BUILD */
|
||||
|
||||
#if __POWERPC__ && PCI_BUMP_N_GRIND
|
||||
enableCopyBackCache((FxU32)gcFifo->fifoStart,gcFifo->fifoSize);
|
||||
@@ -2753,8 +2744,8 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
gcFifo->fifoSize,
|
||||
gcFifo->fifoPtr );
|
||||
|
||||
#ifdef __linux__
|
||||
_grImportFifo(*driInfo.fifoPtr, *driInfo.fifoRead);
|
||||
#ifdef DRI_BUILD
|
||||
_grImportFifo((AnyPtr)*driInfo.fifoPtr, (AnyPtr)*driInfo.fifoRead);
|
||||
#endif
|
||||
|
||||
/* The hw is now in a usable state from the fifo macros.
|
||||
@@ -2811,7 +2802,12 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.colBufferAddr);
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->state.shadow.auxBufferAddr);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
@@ -2822,7 +2818,15 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers1[gc->curBuffer] | SST_BUFFER_BASE_SELECT);
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->buffers1[nColBuffers] | SST_BUFFER_BASE_SELECT);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
@@ -2883,7 +2887,12 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.colBufferAddr);
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->state.shadow.auxBufferAddr);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
@@ -2892,7 +2901,12 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers1[gc->curBuffer] | SST_BUFFER_BASE_SELECT);
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride);
|
||||
#ifdef DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride );
|
||||
#else
|
||||
REG_GROUP_SET(hw, colBufferStride, gc->state.shadow.colBufferStride );
|
||||
#endif
|
||||
REG_GROUP_SET(hw, auxBufferAddr, gc->buffers1[nColBuffers] | SST_BUFFER_BASE_SELECT);
|
||||
REG_GROUP_SET(hw, auxBufferStride, gc->state.shadow.auxBufferStride);
|
||||
}
|
||||
@@ -2928,15 +2942,15 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
|
||||
GDBG_INFO( gc->myLevel, " Setting all Glide state\n" );
|
||||
assertDefaultState();
|
||||
#ifdef __linux__
|
||||
#ifdef DRI_BUILD
|
||||
if (nColBuffers>1)
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
else
|
||||
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
|
||||
grClipWindow(0, 0, gc->state.screen_width, gc->state.screen_height);
|
||||
#else /* defined(__linux__) */
|
||||
#else /* defined(DRI_BUILD) */
|
||||
clearBuffers( gc );
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
gc->state.color_format = format;
|
||||
|
||||
/* --------------------------------------------------------
|
||||
@@ -3005,12 +3019,12 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
hwcRestoreVideo(gc->bInfo);
|
||||
}
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
if (gc->lostContext) {
|
||||
if (*gc->lostContext)
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
|
||||
/* NB: The gc that is being closed is the passed gc not the
|
||||
* currently selected gc. This must be setup before the
|
||||
@@ -3021,7 +3035,7 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
* the tls gc explicitly otherwise other whacky-ness (read 'random
|
||||
* crashes' will ensue).
|
||||
*/
|
||||
setThreadValue((FxU32)gc);
|
||||
setThreadValue((AnyPtr)gc);
|
||||
if ((gc != NULL) && gc->open) grFlush();
|
||||
|
||||
/* Make sure that the user specified gc is not whacked */
|
||||
@@ -3057,7 +3071,7 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
* safe everywhere.
|
||||
*/
|
||||
GDBG_INFO(gc->myLevel, " Restore Video");
|
||||
#ifndef __linux__
|
||||
#ifndef DRI_BUILD
|
||||
if (!*gc->lostContext) {
|
||||
/* disable SLI and AA */
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
@@ -3077,7 +3091,7 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
#endif
|
||||
hwcRestoreVideo(gc->bInfo);
|
||||
}
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
#endif /* !GLIDE_INIT_HAL */
|
||||
|
||||
/*--------------------------
|
||||
@@ -3271,8 +3285,8 @@ _grSstStatus(void)
|
||||
/* */
|
||||
{
|
||||
FxU32 chip ;
|
||||
GR_DCL_NUMCHIPS;
|
||||
if (numChips)
|
||||
|
||||
if (gc->chipCount)
|
||||
for (chip = 0 ;
|
||||
chip < gc->chipCount - 1 ;
|
||||
chip++)
|
||||
@@ -3337,8 +3351,8 @@ GR_ENTRY(grFlush, void, (void))
|
||||
if ( gc->windowed ) {
|
||||
#ifdef GLIDE_INIT_HWC
|
||||
GDBG_INFO(gc->myLevel + 200, FN_NAME": cmdSize(0x%X)\n",
|
||||
((FxU32)gc->cmdTransportInfo.fifoPtr -
|
||||
(FxU32)gc->cmdTransportInfo.hwcFifoInfo.cmdBuf.baseAddr));
|
||||
((AnyPtr)gc->cmdTransportInfo.fifoPtr -
|
||||
(AnyPtr)gc->cmdTransportInfo.hwcFifoInfo.cmdBuf.baseAddr));
|
||||
_FifoFlush();
|
||||
#endif
|
||||
} else if (!gc->cmdTransportInfo.autoBump) {
|
||||
@@ -3362,14 +3376,14 @@ GR_ENTRY(grFinish, void, (void))
|
||||
|
||||
grFlush();
|
||||
if ( gc->windowed ) {
|
||||
#if defined(GLIDE_INIT_HWC) && !defined(__linux__)
|
||||
#if defined(GLIDE_INIT_HWC) && !defined(DRI_BUILD)
|
||||
struct cmdTransportInfo*
|
||||
gcFifo = &gc->cmdTransportInfo;
|
||||
|
||||
hwcIdleWinFifo(gc->bInfo,
|
||||
&gcFifo->hwcFifoInfo,
|
||||
gcFifo->issuedSerialNumber);
|
||||
#endif /* defined(GLIDE_INIT_HWC) && !defined(__linux__) */
|
||||
#endif /* defined(GLIDE_INIT_HWC) && !defined(DRI_BUILD) */
|
||||
} else {
|
||||
/*while((_grSstStatus() & SST_BUSY) != 0) */
|
||||
/* Do Nothing */;
|
||||
@@ -3794,56 +3808,53 @@ _grEnableSliCtrl(void)
|
||||
** enable sli mode
|
||||
*/
|
||||
|
||||
//8xaa
|
||||
if( gc-> chipCount == 2 )
|
||||
sliChipCountDivisor = (gc->grPixelSample == 4) ? 2 : 1;
|
||||
|
||||
if( gc-> chipCount == 4 )
|
||||
sliChipCountDivisor = (gc->grPixelSample == 2) ? 2 : 1;
|
||||
|
||||
|
||||
renderMask = (gc->chipCount / sliChipCountDivisor - 1) << gc->sliBandHeight;
|
||||
scanMask = (1 << gc->sliBandHeight) - 1;
|
||||
log2chipCount = 0;
|
||||
|
||||
while (( 0x1UL << log2chipCount ) != (gc->chipCount / sliChipCountDivisor))
|
||||
log2chipCount++;
|
||||
|
||||
for (chipIndex = 0; chipIndex < gc->chipCount; chipIndex++)
|
||||
{
|
||||
GR_DCL_NUMCHIPS;
|
||||
FxU32 compareMask ;
|
||||
FxU32 sliCtrl ;
|
||||
|
||||
//8xaa
|
||||
if( numChips == 2 )
|
||||
sliChipCountDivisor = (gc->grPixelSample == 4) ? 2 : 1;
|
||||
/* AJB- When YORIGIN swapping we have to swap the compareMask too--
|
||||
Otherwise line ownership gets hosed. 'course winsim behaves
|
||||
completely differently, so this might need some fixing on
|
||||
real hardware.
|
||||
*/
|
||||
if (gc->state.shadow.fbzMode & SST_YORIGIN)
|
||||
compareMask = ((gc->chipCount - chipIndex - 1) / sliChipCountDivisor) << gc->sliBandHeight;
|
||||
else
|
||||
compareMask = (chipIndex / sliChipCountDivisor) << gc->sliBandHeight;
|
||||
|
||||
if( numChips == 4 )
|
||||
sliChipCountDivisor = (gc->grPixelSample == 2) ? 2 : 1;
|
||||
|
||||
|
||||
renderMask = (gc->chipCount / sliChipCountDivisor - 1) << gc->sliBandHeight;
|
||||
scanMask = (1 << gc->sliBandHeight) - 1;
|
||||
log2chipCount = 0;
|
||||
|
||||
while (( 0x1UL << log2chipCount ) != (numChips / sliChipCountDivisor))
|
||||
log2chipCount++;
|
||||
|
||||
for (chipIndex = 0; chipIndex < numChips; chipIndex++)
|
||||
{
|
||||
FxU32 compareMask ;
|
||||
FxU32 sliCtrl ;
|
||||
|
||||
/* AJB- When YORIGIN swapping we have to swap the compareMask too--
|
||||
Otherwise line ownership gets hosed. 'course winsim behaves
|
||||
completely differently, so this might need some fixing on
|
||||
real hardware.
|
||||
*/
|
||||
if (gc->state.shadow.fbzMode & SST_YORIGIN)
|
||||
compareMask = ((gc->chipCount - chipIndex - 1) / sliChipCountDivisor) << gc->sliBandHeight;
|
||||
else
|
||||
compareMask = (chipIndex / sliChipCountDivisor) << gc->sliBandHeight;
|
||||
|
||||
sliCtrl =
|
||||
( (renderMask << SST_SLI_CONTROL_RENDER_MASK_SHIFT) |
|
||||
(compareMask << SST_SLI_CONTROL_COMPARE_MASK_SHIFT) |
|
||||
(scanMask << SST_SLI_CONTROL_SCAN_MASK_SHIFT) |
|
||||
(log2chipCount << SST_SLI_CONTROL_LOG2_CHIP_COUNT_SHIFT) |
|
||||
SST_SLI_CONTROL_SLI_ENABLE);
|
||||
sliCtrl =
|
||||
( (renderMask << SST_SLI_CONTROL_RENDER_MASK_SHIFT) |
|
||||
(compareMask << SST_SLI_CONTROL_COMPARE_MASK_SHIFT) |
|
||||
(scanMask << SST_SLI_CONTROL_SCAN_MASK_SHIFT) |
|
||||
(log2chipCount << SST_SLI_CONTROL_LOG2_CHIP_COUNT_SHIFT) |
|
||||
SST_SLI_CONTROL_SLI_ENABLE);
|
||||
|
||||
_grChipMask( 1 << chipIndex );
|
||||
_grChipMask( 1 << chipIndex );
|
||||
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, sliCtrl, 1, 0x1);
|
||||
REG_GROUP_SET(hw, sliCtrl, sliCtrl);
|
||||
REG_GROUP_END();
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, sliCtrl, 1, 0x1);
|
||||
REG_GROUP_SET(hw, sliCtrl, sliCtrl);
|
||||
REG_GROUP_END();
|
||||
|
||||
}
|
||||
|
||||
_grChipMask( gc->chipmask );
|
||||
}
|
||||
|
||||
_grChipMask( gc->chipmask );
|
||||
|
||||
#undef FN_NAME
|
||||
} /* _grEnableSliCtrl */
|
||||
|
||||
@@ -3856,20 +3867,16 @@ _grDisableSliCtrl(void)
|
||||
{
|
||||
#define FN_NAME "_grDisableSliCtrl"
|
||||
FxU32 chipIndex;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK("_grDisableSliCtrl", 85);
|
||||
{
|
||||
GR_DCL_NUMCHIPS;
|
||||
/*
|
||||
** disable sli mode
|
||||
*/
|
||||
for (chipIndex = 0; chipIndex < numChips; chipIndex++) {
|
||||
FxU32 sliCtrl = 0;
|
||||
_grChipMask( 1 << chipIndex );
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, sliCtrl, 1, 0x1);
|
||||
REG_GROUP_SET(hw, sliCtrl, sliCtrl);
|
||||
REG_GROUP_END();
|
||||
}
|
||||
/*
|
||||
** disable sli mode
|
||||
*/
|
||||
for (chipIndex = 0; chipIndex < gc->chipCount; chipIndex++) {
|
||||
FxU32 sliCtrl = 0;
|
||||
_grChipMask( 1 << chipIndex );
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, sliCtrl, 1, 0x1);
|
||||
REG_GROUP_SET(hw, sliCtrl, sliCtrl);
|
||||
REG_GROUP_END();
|
||||
}
|
||||
_grChipMask( gc->chipmask );
|
||||
|
||||
@@ -3940,27 +3947,6 @@ _grRenderMode(FxU32 pixelformat)
|
||||
#undef FN_NAME
|
||||
} /* _grRenderMode */
|
||||
|
||||
#ifdef __linux__
|
||||
/*
|
||||
* Setup for full screen. Most of the work is done in minihwc.
|
||||
*/
|
||||
GR_ENTRY(grDRISetupFullScreen, FxBool, (FxBool state))
|
||||
{
|
||||
GR_DCL_GC;
|
||||
|
||||
/* hwcInitFifo(gc->bInfo, FXFALSE); */
|
||||
_grImportFifo(*driInfo.fifoPtr, *driInfo.fifoRead);
|
||||
return(hwcSetupFullScreen(gc->bInfo, state));
|
||||
}
|
||||
|
||||
void grSetSliCount(int chips, int sli) {
|
||||
GR_DCL_GC;
|
||||
|
||||
gc->chipCount=chips;
|
||||
gc->sliCount=sli;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* FX_GLIDE_NAPALM */
|
||||
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
|
||||
** simplified code
|
||||
*/
|
||||
FxU32 vSize;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
|
||||
|
||||
@@ -183,8 +183,10 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
vSize = gc->state.vData.vSize;
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
/* Draw the first (or possibly only) set. This is necessary because
|
||||
the packet is 3_BDDDDDD, and in the next set, the packet is
|
||||
|
||||
@@ -177,7 +177,7 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
|
||||
** simplified code
|
||||
*/
|
||||
FxU32 vSize;
|
||||
FxI32 stride = mode;
|
||||
FxI32 stride;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
|
||||
|
||||
@@ -187,8 +187,10 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
|
||||
GR_FLUSH_STATE();
|
||||
|
||||
vSize = gc->state.vData.vSize;
|
||||
if (stride == 0)
|
||||
if (mode == 0)
|
||||
stride = gc->state.vData.vStride;
|
||||
else
|
||||
stride = sizeof(float*)/sizeof(float);
|
||||
|
||||
/* Draw the first (or possibly only) set. This is necessary because
|
||||
the packet is 3_BDDDDDD, and in the next set, the packet is
|
||||
|
||||
@@ -416,10 +416,6 @@
|
||||
#include "minihwc.h"
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <lindri.h>
|
||||
#endif /* defined(__linux__) */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: _grTexCalcBaseAddressTiled
|
||||
Date: 12-Dec-98
|
||||
@@ -3564,70 +3560,67 @@ void g3LodBiasPerChip(void)
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK("g3LodBiasPerChip", 88);
|
||||
|
||||
{
|
||||
GR_DCL_NUMCHIPS;
|
||||
tmu = 0;
|
||||
idx = gc->chipCount > 2;
|
||||
|
||||
tmu = 0;
|
||||
idx = numChips > 2;
|
||||
if ((gc->sliCount > 1) || (_GlideRoot.environment.texLodDither)) goto FORGET_IT;
|
||||
|
||||
if ((gc->sliCount > 1) || (_GlideRoot.environment.texLodDither)) goto FORGET_IT;
|
||||
for (i = 0; i < gc->chipCount; i++)
|
||||
{
|
||||
tLod = gc->state.tmuShadow[tmu].tLOD;
|
||||
tLod &= ~(SST_LODBIAS);
|
||||
lodBias = chipLodBias[idx][i];
|
||||
|
||||
for (i = 0; i < numChips; i++)
|
||||
{
|
||||
tLod = gc->state.tmuShadow[tmu].tLOD;
|
||||
tLod &= ~(SST_LODBIAS);
|
||||
lodBias = chipLodBias[idx][i];
|
||||
if(lodBias > 0x1f) lodBias = 0x1f;
|
||||
if(lodBias < -0x20) lodBias = -0x20;
|
||||
/* Mask it back off. */
|
||||
lodBias &= 0x3f;
|
||||
tLod |= lodBias << SST_LODBIAS_SHIFT;
|
||||
|
||||
if(lodBias > 0x1f) lodBias = 0x1f;
|
||||
if(lodBias < -0x20) lodBias = -0x20;
|
||||
/* Mask it back off. */
|
||||
lodBias &= 0x3f;
|
||||
tLod |= lodBias << SST_LODBIAS_SHIFT;
|
||||
|
||||
if(!gc->state.mode2ppc || (tmu == gc->state.mode2ppcTMU)) {
|
||||
if(!gc->state.mode2ppc || (tmu == gc->state.mode2ppcTMU)) {
|
||||
SstRegs* tmuHw = SST_TMU(hw, tmu);
|
||||
_grChipMask( 1L << i );
|
||||
REG_GROUP_BEGIN((0x02 << tmu), tLOD, 1, 0x1);
|
||||
{
|
||||
REG_GROUP_SET(tmuHw, tLOD, tLod);
|
||||
REG_GROUP_SET(tmuHw, tLOD, tLod);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
_grChipMask( gc->chipmask );
|
||||
} else {
|
||||
} else {
|
||||
INVALIDATE_TMU(tmu, textureMode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tmu = 1;
|
||||
tmu = 1;
|
||||
|
||||
for (i = 0; i < numChips; i++)
|
||||
{
|
||||
tLod = gc->state.tmuShadow[tmu].tLOD;
|
||||
tLod &= ~(SST_LODBIAS);
|
||||
lodBias = chipLodBias[idx][i];
|
||||
for (i = 0; i < gc->chipCount; i++)
|
||||
{
|
||||
tLod = gc->state.tmuShadow[tmu].tLOD;
|
||||
tLod &= ~(SST_LODBIAS);
|
||||
lodBias = chipLodBias[idx][i];
|
||||
|
||||
if(lodBias > 0x1f) lodBias = 0x1f;
|
||||
if(lodBias < -0x20) lodBias = -0x20;
|
||||
/* Mask it back off. */
|
||||
lodBias &= 0x3f;
|
||||
tLod |= lodBias << SST_LODBIAS_SHIFT;
|
||||
if(lodBias > 0x1f) lodBias = 0x1f;
|
||||
if(lodBias < -0x20) lodBias = -0x20;
|
||||
/* Mask it back off. */
|
||||
lodBias &= 0x3f;
|
||||
tLod |= lodBias << SST_LODBIAS_SHIFT;
|
||||
|
||||
if(!gc->state.mode2ppc || (tmu == gc->state.mode2ppcTMU)) {
|
||||
if(!gc->state.mode2ppc || (tmu == gc->state.mode2ppcTMU)) {
|
||||
SstRegs* tmuHw = SST_TMU(hw, tmu);
|
||||
_grChipMask( 1L << i );
|
||||
REG_GROUP_BEGIN((0x02 << tmu), tLOD, 1, 0x1);
|
||||
{
|
||||
REG_GROUP_SET(tmuHw, tLOD, tLod);
|
||||
REG_GROUP_SET(tmuHw, tLOD, tLod);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
_grChipMask( gc->chipmask );
|
||||
} else {
|
||||
} else {
|
||||
INVALIDATE_TMU(tmu, textureMode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
FORGET_IT:
|
||||
GR_END();
|
||||
#undef FN_NAME
|
||||
|
||||
@@ -473,7 +473,7 @@ GR_DDFUNC(_grTexDownloadPalette,
|
||||
while(i < start + slopCount) {
|
||||
FxU32 entry;
|
||||
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | (pal->data[i] & 0xFFFFFF));
|
||||
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
|
||||
@@ -491,7 +491,7 @@ GR_DDFUNC(_grTexDownloadPalette,
|
||||
while(i < endIndex) {
|
||||
FxU32 entry;
|
||||
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | (pal->data[i] & 0xFFFFFF));
|
||||
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
|
||||
@@ -510,7 +510,7 @@ GR_DDFUNC(_grTexDownloadPalette,
|
||||
while(i <= end) {
|
||||
FxU32 entry;
|
||||
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | (pal->data[i] & 0xFFFFFF));
|
||||
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
|
||||
|
||||
@@ -25,11 +25,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/* NOTE: This file is compiled to naught if we aren't
|
||||
running under Win32 */
|
||||
|
||||
#if defined( __WIN32__ )
|
||||
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
@@ -40,9 +35,12 @@
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
/* NOTE: This file is compiled to naught if we aren't
|
||||
running under Win32 */
|
||||
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
|
||||
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static CRITICAL_SECTION criticalSectionObject;
|
||||
static DWORD tlsIndex;
|
||||
@@ -64,13 +62,13 @@ initThreadStorage( void )
|
||||
|
||||
} /* initThreadStorage */
|
||||
|
||||
void setThreadValue( FxU32 value ) {
|
||||
void setThreadValue( AnyPtr value ) {
|
||||
GR_CHECK_F( "setThreadValue", !threadInit, "Thread storage not initialized\n" );
|
||||
TlsSetValue( _GlideRoot.tlsIndex, (void*)value );
|
||||
}
|
||||
|
||||
#pragma warning (4:4035) /* No return value */
|
||||
FxU32 getThreadValueSLOW( void ) {
|
||||
AnyPtr getThreadValueSLOW( void ) {
|
||||
GR_CHECK_F( "getThreadValue", !threadInit, "Thread storage not initialized\n" );
|
||||
|
||||
#if 0
|
||||
@@ -113,30 +111,20 @@ void endCriticalSection( void ) {
|
||||
LeaveCriticalSection( &criticalSectionObject );
|
||||
}
|
||||
|
||||
#elif defined(macintosh)
|
||||
#elif (GLIDE_PLATFORM & GLIDE_OS_MACOS)
|
||||
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
FxU32 _threadValueMacOS;
|
||||
AnyPtr _threadValueMacOS;
|
||||
|
||||
void initThreadStorage(void)
|
||||
{
|
||||
}
|
||||
|
||||
void setThreadValue( FxU32 value )
|
||||
void setThreadValue( AnyPtr value )
|
||||
{
|
||||
_threadValueMacOS = value;
|
||||
}
|
||||
|
||||
FxU32 getThreadValueSLOW( void )
|
||||
AnyPtr getThreadValueSLOW( void )
|
||||
{
|
||||
return _threadValueMacOS;
|
||||
}
|
||||
@@ -157,19 +145,9 @@ void endCriticalSection(void)
|
||||
{
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
#elif (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
FxU32 threadValueLinux;
|
||||
AnyPtr threadValueLinux;
|
||||
|
||||
void initThreadStorage(void)
|
||||
{
|
||||
@@ -177,12 +155,12 @@ void initThreadStorage(void)
|
||||
|
||||
|
||||
|
||||
void setThreadValue( FxU32 value )
|
||||
void setThreadValue( AnyPtr value )
|
||||
{
|
||||
threadValueLinux = value;
|
||||
}
|
||||
|
||||
FxU32 getThreadValueSLOW( void )
|
||||
AnyPtr getThreadValueSLOW( void )
|
||||
{
|
||||
return threadValueLinux;
|
||||
}
|
||||
@@ -199,6 +177,7 @@ void endCriticalSection(void)
|
||||
{
|
||||
}
|
||||
|
||||
#else /* defined(__linux__) */
|
||||
#else /* (GLIDE_PLATFORM & GLIDE_OS_UNIX) */
|
||||
# error "No thread synchronization/storage functions defined for this OS"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -183,11 +183,17 @@ xtexdl_3dnow.o xtexdl_3dnow.lo: xtexdl.s fxgasm.h
|
||||
$(CP) $*.o $*.lo
|
||||
$(RM) -f $*.tmp.s
|
||||
|
||||
if FX_GLIDE_C_CPU_DETECT
|
||||
CPUSOURCES = cpudtect.c
|
||||
else
|
||||
CPUSOURCES = cpudtect.s
|
||||
|
||||
cpudtect.o cpudtect.lo: cpudtect.s
|
||||
$(PREPROCESSOR) -DUSE_PACKET_FIFO=1 $< > $*.tmp.s
|
||||
$(CC) $(AFLAGS) -c -o $*.o $*.tmp.s
|
||||
$(CP) $*.o $*.lo
|
||||
$(RM) -f $*.tmp.s
|
||||
endif
|
||||
|
||||
#
|
||||
# Library definitions.
|
||||
@@ -231,7 +237,7 @@ libglide3_la_SOURCES = fxinline.h fxgasm.h \
|
||||
gbanner.c gerror.c gaa.c gdraw.c \
|
||||
gglide.c distate.c gstrip.c distrip.c \
|
||||
diget.c glfb.c gsst.c gtex.c gtexdl.c \
|
||||
fifo.c cpudtect.s xtexdl_def.c $(VGLIDE_SRC)
|
||||
fifo.c $(CPUSOURCES) xtexdl_def.c $(VGLIDE_SRC)
|
||||
libglide3_la_LDFLAGS = -version-info 13:0:10
|
||||
libglide3_la_LIBADD = $(WHOLE_LIBS) $(LINK_LIBS)
|
||||
|
||||
|
||||
@@ -45,6 +45,13 @@ endif
|
||||
FX_GLIDE_REAL_HW= 1
|
||||
FX_GLIDE_NO_FIFO= 1
|
||||
|
||||
MACHINETYPE=$(shell $(BUILD_ROOT_SWLIBS)/include/make/machinetype)
|
||||
ifeq ($(MACHINETYPE),alpha)
|
||||
FX_GLIDE_CTRISETUP = 1
|
||||
else
|
||||
FX_GLIDE_CTRISETUP = 0
|
||||
endif
|
||||
|
||||
HWSPEC = fifo.c
|
||||
LCDEFS += -DH3 $(CMDXPORTDEFS)
|
||||
INITLIB = $(BUILD_ROOT)/$(FX_GLIDE_HW)/lib$(FX_GLIDE_HW)init.a
|
||||
@@ -202,8 +209,6 @@ LADEFS += $(ASM_REGMAP_DEFS)
|
||||
LAINCS = -I$(BUILD_ROOT)/$(FX_GLIDE_HW)/include
|
||||
LAOPTS = $(DBGOPTS) $(DSPOPTS) $(OPTOPTS)
|
||||
|
||||
AFILES = $(ASMTRISETUP) cpudtect.s
|
||||
|
||||
# sources
|
||||
HEADERS = glide.h glidesys.h glideutl.h g3ext.h
|
||||
PRIVATE_HEADERS = fxglide.h gsstdef.h fxinline.h fxcmd.h fxsplash.h
|
||||
@@ -213,7 +218,7 @@ INSTALL_DESTINATION = $(BUILD_ROOT)/$(FX_GLIDE_HW)
|
||||
CFILES += gsplash.c g3df.c gu.c gthread.c \
|
||||
gpci.c diglide.c disst.c ditex.c \
|
||||
gbanner.c gerror.c gaa.c gdraw.c gglide.c $(GLIDE3FILES) \
|
||||
glfb.c gsst.c gtex.c gtexdl.c $(HWSPEC)
|
||||
glfb.c gsst.c gtex.c gtexdl.c cpudtect.c $(HWSPEC)
|
||||
|
||||
OFILES = $(CFILES:.c=.o)
|
||||
|
||||
@@ -222,7 +227,7 @@ OTHER_CFILES = fxgasm.c fxbldno.c fxinline.h
|
||||
# targets
|
||||
LDIRT = fxgasm.o fxgasm fxgasm.h fxinline.h fxbldno.o fxbldno fxbldno.h
|
||||
|
||||
LIBRARIES = libglide3x.a
|
||||
LIBRARIES = libglide3.a
|
||||
SHARED_LIBRARY = libglide3.so.3.1
|
||||
SUBLIBRARIES = $(BUILD_ROOT_SWLIBS)/lib/libfxmisc.a \
|
||||
$(BUILD_ROOT_SWLIBS)/lib/libfxpci.a \
|
||||
@@ -279,7 +284,6 @@ PREPROCESSOR=cpp
|
||||
|
||||
xdraw2.o : xdraw2.s xdraw2.inc.s fxgasm.h
|
||||
xdraw3.o : xdraw3.s fxgasm.h
|
||||
cpudtect.o: cpudtect.s
|
||||
|
||||
# 3DNow!(tm) dependencies
|
||||
# XXX_def.obj targets are the default targets
|
||||
|
||||
@@ -23,6 +23,10 @@ xdraw2.asm Page 1 - 1
|
||||
;; $Header$
|
||||
;; $Revision$
|
||||
;; $Log$
|
||||
;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
;; number of bug fixes.
|
||||
;;
|
||||
;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
;; Initial checkin into SourceForge.
|
||||
;;
|
||||
@@ -284,6 +288,10 @@ xdraw2.asm Page 1 - 1
|
||||
C ;; $Header$
|
||||
C ;; $Revision$
|
||||
C ;; $Log$
|
||||
C ;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
C ;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
C ;; number of bug fixes.
|
||||
C ;;
|
||||
C ;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
C ;; Initial checkin into SourceForge.
|
||||
C ;;
|
||||
@@ -1265,6 +1273,10 @@ xdraw2.asm Page 1 - 1
|
||||
C ;; $Header$
|
||||
C ;; $Revision$
|
||||
C ;; $Log$
|
||||
C ;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
C ;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
C ;; number of bug fixes.
|
||||
C ;;
|
||||
C ;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
C ;; Initial checkin into SourceForge.
|
||||
C ;;
|
||||
@@ -2246,6 +2258,10 @@ xdraw2.asm Page 1 - 1
|
||||
C ;; $Header$
|
||||
C ;; $Revision$
|
||||
C ;; $Log$
|
||||
C ;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
C ;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
C ;; number of bug fixes.
|
||||
C ;;
|
||||
C ;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
C ;; Initial checkin into SourceForge.
|
||||
C ;;
|
||||
@@ -3227,6 +3243,10 @@ xdraw2.asm Page 1 - 1
|
||||
C ;; $Header$
|
||||
C ;; $Revision$
|
||||
C ;; $Log$
|
||||
C ;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
C ;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
C ;; number of bug fixes.
|
||||
C ;;
|
||||
C ;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
C ;; Initial checkin into SourceForge.
|
||||
C ;;
|
||||
@@ -4208,6 +4228,10 @@ xdraw2.asm Page 1 - 1
|
||||
C ;; $Header$
|
||||
C ;; $Revision$
|
||||
C ;; $Log$
|
||||
C ;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
C ;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
C ;; number of bug fixes.
|
||||
C ;;
|
||||
C ;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
C ;; Initial checkin into SourceForge.
|
||||
C ;;
|
||||
@@ -5258,6 +5282,10 @@ ENDM ; GR_FIFO_WRITE
|
||||
C ;; $Header$
|
||||
C ;; $Revision$
|
||||
C ;; $Log$
|
||||
C ;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
C ;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
C ;; number of bug fixes.
|
||||
C ;;
|
||||
C ;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
C ;; Initial checkin into SourceForge.
|
||||
C ;;
|
||||
@@ -6307,6 +6335,10 @@ ENDM ; GR_FIFO_WRITE
|
||||
C ;; $Header$
|
||||
C ;; $Revision$
|
||||
C ;; $Log$
|
||||
C ;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
C ;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
C ;; number of bug fixes.
|
||||
C ;;
|
||||
C ;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
C ;; Initial checkin into SourceForge.
|
||||
C ;;
|
||||
@@ -7356,6 +7388,10 @@ ENDM ; GR_FIFO_WRITE
|
||||
C ;; $Header$
|
||||
C ;; $Revision$
|
||||
C ;; $Log$
|
||||
C ;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
C ;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
C ;; number of bug fixes.
|
||||
C ;;
|
||||
C ;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
C ;; Initial checkin into SourceForge.
|
||||
C ;;
|
||||
|
||||
@@ -23,6 +23,10 @@ xtexdl.asm Page 1 - 1
|
||||
;; $Header$
|
||||
;; $Revision$
|
||||
;; $Log$
|
||||
;; Revision 1.3 2000/11/15 23:32:54 joseph
|
||||
;; Syncing up with 3dfx internal source repository. These changes contain a
|
||||
;; number of bug fixes.
|
||||
;;
|
||||
;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
;; Initial checkin into SourceForge.
|
||||
;;
|
||||
|
||||
@@ -291,7 +291,7 @@ _grTexDownload_Default_8_4(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
|
||||
const FxU32 t0 = *(const FxU32*)src8;
|
||||
|
||||
GDBG_INFO(195, "s = %d, t = %d, address = 0x%x\n", s, t,
|
||||
(FxU32) tex_address - (FxU32) gc->tex_ptr + 0x200000);
|
||||
(AnyPtr) tex_address - (AnyPtr) gc->tex_ptr + 0x200000);
|
||||
|
||||
LINEAR_WRITE_SET_8(tex_address, t0);
|
||||
|
||||
@@ -384,7 +384,7 @@ _grTexDownload_Default_8_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
|
||||
t1 = *(const FxU32*)(src8 + 4);
|
||||
|
||||
GDBG_INFO(195, "s = %d, t = %d, address = 0x%x\n", s, t,
|
||||
(FxU32) tex_address - (FxU32) gc->tex_ptr + 0x200000);
|
||||
(AnyPtr) tex_address - (AnyPtr) gc->tex_ptr + 0x200000);
|
||||
|
||||
LINEAR_WRITE_SET_8(tex_address + 0, t0);
|
||||
LINEAR_WRITE_SET_8(tex_address + 4, t1);
|
||||
@@ -544,7 +544,7 @@ _grTexDownload_Default_16_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
|
||||
const FxU32 t1 = *(const FxU32*)(src16 + 2);
|
||||
|
||||
GDBG_INFO(195, "s = %d, t = %d, address = 0x%x\n", s, t,
|
||||
(FxU32) tex_address - (FxU32) gc->tex_ptr + 0x200000);
|
||||
(AnyPtr) tex_address - (AnyPtr) gc->tex_ptr + 0x200000);
|
||||
|
||||
LINEAR_WRITE_SET_16(tex_address + 0, t0);
|
||||
LINEAR_WRITE_SET_16(tex_address + 4, t1);
|
||||
@@ -611,7 +611,7 @@ _grTexDownload_Default_32_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
|
||||
const FxU32 t1 = *(src32 + 1);
|
||||
|
||||
GDBG_INFO(195, "s = %d, t = %d, address = 0x%x\n", s, t,
|
||||
(FxU32) tex_address - (FxU32) gc->tex_ptr + 0x200000);
|
||||
(AnyPtr) tex_address - (AnyPtr) gc->tex_ptr + 0x200000);
|
||||
|
||||
LINEAR_WRITE_SET(tex_address, t0);
|
||||
LINEAR_WRITE_SET(tex_address + 4, t1);
|
||||
|
||||
@@ -105,7 +105,7 @@ FX_ENTRY void FX_CALL fxHalPutenv(char *buf);
|
||||
FX_ENTRY HalInfo * FX_CALL fxHalInit(FxU32 flags);
|
||||
FX_ENTRY FxU32 FX_CALL fxHalNumBoardsInSystem(void);
|
||||
FX_ENTRY SstRegs * FX_CALL fxHalMapBoard(FxU32 boardNum);
|
||||
FX_ENTRY FxBool FX_CALL fxHalInitCmdFifo( SstRegs *sst, int which, FxU32 fifoStart,
|
||||
FX_ENTRY FxBool FX_CALL fxHalInitCmdFifo( SstRegs *sst, int which, AnyPtr fifoStart,
|
||||
FxU32 size, FxBool directExec, FxBool disableHoles, FxBool agpEnable);
|
||||
FX_ENTRY FxBool FX_CALL fxHalInitRegisters(SstRegs *sst);
|
||||
FX_ENTRY FxBool FX_CALL fxHalInitRenderingRegisters(SstRegs *sst);
|
||||
@@ -212,9 +212,18 @@ fxHalInitVideoOverlaySurface(
|
||||
#define AGPWRP(aHi,aLo,d) AGPWRV( *agpPhysToVirt(aHi,aLo), d )
|
||||
#define AGPRDP(aHi,aLo) AGPRDV( *agpPhysToVirt(aHi,aLo) )
|
||||
#else // #ifdef HAL_CSIM // REAL hw
|
||||
#ifdef __alpha__
|
||||
extern unsigned char _fxget8(unsigned char *);
|
||||
extern unsigned short _fxget16(unsigned short *);
|
||||
extern unsigned int _fxget32(unsigned int *);
|
||||
#define GET8(s) _fxget8((unsigned byte *)&s);
|
||||
#define GET16(s) _fxget16((unsigned short *)&s);
|
||||
#define GET(s) _fxget32((unsigned int *)&s);
|
||||
#else
|
||||
#define GET8(s) s
|
||||
#define GET16(s) s
|
||||
#define GET(s) s
|
||||
#endif
|
||||
#define SET8(d,s) d = s
|
||||
#define SET16(d,s) d = s
|
||||
#define SET(d,s) d = s
|
||||
|
||||
@@ -2,35 +2,23 @@
|
||||
#define __H3DEFS_H__
|
||||
|
||||
/*
|
||||
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONL
|
||||
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGH
|
||||
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DF
|
||||
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
|
||||
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
|
||||
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
|
||||
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
|
||||
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
|
||||
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
|
||||
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR
|
||||
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
|
||||
**
|
||||
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT T
|
||||
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS I
|
||||
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013
|
||||
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FA
|
||||
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS O
|
||||
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
|
||||
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
|
||||
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
|
||||
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
|
||||
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
|
||||
** THE UNITED STATES.
|
||||
**
|
||||
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVE
|
||||
**
|
||||
** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.;
|
||||
** the contents of this file may not be disclosed to third parties, copied or
|
||||
** duplicated in any form, in whole or in part, without the prior written
|
||||
** permission of 3Dfx Interactive, Inc.
|
||||
**
|
||||
** RESTRICTED RIGHTS LEGEND:
|
||||
** Use, duplication or disclosure by the Government is subject to restrictions
|
||||
** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
||||
** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
||||
** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
||||
** rights reserved under the Copyright Laws of the United States.
|
||||
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
|
||||
**
|
||||
** $Revision$
|
||||
** $Date$
|
||||
@@ -73,11 +61,21 @@
|
||||
|
||||
// this crazy macro tests the sign bit of a float by loading it into
|
||||
// an integer register and then testing the sign bit of the integer
|
||||
#if defined(__LP64__)
|
||||
/* On IA-64, it's faster to do this the obvious way... -davidm 00/08/09 */
|
||||
#define FLOAT_ISNEG(f) ((f) < 0.0)
|
||||
#else
|
||||
#define FLOAT_ISNEG(f) ((*(int *)(&(f))) < 0)
|
||||
#endif
|
||||
|
||||
// these crazy macros returns the sign of a number (1 if >= 0; -1 if < 0)
|
||||
#if defined(__LP64__)
|
||||
#define ISIGN(x) ((x) >= 0 ? 1 : -1)
|
||||
#define FSIGN(f) ((f) >= 0.0 ? 1 : -1)
|
||||
#else
|
||||
#define ISIGN(x) (((x) | 0x40000000L) >> 30)
|
||||
#define FSIGN(f) ISIGN(*(long *)&f)
|
||||
#endif
|
||||
|
||||
#define BIT(n) (1UL<<(n))
|
||||
#define SST_MASK(n) (0xFFFFFFFFL >> (32-(n)))
|
||||
@@ -2044,9 +2042,9 @@
|
||||
|
||||
//----------------- useful addressing macros -----------------------
|
||||
// return pointer to SST at specified WRAP, CHIP, or TREX
|
||||
#define SST_WRAP(sst,n) ((SstRegs *)((n)*0x4000+(FxI32)(sst)))
|
||||
#define SST_CHIP(sst,n) ((SstRegs *)((n)*0x400+(FxI32)(sst)))
|
||||
#define SST_TMU(sst,n) ((SstRegs *)((0x800<<(n))+(FxI32)(sst)))
|
||||
#define SST_WRAP(sst,n) ((SstRegs *)((n)*0x4000+(long)(sst)))
|
||||
#define SST_CHIP(sst,n) ((SstRegs *)((n)*0x400+(long)(sst)))
|
||||
#define SST_TMU(sst,n) ((SstRegs *)((0x800<<(n))+(long)(sst)))
|
||||
#define SST_TREX(sst,n) SST_TMU(sst,n)
|
||||
|
||||
// offsets from the base of memBaseAddr0
|
||||
@@ -2093,7 +2091,7 @@
|
||||
|
||||
#define SST_IS_REGISTER_ADDR(a) ( (a) >= SST_IO_OFFSET && (a) < SST_TEX_OFFSET )
|
||||
|
||||
#define SST_BASE_ADDRESS(sst) ((FxI32)(sst)-SST_3D_OFFSET)
|
||||
#define SST_BASE_ADDRESS(sst) ((AnyPtr)(sst)-SST_3D_OFFSET)
|
||||
#define SST_IO_ADDRESS(sst) (SST_IO_OFFSET+SST_BASE_ADDRESS(sst))
|
||||
#define SST_CMDAGP_ADDRESS(sst) (SST_CMDAGP_OFFSET+SST_BASE_ADDRESS(sst))
|
||||
#define SST_GUI_ADDRESS(sst) (SST_2D_OFFSET+SST_BASE_ADDRESS(sst))
|
||||
|
||||
@@ -279,11 +279,19 @@ typedef volatile struct sstgregs { // THE 2D CHIP
|
||||
|
||||
#ifndef _H2INC
|
||||
|
||||
#if defined(__alpha__) || defined(__LP64__)
|
||||
typedef unsigned int Reg32u;
|
||||
typedef int Reg32;
|
||||
#else
|
||||
typedef unsigned long Reg32u;
|
||||
typedef long Reg32;
|
||||
#endif
|
||||
|
||||
//----------------- SST chip 3D layout -------------------------
|
||||
// registers are in groups of 8 for easy decode
|
||||
typedef struct vertex_Rec {
|
||||
unsigned long x; // 12.4 format
|
||||
unsigned long y; // 12.4
|
||||
Reg32u x; // 12.4 format
|
||||
Reg32u y; // 12.4
|
||||
} vtxRec;
|
||||
|
||||
typedef volatile struct sstregs { // THE 3D CHIP
|
||||
@@ -294,127 +302,127 @@ typedef volatile struct sstregs { // THE 3D CHIP
|
||||
vtxRec vB;
|
||||
vtxRec vC;
|
||||
|
||||
long r; // 12.12 Parameters
|
||||
long g; // 12.12
|
||||
long b; // 12.12
|
||||
long z; // 20.12 in 16bpp, 28.4 in 32bpp (there is an ugly hack in csimio.c, search "//EVIL:")
|
||||
long a; // 12.12
|
||||
long s; // 14.18
|
||||
long t; // 14.18
|
||||
long w; // 2.30
|
||||
Reg32 r; // 12.12 Parameters
|
||||
Reg32 g; // 12.12
|
||||
Reg32 b; // 12.12
|
||||
Reg32 z; // 20.12 in 16bpp, 28.4 in 32bpp (there is an ugly hack in csimio.c, search "//EVIL:")
|
||||
Reg32 a; // 12.12
|
||||
Reg32 s; // 14.18
|
||||
Reg32 t; // 14.18
|
||||
Reg32 w; // 2.30
|
||||
|
||||
long drdx; // X Gradients
|
||||
long dgdx;
|
||||
long dbdx;
|
||||
long dzdx; //20.12 in 16bpp, 28.4 in 32bpp (there is an ugly hack in csimio.c, search "//EVIL:")
|
||||
long dadx;
|
||||
long dsdx;
|
||||
long dtdx;
|
||||
long dwdx;
|
||||
Reg32 drdx; // X Gradients
|
||||
Reg32 dgdx;
|
||||
Reg32 dbdx;
|
||||
Reg32 dzdx; //20.12 in 16bpp, 28.4 in 32bpp (there is an ugly hack in csimio.c, search "//EVIL:")
|
||||
Reg32 dadx;
|
||||
Reg32 dsdx;
|
||||
Reg32 dtdx;
|
||||
Reg32 dwdx;
|
||||
|
||||
long drdy; // Y Gradients
|
||||
long dgdy;
|
||||
long dbdy;
|
||||
long dzdy; //20.12 in 16bpp, 28.4 in 32bpp (there is an ugly hack in csimio.c, search "//EVIL:")
|
||||
long dady;
|
||||
long dsdy;
|
||||
long dtdy;
|
||||
long dwdy;
|
||||
Reg32 drdy; // Y Gradients
|
||||
Reg32 dgdy;
|
||||
Reg32 dbdy;
|
||||
Reg32 dzdy; //20.12 in 16bpp, 28.4 in 32bpp (there is an ugly hack in csimio.c, search "//EVIL:")
|
||||
Reg32 dady;
|
||||
Reg32 dsdy;
|
||||
Reg32 dtdy;
|
||||
Reg32 dwdy;
|
||||
|
||||
unsigned long triangleCMD; // execute a triangle command (float)
|
||||
unsigned long reservedA;
|
||||
Reg32u triangleCMD; // execute a triangle command (float)
|
||||
Reg32u reservedA;
|
||||
vtxRec FvA; // floating point version
|
||||
vtxRec FvB;
|
||||
vtxRec FvC;
|
||||
|
||||
long Fr; // floating point version
|
||||
long Fg;
|
||||
long Fb;
|
||||
long Fz;
|
||||
long Fa;
|
||||
long Fs;
|
||||
long Ft;
|
||||
long Fw;
|
||||
Reg32 Fr; // floating point version
|
||||
Reg32 Fg;
|
||||
Reg32 Fb;
|
||||
Reg32 Fz;
|
||||
Reg32 Fa;
|
||||
Reg32 Fs;
|
||||
Reg32 Ft;
|
||||
Reg32 Fw;
|
||||
|
||||
long Fdrdx;
|
||||
long Fdgdx;
|
||||
long Fdbdx;
|
||||
long Fdzdx;
|
||||
long Fdadx;
|
||||
long Fdsdx;
|
||||
long Fdtdx;
|
||||
long Fdwdx;
|
||||
Reg32 Fdrdx;
|
||||
Reg32 Fdgdx;
|
||||
Reg32 Fdbdx;
|
||||
Reg32 Fdzdx;
|
||||
Reg32 Fdadx;
|
||||
Reg32 Fdsdx;
|
||||
Reg32 Fdtdx;
|
||||
Reg32 Fdwdx;
|
||||
|
||||
long Fdrdy;
|
||||
long Fdgdy;
|
||||
long Fdbdy;
|
||||
long Fdzdy;
|
||||
long Fdady;
|
||||
long Fdsdy;
|
||||
long Fdtdy;
|
||||
long Fdwdy;
|
||||
Reg32 Fdrdy;
|
||||
Reg32 Fdgdy;
|
||||
Reg32 Fdbdy;
|
||||
Reg32 Fdzdy;
|
||||
Reg32 Fdady;
|
||||
Reg32 Fdsdy;
|
||||
Reg32 Fdtdy;
|
||||
Reg32 Fdwdy;
|
||||
|
||||
unsigned long FtriangleCMD; // execute a triangle command
|
||||
unsigned long fbzColorPath; // color select and combine
|
||||
unsigned long fogMode; // fog Mode
|
||||
unsigned long alphaMode; // alpha Mode
|
||||
unsigned long fbzMode; // framebuffer and Z mode
|
||||
unsigned long lfbMode; // linear framebuffer Mode
|
||||
unsigned long clipLeftRight; // (6)10(6)10
|
||||
unsigned long clipBottomTop; // (6)10(6)10
|
||||
Reg32u FtriangleCMD; // execute a triangle command
|
||||
Reg32u fbzColorPath; // color select and combine
|
||||
Reg32u fogMode; // fog Mode
|
||||
Reg32u alphaMode; // alpha Mode
|
||||
Reg32u fbzMode; // framebuffer and Z mode
|
||||
Reg32u lfbMode; // linear framebuffer Mode
|
||||
Reg32u clipLeftRight; // (6)10(6)10
|
||||
Reg32u clipBottomTop; // (6)10(6)10
|
||||
|
||||
unsigned long nopCMD; // execute a nop command
|
||||
unsigned long fastfillCMD; // execute a fast fill command
|
||||
unsigned long swapbufferCMD;// execute a swapbuffer command
|
||||
unsigned long fogColor; // (8)888
|
||||
unsigned long zaColor; // 8.24
|
||||
unsigned long chromaKey; // (8)888
|
||||
unsigned long chromaRange;
|
||||
unsigned long userIntrCmd;
|
||||
Reg32u nopCMD; // execute a nop command
|
||||
Reg32u fastfillCMD; // execute a fast fill command
|
||||
Reg32u swapbufferCMD;// execute a swapbuffer command
|
||||
Reg32u fogColor; // (8)888
|
||||
Reg32u zaColor; // 8.24
|
||||
Reg32u chromaKey; // (8)888
|
||||
Reg32u chromaRange;
|
||||
Reg32u userIntrCmd;
|
||||
|
||||
unsigned long stipple; // 32 bits, MSB masks pixels
|
||||
unsigned long c0; // 8.8.8.8 (ARGB)
|
||||
unsigned long c1; // 8.8.8.8 (ARGB)
|
||||
Reg32u stipple; // 32 bits, MSB masks pixels
|
||||
Reg32u c0; // 8.8.8.8 (ARGB)
|
||||
Reg32u c1; // 8.8.8.8 (ARGB)
|
||||
struct { // statistic gathering variables
|
||||
unsigned long fbiPixelsIn;
|
||||
unsigned long fbiChromaFail;
|
||||
unsigned long fbiZfuncFail;
|
||||
unsigned long fbiAfuncFail;
|
||||
unsigned long fbiPixelsOut;
|
||||
Reg32u fbiPixelsIn;
|
||||
Reg32u fbiChromaFail;
|
||||
Reg32u fbiZfuncFail;
|
||||
Reg32u fbiAfuncFail;
|
||||
Reg32u fbiPixelsOut;
|
||||
} stats;
|
||||
|
||||
unsigned long fogTable[32]; // 64 entries, 2 per word, 2 bytes each
|
||||
Reg32u fogTable[32]; // 64 entries, 2 per word, 2 bytes each
|
||||
|
||||
unsigned long renderMode; // new 32bpp and 1555 modes
|
||||
unsigned long stencilMode;
|
||||
unsigned long stencilOp;
|
||||
unsigned long colBufferAddr; //This is the primary colBufferAddr
|
||||
unsigned long colBufferStride;
|
||||
unsigned long auxBufferAddr; //This is the primary auxBufferAddr
|
||||
unsigned long auxBufferStride;
|
||||
unsigned long fbiStencilFail;
|
||||
Reg32u renderMode; // new 32bpp and 1555 modes
|
||||
Reg32u stencilMode;
|
||||
Reg32u stencilOp;
|
||||
Reg32u colBufferAddr; //This is the primary colBufferAddr
|
||||
Reg32u colBufferStride;
|
||||
Reg32u auxBufferAddr; //This is the primary auxBufferAddr
|
||||
Reg32u auxBufferStride;
|
||||
Reg32u fbiStencilFail;
|
||||
|
||||
unsigned long clipLeftRight1;
|
||||
unsigned long clipBottomTop1;
|
||||
unsigned long combineMode;
|
||||
unsigned long sliCtrl;
|
||||
unsigned long aaCtrl;
|
||||
unsigned long chipMask;
|
||||
unsigned long leftDesktopBuf;
|
||||
unsigned long reservedD[2]; // NOTE: used to store TMUprivate ptr (reservedD[0])
|
||||
Reg32u clipLeftRight1;
|
||||
Reg32u clipBottomTop1;
|
||||
Reg32u combineMode;
|
||||
Reg32u sliCtrl;
|
||||
Reg32u aaCtrl;
|
||||
Reg32u chipMask;
|
||||
Reg32u leftDesktopBuf;
|
||||
Reg32u reservedD[2]; // NOTE: used to store TMUprivate ptr (reservedD[0])
|
||||
// NOTE: used to store CSIMprivate ptr (reservedD[1])
|
||||
|
||||
unsigned long reservedE[7]; // NOTE: reservedE[0] stores the secondary colBufferAddr
|
||||
Reg32u reservedE[7]; // NOTE: reservedE[0] stores the secondary colBufferAddr
|
||||
// NOTE: reservedE[1] stores the secondary auxBufferAddr
|
||||
// NOTE: reservedE[2] stores the primary colBufferAddr
|
||||
// NOTE: reservedE[3] stores the primary auxBufferAddr
|
||||
|
||||
unsigned long reservedF[3];
|
||||
unsigned long swapBufferPend;
|
||||
unsigned long leftOverlayBuf;
|
||||
unsigned long rightOverlayBuf;
|
||||
unsigned long fbiSwapHistory;
|
||||
unsigned long fbiTrianglesOut; // triangles out counter
|
||||
Reg32u reservedF[3];
|
||||
Reg32u swapBufferPend;
|
||||
Reg32u leftOverlayBuf;
|
||||
Reg32u rightOverlayBuf;
|
||||
Reg32u fbiSwapHistory;
|
||||
Reg32u fbiTrianglesOut; // triangles out counter
|
||||
|
||||
FxU32 sSetupMode;
|
||||
FxU32 sVx;
|
||||
@@ -436,24 +444,24 @@ typedef volatile struct sstregs { // THE 3D CHIP
|
||||
|
||||
FxU32 sDrawTriCMD;
|
||||
FxU32 sBeginTriCMD;
|
||||
unsigned long reservedG[6];
|
||||
Reg32u reservedG[6];
|
||||
|
||||
unsigned long reservedH[8];
|
||||
Reg32u reservedH[8];
|
||||
|
||||
unsigned long reservedI[8];
|
||||
Reg32u reservedI[8];
|
||||
|
||||
unsigned long textureMode; // texture Mode
|
||||
unsigned long tLOD; // texture LOD settings
|
||||
unsigned long tDetail; // texture detail settings
|
||||
unsigned long texBaseAddr; // current texture base address
|
||||
unsigned long texBaseAddr1;
|
||||
unsigned long texBaseAddr2;
|
||||
unsigned long texBaseAddr38;
|
||||
unsigned long trexInit0; // hardware init bits
|
||||
unsigned long trexInit1; // hardware init bits
|
||||
Reg32u textureMode; // texture Mode
|
||||
Reg32u tLOD; // texture LOD settings
|
||||
Reg32u tDetail; // texture detail settings
|
||||
Reg32u texBaseAddr; // current texture base address
|
||||
Reg32u texBaseAddr1;
|
||||
Reg32u texBaseAddr2;
|
||||
Reg32u texBaseAddr38;
|
||||
Reg32u trexInit0; // hardware init bits
|
||||
Reg32u trexInit1; // hardware init bits
|
||||
|
||||
unsigned long nccTable0[12]; // NCC decode tables, bits are packed
|
||||
unsigned long nccTable1[12]; // 4 words Y, 4 words I, 4 words Q
|
||||
Reg32u nccTable0[12]; // NCC decode tables, bits are packed
|
||||
Reg32u nccTable1[12]; // 4 words Y, 4 words I, 4 words Q
|
||||
|
||||
} SstRegs;
|
||||
|
||||
|
||||
@@ -256,7 +256,8 @@ typedef struct hwcExtLinearAddrReq_s {
|
||||
/* Returned from HWCEXT_GETLINEARADDR */
|
||||
typedef struct hwcExtLinearAddrRes_s {
|
||||
FxU32
|
||||
numBaseAddrs, /* # base addresses */
|
||||
numBaseAddrs; /* # base addresses */
|
||||
AnyPtr
|
||||
baseAddresses[HWCEXT_MAX_BASEADDR]; /* linear Addresses */
|
||||
} hwcExtLinearAddrRes_t;
|
||||
|
||||
|
||||
@@ -48,6 +48,12 @@ extern char *cmdAGPRegNames[];
|
||||
extern char *waxRegNames[];
|
||||
extern char *sstRegNames[];
|
||||
|
||||
#ifdef __alpha__
|
||||
extern unsigned int _fxget32(unsigned int *);
|
||||
#define GET(s) _fxget32((unsigned int *)&s);
|
||||
#define SET(d,s) d = s
|
||||
#endif
|
||||
|
||||
#ifndef GET
|
||||
# define GET(s) s
|
||||
# define SET(d, s) d = s
|
||||
|
||||
@@ -27,59 +27,31 @@ typedef struct _XF86DRIClipRect {
|
||||
unsigned short y2;
|
||||
} XF86DRIClipRectRec, *XF86DRIClipRectPtr;
|
||||
|
||||
#define MAX_CHIPS 4
|
||||
|
||||
typedef unsigned long drmHandle, *drmHandlePtr; /* To mapped regions */
|
||||
typedef unsigned int drmSize, *drmSizePtr; /* For mapped regions */
|
||||
typedef void *drmAddress, **drmAddressPtr; /* For mapped regions */
|
||||
|
||||
typedef struct {
|
||||
drmHandle handle;
|
||||
drmSize size;
|
||||
drmAddress map;
|
||||
} tdfxRegion, *tdfxRegionPtr;
|
||||
|
||||
typedef struct {
|
||||
tdfxRegion regs[MAX_CHIPS];
|
||||
int deviceID;
|
||||
int width;
|
||||
int height;
|
||||
int mem;
|
||||
int cpp;
|
||||
int stride;
|
||||
int fifoOffset;
|
||||
int fifoSize;
|
||||
int fbOffset;
|
||||
int backOffset;
|
||||
int depthOffset;
|
||||
int textureOffset;
|
||||
int textureSize;
|
||||
int numChips;
|
||||
int numSamples;
|
||||
void *driScrnPriv;
|
||||
} tdfxScreenPrivate;
|
||||
|
||||
typedef struct dri_t {
|
||||
char *pFB;
|
||||
tdfxScreenPrivate *sPriv;
|
||||
int screenWidth;
|
||||
int screenHeight;
|
||||
int cpp;
|
||||
int memory;
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
char *pFB;
|
||||
char *pRegs;
|
||||
int deviceID;
|
||||
int cpp;
|
||||
int stride;
|
||||
int windowedStride;
|
||||
int fullScreenStride;
|
||||
int fbOffset;
|
||||
int fifoOffset;
|
||||
int fifoSize;
|
||||
int backOffset;
|
||||
int depthOffset;
|
||||
int textureOffset;
|
||||
int textureSize;
|
||||
int holeCounting;
|
||||
int numClip;
|
||||
XF86DRIClipRectPtr pClip;
|
||||
volatile int *fifoPtr;
|
||||
volatile int *fifoRead;
|
||||
int fullScreenPixFmt;
|
||||
int windowedPixFmt;
|
||||
int sliCount;
|
||||
int isFullScreen;
|
||||
volatile int **fifoPtr;
|
||||
volatile int **fifoRead;
|
||||
} DRIDef;
|
||||
|
||||
extern DRIDef driInfo;
|
||||
|
||||
@@ -67,7 +67,15 @@ hwcCheckMemSize(hwcBoardInfo *bInfo, FxU32 xres, FxU32 yres, FxU32 nColBuffers,
|
||||
#include "lindri.h"
|
||||
|
||||
static FxU32 fenceVar;
|
||||
#if defined(__i386__)
|
||||
#define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax");
|
||||
#elif defined(__alpha__)
|
||||
#define P6FENCE asm volatile("mb" ::: "memory")
|
||||
#elif defined(__ia64__)
|
||||
#define P6FENCE asm volatile("mf.a" ::: "memory")
|
||||
#elif
|
||||
Error - need to define P6FENCE
|
||||
#endif
|
||||
|
||||
#define MAXFIFOSIZE 0x40000
|
||||
#define FIFOPAD 0x0000
|
||||
@@ -79,7 +87,6 @@ static FxU32 fenceVar;
|
||||
|
||||
static hwcInfo hInfo;
|
||||
static char errorString[1024];
|
||||
static int finalVidDesktopOverlayStride;
|
||||
|
||||
static FxU32 calcBufferStride(hwcBoardInfo *bInfo, FxU32 xres, FxBool tiled);
|
||||
static FxU32 calcBufferSize(hwcBoardInfo *bInfo, FxU32 xres, FxU32 yres,
|
||||
@@ -98,21 +105,30 @@ typedef struct envitem_t {
|
||||
static envitem *first=0;
|
||||
static int envinit=0;
|
||||
|
||||
DRIDef driInfo={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
DRIDef driInfo={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
|
||||
void grDRIOpen(char *pFB, tdfxScreenPrivate *sPriv,
|
||||
void grDRIOpen(char *pFB, char *pRegs, int deviceID, int width, int height,
|
||||
int mem, int cpp, int stride, int fifoOffset, int fifoSize,
|
||||
int fbOffset, int backOffset, int depthOffset,
|
||||
int textureOffset, int textureSize,
|
||||
volatile int *fifoPtr, volatile int *fifoRead) {
|
||||
driInfo.pFB=pFB;
|
||||
driInfo.sPriv=(tdfxScreenPrivate*)malloc(sizeof(tdfxScreenPrivate));
|
||||
memcpy(driInfo.sPriv, sPriv, sizeof(tdfxScreenPrivate));
|
||||
driInfo.pRegs=pRegs;
|
||||
driInfo.deviceID=deviceID;
|
||||
driInfo.screenWidth=width;
|
||||
driInfo.screenHeight=height;
|
||||
driInfo.memory=mem;
|
||||
driInfo.cpp=cpp;
|
||||
driInfo.stride=stride;
|
||||
driInfo.fifoOffset=fifoOffset;
|
||||
driInfo.fifoSize = fifoSize;
|
||||
driInfo.fbOffset=fbOffset;
|
||||
driInfo.backOffset=backOffset;
|
||||
driInfo.depthOffset=depthOffset;
|
||||
driInfo.textureOffset=textureOffset;
|
||||
driInfo.textureSize=textureSize;
|
||||
driInfo.fifoPtr=(volatile int **)fifoPtr;
|
||||
driInfo.fifoRead=(volatile int **)fifoRead;
|
||||
/* These are the fields used in glide src */
|
||||
driInfo.cpp=sPriv->cpp;
|
||||
driInfo.screenWidth=sPriv->width;
|
||||
driInfo.screenHeight=sPriv->height;
|
||||
driInfo.stride=driInfo.windowedStride=sPriv->stride;
|
||||
driInfo.isFullScreen=0;
|
||||
}
|
||||
|
||||
void grDRIPosition(int x, int y, int w, int h,
|
||||
@@ -143,7 +159,7 @@ static void loadEnvFile() {
|
||||
if (*data=='\n') continue;
|
||||
val=strchr(data, '=');
|
||||
if (!val) {
|
||||
if (!sawError) {
|
||||
if (sawError) {
|
||||
fprintf(stderr, "In config file /etc/conf.3dfx/voodoo3:\n");
|
||||
sawError=1;
|
||||
}
|
||||
@@ -193,7 +209,7 @@ hwcInit(FxU32 vID, FxU32 dID) {
|
||||
errorString[0] = '\0';
|
||||
|
||||
if (!driInfo.pFB) return 0;
|
||||
if (dID!=driInfo.sPriv->deviceID) return 0;
|
||||
if (dID!=driInfo.deviceID) return 0;
|
||||
hInfo.boardInfo[0].pciInfo.initialized = FXFALSE;
|
||||
hInfo.nBoards++;
|
||||
hInfo.boardInfo[0].boardNum = 0;
|
||||
@@ -201,14 +217,13 @@ hwcInit(FxU32 vID, FxU32 dID) {
|
||||
hInfo.boardInfo[0].pciInfo.initialized = FXTRUE;;
|
||||
hInfo.boardInfo[0].pciInfo.vendorID = vID;
|
||||
hInfo.boardInfo[0].pciInfo.deviceID = dID;
|
||||
hInfo.boardInfo[0].h3Mem = driInfo.sPriv->mem>>20;
|
||||
if (driInfo.sPriv->cpp==3 || driInfo.sPriv->cpp==4) { /* 24 or 32 bpp modes */
|
||||
hInfo.boardInfo[0].h3Mem = driInfo.memory>>20;
|
||||
if (driInfo.cpp==3 || driInfo.cpp==4) { /* 24 or 32 bpp modes */
|
||||
hInfo.boardInfo[0].h3pixelSize=4;
|
||||
} else {
|
||||
hInfo.boardInfo[0].h3pixelSize=2;
|
||||
}
|
||||
hInfo.boardInfo[0].h3nwaySli=driInfo.sPriv->numChips;
|
||||
hInfo.boardInfo[0].h3pixelSample=driInfo.sPriv->numSamples;
|
||||
hInfo.boardInfo[0].h3nwaySli=1;
|
||||
|
||||
if (hInfo.nBoards) {
|
||||
return &hInfo;
|
||||
@@ -218,11 +233,10 @@ hwcInit(FxU32 vID, FxU32 dID) {
|
||||
}
|
||||
}
|
||||
|
||||
extern int getpid();
|
||||
|
||||
FxBool
|
||||
hwcMapBoard(hwcBoardInfo *bInfo, FxU32 bAddrMask) {
|
||||
extern int getpid();
|
||||
int i;
|
||||
|
||||
if (bInfo->pciInfo.initialized == FXFALSE) {
|
||||
sprintf(errorString, "hwcMapBoard: Called before hwcInit\n");
|
||||
return FXFALSE;
|
||||
@@ -231,10 +245,8 @@ hwcMapBoard(hwcBoardInfo *bInfo, FxU32 bAddrMask) {
|
||||
bInfo->linearInfo.initialized = FXTRUE;
|
||||
bInfo->osNT = FXFALSE;
|
||||
bInfo->procHandle = getpid();
|
||||
for (i=0; i<driInfo.sPriv->numChips; i++) {
|
||||
bInfo->linearInfo.linearAddress[(i<<2)+0]=(FxU32)driInfo.sPriv->regs[i].map;
|
||||
bInfo->linearInfo.linearAddress[(i<<2)+1]=(FxU32)driInfo.pFB;
|
||||
}
|
||||
bInfo->linearInfo.linearAddress[0]=(AnyPtr)driInfo.pRegs;
|
||||
bInfo->linearInfo.linearAddress[1]=(AnyPtr)driInfo.pFB;
|
||||
return FXTRUE;
|
||||
}
|
||||
|
||||
@@ -246,7 +258,6 @@ hwcUnmapBoard(hwcBoardInfo *bInfo) {
|
||||
FxBool
|
||||
hwcInitRegisters(hwcBoardInfo *bInfo) {
|
||||
int dramInit1;
|
||||
int i;
|
||||
|
||||
if (bInfo->linearInfo.initialized == FXFALSE) {
|
||||
printf(errorString, "hwcInitRegisters Called before hwcMapBoard\n");
|
||||
@@ -277,18 +288,24 @@ hwcInitRegisters(hwcBoardInfo *bInfo) {
|
||||
else
|
||||
bInfo->sdRAM = FXFALSE;
|
||||
|
||||
/* Determine the number of chips on the board XXX */
|
||||
bInfo->pciInfo.numChips=driInfo.sPriv->numChips;
|
||||
if (driInfo.sPriv->numChips>1) {
|
||||
for (i=1; i<driInfo.sPriv->numChips; i++) {
|
||||
bInfo->regInfo.slaveSstBase[i-1] =
|
||||
bInfo->linearInfo.linearAddress[(i<<2)+0] + SST_3D_OFFSET;
|
||||
bInfo->regInfo.slaveCmdBase[i-1] =
|
||||
bInfo->linearInfo.linearAddress[(i<<2)+0] + SST_CMDAGP_OFFSET;
|
||||
bInfo->regInfo.slaveIOBase[i-1] =
|
||||
bInfo->linearInfo.linearAddress[(i<<2)+0];
|
||||
}
|
||||
{
|
||||
FxU32
|
||||
pciInit0,
|
||||
pciCommandReg =
|
||||
BIT(0) | /* enable i/o decode */
|
||||
BIT(1); /* enable memory decode */
|
||||
|
||||
/* Enable PCI memory and I/O decode */
|
||||
pciSetConfigData(PCI_COMMAND, bInfo->deviceNum, &pciCommandReg);
|
||||
|
||||
HWC_IO_LOAD(bInfo->regInfo, pciInit0, pciInit0);
|
||||
pciInit0 |= SST_PCI_READ_WS | SST_PCI_WRITE_WS;
|
||||
HWC_IO_STORE(bInfo->regInfo, pciInit0, pciInit0);
|
||||
}
|
||||
|
||||
/* Determine the number of chips on the board XXX */
|
||||
bInfo->pciInfo.numChips=1;
|
||||
|
||||
return FXTRUE;
|
||||
}
|
||||
|
||||
@@ -318,8 +335,12 @@ hwcBufferLfbAddr(const hwcBoardInfo *bInfo, FxU32 physAddress)
|
||||
FxU32 tileScanline;
|
||||
FxU32 tileRow;
|
||||
FxU32 lfbAddress;
|
||||
FxU32 lfbYOffset;
|
||||
/*
|
||||
* This is the tile aperture stride. It should be
|
||||
* a power of two between 1k and 16k.
|
||||
*/
|
||||
FxU32 lfbBufferStride = bInfo->buffInfo.bufLfbStride;
|
||||
FxU32 lfbYOffset;
|
||||
|
||||
if (bInfo->vidInfo.tiled) {
|
||||
GDBG_INFO(80, "\tphysAddress: 0x%08lx\n",physAddress);
|
||||
@@ -352,9 +373,7 @@ hwcBufferLfbAddr(const hwcBoardInfo *bInfo, FxU32 physAddress)
|
||||
lfbYOffset = ((tileRow * 32 + tileScanline) << (bInfo->h3nwaySli >> 1));
|
||||
|
||||
/* Compute LFB address of tile start */
|
||||
lfbAddress = bInfo->primaryOffset
|
||||
+ lfbYOffset * lfbBufferStride
|
||||
+ tileXOffset * 128;
|
||||
lfbAddress = bInfo->primaryOffset + lfbYOffset * lfbBufferStride + tileXOffset * 128;
|
||||
|
||||
GDBG_INFO(80, "\tlfbAddress: %08lx\n", lfbAddress);
|
||||
retVal = lfbAddress;
|
||||
@@ -378,92 +397,10 @@ calculateLfbStride(FxU32 screenWidth)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* 3Dfx WORKHERE:
|
||||
* This needs to be revisited. Why is it here, and
|
||||
* why does it not seem to be used.
|
||||
*/
|
||||
FxBool hwcSetupBufferFullscreen(hwcBoardInfo *bInfo, FxU32 nColBuffers,
|
||||
FxU32 nAuxBuffers)
|
||||
{
|
||||
#define FN_NAME "hwcSetupBufferFullscreen"
|
||||
FxU32 bufStride, bufSize;
|
||||
|
||||
if (bInfo->vidInfo.initialized == FXFALSE) {
|
||||
sprintf(errorString, "%s: Called before video initialization\n", FN_NAME);
|
||||
return FXFALSE;
|
||||
}
|
||||
|
||||
GDBG_INFO(80, "%s(0x%x, 0x%x, 0x%x)\n", FN_NAME, bInfo, nColBuffers, nAuxBuffers);
|
||||
|
||||
/* I've decided on > 2 instead of == 3 because we may support more
|
||||
than 3 buffers in the future, and want 4 to set the
|
||||
triple-buffering bit in dramInit1, also */
|
||||
bInfo->vidInfo.tripleBuffering = (nColBuffers > 2);
|
||||
|
||||
bInfo->vidInfo.stride = bufStride =
|
||||
calcBufferStride(bInfo, bInfo->vidInfo.xRes, bInfo->vidInfo.tiled);
|
||||
|
||||
/* We want to place the FIFO after the tram but before the color
|
||||
buffers with some pad */
|
||||
bufSize = calcBufferSize(bInfo, bInfo->vidInfo.xRes, bInfo->vidInfo.yRes,
|
||||
bInfo->vidInfo.tiled);
|
||||
|
||||
bInfo->buffInfo.bufStride = bufStride;
|
||||
bInfo->buffInfo.bufSize = bufSize;
|
||||
|
||||
if (bInfo->vidInfo.tiled) {
|
||||
driInfo.fullScreenStride=bInfo->buffInfo.bufStrideInTiles = (bufStride >> 7);
|
||||
bInfo->buffInfo.bufSizeInTiles =
|
||||
calcBufferSizeInTiles(bInfo, bInfo->vidInfo.xRes, bInfo->vidInfo.yRes);
|
||||
bInfo->buffInfo.bufHeightInTiles =
|
||||
calcBufferHeightInTiles(bInfo, bInfo->vidInfo.yRes);
|
||||
}
|
||||
|
||||
bInfo->buffInfo.initialized = FXTRUE;
|
||||
bInfo->buffInfo.nColBuffers = nColBuffers;
|
||||
bInfo->buffInfo.nAuxBuffers = nAuxBuffers;
|
||||
|
||||
bInfo->fbOffset = driInfo.sPriv->fbOffset;
|
||||
|
||||
bInfo->fifoInfo.fifoStart = driInfo.sPriv->fifoOffset;
|
||||
bInfo->fifoInfo.fifoLength = driInfo.sPriv->fifoSize;
|
||||
|
||||
bInfo->tramOffset = driInfo.sPriv->textureOffset;
|
||||
|
||||
/* !!! This needs to be reworked to support second col and aux buffers */
|
||||
|
||||
bInfo->primaryOffset = (bInfo->h3Mem<<20) - (bufSize*3+0x1000);
|
||||
bInfo->tramSize = bInfo->primaryOffset-bInfo->tramOffset;
|
||||
|
||||
bInfo->buffInfo.colBuffStart0[0] = bInfo->primaryOffset;
|
||||
bInfo->buffInfo.colBuffEnd0[0] = bInfo->buffInfo.colBuffStart0[0]+bufSize;
|
||||
|
||||
bInfo->buffInfo.colBuffStart0[1] = bInfo->buffInfo.colBuffEnd0[0];
|
||||
bInfo->buffInfo.colBuffEnd0[1] = bInfo->buffInfo.colBuffStart0[1]+bufSize;
|
||||
|
||||
bInfo->buffInfo.auxBuffStart0 = bInfo->buffInfo.colBuffEnd0[1];
|
||||
if (!(bInfo->buffInfo.auxBuffStart0&0x1000))
|
||||
bInfo->buffInfo.auxBuffStart0+=0x1000;
|
||||
bInfo->buffInfo.auxBuffEnd0 = bInfo->buffInfo.auxBuffStart0+bufSize;
|
||||
|
||||
bInfo->buffInfo.lfbBuffAddr0[0] = bInfo->buffInfo.colBuffStart0[0];
|
||||
bInfo->buffInfo.lfbBuffAddr0[1] =
|
||||
hwcBufferLfbAddr(bInfo, bInfo->buffInfo.colBuffStart0[1]);
|
||||
bInfo->buffInfo.lfbBuffAddr0[2] =
|
||||
hwcBufferLfbAddr(bInfo, bInfo->buffInfo.auxBuffStart0);
|
||||
|
||||
return FXTRUE;
|
||||
|
||||
#undef FN_NAME
|
||||
}
|
||||
#endif /* 0 */
|
||||
FxBool
|
||||
hwcSetupBuffersWindowed(hwcBoardInfo *bInfo, FxU32 nColBuffers, FxU32 nAuxBuffers)
|
||||
hwcAllocBuffers(hwcBoardInfo *bInfo, FxU32 nColBuffers, FxU32 nAuxBuffers)
|
||||
{
|
||||
#define FN_NAME "hwcSetupBuffersWindowed"
|
||||
#define FN_NAME "hwcAllocBuffers"
|
||||
FxU32 bufStride, bufSize;
|
||||
|
||||
if (bInfo->vidInfo.initialized == FXFALSE) {
|
||||
@@ -479,68 +416,57 @@ hwcSetupBuffersWindowed(hwcBoardInfo *bInfo, FxU32 nColBuffers, FxU32 nAuxBuffer
|
||||
bInfo->vidInfo.tripleBuffering = (nColBuffers > 2);
|
||||
|
||||
bInfo->vidInfo.stride = bufStride =
|
||||
calcBufferStride(bInfo, driInfo.sPriv->width, bInfo->vidInfo.tiled);
|
||||
calcBufferStride(bInfo, driInfo.screenWidth, bInfo->vidInfo.tiled);
|
||||
|
||||
/* We want to place the FIFO after the tram but before the color
|
||||
buffers with some pad */
|
||||
bufSize = calcBufferSize(bInfo, driInfo.sPriv->width,
|
||||
driInfo.sPriv->height, bInfo->vidInfo.tiled);
|
||||
bufSize = calcBufferSize(bInfo, driInfo.screenWidth, driInfo.screenHeight,
|
||||
bInfo->vidInfo.tiled);
|
||||
|
||||
bInfo->buffInfo.bufStride = bufStride;
|
||||
bInfo->buffInfo.bufSize = bufSize;
|
||||
bInfo->buffInfo.bufLfbStride = calculateLfbStride(bufStride);
|
||||
|
||||
if (bInfo->vidInfo.tiled) {
|
||||
driInfo.fullScreenStride=bInfo->buffInfo.bufStrideInTiles = (bufStride >> 7);
|
||||
bInfo->buffInfo.bufStrideInTiles = (bufStride >> 7);
|
||||
bInfo->buffInfo.bufSizeInTiles =
|
||||
calcBufferSizeInTiles(bInfo, driInfo.sPriv->width, driInfo.sPriv->height);
|
||||
calcBufferSizeInTiles(bInfo, driInfo.screenWidth, driInfo.screenHeight);
|
||||
bInfo->buffInfo.bufHeightInTiles =
|
||||
calcBufferHeightInTiles(bInfo, driInfo.sPriv->height);
|
||||
calcBufferHeightInTiles(bInfo, driInfo.screenHeight);
|
||||
}
|
||||
|
||||
bInfo->buffInfo.initialized = FXTRUE;
|
||||
bInfo->buffInfo.nColBuffers = nColBuffers;
|
||||
bInfo->buffInfo.nAuxBuffers = nAuxBuffers;
|
||||
|
||||
bInfo->fbOffset = driInfo.sPriv->fbOffset;
|
||||
bInfo->fbOffset = driInfo.fbOffset;
|
||||
|
||||
bInfo->fifoInfo.fifoStart = driInfo.sPriv->fifoOffset;
|
||||
bInfo->fifoInfo.fifoLength = driInfo.sPriv->fifoSize;
|
||||
bInfo->fifoInfo.fifoStart = driInfo.fifoOffset;
|
||||
bInfo->fifoInfo.fifoLength = driInfo.fifoSize;
|
||||
|
||||
bInfo->tramOffset = driInfo.sPriv->textureOffset;
|
||||
bInfo->tramSize = driInfo.sPriv->textureSize;
|
||||
bInfo->tramOffset = driInfo.textureOffset;
|
||||
bInfo->tramSize = driInfo.textureSize;
|
||||
|
||||
/* !!! This needs to be reworked to support second col and aux buffers */
|
||||
|
||||
bInfo->primaryOffset = driInfo.sPriv->backOffset;
|
||||
bInfo->primaryOffset = driInfo.backOffset;
|
||||
|
||||
bInfo->buffInfo.colBuffStart0[0] = driInfo.sPriv->fbOffset;
|
||||
bInfo->buffInfo.colBuffEnd0[0] = driInfo.sPriv->fbOffset + bufSize;
|
||||
bInfo->buffInfo.colBuffStart0[0] = driInfo.fbOffset;
|
||||
bInfo->buffInfo.colBuffEnd0[0] = driInfo.fbOffset +
|
||||
driInfo.screenHeight*driInfo.stride;
|
||||
|
||||
bInfo->buffInfo.colBuffStart0[1] = driInfo.sPriv->backOffset;
|
||||
bInfo->buffInfo.colBuffEnd0[1] = driInfo.sPriv->backOffset+bufSize;
|
||||
bInfo->buffInfo.colBuffStart0[1] = driInfo.backOffset;
|
||||
bInfo->buffInfo.colBuffEnd0[1] = driInfo.backOffset+bufSize;
|
||||
|
||||
bInfo->buffInfo.auxBuffStart0 = driInfo.sPriv->depthOffset;
|
||||
bInfo->buffInfo.auxBuffEnd0 = driInfo.sPriv->depthOffset+bufSize;
|
||||
bInfo->buffInfo.auxBuffStart0 = driInfo.depthOffset;
|
||||
bInfo->buffInfo.auxBuffEnd0 = driInfo.depthOffset+bufSize;
|
||||
|
||||
bInfo->buffInfo.lfbBuffAddr0[0] = bInfo->buffInfo.colBuffStart0[0];
|
||||
bInfo->buffInfo.lfbBuffAddr0[1] =
|
||||
hwcBufferLfbAddr(bInfo, bInfo->buffInfo.colBuffStart0[1]);
|
||||
bInfo->buffInfo.lfbBuffAddr0[1] = bInfo->buffInfo.colBuffStart0[1];
|
||||
bInfo->buffInfo.lfbBuffAddr0[2] =
|
||||
hwcBufferLfbAddr(bInfo, bInfo->buffInfo.auxBuffStart0);
|
||||
hwcBufferLfbAddr(bInfo, bInfo->buffInfo.auxBuffStart0);
|
||||
|
||||
return FXTRUE;
|
||||
|
||||
#undef FN_NAME
|
||||
} /* hwcSetupBuffersWindowed */
|
||||
|
||||
FxBool
|
||||
hwcAllocBuffers(hwcBoardInfo *bInfo, FxU32 nColBuffers, FxU32 nAuxBuffers)
|
||||
{
|
||||
FxBool result;
|
||||
|
||||
result=hwcSetupBuffersWindowed(bInfo, nColBuffers, nAuxBuffers);
|
||||
GDBG_INFO(80, "%s: Board Info:\n", "hwcAllocBuffers");
|
||||
GDBG_INFO(80, "%s: Board Info:\n", FN_NAME);
|
||||
GDBG_INFO(80, "\thdc: 0x%x\n", bInfo->hdc);
|
||||
GDBG_INFO(80, "\textContextID: 0x%x\n", bInfo->extContextID);
|
||||
GDBG_INFO(80, "\tdevRev: 0x%x\n", bInfo->devRev);
|
||||
@@ -550,7 +476,7 @@ hwcAllocBuffers(hwcBoardInfo *bInfo, FxU32 nColBuffers, FxU32 nAuxBuffers)
|
||||
GDBG_INFO(80, "\tboardNum: 0x%x\n", bInfo->boardNum);
|
||||
GDBG_INFO(80, "\tdeviceNum: 0x%x\n", bInfo->deviceNum);
|
||||
|
||||
GDBG_INFO(80, "%s: Buffer Info:\n", "hwcAllocBuffers");
|
||||
GDBG_INFO(80, "%s: Buffer Info:\n", FN_NAME);
|
||||
GDBG_INFO(80, "\tbufSize: 0x%x\n", bInfo->buffInfo.bufSize);
|
||||
GDBG_INFO(80, "\tbufSizeInTiles: 0x%x\n", bInfo->buffInfo.bufSizeInTiles);
|
||||
GDBG_INFO(80, "\tbufStride: 0x%x\n", bInfo->buffInfo.bufStride);
|
||||
@@ -571,71 +497,13 @@ hwcAllocBuffers(hwcBoardInfo *bInfo, FxU32 nColBuffers, FxU32 nAuxBuffers)
|
||||
GDBG_INFO(80, "\tlfbBuffAddr0[1] 0x%x\n", bInfo->buffInfo.lfbBuffAddr0[1]);
|
||||
GDBG_INFO(80, "\tlfbBuffAddr0[2] 0x%x\n", bInfo->buffInfo.lfbBuffAddr0[2]);
|
||||
|
||||
GDBG_INFO(80, "%s: FIFO Info:\n", "hwcAllocBuffers");
|
||||
GDBG_INFO(80, "%s: FIFO Info:\n", FN_NAME);
|
||||
GDBG_INFO(80, "\tfifoStart: 0x%x\n", bInfo->fifoInfo.fifoStart);
|
||||
GDBG_INFO(80, "\tfifoLength: 0x%x\n", bInfo->fifoInfo.fifoLength);
|
||||
return result;
|
||||
}
|
||||
return FXTRUE;
|
||||
|
||||
void hwcIdleHardwareWithTimeout(hwcBoardInfo *bInfo)
|
||||
{
|
||||
FxU32
|
||||
miscInit0, miscInit1, status, statusSlave, idle, timeout, i;
|
||||
|
||||
/* Wait for hardware to idle. */
|
||||
idle = 0;
|
||||
timeout = 0;
|
||||
|
||||
checkforidle:
|
||||
do {
|
||||
if(idle > 0) {
|
||||
GDBG_INFO(80,"waiting for idle...\n");
|
||||
}
|
||||
HWC_IO_LOAD(bInfo->regInfo, status, status);
|
||||
for(i = 1; i < bInfo->pciInfo.numChips; i++) {
|
||||
HWC_IO_LOAD_SLAVE(i, bInfo->regInfo, status, statusSlave);
|
||||
status |= statusSlave;
|
||||
}
|
||||
/* Make sure we see an idle 3 times in a row from all chips. */
|
||||
if(status & SST_BUSY) {
|
||||
idle = 0;
|
||||
} else {
|
||||
idle++;
|
||||
}
|
||||
timeout++;
|
||||
/* Nothing the hardware does should take as long as reading the
|
||||
* status registers a billion times... */
|
||||
if(timeout >= 1000000000) {
|
||||
break;
|
||||
}
|
||||
} while(idle < 3);
|
||||
|
||||
if(timeout >= 1000000000) {
|
||||
GDBG_INFO(80,"Hardware timeout on idle, resetting...\n");
|
||||
/* Reset FBI, 2D, and command streams. */
|
||||
HWC_IO_LOAD(bInfo->regInfo, miscInit0, miscInit0);
|
||||
/* Also be sure to make sure miscInit1's addressing is correct on Napalm */
|
||||
HWC_IO_STORE(bInfo->regInfo, miscInit0, (miscInit0 & ~BIT(30)) | SST_GRX_RESET | SST_2D_RESET);
|
||||
HWC_IO_LOAD(bInfo->regInfo, miscInit1, miscInit1);
|
||||
HWC_IO_STORE(bInfo->regInfo, miscInit1, miscInit1 | SST_CMDSTREAM_RESET);
|
||||
|
||||
/* Give it a little time to propagate */
|
||||
for(idle = 0; idle < 100; idle++) {
|
||||
HWC_IO_LOAD(bInfo->regInfo, status, status);
|
||||
}
|
||||
/* Let hardware out of reset */
|
||||
HWC_IO_STORE(bInfo->regInfo, miscInit1, miscInit1);
|
||||
HWC_IO_STORE(bInfo->regInfo, miscInit0, miscInit0);
|
||||
|
||||
/* Give it a little time to propagate */
|
||||
for(idle = 0; idle < 100; idle++) {
|
||||
HWC_IO_LOAD(bInfo->regInfo, status, status);
|
||||
}
|
||||
|
||||
/* And make sure it's really idle... */
|
||||
goto checkforidle;
|
||||
}
|
||||
}
|
||||
#undef FN_NAME
|
||||
} /* hwcAllocBuffers */
|
||||
|
||||
FxBool
|
||||
hwcInitFifo(hwcBoardInfo *bInfo, FxBool enableHoleCounting)
|
||||
@@ -656,129 +524,14 @@ hwcInitFifo(hwcBoardInfo *bInfo, FxBool enableHoleCounting)
|
||||
hwcInitFifoRegs(enableHoleCounting);
|
||||
#endif
|
||||
|
||||
hwcIdleHardwareWithTimeout(bInfo);
|
||||
|
||||
/* disable the CMD fifo */
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifo0.baseSize, 0);
|
||||
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifo0.baseAddrL, bInfo->fifoInfo.fifoStart>>12);
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifo0.readPtrL, bInfo->fifoInfo.fifoStart);
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifo0.readPtrH, 0);
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifo0.aMin, bInfo->fifoInfo.fifoStart-4);
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifo0.aMax, bInfo->fifoInfo.fifoStart-4);
|
||||
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifo0.depth, 0);
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifo0.holeCount, 0);
|
||||
/* Fifo LWM /HWM/ THRESHOLD */
|
||||
if (bInfo->pciInfo.deviceID == SST_DEVICE_ID_H3) { /* banshee */
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifoThresh,
|
||||
(0x09 << SST_HIGHWATER_SHIFT) | 0x2);
|
||||
} else if (IS_NAPALM(bInfo->pciInfo.deviceID)) {
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifoThresh,
|
||||
(0x20 << SST_HIGHWATER_SHIFT) | 0x8);
|
||||
} else {
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifoThresh,
|
||||
(0xf << SST_HIGHWATER_SHIFT) | 0x8);
|
||||
}
|
||||
|
||||
HWC_CAGP_STORE(bInfo->regInfo, cmdFifo0.baseSize,
|
||||
(((bInfo->fifoInfo.fifoLength >> 12) - 1) |
|
||||
SST_EN_CMDFIFO |
|
||||
(enableHoleCounting ? 0 : SST_CMDFIFO_DISABLE_HOLES)));
|
||||
|
||||
GDBG_INFO(80 ,"%s: CMD FIFO placed at physical addr 0x%x size 0x%0x\n",
|
||||
FN_NAME, driInfo.sPriv->fifoOffset, driInfo.sPriv->fifoSize);
|
||||
FN_NAME, driInfo.fifoOffset, driInfo.fifoSize);
|
||||
|
||||
return FXTRUE;
|
||||
|
||||
#undef FN_NAME
|
||||
} /* hwcInitFifo */
|
||||
|
||||
static FxBool
|
||||
hwcInitVideoDesktopAndOverlaySurface(hwcRegInfo *rInfo,
|
||||
FxU32 *vidProcCfgAddr,
|
||||
FxU32 pixFmt,
|
||||
FxU32 desktopStartAddress,
|
||||
FxU32 desktopTiledStride,
|
||||
FxU32 overlayStartAddress,
|
||||
FxU32 overlayTiledStride)
|
||||
{
|
||||
FxU32 doStride;
|
||||
FxU32 vidProcCfg = *vidProcCfgAddr;
|
||||
FxU32 vidScreenSize = 0;
|
||||
int desktopBpp = driInfo.cpp;
|
||||
int lg2desktopBpp;
|
||||
switch (desktopBpp) {
|
||||
case 2:
|
||||
lg2desktopBpp = 1;
|
||||
break;
|
||||
case 3:
|
||||
desktopBpp = 4;
|
||||
/*
|
||||
* Allez Oop.
|
||||
*/
|
||||
case 4:
|
||||
lg2desktopBpp = 2;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* This cannot happen.
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"Bad desktop BPP value %d in hwcSetupFullScreen\n",
|
||||
desktopBpp);
|
||||
return FXFALSE;
|
||||
}
|
||||
HWC_IO_STORE((*rInfo), vidProcCfg, vidProcCfg);
|
||||
/*
|
||||
* Set up the desktop.
|
||||
*/
|
||||
HWC_IO_STORE((*rInfo), vidDesktopStartAddr,
|
||||
desktopStartAddress & SST_VIDEO_START_ADDR);
|
||||
/*
|
||||
* Set up the overlay.
|
||||
*/
|
||||
vidProcCfg |= pixFmt;
|
||||
vidProcCfg |= (pixFmt >> 21) << 18;
|
||||
vidProcCfg &= ~SST_CURSOR_EN; /* Turn off HW Cursor */
|
||||
/*
|
||||
* These are kind of guesswork.
|
||||
*
|
||||
* Bypass both cluts.
|
||||
* Select the upper CLUT for the overlay, and the lower CLUT
|
||||
* for the desktop.
|
||||
*/
|
||||
vidProcCfg |= SST_OVERLAY_CLUT_BYPASS|SST_DESKTOP_CLUT_BYPASS;
|
||||
vidProcCfg |= SST_OVERLAY_CLUT_SELECT;
|
||||
vidProcCfg |= SST_OVERLAY_EN | SST_DESKTOP_EN;
|
||||
vidProcCfg |= SST_DESKTOP_TILED_EN | SST_OVERLAY_TILED_EN;
|
||||
|
||||
/* */
|
||||
doStride = SST_OVERLAY_TILE_STRIDE
|
||||
| SST_DESKTOP_TILE_STRIDE
|
||||
| (desktopTiledStride << SST_DESKTOP_STRIDE_SHIFT)
|
||||
| (overlayTiledStride << SST_OVERLAY_STRIDE_SHIFT);
|
||||
HWC_IO_STORE((*rInfo), vidDesktopOverlayStride, doStride);
|
||||
|
||||
HWC_IO_STORE((*rInfo), vidOverlayStartCoords, 0);
|
||||
HWC_IO_STORE((*rInfo), vidOverlayEndScreenCoord,
|
||||
(driInfo.sPriv->height << SST_OVERLAY_Y_SHIFT) |
|
||||
(driInfo.sPriv->width & SST_OVERLAY_X) );
|
||||
HWC_IO_STORE((*rInfo), vidOverlayDudx, driInfo.screenWidth);
|
||||
HWC_IO_STORE((*rInfo), vidOverlayDvdy, 0);
|
||||
HWC_IO_LOAD((*rInfo), vidScreenSize, vidScreenSize);
|
||||
vidScreenSize &= ~SST_VIDEO_SCREEN_DESKTOPADDR_FIFO_ENABLE;
|
||||
HWC_IO_STORE((*rInfo), vidScreenSize, vidScreenSize);
|
||||
HWC_IO_STORE((*rInfo), vidOverlayDudxOffsetSrcWidth,
|
||||
((driInfo.sPriv->width << lg2desktopBpp)
|
||||
<< SST_OVERLAY_FETCH_SIZE_SHIFT)
|
||||
|
||||
& SST_OVERLAY_FETCH_SIZE);
|
||||
finalVidDesktopOverlayStride = doStride;
|
||||
*vidProcCfgAddr = vidProcCfg;
|
||||
return(FXTRUE);
|
||||
} /* hwcInitVideoDesktopAndOverlaySurface */
|
||||
|
||||
FxBool
|
||||
hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo
|
||||
*vidTiming, FxU32 pixFmt, FxBool overlay) {
|
||||
@@ -824,7 +577,7 @@ hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo
|
||||
|
||||
/* Clear out relavent bits */
|
||||
miscInit0 &= ~SST_YORIGIN_TOP;
|
||||
miscInit0 |= ((driInfo.sPriv->height - 1) << SST_YORIGIN_TOP_SHIFT);
|
||||
miscInit0 |= ((driInfo.screenHeight - 1) << SST_YORIGIN_TOP_SHIFT);
|
||||
HWC_IO_STORE(bInfo->regInfo, miscInit0, miscInit0);
|
||||
|
||||
/* Set up dramInit1 for triple or double buffering */
|
||||
@@ -849,14 +602,18 @@ static FxU32
|
||||
calcBufferStride(hwcBoardInfo *bInfo, FxU32 xres, FxBool tiled)
|
||||
{
|
||||
FxU32 strideInTiles;
|
||||
FxU32 cpp = (bInfo->h3pixelSize == 3) ? 4 : bInfo->h3pixelSize;
|
||||
FxU32 shift = (bInfo->h3pixelSize>>1);
|
||||
|
||||
if (tiled == FXTRUE) {
|
||||
/* Calculate tile width stuff */
|
||||
strideInTiles = (xres * cpp + HWC_TILE_WIDTH - 1)/HWC_TILE_WIDTH;
|
||||
strideInTiles = (xres << shift) >> 7;
|
||||
if ((xres << shift) & (HWC_TILE_WIDTH - 1))
|
||||
strideInTiles++;
|
||||
|
||||
return (strideInTiles * HWC_TILE_WIDTH);
|
||||
|
||||
} else {
|
||||
return (xres * cpp);
|
||||
return (xres << shift);
|
||||
}
|
||||
} /* calcBufferStride */
|
||||
|
||||
@@ -1141,7 +898,7 @@ hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res,
|
||||
{
|
||||
#define FN_NAME "hwcResolutionSupported"
|
||||
|
||||
/* For now we're just going to return TRUE. We should check with
|
||||
/* For now we're just going to retur TRUE. We should check with
|
||||
vmode extension to see if the requested size is available */
|
||||
return FXTRUE;
|
||||
|
||||
@@ -1225,7 +982,7 @@ char hwcGetCH( void ) {
|
||||
return lin_getch();
|
||||
}
|
||||
|
||||
void grDRIImportFifo(int fifoPtr, int fifoRead)
|
||||
void grDRIImportFifo(FxU32 fifoPtr, FxU32 fifoRead)
|
||||
{
|
||||
_grImportFifo(fifoPtr, fifoRead);
|
||||
}
|
||||
@@ -1234,104 +991,8 @@ void grDRIInvalidateAll() {
|
||||
_grInvalidateAll();
|
||||
}
|
||||
|
||||
void grDRIResetSAREA() {
|
||||
void grDRIResetSAREA()
|
||||
{
|
||||
_grExportFifo(driInfo.fifoPtr, driInfo.fifoRead);
|
||||
}
|
||||
|
||||
Bool hwcSetupFullScreen(hwcBoardInfo *bInfo, FxBool state) {
|
||||
driInfo.isFullScreen=state;
|
||||
if (state) {
|
||||
FxU32 desktopTiledStride, overlayTiledStride;
|
||||
FxU32 vidProcCfg = 0;
|
||||
|
||||
/* Video pixel buffer threshold */
|
||||
{
|
||||
FxU32 vidPixelBufThold;
|
||||
FxU32 thold = 32;
|
||||
|
||||
if (getenv("SSTVB_PIXTHOLD")) {
|
||||
thold = atoi(getenv("SSTVB_PIXTHOLD"));
|
||||
}
|
||||
|
||||
thold &= 0x3f;
|
||||
|
||||
vidPixelBufThold = (thold | (thold << 6) | (thold << 12));
|
||||
|
||||
HWC_IO_STORE(bInfo->regInfo, vidPixelBufThold, vidPixelBufThold);
|
||||
}
|
||||
|
||||
driInfo.stride=driInfo.fullScreenStride;
|
||||
if (driInfo.sliCount > 1) {
|
||||
vidProcCfg = BIT(28) | BIT(29);
|
||||
}
|
||||
/*
|
||||
* We place the desktop over the windowed front buffer.
|
||||
* We place the back buffer over the windowed back buffer.
|
||||
*/
|
||||
desktopTiledStride = bInfo->buffInfo.bufStrideInTiles;
|
||||
overlayTiledStride = bInfo->buffInfo.bufStrideInTiles;
|
||||
hwcInitVideoDesktopAndOverlaySurface(
|
||||
&bInfo->regInfo,
|
||||
&vidProcCfg, /* video processor configuration value */
|
||||
driInfo.fullScreenPixFmt, /* pixel format of OS and DS */
|
||||
bInfo->buffInfo.colBuffStart0[0],
|
||||
desktopTiledStride,
|
||||
bInfo->buffInfo.colBuffStart0[1],
|
||||
overlayTiledStride);
|
||||
{
|
||||
int chipNum, locLFBMemCfg, lfbTileCompare;
|
||||
|
||||
for(chipNum = 0; chipNum < bInfo->pciInfo.numChips; chipNum++) {
|
||||
/* Load */
|
||||
if(chipNum == 0) {
|
||||
HWC_IO_STORE(bInfo->regInfo, lfbMemoryConfig, SST_RAW_LFB_UPDATE_CONTROL);
|
||||
HWC_IO_LOAD(bInfo->regInfo, lfbMemoryConfig, locLFBMemCfg);
|
||||
HWC_IO_STORE(bInfo->regInfo, lfbMemoryConfig, SST_RAW_LFB_UPDATE_CONTROL|SST_RAW_LFB_READ_CONTROL);
|
||||
HWC_IO_LOAD(bInfo->regInfo, lfbMemoryConfig, lfbTileCompare);
|
||||
HWC_IO_STORE(bInfo->regInfo, lfbMemoryConfig, SST_RAW_LFB_UPDATE_CONTROL);
|
||||
} else {
|
||||
HWC_IO_STORE_SLAVE(chipNum, bInfo->regInfo, lfbMemoryConfig, SST_RAW_LFB_UPDATE_CONTROL);
|
||||
HWC_IO_LOAD_SLAVE(chipNum, bInfo->regInfo, lfbMemoryConfig, locLFBMemCfg);
|
||||
HWC_IO_STORE_SLAVE(chipNum, bInfo->regInfo, lfbMemoryConfig, SST_RAW_LFB_UPDATE_CONTROL|SST_RAW_LFB_READ_CONTROL);
|
||||
HWC_IO_LOAD_SLAVE(chipNum, bInfo->regInfo, lfbMemoryConfig, lfbTileCompare);
|
||||
HWC_IO_STORE_SLAVE(chipNum, bInfo->regInfo, lfbMemoryConfig, SST_RAW_LFB_UPDATE_CONTROL);
|
||||
}
|
||||
}
|
||||
}
|
||||
HWC_IO_STORE( bInfo->regInfo, vidDesktopOverlayStride,
|
||||
( driInfo.stride << 16 ) |
|
||||
driInfo.stride );
|
||||
grSetSliCount(driInfo.sPriv->numChips, driInfo.sliCount);
|
||||
#if 0
|
||||
/*
|
||||
* We do this in the X server.
|
||||
*/
|
||||
if (driInfo.sliCount > 1) {
|
||||
_grEnableSliCtrl();
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Ok, we are all set up, so enable the video processor, and
|
||||
* we're on our way.
|
||||
*/
|
||||
vidProcCfg |= SST_VIDEO_PROCESSOR_EN;
|
||||
HWC_IO_STORE(bInfo->regInfo, vidProcCfg, vidProcCfg);
|
||||
} else {
|
||||
FxU32 vidProcCfg = 0;
|
||||
/*
|
||||
* Just disable the video processor.
|
||||
*/
|
||||
HWC_IO_LOAD(bInfo->regInfo, vidProcCfg, vidProcCfg);
|
||||
vidProcCfg &= ~SST_VIDEO_PROCESSOR_EN;
|
||||
HWC_IO_STORE(bInfo->regInfo, vidProcCfg, vidProcCfg);
|
||||
#if 0
|
||||
/*
|
||||
* We will do this in the X server.
|
||||
*/
|
||||
_grDisableSliCtrl();
|
||||
#endif
|
||||
grSetSliCount(1, 1);
|
||||
driInfo.stride=driInfo.windowedStride;
|
||||
}
|
||||
return(FXTRUE);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
/*
|
||||
** Copyright (c) 1996, 3Dfx Interactive, Inc.
|
||||
** All Rights Reserved.
|
||||
**
|
||||
** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.;
|
||||
** the contents of this file may not be disclosed to third parties, copied or
|
||||
** duplicated in any form, in whole or in part, without the prior written
|
||||
** permission of 3Dfx Interactive, Inc.
|
||||
**
|
||||
** RESTRICTED RIGHTS LEGEND:
|
||||
** Use, duplication or disclosure by the Government is subject to restrictions
|
||||
** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
||||
** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
||||
** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
||||
** rights reserved under the Copyright Laws of the United States.
|
||||
** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
|
||||
** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
|
||||
** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
|
||||
** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
|
||||
** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
|
||||
** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
|
||||
** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
|
||||
**
|
||||
** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
|
||||
** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
|
||||
** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
|
||||
** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
|
||||
** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
|
||||
** THE UNITED STATES.
|
||||
**
|
||||
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
|
||||
**
|
||||
** $Header$
|
||||
** $Log:
|
||||
@@ -1657,7 +1660,7 @@ hwcMapBoard(hwcBoardInfo *bInfo, FxU32 bAddrMask)
|
||||
for (bAddr = 0; bAddr < 2; bAddr++) {
|
||||
if ((bAddrMask & (0x01UL << bAddr)) != 0x00UL) {
|
||||
bInfo->linearInfo.linearAddress[bAddr] =
|
||||
(FxU32)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
(AnyPtr)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
length, &bInfo->deviceNum, bInfo->boardNum, bAddr);
|
||||
}
|
||||
}
|
||||
@@ -1666,13 +1669,13 @@ hwcMapBoard(hwcBoardInfo *bInfo, FxU32 bAddrMask)
|
||||
* unconditionally
|
||||
*/
|
||||
bInfo->linearInfo.linearAddress[2] =
|
||||
(FxU32)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
(AnyPtr)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
length, &bInfo->deviceNum, bInfo->boardNum, 2);
|
||||
|
||||
/* Does the caller want the rom bios? */
|
||||
if ((bAddrMask & 0x08UL) != 0x00UL) {
|
||||
bInfo->linearInfo.linearAddress[3] =
|
||||
(FxU32)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
(AnyPtr)pciMapCardMulti(bInfo->pciInfo.vendorID, bInfo->pciInfo.deviceID,
|
||||
0x1000000, &bInfo->deviceNum, bInfo->boardNum, 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -315,14 +315,14 @@ typedef struct hwcPCIInfo_s {
|
||||
typedef struct hwcLinearInfo_s {
|
||||
FxBool
|
||||
initialized;
|
||||
FxU32
|
||||
AnyPtr
|
||||
linearAddress[HWC_NUM_BASE_ADDR];
|
||||
} hwcLinearInfo;
|
||||
|
||||
typedef struct hwcRegInfo_s {
|
||||
FxBool
|
||||
initialized;
|
||||
volatile FxU32
|
||||
volatile AnyPtr
|
||||
ioMemBase, /* mem base for I/O aliases */
|
||||
cmdAGPBase, /* CMD/AGP register base */
|
||||
waxBase, /* 2D register base */
|
||||
@@ -346,11 +346,14 @@ typedef struct hwcFifoInfo_s {
|
||||
FxBool
|
||||
agpFifo,
|
||||
initialized;
|
||||
AnyPtr
|
||||
agpVirtAddr;
|
||||
FxU32
|
||||
agpVirtAddr,
|
||||
agpPhysAddr,
|
||||
agpSize,
|
||||
fifoStart, /* Beg of fifo (offset from base) */
|
||||
agpSize;
|
||||
AnyPtr
|
||||
fifoStart; /* Beg of fifo (offset from base) */
|
||||
FxU32
|
||||
fifoLength; /* Fifo size in bytes */
|
||||
} hwcFifoInfo;
|
||||
|
||||
|
||||
@@ -1471,8 +1471,8 @@ FxBool _imgWriteP6Header( FILE *stream, const P6Info *info )
|
||||
imgErrorString = "Image write error.";
|
||||
if ( 0 > fprintf( stream, "P6\n" ) ) return FXFALSE;
|
||||
if ( 0 > fprintf( stream, "# PPM Comment\n" ) ) return FXFALSE;
|
||||
if ( 0 > fprintf( stream, "%ld ", info->width ) ) return FXFALSE;
|
||||
if ( 0 > fprintf( stream, "%ld\n", info->height ) ) return FXFALSE;
|
||||
if ( 0 > fprintf( stream, "%d ", info->width ) ) return FXFALSE;
|
||||
if ( 0 > fprintf( stream, "%d\n", info->height ) ) return FXFALSE;
|
||||
if ( 0 > fprintf( stream, "255\n" ) ) return FXFALSE;
|
||||
imgErrorString = "No error.";
|
||||
return FXTRUE;
|
||||
@@ -1948,7 +1948,7 @@ FxBool imgReadFile(const char *filename, ImgInfo *info)
|
||||
if (prefix) { // if there's a path prefix
|
||||
char buf[1024], *p;
|
||||
strcpy(buf,prefix); // copy and replace semicolon
|
||||
if ((p = strchr(buf,';'))) *p = '\0';
|
||||
if ((p = strchr(buf,';')) != NULL) *p = '\0';
|
||||
fprintf(stderr,buf);
|
||||
fprintf(stderr,"/");
|
||||
}
|
||||
|
||||
@@ -58,6 +58,12 @@ float fxTime(void)
|
||||
once = tb.time; // as float is not big enough
|
||||
return (tb.time - once) + tb.millitm * .001;
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/time.h>
|
||||
struct timeval t;
|
||||
struct timezone tz;
|
||||
gettimeofday(&t, &tz);
|
||||
return ((float)t.tv_sec + ((float)t.tv_usec)/1000000.0);
|
||||
#else
|
||||
#if defined ( WIN32 ) || ( __DOS__ )
|
||||
# include <time.h>
|
||||
@@ -98,7 +104,7 @@ FILE *fxFopenPath(const char *filename, const char *mode, const char *path, cons
|
||||
|
||||
// first try and open up the file in the current directory
|
||||
if (pprefix) *pprefix = NULL;
|
||||
if ((file = fopen(filename,mode)))
|
||||
if ((file = fopen(filename,mode)) != NULL)
|
||||
return file;
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
@@ -115,7 +121,7 @@ FILE *fxFopenPath(const char *filename, const char *mode, const char *path, cons
|
||||
strcat(nameWithPath,"/"); // add directory separator
|
||||
strcat(nameWithPath,filename); // add filename
|
||||
if (pprefix) *pprefix = path; // save the prefix
|
||||
if ((file = fopen(nameWithPath,mode)))
|
||||
if ((file = fopen(nameWithPath,mode)) != NULL)
|
||||
return file;
|
||||
path = psemi; // advance to next path element
|
||||
if (path)
|
||||
|
||||
@@ -92,3 +92,19 @@
|
||||
|
||||
/* Configure in texture display in texus2 */
|
||||
#undef TEXTURE_DISPLAY
|
||||
|
||||
/* Enable various debugging code */
|
||||
#undef GLIDE_DEBUG
|
||||
|
||||
/* Enable Glide for DRI */
|
||||
#undef DRI_BUILD
|
||||
|
||||
/* Voodoo3 Hardware */
|
||||
#undef FX_GLIDE_H3
|
||||
|
||||
/* Voodoo5 Hardware */
|
||||
#undef FX_GLIDE_H5
|
||||
|
||||
/* Banshee Hardware */
|
||||
#undef FX_GLIDE_CVG
|
||||
|
||||
|
||||
@@ -51,10 +51,22 @@ ifeq ("@GLIDE_DEBUG@","true")
|
||||
GLIDE_DEBUG_GCFLAGS = -g -O
|
||||
GLIDE_DEBUG_GDEFS = -DGDBG_INFO_ON -DGLIDE_DEBUG
|
||||
else
|
||||
GLIDE_DEBUG_GCFLAGS = -O6 -m486
|
||||
ifeq ("@FX_GLIDE_BUILD_ARCHITECTURE@","alpha")
|
||||
GLIDE_DEBUG_GCFLAGS = -O2 -mcpu=ev5
|
||||
GLIDE_DEBUG_GDEFS = -fomit-frame-pointer \
|
||||
-fexpensive-optimizations -mieee -DBIG_OPT
|
||||
else
|
||||
ifeq ("@FX_GLIDE_BUILD_ARCHITECTURE@","ia64")
|
||||
GLIDE_DEBUG_GCFLAGS = -O3
|
||||
GLIDE_DEBUG_GDEFS = -fomit-frame-pointer \
|
||||
-fexpensive-optimizations -ffast-math -DBIG_OPT
|
||||
else
|
||||
GLIDE_DEBUG_GCFLAGS = -O2
|
||||
GLIDE_DEBUG_GDEFS = -fomit-frame-pointer -funroll-loops \
|
||||
-fexpensive-optimizations -ffast-math -DBIG_OPT
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
GCFLAGS = $(GLIDE_DEBUG_GCFLAGS)
|
||||
#
|
||||
# Global DEFS
|
||||
@@ -93,7 +105,8 @@ GINCLUDES = $(CVG_VINCLUDES) $(H3_VINCLUDES) $(H5_VINCLUDES) \
|
||||
-I$(top_srcdir)/swlibs/fxmemmap \
|
||||
-I$(top_srcdir)/swlibs/fxmisc \
|
||||
-I$(top_srcdir)/swlibs/newpci/pcilib \
|
||||
-I$(top_srcdir)/swlibs/@TEXTURE_UTILITIES_DIR@/lib
|
||||
-I$(top_srcdir)/swlibs/@TEXTURE_UTILITIES_DIR@/lib \
|
||||
-I$(top_srcdir)/swlibs/include
|
||||
|
||||
########################################################################
|
||||
#
|
||||
|
||||
@@ -26,7 +26,11 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef __linux__
|
||||
#include <sys/io.h>
|
||||
#else
|
||||
#include <machine/cpufunc.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include "fxpci.h"
|
||||
#include "pcilib.h"
|
||||
@@ -35,10 +39,10 @@ static const char* pciIdentifyLinux(void);
|
||||
static FxBool pciOutputStringLinux(const char *msg);
|
||||
static FxBool pciInitializeLinux(void);
|
||||
static FxBool pciShutdownLinux(void);
|
||||
static FxBool pciMapLinearLinux(FxU32, FxU32 physical_addr, FxU32 *linear_addr,
|
||||
static FxBool pciMapLinearLinux(FxU32, FxU32 physical_addr, AnyPtr *linear_addr,
|
||||
FxU32 *length);
|
||||
static FxBool pciUnmapLinearLinux(FxU32 linear_addr, FxU32 length);
|
||||
static FxBool pciSetPermissionLinux(const FxU32, const FxU32, const FxBool);
|
||||
static FxBool pciUnmapLinearLinux(AnyPtr linear_addr, FxU32 length);
|
||||
static FxBool pciSetPermissionLinux(const AnyPtr, const FxU32, const FxBool);
|
||||
static FxU8 pciPortInByteLinux(unsigned short port);
|
||||
static FxU16 pciPortInWordLinux(unsigned short port);
|
||||
static FxU32 pciPortInLongLinux(unsigned short port);
|
||||
@@ -82,6 +86,9 @@ static const FxU32 SST1_PCI_BUS_SNOOP0_LINUX = 0x44;
|
||||
static const FxU32 SST1_PCI_BUS_SNOOP1_LINUX = 0x48;
|
||||
|
||||
static int linuxDevFd=-1;
|
||||
#if defined(__FreeBSD__)
|
||||
static int freebsdIoFd=-1;
|
||||
#endif
|
||||
|
||||
struct pioData {
|
||||
short port;
|
||||
@@ -168,7 +175,11 @@ getNumDevicesLinux(void)
|
||||
static const char*
|
||||
pciIdentifyLinux(void)
|
||||
{
|
||||
#if defined(__FreeBSD__)
|
||||
return "fxPCI for FreeBSD";
|
||||
#else
|
||||
return "fxPCI for Linux";
|
||||
#endif
|
||||
}
|
||||
|
||||
static FxBool
|
||||
@@ -183,7 +194,12 @@ pciInitializeLinux(void)
|
||||
{
|
||||
if (!getenv("SST_NO_DEV3DFX")) linuxDevFd=open("/dev/3dfx", O_RDWR, 0);
|
||||
if (linuxDevFd==-1) {
|
||||
#if defined(__linux__)
|
||||
if (iopl(3)<0) {
|
||||
#else
|
||||
freebsdIoFd=open("/dev/io", O_RDWR, 0);
|
||||
if (freebsdIoFd<0) {
|
||||
#endif
|
||||
pciErrorCode = PCI_ERR_NO_IO_PERM;
|
||||
return FXFALSE;
|
||||
}
|
||||
@@ -194,17 +210,24 @@ pciInitializeLinux(void)
|
||||
static FxBool
|
||||
pciShutdownLinux(void)
|
||||
{
|
||||
#if defined(__linux__)
|
||||
if (linuxDevFd>=0) {
|
||||
close(linuxDevFd);
|
||||
} else {
|
||||
iopl(0);
|
||||
}
|
||||
#else
|
||||
if (linuxDevFd!=-1) close(linuxDevFd);
|
||||
linuxDevFd=-1;
|
||||
if (freebsdIoFd!=-1) close(freebsdIoFd);
|
||||
freebsdIoFd=-1;
|
||||
#endif
|
||||
return FXTRUE;
|
||||
}
|
||||
|
||||
static FxBool
|
||||
pciMapLinearLinux(FxU32 bus, FxU32 physical_addr,
|
||||
FxU32 *linear_addr, FxU32 *length)
|
||||
AnyPtr *linear_addr, FxU32 *length)
|
||||
{
|
||||
int fd;
|
||||
if (linuxDevFd!=-1) {
|
||||
@@ -215,7 +238,7 @@ pciMapLinearLinux(FxU32 bus, FxU32 physical_addr,
|
||||
return FXFALSE;
|
||||
}
|
||||
}
|
||||
if (((*linear_addr)=(FxU32)mmap(0, *length, PROT_READ|PROT_WRITE,
|
||||
if (((*linear_addr)=(AnyPtr)mmap(0, *length, PROT_READ|PROT_WRITE,
|
||||
MAP_SHARED, fd, physical_addr))<0) {
|
||||
if (fd!=linuxDevFd) close(fd);
|
||||
return FXFALSE;
|
||||
@@ -225,14 +248,14 @@ pciMapLinearLinux(FxU32 bus, FxU32 physical_addr,
|
||||
}
|
||||
|
||||
static FxBool
|
||||
pciUnmapLinearLinux(FxU32 linear_addr, FxU32 length)
|
||||
pciUnmapLinearLinux(AnyPtr linear_addr, FxU32 length)
|
||||
{
|
||||
munmap((void*)linear_addr, length);
|
||||
return FXTRUE;
|
||||
}
|
||||
|
||||
static FxBool
|
||||
pciSetPermissionLinux(const FxU32 addrBase, const FxU32 addrLen,
|
||||
pciSetPermissionLinux(const AnyPtr addrBase, const FxU32 addrLen,
|
||||
const FxBool writePermP)
|
||||
{
|
||||
return FXTRUE;
|
||||
@@ -305,7 +328,11 @@ pciPortOutByteLinux(unsigned short port, FxU8 data)
|
||||
/* fprintf(stderr, "write byte=%d desc at %x data at %x\n", data,
|
||||
&desc, &data); */
|
||||
if (linuxDevFd==-1) {
|
||||
#ifdef __linux__
|
||||
outb(data, port);
|
||||
#else
|
||||
outb(port, data);
|
||||
#endif
|
||||
return FXTRUE;
|
||||
}
|
||||
desc.port=port;
|
||||
@@ -321,7 +348,11 @@ pciPortOutWordLinux(unsigned short port, FxU16 data)
|
||||
/* fprintf(stderr, "write word=%x to port=%x desc at %x data at %x\n",
|
||||
data, port, &desc, &data); */
|
||||
if (linuxDevFd==-1) {
|
||||
#ifdef __linux__
|
||||
outw(data, port);
|
||||
#else
|
||||
outw(port, data);
|
||||
#endif
|
||||
return FXTRUE;
|
||||
}
|
||||
desc.port=port;
|
||||
@@ -337,7 +368,11 @@ pciPortOutLongLinux(unsigned short port, FxU32 data)
|
||||
/* fprintf(stderr, "write long=%x to port=%x desc at %x data at %x\n",
|
||||
data, port, &desc, &data); */
|
||||
if (linuxDevFd==-1) {
|
||||
#ifdef __linux__
|
||||
outl(data, port);
|
||||
#else
|
||||
outl(port, data);
|
||||
#endif
|
||||
return FXTRUE;
|
||||
}
|
||||
desc.port=port;
|
||||
@@ -363,3 +398,4 @@ pciSetPassThroughBaseLinux(FxU32 *baseAddr, FxU32 baseAddrLen)
|
||||
{
|
||||
return FXTRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,12 +27,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <3dfx.h>
|
||||
#include <glidesys.h>
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <fxmemmap.h>
|
||||
#include "fxpci.h"
|
||||
#include "pcilib.h"
|
||||
#ifdef __linux__
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
#include "fxlinux.h"
|
||||
#endif
|
||||
|
||||
@@ -55,7 +56,7 @@ static struct {
|
||||
struct {
|
||||
FxBool
|
||||
mapped;
|
||||
FxU32
|
||||
AnyPtr
|
||||
addr;
|
||||
} addrList[MAX_PCI_BASEADDRESSES];
|
||||
} linearAddressMapList[MAX_PCI_DEVICES];
|
||||
@@ -279,11 +280,12 @@ _pciUpdateRegister( FxU32 offset, FxU32 data, FxU32 size_in_bytes,
|
||||
return;
|
||||
} /* _pciUpdateRegister */
|
||||
|
||||
static FxU32
|
||||
static AnyPtr
|
||||
find_mapped_address(FxU32 device_bus_func_number, FxU32 addrNum)
|
||||
{
|
||||
FxU32
|
||||
i,
|
||||
i;
|
||||
AnyPtr
|
||||
retVal = 0x00UL;
|
||||
|
||||
for(i = 0; i < MAX_PCI_DEVICES; i++) {
|
||||
@@ -298,7 +300,7 @@ find_mapped_address(FxU32 device_bus_func_number, FxU32 addrNum)
|
||||
}
|
||||
|
||||
static void
|
||||
set_mapped_address(FxU32 device_bus_func_number, FxU32 addrNum, FxU32 value)
|
||||
set_mapped_address(FxU32 device_bus_func_number, FxU32 addrNum, AnyPtr value)
|
||||
{
|
||||
FxU32 i;
|
||||
|
||||
@@ -421,7 +423,7 @@ sampleVendorID(int deviceNumber, int configMode)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
FxBool
|
||||
pciOpenLinux(void)
|
||||
{
|
||||
@@ -444,7 +446,7 @@ pciOpenLinux(void)
|
||||
}
|
||||
return pciLibraryInitialized;
|
||||
}
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* (GLIDE_PLATFORM & GLIDE_OS_UNIX) */
|
||||
|
||||
FX_EXPORT FxBool FX_CSTYLE
|
||||
pciOpen( void )
|
||||
@@ -468,9 +470,9 @@ pciOpen( void )
|
||||
** Scan All PCI device numbers
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
if (hasDev3DfxLinux) return pciOpenLinux();
|
||||
#endif /* defined(__linux__) */
|
||||
#endif /* (GLIDE_PLATFORM & GLIDE_OS_UNIX) */
|
||||
|
||||
|
||||
for ( deviceNumber = 0; deviceNumber < MAX_PCI_DEVICES; deviceNumber++ ) {
|
||||
@@ -569,7 +571,7 @@ pciGetConfigData( PciRegister reg, FxU32 device_bus_func_number, FxU32 *data )
|
||||
return FXFALSE;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
if (hasDev3DfxLinux()) {
|
||||
*data = pciFetchRegisterLinux(reg.regAddress, reg.sizeInBytes,
|
||||
device_bus_func_number);
|
||||
@@ -608,18 +610,11 @@ pciSetConfigData( PciRegister reg, FxU32 device_bus_func_number, FxU32 *data )
|
||||
return FXFALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: This should really be this way, at least for now.
|
||||
*
|
||||
* Changing this to return the value returned by
|
||||
* pciUpdateRegisterLinux breaks sst1.
|
||||
*/
|
||||
#ifdef __linux__
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_UNIX)
|
||||
if (hasDev3DfxLinux()) {
|
||||
pciUpdateRegisterLinux( reg.regAddress, *data, reg.sizeInBytes,
|
||||
device_bus_func_number);
|
||||
return pciUpdateRegisterLinux(reg.regAddress, *data, reg.sizeInBytes,
|
||||
device_bus_func_number);
|
||||
|
||||
return FXTRUE;
|
||||
}
|
||||
#endif
|
||||
_pciUpdateRegister( reg.regAddress, *data, reg.sizeInBytes,
|
||||
@@ -709,7 +704,8 @@ pciMapCardMulti(FxU32 vendorID, FxU32 deviceID,
|
||||
FxU32 cardNum, FxU32 addressNum)
|
||||
{
|
||||
FxU32
|
||||
physAddress,
|
||||
physAddress;
|
||||
AnyPtr
|
||||
virtAddress;
|
||||
|
||||
/* 1) open the PCI device and scan it for devices
|
||||
@@ -720,7 +716,7 @@ pciMapCardMulti(FxU32 vendorID, FxU32 deviceID,
|
||||
|
||||
/* 3) find the current physcial address of the card */
|
||||
pciGetConfigData( baseAddresses[addressNum], *devNum, &physAddress );
|
||||
if (length <= 0) return (FxU32*)length;
|
||||
if (length <= 0) return (FxU32*)(long)length;
|
||||
|
||||
/* Mask the memory type information bits off.
|
||||
* [0]: Memory type indicator (0 memory/1 i/o)
|
||||
@@ -760,7 +756,6 @@ pciMapCardMulti(FxU32 vendorID, FxU32 deviceID,
|
||||
return (FxU32*)virtAddress;
|
||||
} /* pciMapCardMulti */
|
||||
|
||||
|
||||
FX_EXPORT FxU32 * FX_CSTYLE
|
||||
pciMapCard(FxU32 vendorID, FxU32 deviceID,
|
||||
FxI32 length, FxU32 *devNum, FxU32 addressNum)
|
||||
@@ -769,7 +764,7 @@ pciMapCard(FxU32 vendorID, FxU32 deviceID,
|
||||
} /* pciMapCard */
|
||||
|
||||
FX_EXPORT FxBool FX_CSTYLE
|
||||
pciMapPhysicalToLinear( FxU32 *linear_addr, FxU32 physical_addr,
|
||||
pciMapPhysicalToLinear( AnyPtr *linear_addr, FxU32 physical_addr,
|
||||
FxU32 *length )
|
||||
{
|
||||
return pciMapPhysicalDeviceToLinear(linear_addr,
|
||||
@@ -778,7 +773,7 @@ pciMapPhysicalToLinear( FxU32 *linear_addr, FxU32 physical_addr,
|
||||
} /* pciMapPhysicalToLinear */
|
||||
|
||||
FX_ENTRY FxBool FX_CALL
|
||||
pciMapPhysicalDeviceToLinear(FxU32 *linear_addr,
|
||||
pciMapPhysicalDeviceToLinear(AnyPtr *linear_addr,
|
||||
FxU32 busNumber, FxU32 physical_addr,
|
||||
FxU32 *length)
|
||||
{
|
||||
@@ -788,7 +783,7 @@ pciMapPhysicalDeviceToLinear(FxU32 *linear_addr,
|
||||
|
||||
|
||||
FX_EXPORT void FX_CSTYLE
|
||||
pciUnmapPhysical( FxU32 linear_addr, FxU32 length )
|
||||
pciUnmapPhysical( AnyPtr linear_addr, FxU32 length )
|
||||
{
|
||||
int i,j;
|
||||
|
||||
@@ -828,7 +823,7 @@ pciOutputDebugString(const char* msg)
|
||||
}
|
||||
|
||||
FX_EXPORT FxBool FX_CSTYLE
|
||||
pciLinearRangeSetPermission(const FxU32 addrBase, const FxU32 addrLen, const FxBool writeableP)
|
||||
pciLinearRangeSetPermission(const AnyPtr addrBase, const FxU32 addrLen, const FxBool writeableP)
|
||||
{
|
||||
return pciLinearRangeSetPermissionDD(addrBase, addrLen, writeableP);
|
||||
}
|
||||
|
||||
@@ -180,15 +180,15 @@ pciSetConfigDataRaw( PciRegister reg, FxU32 device_bus_func_number, FxU32 *data
|
||||
* on bus0 which would not work across pci bridges or on agp devices.
|
||||
*/
|
||||
FX_ENTRY FxBool FX_CALL
|
||||
pciMapPhysicalToLinear(FxU32 *linear_addr, FxU32 physical_addr,FxU32 *length);
|
||||
pciMapPhysicalToLinear(AnyPtr *linear_addr, FxU32 physical_addr,FxU32 *length);
|
||||
|
||||
FX_ENTRY FxBool FX_CALL
|
||||
pciMapPhysicalDeviceToLinear(FxU32 *linear_addr,
|
||||
pciMapPhysicalDeviceToLinear(AnyPtr *linear_addr,
|
||||
FxU32 busNumber, FxU32 physical_addr,
|
||||
FxU32 *length);
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
pciUnmapPhysical( FxU32 linear_addr, FxU32 length );
|
||||
pciUnmapPhysical( AnyPtr linear_addr, FxU32 length );
|
||||
|
||||
const char *
|
||||
pciGetVendorName( FxU16 vendor_id );
|
||||
@@ -235,7 +235,7 @@ FX_ENTRY FxBool FX_CALL
|
||||
pciOutputDebugString(const char* debugMsg);
|
||||
|
||||
FX_ENTRY FxBool FX_CALL
|
||||
pciLinearRangeSetPermission(const FxU32 addrBase, const FxU32 addrLen, const FxBool writeableP);
|
||||
pciLinearRangeSetPermission(const AnyPtr addrBase, const FxU32 addrLen, const FxBool writeableP);
|
||||
|
||||
#define PCI_ERR_NOERR 0
|
||||
#define PCI_ERR_WINRTINIT 1
|
||||
|
||||
@@ -74,13 +74,13 @@ typedef struct {
|
||||
|
||||
/* Platform device address management */
|
||||
FxBool (*addrMap)(FxU32 busNumber, FxU32 physAddr,
|
||||
FxU32* linearAddr, FxU32* length);
|
||||
FxBool (*addrUnmap)(FxU32 linearAddr, FxU32 length);
|
||||
AnyPtr* linearAddr, FxU32* length);
|
||||
FxBool (*addrUnmap)(AnyPtr linearAddr, FxU32 length);
|
||||
|
||||
/* Optional things that a platform may or maynot support and clients
|
||||
* should not rely on the call to suceed.
|
||||
*/
|
||||
FxBool (*addrSetPermission)(const FxU32 addrBase, const FxU32 addrLen,
|
||||
FxBool (*addrSetPermission)(const AnyPtr addrBase, const FxU32 addrLen,
|
||||
const FxBool writePermP);
|
||||
|
||||
FxBool (*msrGet)(MSRInfo* in, MSRInfo* out);
|
||||
|
||||
@@ -160,12 +160,12 @@ _txImgDequantizeRGB332(FxU32 *out, FxU8 *in, int w, int h)
|
||||
}
|
||||
|
||||
static void
|
||||
_txImgDequantizeYIQ422(FxU32 *out, FxU8 *in, int w, int h, const long *yabTable)
|
||||
_txImgDequantizeYIQ422(FxU32 *out, FxU8 *in, int w, int h, const FxU32 *yabTable)
|
||||
{
|
||||
int n = w * h;
|
||||
FxU32 pal[256];
|
||||
|
||||
txYABtoPal256((long *)pal, (long *)yabTable);
|
||||
txYABtoPal256(pal, yabTable);
|
||||
out += n;
|
||||
in += n;
|
||||
while (n--) *--out = pal[*--in] | 0xff000000;
|
||||
@@ -223,10 +223,10 @@ _txImgDequantizeARGB8332(FxU32 *out, FxU16 *in, int w, int h)
|
||||
}
|
||||
|
||||
static void
|
||||
_txImgDequantizeAYIQ8422(FxU32 *out, FxU16 *in, int w, int h, const long *yab)
|
||||
_txImgDequantizeAYIQ8422(FxU32 *out, FxU16 *in, int w, int h, const FxU32 *yab)
|
||||
{
|
||||
int n = w * h;
|
||||
long pal[256];
|
||||
FxU32 pal[256];
|
||||
|
||||
txYABtoPal256(pal, yab);
|
||||
out += n;
|
||||
@@ -348,7 +348,7 @@ txMipDequantize(TxMip *txMip, TxMip *pxMip)
|
||||
case GR_TEXFMT_RGB_332: _txImgDequantizeRGB332(dst, src, w, h);
|
||||
break;
|
||||
case GR_TEXFMT_YIQ_422: _txImgDequantizeYIQ422(dst, src, w, h,
|
||||
(long *)pxMip->pal); break;
|
||||
pxMip->pal); break;
|
||||
case GR_TEXFMT_A_8: _txImgDequantizeA8(dst, src, w, h);
|
||||
break;
|
||||
case GR_TEXFMT_I_8: _txImgDequantizeI8(dst, src, w, h);
|
||||
@@ -361,7 +361,7 @@ txMipDequantize(TxMip *txMip, TxMip *pxMip)
|
||||
case GR_TEXFMT_ARGB_8332: _txImgDequantizeARGB8332(dst, src, w, h);
|
||||
break;
|
||||
case GR_TEXFMT_AYIQ_8422: _txImgDequantizeAYIQ8422(dst, src, w, h,
|
||||
(long *)pxMip->pal); break;
|
||||
pxMip->pal); break;
|
||||
case GR_TEXFMT_RGB_565: _txImgDequantizeRGB565(dst, src, w, h);
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_1555: _txImgDequantizeARGB1555(dst, src, w, h);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define B3(x) ((x>>0)&0xFF)
|
||||
|
||||
static void
|
||||
_txImgHalve(long *outdata, int width, int height, long *indata)
|
||||
_txImgHalve(int *outdata, int width, int height, int *indata)
|
||||
{
|
||||
unsigned int i,j,k;
|
||||
unsigned int w,h, *p,sum,*q;
|
||||
|
||||
@@ -124,7 +124,7 @@ _txPixQuantize_YIQ422_D4x4 (unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static void
|
||||
_txImgNcc(char *odata, unsigned long *idata, int w, int h, int format,
|
||||
_txImgNcc(char *odata, unsigned int *idata, int w, int h, int format,
|
||||
int dither)
|
||||
{
|
||||
int (*quantizer)(unsigned long argb, int x, int y, int w);
|
||||
@@ -308,7 +308,7 @@ txMipNcc(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression
|
||||
|
||||
|
||||
if ((dither & TX_DITHER_MASK) == TX_DITHER_ERR) {
|
||||
txYABtoPal256((long *)pxMip->pal, (long *) &ncc.y[0]);
|
||||
txYABtoPal256(pxMip->pal, &ncc.y[0]);
|
||||
txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -88,19 +88,19 @@
|
||||
#define MAX_NEURONS 256
|
||||
|
||||
typedef struct _weight {
|
||||
long r, g, b; // fixed point, SUBPIXEL precision bits
|
||||
int r, g, b; // fixed point, SUBPIXEL precision bits
|
||||
int ir, ig, ib; // pure integers, maybe -256 to 255.
|
||||
} Weight;
|
||||
|
||||
typedef struct _vector {
|
||||
Weight *py, *pa, *pb;
|
||||
long r, g, b; // pure integers, 0 to 255.
|
||||
int r, g, b; // pure integers, 0 to 255.
|
||||
} Neuron;
|
||||
|
||||
static Weight Y[16], A[4], B[4];
|
||||
static Neuron N[MAX_NEURONS];
|
||||
static long errR, errG, errB, errMax;
|
||||
static long totR, totG, totB;
|
||||
static int errR, errG, errB, errMax;
|
||||
static int totR, totG, totB;
|
||||
|
||||
|
||||
#define SUBPIXEL 22
|
||||
@@ -114,12 +114,12 @@ static long totR, totG, totB;
|
||||
x = ((256 << SUBPIXEL) -1)
|
||||
|
||||
static int
|
||||
_nn_modifyNeurons(long ir, long ig, long ib)
|
||||
_nn_modifyNeurons(int ir, int ig, int ib)
|
||||
{
|
||||
int i;
|
||||
int d0, d1; // closest & next closest distance to input
|
||||
int p0, p1; // index into the 256 color table.
|
||||
long d, dr, dg, db;
|
||||
int d, dr, dg, db;
|
||||
Weight *py, *pa, *pb;
|
||||
Neuron *n;
|
||||
|
||||
@@ -268,10 +268,10 @@ static void
|
||||
txMapPal256toYAB(FxU32 *YAB, FxU8 *map, int nsamples, FxU32 *samples)
|
||||
{
|
||||
int i;
|
||||
long bstR, bstG, bstB, bstMax;
|
||||
int bstR, bstG, bstB, bstMax;
|
||||
int iterations; // track how many inputs have been fed to NN
|
||||
int drySpells; // how many inputs since last best case.
|
||||
long yab2pal[256];
|
||||
int yab2pal[256];
|
||||
|
||||
_nn_initTables();
|
||||
/*
|
||||
@@ -367,7 +367,7 @@ txMapPal256toYAB(FxU32 *YAB, FxU8 *map, int nsamples, FxU32 *samples)
|
||||
* Replace MSB of samples with index to be used with YAB table.
|
||||
*/
|
||||
|
||||
txYABtoPal256((long*)yab2pal, (long*)YAB);
|
||||
txYABtoPal256(yab2pal, YAB);
|
||||
|
||||
for (i=0; i<nsamples; i++) {
|
||||
int ir, ig, ib;
|
||||
@@ -388,7 +388,7 @@ txMipNccNNet(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 comp)
|
||||
int i, w, h;
|
||||
int ncolors;
|
||||
int pixsize = (pxMip->format == GR_TEXFMT_YIQ_422) ? 1 : 2;
|
||||
long yabTable[16+12+12];
|
||||
int yabTable[16+12+12];
|
||||
FxU8 map[256];
|
||||
|
||||
|
||||
@@ -425,7 +425,7 @@ txMipNccNNet(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 comp)
|
||||
* the 256 color palette generated from the YAB table. This will be
|
||||
* useful for error diffusion dithering.
|
||||
*/
|
||||
txYABtoPal256((long *)pxMip->pal, (long *)yabTable);
|
||||
txYABtoPal256(pxMip->pal, yabTable);
|
||||
txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -83,20 +83,20 @@ typedef unsigned char uchar;
|
||||
|
||||
typedef struct {
|
||||
float weightedvar; /* weighted variance */
|
||||
ulong mean[3]; /* centroid */
|
||||
ulong weight; /* # of pixels in box */
|
||||
ulong freq[3][MAXCOLORS]; /* Projected frequencies */
|
||||
uint mean[3]; /* centroid */
|
||||
uint weight; /* # of pixels in box */
|
||||
uint freq[3][MAXCOLORS]; /* Projected frequencies */
|
||||
int low[3], high[3]; /* Box extent */
|
||||
} Box;
|
||||
|
||||
#define COLORMAXI ( 1 << NBITS )
|
||||
#if 0
|
||||
static ulong *Histogram; /* image histogram */
|
||||
static uint *Histogram; /* image histogram */
|
||||
#else
|
||||
static ulong Histogram[COLORMAXI*COLORMAXI*COLORMAXI * sizeof(long)];
|
||||
static uint Histogram[COLORMAXI*COLORMAXI*COLORMAXI * sizeof(long)];
|
||||
#endif
|
||||
static ulong SumPixels; /* total # of pixels */
|
||||
static ulong ColormaxI; /* # of colors, 2^Bits */
|
||||
static uint SumPixels; /* total # of pixels */
|
||||
static uint ColormaxI; /* # of colors, 2^Bits */
|
||||
static Box _Boxes[MAXCOLORS];
|
||||
static Box *Boxes; /* Array of color boxes. */
|
||||
|
||||
@@ -108,7 +108,7 @@ static int CutBox(Box *box, Box *newbox);
|
||||
static void BoxStats(Box *box);
|
||||
static int GreatestVariance(Box *boxes, int n);
|
||||
static int CutBoxes(Box *boxes, int colors);
|
||||
static void QuantHistogram(ulong *pixels, int npixels, Box *box);
|
||||
static void QuantHistogram(uint *pixels, int npixels, Box *box);
|
||||
|
||||
/*
|
||||
* Perform variance-based color quantization on a 24-bit image.
|
||||
@@ -135,16 +135,16 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
|
||||
|
||||
Boxes = _Boxes;
|
||||
#if 0
|
||||
Histogram = (ulong *) txMalloc(ColormaxI*ColormaxI*ColormaxI * sizeof(long));
|
||||
Histogram = (uint *) txMalloc(ColormaxI*ColormaxI*ColormaxI * sizeof(long));
|
||||
rgbmap = txMalloc((1<<NBITS)*(1<<NBITS)*(1<<NBITS));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Zero-out the projected frequency arrays of the largest box.
|
||||
*/
|
||||
bzero(Boxes->freq[0], ColormaxI * sizeof(ulong));
|
||||
bzero(Boxes->freq[1], ColormaxI * sizeof(ulong));
|
||||
bzero(Boxes->freq[2], ColormaxI * sizeof(ulong));
|
||||
bzero(Boxes->freq[0], ColormaxI * sizeof(uint));
|
||||
bzero(Boxes->freq[1], ColormaxI * sizeof(uint));
|
||||
bzero(Boxes->freq[2], ColormaxI * sizeof(uint));
|
||||
bzero(Histogram, ColormaxI * ColormaxI * ColormaxI * sizeof(long));
|
||||
|
||||
/* Feed all bitmaps & generate histogram */
|
||||
@@ -153,7 +153,7 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
|
||||
h = txMip->height;
|
||||
for (i=0; i< txMip->depth; i++) {
|
||||
SumPixels += w * h;
|
||||
QuantHistogram((ulong *)txMip->data[i], w * h, &Boxes[0]);
|
||||
QuantHistogram((uint *)txMip->data[i], w * h, &Boxes[0]);
|
||||
if (w > 1) w >>= 1;
|
||||
if (h > 1) h >>= 1;
|
||||
}
|
||||
@@ -166,10 +166,10 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
|
||||
* from their 'prequantized' range to 0-FULLINTENSITY.
|
||||
*/
|
||||
for (i = 0; i < OutColors; i++) {
|
||||
ulong r, g, b;
|
||||
r = (ulong)(Boxes[i].mean[REDI] * Cfactor + 0.5);
|
||||
g = (ulong)(Boxes[i].mean[GREENI] * Cfactor + 0.5);
|
||||
b = (ulong)(Boxes[i].mean[BLUEI] * Cfactor + 0.5);
|
||||
uint r, g, b;
|
||||
r = (uint)(Boxes[i].mean[REDI] * Cfactor + 0.5);
|
||||
g = (uint)(Boxes[i].mean[GREENI] * Cfactor + 0.5);
|
||||
b = (uint)(Boxes[i].mean[BLUEI] * Cfactor + 0.5);
|
||||
|
||||
/*
|
||||
r &= 0xff;
|
||||
@@ -198,11 +198,11 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
|
||||
h = txMip->height;
|
||||
|
||||
for (i=0; i< txMip->depth; i++) {
|
||||
ulong *src;
|
||||
uint *src;
|
||||
uchar *dst;
|
||||
int n;
|
||||
|
||||
src = (ulong *) txMip->data[i];
|
||||
src = (uint *) txMip->data[i];
|
||||
dst = (uchar *) pxMip->data[i];
|
||||
n = w * h;
|
||||
while (n--) {
|
||||
@@ -242,9 +242,9 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
|
||||
* arrays for the first world-encompassing box.
|
||||
*/
|
||||
static void
|
||||
QuantHistogram(ulong *pixels, int npixels, Box *box)
|
||||
QuantHistogram(uint *pixels, int npixels, Box *box)
|
||||
{
|
||||
ulong *rf, *gf, *bf;
|
||||
uint *rf, *gf, *bf;
|
||||
uchar rr, gg, bb;
|
||||
int i;
|
||||
|
||||
@@ -322,7 +322,7 @@ static void
|
||||
BoxStats(Box *box)
|
||||
{
|
||||
int i, color;
|
||||
ulong *freq;
|
||||
uint *freq;
|
||||
float mean, var;
|
||||
|
||||
if(box->weight == 0) {
|
||||
@@ -407,7 +407,7 @@ FindCutpoint(Box *box, int color, Box *newbox1, Box *newbox2)
|
||||
{
|
||||
float u, v, max;
|
||||
int i, maxindex, minindex, cutpoint;
|
||||
ulong optweight, curweight;
|
||||
uint optweight, curweight;
|
||||
|
||||
if (box->low[color] + 1 == box->high[color])
|
||||
return FALSE; /* Cannot be cut. */
|
||||
@@ -457,13 +457,13 @@ FindCutpoint(Box *box, int color, Box *newbox1, Box *newbox2)
|
||||
static void
|
||||
UpdateFrequencies(Box *box1, Box *box2)
|
||||
{
|
||||
ulong myfreq, *h;
|
||||
uint myfreq, *h;
|
||||
int b, g, r;
|
||||
int roff;
|
||||
|
||||
bzero(box1->freq[0], ColormaxI * sizeof(ulong));
|
||||
bzero(box1->freq[1], ColormaxI * sizeof(ulong));
|
||||
bzero(box1->freq[2], ColormaxI * sizeof(ulong));
|
||||
bzero(box1->freq[0], ColormaxI * sizeof(uint));
|
||||
bzero(box1->freq[1], ColormaxI * sizeof(uint));
|
||||
bzero(box1->freq[2], ColormaxI * sizeof(uint));
|
||||
|
||||
for (r = box1->low[0]; r < box1->high[0]; r++) {
|
||||
roff = r << NBITS;
|
||||
|
||||
@@ -31,15 +31,15 @@
|
||||
|
||||
static int
|
||||
dithmat[4][4] = { { 0, 8, 2, 10 },
|
||||
{ 12, 4, 14, 6 },
|
||||
{ 3, 11, 1, 9 },
|
||||
{ 15, 7, 13, 5 }};
|
||||
{ 12, 4, 14, 6 },
|
||||
{ 3, 11, 1, 9 },
|
||||
{ 15, 7, 13, 5 }};
|
||||
|
||||
// for error diffusion.
|
||||
static int errR[MAX_TEXWIDTH], errG[MAX_TEXWIDTH], errB[MAX_TEXWIDTH];
|
||||
|
||||
static int
|
||||
_txPixQuantize_RGB332( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_RGB332( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
return (
|
||||
(((argb>>16) & 0xE0) |
|
||||
@@ -48,7 +48,7 @@ _txPixQuantize_RGB332( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_RGB332_D4x4( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_RGB332_D4x4( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
int d = dithmat[y&3][x&3];
|
||||
int n, t;
|
||||
@@ -63,7 +63,7 @@ _txPixQuantize_RGB332_D4x4( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_RGB332_DErr( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_RGB332_DErr( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
static unsigned char a3[] = {0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff};
|
||||
static unsigned char a2[] = {0x00,0x55,0xaa,0xff};
|
||||
@@ -120,13 +120,13 @@ _txPixQuantize_RGB332_DErr( unsigned long argb, int x, int y, int w)
|
||||
/* YIQ422 done elsewhere */
|
||||
|
||||
static int
|
||||
_txPixQuantize_A8( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_A8( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
return (argb >> 24);
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_I8( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_I8( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
return (
|
||||
((int) (((argb >>16) & 0xFF) * .30F +
|
||||
@@ -135,7 +135,7 @@ _txPixQuantize_I8( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_AI44( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_AI44( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
return(
|
||||
(int) (( ((argb>>16) & 0xFF) * .30F +
|
||||
@@ -145,7 +145,7 @@ _txPixQuantize_AI44( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_AI44_D4x4( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_AI44_D4x4( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
int d = dithmat[y&3][x&3];
|
||||
int n, t;
|
||||
@@ -163,7 +163,7 @@ _txPixQuantize_AI44_D4x4( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_AI44_DErr( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_AI44_DErr( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
int ii, t;
|
||||
static int qi;
|
||||
@@ -198,7 +198,7 @@ _txPixQuantize_AI44_DErr( unsigned long argb, int x, int y, int w)
|
||||
|
||||
|
||||
static int
|
||||
_txPixQuantize_ARGB8332 ( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_ARGB8332 ( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
return (
|
||||
((argb>>16) & 0xE0) |
|
||||
@@ -209,7 +209,7 @@ _txPixQuantize_ARGB8332 ( unsigned long argb, int x, int y, int w)
|
||||
|
||||
|
||||
static int
|
||||
_txPixQuantize_ARGB8332_D4x4( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_ARGB8332_D4x4( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
int d = dithmat[y&3][x&3];
|
||||
int n, t;
|
||||
@@ -225,7 +225,7 @@ _txPixQuantize_ARGB8332_D4x4( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_ARGB8332_DErr( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_ARGB8332_DErr( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
int t;
|
||||
|
||||
@@ -237,7 +237,7 @@ _txPixQuantize_ARGB8332_DErr( unsigned long argb, int x, int y, int w)
|
||||
/* AYIQ8422 done elsewhere */
|
||||
|
||||
static int
|
||||
_txPixQuantize_RGB565( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_RGB565( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
return (
|
||||
((argb >> 8) & 0xF800) |
|
||||
@@ -246,7 +246,7 @@ _txPixQuantize_RGB565( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_RGB565_D4x4 ( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_RGB565_D4x4 ( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
int d = dithmat[y&3][x&3];
|
||||
int n, t;
|
||||
@@ -262,7 +262,7 @@ _txPixQuantize_RGB565_D4x4 ( unsigned long argb, int x, int y, int w)
|
||||
|
||||
|
||||
static int
|
||||
_txPixQuantize_RGB565_DErr ( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_RGB565_DErr ( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
static int qr, qg, qb; // quantized incoming values.
|
||||
int ir, ig, ib; // incoming values.
|
||||
@@ -318,7 +318,7 @@ _txPixQuantize_RGB565_DErr ( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_ARGB1555( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_ARGB1555( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
return (
|
||||
((argb >> 9) & 0x7C00) |
|
||||
@@ -328,7 +328,7 @@ _txPixQuantize_ARGB1555( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_ARGB1555_D4x4 ( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_ARGB1555_D4x4 ( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
int d = dithmat[y&3][x&3];
|
||||
int n, t;
|
||||
@@ -344,7 +344,7 @@ _txPixQuantize_ARGB1555_D4x4 ( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_ARGB1555_DErr ( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_ARGB1555_DErr ( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
static int qr, qg, qb; // quantized incoming values.
|
||||
int ir, ig, ib; // incoming values.
|
||||
@@ -401,7 +401,7 @@ _txPixQuantize_ARGB1555_DErr ( unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_ARGB4444 (unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_ARGB4444 (unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
return (
|
||||
((argb >> 12) & 0x0F00) |
|
||||
@@ -411,7 +411,7 @@ _txPixQuantize_ARGB4444 (unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_ARGB4444_D4x4 (unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_ARGB4444_D4x4 (unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
int d = dithmat[y&3][x&3];
|
||||
int n, t;
|
||||
@@ -427,7 +427,7 @@ _txPixQuantize_ARGB4444_D4x4 (unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_ARGB4444_DErr (unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_ARGB4444_DErr (unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
static int qr, qg, qb; // quantized incoming values.
|
||||
int ir, ig, ib; // incoming values.
|
||||
@@ -484,7 +484,7 @@ _txPixQuantize_ARGB4444_DErr (unsigned long argb, int x, int y, int w)
|
||||
}
|
||||
|
||||
static int
|
||||
_txPixQuantize_AI88( unsigned long argb, int x, int y, int w)
|
||||
_txPixQuantize_AI88( unsigned int argb, int x, int y, int w)
|
||||
{
|
||||
return (
|
||||
(((int) (((argb >>16) & 0xFF) * .30F +
|
||||
@@ -498,7 +498,7 @@ _txPixQuantize_AI88( unsigned long argb, int x, int y, int w)
|
||||
static void
|
||||
_txImgQuantize(char *dst, char *src, int w, int h, FxU32 format, FxU32 dither)
|
||||
{
|
||||
int (*quantizer)(unsigned long argb, int x, int y, int w) = NULL;
|
||||
int (*quantizer)(unsigned int argb, int x, int y, int w) = NULL;
|
||||
int x, y;
|
||||
|
||||
dither &= TX_DITHER_MASK;
|
||||
@@ -589,7 +589,7 @@ _txImgQuantize(char *dst, char *src, int w, int h, FxU32 format, FxU32 dither)
|
||||
// 8 bit dst
|
||||
for (y=0; y<h; y++) {
|
||||
for (x=0; x<w; x++) {
|
||||
*dst++ = (*quantizer)(*(unsigned long *)src, x, y, w);
|
||||
*dst++ = (*quantizer)(*(unsigned int *)src, x, y, w);
|
||||
src += 4;
|
||||
}
|
||||
}
|
||||
@@ -599,7 +599,7 @@ _txImgQuantize(char *dst, char *src, int w, int h, FxU32 format, FxU32 dither)
|
||||
|
||||
for (y=0; y<h; y++) {
|
||||
for (x=0; x<w; x++) {
|
||||
*dst16++ = (*quantizer)(*(unsigned long *)src, x, y, w);
|
||||
*dst16++ = (*quantizer)(*(unsigned int *)src, x, y, w);
|
||||
src += 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ typedef struct _rgtHeader{
|
||||
|
||||
|
||||
|
||||
static void swapShorts(unsigned short *array, long length)
|
||||
static void swapShorts(unsigned short *array, int length)
|
||||
{
|
||||
unsigned short s;
|
||||
while (length--) {
|
||||
@@ -61,7 +61,7 @@ static void swapShorts(unsigned short *array, long length)
|
||||
}
|
||||
}
|
||||
|
||||
static void swapLongs(unsigned int *array, long length)
|
||||
static void swapLongs(unsigned int *array, int length)
|
||||
{
|
||||
unsigned int s;
|
||||
while (length--) {
|
||||
@@ -72,7 +72,7 @@ static void swapLongs(unsigned int *array, long length)
|
||||
}
|
||||
|
||||
// just swap RGB into BGR (leave MSB undefined)
|
||||
static void swapRGB(unsigned int *array, long length)
|
||||
static void swapRGB(unsigned int *array, int length)
|
||||
{
|
||||
unsigned int s;
|
||||
while (length--) {
|
||||
@@ -164,7 +164,7 @@ _txReadRGTData( FILE *stream, TxMip *info)
|
||||
|
||||
#if 1
|
||||
if (swap) {
|
||||
swapRGB((unsigned int *)data32, (long)info->width);
|
||||
swapRGB((unsigned int *)data32, (int)info->width);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user