summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Cencora <[email protected]>2010-01-10 13:59:39 +0100
committerMaciej Cencora <[email protected]>2010-01-19 23:38:33 +0100
commit9363a813f1393f7c41c7af961ffc26947ad92572 (patch)
tree7eab768f2a106e083682ff789045a1d4ae4c5a4f
parentf542fde77effbc3c780940e139fc2572e818a179 (diff)
r300: prepare for texcopy code sharing
-rw-r--r--src/mesa/drivers/dri/r300/r300_blit.c54
-rw-r--r--src/mesa/drivers/dri/r300/r300_blit.h40
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_texcopy.c3
4 files changed, 51 insertions, 48 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c
index 2eec27e900f..37e3f8aa005 100644
--- a/src/mesa/drivers/dri/r300/r300_blit.c
+++ b/src/mesa/drivers/dri/r300/r300_blit.c
@@ -519,29 +519,31 @@ static void emit_cb_setup(struct r300_context *r300,
* @param[in] height region height
* @param[in] flip_y set if y coords of the source image need to be flipped
*/
-GLboolean r300_blit(struct r300_context *r300,
- struct radeon_bo *src_bo,
- intptr_t src_offset,
- gl_format src_mesaformat,
- unsigned src_pitch,
- unsigned src_width,
- unsigned src_height,
- unsigned src_x_offset,
- unsigned src_y_offset,
- struct radeon_bo *dst_bo,
- intptr_t dst_offset,
- gl_format dst_mesaformat,
- unsigned dst_pitch,
- unsigned dst_width,
- unsigned dst_height,
- unsigned dst_x_offset,
- unsigned dst_y_offset,
- unsigned reg_width,
- unsigned reg_height,
- unsigned flip_y)
+unsigned r300_blit(GLcontext *ctx,
+ struct radeon_bo *src_bo,
+ intptr_t src_offset,
+ gl_format src_mesaformat,
+ unsigned src_pitch,
+ unsigned src_width,
+ unsigned src_height,
+ unsigned src_x_offset,
+ unsigned src_y_offset,
+ struct radeon_bo *dst_bo,
+ intptr_t dst_offset,
+ gl_format dst_mesaformat,
+ unsigned dst_pitch,
+ unsigned dst_width,
+ unsigned dst_height,
+ unsigned dst_x_offset,
+ unsigned dst_y_offset,
+ unsigned reg_width,
+ unsigned reg_height,
+ unsigned flip_y)
{
+ r300ContextPtr r300 = R300_CONTEXT(ctx);
+
if (_mesa_get_format_bits(src_mesaformat, GL_DEPTH_BITS) > 0)
- return GL_FALSE;
+ return 0;
/* Make sure that colorbuffer has even width - hw limitation */
if (dst_pitch % 2 > 0)
@@ -551,7 +553,7 @@ GLboolean r300_blit(struct r300_context *r300,
* Looks like a hw limitation.
*/
if (dst_pitch < 32)
- return GL_FALSE;
+ return 0;
/* Need to clamp the region size to make sure
* we don't read outside of the source buffer
@@ -567,7 +569,7 @@ GLboolean r300_blit(struct r300_context *r300,
reg_height = dst_height - dst_y_offset;
if (src_bo == dst_bo) {
- return GL_FALSE;
+ return 0;
}
if (0) {
@@ -587,7 +589,7 @@ GLboolean r300_blit(struct r300_context *r300,
radeonFlush(r300->radeon.glCtx);
if (!validate_buffers(r300, src_bo, dst_bo))
- return GL_FALSE;
+ return 0;
rcommonEnsureCmdBufSpace(&r300->radeon, 200, __FUNCTION__);
@@ -618,5 +620,5 @@ GLboolean r300_blit(struct r300_context *r300,
radeonFlush(r300->radeon.glCtx);
- return GL_TRUE;
-} \ No newline at end of file
+ return 1;
+}
diff --git a/src/mesa/drivers/dri/r300/r300_blit.h b/src/mesa/drivers/dri/r300/r300_blit.h
index dc21e880982..735acaddd70 100644
--- a/src/mesa/drivers/dri/r300/r300_blit.h
+++ b/src/mesa/drivers/dri/r300/r300_blit.h
@@ -30,25 +30,25 @@
void r300_blit_init(struct r300_context *r300);
-GLboolean r300_blit(struct r300_context *r300,
- struct radeon_bo *src_bo,
- intptr_t src_offset,
- gl_format src_mesaformat,
- unsigned src_pitch,
- unsigned src_width,
- unsigned src_height,
- unsigned src_x_offset,
- unsigned src_y_offset,
- struct radeon_bo *dst_bo,
- intptr_t dst_offset,
- gl_format dst_mesaformat,
- unsigned dst_pitch,
- unsigned dst_width,
- unsigned dst_height,
- unsigned dst_x_offset,
- unsigned dst_y_offset,
- unsigned width,
- unsigned height,
- unsigned flip_y);
+unsigned r300_blit(GLcontext *ctx,
+ struct radeon_bo *src_bo,
+ intptr_t src_offset,
+ gl_format src_mesaformat,
+ unsigned src_pitch,
+ unsigned src_width,
+ unsigned src_height,
+ unsigned src_x_offset,
+ unsigned src_y_offset,
+ struct radeon_bo *dst_bo,
+ intptr_t dst_offset,
+ gl_format dst_mesaformat,
+ unsigned dst_pitch,
+ unsigned dst_width,
+ unsigned dst_height,
+ unsigned dst_x_offset,
+ unsigned dst_y_offset,
+ unsigned reg_width,
+ unsigned reg_height,
+ unsigned flip_y);
#endif // R300_BLIT_H \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 1f6ccf6ddca..e449590fbb8 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -326,6 +326,8 @@ static void r300_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.emit_query_finish = rv530_emit_query_finish_single_z;
} else
radeon->vtbl.emit_query_finish = r300_emit_query_finish;
+
+ radeon->vtbl.blit = r300_blit;
}
static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
diff --git a/src/mesa/drivers/dri/r300/r300_texcopy.c b/src/mesa/drivers/dri/r300/r300_texcopy.c
index ebc9c05b8a8..716a38a0a4d 100644
--- a/src/mesa/drivers/dri/r300/r300_texcopy.c
+++ b/src/mesa/drivers/dri/r300/r300_texcopy.c
@@ -34,7 +34,6 @@
#include "drivers/common/meta.h"
#include "radeon_mipmap_tree.h"
-#include "r300_blit.h"
#include <main/debug.h>
// TODO:
@@ -84,7 +83,7 @@ do_copy_texsubimage(GLcontext *ctx,
}
/* blit from src buffer to texture */
- return r300_blit(r300, rrb->bo, src_offset, rrb->base.Format, rrb->pitch/rrb->cpp,
+ return r300->radeon.vtbl.blit(ctx, rrb->bo, src_offset, rrb->base.Format, rrb->pitch/rrb->cpp,
rrb->base.Width, rrb->base.Height, x, y,
timg->mt->bo, dst_offset, timg->base.TexFormat,
timg->base.Width, timg->base.Width, timg->base.Height,