mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Merge rodolfoosvaldobogado's zcomploc code (Graphic_Fixes branch)
This commit is contained in:
@ -459,10 +459,10 @@ void PixelShaderCache::Shutdown()
|
||||
g_ps_disk_cache.Close();
|
||||
}
|
||||
|
||||
bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
bool PixelShaderCache::SetShader(PSGRENDER_MODE PSGRenderMode, u32 components)
|
||||
{
|
||||
PIXELSHADERUID uid;
|
||||
GetPixelShaderId(&uid, dstAlphaMode, components);
|
||||
GetPixelShaderId(&uid, PSGRenderMode, components);
|
||||
|
||||
// Check if the shader is already set
|
||||
if (last_entry)
|
||||
@ -470,7 +470,7 @@ 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);
|
||||
ValidatePixelShaderIDs(API_D3D11, last_entry->safe_uid, last_entry->code, PSGRenderMode, components);
|
||||
return (last_entry->shader != NULL);
|
||||
}
|
||||
}
|
||||
@ -486,12 +486,12 @@ 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);
|
||||
ValidatePixelShaderIDs(API_D3D11, entry.safe_uid, entry.code, PSGRenderMode, components);
|
||||
return (entry.shader != NULL);
|
||||
}
|
||||
|
||||
// Need to compile a new shader
|
||||
const char* code = GeneratePixelShaderCode(dstAlphaMode, API_D3D11, components);
|
||||
const char* code = GeneratePixelShaderCode(PSGRenderMode, API_D3D11, components);
|
||||
|
||||
D3DBlob* pbytecode;
|
||||
if (!D3D::CompilePixelShader(code, (unsigned int)strlen(code), &pbytecode))
|
||||
@ -509,7 +509,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
if (g_ActiveConfig.bEnableShaderDebugging && success)
|
||||
{
|
||||
PixelShaders[uid].code = code;
|
||||
GetSafePixelShaderId(&PixelShaders[uid].safe_uid, dstAlphaMode, components);
|
||||
GetSafePixelShaderId(&PixelShaders[uid].safe_uid, PSGRenderMode, components);
|
||||
}
|
||||
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
enum DSTALPHA_MODE;
|
||||
enum PSGRENDER_MODE;
|
||||
|
||||
namespace DX11
|
||||
{
|
||||
@ -34,7 +34,7 @@ public:
|
||||
static void Init();
|
||||
static void Clear();
|
||||
static void Shutdown();
|
||||
static bool SetShader(DSTALPHA_MODE dstAlphaMode, u32 components); // TODO: Should be renamed to LoadShader
|
||||
static bool SetShader(PSGRENDER_MODE PSGRenderMode, u32 components); // TODO: Should be renamed to LoadShader
|
||||
static bool InsertByteCode(const PIXELSHADERUID &uid, const void* bytecode, unsigned int bytecodelen);
|
||||
|
||||
static ID3D11PixelShader* GetActiveShader() { return last_entry->shader; }
|
||||
|
@ -1211,11 +1211,11 @@ void Renderer::RestoreAPIState()
|
||||
BPFunctions::SetScissor();
|
||||
}
|
||||
|
||||
void Renderer::ApplyState(bool bUseDstAlpha)
|
||||
void Renderer::ApplyState(u32 mode)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (bUseDstAlpha)
|
||||
if (mode & RSM_UseDstAlpha)
|
||||
{
|
||||
// Colors should blend against SRC1_ALPHA
|
||||
if (gx_state.blenddc.RenderTarget[0].SrcBlend == D3D11_BLEND_SRC_ALPHA)
|
||||
@ -1275,7 +1275,7 @@ void Renderer::ApplyState(bool bUseDstAlpha)
|
||||
|
||||
D3D::stateman->Apply();
|
||||
|
||||
if (bUseDstAlpha)
|
||||
if (mode & RSM_UseDstAlpha)
|
||||
{
|
||||
// restore actual state
|
||||
SetBlendMode(false);
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
void SetInterlacingMode();
|
||||
|
||||
// TODO: Fix confusing names (see ResetAPIState and RestoreAPIState)
|
||||
void ApplyState(bool bUseDstAlpha);
|
||||
void ApplyState(u32 mode);
|
||||
void RestoreState();
|
||||
|
||||
void ApplyCullDisable();
|
||||
|
@ -249,7 +249,7 @@ void VertexManager::vFlush()
|
||||
bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
|
||||
|
||||
if (!PixelShaderCache::SetShader(
|
||||
useDstAlpha ? DSTALPHA_DUAL_SOURCE_BLEND : DSTALPHA_NONE,
|
||||
useDstAlpha ? PSGRENDER_DSTALPHA_DUAL_SOURCE_BLEND : PSGRENDER_NORMAL,
|
||||
g_nativeVertexFmt->m_components))
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
|
||||
@ -264,7 +264,7 @@ void VertexManager::vFlush()
|
||||
unsigned int stride = g_nativeVertexFmt->GetVertexStride();
|
||||
g_nativeVertexFmt->SetupVertexPointers();
|
||||
|
||||
g_renderer->ApplyState(useDstAlpha);
|
||||
g_renderer->ApplyState(useDstAlpha ? RSM_UseDstAlpha : RSM_None);
|
||||
LoadBuffers();
|
||||
Draw(stride);
|
||||
|
||||
|
Reference in New Issue
Block a user