Commit 80a9d696 authored by Rinnegatamante's avatar Rinnegatamante
Browse files

Test 1

parent 52401e22
...@@ -92,6 +92,8 @@ extern vidmode_t r_vidModes[]; ...@@ -92,6 +92,8 @@ extern vidmode_t r_vidModes[];
uint32_t cur_width; uint32_t cur_width;
extern SceUID main_thread;
void GLimp_Init( qboolean coreContext) void GLimp_Init( qboolean coreContext)
{ {
...@@ -117,6 +119,13 @@ void GLimp_Init( qboolean coreContext) ...@@ -117,6 +119,13 @@ void GLimp_Init( qboolean coreContext)
vglInitExtended(0x800000, glConfig.vidWidth, glConfig.vidHeight, 0x1000000); vglInitExtended(0x800000, glConfig.vidWidth, glConfig.vidHeight, 0x1000000);
vglUseVram(GL_TRUE); vglUseVram(GL_TRUE);
vglMapHeapMem(); vglMapHeapMem();
// Mapping stack into sceGxm
SceKernelThreadInfo stack_info;
stack_info.size = sizeof(SceKernelThreadInfo);
sceKernelGetThreadInfo(main_thread, &stack_info);
sceGxmMapMemory(stack_info.stack, stack_info.stackSize, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE);
inited = 1; inited = 1;
cur_width = glConfig.vidWidth; cur_width = glConfig.vidWidth;
}else if (glConfig.vidWidth != cur_width){ // Changed resolution in game, restarting the game }else if (glConfig.vidWidth != cur_width){ // Changed resolution in game, restarting the game
......
...@@ -471,6 +471,8 @@ int quake_main (unsigned int argc, void* argv){ ...@@ -471,6 +471,8 @@ int quake_main (unsigned int argc, void* argv){
extern void IN_Init( void *windowData ); extern void IN_Init( void *windowData );
SceUID main_thread;
int main(int argc, char **argv) { int main(int argc, char **argv) {
// Setting maximum clocks // Setting maximum clocks
...@@ -483,7 +485,7 @@ int main(int argc, char **argv) { ...@@ -483,7 +485,7 @@ int main(int argc, char **argv) {
IN_Init(NULL); IN_Init(NULL);
// We need a bigger stack to run Quake 3, so we create a new thread with a proper stack size // We need a bigger stack to run Quake 3, so we create a new thread with a proper stack size
SceUID main_thread = sceKernelCreateThread("Quake III", quake_main, 0x40, 0x200000, 0, 0, NULL); main_thread = sceKernelCreateThread("Quake III", quake_main, 0x40, 0x200000, 0, 0, NULL);
if (main_thread >= 0){ if (main_thread >= 0){
sceKernelStartThread(main_thread, 0, NULL); sceKernelStartThread(main_thread, 0, NULL);
sceKernelWaitThreadEnd(main_thread, NULL, NULL); sceKernelWaitThreadEnd(main_thread, NULL, NULL);
......
...@@ -708,7 +708,7 @@ Used for cinematics. ...@@ -708,7 +708,7 @@ Used for cinematics.
void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty) { void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty) {
int i, j; int i, j;
int start, end; int start, end;
return;
if ( !tr.registered ) { if ( !tr.registered ) {
return; return;
} }
...@@ -959,6 +959,7 @@ Also called by RE_EndRegistration ...@@ -959,6 +959,7 @@ Also called by RE_EndRegistration
=============== ===============
*/ */
void RB_ShowImages( void ) { void RB_ShowImages( void ) {
return;
int i; int i;
image_t *image; image_t *image;
float x, y, w, h; float x, y, w, h;
......
...@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ...@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../renderercommon/qgl.h" #include "../renderercommon/qgl.h"
#define GL_INDEX_TYPE GL_UNSIGNED_INT #define GL_INDEX_TYPE GL_UNSIGNED_INT
typedef unsigned int glIndex_t; typedef uint16_t glIndex_t;
// 14 bits // 14 bits
// can't be increased without changing bit packing for drawsurfs // can't be increased without changing bit packing for drawsurfs
......
...@@ -1300,7 +1300,7 @@ R_DebugPolygon ...@@ -1300,7 +1300,7 @@ R_DebugPolygon
*/ */
void R_DebugPolygon( int color, int numPoints, float *points ) { void R_DebugPolygon( int color, int numPoints, float *points ) {
int i; int i;
return;
GL_State( GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ); GL_State( GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
// draw solid shade // draw solid shade
......
...@@ -40,6 +40,7 @@ without compiled vertex arrays. ...@@ -40,6 +40,7 @@ without compiled vertex arrays.
================== ==================
*/ */
static void R_DrawElements( int numIndexes, const glIndex_t *indexes ) { static void R_DrawElements( int numIndexes, const glIndex_t *indexes ) {
vglIndexPointerMapped(indexes);
vglDrawObjects(GL_TRIANGLES, numIndexes, GL_TRUE); vglDrawObjects(GL_TRIANGLES, numIndexes, GL_TRUE);
} }
...@@ -99,6 +100,7 @@ Draws triangle outlines for debugging ...@@ -99,6 +100,7 @@ Draws triangle outlines for debugging
================ ================
*/ */
static void DrawTris (shaderCommands_t *input) { static void DrawTris (shaderCommands_t *input) {
return;
GL_Bind( tr.whiteImage ); GL_Bind( tr.whiteImage );
qglColor3f (1,1,1); qglColor3f (1,1,1);
...@@ -139,6 +141,7 @@ Draws vertex normals for debugging ...@@ -139,6 +141,7 @@ Draws vertex normals for debugging
================ ================
*/ */
static void DrawNormals (shaderCommands_t *input) { static void DrawNormals (shaderCommands_t *input) {
return;
int i; int i;
vec3_t temp; vec3_t temp;
...@@ -218,13 +221,7 @@ static void DrawMultitextured( shaderCommands_t *input, int stage ) { ...@@ -218,13 +221,7 @@ static void DrawMultitextured( shaderCommands_t *input, int stage ) {
// base // base
// //
GL_SelectTexture( 0 ); GL_SelectTexture( 0 );
float *texcoord = gTexCoordBuffer; vglTexCoordPointerMapped(0, input->svars.texcoords[0]);
int i;
for (i = 0 ; i < input->numIndexes ; i++) {
memcpy(texcoord, input->svars.texcoords[0][input->indexes[i]], sizeof(vec2_t));
texcoord += 2;
}
vglTexCoordPointer( 2, GL_FLOAT, 0, input->numIndexes, gTexCoordBuffer );
R_BindAnimatedImage( &pStage->bundle[0] ); R_BindAnimatedImage( &pStage->bundle[0] );
R_DrawElements( input->numIndexes, input->indexes ); R_DrawElements( input->numIndexes, input->indexes );
...@@ -242,12 +239,7 @@ static void DrawMultitextured( shaderCommands_t *input, int stage ) { ...@@ -242,12 +239,7 @@ static void DrawMultitextured( shaderCommands_t *input, int stage ) {
//-> GL_TexEnv( tess.shader->multitextureEnv ); //-> GL_TexEnv( tess.shader->multitextureEnv );
//->} //->}
texcoord = gTexCoordBuffer; vglTexCoordPointerMapped(0, input->svars.texcoords[1]);
for (i = 0 ; i < input->numIndexes ; i++) {
memcpy(texcoord, input->svars.texcoords[1][input->indexes[i]], sizeof(vec2_t));
texcoord += 2;
}
vglTexCoordPointer( 2, GL_FLOAT, 0, input->numIndexes, gTexCoordBuffer );
R_BindAnimatedImage( &pStage->bundle[1] ); R_BindAnimatedImage( &pStage->bundle[1] );
R_DrawElements( input->numIndexes, input->indexes ); R_DrawElements( input->numIndexes, input->indexes );
...@@ -273,10 +265,10 @@ static void ProjectDlightTexture_scalar( void ) { ...@@ -273,10 +265,10 @@ static void ProjectDlightTexture_scalar( void ) {
int i, l; int i, l;
vec3_t origin; vec3_t origin;
float *texCoords; float *texCoords;
float *colors; uint8_t *colors;
byte clipBits[SHADER_MAX_VERTEXES]; byte clipBits[SHADER_MAX_VERTEXES];
float texCoordsArray[SHADER_MAX_VERTEXES][2]; float texCoordsArray[SHADER_MAX_VERTEXES][2];
float colorArray[SHADER_MAX_VERTEXES][4]; uint8_t colorArray[SHADER_MAX_VERTEXES][4];
glIndex_t hitIndexes[SHADER_MAX_INDEXES]; glIndex_t hitIndexes[SHADER_MAX_INDEXES];
int numIndexes; int numIndexes;
float scale; float scale;
...@@ -373,10 +365,10 @@ static void ProjectDlightTexture_scalar( void ) { ...@@ -373,10 +365,10 @@ static void ProjectDlightTexture_scalar( void ) {
} }
} }
clipBits[i] = clip; clipBits[i] = clip;
colors[0] = (float)(ri.ftol(floatColor[0] * modulate)) / 255.0f; colors[0] = ri.ftol(floatColor[0] * modulate);
colors[1] = (float)(ri.ftol(floatColor[1] * modulate)) / 255.0f; colors[1] = ri.ftol(floatColor[1] * modulate);
colors[2] = (float)(ri.ftol(floatColor[2] * modulate)) / 255.0f; colors[2] = ri.ftol(floatColor[2] * modulate);
colors[3] = 1.0f; colors[3] = 255;
} }
// build a list of triangles that need light // build a list of triangles that need light
...@@ -403,16 +395,8 @@ static void ProjectDlightTexture_scalar( void ) { ...@@ -403,16 +395,8 @@ static void ProjectDlightTexture_scalar( void ) {
qglEnableClientState( GL_TEXTURE_COORD_ARRAY ); qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
qglEnableClientState( GL_COLOR_ARRAY ); qglEnableClientState( GL_COLOR_ARRAY );
float *texcoord = gTexCoordBuffer; vglColorPointerMapped(GL_UNSIGNED_BYTE, colorArray);
float *colorbuf = gColorBuffer; vglTexCoordPointerMapped(GL_FALSE, texCoordsArray[0]);
for (i = 0 ; i < numIndexes ; i++) {
memcpy(texcoord, texCoordsArray[hitIndexes[i]], sizeof(vec2_t));
texcoord += 2;
memcpy(colorbuf, colorArray[hitIndexes[i]], sizeof(vec4_t));
colorbuf += 4;
}
vglColorPointer( 4, GL_FLOAT, 0, numIndexes, gColorBuffer);
vglTexCoordPointer( 2, GL_FLOAT, 0, numIndexes, gTexCoordBuffer );
GL_Bind( tr.dlightImage ); GL_Bind( tr.dlightImage );
// include GLS_DEPTHFUNC_EQUAL so alpha tested surfaces don't add light // include GLS_DEPTHFUNC_EQUAL so alpha tested surfaces don't add light
...@@ -463,19 +447,8 @@ static void RB_FogPass( void ) { ...@@ -463,19 +447,8 @@ static void RB_FogPass( void ) {
GL_State( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA ); GL_State( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
} }
float *texcoord = gTexCoordBuffer; vglColorPointerMapped(GL_UNSIGNED_BYTE, tess.svars.colors);
float *colorbuf = gColorBuffer; vglTexCoordPointerMapped(GL_FALSE, tess.svars.texcoords[0]);
for (i = 0 ; i < tess.numIndexes ; i++) {
colorbuf[0] = (float)(tess.svars.colors[tess.indexes[i]][0]) / 255.0f;
colorbuf[1] = (float)(tess.svars.colors[tess.indexes[i]][1]) / 255.0f;
colorbuf[2] = (float)(tess.svars.colors[tess.indexes[i]][2]) / 255.0f;
colorbuf[3] = (float)(tess.svars.colors[tess.indexes[i]][3]) / 255.0f;
memcpy(texcoord, tess.svars.texcoords[0][tess.indexes[i]], sizeof(vec2_t));
texcoord += 2;
colorbuf += 4;
}
vglColorPointer( 4, GL_FLOAT, 0, tess.numIndexes, gColorBuffer);
vglTexCoordPointer( 2, GL_FLOAT, 0, tess.numIndexes, gTexCoordBuffer );
R_DrawElements( tess.numIndexes, tess.indexes ); R_DrawElements( tess.numIndexes, tess.indexes );
} }
...@@ -820,16 +793,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) ...@@ -820,16 +793,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
//if ( !setArraysOnce ) //if ( !setArraysOnce )
//{ //{
qglEnableClientState( GL_COLOR_ARRAY ); qglEnableClientState( GL_COLOR_ARRAY );
float *colorbuf = gColorBuffer; vglColorPointerMapped(GL_UNSIGNED_BYTE, input->svars.colors);
int i;
for (i = 0 ; i < input->numIndexes ; i++) {
colorbuf[0] = (float)(input->svars.colors[input->indexes[i]][0]) / 255.0f;
colorbuf[1] = (float)(input->svars.colors[input->indexes[i]][1]) / 255.0f;
colorbuf[2] = (float)(input->svars.colors[input->indexes[i]][2]) / 255.0f;
colorbuf[3] = (float)(input->svars.colors[input->indexes[i]][3]) / 255.0f;
colorbuf += 4;
}
vglColorPointer( 4, GL_FLOAT, 0, input->numIndexes, gColorBuffer);
//} //}
// //
...@@ -843,13 +807,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) ...@@ -843,13 +807,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
{ {
//if ( !setArraysOnce ) //if ( !setArraysOnce )
//{ //{
float *texcoord = gTexCoordBuffer; vglTexCoordPointerMapped(0, input->svars.texcoords[0]);
int i;
for (i = 0 ; i < input->numIndexes ; i++) {
memcpy(texcoord, input->svars.texcoords[0][input->indexes[i]], sizeof(vec2_t));
texcoord += 2;
}
vglTexCoordPointer( 2, GL_FLOAT, 0, input->numIndexes, gTexCoordBuffer);
//} //}
// //
...@@ -909,13 +867,7 @@ void RB_StageIteratorGeneric( void ) ...@@ -909,13 +867,7 @@ void RB_StageIteratorGeneric( void )
// //
// lock XYZ // lock XYZ
// //
float *vertices = gVertexBuffer; vglVertexPointerMapped(GL_TRUE, input->xyz);
int i;
for (i=0;i<input->numIndexes;i++){
memcpy(vertices, input->xyz[input->indexes[i]], sizeof(vec3_t));
vertices += 3;
}
vglVertexPointer(3, GL_FLOAT, 0, input->numIndexes, gVertexBuffer);
//->if (qglLockArraysEXT) //->if (qglLockArraysEXT)
//->{ //->{
...@@ -999,24 +951,9 @@ void RB_StageIteratorVertexLitTexture( void ) ...@@ -999,24 +951,9 @@ void RB_StageIteratorVertexLitTexture( void )
qglEnableClientState( GL_COLOR_ARRAY); qglEnableClientState( GL_COLOR_ARRAY);
qglEnableClientState( GL_TEXTURE_COORD_ARRAY); qglEnableClientState( GL_TEXTURE_COORD_ARRAY);
float *colorbuf = gColorBuffer; vglColorPointerMapped(GL_UNSIGNED_BYTE, tess.svars.colors);
float *texcoord = gTexCoordBuffer; vglTexCoordPointerMapped(GL_TRUE, tess.texCoords[0][0]);
float *vertices = gVertexBuffer; vglVertexPointerMapped(GL_TRUE, input->xyz);
int i;
for (i = 0 ; i < tess.numIndexes ; i++) {
colorbuf[0] = (float)(tess.svars.colors[tess.indexes[i]][0]) / 255.0f;
colorbuf[1] = (float)(tess.svars.colors[tess.indexes[i]][1]) / 255.0f;
colorbuf[2] = (float)(tess.svars.colors[tess.indexes[i]][2]) / 255.0f;
colorbuf[3] = (float)(tess.svars.colors[tess.indexes[i]][3]) / 255.0f;
colorbuf += 4;
memcpy(texcoord, tess.texCoords[tess.indexes[i]][0], sizeof(vec2_t));
texcoord += 2;
memcpy(vertices, input->xyz[input->indexes[i]], sizeof(vec3_t));
vertices += 3;
}
vglColorPointer( 4, GL_FLOAT, 0, tess.numIndexes, gColorBuffer);
vglTexCoordPointer(2, GL_FLOAT, 0, tess.numIndexes, gTexCoordBuffer);
vglVertexPointer(3, GL_FLOAT, 0, input->numIndexes, gVertexBuffer);
//->if ( qglLockArraysEXT ) //->if ( qglLockArraysEXT )
//->{ //->{
...@@ -1083,20 +1020,8 @@ void RB_StageIteratorLightmappedMultitexture( void ) { ...@@ -1083,20 +1020,8 @@ void RB_StageIteratorLightmappedMultitexture( void ) {
// //
GL_State( GLS_DEFAULT ); GL_State( GLS_DEFAULT );
qglEnableClientState( GL_COLOR_ARRAY ); qglEnableClientState( GL_COLOR_ARRAY );
int i; vglVertexPointerMapped(GL_TRUE, input->xyz);
float *vertices = gVertexBuffer; vglColorPointerMapped(GL_UNSIGNED_BYTE, tess.constantColor255);
float *colorbuf = gColorBuffer;
for (i = 0 ; i < input->numIndexes ; i++) {
memcpy(vertices, input->xyz[input->indexes[i]], sizeof(vec3_t));
vertices += 3;
colorbuf[0] = 1.0f;
colorbuf[1] = 1.0f;
colorbuf[2] = 1.0f;
colorbuf[3] = 1.0f;
colorbuf += 4;
}
vglVertexPointer(3, GL_FLOAT, 0, input->numIndexes, gVertexBuffer);
vglColorPointer( 4, GL_FLOAT, 0, tess.numIndexes, gColorBuffer);
// //
// select base stage // select base stage
...@@ -1106,12 +1031,7 @@ void RB_StageIteratorLightmappedMultitexture( void ) { ...@@ -1106,12 +1031,7 @@ void RB_StageIteratorLightmappedMultitexture( void ) {
qglEnableClientState( GL_TEXTURE_COORD_ARRAY ); qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
R_BindAnimatedImage( &tess.xstages[0]->bundle[0] ); R_BindAnimatedImage( &tess.xstages[0]->bundle[0] );
float *texcoord = gTexCoordBuffer; vglTexCoordPointerMapped(GL_TRUE, tess.texCoords[0][0]);
for (i = 0 ; i < tess.numIndexes ; i++) {
memcpy(texcoord, tess.texCoords[tess.indexes[i]][0], sizeof(vec2_t));
texcoord += 2;
}
vglTexCoordPointer(2, GL_FLOAT, 0, tess.numIndexes, gTexCoordBuffer);
R_DrawElements( input->numIndexes, input->indexes ); R_DrawElements( input->numIndexes, input->indexes );
// //
...@@ -1125,12 +1045,7 @@ void RB_StageIteratorLightmappedMultitexture( void ) { ...@@ -1125,12 +1045,7 @@ void RB_StageIteratorLightmappedMultitexture( void ) {
//-> GL_TexEnv( GL_MODULATE ); //-> GL_TexEnv( GL_MODULATE );
//->} //->}
R_BindAnimatedImage( &tess.xstages[0]->bundle[1] ); R_BindAnimatedImage( &tess.xstages[0]->bundle[1] );
texcoord = gTexCoordBuffer; vglTexCoordPointerMapped(GL_TRUE, tess.texCoords[0][1]);
for (i = 0 ; i < tess.numIndexes ; i++) {
memcpy(texcoord, tess.texCoords[tess.indexes[i]][1], sizeof(vec2_t));
texcoord += 2;
}
vglTexCoordPointer(2, GL_FLOAT, 0, tess.numIndexes, gTexCoordBuffer);
// //
// lock arrays // lock arrays
......
...@@ -61,6 +61,7 @@ void R_AddEdgeDef( int i1, int i2, int facing ) { ...@@ -61,6 +61,7 @@ void R_AddEdgeDef( int i1, int i2, int facing ) {
void R_RenderShadowEdges( void ) { void R_RenderShadowEdges( void ) {
int i; int i;
return;
int c, c2; int c, c2;
int j, k; int j, k;
......
...@@ -363,6 +363,7 @@ static float s_skyTexCoords[SKY_SUBDIVISIONS+1][SKY_SUBDIVISIONS+1][2]; ...@@ -363,6 +363,7 @@ static float s_skyTexCoords[SKY_SUBDIVISIONS+1][SKY_SUBDIVISIONS+1][2];
static void DrawSkySide( struct image_s *image, const int mins[2], const int maxs[2] ) static void DrawSkySide( struct image_s *image, const int mins[2], const int maxs[2] )
{ {
return;
int s, t; int s, t;
GL_Bind( image ); GL_Bind( image );
......
...@@ -283,6 +283,7 @@ RB_SurfaceBeam ...@@ -283,6 +283,7 @@ RB_SurfaceBeam
*/ */
static void RB_SurfaceBeam( void ) static void RB_SurfaceBeam( void )
{ {
return;
#define NUM_BEAM_SEGS 6 #define NUM_BEAM_SEGS 6
refEntity_t *e; refEntity_t *e;
int i; int i;
...@@ -1159,6 +1160,7 @@ Draws x/y/z lines from the origin for orientation debugging ...@@ -1159,6 +1160,7 @@ Draws x/y/z lines from the origin for orientation debugging
=================== ===================
*/ */
static void RB_SurfaceAxis( void ) { static void RB_SurfaceAxis( void ) {
return;
GL_Bind( tr.whiteImage ); GL_Bind( tr.whiteImage );
GL_State( GLS_DEFAULT ); GL_State( GLS_DEFAULT );
//->qglLineWidth( 3 ); //->qglLineWidth( 3 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment