aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_blend.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_shader.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_msaa.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c7
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp5
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c16
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.h3
10 files changed, 39 insertions, 18 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_blend.c b/mesalib/src/mesa/state_tracker/st_atom_blend.c
index 50d240a7b..064e0c14f 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_blend.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_blend.c
@@ -263,16 +263,13 @@ update_blend( struct st_context *st )
blend->rt[i].colormask |= PIPE_MASK_A;
}
- if (ctx->Color.DitherFlag)
- blend->dither = 1;
+ blend->dither = ctx->Color.DitherFlag;
if (ctx->Multisample.Enabled) {
/* unlike in gallium/d3d10 these operations are only performed
if msaa is enabled */
- if (ctx->Multisample.SampleAlphaToCoverage)
- blend->alpha_to_coverage = 1;
- if (ctx->Multisample.SampleAlphaToOne)
- blend->alpha_to_one = 1;
+ blend->alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;
+ blend->alpha_to_one = ctx->Multisample.SampleAlphaToOne;
}
cso_set_blend(st->cso_context, blend);
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index ee5e9e574..2bad64334 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -245,7 +245,7 @@ static void update_raster_state( struct st_context *st )
}
/* _NEW_TRANSFORM */
- raster->depth_clip = ctx->Transform.DepthClamp == GL_FALSE;
+ raster->depth_clip = !ctx->Transform.DepthClamp;
raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled;
cso_set_rasterizer(st->cso_context, raster);
diff --git a/mesalib/src/mesa/state_tracker/st_atom_shader.c b/mesalib/src/mesa/state_tracker/st_atom_shader.c
index 67c615713..6515a98a3 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_shader.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_shader.c
@@ -89,6 +89,10 @@ update_fp( struct st_context *st )
key.clamp_color = st->clamp_frag_color_in_shader &&
st->ctx->Color._ClampFragmentColor;
+ /* Ignore sample qualifier while computing this flag. */
+ key.persample_shading =
+ _mesa_get_min_invocations_per_fragment(st->ctx, &stfp->Base, true) > 1;
+
st->fp_variant = st_get_fp_variant(st, stfp, &key);
st_reference_fragprog(st, &st->fp, stfp);
@@ -108,7 +112,7 @@ update_fp( struct st_context *st )
const struct st_tracked_state st_update_fp = {
"st_update_fp", /* name */
{ /* dirty */
- _NEW_BUFFERS, /* mesa */
+ _NEW_BUFFERS | _NEW_MULTISAMPLE, /* mesa */
ST_NEW_FRAGMENT_PROGRAM /* st */
},
update_fp /* update */
diff --git a/mesalib/src/mesa/state_tracker/st_cb_msaa.c b/mesalib/src/mesa/state_tracker/st_cb_msaa.c
index bbf2b2c5c..e9955b62b 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_msaa.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_msaa.c
@@ -40,7 +40,7 @@ static void
st_GetSamplePosition(struct gl_context *ctx,
struct gl_framebuffer *fb,
GLuint index,
- GLfloat *outValue)
+ GLfloat *outPos)
{
struct st_context *st = st_context(ctx);
@@ -48,7 +48,9 @@ st_GetSamplePosition(struct gl_context *ctx,
if (st->pipe->get_sample_position)
st->pipe->get_sample_position(st->pipe, (unsigned) fb->Visual.samples,
- index, outValue);
+ index, outPos);
+ else
+ outPos[0] = outPos[1] = 0.5f;
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index c7f3ec6be..c805a094b 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -307,6 +307,7 @@ void st_destroy_context( struct st_context *st )
cso_release_all(st->cso_context);
st_reference_fragprog(st, &st->fp, NULL);
+ st_reference_geomprog(st, &st->gp, NULL);
st_reference_vertprog(st, &st->vp, NULL);
/* release framebuffer surfaces */
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 38d4ccfea..409079bd4 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -83,6 +83,8 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat)
return PIPE_FORMAT_B2G3R3_UNORM;
case MESA_FORMAT_B10G10R10A2_UNORM:
return PIPE_FORMAT_B10G10R10A2_UNORM;
+ case MESA_FORMAT_R10G10B10A2_UNORM:
+ return PIPE_FORMAT_R10G10B10A2_UNORM;
case MESA_FORMAT_L4A4_UNORM:
return PIPE_FORMAT_L4A4_UNORM;
case MESA_FORMAT_L8A8_UNORM:
@@ -439,6 +441,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
return MESA_FORMAT_B2G3R3_UNORM;
case PIPE_FORMAT_B10G10R10A2_UNORM:
return MESA_FORMAT_B10G10R10A2_UNORM;
+ case PIPE_FORMAT_R10G10B10A2_UNORM:
+ return MESA_FORMAT_R10G10B10A2_UNORM;
case PIPE_FORMAT_L4A4_UNORM:
return MESA_FORMAT_L4A4_UNORM;
case PIPE_FORMAT_L8A8_UNORM:
@@ -857,7 +861,8 @@ static const struct format_mapping format_map[] = {
},
{
{ GL_RGB10_A2, 0 },
- { PIPE_FORMAT_B10G10R10A2_UNORM, DEFAULT_RGBA_FORMATS }
+ { PIPE_FORMAT_B10G10R10A2_UNORM, PIPE_FORMAT_R10G10B10A2_UNORM,
+ DEFAULT_RGBA_FORMATS }
},
{
{ 4, GL_RGBA, GL_RGBA8, 0 },
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 9e1943139..f47cd7d53 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4848,6 +4848,7 @@ emit_edgeflags(struct st_translate *t)
* \param inputSemanticIndex the semantic index (ex: which texcoord) for
* each input
* \param interpMode the TGSI_INTERPOLATE_LINEAR/PERSP mode for each input
+ * \param interpLocation the TGSI_INTERPOLATE_LOC_* location for each input
* \param numOutputs number of output registers used
* \param outputMapping maps Mesa fragment program outputs to TGSI
* generic outputs
@@ -4869,7 +4870,7 @@ st_translate_program(
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
- const GLboolean is_centroid[],
+ const GLuint interpLocation[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
@@ -4915,7 +4916,7 @@ st_translate_program(
inputSemanticName[i],
inputSemanticIndex[i],
interpMode[i], 0,
- is_centroid[i]);
+ interpLocation[i]);
}
if (proginfo->InputsRead & VARYING_BIT_POS) {
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
index a3fe91f7e..2e7cb78d5 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -45,7 +45,7 @@ enum pipe_error st_translate_program(
const ubyte inputSemanticName[],
const ubyte inputSemanticIndex[],
const GLuint interpMode[],
- const GLboolean is_centroid[],
+ const GLuint interpLocation[],
GLuint numOutputs,
const GLuint outputMapping[],
const ubyte outputSemanticName[],
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index 3570557fe..9d7b7c475 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -351,7 +351,7 @@ st_translate_vertex_program(struct st_context *st,
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL, /* interp mode */
- NULL, /* is centroid */
+ NULL, /* interp location */
/* outputs */
num_outputs,
stvp->result_to_output,
@@ -481,6 +481,7 @@ st_translate_fragment_program(struct st_context *st,
GLuint outputMapping[FRAG_RESULT_MAX];
GLuint inputMapping[VARYING_SLOT_MAX];
GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */
+ GLuint interpLocation[PIPE_MAX_SHADER_INPUTS];
GLuint attr;
GLbitfield64 inputsRead;
struct ureg_program *ureg;
@@ -489,7 +490,6 @@ st_translate_fragment_program(struct st_context *st,
ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
- GLboolean is_centroid[PIPE_MAX_SHADER_INPUTS];
uint fs_num_inputs = 0;
ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
@@ -541,7 +541,15 @@ st_translate_fragment_program(struct st_context *st,
const GLuint slot = fs_num_inputs++;
inputMapping[attr] = slot;
- is_centroid[slot] = (stfp->Base.IsCentroid & BITFIELD64_BIT(attr)) != 0;
+ if (stfp->Base.IsCentroid & BITFIELD64_BIT(attr))
+ interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTROID;
+ else if (stfp->Base.IsSample & BITFIELD64_BIT(attr))
+ interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE;
+ else
+ interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTER;
+
+ if (key->persample_shading)
+ interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE;
switch (attr) {
case VARYING_SLOT_POS:
@@ -768,7 +776,7 @@ st_translate_fragment_program(struct st_context *st,
input_semantic_name,
input_semantic_index,
interpMode,
- is_centroid,
+ interpLocation,
/* outputs */
fs_num_outputs,
outputMapping,
diff --git a/mesalib/src/mesa/state_tracker/st_program.h b/mesalib/src/mesa/state_tracker/st_program.h
index ce9174f67..9a5b6a847 100644
--- a/mesalib/src/mesa/state_tracker/st_program.h
+++ b/mesalib/src/mesa/state_tracker/st_program.h
@@ -58,6 +58,9 @@ struct st_fp_variant_key
/** for ARB_color_buffer_float */
GLuint clamp_color:1;
+
+ /** for ARB_sample_shading */
+ GLuint persample_shading:1;
};