changeset 1109:f91b3144e52a

did: improve error message
author sam <sam@basx.dev>
date Sat, 13 Apr 2024 11:55:22 +0700
parents 2e7b9807f0e1
children b382ffab50a3
files semicongine/material.nim
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/material.nim	Sat Apr 13 11:20:13 2024 +0700
+++ b/semicongine/material.nim	Sat Apr 13 11:55:22 2024 +0700
@@ -56,8 +56,10 @@
   for attr in shader.inputs:
     if attr.perInstance:
       assert materialType.instanceAttributes.contains(attr.name), &"MaterialType '{materialType}' requires instance attribute '{attr.name}' in order to be renderable with the assigned shader '{shader}'"
+      assert materialType.instanceAttributes[attr.name] == attr.theType, &"Instance attribute '{attr.name}' of MaterialType '{materialType}' is of type {materialType.instanceAttributes[attr.name]} but assigned shader '{shader}' declares type '{attr.theType}'"
     else:
       assert materialType.vertexAttributes.contains(attr.name), &"MaterialType '{materialType}' requires vertex attribute '{attr.name}' in order to be renderable with the assigned shader '{shader}'"
+      assert materialType.vertexAttributes[attr.name] == attr.theType, &"Vertex attribute '{attr.name}' of MaterialType '{materialType}' is of type {materialType.vertexAttributes[attr.name]} but assigned shader '{shader}' declares type '{attr.theType}'"
 
 proc `$`*(material: MaterialData): string =
   var attributes: seq[string]