2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-08 05:25:12 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#include <d3dx9.h>
|
|
|
|
|
2009-09-01 11:14:58 +00:00
|
|
|
#include "Globals.h"
|
2008-12-08 05:25:12 +00:00
|
|
|
#include "Statistics.h"
|
2009-03-07 18:05:29 +00:00
|
|
|
#include "MemoryUtil.h"
|
2009-09-01 11:14:58 +00:00
|
|
|
#include "Hash.h"
|
|
|
|
|
|
|
|
#include "CommonPaths.h"
|
|
|
|
#include "FileUtil.h"
|
2008-12-08 05:25:12 +00:00
|
|
|
|
|
|
|
#include "D3DBase.h"
|
|
|
|
#include "D3DTexture.h"
|
2009-11-08 20:35:11 +00:00
|
|
|
#include "D3DUtil.h"
|
2009-09-13 17:46:33 +00:00
|
|
|
#include "FramebufferManager.h"
|
2009-11-08 20:35:11 +00:00
|
|
|
#include "PixelShaderCache.h"
|
|
|
|
#include "PixelShaderManager.h"
|
|
|
|
#include "VertexShaderManager.h"
|
|
|
|
#include "VertexShaderCache.h"
|
2008-12-08 05:25:12 +00:00
|
|
|
|
|
|
|
#include "Render.h"
|
|
|
|
|
|
|
|
#include "TextureDecoder.h"
|
|
|
|
#include "TextureCache.h"
|
2009-12-22 06:47:42 +00:00
|
|
|
#include "HiresTextures.h"
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
#include "TextureConverter.h"
|
2008-12-08 05:25:12 +00:00
|
|
|
|
2009-09-18 03:12:32 +00:00
|
|
|
#include "debugger/debugger.h"
|
|
|
|
|
2008-12-08 05:25:12 +00:00
|
|
|
extern int frameCount;
|
|
|
|
|
2010-10-19 22:24:27 +00:00
|
|
|
namespace DX9
|
2010-09-28 02:15:02 +00:00
|
|
|
{
|
|
|
|
|
2010-10-19 22:24:27 +00:00
|
|
|
TextureCache::TCacheEntry::~TCacheEntry()
|
2010-09-28 02:15:02 +00:00
|
|
|
{
|
2010-10-19 22:24:27 +00:00
|
|
|
texture->Release();
|
2010-09-28 02:15:02 +00:00
|
|
|
}
|
|
|
|
|
2010-10-19 22:24:27 +00:00
|
|
|
void TextureCache::TCacheEntry::Bind(unsigned int stage)
|
2009-11-14 17:50:51 +00:00
|
|
|
{
|
2010-10-19 22:24:27 +00:00
|
|
|
D3D::SetTexture(stage, texture);
|
2009-11-14 17:50:51 +00:00
|
|
|
}
|
|
|
|
|
2010-10-19 22:24:27 +00:00
|
|
|
bool TextureCache::TCacheEntry::Save(const char filename[])
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
{
|
2010-10-19 22:24:27 +00:00
|
|
|
return SUCCEEDED(PD3DXSaveTextureToFileA(filename, D3DXIFF_PNG, texture, 0));
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
}
|
|
|
|
|
2010-10-19 22:24:27 +00:00
|
|
|
void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
|
|
|
|
unsigned int expanded_width, unsigned int level)
|
2009-11-14 17:50:51 +00:00
|
|
|
{
|
2010-10-19 22:24:27 +00:00
|
|
|
D3D::ReplaceTexture2D(texture, temp, width, height, expanded_width, d3d_fmt, swap_r_b, level);
|
2009-11-14 17:50:51 +00:00
|
|
|
}
|
|
|
|
|
2010-10-19 22:24:27 +00:00
|
|
|
void TextureCache::TCacheEntry::FromRenderTarget(bool bFromZBuffer, bool bScaleByHalf,
|
|
|
|
unsigned int cbufid, const float *colmat, const EFBRectangle &source_rect,
|
|
|
|
bool bIsIntensityFmt, u32 copyfmt)
|
2009-12-07 18:48:31 +00:00
|
|
|
{
|
2010-10-19 22:24:27 +00:00
|
|
|
const LPDIRECT3DTEXTURE9 read_texture = bFromZBuffer ?
|
2010-10-22 19:40:05 +00:00
|
|
|
g_framebufferManager.GetEFBDepthTexture() :
|
|
|
|
g_framebufferManager.GetEFBColorTexture();
|
2009-12-07 18:48:31 +00:00
|
|
|
|
2010-10-19 22:24:27 +00:00
|
|
|
if (!isDynamic || g_ActiveConfig.bCopyEFBToTexture)
|
2010-04-14 13:57:16 +00:00
|
|
|
{
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
LPDIRECT3DSURFACE9 Rendersurf = NULL;
|
2010-10-19 22:24:27 +00:00
|
|
|
texture->GetSurfaceLevel(0, &Rendersurf);
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
D3D::dev->SetDepthStencilSurface(NULL);
|
|
|
|
D3D::dev->SetRenderTarget(0, Rendersurf);
|
|
|
|
|
|
|
|
D3DVIEWPORT9 vp;
|
|
|
|
|
|
|
|
// Stretch picture with increased internal resolution
|
|
|
|
vp.X = 0;
|
|
|
|
vp.Y = 0;
|
2010-10-20 00:39:45 +00:00
|
|
|
vp.Width = virtualW;
|
|
|
|
vp.Height = virtualH;
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
vp.MinZ = 0.0f;
|
|
|
|
vp.MaxZ = 1.0f;
|
|
|
|
D3D::dev->SetViewport(&vp);
|
|
|
|
RECT destrect;
|
2010-10-20 00:39:45 +00:00
|
|
|
destrect.bottom = virtualH;
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
destrect.left = 0;
|
2010-10-20 00:39:45 +00:00
|
|
|
destrect.right = virtualW;
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
destrect.top = 0;
|
|
|
|
|
2010-10-19 22:24:27 +00:00
|
|
|
const float* const fConstAdd = colmat + 16; // fConstAdd is the last 4 floats of colmat
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
PixelShaderManager::SetColorMatrix(colmat, fConstAdd); // set transformation
|
|
|
|
TargetRectangle targetSource = Renderer::ConvertEFBRectangle(source_rect);
|
|
|
|
RECT sourcerect;
|
|
|
|
sourcerect.bottom = targetSource.bottom;
|
|
|
|
sourcerect.left = targetSource.left;
|
|
|
|
sourcerect.right = targetSource.right;
|
|
|
|
sourcerect.top = targetSource.top;
|
|
|
|
|
2010-10-19 22:24:27 +00:00
|
|
|
if (bFromZBuffer)
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
{
|
2010-10-19 22:24:27 +00:00
|
|
|
if (bScaleByHalf || g_ActiveConfig.iMultisampleMode)
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
{
|
|
|
|
D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
|
|
|
|
D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
|
|
|
|
D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
|
|
|
|
D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
|
|
|
}
|
|
|
|
|
2010-09-28 02:15:02 +00:00
|
|
|
D3DFORMAT bformat = g_framebufferManager.GetEFBDepthRTSurfaceFormat();
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
int SSAAMode = g_ActiveConfig.iMultisampleMode;
|
2010-10-19 22:24:27 +00:00
|
|
|
|
|
|
|
D3D::drawShadedTexQuad(read_texture, &sourcerect,
|
|
|
|
Renderer::GetFullTargetWidth(), Renderer::GetFullTargetHeight(),
|
2010-10-20 00:39:45 +00:00
|
|
|
virtualW, virtualH,
|
2010-10-19 22:24:27 +00:00
|
|
|
((bformat != FOURCC_RAWZ && bformat != D3DFMT_D24X8) && bFromZBuffer) ?
|
|
|
|
PixelShaderCache::GetDepthMatrixProgram(SSAAMode) :
|
|
|
|
PixelShaderCache::GetColorMatrixProgram(SSAAMode),
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
VertexShaderCache::GetSimpleVertexShader(SSAAMode));
|
2010-10-19 22:24:27 +00:00
|
|
|
|
|
|
|
Rendersurf->Release();
|
2010-06-05 01:38:22 +00:00
|
|
|
}
|
2010-10-19 22:24:27 +00:00
|
|
|
|
|
|
|
if (!g_ActiveConfig.bCopyEFBToTexture)
|
2009-12-03 20:09:15 +00:00
|
|
|
{
|
2010-10-19 22:24:27 +00:00
|
|
|
hash = TextureConverter::EncodeToRamFromTexture(
|
|
|
|
addr,
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
read_texture,
|
|
|
|
Renderer::GetFullTargetWidth(),
|
|
|
|
Renderer::GetFullTargetHeight(),
|
2010-10-19 22:24:27 +00:00
|
|
|
Renderer::GetTargetScaleX(),
|
|
|
|
Renderer::GetTargetScaleY(),
|
ok, here goes a really experimental commit:
replace efb to ram implementation by a hybrid approach.
explanation:
when copying from efb to texture, instead of make a copy to a texture or to the ram, copy the data to both, in hi quality to the texture and in native quality to the ram.
then instead of re-decoding the data from ram (very slow) use the data in the texture.
to improve this even more, test if the cpu has modified the data in the ram copy, if so, update the texture in memory and mark it as dynamic to avoid redundant work in future frames.
having all this implemented this is what is archived:
sms: full quality with scaled efb copies and fully functional goop cleaning :)
ztp: efb to texture speed with full map support.
nsmbw: this is a hard to emulate game, as it make a lot of shading and texture modification in cpu. it only have 35 fps in my system with new efb to ram but is 10 fps faster than normal efb to ram.
this game also show me another unimplemented feature, copy efb to multiple textures at the same time (is used to animate coins and other things in the world).
this is a remaining todo in efb to texture.
a lot of games should improve, so please test and let me know any regresion caused by this commit.
if everyone likes this the next step is, implement efb to multilpe textures and merge efb to ram and efb to texture.
then port to the other plugins.
enjoy.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5846 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-07-06 22:27:13 +00:00
|
|
|
(float)((Renderer::GetFullTargetWidth() - Renderer::GetTargetWidth()) / 2),
|
|
|
|
(float)((Renderer::GetFullTargetHeight() - Renderer::GetTargetHeight()) / 2) ,
|
|
|
|
bFromZBuffer,
|
|
|
|
bIsIntensityFmt,
|
|
|
|
copyfmt,
|
|
|
|
bScaleByHalf,
|
|
|
|
source_rect);
|
2009-12-03 20:09:15 +00:00
|
|
|
}
|
2010-02-03 03:52:50 +00:00
|
|
|
|
2009-12-02 04:17:18 +00:00
|
|
|
D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER);
|
2009-12-03 20:09:15 +00:00
|
|
|
D3D::RefreshSamplerState(0, D3DSAMP_MAGFILTER);
|
2010-10-19 22:24:27 +00:00
|
|
|
D3D::SetTexture(0, NULL);
|
2010-09-28 02:15:02 +00:00
|
|
|
D3D::dev->SetRenderTarget(0, g_framebufferManager.GetEFBColorRTSurface());
|
|
|
|
D3D::dev->SetDepthStencilSurface(g_framebufferManager.GetEFBDepthRTSurface());
|
2010-10-19 22:24:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width, unsigned int height,
|
|
|
|
unsigned int expanded_width, unsigned int tex_levels, PC_TexFormat pcfmt)
|
|
|
|
{
|
|
|
|
D3DFORMAT d3d_fmt;
|
|
|
|
bool swap_r_b = false;
|
|
|
|
|
|
|
|
switch (pcfmt)
|
|
|
|
{
|
|
|
|
case PC_TEX_FMT_BGRA32:
|
|
|
|
d3d_fmt = D3DFMT_A8R8G8B8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PC_TEX_FMT_RGBA32:
|
|
|
|
d3d_fmt = D3DFMT_A8R8G8B8;
|
|
|
|
swap_r_b = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PC_TEX_FMT_RGB565:
|
|
|
|
d3d_fmt = D3DFMT_R5G6B5;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PC_TEX_FMT_IA4_AS_IA8:
|
|
|
|
d3d_fmt = D3DFMT_A8L8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PC_TEX_FMT_I8:
|
|
|
|
case PC_TEX_FMT_I4_AS_I8:
|
|
|
|
// A hack which means the format is a packed
|
|
|
|
// 8-bit intensity texture. It is unpacked
|
|
|
|
// to A8L8 in D3DTexture.cpp
|
|
|
|
d3d_fmt = D3DFMT_A8P8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PC_TEX_FMT_IA8:
|
|
|
|
d3d_fmt = D3DFMT_A8L8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PC_TEX_FMT_DXT1:
|
|
|
|
d3d_fmt = D3DFMT_DXT1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
TCacheEntry* entry = new TCacheEntry(D3D::CreateTexture2D(temp, width, height, expanded_width, d3d_fmt, swap_r_b, tex_levels));
|
|
|
|
entry->swap_r_b = swap_r_b;
|
|
|
|
entry->d3d_fmt = d3d_fmt;
|
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
TextureCache::TCacheEntryBase* TextureCache::CreateRenderTargetTexture(
|
|
|
|
unsigned int scaled_tex_w, unsigned int scaled_tex_h)
|
|
|
|
{
|
|
|
|
LPDIRECT3DTEXTURE9 texture;
|
|
|
|
D3D::dev->CreateTexture(scaled_tex_w, scaled_tex_h, 1, D3DUSAGE_RENDERTARGET,
|
|
|
|
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture, 0);
|
|
|
|
|
|
|
|
return new TCacheEntry(texture);
|
|
|
|
}
|
|
|
|
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|