Added wglSwapInterval and ARB_debug_output. Removed BX_UNUSED used for removing warnings when debug messages are compiled out.

This commit is contained in:
bkaradzic 2013-04-07 22:12:34 -07:00
parent 3a62f3cd9f
commit 253f313a34
7 changed files with 34 additions and 9 deletions

View file

@ -58,8 +58,6 @@ namespace bgfx
virtual void fatal(Fatal::Enum _code, const char* _str) BX_OVERRIDE
{
BX_TRACE("0x%08x: %s", _code, _str);
BX_UNUSED(_code);
BX_UNUSED(_str);
abort();
}

View file

@ -19,6 +19,7 @@ namespace bgfx
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
# define GL_IMPORT(_optional, _proto, _func) _proto _func
# include "glimports.h"
@ -115,6 +116,7 @@ namespace bgfx
wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
if (NULL != wglGetExtensionsStringARB)
{
@ -236,6 +238,12 @@ namespace bgfx
int result = wglMakeCurrent(m_hdc, m_context);
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "wglMakeCurrent failed!");
if (NULL != wglSwapIntervalEXT)
{
wglSwapIntervalEXT(0);
}
import();
}

View file

@ -137,6 +137,11 @@ GL_IMPORT(true, PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate);
GL_IMPORT(true, PFNGLBLENDEQUATIONSEPARATEPROC, glBlendEquationSeparate);
GL_IMPORT(true, PFNGLBLENDCOLORPROC, glBlendColor);
GL_IMPORT(true, PFNGLDEBUGMESSAGECONTROLARBPROC, glDebugMessageControlARB);
GL_IMPORT(true, PFNGLDEBUGMESSAGEINSERTARBPROC, glDebugMessageInsertARB);
GL_IMPORT(true, PFNGLDEBUGMESSAGECALLBACKARBPROC, glDebugMessageCallbackARB);
GL_IMPORT(true, PFNGLGETDEBUGMESSAGELOGARBPROC, glGetDebugMessageLogARB);
#if BGFX_CONFIG_DEBUG_GREMEDY
GL_IMPORT(true, PFNGLSTRINGMARKERGREMEDYPROC, glStringMarkerGREMEDY);
GL_IMPORT(true, PFNGLFRAMETERMINATORGREMEDYPROC, glFrameTerminatorGREMEDY);

View file

@ -1419,7 +1419,6 @@ namespace bgfx
, regIndex
, regCount
);
BX_UNUSED(kind);
}
m_constantBuffer->finish();

View file

@ -362,7 +362,6 @@ namespace bgfx
fmt.m_supported = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, fmt.m_usage, fmt.m_type, fmt.m_fmt) );
const char* fourcc = (const char*)&fmt.m_fmt;
BX_TRACE("\t%2d: %c%c%c%c %s", ii, fourcc[0], fourcc[1], fourcc[2], fourcc[3], fmt.m_supported ? "supported" : "");
BX_UNUSED(fourcc);
}
m_instancing = false
@ -1186,7 +1185,6 @@ namespace bgfx
, regIndex
, regCount
);
BX_UNUSED(kind);
}
m_constantBuffer->finish();

View file

@ -60,6 +60,7 @@ namespace bgfx
OES_rgb8_rgba8,
EXT_texture_storage,
EXT_blend_color,
ARB_debug_output,
Count
};
@ -115,6 +116,7 @@ namespace bgfx
{ "GL_OES_rgb8_rgba8", false, true },
{ "GL_EXT_texture_storage", false, true },
{ "GL_EXT_blend_color", BGFX_CONFIG_RENDERER_OPENGL >= 31, true },
{ "GL_ARB_debug_output", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
};
#if BGFX_CONFIG_RENDERER_OPENGLES3
@ -160,6 +162,17 @@ namespace bgfx
}
}
static void APIENTRY debugProcCb(GLenum _source, GLenum _type, GLuint _id, GLenum _severity, GLsizei /*_length*/, const GLchar* _message, GLvoid* /*_userParam*/)
{
BX_TRACE("src %d, type %d, id %d, severity %d, '%s'"
, _source
, _type
, _id
, _severity
, _message
);
}
struct RendererContext
{
RendererContext()
@ -959,7 +972,6 @@ namespace bgfx
, data
, offset
);
BX_UNUSED(offset);
}
m_constantBuffer->finish();
@ -2141,7 +2153,6 @@ namespace bgfx
}
BX_TRACE("GL_EXTENSION%s: %s", supported ? " (supported)" : "", name);
BX_UNUSED(supported);
pos += len+1;
}
@ -2249,6 +2260,14 @@ namespace bgfx
s_textureFormat[TextureFormat::L8].m_internalFmt = GL_R8;
s_textureFormat[TextureFormat::L8].m_fmt = GL_RED;
#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
#if BGFX_CONFIG_RENDERER_OPENGL
if (s_extension[Extension::ARB_debug_output].m_supported)
{
GL_CHECK(glDebugMessageCallbackARB(debugProcCb, NULL) );
GL_CHECK(glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE) );
}
#endif // BGFX_CONFIG_RENDERER_OPENGL
}
void Context::rendererShutdown()

View file

@ -666,7 +666,6 @@ bool compileHLSLShaderDx9(bx::CommandLine& _cmdLine, const std::string& _code, b
bx::write(_writer, un.regIndex);
bx::write(_writer, un.regCount);
BX_UNUSED(s_constantTypeName);
BX_TRACE("%s, %s, %d, %d, %d"
, un.name.c_str()
, s_constantTypeName[un.type]
@ -674,7 +673,6 @@ bool compileHLSLShaderDx9(bx::CommandLine& _cmdLine, const std::string& _code, b
, un.regIndex
, un.regCount
);
BX_UNUSED(s_constantTypeName);
}
uint16_t shaderSize = (uint16_t)code->GetBufferSize();