Merge remote-tracking branch 'origin/master' into Android-trash

This commit is contained in:
Ryan Houdek
2013-04-13 00:58:37 -05:00
417 changed files with 23059 additions and 19251 deletions

View File

@ -145,7 +145,7 @@ void OpenGL_ReportARBProgramError()
{
GLint loc = 0;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &loc);
ERROR_LOG(VIDEO, "program error at %d: ", loc);
ERROR_LOG(VIDEO, "Program error at %d: ", loc);
ERROR_LOG(VIDEO, "%s", (char*)pstr);
ERROR_LOG(VIDEO, "\n");
}

View File

@ -30,7 +30,7 @@ void PerfQuery::EnableQuery(PerfQueryGroup type)
if (ARRAYSIZE(m_query_buffer) == m_query_count)
{
FlushOne();
//ERROR_LOG(VIDEO, "flushed query buffer early!");
//ERROR_LOG(VIDEO, "Flushed query buffer early!");
}
// start query

View File

@ -165,7 +165,7 @@ void ApplyShader()
std::string code;
std::string path = File::GetUserPath(D_SHADERS_IDX) + g_ActiveConfig.sPostProcessingShader + ".txt";
if(!File::ReadFileToString(true, path.c_str(), code)) {
ERROR_LOG(VIDEO, "post-processing shader not found: %s", path.c_str());
ERROR_LOG(VIDEO, "Post-processing shader not found: %s", path.c_str());
return;
}

View File

