#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
+#include "swrast/s_context.h"
+#include "swrast/s_depth.h"
+#include "swrast/s_triangle.h"
/**********************************************************************/
/***** Write spans of pixels *****/
}
-triangle_func ggiGetTriangleFunc(GLcontext *ctx);
+static swrast_tri_func ggimesa_stubs_get_triangle_func(GLcontext *ctx);
-int GGIsetup_driver(GGIMesaContext ggictx,struct ggi_mesa_info *info)
+int GGIsetup_driver(GGIMesaContext ggictx, struct ggi_mesa_info *info)
{
- GLcontext *ctx=ggictx->gl_ctx;
+ GLcontext *ctx = ggictx->gl_ctx;
ctx->Driver.WriteRGBASpan = GGIwrite_rgba_span;
ctx->Driver.WriteRGBSpan = GGIwrite_rgb_span;
-// ctx->Driver.WriteMonoRGBASpan = GGIwrite_mono_span;
ctx->Driver.WriteRGBAPixels = GGIwrite_rgba_pixels;
-// ctx->Driver.WriteMonoRGBAPixels = GGIwrite_mono_pixels;
ctx->Driver.WriteCI32Span = GGIwrite_ci32_span;
ctx->Driver.WriteCI8Span = GGIwrite_ci8_span;
-// ctx->Driver.WriteMonoCISpan = GGIwrite_mono_span;
ctx->Driver.WriteCI32Pixels = GGIwrite_ci32_pixels;
-// ctx->Driver.WriteMonoCIPixels = GGIwrite_mono_pixels;
ctx->Driver.ReadCI32Span = GGIread_ci32_span;
ctx->Driver.ReadRGBASpan = GGIread_rgba_span;
ctx->Driver.ReadCI32Pixels = GGIread_ci32_pixels;
ctx->Driver.ReadRGBAPixels = GGIread_rgba_pixels;
- ctx->Driver.RegisterVB = _swsetup_RegisterVB;
- ctx->Driver.UnregisterVB = _swsetup_UnregisterVB;
-
return 0;
}
}
-void GGItriangle_flat(GLcontext *ctx,GLuint v0,GLuint v1,GLuint v2,GLuint pv)
+void GGItriangle_flat(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2)
{
//#define INTERP_Z 1
-//#define INTERP_RGB 1
-//#define INTERP_ALPHA 1
+#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define SETUP_CODE \
- GLubyte r = VB->ColorPtr->data[pv][0]; \
- GLubyte g = VB->ColorPtr->data[pv][1]; \
- GLubyte b = VB->ColorPtr->data[pv][2]; \
- GLubyte a = VB->ColorPtr->data[pv][3]; \
- (*ctx->Driver.Color)(ctx,r,g,b,a);
+#define SETUP_CODE \
+ ggi_color color; \
+ color.r = v0->color[0]; \
+ color.g = v0->color[1]; \
+ color.b = v0->color[2]; \
+ color.a = v0->color[3]; \
+ ggiSetGCForeground(VIS, ggiMapColor(VIS, &color));
#define INNER_LOOP(LEFT,RIGHT,Y) \
ggiDrawHLine(VIS,LEFT,FLIP(Y),RIGHT-LEFT);
-//#include "tritemp.h"
+#include "swrast/s_tritemp.h"
}
-void GGItriangle_flat_depth(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv)
+static void GGItriangle_flat_depth(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2)
{
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define SETUP_CODE \
- GLubyte r = VB->ColorPtr->data[pv][0]; \
- GLubyte g = VB->ColorPtr->data[pv][1]; \
- GLubyte b = VB->ColorPtr->data[pv][2]; \
- GLubyte a = VB->ColorPtr->data[pv][3]; \
- (*ctx->Driver.Color)(ctx,r,g,b,a);
+#define SETUP_CODE \
+ ggi_color color; \
+ color.r = v0->color[0]; \
+ color.g = v0->color[1]; \
+ color.b = v0->color[2]; \
+ color.a = v0->color[3]; \
+ ggiSetGCForeground(VIS, ggiMapColor(VIS, &color));
#define INNER_LOOP(LEFT,RIGHT,Y) \
{ \
if (length) ggiDrawHLine(VIS,startx,yy,length); \
}
-//#include "tritemp.h"
+#include "swrast/s_tritemp.h"
}
-triangle_func ggiGetTriangleFunc(GLcontext *ctx)
+static swrast_tri_func ggimesa_stubs_get_triangle_func(GLcontext *ctx)
{
if (ctx->Stencil.Enabled) return NULL;
if (ctx->Polygon.SmoothFlag) return NULL;
int _ggimesaDebugSync = 0;
uint32 _ggimesaDebugState = 0;
-static void gl_ggiUpdateState(GLcontext *ctx);
+static void gl_ggiUpdateState(GLcontext *ctx, GLuint new_state);
static int changed(ggi_visual_t vis, int whatchanged);
static void gl_ggiGetSize(GLcontext *ctx, GLuint *width, GLuint *height)
return mask & (~GL_COLOR_BUFFER_BIT);
}
-#if 0
-static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLenum mode)
-{
- GGIMESADPRINT_CORE("gl_ggiSetBuffer() called\n");
-
- if (mode == GL_FRONT)
- GGICTX->active_buffer = 1;
- else
- GGICTX->active_buffer = 0;
-
- return GL_TRUE;
-}
-#endif
-
/* Set the buffer used for drawing */
static GLboolean gl_ggiSetDrawBuffer(GLcontext *ctx, GLenum mode)
{
ctx->Driver.LineFunc = _swsetup_Line;
ctx->Driver.TriangleFunc = _swsetup_Triangle;
ctx->Driver.QuadFunc = _swsetup_Quad;
- ctx->Driver.RasterSetup = _swsetup_RasterSetup;
- ctx->Driver.RegisterVB = _swsetup_RegisterVB;
- ctx->Driver.UnregisterVB = _swsetup_UnregisterVB;
+
}
static int gl_ggiInitInfo(GGIMesaContext ctx, struct ggi_mesa_info *info)