00001 /****************************************************************************************/ 00002 /* span.c */ 00003 /* */ 00004 /* Author: John Pollard, Ken Baird */ 00005 /* Description: Span reject list type stuff */ 00006 /* */ 00007 /* The contents of this file are subject to the Genesis3D Public License */ 00008 /* Version 1.01 (the "License"); you may not use this file except in */ 00009 /* compliance with the License. You may obtain a copy of the License at */ 00010 /* http://www.genesis3d.com */ 00011 /* */ 00012 /* Software distributed under the License is distributed on an "AS IS" */ 00013 /* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ 00014 /* the License for the specific language governing rights and limitations */ 00015 /* under the License. */ 00016 /* */ 00017 /* The Original Code is Genesis3D, released March 25, 1999. */ 00018 /*Genesis3D Version 1.1 released November 15, 1999 */ 00019 /* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ 00020 /* */ 00021 /****************************************************************************************/ 00022 #include <Windows.h> 00023 #include <Assert.h> 00024 #include <Stdio.h> 00025 #include <Dos.h> 00026 00027 #include "System.h" 00028 #include "Span.h" 00029 #include "Render.h" 00030 #include "SoftDrv.h" 00031 #include "Scene.h" 00032 #include "3dnowspan.h" 00033 #include "x86span565.h" 00034 #include "x86span555.h" 00035 00036 00037 SpanMinMax SMinMax[MAXSCANLINES]; // Linked list of spans for each scanline... 00038 SList ScanHash[MAXSPANS]; // hash table for SList 00039 int32 CurrentSList; // Current SUB in SList we are at... 00040 int32 NumSpanPixels[MAXSCANLINES]; 00041 extern CPUInfo ProcessorInfo; 00042 extern BOOL bBackLocked; 00043 00044 extern __int64 WrapMask, QFixedScale16; 00045 extern __int64 GLMapMulUV, UVL16; 00046 extern __int64 UVAdjust, UVAdjust2; 00047 extern __int64 UVDivZ16StepX, ARL, GBL; 00048 extern __int64 UVDivZOrigin, UVR; 00049 extern __int64 QFixedScale, ZIR; 00050 extern __int64 UVDivZStepX, UVDivZStepY; 00051 extern uint8 *TexPal; 00052 00053 extern BOOL LockDDrawBackBuffer(DRV_Window *cwnd, RECT *wrect); 00054 00055 //*************************************************************************** 00056 // Clears the index into the ScanHash array. This array is where I do all 00057 // my SList allocating... 00058 //*************************************************************************** 00059 void ResetSList(void) 00060 { 00061 CurrentSList = 0; 00062 } 00063 00064 //*************************************************************************** 00065 // Makes a new valid SList in ScanHash, then updates the CurrentSList indexer. 00066 //*************************************************************************** 00067 SList *NewSList(void) 00068 { 00069 00070 CurrentSList++; 00071 00072 assert(CurrentSList < MAXSPANS); 00073 00074 return &ScanHash[CurrentSList-1]; 00075 00076 return NULL; 00077 } 00078 00079 // *************************************************************************** 00080 // Just clears some variables so we know this SList is no longer used... 00081 // *************************************************************************** 00082 void FreeSList(SList *s) 00083 { 00084 assert(s != NULL); 00085 s->Used = 0; 00086 } 00087 00088 //================================================================================ 00089 // Just clears the global span buckets... 00090 //================================================================================ 00091 void ResetSpans(uint32 Rows) 00092 { 00093 uint32 i; 00094 00095 for (i=0; i<Rows; i++) 00096 { 00097 SMinMax[i].First = NULL; 00098 NumSpanPixels[i] = 0; 00099 } 00100 00101 ResetSList(); 00102 } 00103
1.3.2