mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Merge branch 'primitive_restart'
This commit is contained in:
@ -338,6 +338,7 @@ Renderer::Renderer()
|
||||
|
||||
g_Config.backend_info.bSupportsDualSourceBlend = GLEW_ARB_blend_func_extended;
|
||||
g_Config.backend_info.bSupportsGLSLUBO = GLEW_ARB_uniform_buffer_object;
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart = GLEW_VERSION_3_1 || GLEW_NV_primitive_restart;
|
||||
|
||||
g_ogl_config.bSupportsGLSLCache = GLEW_ARB_get_program_binary;
|
||||
g_ogl_config.bSupportsGLPinnedMemory = GLEW_AMD_pinned_memory;
|
||||
@ -345,6 +346,7 @@ Renderer::Renderer()
|
||||
g_ogl_config.bSupportsGLBaseVertex = GLEW_ARB_draw_elements_base_vertex;
|
||||
g_ogl_config.bSupportCoverageMSAA = GLEW_NV_framebuffer_multisample_coverage;
|
||||
g_ogl_config.bSupportSampleShading = GLEW_ARB_sample_shading;
|
||||
g_ogl_config.bSupportOGL31 = GLEW_VERSION_3_1;
|
||||
|
||||
g_ogl_config.gl_vendor = (const char*)glGetString(GL_VENDOR);
|
||||
g_ogl_config.gl_renderer = (const char*)glGetString(GL_RENDERER);
|
||||
@ -397,9 +399,10 @@ Renderer::Renderer()
|
||||
g_ogl_config.gl_renderer,
|
||||
g_ogl_config.gl_version).c_str(), 5000);
|
||||
|
||||
WARN_LOG(VIDEO,"Missing OGL Extensions: %s%s%s%s%s%s%s%s",
|
||||
WARN_LOG(VIDEO,"Missing OGL Extensions: %s%s%s%s%s%s%s%s%s",
|
||||
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "UniformBuffer ",
|
||||
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
|
||||
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
|
||||
g_ogl_config.bSupportsGLSLCache ? "" : "ShaderCache ",
|
||||
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
|
||||
@ -475,6 +478,20 @@ Renderer::Renderer()
|
||||
glScissor(0, 0, GetTargetWidth(), GetTargetHeight());
|
||||
glBlendColor(0, 0, 0, 0.5f);
|
||||
glClearDepth(1.0f);
|
||||
|
||||
if(g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
|
||||
{
|
||||
if(g_ogl_config.bSupportOGL31)
|
||||
{
|
||||
glEnable(GL_PRIMITIVE_RESTART);
|
||||
glPrimitiveRestartIndex(65535);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnableClientState(GL_PRIMITIVE_RESTART_NV);
|
||||
glPrimitiveRestartIndexNV(65535);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateActiveConfig();
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ extern struct VideoConfig {
|
||||
bool bSupportCoverageMSAA;
|
||||
bool bSupportSampleShading;
|
||||
GLSL_VERSION eSupportedGLSLVersion;
|
||||
bool bSupportOGL31;
|
||||
|
||||
const char *gl_vendor;
|
||||
const char *gl_renderer;
|
||||
|
@ -124,10 +124,12 @@ void VertexManager::Draw(u32 stride)
|
||||
u32 triangle_index_size = IndexGenerator::GetTriangleindexLen();
|
||||
u32 line_index_size = IndexGenerator::GetLineindexLen();
|
||||
u32 point_index_size = IndexGenerator::GetPointindexLen();
|
||||
GLenum triangle_mode = g_ActiveConfig.backend_info.bSupportsPrimitiveRestart?GL_TRIANGLE_STRIP:GL_TRIANGLES;
|
||||
|
||||
if(g_ogl_config.bSupportsGLBaseVertex) {
|
||||
if (triangle_index_size > 0)
|
||||
{
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0], s_baseVertex);
|
||||
glDrawElementsBaseVertex(triangle_mode, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0], s_baseVertex);
|
||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||
}
|
||||
if (line_index_size > 0)
|
||||
@ -143,7 +145,7 @@ void VertexManager::Draw(u32 stride)
|
||||
} else {
|
||||
if (triangle_index_size > 0)
|
||||
{
|
||||
glDrawElements(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0]);
|
||||
glDrawElements(triangle_mode, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0]);
|
||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||
}
|
||||
if (line_index_size > 0)
|
||||
|
@ -96,6 +96,7 @@ Make AA apply instantly during gameplay if possible
|
||||
#include "PerfQuery.h"
|
||||
|
||||
#include "VideoState.h"
|
||||
#include "IndexGenerator.h"
|
||||
#include "VideoBackend.h"
|
||||
#include "ConfigManager.h"
|
||||
|
||||
@ -199,6 +200,7 @@ void VideoBackend::Video_Prepare()
|
||||
g_perf_query = new PerfQuery;
|
||||
Fifo_Init(); // must be done before OpcodeDecoder_Init()
|
||||
OpcodeDecoder_Init();
|
||||
IndexGenerator::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderManager::Init();
|
||||
ProgramShaderCache::Init();
|
||||
|
Reference in New Issue
Block a user