Shader compilado como valor; binarios gerados pelos backends
"compile o shader [pilha]" vira um reporter: devolve o shader compilado,
um bloco-handle com referencias contadas que se guarda numa variavel
("mude [ondas] para (compile o shader ...)", "use o shader (ondas) no
objeto"); sai o registro de shaders por nome.
A 3d continua sem saber de backend: compila os blocos para GLSL e para o
interpretador do software e pede o binario a cada renderizador pelo
contrato (Tb3dRenderer.compile, versao 3). A vk gera SPIR-V (a libshaderc
e a interface do fragment voltam para ela); a gl liga o programa na thread
dela e devolve o binario do driver (glGetProgramBinary), que carrega com
glProgramBinary e, se recusado, recompila o GLSL. O monitor mostra
"shader compilado (vulkan: 2940 bytes, opengl: 10953 bytes)".
Notacao do forum: a pilha de um encaixe vem embaixo tambem quando o bloco
com o encaixe e um reporter dentro do bloco da linha.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
16009eca8e
commit
1c3103ec55
16 files changed
+1186
-608
No files matched your search
@@ -331,6 +331,22 @@ static const Model* model_of(const Models* M, const char* type) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* O bloco da linha (ou um repórter encaixado nele, em profundidade) que tem
|
||||
encaixe de pilha: a pilha dele vem nas linhas de baixo. -1 = nenhum.
|
||||
Ex.: "mude [s v] para (compile o shader)" + a pilha + "end". */
|
||||
static int stack_holder(const Models* M, const TbBpTab* tab, int bi, const Model** md) {
|
||||
if (bi < 0 || bi >= tab->blocks_n || !tab->blocks[bi].used) return -1;
|
||||
const Model* m = model_of(M, tab->blocks[bi].type);
|
||||
if (m) { *md = m; return bi; }
|
||||
for (int s = 0; s < TB_BP_MAX_INPUTS; s++) {
|
||||
int c = tab->blocks[bi].args[s];
|
||||
if (c < 0) continue;
|
||||
int h = stack_holder(M, tab, c, md);
|
||||
if (h >= 0) return h;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* "define nome (a) rotulo <b>": um bloco do usuario achado no texto */
|
||||
#define PROTO_MAX 64
|
||||
typedef struct {
|
||||
@@ -609,9 +625,10 @@ static void render_chain(const Models* M, const TbBpTab* tab, int bi, int depth,
|
||||
indent(out, depth);
|
||||
render_block(M, tab, c, out, true);
|
||||
sb_str(out, "\n");
|
||||
const Model* md = model_of(M, b->type);
|
||||
if (md && md->stack_slot >= 0 && md->stack_slot < TB_BP_MAX_INPUTS) {
|
||||
render_chain(M, tab, b->args[md->stack_slot], depth + 1, out);
|
||||
const Model* md = NULL;
|
||||
int holder = stack_holder(M, tab, c, &md);
|
||||
if (holder >= 0 && md->stack_slot < TB_BP_MAX_INPUTS) {
|
||||
render_chain(M, tab, tab->blocks[holder].args[md->stack_slot], depth + 1, out);
|
||||
indent(out, depth); sb_str(out, "end\n");
|
||||
}
|
||||
if (sh == TB_SB_C1 || sh == TB_SB_C2 || sh == TB_SB_CAP) {
|
||||
@@ -920,10 +937,11 @@ int tb_scratchblocks_import(const char* text, TbBpTab* out, const TbSbContext* c
|
||||
else if (depth > 0) tb_blueprint_link(out, L->cblock, TB_BP_REL_SUB0 + L->sub, bi);
|
||||
L->last = bi;
|
||||
}
|
||||
const Model* md = outer ? NULL : model_of(&M, out->blocks[bi].type);
|
||||
if (md && md->stack_slot >= 0 && depth + 1 < LEVEL_MAX) { /* encaixe de pilha: sub < 0 */
|
||||
const Model* md = NULL;
|
||||
int holder = outer ? -1 : stack_holder(&M, out, bi, &md);
|
||||
if (holder >= 0 && depth + 1 < LEVEL_MAX) { /* encaixe de pilha (sub < 0): no bloco ou num repórter dele */
|
||||
depth++;
|
||||
lv[depth].cblock = bi; lv[depth].sub = -1 - md->stack_slot; lv[depth].last = -1;
|
||||
lv[depth].cblock = holder; lv[depth].sub = -1 - md->stack_slot; lv[depth].last = -1;
|
||||
} else if (!outer && (sh == TB_SB_C1 || sh == TB_SB_C2 || sh == TB_SB_CAP) && depth + 1 < LEVEL_MAX) {
|
||||
depth++;
|
||||
lv[depth].cblock = bi; lv[depth].sub = 0; lv[depth].last = -1;
|
||||
|
||||
Reference in new issue
Block a user