Commit 089e222a authored by Maximus32's avatar Maximus32
Browse files

Almost working...

parent 846b1a1d
Loading
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@
 */


//#define BG_DEBUG
#define BG_DEBUG


typedef struct {
@@ -104,6 +104,7 @@ typedef struct {
} SPass;


#define GS_RENDER_QUEUE_HIRES (512*1024) // 512KiB
static GSQUEUE DrawQueue[2];
static volatile u32 iCurrentDrawQueue = 0;
static GSTEXTURE * pTexture = NULL;
@@ -129,6 +130,10 @@ static u8 ThreadStack[8 * 1024] __attribute__ ((aligned(16)));
static int ThreadId = -1;
static ee_thread_t thread;

//#define FUNCDEBUG() printf("%s\n", __FUNCTION__)
//#define FUNCDEBUG()
#define FUNCDEBUG() SyncDCache(0, 32*1024*1024)


static int hsync_callback()
{
@@ -171,6 +176,7 @@ static int hsync_callback()

static void gsKit_setpass(GSGLOBAL *gsGlobal, const SPass * pass, int yoff)
{
	//FUNCDEBUG();
	u64 *p_data;
	u64 *p_store;
	int qsize = 8;
@@ -213,6 +219,7 @@ static void gsKit_setpass_background(GSGLOBAL *gsGlobal, const SPass * pass, GST

static void gsKit_create_pass(GSGLOBAL *gsGlobal, const SPass * pass, GSQUEUE * Queue, int yoff)
{
	//FUNCDEBUG();
	GSQUEUE * Queue_backup = gsGlobal->CurQueue;

	// Create new queue (if not already created)
@@ -238,6 +245,7 @@ static void gsKit_create_pass(GSGLOBAL *gsGlobal, const SPass * pass, GSQUEUE *

static void gsKit_create_passes(GSGLOBAL *gsGlobal)
{
	FUNCDEBUG();
	u32 iPass;

	// Create draw queues to setup the rendering for each pass
@@ -274,6 +282,7 @@ static void gsKit_queue_send(GSGLOBAL *gsGlobal, GSQUEUE *Queue)

static void dma_to_gs_thread(void * data)
{
	//FUNCDEBUG();
	GSGLOBAL *gsGlobal = (GSGLOBAL *)data;
	u32 iQueue;

@@ -430,6 +439,7 @@ int gsKit_hires_set_bg(GSGLOBAL *gsGlobal, GSTEXTURE * tex)

void gsKit_hires_init_screen(GSGLOBAL *gsGlobal, int passCount)
{
	//FUNCDEBUG();
	u8 ZBuffering_backup;
	ee_sema_t sema;
	u32 iPass;
@@ -594,7 +604,7 @@ void gsKit_hires_init_screen(GSGLOBAL *gsGlobal, int passCount)
	// Re-use the "per" queue from gsKit
	DrawQueue[0] = *gsGlobal->Per_Queue;
	// Create a second identical queue for double buffering
	gsKit_queue_init(gsGlobal, &DrawQueue[1], GS_PERSISTENT, GS_RENDER_QUEUE_PER_POOLSIZE);
	gsKit_queue_init(gsGlobal, &DrawQueue[1], GS_PERSISTENT, GS_RENDER_QUEUE_HIRES);
	// Set active queue
	gsKit_queue_set(gsGlobal, &DrawQueue[iCurrentDrawQueue]);

@@ -641,11 +651,13 @@ void gsKit_hires_init_screen(GSGLOBAL *gsGlobal, int passCount)

GSGLOBAL *gsKit_hires_init_global()
{
	return gsKit_init_global();
	//FUNCDEBUG();
	return gsKit_init_global_custom(GS_RENDER_QUEUE_OS_POOLSIZE, GS_RENDER_QUEUE_HIRES);
}

void gsKit_hires_deinit_global(GSGLOBAL *gsGlobal)
{
	//FUNCDEBUG();
	u32 iPass;

	if (hsync_callback_id >= 0)
+6 −3
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ _blockCreate(unsigned int start, unsigned int size)
	block->pNext = NULL;
	block->pPrev = NULL;

	printf("%s 0x%x %d-%d\n", __FUNCTION__, block, block->iStart/1024, (block->iStart+block->iSize)/1024);

	return block;
}

@@ -75,6 +77,7 @@ _blockRemove(struct SVramBlock * block)
	if(block->pNext != NULL)
		block->pNext->pPrev = block->pPrev;

	printf("%s 0x%x %d-%d\n", __FUNCTION__, block, block->iStart/1024, (block->iStart+block->iSize)/1024);
	free(block);

	return next;
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ EE_LDFLAGS += $(EE_LIB_DIRS)
all: $(EE_BIN)

test: all
	ps2client -h $(PS2_IP) -t 1 execee host:$(EE_BIN)
	ps2client -h $(PS2_IP) execee host:$(EE_BIN)

sim: all
	PCSX2 --elf=$(PWD)/$(EE_BIN) --nogui
+14 −7
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <gsKit.h>
#include <gsHires.h>
#include <dmaKit.h>
#include <fileio.h>

#include "libpad.h"

@@ -128,6 +129,10 @@ int main(int argc, char *argv[])
	u64 TexCol = GS_SETREG_RGBAQ(0x80,0x80,0x80,0x80,0x00);
	GSGLOBAL *gsGlobal = NULL;
	GSTEXTURE *texture = calloc(1, sizeof(*texture));
	u32 color = 0x00ff0000;
	int i;

	fioSetBlockMode(FIO_NOWAIT);

	pad_init();

@@ -169,14 +174,12 @@ int main(int argc, char *argv[])
			gsKit_set_display_offset(gsGlobal, pCurrentMode->XOff * pCurrentMode->VCK, pCurrentMode->YOff);

			print_mode(gsGlobal);

			gsKit_TexManager_invalidate(gsGlobal, texture);
			gsKit_TexManager_bind(gsGlobal, texture);

			printf("VRAM used: %dKiB\n", gsGlobal->CurrentPointer / 1024);
			printf("VRAM free: %dKiB\n", 4096 - (gsGlobal->CurrentPointer / 1024));
		}

#if 1
		//gsKit_TexManager_invalidate(gsGlobal, texture);
		gsKit_TexManager_bind(gsGlobal, texture);
		gsKit_prim_sprite_texture(gsGlobal, texture,
                              0, //X1
                              0,  // Y1
@@ -188,7 +191,11 @@ int main(int argc, char *argv[])
                              texture->Height, // V2
                              0,
                              TexCol);

#else
		color ^= 0x00ffff00;
		for (i = 0; i<10; i++)
			gsKit_clear(gsGlobal, color);
#endif
		gsKit_hires_sync(gsGlobal);
		gsKit_hires_flip(gsGlobal);
		gsKit_TexManager_nextFrame(gsGlobal);