mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 09:39:33 +01:00
Add a few gstate accessors for texture type stuff.
This commit is contained in:
1 parent
0a217a1254
commit
7f6cf3ec29
7 files changed
+14
-12
No files matched your search
@@ -721,7 +721,7 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
if (gstate.getPatchPrimitiveType() != GE_PATCHPRIM_TRIANGLES) {
|
||||
ERROR_LOG_REPORT(G3D, "Unsupported patch primitive %x", gstate.patchprimitive&3);
|
||||
ERROR_LOG_REPORT(G3D, "Unsupported patch primitive %x", gstate.getPatchPrimitiveType());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ LinkedShader::LinkedShader(Shader *vs, Shader *fs, bool useHWTransform)
|
||||
u_view = glGetUniformLocation(program, "u_view");
|
||||
u_world = glGetUniformLocation(program, "u_world");
|
||||
u_texmtx = glGetUniformLocation(program, "u_texmtx");
|
||||
if (gstate.getWeightMask() != 0)
|
||||
if (gstate.getWeightMask() != GE_VTYPE_WEIGHT_NONE)
|
||||
numBones = TranslateNumBones(gstate.getNumBoneWeights());
|
||||
else
|
||||
numBones = 0;
|
||||
@@ -338,7 +338,7 @@ void LinkedShader::updateUniforms() {
|
||||
// Not sure what GE_TEXMAP_UNKNOWN is, but seen in Riviera. Treating the same as GE_TEXMAP_TEXTURE_COORDS works.
|
||||
if (gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_COORDS || gstate.getUVGenMode() == GE_TEXMAP_UNKNOWN) {
|
||||
static const float rescale[4] = {1.0f, 2*127.5f/128.f, 2*32767.5f/32768.f, 1.0f};
|
||||
float factor = rescale[(gstate.vertType & GE_VTYPE_TC_MASK) >> GE_VTYPE_TC_SHIFT];
|
||||
float factor = rescale[gstate.getTexCoordMask() >> GE_VTYPE_TC_SHIFT];
|
||||
uvscaleoff[0] = gstate_c.uv.uScale * factor * widthFactor;
|
||||
uvscaleoff[1] = gstate_c.uv.vScale * factor * heightFactor;
|
||||
uvscaleoff[2] = gstate_c.uv.uOff * widthFactor;
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ void TransformDrawEngine::DrawBezier(int ucount, int vcount) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!(gstate.vertType & GE_VTYPE_TC_MASK)) {
|
||||
if (!gstate.getTexCoordMask()) {
|
||||
VertexDecoder *dec = GetVertexDecoder(gstate.vertType);
|
||||
dec->SetVertexType(gstate.vertType);
|
||||
u32 newVertType = dec->InjectUVs(decoded2, Memory::GetPointer(gstate_c.vertexAddr), customUV, 16);
|
||||
|
||||
@@ -424,7 +424,7 @@ void *TextureCache::readIndexedTex(int level, u32 texaddr, int bytesPerIndex, GL
|
||||
tmpTexBuf16.resize(std::max(bufw, w) * h);
|
||||
tmpTexBufRearrange.resize(std::max(bufw, w) * h);
|
||||
const u16 *clut = GetCurrentClut<u16>();
|
||||
if (!(gstate.texmode & 1)) {
|
||||
if (!gstate.isTextureSwizzled()) {
|
||||
switch (bytesPerIndex) {
|
||||
case 1:
|
||||
DeIndexTexture<u8>(tmpTexBuf16.data(), texaddr, length, clut);
|
||||
@@ -464,7 +464,7 @@ void *TextureCache::readIndexedTex(int level, u32 texaddr, int bytesPerIndex, GL
|
||||
tmpTexBuf32.resize(std::max(bufw, w) * h);
|
||||
tmpTexBufRearrange.resize(std::max(bufw, w) * h);
|
||||
const u32 *clut = GetCurrentClut<u32>();
|
||||
if (!(gstate.texmode & 1)) {
|
||||
if (!gstate.isTextureSwizzled()) {
|
||||
switch (bytesPerIndex) {
|
||||
case 1:
|
||||
DeIndexTexture<u8>(tmpTexBuf32.data(), texaddr, length, clut);
|
||||
@@ -1285,7 +1285,7 @@ void *TextureCache::DecodeTextureLevel(GETextureFormat format, GEPaletteFormat c
|
||||
tmpTexBufRearrange.resize(std::max(bufw, w) * h);
|
||||
const u16 *clut = GetCurrentClut<u16>() + clutSharingOffset;
|
||||
texByteAlign = 2;
|
||||
if (!(gstate.texmode & 1)) {
|
||||
if (!gstate.isTextureSwizzled()) {
|
||||
if (clutAlphaLinear_ && mipmapShareClut) {
|
||||
DeIndexTexture4Optimal(tmpTexBuf16.data(), texaddr, bufw * h, clutAlphaLinearColor_);
|
||||
} else {
|
||||
@@ -1309,7 +1309,7 @@ void *TextureCache::DecodeTextureLevel(GETextureFormat format, GEPaletteFormat c
|
||||
tmpTexBuf32.resize(std::max(bufw, w) * h);
|
||||
tmpTexBufRearrange.resize(std::max(bufw, w) * h);
|
||||
const u32 *clut = GetCurrentClut<u32>() + clutSharingOffset;
|
||||
if (!(gstate.texmode & 1)) {
|
||||
if (!gstate.isTextureSwizzled()) {
|
||||
DeIndexTexture4(tmpTexBuf32.data(), texaddr, bufw * h, clut);
|
||||
finalBuf = tmpTexBuf32.data();
|
||||
} else {
|
||||
@@ -1366,7 +1366,7 @@ void *TextureCache::DecodeTextureLevel(GETextureFormat format, GEPaletteFormat c
|
||||
dstFmt = GL_UNSIGNED_SHORT_5_6_5;
|
||||
texByteAlign = 2;
|
||||
|
||||
if (!(gstate.texmode & 1)) {
|
||||
if (!gstate.isTextureSwizzled()) {
|
||||
int len = std::max(bufw, w) * h;
|
||||
tmpTexBuf16.resize(len);
|
||||
tmpTexBufRearrange.resize(len);
|
||||
@@ -1383,7 +1383,7 @@ void *TextureCache::DecodeTextureLevel(GETextureFormat format, GEPaletteFormat c
|
||||
if (bufw < 4)
|
||||
bufw = 4;
|
||||
dstFmt = GL_UNSIGNED_BYTE;
|
||||
if (!(gstate.texmode & 1)) {
|
||||
if (!gstate.isTextureSwizzled()) {
|
||||
// Special case: if we don't need to deal with packing, we don't need to copy.
|
||||
if (w == bufw) {
|
||||
finalBuf = Memory::GetPointer(texaddr);
|
||||
|
||||
@@ -60,7 +60,7 @@ void ComputeVertexShaderID(VertexShaderID *id, int prim, bool useHWTransform) {
|
||||
|
||||
bool hasColor = (vertType & GE_VTYPE_COL_MASK) != 0;
|
||||
bool hasNormal = (vertType & GE_VTYPE_NRM_MASK) != 0;
|
||||
bool hasBones = gstate.getWeightMask() != 0;
|
||||
bool hasBones = gstate.getWeightMask() != GE_VTYPE_WEIGHT_NONE;
|
||||
bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough() && !gstate.isModeClear();
|
||||
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
|
||||
|
||||
|
||||
@@ -289,6 +289,7 @@ struct GPUgstate
|
||||
int getClutIndexMask() const { return (clutformat >> 8) & 0xFF; }
|
||||
int getClutIndexStartPos() const { return ((clutformat >> 16) & 0x1F) << 4; }
|
||||
bool isClutIndexSimple() const { return (clutformat & ~3) == 0xC500FF00; } // Meaning, no special mask, shift, or start pos.
|
||||
bool isTextureSwizzled() const { return texmode & 1; }
|
||||
|
||||
// Lighting
|
||||
bool isLightingEnabled() const { return lightingEnable & 1; }
|
||||
@@ -353,6 +354,7 @@ struct GPUgstate
|
||||
int getWeightMask() const { return vertType & GE_VTYPE_WEIGHT_MASK; }
|
||||
int getNumBoneWeights() const { return 1 + ((vertType & GE_VTYPE_WEIGHTCOUNT_MASK) >> GE_VTYPE_WEIGHTCOUNT_SHIFT); }
|
||||
bool isSkinningEnabled() const { return ((vertType & GE_VTYPE_WEIGHT_MASK) != GE_VTYPE_WEIGHT_NONE); }
|
||||
int getTexCoordMask() const { return vertType & GE_VTYPE_TC_MASK; }
|
||||
|
||||
GEPatchPrimType getPatchPrimitiveType() const { return static_cast<GEPatchPrimType>(patchprimitive & 3); }
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ static inline int orient2dIncY(int dX01)
|
||||
|
||||
static inline int GetPixelDataOffset(unsigned int texel_size_bits, unsigned int row_pitch_bits, unsigned int u, unsigned int v)
|
||||
{
|
||||
if (!(gstate.texmode & 1))
|
||||
if (!gstate.isTextureSwizzled())
|
||||
return v * row_pitch_bits *texel_size_bits/8 / 8 + u * texel_size_bits / 8;
|
||||
|
||||
int tile_size_bits = 32;
|
||||
|
||||
Reference in new issue
Block a user