mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-14 16:29:21 +01:00
![Rodolfo Osvaldo Bogado](/assets/img/avatar_default.png)
Opengl: Reorder the rendering path to make it more generic, and a little bit faster i think. Reduce the index Buffer size to make it more Friendly to older video hardware. get rid of the remaining annoying sps (I hope). D3D: Implement the same path as opengl to make the plugins more similar and maintainable. Fixed Peek_Z this means, Pushing stars in SMG Now Works. Please give heavy testing to this changes and compare the performance with the old path. Thanks to hrydgard for let me participate :). git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4353 8ced0084-cf51-0410-be5f-012b33b47a6e
79 lines
2.6 KiB
C++
79 lines
2.6 KiB
C++
// Copyright (C) 2003 Dolphin Project.
|
|
|
|
// 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 "D3DBase.h"
|
|
#include "Render.h"
|
|
#include "FramebufferManager.h"
|
|
|
|
namespace FBManager
|
|
{
|
|
|
|
static LPDIRECT3DTEXTURE9 s_efb_color_texture;
|
|
static LPDIRECT3DSURFACE9 s_efb_color_surface;
|
|
static LPDIRECT3DSURFACE9 s_efb_depth_surface;
|
|
|
|
#undef CHECK
|
|
#define CHECK(hr) if (FAILED(hr)) { PanicAlert("FAIL: " __FUNCTION__); }
|
|
|
|
LPDIRECT3DSURFACE9 GetEFBColorRTSurface() { return s_efb_color_surface; }
|
|
LPDIRECT3DSURFACE9 GetEFBDepthRTSurface() { return s_efb_depth_surface; }
|
|
|
|
LPDIRECT3DTEXTURE9 GetEFBColorTexture(const EFBRectangle& sourceRc)
|
|
{
|
|
return s_efb_color_texture;
|
|
}
|
|
|
|
LPDIRECT3DTEXTURE9 GetEFBDepthTexture(const EFBRectangle &sourceRc)
|
|
{
|
|
// Depth textures not supported under DX9. We're gonna fake this
|
|
// with a secondary render target later.
|
|
return NULL;
|
|
}
|
|
|
|
void Create()
|
|
{
|
|
// Simplest possible setup to start with.
|
|
int target_width = Renderer::GetTargetWidth();
|
|
int target_height = Renderer::GetTargetHeight();
|
|
|
|
HRESULT hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
|
D3DPOOL_DEFAULT, &s_efb_color_texture, NULL);
|
|
CHECK(hr);
|
|
|
|
hr = s_efb_color_texture->GetSurfaceLevel(0, &s_efb_color_surface);
|
|
CHECK(hr);
|
|
|
|
//D3DFMT_D32F_LOCKABLE and D3DFMT_D16_LOCKABLE must be used to peek_z to work, 16 bits is a crapy z buffer and to allow
|
|
// to read directi as a float we need it to be float so using ...
|
|
hr = D3D::dev->CreateDepthStencilSurface(target_width, target_height, D3DFMT_D32F_LOCKABLE,
|
|
D3DMULTISAMPLE_NONE, 0, FALSE, &s_efb_depth_surface, NULL);
|
|
CHECK(hr);
|
|
}
|
|
|
|
void Destroy()
|
|
{
|
|
s_efb_depth_surface->Release();
|
|
s_efb_depth_surface = NULL;
|
|
|
|
s_efb_color_surface->Release();
|
|
s_efb_color_surface = NULL;
|
|
|
|
s_efb_color_texture->Release();
|
|
s_efb_color_texture = NULL;
|
|
}
|
|
|
|
} // namespace
|