mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Prepare to unify SetTexture
This commit is contained in:
parent
aae2030a14
commit
e24e652b0d
8 changed files with 25 additions and 9 deletions
|
@ -184,6 +184,7 @@ public:
|
|||
void ClearNextFrame();
|
||||
|
||||
virtual void ForgetLastTexture() = 0;
|
||||
virtual void InvalidateLastTexture() = 0;
|
||||
virtual void Clear(bool delete_them);
|
||||
|
||||
// FramebufferManager keeps TextureCache updated about what regions of memory are being rendered to.
|
||||
|
|
|
@ -139,6 +139,10 @@ void TextureCacheD3D11::ForgetLastTexture() {
|
|||
context_->PSSetShaderResources(0, 1, &nullTex);
|
||||
}
|
||||
|
||||
void TextureCacheD3D11::InvalidateLastTexture() {
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
}
|
||||
|
||||
DXGI_FORMAT getClutDestFormatD3D11(GEPaletteFormat format) {
|
||||
switch (format) {
|
||||
case GE_CMODE_16BIT_ABGR4444:
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
bool DecodeTexture(u8 *output, const GPUgstate &state);
|
||||
|
||||
void ForgetLastTexture() override;
|
||||
void InvalidateLastTexture() override;
|
||||
|
||||
void SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key);
|
||||
|
||||
|
|
|
@ -107,6 +107,10 @@ void TextureCacheDX9::ForgetLastTexture() {
|
|||
gstate_c.Dirty(DIRTY_TEXTURE_PARAMS);
|
||||
}
|
||||
|
||||
void TextureCacheDX9::InvalidateLastTexture() {
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
}
|
||||
|
||||
D3DFORMAT getClutDestFormat(GEPaletteFormat format) {
|
||||
switch (format) {
|
||||
case GE_CMODE_16BIT_ABGR4444:
|
||||
|
@ -467,13 +471,13 @@ void TextureCacheDX9::SetTexture(bool force) {
|
|||
#ifdef DEBUG_TEXTURES
|
||||
if (SetDebugTexture()) {
|
||||
// A different texture was bound, let's rebind next time.
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
InvalidateLastTexture();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (force) {
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
InvalidateLastTexture();
|
||||
}
|
||||
|
||||
u8 level = 0;
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
bool DecodeTexture(u8 *output, const GPUgstate &state);
|
||||
|
||||
void ForgetLastTexture() override;
|
||||
void InvalidateLastTexture() override;
|
||||
|
||||
void SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight);
|
||||
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
#define GL_UNPACK_ROW_LENGTH 0x0CF2
|
||||
#endif
|
||||
|
||||
#define INVALID_TEX -1
|
||||
|
||||
#define TEXCACHE_NAME_CACHE_SIZE 16
|
||||
|
||||
TextureCacheGLES::TextureCacheGLES(Draw::DrawContext *draw)
|
||||
|
@ -541,13 +539,13 @@ void TextureCacheGLES::SetTexture(bool force) {
|
|||
#ifdef DEBUG_TEXTURES
|
||||
if (SetDebugTexture()) {
|
||||
// A different texture was bound, let's rebind next time.
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
InvalidateLastTexture();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (force) {
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
InvalidateLastTexture();
|
||||
}
|
||||
|
||||
u8 level = 0;
|
||||
|
@ -557,7 +555,6 @@ void TextureCacheGLES::SetTexture(bool force) {
|
|||
if (!Memory::IsValidAddress(texaddr)) {
|
||||
// Bind a null texture and return.
|
||||
Unbind();
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
return;
|
||||
}
|
||||
|
@ -768,7 +765,7 @@ bool TextureCacheGLES::HandleTextureChange(TexCacheEntry *const entry, const cha
|
|||
if (entry->textureName == lastBoundTexture) {
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
}
|
||||
glDeleteTextures(1, &entry->textureName);
|
||||
ReleaseTexture(entry);
|
||||
entry->status &= ~TexCacheEntry::STATUS_IS_SCALED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,9 +63,12 @@ public:
|
|||
}
|
||||
|
||||
void ForgetLastTexture() override {
|
||||
lastBoundTexture = -1;
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
gstate_c.Dirty(DIRTY_TEXTURE_PARAMS);
|
||||
}
|
||||
void InvalidateLastTexture() override {
|
||||
lastBoundTexture = INVALID_TEX;
|
||||
}
|
||||
|
||||
u32 AllocTextureName();
|
||||
|
||||
|
@ -102,6 +105,8 @@ private:
|
|||
DepalShaderCacheGLES *depalShaderCache_;
|
||||
ShaderManagerGLES *shaderManager_;
|
||||
DrawEngineGLES *drawEngine_;
|
||||
|
||||
enum { INVALID_TEX = -1 };
|
||||
};
|
||||
|
||||
GLenum getClutDestFormat(GEPaletteFormat format);
|
||||
|
|
|
@ -89,6 +89,9 @@ public:
|
|||
lastBoundTexture = nullptr;
|
||||
gstate_c.Dirty(DIRTY_TEXTURE_PARAMS);
|
||||
}
|
||||
void InvalidateLastTexture() override {
|
||||
lastBoundTexture = nullptr;
|
||||
}
|
||||
|
||||
void GetVulkanHandles(VkImageView &imageView, VkSampler &sampler) {
|
||||
imageView = imageView_;
|
||||
|
|
Loading…
Add table
Reference in a new issue