aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-16 16:33:47 +0000
committermarha <marha@users.sourceforge.net>2011-01-16 16:33:47 +0000
commit5d0def58c0a3124e70076584cadc7c761e1f9e57 (patch)
treee87238976fbf7b0845aaa60876e417ca42146e1a /mesalib/src/mesa/state_tracker
parent8b668e29799ccd203f12719c6ef92c08027f6592 (diff)
parent367c91bebcdc1f5ba4278b68eb8715218d9640ad (diff)
downloadvcxsrv-5d0def58c0a3124e70076584cadc7c761e1f9e57.tar.gz
vcxsrv-5d0def58c0a3124e70076584cadc7c761e1f9e57.tar.bz2
vcxsrv-5d0def58c0a3124e70076584cadc7c761e1f9e57.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_blend.c37
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c20
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c27
5 files changed, 77 insertions, 19 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_blend.c b/mesalib/src/mesa/state_tracker/st_atom_blend.c
index e60bbd36f..26bb3dab9 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_blend.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_blend.c
@@ -169,13 +169,18 @@ colormask_per_rt(struct gl_context *ctx)
}
/**
- * Figure out if blend enables are different per rt.
+ * Figure out if blend enables/state are different per rt.
*/
static GLboolean
blend_per_rt(struct gl_context *ctx)
{
if (ctx->Color.BlendEnabled &&
(ctx->Color.BlendEnabled != ((1 << ctx->Const.MaxDrawBuffers) - 1))) {
+ /* This can only happen if GL_EXT_draw_buffers2 is enabled */
+ return GL_TRUE;
+ }
+ if (ctx->Color._BlendFuncPerBuffer || ctx->Color._BlendEquationPerBuffer) {
+ /* this can only happen if GL_ARB_draw_buffers_blend is enabled */
return GL_TRUE;
}
return GL_FALSE;
@@ -202,7 +207,7 @@ update_blend( struct st_context *st )
don't happen. */
if (st->ctx->Color.ColorLogicOpEnabled ||
(st->ctx->Color.BlendEnabled &&
- st->ctx->Color.BlendEquationRGB == GL_LOGIC_OP)) {
+ st->ctx->Color.Blend[0].EquationRGB == GL_LOGIC_OP)) {
/* logicop enabled */
blend->logicop_enable = 1;
blend->logicop_func = translate_logicop(st->ctx->Color.LogicOp);
@@ -213,28 +218,36 @@ update_blend( struct st_context *st )
blend->rt[i].blend_enable = (st->ctx->Color.BlendEnabled >> i) & 0x1;
- blend->rt[i].rgb_func = translate_blend(st->ctx->Color.BlendEquationRGB);
- if (st->ctx->Color.BlendEquationRGB == GL_MIN ||
- st->ctx->Color.BlendEquationRGB == GL_MAX) {
+ blend->rt[i].rgb_func =
+ translate_blend(st->ctx->Color.Blend[i].EquationRGB);
+
+ if (st->ctx->Color.Blend[i].EquationRGB == GL_MIN ||
+ st->ctx->Color.Blend[i].EquationRGB == GL_MAX) {
/* Min/max are special */
blend->rt[i].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
blend->rt[i].rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
}
else {
- blend->rt[i].rgb_src_factor = translate_blend(st->ctx->Color.BlendSrcRGB);
- blend->rt[i].rgb_dst_factor = translate_blend(st->ctx->Color.BlendDstRGB);
+ blend->rt[i].rgb_src_factor =
+ translate_blend(st->ctx->Color.Blend[i].SrcRGB);
+ blend->rt[i].rgb_dst_factor =
+ translate_blend(st->ctx->Color.Blend[i].DstRGB);
}
- blend->rt[i].alpha_func = translate_blend(st->ctx->Color.BlendEquationA);
- if (st->ctx->Color.BlendEquationA == GL_MIN ||
- st->ctx->Color.BlendEquationA == GL_MAX) {
+ blend->rt[i].alpha_func =
+ translate_blend(st->ctx->Color.Blend[i].EquationA);
+
+ if (st->ctx->Color.Blend[i].EquationA == GL_MIN ||
+ st->ctx->Color.Blend[i].EquationA == GL_MAX) {
/* Min/max are special */
blend->rt[i].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
blend->rt[i].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
}
else {
- blend->rt[i].alpha_src_factor = translate_blend(st->ctx->Color.BlendSrcA);
- blend->rt[i].alpha_dst_factor = translate_blend(st->ctx->Color.BlendDstA);
+ blend->rt[i].alpha_src_factor =
+ translate_blend(st->ctx->Color.Blend[i].SrcA);
+ blend->rt[i].alpha_dst_factor =
+ translate_blend(st->ctx->Color.Blend[i].DstA);
}
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index 37eae9401..b98953b7b 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -221,6 +221,10 @@ update_textures(struct st_context *st)
firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
firstImageFormat = st_mesa_format_to_pipe_format(firstImage->base.TexFormat);
+ if ((stObj->base.sRGBDecode == GL_SKIP_DECODE_EXT) && (_mesa_get_format_color_encoding(firstImage->base.TexFormat) == GL_SRGB)) {
+ firstImageFormat = st_mesa_format_to_pipe_format(_mesa_get_srgb_format_linear(firstImage->base.TexFormat));
+ }
+
if (firstImageFormat != stObj->pt->format)
st_view_format = firstImageFormat;
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index ece051fc8..19466ea44 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -387,9 +387,16 @@ setup_interleaved_attribs(struct gl_context *ctx,
vbuffer->max_index = max_index;
}
+ /*
+ if (arrays[mesaAttr]->InstanceDivisor)
+ vbuffer[attr].max_index = arrays[mesaAttr]->_MaxElement;
+ else
+ vbuffer[attr].max_index = max_index;
+ */
+
velements[attr].src_offset =
(unsigned) (arrays[mesaAttr]->Ptr - offset0);
- velements[attr].instance_divisor = 0;
+ velements[attr].instance_divisor = arrays[mesaAttr]->InstanceDivisor;
velements[attr].vertex_buffer_index = 0;
velements[attr].src_format =
st_pipe_vertex_format(arrays[mesaAttr]->Type,
@@ -440,7 +447,6 @@ setup_non_interleaved_attribs(struct gl_context *ctx,
vbuffer[attr].buffer = NULL;
pipe_resource_reference(&vbuffer[attr].buffer, stobj->buffer);
vbuffer[attr].buffer_offset = pointer_to_offset(arrays[mesaAttr]->Ptr);
- velements[attr].src_offset = 0;
}
else {
/* attribute data is in user-space memory, not a VBO */
@@ -476,15 +482,19 @@ setup_non_interleaved_attribs(struct gl_context *ctx,
}
vbuffer[attr].buffer_offset = 0;
- velements[attr].src_offset = 0;
}
assert(velements[attr].src_offset <= 2048); /* 11-bit field */
/* common-case setup */
vbuffer[attr].stride = stride; /* in bytes */
- vbuffer[attr].max_index = max_index;
- velements[attr].instance_divisor = 0;
+ if (arrays[mesaAttr]->InstanceDivisor)
+ vbuffer[attr].max_index = arrays[mesaAttr]->_MaxElement;
+ else
+ vbuffer[attr].max_index = max_index;
+
+ velements[attr].src_offset = 0;
+ velements[attr].instance_divisor = arrays[mesaAttr]->InstanceDivisor;
velements[attr].vertex_buffer_index = attr;
velements[attr].src_format
= st_pipe_vertex_format(arrays[mesaAttr]->Type,
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 4f8862773..0a1c473cc 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -387,6 +387,7 @@ void st_init_extensions(struct st_context *st)
PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
+ ctx->Extensions.EXT_texture_sRGB_decode = GL_TRUE;
}
if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM,
@@ -438,11 +439,9 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
}
-#if 0 /* not yet */
if (screen->get_param(screen, PIPE_CAP_INDEP_BLEND_FUNC)) {
ctx->Extensions.ARB_draw_buffers_blend = GL_TRUE;
}
-#endif
if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
#if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */
@@ -461,4 +460,9 @@ void st_init_extensions(struct st_context *st)
if (screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
ctx->Extensions.ARB_shader_stencil_export = GL_TRUE;
}
+
+ if (screen->get_param(screen, PIPE_CAP_INSTANCED_DRAWING)) {
+ ctx->Extensions.ARB_draw_instanced = GL_TRUE;
+ ctx->Extensions.ARB_instanced_arrays = GL_TRUE;
+ }
}
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 1a64c503a..b24729440 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -72,6 +72,7 @@ struct st_translate {
struct ureg_src inputs[PIPE_MAX_SHADER_INPUTS];
struct ureg_dst address[1];
struct ureg_src samplers[PIPE_MAX_SAMPLERS];
+ struct ureg_src systemValues[SYSTEM_VALUE_MAX];
/* Extra info for handling point size clamping in vertex shader */
struct ureg_dst pointSizeResult; /**< Actual point size output register */
@@ -104,6 +105,13 @@ struct st_translate {
};
+/** Map Mesa's SYSTEM_VALUE_x to TGSI_SEMANTIC_x */
+static unsigned mesa_sysval_to_semantic[SYSTEM_VALUE_MAX] = {
+ TGSI_SEMANTIC_FACE,
+ TGSI_SEMANTIC_INSTANCEID
+};
+
+
/**
* Make note of a branch to a label in the TGSI code.
* After we've emitted all instructions, we'll go over the list
@@ -245,6 +253,10 @@ src_register( struct st_translate *t,
case PROGRAM_ADDRESS:
return ureg_src(t->address[index]);
+ case PROGRAM_SYSTEM_VALUE:
+ assert(index < Elements(t->systemValues));
+ return t->systemValues[index];
+
default:
debug_assert( 0 );
return ureg_src_undef();
@@ -1089,6 +1101,21 @@ st_translate_mesa_program(
t->address[0] = ureg_DECL_address( ureg );
}
+ /* Declare misc input registers
+ */
+ {
+ GLbitfield sysInputs = program->SystemValuesRead;
+ unsigned numSys = 0;
+ for (i = 0; sysInputs; i++) {
+ if (sysInputs & (1 << i)) {
+ unsigned semName = mesa_sysval_to_semantic[i];
+ t->systemValues[i] = ureg_DECL_system_value(ureg, numSys, semName, 0);
+ numSys++;
+ sysInputs &= ~(1 << i);
+ }
+ }
+ }
+
if (program->IndirectRegisterFiles & (1 << PROGRAM_TEMPORARY)) {
/* If temps are accessed with indirect addressing, declare temporaries
* in sequential order. Else, we declare them on demand elsewhere.