-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vertex arrays enabled when there's no data passed for them #5133
Comments
Good investigation. Hm. Texturing being enabled with no texture coordinates in the vertices is a totally valid scenario if (and probably only if) texture coordinate generation is enabled (gstate.getUVGenMode() != GE_TEXMAP_TEXTURE_COORDS (or UNKNOWN)). The check for enabling that vertex array thus needs to also check the texcoord gen mode, which we don't seem to do atm.. |
In this particular case, gstate.getUVGenMode() = GE_TEXMAP_TEXTURE_COORDS. Vertex type is 0x000001e0. There are 9 flushes per frame like this, and it keeps going. The crash only happens of course in hardware transform. -[Unknown] |
Okay, that's a game bug then, but one we should tolerate better. Not sure if we should emit 0.0 texcoords from the vertex decoder or generate special vertex shaders that simply write 0.0 for the fragment shader to read. |
Can't find any other unprotected attributes (well, position, but that should always be specified) so this fixes hrydgard#5133. Also fixes hrydgard#5124 for me.
While investigating #5124, I found a workaround: calling
gpu->CopyDisplayToOutput();
on savestate load fixed it. Weird. Almost figured that was good enough, but I dug deeper.I then found that what was "saving" it was
glVertexAttribPointer(program->a_texcoord0, 2, GL_FLOAT, GL_FALSE, 8, texCoords);
fromDrawActiveTexture()
. Otherwise, it crashes onglDrawArrays(glprim[prim], 0, vertexCount);
- presumably because there was no data for a_texcoord0 and it was enabled.So, then I looked into what was enabled. It turns out this is wholly controlled by this line:
And, indeed, this particular shader does have texturing enabled, therefore it does have a texcoord input parameter. However, the vertex does not have any texture coordinates - I guess it would just use whatever were previously passed (
maybe this is the cause of #4617?And the Star Ocean crash maybe?)Changing it to:
Safely works around the crash (although the other attributes might have issues too.) Another viable (and probably better, since I'm not sure what the behavior ought to be?) option is this in the shader:
Anyway, I guess we need to figure out what happens if texturing is enabled and no texcoords are passed, and also if any of the other vertex attributes can have this problem.
-[Unknown]
The text was updated successfully, but these errors were encountered: