JayFoxRox / Lindbergh-Emulator

A Sega Lindbergh environment / HLE for Linux
46 stars 8 forks source link

Vertex attributes might not be bound correctly #77

Open JayFoxRox opened 5 years ago

JayFoxRox commented 5 years ago

Migrated from original GitLab issue 72

nvidia had this thing where each fixed-function attribute mapped to an index in the hardware. However, as generic binding of vertex attributes by index was started, this overlapped.

See https://www.khronos.org/registry/OpenGL/extensions/NV/NV_vertex_program.txt (2.14.1.6 Semantic Meaning for Vertex Attributes and Program Parameters)

glVertexAttribPointerARB(3, ..) should actally be an alias for glColorPointer

I'm not sure how GLSL handles this, it seems to work fine for attribute 0 as gl_Position, but that might just be luck?

Unfortunately, doing this the other way around (mapping old-attributes to custom ones) would require emulation of the fixed function pipeline or duplicate uploads (to custom attributes and the fixed-function ones).

So to resolve this, glVertexAttribPointerARB should always alias, except for weights (probably).

A better solution can be implemented later.

JayFoxRox commented 5 years ago

I've done this and it seems to help, but it's still not looking correct.

I came up with another hack now, but this might upload attributes twice (although this could be improved).

!!! The hack does not work for immediate mode though !!!

(Probably doesn't work without vertexshader either?!)