aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-10-25 19:53:22 +0200
committermarha <marha@users.sourceforge.net>2014-10-25 19:53:22 +0200
commitd6d5581d5fba846c8476ad4d593da662306765d7 (patch)
tree7a864e15d2c5007b7c3298487a59f11f15c55c75 /mesalib/src/mesa
parenta14858a22f164b5accc4bd192a5d3de21d88e3d1 (diff)
downloadvcxsrv-d6d5581d5fba846c8476ad4d593da662306765d7.tar.gz
vcxsrv-d6d5581d5fba846c8476ad4d593da662306765d7.tar.bz2
vcxsrv-d6d5581d5fba846c8476ad4d593da662306765d7.zip
libXft mesa xserver pixman xkeyboard-config git update 25 Oct 2014
xserver commit 16a32c53f6e9ad1f3284d4596edfa33e9efb740e xkeyboard-config commit 0d4c3d9d891536aa1ec4f1fff5e3df51cfd2718d pixman commit 594e6a6c93e92fcfb495e987aec5617f6c37f467 libXft commit e8a83226bc10afb587f6f34daac44d2ef809c85e mesa commit 13862812dc910a4ef57cb72cb9fe777ce3c14515
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c9
-rw-r--r--mesalib/src/mesa/drivers/common/meta.h3
-rw-r--r--mesalib/src/mesa/main/attrib.c1
-rw-r--r--mesalib/src/mesa/main/bufferobj.c4
-rw-r--r--mesalib/src/mesa/main/context.c12
-rw-r--r--mesalib/src/mesa/main/dd.h3
-rw-r--r--mesalib/src/mesa/main/dlist.c26
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp14
-rw-r--r--mesalib/src/mesa/main/get.c1
-rw-r--r--mesalib/src/mesa/main/get_hash_params.py2
-rw-r--r--mesalib/src/mesa/main/mtypes.h7
-rw-r--r--mesalib/src/mesa/main/polygon.c2
-rw-r--r--mesalib/src/mesa/main/shaderapi.c2
-rw-r--r--mesalib/src/mesa/main/shaderapi.h9
-rw-r--r--mesalib/src/mesa/main/shaderimage.c2
-rw-r--r--mesalib/src/mesa/main/shaderobj.c28
-rw-r--r--mesalib/src/mesa/main/shaderobj.h6
-rw-r--r--mesalib/src/mesa/main/state.c25
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp74
-rw-r--r--mesalib/src/mesa/main/uniforms.c22
-rw-r--r--mesalib/src/mesa/main/uniforms.h2
-rw-r--r--mesalib/src/mesa/main/version.c2
-rw-r--r--mesalib/src/mesa/main/viewport.c122
-rw-r--r--mesalib/src/mesa/main/viewport.h6
-rw-r--r--mesalib/src/mesa/math/m_matrix.c17
-rw-r--r--mesalib/src/mesa/math/m_matrix.h4
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c25
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_viewport.c23
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_program.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_debug.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_debug.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp47
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h5
36 files changed, 318 insertions, 203 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 7a8e627ba..87532c1df 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -680,6 +680,12 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_Ortho(0.0, ctx->DrawBuffer->Width,
0.0, ctx->DrawBuffer->Height,
-1.0, 1.0);
+
+ if (ctx->Extensions.ARB_clip_control) {
+ save->ClipOrigin = ctx->Transform.ClipOrigin;
+ save->ClipDepthMode = ctx->Transform.ClipDepthMode;
+ _mesa_ClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
+ }
}
if (state & MESA_META_CLIP) {
@@ -1081,6 +1087,9 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_LoadMatrixf(save->ProjectionMatrix);
_mesa_MatrixMode(save->MatrixMode);
+
+ if (ctx->Extensions.ARB_clip_control)
+ _mesa_ClipControl(save->ClipOrigin, save->ClipDepthMode);
}
if (state & MESA_META_CLIP) {
diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h
index 2c9517b14..6ecf3c005 100644
--- a/mesalib/src/mesa/drivers/common/meta.h
+++ b/mesalib/src/mesa/drivers/common/meta.h
@@ -136,6 +136,9 @@ struct save_state
GLfloat ModelviewMatrix[16];
GLfloat ProjectionMatrix[16];
GLfloat TextureMatrix[16];
+ /** GL_ARB_clip_control */
+ GLenum ClipOrigin; /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
+ GLenum ClipDepthMode; /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
/** MESA_META_CLIP */
GLbitfield ClipPlanesEnabled;
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index d90e6627f..5345339f6 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -1345,6 +1345,7 @@ _mesa_PopAttrib(void)
if (xform->DepthClamp != ctx->Transform.DepthClamp)
_mesa_set_enable(ctx, GL_DEPTH_CLAMP,
ctx->Transform.DepthClamp);
+ _mesa_ClipControl(xform->ClipOrigin, xform->ClipDepthMode);
}
break;
case GL_TEXTURE_BIT:
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 0ee88560f..2bae1bc72 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -2710,7 +2710,7 @@ bind_buffer_range_uniform_buffer(struct gl_context *ctx,
if (offset & (ctx->Const.UniformBufferOffsetAlignment - 1)) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glBindBufferRange(offset misalgned %d/%d)", (int) offset,
+ "glBindBufferRange(offset misaligned %d/%d)", (int) offset,
ctx->Const.UniformBufferOffsetAlignment);
return;
}
@@ -2797,7 +2797,7 @@ bind_atomic_buffer(struct gl_context *ctx,
if (offset & (ATOMIC_COUNTER_SIZE - 1)) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "%s(offset misalgned %d/%d)", name, (int) offset,
+ "%s(offset misaligned %d/%d)", name, (int) offset,
ATOMIC_COUNTER_SIZE);
return;
}
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 5a8f7184a..25b9bfc4c 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -133,6 +133,7 @@
#include "program/prog_print.h"
#include "math/m_matrix.h"
#include "main/dispatch.h" /* for _gloffset_COUNT */
+#include "uniforms.h"
#ifdef USE_SPARC_ASM
#include "sparc/sparc.h"
@@ -1949,6 +1950,17 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
}
}
+ /* If a program is active and SSO not in use, check if validation of
+ * samplers succeeded for the active program. */
+ if (ctx->_Shader->ActiveProgram && ctx->_Shader != ctx->Pipeline.Current) {
+ char errMsg[100];
+ if (!_mesa_sampler_uniforms_are_valid(ctx->_Shader->ActiveProgram,
+ errMsg, 100)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", errMsg);
+ return GL_FALSE;
+ }
+ }
+
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
"%s(incomplete framebuffer)", where);
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index c07e83ad9..2f40915d9 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -758,8 +758,7 @@ struct dd_function_table {
struct gl_shader *(*NewShader)(struct gl_context *ctx,
GLuint name, GLenum type);
void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader);
- struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx,
- GLuint name);
+ struct gl_shader_program *(*NewShaderProgram)(GLuint name);
void (*DeleteShaderProgram)(struct gl_context *ctx,
struct gl_shader_program *shProg);
void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg);
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 5c7160d05..4b7b0604b 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -398,6 +398,9 @@ typedef enum
OPCODE_PROGRAM_UNIFORM_MATRIX34F,
OPCODE_PROGRAM_UNIFORM_MATRIX43F,
+ /* GL_ARB_clip_control */
+ OPCODE_CLIP_CONTROL,
+
/* GL_ARB_color_buffer_float */
OPCODE_CLAMP_COLOR,
@@ -7208,6 +7211,22 @@ save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
}
static void GLAPIENTRY
+save_ClipControl(GLenum origin, GLenum depth)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
+ if (n) {
+ n[1].e = origin;
+ n[2].e = depth;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_ClipControl(ctx->Exec, (origin, depth));
+ }
+}
+
+static void GLAPIENTRY
save_ClampColorARB(GLenum target, GLenum clamp)
{
GET_CURRENT_CONTEXT(ctx);
@@ -8617,6 +8636,10 @@ execute_list(struct gl_context *ctx, GLuint list)
get_pointer(&n[5])));
break;
+ case OPCODE_CLIP_CONTROL:
+ CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
+ break;
+
case OPCODE_CLAMP_COLOR:
CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
break;
@@ -9551,6 +9574,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_TexParameterIiv(table, save_TexParameterIiv);
SET_TexParameterIuiv(table, save_TexParameterIuiv);
+ /* GL_ARB_clip_control */
+ SET_ClipControl(table, save_ClipControl);
+
/* GL_ARB_color_buffer_float */
SET_ClampColor(table, save_ClampColorARB);
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index f0e2f89e4..15d66a744 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -91,6 +91,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_buffer_storage", o(ARB_buffer_storage), GL, 2013 },
{ "GL_ARB_clear_buffer_object", o(dummy_true), GL, 2012 },
{ "GL_ARB_clear_texture", o(ARB_clear_texture), GL, 2013 },
+ { "GL_ARB_clip_control", o(ARB_clip_control), GL, 2014 },
{ "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 },
{ "GL_ARB_compressed_texture_pixel_storage", o(dummy_true), GL, 2011 },
{ "GL_ARB_compute_shader", o(ARB_compute_shader), GL, 2012 },
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 9bb706cc5..5591d57df 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -665,7 +665,7 @@ static GLboolean args_match( const struct state_key *key, GLuint unit )
}
static ir_rvalue *
-smear(texenv_fragment_program *p, ir_rvalue *val)
+smear(ir_rvalue *val)
{
if (!val->type->is_scalar())
return val;
@@ -722,7 +722,7 @@ emit_combine(texenv_fragment_program *p,
tmp1 = mul(src[1], new(p->mem_ctx) ir_constant(2.0f));
tmp1 = add(tmp1, new(p->mem_ctx) ir_constant(-1.0f));
- return dot(swizzle_xyz(smear(p, tmp0)), swizzle_xyz(smear(p, tmp1)));
+ return dot(swizzle_xyz(smear(tmp0)), swizzle_xyz(smear(tmp1)));
}
case MODE_MODULATE_ADD_ATI:
return add(mul(src[0], src[2]), src[1]);
@@ -804,7 +804,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
key->unit[unit].NumArgsRGB,
key->unit[unit].ModeRGB,
key->unit[unit].OptRGB);
- val = smear(p, val);
+ val = smear(val);
if (rgb_saturate)
val = saturate(val);
@@ -816,7 +816,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
key->unit[unit].NumArgsRGB,
key->unit[unit].ModeRGB,
key->unit[unit].OptRGB);
- val = smear(p, val);
+ val = smear(val);
if (rgb_saturate)
val = saturate(val);
p->emit(assign(temp_var, val));
@@ -829,7 +829,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
key->unit[unit].NumArgsRGB,
key->unit[unit].ModeRGB,
key->unit[unit].OptRGB);
- val = swizzle_xyz(smear(p, val));
+ val = swizzle_xyz(smear(val));
if (rgb_saturate)
val = saturate(val);
p->emit(assign(temp_var, val, WRITEMASK_XYZ));
@@ -838,7 +838,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
key->unit[unit].NumArgsA,
key->unit[unit].ModeA,
key->unit[unit].OptA);
- val = swizzle_w(smear(p, val));
+ val = swizzle_w(smear(val));
if (alpha_saturate)
val = saturate(val);
p->emit(assign(temp_var, val, WRITEMASK_W));
@@ -1212,7 +1212,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
p.top_instructions = p.shader->ir;
p.instructions = p.shader->ir;
p.state = key;
- p.shader_program = ctx->Driver.NewShaderProgram(ctx, 0);
+ p.shader_program = ctx->Driver.NewShaderProgram(0);
/* Tell the linker to ignore the fact that we're building a
* separate shader, in case we're in a GLES2 context that would
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 0e2d8f687..6091efc7f 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -391,6 +391,7 @@ EXTRA_EXT(ARB_gpu_shader5);
EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5);
EXTRA_EXT(INTEL_performance_query);
EXTRA_EXT(ARB_explicit_uniform_location);
+EXTRA_EXT(ARB_clip_control);
static const int
extra_ARB_color_buffer_float_or_glcore[] = {
diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py
index da3568469..aa9f282d8 100644
--- a/mesalib/src/mesa/main/get_hash_params.py
+++ b/mesalib/src/mesa/main/get_hash_params.py
@@ -414,6 +414,8 @@ descriptor=[
[ "AUX_BUFFERS", "BUFFER_INT(Visual.numAuxBuffers), NO_EXTRA" ],
[ "BLUE_BIAS", "CONTEXT_FLOAT(Pixel.BlueBias), NO_EXTRA" ],
[ "BLUE_SCALE", "CONTEXT_FLOAT(Pixel.BlueScale), NO_EXTRA" ],
+ [ "CLIP_DEPTH_MODE", "CONTEXT_ENUM(Transform.ClipDepthMode), extra_ARB_clip_control" ],
+ [ "CLIP_ORIGIN", "CONTEXT_ENUM(Transform.ClipOrigin), extra_ARB_clip_control" ],
[ "CLIENT_ATTRIB_STACK_DEPTH", "CONTEXT_INT(ClientAttribStackDepth), NO_EXTRA" ],
[ "COLOR_MATERIAL_FACE", "CONTEXT_ENUM(Light.ColorMaterialFace), NO_EXTRA" ],
[ "COLOR_MATERIAL_PARAMETER", "CONTEXT_ENUM(Light.ColorMaterialMode), NO_EXTRA" ],
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 9f44edac6..e1f1f1dde 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1430,6 +1430,9 @@ struct gl_transform_attrib
GLboolean RescaleNormals; /**< GL_EXT_rescale_normal */
GLboolean RasterPositionUnclipped; /**< GL_IBM_rasterpos_clip */
GLboolean DepthClamp; /**< GL_ARB_depth_clamp */
+ /** GL_ARB_clip_control */
+ GLenum ClipOrigin; /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
+ GLenum ClipDepthMode; /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
};
@@ -2775,7 +2778,7 @@ struct gl_shader_program
* Transform feedback varyings last specified by
* glTransformFeedbackVaryings().
*
- * For the current set of transform feeedback varyings used for transform
+ * For the current set of transform feedback varyings used for transform
* feedback output, see LinkedTransformFeedback.
*/
struct {
@@ -2884,6 +2887,7 @@ struct gl_shader_program
GLboolean LinkStatus; /**< GL_LINK_STATUS */
GLboolean Validated;
GLboolean _Used; /**< Ever used for drawing? */
+ GLboolean SamplersValidated; /**< Samplers validated against texture units? */
GLchar *InfoLog;
unsigned Version; /**< GLSL version used for linking */
@@ -3697,6 +3701,7 @@ struct gl_extensions
GLboolean ARB_blend_func_extended;
GLboolean ARB_buffer_storage;
GLboolean ARB_clear_texture;
+ GLboolean ARB_clip_control;
GLboolean ARB_color_buffer_float;
GLboolean ARB_compute_shader;
GLboolean ARB_conditional_render_inverted;
diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c
index 611cef653..76d601977 100644
--- a/mesalib/src/mesa/main/polygon.c
+++ b/mesalib/src/mesa/main/polygon.c
@@ -104,8 +104,6 @@ _mesa_FrontFace( GLenum mode )
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.FrontFace = mode;
- ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW);
-
if (ctx->Driver.FrontFace)
ctx->Driver.FrontFace( ctx, mode );
}
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 3e6f61067..2be9092c1 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -316,7 +316,7 @@ create_shader_program(struct gl_context *ctx)
name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
- shProg = ctx->Driver.NewShaderProgram(ctx, name);
+ shProg = ctx->Driver.NewShaderProgram(name);
_mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg);
diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h
index 17b05b313..047d2562d 100644
--- a/mesalib/src/mesa/main/shaderapi.h
+++ b/mesalib/src/mesa/main/shaderapi.h
@@ -205,15 +205,6 @@ _mesa_use_shader_program(struct gl_context *ctx, GLenum type,
struct gl_shader_program *shProg,
struct gl_pipeline_object *shTarget);
-extern void GLAPIENTRY
-_mesa_UseShaderProgramEXT(GLenum type, GLuint program);
-
-extern void GLAPIENTRY
-_mesa_ActiveProgramEXT(GLuint program);
-
-extern GLuint GLAPIENTRY
-_mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string);
-
extern void
_mesa_copy_linked_program_data(gl_shader_stage type,
const struct gl_shader_program *src,
diff --git a/mesalib/src/mesa/main/shaderimage.c b/mesalib/src/mesa/main/shaderimage.c
index 9e62f4294..dcbcca623 100644
--- a/mesalib/src/mesa/main/shaderimage.c
+++ b/mesalib/src/mesa/main/shaderimage.c
@@ -384,7 +384,7 @@ validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
void
_mesa_validate_image_units(struct gl_context *ctx)
{
- int i;
+ unsigned i;
for (i = 0; i < ctx->Const.MaxImageUnits; ++i) {
struct gl_image_unit *u = &ctx->ImageUnits[i];
diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c
index 693e9a259..81bd7829d 100644
--- a/mesalib/src/mesa/main/shaderobj.c
+++ b/mesalib/src/mesa/main/shaderobj.c
@@ -235,8 +235,8 @@ _mesa_reference_shader_program(struct gl_context *ctx,
}
}
-void
-_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog)
+static void
+init_shader_program(struct gl_shader_program *prog)
{
prog->Type = GL_SHADER_PROGRAM_MESA;
prog->RefCount = 1;
@@ -261,13 +261,13 @@ _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog
* Called via ctx->Driver.NewShaderProgram()
*/
static struct gl_shader_program *
-_mesa_new_shader_program(struct gl_context *ctx, GLuint name)
+_mesa_new_shader_program(GLuint name)
{
struct gl_shader_program *shProg;
shProg = rzalloc(NULL, struct gl_shader_program);
if (shProg) {
shProg->Name = name;
- _mesa_init_shader_program(ctx, shProg);
+ init_shader_program(shProg);
}
return shProg;
}
@@ -277,11 +277,11 @@ _mesa_new_shader_program(struct gl_context *ctx, GLuint name)
* Clear (free) the shader program state that gets produced by linking.
*/
void
-_mesa_clear_shader_program_data(struct gl_context *ctx,
- struct gl_shader_program *shProg)
+_mesa_clear_shader_program_data(struct gl_shader_program *shProg)
{
+ unsigned i;
+
if (shProg->UniformStorage) {
- unsigned i;
for (i = 0; i < shProg->NumUserUniformStorage; ++i)
_mesa_uniform_detach_all_driver_storage(&shProg->UniformStorage[i]);
ralloc_free(shProg->UniformStorage);
@@ -303,6 +303,18 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
assert(shProg->InfoLog != NULL);
ralloc_free(shProg->InfoLog);
shProg->InfoLog = ralloc_strdup(shProg, "");
+
+ ralloc_free(shProg->UniformBlocks);
+ shProg->UniformBlocks = NULL;
+ shProg->NumUniformBlocks = 0;
+ for (i = 0; i < MESA_SHADER_STAGES; i++) {
+ ralloc_free(shProg->UniformBlockStageIndex[i]);
+ shProg->UniformBlockStageIndex[i] = NULL;
+ }
+
+ ralloc_free(shProg->AtomicBuffers);
+ shProg->AtomicBuffers = NULL;
+ shProg->NumAtomicBuffers = 0;
}
@@ -319,7 +331,7 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
- _mesa_clear_shader_program_data(ctx, shProg);
+ _mesa_clear_shader_program_data(shProg);
if (shProg->AttributeBindings) {
string_to_uint_map_dtor(shProg->AttributeBindings);
diff --git a/mesalib/src/mesa/main/shaderobj.h b/mesalib/src/mesa/main/shaderobj.h
index d72919c1f..05ddfeb50 100644
--- a/mesalib/src/mesa/main/shaderobj.h
+++ b/mesalib/src/mesa/main/shaderobj.h
@@ -71,9 +71,6 @@ _mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader);
extern struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
-extern void
-_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog);
-
extern struct gl_shader_program *
_mesa_lookup_shader_program(struct gl_context *ctx, GLuint name);
@@ -82,8 +79,7 @@ _mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
const char *caller);
extern void
-_mesa_clear_shader_program_data(struct gl_context *ctx,
- struct gl_shader_program *shProg);
+_mesa_clear_shader_program_data(struct gl_shader_program *shProg);
extern void
_mesa_free_shader_program_data(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index 80287c470..45bce78fd 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -51,6 +51,7 @@
#include "texobj.h"
#include "texstate.h"
#include "varray.h"
+#include "viewport.h"
#include "blend.h"
@@ -281,16 +282,29 @@ update_viewport_matrix(struct gl_context *ctx)
* NOTE: RasterPos uses this.
*/
for (i = 0; i < ctx->Const.MaxViewports; i++) {
+ double scale[3], translate[3];
+
+ _mesa_get_viewport_xform(ctx, i, scale, translate);
_math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap,
- ctx->ViewportArray[i].X, ctx->ViewportArray[i].Y,
- ctx->ViewportArray[i].Width, ctx->ViewportArray[i].Height,
- ctx->ViewportArray[i].Near, ctx->ViewportArray[i].Far,
- depthMax);
+ scale, translate, depthMax);
}
}
/**
+ * Update the ctx->Polygon._FrontBit flag.
+ */
+static void
+update_frontbit(struct gl_context *ctx)
+{
+ if (ctx->Transform.ClipOrigin == GL_LOWER_LEFT)
+ ctx->Polygon._FrontBit = (ctx->Polygon.FrontFace == GL_CW);
+ else
+ ctx->Polygon._FrontBit = (ctx->Polygon.FrontFace == GL_CCW);
+}
+
+
+/**
* Update derived multisample state.
*/
static void
@@ -372,6 +386,9 @@ _mesa_update_state_locked( struct gl_context *ctx )
if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
_mesa_update_texture( ctx, new_state );
+ if (new_state & _NEW_POLYGON)
+ update_frontbit( ctx );
+
if (new_state & _NEW_BUFFERS)
_mesa_update_framebuffer(ctx);
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 1592c9bfd..fcb14c4e2 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -533,8 +533,7 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
dst += array_index * store->element_stride;
switch (store->format) {
- case uniform_native:
- case uniform_bool_int_0_1: {
+ case uniform_native: {
unsigned j;
unsigned v;
@@ -550,8 +549,7 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
break;
}
- case uniform_int_float:
- case uniform_bool_float: {
+ case uniform_int_float: {
const int *isrc = (const int *) src;
unsigned j;
unsigned v;
@@ -572,27 +570,6 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
break;
}
- case uniform_bool_int_0_not0: {
- const int *isrc = (const int *) src;
- unsigned j;
- unsigned v;
- unsigned c;
-
- for (j = 0; j < count; j++) {
- for (v = 0; v < vectors; v++) {
- for (c = 0; c < components; c++) {
- ((int *) dst)[c] = *isrc == 0 ? 0 : ~0;
- isrc++;
- }
-
- dst += store->vector_stride;
- }
-
- dst += extra_stride;
- }
- break;
- }
-
default:
assert(!"Should not get here.");
break;
@@ -996,8 +973,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
* array offset in *offset, or GL_INVALID_INDEX (-1).
*/
extern "C" unsigned
-_mesa_get_uniform_location(struct gl_context *ctx,
- struct gl_shader_program *shProg,
+_mesa_get_uniform_location(struct gl_shader_program *shProg,
const GLchar *name,
unsigned *out_offset)
{
@@ -1064,42 +1040,16 @@ extern "C" bool
_mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,
char *errMsg, size_t errMsgLength)
{
- const glsl_type *unit_types[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
-
- memset(unit_types, 0, sizeof(unit_types));
-
- for (unsigned i = 0; i < shProg->NumUserUniformStorage; i++) {
- const struct gl_uniform_storage *const storage =
- &shProg->UniformStorage[i];
- const glsl_type *const t = (storage->type->is_array())
- ? storage->type->fields.array : storage->type;
-
- if (!t->is_sampler())
- continue;
-
- const unsigned count = MAX2(1, storage->type->array_size());
- for (unsigned j = 0; j < count; j++) {
- const unsigned unit = storage->storage[j].i;
-
- /* The types of the samplers associated with a particular texture
- * unit must be an exact match. Page 74 (page 89 of the PDF) of the
- * OpenGL 3.3 core spec says:
- *
- * "It is not allowed to have variables of different sampler
- * types pointing to the same texture image unit within a program
- * object."
- */
- if (unit_types[unit] == NULL) {
- unit_types[unit] = t;
- } else if (unit_types[unit] != t) {
- _mesa_snprintf(errMsg, errMsgLength,
- "Texture unit %d is accessed both as %s and %s",
- unit, unit_types[unit]->name, t->name);
- return false;
- }
- }
+ /* Shader does not have samplers. */
+ if (shProg->NumUserUniformStorage == 0)
+ return true;
+
+ if (!shProg->SamplersValidated) {
+ _mesa_snprintf(errMsg, errMsgLength,
+ "active samplers with a different type "
+ "refer to the same texture image unit");
+ return false;
}
-
return true;
}
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index 0d0cbf57e..c30710772 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -75,12 +75,26 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg,
memcpy(prog->SamplerUnits, shader->SamplerUnits, sizeof(prog->SamplerUnits));
memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
+ shProg->SamplersValidated = GL_TRUE;
+
for (s = 0; s < MAX_SAMPLERS; s++) {
if (prog->SamplersUsed & (1 << s)) {
GLuint unit = shader->SamplerUnits[s];
GLuint tgt = shader->SamplerTargets[s];
assert(unit < Elements(prog->TexturesUsed));
assert(tgt < NUM_TEXTURE_TARGETS);
+
+ /* The types of the samplers associated with a particular texture
+ * unit must be an exact match. Page 74 (page 89 of the PDF) of the
+ * OpenGL 3.3 core spec says:
+ *
+ * "It is not allowed to have variables of different sampler
+ * types pointing to the same texture image unit within a program
+ * object."
+ */
+ if (prog->TexturesUsed[unit] & ~(1 << tgt))
+ shProg->SamplersValidated = GL_FALSE;
+
prog->TexturesUsed[unit] |= (1 << tgt);
}
}
@@ -917,7 +931,7 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
return -1;
}
- index = _mesa_get_uniform_location(ctx, shProg, name, &offset);
+ index = _mesa_get_uniform_location(shProg, name, &offset);
if (index == GL_INVALID_INDEX)
return -1;
@@ -990,7 +1004,7 @@ _mesa_GetUniformIndices(GLuint program,
for (i = 0; i < uniformCount; i++) {
unsigned offset;
- uniformIndices[i] = _mesa_get_uniform_location(ctx, shProg,
+ uniformIndices[i] = _mesa_get_uniform_location(shProg,
uniformNames[i], &offset);
}
}
@@ -1096,7 +1110,7 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
for (i = 0; i < block->NumUniforms; i++) {
unsigned offset;
const int idx =
- _mesa_get_uniform_location(ctx, shProg,
+ _mesa_get_uniform_location(shProg,
block->Uniforms[i].IndexName,
&offset);
if (idx != -1)
@@ -1113,7 +1127,7 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
for (i = 0; i < block->NumUniforms; i++) {
unsigned offset;
const int idx =
- _mesa_get_uniform_location(ctx, shProg,
+ _mesa_get_uniform_location(shProg,
block->Uniforms[i].IndexName,
&offset);
diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h
index e7a370e84..6575a52f4 100644
--- a/mesalib/src/mesa/main/uniforms.h
+++ b/mesalib/src/mesa/main/uniforms.h
@@ -259,7 +259,7 @@ _mesa_parse_program_resource_name(const GLchar *name,
const GLchar **out_base_name_end);
unsigned
-_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg,
+_mesa_get_uniform_location(struct gl_shader_program *shProg,
const GLchar *name, unsigned *offset);
void
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 71f70119b..4951891cb 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -381,7 +381,6 @@ compute_version_es2(const struct gl_extensions *extensions)
extensions->ARB_shader_texture_lod &&
extensions->ARB_texture_float &&
extensions->ARB_texture_rg &&
- extensions->ARB_texture_compression_rgtc &&
extensions->EXT_draw_buffers2 &&
/* extensions->ARB_framebuffer_object && */
extensions->EXT_framebuffer_sRGB &&
@@ -389,7 +388,6 @@ compute_version_es2(const struct gl_extensions *extensions)
extensions->EXT_texture_array &&
extensions->EXT_texture_shared_exponent &&
extensions->EXT_transform_feedback &&
- extensions->NV_conditional_render &&
extensions->ARB_draw_instanced &&
extensions->ARB_uniform_buffer_object &&
extensions->EXT_texture_snorm &&
diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c
index 222ae307b..d6a9e290a 100644
--- a/mesalib/src/mesa/main/viewport.c
+++ b/mesalib/src/mesa/main/viewport.c
@@ -30,6 +30,7 @@
#include "context.h"
+#include "enums.h"
#include "macros.h"
#include "mtypes.h"
#include "viewport.h"
@@ -39,6 +40,8 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
GLfloat x, GLfloat y,
GLfloat width, GLfloat height)
{
+ double scale[3], translate[3];
+
/* clamp width and height to the implementation dependent range */
width = MIN2(width, (GLfloat) ctx->Const.MaxViewportWidth);
height = MIN2(height, (GLfloat) ctx->Const.MaxViewportHeight);
@@ -75,14 +78,9 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
* the WindowMap matrix being up to date in the driver's Viewport
* and DepthRange functions.
*/
+ _mesa_get_viewport_xform(ctx, idx, scale, translate);
_math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap,
- ctx->ViewportArray[idx].X,
- ctx->ViewportArray[idx].Y,
- ctx->ViewportArray[idx].Width,
- ctx->ViewportArray[idx].Height,
- ctx->ViewportArray[idx].Near,
- ctx->ViewportArray[idx].Far,
- ctx->DrawBuffer->_DepthMaxF);
+ scale, translate, ctx->DrawBuffer->_DepthMaxF);
#endif
}
@@ -248,6 +246,8 @@ static void
set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
GLclampd nearval, GLclampd farval)
{
+ double scale[3], translate[3];
+
if (ctx->ViewportArray[idx].Near == nearval &&
ctx->ViewportArray[idx].Far == farval)
return;
@@ -261,14 +261,9 @@ set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
* the WindowMap matrix being up to date in the driver's Viewport
* and DepthRange functions.
*/
+ _mesa_get_viewport_xform(ctx, idx, scale, translate);
_math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap,
- ctx->ViewportArray[idx].X,
- ctx->ViewportArray[idx].Y,
- ctx->ViewportArray[idx].Width,
- ctx->ViewportArray[idx].Height,
- ctx->ViewportArray[idx].Near,
- ctx->ViewportArray[idx].Far,
- ctx->DrawBuffer->_DepthMaxF);
+ scale, translate, ctx->DrawBuffer->_DepthMaxF);
#endif
}
@@ -396,10 +391,15 @@ void _mesa_init_viewport(struct gl_context *ctx)
GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
unsigned i;
+ ctx->Transform.ClipOrigin = GL_LOWER_LEFT;
+ ctx->Transform.ClipDepthMode = GL_NEGATIVE_ONE_TO_ONE;
+
/* Note: ctx->Const.MaxViewports may not have been set by the driver yet,
* so just initialize all of them.
*/
for (i = 0; i < MAX_VIEWPORTS; i++) {
+ double scale[3], translate[3];
+
/* Viewport group */
ctx->ViewportArray[i].X = 0;
ctx->ViewportArray[i].Y = 0;
@@ -409,8 +409,9 @@ void _mesa_init_viewport(struct gl_context *ctx)
ctx->ViewportArray[i].Far = 1.0;
_math_matrix_ctr(&ctx->ViewportArray[i]._WindowMap);
- _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap, 0, 0, 0, 0,
- 0.0F, 1.0F, depthMax);
+ _mesa_get_viewport_xform(ctx, i, scale, translate);
+ _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap,
+ scale, translate, depthMax);
}
}
@@ -427,3 +428,92 @@ void _mesa_free_viewport_data(struct gl_context *ctx)
_math_matrix_dtr(&ctx->ViewportArray[i]._WindowMap);
}
+extern void GLAPIENTRY
+_mesa_ClipControl(GLenum origin, GLenum depth)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE&VERBOSE_API)
+ _mesa_debug(ctx, "glClipControl(%s, %s)\n",
+ _mesa_lookup_enum_by_nr(origin),
+ _mesa_lookup_enum_by_nr(depth));
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!ctx->Extensions.ARB_clip_control) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glClipControl");
+ return;
+ }
+
+ if (origin != GL_LOWER_LEFT && origin != GL_UPPER_LEFT) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
+ return;
+ }
+
+ if (depth != GL_NEGATIVE_ONE_TO_ONE && depth != GL_ZERO_TO_ONE) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
+ return;
+ }
+
+ if (ctx->Transform.ClipOrigin == origin &&
+ ctx->Transform.ClipDepthMode == depth)
+ return;
+
+ FLUSH_VERTICES(ctx, 0);
+
+ if (ctx->Transform.ClipOrigin != origin) {
+ ctx->Transform.ClipOrigin = origin;
+
+ /* Affects the winding order of the front face. */
+ ctx->NewState |= _NEW_POLYGON;
+ /* Affects the y component of the viewport transform. */
+ ctx->NewState |= _NEW_VIEWPORT;
+
+ if (ctx->Driver.FrontFace)
+ ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
+ }
+
+ if (ctx->Transform.ClipDepthMode != depth) {
+ ctx->Transform.ClipDepthMode = depth;
+
+ /* Affects the z part of the viewpoint transform. */
+ ctx->NewState |= _NEW_VIEWPORT;
+
+ if (ctx->Driver.DepthRange)
+ ctx->Driver.DepthRange(ctx);
+ }
+}
+
+/**
+ * Computes the scaling and the translation part of the
+ * viewport transform matrix of the \param i-th viewport
+ * and writes that into \param scale and \param translate.
+ */
+void
+_mesa_get_viewport_xform(struct gl_context *ctx, unsigned i,
+ double scale[3], double translate[3])
+{
+ double x = ctx->ViewportArray[i].X;
+ double y = ctx->ViewportArray[i].Y;
+ double half_width = 0.5*ctx->ViewportArray[i].Width;
+ double half_height = 0.5*ctx->ViewportArray[i].Height;
+ double n = ctx->ViewportArray[i].Near;
+ double f = ctx->ViewportArray[i].Far;
+
+ scale[0] = half_width;
+ translate[0] = half_width + x;
+ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) {
+ scale[1] = -half_height;
+ translate[1] = half_height - y;
+ } else {
+ scale[1] = half_height;
+ translate[1] = half_height + y;
+ }
+ if (ctx->Transform.ClipDepthMode == GL_NEGATIVE_ONE_TO_ONE) {
+ scale[2] = 0.5*(f - n);
+ translate[2] = 0.5*(n + f);
+ } else {
+ scale[2] = f - n;
+ translate[2] = n;
+ }
+}
diff --git a/mesalib/src/mesa/main/viewport.h b/mesalib/src/mesa/main/viewport.h
index f2311c02b..426e194bd 100644
--- a/mesalib/src/mesa/main/viewport.h
+++ b/mesalib/src/mesa/main/viewport.h
@@ -71,5 +71,11 @@ _mesa_init_viewport(struct gl_context *ctx);
extern void
_mesa_free_viewport_data(struct gl_context *ctx);
+extern void GLAPIENTRY
+_mesa_ClipControl(GLenum origin, GLenum depth);
+
+extern void
+_mesa_get_viewport_xform(struct gl_context *ctx, unsigned i,
+ double scale[3], double translate[3]);
#endif
diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c
index e512e456f..9c9310d93 100644
--- a/mesalib/src/mesa/math/m_matrix.c
+++ b/mesalib/src/mesa/math/m_matrix.c
@@ -1110,16 +1110,15 @@ _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
* Transforms Normalized Device Coords to window/Z values.
*/
void
-_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y,
- GLfloat width, GLfloat height,
- GLdouble zNear, GLdouble zFar, GLdouble depthMax)
+_math_matrix_viewport(GLmatrix *m, const double scale[3],
+ const double translate[3], double depthMax)
{
- m->m[MAT_SX] = width / 2.0F;
- m->m[MAT_TX] = m->m[MAT_SX] + x;
- m->m[MAT_SY] = height / 2.0F;
- m->m[MAT_TY] = m->m[MAT_SY] + y;
- m->m[MAT_SZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0));
- m->m[MAT_TZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0 + zNear));
+ m->m[MAT_SX] = scale[0];
+ m->m[MAT_TX] = translate[0];
+ m->m[MAT_SY] = scale[1];
+ m->m[MAT_TY] = translate[1];
+ m->m[MAT_SZ] = depthMax*scale[2];
+ m->m[MAT_TZ] = depthMax*translate[2];
m->flags = MAT_FLAG_GENERAL_SCALE | MAT_FLAG_TRANSLATION;
m->type = MATRIX_3D_NO_ROT;
}
diff --git a/mesalib/src/mesa/math/m_matrix.h b/mesalib/src/mesa/math/m_matrix.h
index dddce7019..778d716dc 100644
--- a/mesalib/src/mesa/math/m_matrix.h
+++ b/mesalib/src/mesa/math/m_matrix.h
@@ -122,8 +122,8 @@ _math_matrix_frustum( GLmatrix *mat,
GLfloat nearval, GLfloat farval );
extern void
-_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y, GLfloat width, GLfloat height,
- GLdouble zNear, GLdouble zFar, GLdouble depthMax);
+_math_matrix_viewport( GLmatrix *m, const double scale[3],
+ const double translate[3], double depthMax );
extern void
_math_matrix_set_identity( GLmatrix *dest );
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index b3e04d7b6..5cd905822 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -3020,7 +3020,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
{
unsigned int i;
- _mesa_clear_shader_program_data(ctx, prog);
+ _mesa_clear_shader_program_data(prog);
prog->LinkStatus = GL_TRUE;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index a2285383e..50209788b 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -33,6 +33,7 @@
#include "main/macros.h"
#include "st_context.h"
#include "st_atom.h"
+#include "st_debug.h"
#include "st_program.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
@@ -71,6 +72,11 @@ static void update_raster_state( struct st_context *st )
{
raster->front_ccw = (ctx->Polygon.FrontFace == GL_CCW);
+ /* _NEW_VIEWPORT */
+ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) {
+ raster->front_ccw ^= 1;
+ }
+
/*
* Gallium's surfaces are Y=0=TOP orientation. OpenGL is the
* opposite. Window system surfaces are Y=0=TOP. Mesa's FBOs
@@ -119,8 +125,14 @@ static void update_raster_state( struct st_context *st )
/* _NEW_POLYGON
*/
{
- raster->fill_front = translate_fill( ctx->Polygon.FrontMode );
- raster->fill_back = translate_fill( ctx->Polygon.BackMode );
+ if (ST_DEBUG & DEBUG_WIREFRAME) {
+ raster->fill_front = PIPE_POLYGON_MODE_LINE;
+ raster->fill_back = PIPE_POLYGON_MODE_LINE;
+ }
+ else {
+ raster->fill_front = translate_fill( ctx->Polygon.FrontMode );
+ raster->fill_back = translate_fill( ctx->Polygon.BackMode );
+ }
/* Simplify when culling is active:
*/
@@ -234,6 +246,12 @@ static void update_raster_state( struct st_context *st )
raster->half_pixel_center = 1;
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
raster->bottom_edge_rule = 1;
+ /* _NEW_VIEWPORT */
+ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT)
+ raster->bottom_edge_rule ^= 1;
+
+ /* _NEW_VIEWPORT */
+ raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE);
/* ST_NEW_RASTERIZER */
raster->rasterizer_discard = ctx->RasterDiscard;
@@ -265,7 +283,8 @@ const struct st_tracked_state st_update_rasterizer = {
_NEW_PROGRAM |
_NEW_SCISSOR |
_NEW_FRAG_CLAMP |
- _NEW_TRANSFORM), /* mesa state dependencies*/
+ _NEW_TRANSFORM |
+ _NEW_VIEWPORT), /* mesa state dependencies*/
(ST_NEW_VERTEX_PROGRAM |
ST_NEW_RASTERIZER), /* state tracker dependencies */
},
diff --git a/mesalib/src/mesa/state_tracker/st_atom_viewport.c b/mesalib/src/mesa/state_tracker/st_atom_viewport.c
index 7584f9b3d..5b992084b 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_viewport.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_viewport.c
@@ -27,6 +27,7 @@
#include "main/context.h"
+#include "main/viewport.h"
#include "st_context.h"
#include "st_atom.h"
#include "pipe/p_context.h"
@@ -63,21 +64,17 @@ update_viewport( struct st_context *st )
*/
for (i = 0; i < ctx->Const.MaxViewports; i++)
{
- GLfloat x = ctx->ViewportArray[i].X;
- GLfloat y = ctx->ViewportArray[i].Y;
- GLfloat z = ctx->ViewportArray[i].Near;
- GLfloat half_width = ctx->ViewportArray[i].Width * 0.5f;
- GLfloat half_height = ctx->ViewportArray[i].Height * 0.5f;
- GLfloat half_depth = (GLfloat)(ctx->ViewportArray[i].Far - ctx->ViewportArray[i].Near) * 0.5f;
-
- st->state.viewport[i].scale[0] = half_width;
- st->state.viewport[i].scale[1] = half_height * yScale;
- st->state.viewport[i].scale[2] = half_depth;
+ double scale[3], translate[3];
+ _mesa_get_viewport_xform(ctx, i, scale, translate);
+
+ st->state.viewport[i].scale[0] = scale[0];
+ st->state.viewport[i].scale[1] = scale[1] * yScale;
+ st->state.viewport[i].scale[2] = scale[2];
st->state.viewport[i].scale[3] = 1.0;
- st->state.viewport[i].translate[0] = half_width + x;
- st->state.viewport[i].translate[1] = (half_height + y) * yScale + yBias;
- st->state.viewport[i].translate[2] = half_depth + z;
+ st->state.viewport[i].translate[0] = translate[0];
+ st->state.viewport[i].translate[1] = translate[1] * yScale + yBias;
+ st->state.viewport[i].translate[2] = translate[2];
st->state.viewport[i].translate[3] = 0.0;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_program.c b/mesalib/src/mesa/state_tracker/st_cb_program.c
index 82e1fd14a..faff9c4bd 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_program.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_program.c
@@ -242,7 +242,5 @@ st_init_program_functions(struct dd_function_table *functions)
functions->IsProgramNative = st_is_program_native;
functions->ProgramStringNotify = st_program_string_notify;
- functions->NewShader = st_new_shader;
- functions->NewShaderProgram = st_new_shader_program;
functions->LinkShader = st_link_shader;
}
diff --git a/mesalib/src/mesa/state_tracker/st_debug.c b/mesalib/src/mesa/state_tracker/st_debug.c
index 8c15e18d3..de3e3a9cd 100644
--- a/mesalib/src/mesa/state_tracker/st_debug.c
+++ b/mesalib/src/mesa/state_tracker/st_debug.c
@@ -55,6 +55,7 @@ static const struct debug_named_value st_debug_flags[] = {
{ "query", DEBUG_QUERY, NULL },
{ "draw", DEBUG_DRAW, NULL },
{ "buffer", DEBUG_BUFFER, NULL },
+ { "wf", DEBUG_WIREFRAME, NULL },
DEBUG_NAMED_VALUE_END
};
diff --git a/mesalib/src/mesa/state_tracker/st_debug.h b/mesalib/src/mesa/state_tracker/st_debug.h
index c1c482524..49b916fb3 100644
--- a/mesalib/src/mesa/state_tracker/st_debug.h
+++ b/mesalib/src/mesa/state_tracker/st_debug.h
@@ -46,6 +46,7 @@ st_print_current(void);
#define DEBUG_SCREEN 0x80
#define DEBUG_DRAW 0x100
#define DEBUG_BUFFER 0x200
+#define DEBUG_WIREFRAME 0x400
#ifdef DEBUG
extern int ST_DEBUG;
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 5dd827800..aff3ddebe 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -192,6 +192,10 @@ void st_init_limits(struct pipe_screen *screen,
pc->MaxParameters = pc->MaxNativeParameters =
screen->get_shader_param(screen, sh,
PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) / sizeof(float[4]);
+ pc->MaxInputComponents =
+ screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INPUTS) * 4;
+ pc->MaxOutputComponents =
+ screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_OUTPUTS) * 4;
pc->MaxUniformComponents = 4 * MIN2(pc->MaxNativeParameters, MAX_UNIFORMS);
@@ -261,10 +265,6 @@ void st_init_limits(struct pipe_screen *screen,
c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
PIPE_SHADER_CAP_MAX_INPUTS);
c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
- c->Program[MESA_SHADER_FRAGMENT].MaxInputComponents = c->MaxVarying * 4;
- c->Program[MESA_SHADER_VERTEX].MaxOutputComponents = c->MaxVarying * 4;
- c->Program[MESA_SHADER_GEOMETRY].MaxInputComponents = c->MaxVarying * 4;
- c->Program[MESA_SHADER_GEOMETRY].MaxOutputComponents = c->MaxVarying * 4;
c->MaxGeometryOutputVertices = screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES);
c->MaxGeometryTotalOutputComponents = screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS);
@@ -463,6 +463,7 @@ void st_init_extensions(struct pipe_screen *screen,
{ o(ARB_derivative_control), PIPE_CAP_TGSI_FS_FINE_DERIVATIVE },
{ o(ARB_conditional_render_inverted), PIPE_CAP_CONDITIONAL_RENDER_INVERTED },
{ o(ARB_texture_view), PIPE_CAP_SAMPLER_VIEW_TARGET },
+ { o(ARB_clip_control), PIPE_CAP_CLIP_HALFZ },
};
/* Required: render target and sampler support */
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 a0da9f635..a4e2c8da5 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4781,15 +4781,19 @@ emit_wpos(struct st_context *st,
* saturating the value to [0,1] does the job.
*/
static void
-emit_face_var(struct st_translate *t)
+emit_face_var(struct gl_context *ctx, struct st_translate *t)
{
struct ureg_program *ureg = t->ureg;
struct ureg_dst face_temp = ureg_DECL_temporary(ureg);
struct ureg_src face_input = t->inputs[t->inputMapping[VARYING_SLOT_FACE]];
- /* MOV_SAT face_temp, input[face] */
- face_temp = ureg_saturate(face_temp);
- ureg_MOV(ureg, face_temp, face_input);
+ if (ctx->Const.NativeIntegers) {
+ ureg_FSGE(ureg, face_temp, face_input, ureg_imm1f(ureg, 0));
+ }
+ else {
+ /* MOV_SAT face_temp, input[face] */
+ ureg_MOV(ureg, ureg_saturate(face_temp), face_input);
+ }
/* Use face_temp as face input from here on: */
t->inputs[t->inputMapping[VARYING_SLOT_FACE]] = ureg_src(face_temp);
@@ -4909,7 +4913,7 @@ st_translate_program(
}
if (proginfo->InputsRead & VARYING_BIT_FACE)
- emit_face_var(t);
+ emit_face_var(ctx, t);
/*
* Declare output attributes.
@@ -5210,6 +5214,7 @@ get_mesa_program(struct gl_context *ctx,
v->have_sqrt = pscreen->get_shader_param(pscreen, ptarget,
PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED);
+ _mesa_copy_linked_program_data(shader->Stage, shader_program, prog);
_mesa_generate_parameters_list_for_uniforms(shader_program, shader,
prog->Parameters);
@@ -5315,10 +5320,6 @@ get_mesa_program(struct gl_context *ctx,
case GL_GEOMETRY_SHADER:
stgp = (struct st_geometry_program *)prog;
stgp->glsl_to_tgsi = v;
- stgp->Base.InputType = shader_program->Geom.InputType;
- stgp->Base.OutputType = shader_program->Geom.OutputType;
- stgp->Base.VerticesOut = shader_program->Geom.VerticesOut;
- stgp->Base.Invocations = shader_program->Geom.Invocations;
break;
default:
assert(!"should not be reached");
@@ -5330,34 +5331,6 @@ get_mesa_program(struct gl_context *ctx,
extern "C" {
-struct gl_shader *
-st_new_shader(struct gl_context *ctx, GLuint name, GLuint type)
-{
- struct gl_shader *shader;
- assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER ||
- type == GL_GEOMETRY_SHADER_ARB);
- shader = rzalloc(NULL, struct gl_shader);
- if (shader) {
- shader->Type = type;
- shader->Stage = _mesa_shader_enum_to_shader_stage(type);
- shader->Name = name;
- _mesa_init_shader(ctx, shader);
- }
- return shader;
-}
-
-struct gl_shader_program *
-st_new_shader_program(struct gl_context *ctx, GLuint name)
-{
- struct gl_shader_program *shProg;
- shProg = rzalloc(NULL, struct gl_shader_program);
- if (shProg) {
- shProg->Name = name;
- _mesa_init_shader_program(ctx, shProg);
- }
- return shProg;
-}
-
/**
* Link a shader.
* Called via ctx->Driver.LinkShader()
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 18f666f5b..5ed640747 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -61,11 +61,6 @@ void get_bitmap_visitor(struct st_fragment_program *fp,
struct glsl_to_tgsi_visitor *original,
int samplerIndex);
-struct gl_shader *st_new_shader(struct gl_context *ctx, GLuint name, GLuint type);
-
-struct gl_shader_program *
-st_new_shader_program(struct gl_context *ctx, GLuint name);
-
GLboolean st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
void