Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions src/gu/pspgu.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ extern "C" {
#define GU_CALLBACK_SIGNAL (1)
#define GU_CALLBACK_FINISH (4)

/* Signal behavior */
/* Signal behavior (deprecated) */
#define GU_BEHAVIOR_SUSPEND (1)
#define GU_BEHAVIOR_CONTINUE (2)

Expand Down Expand Up @@ -503,19 +503,15 @@ void* sceGuSetCallback(int signal, void (*callback)(int));
/**
* Trigger signal to call code from the command stream
*
* Available signals are:
* Available signal interrupt modes are:
* - GU_SIGNAL_WAIT - Wait for callback to finish
* - GU_SIGNAL_NOWAIT - Do not wait for callback to finish
* - GU_SIGNAL_PAUSE - Pause execution until callback is finished
*
* Available behaviors are:
* - GU_BEHAVIOR_SUSPEND - Stops display list execution until callback function finished
* - GU_BEHAVIOR_CONTINUE - Do not stop display list execution during callback
*
* @param signal - Signal to trigger
* @param behavior - Behavior type
* @param mode - Signal interrupt mode
* @param id - Signal id
**/
void sceGuSignal(int signal, int behavior);
void sceGuSignal(int mode, int id);

/**
* Send raw float-command to the GE
Expand Down Expand Up @@ -604,7 +600,7 @@ int sceGuCallList(const void* list);
/**
* Set wether to use stack-based calls or signals to handle execution of called lists.
*
* @param mode - GU_TRUE(1) to enable signals, GU_FALSE(0) to disable signals and use
* @param mode - GU_CALL_SIGNAL(1) to enable signals, GU_CALL_NORMAL(0) to disable signals and use
* normal calls instead.
**/
void sceGuCallMode(int mode);
Expand Down
2 changes: 1 addition & 1 deletion src/gu/sceGuCallList.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int sceGuCallList(const void *list)

if (gu_call_mode == GU_CALL_SIGNAL)
{
sendCommandi(SIGNAL, (list_addr >> 16) | 0x110000);
sendCommandi(SIGNAL, (0x11 << 16) | (list_addr >> 16));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the old syntax (list_addr >> 16) | 0x110000 as it's clearer to me, but it's probably just my personal preference.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here… 0x11 is an specific command

sendCommandi(END, list_addr & 0xffff);
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/gu/sceGuFinishId.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int sceGuFinishId(unsigned int id)
case GU_CALL:
if (gu_call_mode == GU_CALL_SIGNAL)
{
sendCommandi(SIGNAL, 0x120000);
sendCommandi(SIGNAL, 0x12 << 16);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, I'd keep 0x120000 (personal preference)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I split it is because 0x12 is actually part of a GE command when SIGNAL CMD is used.

sendCommandi(END, 0);
}
else
Expand Down
6 changes: 3 additions & 3 deletions src/gu/sceGuSignal.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

#include "guInternal.h"

void sceGuSignal(int signal, int argument)
void sceGuSignal(int mode, int id)
{
sendCommandi(SIGNAL, ((signal & 0xff) << 16) | (argument & 0xffff));
sendCommandi(SIGNAL, ((mode & 0xff) << 16) | (id & 0xffff));
sendCommandi(END, 0);

if (signal == GU_SIGNAL_PAUSE)
if (mode == GU_SIGNAL_PAUSE)
{
sendCommandi(FINISH, 0);
sendCommandi(END, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/samples/gu/beginobject/beginobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ int main(int argc, char* argv[]) {
sceGuBeginObject(GU_VERTEX_32BITF, 8, 0, bbox);
}

sceGuSignal(1, GU_BEHAVIOR_SUSPEND);
sceGuSignal(GU_SIGNAL_WAIT, i);

sceGumPushMatrix();
sceGumRotateX(time * 0.5324f);
Expand Down
11 changes: 4 additions & 7 deletions src/samples/gu/signals/signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,8 @@ int main(int argc, char* argv[])
// init GU and set callbacks
sceGuInit();

// 0x01 - user callback
// 0x04 - 'rendering finished' callback
sceGuSetCallback(1, &mySignalHandler);
sceGuSetCallback(4, &myFinishHandler);
sceGuSetCallback(GU_CALLBACK_SIGNAL, &mySignalHandler);
sceGuSetCallback(GU_CALLBACK_FINISH, &myFinishHandler);

// setup GU
sceGuStart(GU_DIRECT,list);
Expand Down Expand Up @@ -246,7 +244,7 @@ int main(int argc, char* argv[])
// run sample

#ifdef USING_SIGNALS
sceGuCallMode(1);
sceGuCallMode(GU_CALL_SIGNAL);
#endif

// generate callable command-list with texture setup
Expand Down Expand Up @@ -439,8 +437,7 @@ void render_billboards(unsigned int i)

#ifdef USING_SIGNALS
// send a signal when rendering was completed
// signals 0x01..0x03 - seems to be available for custom usage
sceGuSignal( 1, nextI );
sceGuSignal(GU_SIGNAL_WAIT, nextI);

// HACK: keeps CPU waiting until all jobs were submitted for GPU
if (nextI == g_context.iterationCount)
Expand Down
24 changes: 12 additions & 12 deletions src/samples/gu/timing/timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,43 +236,43 @@ int main(int argc, char** argv) {

switch(mode) {
case 0 :
sceGuSignal(GU_BEHAVIOR_SUSPEND, 1);
sceGuSignal(GU_SIGNAL_WAIT, 1);
sceGumDrawArray(GU_TRIANGLES, GU_VERTEX_32BITF, TORUS_SEGMENTS * TORUS_SLICES * 6, 0, triangleTorus);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 2);
sceGuSignal(GU_SIGNAL_WAIT, 2);
break;

case 1 :
sceGuSignal(GU_BEHAVIOR_SUSPEND, 1);
sceGuSignal(GU_SIGNAL_WAIT, 1);
sceGumDrawArrayN(GU_TRIANGLE_STRIP, GU_VERTEX_32BITF, TORUS_SLICES*2+2, TORUS_SEGMENTS, 0, tristripTorus);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 2);
sceGuSignal(GU_SIGNAL_WAIT, 2);
break;

case 2 :
sceGuPatchDivide(1, 1);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 1);
sceGuSignal(GU_SIGNAL_WAIT, 1);
sceGumDrawSpline(GU_VERTEX_32BITF, TORUS_SEGMENTS + 3, TORUS_SLICES + 3, GU_FILL_FILL, GU_FILL_FILL, 0, splineTorus);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 2);
sceGuSignal(GU_SIGNAL_WAIT, 2);
break;

case 3 :
sceGuPatchDivide(2, 2);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 1);
sceGuSignal(GU_SIGNAL_WAIT, 1);
sceGumDrawSpline(GU_VERTEX_32BITF, TORUS_SEGMENTS + 3, TORUS_SLICES + 3, GU_FILL_FILL, GU_FILL_FILL, 0, splineTorus);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 2);
sceGuSignal(GU_SIGNAL_WAIT, 2);
break;

case 4 :
sceGuPatchDivide(4, 4);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 1);
sceGuSignal(GU_SIGNAL_WAIT, 1);
sceGumDrawSpline(GU_VERTEX_32BITF, TORUS_SEGMENTS + 3, TORUS_SLICES + 3, GU_FILL_FILL, GU_FILL_FILL, 0, splineTorus);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 2);
sceGuSignal(GU_SIGNAL_WAIT, 2);
break;

default :
sceGuPatchDivide(8, 8);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 1);
sceGuSignal(GU_SIGNAL_WAIT, 1);
sceGumDrawSpline(GU_VERTEX_32BITF, TORUS_SEGMENTS + 3, TORUS_SLICES + 3, GU_FILL_FILL, GU_FILL_FILL, 0, splineTorus);
sceGuSignal(GU_BEHAVIOR_SUSPEND, 2);
sceGuSignal(GU_SIGNAL_WAIT, 2);
break;
}
sceGuFinish();
Expand Down