GLide 32x

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Mon Feb 19, 2007 9:49 pm

Arent those "polygon crossing" only done by hardware rendering?
I mean, it requires too much software (Require a Zpixel map) for manual rendering.

My point of view would be to render per group of polygons only (group car, group house, group tree, group map).
Using a Zbuffer per group (polygons) and a global Zbuffer for the groups :P

Also, the trick is to put the houses few px flying on the map to avoid any suddently house disparition under the map (due to bad zbuffer approx).

Well, that's for the exemple of a green outdoor map and houses :P

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Feb 19, 2007 11:52 pm

As said Fonzie, it's too much for software. The easy Z buffer method is also a big overhead compared to classic rendering. Generally we calculate the Z value on a triangle base and just ignore triangle intersection stuff. We can do some complex intersection code which cut triangle in severals ones but it's complex and still heavy for the CPU.

There are many ways of rendering a 3D scene. The scanline method offers a good level of accuracy (they can handle intersection easily) and can be faster for complexe scene. But you need to be familiar with 3D rendering as this method is more complexe.

http://en.wikipedia.org/wiki/Scanline_r ... _Rendering

This link just list some software 3D engine, maybe it can be a good source of informations for you :
http://cg.cs.tu-berlin.de/~ki/3del_1419 ... _span.html

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Tue Feb 20, 2007 5:42 am

Stef wrote:As said Fonzie, it's too much for software.
Thank you guys.
Well, it'll save me some hundreds hours of computing, that's true !
I've been off for a little, and will still be the couple of coming days. We're releasing a new version of our software, and since I am desperately late (thank you 32x !!!), it's a great piece of work I have to furnish !

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Sun Feb 25, 2007 9:36 pm

Hi you guys.
It seems forever to me I didn't post here.
First of all, let me congratulate Kan and Steph' for making KMod 0.7 possible.
Here I am striking back. Your remember ? I want to use the 32X as a video card for the genny.

I use the Comm Port as a bus between the 2 systems :
Offset 0h : STATUS. Indicates the state of the Comm Port : who can write, who can read, ...
2h : CTRL. Tells the 32X what function to execute : empty the Frame Buffer, allocate a vertex, draw a triangle, ...
4h to Ch : DATA0 to DATA4. Used for the functions. You'd guess that a function drawing a triangle will need 3 vertex for the triangle to be drawn.
Eh : RESULT. Sometimes, the 32X can gives some results back. I don't see anything more than allocate : the 68k asks the 32X to allocate a vertex. The 32X gives the address back, so that 68k and 32X could speak of the same vertex.

The Comm Port has five states :
WRITE_ME. The 68k can write to the Comm Port.
WRITING. The 68k is writing to the Comm Port.
READ_ME. The Comm Port can be read by one SH2.
READING_M. The Master SH2 is reading the Comm Port.
READING_S. The Slave SH2 is reading the Comm Port.

Here's the code for the 68k to write something to the Comm Port :

Code: Select all

void putVDP(int ctrl, int data0, int data1, ...) {
	while (COMM_PORT(STATUS) != WRITE_ME) ;
	COMM_PORT(STATUS) = WRITING;
	COMM_PORT(CTRL) = ctrl;
	COMM_PORT(DATA0) = data0;
	COMM_PORT(DATA1) = data1;
		// wriesg others DATA
	COMM_PORT(STATUS) = READ_ME;
}
Here's the code for the Master SH2 to read something from the Comm Port :

Code: Select all

void readVDP() {
	int entrance = 1;
	int instr;
	int data0;
	int data1;
	/* Wait for READ_ME, than, wait for READING_M. Between READ_ME and
	setting READING_M, the Slave SH2 may have written READING_S	*/
	while (entrance | COMM_PORT(STATUS)==READING_M) {
		entrance = 0;
		while (COMM_PORT(STATUS) != READ_ME) ;
		COMM_PORT(STATUS) = READING_M;
	}
	instr = COMM_PORT(CTRL);
	data0 = COMM_PORT(DATA0);
	data1 = COMM_PORT(DATA1);
		// read others DATA
	COMM_PORT(STATUS) = WRITE_ME;
}
I could do the same for the slave SH2, but I rather re-use this bit of code. It will help the lisibility and the maintainability of the program. I can tell each SH2 if it's Master of Slave. All I have to do, is set a bit that just them will know : in private Work RAM for example. So, I set the cache as 2 way, for each SH2, and, at their own C000 0000h, I write respectively READING_M and READING_S. In the ROM, at 3E0h and 3E4h, there are the Master and Slave Start Address. Here's a SH2 bootstrap :

Code: Select all

READING_M	equ	3
READING_S	equ	4
MASTER_INIT:
; set cache as 2way
	MOV	READ_STATUS,R1
	MOV	READING_M,@R1
	BRA	MAIN
SLAVE_INIT:
; set cache as 2way
	MOV	READ_STATUS,R1
	MOV	READING_S,@R1
	BRA	MAIN
READ_STATUS:
	dc.l	$C0000000