@ -21,6 +21,7 @@
#include "Debugger.h"
#include "Statistics.h"
#include "ImageWrite.h"
#include "Render.h"
namespace OGL
{
@ -122,8 +123,15 @@ void SHADER::SetProgramBindings()
glBindFragDataLocationIndexed(glprogid, 0, 0, "ocol0");
glBindFragDataLocationIndexed(glprogid, 0, 1, "ocol1");
}
else
else if(g_ogl_config.eSupportedGLSLVersion > GLSL_120)
{
glBindFragDataLocation(glprogid, 0, "ocol0");
}
else
{
// ogl2 shaders don't need to bind output colors.
// gl_FragColor already point to color channel
}
// Need to set some attribute locations
glBindAttribLocation(glprogid, SHADER_POSITION_ATTRIB, "rawpos");
@ -270,7 +278,7 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons
glAttachShader(pid, vsid);
glAttachShader(pid, psid);
if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
if (g_ogl_config.bSupportsGLSLCache)
glProgramParameteri(pid, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
shader.SetProgramBindings();
@ -406,14 +414,14 @@ void ProgramShaderCache::Init(void)
}
// Read our shader cache, only if supported
if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
if (g_ogl_config.bSupportsGLSLCache)
{
GLint Supported;
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &Supported);
if(!Supported)
{
ERROR_LOG(VIDEO, "GL_ARB_get_program_binary is supported, but no binary format is known. So disable shader cache.");
g_ActiveConfig.backend_info.bSupportsGLSLCache = false;
g_ogl_config.bSupportsGLSLCache = false;
}
else
{
@ -439,7 +447,7 @@ void ProgramShaderCache::Init(void)
void ProgramShaderCache::Shutdown(void)
{
// store all shaders in cache on disk
if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
if (g_ogl_config.bSupportsGLSLCache)
{
PCache::iterator iter = pshaders.begin();
for (; iter != pshaders.end(); ++iter)
@ -481,32 +489,17 @@ void ProgramShaderCache::Shutdown(void)
void ProgramShaderCache::CreateHeader ( void )
{
#ifdef _WIN32
// Intel Windows driver has a issue:
// their glsl doesn't know about the ubo extension, so we can't load it.
// but as version 140, ubo is in core and don't have to be loaded in glsl.
// as sandy do ogl3.1, glsl 140 is supported, so force it in this way.
// TODO: remove this again when the issue is fixed:
// see http://communities.intel.com/thread/36084
char *vendor = (char*)glGetString(GL_VENDOR);
bool glsl140_hack = strcmp(vendor, "Intel") == 0;
#elif __APPLE__
// as apple doesn't support glsl130 at all, we also have to use glsl140
bool glsl140_hack = true;
#else
bool glsl140_hack = false;
#endif
GLSL_VERSION v = g_ogl_config.eSupportedGLSLVersion;
snprintf(s_glsl_header, sizeof(s_glsl_header),
"#version %s\n"
"%s\n" // tex_rect
"%s\n" // ubo
"\n"// A few required defines and ones that will make our lives a lot easier
"#define ATTRIN in\n"
"#define ATTROUT out\n"
"#define VARYIN centroid in\n"
"#define VARYOUT centroid out\n"
"#define ATTRIN %s\n"
"#define ATTROUT %s\n"
"#define VARYIN %s\n"
"#define VARYOUT %s\n"
// Silly differences
"#define float2 vec2\n"
@ -518,10 +511,27 @@ void ProgramShaderCache::CreateHeader ( void )
"#define saturate(x) clamp(x, 0.0f, 1.0f)\n"
"#define lerp(x, y, z) mix(x, y, z)\n"
// glsl 120 hack
"%s\n"
"%s\n"
"%s\n"
"%s\n"
"%s\n"
"#define COLOROUT(name) %s\n"
, glsl140_hack ? "140" : "130"
, glsl140_hack ? "#define texture2DRect texture" : "#extension GL_ARB_texture_rectangle : enable"
, g_ActiveConfig.backend_info.bSupportsGLSLUBO && !glsl140_hack ? "#extension GL_ARB_uniform_buffer_object : enable" : "// ubo disabled"
, v==GLSL_120 ? "120" : v==GLSL_130 ? "130" : "140"
, v<=GLSL_130 ? "#extension GL_ARB_texture_rectangle : enable" : "#define texture2DRect texture"
, g_ActiveConfig.backend_info.bSupportsGLSLUBO && v!=GLSL_140 ? "#extension GL_ARB_uniform_buffer_object : enable" : ""
, v==GLSL_120 ? "attribute" : "in"
, v==GLSL_120 ? "attribute" : "out"
, v==GLSL_120 ? "varying" : "centroid in"
, v==GLSL_120 ? "varying" : "centroid out"
, v==GLSL_120 ? "#define texture texture2D" : ""
, v==GLSL_120 ? "#define round(x) floor((x)+0.5f)" : ""
, v==GLSL_120 ? "#define out " : ""
, v==GLSL_120 ? "#define ocol0 gl_FragColor" : ""
, v==GLSL_120 ? "#define ocol1 gl_FragColor" : "" //TODO: implemenet dual source blend
, v==GLSL_120 ? "" : "out vec4 name;"
);
}

View File

@ -128,9 +128,9 @@ const u8 rasters[char_count][char_height] = {
static const char *s_vertexShaderSrc =
"uniform vec2 charSize;\n"
"in vec2 rawpos;\n"
"in vec2 tex0;\n"
"out vec2 uv0;\n"
"ATTRIN vec2 rawpos;\n"
"ATTRIN vec2 tex0;\n"
"VARYOUT vec2 uv0;\n"
"void main(void) {\n"
" gl_Position = vec4(rawpos,0,1);\n"
" uv0 = tex0 * charSize;\n"
@ -139,8 +139,8 @@ static const char *s_vertexShaderSrc =
static const char *s_fragmentShaderSrc =
"uniform sampler2D samp8;\n"
"uniform vec4 color;\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"VARYIN vec2 uv0;\n"
"COLOROUT(ocol0)\n"
"void main(void) {\n"
" ocol0 = texture(samp8,uv0) * color;\n"
"}\n";

View File

@ -24,7 +24,9 @@
#include <cstdio>
#include "GLUtil.h"
#if defined(HAVE_WX) && HAVE_WX
#include "WxUtils.h"
#endif
#include "FileUtil.h"
@ -103,6 +105,21 @@ int OSDInternalW, OSDInternalH;
namespace OGL
{
enum MultisampleMode {
MULTISAMPLE_OFF,
MULTISAMPLE_2X,
MULTISAMPLE_4X,
MULTISAMPLE_8X,
MULTISAMPLE_CSAA_8X,
MULTISAMPLE_CSAA_8XQ,
MULTISAMPLE_CSAA_16X,
MULTISAMPLE_CSAA_16XQ,
MULTISAMPLE_SSAA_4X,
};
VideoConfig g_ogl_config;
// Declarations and definitions
// ----------------------------
static int s_fps = 0;
@ -117,9 +134,10 @@ static int s_MSAASamples = 1;
static int s_MSAACoverageSamples = 0;
static int s_LastMultisampleMode = 0;
static bool s_bHaveCoverageMSAA = false;
static u32 s_blendMode;
static bool s_vsync;
#if defined(HAVE_WX) && HAVE_WX
static std::thread scrshotThread;
#endif
@ -133,7 +151,7 @@ static std::vector<u32> s_efbCache[2][EFB_CACHE_WIDTH * EFB_CACHE_HEIGHT]; // 2
int GetNumMSAASamples(int MSAAMode)
{
int samples, maxSamples;
int samples;
switch (MSAAMode)
{
case MULTISAMPLE_OFF:
@ -147,6 +165,7 @@ int GetNumMSAASamples(int MSAAMode)
case MULTISAMPLE_4X:
case MULTISAMPLE_CSAA_8X:
case MULTISAMPLE_CSAA_16X:
case MULTISAMPLE_SSAA_4X:
samples = 4;
break;
@ -159,12 +178,11 @@ int GetNumMSAASamples(int MSAAMode)
default:
samples = 1;
}
glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
if(samples <= maxSamples) return samples;
if(samples <= g_ogl_config.max_samples) return samples;
ERROR_LOG(VIDEO, "MSAA Bug: %d samples selected, but only %d supported by gpu.", samples, maxSamples);
return maxSamples;
ERROR_LOG(VIDEO, "MSAA Bug: %d samples selected, but only %d supported by GPU.", samples, g_ogl_config.max_samples);
return g_ogl_config.max_samples;
}
int GetNumMSAACoverageSamples(int MSAAMode)
@ -185,12 +203,59 @@ int GetNumMSAACoverageSamples(int MSAAMode)
default:
samples = 0;
}
if(s_bHaveCoverageMSAA || samples == 0) return samples;
if(g_ogl_config.bSupportCoverageMSAA || samples == 0) return samples;
ERROR_LOG(VIDEO, "MSAA Bug: CSAA selected, but not supported by gpu.");
ERROR_LOG(VIDEO, "MSAA Bug: CSAA selected, but not supported by GPU.");
return 0;
}
void ApplySSAASettings() {
if(g_ActiveConfig.iMultisampleMode == MULTISAMPLE_SSAA_4X) {
if(g_ogl_config.bSupportSampleShading) {
glEnable(GL_SAMPLE_SHADING_ARB);
glMinSampleShadingARB(s_MSAASamples);
} else {
ERROR_LOG(VIDEO, "MSAA Bug: SSAA selected, but not supported by GPU.");
}
} else if(g_ogl_config.bSupportSampleShading) {
glDisable(GL_SAMPLE_SHADING_ARB);
}
}
void ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* message, void* userParam)
{
const char *s_source;
const char *s_type;
switch(source)
{
case GL_DEBUG_SOURCE_API_ARB: s_source = "API"; break;
case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: s_source = "Window System"; break;
case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB: s_source = "Shader Compiler"; break;
case GL_DEBUG_SOURCE_THIRD_PARTY_ARB: s_source = "Third Party"; break;
case GL_DEBUG_SOURCE_APPLICATION_ARB: s_source = "Application"; break;
case GL_DEBUG_SOURCE_OTHER_ARB: s_source = "Other"; break;
default: s_source = "Unknown"; break;
}
switch(type)
{
case GL_DEBUG_TYPE_ERROR_ARB: s_type = "Error"; break;
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: s_type = "Deprecated"; break;
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: s_type = "Undefined"; break;
case GL_DEBUG_TYPE_PORTABILITY_ARB: s_type = "Portability"; break;
case GL_DEBUG_TYPE_PERFORMANCE_ARB: s_type = "Performance"; break;
case GL_DEBUG_TYPE_OTHER_ARB: s_type = "Other"; break;
default: s_type = "Unknown"; break;
}
switch(severity)
{
case GL_DEBUG_SEVERITY_HIGH_ARB: ERROR_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
case GL_DEBUG_SEVERITY_MEDIUM_ARB: WARN_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
case GL_DEBUG_SEVERITY_LOW_ARB: WARN_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
default: ERROR_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
}
}
// Init functions
Renderer::Renderer()
{
@ -201,15 +266,6 @@ Renderer::Renderer()
s_ShowEFBCopyRegions_VBO = 0;
s_blendMode = 0;
InitFPSCounter();
const char* gl_vendor = (const char*)glGetString(GL_VENDOR);
const char* gl_renderer = (const char*)glGetString(GL_RENDERER);
const char* gl_version = (const char*)glGetString(GL_VERSION);
OSD::AddMessage(StringFromFormat("Video Info: %s, %s, %s",
gl_vendor,
gl_renderer,
gl_version).c_str(), 5000);
bool bSuccess = true;
GLint numvertexattribs = 0;
@ -231,6 +287,15 @@ Renderer::Renderer()
ERROR_LOG(VIDEO, "glewInit() failed! Does your video card support OpenGL 2.x?");
return; // TODO: fail
}
#if defined(_DEBUG) || defined(DEBUGFAST)
if (GLEW_ARB_debug_output)
{
glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, true);
glDebugMessageCallbackARB( ErrorCallback, NULL );
glEnable( GL_DEBUG_OUTPUT );
}
#endif
if (!GLEW_EXT_secondary_color)
{
@ -268,54 +333,96 @@ Renderer::Renderer()
bSuccess = false;
}
s_bHaveCoverageMSAA = GLEW_NV_framebuffer_multisample_coverage;
if (!bSuccess)
return; // TODO: fail
g_Config.backend_info.bSupportsDualSourceBlend = GLEW_ARB_blend_func_extended;
g_Config.backend_info.bSupportsGLSLUBO = GLEW_ARB_uniform_buffer_object;
g_Config.backend_info.bSupportsGLPinnedMemory = GLEW_AMD_pinned_memory;
g_Config.backend_info.bSupportsGLSync = GLEW_ARB_sync;
g_Config.backend_info.bSupportsGLSLCache = GLEW_ARB_get_program_binary;
g_Config.backend_info.bSupportsGLBaseVertex = GLEW_ARB_draw_elements_base_vertex;
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;
g_ogl_config.bSupportsGLSync = GLEW_ARB_sync;
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);
g_ogl_config.gl_version = (const char*)glGetString(GL_VERSION);
g_ogl_config.glsl_version = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
if(strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10"))
{
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need at least GLSL 1.20\n"
"GPU: Does your video card support OpenGL 2.1?\n"
"GPU: Your driver supports glsl %s", g_ogl_config.glsl_version);
bSuccess = false;
}
else if(strstr(g_ogl_config.glsl_version, "1.20"))
{
g_ogl_config.eSupportedGLSLVersion = GLSL_120;
g_Config.backend_info.bSupportsDualSourceBlend = false; //TODO: implemenet dual source blend
}
else if(strstr(g_ogl_config.glsl_version, "1.30"))
{
g_ogl_config.eSupportedGLSLVersion = GLSL_130;
}
else
{
g_ogl_config.eSupportedGLSLVersion = GLSL_140;
}
glGetIntegerv(GL_MAX_SAMPLES, &g_ogl_config.max_samples);
if(g_ogl_config.max_samples < 1)
g_ogl_config.max_samples = 1;
if(g_Config.backend_info.bSupportsGLSLUBO && (
// hd3000 get corruption, hd4000 also and a big slowdown
!strcmp(gl_vendor, "Intel Open Source Technology Center") && (!strcmp(gl_version, "3.0 Mesa 9.0.0") || !strcmp(gl_version, "3.0 Mesa 9.0.1") || !strcmp(gl_version, "3.0 Mesa 9.0.2") || !strcmp(gl_version, "3.0 Mesa 9.0.3") || !strcmp(gl_version, "3.0 Mesa 9.1.0") )
!strcmp(g_ogl_config.gl_vendor, "Intel Open Source Technology Center") && (
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.0.0") ||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.0.1") ||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.0.2") ||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.0.3") ||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.1.0") ||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.1.1") )
)) {
g_Config.backend_info.bSupportsGLSLUBO = false;
ERROR_LOG(VIDEO, "buggy driver detected. Disable UBO");
ERROR_LOG(VIDEO, "Buggy driver detected. Disable UBO");
}
#ifndef _WIN32
if(g_Config.backend_info.bSupportsGLPinnedMemory && !strcmp(gl_vendor, "Advanced Micro Devices, Inc.")) {
g_Config.backend_info.bSupportsGLPinnedMemory = false;
ERROR_LOG(VIDEO, "some fglrx versions have broken pinned memory support, so it's disabled for fglrx");
}
#endif
UpdateActiveConfig();
OSD::AddMessage(StringFromFormat("Missing Extensions: %s%s%s%s%s%s",
OSD::AddMessage(StringFromFormat("Video Info: %s, %s, %s",
g_ogl_config.gl_vendor,
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%s",
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "UniformBuffer ",
g_ActiveConfig.backend_info.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
g_ActiveConfig.backend_info.bSupportsGLSLCache ? "" : "ShaderCache ",
g_ActiveConfig.backend_info.bSupportsGLBaseVertex ? "" : "BaseVertex ",
g_ActiveConfig.backend_info.bSupportsGLSync ? "" : "Sync "
).c_str(), 5000);
if (!bSuccess)
return; // TODO: fail
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
g_ogl_config.bSupportsGLSLCache ? "" : "ShaderCache ",
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
g_ogl_config.bSupportsGLSync ? "" : "Sync ",
g_ogl_config.bSupportCoverageMSAA ? "" : "CSAA ",
g_ogl_config.bSupportSampleShading ? "" : "SSAA "
);
s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode;
s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode);
s_MSAACoverageSamples = GetNumMSAACoverageSamples(s_LastMultisampleMode);
ApplySSAASettings();
// Decide frambuffer size
s_backbuffer_width = (int)GLInterface->GetBackBufferWidth();
s_backbuffer_height = (int)GLInterface->GetBackBufferHeight();
// Handle VSync on/off
int swapInterval = g_ActiveConfig.IsVSync() ? 1 : 0;
GLInterface->SwapInterval(swapInterval);
s_vsync = g_ActiveConfig.IsVSync();
GLInterface->SwapInterval(s_vsync);
// check the max texture width and height
GLint max_texture_size;
@ -371,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();
}
@ -405,15 +526,15 @@ void Renderer::Init()
s_pfont = new RasterFont();
ProgramShaderCache::CompileShader(s_ShowEFBCopyRegions,
"in vec2 rawpos;\n"
"in vec3 color0;\n"
"out vec4 c;\n"
"ATTRIN vec2 rawpos;\n"
"ATTRIN vec3 color0;\n"
"VARYOUT vec4 c;\n"
"void main(void) {\n"
" gl_Position = vec4(rawpos,0,1);\n"
" c = vec4(color0, 1.0);\n"
"}\n",
"in vec4 c;\n"
"out vec4 ocol0;\n"
"VARYIN vec4 c;\n"
"COLOROUT(ocol0)\n"
"void main(void) {\n"
" ocol0 = c;\n"
"}\n");
@ -450,10 +571,6 @@ void Renderer::DrawDebugInfo()
if (g_ActiveConfig.bShowEFBCopyRegions)
{
// Store Line Size
GLfloat lSize;
glGetFloatv(GL_LINE_WIDTH, &lSize);
// Set Line Size
glLineWidth(3.0f);
@ -566,7 +683,7 @@ void Renderer::DrawDebugInfo()
glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6);
// Restore Line Size
glLineWidth(lSize);
SetLineWidth();
// Clear stored regions
stats.efb_regions.clear();
@ -920,8 +1037,8 @@ void Renderer::SetBlendMode(bool forceUpdate)
GL_ONE,
GL_DST_COLOR,
GL_ONE_MINUS_DST_COLOR,
GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA, // NOTE: If dual-source blending is enabled, use SRC1_ALPHA
(useDualSource) ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
(useDualSource) ? GL_ONE_MINUS_SRC1_ALPHA : (GLenum)GL_ONE_MINUS_SRC_ALPHA,
(target_has_alpha) ? GL_DST_ALPHA : (GLenum)GL_ONE,
(target_has_alpha) ? GL_ONE_MINUS_DST_ALPHA : (GLenum)GL_ZERO
};
@ -931,8 +1048,8 @@ void Renderer::SetBlendMode(bool forceUpdate)
GL_ONE,
GL_SRC_COLOR,
GL_ONE_MINUS_SRC_COLOR,
GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA, // NOTE: If dual-source blending is enabled, use SRC1_ALPHA
(useDualSource) ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
(useDualSource) ? GL_ONE_MINUS_SRC1_ALPHA : (GLenum)GL_ONE_MINUS_SRC_ALPHA,
(target_has_alpha) ? GL_DST_ALPHA : (GLenum)GL_ONE,
(target_has_alpha) ? GL_ONE_MINUS_DST_ALPHA : (GLenum)GL_ZERO
};
@ -973,30 +1090,32 @@ void Renderer::SetBlendMode(bool forceUpdate)
if (changes & 0x1FA)
{
GLenum srcFactor = glSrcFactors[(newval >> 3) & 7];
GLenum dstFactor = glDestFactors[(newval >> 6) & 7];
GLenum srcFactorAlpha = srcFactor;
GLenum dstFactorAlpha = dstFactor;
u32 srcidx = (newval >> 3) & 7;
u32 dstidx = (newval >> 6) & 7;
GLenum srcFactor = glSrcFactors[srcidx];
GLenum dstFactor = glDestFactors[dstidx];
// adjust alpha factors
if (useDualSource)
{
srcFactorAlpha = GL_ONE;
dstFactorAlpha = GL_ZERO;
srcidx = GX_BL_ONE;
dstidx = GX_BL_ZERO;
}
else
{
// we can't use GL_DST_COLOR or GL_ONE_MINUS_DST_COLOR for source in alpha channel so use their alpha equivalent instead
if (srcidx == GX_BL_DSTCLR) srcidx = GX_BL_DSTALPHA;
if (srcidx == GX_BL_INVDSTCLR) srcidx = GX_BL_INVDSTALPHA;
if (srcFactor == GL_SRC_ALPHA)
srcFactor = GL_SRC1_ALPHA;
else if (srcFactor == GL_ONE_MINUS_SRC_ALPHA)
srcFactor = GL_ONE_MINUS_SRC1_ALPHA;
if (dstFactor == GL_SRC_ALPHA)
dstFactor = GL_SRC1_ALPHA;
else if (dstFactor == GL_ONE_MINUS_SRC_ALPHA)
dstFactor = GL_ONE_MINUS_SRC1_ALPHA;
}
// we can't use GL_SRC_COLOR or GL_ONE_MINUS_SRC_COLOR for destination in alpha channel so use their alpha equivalent instead
if (dstidx == GX_BL_SRCCLR) dstidx = GX_BL_SRCALPHA;
if (dstidx == GX_BL_INVSRCCLR) dstidx = GX_BL_INVSRCALPHA;
}
GLenum srcFactorAlpha = glSrcFactors[srcidx];
GLenum dstFactorAlpha = glDestFactors[dstidx];
// blend RGB change
glBlendFuncSeparate(srcFactor, dstFactor, srcFactorAlpha, dstFactorAlpha);
}
s_blendMode = newval;
}
@ -1076,8 +1195,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
int xfbWidth = xfbSource->srcWidth;
int hOffset = ((s32)xfbSource->srcAddr - (s32)xfbAddr) / ((s32)fbWidth * 2);
drawRc.top = flipped_trc.bottom + (hOffset + xfbHeight) * flipped_trc.GetHeight() / fbHeight;
drawRc.bottom = flipped_trc.bottom + hOffset * flipped_trc.GetHeight() / fbHeight;
drawRc.top = flipped_trc.top - hOffset * flipped_trc.GetHeight() / fbHeight;
drawRc.bottom = flipped_trc.top - (hOffset + xfbHeight) * flipped_trc.GetHeight() / fbHeight;
drawRc.left = flipped_trc.left + (flipped_trc.GetWidth() - xfbWidth * flipped_trc.GetWidth() / fbWidth)/2;
drawRc.right = flipped_trc.left + (flipped_trc.GetWidth() + xfbWidth * flipped_trc.GetWidth() / fbWidth)/2;
@ -1270,7 +1389,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode;
s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode);
s_MSAACoverageSamples = GetNumMSAACoverageSamples(s_LastMultisampleMode);
ApplySSAASettings();
delete g_framebuffer_manager;
g_framebuffer_manager = new FramebufferManager(s_target_width, s_target_height,
s_MSAASamples, s_MSAACoverageSamples);
@ -1289,7 +1409,9 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
DrawDebugText();
GL_REPORT_ERRORD();
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_ONFRAME);
OSD::DrawMessages();
GL_REPORT_ERRORD();
@ -1307,7 +1429,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
GL_REPORT_ERRORD();
GLInterface->SwapInterval(g_ActiveConfig.IsVSync() ? 1 : 0);
if(s_vsync != g_ActiveConfig.IsVSync())
{
s_vsync = g_ActiveConfig.IsVSync();
GLInterface->SwapInterval(s_vsync);
}
// Clean out old stuff from caches. It's not worth it to clean out the shader caches.
DLCache::ProgressiveCleanup();

View File

@ -9,6 +9,31 @@ namespace OGL
void ClearEFBCache();
enum GLSL_VERSION {
GLSL_120,
GLSL_130,
GLSL_140 // and above
};
// ogl-only config, so not in VideoConfig.h
extern struct VideoConfig {
bool bSupportsGLSLCache;
bool bSupportsGLPinnedMemory;
bool bSupportsGLSync;
bool bSupportsGLBaseVertex;
bool bSupportCoverageMSAA;
bool bSupportSampleShading;
GLSL_VERSION eSupportedGLSLVersion;
bool bSupportOGL31;
const char *gl_vendor;
const char *gl_renderer;
const char* gl_version;
const char* glsl_version;
s32 max_samples;
} g_ogl_config;
class Renderer : public ::Renderer
{
public:

View File

@ -19,6 +19,7 @@
#include "GLUtil.h"
#include "StreamBuffer.h"
#include "MemoryUtil.h"
#include "Render.h"
namespace OGL
{
@ -31,19 +32,19 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType)
{
glGenBuffers(1, &m_buffer);
bool nvidia = !strcmp((const char*)glGetString(GL_VENDOR), "NVIDIA Corporation");
bool nvidia = !strcmp(g_ogl_config.gl_vendor, "NVIDIA Corporation");
if(m_uploadtype == STREAM_DETECT)
if(m_uploadtype & STREAM_DETECT)
{
if(!g_Config.backend_info.bSupportsGLBaseVertex)
if(!g_ogl_config.bSupportsGLBaseVertex && (m_uploadtype & BUFFERSUBDATA))
m_uploadtype = BUFFERSUBDATA;
else if(g_Config.backend_info.bSupportsGLSync && g_Config.bHackedBufferUpload)
else if(g_ogl_config.bSupportsGLSync && g_Config.bHackedBufferUpload && (m_uploadtype & MAP_AND_RISK))
m_uploadtype = MAP_AND_RISK;
else if(g_Config.backend_info.bSupportsGLSync && g_Config.backend_info.bSupportsGLPinnedMemory)
else if(g_ogl_config.bSupportsGLSync && g_ogl_config.bSupportsGLPinnedMemory && (m_uploadtype & PINNED_MEMORY))
m_uploadtype = PINNED_MEMORY;
else if(nvidia)
else if(nvidia && (m_uploadtype & BUFFERSUBDATA))
m_uploadtype = BUFFERSUBDATA;
else if(g_Config.backend_info.bSupportsGLSync)
else if(g_ogl_config.bSupportsGLSync && (m_uploadtype & MAP_AND_SYNC))
m_uploadtype = MAP_AND_SYNC;
else
m_uploadtype = MAP_AND_ORPHAN;
@ -124,6 +125,7 @@ void StreamBuffer::Alloc ( size_t size, u32 stride )
m_iterator_aligned = 0;
break;
case STREAM_DETECT:
case DETECT_MASK: // Just to shutup warnings
break;
}
m_iterator = m_iterator_aligned;
@ -139,7 +141,7 @@ size_t StreamBuffer::Upload ( u8* data, size_t size )
memcpy(pointer, data, size);
glUnmapBuffer(m_buffertype);
} else {
ERROR_LOG(VIDEO, "buffer mapping failed");
ERROR_LOG(VIDEO, "Buffer mapping failed");
}
break;
case PINNED_MEMORY:
@ -151,6 +153,7 @@ size_t StreamBuffer::Upload ( u8* data, size_t size )
glBufferSubData(m_buffertype, m_iterator, size, data);
break;
case STREAM_DETECT:
case DETECT_MASK: // Just to shutup warnings
break;
}
size_t ret = m_iterator;
@ -189,7 +192,7 @@ void StreamBuffer::Init()
// on error, switch to another backend. some old catalyst seems to have broken pinned memory support
if(glGetError() != GL_NO_ERROR) {
ERROR_LOG(VIDEO, "pinned memory detected, but not working. Please report this: %s, %s, %s", glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION));
ERROR_LOG(VIDEO, "Pinned memory detected, but not working. Please report this: %s, %s, %s", g_ogl_config.gl_vendor, g_ogl_config.gl_renderer, g_ogl_config.gl_version);
Shutdown();
m_uploadtype = MAP_AND_SYNC;
Init();
@ -201,9 +204,10 @@ void StreamBuffer::Init()
pointer = (u8*)glMapBuffer(m_buffertype, GL_WRITE_ONLY);
glUnmapBuffer(m_buffertype);
if(!pointer)
ERROR_LOG(VIDEO, "buffer allocation failed");
ERROR_LOG(VIDEO, "Buffer allocation failed");
case STREAM_DETECT:
case DETECT_MASK: // Just to shutup warnings
break;
}
}
@ -230,6 +234,7 @@ void StreamBuffer::Shutdown()
FreeAlignedMemory(pointer);
break;
case STREAM_DETECT:
case DETECT_MASK: // Just to shutup warnings
break;
}
}

View File

@ -32,18 +32,19 @@
namespace OGL
{
enum StreamType {
STREAM_DETECT,
MAP_AND_ORPHAN,
MAP_AND_SYNC,
MAP_AND_RISK,
PINNED_MEMORY,
BUFFERSUBDATA
DETECT_MASK = 0x3F,
STREAM_DETECT = (1 << 0),
MAP_AND_ORPHAN = (1 << 1),
MAP_AND_SYNC = (1 << 2),
MAP_AND_RISK = (1 << 3),
PINNED_MEMORY = (1 << 4),
BUFFERSUBDATA = (1 << 5)
};
class StreamBuffer {
public:
StreamBuffer(u32 type, size_t size, StreamType uploadType = STREAM_DETECT);
StreamBuffer(u32 type, size_t size, StreamType uploadType = DETECT_MASK);
~StreamBuffer();
void Alloc(size_t size, u32 stride = 0);

View File

@ -74,8 +74,6 @@ struct VBOCache {
};
static std::map<u64,VBOCache> s_VBO;
static u32 s_TempFramebuffer = 0;
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level)
{
int width = std::max(virtual_width >> level, 1);
@ -107,12 +105,20 @@ TextureCache::TCacheEntry::~TCacheEntry()
glDeleteTextures(1, &texture);
texture = 0;
}
if (framebuffer)
{
glDeleteFramebuffers(1, &framebuffer);
framebuffer = 0;
}
}
TextureCache::TCacheEntry::TCacheEntry()
{
glGenTextures(1, &texture);
GL_REPORT_ERRORD();
framebuffer = 0;
}
void TextureCache::TCacheEntry::Bind(unsigned int stage)
@ -268,9 +274,13 @@ TextureCache::TCacheEntryBase* TextureCache::CreateRenderTargetTexture(
entry->m_tex_levels = 1;
glTexImage2D(GL_TEXTURE_2D, 0, gl_iformat, scaled_tex_w, scaled_tex_h, 0, gl_format, gl_type, NULL);
glBindTexture(GL_TEXTURE_2D, 0);
glGenFramebuffers(1, &entry->framebuffer);
FramebufferManager::SetFramebuffer(entry->framebuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, entry->texture, 0);
GL_REPORT_FBO_ERROR();
SetStage();
GL_REPORT_ERRORD();
@ -290,17 +300,12 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
FramebufferManager::ResolveAndGetDepthTarget(srcRect) :
FramebufferManager::ResolveAndGetRenderTarget(srcRect);
GL_REPORT_ERRORD();
GL_REPORT_ERRORD();
if (type != TCET_EC_DYNAMIC || g_ActiveConfig.bCopyEFBToTexture)
{
if (s_TempFramebuffer == 0)
glGenFramebuffers(1, (GLuint*)&s_TempFramebuffer);
FramebufferManager::SetFramebuffer(framebuffer);
FramebufferManager::SetFramebuffer(s_TempFramebuffer);
// Bind texture to temporary framebuffer
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
GL_REPORT_FBO_ERROR();
GL_REPORT_ERRORD();
glActiveTexture(GL_TEXTURE0+9);
@ -353,10 +358,10 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
(GLfloat)targetSource.left, (GLfloat)targetSource.bottom,
-1.f, -1.f,
(GLfloat)targetSource.left, (GLfloat)targetSource.top,
1.f, -1.f,
(GLfloat)targetSource.right, (GLfloat)targetSource.top,
1.f, 1.f,
(GLfloat)targetSource.right, (GLfloat)targetSource.bottom
(GLfloat)targetSource.right, (GLfloat)targetSource.bottom,
1.f, -1.f,
(GLfloat)targetSource.right, (GLfloat)targetSource.top
};
glBindBuffer(GL_ARRAY_BUFFER, vbo_it->second.vbo);
@ -366,14 +371,11 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
}
glBindVertexArray(vbo_it->second.vao);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
GL_REPORT_ERRORD();
// Unbind texture from temporary framebuffer
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
}
if (false == g_ActiveConfig.bCopyEFBToTexture)
@ -419,8 +421,8 @@ TextureCache::TextureCache()
const char *pColorMatrixProg =
"uniform sampler2DRect samp9;\n"
"uniform vec4 colmat[7];\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"VARYIN vec2 uv0;\n"
"COLOROUT(ocol0)\n"
"\n"
"void main(){\n"
" vec4 texcol = texture2DRect(samp9, uv0);\n"
@ -431,8 +433,8 @@ TextureCache::TextureCache()
const char *pDepthMatrixProg =
"uniform sampler2DRect samp9;\n"
"uniform vec4 colmat[5];\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"VARYIN vec2 uv0;\n"
"COLOROUT(ocol0)\n"
"\n"
"void main(){\n"
" vec4 texcol = texture2DRect(samp9, uv0);\n"
@ -443,9 +445,9 @@ TextureCache::TextureCache()
const char *VProgram =
"in vec2 rawpos;\n"
"in vec2 tex0;\n"
"out vec2 uv0;\n"
"ATTRIN vec2 rawpos;\n"
"ATTRIN vec2 tex0;\n"
"VARYOUT vec2 uv0;\n"
"void main()\n"
"{\n"
" uv0 = tex0;\n"
@ -477,12 +479,6 @@ TextureCache::~TextureCache()
glDeleteVertexArrays(1, &it->second.vao);
}
s_VBO.clear();
if (s_TempFramebuffer)
{
glDeleteFramebuffers(1, (GLuint*)&s_TempFramebuffer);
s_TempFramebuffer = 0;
}
}
void TextureCache::DisableStage(unsigned int stage)

