fixed testsuite for all libs
This commit is contained in:
@@ -1,21 +1,34 @@
|
||||
sst1: HW: Voodoo Graphics, Voodoo Rush
|
||||
OS: DOS(DJGPP), Linux
|
||||
Glide3x (01-oct-2004):
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
sst1: HW: Voodoo Graphics XOR Voodoo Rush
|
||||
Status: DOS - working (compiled with DJGPP)
|
||||
Linux - V1 working, VR needs testing
|
||||
Win32 - N/A
|
||||
Notes: grDrawPoint has type-punning problems (gcc -O2)
|
||||
V1 library cannot be used with VR (and vice-versa)
|
||||
Maintainers: Daniel Borca
|
||||
|
||||
cvg: HW: Voodoo^2
|
||||
OS: DOS(DJGPP), Linux
|
||||
Status: DOS - working (compiled with DJGPP)
|
||||
Linux - working
|
||||
Win32 - N/A
|
||||
Notes: grDrawPoint has type-punning problems (gcc -O2)
|
||||
Maintainers: Daniel Borca
|
||||
|
||||
h3: HW: Voodoo Banshee, Voodoo3
|
||||
OS: DOS(DJGPP), Linux(DRI)
|
||||
Status: DOS - working (compiled with DJGPP)
|
||||
Linux - DRI working, DGA needs testing, CINIT broken
|
||||
Win32 - N/A
|
||||
Notes: grDrawPoint has type-punning problems (gcc -O2)
|
||||
Maintainers: Daniel Borca, Guillem Jover
|
||||
|
||||
h5: HW: Voodoo Banshee, Velocity 100/200, Voodoo3/4/5
|
||||
OS: DOS(DJGPP), Linux(DRI), Win32
|
||||
Status: DOS - working (compiled with DJGPP)
|
||||
Linux - DRI working, DGA needs testing, CINIT broken
|
||||
Win32 - working (compiled with MSVC)
|
||||
Maintainers: Hiroshi Morii, Daniel Borca, Guillem Jover
|
||||
|
||||
Notes:
|
||||
1) sst1 branch must be compiled separately for V1 and VR.
|
||||
2) h3 & h5 have experimental non-DRI versions; they don't work yet!
|
||||
|
||||
---------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Look at the INSTALL file for more information on installing Glide3.
|
||||
|
||||
|
||||
@@ -411,11 +411,11 @@ void main( int argc, char **argv) {
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
triDecal.smallLodLog2 = bgInfo.header.small_lod;
|
||||
triDecal.largeLodLog2 = bgInfo.header.large_lod;
|
||||
triDecal.aspectRatioLog2 = bgInfo.header.aspect_ratio;
|
||||
triDecal.data = bgInfo.data;
|
||||
triDecal.format = bgInfo.header.format;
|
||||
triDecal.smallLodLog2 = triInfo.header.small_lod;
|
||||
triDecal.largeLodLog2 = triInfo.header.large_lod;
|
||||
triDecal.aspectRatioLog2 = triInfo.header.aspect_ratio;
|
||||
triDecal.data = triInfo.data;
|
||||
triDecal.format = triInfo.header.format;
|
||||
grTexDownloadMipMap( GR_TMU0, startAddress, GR_MIPMAPLEVELMASK_BOTH, &triDecal);
|
||||
grTexMipMapMode(GR_TMU0, GR_MIPMAP_NEAREST, FXTRUE);
|
||||
grTexClampMode( GR_TMU0, GR_TEXTURECLAMP_WRAP, GR_TEXTURECLAMP_WRAP);
|
||||
|
||||
@@ -238,7 +238,8 @@ void main(int argc, char **argv) {
|
||||
/* Download this in a sequential way to test the palette download */
|
||||
i = 0;
|
||||
while(i < 256) {
|
||||
const int end = MIN((i + (rand() % 10)), 255);
|
||||
const int max = i + (rand() % 10);
|
||||
const int end = MIN(max, 255);
|
||||
|
||||
grTexDownloadTablePartial(curPalType, &texPal, i, end);
|
||||
i = end + 1;
|
||||
|
||||
@@ -449,10 +449,10 @@ main( int argc, char **argv)
|
||||
packedrgb = !packedrgb;
|
||||
if (packedrgb) {
|
||||
grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
(FxU32)srcVerts[0].r = 0xff0000ff;
|
||||
(FxU32)srcVerts[1].r = 0xff00ff00;
|
||||
(FxU32)srcVerts[2].r = 0xffff0000;
|
||||
(FxU32)srcVerts[3].r = 0xffff0000;
|
||||
*(FxU32 *)&srcVerts[0].r = 0xff0000ff;
|
||||
*(FxU32 *)&srcVerts[1].r = 0xff00ff00;
|
||||
*(FxU32 *)&srcVerts[2].r = 0xffff0000;
|
||||
*(FxU32 *)&srcVerts[3].r = 0xffff0000;
|
||||
}
|
||||
else {
|
||||
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
|
||||
@@ -411,11 +411,11 @@ void main( int argc, char **argv) {
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
triDecal.smallLodLog2 = bgInfo.header.small_lod;
|
||||
triDecal.largeLodLog2 = bgInfo.header.large_lod;
|
||||
triDecal.aspectRatioLog2 = bgInfo.header.aspect_ratio;
|
||||
triDecal.data = bgInfo.data;
|
||||
triDecal.format = bgInfo.header.format;
|
||||
triDecal.smallLodLog2 = triInfo.header.small_lod;
|
||||
triDecal.largeLodLog2 = triInfo.header.large_lod;
|
||||
triDecal.aspectRatioLog2 = triInfo.header.aspect_ratio;
|
||||
triDecal.data = triInfo.data;
|
||||
triDecal.format = triInfo.header.format;
|
||||
grTexDownloadMipMap( GR_TMU0, startAddress, GR_MIPMAPLEVELMASK_BOTH, &triDecal);
|
||||
grTexMipMapMode(GR_TMU0, GR_MIPMAP_NEAREST, FXTRUE);
|
||||
grTexClampMode( GR_TMU0, GR_TEXTURECLAMP_WRAP, GR_TEXTURECLAMP_WRAP);
|
||||
|
||||
@@ -238,7 +238,8 @@ void main(int argc, char **argv) {
|
||||
/* Download this in a sequential way to test the palette download */
|
||||
i = 0;
|
||||
while(i < 256) {
|
||||
const int end = MIN((i + (rand() % 10)), 255);
|
||||
const int max = i + (rand() % 10);
|
||||
const int end = MIN(max, 255);
|
||||
|
||||
grTexDownloadTablePartial(curPalType, &texPal, i, end);
|
||||
i = end + 1;
|
||||
|
||||
@@ -307,12 +307,12 @@ main( int argc, char **argv)
|
||||
packedrgb = !packedrgb;
|
||||
if (packedrgb) {
|
||||
grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
(FxU32)vtxList[0].r = 0xff0000ff;
|
||||
(FxU32)vtxList[1].r = 0xff00ff00;
|
||||
(FxU32)vtxList[2].r = 0xffff0000;
|
||||
(FxU32)vtxList[3].r = 0xffff0000;
|
||||
(FxU32)vtxList[4].r = 0xff00ff00;
|
||||
(FxU32)vtxList[5].r = 0xff0000ff;
|
||||
*(FxU32 *)&vtxList[0].r = 0xff0000ff;
|
||||
*(FxU32 *)&vtxList[1].r = 0xff00ff00;
|
||||
*(FxU32 *)&vtxList[2].r = 0xffff0000;
|
||||
*(FxU32 *)&vtxList[3].r = 0xffff0000;
|
||||
*(FxU32 *)&vtxList[4].r = 0xff00ff00;
|
||||
*(FxU32 *)&vtxList[5].r = 0xff0000ff;
|
||||
}
|
||||
else {
|
||||
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
|
||||
@@ -449,10 +449,10 @@ main( int argc, char **argv)
|
||||
packedrgb = !packedrgb;
|
||||
if (packedrgb) {
|
||||
grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
(FxU32)srcVerts[0].r = 0xff0000ff;
|
||||
(FxU32)srcVerts[1].r = 0xff00ff00;
|
||||
(FxU32)srcVerts[2].r = 0xffff0000;
|
||||
(FxU32)srcVerts[3].r = 0xffff0000;
|
||||
*(FxU32 *)&srcVerts[0].r = 0xff0000ff;
|
||||
*(FxU32 *)&srcVerts[1].r = 0xff00ff00;
|
||||
*(FxU32 *)&srcVerts[2].r = 0xffff0000;
|
||||
*(FxU32 *)&srcVerts[3].r = 0xffff0000;
|
||||
}
|
||||
else {
|
||||
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
|
||||
@@ -35,7 +35,7 @@ void main( int argc, char **argv) {
|
||||
iFailures = 0, iStatusAt = 0,
|
||||
viewport[4];
|
||||
GrContext_t context;
|
||||
#ifndef __linux__
|
||||
#if !defined(__linux__) && !defined(__DJGPP__)
|
||||
extern unsigned long hWndMain;
|
||||
#else
|
||||
unsigned long hWndMain = tlGethWnd();
|
||||
|
||||
382
glide3x/h3/glide3/tests/test37.c
Normal file
382
glide3x/h3/glide3/tests/test37.c
Normal file
@@ -0,0 +1,382 @@
|
||||
/*
|
||||
** 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
|
||||
**
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifndef __linux__
|
||||
#include <conio.h>
|
||||
#else
|
||||
#include <linutil.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glide.h>
|
||||
#include "tlib.h"
|
||||
|
||||
#define CORRECT_GR_BITS_DEPTH 16
|
||||
#define CORRECT_GR_BITS_RGBA_R 5
|
||||
#define CORRECT_GR_BITS_RGBA_G 6
|
||||
#define CORRECT_GR_BITS_RGBA_B 5
|
||||
#define CORRECT_GR_BITS_RGBA_A 0
|
||||
#define CORRECT_GR_BITS_GAMMA 8
|
||||
#define CORRECT_GR_FOG_TABLE_ENTRIES 64
|
||||
#define CORRECT_GR_GAMMA_TABLE_ENTRIES 32
|
||||
#define CORRECT_GR_MAX_TEXTURE_SIZE 256
|
||||
#define CORRECT_GR_MAX_TEXTURE_ASPECT_RATIO 3
|
||||
#define CORRECT_GR_NUM_FB 2
|
||||
#define CORRECT_GR_NUM_TMU 1
|
||||
#define CORRECT_GR_TEXTURE_ALIGN 8
|
||||
#define CORRECT_GR_VIEWPORT_X 0
|
||||
#define CORRECT_GR_VIEWPORT_Y 0
|
||||
#define CORRECT_GR_VIEWPORT_WIDTH 640
|
||||
#define CORRECT_GR_VIEWPORT_HEIGHT 480
|
||||
|
||||
void TestGet(char * getvalstr, int getval, int memcount , long * memval, int * failures);
|
||||
void TestGetString(char * getvalstr, int getval, int * failures);
|
||||
|
||||
int hwconfig;
|
||||
static const char *version;
|
||||
static const char *extension;
|
||||
|
||||
extern unsigned long hWndMain;
|
||||
|
||||
void
|
||||
main( int argc, char **argv)
|
||||
{
|
||||
GrScreenResolution_t resolution = GR_RESOLUTION_640x480;
|
||||
float scrWidth = 640.0f;
|
||||
float scrHeight = 480.0f;
|
||||
long val4[4];
|
||||
long * histbuffer;
|
||||
long histsize;
|
||||
const char * str;
|
||||
int ret;
|
||||
int i;
|
||||
int failures = 0;
|
||||
int warnings = 0;
|
||||
GrProc func;
|
||||
GrContext_t gc = 0;
|
||||
|
||||
/* Initialize Glide */
|
||||
grGlideInit();
|
||||
assert( hwconfig = tlVoodooType() );
|
||||
|
||||
/* Process Command Line Arguments */
|
||||
tlSetScreen( scrWidth, scrHeight );
|
||||
|
||||
version = grGetString( GR_VERSION );
|
||||
|
||||
printf("Test 37 - grGet() Stress Test. All output goes to the Console.\n\n");
|
||||
tlGetCH ();
|
||||
|
||||
/* Test the Num Boards Call before we do the win open*/
|
||||
TestGet("GR_NUM_BOARDS", GR_NUM_BOARDS, 1 , &val4[0], &failures);
|
||||
|
||||
grSstSelect( 0 );
|
||||
gc = grSstWinOpen( tlGethWnd(),
|
||||
resolution,
|
||||
GR_REFRESH_60Hz,
|
||||
GR_COLORFORMAT_ABGR,
|
||||
GR_ORIGIN_UPPER_LEFT,
|
||||
2, 1 );
|
||||
if (!gc) {
|
||||
printf("Could not allocate glide fullscreen context.\n");
|
||||
goto __errExit;
|
||||
}
|
||||
|
||||
tlConSet( 0.0f, 0.0f, 1.0f, 1.0f,
|
||||
60, 30, 0xffffff );
|
||||
|
||||
/*do the 4 byte grGet()'s*/
|
||||
TestGet("GR_BITS_DEPTH", GR_BITS_DEPTH, 1 , &val4[0], &failures);
|
||||
if(val4[0]!=CORRECT_GR_BITS_DEPTH) {
|
||||
printf("WARNING : Value returned was not not equal to %d\n",CORRECT_GR_BITS_DEPTH);
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_BITS_GAMMA", GR_BITS_GAMMA, 1 , &val4[0], &failures);
|
||||
if(val4[0]<CORRECT_GR_BITS_GAMMA) {
|
||||
printf("WARNING : Value returned was less than expected\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_FOG_TABLE_ENTRIES", GR_FOG_TABLE_ENTRIES, 1 , &val4[0], &failures);
|
||||
if(val4[0]<CORRECT_GR_FOG_TABLE_ENTRIES) {
|
||||
printf("WARNING : Value returned was less than expected\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_GAMMA_TABLE_ENTRIES", GR_GAMMA_TABLE_ENTRIES, 1 , &val4[0], &failures);
|
||||
if(val4[0]<CORRECT_GR_GAMMA_TABLE_ENTRIES) {
|
||||
printf("WARNING : Value returned was less than expected\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_IS_BUSY", GR_IS_BUSY, 1 , &val4[0], &failures);
|
||||
if(val4[0]!=FXTRUE && val4[0]!=FXFALSE) {
|
||||
printf("WARNING : Value returned was not FXTRUE or FXFALSE\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_LFB_PIXEL_PIPE", GR_LFB_PIXEL_PIPE, 1 , &val4[0], &failures);
|
||||
if(val4[0]!=FXTRUE && val4[0]!=FXFALSE) {
|
||||
printf("WARNING : Value returned was not FXTRUE or FXFALSE\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_MAX_TEXTURE_SIZE", GR_MAX_TEXTURE_SIZE, 1 , &val4[0], &failures);
|
||||
if(val4[0]<CORRECT_GR_MAX_TEXTURE_SIZE) {
|
||||
printf("WARNING : Value returned was less than expected\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_MAX_TEXTURE_ASPECT_RATIO", GR_MAX_TEXTURE_ASPECT_RATIO, 1 , &val4[0], &failures);
|
||||
if(val4[0]<CORRECT_GR_MAX_TEXTURE_ASPECT_RATIO) {
|
||||
printf("WARNING : Value returned was less than expected\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_NON_POWER_OF_TWO_TEXTURES", GR_NON_POWER_OF_TWO_TEXTURES, 1 , &val4[0], &failures);
|
||||
if(val4[0]!=FXTRUE && val4[0]!=FXFALSE) {
|
||||
printf("WARNING : Value returned was not FXTRUE or FXFALSE\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_NUM_FB", GR_NUM_FB, 1 , &val4[0], &failures);
|
||||
if(val4[0]>CORRECT_GR_NUM_FB) {
|
||||
printf("WARNING : Value returned was greater than %d\n",CORRECT_GR_NUM_FB);
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_NUM_TMU", GR_NUM_TMU, 1 , &val4[0], &failures);
|
||||
if(val4[0]<CORRECT_GR_NUM_TMU) {
|
||||
printf("WARNING : Value returned was less than %d\n",CORRECT_GR_NUM_TMU);
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_SUPPORTS_PASSTHRU", GR_SUPPORTS_PASSTHRU, 1 , &val4[0], &failures);
|
||||
if(val4[0]!=FXTRUE && val4[0]!=FXFALSE) {
|
||||
printf("WARNING : Value returned was not FXTRUE or FXFALSE\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_TEXTURE_ALIGN", GR_TEXTURE_ALIGN, 1 , &val4[0], &failures);
|
||||
if(val4[0]<CORRECT_GR_TEXTURE_ALIGN) {
|
||||
printf("WARNING : Value returned was less than expected\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
/*Now do the ones we cant verify*/
|
||||
TestGet("GR_GLIDE_STATE_SIZE", GR_GLIDE_STATE_SIZE, 1 , &val4[0], &failures);
|
||||
TestGet("GR_GLIDE_VERTEXLAYOUT_SIZE", GR_GLIDE_VERTEXLAYOUT_SIZE, 1 , &val4[0], &failures);
|
||||
TestGet("GR_MEMORY_FB", GR_MEMORY_FB, 1 , &val4[0], &failures);
|
||||
TestGet("GR_MEMORY_TMU", GR_MEMORY_TMU, 1 , &val4[0], &failures);
|
||||
TestGet("GR_MEMORY_UMA", GR_MEMORY_UMA, 1 , &val4[0], &failures);
|
||||
TestGet("GR_NUM_SWAP_HISTORY_BUFFER", GR_NUM_SWAP_HISTORY_BUFFER, 1 , &val4[0], &failures);
|
||||
TestGet("GR_PENDING_BUFFERSWAPS", GR_PENDING_BUFFERSWAPS, 1 , &val4[0], &failures);
|
||||
TestGet("GR_REVISION_FB", GR_REVISION_FB, 1 , &val4[0], &failures);
|
||||
TestGet("GR_REVISION_TMU", GR_REVISION_TMU, 1 , &val4[0], &failures);
|
||||
TestGet("GR_STATS_LINES", GR_STATS_LINES, 1 , &val4[0], &failures);
|
||||
TestGet("GR_STATS_PIXELS_AFUNC_FAIL", GR_STATS_PIXELS_AFUNC_FAIL, 1 , &val4[0], &failures);
|
||||
TestGet("GR_STATS_PIXELS_CHROMA_FAIL", GR_STATS_PIXELS_CHROMA_FAIL, 1 , &val4[0], &failures);
|
||||
TestGet("GR_STATS_PIXELS_DEPTHFUNC_FAIL", GR_STATS_PIXELS_DEPTHFUNC_FAIL, 1 , &val4[0], &failures);
|
||||
TestGet("GR_STATS_PIXELS_IN", GR_STATS_PIXELS_IN, 1 , &val4[0], &failures);
|
||||
TestGet("GR_STATS_PIXELS_OUT", GR_STATS_PIXELS_OUT, 1 , &val4[0], &failures);
|
||||
TestGet("GR_STATS_POINTS", GR_STATS_POINTS, 1 , &val4[0], &failures);
|
||||
TestGet("GR_STATS_TRIANGLES_IN", GR_STATS_TRIANGLES_IN, 1 , &val4[0], &failures);
|
||||
TestGet("GR_STATS_TRIANGLES_OUT", GR_STATS_TRIANGLES_OUT, 1 , &val4[0], &failures);
|
||||
|
||||
/*Now do 8 byte grGet()'s*/
|
||||
TestGet("GR_WDEPTH_MIN_MAX", GR_WDEPTH_MIN_MAX, 2 , &val4[0], &failures);
|
||||
if(val4[0]>val4[1]) {
|
||||
printf("WARNING : Value[0] returned was greater than Value[1]\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_ZDEPTH_MIN_MAX", GR_ZDEPTH_MIN_MAX, 2 , &val4[0], &failures);
|
||||
if(val4[0]<val4[1]) {
|
||||
printf("WARNING : Value[0] returned was less than Value[1]\n");
|
||||
warnings++;
|
||||
}
|
||||
/*Now do the ones we cant verify*/
|
||||
TestGet("GR_FIFO_FULLNESS", GR_FIFO_FULLNESS, 2 , &val4[0], &failures);
|
||||
TestGet("GR_VIDEO_POSITION", GR_VIDEO_POSITION, 2 , &val4[0], &failures);
|
||||
|
||||
|
||||
|
||||
/* Now do 16 byte grGet()*/
|
||||
TestGet("GR_BITS_RGBA", GR_BITS_RGBA, 4 , &val4[0], &failures);
|
||||
if((val4[0]!=CORRECT_GR_BITS_RGBA_R) | (val4[1]!=CORRECT_GR_BITS_RGBA_G) |
|
||||
(val4[2]!=CORRECT_GR_BITS_RGBA_B) | (val4[3]!=CORRECT_GR_BITS_RGBA_A) ) {
|
||||
printf("WARNING : Values returned were not in range expected\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
TestGet("GR_VIEWPORT", GR_VIEWPORT, 4 , &val4[0], &failures);
|
||||
if((val4[0]!=CORRECT_GR_VIEWPORT_X) | (val4[1]!=CORRECT_GR_VIEWPORT_Y) |
|
||||
(val4[2]!=CORRECT_GR_VIEWPORT_WIDTH) |
|
||||
(val4[3]!=CORRECT_GR_VIEWPORT_HEIGHT)){
|
||||
printf("WARNING : Values returned were not in range expected\n");
|
||||
warnings++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Now do the Swap History Test*/
|
||||
ret = grGet(GR_NUM_SWAP_HISTORY_BUFFER, sizeof(histsize), &histsize );
|
||||
|
||||
if(ret==sizeof(histsize)) {
|
||||
histbuffer = malloc(histsize*sizeof(long));
|
||||
|
||||
ret = grGet(GR_SWAP_HISTORY, histsize*sizeof(long), histbuffer );
|
||||
if(ret==(int)(histsize*sizeof(long)))
|
||||
printf("Success(%d) - ",ret);
|
||||
else {
|
||||
printf("Failed (%d) - ", ret);
|
||||
failures++;
|
||||
}
|
||||
|
||||
printf("GR_SWAP_HISTORY Result = ");
|
||||
|
||||
for(i=0;i<histsize;i++) {
|
||||
printf("%d ", histbuffer[i]);
|
||||
}
|
||||
printf("\n", histbuffer[i]);
|
||||
free(histbuffer);
|
||||
} else {
|
||||
printf("GR_NUM_SWAP_HISTORY_BUFFER failed, so unable to call GR_SWAP_HISTORY\n");
|
||||
}
|
||||
|
||||
/* Now Test The GetString Calls*/
|
||||
TestGetString("GR_HARDWARE", GR_HARDWARE, &failures);
|
||||
TestGetString("GR_RENDERER", GR_RENDERER, &failures);
|
||||
TestGetString("GR_VENDOR", GR_VENDOR, &failures);
|
||||
TestGetString("GR_VERSION", GR_VERSION, &failures);
|
||||
TestGetString("GR_EXTENSION", GR_EXTENSION, &failures);
|
||||
|
||||
str = grGetString(GR_EXTENSION);
|
||||
|
||||
if(strstr(str,"CHROMARANGE")) {
|
||||
/*try and do the getprocaddress calls for Chromarange*/
|
||||
func = grGetProcAddress ( "grChromaRangeModeExt");
|
||||
if(!func) {
|
||||
printf("GetProcAddress for grChromaRangeModeExt Failed\n");
|
||||
failures++;
|
||||
}
|
||||
func = grGetProcAddress ( "grChromaRangeExt");
|
||||
if(!func) {
|
||||
printf("GetProcAddress for grChromaRangeExt Failed\n");
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
|
||||
if(strstr(str,"TEXCHROMA")) {
|
||||
/* try and do the getprocaddress calls for TexChroma*/
|
||||
func = grGetProcAddress ( "grTexChromaModeExt");
|
||||
if(!func) {
|
||||
printf("GetProcAddress for grTexChromaModeExt Failed\n");
|
||||
failures++;
|
||||
}
|
||||
func = grGetProcAddress ( "grTexChromaRangeExt");
|
||||
if(!func) {
|
||||
printf("GetProcAddress for grTexChromaRangeExt Failed\n");
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
|
||||
if(failures)
|
||||
printf("\n%d failures encountered during this test\n",failures);
|
||||
else
|
||||
printf("\ntesting complete - no failures reported\n");
|
||||
|
||||
if(warnings)
|
||||
printf("%d warnings encountered during this test\n",warnings);
|
||||
else
|
||||
printf("testing complete - no warnings reported\n");
|
||||
|
||||
__errExit:
|
||||
grGlideShutdown();
|
||||
|
||||
return;
|
||||
} /* main */
|
||||
|
||||
|
||||
void
|
||||
TestGet(char * getvalstr, int getval, int memcount , long * memval, int * failures)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
int correct;
|
||||
|
||||
correct = FXTRUE; /*Set to TRUE to start with*/
|
||||
|
||||
for(i=0;i<4;i++) /*Clear Memory to some unique Pattern*/
|
||||
memval[i] =0xdeadbeef;
|
||||
|
||||
ret = grGet(getval, memcount*sizeof(long), memval ); /*Do the Get*/
|
||||
|
||||
for(i=0;i<memcount;i++)
|
||||
/*if pattern still exists, then we have a problem*/
|
||||
if(memval[i]==0xdeadbeef)
|
||||
correct=FXFALSE;
|
||||
|
||||
/* if Number of bytes returned is wrong, then we have a problem*/
|
||||
if(ret!=(int)(memcount*sizeof(long)))
|
||||
correct=FXFALSE;
|
||||
|
||||
if(correct) /*print the results*/
|
||||
printf("Success(%d) - ",ret);
|
||||
else {
|
||||
printf("Failed (%d) - ", ret);
|
||||
failures[0]++;
|
||||
}
|
||||
|
||||
switch(memcount) {
|
||||
case 4:
|
||||
printf("%s Result = %d, %d, %d, %d\n",getvalstr, memval[0],memval[1],memval[2],memval[3]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
printf("%s Result = %d, %d\n",getvalstr, memval[0],memval[1]);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
default:
|
||||
printf("%s Result = %d\n",getvalstr, memval[0]);
|
||||
break;
|
||||
}
|
||||
} /* TestGet */
|
||||
|
||||
void
|
||||
TestGetString(char * getvalstr, int getval, int * failures)
|
||||
{
|
||||
const char * str;
|
||||
|
||||
str = grGetString(getval);
|
||||
if(str)
|
||||
printf("Success - ");
|
||||
else {
|
||||
printf("Failed - ");
|
||||
failures[0]++;
|
||||
}
|
||||
printf("%s Result = %s\n",getvalstr, str);
|
||||
} /* TestGetString */
|
||||
200
glide3x/h3/glide3/tests/test38.c
Normal file
200
glide3x/h3/glide3/tests/test38.c
Normal file
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
** 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
|
||||
**
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifndef __linux__
|
||||
#include <conio.h>
|
||||
#else
|
||||
#include <linutil.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glide.h>
|
||||
#include "tlib.h"
|
||||
|
||||
int hwconfig;
|
||||
static const char *version;
|
||||
|
||||
static const char name[] = "test38";
|
||||
static const char purpose[] = "Test the guGammaCorrectionRGB(..) function.";
|
||||
static const char usage[] = "-n <frames> -r <res> -d <filename>";
|
||||
|
||||
extern unsigned long hWndMain;
|
||||
|
||||
void main( int argc, char **argv)
|
||||
{
|
||||
char match;
|
||||
char **remArgs;
|
||||
int rv;
|
||||
char key;
|
||||
float red=1.3f;
|
||||
float green=1.3f;
|
||||
float blue=1.3f;
|
||||
|
||||
GrScreenResolution_t resolution = GR_RESOLUTION_640x480;
|
||||
float scrWidth = 640.0f;
|
||||
float scrHeight = 480.0f;
|
||||
int frames = -1;
|
||||
FxBool scrgrab = FXFALSE;
|
||||
char filename[256];
|
||||
FxU32 wrange[2];
|
||||
GrContext_t gc = 0;
|
||||
|
||||
/* Initialize Glide */
|
||||
grGlideInit();
|
||||
assert( hwconfig = tlVoodooType() );
|
||||
|
||||
/* Process Command Line Arguments */
|
||||
while( rv = tlGetOpt( argc, argv, "nrd", &match, &remArgs ) ) {
|
||||
if ( rv == -1 ) {
|
||||
printf( "Unrecognized command line argument\n" );
|
||||
printf( "%s %s\n", name, usage );
|
||||
printf( "Available resolutions:\n%s\n",
|
||||
tlGetResolutionList() );
|
||||
return;
|
||||
}
|
||||
switch( match ) {
|
||||
case 'n':
|
||||
frames = atoi( remArgs[0] );
|
||||
break;
|
||||
case 'r':
|
||||
resolution = tlGetResolutionConstant( remArgs[0],
|
||||
&scrWidth,
|
||||
&scrHeight );
|
||||
break;
|
||||
case 'd':
|
||||
scrgrab = FXTRUE;
|
||||
frames = 1;
|
||||
strcpy(filename, remArgs[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tlSetScreen( scrWidth, scrHeight );
|
||||
|
||||
version = grGetString( GR_VERSION );
|
||||
|
||||
printf( "%s:\n%s\n", name, purpose );
|
||||
printf( "%s\n", version );
|
||||
printf( "Resolution: %s\n", tlGetResolutionString( resolution ) );
|
||||
if ( frames == -1 ) {
|
||||
printf( "Press A Key To Begin Test.\n" );
|
||||
tlGetCH();
|
||||
}
|
||||
|
||||
grSstSelect( 0 );
|
||||
gc = grSstWinOpen( tlGethWnd(),
|
||||
resolution,
|
||||
GR_REFRESH_60Hz,
|
||||
GR_COLORFORMAT_ABGR,
|
||||
GR_ORIGIN_UPPER_LEFT,
|
||||
2, 1 );
|
||||
if (!gc) {
|
||||
printf("Could not allocate glide fullscreen context.\n");
|
||||
goto __errExit;
|
||||
}
|
||||
|
||||
grGet(GR_WDEPTH_MIN_MAX, 8, (FxI32 *)wrange);
|
||||
|
||||
|
||||
|
||||
while( frames-- && tlOkToRender()) {
|
||||
grBufferClear( 0xff0000, 0, wrange[1] );
|
||||
tlConSet( 0.0f, 0.0f, 1.0f, 1.0f,
|
||||
60, 30, 0xffffff );
|
||||
tlConOutput( "Press W/S to Modify the Red Gamma (%.2f)\n",red );
|
||||
tlConOutput( "Press E/D to Modify the Green Gamma (%.2f)\n",green );
|
||||
tlConOutput( "Press R/F to Modify the Blue Gamma (%.2f)\n",blue );
|
||||
tlConRender();
|
||||
grBufferSwap( 1 );
|
||||
|
||||
if (hwconfig == TL_VOODOORUSH) {
|
||||
tlGetDimsByConst(resolution,
|
||||
&scrWidth,
|
||||
&scrHeight );
|
||||
|
||||
grClipWindow(0, 0, (FxU32) scrWidth, (FxU32) scrHeight);
|
||||
}
|
||||
/* grab the frame buffer */
|
||||
if (scrgrab) {
|
||||
if (!tlScreenDump(filename, (FxU16)scrWidth, (FxU16)scrHeight))
|
||||
printf( "Cannot open %s\n", filename);
|
||||
scrgrab = FXFALSE;
|
||||
}
|
||||
|
||||
key = tlGetCH();
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case 'w':
|
||||
case 'W':
|
||||
red+=0.1f;
|
||||
break;
|
||||
case 's':
|
||||
case 'S':
|
||||
red-=0.1f;
|
||||
break;
|
||||
case 'e':
|
||||
case 'E':
|
||||
green+=0.1f;
|
||||
break;
|
||||
case 'd':
|
||||
case 'D':
|
||||
green-=0.1f;
|
||||
break;
|
||||
case 'r':
|
||||
case 'R':
|
||||
blue+=0.1f;
|
||||
break;
|
||||
case 'f':
|
||||
case 'F':
|
||||
blue-=0.1f;
|
||||
break;
|
||||
|
||||
default:
|
||||
frames = 0;
|
||||
break;
|
||||
}
|
||||
if(red<0.0f)
|
||||
red=0.0f;
|
||||
if(red>8.0f)
|
||||
red=8.0f;
|
||||
if(green<0.0f)
|
||||
green=0.0f;
|
||||
if(green>8.0f)
|
||||
green=8.0f;
|
||||
if(blue<0.0f)
|
||||
blue=0.0f;
|
||||
if(blue>8.0f)
|
||||
blue=8.0f;
|
||||
|
||||
/* Set the Gamma with Glide*/
|
||||
guGammaCorrectionRGB ( red, green, blue );
|
||||
|
||||
}
|
||||
|
||||
__errExit:
|
||||
grGlideShutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
477
glide3x/h3/glide3/tests/test39.c
Normal file
477
glide3x/h3/glide3/tests/test39.c
Normal file
@@ -0,0 +1,477 @@
|
||||
/*
|
||||
** 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
|
||||
**
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifndef __linux__
|
||||
#include <conio.h>
|
||||
#else
|
||||
#include <linutil.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glide.h>
|
||||
#include "tlib.h"
|
||||
|
||||
int hwconfig;
|
||||
static const char *version;
|
||||
|
||||
static const char name[] = "test39";
|
||||
static const char purpose[] = "Multi-base address test";
|
||||
static const char usage[] = "\t-d <screen dump filename>\n"
|
||||
"\t-m [Check grGet(GR_MAX_TEXTURE_SIZE) for max map size]\n"
|
||||
"\t-n <frames>\n"
|
||||
"\t-r <res>\n";
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char match;
|
||||
char **remArgs;
|
||||
int rv = -1;
|
||||
|
||||
GrScreenResolution_t resolution = GR_RESOLUTION_640x480;
|
||||
float scrWidth = 640.0f;
|
||||
float scrHeight = 480.0f;
|
||||
int frames = -1;
|
||||
FxBool scrgrab = FXFALSE;
|
||||
char filename[256];
|
||||
FxU32 wrange[2];
|
||||
|
||||
FxU32
|
||||
multiBaseMode = 0,
|
||||
minTexSize = 1,
|
||||
maxTexSize = 256;
|
||||
|
||||
const TlVertex3D
|
||||
srcVerts[4] =
|
||||
{
|
||||
{ -0.5f, 0.0f, 0.5f, 1.0f, 0.0f, 0.0f },
|
||||
{ 0.5f, 0.0f, 0.5f, 1.0f, 1.0f, 0.0f },
|
||||
{ -0.5f, 0.0f, -0.5f, 1.0f, 0.0f, 1.0f },
|
||||
{ 0.5f, 0.0f, -0.5f, 1.0f, 1.0f, 1.0f }
|
||||
};
|
||||
|
||||
/* Initialize Glide */
|
||||
grGlideInit();
|
||||
if ((hwconfig = tlVoodooType()) == 0) {
|
||||
printf("Error getting 3Dfx hw type.\n");
|
||||
exit(-1);
|
||||
}
|
||||
/* Process Command Line Arguments */
|
||||
while(rv = tlGetOpt(argc, argv, "dmnrx", &match, &remArgs)) {
|
||||
if (rv == -1) {
|
||||
printf("Unrecognized command line argument\n");
|
||||
printf("%s %s\n", name, usage);
|
||||
printf("Available resolutions:\n%s\n",
|
||||
tlGetResolutionList());
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
switch(match) {
|
||||
case 'd':
|
||||
scrgrab = FXTRUE;
|
||||
if (scrgrab) {
|
||||
frames = 1;
|
||||
strcpy(filename, remArgs[0]);
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
/* Do we want to test larger sizes if the hw supports it? */
|
||||
if (!grGet(GR_MAX_TEXTURE_SIZE, sizeof(maxTexSize), (FxI32 *)&maxTexSize)) {
|
||||
printf("grGet(GR_MAX_TEXTURE_SIZE) failed.\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
if (remArgs[0] != NULL) frames = atoi(remArgs[0]);
|
||||
break;
|
||||
case 'r':
|
||||
if (remArgs[0] != NULL) resolution = tlGetResolutionConstant(remArgs[0],
|
||||
&scrWidth,
|
||||
&scrHeight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tlSetScreen(scrWidth, scrHeight);
|
||||
|
||||
version = grGetString(GR_VERSION);
|
||||
|
||||
printf("%s:\n%s\n", name, purpose);
|
||||
printf("%s\n", version);
|
||||
printf("Resolution: %s\n", tlGetResolutionString(resolution));
|
||||
if (frames == -1) {
|
||||
printf("Press A Key To Begin Test.\n");
|
||||
tlGetCH();
|
||||
}
|
||||
|
||||
grSstSelect(0);
|
||||
if (grSstWinOpen(tlGethWnd(),
|
||||
resolution,
|
||||
GR_REFRESH_60Hz,
|
||||
GR_COLORFORMAT_ABGR,
|
||||
GR_ORIGIN_UPPER_LEFT,
|
||||
2, 1) == 0) {
|
||||
printf("grSstWinOpen failed.\n");
|
||||
goto __errExit;
|
||||
}
|
||||
|
||||
tlConSet(0.0f, 0.0f, 1.0f, 1.0f,
|
||||
60, 30, 0xffffff);
|
||||
|
||||
/* Set up Render State */
|
||||
grGet(GR_WDEPTH_MIN_MAX, 8, (FxI32 *)wrange);
|
||||
grVertexLayout(GR_PARAM_XY, 0, GR_PARAM_ENABLE);
|
||||
grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
|
||||
grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
|
||||
GR_COMBINE_FACTOR_ONE,
|
||||
GR_COMBINE_LOCAL_CONSTANT,
|
||||
GR_COMBINE_OTHER_TEXTURE,
|
||||
FXFALSE);
|
||||
grTexCombine(GR_TMU0,
|
||||
GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_ONE,
|
||||
GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_ONE,
|
||||
FXFALSE, FXFALSE);
|
||||
|
||||
/* Generate texture */
|
||||
{
|
||||
GrLOD_t
|
||||
largeLod,
|
||||
smallLod;
|
||||
FxU16*
|
||||
texData = NULL;
|
||||
FxU32
|
||||
totalMapSize,
|
||||
curMapSize;
|
||||
|
||||
/* There's some closed form of this series thing, but I forget
|
||||
* what it is and am way to lazy to actually go look it up. This
|
||||
* is only a glide test after all.
|
||||
*/
|
||||
totalMapSize = 0;
|
||||
curMapSize = maxTexSize;
|
||||
while(curMapSize > 0) {
|
||||
totalMapSize += (curMapSize * curMapSize) * sizeof(FxU16);
|
||||
curMapSize >>= 1;
|
||||
}
|
||||
texData = (FxU16*)malloc(totalMapSize * sizeof(*texData));
|
||||
if (texData == NULL) {
|
||||
printf("Unable to allocate texture data.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Figure out the supported log2(lod size) */
|
||||
largeLod = GR_LOD_LOG2_1;
|
||||
while((0x01UL << largeLod) != maxTexSize) largeLod++;
|
||||
|
||||
smallLod = GR_LOD_LOG2_1;
|
||||
while((0x01UL << smallLod) != minTexSize) smallLod++;
|
||||
|
||||
/* Build simple texture w/ a different color for each map to help
|
||||
* distinguish the different maps when mipmapping. Additionally,
|
||||
* add a 'border' so that we can see if the start of the texture
|
||||
* gets mucked up due to an incorrect start address.
|
||||
*/
|
||||
{
|
||||
FxU16
|
||||
colorVal = 0xF800,
|
||||
*curTexPtr = texData;
|
||||
FxU32
|
||||
i, j,
|
||||
colorShift = (16 / largeLod);
|
||||
|
||||
curMapSize = maxTexSize;
|
||||
while(curMapSize > 0) {
|
||||
for(j = 0; j < curMapSize; j++) *curTexPtr++ = 0xFFFF;
|
||||
for(i = 1; i < curMapSize - 1; i++) {
|
||||
*curTexPtr++ = 0xFFFF;
|
||||
for(j = 1; j < curMapSize - 1; j++) {
|
||||
*curTexPtr++ = colorVal;
|
||||
}
|
||||
*curTexPtr++ = 0xFFFF;
|
||||
}
|
||||
for(j = 0; j < curMapSize; j++) *curTexPtr++ = 0xFFFF;
|
||||
|
||||
curMapSize >>= 1;
|
||||
colorVal >>= colorShift;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
GrTexInfo texInfo = {
|
||||
GR_LOD_LOG2_1,
|
||||
0,
|
||||
GR_ASPECT_LOG2_1x1,
|
||||
GR_TEXFMT_RGB_565,
|
||||
0
|
||||
};
|
||||
FxU32
|
||||
curTexAddr = 0x00UL,
|
||||
texMultiBaseOffset;
|
||||
|
||||
texInfo.largeLodLog2 = largeLod;
|
||||
texInfo.data = texData;
|
||||
|
||||
/* Determine the hw texture alignment and generate some random
|
||||
* offset for the texture base addressing.
|
||||
*/
|
||||
{
|
||||
FxU32
|
||||
texAlign,
|
||||
maxTexMem = grTexMaxAddress(GR_TMU0),
|
||||
maxTexSize = grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
|
||||
if (!grGet(GR_TEXTURE_ALIGN, sizeof(texAlign), (FxI32 *)&texAlign)) {
|
||||
printf("grGet(GR_TEXTURE_ALIGN): Failed!\n");
|
||||
exit(-1);
|
||||
}
|
||||
texAlign <<= 3UL;
|
||||
|
||||
/* Get some offset that has to be smaller than the amount of
|
||||
* texxture space we have left divided by the # of times
|
||||
* that we're going to add it in.
|
||||
*/
|
||||
do {
|
||||
texMultiBaseOffset = rand();
|
||||
} while ((texMultiBaseOffset < 0x1000UL) ||
|
||||
(texMultiBaseOffset > ((maxTexMem - maxTexSize) / 4)));
|
||||
|
||||
texMultiBaseOffset = (texMultiBaseOffset + texAlign) & ~(texAlign - 1UL);
|
||||
}
|
||||
|
||||
/* Download the texture to the multibase address specified by
|
||||
* the current mode. We play a few games w/ offsetting the
|
||||
* texture start address by texMultiBaseOffset to try to make
|
||||
* sure that multi-base actually works inside of glide.
|
||||
*/
|
||||
|
||||
/* Mmmm... multibase */
|
||||
grTexMultibase(GR_TMU0, FXTRUE);
|
||||
|
||||
/* Download and set the base addresses in descending map size
|
||||
* order offsetting by some dorky amount as we go.
|
||||
*/
|
||||
texInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
texInfo.largeLodLog2 = largeLod;
|
||||
|
||||
grTexDownloadMipMap(GR_TMU0,
|
||||
curTexAddr,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
grTexMultibaseAddress(GR_TMU0,
|
||||
GR_TEXBASE_256,
|
||||
curTexAddr,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
|
||||
curTexAddr += (texMultiBaseOffset +
|
||||
grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo));
|
||||
texInfo.data = (void*)((FxU8*)texInfo.data +
|
||||
grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo));
|
||||
|
||||
texInfo.smallLodLog2 = GR_LOD_LOG2_128;
|
||||
texInfo.largeLodLog2 = GR_LOD_LOG2_128;
|
||||
|
||||
grTexDownloadMipMap(GR_TMU0,
|
||||
curTexAddr,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
grTexMultibaseAddress(GR_TMU0,
|
||||
GR_TEXBASE_128,
|
||||
curTexAddr,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
|
||||
curTexAddr += (texMultiBaseOffset +
|
||||
grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo));
|
||||
texInfo.data = (void*)((FxU8*)texInfo.data +
|
||||
grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo));
|
||||
|
||||
texInfo.smallLodLog2 = GR_LOD_LOG2_64;
|
||||
texInfo.largeLodLog2 = GR_LOD_LOG2_64;
|
||||
|
||||
grTexDownloadMipMap(GR_TMU0,
|
||||
curTexAddr,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
grTexMultibaseAddress(GR_TMU0,
|
||||
GR_TEXBASE_64,
|
||||
curTexAddr,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
|
||||
curTexAddr += (texMultiBaseOffset +
|
||||
grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo));
|
||||
texInfo.data = (void*)((FxU8*)texInfo.data +
|
||||
grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo));
|
||||
|
||||
texInfo.smallLodLog2 = GR_LOD_LOG2_1;
|
||||
texInfo.largeLodLog2 = GR_LOD_LOG2_32;
|
||||
|
||||
grTexDownloadMipMap(GR_TMU0,
|
||||
curTexAddr,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
grTexMultibaseAddress(GR_TMU0,
|
||||
GR_TEXBASE_32_TO_1,
|
||||
curTexAddr,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
|
||||
/* Source the whole texture. The large map start will reset
|
||||
* baseAddr0, but that should be fine since we did not adjust
|
||||
* its address because it came first.
|
||||
*/
|
||||
texInfo.smallLodLog2 = GR_LOD_LOG2_1;
|
||||
texInfo.largeLodLog2 = largeLod;
|
||||
|
||||
grTexSource(GR_TMU0,
|
||||
0x00UL,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
&texInfo);
|
||||
}
|
||||
|
||||
free((void*)texData);
|
||||
}
|
||||
|
||||
grTexMipMapMode(GR_TMU0,
|
||||
GR_MIPMAP_NEAREST,
|
||||
FXFALSE);
|
||||
|
||||
tlConOutput("Press a key to quit\n");
|
||||
while(frames-- && tlOkToRender()) {
|
||||
static float
|
||||
curOOW = 1.0f;
|
||||
|
||||
if (hwconfig == TL_VOODOORUSH) {
|
||||
tlGetDimsByConst(resolution,
|
||||
&scrWidth,
|
||||
&scrHeight);
|
||||
|
||||
grClipWindow(0, 0, (FxU32) scrWidth, (FxU32) scrHeight);
|
||||
}
|
||||
|
||||
grBufferClear(0x808080, 0xFF, wrange[1]);
|
||||
|
||||
{
|
||||
static float
|
||||
distance = 1.0f,
|
||||
dDelta = 0.1f;
|
||||
TlVertex3D
|
||||
xfVerts[4],
|
||||
prjVerts[4];
|
||||
GrVertex
|
||||
vtxA,
|
||||
vtxB,
|
||||
vtxC,
|
||||
vtxD;
|
||||
|
||||
/*----
|
||||
A-B
|
||||
|\|
|
||||
C-D
|
||||
-----*/
|
||||
vtxA.oow = 1.0f;
|
||||
vtxB = vtxC = vtxD = vtxA;
|
||||
|
||||
#define MAX_DIST 30.5f
|
||||
#define MIN_DIST 1.0f
|
||||
|
||||
distance += dDelta;
|
||||
if (distance > MAX_DIST ||
|
||||
distance < MIN_DIST) {
|
||||
dDelta *= -1.0f;
|
||||
distance += dDelta;
|
||||
}
|
||||
|
||||
tlSetMatrix(tlIdentity());
|
||||
tlMultMatrix(tlXRotation(-20.0f));
|
||||
tlMultMatrix(tlTranslation(0.0f, -0.3f, distance));
|
||||
|
||||
tlTransformVertices(xfVerts, srcVerts, 4);
|
||||
tlProjectVertices(prjVerts, xfVerts, 4);
|
||||
|
||||
vtxA.x = tlScaleX(prjVerts[0].x);
|
||||
vtxA.y = tlScaleY(prjVerts[0].y);
|
||||
vtxA.oow = 1.0f / prjVerts[0].w;
|
||||
vtxA.tmuvtx[0].sow = prjVerts[0].s * 255.0f * vtxA.oow;
|
||||
vtxA.tmuvtx[0].tow = prjVerts[0].t * 255.0f * vtxA.oow;
|
||||
|
||||
vtxB.x = tlScaleX(prjVerts[1].x);
|
||||
vtxB.y = tlScaleY(prjVerts[1].y);
|
||||
vtxB.oow = 1.0f / prjVerts[1].w;
|
||||
vtxB.tmuvtx[0].sow = prjVerts[1].s * 255.0f * vtxB.oow;
|
||||
vtxB.tmuvtx[0].tow = prjVerts[1].t * 255.0f * vtxB.oow;
|
||||
|
||||
vtxC.x = tlScaleX(prjVerts[2].x);
|
||||
vtxC.y = tlScaleY(prjVerts[2].y);
|
||||
vtxC.oow = 1.0f / prjVerts[2].w;
|
||||
vtxC.tmuvtx[0].sow = prjVerts[2].s * 255.0f * vtxC.oow;
|
||||
vtxC.tmuvtx[0].tow = prjVerts[2].t * 255.0f * vtxC.oow;
|
||||
|
||||
vtxD.x = tlScaleX(prjVerts[3].x);
|
||||
vtxD.y = tlScaleY(prjVerts[3].y);
|
||||
vtxD.oow = 1.0f / prjVerts[3].w;
|
||||
vtxD.tmuvtx[0].sow = prjVerts[3].s * 255.0f * vtxD.oow;
|
||||
vtxD.tmuvtx[0].tow = prjVerts[3].t * 255.0f * vtxD.oow;
|
||||
|
||||
grDrawTriangle(&vtxA, &vtxB, &vtxD);
|
||||
grDrawTriangle(&vtxA, &vtxD, &vtxC);
|
||||
}
|
||||
|
||||
tlConRender();
|
||||
grBufferSwap(1);
|
||||
|
||||
/* grab the frame buffer */
|
||||
if (scrgrab) {
|
||||
if (!tlScreenDump(filename, (FxU16)scrWidth, (FxU16)scrHeight))
|
||||
printf("Cannot open %s\n", filename);
|
||||
scrgrab = FXFALSE;
|
||||
}
|
||||
|
||||
if (tlKbHit()) {
|
||||
char curKey = tlGetCH();
|
||||
|
||||
switch(curKey) {
|
||||
default:
|
||||
frames = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
rv = 0;
|
||||
|
||||
__errExit:
|
||||
grGlideShutdown();
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -635,6 +635,7 @@ void tlConRender( void ) {
|
||||
grTexMipMapMode( GR_TMU0,
|
||||
GR_MIPMAP_DISABLE,
|
||||
FXFALSE );
|
||||
grTexMultibase(GR_TMU0, FXFALSE);
|
||||
grDepthBufferFunction( GR_CMP_ALWAYS );
|
||||
grAlphaTestReferenceValue( 0x1 );
|
||||
grSstOrigin( GR_ORIGIN_UPPER_LEFT );
|
||||
|
||||
@@ -259,7 +259,8 @@ main(int argc, char **argv)
|
||||
/* Download this in a sequential way to test the palette download */
|
||||
i = 0;
|
||||
while(i < 256) {
|
||||
const int end = MIN((i + (rand() % 10)), 255);
|
||||
const int max = i + (rand() % 10);
|
||||
const int end = MIN(max, 255);
|
||||
|
||||
grTexDownloadTablePartial(curPalType, &texPal, i, end);
|
||||
i = end + 1;
|
||||
|
||||
@@ -413,11 +413,11 @@ void main( int argc, char **argv) {
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
triDecal.smallLodLog2 = bgInfo.header.small_lod;
|
||||
triDecal.largeLodLog2 = bgInfo.header.large_lod;
|
||||
triDecal.aspectRatioLog2 = bgInfo.header.aspect_ratio;
|
||||
triDecal.data = bgInfo.data;
|
||||
triDecal.format = bgInfo.header.format;
|
||||
triDecal.smallLodLog2 = triInfo.header.small_lod;
|
||||
triDecal.largeLodLog2 = triInfo.header.large_lod;
|
||||
triDecal.aspectRatioLog2 = triInfo.header.aspect_ratio;
|
||||
triDecal.data = triInfo.data;
|
||||
triDecal.format = triInfo.header.format;
|
||||
grTexDownloadMipMap( GR_TMU0, startAddress, GR_MIPMAPLEVELMASK_BOTH, &triDecal);
|
||||
grTexMipMapMode(GR_TMU0, GR_MIPMAP_NEAREST, FXTRUE);
|
||||
grTexClampMode( GR_TMU0, GR_TEXTURECLAMP_WRAP, GR_TEXTURECLAMP_WRAP);
|
||||
|
||||
@@ -449,10 +449,10 @@ main( int argc, char **argv)
|
||||
packedrgb = !packedrgb;
|
||||
if (packedrgb) {
|
||||
grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
(FxU32)srcVerts[0].r = 0xff0000ff;
|
||||
(FxU32)srcVerts[1].r = 0xff00ff00;
|
||||
(FxU32)srcVerts[2].r = 0xffff0000;
|
||||
(FxU32)srcVerts[3].r = 0xffff0000;
|
||||
*(FxU32 *)&srcVerts[0].r = 0xff0000ff;
|
||||
*(FxU32 *)&srcVerts[1].r = 0xff00ff00;
|
||||
*(FxU32 *)&srcVerts[2].r = 0xffff0000;
|
||||
*(FxU32 *)&srcVerts[3].r = 0xffff0000;
|
||||
}
|
||||
else {
|
||||
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
|
||||
|
||||
Reference in New Issue
Block a user