aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/mesa/main/get.c2
-rw-r--r--mesalib/src/mesa/main/pack.c3
-rw-r--r--mesalib/src/mesa/main/shaderapi.c10
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.c16
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp5
-rw-r--r--mesalib/src/mesa/program/register_allocate.c28
-rw-r--r--mesalib/src/mesa/program/register_allocate.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c2
9 files changed, 29 insertions, 48 deletions
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 3f9cf492b..15c808194 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -1163,7 +1163,7 @@ static const struct value_desc values[] = {
/* GL_EXT_provoking_vertex */
{ GL_PROVOKING_VERTEX_EXT,
- CONTEXT_BOOL(Light.ProvokingVertex), extra_EXT_provoking_vertex },
+ CONTEXT_ENUM(Light.ProvokingVertex), extra_EXT_provoking_vertex },
{ GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT,
CONTEXT_BOOL(Const.QuadsFollowProvokingVertexConvention),
extra_EXT_provoking_vertex },
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index e6734bbbc..fcf0f9f53 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -2932,7 +2932,6 @@ extract_uint_rgba(GLuint n, GLuint rgba[][4],
GLint rSrc, gSrc, bSrc, aSrc;
GLint stride;
GLint rDst, bDst, gDst, aDst;
- GLboolean intFormat;
ASSERT(srcFormat == GL_RED ||
srcFormat == GL_GREEN ||
@@ -2989,8 +2988,6 @@ extract_uint_rgba(GLuint n, GLuint rgba[][4],
stride = _mesa_components_in_format(srcFormat);
- intFormat = _mesa_is_integer_format(srcFormat);
-
#define PROCESS(SRC_INDEX, DST_INDEX, DEFAULT, TYPE, CONVERSION) \
if ((SRC_INDEX) < 0) { \
GLuint i; \
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 066e8b427..baebb5cd3 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -362,7 +362,7 @@ bind_attrib_location(struct gl_context *ctx, GLuint program, GLuint index,
{
struct gl_shader_program *shProg;
const GLint size = -1; /* unknown size */
- GLint i, oldIndex;
+ GLint i;
GLenum datatype = GL_FLOAT_VEC4;
shProg = _mesa_lookup_shader_program_err(ctx, program,
@@ -385,14 +385,6 @@ bind_attrib_location(struct gl_context *ctx, GLuint program, GLuint index,
return;
}
- if (shProg->LinkStatus) {
- /* get current index/location for the attribute */
- oldIndex = get_attrib_location(ctx, program, name);
- }
- else {
- oldIndex = -1;
- }
-
/* this will replace the current value if it's already in the list */
i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index);
if (i < 0) {
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c
index 479806eca..c7b27c1a4 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.c
+++ b/mesalib/src/mesa/main/texcompress_s3tc.c
@@ -167,7 +167,6 @@ GLboolean
_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
- GLint srcRowStride;
GLubyte *dst;
const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
const GLchan *tempImage = NULL;
@@ -194,13 +193,10 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
if (!tempImage)
return GL_FALSE; /* out of memory */
pixels = tempImage;
- srcRowStride = 3 * srcWidth;
srcFormat = GL_RGB;
}
else {
pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
@@ -230,7 +226,6 @@ GLboolean
_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
{
const GLchan *pixels;
- GLint srcRowStride;
GLubyte *dst;
const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */
const GLchan *tempImage = NULL;
@@ -257,13 +252,10 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
if (!tempImage)
return GL_FALSE; /* out of memory */
pixels = tempImage;
- srcRowStride = 4 * srcWidth;
srcFormat = GL_RGBA;
}
else {
pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
@@ -292,7 +284,6 @@ GLboolean
_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
{
const GLchan *pixels;
- GLint srcRowStride;
GLubyte *dst;
const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
const GLchan *tempImage = NULL;
@@ -319,12 +310,9 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
if (!tempImage)
return GL_FALSE; /* out of memory */
pixels = tempImage;
- srcRowStride = 4 * srcWidth;
}
else {
pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
@@ -353,7 +341,6 @@ GLboolean
_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
{
const GLchan *pixels;
- GLint srcRowStride;
GLubyte *dst;
const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */
const GLchan *tempImage = NULL;
@@ -380,12 +367,9 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
if (!tempImage)
return GL_FALSE; /* out of memory */
pixels = tempImage;
- srcRowStride = 4 * srcWidth;
}
else {
pixels = (const GLchan *) srcAddr;
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLchan);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index f6b4ddfb6..8dae7bb23 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -1481,7 +1481,6 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir)
if (index) {
src.index += index->value.i[0] * element_size;
} else {
- src_reg array_base = this->result;
/* Variable index array dereference. It eats the "vec4" of the
* base of the array and an index that offsets the Mesa register
* index.
@@ -2163,7 +2162,7 @@ ir_to_mesa_visitor::visit(ir_discard *ir)
void
ir_to_mesa_visitor::visit(ir_if *ir)
{
- ir_to_mesa_instruction *cond_inst, *if_inst, *else_inst = NULL;
+ ir_to_mesa_instruction *cond_inst, *if_inst;
ir_to_mesa_instruction *prev_inst;
prev_inst = (ir_to_mesa_instruction *)this->instructions.get_tail();
@@ -2195,7 +2194,7 @@ ir_to_mesa_visitor::visit(ir_if *ir)
visit_exec_list(&ir->then_instructions, this);
if (!ir->else_instructions.is_empty()) {
- else_inst = emit(ir->condition, OPCODE_ELSE);
+ emit(ir->condition, OPCODE_ELSE);
visit_exec_list(&ir->else_instructions, this);
}
diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c
index e78db24a4..095d53796 100644
--- a/mesalib/src/mesa/program/register_allocate.c
+++ b/mesalib/src/mesa/program/register_allocate.c
@@ -77,6 +77,8 @@
#include "main/mtypes.h"
#include "register_allocate.h"
+#define NO_REG ~0
+
struct ra_reg {
GLboolean *conflicts;
unsigned int *conflict_list;
@@ -123,7 +125,7 @@ struct ra_node {
unsigned int class;
- /* Register, if assigned, or ~0. */
+ /* Register, if assigned, or NO_REG. */
unsigned int reg;
/**
@@ -289,7 +291,7 @@ ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count)
g->nodes[i].adjacency_list = ralloc_array(g, unsigned int, count);
g->nodes[i].adjacency_count = 0;
ra_add_node_adjacency(g, i, i);
- g->nodes[i].reg = ~0;
+ g->nodes[i].reg = NO_REG;
}
return g;
@@ -349,7 +351,7 @@ ra_simplify(struct ra_graph *g)
progress = GL_FALSE;
for (i = g->count - 1; i >= 0; i--) {
- if (g->nodes[i].in_stack)
+ if (g->nodes[i].in_stack || g->nodes[i].reg != NO_REG)
continue;
if (pq_test(g, i)) {
@@ -429,7 +431,7 @@ ra_optimistic_color(struct ra_graph *g)
unsigned int i;
for (i = 0; i < g->count; i++) {
- if (g->nodes[i].in_stack)
+ if (g->nodes[i].in_stack || g->nodes[i].reg != NO_REG)
continue;
g->stack[g->stack_count] = i;
@@ -453,6 +455,24 @@ ra_get_node_reg(struct ra_graph *g, unsigned int n)
return g->nodes[n].reg;
}
+/**
+ * Forces a node to a specific register. This can be used to avoid
+ * creating a register class containing one node when handling data
+ * that must live in a fixed location and is known to not conflict
+ * with other forced register assignment (as is common with shader
+ * input data). These nodes do not end up in the stack during
+ * ra_simplify(), and thus at ra_select() time it is as if they were
+ * the first popped off the stack and assigned their fixed locations.
+ *
+ * Must be called before ra_simplify().
+ */
+void
+ra_set_node_reg(struct ra_graph *g, unsigned int n, unsigned int reg)
+{
+ g->nodes[n].reg = reg;
+ g->nodes[n].in_stack = GL_FALSE;
+}
+
static float
ra_get_spill_benefit(struct ra_graph *g, unsigned int n)
{
diff --git a/mesalib/src/mesa/program/register_allocate.h b/mesalib/src/mesa/program/register_allocate.h
index bb9e2740a..1345debd0 100644
--- a/mesalib/src/mesa/program/register_allocate.h
+++ b/mesalib/src/mesa/program/register_allocate.h
@@ -65,6 +65,7 @@ GLboolean ra_select(struct ra_graph *g);
GLboolean ra_allocate_no_spills(struct ra_graph *g);
unsigned int ra_get_node_reg(struct ra_graph *g, unsigned int n);
+void ra_set_node_reg(struct ra_graph * g, unsigned int n, unsigned int reg);
void ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost);
int ra_get_best_spill_node(struct ra_graph *g);
/** @} */
diff --git a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
index e0a1cba2b..9b44d1a71 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -195,18 +195,8 @@ get_pixel_transfer_program(struct gl_context *ctx, const struct state_key *key)
{ STATE_INTERNAL, STATE_PT_SCALE, 0, 0, 0 };
static const gl_state_index bias_state[STATE_LENGTH] =
{ STATE_INTERNAL, STATE_PT_BIAS, 0, 0, 0 };
- GLfloat scale[4], bias[4];
GLint scale_p, bias_p;
- scale[0] = ctx->Pixel.RedScale;
- scale[1] = ctx->Pixel.GreenScale;
- scale[2] = ctx->Pixel.BlueScale;
- scale[3] = ctx->Pixel.AlphaScale;
- bias[0] = ctx->Pixel.RedBias;
- bias[1] = ctx->Pixel.GreenBias;
- bias[2] = ctx->Pixel.BlueBias;
- bias[3] = ctx->Pixel.AlphaBias;
-
scale_p = _mesa_add_state_reference(params, scale_state);
bias_p = _mesa_add_state_reference(params, bias_state);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 9cc40c3d9..c568db2bc 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -419,7 +419,6 @@ make_texture(struct st_context *st,
gl_format mformat;
struct pipe_resource *pt;
enum pipe_format pipeFormat;
- GLuint cpp;
GLenum baseFormat, intFormat;
baseFormat = base_format(format);
@@ -431,7 +430,6 @@ make_texture(struct st_context *st,
pipeFormat = st_mesa_format_to_pipe_format(mformat);
assert(pipeFormat);
- cpp = util_format_get_blocksize(pipeFormat);
pixels = _mesa_map_pbo_source(ctx, unpack, pixels);
if (!pixels)