m_buffer_handle = 0;
m_buffer_usage = BufferUsageDynamicDraw;
m_faking_map = false;
+ m_name = "Unnamed Buffer";
SetUsage(BufferUsageStaticDraw);
}
m_buffer_type = bufType;
}
+void GraphicsBuffer::SetName(const char *name)
+{
+ m_name = name;
+}
+
void GraphicsBuffer::SetUsage(GraphicsBuffer::BufferUsage bufUsage)
{
if (bufUsage != m_buffer_usage)
glDeleteBuffers(1, &m_buffer_handle);
}
glGenBuffers(1, &m_buffer_handle);
+ glObjectLabel(GL_BUFFER, m_buffer_handle, -1, m_name);
m_buffer_shape_dirty = false;
if (m_buffer_size)
Upload(m_buffer_size, data);
void GraphicsBuffer::Resize(size_t length)
{
+ glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Resizing buffer.");
if (m_invalidated)
{
m_buffer_size = length;
glDeleteBuffers(1, &old_buffer);
m_buffer_size = length;
}
+ glPopDebugGroup();
}
void GraphicsBuffer::Bind() const
GraphicsBuffer();
~GraphicsBuffer();
+ void SetName(const char *name);
void SetType(BufferType bufType);
void SetUsage(BufferUsage bufUsage);
bool m_invalidated;
bool m_buffer_shape_dirty;
bool m_faking_map;
+ const char *m_name;
};
}
m_ibo.Invalidate();
m_ibo.SetUsage(GraphicsBuffer::BufferUsageStaticDraw);
m_ibo.SetType(GraphicsBuffer::BufferTypeIndex);
+ m_ibo.SetName("m_ibo: ObjectRenderer GPU indices");
m_ibo.Resize(max_objects * 2 * sizeof(uint32_t));
// BufferBuilder is used to construct the ibo
m_buffer_builder = new BufferBuilder<uint32_t>(m_ibo.Map(false, true, true), m_ibo.GetSize()); // new matches delete in ObjectRenderer::FinaliseBuffers
{
m_bezier_coeffs.SetType(GraphicsBuffer::BufferTypeTexture);
m_bezier_coeffs.SetUsage(GraphicsBuffer::BufferUsageDynamicDraw);
+ m_bezier_coeffs.SetName("m_bezier_coeffs: Bezier coefficients");
m_bezier_coeffs.Resize(objects.beziers.size()*sizeof(GPUBezierCoeffs));
BufferBuilder<GPUBezierCoeffs> builder(m_bezier_coeffs.Map(false, true, true), m_bezier_coeffs.GetSize());
m_bezier_ids.SetType(GraphicsBuffer::BufferTypeTexture);
m_bezier_ids.SetUsage(GraphicsBuffer::BufferUsageDynamicDraw);
+ m_bezier_ids.SetName("m_bezier_ids: object data_indices");
m_bezier_ids.Upload(objects.data_indices.size() * sizeof(uint32_t), &objects.data_indices[0]);
glGenTextures(1, &m_bezier_id_buffer_texture);
m_debug_font_vertices.SetUsage(GraphicsBuffer::BufferUsageStreamDraw);
m_debug_font_vertices.SetType(GraphicsBuffer::BufferTypeVertex);
+ m_debug_font_vertices.SetName("m_debug_font_vertices");
m_debug_font_vertices.Upload(8192,NULL);
m_debug_font_vertex_head = 0;
m_debug_font_indices.SetUsage(GraphicsBuffer::BufferUsageStreamDraw);
m_debug_font_indices.SetType(GraphicsBuffer::BufferTypeIndex);
+ m_debug_font_indices.SetName("m_debug_font_indices");
m_debug_font_indices.Resize(500);
m_debug_font_index_head = 0;
}
void Screen::DebugFontFlush()
{
-
+ glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 40, -1, "Screen::DebugFontFlush()");
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
m_debug_font_indices.Invalidate();
m_debug_font_vertex_head = 0;
m_debug_font_index_head = 0;
+
+ glPopDebugGroup();
}
struct fontvertex
{
if (!m_debug_font_atlas) return;
+ glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 41, -1, "Screen::DebugFontPrint()");
BufferBuilder<fontvertex> vertexData(m_debug_font_vertices.MapRange(m_debug_font_vertex_head*sizeof(float), m_debug_font_vertices.GetSize() - m_debug_font_vertex_head*sizeof(float), false, true, true), m_debug_font_vertices.GetSize() - m_debug_font_vertex_head*sizeof(float));
BufferBuilder<uint16_t> indexData(m_debug_font_indices.MapRange(m_debug_font_index_head*sizeof(uint16_t), m_debug_font_indices.GetSize() - m_debug_font_index_head*sizeof(uint16_t), false, true, true), m_debug_font_indices.GetSize() - m_debug_font_index_head*sizeof(uint16_t));
m_debug_font_vertices.UnMap();
DebugFontFlush();
DebugFontPrint(str);
+ glPopDebugGroup();
return;
}
if (*str >= 32 && (unsigned char)(*str) < 128) {
}
m_debug_font_indices.UnMap();
m_debug_font_vertices.UnMap();
+ glPopDebugGroup();
//DebugFontFlush();
}
bool ShaderProgram::AttachShader(const char * src_file, GLenum type)
{
GLuint shader_obj = glCreateShader(type);
+ glObjectLabel(GL_SHADER, shader_obj, -1, src_file);
char * src = GetShaderSource(src_file);
if (src == NULL)
{
*/
void View::Render(int width, int height)
{
+ glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION,42,-1, "Beginning View::Render()");
// View dimensions have changed (ie: Window was resized)
int prev_width = m_cached_display.GetWidth();
int prev_height = m_cached_display.GetHeight();
{
m_cached_display.UnBind();
m_cached_display.Blit();
+ glPopDebugGroup();
return;
}
m_cached_display.Bind(); //NOTE: This is redundant; Clear already calls Bind
m_cached_display.UnBind(); // resets render target to the screen
m_cached_display.Blit(); // blit FrameBuffer to screen
m_buffer_dirty = false;
+ glPopDebugGroup();
}
#ifndef QUADTREE_DISABLED
void View::RenderRange(int width, int height, unsigned first_obj, unsigned last_obj)
{
+ glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 43, -1, "View::RenderRange()");
if (m_render_dirty) // document has changed
PrepareRender();
m_object_renderers[i]->RenderUsingCPU(m_document.m_objects, *this, {m_cpu_rendering_pixels, width, height}, first_obj, last_obj);
}
}
+ glPopDebugGroup();
}
void View::UpdateObjBoundsVBO(unsigned first_obj, unsigned last_obj)
{
//m_objbounds_vbo.Invalidate();
m_objbounds_vbo.SetType(GraphicsBuffer::BufferTypeVertex);
+ m_objbounds_vbo.SetName("Object Bounds VBO");
if (m_use_gpu_transform)
{
m_objbounds_vbo.SetUsage(GraphicsBuffer::BufferUsageStaticDraw);
m_bounds_ubo.Invalidate();
m_bounds_ubo.SetType(GraphicsBuffer::BufferTypeUniform);
m_bounds_ubo.SetUsage(GraphicsBuffer::BufferUsageStreamDraw);
+ m_bounds_ubo.SetName("m_bounds_ubo: Screen bounds.");
// Instead of having each ObjectRenderer go through the whole document
// we initialise them, go through the document once adding to the appropriate Renderers