mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-12-25 00:15:18 +00:00
Merge pull request #1618 from vlj/gl
gl: Enable core context and debug output.
This commit is contained in:
commit
27a8c074fa
@ -15,6 +15,8 @@ endif()
|
||||
set(PNG_SHARED OFF CACHE BOOL "Build shared lib." FORCE)
|
||||
set(PNG_TESTS OFF CACHE BOOL "Build tests." FORCE)
|
||||
|
||||
add_definitions(-DCMAKE_BUILD)
|
||||
|
||||
add_subdirectory( asmjit )
|
||||
add_subdirectory( 3rdparty/libpng )
|
||||
# TODO: do real installation, including copying directory structure
|
||||
|
@ -133,7 +133,7 @@ void GLGSRender::begin()
|
||||
__glcheck glDepthRange((f32&)rsx::method_registers[NV4097_SET_CLIP_MIN], (f32&)rsx::method_registers[NV4097_SET_CLIP_MAX]);
|
||||
__glcheck enable(rsx::method_registers[NV4097_SET_DITHER_ENABLE], GL_DITHER);
|
||||
|
||||
if (__glcheck enable(rsx::method_registers[NV4097_SET_ALPHA_TEST_ENABLE], GL_ALPHA_TEST))
|
||||
if (!!rsx::method_registers[NV4097_SET_ALPHA_TEST_ENABLE])
|
||||
{
|
||||
//TODO: NV4097_SET_ALPHA_REF must be converted to f32
|
||||
//glcheck(glAlphaFunc(rsx::method_registers[NV4097_SET_ALPHA_FUNC], rsx::method_registers[NV4097_SET_ALPHA_REF]));
|
||||
@ -205,7 +205,7 @@ void GLGSRender::begin()
|
||||
__glcheck enable(blend_mrt & 8, GL_BLEND, GL_COLOR_ATTACHMENT3);
|
||||
}
|
||||
|
||||
if (__glcheck enable(rsx::method_registers[NV4097_SET_LOGIC_OP_ENABLE], GL_LOGIC_OP))
|
||||
if (__glcheck enable(rsx::method_registers[NV4097_SET_LOGIC_OP_ENABLE], GL_COLOR_LOGIC_OP))
|
||||
{
|
||||
__glcheck glLogicOp(rsx::method_registers[NV4097_SET_LOGIC_OP]);
|
||||
}
|
||||
@ -261,14 +261,6 @@ void GLGSRender::begin()
|
||||
|
||||
__glcheck enable(rsx::method_registers[NV4097_SET_POLY_OFFSET_FILL_ENABLE], GL_POLYGON_OFFSET_FILL);
|
||||
|
||||
if (__glcheck enable(rsx::method_registers[NV4097_SET_POLYGON_STIPPLE], GL_POLYGON_STIPPLE))
|
||||
{
|
||||
__glcheck glPolygonStipple((GLubyte*)(rsx::method_registers + NV4097_SET_POLYGON_STIPPLE_PATTERN));
|
||||
}
|
||||
|
||||
__glcheck glPolygonMode(GL_FRONT, rsx::method_registers[NV4097_SET_FRONT_POLYGON_MODE]);
|
||||
__glcheck glPolygonMode(GL_BACK, rsx::method_registers[NV4097_SET_BACK_POLYGON_MODE]);
|
||||
|
||||
if (__glcheck enable(rsx::method_registers[NV4097_SET_CULL_FACE_ENABLE], GL_CULL_FACE))
|
||||
{
|
||||
__glcheck glCullFace(rsx::method_registers[NV4097_SET_CULL_FACE]);
|
||||
@ -288,14 +280,6 @@ void GLGSRender::begin()
|
||||
{
|
||||
__glcheck glPrimitiveRestartIndex(rsx::method_registers[NV4097_SET_RESTART_INDEX]);
|
||||
}
|
||||
|
||||
if (__glcheck enable(rsx::method_registers[NV4097_SET_LINE_STIPPLE], GL_LINE_STIPPLE))
|
||||
{
|
||||
u32 line_stipple_pattern = rsx::method_registers[NV4097_SET_LINE_STIPPLE_PATTERN];
|
||||
u16 factor = line_stipple_pattern;
|
||||
u16 pattern = line_stipple_pattern >> 16;
|
||||
__glcheck glLineStipple(factor, pattern);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, int count>
|
||||
@ -779,6 +763,8 @@ void GLGSRender::on_init_thread()
|
||||
GSRender::on_init_thread();
|
||||
|
||||
gl::init();
|
||||
if (rpcs3::config.rsx.d3d12.debug_output.value())
|
||||
gl::enable_debugging();
|
||||
LOG_NOTICE(RSX, "%s", (const char*)glGetString(GL_VERSION));
|
||||
LOG_NOTICE(RSX, "%s", (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
LOG_NOTICE(RSX, "%s", (const char*)glGetString(GL_VENDOR));
|
||||
|
@ -174,9 +174,7 @@ OPENGL_PROC(PFNGLTEXTUREBUFFERRANGEEXTPROC, TextureBufferRangeEXT);
|
||||
OPENGL_PROC(PFNGLCOPYIMAGESUBDATAPROC, CopyImageSubData);
|
||||
|
||||
//KHR_debug
|
||||
OPENGL_PROC(PFNGLDEBUGMESSAGECONTROLARBPROC, DebugMessageControlARB);
|
||||
OPENGL_PROC(PFNGLDEBUGMESSAGEINSERTARBPROC, DebugMessageInsertARB);
|
||||
OPENGL_PROC(PFNGLDEBUGMESSAGECALLBACKARBPROC, DebugMessageCallbackARB);
|
||||
OPENGL_PROC(PFNGLDEBUGMESSAGECALLBACKPROC, DebugMessageCallback);
|
||||
|
||||
OPENGL_PROC(PFNGLTEXSTORAGE2DPROC, TexStorage2D);
|
||||
//...
|
||||
|
@ -23,6 +23,31 @@ namespace gl
|
||||
throw new EXCEPTION("unknow primitive type");
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
void APIENTRY dbgFunc(GLenum source, GLenum type, GLuint id,
|
||||
GLenum severity, GLsizei lenght, const GLchar* message,
|
||||
const void* userParam)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GL_DEBUG_TYPE_ERROR:
|
||||
LOG_ERROR(RSX, "%s", message);
|
||||
return;
|
||||
default:
|
||||
LOG_WARNING(RSX, "%s", message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void enable_debugging()
|
||||
{
|
||||
#ifdef WIN32
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallback(static_cast<GLDEBUGPROC>(dbgFunc), nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void fbo::create()
|
||||
{
|
||||
glGenFramebuffers(1, &m_id);
|
||||
|
@ -53,6 +53,8 @@ namespace gl
|
||||
#define __glcheck
|
||||
#endif
|
||||
|
||||
void enable_debugging();
|
||||
|
||||
class exception : public std::exception
|
||||
{
|
||||
protected:
|
||||
|
@ -374,7 +374,7 @@ namespace rsx
|
||||
|
||||
glTexParameteri(m_target, GL_TEXTURE_COMPARE_FUNC, gl_tex_zfunc[tex.zfunc()]);
|
||||
|
||||
glTexEnvi(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, (GLint)tex.bias());
|
||||
// TODO: Handle texture bias
|
||||
glTexParameteri(m_target, GL_TEXTURE_MIN_LOD, (tex.min_lod() >> 8));
|
||||
glTexParameteri(m_target, GL_TEXTURE_MAX_LOD, (tex.max_lod() >> 8));
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "stdafx_gui.h"
|
||||
#include "GLGSFrame.h"
|
||||
#include "config.h"
|
||||
#include <wx/version.h>
|
||||
|
||||
GLGSFrame::GLGSFrame() : GSFrame("OpenGL")
|
||||
{
|
||||
@ -9,6 +11,14 @@ GLGSFrame::GLGSFrame() : GSFrame("OpenGL")
|
||||
WX_GL_RGBA,
|
||||
WX_GL_DEPTH_SIZE, 16,
|
||||
WX_GL_DOUBLEBUFFER,
|
||||
#if wxCHECK_VERSION(3, 1, 0)
|
||||
WX_GL_MAJOR_VERSION, 3,
|
||||
WX_GL_MINOR_VERSION, 3,
|
||||
WX_GL_CORE_PROFILE,
|
||||
#if !defined(CMAKE_BUILD)
|
||||
rpcs3::config.rsx.d3d12.debug_output.value() ? WX_GL_DEBUG : 0,
|
||||
#endif
|
||||
#endif
|
||||
0
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user