mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Merge branch 'master' into buffer_storage
Conflicts: Source/Core/VideoBackends/OGL/Src/Render.cpp Source/Core/VideoCommon/Src/DriverDetails.cpp Source/Core/VideoCommon/Src/DriverDetails.h
This commit is contained in:
@ -1167,6 +1167,7 @@ void Renderer::SetGenerationMode()
|
||||
};
|
||||
|
||||
// rastdc.FrontCounterClockwise must be false for this to work
|
||||
// TODO: GX_CULL_ALL not supported, yet!
|
||||
gx_state.rastdc.CullMode = d3dCullModes[bpmem.genMode.cullmode];
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,9 @@
|
||||
#include "DriverDetails.h"
|
||||
#include "GLFunctions.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef USE_GLES3
|
||||
PFNGLMAPBUFFERRANGEPROC glMapBufferRange;
|
||||
@ -13,6 +15,7 @@ PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
PFNGLBINDBUFFERRANGEPROC glBindBufferRange;
|
||||
|
||||
PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
|
||||
PFNGLGETSTRINGIPROC glGetStringi;
|
||||
|
||||
PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||
@ -49,6 +52,8 @@ PFNGLGENQUERIESPROC glGenQueries;
|
||||
namespace GLFunc
|
||||
{
|
||||
void *self;
|
||||
std::unordered_map<std::string, bool> _extensions;
|
||||
|
||||
void LoadFunction(const char *name, void **func)
|
||||
{
|
||||
#ifdef USE_GLES3
|
||||
@ -67,10 +72,27 @@ namespace GLFunc
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SupportsExt(std::string ext)
|
||||
{
|
||||
return _extensions.find(ext) != _extensions.end();
|
||||
}
|
||||
|
||||
void InitExtensions()
|
||||
{
|
||||
GLint NumExtension = 0;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &NumExtension);
|
||||
for (GLint i = 0; i < NumExtension; ++i)
|
||||
_extensions[std::string((const char*)glGetStringi(GL_EXTENSIONS, i))] = true;
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
self = dlopen(NULL, RTLD_LAZY);
|
||||
|
||||
LoadFunction("glGetStringi", (void**)&glGetStringi);
|
||||
|
||||
InitExtensions();
|
||||
|
||||
LoadFunction("glUnmapBuffer", (void**)&glUnmapBuffer);
|
||||
LoadFunction("glBeginQuery", (void**)&glBeginQuery);
|
||||
LoadFunction("glEndQuery", (void**)&glEndQuery);
|
||||
|
@ -10,8 +10,10 @@ typedef GLvoid* (*PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
|
||||
typedef GLvoid* (*PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
|
||||
typedef void (*PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
|
||||
typedef GLboolean (*PFNGLUNMAPBUFFERPROC) (GLenum target);
|
||||
typedef GLubyte* (*PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
|
||||
|
||||
typedef void (*PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
|
||||
// VAOS
|
||||
typedef void (*PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays);
|
||||
typedef void (*PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint* arrays);
|
||||
@ -63,6 +65,7 @@ extern PFNGLMAPBUFFERRANGEPROC glMapBufferRange;
|
||||
extern PFNGLBINDBUFFERRANGEPROC glBindBufferRange;
|
||||
|
||||
extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
|
||||
extern PFNGLGETSTRINGIPROC glGetStringi;
|
||||
|
||||
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||
@ -95,5 +98,6 @@ extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
|
||||
namespace GLFunc
|
||||
{
|
||||
void Init();
|
||||
bool SupportsExt(std::string ext);
|
||||
}
|
||||
#endif
|
||||
|
@ -260,6 +260,7 @@ void InitDriverInfo()
|
||||
DriverDetails::Vendor vendor = DriverDetails::VENDOR_UNKNOWN;
|
||||
DriverDetails::Driver driver = DriverDetails::DRIVER_UNKNOWN;
|
||||
double version = 0.0;
|
||||
u32 family = 0;
|
||||
|
||||
// Get the vendor first
|
||||
if (svendor == "NVIDIA Corporation" && srenderer != "NVIDIA Tegra")
|
||||
@ -321,11 +322,23 @@ void InitDriverInfo()
|
||||
version = 100*major + 10*minor + release;
|
||||
}
|
||||
break;
|
||||
case DriverDetails::VENDOR_INTEL: // Happens in OS X
|
||||
sscanf(g_ogl_config.gl_renderer, "Intel HD Graphics %d", &family);
|
||||
/*
|
||||
int glmajor = 0;
|
||||
int glminor = 0;
|
||||
int major = 0;
|
||||
int minor = 0;
|
||||
int release = 0;
|
||||
sscanf(g_ogl_config.gl_version, "%d.%d INTEL-%d.%d.%d", &glmajor, &glminor, &major, &minor, &release);
|
||||
version = 10000*major + 1000*minor + release;
|
||||
*/
|
||||
break;
|
||||
// We don't care about these
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DriverDetails::Init(vendor, driver, version);
|
||||
DriverDetails::Init(vendor, driver, version, family);
|
||||
}
|
||||
|
||||
// Init functions
|
||||
@ -359,11 +372,7 @@ Renderer::Renderer()
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart = true;
|
||||
g_Config.backend_info.bSupportsEarlyZ = false;
|
||||
|
||||
#ifdef ANDROID
|
||||
g_ogl_config.bSupportsGLSLCache = false;
|
||||
#else
|
||||
g_ogl_config.bSupportsGLSLCache = true;
|
||||
#endif
|
||||
g_ogl_config.bSupportsGLPinnedMemory = false;
|
||||
g_ogl_config.bSupportsGLSync = true;
|
||||
g_ogl_config.bSupportsGLBaseVertex = false;
|
||||
@ -470,7 +479,8 @@ Renderer::Renderer()
|
||||
|
||||
g_Config.backend_info.bSupportsDualSourceBlend = TO_BOOL(GLEW_ARB_blend_func_extended);
|
||||
g_Config.backend_info.bSupportsGLSLUBO = TO_BOOL(GLEW_ARB_uniform_buffer_object);
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart = TO_BOOL(GLEW_VERSION_3_1) || TO_BOOL(GLEW_NV_primitive_restart);
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart = !DriverDetails::HasBug(DriverDetails::BUG_PRIMITIVERESTART) &&
|
||||
(TO_BOOL(GLEW_VERSION_3_1) || TO_BOOL(GLEW_NV_primitive_restart));
|
||||
g_Config.backend_info.bSupportsEarlyZ = TO_BOOL(GLEW_ARB_shader_image_load_store);
|
||||
|
||||
g_ogl_config.bSupportsGLSLCache = TO_BOOL(GLEW_ARB_get_program_binary);
|
||||
@ -1680,6 +1690,7 @@ void Renderer::SetGenerationMode()
|
||||
// none, ccw, cw, ccw
|
||||
if (bpmem.genMode.cullmode > 0)
|
||||
{
|
||||
// TODO: GX_CULL_ALL not supported, yet!
|
||||
glEnable(GL_CULL_FACE);
|
||||
glFrontFace(bpmem.genMode.cullmode == 2 ? GL_CCW : GL_CW);
|
||||
}
|
||||
|
@ -44,7 +44,9 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType)
|
||||
m_uploadtype = BUFFERDATA;
|
||||
else if(g_ogl_config.bSupportsGLSync && g_ActiveConfig.bHackedBufferUpload && (m_uploadtype & MAP_AND_RISK))
|
||||
m_uploadtype = MAP_AND_RISK;
|
||||
else if(g_ogl_config.bSupportsGLSync && g_ogl_config.bSupportsGLPinnedMemory && (m_uploadtype & PINNED_MEMORY))
|
||||
else if(g_ogl_config.bSupportsGLSync && g_ogl_config.bSupportsGLPinnedMemory &&
|
||||
!(DriverDetails::HasBug(DriverDetails::BUG_BROKENPINNEDMEMORY) && type == GL_ELEMENT_ARRAY_BUFFER) &&
|
||||
(m_uploadtype & PINNED_MEMORY))
|
||||
m_uploadtype = PINNED_MEMORY;
|
||||
else if(nvidia && (m_uploadtype & BUFFERSUBDATA))
|
||||
m_uploadtype = BUFFERSUBDATA;
|
||||
|
@ -385,6 +385,10 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
|
||||
float w[3] = { 1.0f / v0->projectedPosition.w, 1.0f / v1->projectedPosition.w, 1.0f / v2->projectedPosition.w };
|
||||
InitSlope(&WSlope, w[0], w[1], w[2], fltdx31, fltdx12, fltdy12, fltdy31);
|
||||
|
||||
// TODO: The zfreeze emulation is not quite correct, yet!
|
||||
// Many things might prevent us from reaching this line (culling, clipping, scissoring).
|
||||
// However, the zslope is always guaranteed to be calculated unless all vertices are trivially rejected during clipping!
|
||||
// We're currently sloppy at this since we abort early if any of the culling/clipping/scissoring tests fail.
|
||||
if (!bpmem.genMode.zfreeze || !g_SWVideoConfig.bZFreeze)
|
||||
InitSlope(&ZSlope, v0->screenPosition[2], v1->screenPosition[2], v2->screenPosition[2], fltdx31, fltdx12, fltdy12, fltdy31);
|
||||
|
||||
|
Reference in New Issue
Block a user