summaryrefslogtreecommitdiff
path: root/xc/lib/GL/mesa/src/drv/i810/i810span.c
blob: ce55c6f70b42beae3ab90bfd4b8962d6be149973 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include "types.h"
#include "i810buf.h"
#include "i810dd.h"
#include "i810lib.h"
#include "i810dma.h"
#include "i810log.h"

static void (*xsmWriteRGBASpan)( const GLcontext *ctx,
				 GLuint n, GLint x, GLint y,
				 CONST GLubyte rgba[][4], 
				 const GLubyte mask[] );
static void (*xsmWriteRGBSpan)( const GLcontext *ctx,
				GLuint n, GLint x, GLint y,
				CONST GLubyte rgb[][3], const GLubyte mask[] );
static void (*xsmWriteMonoRGBASpan)(const GLcontext *ctx, GLuint n, 
				    GLint x, GLint y,const GLubyte mask[] );
static void (*xsmWriteRGBAPixels)(const GLcontext *ctx,
				  GLuint n, const GLint x[], const GLint y[],
				  CONST GLubyte rgba[][4], 
				  const GLubyte mask[] );
static void (*xsmWriteMonoRGBAPixels)(const GLcontext *ctx,GLuint n, 
				      const GLint x[], const GLint y[],
				      const GLubyte mask[] );
static void (*xsmReadRGBASpan)(const GLcontext *ctx, GLuint n, 
			       GLint x, GLint y,GLubyte rgba[][4] );
static void (*xsmReadRGBAPixels)(const GLcontext *ctx,GLuint n, 
				 const GLint x[], const GLint y[],
				 GLubyte rgba[][4], const GLubyte mask[] );

/* Wrapper functions */

static void WriteRGBASpan( const GLcontext *ctx,
			   GLuint n, GLint x, GLint y,
			   CONST GLubyte rgba[][4], 
			   const GLubyte mask[] )
{
  i810Msg(12,__FUNCTION__ "\n"); 
  i810WaitDrawingEngine();
  (*xsmWriteRGBASpan)(ctx,n,x,y,rgba,mask);
}

static void WriteRGBSpan( const GLcontext *ctx,
			  GLuint n, GLint x, GLint y,
			  CONST GLubyte rgb[][3], const GLubyte mask[] )
{
  i810Msg(12,__FUNCTION__ "\n");
  i810WaitDrawingEngine();
  (*xsmWriteRGBSpan)(ctx,n,x,y,rgb,mask);
}

static void WriteMonoRGBASpan(const GLcontext *ctx, GLuint n, 
			      GLint x, GLint y,const GLubyte mask[] )
{
  i810Msg(12,__FUNCTION__ "\n");
  i810WaitDrawingEngine();
  (*xsmWriteMonoRGBASpan)(ctx,n,x,y,mask);
}

static void WriteRGBAPixels(const GLcontext *ctx,
			    GLuint n, const GLint x[], const GLint y[],
			    CONST GLubyte rgba[][4], 
			    const GLubyte mask[] )
{
  i810Msg(12,__FUNCTION__ "\n");
  i810WaitDrawingEngine();
  (*xsmWriteRGBAPixels)(ctx,n,x,y,rgba,mask);
}

static void WriteMonoRGBAPixels(const GLcontext *ctx,GLuint n, 
				const GLint x[], const GLint y[],
				const GLubyte mask[] )
{
  i810Msg(12,__FUNCTION__ "\n");
  i810WaitDrawingEngine();
  (*xsmWriteMonoRGBAPixels)(ctx,n,x,y,mask);
}

static void ReadRGBASpan(const GLcontext *ctx, GLuint n, 
			 GLint x, GLint y,GLubyte rgba[][4] )
{
  i810Msg(12,__FUNCTION__ "\n");
  i810WaitDrawingEngine();
  (*xsmReadRGBASpan)(ctx,n,x,y,rgba);
}

static void ReadRGBAPixels(const GLcontext *ctx,GLuint n, 
			   const GLint x[], const GLint y[],
			   GLubyte rgba[][4], const GLubyte mask[] )
{
  i810Msg(12,__FUNCTION__ "\n");
  i810WaitDrawingEngine();
  (*xsmReadRGBAPixels)(ctx,n,x,y,rgba,mask);
}

#define WRAP(x) 				\
    xsm ## x = ctx->Driver.x;			\
    ctx->Driver.x = x

void i810DDInitSpans( GLcontext *ctx )
{
   /* Need another hook from mesa to synchronize hardware before
    * write-pixels and read-spans/pixels.
    */ 
   WRAP(WriteRGBASpan);
   WRAP(WriteRGBSpan);
   WRAP(WriteMonoRGBASpan);
   WRAP(WriteRGBAPixels);
   WRAP(WriteMonoRGBAPixels);
   WRAP(ReadRGBASpan);
   WRAP(ReadRGBAPixels);
}









void fxUpdateDDSpanPointers(GLcontext *ctx)
{
  ctx->Driver.DepthTestSpan=fxDDDepthTestSpanGeneric;
  ctx->Driver.DepthTestPixels=fxDDDepthTestPixelsGeneric;

  ctx->Driver.ReadDepthSpanFloat=fxDDReadDepthSpanFloat;
  ctx->Driver.ReadDepthSpanInt=fxDDReadDepthSpanInt;
}

void fxSetupDDSpanPointers(GLcontext *ctx)
{
  ctx->Driver.WriteRGBASpan       =fxDDWriteRGBASpan;
  ctx->Driver.WriteRGBSpan        =fxDDWriteRGBSpan;
  ctx->Driver.WriteMonoRGBASpan   =fxDDWriteMonoRGBASpan;
  ctx->Driver.WriteRGBAPixels     =fxDDWriteRGBAPixels;
  ctx->Driver.WriteMonoRGBAPixels =fxDDWriteMonoRGBAPixels;

  ctx->Driver.WriteCI8Span        =NULL;
  ctx->Driver.WriteCI32Span       =NULL;
  ctx->Driver.WriteMonoCISpan     =NULL;
  ctx->Driver.WriteCI32Pixels     =NULL;
  ctx->Driver.WriteMonoCIPixels   =NULL;

  ctx->Driver.ReadRGBASpan        =fxDDReadRGBASpan;
  ctx->Driver.ReadRGBAPixels      =fxDDReadRGBAPixels;

  ctx->Driver.ReadCI32Span        =NULL;
  ctx->Driver.ReadCI32Pixels      =NULL;
}