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