shithub: gpufs

Download patch

ref: 77e627174769161f3284c854073f21ea9181d982
parent: 2ea9cb1ccca882e47c316cde52302cd108310649
author: sirjofri <[email protected]>
date: Sat Feb 17 09:23:06 EST 2024

default descpool for shaders -1, basic compile checks

--- a/vm.c
+++ b/vm.c
@@ -147,6 +147,7 @@
 	objects[id].type = SHADER;
 	objects[id].s.buffer = nil;
 	objects[id].s.len = -1;
+	objects[id].s.descpool = -1;
 	updateinfostring(id);
 	return id;
 }
@@ -272,6 +273,22 @@
 int
 compileshader(vlong id)
 {
+	Shader *sh;
+	if (!validate(id, SHADER)) {
+		return 0;
+	}
+	
+	sh = &objects[id].s;
+	if (!sh->buffer || sh->len <= 0) {
+		werrstr("shader is empty");
+		return 0;
+	}
+	
+	if (sh->descpool < 0) {
+		werrstr("shader is not bound to a descriptor pool");
+		return 0;
+	}
+	
 	werrstr("not implemented!");
 	return 0;
 }