cultmath: generator maps integer vector and matrix return types to HLSL
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
37bc6de8b1
commit
89bf977dcf
2 changed files with 8 additions and 1 deletions
|
|
@ -67,6 +67,13 @@ def write(kind, glsl, value):
|
|||
return {'f': 'asuint(%s)', 'i': 'asuint(%s)', 'u': '%s'}[kind] % value
|
||||
|
||||
|
||||
def hlsl_type(t):
|
||||
m = GLSL_VEC.match(t)
|
||||
if m:
|
||||
return {'': 'float', 'i': 'int', 'u': 'uint'}[m.group(1)] + m.group(2)
|
||||
return 'float3x3' if t == 'mat3' else t
|
||||
|
||||
|
||||
def body(sig, n, win, wout, defs, glsl):
|
||||
m = re.fullmatch(r'(\w+)\s+(\w+)\((.*)\)', sig)
|
||||
ret, name, params = m.group(1), m.group(2), [p.strip() for p in m.group(3).split(',') if p.strip()]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
static void *slurp(const char *p, size_t *n) {
|
||||
FILE *f = fopen(p, "rb"); if (!f) { perror(p); exit(2); }
|
||||
fseek(f, 0, SEEK_END); *n = ftell(f); fseek(f, 0, SEEK_SET);
|
||||
void *b = malloc(*n ? *n : 4); fread(b, 1, *n, f); fclose(f); return b;
|
||||
void *b = malloc(*n ? *n : 4); if (fread(b, 1, *n, f) != *n) exit(2); fclose(f); return b;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue