diff options
author | Paul Berry <[email protected]> | 2012-04-29 21:41:42 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2012-05-15 15:09:23 -0700 |
commit | 19e9b24626c2b9d7abef054d57bb2a52106c545b (patch) | |
tree | 400b049b32a91ad064f94dadd38929f6a65b6768 /src/mesa/drivers/dri/i965/gen7_blorp.cpp | |
parent | 506d70be21cd3469118de89297cba0c0f709c1ae (diff) |
i965/gen6: Initial implementation of MSAA.
This patch enables MSAA for Gen6, by modifying intel_mipmap_tree to
understand multisampled buffers, adapting the rendering pipeline setup
to enable multisampled rendering, and adding multisample resolve
operations to brw_blorp_blit.cpp. Some preparation work is also
included for Gen7, but it is not yet enabled.
MSAA support is still fairly preliminary. In particular, the
following are not yet supported:
- Fully general blits between MSAA and non-MSAA buffers.
- Formats other than RGBA8, DEPTH24, and STENCIL8.
- Centroid interpolation.
- Coverage parameters (glSampleCoverage, GL_SAMPLE_ALPHA_TO_COVERAGE,
GL_SAMPLE_ALPHA_TO_ONE, GL_SAMPLE_COVERAGE, GL_SAMPLE_COVERAGE_VALUE,
GL_SAMPLE_COVERAGE_INVERT).
Fixes piglit tests "EXT_framebuffer_multisample/accuracy" on
i965/Gen6.
v2:
- In intel_alloc_renderbuffer_storage(), quantize the requested number
of samples to the next higher sample count supported by the
hardware. This ensures that a query of GL_SAMPLES will return the
correct value. It also ensures that MSAA is fully disabled on Gen7
for now (since Gen7 MSAA support doesn't work yet).
- When reading from a non-MSAA surface, ensure that s_is_zero is true
so that we won't try to read from a nonexistent sample.
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen7_blorp.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_blorp.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp index f10d0aab2f8..fbb94dfed56 100644 --- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp +++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp @@ -143,6 +143,10 @@ gen7_blorp_emit_surface_state(struct brw_context *brw, uint32_t wm_surf_offset; uint32_t width, height; surface->get_miplevel_dims(&width, &height); + if (surface->num_samples > 0) { /* TODO: wrong for 8x */ + width /= 2; + height /= 2; + } if (surface->map_stencil_as_y_tiled) { width *= 2; height /= 2; @@ -181,6 +185,8 @@ gen7_blorp_emit_surface_state(struct brw_context *brw, pitch_bytes *= 2; surf->ss3.pitch = pitch_bytes - 1; + gen7_set_surface_num_multisamples(surf, surface->num_samples); + if (intel->is_haswell) { surf->ss7.shader_chanel_select_r = HSW_SCS_RED; surf->ss7.shader_chanel_select_g = HSW_SCS_GREEN; @@ -366,7 +372,7 @@ gen7_blorp_emit_sf_config(struct brw_context *brw, OUT_BATCH(_3DSTATE_SF << 16 | (7 - 2)); OUT_BATCH(params->depth_format << GEN7_SF_DEPTH_BUFFER_SURFACE_FORMAT_SHIFT); - OUT_BATCH(0); + OUT_BATCH(params->num_samples > 0 ? GEN6_SF_MSRAST_ON_PATTERN : 0); OUT_BATCH(0); OUT_BATCH(0); OUT_BATCH(0); @@ -397,7 +403,7 @@ gen7_blorp_emit_wm_config(struct brw_context *brw, { struct intel_context *intel = &brw->intel; - uint32_t dw1 = 0; + uint32_t dw1 = 0, dw2 = 0; switch (params->hiz_op) { case GEN6_HIZ_OP_DEPTH_CLEAR: @@ -423,10 +429,18 @@ gen7_blorp_emit_wm_config(struct brw_context *brw, dw1 |= GEN7_WM_DISPATCH_ENABLE; /* We are rendering */ } + if (params->num_samples > 0) { + dw1 |= GEN7_WM_MSRAST_ON_PATTERN; + dw2 |= GEN7_WM_MSDISPMODE_PERPIXEL; + } else { + dw1 |= GEN7_WM_MSRAST_OFF_PIXEL; + dw2 |= GEN7_WM_MSDISPMODE_PERSAMPLE; + } + BEGIN_BATCH(3); OUT_BATCH(_3DSTATE_WM << 16 | (3 - 2)); OUT_BATCH(dw1); - OUT_BATCH(0); + OUT_BATCH(dw2); ADVANCE_BATCH(); } |