MAIN:
; 32X SH2 main code
The code for reading becomes, for each SH2 :

Code: Select all

void readVDP() {
	int * READ_STATUS = (int *) 0xC0000000;
	int entrance = 1;
	int instr;
	int data0;
	int data1;
	while (entrance | COMM_PORT(STATUS)==*READ_STATUS) {
		entrance = 0;
		while (COMM_PORT(STATUS) != READ_ME) ;
		COMM_PORT(STATUS) = *READ_STATUS;
	}
	instr = COMM_PORT(CTRL);
	data0 = COMM_PORT(DATA0);
	data1 = COMM_PORT(DATA1);
		// read others DATA
	COMM_PORT(STATUS) = WRITE_ME;
}
Here it is. I think it's pretty fast. I don't know it the 32X still is efficient like this, and I don't even know if the 32X has already benn used like this. But I find it a little funny, so ... expect more to come soon. Actually, I just hope the synchronization (waiting, looking, ....) doesn't waste too much time. Wait and see, as everything that is written here just runs ... in my brain !

Oh, by the way. I can tell now that I know what the 32X is. It took me nearly 18 monthes between knowing what the genesis was, and having got some skills for develop ...

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Sun Feb 25, 2007 10:03 pm

Appear good to me :)
It seems you want to use the 68K to drive the polygon sorting etc etc? Or i've misunderstood and you'll do all on 32x side?
I really can't wait to see a demo :D


Do you plan to add some 2d functions too (with some kind of caching to 32x's ram), lets say 128KB of Vram (2048 tiles of 256 colors)?

Then some functions like
-Load palette
-Load_tile
-Show_map
-Show sprite
...?

I think your method was used in some games... It is actualy good :D.


Good luck man :)

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Sun Feb 25, 2007 10:39 pm

The 32X hasn't anything to implement tile, so it'be kind of hell. Nevertheless, 2D can be implemented. Didn't figure exactly how yet.

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Sun Feb 25, 2007 10:41 pm

I mean, for software rendering :) ;) Working with tile isn't so bad but maybe they can be 64*64 pixels instead of 8*8 for faster drawing :)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun Feb 25, 2007 10:48 pm

ob1 wrote:The 32X hasn't anything to implement tile, so it'be kind of hell. Nevertheless, 2D can be implemented. Didn't figure exactly how yet.
I know pitfall 32X handles a complex tile system in software on the 32X. A sort of classical 2D VDP as the genesis one with more colors :)

Using the com port for instruct command to SH2 sounds as a smart idea :) unfortunatly i don't remember how far i emulated the com port on SH-2 side, the SH-2 io stuff are very incomplete on Gens :-/
If something should work but doesn't work on Gens, try your program with Kega Fusion ;)
Last edited by Stef on Mon Feb 26, 2007 8:15 am, edited 1 time in total.

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Mon Feb 26, 2007 7:49 am

Fonzie wrote:I mean, for software rendering :) ;) Working with tile isn't so bad but maybe they can be 64*64 pixels instead of 8*8 for faster drawing :)
Don't tell me projects like that !!!! I could engage them !!!

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Mon Feb 26, 2007 11:29 am

Stef wrote:unfortunatly i don't remember how far i emulated the com port on SH-2 side, the SH-2 io stuff are very incomplete on Gens :-/
I'm talking about the software Comm Port, at A1 5120h from Genesis side and 2000 4020h from the 32X side.
Don't worry. I'm pretty damn sure your implementation of Comm Port is right. Else, Virtua Racing Deluxe wouldn't kick that ass.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Mon Feb 26, 2007 11:30 am

ob1 wrote:
Stef wrote:unfortunatly i don't remember how far i emulated the com port on SH-2 side, the SH-2 io stuff are very incomplete on Gens :-/
I'm talking about the software Comm Port, at A1 5120h from Genesis side and 2000 4020h from the 32X side.
Don't worry. I'm pretty damn sure your implementation of Comm Port is right. Else, Virtua Racing Deluxe wouldn't kick that ass.
Ha ok. I though you were speaking about the internal SH-2 communication port :)

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Mon Mar 12, 2007 2:45 pm

Fonzie wrote:I really can't wait to see a demo
I've drawn something !!!!

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Mon Mar 12, 2007 3:23 pm

PM me the link for ^^ :D
do you get good speed results?

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

GLide 32x re-enaged

Post by ob1 » Wed May 09, 2007 4:18 pm

SuperVDP aborted, here comes the GLide 32x again.
I've started to work on some basics command (grBufferSwap, grBufferClear, grDraw2DPlot). I am currently on grDraw2DLine. And the less I can tell is that it's gonna be way hard to kick the 32x ass !
The amount of work to be done for rendering seems huge to me ! Need to work a lot on paper, and really less on pipeline tricks ;)
Stay tuned.

commodorejohn
Very interested
Posts: 70
Joined: Tue Mar 06, 2007 6:30 pm

Post by commodorejohn » Thu May 10, 2007 1:44 pm

There's one thing I have to say about this whole idea:

Quake 32X CD.

Post Reply