[Mesa-dev] [PATCH 2/3] i965: Port 3DSTATE_VF to genxml and simplify the implementation.
Emil Velikov
emil.l.velikov at gmail.com
Fri May 5 11:06:01 UTC 2017
On 4 May 2017 at 18:51, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On Thursday, May 4, 2017 8:51:43 AM PDT Emil Velikov wrote:
>> Hi Ken,
>>
>> On 4 May 2017 at 16:13, Kenneth Graunke <kenneth at whitecape.org> wrote:
>>
>> > +#if GEN_IS_HASWELL || GEN_GEN >= 8
>> > +static void
>> > +genX(upload_cut_index)(struct brw_context *brw)
>> > +{
>> > + const struct gl_context *ctx = &brw->ctx;
>> > +
>> > + brw_batch_emit(brw, GENX(3DSTATE_VF), vf) {
>> > + if (ctx->Array._PrimitiveRestart && brw->ib.ib) {
>> > + vf.IndexedDrawCutIndexEnable = true;
>> Original code explicitly disables the cut index, which is no longer done here.
>> I take it that is was not required to begin with?
>>
>> -Emil
>> P.S. Pardon if my question comes a bit silly.
>
> No, it's a good question. There is a change in behavior, but I think
> it should be equivalent in the case that matters.
>
> In the new code, we enable cutting for indexed draws and program a
> meaningful cut index value draws when (a) there is an index buffer
> and (b) primitive restart is enabled. Otherwise, both fields are
> zero filled, meaning cutting is disabled and the cut index is 0
> (but unused, so it doesn't matter).
>
Sounds like I should have read the brw_batch_emit macro more
carefully. I missed the zero fill part.
> In the old code, we enabled cutting for indexed draws when primitive
> restart was enabled...but even if there was no index buffer. With no
> index buffer, indexed draws aren't happening, so no cutting should be
> happening anyway. We also used to set the cut index value
> unconditionally - but if cutting isn't enabled, the value shouldn't
> be used.
>
> Does that make sense?
Indeed it does. Thank you.
-Emil
More information about the mesa-dev
mailing list