aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/configure.ac4
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_debug.h19
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h10
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_vbuf.c36
-rw-r--r--mesalib/src/glsl/ast.h13
-rw-r--r--mesalib/src/glsl/ast_function.cpp63
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp39
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp1
-rw-r--r--mesalib/src/mesa/SConscript1
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c39
-rw-r--r--mesalib/src/mesa/drivers/common/meta.h12
-rw-r--r--mesalib/src/mesa/main/attrib.c2
-rw-r--r--mesalib/src/mesa/main/bufferobj.c5
-rw-r--r--mesalib/src/mesa/main/dd.h42
-rw-r--r--mesalib/src/mesa/main/format_pack.c8
-rw-r--r--mesalib/src/mesa/main/format_unpack.h5
-rw-r--r--mesalib/src/mesa/main/framebuffer.c6
-rw-r--r--mesalib/src/mesa/main/mtypes.h6
-rw-r--r--mesalib/src/mesa/main/shaderobj.h3
-rw-r--r--mesalib/src/mesa/main/teximage.c46
-rw-r--r--mesalib/src/mesa/sources.mak1
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_clip.c20
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c40
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp11
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c18
-rw-r--r--mesalib/src/mesa/swrast/s_context.c29
-rw-r--r--mesalib/src/mesa/swrast/s_context.h4
-rw-r--r--mesalib/src/mesa/swrast/s_depth.c36
-rw-r--r--mesalib/src/mesa/swrast/s_depthstencil.c791
-rw-r--r--mesalib/src/mesa/swrast/s_depthstencil.h39
-rw-r--r--mesalib/src/mesa/swrast/s_span.c5
-rw-r--r--mesalib/src/mesa/swrast/s_span.h3
33 files changed, 358 insertions, 1010 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index e5a5e8842..511d147cb 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -402,7 +402,6 @@ fi
GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
-GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
@@ -414,7 +413,6 @@ GBM_LIB_NAME='lib$(GBM_LIB).'${LIB_EXTENSION}
GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
-GLUT_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLUT_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
@@ -427,7 +425,6 @@ GBM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GBM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTE
AC_SUBST([GL_LIB_NAME])
AC_SUBST([GLU_LIB_NAME])
-AC_SUBST([GLUT_LIB_NAME])
AC_SUBST([OSMESA_LIB_NAME])
AC_SUBST([EGL_LIB_NAME])
AC_SUBST([GLESv1_CM_LIB_NAME])
@@ -439,7 +436,6 @@ AC_SUBST([GBM_LIB_NAME])
AC_SUBST([GL_LIB_GLOB])
AC_SUBST([GLU_LIB_GLOB])
-AC_SUBST([GLUT_LIB_GLOB])
AC_SUBST([OSMESA_LIB_GLOB])
AC_SUBST([EGL_LIB_GLOB])
AC_SUBST([GLESv1_CM_LIB_GLOB])
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.h b/mesalib/src/gallium/auxiliary/util/u_debug.h
index cbea35830..ed19cda05 100644
--- a/mesalib/src/gallium/auxiliary/util/u_debug.h
+++ b/mesalib/src/gallium/auxiliary/util/u_debug.h
@@ -215,6 +215,25 @@ void _debug_assert_fail(const char *expr,
/**
+ * Emit a warning message, but only once.
+ */
+#ifdef DEBUG
+#define debug_warn_once(__msg) \
+ do { \
+ static bool warned = FALSE; \
+ if (!warned) { \
+ _debug_printf("%s:%u:%s: one time warning: %s\n", \
+ __FILE__, __LINE__, __FUNCTION__, __msg); \
+ warned = TRUE; \
+ } \
+ } while (0)
+#else
+#define debug_warn_once(__msg) \
+ ((void)0)
+#endif
+
+
+/**
* Output an error message. Not muted on release version.
*/
#ifdef DEBUG
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h b/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h
index 6bb430296..bd64b2896 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format_r11g11b10f.h
@@ -119,12 +119,12 @@ static INLINE float uf11_to_f32(uint16_t val)
float scale, decimal;
exponent -= 15;
if (exponent < 0) {
- scale = 1.0 / (1 << -exponent);
+ scale = 1.0f / (1 << -exponent);
}
else {
- scale = 1 << exponent;
+ scale = (float) (1 << exponent);
}
- decimal = 1.0 + (float) mantissa / 64;
+ decimal = 1.0f + (float) mantissa / 64;
f32.f = scale * decimal;
}
@@ -208,9 +208,9 @@ static INLINE float uf10_to_f32(uint16_t val)
scale = 1.0 / (1 << -exponent);
}
else {
- scale = 1 << exponent;
+ scale = (float) (1 << exponent);
}
- decimal = 1.0 + (float) mantissa / 32;
+ decimal = 1.0f + (float) mantissa / 32;
f32.f = scale * decimal;
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf.c b/mesalib/src/gallium/auxiliary/util/u_vbuf.c
index 711ad10e8..50c35afd5 100644
--- a/mesalib/src/gallium/auxiliary/util/u_vbuf.c
+++ b/mesalib/src/gallium/auxiliary/util/u_vbuf.c
@@ -912,6 +912,39 @@ static boolean u_vbuf_need_minmax_index(struct u_vbuf_priv *mgr)
return FALSE;
}
+static boolean u_vbuf_mapping_vertex_buffer_blocks(struct u_vbuf_priv *mgr)
+{
+ unsigned i, nr = mgr->ve->count;
+
+ for (i = 0; i < nr; i++) {
+ struct pipe_vertex_buffer *vb;
+ unsigned index;
+
+ /* Per-instance attribs are not per-vertex data. */
+ if (mgr->ve->ve[i].instance_divisor) {
+ continue;
+ }
+
+ index = mgr->ve->ve[i].vertex_buffer_index;
+ vb = &mgr->b.vertex_buffer[index];
+
+ /* Constant attribs are not per-vertex data. */
+ if (!vb->stride) {
+ continue;
+ }
+
+ /* Return true for the hw buffers which don't need to be translated. */
+ /* XXX we could use some kind of a is-busy query. */
+ if (!u_vbuf_resource(vb->buffer)->user_ptr &&
+ !mgr->ve->incompatible_layout_elem[i] &&
+ !mgr->incompatible_vb[index]) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
static void u_vbuf_get_minmax_index(struct pipe_context *pipe,
struct pipe_index_buffer *ib,
const struct pipe_draw_info *info,
@@ -1054,7 +1087,8 @@ u_vbuf_draw_begin(struct u_vbuf *mgrb,
* performance. */
if (!info->primitive_restart &&
num_vertices > info->count*2 &&
- num_vertices-info->count > 32) {
+ num_vertices-info->count > 32 &&
+ !u_vbuf_mapping_vertex_buffer_blocks(mgr)) {
/*printf("num_vertices=%i count=%i\n", num_vertices, info->count);*/
unroll_indices = true;
}
diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h
index 79054be86..93d36bf34 100644
--- a/mesalib/src/glsl/ast.h
+++ b/mesalib/src/glsl/ast.h
@@ -211,6 +211,7 @@ public:
subexpressions[1] = NULL;
subexpressions[2] = NULL;
primary_expression.identifier = (char *) identifier;
+ this->non_lvalue_description = NULL;
}
static const char *operator_string(enum ast_operators op);
@@ -238,6 +239,18 @@ public:
* \c ast_function_call
*/
exec_list expressions;
+
+ /**
+ * For things that can't be l-values, this describes what it is.
+ *
+ * This text is used by the code that generates IR for assignments to
+ * detect and emit useful messages for assignments to some things that
+ * can't be l-values. For example, pre- or post-incerement expressions.
+ *
+ * \note
+ * This pointer may be \c NULL.
+ */
+ const char *non_lvalue_description;
};
class ast_expression_bin : public ast_expression {
diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp
index 126b610d1..1c2e8613c 100644
--- a/mesalib/src/glsl/ast_function.cpp
+++ b/mesalib/src/glsl/ast_function.cpp
@@ -93,14 +93,21 @@ prototype_string(const glsl_type *return_type, const char *name,
return str;
}
+/**
+ * If a function call is generated, \c call_ir will point to it on exit.
+ * Otherwise \c call_ir will be set to \c NULL.
+ */
static ir_rvalue *
generate_call(exec_list *instructions, ir_function_signature *sig,
YYLTYPE *loc, exec_list *actual_parameters,
+ ir_call **call_ir,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
exec_list post_call_conversions;
+ *call_ir = NULL;
+
/* Verify that 'out' and 'inout' actual parameters are lvalues. This
* isn't done in ir_function::matching_signature because that function
* cannot generate the necessary diagnostics.
@@ -256,10 +263,12 @@ generate_call(exec_list *instructions, ir_function_signature *sig,
deref = new(ctx) ir_dereference_variable(var);
ir_assignment *assign = new(ctx) ir_assignment(deref, call, NULL);
instructions->push_tail(assign);
+ *call_ir = call;
deref = new(ctx) ir_dereference_variable(var);
} else {
instructions->push_tail(call);
+ *call_ir = call;
deref = NULL;
}
instructions->append_list(&post_call_conversions);
@@ -269,6 +278,7 @@ generate_call(exec_list *instructions, ir_function_signature *sig,
static ir_rvalue *
match_function_by_name(exec_list *instructions, const char *name,
YYLTYPE *loc, exec_list *actual_parameters,
+ ir_call **call_ir,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
@@ -342,7 +352,8 @@ done:
}
/* Finally, generate a call instruction. */
- return generate_call(instructions, sig, loc, actual_parameters, state);
+ return generate_call(instructions, sig, loc, actual_parameters,
+ call_ir, state);
} else {
char *str = prototype_string(NULL, name, actual_parameters);
@@ -1442,9 +1453,53 @@ ast_function_expression::hir(exec_list *instructions,
process_parameters(instructions, &actual_parameters, &this->expressions,
state);
- return match_function_by_name(instructions,
- id->primary_expression.identifier, & loc,
- &actual_parameters, state);
+ ir_call *call = NULL;
+ ir_rvalue *const value =
+ match_function_by_name(instructions,
+ id->primary_expression.identifier,
+ &loc, &actual_parameters, &call, state);
+
+ if (call != NULL) {
+ /* If a function was found, make sure that none of the 'out' or 'inout'
+ * parameters violate the extra l-value rules.
+ */
+ ir_function_signature *f = call->get_callee();
+ assert(f != NULL);
+
+ exec_node *formal_node = f->parameters.head;
+
+ foreach_list (actual_node, &this->expressions) {
+ /* Both parameter lists had better be the same length!
+ */
+ assert(!actual_node->is_tail_sentinel());
+
+ const ir_variable *const formal_parameter =
+ (ir_variable *) formal_node;
+ const ast_expression *const actual_parameter =
+ exec_node_data(ast_expression, actual_node, link);
+
+ if ((formal_parameter->mode == ir_var_out
+ || formal_parameter->mode == ir_var_inout)
+ && actual_parameter->non_lvalue_description != NULL) {
+ YYLTYPE loc = actual_parameter->get_location();
+
+ _mesa_glsl_error(&loc, state,
+ "function parameter '%s %s' references a %s",
+ (formal_parameter->mode == ir_var_out)
+ ? "out" : "inout",
+ formal_parameter->name,
+ actual_parameter->non_lvalue_description);
+ return ir_call::get_error_instruction(ctx);
+ }
+
+ /* Only advance the formal_node pointer here because the
+ * foreach_list business already advances actual_node.
+ */
+ formal_node = formal_node->next;
+ }
+ }
+
+ return value;
}
return ir_call::get_error_instruction(ctx);
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index f0c921875..1aebca40f 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -664,6 +664,7 @@ mark_whole_array_access(ir_rvalue *access)
ir_rvalue *
do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
+ const char *non_lvalue_description,
ir_rvalue *lhs, ir_rvalue *rhs, bool is_initializer,
YYLTYPE lhs_loc)
{
@@ -671,8 +672,13 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
bool error_emitted = (lhs->type->is_error() || rhs->type->is_error());
if (!error_emitted) {
- if (lhs->variable_referenced() != NULL
- && lhs->variable_referenced()->read_only) {
+ if (non_lvalue_description != NULL) {
+ _mesa_glsl_error(&lhs_loc, state,
+ "assignment to %s",
+ non_lvalue_description);
+ error_emitted = true;
+ } else if (lhs->variable_referenced() != NULL
+ && lhs->variable_referenced()->read_only) {
_mesa_glsl_error(&lhs_loc, state,
"assignment to read-only variable '%s'",
lhs->variable_referenced()->name);
@@ -769,11 +775,6 @@ get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue)
instructions->push_tail(new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var),
lvalue, NULL));
- /* Once we've created this temporary, mark it read only so it's no
- * longer considered an lvalue.
- */
- var->read_only = true;
-
return new(ctx) ir_dereference_variable(var);
}
@@ -1030,7 +1031,9 @@ ast_expression::hir(exec_list *instructions,
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
- result = do_assignment(instructions, state, op[0], op[1], false,
+ result = do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0], op[1], false,
this->subexpressions[0]->get_location());
error_emitted = result->type->is_error();
break;
@@ -1310,6 +1313,7 @@ ast_expression::hir(exec_list *instructions,
op[0], op[1]);
result = do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs, false,
this->subexpressions[0]->get_location());
error_emitted = (op[0]->type->is_error());
@@ -1335,6 +1339,7 @@ ast_expression::hir(exec_list *instructions,
op[0], op[1]);
result = do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs, false,
this->subexpressions[0]->get_location());
error_emitted = type->is_error();
@@ -1349,8 +1354,9 @@ ast_expression::hir(exec_list *instructions,
&loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
type, op[0], op[1]);
- result = do_assignment(instructions, state, op[0]->clone(ctx, NULL),
- temp_rhs, false,
+ result = do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs, false,
this->subexpressions[0]->get_location());
error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
break;
@@ -1365,8 +1371,9 @@ ast_expression::hir(exec_list *instructions,
state, &loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
type, op[0], op[1]);
- result = do_assignment(instructions, state, op[0]->clone(ctx, NULL),
- temp_rhs, false,
+ result = do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs, false,
this->subexpressions[0]->get_location());
error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
break;
@@ -1463,6 +1470,9 @@ ast_expression::hir(exec_list *instructions,
case ast_pre_inc:
case ast_pre_dec: {
+ this->non_lvalue_description = (this->oper == ast_pre_inc)
+ ? "pre-increment operation" : "pre-decrement operation";
+
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = constant_one_for_inc_dec(ctx, op[0]->type);
@@ -1473,6 +1483,7 @@ ast_expression::hir(exec_list *instructions,
op[0], op[1]);
result = do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs, false,
this->subexpressions[0]->get_location());
error_emitted = op[0]->type->is_error();
@@ -1481,6 +1492,8 @@ ast_expression::hir(exec_list *instructions,
case ast_post_inc:
case ast_post_dec: {
+ this->non_lvalue_description = (this->oper == ast_post_inc)
+ ? "post-increment operation" : "post-decrement operation";
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = constant_one_for_inc_dec(ctx, op[0]->type);
@@ -1498,6 +1511,7 @@ ast_expression::hir(exec_list *instructions,
result = get_lvalue_copy(instructions, op[0]->clone(ctx, NULL));
(void)do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
op[0]->clone(ctx, NULL), temp_rhs, false,
this->subexpressions[0]->get_location());
@@ -2365,6 +2379,7 @@ process_initializer(ir_variable *var, ast_declaration *decl,
const glsl_type *initializer_type;
if (!type->qualifier.flags.q.uniform) {
result = do_assignment(initializer_instructions, state,
+ NULL,
lhs, rhs, true,
type->get_location());
initializer_type = result->type;
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index 0b4ccac53..0b53232e9 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -626,6 +626,7 @@ ast_expression::ast_expression(int oper,
this->subexpressions[0] = ex0;
this->subexpressions[1] = ex1;
this->subexpressions[2] = ex2;
+ this->non_lvalue_description = NULL;
}
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index bd9e94b82..4754fbfc8 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -161,7 +161,6 @@ swrast_sources = [
'swrast/s_copypix.c',
'swrast/s_context.c',
'swrast/s_depth.c',
- 'swrast/s_depthstencil.c',
'swrast/s_drawpix.c',
'swrast/s_feedback.c',
'swrast/s_fog.c',
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 785a59531..ad289aa70 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -1026,7 +1026,7 @@ _mesa_meta_in_progress(struct gl_context *ctx)
static INLINE GLfloat
invert_z(GLfloat normZ)
{
- GLfloat objZ = 1.0 - 2.0 * normZ;
+ GLfloat objZ = 1.0f - 2.0f * normZ;
return objZ;
}
@@ -2920,7 +2920,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
/* setup texcoords (XXX what about border?) */
setup_texture_coords(faceTarget,
- 0.0, 0.0, /* width, height never used here */
+ 0.0f, 0.0f, /* width, height never used here */
slice,
verts[0].tex,
verts[1].tex,
@@ -3098,20 +3098,19 @@ get_temp_image_type(struct gl_context *ctx, GLenum baseFormat)
*/
static void
copy_tex_sub_image(struct gl_context *ctx,
- GLuint dims, GLenum target, GLint level,
+ GLuint dims,
+ struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
+ struct gl_renderbuffer *rb,
GLint x, GLint y,
GLsizei width, GLsizei height)
{
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
+ struct gl_texture_object *texObj = texImage->TexObject;
+ const GLenum target = texObj->Target;
GLenum format, type;
GLint bpp;
void *buf;
- texObj = _mesa_get_current_tex_object(ctx, target);
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-
/* Choose format/type for temporary image buffer */
format = _mesa_get_format_base_format(texImage->TexFormat);
if (format == GL_LUMINANCE ||
@@ -3180,34 +3179,40 @@ copy_tex_sub_image(struct gl_context *ctx,
void
-_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint xoffset,
+ struct gl_renderbuffer *rb,
GLint x, GLint y, GLsizei width)
{
- copy_tex_sub_image(ctx, 1, target, level, xoffset, 0, 0,
- x, y, width, 1);
+ copy_tex_sub_image(ctx, 1, texImage, xoffset, 0, 0,
+ rb, x, y, width, 1);
}
void
-_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset,
+ struct gl_renderbuffer *rb,
GLint x, GLint y,
GLsizei width, GLsizei height)
{
- copy_tex_sub_image(ctx, 2, target, level, xoffset, yoffset, 0,
- x, y, width, height);
+ copy_tex_sub_image(ctx, 2, texImage, xoffset, yoffset, 0,
+ rb, x, y, width, height);
}
void
-_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
+ struct gl_renderbuffer *rb,
GLint x, GLint y,
GLsizei width, GLsizei height)
{
- copy_tex_sub_image(ctx, 3, target, level, xoffset, yoffset, zoffset,
- x, y, width, height);
+ copy_tex_sub_image(ctx, 3, texImage, xoffset, yoffset, zoffset,
+ rb, x, y, width, height);
}
diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h
index d13796ebe..de039b575 100644
--- a/mesalib/src/mesa/drivers/common/meta.h
+++ b/mesalib/src/mesa/drivers/common/meta.h
@@ -111,19 +111,25 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj);
extern void
-_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint xoffset,
+ struct gl_renderbuffer *rb,
GLint x, GLint y, GLsizei width);
extern void
-_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset,
+ struct gl_renderbuffer *rb,
GLint x, GLint y,
GLsizei width, GLsizei height);
extern void
-_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
+ struct gl_renderbuffer *rb,
GLint x, GLint y,
GLsizei width, GLsizei height);
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 6f4a91b1f..1c1ee5dde 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -1068,7 +1068,7 @@ _mesa_PopAttrib(void)
p[0] = l->QuadraticAttenuation;
_mesa_light(ctx, i, GL_QUADRATIC_ATTENUATION, p);
}
- }
+ }
/* light model */
_mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT,
light->Model.Ambient);
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 63eb6faaa..b2a74f322 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -504,7 +504,7 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
{
void *srcPtr, *dstPtr;
- /* buffer should not already be mapped */
+ /* the buffers should not be mapped */
assert(!_mesa_bufferobj_mapped(src));
assert(!_mesa_bufferobj_mapped(dst));
@@ -514,6 +514,9 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
(GL_MAP_WRITE_BIT |
GL_MAP_INVALIDATE_RANGE_BIT), dst);
+ /* Note: the src and dst regions will never overlap. Trying to do so
+ * would generate GL_INVALID_VALUE earlier.
+ */
if (srcPtr && dstPtr)
memcpy(dstPtr, srcPtr, size);
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 6707e785d..24f3d4ca5 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -283,31 +283,33 @@ struct dd_function_table {
struct gl_texture_image *texImage );
/**
- * Called by glCopyTexSubImage1D().
- *
- * Drivers should use a fallback routine from texstore.c if needed.
+ * Called by glCopyTexSubImage1D() and glCopyTexImage1D().
*/
- void (*CopyTexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset,
- GLint x, GLint y, GLsizei width );
+ void (*CopyTexSubImage1D)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint xoffset,
+ struct gl_renderbuffer *rb,
+ GLint x, GLint y, GLsizei width);
+
/**
- * Called by glCopyTexSubImage2D().
- *
- * Drivers should use a fallback routine from texstore.c if needed.
+ * Called by glCopyTexSubImage2D() and glCopyTexImage2D().
*/
- void (*CopyTexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y,
- GLsizei width, GLsizei height );
+ void (*CopyTexSubImage2D)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint xoffset, GLint yoffset,
+ struct gl_renderbuffer *rb,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height);
+
/**
- * Called by glCopyTexSubImage3D().
- *
- * Drivers should use a fallback routine from texstore.c if needed.
+ * Called by glCopyTexSubImage3D() and glCopyTexImage3D().
*/
- void (*CopyTexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y,
- GLsizei width, GLsizei height );
+ void (*CopyTexSubImage3D)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ struct gl_renderbuffer *rb,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height);
/**
* Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c
index 43677117e..0982c9af4 100644
--- a/mesalib/src/mesa/main/format_pack.c
+++ b/mesalib/src/mesa/main/format_pack.c
@@ -2532,10 +2532,10 @@ _mesa_pack_colormask(gl_format format, const GLubyte colorMask[4], void *dst)
GLuint i;
/* this should put non-zero values into the channels of dst */
- maskColor[0] = colorMask[0] ? -1.0 : 0.0;
- maskColor[1] = colorMask[1] ? -1.0 : 0.0;
- maskColor[2] = colorMask[2] ? -1.0 : 0.0;
- maskColor[3] = colorMask[3] ? -1.0 : 0.0;
+ maskColor[0] = colorMask[0] ? -1.0f : 0.0f;
+ maskColor[1] = colorMask[1] ? -1.0f : 0.0f;
+ maskColor[2] = colorMask[2] ? -1.0f : 0.0f;
+ maskColor[3] = colorMask[3] ? -1.0f : 0.0f;
_mesa_pack_float_rgba_row(format, 1,
(const GLfloat (*)[4]) maskColor, dst);
diff --git a/mesalib/src/mesa/main/format_unpack.h b/mesalib/src/mesa/main/format_unpack.h
index 0d13a2d39..c5348d30d 100644
--- a/mesalib/src/mesa/main/format_unpack.h
+++ b/mesalib/src/mesa/main/format_unpack.h
@@ -40,11 +40,6 @@ _mesa_unpack_rgba_block(gl_format format,
GLuint x, GLuint y, GLuint width, GLuint height);
extern void
-_mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
- const void *src, GLuint dst[][4]);
-
-
-extern void
_mesa_unpack_float_z_row(gl_format format, GLuint n,
const void *src, GLfloat *dst);
diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c
index 6d5e4524a..730de6206 100644
--- a/mesalib/src/mesa/main/framebuffer.c
+++ b/mesalib/src/mesa/main/framebuffer.c
@@ -222,10 +222,6 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
ASSERT(!att->Texture);
att->Type = GL_NONE;
}
-
- /* unbind _Depth/_StencilBuffer to decr ref counts */
- _mesa_reference_renderbuffer(&fb->_DepthBuffer, NULL);
- _mesa_reference_renderbuffer(&fb->_StencilBuffer, NULL);
}
@@ -681,8 +677,6 @@ update_color_read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb)
* _ColorDrawBuffers
* _NumColorDrawBuffers
* _ColorReadBuffer
- * _DepthBuffer
- * _StencilBuffer
*
* If the framebuffer is user-created, make sure it's complete.
*
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index dcb987116..64d8c8d3f 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2673,12 +2673,6 @@ struct gl_framebuffer
struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS];
struct gl_renderbuffer *_ColorReadBuffer;
- /** Wrappers to make combined depth/stencil buffers look like separate
- * buffers. Only used by swrast. Will be removed in the future.
- */
- struct gl_renderbuffer *_DepthBuffer;
- struct gl_renderbuffer *_StencilBuffer;
-
/** Delete this framebuffer */
void (*Delete)(struct gl_framebuffer *fb);
};
diff --git a/mesalib/src/mesa/main/shaderobj.h b/mesalib/src/mesa/main/shaderobj.h
index 941841d43..5470b51d7 100644
--- a/mesalib/src/mesa/main/shaderobj.h
+++ b/mesalib/src/mesa/main/shaderobj.h
@@ -32,9 +32,12 @@
#include "main/mtypes.h"
#include "program/ir_to_mesa.h"
+
#ifdef __cplusplus
extern "C" {
#endif
+
+
/**
* Internal functions
*/
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 6dd70b96c..9475e84f5 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -2752,6 +2752,25 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
/**
+ * For glCopyTexSubImage, return the source renderbuffer to copy texel data
+ * from. This depends on whether the texture contains color or depth values.
+ */
+static struct gl_renderbuffer *
+get_copy_tex_image_source(struct gl_context *ctx, gl_format texFormat)
+{
+ if (_mesa_get_format_bits(texFormat, GL_DEPTH_BITS) > 0) {
+ /* reading from depth/stencil buffer */
+ return ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
+ }
+ else {
+ /* copying from color buffer */
+ return ctx->ReadBuffer->_ColorReadBuffer;
+ }
+}
+
+
+
+/**
* Implement the glCopyTexImage1/2D() functions.
*/
static void
@@ -2828,13 +2847,16 @@ copyteximage(struct gl_context *ctx, GLuint dims,
if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
&width, &height)) {
+ struct gl_renderbuffer *srcRb =
+ get_copy_tex_image_source(ctx, texImage->TexFormat);
+
if (dims == 1)
- ctx->Driver.CopyTexSubImage1D(ctx, target, level, dstX,
- srcX, srcY, width);
+ ctx->Driver.CopyTexSubImage1D(ctx, texImage, dstX,
+ srcRb, srcX, srcY, width);
else
- ctx->Driver.CopyTexSubImage2D(ctx, target, level, dstX, dstY,
- srcX, srcY, width, height);
+ ctx->Driver.CopyTexSubImage2D(ctx, texImage, dstX, dstY,
+ srcRb, srcX, srcY, width, height);
}
check_gen_mipmap(ctx, target, texObj, level);
@@ -2930,20 +2952,22 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y,
&width, &height)) {
+ struct gl_renderbuffer *srcRb =
+ get_copy_tex_image_source(ctx, texImage->TexFormat);
+
switch (dims) {
case 1:
- ctx->Driver.CopyTexSubImage1D(ctx, target, level,
- xoffset, x, y, width);
+ ctx->Driver.CopyTexSubImage1D(ctx, texImage, xoffset,
+ srcRb, x, y, width);
break;
case 2:
- ctx->Driver.CopyTexSubImage2D(ctx, target, level,
- xoffset, yoffset,
- x, y, width, height);
+ ctx->Driver.CopyTexSubImage2D(ctx, texImage, xoffset, yoffset,
+ srcRb, x, y, width, height);
break;
case 3:
- ctx->Driver.CopyTexSubImage3D(ctx, target, level,
+ ctx->Driver.CopyTexSubImage3D(ctx, texImage,
xoffset, yoffset, zoffset,
- x, y, width, height);
+ srcRb, x, y, width, height);
break;
default:
_mesa_problem(ctx, "bad dims in copytexsubimage()");
diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak
index 09cdd261b..165a6c85e 100644
--- a/mesalib/src/mesa/sources.mak
+++ b/mesalib/src/mesa/sources.mak
@@ -133,7 +133,6 @@ SWRAST_SOURCES = \
swrast/s_copypix.c \
swrast/s_context.c \
swrast/s_depth.c \
- swrast/s_depthstencil.c \
swrast/s_drawpix.c \
swrast/s_feedback.c \
swrast/s_fog.c \
diff --git a/mesalib/src/mesa/state_tracker/st_atom_clip.c b/mesalib/src/mesa/state_tracker/st_atom_clip.c
index 1330db843..236d3cf40 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_clip.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_clip.c
@@ -34,7 +34,7 @@
#include "st_context.h"
#include "pipe/p_context.h"
#include "st_atom.h"
-
+#include "st_program.h"
#include "cso_cache/cso_context.h"
@@ -45,15 +45,23 @@ static void update_clip( struct st_context *st )
struct pipe_clip_state clip;
const struct gl_context *ctx = st->ctx;
GLuint i;
+ bool use_eye = FALSE;
memset(&clip, 0, sizeof(clip));
+ /* if we have a vertex shader that writes clip vertex we need to pass
+ the pre-projection transformed coordinates into the driver. */
+ if (st->vp) {
+ if (ctx->Shader.CurrentVertexProgram)
+ use_eye = TRUE;
+ }
+
for (i = 0; i < PIPE_MAX_CLIP_PLANES; i++) {
if (ctx->Transform.ClipPlanesEnabled & (1 << i)) {
- memcpy(clip.ucp[clip.nr],
- ctx->Transform._ClipUserPlane[i],
- sizeof(clip.ucp[0]));
- clip.nr++;
+ memcpy(clip.ucp[clip.nr],
+ use_eye ? ctx->Transform.EyeUserPlane[i] : ctx->Transform._ClipUserPlane[i],
+ sizeof(clip.ucp[0]));
+ clip.nr++;
}
}
@@ -69,7 +77,7 @@ static void update_clip( struct st_context *st )
const struct st_tracked_state st_update_clip = {
"st_update_clip", /* name */
{ /* dirty */
- (_NEW_TRANSFORM), /* mesa */
+ (_NEW_TRANSFORM | _NEW_PROGRAM), /* mesa */
0, /* st */
},
update_clip /* update */
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index 3115a2511..008e9bd10 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -267,14 +267,13 @@ update_vertex_textures(struct st_context *st)
GLboolean retval;
GLuint texUnit;
- texUnit = vprog->Base.SamplerUnits[su];
+ texUnit = vprog->Base.SamplerUnits[su];
- retval = update_single_texture(st, &sampler_view, texUnit);
- if (retval == GL_FALSE)
- continue;
-
- st->state.num_vertex_textures = su + 1;
+ retval = update_single_texture(st, &sampler_view, texUnit);
+ if (retval == GL_FALSE)
+ continue;
+ st->state.num_vertex_textures = su + 1;
}
pipe_sampler_view_reference(&st->state.sampler_vertex_views[su], sampler_view);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 592d04b92..ad4f23c7e 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -736,7 +736,7 @@ st_GetTexImage(struct gl_context * ctx,
* Note: srcY=0=TOP of renderbuffer
*/
static void
-fallback_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level,
+fallback_copy_texsubimage(struct gl_context *ctx,
struct st_renderbuffer *strb,
struct st_texture_image *stImage,
GLenum baseFormat,
@@ -931,17 +931,12 @@ compatible_src_dst_formats(struct gl_context *ctx,
*/
static void
st_copy_texsubimage(struct gl_context *ctx,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint destX, GLint destY, GLint destZ,
+ struct gl_renderbuffer *rb,
GLint srcX, GLint srcY,
GLsizei width, GLsizei height)
{
- struct gl_texture_unit *texUnit =
- &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- struct gl_texture_object *texObj =
- _mesa_select_tex_object(ctx, texUnit, target);
- struct gl_texture_image *texImage =
- _mesa_select_tex_image(ctx, texObj, target, level);
struct st_texture_image *stImage = st_texture_image(texImage);
const GLenum texBaseFormat = texImage->_BaseFormat;
struct gl_framebuffer *fb = ctx->ReadBuffer;
@@ -1096,7 +1091,7 @@ st_copy_texsubimage(struct gl_context *ctx,
fallback:
/* software fallback */
- fallback_copy_texsubimage(ctx, target, level,
+ fallback_copy_texsubimage(ctx,
strb, stImage, texBaseFormat,
destX, destY, destZ,
srcX, srcY, width, height);
@@ -1105,37 +1100,44 @@ fallback:
static void
-st_CopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width)
+st_CopyTexSubImage1D(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint xoffset,
+ struct gl_renderbuffer *rb,
+ GLint x, GLint y, GLsizei width)
{
const GLint yoffset = 0, zoffset = 0;
const GLsizei height = 1;
- st_copy_texsubimage(ctx, target, level,
+ st_copy_texsubimage(ctx, texImage,
xoffset, yoffset, zoffset, /* destX,Y,Z */
- x, y, width, height); /* src X, Y, size */
+ rb, x, y, width, height); /* src X, Y, size */
}
static void
-st_CopyTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
+st_CopyTexSubImage2D(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset,
+ struct gl_renderbuffer *rb,
GLint x, GLint y, GLsizei width, GLsizei height)
{
const GLint zoffset = 0;
- st_copy_texsubimage(ctx, target, level,
+ st_copy_texsubimage(ctx, texImage,
xoffset, yoffset, zoffset, /* destX,Y,Z */
- x, y, width, height); /* src X, Y, size */
+ rb, x, y, width, height); /* src X, Y, size */
}
static void
-st_CopyTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level,
+st_CopyTexSubImage3D(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
+ struct gl_renderbuffer *rb,
GLint x, GLint y, GLsizei width, GLsizei height)
{
- st_copy_texsubimage(ctx, target, level,
+ st_copy_texsubimage(ctx, texImage,
xoffset, yoffset, zoffset, /* destX,Y,Z */
- x, y, width, height); /* src X, Y, size */
+ rb, x, y, width, height); /* src X, Y, size */
}
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 73d956ea1..3b8e2fe37 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1402,8 +1402,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
}
break;
case ir_unop_neg:
- assert(result_dst.type == GLSL_TYPE_FLOAT || result_dst.type == GLSL_TYPE_INT);
- if (result_dst.type == GLSL_TYPE_INT)
+ if (result_dst.type == GLSL_TYPE_INT || result_dst.type == GLSL_TYPE_UINT)
emit(ir, TGSI_OPCODE_INEG, result_dst, op[0]);
else {
op[0].negate = ~op[0].negate;
@@ -1411,8 +1410,10 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
}
break;
case ir_unop_abs:
- assert(result_dst.type == GLSL_TYPE_FLOAT);
- emit(ir, TGSI_OPCODE_ABS, result_dst, op[0]);
+ if (result_dst.type == GLSL_TYPE_INT || result_dst.type == GLSL_TYPE_UINT)
+ emit(ir, TGSI_OPCODE_IABS, result_dst, op[0]);
+ else
+ emit(ir, TGSI_OPCODE_ABS, result_dst, op[0]);
break;
case ir_unop_sign:
emit(ir, TGSI_OPCODE_SSG, result_dst, op[0]);
@@ -2375,7 +2376,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir)
gl_type = native_integers ? GL_BOOL : GL_FLOAT;
for (i = 0; i < ir->type->vector_elements; i++) {
if (native_integers)
- values[i].b = ir->value.b[i];
+ values[i].u = ir->value.b[i] ? ~0 : 0;
else
values[i].f = ir->value.b[i];
}
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index aceaaf8c5..8d7469dfb 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -255,6 +255,10 @@ st_prepare_vertex_program(struct gl_context *ctx,
case VERT_RESULT_EDGE:
assert(0);
break;
+ case VERT_RESULT_CLIP_VERTEX:
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX;
+ stvp->output_semantic_index[slot] = 0;
+ break;
case VERT_RESULT_TEX0:
case VERT_RESULT_TEX1:
@@ -432,10 +436,13 @@ st_get_vp_variant(struct st_context *st,
static unsigned
-st_translate_interp(enum glsl_interp_qualifier glsl_qual)
+st_translate_interp(enum glsl_interp_qualifier glsl_qual, bool is_color)
{
switch (glsl_qual) {
case INTERP_QUALIFIER_NONE:
+ if (is_color)
+ return TGSI_INTERPOLATE_LINEAR;
+ return TGSI_INTERPOLATE_PERSPECTIVE;
case INTERP_QUALIFIER_SMOOTH:
return TGSI_INTERPOLATE_PERSPECTIVE;
case INTERP_QUALIFIER_FLAT:
@@ -538,12 +545,14 @@ st_translate_fragment_program(struct st_context *st,
case FRAG_ATTRIB_COL0:
input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
input_semantic_index[slot] = 0;
- interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr]);
+ interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
+ TRUE);
break;
case FRAG_ATTRIB_COL1:
input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
input_semantic_index[slot] = 1;
- interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr]);
+ interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
+ TRUE);
break;
case FRAG_ATTRIB_FOGC:
input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
@@ -600,7 +609,8 @@ st_translate_fragment_program(struct st_context *st,
if (attr == FRAG_ATTRIB_PNTC)
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
else
- interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr]);
+ interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
+ FALSE);
break;
}
}
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index 6850a09f3..94b7fe34d 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -36,7 +36,6 @@
#include "swrast.h"
#include "s_blend.h"
#include "s_context.h"
-#include "s_depthstencil.h"
#include "s_lines.h"
#include "s_points.h"
#include "s_span.h"
@@ -493,7 +492,7 @@ static void
_swrast_update_active_attribs(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GLuint attribsMask;
+ GLbitfield64 attribsMask;
/*
* Compute _ActiveAttribsMask = which fragment attributes are needed.
@@ -546,25 +545,6 @@ _swrast_update_active_attribs(struct gl_context *ctx)
}
-/**
- * Update the depth/stencil renderbuffers, if needed.
- */
-static void
-_swrast_update_depth_stencil(struct gl_context *ctx)
-{
- struct gl_framebuffer *drawFb = ctx->DrawBuffer;
- struct gl_framebuffer *readFb = ctx->ReadBuffer;
-
- _swrast_update_depth_buffer(ctx, drawFb);
- _swrast_update_stencil_buffer(ctx, drawFb);
-
- if (readFb != drawFb) {
- _swrast_update_depth_buffer(ctx, readFb);
- _swrast_update_stencil_buffer(ctx, readFb);
- }
-}
-
-
void
_swrast_validate_derived( struct gl_context *ctx )
{
@@ -609,9 +589,6 @@ _swrast_validate_derived( struct gl_context *ctx )
_NEW_TEXTURE))
_swrast_update_specular_vertex_add(ctx);
- if (swrast->NewState & _NEW_BUFFERS)
- _swrast_update_depth_stencil(ctx);
-
swrast->NewState = 0;
swrast->StateChanges = 0;
swrast->InvalidateState = _swrast_invalidate_state;
@@ -741,9 +718,9 @@ _swrast_CreateContext( struct gl_context *ctx )
GLuint i;
SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext));
#ifdef _OPENMP
- const GLint maxThreads = omp_get_max_threads();
+ const GLuint maxThreads = omp_get_max_threads();
#else
- const GLint maxThreads = 1;
+ const GLuint maxThreads = 1;
#endif
if (SWRAST_DEBUG) {
diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h
index af9e49ecb..0a383aa3b 100644
--- a/mesalib/src/mesa/swrast/s_context.h
+++ b/mesalib/src/mesa/swrast/s_context.h
@@ -196,8 +196,8 @@ typedef struct
/** List/array of the fragment attributes to interpolate */
GLuint _ActiveAttribs[FRAG_ATTRIB_MAX];
- /** Same info, but as a bitmask */
- GLbitfield _ActiveAttribMask;
+ /** Same info, but as a bitmask of FRAG_BIT_x bits */
+ GLbitfield64 _ActiveAttribMask;
/** Number of fragment attributes to interpolate */
GLuint _NumActiveAttribs;
/** Indicates how each attrib is to be interpolated (lines/tris) */
diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c
index 53f21cb69..42724c72b 100644
--- a/mesalib/src/mesa/swrast/s_depth.c
+++ b/mesalib/src/mesa/swrast/s_depth.c
@@ -205,6 +205,7 @@ _swrast_depth_clamp_span( struct gl_context *ctx, SWspan *span )
/**
* Get array of 32-bit z values from the depth buffer. With clipping.
+ * Note: the returned values are always in the range [0, 2^32-1].
*/
static void
get_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
@@ -235,6 +236,11 @@ get_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
}
+
+/**
+ * Put an array of 32-bit z values into the depth buffer.
+ * Note: the z values are always in the range [0, 2^32-1].
+ */
static void
put_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
@@ -284,8 +290,8 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
void *zBufferVals;
GLuint *zBufferTemp = NULL;
GLuint passed;
+ GLuint zBits = _mesa_get_format_bits(rb->Format, GL_DEPTH_BITS);
GLboolean ztest16 = GL_FALSE;
- GLboolean ztest24 = _mesa_get_format_bits(rb->Format, GL_DEPTH_BITS) == 24;
if (rb->Format == MESA_FORMAT_Z16 && !(span->arrayMask & SPAN_XY)) {
/* directly read/write row of 16-bit Z values */
@@ -310,7 +316,7 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
_mesa_unpack_uint_z_row(rb->Format, count, zStart, zBufferTemp);
}
- if (ztest24) {
+ if (zBits == 24) {
GLuint i;
/* Convert depth buffer values from 32 to 24 bits to match the
* fragment Z values generated by rasterization.
@@ -319,6 +325,16 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
zBufferTemp[i] >>= 8;
}
}
+ else if (zBits == 16) {
+ GLuint i;
+ /* Convert depth buffer values from 32 to 16 bits */
+ for (i = 0; i < count; i++) {
+ zBufferTemp[i] >>= 16;
+ }
+ }
+ else {
+ assert(zBits == 32);
+ }
zBufferVals = zBufferTemp;
}
@@ -332,16 +348,22 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
if (zBufferTemp) {
/* need to write temp Z values back into the buffer */
- if (ztest24) {
+ /* Convert depth buffer values back to 32-bit values. The least
+ * significant bits don't matter since they'll get dropped when
+ * they're packed back into the depth buffer.
+ */
+ if (zBits == 24) {
GLuint i;
- /* Convert depth buffer values back to 32-bit values. The least
- * significant bits don't matter since they'll get dropped when
- * they're packed back into the depth buffer.
- */
for (i = 0; i < count; i++) {
zBufferTemp[i] = (zBufferTemp[i] << 8);
}
}
+ else if (zBits == 16) {
+ GLuint i;
+ for (i = 0; i < count; i++) {
+ zBufferTemp[i] = zBufferTemp[i] << 16;
+ }
+ }
if (span->arrayMask & SPAN_XY) {
/* random locations */
diff --git a/mesalib/src/mesa/swrast/s_depthstencil.c b/mesalib/src/mesa/swrast/s_depthstencil.c
deleted file mode 100644
index e48177ec1..000000000
--- a/mesalib/src/mesa/swrast/s_depthstencil.c
+++ /dev/null
@@ -1,791 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "main/glheader.h"
-#include "main/imports.h"
-#include "main/context.h"
-#include "main/formats.h"
-#include "main/mtypes.h"
-#include "main/renderbuffer.h"
-#include "swrast/s_depthstencil.h"
-
-
-/**
- * Adaptor/wrappers for GL_DEPTH_STENCIL renderbuffers.
- *
- * The problem with a GL_DEPTH_STENCIL renderbuffer is that sometimes we
- * want to treat it as a stencil buffer, other times we want to treat it
- * as a depth/z buffer and still other times when we want to treat it as
- * a combined Z+stencil buffer! That implies we need three different sets
- * of Get/Put functions.
- *
- * We solve this by wrapping the Z24_S8 or S8_Z24 renderbuffer with depth and
- * stencil adaptors, each with the right kind of depth/stencil Get/Put functions.
- */
-
-
-static void *
-nop_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
-{
- (void) ctx;
- (void) rb;
- (void) x;
- (void) y;
- return NULL;
-}
-
-
-/**
- * Delete a depth or stencil wrapper renderbuffer.
- */
-static void
-delete_wrapper(struct gl_renderbuffer *rb)
-{
- ASSERT(rb->Format == MESA_FORMAT_S8 ||
- rb->Format == MESA_FORMAT_X8_Z24 ||
- rb->Format == MESA_FORMAT_Z32_FLOAT);
- _mesa_reference_renderbuffer(&rb->Wrapped, NULL);
- free(rb);
-}
-
-
-/**
- * Realloc storage for wrapper.
- */
-static GLboolean
-alloc_wrapper_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat, GLuint width, GLuint height)
-{
- /* just pass this on to the wrapped renderbuffer */
- struct gl_renderbuffer *dsrb = rb->Wrapped;
- GLboolean retVal;
-
- (void) internalFormat;
-
- ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
- dsrb->Format == MESA_FORMAT_Z24_X8 ||
- dsrb->Format == MESA_FORMAT_S8_Z24 ||
- dsrb->Format == MESA_FORMAT_X8_Z24);
-
- retVal = dsrb->AllocStorage(ctx, dsrb, dsrb->InternalFormat, width, height);
- if (retVal) {
- rb->Width = width;
- rb->Height = height;
- rb->RowStride = dsrb->RowStride;
- }
- return retVal;
-}
-
-
-
-
-/*======================================================================
- * Depth wrapper around depth/stencil renderbuffer
- */
-
-static void
-get_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
- GLint x, GLint y, void *values)
-{
- struct gl_renderbuffer *dsrb = z24rb->Wrapped;
- GLuint temp[MAX_WIDTH], i;
- GLuint *dst = (GLuint *) values;
- const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
- ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- if (!src) {
- dsrb->GetRow(ctx, dsrb, count, x, y, temp);
- src = temp;
- }
- if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- dst[i] = src[i] >> 8;
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- dst[i] = src[i] & 0xffffff;
- }
- }
-}
-
-static void
-get_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- struct gl_renderbuffer *dsrb = z24rb->Wrapped;
- GLuint temp[MAX_WIDTH], i;
- GLuint *dst = (GLuint *) values;
- ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- ASSERT(count <= MAX_WIDTH);
- /* don't bother trying direct access */
- dsrb->GetValues(ctx, dsrb, count, x, y, temp);
- if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- dst[i] = temp[i] >> 8;
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- dst[i] = temp[i] & 0xffffff;
- }
- }
-}
-
-static void
-put_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- struct gl_renderbuffer *dsrb = z24rb->Wrapped;
- const GLuint *src = (const GLuint *) values;
- GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
- ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- if (dst) {
- /* direct access */
- GLuint i;
- if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i] = (src[i] << 8) | (dst[i] & 0xff);
- }
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i] = (src[i] & 0xffffff) | (dst[i] & 0xff000000);
- }
- }
- }
- }
- else {
- /* get, modify, put */
- GLuint temp[MAX_WIDTH], i;
- dsrb->GetRow(ctx, dsrb, count, x, y, temp);
- if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i] = (src[i] << 8) | (temp[i] & 0xff);
- }
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000);
- }
- }
- }
- dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
- }
-}
-
-
-static void
-put_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
- const GLint x[], const GLint y[],
- const void *values, const GLubyte *mask)
-{
- struct gl_renderbuffer *dsrb = z24rb->Wrapped;
- const GLuint *src = (const GLuint *) values;
- ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
- /* direct access */
- GLuint i;
- if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
- *dst = (src[i] << 8) | (*dst & 0xff);
- }
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
- *dst = (src[i] & 0xffffff) | (*dst & 0xff000000);
- }
- }
- }
- }
- else {
- /* get, modify, put */
- GLuint temp[MAX_WIDTH], i;
- dsrb->GetValues(ctx, dsrb, count, x, y, temp);
- if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i] = (src[i] << 8) | (temp[i] & 0xff);
- }
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000);
- }
- }
- }
- dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
- }
-}
-
-
-/**
- * Wrap the given GL_DEPTH_STENCIL renderbuffer so that it acts like
- * a depth renderbuffer.
- * \return new depth renderbuffer
- */
-static struct gl_renderbuffer *
-new_z24_renderbuffer_wrapper(struct gl_context *ctx,
- struct gl_renderbuffer *dsrb)
-{
- struct gl_renderbuffer *z24rb;
-
- ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
- dsrb->Format == MESA_FORMAT_Z24_X8 ||
- dsrb->Format == MESA_FORMAT_S8_Z24 ||
- dsrb->Format == MESA_FORMAT_X8_Z24);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
-
- z24rb = ctx->Driver.NewRenderbuffer(ctx, 0);
- if (!z24rb)
- return NULL;
-
- /* NOTE: need to do manual refcounting here */
- z24rb->Wrapped = dsrb;
- dsrb->RefCount++;
-
- z24rb->Name = dsrb->Name;
- z24rb->RefCount = 0;
- z24rb->Width = dsrb->Width;
- z24rb->Height = dsrb->Height;
- z24rb->RowStride = dsrb->RowStride;
- z24rb->InternalFormat = GL_DEPTH_COMPONENT24;
- z24rb->Format = MESA_FORMAT_X8_Z24;
- z24rb->_BaseFormat = GL_DEPTH_COMPONENT;
- z24rb->DataType = GL_UNSIGNED_INT;
- z24rb->Data = NULL;
- z24rb->Delete = delete_wrapper;
- z24rb->AllocStorage = alloc_wrapper_storage;
- z24rb->GetPointer = nop_get_pointer;
- z24rb->GetRow = get_row_z24;
- z24rb->GetValues = get_values_z24;
- z24rb->PutRow = put_row_z24;
- z24rb->PutValues = put_values_z24;
-
- return z24rb;
-}
-
-
-static void
-get_row_z32f(struct gl_context *ctx, struct gl_renderbuffer *z32frb, GLuint count,
- GLint x, GLint y, void *values)
-{
- struct gl_renderbuffer *dsrb = z32frb->Wrapped;
- GLfloat temp[MAX_WIDTH*2];
- GLfloat *dst = (GLfloat *) values;
- const GLfloat *src = (const GLfloat *) dsrb->GetPointer(ctx, dsrb, x, y);
- GLuint i;
- ASSERT(z32frb->DataType == GL_FLOAT);
- ASSERT(dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
- ASSERT(dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8);
- if (!src) {
- dsrb->GetRow(ctx, dsrb, count, x, y, temp);
- src = temp;
- }
- for (i = 0; i < count; i++) {
- dst[i] = src[i*2];
- }
-}
-
-static void
-get_values_z32f(struct gl_context *ctx, struct gl_renderbuffer *z32frb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- struct gl_renderbuffer *dsrb = z32frb->Wrapped;
- GLfloat temp[MAX_WIDTH*2];
- GLfloat *dst = (GLfloat *) values;
- GLuint i;
- ASSERT(z32frb->DataType == GL_FLOAT);
- ASSERT(dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
- ASSERT(dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8);
- ASSERT(count <= MAX_WIDTH);
- /* don't bother trying direct access */
- dsrb->GetValues(ctx, dsrb, count, x, y, temp);
- for (i = 0; i < count; i++) {
- dst[i] = temp[i*2];
- }
-}
-
-static void
-put_row_z32f(struct gl_context *ctx, struct gl_renderbuffer *z32frb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- struct gl_renderbuffer *dsrb = z32frb->Wrapped;
- const GLfloat *src = (const GLfloat *) values;
- GLfloat *dst = (GLfloat *) dsrb->GetPointer(ctx, dsrb, x, y);
- ASSERT(z32frb->DataType == GL_FLOAT);
- ASSERT(dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
- ASSERT(dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8);
- if (dst) {
- /* direct access */
- GLuint i;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i*2] = src[i];
- }
- }
- }
- else {
- /* get, modify, put */
- GLfloat temp[MAX_WIDTH*2];
- GLuint i;
- dsrb->GetRow(ctx, dsrb, count, x, y, temp);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i*2] = src[i];
- }
- }
- dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
- }
-}
-
-
-static void
-put_values_z32f(struct gl_context *ctx, struct gl_renderbuffer *z32frb, GLuint count,
- const GLint x[], const GLint y[],
- const void *values, const GLubyte *mask)
-{
- struct gl_renderbuffer *dsrb = z32frb->Wrapped;
- const GLfloat *src = (const GLfloat *) values;
- ASSERT(z32frb->DataType == GL_FLOAT);
- ASSERT(dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
- ASSERT(dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8);
- if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
- /* direct access */
- GLuint i;
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLfloat *dst = (GLfloat *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
- *dst = src[i];
- }
- }
- }
- else {
- /* get, modify, put */
- GLfloat temp[MAX_WIDTH*2];
- GLuint i;
- dsrb->GetValues(ctx, dsrb, count, x, y, temp);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i*2] = src[i];
- }
- }
- dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
- }
-}
-
-
-/**
- * Wrap the given GL_DEPTH_STENCIL renderbuffer so that it acts like
- * a depth renderbuffer.
- * \return new depth renderbuffer
- */
-static struct gl_renderbuffer *
-new_z32f_renderbuffer_wrapper(struct gl_context *ctx,
- struct gl_renderbuffer *dsrb)
-{
- struct gl_renderbuffer *z32frb;
-
- ASSERT(dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8);
- ASSERT(dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
-
- z32frb = ctx->Driver.NewRenderbuffer(ctx, 0);
- if (!z32frb)
- return NULL;
-
- /* NOTE: need to do manual refcounting here */
- z32frb->Wrapped = dsrb;
- dsrb->RefCount++;
-
- z32frb->Name = dsrb->Name;
- z32frb->RefCount = 0;
- z32frb->Width = dsrb->Width;
- z32frb->Height = dsrb->Height;
- z32frb->RowStride = dsrb->RowStride;
- z32frb->InternalFormat = GL_DEPTH_COMPONENT32F;
- z32frb->Format = MESA_FORMAT_Z32_FLOAT;
- z32frb->_BaseFormat = GL_DEPTH_COMPONENT;
- z32frb->DataType = GL_FLOAT;
- z32frb->Data = NULL;
- z32frb->Delete = delete_wrapper;
- z32frb->AllocStorage = alloc_wrapper_storage;
- z32frb->GetPointer = nop_get_pointer;
- z32frb->GetRow = get_row_z32f;
- z32frb->GetValues = get_values_z32f;
- z32frb->PutRow = put_row_z32f;
- z32frb->PutValues = put_values_z32f;
-
- return z32frb;
-}
-
-
-/*======================================================================
- * Stencil wrapper around depth/stencil renderbuffer
- */
-
-static void
-get_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
- GLint x, GLint y, void *values)
-{
- struct gl_renderbuffer *dsrb = s8rb->Wrapped;
- GLuint temp[MAX_WIDTH*2], i;
- GLubyte *dst = (GLubyte *) values;
- const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
- ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT ||
- dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
- if (!src) {
- dsrb->GetRow(ctx, dsrb, count, x, y, temp);
- src = temp;
- }
- if (dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) {
- for (i = 0; i < count; i++) {
- dst[i] = src[i*2+1] & 0xff;
- }
- }
- else if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- dst[i] = src[i] & 0xff;
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- dst[i] = src[i] >> 24;
- }
- }
-}
-
-static void
-get_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
- const GLint x[], const GLint y[], void *values)
-{
- struct gl_renderbuffer *dsrb = s8rb->Wrapped;
- GLuint temp[MAX_WIDTH*2], i;
- GLubyte *dst = (GLubyte *) values;
- ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT ||
- dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
- ASSERT(count <= MAX_WIDTH);
- /* don't bother trying direct access */
- dsrb->GetValues(ctx, dsrb, count, x, y, temp);
- if (dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) {
- for (i = 0; i < count; i++) {
- dst[i] = temp[i*2+1] & 0xff;
- }
- }
- else if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- dst[i] = temp[i] & 0xff;
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- dst[i] = temp[i] >> 24;
- }
- }
-}
-
-static void
-put_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
- GLint x, GLint y, const void *values, const GLubyte *mask)
-{
- struct gl_renderbuffer *dsrb = s8rb->Wrapped;
- const GLubyte *src = (const GLubyte *) values;
- GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y);
- ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT ||
- dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
- if (dst) {
- /* direct access */
- GLuint i;
- if (dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i*2+1] = src[i];
- }
- }
- }
- else if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i] = (dst[i] & 0xffffff00) | src[i];
- }
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- dst[i] = (dst[i] & 0xffffff) | (src[i] << 24);
- }
- }
- }
- }
- else {
- /* get, modify, put */
- GLuint temp[MAX_WIDTH*2], i;
- dsrb->GetRow(ctx, dsrb, count, x, y, temp);
- if (dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i*2+1] = src[i];
- }
- }
- }
- else if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i] = (temp[i] & 0xffffff00) | src[i];
- }
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i] = (temp[i] & 0xffffff) | (src[i] << 24);
- }
- }
- }
- dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask);
- }
-}
-
-
-static void
-put_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
- const GLint x[], const GLint y[],
- const void *values, const GLubyte *mask)
-{
- struct gl_renderbuffer *dsrb = s8rb->Wrapped;
- const GLubyte *src = (const GLubyte *) values;
- ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT ||
- dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
- if (dsrb->GetPointer(ctx, dsrb, 0, 0)) {
- /* direct access */
- GLuint i;
- if (dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
- dst[1] = src[i];
- }
- }
- }
- else if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
- *dst = (*dst & 0xffffff00) | src[i];
- }
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]);
- *dst = (*dst & 0xffffff) | (src[i] << 24);
- }
- }
- }
- }
- else {
- /* get, modify, put */
- GLuint temp[MAX_WIDTH*2], i;
- dsrb->GetValues(ctx, dsrb, count, x, y, temp);
- if (dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i*2+1] = src[i];
- }
- }
- }
- else if (dsrb->Format == MESA_FORMAT_Z24_S8) {
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i] = (temp[i] & 0xffffff00) | src[i];
- }
- }
- }
- else {
- assert(dsrb->Format == MESA_FORMAT_S8_Z24);
- for (i = 0; i < count; i++) {
- if (!mask || mask[i]) {
- temp[i] = (temp[i] & 0xffffff) | (src[i] << 24);
- }
- }
- }
- dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask);
- }
-}
-
-
-/**
- * Wrap the given GL_DEPTH_STENCIL renderbuffer so that it acts like
- * a stencil renderbuffer.
- * \return new stencil renderbuffer
- */
-static struct gl_renderbuffer *
-new_s8_renderbuffer_wrapper(struct gl_context *ctx, struct gl_renderbuffer *dsrb)
-{
- struct gl_renderbuffer *s8rb;
-
- ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 ||
- dsrb->Format == MESA_FORMAT_S8_Z24 ||
- dsrb->Format == MESA_FORMAT_Z32_FLOAT_X24S8);
- ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT ||
- dsrb->DataType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
-
- s8rb = ctx->Driver.NewRenderbuffer(ctx, 0);
- if (!s8rb)
- return NULL;
-
- /* NOTE: need to do manual refcounting here */
- s8rb->Wrapped = dsrb;
- dsrb->RefCount++;
-
- s8rb->Name = dsrb->Name;
- s8rb->RefCount = 0;
- s8rb->Width = dsrb->Width;
- s8rb->Height = dsrb->Height;
- s8rb->RowStride = dsrb->RowStride;
- s8rb->InternalFormat = GL_STENCIL_INDEX8_EXT;
- s8rb->Format = MESA_FORMAT_S8;
- s8rb->_BaseFormat = GL_STENCIL_INDEX;
- s8rb->DataType = GL_UNSIGNED_BYTE;
- s8rb->Data = NULL;
- s8rb->Delete = delete_wrapper;
- s8rb->AllocStorage = alloc_wrapper_storage;
- s8rb->GetPointer = nop_get_pointer;
- s8rb->GetRow = get_row_s8;
- s8rb->GetValues = get_values_s8;
- s8rb->PutRow = put_row_s8;
- s8rb->PutValues = put_values_s8;
-
- return s8rb;
-}
-
-
-/**
- * Update the framebuffer's _DepthBuffer field using the renderbuffer
- * found at the given attachment index.
- *
- * If that attachment points to a combined GL_DEPTH_STENCIL renderbuffer,
- * create and install a depth wrapper/adaptor.
- *
- * \param fb the framebuffer whose _DepthBuffer field to update
- */
-void
-_swrast_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb)
-{
- struct gl_renderbuffer *depthRb =
- fb->Attachment[BUFFER_DEPTH].Renderbuffer;
-
- if (depthRb && _mesa_is_format_packed_depth_stencil(depthRb->Format)) {
- /* The attached depth buffer is a GL_DEPTH_STENCIL renderbuffer */
- if (!fb->_DepthBuffer
- || fb->_DepthBuffer->Wrapped != depthRb
- || _mesa_get_format_base_format(fb->_DepthBuffer->Format) != GL_DEPTH_COMPONENT) {
- /* need to update wrapper */
- struct gl_renderbuffer *wrapper;
-
- if (depthRb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) {
- wrapper = new_z32f_renderbuffer_wrapper(ctx, depthRb);
- }
- else {
- wrapper = new_z24_renderbuffer_wrapper(ctx, depthRb);
- }
- _mesa_reference_renderbuffer(&fb->_DepthBuffer, wrapper);
- }
- ASSERT(fb->_DepthBuffer->Wrapped == depthRb);
- fb->_DepthBuffer->Width = depthRb->Width;
- fb->_DepthBuffer->Height = depthRb->Height;
- }
- else {
- /* depthRb may be null */
- _mesa_reference_renderbuffer(&fb->_DepthBuffer, depthRb);
- }
-}
-
-
-/**
- * Update the framebuffer's _StencilBuffer field using the renderbuffer
- * found at the given attachment index.
- *
- * If that attachment points to a combined GL_DEPTH_STENCIL renderbuffer,
- * create and install a stencil wrapper/adaptor.
- *
- * \param fb the framebuffer whose _StencilBuffer field to update
- */
-void
-_swrast_update_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *fb)
-{
- struct gl_renderbuffer *stencilRb =
- fb->Attachment[BUFFER_STENCIL].Renderbuffer;
-
- if (stencilRb && _mesa_is_format_packed_depth_stencil(stencilRb->Format)) {
- /* The attached stencil buffer is a GL_DEPTH_STENCIL renderbuffer */
- if (!fb->_StencilBuffer
- || fb->_StencilBuffer->Wrapped != stencilRb
- || _mesa_get_format_base_format(fb->_StencilBuffer->Format) != GL_STENCIL_INDEX) {
- /* need to update wrapper */
- struct gl_renderbuffer *wrapper
- = new_s8_renderbuffer_wrapper(ctx, stencilRb);
- _mesa_reference_renderbuffer(&fb->_StencilBuffer, wrapper);
- }
- ASSERT(fb->_StencilBuffer->Wrapped == stencilRb);
- fb->_StencilBuffer->Width = stencilRb->Width;
- fb->_StencilBuffer->Height = stencilRb->Height;
- }
- else {
- /* stencilRb may be null */
- _mesa_reference_renderbuffer(&fb->_StencilBuffer, stencilRb);
- }
-}
diff --git a/mesalib/src/mesa/swrast/s_depthstencil.h b/mesalib/src/mesa/swrast/s_depthstencil.h
deleted file mode 100644
index 0bf624a7b..000000000
--- a/mesalib/src/mesa/swrast/s_depthstencil.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef S_DEPTHSTENCIL_H
-#define S_DEPTHSTENCIL_H
-
-struct gl_context;
-struct gl_framebuffer;
-
-void
-_swrast_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb);
-
-void
-_swrast_update_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *fb);
-
-
-#endif /* S_DEPTHSTENCIL_H */
diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c
index 8f02eeae7..689fe34ae 100644
--- a/mesalib/src/mesa/swrast/s_span.c
+++ b/mesalib/src/mesa/swrast/s_span.c
@@ -163,7 +163,8 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span)
* should have computed attrStart/Step values for FRAG_ATTRIB_WPOS[3]!
*/
static inline void
-interpolate_active_attribs(struct gl_context *ctx, SWspan *span, GLbitfield attrMask)
+interpolate_active_attribs(struct gl_context *ctx, SWspan *span,
+ GLbitfield64 attrMask)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
@@ -1038,7 +1039,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
const GLuint *colorMask = (GLuint *) ctx->Color.ColorMask;
const GLbitfield origInterpMask = span->interpMask;
const GLbitfield origArrayMask = span->arrayMask;
- const GLbitfield origArrayAttribs = span->arrayAttribs;
+ const GLbitfield64 origArrayAttribs = span->arrayAttribs;
const GLenum origChanType = span->array->ChanType;
void * const origRgba = span->array->rgba;
const GLboolean shader = (ctx->FragmentProgram._Current
diff --git a/mesalib/src/mesa/swrast/s_span.h b/mesalib/src/mesa/swrast/s_span.h
index 382c3d2eb..f4d32dd87 100644
--- a/mesalib/src/mesa/swrast/s_span.h
+++ b/mesalib/src/mesa/swrast/s_span.h
@@ -155,7 +155,8 @@ typedef struct sw_span
*/
GLbitfield arrayMask;
- GLbitfield arrayAttribs;
+ /** Mask of FRAG_BIT_x bits */
+ GLbitfield64 arrayAttribs;
/**
* We store the arrays of fragment values in a separate struct so