projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'origin/master' into gallium-0.2
[mesa.git]
/
src
/
mesa
/
state_tracker
/
st_cb_accum.c
diff --git
a/src/mesa/state_tracker/st_cb_accum.c
b/src/mesa/state_tracker/st_cb_accum.c
index 8098d75e18f337a78755f74bb9db78e92f5cda8e..a4e72b48ed4b5cca52461af345bb247a45c7a18a 100644
(file)
--- a/
src/mesa/state_tracker/st_cb_accum.c
+++ b/
src/mesa/state_tracker/st_cb_accum.c
@@
-38,11
+38,12
@@
#include "st_cb_accum.h"
#include "st_cb_fbo.h"
#include "st_draw.h"
#include "st_cb_accum.h"
#include "st_cb_fbo.h"
#include "st_draw.h"
+#include "st_public.h"
#include "st_format.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "st_format.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "util/
p
_tile.h"
+#include "util/
u
_tile.h"
#define UNCLAMPED_FLOAT_TO_SHORT(us, f) \
#define UNCLAMPED_FLOAT_TO_SHORT(us, f) \
@@
-66,15
+67,17
@@
acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
uint x, uint y, uint w, uint h, float *p)
{
const enum pipe_format f = acc_ps->format;
uint x, uint y, uint w, uint h, float *p)
{
const enum pipe_format f = acc_ps->format;
- const
int cpp = acc_ps->cpp
;
+ const
struct pipe_format_block b = acc_ps->block
;
acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT;
acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT;
- acc_ps->cpp = 8;
+ acc_ps->block.size = 8;
+ acc_ps->block.width = 1;
+ acc_ps->block.height = 1;
- pipe_get_tile_rgba(
pipe,
acc_ps, x, y, w, h, p);
+ pipe_get_tile_rgba(acc_ps, x, y, w, h, p);
acc_ps->format = f;
acc_ps->format = f;
- acc_ps->
cpp = cpp
;
+ acc_ps->
block = b
;
}
}
@@
-88,15
+91,17
@@
acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
uint x, uint y, uint w, uint h, const float *p)
{
enum pipe_format f = acc_ps->format;
uint x, uint y, uint w, uint h, const float *p)
{
enum pipe_format f = acc_ps->format;
- const
int cpp = acc_ps->cpp
;
+ const
struct pipe_format_block b = acc_ps->block
;
acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT;
acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT;
- acc_ps->cpp = 8;
+ acc_ps->block.size = 8;
+ acc_ps->block.width = 1;
+ acc_ps->block.height = 1;
- pipe_put_tile_rgba(
pipe,
acc_ps, x, y, w, h, p);
+ pipe_put_tile_rgba(acc_ps, x, y, w, h, p);
acc_ps->format = f;
acc_ps->format = f;
- acc_ps->
cpp = cpp
;
+ acc_ps->
block = b
;
}
}
@@
-111,7
+116,7
@@
st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
const GLint ypos = ctx->DrawBuffer->_Ymin;
const GLint width = ctx->DrawBuffer->_Xmax - xpos;
const GLint height = ctx->DrawBuffer->_Ymax - ypos;
const GLint ypos = ctx->DrawBuffer->_Ymin;
const GLint width = ctx->DrawBuffer->_Xmax - xpos;
const GLint height = ctx->DrawBuffer->_Ymax - ypos;
- GL
void
*map;
+ GL
ubyte
*map;
acc_ps = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
PIPE_BUFFER_USAGE_CPU_WRITE);
acc_ps = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
PIPE_BUFFER_USAGE_CPU_WRITE);
@@
-128,8
+133,7
@@
st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]);
int i, j;
for (i = 0; i < height; i++) {
GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]);
int i, j;
for (i = 0; i < height; i++) {
- GLshort *dst = ((GLshort *) map
- + ((ypos + i) * acc_ps->pitch + xpos) * 4);
+ GLshort *dst = (GLshort *) (map + (ypos + i) * acc_ps->stride + xpos * 8);
for (j = 0; j < width; j++) {
dst[0] = r;
dst[1] = g;
for (j = 0; j < width; j++) {
dst[0] = r;
dst[1] = g;
@@
-157,7
+161,7
@@
accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias,
{
struct pipe_screen *screen = ctx->st->pipe->screen;
struct pipe_surface *acc_ps = acc_strb->surface;
{
struct pipe_screen *screen = ctx->st->pipe->screen;
struct pipe_surface *acc_ps = acc_strb->surface;
- GL
void
*map;
+ GL
ubyte
*map;
map = screen->surface_map(screen, acc_ps,
PIPE_BUFFER_USAGE_CPU_WRITE);
map = screen->surface_map(screen, acc_ps,
PIPE_BUFFER_USAGE_CPU_WRITE);
@@
-168,8
+172,7
@@
accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias,
{
int i, j;
for (i = 0; i < height; i++) {
{
int i, j;
for (i = 0; i < height; i++) {
- GLshort *acc = ((GLshort *) map
- + ((ypos + i) * acc_ps->pitch + xpos) * 4);
+ GLshort *acc = (GLshort *) (map + (ypos + i) * acc_ps->stride + xpos * 8);
for (j = 0; j < width * 4; j++) {
float val = SHORT_TO_FLOAT(acc[j]) * scale + bias;
acc[j] = FLOAT_TO_SHORT(val);
for (j = 0; j < width * 4; j++) {
float val = SHORT_TO_FLOAT(acc[j]) * scale + bias;
acc[j] = FLOAT_TO_SHORT(val);
@@
-206,7
+209,7
@@
accum_accum(struct pipe_context *pipe, GLfloat value,
colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(
pipe,
color_surf, xpos, ypos, width, height, colorBuf);
+ pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, colorBuf);
acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
for (i = 0; i < 4 * width * height; i++) {
acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
for (i = 0; i < 4 * width * height; i++) {
@@
-241,7
+244,7
@@
accum_load(struct pipe_context *pipe, GLfloat value,
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(
pipe,
color_surf, xpos, ypos, width, height, buf);
+ pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, buf);
for (i = 0; i < 4 * width * height; i++) {
buf[i] = buf[i] * value;
for (i = 0; i < 4 * width * height; i++) {
buf[i] = buf[i] * value;
@@
-281,14
+284,14
@@
accum_return(GLcontext *ctx, GLfloat value,
if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) {
cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) {
cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(
pipe,
color_surf, xpos, ypos, width, height, cbuf);
+ pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, cbuf);
}
for (i = 0; i < width * height; i++) {
for (ch = 0; ch < 4; ch++) {
if (colormask[ch]) {
GLfloat val = abuf[i * 4 + ch] * value;
}
for (i = 0; i < width * height; i++) {
for (ch = 0; ch < 4; ch++) {
if (colormask[ch]) {
GLfloat val = abuf[i * 4 + ch] * value;
- abuf[i * 4 + ch] = CLAMP(val, 0.0
, 1.0
);
+ abuf[i * 4 + ch] = CLAMP(val, 0.0
f, 1.0f
);
}
else {
abuf[i * 4 + ch] = cbuf[i * 4 + ch];
}
else {
abuf[i * 4 + ch] = cbuf[i * 4 + ch];
@@
-296,7
+299,7
@@
accum_return(GLcontext *ctx, GLfloat value,
}
}
}
}
- pipe_put_tile_rgba(
pipe,
color_surf, xpos, ypos, width, height, abuf);
+ pipe_put_tile_rgba(color_surf, xpos, ypos, width, height, abuf);
free(abuf);
if (cbuf)
free(abuf);
if (cbuf)
@@
-322,7
+325,7
@@
st_Accum(GLcontext *ctx, GLenum op, GLfloat value)
const GLint height = ctx->DrawBuffer->_Ymax - ypos;
/* make sure color bufs aren't cached */
const GLint height = ctx->DrawBuffer->_Ymax - ypos;
/* make sure color bufs aren't cached */
-
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL
);
+
st_flush( st, PIPE_FLUSH_RENDER_CACHE, NULL
);
switch (op) {
case GL_ADD:
switch (op) {
case GL_ADD: