mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
VertexLoader: Remove global state dependency on g_nativeVertexFmt
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/Statistics.h"
|
||||
#include "VideoCommon/TextureCacheBase.h"
|
||||
#include "VideoCommon/VertexLoader.h"
|
||||
#include "VideoCommon/VertexLoaderManager.h"
|
||||
#include "VideoCommon/VertexShaderManager.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
@ -136,6 +136,7 @@ static const float LINE_PT_TEX_OFFSETS[8] = {
|
||||
|
||||
void VertexManager::Draw(UINT stride)
|
||||
{
|
||||
u32 components = VertexLoaderManager::GetCurrentVertexFormat()->m_components;
|
||||
D3D::context->IASetVertexBuffers(0, 1, &m_vertex_buffers[m_current_vertex_buffer], &stride, &m_vertex_draw_offset);
|
||||
D3D::context->IASetIndexBuffer(m_index_buffers[m_current_index_buffer], DXGI_FORMAT_R16_UINT, 0);
|
||||
|
||||
@ -157,7 +158,7 @@ void VertexManager::Draw(UINT stride)
|
||||
for (int i = 0; i < 8; ++i)
|
||||
texOffsetEnable[i] = bpmem.texcoords[i].s.line_offset;
|
||||
|
||||
if (m_lineShader.SetShader(g_nativeVertexFmt->m_components, lineWidth,
|
||||
if (m_lineShader.SetShader(components, lineWidth,
|
||||
texOffset, vpWidth, vpHeight, texOffsetEnable))
|
||||
{
|
||||
((DX11::Renderer*)g_renderer)->ApplyCullDisable(); // Disable culling for lines and points
|
||||
@ -181,7 +182,7 @@ void VertexManager::Draw(UINT stride)
|
||||
for (int i = 0; i < 8; ++i)
|
||||
texOffsetEnable[i] = bpmem.texcoords[i].s.point_offset;
|
||||
|
||||
if (m_pointShader.SetShader(g_nativeVertexFmt->m_components, pointSize,
|
||||
if (m_pointShader.SetShader(components, pointSize,
|
||||
texOffset, vpWidth, vpHeight, texOffsetEnable))
|
||||
{
|
||||
((DX11::Renderer*)g_renderer)->ApplyCullDisable(); // Disable culling for lines and points
|
||||
@ -197,21 +198,21 @@ void VertexManager::Draw(UINT stride)
|
||||
|
||||
void VertexManager::vFlush(bool useDstAlpha)
|
||||
{
|
||||
u32 components = VertexLoaderManager::GetCurrentVertexFormat()->m_components;
|
||||
if (!PixelShaderCache::SetShader(
|
||||
useDstAlpha ? DSTALPHA_DUAL_SOURCE_BLEND : DSTALPHA_NONE,
|
||||
g_nativeVertexFmt->m_components))
|
||||
useDstAlpha ? DSTALPHA_DUAL_SOURCE_BLEND : DSTALPHA_NONE, components))
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
|
||||
return;
|
||||
}
|
||||
if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components))
|
||||
if (!VertexShaderCache::SetShader(components))
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
|
||||
return;
|
||||
}
|
||||
PrepareDrawBuffers();
|
||||
unsigned int stride = g_nativeVertexFmt->GetVertexStride();
|
||||
g_nativeVertexFmt->SetupVertexPointers();
|
||||
unsigned int stride = VertexLoaderManager::GetCurrentVertexFormat()->GetVertexStride();
|
||||
VertexLoaderManager::GetCurrentVertexFormat()->SetupVertexPointers();
|
||||
g_renderer->ApplyState(useDstAlpha);
|
||||
|
||||
Draw(stride);
|
||||
|
Reference in New Issue
Block a user