On Mon, Nov 12, 2018 at 6:11 PM Fernando Sahmkow <fsahmkow27@xxxxxxxxx> wrote: > > So I'm trying to track an special value in IPA instruction generation. > https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp#L2561 > > Register on 0x14 (20) is set to some source on "insn->op == OP_PINTERP" > > I have found while emulation that such value can be set sometimes to FragCoord.w, I don't however know what that value is and how to represent it on glsl. Do you guys know where does that value come from and what it means? It's for perspective division. If you're doing perspective interpolation, you have to pass in 1/w as that argument (and set the interpolation mode to "mul", which iirc doesn't cause anything to be printed in nvdisasm). Note that there's additional subtlety here ... the hardware will do different things depending on what's in the shader header, as well as on the global "shade model" which can be set to "flat". However if you're converting to GLSL, IPA = perspective interp IPA.PASS = linear interp (i.e. "noperspective" in GLSL) IPA.CONSTANT = flat interp (i.e. "flat" in GLSL) IPA.SC = we use this for gl_Color. I *think* it's only this which is affected by the global "shade model" setting. But don't quote me on this. Now, the contents of the shader header will affect the barycentric coordinates that are computed and are made available to the IPA logic, so you can't have too much disagreement. However if the shader header says "flat", then flat interp is what you'll get no matter the IPA.* mode. We use this feature to deal with a situation where you e.g. have noperspective gl_Color gl_SecondaryColor and then glShadeModel(GL_FLAT) -- this is supposed to only affect the gl_SecondaryColor, since the gl_Color has an explicit interpolation mode, so we just mess with the shader header. You can see some of this at work at https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c#n104 Cheers, -ilia _______________________________________________ Nouveau mailing list Nouveau@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/nouveau