summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2017-09-11 13:28:09 +0200
committerGitHub <noreply@github.com>2017-09-11 13:28:09 +0200
commit002e01d0ede3bd0eeebebc09f8f6a813ebc8d444 (patch)
tree5fb17c3d07988499767c51908b49dac2d8d9c881 /Source/Core/VideoBackends/OGL
parent9d169449a7898cefab29a5e033f82560cfcdef5e (diff)
parent24ddea04ce3c843dd1de3d34d775e9a49d195225 (diff)
Merge pull request #5343 from stenzek/videocommon-states
Move depth, rasterization and sampler states to VideoCommon
Diffstat (limited to 'Source/Core/VideoBackends/OGL')
-rw-r--r--Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp23
-rw-r--r--Source/Core/VideoBackends/OGL/ProgramShaderCache.h6
-rw-r--r--Source/Core/VideoBackends/OGL/Render.cpp30
-rw-r--r--Source/Core/VideoBackends/OGL/Render.h6
-rw-r--r--Source/Core/VideoBackends/OGL/SamplerCache.cpp151
-rw-r--r--Source/Core/VideoBackends/OGL/SamplerCache.h45
-rw-r--r--Source/Core/VideoBackends/OGL/VertexManager.cpp17
7 files changed, 110 insertions, 168 deletions
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
index 5617a928a9..a5133023af 100644
--- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
+++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
@@ -221,7 +221,8 @@ void ProgramShaderCache::UploadConstants()
}
}
-SHADER* ProgramShaderCache::SetShader(u32 primitive_type, const GLVertexFormat* vertex_format)
+SHADER* ProgramShaderCache::SetShader(PrimitiveType primitive_type,
+ const GLVertexFormat* vertex_format)
{
if (g_ActiveConfig.bDisableSpecializedShaders)
return SetUberShader(primitive_type, vertex_format);
@@ -292,7 +293,8 @@ SHADER* ProgramShaderCache::SetShader(u32 primitive_type, const GLVertexFormat*
return &last_entry->shader;
}
-SHADER* ProgramShaderCache::SetUberShader(u32 primitive_type, const GLVertexFormat* vertex_format)
+SHADER* ProgramShaderCache::SetUberShader(PrimitiveType primitive_type,
+ const GLVertexFormat* vertex_format)
{
UBERSHADERUID uid;
std::memset(&uid, 0, sizeof(uid));
@@ -1117,7 +1119,8 @@ bool ProgramShaderCache::ShaderCompileWorkItem::Compile()
gcode = GenerateGeometryShaderCode(APIType::OpenGL, host_config, m_uid.guid.GetUidData());
CompileShader(m_program, vcode.GetBuffer(), pcode.GetBuffer(), gcode.GetBuffer());
- DrawPrerenderArray(m_program, m_uid.guid.GetUidData()->primitive_type);
+ DrawPrerenderArray(m_program,
+ static_cast<PrimitiveType>(m_uid.guid.GetUidData()->primitive_type));
return true;
}
@@ -1155,7 +1158,8 @@ bool ProgramShaderCache::UberShaderCompileWorkItem::Compile()
gcode = GenerateGeometryShaderCode(APIType::OpenGL, host_config, m_uid.guid.GetUidData());
CompileShader(m_program, vcode.GetBuffer(), pcode.GetBuffer(), gcode.GetBuffer());
- DrawPrerenderArray(m_program, m_uid.guid.GetUidData()->primitive_type);
+ DrawPrerenderArray(m_program,
+ static_cast<PrimitiveType>(m_uid.guid.GetUidData()->primitive_type));
return true;
}
@@ -1295,7 +1299,7 @@ void ProgramShaderCache::DestroyPrerenderArrays(SharedContextData* data)
}
}
-void ProgramShaderCache::DrawPrerenderArray(const SHADER& shader, u32 primitive_type)
+void ProgramShaderCache::DrawPrerenderArray(const SHADER& shader, PrimitiveType primitive_type)
{
// This is called on a worker thread, so we don't want to use the normal binding process.
glUseProgram(shader.glprogid);
@@ -1303,15 +1307,18 @@ void ProgramShaderCache::DrawPrerenderArray(const SHADER& shader, u32 primitive_
// The number of primitives drawn depends on the type.
switch (primitive_type)
{
- case PRIMITIVE_POINTS:
+ case PrimitiveType::Points:
glDrawElements(GL_POINTS, 1, GL_UNSIGNED_SHORT, nullptr);
break;
- case PRIMITIVE_LINES:
+ case PrimitiveType::Lines:
glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, nullptr);
break;
- case PRIMITIVE_TRIANGLES:
+ case PrimitiveType::Triangles:
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, nullptr);
break;
+ case PrimitiveType::TriangleStrip:
+ glDrawElements(GL_TRIANGLE_STRIP, 3, GL_UNSIGNED_SHORT, nullptr);
+ break;
}
// Has to be finished by the time the main thread picks it up.
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h
index d45b2e4cbb..83f9d0e817 100644
--- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h
+++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h
@@ -94,8 +94,8 @@ public:
};
static PCacheEntry GetShaderProgram();
- static SHADER* SetShader(u32 primitive_type, const GLVertexFormat* vertex_format);
- static SHADER* SetUberShader(u32 primitive_type, const GLVertexFormat* vertex_format);
+ static SHADER* SetShader(PrimitiveType primitive_type, const GLVertexFormat* vertex_format);
+ static SHADER* SetUberShader(PrimitiveType primitive_type, const GLVertexFormat* vertex_format);
static void BindVertexFormat(const GLVertexFormat* vertex_format);
static void InvalidateVertexFormat();
static void BindLastVertexFormat();
@@ -198,7 +198,7 @@ private:
static void DestroyShaders();
static void CreatePrerenderArrays(SharedContextData* data);
static void DestroyPrerenderArrays(SharedContextData* data);
- static void DrawPrerenderArray(const SHADER& shader, u32 primitive_type);
+ static void DrawPrerenderArray(const SHADER& shader, PrimitiveType primitive_type);
static PCache pshaders;
static UberPCache ubershaders;
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp
index 8953b10831..ccf89b45f2 100644
--- a/Source/Core/VideoBackends/OGL/Render.cpp
+++ b/Source/Core/VideoBackends/OGL/Render.cpp
@@ -1503,9 +1503,13 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
g_Config.iSaveTargetId = 0;
+ int old_anisotropy = g_ActiveConfig.iMaxAnisotropy;
UpdateActiveConfig();
g_texture_cache->OnConfigChanged(g_ActiveConfig);
+ if (old_anisotropy != g_ActiveConfig.iMaxAnisotropy)
+ g_sampler_cache->Clear();
+
// Invalidate shader cache when the host config changes.
if (CheckForHostConfigChanges())
ProgramShaderCache::Reload();
@@ -1785,9 +1789,9 @@ void Renderer::RestoreAPIState()
glEnable(GL_CLIP_DISTANCE0);
glEnable(GL_CLIP_DISTANCE1);
}
- SetGenerationMode();
+ BPFunctions::SetGenerationMode();
BPFunctions::SetScissor();
- SetDepthMode();
+ BPFunctions::SetDepthMode();
BPFunctions::SetBlendMode();
SetViewport();
@@ -1798,14 +1802,14 @@ void Renderer::RestoreAPIState()
OGLTexture::SetStage();
}
-void Renderer::SetGenerationMode()
+void Renderer::SetRasterizationState(const RasterizationState& state)
{
// none, ccw, cw, ccw
- if (bpmem.genMode.cullmode > 0)
+ if (state.cullmode != GenMode::CULL_NONE)
{
// TODO: GX_CULL_ALL not supported, yet!
glEnable(GL_CULL_FACE);
- glFrontFace(bpmem.genMode.cullmode == 2 ? GL_CCW : GL_CW);
+ glFrontFace(state.cullmode == GenMode::CULL_FRONT ? GL_CCW : GL_CW);
}
else
{
@@ -1813,16 +1817,16 @@ void Renderer::SetGenerationMode()
}
}
-void Renderer::SetDepthMode()
+void Renderer::SetDepthState(const DepthState& state)
{
const GLenum glCmpFuncs[8] = {GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL,
GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, GL_ALWAYS};
- if (bpmem.zmode.testenable)
+ if (state.testenable)
{
glEnable(GL_DEPTH_TEST);
- glDepthMask(bpmem.zmode.updateenable ? GL_TRUE : GL_FALSE);
- glDepthFunc(glCmpFuncs[bpmem.zmode.func]);
+ glDepthMask(state.updateenable ? GL_TRUE : GL_FALSE);
+ glDepthFunc(glCmpFuncs[state.func]);
}
else
{
@@ -1834,13 +1838,9 @@ void Renderer::SetDepthMode()
}
}
-void Renderer::SetSamplerState(int stage, int texindex, bool custom_tex)
+void Renderer::SetSamplerState(u32 index, const SamplerState& state)
{
- auto const& tex = bpmem.tex[texindex];
- auto const& tm0 = tex.texMode0[stage];
- auto const& tm1 = tex.texMode1[stage];
-
- g_sampler_cache->SetSamplerState((texindex * 4) + stage, tm0, tm1, custom_tex);
+ g_sampler_cache->SetSamplerState(index, state);
}
void Renderer::SetInterlacingMode()
diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h
index 668b15c51f..8efea70bec 100644
--- a/Source/Core/VideoBackends/OGL/Render.h
+++ b/Source/Core/VideoBackends/OGL/Render.h
@@ -79,9 +79,9 @@ public:
void SetBlendingState(const BlendingState& state) override;
void SetScissorRect(const EFBRectangle& rc) override;
- void SetGenerationMode() override;
- void SetDepthMode() override;
- void SetSamplerState(int stage, int texindex, bool custom_tex) override;
+ void SetRasterizationState(const RasterizationState& state) override;
+ void SetDepthState(const DepthState& state) override;
+ void SetSamplerState(u32 index, const SamplerState& state) override;
void SetInterlacingMode() override;
void SetViewport() override;
diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.cpp b/Source/Core/VideoBackends/OGL/SamplerCache.cpp
index cbde39be6c..59d3d3a842 100644
--- a/Source/Core/VideoBackends/OGL/SamplerCache.cpp
+++ b/Source/Core/VideoBackends/OGL/SamplerCache.cpp
@@ -15,141 +15,106 @@ namespace OGL
{
std::unique_ptr<SamplerCache> g_sampler_cache;
-SamplerCache::SamplerCache() : m_last_max_anisotropy()
+SamplerCache::SamplerCache()
{
- glGenSamplers(2, m_sampler_id);
- glSamplerParameteri(m_sampler_id[0], GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glSamplerParameteri(m_sampler_id[0], GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glSamplerParameteri(m_sampler_id[0], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glSamplerParameteri(m_sampler_id[0], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glSamplerParameteri(m_sampler_id[1], GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glSamplerParameteri(m_sampler_id[1], GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glSamplerParameteri(m_sampler_id[1], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glSamplerParameteri(m_sampler_id[1], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glGenSamplers(1, &m_point_sampler);
+ glGenSamplers(1, &m_linear_sampler);
+ glSamplerParameteri(m_point_sampler, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glSamplerParameteri(m_point_sampler, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glSamplerParameteri(m_point_sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glSamplerParameteri(m_point_sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glSamplerParameteri(m_linear_sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glSamplerParameteri(m_linear_sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glSamplerParameteri(m_linear_sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glSamplerParameteri(m_linear_sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
SamplerCache::~SamplerCache()
{
Clear();
- glDeleteSamplers(2, m_sampler_id);
+ glDeleteSamplers(1, &m_point_sampler);
+ glDeleteSamplers(1, &m_linear_sampler);
}
void SamplerCache::BindNearestSampler(int stage)
{
- glBindSampler(stage, m_sampler_id[0]);
+ glBindSampler(stage, m_point_sampler);
}
void SamplerCache::BindLinearSampler(int stage)
{
- glBindSampler(stage, m_sampler_id[1]);
+ glBindSampler(stage, m_linear_sampler);
}
-void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1,
- bool custom_tex)
+void SamplerCache::SetSamplerState(u32 stage, const SamplerState& state)
{
- // TODO: can this go somewhere else?
- if (m_last_max_anisotropy != g_ActiveConfig.iMaxAnisotropy)
- {
- m_last_max_anisotropy = g_ActiveConfig.iMaxAnisotropy;
- Clear();
- }
+ if (m_active_samplers[stage].first == state && m_active_samplers[stage].second != 0)
+ return;
- Params params(tm0, tm1);
-
- // take equivalent forced linear when bForceFiltering
- if (g_ActiveConfig.bForceFiltering)
+ auto it = m_cache.find(state);
+ if (it == m_cache.end())
{
- params.tm0.min_filter = SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0) ? 6 : 4;
- params.tm0.mag_filter = 1;
+ GLuint sampler;
+ glGenSamplers(1, &sampler);
+ SetParameters(sampler, state);
+ it = m_cache.emplace(state, sampler).first;
}
- // custom textures may have higher resolution, so disable the max_lod
- if (custom_tex)
- {
- params.tm1.max_lod = 255;
- }
-
- // TODO: Should keep a circular buffer for each stage of recently used samplers.
-
- auto& active_sampler = m_active_samplers[stage];
- if (active_sampler.first != params || !active_sampler.second.sampler_id)
- {
- // Active sampler does not match parameters (or is invalid), bind the proper one.
- active_sampler.first = params;
- active_sampler.second = GetEntry(params);
- glBindSampler(stage, active_sampler.second.sampler_id);
- }
+ m_active_samplers[stage].first = state;
+ m_active_samplers[stage].second = it->second;
+ glBindSampler(stage, it->second);
}
-SamplerCache::Value& SamplerCache::GetEntry(const Params& params)
+void SamplerCache::InvalidateBinding(u32 stage)
{
- auto& val = m_cache[params];
- if (!val.sampler_id)
- {
- // Sampler not found in cache, create it.
- glGenSamplers(1, &val.sampler_id);
- SetParameters(val.sampler_id, params);
-
- // TODO: Maybe kill old samplers if the cache gets huge. It doesn't seem to get huge though.
- // ERROR_LOG(VIDEO, "Sampler cache size is now %ld.", m_cache.size());
- }
-
- return val;
+ m_active_samplers[stage].second = 0;
}
-void SamplerCache::SetParameters(GLuint sampler_id, const Params& params)
+void SamplerCache::SetParameters(GLuint sampler_id, const SamplerState& params)
{
- static const GLint min_filters[8] = {
- GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST,
- GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR,
- };
+ GLenum min_filter;
+ GLenum mag_filter = (params.mag_filter == SamplerState::Filter::Point) ? GL_NEAREST : GL_LINEAR;
+ if (params.mipmap_filter == SamplerState::Filter::Linear)
+ {
+ min_filter = (params.min_filter == SamplerState::Filter::Point) ? GL_NEAREST_MIPMAP_LINEAR :
+ GL_LINEAR_MIPMAP_LINEAR;
+ }
+ else
+ {
+ min_filter = (params.min_filter == SamplerState::Filter::Point) ? GL_NEAREST_MIPMAP_NEAREST :
+ GL_LINEAR_MIPMAP_NEAREST;
+ }
- static const GLint wrap_settings[4] = {
- GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT, GL_REPEAT,
- };
+ glSamplerParameteri(sampler_id, GL_TEXTURE_MIN_FILTER, min_filter);
+ glSamplerParameteri(sampler_id, GL_TEXTURE_MAG_FILTER, mag_filter);
- auto& tm0 = params.tm0;
- auto& tm1 = params.tm1;
+ static constexpr std::array<GLenum, 3> address_modes = {
+ {GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT}};
- glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_S, wrap_settings[tm0.wrap_s]);
- glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_T, wrap_settings[tm0.wrap_t]);
+ glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_S,
+ address_modes[static_cast<u32>(params.wrap_u.Value())]);
+ glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_T,
+ address_modes[static_cast<u32>(params.wrap_v.Value())]);
- glSamplerParameterf(sampler_id, GL_TEXTURE_MIN_LOD, tm1.min_lod / 16.f);
- glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_LOD, tm1.max_lod / 16.f);
+ glSamplerParameterf(sampler_id, GL_TEXTURE_MIN_LOD, params.min_lod / 16.f);
+ glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_LOD, params.max_lod / 16.f);
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL)
- glSamplerParameterf(sampler_id, GL_TEXTURE_LOD_BIAS, (s32)tm0.lod_bias / 32.f);
+ glSamplerParameterf(sampler_id, GL_TEXTURE_LOD_BIAS, params.lod_bias / 32.f);
- GLint min_filter = min_filters[tm0.min_filter];
- GLint mag_filter = tm0.mag_filter ? GL_LINEAR : GL_NEAREST;
-
- if (g_ActiveConfig.iMaxAnisotropy > 0 && g_ogl_config.bSupportsAniso &&
- !SamplerCommon::IsBpTexMode0PointFiltering(tm0))
+ if (params.anisotropic_filtering && g_ogl_config.bSupportsAniso)
{
- // https://www.opengl.org/registry/specs/EXT/texture_filter_anisotropic.txt
- // For predictable results on all hardware/drivers, only use one of:
- // GL_LINEAR + GL_LINEAR (No Mipmaps [Bilinear])
- // GL_LINEAR + GL_LINEAR_MIPMAP_LINEAR (w/ Mipmaps [Trilinear])
- // Letting the game set other combinations will have varying arbitrary results;
- // possibly being interpreted as equal to bilinear/trilinear, implicitly
- // disabling anisotropy, or changing the anisotropic algorithm employed.
- min_filter =
- SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0) ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
- mag_filter = GL_LINEAR;
glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_ANISOTROPY_EXT,
- (float)(1 << g_ActiveConfig.iMaxAnisotropy));
+ static_cast<float>(1 << g_ActiveConfig.iMaxAnisotropy));
}
-
- glSamplerParameteri(sampler_id, GL_TEXTURE_MIN_FILTER, min_filter);
- glSamplerParameteri(sampler_id, GL_TEXTURE_MAG_FILTER, mag_filter);
}
void SamplerCache::Clear()
{
for (auto& p : m_cache)
- {
- glDeleteSamplers(1, &p.second.sampler_id);
- }
+ glDeleteSamplers(1, &p.second);
+ for (auto& p : m_active_samplers)
+ p.second = 0;
m_cache.clear();
}
}
diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.h b/Source/Core/VideoBackends/OGL/SamplerCache.h
index c6bd76dae1..7b437e326b 100644
--- a/Source/Core/VideoBackends/OGL/SamplerCache.h
+++ b/Source/Core/VideoBackends/OGL/SamplerCache.h
@@ -4,6 +4,7 @@
#pragma once
+#include <array>
#include <map>
#include <memory>
@@ -24,49 +25,21 @@ public:
SamplerCache(SamplerCache&&) = delete;
SamplerCache& operator=(SamplerCache&&) = delete;
- void SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1, bool custom_tex);
+ void SetSamplerState(u32 stage, const SamplerState& state);
+ void InvalidateBinding(u32 stage);
+
void Clear();
void BindNearestSampler(int stage);
void BindLinearSampler(int stage);
private:
- struct Params
- {
- union
- {
- struct
- {
- TexMode0 tm0;
- TexMode1 tm1;
- };
-
- u64 hex;
- };
-
- Params() : hex() {}
- Params(const TexMode0& _tm0, const TexMode1& _tm1) : tm0(_tm0), tm1(_tm1)
- {
- static_assert(sizeof(Params) == 8, "Assuming I can treat this as a 64bit int.");
- }
-
- bool operator<(const Params& other) const { return hex < other.hex; }
- bool operator!=(const Params& other) const { return hex != other.hex; }
- };
-
- struct Value
- {
- Value() : sampler_id() {}
- GLuint sampler_id;
- };
-
- void SetParameters(GLuint sampler_id, const Params& params);
- Value& GetEntry(const Params& params);
+ static void SetParameters(GLuint sampler_id, const SamplerState& params);
- std::map<Params, Value> m_cache;
- std::pair<Params, Value> m_active_samplers[8];
+ std::map<SamplerState, GLuint> m_cache;
+ std::array<std::pair<SamplerState, GLuint>, 8> m_active_samplers{};
- int m_last_max_anisotropy;
- u32 m_sampler_id[2];
+ GLuint m_point_sampler;
+ GLuint m_linear_sampler;
};
extern std::unique_ptr<SamplerCache> g_sampler_cache;
diff --git a/Source/Core/VideoBackends/OGL/VertexManager.cpp b/Source/Core/VideoBackends/OGL/VertexManager.cpp
index 19b9734be2..fd005e4860 100644
--- a/Source/Core/VideoBackends/OGL/VertexManager.cpp
+++ b/Source/Core/VideoBackends/OGL/VertexManager.cpp
@@ -114,17 +114,17 @@ void VertexManager::Draw(u32 stride)
switch (m_current_primitive_type)
{
- case PRIMITIVE_POINTS:
+ case PrimitiveType::Points:
primitive_mode = GL_POINTS;
- glDisable(GL_CULL_FACE);
break;
- case PRIMITIVE_LINES:
+ case PrimitiveType::Lines:
primitive_mode = GL_LINES;
- glDisable(GL_CULL_FACE);
break;
- case PRIMITIVE_TRIANGLES:
- primitive_mode =
- g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? GL_TRIANGLE_STRIP : GL_TRIANGLES;
+ case PrimitiveType::Triangles:
+ primitive_mode = GL_TRIANGLES;
+ break;
+ case PrimitiveType::TriangleStrip:
+ primitive_mode = GL_TRIANGLE_STRIP;
break;
}
@@ -140,9 +140,6 @@ void VertexManager::Draw(u32 stride)
}
INCSTAT(stats.thisFrame.numDrawCalls);
-
- if (m_current_primitive_type != PRIMITIVE_TRIANGLES)
- static_cast<Renderer*>(g_renderer.get())->SetGenerationMode();
}
void VertexManager::vFlush()