mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 10:40:01 +01:00
d3d9: Specify tex stage for binding framebuf color.
This commit is contained in:
1 parent
718d7e291f
commit
4e50eed85b
7 files changed
+21
-13
No files matched your search
@@ -643,13 +643,13 @@ namespace DX9 {
|
||||
return offscreen;
|
||||
}
|
||||
|
||||
void FramebufferManagerDX9::BindFramebufferColor(VirtualFramebuffer *framebuffer, bool skipCopy) {
|
||||
void FramebufferManagerDX9::BindFramebufferColor(int stage, VirtualFramebuffer *framebuffer, bool skipCopy) {
|
||||
if (framebuffer == NULL) {
|
||||
framebuffer = currentRenderVfb_;
|
||||
}
|
||||
|
||||
if (!framebuffer->fbo || !useBufferedRendering_) {
|
||||
pD3Ddevice->SetTexture(0, nullptr);
|
||||
pD3Ddevice->SetTexture(stage, nullptr);
|
||||
gstate_c.skipDrawReason |= SKIPDRAW_BAD_FB_TEXTURE;
|
||||
return;
|
||||
}
|
||||
@@ -668,12 +668,12 @@ namespace DX9 {
|
||||
BlitFramebuffer(©Info, 0, 0, framebuffer, 0, 0, framebuffer->drawnWidth, framebuffer->drawnHeight, 0, false);
|
||||
|
||||
RebindFramebuffer();
|
||||
fbo_bind_color_as_texture(renderCopy, 0);
|
||||
pD3Ddevice->SetTexture(stage, fbo_get_color_texture(renderCopy));
|
||||
} else {
|
||||
fbo_bind_color_as_texture(framebuffer->fbo, 0);
|
||||
pD3Ddevice->SetTexture(stage, fbo_get_color_texture(framebuffer->fbo));
|
||||
}
|
||||
} else {
|
||||
fbo_bind_color_as_texture(framebuffer->fbo, 0);
|
||||
pD3Ddevice->SetTexture(stage, fbo_get_color_texture(framebuffer->fbo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
void BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFramebuffer *dst);
|
||||
|
||||
void BindFramebufferColor(VirtualFramebuffer *framebuffer, bool skipCopy);
|
||||
void BindFramebufferColor(int stage, VirtualFramebuffer *framebuffer, bool skipCopy);
|
||||
|
||||
virtual void ReadFramebufferToMemory(VirtualFramebuffer *vfb, bool sync, int x, int y, int w, int h) override;
|
||||
|
||||
|
||||
@@ -145,8 +145,7 @@ bool TransformDrawEngineDX9::ApplyShaderBlending() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Need a param to set stage 1.
|
||||
// framebufferManager_->BindFramebufferColor(NULL);
|
||||
framebufferManager_->BindFramebufferColor(1, nullptr, false);
|
||||
// If we are rendering at a higher resolution, linear is probably best for the dest color.
|
||||
pD3Ddevice->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
||||
pD3Ddevice->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
|
||||
|
||||
@@ -920,13 +920,18 @@ FBO *FramebufferManager::GetTempFBO(u16 w, u16 h, FBOColorDepth depth) {
|
||||
return fbo;
|
||||
}
|
||||
|
||||
void FramebufferManager::BindFramebufferColor(VirtualFramebuffer *framebuffer, bool skipCopy) {
|
||||
void FramebufferManager::BindFramebufferColor(int stage, VirtualFramebuffer *framebuffer, bool skipCopy) {
|
||||
if (framebuffer == NULL) {
|
||||
framebuffer = currentRenderVfb_;
|
||||
}
|
||||
|
||||
if (stage != GL_TEXTURE0) {
|
||||
glActiveTexture(stage);
|
||||
}
|
||||
|
||||
if (!framebuffer->fbo || !useBufferedRendering_) {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
gstate_c.skipDrawReason |= SKIPDRAW_BAD_FB_TEXTURE;
|
||||
return;
|
||||
}
|
||||
@@ -952,6 +957,10 @@ void FramebufferManager::BindFramebufferColor(VirtualFramebuffer *framebuffer, b
|
||||
} else {
|
||||
fbo_bind_color_as_texture(framebuffer->fbo, 0);
|
||||
}
|
||||
|
||||
if (stage != GL_TEXTURE1) {
|
||||
glActiveTexture(stage);
|
||||
}
|
||||
}
|
||||
|
||||
void FramebufferManager::CopyDisplayToOutput() {
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
void BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFramebuffer *dst);
|
||||
|
||||
// For use when texturing from a framebuffer. May create a duplicate if target.
|
||||
void BindFramebufferColor(VirtualFramebuffer *framebuffer, bool skipCopy = false);
|
||||
void BindFramebufferColor(int stage, VirtualFramebuffer *framebuffer, bool skipCopy = false);
|
||||
|
||||
// Reads a rectangular subregion of a framebuffer to the right position in its backing memory.
|
||||
virtual void ReadFramebufferToMemory(VirtualFramebuffer *vfb, bool sync, int x, int y, int w, int h) override;
|
||||
|
||||
@@ -187,8 +187,8 @@ bool TransformDrawEngine::ApplyShaderBlending() {
|
||||
return false;
|
||||
}
|
||||
|
||||
framebufferManager_->BindFramebufferColor(GL_TEXTURE1, NULL);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
framebufferManager_->BindFramebufferColor(NULL);
|
||||
// If we are rendering at a higher resolution, linear is probably best for the dest color.
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
@@ -1052,7 +1052,7 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry, VirtualFramebuffe
|
||||
glBindTexture(GL_TEXTURE_2D, clutTexture);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
framebufferManager_->BindFramebufferColor(framebuffer, true);
|
||||
framebufferManager_->BindFramebufferColor(GL_TEXTURE0, framebuffer, true);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
@@ -1087,7 +1087,7 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry, VirtualFramebuffe
|
||||
gstate_c.textureSimpleAlpha = alphaStatus == TexCacheEntry::STATUS_ALPHA_SIMPLE;
|
||||
} else {
|
||||
entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE;
|
||||
framebufferManager_->BindFramebufferColor(framebuffer);
|
||||
framebufferManager_->BindFramebufferColor(GL_TEXTURE0, framebuffer);
|
||||
|
||||
gstate_c.textureFullAlpha = framebuffer->drawnFormat == GE_FORMAT_565;
|
||||
gstate_c.textureSimpleAlpha = gstate_c.textureFullAlpha;
|
||||
|
||||
Reference in new issue
Block a user