[Mesa-dev] [Bug 79783] Distorted output in obs-studio where other vendors "work"

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Sep 19 01:02:50 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=79783

--- Comment #9 from gregory.hainaut at gmail.com ---
(In reply to Ilia Mirkin from comment #8)
> (In reply to gregory.hainaut from comment #5)
> > Here the dump of the ASM (TGSI?). (Generated with the hack to disable flat
> > optimization)
> 
> TGSI (which is DX9-ish assembly type code, but extended well beyond)
> 
> > 
> > FRAG
> > DCL IN[0], GENERIC[0], PERSPECTIVE
> > DCL OUT[0], COLOR
> > DCL SAMP[0]
> > DCL SVIEW[0], 2D, FLOAT
> > DCL CONST[1][0]
> > DCL TEMP[0..1], LOCAL
> > IMM[0] FLT32 {    2.0000,     0.0000,     0.0000,     0.0000}
> >   0: MOV TEMP[0].xy, IN[0].xyyy
> >   1: TEX TEMP[0], TEMP[0], SAMP[0], 2D
> >   2: MOV TEMP[1].xyz, TEMP[0].xyzx
> >   3: MUL TEMP[0].x, TEMP[0].wwww, IMM[0].xxxx
> >   4: MOV TEMP[1].w, TEMP[0].xxxx
> >   5: MOV OUT[0], TEMP[1]
> >   6: END
> > 
> > As you can it use the IN[0] whereas I have 2 inputs in the FS. IN[0] is
> > likely my position which is [-1;1]. It confirms the strange behavior of my
> > previous message.
> > My shader doesn't use the parameter p so I guess it was wrongly removed.
> 
> You should double-check that it wasn't also eliminated from the relevant
> vertex shader. GENERIC[0] should map to whatever GENERIC[0] output in the
> vertex shader.

VERT
DCL IN[0]
DCL IN[1]
DCL OUT[0], POSITION
DCL OUT[1], GENERIC[0]
DCL OUT[2], GENERIC[1]
DCL TEMP[0..2], LOCAL
IMM[0] FLT32 {    0.5000,     1.0000,     0.0000,     0.0000}
  0: MOV TEMP[0].zw, IMM[0].yyxy
  1: MOV TEMP[0].xy, IN[0].xyxx
  2: MOV TEMP[1].zw, IMM[0].yyxy
  3: MOV TEMP[1].xy, IN[0].xyxx
  4: MOV TEMP[2].xy, IN[1].xyxx
  5: MOV OUT[1], TEMP[0]
  6: MOV OUT[2], TEMP[2]
  7: MOV OUT[0], TEMP[1]
  8: END

The vertex shader outputs 2 variables. POSITION is copyied into GENERIC[0]
whereas the texture coordinate is copyied into GENERIC[1]. In separate shader
program, Frag shader must work for any Vert shader (or it could be a Geom
shader).


> By the way, you may also be interested in MESA_GLSL=dump which dumps out the
> mesa glsl ir in various stages.

Note I renamed the interface name to p_deadcode to ease grep.

Before the above patch:
(declare (location=24 shader_in ) vec4 packed:t)
(declare (location=0 uniform ) ivec4 ScalingFactor)
(declare (location=4 shader_out ) vec4 SV_Target0)
(declare (temporary ) vec4 SV_Target0)
(declare (location=0 uniform ) sampler2D TextureSampler)

If I enable the logging of opt_dead_code.cpp
p_deadcode at 0x93dbca8: 0 refs, 0 assigns, declared in our scope
Removed declaration of p_deadcode at 0x93dbca8

After the above patch:
(declare (location=0 shader_in ) vec4 gl_FragCoord)
(declare (location=17 shader_in ) (array vec4 1) gl_ClipDistanceMESA)
(declare (location=19 shader_in flat) int gl_PrimitiveID)
(declare (location=22 shader_in ) bool gl_FrontFacing)
(declare (location=23 shader_in ) vec2 gl_PointCoord)
(declare (location=24 shader_in ) vec4 p_deadcode) <= the missing one
(declare (location=25 shader_in ) vec4 packed:t)
(declare (location=0 uniform ) ivec4 ScalingFactor)
(declare (location=4 shader_out ) vec4 SV_Target0)
(declare (temporary ) vec4 SV_Target0)
(declare (location=0 uniform ) sampler2D TextureSampler)

Hum, it might be a better idea to the interface block type to only disable the
optimization in this case. I tried to use is_interface_instance but I guess it
is only working for uniform.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150919/d6d26695/attachment.html>


More information about the mesa-dev mailing list