#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
+#include "compiler/brw_eu_defines.h"
+#include "brw_util.h"
#include "intel_batchbuffer.h"
+#include "main/fbobject.h"
+#include "main/framebuffer.h"
-static void
-upload_clip_state(struct brw_context *brw)
+bool
+brw_is_drawing_points(const struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
- uint32_t depth_clamp = 0;
- uint32_t provoking;
-
- if (!ctx->Transform.DepthClamp)
- depth_clamp = GEN6_CLIP_Z_TEST;
+ /* Determine if the primitives *reaching the SF* are points */
+ /* _NEW_POLYGON */
+ if (brw->ctx.Polygon.FrontMode == GL_POINT ||
+ brw->ctx.Polygon.BackMode == GL_POINT) {
+ return true;
+ }
- if (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION) {
- provoking = 0;
+ if (brw->gs.base.prog_data) {
+ /* BRW_NEW_GS_PROG_DATA */
+ return brw_gs_prog_data(brw->gs.base.prog_data)->output_topology ==
+ _3DPRIM_POINTLIST;
+ } else if (brw->tes.base.prog_data) {
+ /* BRW_NEW_TES_PROG_DATA */
+ return brw_tes_prog_data(brw->tes.base.prog_data)->output_topology ==
+ BRW_TESS_OUTPUT_TOPOLOGY_POINT;
} else {
- provoking =
- (2 << GEN6_CLIP_TRI_PROVOKE_SHIFT) |
- (2 << GEN6_CLIP_TRIFAN_PROVOKE_SHIFT) |
- (1 << GEN6_CLIP_LINE_PROVOKE_SHIFT);
+ /* BRW_NEW_PRIMITIVE */
+ return brw->primitive == _3DPRIM_POINTLIST;
}
+}
- BEGIN_BATCH(4);
- OUT_BATCH(CMD_3D_CLIP_STATE << 16 | (4 - 2));
- OUT_BATCH(GEN6_CLIP_STATISTICS_ENABLE);
- OUT_BATCH(GEN6_CLIP_ENABLE |
- GEN6_CLIP_API_OGL |
- GEN6_CLIP_MODE_NORMAL |
- GEN6_CLIP_XY_TEST |
- depth_clamp |
- provoking);
- OUT_BATCH(0);
- ADVANCE_BATCH();
+bool
+brw_is_drawing_lines(const struct brw_context *brw)
+{
+ /* Determine if the primitives *reaching the SF* are points */
+ /* _NEW_POLYGON */
+ if (brw->ctx.Polygon.FrontMode == GL_LINE ||
+ brw->ctx.Polygon.BackMode == GL_LINE) {
+ return true;
+ }
- intel_batchbuffer_emit_mi_flush(intel->batch);
+ if (brw->gs.base.prog_data) {
+ /* BRW_NEW_GS_PROG_DATA */
+ return brw_gs_prog_data(brw->gs.base.prog_data)->output_topology ==
+ _3DPRIM_LINESTRIP;
+ } else if (brw->tes.base.prog_data) {
+ /* BRW_NEW_TES_PROG_DATA */
+ return brw_tes_prog_data(brw->tes.base.prog_data)->output_topology ==
+ BRW_TESS_OUTPUT_TOPOLOGY_LINE;
+ } else {
+ /* BRW_NEW_PRIMITIVE */
+ switch (brw->primitive) {
+ case _3DPRIM_LINELIST:
+ case _3DPRIM_LINESTRIP:
+ case _3DPRIM_LINELOOP:
+ return true;
+ }
+ }
+ return false;
}
-const struct brw_tracked_state gen6_clip_state = {
- .dirty = {
- .mesa = _NEW_TRANSFORM,
- .brw = BRW_NEW_CONTEXT,
- .cache = 0
- },
- .emit = upload_clip_state,
-};