mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
D3D: Fix bugs in the shader cache, fixes crashes on x64. added some debugging stuff (only active in debug builds). assorted code cleanup.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4145 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -16,6 +16,7 @@
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
#include "D3DBase.h"
|
||||
|
||||
@ -81,6 +82,8 @@ bool Init()
|
||||
collection = C_NOTHING;
|
||||
fakeVBuffer = new u8[MAXVBUFFERSIZE];
|
||||
fakeIBuffer = new u16[MAXIBUFFERSIZE];
|
||||
memset(fakeVBuffer, 0, MAXVBUFFERSIZE);
|
||||
memset(fakeIBuffer, 0, MAXIBUFFERSIZE * 2);
|
||||
CreateDeviceObjects();
|
||||
VertexManager::s_pCurBufferPointer = fakeVBuffer;
|
||||
return true;
|
||||
@ -143,9 +146,6 @@ void AddVertices(int _primitive, int _numVertices)
|
||||
//We are NOT collecting the right type.
|
||||
Flush();
|
||||
|
||||
// Copy the extra verts that we lost.
|
||||
memcpy(s_pCurBufferPointer, fakeVBuffer, _numVertices * g_nativeVertexFmt->GetVertexStride());
|
||||
|
||||
collection = type;
|
||||
u16 *ptr = 0;
|
||||
if (type != C_POINTS)
|
||||
@ -247,14 +247,23 @@ void Flush()
|
||||
if (collection != C_POINTS)
|
||||
{
|
||||
int numPrimitives = indexGen.GetNumPrims();
|
||||
D3D::dev->DrawIndexedPrimitiveUP(pts[(int)collection],
|
||||
0,
|
||||
numVertices,
|
||||
numPrimitives,
|
||||
fakeIBuffer,
|
||||
D3DFMT_INDEX16,
|
||||
fakeVBuffer,
|
||||
stride);
|
||||
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
||||
pts[(int)collection],
|
||||
0,
|
||||
numVertices,
|
||||
numPrimitives,
|
||||
fakeIBuffer,
|
||||
D3DFMT_INDEX16,
|
||||
fakeVBuffer,
|
||||
stride))) {
|
||||
#ifdef _DEBUG
|
||||
std::string error_shaders;
|
||||
error_shaders.append(VertexShaderCache::GetCurrentShaderCode());
|
||||
error_shaders.append(PixelShaderCache::GetCurrentShaderCode());
|
||||
File::WriteStringToFile(true, error_shaders, "bad_shader_combo.txt");
|
||||
PanicAlert("DrawIndexedPrimitiveUP failed. Shaders written to shaders.txt.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user