SHDR : various fixes
This commit is contained in:
parent
1cab4c80a9
commit
656cb1a923
@ -1,43 +0,0 @@
|
|||||||
; setup constants
|
|
||||||
.const 5, 0.0, 1.0, 2.0, 3.0
|
|
||||||
|
|
||||||
; setup outmap
|
|
||||||
.out o0, result.position
|
|
||||||
.out o1, result.color
|
|
||||||
.out o2, result.texcoord0
|
|
||||||
.out o3, result.texcoord1
|
|
||||||
.out o4, result.texcoord2
|
|
||||||
|
|
||||||
; setup uniform map (not required)
|
|
||||||
.uniform 0x10, 0x13, mdlvMtx
|
|
||||||
.uniform 0x14, 0x17, projMtx
|
|
||||||
|
|
||||||
;code
|
|
||||||
main:
|
|
||||||
; result.pos = mdlvMtx * in.pos
|
|
||||||
dp4 d40, d40, d00 (0x0)
|
|
||||||
dp4 d40, d41, d00 (0x1)
|
|
||||||
dp4 d40, d42, d00 (0x2)
|
|
||||||
mov d40, d25 (0x4)
|
|
||||||
; result.pos = projMtx * in.pos
|
|
||||||
dp4 d00, d44, d40 (0x0)
|
|
||||||
dp4 d00, d45, d40 (0x1)
|
|
||||||
dp4 d00, d46, d40 (0x2)
|
|
||||||
dp4 d00, d47, d40 (0x3)
|
|
||||||
; result.color = in.pos
|
|
||||||
mov d04, d25 (0x5)
|
|
||||||
; result.texcoord = const
|
|
||||||
mov d08, d25 (0x5)
|
|
||||||
mov d0C, d25 (0x5)
|
|
||||||
mov d10, d25 (0x5)
|
|
||||||
flush
|
|
||||||
end
|
|
||||||
endmain:
|
|
||||||
|
|
||||||
;operand descriptors
|
|
||||||
.opdesc x___, xyzw, xyzw ; 0x0
|
|
||||||
.opdesc _y__, xyzw, xyzw ; 0x1
|
|
||||||
.opdesc __z_, xyzw, xyzw ; 0x2
|
|
||||||
.opdesc ___w, xyzw, xyzw ; 0x3
|
|
||||||
.opdesc ___w, yyyy, xyzw ; 0x4
|
|
||||||
.opdesc xyzw, xyzw, xyzw ; 0x5
|
|
@ -15,42 +15,55 @@ DVLB_s* SHDR_ParseSHBIN(u32* shbinData, u32 shbinSize)
|
|||||||
DVLB_s* ret=malloc(sizeof(DVLB_s));
|
DVLB_s* ret=malloc(sizeof(DVLB_s));
|
||||||
if(!ret)goto exit;
|
if(!ret)goto exit;
|
||||||
|
|
||||||
// //parse DVLB
|
//parse DVLB
|
||||||
// ret->numDVLE=shbinData[1];
|
ret->numDVLE=shbinData[1];
|
||||||
// ret->DVLE=malloc(sizeof(DVLE_s)*ret->numDVLE);
|
ret->DVLE=malloc(sizeof(DVLE_s)*ret->numDVLE);
|
||||||
// if(!ret->DVLE)goto clean1;
|
if(!ret->DVLE)goto clean1;
|
||||||
|
|
||||||
// //parse DVLP
|
//parse DVLP
|
||||||
// u32* dvlpData=&shbinData[2+ret->numDVLE];
|
u32* dvlpData=&shbinData[2+ret->numDVLE];
|
||||||
// ret->DVLP.codeSize=dvlpData[3];
|
ret->DVLP.codeSize=dvlpData[3];
|
||||||
// ret->DVLP.codeData=&dvlpData[dvlpData[2]/4];
|
ret->DVLP.codeData=&dvlpData[dvlpData[2]/4];
|
||||||
// ret->DVLP.opdescSize=dvlpData[5];
|
ret->DVLP.opdescSize=dvlpData[5];
|
||||||
// ret->DVLP.opcdescData=&dvlpData[dvlpData[4]/4];
|
ret->DVLP.opcdescData=&dvlpData[dvlpData[4]/4];
|
||||||
|
|
||||||
// //parse DVLE
|
//parse DVLE
|
||||||
// int i;
|
int i;
|
||||||
// for(i=0;i<ret->numDVLE;i++)
|
for(i=0;i<ret->numDVLE;i++)
|
||||||
// {
|
{
|
||||||
// DVLE_s* dvle=&ret->DVLE[i];
|
DVLE_s* dvle=&ret->DVLE[i];
|
||||||
// u32* dvleData=&shbinData[shbinData[2+i]/4];
|
u32* dvleData=&shbinData[shbinData[2+i]/4];
|
||||||
|
|
||||||
// dvle->type=(dvleData[1]>>16)&0xFF;
|
dvle->type=(dvleData[1]>>16)&0xFF;
|
||||||
// dvle->mainOffset=dvleData[2];
|
dvle->mainOffset=dvleData[2];
|
||||||
// dvle->endmainOffset=dvleData[3];
|
dvle->endmainOffset=dvleData[3];
|
||||||
|
|
||||||
// dvle->constTableSize=dvleData[7];
|
dvle->constTableSize=dvleData[7];
|
||||||
// dvle->constTableData=(DVLE_constEntry_s*)&dvleData[dvleData[6]/4];
|
dvle->constTableData=(DVLE_constEntry_s*)&dvleData[dvleData[6]/4];
|
||||||
|
|
||||||
// dvle->outTableSize=dvleData[11];
|
dvle->outTableSize=dvleData[11];
|
||||||
// dvle->outTableData=(DVLE_outEntry_s*)&dvleData[dvleData[10]/4];
|
dvle->outTableData=(DVLE_outEntry_s*)&dvleData[dvleData[10]/4];
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
goto exit;
|
||||||
clean1:
|
clean1:
|
||||||
free(ret);
|
free(ret);
|
||||||
exit:
|
exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//hm
|
||||||
|
static inline minu8(u8 a, u8 b)
|
||||||
|
{
|
||||||
|
if(a<b)return a;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
static inline maxu8(u8 a, u8 b)
|
||||||
|
{
|
||||||
|
if(a<b)return b;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
void DVLP_SendCode(DVLP_s* dvlp)
|
void DVLP_SendCode(DVLP_s* dvlp)
|
||||||
{
|
{
|
||||||
if(!dvlp)return;
|
if(!dvlp)return;
|
||||||
@ -58,7 +71,8 @@ void DVLP_SendCode(DVLP_s* dvlp)
|
|||||||
GPUCMD_AddSingleParam(0x000F02CB, 0x00000000);
|
GPUCMD_AddSingleParam(0x000F02CB, 0x00000000);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<dvlp->codeSize;i+=0x80)GPUCMD_Add(0x000F02CC, &dvlp->codeData[i], ((dvlp->codeSize-i)<0x80)?(dvlp->codeSize-i):0x80);
|
// for(i=0;i<dvlp->codeSize;i+=0x80)GPUCMD_Add(0x000F02CC, &dvlp->codeData[i], ((dvlp->codeSize-i)<0x80)?(dvlp->codeSize-i):0x80);
|
||||||
|
for(i=0;i<dvlp->codeSize;i+=0x80)GPUCMD_Add(0x000F02CC, &dvlp->codeData[i], maxu8(minu8(dvlp->codeSize-i,0x80),0x37)); //not sure why, but anything smaller than 0x37 seems to break stuff atm...
|
||||||
|
|
||||||
GPUCMD_AddSingleParam(0x000F02BF, 0x00000001);
|
GPUCMD_AddSingleParam(0x000F02BF, 0x00000001);
|
||||||
}
|
}
|
||||||
@ -69,17 +83,24 @@ void DVLP_SendOpDesc(DVLP_s* dvlp)
|
|||||||
|
|
||||||
GPUCMD_AddSingleParam(0x000F02D5, 0x00000000);
|
GPUCMD_AddSingleParam(0x000F02D5, 0x00000000);
|
||||||
|
|
||||||
GPUCMD_Add(0x000F02D6, dvlp->opcdescData, dvlp->opdescSize);
|
u32 param[0x20];
|
||||||
|
|
||||||
|
int i;
|
||||||
|
//TODO : should probably preprocess this
|
||||||
|
for(i=0;i<dvlp->opdescSize;i++)param[i]=dvlp->opcdescData[i*2];
|
||||||
|
|
||||||
|
GPUCMD_Add(0x000F02D6, param, dvlp->opdescSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DVLE_SendOutmap(DVLE_s* dvle)
|
void DVLE_SendOutmap(DVLE_s* dvle)
|
||||||
{
|
{
|
||||||
if(!dvle)return;
|
if(!dvle)return;
|
||||||
|
|
||||||
u32 param[0x8]={0x1F1F1F1F,0x1F1F1F1F,0x1F1F1F1F,0x1F1F1F1F,
|
u32 param[0x7]={0x1F1F1F1F,0x1F1F1F1F,0x1F1F1F1F,0x1F1F1F1F,
|
||||||
0x1F1F1F1F,0x1F1F1F1F,0x1F1F1F1F,0x1F1F1F1F};
|
0x1F1F1F1F,0x1F1F1F1F,0x1F1F1F1F};
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
//TODO : should probably preprocess this
|
||||||
for(i=0;i<dvle->outTableSize;i++)
|
for(i=0;i<dvle->outTableSize;i++)
|
||||||
{
|
{
|
||||||
u32* out=¶m[dvle->outTableData[i].regID];
|
u32* out=¶m[dvle->outTableData[i].regID];
|
||||||
|
Loading…
Reference in New Issue
Block a user