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.
Reviewed-by: Zack Rusin <zackr@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
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:
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]]++;
}
unsigned *Primitives;
unsigned NumOutputs;
unsigned MaxGeometryShaderOutputs;
+ unsigned MaxOutputVertices;
/* FRAGMENT processor only. */
const struct tgsi_interp_coef *InterpCoefs;