mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Use the texture-related GE accessors.
This commit is contained in:
parent
abd9dc6137
commit
46805b37cb
2 changed files with 9 additions and 9 deletions
|
@ -114,20 +114,20 @@ void ComputeFragmentShaderID(FragmentShaderID *id) {
|
|||
bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough();
|
||||
bool enableAlphaTest = gstate.isAlphaTestEnabled() && !IsAlphaTestTriviallyTrue();
|
||||
bool enableColorTest = gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue();
|
||||
bool enableColorDoubling = (gstate.texfunc & 0x10000) != 0;
|
||||
bool enableColorDoubling = gstate.isColorDoublingEnabled();
|
||||
// This isn't really correct, but it's a hack to get doubled blend modes to work more correctly.
|
||||
bool enableAlphaDoubling = CanDoubleSrcBlendMode();
|
||||
bool doTextureProjection = gstate.getUVGenMode() == 1;
|
||||
bool doTextureAlpha = (gstate.texfunc & 0x100) != 0;
|
||||
|
||||
// All texfuncs except replace are the same for RGB as for RGBA with full alpha.
|
||||
if (gstate_c.textureFullAlpha && (gstate.texfunc & 0x7) != GE_TEXFUNC_REPLACE)
|
||||
if (gstate_c.textureFullAlpha && gstate.getTextureFunction() != GE_TEXFUNC_REPLACE)
|
||||
doTextureAlpha = false;
|
||||
|
||||
// id->d[0] |= (gstate.isModeClear() & 1);
|
||||
if (gstate.isTextureMapEnabled()) {
|
||||
id->d[0] |= 1 << 1;
|
||||
id->d[0] |= (gstate.texfunc & 0x7) << 2;
|
||||
id->d[0] |= gstate.getTextureFunction() << 2;
|
||||
id->d[0] |= (doTextureAlpha & 1) << 5; // rgb or rgba
|
||||
}
|
||||
id->d[0] |= (lmode & 1) << 7;
|
||||
|
@ -161,13 +161,13 @@ void GenerateFragmentShader(char *buffer) {
|
|||
bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough() && !gstate.isModeClear();
|
||||
bool enableAlphaTest = gstate.isAlphaTestEnabled() && !IsAlphaTestTriviallyTrue() && !gstate.isModeClear();
|
||||
bool enableColorTest = gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue() && !gstate.isModeClear();
|
||||
bool enableColorDoubling = (gstate.texfunc & 0x10000) != 0;
|
||||
bool enableColorDoubling = gstate.isColorDoublingEnabled();
|
||||
// This isn't really correct, but it's a hack to get doubled blend modes to work more correctly.
|
||||
bool enableAlphaDoubling = CanDoubleSrcBlendMode();
|
||||
bool doTextureProjection = gstate.getUVGenMode() == 1;
|
||||
bool doTextureAlpha = (gstate.texfunc & 0x100) != 0;
|
||||
|
||||
if (gstate_c.textureFullAlpha && (gstate.texfunc & 0x7) != GE_TEXFUNC_REPLACE)
|
||||
if (gstate_c.textureFullAlpha && gstate.getTextureFunction() != GE_TEXFUNC_REPLACE)
|
||||
doTextureAlpha = false;
|
||||
|
||||
if (doTexture)
|
||||
|
@ -240,7 +240,7 @@ void GenerateFragmentShader(char *buffer) {
|
|||
WRITE(p, " vec4 p = v_color0;\n");
|
||||
|
||||
if (doTextureAlpha) { // texfmt == RGBA
|
||||
switch (gstate.texfunc & 0x7) {
|
||||
switch (gstate.getTextureFunction()) {
|
||||
case GE_TEXFUNC_MODULATE:
|
||||
WRITE(p, " vec4 v = p * t%s;\n", secondary); break;
|
||||
case GE_TEXFUNC_DECAL:
|
||||
|
@ -255,8 +255,8 @@ void GenerateFragmentShader(char *buffer) {
|
|||
WRITE(p, " vec4 v = p;\n"); break;
|
||||
}
|
||||
|
||||
} else { // texfmt == RGB
|
||||
switch (gstate.texfunc & 0x7) {
|
||||
} else { // texfmt == RGB
|
||||
switch (gstate.getTextureFunction()) {
|
||||
case GE_TEXFUNC_MODULATE:
|
||||
WRITE(p, " vec4 v = vec4(t.rgb * p.rgb, p.a)%s;\n", secondary); break;
|
||||
case GE_TEXFUNC_DECAL:
|
||||
|
|
|
@ -234,7 +234,7 @@ struct GPUgstate
|
|||
|
||||
// Texturing
|
||||
bool isTextureMapEnabled() const { return textureMapEnable & 1; }
|
||||
int getTextureFunction() const { return texfunc & 0x7; }
|
||||
GETexFunc getTextureFunction() const { return static_cast<GETexFunc>(texfunc & 0x7); }
|
||||
bool isColorDoublingEnabled() const { return (texfunc & 0x10000) != 0; }
|
||||
GETextureFormat getTextureFormat() const { return static_cast<GETextureFormat>(texformat & 0xF); }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue