gsdx ogl: add a pretty name to various opengl opengl

This commit is contained in:
Gregory Hainaut 2016-06-07 20:30:56 +02:00
parent ff3d9bd373
commit fca2661e05
6 changed files with 32 additions and 17 deletions

View File

@ -256,7 +256,7 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
{
GL_PUSH("GSDeviceOGL::Convert");
m_convert.cb = new GSUniformBufferOGL(g_convert_index, sizeof(MiscConstantBuffer));
m_convert.cb = new GSUniformBufferOGL("Misc UBO", g_convert_index, sizeof(MiscConstantBuffer));
// Upload once and forget about it
m_misc_cb_cache.ScalingFactor = GSVector4i(theApp.GetConfigI("upscale_multiplier"));
m_convert.cb->cache_upload(&m_misc_cb_cache);
@ -266,7 +266,8 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
m_convert.vs = vs;
for(size_t i = 0; i < countof(m_convert.ps); i++) {
ps = m_shader->Compile("convert.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, convert_glsl);
m_convert.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
string pretty_name = "Convert pipe " + to_string(i);
m_convert.ps[i] = m_shader->LinkPipeline(pretty_name, vs, 0, ps);
}
PSSamplerSelector point;
@ -288,11 +289,12 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
{
GL_PUSH("GSDeviceOGL::Merge");
m_merge_obj.cb = new GSUniformBufferOGL(g_merge_cb_index, sizeof(MergeConstantBuffer));
m_merge_obj.cb = new GSUniformBufferOGL("Merge UBO", g_merge_cb_index, sizeof(MergeConstantBuffer));
for(size_t i = 0; i < countof(m_merge_obj.ps); i++) {
ps = m_shader->Compile("merge.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, merge_glsl);
m_merge_obj.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
string pretty_name = "Merge pipe " + to_string(i);
m_merge_obj.ps[i] = m_shader->LinkPipeline(pretty_name, vs, 0, ps);
}
}
@ -302,11 +304,12 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
{
GL_PUSH("GSDeviceOGL::Interlace");
m_interlace.cb = new GSUniformBufferOGL(g_interlace_cb_index, sizeof(InterlaceConstantBuffer));
m_interlace.cb = new GSUniformBufferOGL("Interlace UBO", g_interlace_cb_index, sizeof(InterlaceConstantBuffer));
for(size_t i = 0; i < countof(m_interlace.ps); i++) {
ps = m_shader->Compile("interlace.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, interlace_glsl);
m_interlace.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
string pretty_name = "Interlace pipe " + to_string(i);
m_interlace.ps[i] = m_shader->LinkPipeline(pretty_name, vs, 0, ps);
}
}
@ -324,7 +327,7 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
+ format("#define SB_CONTRAST %d.0\n", ShadeBoost_Contrast);
ps = m_shader->Compile("shadeboost.glsl", "ps_main", GL_FRAGMENT_SHADER, shadeboost_glsl, shade_macro);
m_shadeboost.ps = m_shader->LinkPipeline(vs, 0, ps);
m_shadeboost.ps = m_shader->LinkPipeline("ShadeBoost pipe", vs, 0, ps);
}
// ****************************************************************
@ -410,8 +413,8 @@ void GSDeviceOGL::CreateTextureFX()
{
GL_PUSH("GSDeviceOGL::CreateTextureFX");
m_vs_cb = new GSUniformBufferOGL(g_vs_cb_index, sizeof(VSConstantBuffer));
m_ps_cb = new GSUniformBufferOGL(g_ps_cb_index, sizeof(PSConstantBuffer));
m_vs_cb = new GSUniformBufferOGL("HW VS UBO", g_vs_cb_index, sizeof(VSConstantBuffer));
m_ps_cb = new GSUniformBufferOGL("HW PS UBO", g_ps_cb_index, sizeof(PSConstantBuffer));
// warning 1 sampler by image unit. So you cannot reuse m_ps_ss...
m_palette_ss = CreateSampler(false, false, false);
@ -1233,7 +1236,7 @@ void GSDeviceOGL::DoFXAA(GSTexture* sTex, GSTexture* dTex)
std::string fxaa_macro = "#define FXAA_GLSL_130 1\n";
fxaa_macro += "#extension GL_ARB_gpu_shader5 : enable\n";
GLuint ps = m_shader->Compile("fxaa.fx", "ps_main", GL_FRAGMENT_SHADER, fxaa_fx, fxaa_macro);
m_fxaa.ps = m_shader->LinkPipeline(m_convert.vs, 0, ps);
m_fxaa.ps = m_shader->LinkPipeline("FXAA pipe", m_convert.vs, 0, ps);
}
GL_PUSH("DoFxaa");
@ -1274,9 +1277,9 @@ void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
shader << fshader.rdbuf();
m_shaderfx.cb = new GSUniformBufferOGL(g_fx_cb_index, sizeof(ExternalFXConstantBuffer));
m_shaderfx.cb = new GSUniformBufferOGL("eFX UBO", g_fx_cb_index, sizeof(ExternalFXConstantBuffer));
GLuint ps = m_shader->Compile("Extra", "ps_main", GL_FRAGMENT_SHADER, shader.str().c_str(), config.str());
m_shaderfx.ps = m_shader->LinkPipeline(m_convert.vs, 0, ps);
m_shaderfx.ps = m_shader->LinkPipeline("eFX pipie", m_convert.vs, 0, ps);
}
GL_PUSH("DoExternalFX");

View File

@ -30,7 +30,7 @@ GSShaderOGL::GSShaderOGL(bool debug) :
m_debug_shader(debug)
{
// Create a default pipeline
m_pipeline = LinkPipeline(0, 0, 0);
m_pipeline = LinkPipeline("HW pipe", 0, 0, 0);
BindPipeline(m_pipeline);
}
@ -44,7 +44,7 @@ GSShaderOGL::~GSShaderOGL()
glDeleteProgramPipelines(m_pipe_to_delete.size(), &m_pipe_to_delete[0]);
}
GLuint GSShaderOGL::LinkPipeline(GLuint vs, GLuint gs, GLuint ps)
GLuint GSShaderOGL::LinkPipeline(const string& pretty_print, GLuint vs, GLuint gs, GLuint ps)
{
GLuint p;
glCreateProgramPipelines(1, &p);
@ -52,6 +52,8 @@ GLuint GSShaderOGL::LinkPipeline(GLuint vs, GLuint gs, GLuint ps)
glUseProgramStages(p, GL_GEOMETRY_SHADER_BIT, gs);
glUseProgramStages(p, GL_FRAGMENT_SHADER_BIT, ps);
glObjectLabel(GL_PROGRAM_PIPELINE, p, pretty_print.size(), pretty_print.c_str());
m_pipe_to_delete.push_back(p);
return p;

View File

@ -44,7 +44,7 @@ class GSShaderOGL {
void BindPipeline(GLuint pipe);
GLuint Compile(const std::string& glsl_file, const std::string& entry, GLenum type, const char* glsl_h_code, const std::string& macro_sel = "");
GLuint LinkPipeline(GLuint vs, GLuint gs, GLuint ps);
GLuint LinkPipeline(const string& pretty_print, GLuint vs, GLuint gs, GLuint ps);
// Same as above but for not separated build
void BindProgram(GLuint vs, GLuint gs, GLuint ps);

View File

@ -57,6 +57,9 @@ namespace PboPool {
for (size_t i = 0; i < countof(m_pool); i++) {
BindPbo();
string pretty_name = "PBO" + to_string(i);
glObjectLabel(GL_BUFFER, m_pool[i], pretty_name.size(), pretty_name.c_str());
glBufferStorage(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, create_flags);
m_map[m_current_pbo] = (char*)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_pbo_size, map_flags);
m_fence[m_current_pbo] = 0;

View File

@ -35,11 +35,12 @@ class GSUniformBufferOGL {
uint8* cache; // content of the previous upload
public:
GSUniformBufferOGL(GLuint index, uint32 size) : index(index)
, size(size)
GSUniformBufferOGL(const string& pretty_name, GLuint index, uint32 size)
: index(index), size(size)
{
glGenBuffers(1, &buffer);
bind();
glObjectLabel(GL_BUFFER, buffer, pretty_name.size(), pretty_name.c_str());
allocate();
attach();
cache = (uint8*)_aligned_malloc(size, 32);

View File

@ -64,6 +64,12 @@ class GSBufferOGL {
// TODO: if we do manually the synchronization, I'm not sure size is important. It worths to investigate it.
// => bigger buffer => less sync
bind();
if (STRIDE <= 4)
glObjectLabel(GL_BUFFER, m_buffer_name, -1, "IBO");
else
glObjectLabel(GL_BUFFER, m_buffer_name, -1, "VBO");
// coherency will be done by flushing
const GLbitfield common_flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT;
const GLbitfield map_flags = common_flags | GL_MAP_FLUSH_EXPLICIT_BIT;