mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-20 14:11:42 +00:00
Add a way to get to the current texture as well.
This commit is contained in:
parent
75f2995f25
commit
81e71dd8d7
@ -153,8 +153,13 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Similar to GetCurrentFramebuffer().
|
||||
virtual bool GetCurrentTexture(GPUDebugBuffer &buffer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// cached framebuffers / textures / vertices?
|
||||
// get content of framebuffer / texture
|
||||
// get content of specific framebuffer / texture?
|
||||
// vertex / texture decoding?
|
||||
};
|
@ -1515,7 +1515,28 @@ void GLES_GPU::DoState(PointerWrap &p) {
|
||||
framebufferManager_.DestroyAllFBOs();
|
||||
}
|
||||
|
||||
bool GLES_GPU::GetCurrentFramebuffer(GPUDebugBuffer &buffer)
|
||||
{
|
||||
bool GLES_GPU::GetCurrentFramebuffer(GPUDebugBuffer &buffer) {
|
||||
return framebufferManager_.GetCurrentFramebuffer(buffer);
|
||||
}
|
||||
|
||||
bool GLES_GPU::GetCurrentTexture(GPUDebugBuffer &buffer) {
|
||||
if (!gstate.isTextureMapEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef USING_GLES2
|
||||
textureCache_.SetTexture(true);
|
||||
int w = gstate.getTextureWidth(0);
|
||||
int h = gstate.getTextureHeight(0);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
|
||||
|
||||
buffer.Allocate(w, h, GE_FORMAT_8888, false);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer.GetData());
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
@ -67,6 +67,7 @@ public:
|
||||
std::vector<FramebufferInfo> GetFramebufferList();
|
||||
|
||||
bool GetCurrentFramebuffer(GPUDebugBuffer &buffer);
|
||||
bool GetCurrentTexture(GPUDebugBuffer &buffer);
|
||||
|
||||
protected:
|
||||
virtual void FastRunLoop(DisplayList &list);
|
||||
|
@ -780,7 +780,7 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry)
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCache::SetTexture() {
|
||||
void TextureCache::SetTexture(bool force) {
|
||||
#ifdef DEBUG_TEXTURES
|
||||
if (SetDebugTexture()) {
|
||||
// A different texture was bound, let's rebind next time.
|
||||
@ -789,6 +789,10 @@ void TextureCache::SetTexture() {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (force) {
|
||||
lastBoundTexture = -1;
|
||||
}
|
||||
|
||||
u32 texaddr = gstate.getTextureAddress(0);
|
||||
if (!Memory::IsValidAddress(texaddr)) {
|
||||
// Bind a null texture and return.
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
TextureCache();
|
||||
~TextureCache();
|
||||
|
||||
void SetTexture();
|
||||
void SetTexture(bool force = false);
|
||||
|
||||
void Clear(bool delete_them);
|
||||
void StartFrame();
|
||||
|
@ -365,7 +365,7 @@ void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer) {
|
||||
|
||||
case GE_CMD_FRAMEBUFWIDTH:
|
||||
{
|
||||
sprintf(buffer, "FramebufWidth: %i", data);
|
||||
sprintf(buffer, "FramebufWidth: %x, address high %02x", data & 0xFFFF, data >> 16);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -74,6 +74,10 @@ public:
|
||||
}
|
||||
|
||||
virtual bool GetCurrentFramebuffer(GPUDebugBuffer &buffer);
|
||||
bool GetCurrentTexture(GPUDebugBuffer &buffer) {
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void FastRunLoop(DisplayList &list);
|
||||
|
Loading…
x
Reference in New Issue
Block a user