Looks great. If I was into diffs I'd make sweet and passionate love to this one.
Reviewed-by: Zack Rusin <za...@vmware.com> ----- Original Message ----- > From: Dave Airlie <airl...@redhat.com> > > This limits the number of emitted vertices to the shaders max output > vertices, and avoids us writing things into memory that isn't big > enough for it. > > Signed-off-by: Dave Airlie <airl...@redhat.com> > --- > src/gallium/auxiliary/tgsi/tgsi_exec.c | 8 ++++++++ > src/gallium/auxiliary/tgsi/tgsi_exec.h | 1 + > 2 files changed, 9 insertions(+) > > diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c > b/src/gallium/auxiliary/tgsi/tgsi_exec.c > index 69d98fd..d848348 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c > @@ -789,6 +789,11 @@ tgsi_exec_machine_bind_shader( > break; > > case TGSI_TOKEN_TYPE_PROPERTY: > + if (mach->Processor == TGSI_PROCESSOR_GEOMETRY) { > + if (parse.FullToken.FullProperty.Property.PropertyName == > TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES) { > + mach->MaxOutputVertices = > parse.FullToken.FullProperty.u[0].Data; > + } > + } > break; > > default: > @@ -1621,6 +1626,9 @@ emit_vertex(struct tgsi_exec_machine *mach) > if ((mach->ExecMask & (1 << i))) > */ > if (mach->ExecMask) { > + if > (mach->Primitives[mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0]] > >= mach->MaxOutputVertices) > + return; > + > mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] += > mach->NumOutputs; > > mach->Primitives[mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0]]++; > } > diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h > b/src/gallium/auxiliary/tgsi/tgsi_exec.h > index 7a82f69..d53c4ba 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h > +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h > @@ -297,6 +297,7 @@ struct tgsi_exec_machine > unsigned *Primitives; > unsigned NumOutputs; > unsigned MaxGeometryShaderOutputs; > + unsigned MaxOutputVertices; > > /* FRAGMENT processor only. */ > const struct tgsi_interp_coef *InterpCoefs; > -- > 1.9.3 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev