 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
dridri
Joined: 31 Jul 2009 Posts: 35
|
Posted: Wed Aug 26, 2009 3:08 am Post subject: Using PSPGE for graphic engine |
|
|
Im creating a Graphic Engine, but i dont want to use the PSPGu, because the PSPGu is not the better way for that. It's too slow, example :
| Code: | void myEngineEnable(int state){
sceGuEnable(state);
} |
It's too much, because the CPU makes two calls for one operation.
All compiles okay, but the program stops at sceGeSyncList, and I d'ont know why.
Initialization :
| Code: | static unsigned int __attribute__((aligned(16))) ge_init_list[] = { ...... }; //The same as PSPGU
unsigned int __attribute__((aligned(16))) DisplayList[262144] = { 0 };
void createContext(){
libge_context = &libge_contexts[0];
ge_edram_address = (u32)sceGeEdramGetAddr();
// initialize graphics hardware
ge_list_executed[0] = sceGeListEnQueue((void*)((unsigned int)ge_init_list & 0x1fffffff), 0, 0, 0);
sceGeListSync(ge_list_executed[0], 0); //This works good, so the PSPGE is initialized ?!
libge_context->dList.start = DisplayList;
libge_context->dList.current = libge_context->dList.start;
libge_context->clear_color = 0xffffffff;
//The same as PSPGU, in sceGuStart
static int dither_matrix[16] = {
-4, 0,-3, 1,
2,-2, 3,-1,
-3, 1,-4, 0,
3,-1, 2,-2
};
geSetDither((ScePspIMatrix4*)dither_matrix);
geSendCommandi(CMD_PATCH_DIVIDE, (16 << 8)|16);
geSendCommandi(CMD_MATERIAL, GU_AMBIENT|GU_DIFFUSE|GU_SPECULAR);
geSendCommandf(CMD_SPECULAR, 1.0f);
geSendCommandf(CMD_TEX_SCALE_U, 1.0f);
geSendCommandf(CMD_TEX_SCALE_V, 1.0f);
}
|
//initialization of my Lib
| Code: |
void Init(){
createContext();
geDrawBuffer(GU_PSM_8888, 0, 512);
geDispBuffer((void*)(512*272*4), 480, 272);
geScissor(0, 0, 480, 272);
geAmbientColor(0xffffffff);
geDisable(GE_DEPTH_TEST);
geEnable(GE_TEXTURE_2D);
geDrawSync(); //The bug is in this function
} |
//The sync function
| Code: |
void geDrawSync(){
*(libge_context->dList.current++) = 0x0f000000;
*(libge_context->dList.current++) = 0x0c000000;
*(libge_context->dList.current++) = 0x00000000;
*(libge_context->dList.current++) = 0x00000000;
ge_list_executed[0] = sceGeListEnQueue(libge_context->dList.start, libge_context->dList.current, 0, NULL);
pspDebugScreenPrintf("SyncList...\n");
sceGeListSync(ge_list_executed[0], PSP_GE_LIST_DONE);
//The program stops running here (i can see "SyncList..." on screen, but not "Ok"
pspDebugScreenPrintf("Ok\n");
sceGeDrawSync(PSP_GE_LIST_DRAWING_DONE);
libge_context->dList.current = libge_context->dList.start; //Reset list
} |
Thanks to people who knows PSPGE and want help me ... _________________ I'm French, and 15 years old, so my English is not good... |
|
| Back to top |
|
 |
dridri
Joined: 31 Jul 2009 Posts: 35
|
Posted: Wed Aug 26, 2009 3:47 am Post subject: |
|
|
I resolved the problem ! Very simple ^^.
The PSPGE uses a GPU local address for the displayList, so :
| Code: | | libge_context->dList.start = (u32*)((u32)DisplayList | 0x40000000); |
_________________ I'm French, and 15 years old, so my English is not good... |
|
| Back to top |
|
 |
svxs
Joined: 19 Jun 2009 Posts: 15
|
Posted: Wed Aug 26, 2009 5:29 am Post subject: |
|
|
My advice is to not reinvent the wheel. If the GU functions do it fine by themselves, why wrap them? If you're intent on it, then use a macro:
| Code: |
#define myEngineEnable(State) sceGuEnable(State)
|
Not much point in a library that renames standardized/common functions from the SDK, though. |
|
| Back to top |
|
 |
dridri
Joined: 31 Jul 2009 Posts: 35
|
Posted: Wed Aug 26, 2009 7:16 am Post subject: |
|
|
| svxs wrote: | | My advice is to not reinvent the wheel. If the GU functions do it fine by themselves, why wrap them? |
That's the difference, in reality certain things are not good inthe PSPGU, and I want to make a low-level library. _________________ I'm French, and 15 years old, so my English is not good... |
|
| Back to top |
|
 |
fungos
Joined: 31 Oct 2007 Posts: 41 Location: cwb br
|
Posted: Thu Aug 27, 2009 12:49 am Post subject: Re: Using PSPGE for graphic engine |
|
|
| dridri wrote: | example :
| Code: | void myEngineEnable(int state){
sceGuEnable(state);
} |
It's too much, because the CPU makes two calls for one operation. |
| svxs wrote: | | Code: | | #define myEngineEnable(State) sceGuEnable(State) |
|
Or, you can inline it when doing wrapping. I think it is better than macro if you have a decent compiler as gcc. |
|
| Back to top |
|
 |
jojojoris
Joined: 30 Mar 2008 Posts: 261
|
Posted: Thu Aug 27, 2009 2:01 am Post subject: Re: Using PSPGE for graphic engine |
|
|
| dridri wrote: |
| Code: | void myEngineEnable(int state){
sceGuEnable(state);
} |
It's too much, because the CPU makes two calls for one operation. |
Do you know what a compiler does??? I think it doesn't make any sense since to compiler does optimalisation which will probable reduce the actual number CPU calls to a minimum. _________________
| Code: | int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
} |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|