View File

@ -41,6 +41,7 @@ private:
struct TCacheEntry : TCacheEntryBase
{
GLuint texture;
GLuint framebuffer;
PC_TexFormat pcfmt;

View File

@ -66,9 +66,9 @@ static int s_cached_srcWidth = 0;
static int s_cached_srcHeight = 0;
static const char *VProgram =
"in vec2 rawpos;\n"
"in vec2 tex0;\n"
"out vec2 uv0;\n"
"ATTRIN vec2 rawpos;\n"
"ATTRIN vec2 tex0;\n"
"VARYOUT vec2 uv0;\n"
"void main()\n"
"{\n"
" uv0 = tex0;\n"
@ -80,8 +80,8 @@ void CreatePrograms()
// Output is BGRA because that is slightly faster than RGBA.
const char *FProgramRgbToYuyv =
"uniform sampler2DRect samp9;\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"VARYIN vec2 uv0;\n"
"COLOROUT(ocol0)\n"
"void main()\n"
"{\n"
" vec3 c0 = texture2DRect(samp9, uv0).rgb;\n"
@ -96,8 +96,8 @@ void CreatePrograms()
const char *FProgramYuyvToRgb =
"uniform sampler2DRect samp9;\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"VARYIN vec2 uv0;\n"
"COLOROUT(ocol0)\n"
"void main()\n"
"{\n"
" vec4 c0 = texture2DRect(samp9, uv0).rgba;\n"
@ -250,10 +250,10 @@ void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc,
(float)sourceRc.left, (float)sourceRc.top,
-1.f, 1.f,
(float)sourceRc.left, (float)sourceRc.bottom,
1.f, 1.f,
(float)sourceRc.right, (float)sourceRc.bottom,
1.f, -1.f,
(float)sourceRc.right, (float)sourceRc.top
(float)sourceRc.right, (float)sourceRc.top,
1.f, 1.f,
(float)sourceRc.right, (float)sourceRc.bottom
};
glBindBuffer(GL_ARRAY_BUFFER, s_encode_VBO );
glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
@ -262,7 +262,7 @@ void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc,
}
glBindVertexArray( s_encode_VAO );
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
@ -426,10 +426,10 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destRender
(float)srcFmtWidth, (float)srcHeight,
1.f, 1.f,
(float)srcFmtWidth, 0.f,
-1.f, 1.f,
0.f, 0.f,
-1.f, -1.f,
0.f, (float)srcHeight
0.f, (float)srcHeight,
-1.f, 1.f,
0.f, 0.f
};
glBindBuffer(GL_ARRAY_BUFFER, s_decode_VBO );
@ -440,7 +440,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destRender
}
glBindVertexArray( s_decode_VAO );
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
GL_REPORT_ERRORD();

