Module: Mesa Branch: master Commit: 7a4790148c524fbdc75fca9aaa4d4439dce911a2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a4790148c524fbdc75fca9aaa4d4439dce911a2
Author: Anuj Phogat <[email protected]> Date: Tue Sep 23 11:58:02 2014 -0700 i965: Initialize the SampleMap{2,4,8}x variables with values specific to Intel hardware. V2: Define and use gen6_get_sample_map() function to initialize the variables. V3: Change the function name to gen6_set_sample_maps() and use memcpy() to fill in the data. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jordan Justen <[email protected]> --- src/mesa/drivers/dri/i965/brw_context.c | 8 ++++ src/mesa/drivers/dri/i965/brw_context.h | 2 + src/mesa/drivers/dri/i965/gen6_multisample_state.c | 45 ++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index ca389f8..8b3f45b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -406,6 +406,14 @@ brw_initialize_context_constants(struct brw_context *brw) ctx->Const.MaxDepthTextureSamples = max_samples; ctx->Const.MaxIntegerSamples = max_samples; + /* gen6_set_sample_maps() sets SampleMap{2,4,8}x variables which are used + * to map indices of rectangular grid to sample numbers within a pixel. + * These variables are used by GL_EXT_framebuffer_multisample_blit_scaled + * extension implementation. For more details see the comment above + * gen6_set_sample_maps() definition. + */ + gen6_set_sample_maps(ctx); + if (brw->gen >= 7) ctx->Const.MaxProgramTextureGatherComponents = 4; else if (brw->gen == 6) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 317724f..884e28b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1693,6 +1693,8 @@ gen6_get_sample_position(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint index, GLfloat *result); +void +gen6_set_sample_maps(struct gl_context *ctx); /* gen8_multisample_state.c */ void gen8_emit_3dstate_multisample(struct brw_context *brw, unsigned num_samp); diff --git a/src/mesa/drivers/dri/i965/gen6_multisample_state.c b/src/mesa/drivers/dri/i965/gen6_multisample_state.c index 429a590..ee20c08 100644 --- a/src/mesa/drivers/dri/i965/gen6_multisample_state.c +++ b/src/mesa/drivers/dri/i965/gen6_multisample_state.c @@ -57,6 +57,51 @@ gen6_get_sample_position(struct gl_context *ctx, } /** + * Sample index layout shows the numbering of slots in a rectangular + * grid of samples with in a pixel. Sample number layout shows the + * rectangular grid of samples roughly corresponding to the real sample + * locations with in a pixel. Sample number layout matches the sample + * index layout in case of 2X and 4x MSAA, but they are different in + * case of 8X MSAA. + * + * 2X MSAA sample index / number layout + * --------- + * | 0 | 1 | + * --------- + * + * 4X MSAA sample index / number layout + * --------- + * | 0 | 1 | + * --------- + * | 2 | 3 | + * --------- + * + * 8X MSAA sample index layout 8x MSAA sample number layout + * --------- --------- + * | 0 | 1 | | 5 | 2 | + * --------- --------- + * | 2 | 3 | | 4 | 6 | + * --------- --------- + * | 4 | 5 | | 0 | 3 | + * --------- --------- + * | 6 | 7 | | 7 | 1 | + * --------- --------- + * + * A sample map is used to map sample indices to sample numbers. + */ +void +gen6_set_sample_maps(struct gl_context *ctx) +{ + uint8_t map_2x[2] = {0, 1}; + uint8_t map_4x[4] = {0, 1, 2, 3}; + uint8_t map_8x[8] = {5, 2, 4, 6, 0, 3, 7, 1}; + + memcpy(ctx->Const.SampleMap2x, map_2x, sizeof(map_2x)); + memcpy(ctx->Const.SampleMap4x, map_4x, sizeof(map_4x)); + memcpy(ctx->Const.SampleMap8x, map_8x, sizeof(map_8x)); +} + +/** * 3DSTATE_MULTISAMPLE */ void _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
