diff options
author | Daniel Borca <[email protected]> | 2004-02-07 10:54:36 +0000 |
---|---|---|
committer | Daniel Borca <[email protected]> | 2004-02-07 10:54:36 +0000 |
commit | d039b43e3074d14193944408ef211a9abf10608b (patch) | |
tree | e2f29f73426a37a6ce8d8dcd19e6b52ad8f9e8fb /src/mesa/drivers/dos/dmesa.c | |
parent | 07d6a983595b7ee52c8448fc579d952ce36472b8 (diff) |
added NUL driver for DMesa
Diffstat (limited to 'src/mesa/drivers/dos/dmesa.c')
-rw-r--r-- | src/mesa/drivers/dos/dmesa.c | 105 |
1 files changed, 54 insertions, 51 deletions
diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c index c8fd91864bd..e0744a88de8 100644 --- a/src/mesa/drivers/dos/dmesa.c +++ b/src/mesa/drivers/dos/dmesa.c @@ -69,11 +69,8 @@ */ struct dmesa_visual { GLvisual gl_visual; - GLboolean db_flag; /* double buffered? */ - GLboolean rgb_flag; /* RGB mode? */ GLboolean sw_alpha; /* use Mesa's alpha buffer? */ - GLuint depth; /* bits per pixel (1, 8, 24, etc) */ - int zbuffer; /* Z=buffer: 0=no, 1=SW, -1=HW */ + int z_buffer; /* Z=buffer: 0=no, 1=SW, -1=HW */ }; /* @@ -95,7 +92,7 @@ struct dmesa_buffer { struct dmesa_context { GLcontext gl_ctx; /* the core library context */ DMesaVisual visual; - DMesaBuffer Buffer; + DMesaBuffer buffer; GLuint ClearColor; GLuint ClearIndex; /* etc... */ @@ -107,10 +104,10 @@ struct dmesa_context { /**************************************************************************** * Read/Write pixels ***************************************************************************/ -#define FLIP(y) (dmesa->Buffer->height - (y) - 1) +#define FLIP(y) (dmesa->buffer->height - (y) - 1) #define FLIP2(y) (_b_ - (y)) -#define DSTRIDE dmesa->Buffer->width +#define DSTRIDE dmesa->buffer->width /**************************************************************************** * RGB[A] @@ -208,7 +205,7 @@ static void write_rgba_pixels (const GLcontext *ctx, const GLubyte rgba[][4], const GLubyte mask[]) { const DMesaContext dmesa = (DMesaContext)ctx; - GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1; + GLuint i, _w_ = DSTRIDE, _b_ = dmesa->buffer->height - 1; if (mask) { /* draw some pixels */ @@ -232,7 +229,7 @@ static void write_mono_rgba_pixels (const GLcontext *ctx, const GLchan color[4], const GLubyte mask[]) { const DMesaContext dmesa = (DMesaContext)ctx; - GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1, rgba = vl_mixrgba(color); + GLuint i, _w_ = DSTRIDE, _b_ = dmesa->buffer->height - 1, rgba = vl_mixrgba(color); if (mask) { /* draw some pixels */ @@ -256,7 +253,7 @@ static void read_rgba_pixels (const GLcontext *ctx, GLubyte rgba[][4], const GLubyte mask[]) { const DMesaContext dmesa = (DMesaContext)ctx; - GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1; + GLuint i, _w_ = DSTRIDE, _b_ = dmesa->buffer->height - 1; if (mask) { /* read some pixels */ @@ -371,7 +368,7 @@ static void write_index_pixels (const GLcontext *ctx, const GLuint index[], const GLubyte mask[]) { const DMesaContext dmesa = (DMesaContext)ctx; - GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1; + GLuint i, _w_ = DSTRIDE, _b_ = dmesa->buffer->height - 1; if (mask) { /* draw some pixels */ @@ -395,7 +392,7 @@ static void write_mono_index_pixels (const GLcontext *ctx, GLuint colorIndex, const GLubyte mask[]) { const DMesaContext dmesa = (DMesaContext)ctx; - GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1; + GLuint i, _w_ = DSTRIDE, _b_ = dmesa->buffer->height - 1; if (mask) { /* draw some pixels */ @@ -419,7 +416,7 @@ static void read_index_pixels (const GLcontext *ctx, GLuint index[], const GLubyte mask[]) { const DMesaContext dmesa = (DMesaContext)ctx; - GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1; + GLuint i, _w_ = DSTRIDE, _b_ = dmesa->buffer->height - 1; if (mask) { /* read some pixels */ @@ -455,8 +452,8 @@ static void read_index_pixels (const GLcontext *ctx, #define SETUP_CODE \ const DMesaContext dmesa = (DMesaContext)ctx; \ - GLuint _b_ = dmesa->Buffer->height - 1; \ - GLuint _w_ = dmesa->Buffer->width; \ + GLuint _b_ = dmesa->buffer->height - 1; \ + GLuint _w_ = dmesa->buffer->width; \ GLuint rgb = vl_mixrgb(v2->color); #define RENDER_SPAN(span) \ @@ -479,8 +476,8 @@ static void read_index_pixels (const GLcontext *ctx, #define SETUP_CODE \ const DMesaContext dmesa = (DMesaContext)ctx; \ - GLuint _b_ = dmesa->Buffer->height - 1; \ - GLuint _w_ = dmesa->Buffer->width; \ + GLuint _b_ = dmesa->buffer->height - 1; \ + GLuint _w_ = dmesa->buffer->width; \ GLuint rgb = vl_mixrgb(v2->color); #define RENDER_SPAN(span) \ @@ -507,8 +504,8 @@ static void read_index_pixels (const GLcontext *ctx, #define SETUP_CODE \ const DMesaContext dmesa = (DMesaContext)ctx; \ - GLuint _b_ = dmesa->Buffer->height - 1; \ - GLuint _w_ = dmesa->Buffer->width; + GLuint _b_ = dmesa->buffer->height - 1; \ + GLuint _w_ = dmesa->buffer->width; #define RENDER_SPAN(span) \ GLuint i, offset = FLIP2(span.y)*_w_ + span.x; \ @@ -534,8 +531,8 @@ static void read_index_pixels (const GLcontext *ctx, #define SETUP_CODE \ const DMesaContext dmesa = (DMesaContext)ctx; \ - GLuint _b_ = dmesa->Buffer->height - 1; \ - GLuint _w_ = dmesa->Buffer->width; + GLuint _b_ = dmesa->buffer->height - 1; \ + GLuint _w_ = dmesa->buffer->width; #define RENDER_SPAN(span) \ GLuint i, offset = FLIP2(span.y)*_w_ + span.x; \ @@ -616,8 +613,8 @@ static void dmesa_choose_tri (GLcontext *ctx) #define SETUP_CODE \ const DMesaContext dmesa = (DMesaContext)ctx; \ - GLuint _b_ = dmesa->Buffer->height - 1; \ - GLuint _w_ = dmesa->Buffer->width; \ + GLuint _b_ = dmesa->buffer->height - 1; \ + GLuint _w_ = dmesa->buffer->width; \ GLuint rgb = vl_mixrgb(vert1->color); #define PLOT(X,Y) vl_putpixel(FLIP2(Y) * _w_ + X, rgb); @@ -638,8 +635,8 @@ static void dmesa_choose_tri (GLcontext *ctx) #define SETUP_CODE \ const DMesaContext dmesa = (DMesaContext)ctx; \ - GLuint _b_ = dmesa->Buffer->height - 1; \ - GLuint _w_ = dmesa->Buffer->width; \ + GLuint _b_ = dmesa->buffer->height - 1; \ + GLuint _w_ = dmesa->buffer->width; \ GLuint rgb = vl_mixrgb(vert1->color); #define PLOT(X,Y) \ @@ -751,7 +748,7 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all, /* we can't handle color or index masking */ if ((*colorMask == 0xffffffff) && (ctx->Color.IndexMask == 0xffffffff)) { if (mask & DD_BACK_LEFT_BIT) { - int color = c->visual->rgb_flag ? c->ClearColor : c->ClearIndex; + int color = ((GLvisual *)(c->visual))->rgbMode ? c->ClearColor : c->ClearIndex; if (all) { vl_clear(color); @@ -958,10 +955,6 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint redBits, greenBits, blueBits, alphaBits, indexBits; GLboolean sw_alpha; - if (!dbFlag) { - return NULL; - } - alphaBits = 0; if (!rgbFlag) { @@ -1017,6 +1010,9 @@ DMesaVisual DMesaCreateVisual (GLint width, alphaBits = alphaSize; sw_alpha = (alphaBits > 0); + if (!dbFlag) { + return NULL; + } if ((colDepth=vl_video_init(width, height, colDepth, rgbFlag, refresh)) <= 0) { return NULL; } @@ -1040,12 +1036,8 @@ DMesaVisual DMesaCreateVisual (GLint width, alphaBits?accumSize:0, /* accumAlpha */ 1); /* numSamples */ - v->depth = colDepth; - v->db_flag = dbFlag; - v->rgb_flag = rgbFlag; v->sw_alpha = sw_alpha; - - v->zbuffer = (depthSize > 0) ? 1 : 0; + v->z_buffer = (depthSize > 0) ? 1 : 0; } return v; @@ -1113,7 +1105,7 @@ DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, if ((b=(DMesaBuffer)CALLOC_STRUCT(dmesa_buffer)) != NULL) { _mesa_initialize_framebuffer((GLframebuffer *)b, (GLvisual *)visual, - visual->zbuffer == 1, + visual->z_buffer == 1, ((GLvisual *)visual)->stencilBits > 0, ((GLvisual *)visual)->accumRedBits > 0, visual->sw_alpha); @@ -1134,7 +1126,9 @@ DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, void DMesaDestroyBuffer (DMesaBuffer b) { #ifndef FX - free(b->the_window); + if (b->the_window != NULL) { + free(b->the_window); + } _mesa_destroy_framebuffer((GLframebuffer *)b); #endif } @@ -1179,7 +1173,7 @@ DMesaContext DMesaCreateContext (DMesaVisual visual, tnl = TNL_CONTEXT(c); tnl->Driver.RunPipeline = _tnl_run_pipeline; /* swrast setup */ - if (visual->rgb_flag) dmesa_register_swrast_functions(c); + if (((GLvisual *)visual)->rgbMode) dmesa_register_swrast_functions(c); dmesa_init_pointers(c); _swsetup_Wakeup(c); } @@ -1212,19 +1206,16 @@ GLboolean DMesaMoveBuffer (GLint xpos, GLint ypos) { #ifndef FX GET_CURRENT_CONTEXT(ctx); - DMesaBuffer b = ((DMesaContext)ctx)->Buffer; + DMesaBuffer b = ((DMesaContext)ctx)->buffer; - if (vl_sync_buffer(&b->the_window, xpos, ypos, b->width, b->height) != 0) { - return GL_FALSE; - } else { + if (vl_sync_buffer(&b->the_window, xpos, ypos, b->width, b->height) == 0) { b->xpos = xpos; b->ypos = ypos; return GL_TRUE; } +#endif -#else return GL_FALSE; -#endif } @@ -1233,19 +1224,16 @@ GLboolean DMesaResizeBuffer (GLint width, GLint height) { #ifndef FX GET_CURRENT_CONTEXT(ctx); - DMesaBuffer b = ((DMesaContext)ctx)->Buffer; + DMesaBuffer b = ((DMesaContext)ctx)->buffer; - if (vl_sync_buffer(&b->the_window, b->xpos, b->ypos, width, height) != 0) { - return GL_FALSE; - } else { + if (vl_sync_buffer(&b->the_window, b->xpos, b->ypos, width, height) == 0) { b->width = width; b->height = height; return GL_TRUE; } +#endif -#else return GL_FALSE; -#endif } @@ -1261,7 +1249,7 @@ GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b) return GL_FALSE; } - c->Buffer = b; + c->buffer = b; _mesa_make_current((GLcontext *)c, (GLframebuffer *)b); if (((GLcontext *)c)->Viewport.Width == 0) { @@ -1391,6 +1379,21 @@ int DMesaGetIntegerv (GLenum pname, GLint *params) return n; } #endif + case DMESA_GET_BUFFER_ADDR: + #ifndef FX + { + DMesaContext c = (DMesaContext)DMesaGetCurrentContext(); + if (c != NULL) { + DMesaBuffer b = c->buffer; + if (b != NULL) { + params[0] = (GLint)b->the_window; + } + } + } + #else + return -1; + #endif + break; default: return -1; } |