Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Macros are broken for WebGL #642

Closed
kvark opened this issue Mar 11, 2015 · 5 comments · Fixed by #646 or #650
Closed

Macros are broken for WebGL #642

kvark opened this issue Mar 11, 2015 · 5 comments · Fixed by #646 or #650

Comments

@kvark
Copy link
Member

kvark commented Mar 11, 2015

Reported by @AerialX for #641:

gfx_macros is broken. So, uh, if you can maybe show me how to not use it that'd be cool. The terrain demo has 3 matrix uniforms. By the time it got to the process() loop, it would only send two of the three, and they were corrupt / bad data.

@kvark
Copy link
Member Author

kvark commented Mar 11, 2015

wtf Params { model: [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], view: [[-0.999444, -0.014904, 0.029809, 0], [0.033327, -0.446965, 0.89393, 0], [0, 0.894427, 0.447214, 0], [0, 0, -35.777088, 1]], proj: [[1.299038, 0, 0, 0], [0, 1.732051, 0, 0], [0, 0, -1.0002, -1], [0, 0, -0.20002, 0]], _dummy: PhantomData }
Processing BindProgram(0)
Processing BindArrayBuffer(0)
Processing BindIndex(0)
Processing SetPrimitiveState(Primitive { front_face: CounterClockwise, method: Fill(Back), offset: None })
Processing SetViewport(Rect { x: 0, y: 0, w: 0, h: 0 })
Processing SetScissor(None)
Processing SetDepthStencilState(None, None, Nothing)
Processing SetBlendState(None)
Processing SetColorMask(ColorMask(Red | Green | Blue | Alpha))
Processing SetViewport(Rect { x: 0, y: 0, w: 800, h: 600 })
Processing Clear(ClearData { color: [0.3, 0.3, 0.3, 1], depth: 1, stencil: 0 }, Mask(65))
Processing BindProgram(6)
Processing BindUniform(7, ValueF32Matrix4([0, 0, 0, 0][0, 0, 0, 0][0, 0, 0, 0][0, 0, 0, 0]))
Processing BindUniform(8, ValueF32Matrix4([1.299038, 0, 0, 0][0, 1.732051, 0, 0][0, 0, -1.0002, -1][0, 0, -0.20002, 0]))
Processing SetDepthStencilState(None, None, Back)
Processing BindArrayBuffer(0)
Processing BindAttribute(0, 3, Format { elem_count: 1, elem_type: Int(Normalized, U8, Unsigned), offset: 0, stride: 24, instance_rate: 0 })
Processing BindAttribute(1, 3, Format { elem_count: 1, elem_type: Int(Normalized, U8, Signed), offset: 12, stride: 24, instance_rate: 0 })
Processing BindIndex(2)
Processing DrawIndexed(TriangleList, U32, 0, 1572864, 0, None)
wtf Params { model: [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], view: [[-0.997779, -0.029792, 0.059584, 0], [0.066617, -0.44622, 0.89244, 0], [0, 0.894427, 0.447214, 0], [0, 0, -35.777088, 1]], proj: [[1.299038, 0, 0, 0], [0, 1.732051, 0, 0], [0, 0, -1.0002, -1], [0, 0, -0.20002, 0]], _dummy: PhantomData }
Processing BindProgram(0)
Processing BindArrayBuffer(0)
Processing BindIndex(0)
Processing SetPrimitiveState(Primitive { front_face: CounterClockwise, method: Fill(Back), offset: None })
Processing SetViewport(Rect { x: 0, y: 0, w: 0, h: 0 })
Processing SetScissor(None)
Processing SetDepthStencilState(None, None, Nothing)
Processing SetBlendState(None)
Processing SetColorMask(ColorMask(Red | Green | Blue | Alpha))
Processing SetViewport(Rect { x: 0, y: 0, w: 800, h: 600 })
Processing Clear(ClearData { color: [0.3, 0.3, 0.3, 1], depth: 1, stencil: 0 }, Mask(65))
Processing BindProgram(6)
Processing BindUniform(7, ValueF32Matrix4([0, 0, 0, 0][0, 0, 0, 0][0, 0, 0, 0][0, 0, 0, 0]))
Processing BindUniform(8, ValueF32Matrix4([1.299038, 0, 0, 0][0, 1.732051, 0, 0][0, 0, -1.0002, -1][0, 0, -0.20002, 0]))
Processing SetDepthStencilState(None, None, Back)
Processing BindArrayBuffer(0)
Processing BindAttribute(0, 3, Format { elem_count: 1, elem_type: Int(Normalized, U8, Unsigned), offset: 0, stride: 24, instance_rate: 0 })
Processing BindAttribute(1, 3, Format { elem_count: 1, elem_type: Int(Normalized, U8, Signed), offset: 12, stride: 24, instance_rate: 0 })
Processing BindIndex(2)
Processing DrawIndexed(TriangleList, U32, 0, 1572864, 0, None)
wtf Params { model: [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], view: [[-0.995004, -0.044647, 0.089294, 0], [0.099833, -0.444979, 0.889959, 0], [0, 0.894427, 0.447214, 0], [0, 0, -35.777088, 1]], proj: [[1.299038, 0, 0, 0], [0, 1.732051, 0, 0], [0, 0, -1.0002, -1], [0, 0, -0.20002, 0]], _dummy: PhantomData }
Processing BindProgram(0)
Processing BindArrayBuffer(0)
Processing BindIndex(0)
Processing SetPrimitiveState(Primitive { front_face: CounterClockwise, method: Fill(Back), offset: None })
Processing SetViewport(Rect { x: 0, y: 0, w: 0, h: 0 })
Processing SetScissor(None)
Processing SetDepthStencilState(None, None, Nothing)
Processing SetBlendState(None)
Processing SetColorMask(ColorMask(Red | Green | Blue | Alpha))
Processing SetViewport(Rect { x: 0, y: 0, w: 800, h: 600 })
Processing Clear(ClearData { color: [0.3, 0.3, 0.3, 1], depth: 1, stencil: 0 }, Mask(65))
Processing BindProgram(6)
Processing BindUniform(7, ValueF32Matrix4([0, 0, 0, 0][0, 0, 0, 0][0, 0, 0, 0][0, 0, 0, 0]))
Processing BindUniform(8, ValueF32Matrix4([1.299038, 0, 0, 0][0, 1.732051, 0, 0][0, 0, -1.0002, -1][0, 0, -0.20002, 0]))
Processing SetDepthStencilState(None, None, Back)
Processing BindArrayBuffer(0)
Processing BindAttribute(0, 3, Format { elem_count: 1, elem_type: Int(Normalized, U8, Unsigned), offset: 0, stride: 24, instance_rate: 0 })
Processing BindAttribute(1, 3, Format { elem_count: 1, elem_type: Int(Normalized, U8, Signed), offset: 12, stride: 24, instance_rate: 0 })
Processing BindIndex(2)
Processing DrawIndexed(TriangleList, U32, 0, 1572864, 0, None)

@AerialX
Copy link

AerialX commented Mar 12, 2015

It's not just WebGL. See this for what I had to do to get hematite working on my PC. Original generated code is commented out.

I have no idea what it's supposed to be doing, but the set_len appears to be very broken and leads to the rest of the library using uninitialized memory. Maybe it's just the + 1?

@kvark
Copy link
Member Author

kvark commented Mar 12, 2015

That sounds pretty bad. Perhaps, we screwed something up lately. I'm looking into it.

@kvark
Copy link
Member Author

kvark commented Mar 12, 2015

@AerialX Sorry for the problem, we don't get this kind of hazards often. Fix is going to be merged shortly.

@kvark
Copy link
Member Author

kvark commented Mar 12, 2015

The allocation is now in place, but we call drop() implicitly on uninitialized memory when doing X.get_mut(Y) = Z

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants