Some stuff which was still lying around on my hard disk:
- Add a sanity check in CRenderFrame::MSWWindowProc. Possibly reduces the risk of a crash when starting a game and immediately closing the emulation window when using the DX9 plugin. - DX11: Add the resource usage as a parameter to CreateQuadVertexBuffer, possibly to be used in the future. - reduce the size of the EFB access buffers from 4x4 to 1x1 since they needn't be bigger anymore - some fixes to the recent hires commit. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6256 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
4907e6b6d2
commit
9ffc071e34
|
@ -218,6 +218,12 @@ WXLRESULT CRenderFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPa
|
||||||
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_CLOSE:
|
||||||
|
// Let Core finish initializing before accepting any WM_CLOSE messages
|
||||||
|
if (Core::GetState() == Core::CORE_UNINITIALIZED) break;
|
||||||
|
// Use default action otherwise
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// By default let wxWidgets do what it normally does with this event
|
// By default let wxWidgets do what it normally does with this event
|
||||||
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
|
|
|
@ -391,15 +391,29 @@ int CD3DFont::DrawTextScaled(float x, float y, float size, float spacing, u32 dw
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ID3D11Buffer* CreateQuadVertexBuffer(unsigned int size, void* data)
|
ID3D11Buffer* CreateQuadVertexBuffer(unsigned int size, void* data, D3D11_USAGE usage = D3D11_USAGE_DYNAMIC)
|
||||||
{
|
{
|
||||||
ID3D11Buffer* vb;
|
ID3D11Buffer* vb;
|
||||||
D3D11_BUFFER_DESC vbdesc;
|
D3D11_BUFFER_DESC vbdesc;
|
||||||
vbdesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
vbdesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||||
vbdesc.ByteWidth = size;
|
vbdesc.ByteWidth = size;
|
||||||
vbdesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
|
||||||
vbdesc.MiscFlags = 0;
|
vbdesc.MiscFlags = 0;
|
||||||
vbdesc.Usage = D3D11_USAGE_DYNAMIC;
|
vbdesc.Usage = usage;
|
||||||
|
switch (usage)
|
||||||
|
{
|
||||||
|
case D3D11_USAGE_DEFAULT:
|
||||||
|
case D3D11_USAGE_IMMUTABLE:
|
||||||
|
vbdesc.CPUAccessFlags = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case D3D11_USAGE_DYNAMIC:
|
||||||
|
vbdesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case D3D11_USAGE_STAGING:
|
||||||
|
vbdesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE|D3D11_CPU_ACCESS_READ;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
D3D11_SUBRESOURCE_DATA bufdata;
|
D3D11_SUBRESOURCE_DATA bufdata;
|
||||||
|
|
|
@ -65,7 +65,7 @@ void FramebufferManager::Create()
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.depth_tex->GetSRV(), "EFB depth texture shader resource view");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.depth_tex->GetSRV(), "EFB depth texture shader resource view");
|
||||||
|
|
||||||
// render target for depth buffer access in Renderer::AccessEFB
|
// render target for depth buffer access in Renderer::AccessEFB
|
||||||
texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R32_FLOAT, 4, 4, 1, 1, D3D11_BIND_RENDER_TARGET);
|
texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R32_FLOAT, 1, 1, 1, 1, D3D11_BIND_RENDER_TARGET);
|
||||||
hr = D3D::device->CreateTexture2D(&texdesc, NULL, &buf);
|
hr = D3D::device->CreateTexture2D(&texdesc, NULL, &buf);
|
||||||
CHECK(hr==S_OK, "create EFB depth read texture (hr=%#x)", hr);
|
CHECK(hr==S_OK, "create EFB depth read texture (hr=%#x)", hr);
|
||||||
m_efb.depth_read_texture = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET);
|
m_efb.depth_read_texture = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET);
|
||||||
|
@ -74,7 +74,7 @@ void FramebufferManager::Create()
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.depth_read_texture->GetRTV(), "EFB depth read texture render target view (used in Renderer::AccessEFB)");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.depth_read_texture->GetRTV(), "EFB depth read texture render target view (used in Renderer::AccessEFB)");
|
||||||
|
|
||||||
// staging texture to which we copy the data from m_efb.depth_read_texture
|
// staging texture to which we copy the data from m_efb.depth_read_texture
|
||||||
texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R32_FLOAT, 4, 4, 1, 1, 0, D3D11_USAGE_STAGING, D3D11_CPU_ACCESS_READ|D3D11_CPU_ACCESS_WRITE);
|
texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R32_FLOAT, 1, 1, 1, 1, 0, D3D11_USAGE_STAGING, D3D11_CPU_ACCESS_READ|D3D11_CPU_ACCESS_WRITE);
|
||||||
hr = D3D::device->CreateTexture2D(&texdesc, NULL, &m_efb.depth_staging_buf);
|
hr = D3D::device->CreateTexture2D(&texdesc, NULL, &m_efb.depth_staging_buf);
|
||||||
CHECK(hr==S_OK, "create EFB depth staging buffer (hr=%#x)", hr);
|
CHECK(hr==S_OK, "create EFB depth staging buffer (hr=%#x)", hr);
|
||||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.depth_staging_buf, "EFB depth staging texture (used for Renderer::AccessEFB)");
|
D3D::SetDebugObjectName((ID3D11DeviceChild*)m_efb.depth_staging_buf, "EFB depth staging texture (used for Renderer::AccessEFB)");
|
||||||
|
|
|
@ -291,18 +291,16 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||||
{
|
{
|
||||||
// Load Custom textures
|
// Load Custom textures
|
||||||
char texPathTemp[MAX_PATH];
|
char texPathTemp[MAX_PATH];
|
||||||
int oldWidth = width;
|
int newWidth = width;
|
||||||
int oldHeight = height;
|
int newHeight = height;
|
||||||
|
|
||||||
sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, texHash, tex_format);
|
sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, texHash, tex_format);
|
||||||
pcfmt = HiresTextures::GetHiresTex(texPathTemp, &width, &height, tex_format, temp);
|
pcfmt = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, tex_format, temp);
|
||||||
|
|
||||||
if (pcfmt != PC_TEX_FMT_NONE)
|
if (pcfmt != PC_TEX_FMT_NONE)
|
||||||
{
|
{
|
||||||
expandedWidth = width;
|
expandedWidth = width = newWidth;
|
||||||
expandedHeight = height;
|
expandedHeight = height = newHeight;
|
||||||
entry.Realw = oldWidth;
|
|
||||||
entry.Realh = oldHeight;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,6 +392,8 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||||
entry.frameCount = frameCount;
|
entry.frameCount = frameCount;
|
||||||
entry.w = width;
|
entry.w = width;
|
||||||
entry.h = height;
|
entry.h = height;
|
||||||
|
entry.Scaledw = width;
|
||||||
|
entry.Scaledh = height;
|
||||||
entry.fmt = FullFormat;
|
entry.fmt = FullFormat;
|
||||||
|
|
||||||
if (g_ActiveConfig.bDumpTextures)
|
if (g_ActiveConfig.bDumpTextures)
|
||||||
|
|
|
@ -382,18 +382,16 @@ TextureCache::TCacheEntry* TextureCache::Load(int texstage, u32 address, int wid
|
||||||
// Load Custom textures
|
// Load Custom textures
|
||||||
char texPathTemp[MAX_PATH];
|
char texPathTemp[MAX_PATH];
|
||||||
|
|
||||||
int oldWidth = width;
|
int newWidth = width;
|
||||||
int oldHeight = height;
|
int newHeight = height;
|
||||||
|
|
||||||
sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, (unsigned int) texHash, tex_format);
|
sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, (unsigned int) texHash, tex_format);
|
||||||
pcfmt = HiresTextures::GetHiresTex(texPathTemp, &width, &height, tex_format, temp);
|
pcfmt = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, tex_format, temp);
|
||||||
|
|
||||||
if (pcfmt != PC_TEX_FMT_NONE)
|
if (pcfmt != PC_TEX_FMT_NONE)
|
||||||
{
|
{
|
||||||
expandedWidth = width;
|
expandedWidth = width = newWidth;
|
||||||
expandedHeight = height;
|
expandedHeight = height = newHeight;
|
||||||
entry.Realw = oldWidth;
|
|
||||||
entry.Realh = oldHeight;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue