internal/graphicsdriver/opengl: assume custom attributes are vec4

Due to HLSL restrictions, all the attributes must have a semantics.
Always assuming custom attributes are vec4 makes things simpler.

Updates #2640
This commit is contained in:
Hajime Hoshi 2024-08-25 17:09:10 +09:00
parent 107189a00d
commit ed45843c13

View File

@ -114,17 +114,17 @@ func init() {
},
}
n := theArrayBufferLayout.float32Count()
if n > graphics.VertexFloatCount {
panic("opengl: the array buffer layout is too large")
diff := graphics.VertexFloatCount - n
if diff == 0 {
return
}
if n < graphics.VertexFloatCount {
d := graphics.VertexFloatCount - n
if d > 4 {
panic("opengl: the array buffer layout is too small")
}
if diff%4 != 0 {
panic("opengl: unexpected attribute layout")
}
for i := 0; i < diff/4; i++ {
theArrayBufferLayout.addPart(arrayBufferLayoutPart{
name: "A3",
num: d,
name: fmt.Sprintf("A%d", i+3),
num: 4,
})
}
}