-
Notifications
You must be signed in to change notification settings - Fork 3
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
Matrix multiplication problems #1
Comments
I'm not sure why you're getting a divide-by-zero error (on my machine, I get a segfault) but it seems that the underlying issue is that GLSL IR is lowering matrix operations like
to
which is good, except it seems to represent modelviewprojectionMatrix[0] as an ir_dereference_array, even though the thing being dereferenced isn't an array, which confuses us when we lower dereferences to offsets since we don't handle that case yet. |
Can this shader be modified into something that is currently supported? |
Well, if you handcoded those operations instead of using matrices it should work... I'll try and fix the bug tonight though, so hopefully you won't have to. It's nice having people test this, even if the result is "oh whoops, I forgot to handle matrices!" |
Since 6a24095, we now generate correct GP IR for this shader, and valgrind gives me no errors, so this particular error shouldn't happen for you. However, for some reason, the scheduler keeps restarting without making any progress until it runs out of registers to be allocated the fast way, at which point it hits an assert since we haven't implemented the slow path (which involves generating driver-internal uniforms to hold constants, something we couldn't do until pretty recently). The IR before this seems sane, again valgrind shows no errors, and the scheduler should have no problem scheduling this, so there's one of 2 things happening:
Either way, it's going to be a lot harder to debug... sorry. |
After trying to play around with the code and change mat4/vec4 to mat3/vec3, it segfaults again:
|
FWIW, handcoding the matrix operation indeed works now at least in 51f162b:
|
…iler And by doing this, we now achieve the 100% free software and 100% free tools milestone. Which means no proprietary dependencies in any form. Note that the matrix multiplication has to be done manually to workaround the lima_complier bug cwabbott0/lima_compiler#1 Signed-off-by: Siarhei Siamashka <[email protected]>
And by doing this, we now achieve the 100% free software and 100% free tools milestone. Which means no proprietary dependencies in any form. Note that the matrix multiplication has to be done manually to workaround the lima_complier bug cwabbott0/lima_compiler#1 Signed-off-by: Siarhei Siamashka <[email protected]>
Ok, that's strange... it must be that manually doing it reorders the adds/multiplies in such a way that makes us not hit that pathological case in the scheduler. Just for reference, you're now getting the same error as me when you don't hand-code it, right? Assertion failed: (0), function try_schedule_reg, file gp_ir/scheduler.c, line 967. |
limasc: gp_ir/scheduler.c:950: try_schedule_reg: Assertion `0' failed. |
Division by zero trying to compile the following simple vertex shader:
==27873== Process terminating with default action of signal 8 (SIGFPE)
==27873== Integer divide by zero at address 0x4049E9641
==27873== at 0x40346B: get_hash (ptrset.c:41)
==27873== by 0x40376D: ptrset_add (ptrset.c:114)
==27873== by 0x412DDF: lima_gp_ir_node_link (node.c:674)
==27873== by 0x454432: (anonymous namespace)::gp_ir_visitor::emit_uniform_load(ir_dereference_, bool) (from_glsl.cpp:1222)
==27873== by 0x453CAC: (anonymous namespace)::gp_ir_visitor::handle_deref(ir_dereference_) (from_glsl.cpp:1001)
==27873== by 0x453AC8: (anonymous namespace)::gp_ir_visitor::visit_enter(ir_dereference_array_) (from_glsl.cpp:950)
==27873== by 0x485436: ir_dereference_array::accept(ir_hierarchical_visitor_) (ir_hv_accept.cpp:272)
==27873== by 0x45368C: (anonymous namespace)::gp_ir_visitor::emit_expression(lima_gp_ir_op_e, ir_rvalue**, unsigned int) (from_glsl.cpp:855)
==27873== by 0x452D42: (anonymous namespace)::gp_ir_visitor::visit_enter(ir_expression_) (from_glsl.cpp:616)
==27873== by 0x485249: ir_expression::accept(ir_hierarchical_visitor_) (ir_hv_accept.cpp:150)
==27873== by 0x45368C: (anonymous namespace)::gp_ir_visitor::emit_expression(lima_gp_ir_op_e, ir_rvalue**, unsigned int) (from_glsl.cpp:855)
==27873== by 0x452D1F: (anonymous namespace)::gp_ir_visitor::visit_enter(ir_expression*) (from_glsl.cpp:612)
The text was updated successfully, but these errors were encountered: