Remove counterintuitive NULL protection in texture code (fixes #31)
This commit is contained in:
parent
46117ec90a
commit
033c600e20
@ -59,7 +59,6 @@ static void C3Di_TexCubeDelete(C3D_TexCube* cube)
|
|||||||
|
|
||||||
bool C3D_TexInitWithParams(C3D_Tex* tex, C3D_TexCube* cube, C3D_TexInitParams p)
|
bool C3D_TexInitWithParams(C3D_Tex* tex, C3D_TexCube* cube, C3D_TexInitParams p)
|
||||||
{
|
{
|
||||||
if (tex->data) return false;
|
|
||||||
if ((p.width|p.height) & 7) return false;
|
if ((p.width|p.height) & 7) return false;
|
||||||
|
|
||||||
bool isCube = typeIsCube(p.type);
|
bool isCube = typeIsCube(p.type);
|
||||||
@ -109,9 +108,6 @@ bool C3D_TexInitWithParams(C3D_Tex* tex, C3D_TexCube* cube, C3D_TexInitParams p)
|
|||||||
|
|
||||||
void C3D_TexLoadImage(C3D_Tex* tex, const void* data, GPU_TEXFACE face, int level)
|
void C3D_TexLoadImage(C3D_Tex* tex, const void* data, GPU_TEXFACE face, int level)
|
||||||
{
|
{
|
||||||
if (!tex->data)
|
|
||||||
return;
|
|
||||||
|
|
||||||
u32 size = 0;
|
u32 size = 0;
|
||||||
void* out = C3D_TexGetImagePtr(tex,
|
void* out = C3D_TexGetImagePtr(tex,
|
||||||
C3Di_TexIs2D(tex) ? tex->data : tex->cube->data[face],
|
C3Di_TexIs2D(tex) ? tex->data : tex->cube->data[face],
|
||||||
@ -240,19 +236,16 @@ void C3D_TexBind(int unitId, C3D_Tex* tex)
|
|||||||
|
|
||||||
void C3D_TexFlush(C3D_Tex* tex)
|
void C3D_TexFlush(C3D_Tex* tex)
|
||||||
{
|
{
|
||||||
if (tex->data && !addrIsVRAM(tex->data))
|
if (!addrIsVRAM(tex->data))
|
||||||
GSPGPU_FlushDataCache(tex->data, C3D_TexCalcTotalSize(tex->size, tex->maxLevel));
|
GSPGPU_FlushDataCache(tex->data, C3D_TexCalcTotalSize(tex->size, tex->maxLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
void C3D_TexDelete(C3D_Tex* tex)
|
void C3D_TexDelete(C3D_Tex* tex)
|
||||||
{
|
{
|
||||||
if (!tex->data) return;
|
|
||||||
|
|
||||||
if (C3Di_TexIs2D(tex))
|
if (C3Di_TexIs2D(tex))
|
||||||
allocFree(tex->data);
|
allocFree(tex->data);
|
||||||
else
|
else
|
||||||
C3Di_TexCubeDelete(tex->cube);
|
C3Di_TexCubeDelete(tex->cube);
|
||||||
tex->data = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void C3D_TexShadowParams(bool perspective, float bias)
|
void C3D_TexShadowParams(bool perspective, float bias)
|
||||||
|
Loading…
Reference in New Issue
Block a user