mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
VideoCommon: Make dst_alpha state implicit.
This commit is contained in:
@ -551,9 +551,9 @@ void PixelShaderCache::Shutdown()
|
||||
g_ps_disk_cache.Close();
|
||||
}
|
||||
|
||||
bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode)
|
||||
bool PixelShaderCache::SetShader()
|
||||
{
|
||||
PixelShaderUid uid = GetPixelShaderUid(dstAlphaMode);
|
||||
PixelShaderUid uid = GetPixelShaderUid();
|
||||
|
||||
// Check if the shader is already set
|
||||
if (last_entry)
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
#include "VideoCommon/PixelShaderGen.h"
|
||||
|
||||
enum DSTALPHA_MODE;
|
||||
|
||||
namespace DX11
|
||||
{
|
||||
class PixelShaderCache
|
||||
@ -19,7 +17,7 @@ public:
|
||||
static void Init();
|
||||
static void Clear();
|
||||
static void Shutdown();
|
||||
static bool SetShader(DSTALPHA_MODE dstAlphaMode); // TODO: Should be renamed to LoadShader
|
||||
static bool SetShader(); // TODO: Should be renamed to LoadShader
|
||||
static bool InsertByteCode(const PixelShaderUid& uid, const void* bytecode,
|
||||
unsigned int bytecodelen);
|
||||
|
||||
|
@ -940,8 +940,12 @@ void Renderer::RestoreAPIState()
|
||||
BPFunctions::SetScissor();
|
||||
}
|
||||
|
||||
void Renderer::ApplyState(bool bUseDstAlpha)
|
||||
void Renderer::ApplyState()
|
||||
{
|
||||
// TODO: Refactor this logic here.
|
||||
bool bUseDstAlpha = bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate &&
|
||||
bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24;
|
||||
|
||||
gx_state.blend.use_dst_alpha = bUseDstAlpha;
|
||||
D3D::stateman->PushBlendState(gx_state_cache.Get(gx_state.blend));
|
||||
D3D::stateman->PushDepthState(gx_state_cache.Get(gx_state.zmode));
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
bool IsFullscreen() const override;
|
||||
|
||||
// TODO: Fix confusing names (see ResetAPIState and RestoreAPIState)
|
||||
void ApplyState(bool bUseDstAlpha) override;
|
||||
void ApplyState() override;
|
||||
void RestoreState() override;
|
||||
|
||||
void ApplyCullDisable();
|
||||
|
@ -147,9 +147,9 @@ void VertexManager::Draw(u32 stride)
|
||||
static_cast<Renderer*>(g_renderer.get())->RestoreCull();
|
||||
}
|
||||
|
||||
void VertexManager::vFlush(bool useDstAlpha)
|
||||
void VertexManager::vFlush()
|
||||
{
|
||||
if (!PixelShaderCache::SetShader(useDstAlpha ? DSTALPHA_DUAL_SOURCE_BLEND : DSTALPHA_NONE))
|
||||
if (!PixelShaderCache::SetShader())
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR, true, { printf("Fail to set pixel shader\n"); });
|
||||
return;
|
||||
@ -179,7 +179,7 @@ void VertexManager::vFlush(bool useDstAlpha)
|
||||
PrepareDrawBuffers(stride);
|
||||
|
||||
VertexLoaderManager::GetCurrentVertexFormat()->SetupVertexPointers();
|
||||
g_renderer->ApplyState(useDstAlpha);
|
||||
g_renderer->ApplyState();
|
||||
|
||||
Draw(stride);
|
||||
|
||||
|
@ -25,7 +25,7 @@ private:
|
||||
void PrepareDrawBuffers(u32 stride);
|
||||
void Draw(u32 stride);
|
||||
// temp
|
||||
void vFlush(bool useDstAlpha) override;
|
||||
void vFlush() override;
|
||||
|
||||
u32 m_vertexDrawOffset;
|
||||
u32 m_indexDrawOffset;
|
||||
|
Reference in New Issue
Block a user