void gld_Points3D_DX8( GLcontext *ctx, GLuint first, GLuint last) { GLD_SETUP_3D_VARS_POINTS unsigned i; // struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; // _Size is already clamped to MaxPointSize and MinPointSize IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size)); if (VB->Elts) { for (i=first; i<last; i++, pV++) { if (VB->ClipMask[VB->Elts[i]] == 0) { // _swrast_Point( ctx, &verts[VB->Elts[i]] ); // GLD_SETUP_GET_SWVERT(VB->Elts[i]); GLD_SETUP_3D_VERTEX(VB->Elts[i]) GLD_SETUP_SMOOTH_COLOUR_3D(i) GLD_SETUP_TEX0_3D(i) GLD_SETUP_TEX1_3D(i) } } } else { // GLD_SETUP_GET_SWVERT(first); for (i=first; i<last; i++, pV++) {
void gld_Points2D_DX8( GLcontext *ctx, GLuint first, GLuint last) { GLD_SETUP_2D_VARS_POINTS; unsigned i; struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; // _Size is already clamped to MaxPointSize and MinPointSize IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size)); if (VB->Elts) { for (i=first; i<last; i++, pV++) { if (VB->ClipMask[VB->Elts[i]] == 0) { // _swrast_Point( ctx, &verts[VB->Elts[i]] ); GLD_SETUP_GET_SWVERT(VB->Elts[i]); GLD_SETUP_2D_VERTEX; GLD_SETUP_SMOOTH_COLOUR; GLD_SETUP_DEPTH; GLD_SETUP_SPECULAR; GLD_SETUP_TEX0; GLD_SETUP_TEX1; } } } else { GLD_SETUP_GET_SWVERT(first); for (i=first; i<last; i++, swv++, pV++) { if (VB->ClipMask[i] == 0) { // _swrast_Point( ctx, &verts[i] ); GLD_SETUP_2D_VERTEX; GLD_SETUP_SMOOTH_COLOUR; GLD_SETUP_DEPTH; GLD_SETUP_SPECULAR; GLD_SETUP_TEX0; GLD_SETUP_TEX1; } } } gld->PB2d.pPoints = (BYTE*)pV; gld->PB2d.nPoints += (last-first); }
BOOL gldInitialiseMesa_DX( DGL_ctx *lpCtx) { GLD_driver_dx8 *gld = NULL; int MaxTextureSize, TextureLevels; BOOL bSoftwareTnL; if (lpCtx == NULL) return FALSE; gld = lpCtx->glPriv; if (gld == NULL) return FALSE; if (glb.bMultitexture) { lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps8.MaxSimultaneousTextures; // Only support MAX_TEXTURE_UNITS texture units. // ** If this is altered then the FVF formats must be reviewed **. if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX8) lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX8; } else { // Multitexture override lpCtx->glCtx->Const.MaxTextureUnits = 1; } // max texture size MaxTextureSize = min(gld->d3dCaps8.MaxTextureHeight, gld->d3dCaps8.MaxTextureWidth); if (MaxTextureSize == 0) MaxTextureSize = 256; // Sanity check // // HACK!! if (MaxTextureSize > 1024) MaxTextureSize = 1024; // HACK - CLAMP TO 1024 // HACK!! // // Got to set MAX_TEXTURE_SIZE as max levels. // Who thought this stupid idea up? ;) TextureLevels = 0; // Calculate power-of-two. while (MaxTextureSize) { TextureLevels++; MaxTextureSize >>= 1; } lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8; lpCtx->glCtx->Const.MaxDrawBuffers = 1; IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_LIGHTING, FALSE); IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE); IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_DITHERENABLE, TRUE); IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SHADEMODE, D3DSHADE_GOURAUD); IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ZENABLE, (lpCtx->lpPF->dwDriverData!=D3DFMT_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE); // Set the view matrix { D3DXMATRIX vm; #if 1 D3DXMatrixIdentity(&vm); #else D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f); D3DXVECTOR3 At(0.0f, 0.0f, -1.0f); D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f); D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up); vm._31 = -vm._31; vm._32 = -vm._32; vm._33 = -vm._33; vm._34 = -vm._34; #endif IDirect3DDevice8_SetTransform(gld->pDev, D3DTS_VIEW, &vm); } if (gld->bHasHWTnL) { if (glb.dwTnL == GLDS_TNL_DEFAULT) bSoftwareTnL = FALSE; // HW TnL else { bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE; } } else { // No HW TnL, so no choice possible bSoftwareTnL = TRUE; } IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL); // Dump this in a Release build as well, now. //#ifdef _DEBUG ddlogPrintf(DDLOG_INFO, "HW TnL: %s", gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable"); //#endif gldEnableExtensions_DX8(lpCtx->glCtx); gldInstallPipeline_DX8(lpCtx->glCtx); gldSetupDriverPointers_DX8(lpCtx->glCtx); // Signal a complete state update lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL); // Start a scene IDirect3DDevice8_BeginScene(gld->pDev); lpCtx->bSceneStarted = TRUE; return TRUE; }