diff options
author | Anuj Phogat <[email protected]> | 2014-09-23 11:58:02 -0700 |
---|---|---|
committer | Anuj Phogat <[email protected]> | 2014-10-01 12:04:15 -0700 |
commit | 7a4790148c524fbdc75fca9aaa4d4439dce911a2 (patch) | |
tree | 20e6abe5a9096144d5a204f38436f215cca34108 /src | |
parent | 38cd40faab8686023ac48e323014f951abf47098 (diff) |
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]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_multisample_state.c | 45 |
3 files changed, 55 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index ca389f80d7b..8b3f45b68d8 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 317724fa2e7..884e28bf8b4 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 429a590a2b5..ee20c0806de 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 |