summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r200
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2004-10-14 00:59:12 +0000
committerIan Romanick <[email protected]>2004-10-14 00:59:12 +0000
commit06487945186f546094b78cc7021a2bc1e695c17b (patch)
tree720c7ac3f190d707419aafc3d804f2b54b4609c9 /src/mesa/drivers/dri/r200
parentdc45ee7a4b07603646a0b0f502f74941a4b73f3d (diff)
Add support for optimized versions of the code underlying ReadPixels
(and DrawPixels). The R200, R128, and Unichrome drivers get support in this commit. Other drivers would be easy enough to add for people that have the cards. The DRI (CVS) build will need to be updated to account for the new source files.
Diffstat (limited to 'src/mesa/drivers/dri/r200')
-rw-r--r--src/mesa/drivers/dri/r200/r200_span.c78
1 files changed, 16 insertions, 62 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_span.c b/src/mesa/drivers/dri/r200/r200_span.c
index e1ad976ce3b..efb5e6ea7c5 100644
--- a/src/mesa/drivers/dri/r200/r200_span.c
+++ b/src/mesa/drivers/dri/r200/r200_span.c
@@ -122,61 +122,27 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* 16 bit, RGB565 color spanline and pixel functions
*/
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_565( color[0], color[1], color[2] )
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
+#define GET_SRC_PTR(_x, _y) (read_buf + _x * 2 + _y * pitch)
+#define GET_DST_PTR(_x, _y) ( buf + _x * 2 + _y * pitch)
+#define SPANTMP_PIXEL_FMT GL_RGB
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
- rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
- rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) r200##x##_RGB565
-#include "spantmp.h"
+#define TAG(x) r200##x##_RGB565
+#define TAG2(x,y) r200##x##_RGB565##y
+#include "spantmp2.h"
/* 32 bit, ARGB8888 color spanline and pixel functions
*/
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_8888( color[3], color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
-do { \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16) | \
- (a << 24) ); \
-} while (0)
-
-#define WRITE_PIXEL( _x, _y, p ) \
-do { \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p; \
-} while (0)
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- volatile GLuint *ptr = (volatile GLuint *)(read_buf + _x*4 + _y*pitch); \
- GLuint p = *ptr; \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
-} while (0)
-#define TAG(x) r200##x##_ARGB8888
-#include "spantmp.h"
+#define GET_SRC_PTR(_x, _y) (read_buf + _x * 4 + _y * pitch)
+#define GET_DST_PTR(_x, _y) ( buf + _x * 4 + _y * pitch)
+#define SPANTMP_PIXEL_FMT GL_BGRA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
+#define TAG(x) r200##x##_ARGB8888
+#define TAG2(x,y) r200##x##_ARGB8888##y
+#include "spantmp2.h"
/* ================================================================
@@ -380,23 +346,11 @@ void r200InitSpanFuncs( GLcontext *ctx )
switch ( rmesa->r200Screen->cpp ) {
case 2:
- swdd->WriteRGBASpan = r200WriteRGBASpan_RGB565;
- swdd->WriteRGBSpan = r200WriteRGBSpan_RGB565;
- swdd->WriteMonoRGBASpan = r200WriteMonoRGBASpan_RGB565;
- swdd->WriteRGBAPixels = r200WriteRGBAPixels_RGB565;
- swdd->WriteMonoRGBAPixels = r200WriteMonoRGBAPixels_RGB565;
- swdd->ReadRGBASpan = r200ReadRGBASpan_RGB565;
- swdd->ReadRGBAPixels = r200ReadRGBAPixels_RGB565;
+ r200InitPointers_RGB565( swdd );
break;
case 4:
- swdd->WriteRGBASpan = r200WriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = r200WriteRGBSpan_ARGB8888;
- swdd->WriteMonoRGBASpan = r200WriteMonoRGBASpan_ARGB8888;
- swdd->WriteRGBAPixels = r200WriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBAPixels = r200WriteMonoRGBAPixels_ARGB8888;
- swdd->ReadRGBASpan = r200ReadRGBASpan_ARGB8888;
- swdd->ReadRGBAPixels = r200ReadRGBAPixels_ARGB8888;
+ r200InitPointers_ARGB8888( swdd );
break;
default: