aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blit.c3
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c3
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c3
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_texture.c11
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_texture.h5
-rwxr-xr-xmesalib/src/mesa/drivers/dri/swrast/swrast.c4
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c14
-rw-r--r--mesalib/src/mesa/program/program_parse.y7
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_feedback.c6
9 files changed, 39 insertions, 17 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c
index 4ba71b929..595287d3b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blit.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blit.c
@@ -272,7 +272,8 @@ setup_vertex_data_tex(struct blit_state *ctx,
const unsigned stride = sizeof ctx->vertices[0] / sizeof ctx->vertices[0][0][0];
util_map_texcoords2d_onto_cubemap(src_face,
&ctx->vertices[0][1][0], stride,
- &ctx->vertices[0][1][0], stride);
+ &ctx->vertices[0][1][0], stride,
+ TRUE);
}
offset = get_next_slot( ctx );
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 096d3bc2b..b95cbab12 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -659,7 +659,8 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx,
util_map_texcoords2d_onto_cubemap(layer % 6,
/* pointer, stride in floats */
&face_coord[0][0], 2,
- &ctx->vertices[0][1][0], 8);
+ &ctx->vertices[0][1][0], 8,
+ TRUE);
} else {
set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8);
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
index a885f2b0f..84bf30f08 100644
--- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1409,7 +1409,8 @@ set_vertex_data(struct gen_mipmap_state *ctx,
};
util_map_texcoords2d_onto_cubemap(layer, &st[0][0], 2,
- &ctx->vertices[0][1][0], 8);
+ &ctx->vertices[0][1][0], 8,
+ FALSE);
}
else if (tex_target == PIPE_TEXTURE_1D_ARRAY) {
/* 1D texture array */
diff --git a/mesalib/src/gallium/auxiliary/util/u_texture.c b/mesalib/src/gallium/auxiliary/util/u_texture.c
index d97e57a79..e865f8e73 100644
--- a/mesalib/src/gallium/auxiliary/util/u_texture.c
+++ b/mesalib/src/gallium/auxiliary/util/u_texture.c
@@ -42,7 +42,8 @@
void util_map_texcoords2d_onto_cubemap(unsigned face,
const float *in_st, unsigned in_stride,
- float *out_str, unsigned out_stride)
+ float *out_str, unsigned out_stride,
+ boolean allow_scale)
{
int i;
float rx, ry, rz;
@@ -52,8 +53,14 @@ void util_map_texcoords2d_onto_cubemap(unsigned face,
/* Compute sc = +/-scale and tc = +/-scale.
* Not +/-1 to avoid cube face selection ambiguity near the edges,
* though that can still sometimes happen with this scale factor...
+ *
+ * XXX: Yep, there is no safe scale factor that will prevent sampling
+ * the neighbouring face when stretching out. A more reliable solution
+ * would be to clamp (sc, tc) against +/- 1.0-1.0/mipsize, in the shader.
+ *
+ * Also, this is not necessary when minifying, or 1:1 blits.
*/
- const float scale = 0.9999f;
+ const float scale = allow_scale ? 0.9999f : 1.0f;
const float sc = (2 * in_st[0] - 1) * scale;
const float tc = (2 * in_st[1] - 1) * scale;
diff --git a/mesalib/src/gallium/auxiliary/util/u_texture.h b/mesalib/src/gallium/auxiliary/util/u_texture.h
index 93b2f1e4c..b1c8c7091 100644
--- a/mesalib/src/gallium/auxiliary/util/u_texture.h
+++ b/mesalib/src/gallium/auxiliary/util/u_texture.h
@@ -27,6 +27,8 @@
#ifndef U_TEXTURE_H
#define U_TEXTURE_H
+#include "pipe/p_compiler.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -44,7 +46,8 @@ extern "C" {
*/
void util_map_texcoords2d_onto_cubemap(unsigned face,
const float *in_st, unsigned in_stride,
- float *out_str, unsigned out_stride);
+ float *out_str, unsigned out_stride,
+ boolean allow_scale);
#ifdef __cplusplus
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index 136a76fd9..d0ca80fa7 100755
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -411,8 +411,8 @@ swrast_map_renderbuffer(struct gl_context *ctx,
(char *) xrb->Base.Buffer,
dPriv->loaderPrivate);
- *out_map = xrb->Base.Buffer;
- *out_stride = stride;
+ *out_map = xrb->Base.Buffer + (h - 1) * stride;
+ *out_stride = -stride;
return;
}
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index f6fd53576..58e1f496e 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -368,6 +368,13 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
COPY_4V(value, ctx->FragmentProgram.Parameters[idx]);
return;
case STATE_LOCAL:
+ if (!ctx->FragmentProgram.Current->Base.LocalParams) {
+ ctx->FragmentProgram.Current->Base.LocalParams =
+ calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
+ if (!ctx->FragmentProgram.Current->Base.LocalParams)
+ return;
+ }
+
COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]);
return;
default:
@@ -387,6 +394,13 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
return;
case STATE_LOCAL:
+ if (!ctx->VertexProgram.Current->Base.LocalParams) {
+ ctx->VertexProgram.Current->Base.LocalParams =
+ calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
+ if (!ctx->VertexProgram.Current->Base.LocalParams)
+ return;
+ }
+
COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]);
return;
default:
diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y
index 03c0a3dba..a76db4e86 100644
--- a/mesalib/src/mesa/program/program_parse.y
+++ b/mesalib/src/mesa/program/program_parse.y
@@ -25,7 +25,6 @@
#include <stdlib.h>
#include <string.h>
-#include "main/macros.h"
#include "main/mtypes.h"
#include "main/imports.h"
#include "program/program.h"
@@ -2560,12 +2559,6 @@ initialize_symbol_from_param(struct gl_program *prog,
param_var->type = at_param;
param_var->param_binding_type = PROGRAM_STATE_VAR;
- /* Dynamically allocate LocalParams, since it's a large array to have
- * statically in every gl_program otherwise.
- */
- if (state_tokens[1] == STATE_LOCAL && !prog->LocalParams)
- prog->LocalParams = calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
-
/* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
* we need to unroll it and call add_state_reference() for each row
*/
diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.c b/mesalib/src/mesa/state_tracker/st_cb_feedback.c
index d2e4346b7..34a16ccf9 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_feedback.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.c
@@ -85,9 +85,11 @@ feedback_vertex(struct gl_context *ctx, const struct draw_context *draw,
const GLfloat *color, *texcoord;
GLuint slot;
- /* Recall that Y=0=Top of window for Gallium wincoords */
win[0] = v->data[0][0];
- win[1] = ctx->DrawBuffer->Height - v->data[0][1];
+ if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
+ win[1] = ctx->DrawBuffer->Height - v->data[0][1];
+ else
+ win[1] = v->data[0][1];
win[2] = v->data[0][2];
win[3] = 1.0F / v->data[0][3];