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" "frameRate": "59.94"
}, },
"output": { "output": {
"backend": "ndi", "backend": "decklink",
"device": "shader toys", "device": "default",
"resolution": "1080p", "resolution": "1080p",
"frameRate": "59.94", "frameRate": "59.94",
"keying": { "keying": {

View File

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

View File

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