mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 09:35:35 +00:00
Fix Windows build, try 1.
This commit is contained in:
parent
364a5093d9
commit
24ab51f9f6
@ -41,9 +41,9 @@ namespace DX11
|
||||
|
||||
PixelShaderCache::PSCache PixelShaderCache::PixelShaders;
|
||||
const PixelShaderCache::PSCacheEntry* PixelShaderCache::last_entry;
|
||||
PIXELSHADERUID PixelShaderCache::last_uid;
|
||||
PixelShaderUid PixelShaderCache::last_uid;
|
||||
|
||||
LinearDiskCache<PIXELSHADERUID, u8> g_ps_disk_cache;
|
||||
LinearDiskCache<PixelShaderUid, u8> g_ps_disk_cache;
|
||||
|
||||
ID3D11PixelShader* s_ColorMatrixProgram[2] = {NULL};
|
||||
ID3D11PixelShader* s_ColorCopyProgram[2] = {NULL};
|
||||
@ -363,10 +363,10 @@ ID3D11Buffer* &PixelShaderCache::GetConstantBuffer()
|
||||
}
|
||||
|
||||
// this class will load the precompiled shaders into our cache
|
||||
class PixelShaderCacheInserter : public LinearDiskCacheReader<PIXELSHADERUID, u8>
|
||||
class PixelShaderCacheInserter : public LinearDiskCacheReader<PixelShaderUid, u8>
|
||||
{
|
||||
public:
|
||||
void Read(const PIXELSHADERUID &key, const u8 *value, u32 value_size)
|
||||
void Read(const PixelShaderUid &key, const u8 *value, u32 value_size)
|
||||
{
|
||||
PixelShaderCache::InsertByteCode(key, value, value_size);
|
||||
}
|
||||
@ -461,8 +461,8 @@ void PixelShaderCache::Shutdown()
|
||||
|
||||
bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
{
|
||||
PIXELSHADERUID uid;
|
||||
GetPixelShaderId(&uid, dstAlphaMode, components);
|
||||
PixelShaderUid uid;
|
||||
GetPixelShaderUid(uid, dstAlphaMode, components);
|
||||
|
||||
// Check if the shader is already set
|
||||
if (last_entry)
|
||||
@ -470,7 +470,6 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
if (uid == last_uid)
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true);
|
||||
ValidatePixelShaderIDs(API_D3D11, last_entry->safe_uid, last_entry->code, dstAlphaMode, components);
|
||||
return (last_entry->shader != NULL);
|
||||
}
|
||||
}
|
||||
@ -486,15 +485,15 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
last_entry = &entry;
|
||||
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true);
|
||||
ValidatePixelShaderIDs(API_D3D11, entry.safe_uid, entry.code, dstAlphaMode, components);
|
||||
return (entry.shader != NULL);
|
||||
}
|
||||
|
||||
// Need to compile a new shader
|
||||
const char* code = GeneratePixelShaderCode(dstAlphaMode, API_D3D11, components);
|
||||
PixelShaderCode code;
|
||||
GeneratePixelShaderCode(code, dstAlphaMode, API_D3D11, components);
|
||||
|
||||
D3DBlob* pbytecode;
|
||||
if (!D3D::CompilePixelShader(code, (unsigned int)strlen(code), &pbytecode))
|
||||
if (!D3D::CompilePixelShader(code.GetBuffer(), (unsigned int)strlen(code.GetBuffer()), &pbytecode))
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true);
|
||||
return false;
|
||||
@ -508,7 +507,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
|
||||
if (g_ActiveConfig.bEnableShaderDebugging && success)
|
||||
{
|
||||
PixelShaders[uid].code = code;
|
||||
PixelShaders[uid].code = code.GetBuffer();
|
||||
GetSafePixelShaderId(&PixelShaders[uid].safe_uid, dstAlphaMode, components);
|
||||
}
|
||||
|
||||
@ -516,7 +515,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
return success;
|
||||
}
|
||||
|
||||
bool PixelShaderCache::InsertByteCode(const PIXELSHADERUID &uid, const void* bytecode, unsigned int bytecodelen)
|
||||
bool PixelShaderCache::InsertByteCode(const PixelShaderUid &uid, const void* bytecode, unsigned int bytecodelen)
|
||||
{
|
||||
ID3D11PixelShader* shader = D3D::CreatePixelShaderFromByteCode(bytecode, bytecodelen);
|
||||
if (shader == NULL)
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
static void Clear();
|
||||
static void Shutdown();
|
||||
static bool SetShader(DSTALPHA_MODE dstAlphaMode, u32 components); // TODO: Should be renamed to LoadShader
|
||||
static bool InsertByteCode(const PIXELSHADERUID &uid, const void* bytecode, unsigned int bytecodelen);
|
||||
static bool InsertByteCode(const PixelShaderUid &uid, const void* bytecode, unsigned int bytecodelen);
|
||||
|
||||
static ID3D11PixelShader* GetActiveShader() { return last_entry->shader; }
|
||||
static ID3D11Buffer* &GetConstantBuffer();
|
||||
@ -54,18 +54,17 @@ private:
|
||||
{
|
||||
ID3D11PixelShader* shader;
|
||||
|
||||
PIXELSHADERUIDSAFE safe_uid;
|
||||
std::string code;
|
||||
|
||||
PSCacheEntry() : shader(NULL) {}
|
||||
void Destroy() { SAFE_RELEASE(shader); }
|
||||
};
|
||||
|
||||
typedef std::map<PIXELSHADERUID, PSCacheEntry> PSCache;
|
||||
typedef std::map<PixelShaderUid, PSCacheEntry> PSCache;
|
||||
|
||||
static PSCache PixelShaders;
|
||||
static const PSCacheEntry* last_entry;
|
||||
static PIXELSHADERUID last_uid;
|
||||
static PixelShaderUid last_uid;
|
||||
};
|
||||
|
||||
} // namespace DX11
|
||||
|
@ -37,14 +37,14 @@ namespace DX11 {
|
||||
|
||||
VertexShaderCache::VSCache VertexShaderCache::vshaders;
|
||||
const VertexShaderCache::VSCacheEntry *VertexShaderCache::last_entry;
|
||||
VERTEXSHADERUID VertexShaderCache::last_uid;
|
||||
VertexShaderUid VertexShaderCache::last_uid;
|
||||
|
||||
static ID3D11VertexShader* SimpleVertexShader = NULL;
|
||||
static ID3D11VertexShader* ClearVertexShader = NULL;
|
||||
static ID3D11InputLayout* SimpleLayout = NULL;
|
||||
static ID3D11InputLayout* ClearLayout = NULL;
|
||||
|
||||
LinearDiskCache<VERTEXSHADERUID, u8> g_vs_disk_cache;
|
||||
LinearDiskCache<VertexShaderUid, u8> g_vs_disk_cache;
|
||||
|
||||
ID3D11VertexShader* VertexShaderCache::GetSimpleVertexShader() { return SimpleVertexShader; }
|
||||
ID3D11VertexShader* VertexShaderCache::GetClearVertexShader() { return ClearVertexShader; }
|
||||
@ -68,10 +68,10 @@ ID3D11Buffer* &VertexShaderCache::GetConstantBuffer()
|
||||
}
|
||||
|
||||
// this class will load the precompiled shaders into our cache
|
||||
class VertexShaderCacheInserter : public LinearDiskCacheReader<VERTEXSHADERUID, u8>
|
||||
class VertexShaderCacheInserter : public LinearDiskCacheReader<VertexShaderUid, u8>
|
||||
{
|
||||
public:
|
||||
void Read(const VERTEXSHADERUID &key, const u8 *value, u32 value_size)
|
||||
void Read(const VertexShaderUid &key, const u8 *value, u32 value_size)
|
||||
{
|
||||
D3DBlob* blob = new D3DBlob(value_size, value);
|
||||
VertexShaderCache::InsertByteCode(key, blob);
|
||||
@ -208,14 +208,13 @@ void VertexShaderCache::Shutdown()
|
||||
|
||||
bool VertexShaderCache::SetShader(u32 components)
|
||||
{
|
||||
VERTEXSHADERUID uid;
|
||||
GetVertexShaderId(&uid, components);
|
||||
VertexShaderUid uid;
|
||||
GetVertexShaderUid(uid, components, API_D3D11);
|
||||
if (last_entry)
|
||||
{
|
||||
if (uid == last_uid)
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
|
||||
ValidateVertexShaderIDs(API_D3D11, last_entry->safe_uid, last_entry->code, components);
|
||||
return (last_entry->shader != NULL);
|
||||
}
|
||||
}
|
||||
@ -229,14 +228,14 @@ bool VertexShaderCache::SetShader(u32 components)
|
||||
last_entry = &entry;
|
||||
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
|
||||
ValidateVertexShaderIDs(API_D3D11, entry.safe_uid, entry.code, components);
|
||||
return (entry.shader != NULL);
|
||||
}
|
||||
|
||||
const char *code = GenerateVertexShaderCode(components, API_D3D11);
|
||||
VertexShaderCode code;
|
||||
GenerateVertexShaderCode(code, components, API_D3D11);
|
||||
|
||||
D3DBlob* pbytecode = NULL;
|
||||
D3D::CompileVertexShader(code, (int)strlen(code), &pbytecode);
|
||||
D3D::CompileVertexShader(code.GetBuffer(), (int)strlen(code.GetBuffer()), &pbytecode);
|
||||
|
||||
if (pbytecode == NULL)
|
||||
{
|
||||
@ -250,15 +249,14 @@ bool VertexShaderCache::SetShader(u32 components)
|
||||
|
||||
if (g_ActiveConfig.bEnableShaderDebugging && success)
|
||||
{
|
||||
vshaders[uid].code = code;
|
||||
GetSafeVertexShaderId(&vshaders[uid].safe_uid, components);
|
||||
vshaders[uid].code = code.GetBuffer();
|
||||
}
|
||||
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
|
||||
return success;
|
||||
}
|
||||
|
||||
bool VertexShaderCache::InsertByteCode(const VERTEXSHADERUID &uid, D3DBlob* bcodeblob)
|
||||
bool VertexShaderCache::InsertByteCode(const VertexShaderUid &uid, D3DBlob* bcodeblob)
|
||||
{
|
||||
ID3D11VertexShader* shader = D3D::CreateVertexShaderFromByteCode(bcodeblob);
|
||||
if (shader == NULL)
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
static ID3D11InputLayout* GetSimpleInputLayout();
|
||||
static ID3D11InputLayout* GetClearInputLayout();
|
||||
|
||||
static bool VertexShaderCache::InsertByteCode(const VERTEXSHADERUID &uid, D3DBlob* bcodeblob);
|
||||
static bool VertexShaderCache::InsertByteCode(const VertexShaderUid &uid, D3DBlob* bcodeblob);
|
||||
|
||||
private:
|
||||
struct VSCacheEntry
|
||||
@ -52,7 +52,6 @@ private:
|
||||
ID3D11VertexShader* shader;
|
||||
D3DBlob* bytecode; // needed to initialize the input layout
|
||||
|
||||
VERTEXSHADERUIDSAFE safe_uid;
|
||||
std::string code;
|
||||
|
||||
VSCacheEntry() : shader(NULL), bytecode(NULL) {}
|
||||
@ -68,11 +67,11 @@ private:
|
||||
SAFE_RELEASE(bytecode);
|
||||
}
|
||||
};
|
||||
typedef std::map<VERTEXSHADERUID, VSCacheEntry> VSCache;
|
||||
typedef std::map<VertexShaderUid, VSCacheEntry> VSCache;
|
||||
|
||||
static VSCache vshaders;
|
||||
static const VSCacheEntry* last_entry;
|
||||
static VERTEXSHADERUID last_uid;
|
||||
static VertexShaderUid last_uid;
|
||||
};
|
||||
|
||||
} // namespace DX11
|
||||
|
@ -43,9 +43,9 @@ namespace DX9
|
||||
|
||||
PixelShaderCache::PSCache PixelShaderCache::PixelShaders;
|
||||
const PixelShaderCache::PSCacheEntry *PixelShaderCache::last_entry;
|
||||
PIXELSHADERUID PixelShaderCache::last_uid;
|
||||
PixelShaderUid PixelShaderCache::last_uid;
|
||||
|
||||
static LinearDiskCache<PIXELSHADERUID, u8> g_ps_disk_cache;
|
||||
static LinearDiskCache<PixelShaderUid, u8> g_ps_disk_cache;
|
||||
static std::set<u32> unique_shaders;
|
||||
|
||||
#define MAX_SSAA_SHADERS 3
|
||||
@ -67,10 +67,10 @@ static LPDIRECT3DPIXELSHADER9 s_ClearProgram = NULL;
|
||||
static LPDIRECT3DPIXELSHADER9 s_rgba6_to_rgb8 = NULL;
|
||||
static LPDIRECT3DPIXELSHADER9 s_rgb8_to_rgba6 = NULL;
|
||||
|
||||
class PixelShaderCacheInserter : public LinearDiskCacheReader<PIXELSHADERUID, u8>
|
||||
class PixelShaderCacheInserter : public LinearDiskCacheReader<PixelShaderUid, u8>
|
||||
{
|
||||
public:
|
||||
void Read(const PIXELSHADERUID &key, const u8 *value, u32 value_size)
|
||||
void Read(const PixelShaderUid &key, const u8 *value, u32 value_size)
|
||||
{
|
||||
PixelShaderCache::InsertByteCode(key, value, value_size, false);
|
||||
}
|
||||
@ -333,8 +333,8 @@ void PixelShaderCache::Shutdown()
|
||||
bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
{
|
||||
const API_TYPE api = ((D3D::GetCaps().PixelShaderVersion >> 8) & 0xFF) < 3 ? API_D3D9_SM20 : API_D3D9_SM30;
|
||||
PIXELSHADERUID uid;
|
||||
GetPixelShaderId(&uid, dstAlphaMode, components);
|
||||
PixelShaderUid uid;
|
||||
GetPixelShaderUid(uid, dstAlphaMode, components);
|
||||
|
||||
// Check if the shader is already set
|
||||
if (last_entry)
|
||||
@ -342,7 +342,6 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
if (uid == last_uid)
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
|
||||
ValidatePixelShaderIDs(api, last_entry->safe_uid, last_entry->code, dstAlphaMode, components);
|
||||
return last_entry->shader != NULL;
|
||||
}
|
||||
}
|
||||
@ -359,34 +358,34 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
|
||||
if (entry.shader) D3D::SetPixelShader(entry.shader);
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
|
||||
ValidatePixelShaderIDs(api, entry.safe_uid, entry.code, dstAlphaMode, components);
|
||||
return (entry.shader != NULL);
|
||||
}
|
||||
|
||||
|
||||
// Need to compile a new shader
|
||||
const char *code = GeneratePixelShaderCode(dstAlphaMode, api, components);
|
||||
PixelShaderCode code;
|
||||
GeneratePixelShaderCode(code, dstAlphaMode, api, components);
|
||||
|
||||
if (g_ActiveConfig.bEnableShaderDebugging)
|
||||
{
|
||||
u32 code_hash = HashAdler32((const u8 *)code, strlen(code));
|
||||
u32 code_hash = HashAdler32((const u8 *)code.GetBuffer(), strlen(code.GetBuffer()));
|
||||
unique_shaders.insert(code_hash);
|
||||
SETSTAT(stats.numUniquePixelShaders, unique_shaders.size());
|
||||
}
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) {
|
||||
if (g_ActiveConfig.iLog & CONF_SAVESHADERS) {
|
||||
static int counter = 0;
|
||||
char szTemp[MAX_PATH];
|
||||
sprintf(szTemp, "%sps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++);
|
||||
|
||||
SaveData(szTemp, code);
|
||||
SaveData(szTemp, code.GetBuffer());
|
||||
}
|
||||
#endif
|
||||
|
||||
u8 *bytecode = 0;
|
||||
int bytecodelen = 0;
|
||||
if (!D3D::CompilePixelShader(code, (int)strlen(code), &bytecode, &bytecodelen)) {
|
||||
if (!D3D::CompilePixelShader(code.GetBuffer(), (int)strlen(code.GetBuffer()), &bytecode, &bytecodelen)) {
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true);
|
||||
return false;
|
||||
}
|
||||
@ -400,15 +399,14 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
|
||||
if (g_ActiveConfig.bEnableShaderDebugging && success)
|
||||
{
|
||||
PixelShaders[uid].code = code;
|
||||
GetSafePixelShaderId(&PixelShaders[uid].safe_uid, dstAlphaMode, components);
|
||||
PixelShaders[uid].code = code.GetBuffer();
|
||||
}
|
||||
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
|
||||
return success;
|
||||
}
|
||||
|
||||
bool PixelShaderCache::InsertByteCode(const PIXELSHADERUID &uid, const u8 *bytecode, int bytecodelen, bool activate)
|
||||
bool PixelShaderCache::InsertByteCode(const PixelShaderUid &uid, const u8 *bytecode, int bytecodelen, bool activate)
|
||||
{
|
||||
LPDIRECT3DPIXELSHADER9 shader = D3D::CreatePixelShaderFromByteCode(bytecode, bytecodelen);
|
||||
|
||||
|
@ -41,7 +41,6 @@ private:
|
||||
LPDIRECT3DPIXELSHADER9 shader;
|
||||
bool owns_shader;
|
||||
|
||||
PIXELSHADERUIDSAFE safe_uid;
|
||||
std::string code;
|
||||
|
||||
PSCacheEntry() : shader(NULL), owns_shader(true) {}
|
||||
@ -53,18 +52,18 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<PIXELSHADERUID, PSCacheEntry> PSCache;
|
||||
typedef std::map<PixelShaderUid, PSCacheEntry> PSCache;
|
||||
|
||||
static PSCache PixelShaders;
|
||||
static const PSCacheEntry *last_entry;
|
||||
static PIXELSHADERUID last_uid;
|
||||
static PixelShaderUid last_uid;
|
||||
static void Clear();
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
static bool SetShader(DSTALPHA_MODE dstAlphaMode, u32 componets);
|
||||
static bool InsertByteCode(const PIXELSHADERUID &uid, const u8 *bytecode, int bytecodelen, bool activate);
|
||||
static bool InsertByteCode(const PixelShaderUid &uid, const u8 *bytecode, int bytecodelen, bool activate);
|
||||
static LPDIRECT3DPIXELSHADER9 GetColorMatrixProgram(int SSAAMode);
|
||||
static LPDIRECT3DPIXELSHADER9 GetColorCopyProgram(int SSAAMode);
|
||||
static LPDIRECT3DPIXELSHADER9 GetDepthMatrixProgram(int SSAAMode, bool depthConversion);
|
||||
|
@ -38,14 +38,14 @@ namespace DX9
|
||||
|
||||
VertexShaderCache::VSCache VertexShaderCache::vshaders;
|
||||
const VertexShaderCache::VSCacheEntry *VertexShaderCache::last_entry;
|
||||
VERTEXSHADERUID VertexShaderCache::last_uid;
|
||||
VertexShaderUid VertexShaderCache::last_uid;
|
||||
|
||||
#define MAX_SSAA_SHADERS 3
|
||||
|
||||
static LPDIRECT3DVERTEXSHADER9 SimpleVertexShader[MAX_SSAA_SHADERS];
|
||||
static LPDIRECT3DVERTEXSHADER9 ClearVertexShader;
|
||||
|
||||
LinearDiskCache<VERTEXSHADERUID, u8> g_vs_disk_cache;
|
||||
LinearDiskCache<VertexShaderUid, u8> g_vs_disk_cache;
|
||||
|
||||
LPDIRECT3DVERTEXSHADER9 VertexShaderCache::GetSimpleVertexShader(int level)
|
||||
{
|
||||
@ -58,10 +58,10 @@ LPDIRECT3DVERTEXSHADER9 VertexShaderCache::GetClearVertexShader()
|
||||
}
|
||||
|
||||
// this class will load the precompiled shaders into our cache
|
||||
class VertexShaderCacheInserter : public LinearDiskCacheReader<VERTEXSHADERUID, u8>
|
||||
class VertexShaderCacheInserter : public LinearDiskCacheReader<VertexShaderUid, u8>
|
||||
{
|
||||
public:
|
||||
void Read(const VERTEXSHADERUID &key, const u8 *value, u32 value_size)
|
||||
void Read(const VertexShaderUid &key, const u8 *value, u32 value_size)
|
||||
{
|
||||
VertexShaderCache::InsertByteCode(key, value, value_size, false);
|
||||
}
|
||||
@ -188,14 +188,13 @@ void VertexShaderCache::Shutdown()
|
||||
|
||||
bool VertexShaderCache::SetShader(u32 components)
|
||||
{
|
||||
VERTEXSHADERUID uid;
|
||||
GetVertexShaderId(&uid, components);
|
||||
VertexShaderUid uid;
|
||||
GetVertexShaderUid(uid, components);
|
||||
if (last_entry)
|
||||
{
|
||||
if (uid == last_uid)
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
|
||||
ValidateVertexShaderIDs(API_D3D9, last_entry->safe_uid, last_entry->code, components);
|
||||
return (last_entry->shader != NULL);
|
||||
}
|
||||
}
|
||||
@ -210,14 +209,15 @@ bool VertexShaderCache::SetShader(u32 components)
|
||||
|
||||
if (entry.shader) D3D::SetVertexShader(entry.shader);
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
|
||||
ValidateVertexShaderIDs(API_D3D9, entry.safe_uid, entry.code, components);
|
||||
return (entry.shader != NULL);
|
||||
}
|
||||
|
||||
const char *code = GenerateVertexShaderCode(components, API_D3D9);
|
||||
VertexShaderCode code;
|
||||
GenerateVertexShaderCode(code, components, API_D3D9);
|
||||
|
||||
u8 *bytecode;
|
||||
int bytecodelen;
|
||||
if (!D3D::CompileVertexShader(code, (int)strlen(code), &bytecode, &bytecodelen))
|
||||
if (!D3D::CompileVertexShader(code.GetBuffer(), (int)strlen(code.GetBuffer()), &bytecode, &bytecodelen))
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true);
|
||||
return false;
|
||||
@ -227,15 +227,14 @@ bool VertexShaderCache::SetShader(u32 components)
|
||||
bool success = InsertByteCode(uid, bytecode, bytecodelen, true);
|
||||
if (g_ActiveConfig.bEnableShaderDebugging && success)
|
||||
{
|
||||
vshaders[uid].code = code;
|
||||
GetSafeVertexShaderId(&vshaders[uid].safe_uid, components);
|
||||
vshaders[uid].code = code.GetBuffer();
|
||||
}
|
||||
delete [] bytecode;
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
|
||||
return success;
|
||||
}
|
||||
|
||||
bool VertexShaderCache::InsertByteCode(const VERTEXSHADERUID &uid, const u8 *bytecode, int bytecodelen, bool activate) {
|
||||
bool VertexShaderCache::InsertByteCode(const VertexShaderUid &uid, const u8 *bytecode, int bytecodelen, bool activate) {
|
||||
LPDIRECT3DVERTEXSHADER9 shader = D3D::CreateVertexShaderFromByteCode(bytecode, bytecodelen);
|
||||
|
||||
// Make an entry in the table
|
||||
|
@ -36,7 +36,6 @@ private:
|
||||
LPDIRECT3DVERTEXSHADER9 shader;
|
||||
|
||||
std::string code;
|
||||
VERTEXSHADERUIDSAFE safe_uid;
|
||||
|
||||
VSCacheEntry() : shader(NULL) {}
|
||||
void Destroy()
|
||||
@ -47,11 +46,11 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<VERTEXSHADERUID, VSCacheEntry> VSCache;
|
||||
typedef std::map<VertexShaderUid, VSCacheEntry> VSCache;
|
||||
|
||||
static VSCache vshaders;
|
||||
static const VSCacheEntry *last_entry;
|
||||
static VERTEXSHADERUID last_uid;
|
||||
static VertexShaderUid last_uid;
|
||||
static void Clear();
|
||||
|
||||
public:
|
||||
@ -60,7 +59,7 @@ public:
|
||||
static bool SetShader(u32 components);
|
||||
static LPDIRECT3DVERTEXSHADER9 GetSimpleVertexShader(int level);
|
||||
static LPDIRECT3DVERTEXSHADER9 GetClearVertexShader();
|
||||
static bool InsertByteCode(const VERTEXSHADERUID &uid, const u8 *bytecode, int bytecodelen, bool activate);
|
||||
static bool InsertByteCode(const VertexShaderUid &uid, const u8 *bytecode, int bytecodelen, bool activate);
|
||||
|
||||
static std::string GetCurrentShaderCode();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user