font changing on the fly

This commit is contained in:
2026-05-22 17:27:29 +10:00
parent af448c338c
commit be9f3b4e8b
3 changed files with 13 additions and 3 deletions

View File

@@ -12,8 +12,8 @@
"frameRate": "59.94"
},
"output": {
"backend": "ndi",
"device": "shader toys",
"backend": "decklink",
"device": "default",
"resolution": "1080p",
"frameRate": "59.94",
"keying": {

View File

@@ -103,8 +103,14 @@ bool RuntimeTextTextureCache::EnsureTextTexture(TextTexture& texture)
const RuntimePreparedTextTexture* prepared = FindPreparedTexture(texture.parameterId);
if (!prepared || !prepared->rgbaPixels || prepared->rgbaPixels->empty() || prepared->width == 0 || prepared->height == 0)
return false;
if (texture.texture != 0 && texture.cachedText == prepared->textValue && texture.width == prepared->width && texture.height == prepared->height)
if (texture.texture != 0 &&
texture.cachedText == prepared->textValue &&
texture.cachedPixels == prepared->rgbaPixels &&
texture.width == prepared->width &&
texture.height == prepared->height)
{
return true;
}
if (texture.texture == 0)
glGenTextures(1, &texture.texture);
@@ -130,6 +136,7 @@ bool RuntimeTextTextureCache::EnsureTextTexture(TextTexture& texture)
glActiveTexture(GL_TEXTURE0);
texture.cachedText = prepared->textValue;
texture.cachedPixels = prepared->rgbaPixels;
texture.width = prepared->width;
texture.height = prepared->height;
texture.liveWidth = prepared->liveWidth;
@@ -154,4 +161,5 @@ void RuntimeTextTextureCache::DestroyTexture(TextTexture& texture)
texture.width = 0;
texture.height = 0;
texture.cachedText.clear();
texture.cachedPixels.reset();
}

View File

@@ -4,6 +4,7 @@
#include "RuntimeShaderArtifact.h"
#include <map>
#include <memory>
#include <string>
#include <vector>
@@ -28,6 +29,7 @@ private:
{
std::string parameterId;
std::string cachedText;
std::shared_ptr<const std::vector<unsigned char>> cachedPixels;
GLuint texture = 0;
unsigned width = 0;
unsigned height = 0;