GPUstate :Add getTextureWidth() & getTextureHeight()

and
This commit is contained in:
raven02 2013-07-30 23:09:22 +08:00
parent 4ac782f789
commit 75c9ce2498
5 changed files with 12 additions and 10 deletions

View File

@ -633,8 +633,8 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
}
case GE_CMD_TEXSIZE0:
gstate_c.curTextureWidth = 1 << (gstate.texsize[0] & 0xf);
gstate_c.curTextureHeight = 1 << ((gstate.texsize[0] >> 8) & 0xf);
gstate_c.curTextureWidth = gstate.getTextureWidth();
gstate_c.curTextureHeight = gstate.getTextureHeight();
shaderManager_->DirtyUniform(DIRTY_UVSCALEOFFSET);
//fall thru - ignoring the mipmap sizes for now
case GE_CMD_TEXSIZE1:

View File

@ -331,8 +331,8 @@ void LinkedShader::updateUniforms() {
uvscaleoff[3] = gstate_c.uv.vOff / gstate_c.curTextureHeight;
glUniform4fv(u_uvscaleoffset, 1, uvscaleoff);
} else {
int w = 1 << (gstate.texsize[0] & 0xf);
int h = 1 << ((gstate.texsize[0] >> 8) & 0xf);
int w = gstate.getTextureWidth();
int h = gstate.getTextureHeight();
float widthFactor = (float)w / (float)gstate_c.curTextureWidth;
float heightFactor = (float)h / (float)gstate_c.curTextureHeight;
if ((gstate.texmapmode & 3) == 0) {

View File

@ -392,8 +392,8 @@ inline void DeIndexTexture4Optimal(ClutT *dest, const u32 texaddr, int length, C
void *TextureCache::readIndexedTex(int level, u32 texaddr, int bytesPerIndex, GLuint dstFmt) {
int bufw = GetLevelBufw(level, texaddr);
int w = 1 << (gstate.texsize[0] & 0xf);
int h = 1 << ((gstate.texsize[0] >> 8) & 0xf);
int w = gstate.getTextureWidth();
int h = gstate.getTextureHeight();
int length = bufw * h;
void *buf = NULL;
switch (gstate.getClutPaletteFormat()) {
@ -996,8 +996,8 @@ void TextureCache::SetTexture() {
cluthash = 0;
}
int w = 1 << (gstate.texsize[0] & 0xf);
int h = 1 << ((gstate.texsize[0] >> 8) & 0xf);
int w = gstate.getTextureWidth();
int h = gstate.getTextureHeight();
int bufw = GetLevelBufw(0, texaddr);
int maxLevel = ((gstate.texmode >> 16) & 0x7);

View File

@ -524,8 +524,8 @@ void TransformDrawEngine::SoftwareTransformAndDraw(
vscale /= gstate_c.curTextureHeight;
}
int w = 1 << (gstate.texsize[0] & 0xf);
int h = 1 << ((gstate.texsize[0] >> 8) & 0xf);
int w = gstate.getTextureWidth();
int h = gstate.getTextureHeight();
float widthFactor = (float) w / (float) gstate_c.curTextureWidth;
float heightFactor = (float) h / (float) gstate_c.curTextureHeight;

View File

@ -246,6 +246,8 @@ struct GPUgstate
u32 getColorTestMask() const { return colormask & 0xFFFFFF; }
// Texturing
int getTextureWidth() const { return 1 << (texsize[0] & 0xf);}
int getTextureHeight() const { return 1 << ((texsize[0] >> 8) & 0xf);}
bool isTextureMapEnabled() const { return textureMapEnable & 1; }
GETexFunc getTextureFunction() const { return static_cast<GETexFunc>(texfunc & 0x7); }
bool isColorDoublingEnabled() const { return (texfunc & 0x10000) != 0; }