/* * File name : wmesa.c * Version : 2.0 * * Display driver for Mesa 2.0 under * Windows95, WindowsNT and Win32 * * Copyright (C) 1996- Li Wei * Address : Institute of Artificial Intelligence * : & Robotics * : Xi'an Jiaotong University * Email : liwei@aiar.xjtu.edu.cn * Web page : http://sun.aiar.xjtu.edu.cn * * This file and its associations are partially based on the * Windows NT driver for Mesa, written by Mark Leaming * (mark@rsinc.com). */ /* * $Log: wmesa.c,v $ * Revision 2.0 1996/11/15 10:53:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn) * Initial revision * */ /* NOTE: * This driver also support stereo feature and parallel feature * If the above two features are desired, several other files * are needed and the definition of macro * NO_STEREO and * NO_PARALLEL * should be removed or commented */ #define NO_PARALLEL #define NO_STEREO #define WMESA_STEREO_C #include #include #include #include #include #include "context.h" #include "dd.h" #include "xform.h" #include "vb.h" #include "matrix.h" #include "depth.h" #ifdef PROFILE #include "profile.h" #endif #include /*#include "mesa_extend.h"*/ #if !defined(NO_STEREO) #include "gl\glu.h" #include "stereo.h" PBYTE Buffer_Stereo; void WMesaCreateStereoBuffer(void); void WMesaInterleave( GLenum aView); void WMesaDestroyStereoBuffer(void); void WMesaShowStereo(GLuint list); #endif #if !defined(NO_PARALLEL) #include "parallel.h" #endif /* end of added code*/ /* Bit's used for dest: */ #define FRONT_PIXMAP 1 #define BACK_PIXMAP 2 #define BACK_XIMAGE 4 static PWMC Current = NULL; WMesaContext WC = NULL; #ifdef NDEBUG #define assert(ignore) ((void) 0) #else void Mesa_Assert(void *Cond,void *File,unsigned Line) { char Msg[512]; sprintf(Msg,"%s %s %d",Cond,File,Line); MessageBox(NULL,Msg,"Assertion failed.",MB_OK); exit(1); } #define assert(e) if (!e) Mesa_Assert(#e,__FILE__,__LINE__); #endif #define DD_GETDC ((Current->db_flag) ? Current->dib.hDC : Current->hDC ) #define DD_RELEASEDC //#define BEGINGDICALL if(Current->rgb_flag)wmFlushBits(Current); #define BEGINGDICALL //#define ENDGDICALL if(Current->rgb_flag)wmGetBits(Current); #define ENDGDICALL #define FLIP(Y) (Current->height-(Y)-1) #define STARTPROFILE #define ENDPROFILE(PARA) /**********************************************************************/ /***** Optimized triangle rendering *****/ /**********************************************************************/ /* * Smooth-shaded, z-less triangle, RGBA color. */ static void smooth_color_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv ) { UINT nBypp = Current->cColorBits / 8; GLbyte* img; GLushort* img16; GLuint *img24 ,*img32; #define INTERP_Z 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint i, len = RIGHT-LEFT; \ img = PIXELADDR(LEFT,Y); \ for (i=0;i