mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
VideoCommon/IndexGenerator: Eliminate static state
Now that we've extracted all of the stateless functions that can be hidden, it's time to make the index generator a regular class with active data members. This can just be a member that sits within the vertex manager base class. By deglobalizing the state of the index generator we also get rid of the wonky dual-initializing that was going on within the OpenGL backend. Since the renderer is always initialized before the vertex manager, we now only call Init() once throughout the execution lifecycle.
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/MathUtil.h"
|
||||
#include "VideoCommon/IndexGenerator.h"
|
||||
#include "VideoCommon/RenderState.h"
|
||||
#include "VideoCommon/ShaderCache.h"
|
||||
|
||||
@ -65,6 +66,7 @@ public:
|
||||
virtual bool Initialize();
|
||||
|
||||
PrimitiveType GetCurrentPrimitiveType() const { return m_current_primitive_type; }
|
||||
void AddIndices(int primitive, u32 num_vertices);
|
||||
DataReader PrepareForAdditionalData(int primitive, u32 count, u32 stride, bool cullall);
|
||||
void FlushData(u32 count, u32 stride);
|
||||
|
||||
@ -134,7 +136,7 @@ protected:
|
||||
virtual void DrawCurrentBatch(u32 base_index, u32 num_indices, u32 base_vertex);
|
||||
|
||||
u32 GetRemainingSize() const;
|
||||
static u32 GetRemainingIndices(int primitive);
|
||||
u32 GetRemainingIndices(int primitive) const;
|
||||
|
||||
void CalculateZSlope(NativeVertexFormat* format);
|
||||
void LoadTextures();
|
||||
@ -159,6 +161,8 @@ protected:
|
||||
bool m_blending_state_changed = true;
|
||||
bool m_cull_all = false;
|
||||
|
||||
IndexGenerator m_index_generator;
|
||||
|
||||
private:
|
||||
// Minimum number of draws per command buffer when attempting to preempt a readback operation.
|
||||
static constexpr u32 MINIMUM_DRAW_CALLS_PER_COMMAND_BUFFER_FOR_READBACK = 10;
|
||||
|
Reference in New Issue
Block a user