<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [gen7][gen8] glmark2 -b jellyfish misrendered"
href="https://bugs.freedesktop.org/show_bug.cgi?id=86755#c8">Comment # 8</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [gen7][gen8] glmark2 -b jellyfish misrendered"
href="https://bugs.freedesktop.org/show_bug.cgi?id=86755">bug 86755</a>
from <span class="vcard"><a class="email" href="mailto:ville.syrjala@linux.intel.com" title="Ville Syrjala <ville.syrjala@linux.intel.com>"> <span class="fn">Ville Syrjala</span></a>
</span></b>
<pre>(In reply to Samuel Iglesias from <a href="show_bug.cgi?id=86755#c7">comment #7</a>)
<span class="quote">> Created <span class=""><a href="attachment.cgi?id=113982" name="attach_113982" title="glmark2 jellyfish vertex shader patch">attachment 113982</a> <a href="attachment.cgi?id=113982&action=edit" title="glmark2 jellyfish vertex shader patch">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=86755&attachment=113982'>[review]</a> [review]
> glmark2 jellyfish vertex shader patch
>
> I confirm that this is happening in SNB (gen6) too.
>
> I modified the jellyfish vertex shader (attached patch) to have the sin()
> function argument to be within the range of [0, 2*PI) radians by using the
> modulo operation. In this case, it renders fine.
>
> I think this is the same problem explained here:
>
> <a href="http://lists.freedesktop.org/archives/mesa-dev/2014-December/072429.html">http://lists.freedesktop.org/archives/mesa-dev/2014-December/072429.html</a></span >
Oh, I hadn't noticed your comment here. I came to the same conclusion just
today when I was wondering about this again. I actually went and read throught
the entire asm the vertex shader looking for an error, and when I didn't find
one I figured it could be the sin(), so I cooked up some kind of kludge to fix
it on the Mesa side. I could hve avoided all that if I'd checked this bug first
:) But it was a good exercise anyway, learning a bit of gen asm and looking at
the i965 compiler a bit.
Here's my hack for anyone interested:
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 26a3b9f..85c8f69 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -343,8 +343,19 @@ vec4_visitor::emit_math(enum opcode opcode,
const dst_reg &dst,
const src_reg &src0, const src_reg &src1)
{
- vec4_instruction *math =
- emit(opcode, dst, fix_math_operand(src0), fix_math_operand(src1));
+ vec4_instruction *math;
+
+ if (opcode == SHADER_OPCODE_SIN || opcode == SHADER_OPCODE_COS) {
+ dst_reg tmp = dst_reg(this, glsl_type::vec4_type);
+ emit(MUL(tmp, src0, brw_imm_f(1.0 / (2.0 * M_PI))));
+ emit(RNDZ(tmp, src_reg(tmp)));
+ emit(MUL(tmp, src_reg(tmp), brw_imm_f(2.0 * M_PI)));
+ emit(ADD(tmp, src0, negate(src_reg(tmp))));
+ math = emit(opcode, dst, fix_math_operand(src_reg(tmp)),
fix_math_operand(src1));
+ } else {
+ math = emit(opcode, dst, fix_math_operand(src0),
fix_math_operand(src1));
+ }
if (brw->gen == 6 && dst.writemask != WRITEMASK_XYZW) {
/* MATH on Gen6 must be align1, so we can't do writemasks. */</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>