From 868ba6279a20e4d1412c2d576c67400167de6694 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Tue, 30 Apr 2019 16:12:35 +0500 Subject: Integrated Optick profiler --- src/Framebuffer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Framebuffer.cpp') diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index fb7ebc7..d81b0e0 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -3,11 +3,13 @@ #include #include "Utility.hpp" #include "AssetManager.hpp" +#include const GLuint magic = 316784; GLuint quadVao = magic, quadVbo = magic; Framebuffer::Framebuffer(unsigned int width, unsigned int height, bool createDepthStencilBuffer) : width(width), height(height) { + OPTICK_EVENT(); if (quadVao == magic) { float quadVertices[] = { // positions // texCoords @@ -70,11 +72,13 @@ Framebuffer::~Framebuffer() { } void Framebuffer::Activate() { + OPTICK_EVENT(); glViewport(0, 0, width, height); glBindFramebuffer(GL_FRAMEBUFFER, fbo); } void Framebuffer::RenderTo(Framebuffer &target) { + OPTICK_EVENT(); glBindFramebuffer(GL_FRAMEBUFFER, target.fbo); glViewport(0, 0, target.width, target.height); AssetManager::GetAsset("/altcraft/shaders/fbo")->shader->Activate(); @@ -96,8 +100,8 @@ void Framebuffer::Resize(unsigned int newWidth, unsigned int newHeight) { } } -Framebuffer &Framebuffer::GetDefault() -{ +Framebuffer &Framebuffer::GetDefault() { + OPTICK_EVENT(); static char fboDefaultData[sizeof(Framebuffer)]; static Framebuffer *fboDefault = nullptr; if (fboDefault == nullptr) { @@ -111,8 +115,8 @@ Framebuffer &Framebuffer::GetDefault() return *fboDefault; } -void Framebuffer::Clear(bool color, bool depth, bool stencil) -{ +void Framebuffer::Clear(bool color, bool depth, bool stencil) { + OPTICK_EVENT(); Activate(); GLbitfield clearBits = 0; if (color) -- cgit v1.2.3