include ofxProfiler

This commit is contained in:
jrkb 2023-04-19 13:51:41 +02:00
parent 297542abc9
commit 7ef6d13c93
4 changed files with 9 additions and 0 deletions

View file

@ -51,6 +51,7 @@ void GPUFontAtlasLayerCombo::setup(const ComboIdentifier & identifier,
cout << "Render type " << r->getType() << endl;
}
void GPUFontAtlasLayerCombo::update(){
OFX_PROFILER_FUNCTION();
for(const auto & layer : layers){
layer->update();
if(layer->isDirtyDirty()){
@ -133,6 +134,7 @@ const vector <shared_ptr <GPUFontLayer> > & GPUFontAtlasLayerCombo::getLayers(){
return layers;
}
void GPUFontAtlasLayerCombo::draw(){
OFX_PROFILER_FUNCTION();
GLuint location;
int width = ofGetWidth();
@ -159,6 +161,7 @@ void GPUFontAtlasLayerCombo::draw(){
float superLineHeight = 0;
if(font){
OFX_PROFILER_SCOPE("draw font");
fontShaderProgram = fontShader->program;
glUseProgram(fontShaderProgram);
@ -192,6 +195,7 @@ void GPUFontAtlasLayerCombo::draw(){
std::vector <ofVboMesh> outerBoundingBoxes;
for(const auto & layer : layers){
OFX_PROFILER_SCOPE("draw layer");
float lineHeight = font->getLineHeight(layer->getProps().fontSize_px);
float ascender = font->getAscender(layer->getProps().fontSize_px);
superLineHeight = lineHeight;

View file

@ -4,6 +4,7 @@
#include "ofMain.h"
#include "AtlasLayerCombo.h"
#include "GPUFontLayer.h"
#include "ofxProfiler.h"
#ifdef TARGET_EMSCRIPTEN
#include <GLES/gl.h>
#include <emscripten/emscripten.h>

View file

@ -65,13 +65,16 @@ void GPUFontLayer::setMomsComboIdentifier(const ComboIdentifier & identifier){
}
void GPUFontLayer::setProps(const Props & props){
OFX_PROFILER_FUNCTION();
if(propsBuffer.size() == 0 || props.text != propsBuffer[0].text
|| propsBuffer[0].fontVariations != props.fontVariations){
OFX_PROFILER_SCOPE("variations");
setDirtyDirty(true);
variationText.clear();
variationText.resize(props.text.size());
int i = 0;
for(const char c : props.text){
OFX_PROFILER_SCOPE("char");
ofxGPUFont::GlyphIdentity glyphIdentity;
glyphIdentity.charcode = ofxGPUFont::decodeCharcode(&c);
const Props & vProps = getProps(i * props.letterDelay);

View file

@ -1,5 +1,6 @@
#pragma once
#include "ofxProfiler.h"
#include "AtlasLayerCombo.h"
#include "font.hpp"
#include "ofMain.h"