View File

@ -41,6 +41,7 @@
#include "Debugger.h"
#include "StreamBuffer.h"
#include "PerfQueryBase.h"
#include "Render.h"
#include "main.h"
@ -72,7 +73,7 @@ void VertexManager::CreateDeviceObjects()
{
s_vertexBuffer = new StreamBuffer(GL_ARRAY_BUFFER, MAX_VBUFFER_SIZE);
m_vertex_buffers = s_vertexBuffer->getBuffer();
s_indexBuffer = new StreamBuffer(GL_ELEMENT_ARRAY_BUFFER, MAX_IBUFFER_SIZE);
s_indexBuffer = new StreamBuffer(GL_ELEMENT_ARRAY_BUFFER, MAX_IBUFFER_SIZE, (StreamType)(DETECT_MASK & ~PINNED_MEMORY));
m_index_buffers = s_indexBuffer->getBuffer();
m_CurrentVertexFmt = NULL;
@ -123,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();
if(g_Config.backend_info.bSupportsGLBaseVertex) {
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)
@ -142,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)
@ -233,7 +236,7 @@ void VertexManager::vFlush()
PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, 0, 0);
}
else
ERROR_LOG(VIDEO, "error loading texture");
ERROR_LOG(VIDEO, "Error loading texture");
}
}

