aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_util.h
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-07-18 16:29:27 +0200
committerErik Faye-Lund <[email protected]>2019-10-17 10:41:36 +0200
commitb786738454296ad90716b5e7106fc9cd03db271c (patch)
tree189d53b764c19cea6a2abe61dda5b74538391c63 /src/mesa/state_tracker/st_util.h
parentb1c4c4c7f53cde52a8f3b3ec17cd66b89bf04199 (diff)
st/mesa: move point_size_per_vertex-logic to helper
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_util.h')
-rw-r--r--src/mesa/state_tracker/st_util.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_util.h b/src/mesa/state_tracker/st_util.h
index bae85974f0e..edb13a1f26f 100644
--- a/src/mesa/state_tracker/st_util.h
+++ b/src/mesa/state_tracker/st_util.h
@@ -101,6 +101,39 @@ st_user_clip_planes_enabled(struct gl_context *ctx)
ctx->Transform.ClipPlanesEnabled;
}
+static inline bool
+st_point_size_per_vertex(struct gl_context *ctx)
+{
+ const struct gl_program *vertProg = ctx->VertexProgram._Current;
+ if (vertProg) {
+ if (vertProg->Id == 0) {
+ if (vertProg->info.outputs_written &
+ BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
+ /* generated program which emits point size */
+ return true;
+ }
+ }
+ else if (ctx->API != API_OPENGLES2) {
+ /* PointSizeEnabled is always set in ES2 contexts */
+ return ctx->VertexProgram.PointSizeEnabled;
+ }
+ else {
+ /* ST_NEW_TESSEVAL_PROGRAM | ST_NEW_GEOMETRY_PROGRAM */
+ /* We have to check the last bound stage and see if it writes psize */
+ struct gl_program *last = NULL;
+ if (ctx->GeometryProgram._Current)
+ last = ctx->GeometryProgram._Current;
+ else if (ctx->TessEvalProgram._Current)
+ last = ctx->TessEvalProgram._Current;
+ else if (ctx->VertexProgram._Current)
+ last = ctx->VertexProgram._Current;
+ if (last)
+ return !!(last->info.outputs_written &
+ BITFIELD64_BIT(VARYING_SLOT_PSIZ));
+ }
+ }
+ return false;
+}
/** clear-alloc a struct-sized object, with casting */
#define ST_CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))