diff options
author | Rafael Antognolli <[email protected]> | 2017-04-19 13:13:25 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-05-03 20:40:20 -0700 |
commit | da665d22f55ba4af0f6f3c4fbea80a193e7028c1 (patch) | |
tree | f8e31a26c7c49eb70c837b4c35e18d6273d9239a /src/mesa/drivers/dri/i965/brw_misc_state.c | |
parent | c85b217ab08730c6a6300b08834e2825be8cc47c (diff) |
i965: Port gen4+ state emitting code to genxml.
On this patch, we port:
- brw_polygon_stipple
- brw_polygon_stipple_offset
- brw_line_stipple
- brw_drawing_rect
v2:
- Also emit states for gen4-5 with this code.
v3:
- Style fixes and remove excessive checks (Ken).
Signed-off-by: Rafael Antognolli <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_misc_state.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_misc_state.c | 147 |
1 files changed, 0 insertions, 147 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 83c1810e8db..afa7e0861fa 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -44,32 +44,6 @@ #include "main/fbobject.h" #include "main/glformats.h" -/* Constant single cliprect for framebuffer object or DRI2 drawing */ -static void -upload_drawing_rect(struct brw_context *brw) -{ - struct gl_context *ctx = &brw->ctx; - const struct gl_framebuffer *fb = ctx->DrawBuffer; - const unsigned int fb_width = _mesa_geometric_width(fb); - const unsigned int fb_height = _mesa_geometric_height(fb); - - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_DRAWING_RECTANGLE << 16 | (4 - 2)); - OUT_BATCH(0); /* xmin, ymin */ - OUT_BATCH(((fb_width - 1) & 0xffff) | ((fb_height - 1) << 16)); - OUT_BATCH(0); - ADVANCE_BATCH(); -} - -const struct brw_tracked_state brw_drawing_rect = { - .dirty = { - .mesa = _NEW_BUFFERS, - .brw = BRW_NEW_BLORP | - BRW_NEW_CONTEXT, - }, - .emit = upload_drawing_rect -}; - /** * Upload pointers to the per-stage state. * @@ -696,127 +670,6 @@ const struct brw_tracked_state brw_depthbuffer = { .emit = brw_emit_depthbuffer, }; -/** - * Polygon stipple packet - */ -static void -upload_polygon_stipple(struct brw_context *brw) -{ - struct gl_context *ctx = &brw->ctx; - GLuint i; - - /* _NEW_POLYGON */ - if (!ctx->Polygon.StippleFlag) - return; - - BEGIN_BATCH(33); - OUT_BATCH(_3DSTATE_POLY_STIPPLE_PATTERN << 16 | (33 - 2)); - - /* Polygon stipple is provided in OpenGL order, i.e. bottom - * row first. If we're rendering to a window (i.e. the - * default frame buffer object, 0), then we need to invert - * it to match our pixel layout. But if we're rendering - * to a FBO (i.e. any named frame buffer object), we *don't* - * need to invert - we already match the layout. - */ - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { - for (i = 0; i < 32; i++) - OUT_BATCH(ctx->PolygonStipple[31 - i]); /* invert */ - } else { - for (i = 0; i < 32; i++) - OUT_BATCH(ctx->PolygonStipple[i]); - } - ADVANCE_BATCH(); -} - -const struct brw_tracked_state brw_polygon_stipple = { - .dirty = { - .mesa = _NEW_POLYGON | - _NEW_POLYGONSTIPPLE, - .brw = BRW_NEW_CONTEXT, - }, - .emit = upload_polygon_stipple -}; - -/** - * Polygon stipple offset packet - */ -static void -upload_polygon_stipple_offset(struct brw_context *brw) -{ - struct gl_context *ctx = &brw->ctx; - - /* _NEW_POLYGON */ - if (!ctx->Polygon.StippleFlag) - return; - - BEGIN_BATCH(2); - OUT_BATCH(_3DSTATE_POLY_STIPPLE_OFFSET << 16 | (2-2)); - - /* _NEW_BUFFERS - * - * If we're drawing to a system window we have to invert the Y axis - * in order to match the OpenGL pixel coordinate system, and our - * offset must be matched to the window position. If we're drawing - * to a user-created FBO then our native pixel coordinate system - * works just fine, and there's no window system to worry about. - */ - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) - OUT_BATCH((32 - (_mesa_geometric_height(ctx->DrawBuffer) & 31)) & 31); - else - OUT_BATCH(0); - ADVANCE_BATCH(); -} - -const struct brw_tracked_state brw_polygon_stipple_offset = { - .dirty = { - .mesa = _NEW_BUFFERS | - _NEW_POLYGON, - .brw = BRW_NEW_CONTEXT, - }, - .emit = upload_polygon_stipple_offset -}; - -/** - * Line stipple packet - */ -static void -upload_line_stipple(struct brw_context *brw) -{ - struct gl_context *ctx = &brw->ctx; - GLfloat tmp; - GLint tmpi; - - if (!ctx->Line.StippleFlag) - return; - - BEGIN_BATCH(3); - OUT_BATCH(_3DSTATE_LINE_STIPPLE_PATTERN << 16 | (3 - 2)); - OUT_BATCH(ctx->Line.StipplePattern); - - if (brw->gen >= 7) { - /* in U1.16 */ - tmp = 1.0f / ctx->Line.StippleFactor; - tmpi = tmp * (1<<16); - OUT_BATCH(tmpi << 15 | ctx->Line.StippleFactor); - } else { - /* in U1.13 */ - tmp = 1.0f / ctx->Line.StippleFactor; - tmpi = tmp * (1<<13); - OUT_BATCH(tmpi << 16 | ctx->Line.StippleFactor); - } - - ADVANCE_BATCH(); -} - -const struct brw_tracked_state brw_line_stipple = { - .dirty = { - .mesa = _NEW_LINE, - .brw = BRW_NEW_CONTEXT, - }, - .emit = upload_line_stipple -}; - void brw_emit_select_pipeline(struct brw_context *brw, enum brw_pipeline pipeline) { |