View File

@ -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"
@ -141,7 +142,7 @@ void InitBackendInfo()
g_Config.backend_info.bSupportsPixelLighting = true;
// aamodes
const char* caamodes[] = {"None", "2x", "4x", "8x", "8x CSAA", "8xQ CSAA", "16x CSAA", "16xQ CSAA"};
const char* caamodes[] = {_trans("None"), "2x", "4x", "8x", "8x CSAA", "8xQ CSAA", "16x CSAA", "16xQ CSAA", "4x SSAA"};
g_Config.backend_info.AAModes.assign(caamodes, caamodes + sizeof(caamodes)/sizeof(*caamodes));
// pp shaders
@ -156,7 +157,10 @@ void VideoBackend::ShowConfig(void *_hParent)
diag.ShowModal();
#endif
}
void Test(u32 Data)
{
printf("Data: %d\n", Data);
}
bool VideoBackend::Initialize(void *&window_handle)
{
InitializeShared();
@ -174,6 +178,9 @@ bool VideoBackend::Initialize(void *&window_handle)
if (!GLInterface->Create(window_handle))
return false;
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_INIT);
s_BackendInitialized = true;
return true;
@ -199,6 +206,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();
@ -220,6 +228,10 @@ void VideoBackend::Video_Prepare()
void VideoBackend::Shutdown()
{
s_BackendInitialized = false;
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_SHUTDOWN);
GLInterface->Shutdown();
}
@ -253,6 +265,7 @@ void VideoBackend::Video_Cleanup() {
OpcodeDecoder_Shutdown();
delete g_renderer;
g_renderer = NULL;
GLInterface->ClearCurrent();
}
}