summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/allegro/amesa.c414
-rw-r--r--src/mesa/drivers/allegro/amesa.h65
-rw-r--r--src/mesa/drivers/allegro/direct.h189
-rw-r--r--src/mesa/drivers/allegro/generic.h234
-rw-r--r--src/mesa/drivers/beos/GLView.cpp4
-rw-r--r--src/mesa/drivers/common/driverfuncs.c6
-rw-r--r--src/mesa/drivers/common/meta.c51
-rw-r--r--src/mesa/drivers/d3d/D3DCAPS.CPP250
-rw-r--r--src/mesa/drivers/d3d/D3DHAL.H68
-rw-r--r--src/mesa/drivers/d3d/D3DInit.cpp891
-rw-r--r--src/mesa/drivers/d3d/D3DMESA.H84
-rw-r--r--src/mesa/drivers/d3d/D3DRaster.cpp213
-rw-r--r--src/mesa/drivers/d3d/D3DShared.h154
-rw-r--r--src/mesa/drivers/d3d/D3DTEXT.CPP576
-rw-r--r--src/mesa/drivers/d3d/D3DTextureMgr.cpp947
-rw-r--r--src/mesa/drivers/d3d/D3DTextureMgr.h62
-rw-r--r--src/mesa/drivers/d3d/D3DUTILS.CPP638
-rw-r--r--src/mesa/drivers/d3d/D3Dvbrender.c2149
-rw-r--r--src/mesa/drivers/d3d/DDrawPROCS.c399
-rw-r--r--src/mesa/drivers/d3d/DEBUG.C143
-rw-r--r--src/mesa/drivers/d3d/DEBUG.H90
-rw-r--r--src/mesa/drivers/d3d/DbgEnv.bat25
-rw-r--r--src/mesa/drivers/d3d/MAKEFILE101
-rw-r--r--src/mesa/drivers/d3d/NULLProcs.h49
-rw-r--r--src/mesa/drivers/d3d/NullProcs.c49
-rw-r--r--src/mesa/drivers/d3d/OPENGL32.DEF442
-rw-r--r--src/mesa/drivers/d3d/WGL.C1262
-rw-r--r--src/mesa/drivers/d3d/d3dText.h53
-rw-r--r--src/mesa/drivers/directfb/Makefile67
-rw-r--r--src/mesa/drivers/directfb/idirectfbgl_mesa.c982
-rw-r--r--src/mesa/drivers/dos/blit.S1040
-rw-r--r--src/mesa/drivers/dos/dmesa.c359
-rw-r--r--src/mesa/drivers/dos/dpmi.c166
-rw-r--r--src/mesa/drivers/dos/internal.h105
-rw-r--r--src/mesa/drivers/dos/null.c224
-rw-r--r--src/mesa/drivers/dos/null.h41
-rw-r--r--src/mesa/drivers/dos/vesa.c719
-rw-r--r--src/mesa/drivers/dos/vesa.h65
-rw-r--r--src/mesa/drivers/dos/vga.c289
-rw-r--r--src/mesa/drivers/dos/vga.h42
-rw-r--r--src/mesa/drivers/dos/video.c442
-rw-r--r--src/mesa/drivers/dos/video.h56
-rw-r--r--src/mesa/drivers/dri/Makefile.template24
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c38
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h1
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.c12
-rw-r--r--src/mesa/drivers/dri/common/spantmp.h23
-rw-r--r--src/mesa/drivers/dri/common/spantmp2.h23
-rw-r--r--src/mesa/drivers/dri/common/utils.c31
-rw-r--r--src/mesa/drivers/dri/fb/Doxyfile232
-rw-r--r--src/mesa/drivers/dri/fb/Makefile24
-rw-r--r--src/mesa/drivers/dri/fb/fb_dri.c794
-rw-r--r--src/mesa/drivers/dri/ffb/Makefile35
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_bitmap.c158
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_bitmap.h7
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_clear.c335
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_clear.h6
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_context.h305
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_dd.c115
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_dd.h36
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_depth.c243
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_depth.h7
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_fifo.h27
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_fog.c73
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_lines.c107
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_lines.h17
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_linetmp.h80
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_lock.h36
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_points.c91
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_points.h14
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_pointtmp.h54
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_rendertmp.h645
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_span.c127
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_span.h9
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_state.c1222
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_state.h12
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_stencil.c224
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_stencil.h7
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_tex.c35
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_tex.h34
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_tris.c945
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_tris.h25
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_tritmp.h238
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_vb.c207
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_vb.h44
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_vbtmp.h150
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_vtxfmt.c414
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_vtxfmt.h7
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_xmesa.c729
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_xmesa.h25
-rw-r--r--src/mesa/drivers/dri/ffb/server/ffb_dac.h366
-rw-r--r--src/mesa/drivers/dri/ffb/server/ffb_drishare.h47
-rw-r--r--src/mesa/drivers/dri/ffb/server/ffb_regs.h508
-rw-r--r--src/mesa/drivers/dri/gamma/Makefile34
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_client.h6184
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_context.c228
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_context.h402
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_dd.c109
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_inithw.c550
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_lock.c60
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_lock.h84
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_macros.h323
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_regs.h658
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_render.c220
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_screen.c147
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_screen.h30
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_span.c314
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_state.c1722
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_tex.c434
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_texmem.c534
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_texstate.c215
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_tris.c659
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_tris.h36
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_tritmp.h496
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_vb.c361
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_vb.h60
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_xmesa.c272
-rw-r--r--src/mesa/drivers/dri/gamma/server/glint_common.h63
-rw-r--r--src/mesa/drivers/dri/gamma/server/glint_dri.h122
-rw-r--r--src/mesa/drivers/dri/i810/Makefile3
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c6
-rw-r--r--src/mesa/drivers/dri/i810/i810texmem.c1
-rw-r--r--src/mesa/drivers/dri/i810/i810tris.c1
-rw-r--r--src/mesa/drivers/dri/i810/i810vb.c4
-rw-r--r--src/mesa/drivers/dri/i810/server/i810_dri.c975
-rw-r--r--src/mesa/drivers/dri/i915/Makefile2
-rw-r--r--src/mesa/drivers/dri/i915/i830_context.h3
-rw-r--r--src/mesa/drivers/dri/i915/i830_texstate.c49
-rw-r--r--src/mesa/drivers/dri/i915/i830_vtbl.c43
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.h1
-rw-r--r--src/mesa/drivers/dri/i915/i915_debug.c178
-rw-r--r--src/mesa/drivers/dri/i915/i915_debug_fp.c80
-rw-r--r--src/mesa/drivers/dri/i915/i915_tex_layout.c4
-rw-r--r--src/mesa/drivers/dri/i915/i915_texstate.c36
-rw-r--r--src/mesa/drivers/dri/i915/i915_vtbl.c51
-rw-r--r--src/mesa/drivers/dri/i915/intel_tris.c16
l---------src/mesa/drivers/dri/i915/server/intel_dri.c1
-rw-r--r--src/mesa/drivers/dri/i965/Makefile14
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h20
-rw-r--r--src/mesa/drivers/dri/i965/brw_curbe.c37
-rw-r--r--src/mesa/drivers/dri/i965/brw_defines.h252
-rw-r--r--src/mesa/drivers/dri/i965/brw_disasm.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c113
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_debug.c14
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_emit.c86
-rw-r--r--src/mesa/drivers/dri/i965/brw_misc_state.c109
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c14
-rw-r--r--src/mesa/drivers/dri/i965/brw_queryobj.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf.c21
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf.h6
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_emit.c135
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h17
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_batch.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_cache.c21
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_upload.c96
-rw-r--r--src/mesa/drivers/dri/i965/brw_structs.h114
-rw-r--r--src/mesa/drivers/dri/i965/brw_urb.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_emit.c114
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_vtbl.c15
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_debug.c68
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_emit.c12
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_fp.c14
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_glsl.c154
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_pass0.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c16
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c131
-rw-r--r--src/mesa/drivers/dri/i965/gen6_cc.c296
-rw-r--r--src/mesa/drivers/dri/i965/gen6_clip_state.c75
-rw-r--r--src/mesa/drivers/dri/i965/gen6_depthstencil.c165
-rw-r--r--src/mesa/drivers/dri/i965/gen6_gs_state.c91
-rw-r--r--src/mesa/drivers/dri/i965/gen6_sampler_state.c71
-rw-r--r--src/mesa/drivers/dri/i965/gen6_scissor_state.c105
-rw-r--r--src/mesa/drivers/dri/i965/gen6_sf_state.c187
-rw-r--r--src/mesa/drivers/dri/i965/gen6_urb.c83
-rw-r--r--src/mesa/drivers/dri/i965/gen6_viewport_state.c173
-rw-r--r--src/mesa/drivers/dri/i965/gen6_vs_state.c119
-rw-r--r--src/mesa/drivers/dri/i965/gen6_wm_state.c160
l---------src/mesa/drivers/dri/i965/server/intel_dri.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.c39
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.h82
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c67
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c154
-rw-r--r--src/mesa/drivers/dri/intel/intel_chipset.h14
-rw-r--r--src/mesa/drivers/dri/intel/intel_clear.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c25
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h23
-rw-r--r--src/mesa/drivers/dri/intel/intel_decode.c10
-rw-r--r--src/mesa/drivers/dri/intel/intel_depthtmp.h64
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c48
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.h3
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c11
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c8
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_read.c14
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c47
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.h8
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c122
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.h1
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c509
-rw-r--r--src/mesa/drivers/dri/intel/intel_spantmp.h67
-rw-r--r--src/mesa/drivers/dri/intel/intel_syncobj.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.h2
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c75
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_obj.h4
-rw-r--r--src/mesa/drivers/dri/intel/server/intel_dri.c1306
-rw-r--r--src/mesa/drivers/dri/mach64/Makefile3
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_context.c4
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_state.c2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_texmem.c3
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_tris.c1
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_vb.c4
-rw-r--r--src/mesa/drivers/dri/mga/Makefile2
-rw-r--r--src/mesa/drivers/dri/mga/mgapixel.c2
-rw-r--r--src/mesa/drivers/dri/mga/mgastate.c3
-rw-r--r--src/mesa/drivers/dri/mga/mgatexmem.c1
-rw-r--r--src/mesa/drivers/dri/mga/mgatris.c1
-rw-r--r--src/mesa/drivers/dri/mga/mgavb.c4
-rw-r--r--src/mesa/drivers/dri/mga/server/mga_dri.c1088
-rw-r--r--src/mesa/drivers/dri/nouveau/Makefile3
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c104
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.h13
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_driver.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_driver.h2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_fbo.c7
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c8
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_span.c11
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_state.c12
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_state.h1
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_texture.c402
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_texture.h8
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_util.h18
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c73
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_context.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_fb.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_frag.c76
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_raster.c23
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_tex.c7
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_surface.c134
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_context.c8
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_driver.h11
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_fb.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_frag.c240
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_raster.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tex.c45
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tnl.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_context.c18
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_driver.h7
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_fb.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_frag.c73
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tex.c52
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tnl.c2
-rw-r--r--src/mesa/drivers/dri/r128/Makefile2
-rw-r--r--src/mesa/drivers/dri/r128/r128_state.c2
-rw-r--r--src/mesa/drivers/dri/r128/r128_texmem.c1
-rw-r--r--src/mesa/drivers/dri/r128/r128_tris.c1
-rw-r--r--src/mesa/drivers/dri/r128/server/r128_dri.c1112
-rw-r--r--src/mesa/drivers/dri/r200/Makefile7
-rw-r--r--src/mesa/drivers/dri/r200/r200_blit.c17
-rw-r--r--src/mesa/drivers/dri/r200/r200_blit.h2
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_ioctl.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_swtcl.c1
l---------src/mesa/drivers/dri/r200/radeon_pixel_read.c1
l---------src/mesa/drivers/dri/r200/radeon_tex_getimage.c1
l---------src/mesa/drivers/dri/r200/radeon_tile.c1
l---------src/mesa/drivers/dri/r200/radeon_tile.h1
l---------src/mesa/drivers/dri/r200/server/radeon_dri.c1
-rw-r--r--src/mesa/drivers/dri/r300/Makefile9
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_blit.c41
-rw-r--r--src/mesa/drivers/dri/r300/r300_blit.h4
-rw-r--r--src/mesa/drivers/dri/r300/r300_cmdbuf.c56
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c13
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h1
-rw-r--r--src/mesa/drivers/dri/r300/r300_draw.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c8
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_shader.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c99
-rw-r--r--src/mesa/drivers/dri/r300/r300_swtcl.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.c39
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.h3
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c13
l---------src/mesa/drivers/dri/r300/radeon_pixel_read.c1
l---------src/mesa/drivers/dri/r300/radeon_tex_getimage.c1
l---------src/mesa/drivers/dri/r300/radeon_tile.c1
l---------src/mesa/drivers/dri/r300/radeon_tile.h1
l---------src/mesa/drivers/dri/r300/server/radeon_dri.c1
-rw-r--r--src/mesa/drivers/dri/r600/Makefile9
-rw-r--r--src/mesa/drivers/dri/r600/r600_blit.c22
-rw-r--r--src/mesa/drivers/dri/r600/r600_blit.h33
-rw-r--r--src/mesa/drivers/dri/r600/r600_context.c12
-rw-r--r--src/mesa/drivers/dri/r600/r600_texstate.c28
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.c4
-rw-r--r--src/mesa/drivers/dri/r600/r700_chip.c2
-rw-r--r--src/mesa/drivers/dri/r600/r700_oglprog.c2
-rw-r--r--src/mesa/drivers/dri/r600/r700_render.c24
-rw-r--r--src/mesa/drivers/dri/r600/r700_state.c6
-rw-r--r--src/mesa/drivers/dri/r600/r700_vertprog.c2
l---------src/mesa/drivers/dri/r600/radeon_pixel_read.c1
l---------src/mesa/drivers/dri/r600/radeon_tex_getimage.c1
l---------src/mesa/drivers/dri/r600/radeon_tile.c1
l---------src/mesa/drivers/dri/r600/radeon_tile.h1
l---------src/mesa/drivers/dri/r600/server/radeon_dri.c1
-rw-r--r--src/mesa/drivers/dri/radeon/Makefile7
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_blit.c17
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_blit.h2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_buffer_objects.c8
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_chipset.h1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common.c5
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common.h6
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common_context.h2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_dma.c16
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c134
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_ioctl.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c74
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h9
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_pixel_read.c188
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_queryobj.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_swtcl.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tex_copy.c49
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tex_getimage.c95
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c83
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.h2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tile.c512
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tile.h38
-rw-r--r--src/mesa/drivers/dri/radeon/server/radeon_dri.c1337
-rw-r--r--src/mesa/drivers/dri/savage/Makefile3
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c16
-rw-r--r--src/mesa/drivers/dri/savage/savagetex.c5
-rw-r--r--src/mesa/drivers/dri/savage/savagetris.c1
-rw-r--r--src/mesa/drivers/dri/sis/Makefile4
-rw-r--r--src/mesa/drivers/dri/sis/sis_tris.c2
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c81
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_priv.h13
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_span.c50
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_spantemp.h16
-rw-r--r--src/mesa/drivers/dri/tdfx/Makefile3
-rw-r--r--src/mesa/drivers/dri/tdfx/server/tdfx_dri.c471
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_pixels.c6
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_screen.c2
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_span.c6
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_tex.c4
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_texstate.c8
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_tris.c1
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_vb.c4
-rw-r--r--src/mesa/drivers/dri/unichrome/Makefile2
-rw-r--r--src/mesa/drivers/dri/unichrome/server/via_dri.c1251
-rw-r--r--src/mesa/drivers/dri/unichrome/via_fb.c6
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.c4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tris.c1
-rw-r--r--src/mesa/drivers/fbdev/glfbdev.c150
-rw-r--r--src/mesa/drivers/ggi/default/.gitignore1
-rw-r--r--src/mesa/drivers/ggi/default/genkgi.conf.in4
-rw-r--r--src/mesa/drivers/ggi/default/genkgi.h76
-rw-r--r--src/mesa/drivers/ggi/default/genkgi_mode.c97
-rw-r--r--src/mesa/drivers/ggi/default/genkgi_visual.c190
-rw-r--r--src/mesa/drivers/ggi/default/linear.c409
-rw-r--r--src/mesa/drivers/ggi/default/linear_15.c36
-rw-r--r--src/mesa/drivers/ggi/default/linear_16.c36
-rw-r--r--src/mesa/drivers/ggi/default/linear_24.c36
-rw-r--r--src/mesa/drivers/ggi/default/linear_32.c36
-rw-r--r--src/mesa/drivers/ggi/default/linear_8.c36
-rw-r--r--src/mesa/drivers/ggi/default/stubs.c512
-rw-r--r--src/mesa/drivers/ggi/display/.gitignore1
-rw-r--r--src/mesa/drivers/ggi/display/fbdev.conf.in4
-rw-r--r--src/mesa/drivers/ggi/display/fbdev_mode.c130
-rw-r--r--src/mesa/drivers/ggi/display/fbdev_visual.c138
-rw-r--r--src/mesa/drivers/ggi/ggimesa.c670
-rw-r--r--src/mesa/drivers/ggi/ggimesa.conf.in13
-rw-r--r--src/mesa/drivers/ggi/include/ggi/mesa/debug.h260
-rw-r--r--src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h20
-rw-r--r--src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h84
-rw-r--r--src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h44
-rw-r--r--src/mesa/drivers/glide/fxapi.c951
-rw-r--r--src/mesa/drivers/glide/fxdd.c2197
-rw-r--r--src/mesa/drivers/glide/fxddspan.c638
-rw-r--r--src/mesa/drivers/glide/fxddtex.c1836
-rw-r--r--src/mesa/drivers/glide/fxdrv.h773
-rw-r--r--src/mesa/drivers/glide/fxg.c2309
-rw-r--r--src/mesa/drivers/glide/fxg.h382
-rw-r--r--src/mesa/drivers/glide/fxglidew.c269
-rw-r--r--src/mesa/drivers/glide/fxglidew.h228
-rw-r--r--src/mesa/drivers/glide/fxsetup.c2220
-rw-r--r--src/mesa/drivers/glide/fxsetup.h850
-rw-r--r--src/mesa/drivers/glide/fxtexman.c874
-rw-r--r--src/mesa/drivers/glide/fxtris.c1832
-rw-r--r--src/mesa/drivers/glide/fxvb.c838
-rw-r--r--src/mesa/drivers/glide/fxvbtmp.h370
-rw-r--r--src/mesa/drivers/glslcompiler/glslcompiler.c8
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c92
-rw-r--r--src/mesa/drivers/svga/svgamesa.c516
-rw-r--r--src/mesa/drivers/svga/svgamesa15.c220
-rw-r--r--src/mesa/drivers/svga/svgamesa15.h42
-rw-r--r--src/mesa/drivers/svga/svgamesa16.c218
-rw-r--r--src/mesa/drivers/svga/svgamesa16.h43
-rw-r--r--src/mesa/drivers/svga/svgamesa24.c242
-rw-r--r--src/mesa/drivers/svga/svgamesa24.h43
-rw-r--r--src/mesa/drivers/svga/svgamesa32.c223
-rw-r--r--src/mesa/drivers/svga/svgamesa32.h43
-rw-r--r--src/mesa/drivers/svga/svgamesa8.c196
-rw-r--r--src/mesa/drivers/svga/svgamesa8.h43
-rw-r--r--src/mesa/drivers/svga/svgapix.h70
-rw-r--r--src/mesa/drivers/windows/gdi/mesa.def8
-rw-r--r--src/mesa/drivers/windows/gdi/wmesa.c12
-rw-r--r--src/mesa/drivers/windows/gldirect/dglcontext.c2
-rw-r--r--src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c16
-rw-r--r--src/mesa/drivers/windows/icd/mesa.def6
-rw-r--r--src/mesa/drivers/x11/fakeglx.c389
-rw-r--r--src/mesa/drivers/x11/xfonts.c2
-rw-r--r--src/mesa/drivers/x11/xm_api.c163
-rw-r--r--src/mesa/drivers/x11/xm_buffer.c22
-rw-r--r--src/mesa/drivers/x11/xm_dd.c46
-rw-r--r--src/mesa/drivers/x11/xm_tri.c92
428 files changed, 6340 insertions, 69488 deletions
diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c
deleted file mode 100644
index 0744677d2bd..00000000000
--- a/src/mesa/drivers/allegro/amesa.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.0
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <allegro.h>
-#include "main/buffers.h"
-#include "main/context.h"
-#include "main/imports.h"
-#include "main/matrix.h"
-#include "main/mtypes.h"
-#include "amesa.h"
-
-
-struct amesa_visual
- {
- GLvisual *GLVisual; /* inherit from GLvisual */
- GLboolean DBFlag; /* double buffered? */
- GLuint Depth; /* bits per pixel ( >= 15 ) */
- };
-
-
-struct amesa_buffer
- {
- GLframebuffer *GLBuffer; /* inherit from GLframebuffer */
- GLuint Width, Height;
- BITMAP *Screen;
- BITMAP *Background;
- BITMAP *Active;
- };
-
-
-struct amesa_context
- {
- GLcontext *GLContext; /* inherit from GLcontext */
- AMesaVisual Visual;
- AMesaBuffer Buffer;
- GLuint ClearColor;
- GLuint CurrentColor;
- };
-
-
-static void setup_dd_pointers(GLcontext *ctx);
-
-
-/**********************************************************************/
-/***** drawing functions *****/
-/**********************************************************************/
-
-#define FLIP(context, y) (context->Buffer->Height - (y) - 1)
-
-#include "allegro/generic.h"
-#include "allegro/direct.h"
-
-
-/**********************************************************************/
-/***** 15-bit accelerated drawing funcs *****/
-/**********************************************************************/
-
-IMPLEMENT_WRITE_RGBA_SPAN(15, unsigned short)
-IMPLEMENT_WRITE_RGB_SPAN(15, unsigned short)
-IMPLEMENT_WRITE_MONO_RGBA_SPAN(15, unsigned short)
-IMPLEMENT_READ_RGBA_SPAN(15, unsigned short)
-IMPLEMENT_WRITE_RGBA_PIXELS(15, unsigned short)
-IMPLEMENT_WRITE_MONO_RGBA_PIXELS(15, unsigned short)
-IMPLEMENT_READ_RGBA_PIXELS(15, unsigned short)
-
-
-/**********************************************************************/
-/***** 16-bit accelerated drawing funcs *****/
-/**********************************************************************/
-
-IMPLEMENT_WRITE_RGBA_SPAN(16, unsigned short)
-IMPLEMENT_WRITE_RGB_SPAN(16, unsigned short)
-IMPLEMENT_WRITE_MONO_RGBA_SPAN(16, unsigned short)
-IMPLEMENT_READ_RGBA_SPAN(16, unsigned short)
-IMPLEMENT_WRITE_RGBA_PIXELS(16, unsigned short)
-IMPLEMENT_WRITE_MONO_RGBA_PIXELS(16, unsigned short)
-IMPLEMENT_READ_RGBA_PIXELS(16, unsigned short)
-
-
-/**********************************************************************/
-/***** 32-bit accelerated drawing funcs *****/
-/**********************************************************************/
-
-IMPLEMENT_WRITE_RGBA_SPAN(32, unsigned long)
-IMPLEMENT_WRITE_RGB_SPAN(32, unsigned long)
-IMPLEMENT_WRITE_MONO_RGBA_SPAN(32, unsigned long)
-IMPLEMENT_READ_RGBA_SPAN(32, unsigned long)
-IMPLEMENT_WRITE_RGBA_PIXELS(32, unsigned long)
-IMPLEMENT_WRITE_MONO_RGBA_PIXELS(32, unsigned long)
-IMPLEMENT_READ_RGBA_PIXELS(32, unsigned long)
-
-
-/**********************************************************************/
-/***** Miscellaneous device driver funcs *****/
-/**********************************************************************/
-
-static GLboolean set_buffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bit)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- GLboolean ok = GL_TRUE;
-
- if (bit == DD_FRONT_LEFT_BIT)
- context->Buffer->Active = context->Buffer->Screen;
-
- else if (bit == DD_BACK_LEFT)
- {
- if (context->Buffer->Background)
- context->Buffer->Active = context->Buffer->Background;
- else
- ok = GL_FALSE;
- }
-
- else
- ok = GL_FALSE;
-
- return ok;
- }
-
-
-static void get_buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
-
- *width = context->Buffer->Width;
- *height = context->Buffer->Height;
- }
-
-
-/**
- * We only implement this function as a mechanism to check if the
- * framebuffer size has changed (and update corresponding state).
- */
-static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- /* poll for window size change and realloc software Z/stencil/etc if needed */
- GLuint newWidth, newHeight;
- GLframebuffer *buffer = ctx->WinSysDrawBuffer;
- get_buffer_size( &newWidth, &newHeight );
- if (buffer->Width != newWidth || buffer->Height != newHeight) {
- _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight );
- }
-
-}
-
-
-/**********************************************************************/
-/**********************************************************************/
-
-static void setup_dd_pointers(GLcontext *ctx)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
-
- /* Initialize all the pointers in the driver struct. Do this whenever */
- /* a new context is made current or we change buffers via set_buffer! */
-
- ctx->Driver.UpdateState = setup_dd_pointers;
- ctx->Driver.SetBuffer = set_buffer;
- ctx->Driver.GetBufferSize = get_buffer_size;
- ctx->Driver.Viewport = viewport;
-
- ctx->Driver.Color = set_color_generic;
- ctx->Driver.ClearColor = clear_color_generic;
- ctx->Driver.Clear = clear_generic;
- ctx->Driver.WriteRGBASpan = write_rgba_span_generic;
- ctx->Driver.WriteRGBSpan = write_rgb_span_generic;
- ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_generic;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_generic;
- ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_generic;
- ctx->Driver.ReadRGBASpan = read_rgba_span_generic;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels_generic;
-
- if (context->Buffer->Active != screen)
- {
- switch (context->Visual->Depth)
- {
- case 15:
- ctx->Driver.WriteRGBASpan = write_rgba_span_15;
- ctx->Driver.WriteRGBSpan = write_rgb_span_15;
- ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_15;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_15;
- ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_15;
- ctx->Driver.ReadRGBASpan = read_rgba_span_15;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels_15;
- break;
-
- case 16:
- ctx->Driver.WriteRGBASpan = write_rgba_span_16;
- ctx->Driver.WriteRGBSpan = write_rgb_span_16;
- ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_16;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_16;
- ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_16;
- ctx->Driver.ReadRGBASpan = read_rgba_span_16;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels_16;
- break;
-
- case 32:
- ctx->Driver.WriteRGBASpan = write_rgba_span_32;
- ctx->Driver.WriteRGBSpan = write_rgb_span_32;
- ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_32;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_32;
- ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_32;
- ctx->Driver.ReadRGBASpan = read_rgba_span_32;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels_32;
- break;
- }
- }
- }
-
-
-/**********************************************************************/
-/***** AMesa Public API Functions *****/
-/**********************************************************************/
-
-
-AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth,
- GLint depthSize, GLint stencilSize, GLint accumSize)
- {
- AMesaVisual visual;
- GLbyte redBits, greenBits, blueBits;
-
- visual = (AMesaVisual)calloc(1, sizeof(struct amesa_visual));
- if (!visual)
- return NULL;
-
- switch (depth)
- {
- case 15:
- redBits = 5;
- greenBits = 5;
- blueBits = 5;
- break;
-
- case 16:
- redBits = 5;
- greenBits = 6;
- blueBits = 5;
- break;
-
- case 24: case 32:
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
- break;
-
- default:
- free(visual);
- return NULL;
- }
-
- visual->DBFlag = dbFlag;
- visual->Depth = depth;
- visual->GLVisual = _mesa_create_visual(GL_TRUE, /* rgb mode */
- dbFlag, /* db_flag */
- GL_FALSE, /* stereo */
- redBits, greenBits, blueBits, 8,
- 0, /* index bits */
- depthSize, /* depth bits */
- stencilSize,/* stencil bits */
- accumSize, /* accum bits */
- accumSize, /* accum bits */
- accumSize, /* accum bits */
- accumSize, /* accum bits */
- 1 );
- if (!visual->GLVisual)
- {
- free(visual);
- return NULL;
- }
-
- return visual;
- }
-
-
-void AMesaDestroyVisual(AMesaVisual visual)
- {
- _mesa_destroy_visual(visual->GLVisual);
- free(visual);
- }
-
-
-AMesaBuffer AMesaCreateBuffer(AMesaVisual visual,
- GLint width, GLint height)
- {
- AMesaBuffer buffer;
-
- buffer = (AMesaBuffer)calloc(1, sizeof(struct amesa_buffer));
- if (!buffer)
- return NULL;
-
- buffer->Screen = NULL;
- buffer->Background = NULL;
- buffer->Active = NULL;
- buffer->Width = width;
- buffer->Height = height;
-
- if (visual->DBFlag)
- {
- buffer->Background = create_bitmap_ex(visual->Depth, width, height);
- if (!buffer->Background)
- {
- free(buffer);
- return NULL;
- }
- }
-
- buffer->GLBuffer = _mesa_create_framebuffer(visual->GLVisual);
- if (!buffer->GLBuffer)
- {
- if (buffer->Background) destroy_bitmap(buffer->Background);
- free(buffer);
- return NULL;
- }
-
- return buffer;
- }
-
-
-void AMesaDestroyBuffer(AMesaBuffer buffer)
-{
- if (buffer->Screen) destroy_bitmap(buffer->Screen);
- if (buffer->Background) destroy_bitmap(buffer->Background);
- _mesa_reference_framebuffer(&buffer->GLBuffer, NULL);
- free(buffer);
-}
-
-
-AMesaContext AMesaCreateContext(AMesaVisual visual,
- AMesaContext share)
-{
- AMesaContext context;
- GLboolean direct = GL_FALSE;
-
- context = (AMesaContext)calloc(1, sizeof(struct amesa_context));
- if (!context)
- return NULL;
-
- context->Visual = visual;
- context->Buffer = NULL;
- context->ClearColor = 0;
- context->CurrentColor = 0;
- context->GLContext = _mesa_create_context(visual->GLVisual,
- share ? share->GLContext : NULL,
- (void *) context, GL_FALSE );
- if (!context->GLContext)
- {
- free(context);
- return NULL;
- }
-
- return context;
-}
-
-
-void AMesaDestroyContext(AMesaContext context)
-{
- _mesa_destroy_context(context->GLContext);
- free(context);
-}
-
-
-GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer)
-{
- if (context && buffer) {
- set_color_depth(context->Visual->Depth);
- if (set_gfx_mode(GFX_AUTODETECT, buffer->Width, buffer->Height, 0, 0) != 0)
- return GL_FALSE;
-
- context->Buffer = buffer;
- buffer->Screen = screen;
- buffer->Active = buffer->Background ? buffer->Background : screen;
-
- setup_dd_pointers(context->GLContext);
- _mesa_make_current(context->GLContext, buffer->GLBuffer);
- }
- else {
- /* XXX I don't think you want to destroy anything here! */
- destroy_bitmap(context->Buffer->Screen);
- context->Buffer->Screen = NULL;
- context->Buffer->Active = NULL;
- context->Buffer = NULL;
- _mesa_make_current(NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-
-void AMesaSwapBuffers(AMesaBuffer buffer)
-{
- if (buffer->Background) {
- blit(buffer->Background, buffer->Screen,
- 0, 0, 0, 0,
- buffer->Width, buffer->Height);
- }
-}
diff --git a/src/mesa/drivers/allegro/amesa.h b/src/mesa/drivers/allegro/amesa.h
deleted file mode 100644
index 852d34cf4f5..00000000000
--- a/src/mesa/drivers/allegro/amesa.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- *
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/* Allegro (DJGPP) driver by Bernhard Tschirren (bernie-t@geocities.com) */
-
-
-#ifndef AMESA_H
-#define AMESA_H
-
-
-#define AMESA_MAJOR_VERSION 3
-#define AMESA_MINOR_VERSION 3
-
-
-typedef struct amesa_visual *AMesaVisual;
-typedef struct amesa_buffer *AMesaBuffer;
-typedef struct amesa_context *AMesaContext;
-
-
-extern AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth,
- GLint depthSize,
- GLint stencilSize,
- GLint accumSize);
-
-extern void AMesaDestroyVisual(AMesaVisual visual);
-
-extern AMesaBuffer AMesaCreateBuffer(AMesaVisual visual,
- GLint width, GLint height);
-
-extern void AMesaDestroyBuffer(AMesaBuffer buffer);
-
-
-extern AMesaContext AMesaCreateContext(AMesaVisual visual,
- AMesaContext sharelist);
-
-extern void AMesaDestroyContext(AMesaContext context);
-
-extern GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer);
-
-extern void AMesaSwapBuffers(AMesaBuffer buffer);
-
-
-#endif /* AMESA_H */
diff --git a/src/mesa/drivers/allegro/direct.h b/src/mesa/drivers/allegro/direct.h
deleted file mode 100644
index bd8b5eb49dd..00000000000
--- a/src/mesa/drivers/allegro/direct.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.0
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#define DESTINATION(BMP, X, Y, TYPE) \
- ({ \
- BITMAP *_bmp = BMP; \
- \
- (TYPE*)(_bmp->line[_bmp->h - (Y) - 1]) + (X); \
- })
-
-
-#define IMPLEMENT_WRITE_RGBA_SPAN(DEPTH, TYPE) \
-static void write_rgba_span_##DEPTH (const GLcontext *ctx, \
- GLuint n, GLint x, GLint y, \
- const GLubyte rgba[][4], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- TYPE *d = DESTINATION(context->Buffer->Active, x, y, TYPE); \
- \
- if (mask) \
- { \
- while (n--) \
- { \
- if (mask[0]) d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]); \
- d++; rgba++; mask++; \
- } \
- } \
- else \
- { \
- while (n--) \
- { \
- d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]); \
- d++; rgba++; \
- } \
- } \
- }
-
-
-#define IMPLEMENT_WRITE_RGB_SPAN(DEPTH, TYPE) \
-static void write_rgb_span_##DEPTH (const GLcontext *ctx, \
- GLuint n, GLint x, GLint y, \
- const GLubyte rgb[][3], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- TYPE *d = DESTINATION(context->Buffer->Active, x, y, TYPE); \
- \
- if (mask) \
- { \
- while (n--) \
- { \
- if (mask[0]) d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]); \
- d++; rgb++; mask++; \
- } \
- } \
- else \
- { \
- while (n--) \
- { \
- d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]); \
- d++; rgb++; \
- } \
- } \
- }
-
-
-#define IMPLEMENT_WRITE_MONO_RGBA_SPAN(DEPTH, TYPE) \
-static void write_mono_rgba_span_##DEPTH (const GLcontext *ctx, \
- GLuint n, GLint x, GLint y, \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- TYPE color = context->CurrentColor; \
- TYPE *d = DESTINATION(context->Buffer->Active, x, y, TYPE); \
- \
- while (n--) \
- { \
- if (mask[0]) d[0] = color; \
- d++; mask++; \
- } \
- }
-
-
-#define IMPLEMENT_READ_RGBA_SPAN(DEPTH, TYPE) \
-static void read_rgba_span_##DEPTH (const GLcontext *ctx, \
- GLuint n, GLint x, GLint y, \
- GLubyte rgba[][4]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- BITMAP *bmp = context->Buffer->Active; \
- TYPE *d = DESTINATION(bmp, x, y, TYPE); \
- \
- while (n--) \
- { \
- rgba[0][RCOMP] = getr##DEPTH(d[0]); \
- rgba[0][GCOMP] = getg##DEPTH(d[0]); \
- rgba[0][BCOMP] = getb##DEPTH(d[0]); \
- rgba[0][ACOMP] = 255; \
- \
- d++; rgba++; \
- } \
- }
-
-
-#define IMPLEMENT_WRITE_RGBA_PIXELS(DEPTH, TYPE) \
-static void write_rgba_pixels_##DEPTH (const GLcontext *ctx, \
- GLuint n, \
- const GLint x[], \
- const GLint y[], \
- const GLubyte rgba[][4], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- BITMAP *bmp = context->Buffer->Active; \
- \
- while (n--) \
- { \
- if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]); \
- rgba++; x++; y++; mask++; \
- } \
- }
-
-
-
-#define IMPLEMENT_WRITE_MONO_RGBA_PIXELS(DEPTH, TYPE) \
-static void write_mono_rgba_pixels_##DEPTH (const GLcontext *ctx, \
- GLuint n, \
- const GLint x[], \
- const GLint y[], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- TYPE color = context->CurrentColor; \
- BITMAP *bmp = context->Buffer->Active; \
- \
- while (n--) \
- { \
- if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = color; \
- x++; y++; mask++; \
- } \
- }
-
-
-#define IMPLEMENT_READ_RGBA_PIXELS(DEPTH, TYPE) \
-static void read_rgba_pixels_##DEPTH (const GLcontext *ctx, \
- GLuint n, \
- const GLint x[], \
- const GLint y[], \
- GLubyte rgba[][4], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- BITMAP *bmp = context->Buffer->Active; \
- \
- while (n--) \
- { \
- if (mask[0]) \
- { \
- int color = *DESTINATION(bmp, x[0], y[0], TYPE); \
- \
- rgba[0][RCOMP] = getr##DEPTH(color); \
- rgba[0][GCOMP] = getg##DEPTH(color); \
- rgba[0][BCOMP] = getb##DEPTH(color); \
- rgba[0][ACOMP] = 255; \
- } \
- \
- x++; y++; rgba++; mask++; \
- } \
- }
-
diff --git a/src/mesa/drivers/allegro/generic.h b/src/mesa/drivers/allegro/generic.h
deleted file mode 100644
index 4c8af9b95cf..00000000000
--- a/src/mesa/drivers/allegro/generic.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.0
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-static void clear_color_generic(GLcontext *ctx, const GLfloat color[4])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- GLubyte r, g, b;
- CLAMPED_FLOAT_TO_UBYTE(r, color[0]);
- CLAMPED_FLOAT_TO_UBYTE(g, color[1]);
- CLAMPED_FLOAT_TO_UBYTE(b, color[2]);
- context->ClearColor = makecol(r, g, b);
- }
-
-
-static void set_color_generic(GLcontext *ctx,
- GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
-
- context->CurrentColor = makecol(red, green, blue);
- }
-
-
-static GLbitfield clear_generic(GLcontext *ctx,
- GLbitfield mask, GLboolean all,
- GLint x, GLint y,
- GLint width, GLint height)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
-
- if (mask & GL_COLOR_BUFFER_BIT)
- {
- if (all)
- clear_to_color(context->Buffer->Active, context->ClearColor);
- else
- rect(context->Buffer->Active,
- x, y, x+width-1, y+height-1,
- context->ClearColor);
- }
-
- return mask & (~GL_COLOR_BUFFER_BIT);
- }
-
-
-static void write_rgba_span_generic(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- y = FLIP(context, y);
-
- if (mask)
- {
- while (n--)
- {
- if (mask[0]) putpixel(bmp, x, y, makecol(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]));
- x++; mask++; rgba++;
- }
- }
- else
- {
- while (n--)
- {
- putpixel(bmp, x, y, makecol(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]));
- x++; rgba++;
- }
- }
- }
-
-
-static void write_rgb_span_generic(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- y = FLIP(context, y);
-
- if (mask)
- {
- while(n--)
- {
- if (mask[0]) putpixel(bmp, x, y, makecol(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]));
- x++; mask++; rgb++;
- }
- }
- else
- {
- while (n--)
- {
- putpixel(bmp, x, y, makecol(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]));
- x++; rgb++;
- }
- }
- }
-
-
-static void write_mono_rgba_span_generic(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
- int color = context->CurrentColor;
-
- y = FLIP(context, y);
-
- if (mask)
- {
- while(n--)
- {
- if (mask[0]) putpixel(bmp, x, y, color);
- x++; mask++;
- }
- }
- else
- {
- while(n--)
- {
- putpixel(bmp, x, y, color);
- x++;
- }
- }
- }
-
-
-static void read_rgba_span_generic(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- y = FLIP(context, y);
-
- while (n--)
- {
- int color = getpixel(bmp, x, y);
-
- rgba[0][RCOMP] = getr(color);
- rgba[0][GCOMP] = getg(color);
- rgba[0][BCOMP] = getb(color);
- rgba[0][ACOMP] = 255;
-
- x++; rgba++;
- }
- }
-
-
-static void write_rgba_pixels_generic(const GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- while (n--)
- {
- if (mask[0]) putpixel(bmp, x[0], FLIP(context, y[0]), makecol(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]));
- x++; y++; mask++;
- }
- }
-
-
-static void write_mono_rgba_pixels_generic(const GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
- int color = context->CurrentColor;
-
- while (n--)
- {
- if (mask[0]) putpixel(bmp, x[0], FLIP(context, y[0]), color);
- x++; y++; mask++;
- }
- }
-
-
-static void read_rgba_pixels_generic(const GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- GLubyte rgba[][4],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- while (n--)
- {
- if (mask[0])
- {
- int color = getpixel(bmp, x[0], FLIP(context, y[0]));
-
- rgba[0][RCOMP] = getr(color);
- rgba[0][GCOMP] = getg(color);
- rgba[0][BCOMP] = getb(color);
- rgba[0][ACOMP] = 255;
- }
-
- x++; y++; mask++; rgba++;
- }
- }
-
diff --git a/src/mesa/drivers/beos/GLView.cpp b/src/mesa/drivers/beos/GLView.cpp
index 9e4a7ebe56e..a029f6b200c 100644
--- a/src/mesa/drivers/beos/GLView.cpp
+++ b/src/mesa/drivers/beos/GLView.cpp
@@ -297,11 +297,9 @@ BGLView::BGLView(BRect rect, char *name,
MesaDriver * md = new MesaDriver();
// examine option flags and create gl_context struct
- GLvisual * visual = _mesa_create_visual( rgbFlag,
- dblFlag,
+ GLvisual * visual = _mesa_create_visual( dblFlag,
stereoFlag,
red, green, blue, alpha,
- index,
depth,
stencil,
accum, accum, accum, accum,
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 49d4aaedb03..ebfaa2f07bd 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -70,7 +70,7 @@
void
_mesa_init_driver_functions(struct dd_function_table *driver)
{
- _mesa_bzero(driver, sizeof(*driver));
+ memset(driver, 0, sizeof(*driver));
driver->GetString = NULL; /* REQUIRED! */
driver->UpdateState = NULL; /* REQUIRED! */
@@ -120,7 +120,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->FreeTexImageData = _mesa_free_texture_image_data;
driver->MapTexture = NULL;
driver->UnmapTexture = NULL;
- driver->TextureMemCpy = _mesa_memcpy;
+ driver->TextureMemCpy = memcpy;
driver->IsTextureResident = NULL;
driver->UpdateTexturePalette = NULL;
@@ -142,7 +142,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->BlendFuncSeparate = NULL;
driver->ClearColor = NULL;
driver->ClearDepth = NULL;
- driver->ClearIndex = NULL;
driver->ClearStencil = NULL;
driver->ClipPlane = NULL;
driver->ColorMask = NULL;
@@ -157,7 +156,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->Enable = NULL;
driver->Fogfv = NULL;
driver->Hint = NULL;
- driver->IndexMask = NULL;
driver->Lightfv = NULL;
driver->LightModelfv = NULL;
driver->LineStipple = NULL;
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 7116d920f7a..b97b760f181 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -307,7 +307,7 @@ _mesa_meta_free(GLcontext *ctx)
* freed by the normal context destruction code. But this would be
* the place to free other meta data someday.
*/
- _mesa_free(ctx->Meta);
+ free(ctx->Meta);
ctx->Meta = NULL;
}
@@ -493,12 +493,12 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
if (state & META_TRANSFORM) {
GLuint activeTexture = ctx->Texture.CurrentUnit;
- _mesa_memcpy(save->ModelviewMatrix, ctx->ModelviewMatrixStack.Top->m,
- 16 * sizeof(GLfloat));
- _mesa_memcpy(save->ProjectionMatrix, ctx->ProjectionMatrixStack.Top->m,
- 16 * sizeof(GLfloat));
- _mesa_memcpy(save->TextureMatrix, ctx->TextureMatrixStack[0].Top->m,
- 16 * sizeof(GLfloat));
+ memcpy(save->ModelviewMatrix, ctx->ModelviewMatrixStack.Top->m,
+ 16 * sizeof(GLfloat));
+ memcpy(save->ProjectionMatrix, ctx->ProjectionMatrixStack.Top->m,
+ 16 * sizeof(GLfloat));
+ memcpy(save->TextureMatrix, ctx->TextureMatrixStack[0].Top->m,
+ 16 * sizeof(GLfloat));
save->MatrixMode = ctx->Transform.MatrixMode;
/* set 1:1 vertex:pixel coordinate transform */
_mesa_ActiveTextureARB(GL_TEXTURE0);
@@ -1304,7 +1304,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx,
}
if (mask & GL_DEPTH_BUFFER_BIT) {
- GLuint *tmp = (GLuint *) _mesa_malloc(srcW * srcH * sizeof(GLuint));
+ GLuint *tmp = (GLuint *) malloc(srcW * srcH * sizeof(GLuint));
if (tmp) {
if (!blit->DepthFP)
init_blit_depth_pixels(ctx);
@@ -1328,7 +1328,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx,
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
mask &= ~GL_DEPTH_BUFFER_BIT;
- _mesa_free(tmp);
+ free(tmp);
}
}
@@ -1895,7 +1895,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx,
_mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP);
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE);
- for (bit = 0; bit < ctx->Visual.stencilBits; bit++) {
+ for (bit = 0; bit < ctx->DrawBuffer->Visual.stencilBits; bit++) {
const GLuint mask = 1 << bit;
if (mask & origStencilMask) {
_mesa_StencilFunc(GL_ALWAYS, mask, mask);
@@ -2065,7 +2065,7 @@ _mesa_meta_Bitmap(GLcontext *ctx,
if (!bitmap1)
return;
- bitmap8 = (GLubyte *) _mesa_calloc(width * height);
+ bitmap8 = (GLubyte *) calloc(1, width * height);
if (bitmap8) {
_mesa_expand_bitmap(width, height, &unpackSave, bitmap1,
bitmap8, width, 0xff);
@@ -2082,7 +2082,7 @@ _mesa_meta_Bitmap(GLcontext *ctx,
_mesa_set_enable(ctx, tex->Target, GL_FALSE);
- _mesa_free(bitmap8);
+ free(bitmap8);
}
_mesa_unmap_pbo_source(ctx, &unpackSave);
@@ -2131,12 +2131,15 @@ _mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target,
GL_COLOR_ATTACHMENT0_EXT,
target, texObj->Name, srcLevel);
}
+#if 0
+ /* other work is needed to enable 3D mipmap generation */
else if (target == GL_TEXTURE_3D) {
GLint zoffset = 0;
_mesa_FramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
target, texObj->Name, srcLevel, zoffset);
}
+#endif
else {
/* 2D / cube */
_mesa_FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
@@ -2531,7 +2534,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
/*
* Alloc image buffer (XXX could use a PBO)
*/
- buf = _mesa_malloc(width * height * bpp);
+ buf = malloc(width * height * bpp);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
return;
@@ -2592,7 +2595,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
_mesa_lock_texture(ctx, texObj); /* re-lock */
- _mesa_free(buf);
+ free(buf);
}
@@ -2647,7 +2650,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
/*
* Alloc image buffer (XXX could use a PBO)
*/
- buf = _mesa_malloc(width * height * bpp);
+ buf = malloc(width * height * bpp);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage%uD", dims);
return;
@@ -2688,7 +2691,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
_mesa_lock_texture(ctx, texObj); /* re-lock */
- _mesa_free(buf);
+ free(buf);
}
@@ -2731,7 +2734,7 @@ _mesa_meta_CopyColorTable(GLcontext *ctx,
{
GLfloat *buf;
- buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorTable");
return;
@@ -2748,7 +2751,7 @@ _mesa_meta_CopyColorTable(GLcontext *ctx,
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
@@ -2758,7 +2761,7 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
{
GLfloat *buf;
- buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorSubTable");
return;
@@ -2775,7 +2778,7 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
@@ -2786,7 +2789,7 @@ _mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
{
GLfloat *buf;
- buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
return;
@@ -2805,7 +2808,7 @@ _mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
@@ -2816,7 +2819,7 @@ _mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
{
GLfloat *buf;
- buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
return;
@@ -2836,5 +2839,5 @@ _mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
diff --git a/src/mesa/drivers/d3d/D3DCAPS.CPP b/src/mesa/drivers/d3d/D3DCAPS.CPP
deleted file mode 100644
index 80ee91d9222..00000000000
--- a/src/mesa/drivers/d3d/D3DCAPS.CPP
+++ /dev/null
@@ -1,250 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver Build 5 */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* Macros. */
-/*===========================================================================*/
-#define SRCBLEND_MAP(gl,d3d,fall) if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwSrcBlendCaps & d3d ) \
- { \
- sprintf( buffer, "SRC Blend: %s -> %s", # gl, # d3d ); \
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \
- pShared->dwSrcBlendCaps[index] = d3d; \
- } \
- else \
- { \
- sprintf( buffer, "SRC Blend: %s -> %s", # gl, # fall ); \
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \
- pShared->dwSrcBlendCaps[index] = fall; \
- }
-#define DSTBLEND_MAP(gl,d3d,fall) if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwDestBlendCaps & d3d ) \
- { \
- sprintf( buffer, "DST Blend: %s -> %s", # gl, # d3d ); \
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \
- pShared->dwDestBlendCaps[index] = d3d; \
- } \
- else \
- { \
- sprintf( buffer, "DST Blend: %s -> %s", # gl, # fall ); \
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \
- pShared->dwDestBlendCaps[index] = fall; \
- }
-
-/*===========================================================================*/
-/* I use this function to handle the fact that the D3D texture blending and */
-/* OpenGL texture blending functions don't map one to one. Also there is the*/
-/* problem with cards not supporting all the D3D functions. So I use the CAPS*/
-/* of the card to make a table of functions that will have defaults for the */
-/* unsupported functions. */
-/* So first I fill the table with the fallback function then I check to see */
-/* if the card supports the requested function. If it does I replace the */
-/* default thats already in the array. Now order does matter as I used an */
-/* enum type in D3DShared.h so that the mapping would be a little easier. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void AlphaBlendTableHAL( PMESAD3DHAL pHAL )
-{
- PMESAD3DSHARED pShared = &pHAL->shared;
- int index;
- char buffer[128];
-
- DPF(( DBG_FUNC, "AlphaBlendTableHAL();" ));
-
- /* Make the fallback for the Source blend. */
- for( index = 0; index < 14; index++ )
- {
- switch( index )
- {
- case s_zero:
- SRCBLEND_MAP( GL_ZERO, D3DBLEND_ZERO, D3DBLEND_ONE );
- break;
- case s_one:
- SRCBLEND_MAP( GL_ONE, D3DBLEND_ONE, D3DBLEND_ONE );
- break;
- case s_dst_color:
- SRCBLEND_MAP( GL_DST_COLOR, D3DBLEND_DESTCOLOR, D3DBLEND_ONE );
- break;
- case s_one_minus_dst_color:
- SRCBLEND_MAP( GL_ONE_MINUS_DST_COLOR, D3DBLEND_INVDESTCOLOR, D3DBLEND_ONE );
- break;
- case s_src_alpha:
- SRCBLEND_MAP( GL_SRC_ALPHA, D3DBLEND_SRCALPHA, D3DBLEND_ONE );
- break;
- case s_one_minus_src_alpha:
- SRCBLEND_MAP( GL_ONE_MINUS_SRC_ALPHA, D3DBLEND_INVSRCALPHA, D3DBLEND_ONE );
- break;
- case s_dst_alpha:
- SRCBLEND_MAP( GL_DST_ALPHA, D3DBLEND_DESTALPHA, D3DBLEND_ONE );
- break;
- case s_one_minus_dst_alpha:
- SRCBLEND_MAP( GL_ONE_MINUS_DST_ALPHA, D3DBLEND_INVDESTALPHA, D3DBLEND_ONE );
- break;
- case s_src_alpha_saturate:
- SRCBLEND_MAP( GL_SRC_ALPHA_SATURATE, D3DBLEND_SRCALPHASAT, D3DBLEND_ONE );
- break;
- case s_constant_color:
- SRCBLEND_MAP( GL_CONSTANT_COLOR, D3DBLEND_SRCCOLOR, D3DBLEND_ONE );
- break;
- case s_one_minus_constant_color:
- SRCBLEND_MAP( GL_ONE_MINUS_CONSTANT_COLOR, D3DBLEND_INVSRCCOLOR, D3DBLEND_ONE );
- break;
- case s_constant_alpha:
- SRCBLEND_MAP( GL_CONSTANT_ALPHA, D3DBLEND_BOTHSRCALPHA, D3DBLEND_ONE );
- break;
- case s_one_minus_constant_alpha:
- SRCBLEND_MAP( GL_ONE_MINUS_CONSTANT_ALPHA, D3DBLEND_BOTHINVSRCALPHA, D3DBLEND_ONE );
- break;
- }
- }
-
- /* Make the fallback for the Destination blend. */
- for( index = 0; index < 14; index++ )
- {
- switch( index )
- {
- case d_zero:
- DSTBLEND_MAP( GL_ZERO, D3DBLEND_ZERO, D3DBLEND_ONE );
- break;
- case d_one:
- DSTBLEND_MAP( GL_ONE, D3DBLEND_ONE, D3DBLEND_ONE );
- break;
- case d_src_color:
- DSTBLEND_MAP( GL_SRC_COLOR, D3DBLEND_SRCCOLOR, D3DBLEND_ONE );
- break;
- case d_one_minus_src_color:
- DSTBLEND_MAP( GL_ONE_MINUS_SRC_COLOR, D3DBLEND_INVSRCCOLOR, D3DBLEND_ONE );
- break;
- case d_src_alpha:
- DSTBLEND_MAP( GL_SRC_ALPHA, D3DBLEND_SRCALPHA, D3DBLEND_ONE );
- break;
- case d_one_minus_src_alpha:
- DSTBLEND_MAP( GL_ONE_MINUS_SRC_ALPHA, D3DBLEND_INVSRCALPHA, D3DBLEND_ONE );
- break;
- case d_dst_alpha:
- DSTBLEND_MAP( GL_DST_ALPHA, D3DBLEND_DESTALPHA, D3DBLEND_ONE );
- break;
- case d_one_minus_dst_alpha:
- DSTBLEND_MAP( GL_ONE_MINUS_DST_ALPHA, D3DBLEND_INVDESTALPHA, D3DBLEND_ONE );
- break;
- case d_constant_color:
- DSTBLEND_MAP( GL_CONSTANT_COLOR, D3DBLEND_DESTCOLOR, D3DBLEND_ONE );
- break;
- case d_one_minus_constant_color:
- DSTBLEND_MAP( GL_ONE_MINUS_CONSTANT_COLOR, D3DBLEND_INVDESTCOLOR, D3DBLEND_ONE );
- break;
- case d_constant_alpha:
- DSTBLEND_MAP( GL_CONSTANT_ALPHAR, D3DBLEND_BOTHSRCALPHA, D3DBLEND_ONE );
- break;
- case d_one_minus_constant_alpha:
- DSTBLEND_MAP( GL_ONE_MINUS_CONSTANT_ALPHA, D3DBLEND_BOTHINVSRCALPHA, D3DBLEND_ONE );
- break;
- }
- }
-
- /* Make the fallbacks for the texture functions. */
- for( index = 0; index < 4; index++ )
- {
- switch( index )
- {
- case d3dtblend_decal:
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECAL -> D3DTBLEND_DECAL" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECAL;
- }
- else
- {
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATE )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECAL -> D3DTBLEND_MODULATE" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATE;
- }
- else
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECAL -> D3DTBLEND_ADD" ));
- pShared->dwTexFunc[index] = D3DTBLEND_ADD;
- }
- }
- break;
- case d3dtblend_decalalpha:
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECALALPHA )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECALALPHA -> D3DTBLEND_DECALALPHA" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECALALPHA;
- }
- else
- {
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECALALPA -> D3DTBLEND_DECAL" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECAL;
- }
- else
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECALALPHA -> D3DTBLEND_ADD" ));
- pShared->dwTexFunc[index] = D3DTBLEND_ADD;
- }
- }
- break;
- case d3dtblend_modulate:
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATE )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_MODULATE" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATE;
- }
- else
- {
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATEALPHA )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_MODULATEALPHA" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATEALPHA;
- }
- else if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_DECAL" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECAL;
- }
- else
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_ADD" ));
- pShared->dwTexFunc[index] = D3DTBLEND_ADD;
- }
- }
- break;
- case d3dtblend_modulatealpha:
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATEALPHA )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_MODULATEALPHA" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATEALPHA;
- }
- else
- {
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATE )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_MODULATE" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATE;
- }
- else if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_DECALE" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECAL;
- }
- else
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_ADD" ));
- pShared->dwTexFunc[index] = D3DTBLEND_ADD;
- }
- }
- break;
- }
- }
-}
-
diff --git a/src/mesa/drivers/d3d/D3DHAL.H b/src/mesa/drivers/d3d/D3DHAL.H
deleted file mode 100644
index 2496d164e5c..00000000000
--- a/src/mesa/drivers/d3d/D3DHAL.H
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef _D3D_HAL_INC
-#define _D3D_HAL_INC
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <windows.h>
-#include <ddraw.h>
-#include <d3d.h>
-#include <stdlib.h>
-#include <time.h>
-#include "D3DShared.h"
-#include "D3DTextureMgr.h"
-#include "Debug.h"
-/*===========================================================================*/
-/* Defines. */
-/*===========================================================================*/
-#define DX_RESTORE(ps) if ( (ps) && (ps)->IsLost() ) (ps)->Restore();
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-typedef struct _d3d_hal_struct
-{
- MESAD3DSHARED shared;
-
- GUID guid;
- LPDIRECTDRAW lpDD;
- LPDIRECTDRAW4 lpDD4;
- LPDIRECT3D3 lpD3D3;
- LPDIRECT3DDEVICE3 lpD3DDevice;
- D3DDEVICEDESC D3DHWDevDesc;
- LPDIRECTDRAWSURFACE4 lpDDSPrimary,
- lpDDSRender,
- lpDDSZbuffer;
- LPDIRECT3DVIEWPORT3 lpViewport;
- LPDIRECTDRAWCLIPPER lpClipper;
- DDPIXELFORMAT ddpf,
- ddpfZBuffer;
- PTM_OBJECT pTMList;
-
-} MESAD3DHAL, *PMESAD3DHAL;
-/*===========================================================================*/
-/* External function prototypes. */
-/*===========================================================================*/
-extern BOOL InitTMgrHAL( PMESAD3DHAL pHAL );
-extern void TermTMgrHAL( PMESAD3DHAL pHAL );
-extern void AlphaBlendTableHAL( PMESAD3DHAL pHAL );
-
-extern void Solve8BitChannelPixelFormat( DDPIXELFORMAT *pddpf, PPIXELINFO pPixel );
-extern char *ErrorStringD3D( HRESULT hr );
-extern void FatalShutDown( PMESAD3DHAL pHAL );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-extern char *errorMsg;
-
-#endif
-
diff --git a/src/mesa/drivers/d3d/D3DInit.cpp b/src/mesa/drivers/d3d/D3DInit.cpp
deleted file mode 100644
index e21cd21e250..00000000000
--- a/src/mesa/drivers/d3d/D3DInit.cpp
+++ /dev/null
@@ -1,891 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver Build 5 */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* Local function prototypes. */
-/*===========================================================================*/
-static void DestroyAllSurfaces( PMESAD3DHAL pHAL );
-static void DestroyDevice( PMESAD3DHAL pHAL );
-static void DestroyInterfaces( PMESAD3DHAL pHAL );
-
-HRESULT WINAPI EnumSurfacesHook( LPDIRECTDRAWSURFACE4 lpDDS, LPDDSURFACEDESC2 lpDDSDesc, LPVOID pVoid );
-HRESULT CALLBACK EnumZBufferHook( DDPIXELFORMAT* pddpf, VOID *pVoid );
-HRESULT CALLBACK EnumDeviceHook( GUID FAR* lpGuid, LPSTR lpDesc, LPSTR lpName, LPD3DDEVICEDESC lpD3DHWDesc, LPD3DDEVICEDESC lpD3DHELDesc, void *pVoid );
-/*===========================================================================*/
-/* Globals. */
-/*===========================================================================*/
-//char *errorMsg;
-/*===========================================================================*/
-/* This function is responable for allocating the actual MESAD3DHAL struct. */
-/* Each Mesa context will have its own MESAD3DHAL struct so its like a mini */
-/* context to some extent. All one time allocations/operations get done here.*/
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-extern "C" PMESAD3DSHARED InitHAL( HWND hwnd )
-{
- PMESAD3DHAL pHAL;
- ULONG rc;
-
- DPF(( DBG_FUNC, "InitHAL();" ));
- DPF(( DBG_CNTX_INFO, "hwnd: %d", hwnd ));
-
- /* Allocate the structure and zero it out. */
- pHAL = (PMESAD3DHAL)ALLOC( sizeof(MESAD3DHAL) );
- if ( pHAL == NULL )
- {
- RIP( pHAL, "InitHAL->", "Memory Allocation" );
- return (PMESAD3DSHARED)NULL;
- }
- memset( pHAL, 0, sizeof(MESAD3DHAL) );
-
- /* Get the texture manager going. */
- rc = InitTMgrHAL( pHAL );
- if ( rc == FALSE )
- {
- RIP( pHAL, "InitTMgrHAL->", "Failed" );
- return (PMESAD3DSHARED)NULL;
- }
-
- /* Fill in the window parameters if we can. */
- pHAL->shared.hwnd = hwnd;
-
- /* Parse the user's enviroment variables to generate a debug mask. */
- ReadDBGEnv();
-
- return (PMESAD3DSHARED)pHAL;
-}
-/*===========================================================================*/
-/* This function will unload all the resources that the MESAD3DHAL struct */
-/* has bound to it. The actual structure itself will be freed. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void TermHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
- DPF(( DBG_FUNC, "TermHAL();" ));
-
- /* Check for an empty wrapper structure. */
- if ( pHAL == NULL )
- return;
-
- /* Kill this texture manager. */
- TermTMgrHAL( pHAL );
-
- /* Kill any DDraw stuff if exists. */
- DestroyDevice( pHAL );
- DestroyAllSurfaces( pHAL );
- DestroyInterfaces( pHAL );
-
- FREE( pHAL );
-}
-/*===========================================================================*/
-/* This function is used to init and resize the rendering surface as the two*/
-/* are almost the same. First the device and all the surfaces are destoryed */
-/* if they already exist. Next we create a OffScreen rendering surface and */
-/* save some pixelformat info to do color convertions. Next we start to take */
-/* care of getting the most out of the hardware. I use bHardware to determine*/
-/* the state of the device we found in the device enumeration. The enum proc*/
-/* will try for hardware first. I next use a bForceSW to make the enum proc */
-/* choose a software device. So I will try some combinations with HW first */
-/* until I feel I have to set the bForceSW and call this function again. If */
-/* this function is called with no width or height then use the internals. */
-/* NOTE: The worst case is that all will be in SW (RGBDevice) and really */
-/* I should forget the whole thing and fall back to a DDraw span type*/
-/* rendering but what is the point. This way I always know I have a */
-/* D3DDevice and that makes things easier. I do impliment the span */
-/* rendering function for stuff that I haven't done support for such */
-/* as points and lines. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE */
-/*===========================================================================*/
-extern "C" BOOL CreateHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- DDSURFACEDESC2 ddsd2;
- D3DDEVICEDESC D3DSWDevDesc;
- DDSCAPS2 ddscaps;
- DWORD dwCoopFlags,
- dwWidth,
- dwHeight;
- ULONG rc;
-
- DPF(( DBG_FUNC, "CreateHAL();" ));
-
-#define InitDDSD2(f) memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); \
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 ); \
- ddsd2.dwFlags = f;
-
- if ( pHAL == NULL )
- return FALSE;
-
- /* Use the internal rectangle struct. */
- dwWidth = pShared->rectW.right - pShared->rectW.left;
- dwHeight = pShared->rectW.bottom - pShared->rectW.top;
-
- DPF(( DBG_CNTX_INFO, "Width: %d Height: %d", dwWidth, dwHeight ));
-
- /* The dimensions might still be the same so just leave. */
- if ( (dwWidth == pShared->dwWidth) && (dwHeight == pShared->dwHeight) )
- {
- DPF(( DBG_CNTX_WARN, "Context size hasn't changed" ));
- return TRUE;
- }
-
- /* If one of the dimensions are zero then leave. WM_SIZE should get us back here. */
- if ( (dwWidth == 0) || (dwHeight == 0) )
- return TRUE;
-
- /* Save the renders dimensions. */
- pShared->dwWidth = dwWidth;
- pShared->dwHeight = dwHeight;
-
- DPF(( DBG_CNTX_INFO, "Creating Context:\n cx:%d cy:%d", pShared->dwWidth, pShared->dwHeight ));
-
- /*=================================*/
- /* Create all required interfaces. */
- /*=================================*/
-
- /* Kill any DDraw stuff if exists. */
- DestroyDevice( pHAL );
- DestroyAllSurfaces( pHAL );
- DestroyInterfaces( pHAL );
-
- /* Create a instance of DDraw using the Primary display driver. */
- rc = DirectDrawCreate( NULL, &pHAL->lpDD, NULL );
- if( FAILED(rc) )
- {
- RIP( pHAL, "DirectDrawCreate->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Get the DDraw4 interface. */
- rc = pHAL->lpDD->QueryInterface( IID_IDirectDraw4, (void **)&pHAL->lpDD4 );
- if( FAILED(rc) )
- {
- RIP( pHAL, "QueryInterface (IID_IDirectDraw4) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Get the Direct3D3 interface. */
- rc = pHAL->lpDD4->QueryInterface( IID_IDirect3D3, (void **)&pHAL->lpD3D3 );
- if( FAILED(rc) )
- {
- RIP( pHAL, "QueryInterface (IID_IDirect3D3) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Set the Cooperative level. NOTE: we need to know if we are FS at this point.*/
- dwCoopFlags = (pShared->bWindow == TRUE) ? DDSCL_NORMAL : (DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
- rc = pHAL->lpDD4->SetCooperativeLevel( pShared->hwnd, dwCoopFlags );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "SetCooperativeLevel->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /*==================================================================*/
- /* Get the best device we can and note whether its hardware or not. */
- /*==================================================================*/
- pShared->bForceSW = FALSE;
- pHAL->lpD3D3->EnumDevices( EnumDeviceHook, (void *)pHAL );
- pShared->bHardware = IsEqualIID( pHAL->guid, IID_IDirect3DHALDevice );
- DPF(( DBG_CNTX_INFO, "bHardware: %s", (pShared->bHardware) ? "TRUE" : "FALSE" ));
- DPF(( DBG_CNTX_INFO, "bWindowed: %s", (pShared->bWindow) ? "TRUE" : "FALSE" ));
-
- /*========================================================================*/
- /* HARDWARE was found. */
- /*========================================================================*/
- if ( pShared->bHardware == TRUE )
- {
- /*===================================*/
- /* HARDWARE -> Z-BUFFER. */
- /*===================================*/
-
- /* Get a Z-Buffer pixelformat. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- rc = pHAL->lpD3D3->EnumZBufferFormats( pHAL->guid, EnumZBufferHook, (VOID*)&ddsd2.ddpfPixelFormat );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "EnumZBufferFormatsl->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Setup our request structure for the Z-buffer surface. */
- ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY;
- ddsd2.dwWidth = dwWidth;
- ddsd2.dwHeight = dwHeight;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSZbuffer, NULL );
- if ( !FAILED(rc) )
- {
- DPF(( DBG_CNTX_INFO, "HW ZBuffer" ));
-
- /*===================================*/
- /* HARDWARE -> Z-BUFFER -> FLIPABLE */
- /*===================================*/
- if ( pShared->bWindow == FALSE )
- {
- InitDDSD2( DDSD_CAPS | DDSD_BACKBUFFERCOUNT );
- ddsd2.dwBackBufferCount = 1;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL );
- if ( FAILED(rc) )
- {
- /* Make sure we try the next fall back. */
- DPF(( DBG_CNTX_WARN, "HW Flip/Complex not available" ));
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- /* Get the back buffer that was created. */
- ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
- rc = pHAL->lpDDSPrimary->GetAttachedSurface( &ddscaps, &pHAL->lpDDSRender );
- if ( FAILED(rc) )
- {
- DPF(( DBG_CNTX_WARN, "GetAttachedSurface failed -> HW Flip/Complex" ));
-
- /* Make sure we try the next fall back. */
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- /* I have had problems when a complex surface comes back */
- /* with the back buffer being created in SW. Not sure why */
- /* or how this is possable but I'm checking for it here. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- DX_RESTORE( pHAL->lpDDSRender );
- rc = pHAL->lpDDSRender->GetSurfaceDesc( &ddsd2 );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "GetSurfaceDesc (RENDER) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* If the surface is in VID then we are happy with are Flipable. */
- if ( ddsd2.ddsCaps.dwCaps & DDSCAPS_LOCALVIDMEM )
- {
- pShared->bFlipable = TRUE;
- DPF(( DBG_CNTX_INFO, "HW Flip/Complex!" ));
- }
- else
- {
- /* Kill this setup. */
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- }
- }
- }
-
- /*===================================*/
- /* HARDWARE -> Z-BUFFER -> BLT */
- /*===================================*/
- if ( pHAL->lpDDSPrimary == NULL )
- {
- pShared->bFlipable = FALSE;
-
- /* Create the Primary (front buffer). */
- InitDDSD2( DDSD_CAPS );
- ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL );
- if ( FAILED(rc) )
- {
- /* This is an error as we should be able to do this at minimum. */
- RIP( pHAL, "CreateSurface (PRIMARY) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Create the Render (back buffer). */
- InitDDSD2( DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT );
- ddsd2.dwWidth = dwWidth;
- ddsd2.dwHeight = dwHeight;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSRender, NULL );
- if ( FAILED(rc) )
- {
- DPF(( DBG_CNTX_WARN, "Failed HW Offscreen surface" ));
-
- /* Make sure we try the next fall back. */
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- /* Might as well check here too see if this surface is in */
- /* hardware. If nothing else just to be consistant. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- DX_RESTORE( pHAL->lpDDSRender );
- rc = pHAL->lpDDSRender->GetSurfaceDesc( &ddsd2 );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "GetSurfaceDesc (RENDER) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* If the surface is in VID then we are happy. */
- if ( ddsd2.ddsCaps.dwCaps & DDSCAPS_LOCALVIDMEM )
- {
- /* Create a clipper object so that DDraw will be able to blt windows that */
- /* have been clipped by the screen or other windows. */
- pHAL->lpDD4->CreateClipper( 0, &pHAL->lpClipper, NULL );
- pHAL->lpClipper->SetHWnd( 0, pShared->hwnd );
- pHAL->lpDDSPrimary->SetClipper( pHAL->lpClipper );
- pHAL->lpClipper->Release();
- DPF(( DBG_CNTX_INFO, "HW RENDER surface" ));
- }
- else
- {
- /* Kill this setup. */
- pHAL->lpDDSRender->Release();
- pHAL->lpDDSRender = NULL;
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- }
- }
-
- /*===================================*/
- /* Create D3DDEVICE -> HARDWARE. */
- /*===================================*/
- if ( pHAL->lpDDSZbuffer && pHAL->lpDDSPrimary && pHAL->lpDDSRender )
- {
- DX_RESTORE( pHAL->lpDDSRender );
- DX_RESTORE( pHAL->lpDDSZbuffer );
-
- rc = pHAL->lpDDSRender->AddAttachedSurface( pHAL->lpDDSZbuffer );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "AddAttachedSurface (ZBUFFER) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- rc = pHAL->lpD3D3->CreateDevice( IID_IDirect3DHALDevice, pHAL->lpDDSRender, &pHAL->lpD3DDevice, NULL );
- if ( rc != D3D_OK )
- {
- DPF(( DBG_CNTX_WARN, "Failed HW Device" ));
- pHAL->lpD3DDevice = NULL;
- }
- else
- {
- DPF(( DBG_CNTX_INFO, "HW Device" ));
- }
- }
- }
- }
-
- /*========================================================================*/
- /* SOFTWARE fallback. */
- /*========================================================================*/
- if ( pHAL->lpD3DDevice == NULL )
- {
- DPF(( DBG_CNTX_INFO, "SW fallback :(" ));
-
- /* Make sure we have no surfaces allocated. Just incase. */
- DestroyAllSurfaces( pHAL );
-
- /* Get a software device. */
- pShared->bFlipable = FALSE;
- pShared->bForceSW = TRUE;
- pHAL->lpD3D3->EnumDevices( EnumDeviceHook, (void *)pHAL );
- pShared->bHardware = IsEqualIID( pHAL->guid, IID_IDirect3DHALDevice );
-
- /*===================================*/
- /* SOFTWARE -> Z-BUFFER. */
- /*===================================*/
-
- /*===================================*/
- /* SOFTWARE -> Z-BUFFER -> FLIPABLE */
- /*===================================*/
- if ( pShared->bWindow == FALSE )
- {
- InitDDSD2( DDSD_CAPS | DDSD_BACKBUFFERCOUNT );
- ddsd2.dwBackBufferCount = 1;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
- ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT );
- ddsd2.ddpfPixelFormat.dwFlags = (DDPF_RGB | DDPF_ALPHAPIXELS);
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL );
- if ( FAILED(rc) )
- {
- DPF(( DBG_CNTX_WARN, "Failed SW Flip/Complex" ));
-
- /* Make sure we try the next fall back. */
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
- rc = pHAL->lpDDSPrimary->GetAttachedSurface( &ddscaps, &pHAL->lpDDSRender );
- if ( FAILED(rc) )
- {
- /* Make sure we try the next fall back. */
- DPF(( DBG_CNTX_WARN, "GetAttachedSurface failed -> SW Flip/Complex" ));
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- DPF(( DBG_CNTX_INFO, "SW Flip/Complex" ));
- pShared->bFlipable = TRUE;
- }
- }
- }
-
- /*===================================*/
- /* SOFTWARE -> Z-BUFFER -> BLT */
- /*===================================*/
- if ( pHAL->lpDDSPrimary == NULL )
- {
- /* Create the Primary (front buffer). */
- InitDDSD2( DDSD_CAPS );
- ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL );
- if ( FAILED(rc) )
- {
- /* This is an error as we should be able to do this at minimum. */
- RIP( pHAL, "CreateSurface (PRIMARY) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Create the Render (back buffer). */
- InitDDSD2( DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT );
- ddsd2.dwWidth = dwWidth;
- ddsd2.dwHeight = dwHeight;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
- ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT );
- ddsd2.ddpfPixelFormat.dwFlags = (DDPF_RGB | DDPF_ALPHAPIXELS);
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSRender, NULL );
- if ( FAILED(rc) )
- {
- /* That was our last hope. */
- RIP( pHAL, "CreateSurface (RENDER) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
- else
- {
- DPF(( DBG_CNTX_INFO, "SW RENDER surface" ));
-
- /* Create a clipper object so that DDraw will be able to blt windows that */
- /* have been clipped by the screen or other windows. */
- pHAL->lpDD4->CreateClipper( 0, &pHAL->lpClipper, NULL );
- pHAL->lpClipper->SetHWnd( 0, pShared->hwnd );
- pHAL->lpDDSPrimary->SetClipper( pHAL->lpClipper );
- pHAL->lpClipper->Release();
- }
- }
-
- /*===================================*/
- /* Create D3DDEVICE -> SOFTWARE. */
- /*===================================*/
- if ( pHAL->lpDDSPrimary && pHAL->lpDDSRender )
- {
- DX_RESTORE( pHAL->lpDDSRender );
- rc = pHAL->lpD3D3->CreateDevice( IID_IDirect3DRGBDevice, pHAL->lpDDSRender, &pHAL->lpD3DDevice, NULL );
- if ( rc != D3D_OK )
- {
- /* That was our last hope. */
- RIP( pHAL, "CreateDevice (IID_IDirect3DRGBDevice) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- DPF(( DBG_CNTX_INFO, "SW Device" ));
- }
- }
-
- /*==============================================================================*/
- /* Get a copy of the render pixelformat so that wgl.c can call GetPixelInfoD3D. */
- /*==============================================================================*/
- memset( &pHAL->ddpf, 0, sizeof(DDPIXELFORMAT) );
- pHAL->ddpf.dwSize = sizeof( DDPIXELFORMAT );
- rc = pHAL->lpDDSRender->GetPixelFormat( &pHAL->ddpf );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "GetPixelFormat ->", ErrorStringD3D(rc) );
- return FALSE;
- }
- DebugPixelFormat( "Using OFFSCREEN", &pHAL->ddpf );
- DebugPixelFormat( "Using ZBUFFER", &ddsd2.ddpfPixelFormat );
-
- /* Get a copy of what the D3DDevice supports for later use. */
- memset( &D3DSWDevDesc, 0, sizeof(D3DDEVICEDESC) );
- memset( &pHAL->D3DHWDevDesc, 0, sizeof(D3DDEVICEDESC) );
- D3DSWDevDesc.dwSize = sizeof( D3DDEVICEDESC );
- pHAL->D3DHWDevDesc.dwSize = sizeof( D3DDEVICEDESC );
- rc = pHAL->lpD3DDevice->GetCaps( &pHAL->D3DHWDevDesc, &D3DSWDevDesc );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "GetCaps ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Get a copy of the pixel convertion stuff for direct buffer access. */
- Solve8BitChannelPixelFormat( &pHAL->ddpf, &pShared->pixel );
- AlphaBlendTableHAL( pHAL );
-
- /* We must prime the Begin/End scene for SwapBuffers to work. */
- rc = pHAL->lpD3DDevice->BeginScene();
- if ( FAILED(rc) )
- {
- RIP( pHAL, "BeginScene ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
-#undef InitDDSD2
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will make sure a viewport is created and set for the device*/
-/* in the supplied structure. If a rect is supplied then it will be used for*/
-/* the viewport otherwise the current setting in the strucute will be used. */
-/* Note that the rect is relative to the window. So left/top must be 0,0 to */
-/* use the whole window else there is scissoring going down. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-extern "C" BOOL SetViewportHAL( PMESAD3DSHARED pShared, RECT *pRect, float minZ, float maxZ )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- D3DVIEWPORT2 vdData;
- ULONG rc;
- POINT pt;
-
- DPF(( DBG_FUNC, "SetViewportHAL();" ));
-
- /* Make sure we have enough info. */
- if ( !pHAL || !pHAL->lpDDSPrimary || !pHAL->lpD3DDevice )
- {
- DPF(( DBG_CNTX_WARN, "SetViewport() -> NULL Pointer" ));
- return FALSE;
- }
-
- /* TODO: this is just a temp fix to stop redundant changes. */
- if ( pRect &&
- (pShared->rectV.left == pRect->left) &&
- (pShared->rectV.right == pRect->right) &&
- (pShared->rectV.top == pRect->top) &&
- (pShared->rectV.bottom == pRect->bottom) )
- {
- DPF(( DBG_CNTX_WARN, "Redundant viewport" ));
- return TRUE;
- }
-
- DPF(( DBG_CNTX_INFO, "Current Viewport:" ));
- DPF(( DBG_CNTX_INFO, "x: %d y: %d", pShared->rectV.left, pShared->rectV.top ));
- DPF(( DBG_CNTX_INFO, "cx: %d cy: %d", (pShared->rectV.right-pShared->rectV.left), (pShared->rectV.bottom-pShared->rectV.top) ));
- DPF(( DBG_CNTX_INFO, "New Viewport:" ));
- DPF(( DBG_CNTX_INFO, "x: %d y: %d", pRect->left, pRect->top ));
- DPF(( DBG_CNTX_INFO, "cx: %d cy: %d", (pRect->right-pRect->left), (pRect->bottom-pRect->top) ));
-
- /* Update the current viewport rect if one is supplied. */
- if ( pRect )
- memcpy( &pShared->rectV, pRect, sizeof(RECT) );
-
- /* Build the request structure. */
- memset( &vdData, 0, sizeof(D3DVIEWPORT2) );
- vdData.dwSize = sizeof(D3DVIEWPORT2);
- vdData.dwX = pShared->rectV.left;
- vdData.dwY = pShared->rectV.top;
- vdData.dwWidth = (pShared->rectV.right - pShared->rectV.left);
- vdData.dwHeight = (pShared->rectV.bottom - pShared->rectV.top);
-
- if ( !vdData.dwWidth || !vdData.dwHeight )
- {
- GetClientRect( pShared->hwnd, &pShared->rectW );
- pt.x = pt.y = 0;
- ClientToScreen( pShared->hwnd, &pt );
- OffsetRect( &pShared->rectW, pt.x, pt.y);
- vdData.dwX = pShared->rectW.left;
- vdData.dwY = pShared->rectW.top;
- vdData.dwWidth = (pShared->rectW.right - pShared->rectW.left);
- vdData.dwHeight = (pShared->rectW.bottom - pShared->rectW.top);
- memcpy( &pShared->rectV, &pShared->rectW, sizeof(RECT) );
- }
-
- // The dvClipX, dvClipY, dvClipWidth, dvClipHeight, dvMinZ,
- // and dvMaxZ members define the non-normalized post-perspective
- // 3-D view volume which is visible to the viewer. In most cases,
- // dvClipX is set to -1.0 and dvClipY is set to the inverse of
- // the viewport's aspect ratio on the target surface, which can be
- // calculated by dividing the dwHeight member by dwWidth. Similarly,
- // the dvClipWidth member is typically 2.0 and dvClipHeight is set
- // to twice the aspect ratio set in dwClipY. The dvMinZ and dvMaxZ
- // are usually set to 0.0 and 1.0.
- vdData.dvClipX = -1.0f;
- vdData.dvClipWidth = 2.0f;
- vdData.dvClipY = 1.0f;
- vdData.dvClipHeight = 2.0f;
- vdData.dvMaxZ = maxZ;
- vdData.dvMinZ = minZ;
-
- DPF(( DBG_CNTX_INFO, "zMin: %f zMax: %f", minZ, maxZ ));
-
- /* I'm going to destroy the viewport everytime as when we size we will */
- /* have a new D3DDevice. As this area doesn't need to be fast... */
- if ( pHAL->lpViewport )
- {
- DPF(( DBG_CNTX_INFO, "DeleteViewport" ));
-
- pHAL->lpD3DDevice->DeleteViewport( pHAL->lpViewport );
- rc = pHAL->lpViewport->Release();
- pHAL->lpViewport = NULL;
- }
-
- rc = pHAL->lpD3D3->CreateViewport( &pHAL->lpViewport, NULL );
- if ( rc != D3D_OK )
- {
- DPF(( DBG_CNTX_ERROR, "CreateViewport Failed" ));
- return FALSE;
- }
-
- /* Update the device with the new viewport. */
- pHAL->lpD3DDevice->AddViewport( pHAL->lpViewport );
- pHAL->lpViewport->SetViewport2( &vdData );
- pHAL->lpD3DDevice->SetCurrentViewport( pHAL->lpViewport );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* */
-/* */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-HRESULT WINAPI EnumSurfacesHook( LPDIRECTDRAWSURFACE4 lpDDS, LPDDSURFACEDESC2 lpDDSDesc, LPVOID pVoid )
-{
- DDSURFACEDESC2 *pddsd2 = (DDSURFACEDESC2 *)pVoid;
-
- DPF(( DBG_FUNC, "EnumSurfacesHook();" ));
-
- if ( (lpDDSDesc->ddpfPixelFormat.dwFlags == pddsd2->ddpfPixelFormat.dwFlags) && (lpDDSDesc->ddsCaps.dwCaps == pddsd2->ddsCaps.dwCaps) )
- {
- /* Save the pixelformat now so that we know we have one. */
- memcpy( pddsd2, lpDDSDesc, sizeof(DDSURFACEDESC2) );
-
- return D3DENUMRET_CANCEL;
- }
-
- return D3DENUMRET_OK;
-}
-/*===========================================================================*/
-/* This is the callback proc to get a Z-Buffer. Thats it. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-HRESULT CALLBACK EnumZBufferHook( DDPIXELFORMAT* pddpf, VOID *pVoid )
-{
- DDPIXELFORMAT *pddpfChoice = (DDPIXELFORMAT *)pVoid;
-
- DPF(( DBG_FUNC, "EnumZBufferHook();" ));
-
- /* If this is ANY type of depth-buffer, stop. */
- if( pddpf->dwFlags == DDPF_ZBUFFER )
- {
- /* Save the pixelformat now so that we know we have one. */
- memcpy( pddpfChoice, pddpf, sizeof(DDPIXELFORMAT) );
-
- /* I feel if the hardware supports this low then lets use it. Could get ugly. */
- if( pddpf->dwZBufferBitDepth >= 8 )
- {
- return D3DENUMRET_CANCEL;
- }
- }
-
- return D3DENUMRET_OK;
-}
-/*===========================================================================*/
-/* This function handles the callback for the D3DDevice enumeration. Good */
-/* god who's idea was this? The D3D wrapper has two variable related to what*/
-/* kind of device we want and have. First we have a Bool that is set if we */
-/* have allocated a HW device. We always look for the HW device first. The */
-/* other variable is used to force SW. If we have run into a case that we */
-/* want to fallback to SW then we set this. We will fallback if we cannot */
-/* texture in video memory (among others). */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-HRESULT CALLBACK EnumDeviceHook( GUID FAR* lpGuid, LPSTR lpDesc, LPSTR lpName, LPD3DDEVICEDESC lpD3DHWDesc, LPD3DDEVICEDESC lpD3DHELDesc, void *pVoid )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pVoid;
- LPD3DDEVICEDESC pChoice = lpD3DHWDesc;
-
- DPF(( DBG_FUNC, "EnumDeviceHook();" ));
-
- /* Determine if which device description is valid. */
- if ( pChoice->dcmColorModel == 0 )
- pChoice = lpD3DHELDesc;
-
- /* Make sure we always have a GUID. */
- memcpy( &pHAL->guid, lpGuid, sizeof(GUID) );
-
- /* This controls whether we will except HW or not. */
- if ( pHAL->shared.bForceSW == TRUE )
- {
- return (pChoice == lpD3DHELDesc) ? D3DENUMRET_CANCEL : D3DENUMRET_OK;
- }
-
- /* Always try for hardware. */
- if ( pChoice == lpD3DHWDesc )
- {
- return D3DENUMRET_CANCEL;
- }
-
- return D3DENUMRET_OK;
-}
-/*===========================================================================*/
-/* This function will destroy any and all surfaces that this context has */
-/* allocated. If there is a clipper object then it will also be destoryed as*/
-/* it is part of the Primary Surface. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void DestroyAllSurfaces( PMESAD3DHAL pHAL )
-{
- LONG refCount;
-
- DPF(( DBG_FUNC, "DestroyAllSurfaces();" ));
-
- DX_RESTORE( pHAL->lpDDSPrimary );
- DX_RESTORE( pHAL->lpDDSRender );
- DX_RESTORE( pHAL->lpDDSZbuffer);
-
- if ( pHAL->lpDDSRender )
- {
- pHAL->lpDDSRender->Unlock( NULL );
-
- /* If this isn't a Flipable surface then we must clean up the render. */
- if ( pHAL->shared.bFlipable == FALSE)
- {
- if ( pHAL->lpDDSZbuffer )
- {
- DPF(( DBG_CNTX_INFO, "Remove attached surfaces from RENDER" ));
- pHAL->lpDDSRender->DeleteAttachedSurface( 0, NULL );
- }
-
- DPF(( DBG_CNTX_INFO, "Release RENDER" ));
- refCount = pHAL->lpDDSRender->Release();
- pHAL->lpDDSRender = NULL;
- }
- }
-
- if ( pHAL->lpDDSZbuffer )
- {
- DPF(( DBG_CNTX_INFO, "Release ZBuffer" ));
- pHAL->lpDDSZbuffer->Unlock( NULL );
- refCount = pHAL->lpDDSZbuffer->Release();
- pHAL->lpDDSZbuffer = NULL;
- }
-
- if ( pHAL->lpClipper )
- {
- DPF(( DBG_CNTX_INFO, "Release Clipper" ));
- refCount = pHAL->lpClipper->Release();
- pHAL->lpClipper = NULL;
- }
-
- if ( pHAL->lpDDSPrimary )
- {
- pHAL->lpDDSPrimary->Unlock( NULL );
-
- DPF(( DBG_CNTX_INFO, "Release PRIMARY" ));
- refCount = pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
-}
-/*===========================================================================*/
-/* This function will destroy the current D3DDevice and any resources that */
-/* belong to it. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void DestroyDevice( PMESAD3DHAL pHAL )
-{
- LONG refCount;
-
- DPF(( DBG_FUNC, "DestroyDevice();" ));
-
- /* Kill the D3D stuff if exists. */
- if ( pHAL->lpViewport )
- {
- DPF(( DBG_CNTX_INFO, "Delete Viewport" ));
- pHAL->lpD3DDevice->DeleteViewport( pHAL->lpViewport );
-
- DPF(( DBG_CNTX_INFO, "Release Viewport" ));
- refCount = pHAL->lpViewport->Release();
- pHAL->lpViewport = NULL;
- }
-
- if ( pHAL->lpD3DDevice != NULL )
- {
- DPF(( DBG_CNTX_INFO, "Release D3DDevice" ));
- refCount = pHAL->lpD3DDevice->EndScene();
- refCount = pHAL->lpD3DDevice->Release();
- pHAL->lpD3DDevice = NULL;
- }
-}
-/*===========================================================================*/
-/* This function will destroy the current D3DDevice and any resources that */
-/* belong to it. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void DestroyInterfaces( PMESAD3DHAL pHAL )
-{
- LONG refCount;
-
- DPF(( DBG_FUNC, "DestroyInterfaces();" ));
-
- if ( pHAL->lpD3D3 != NULL )
- {
- DPF(( DBG_CNTX_INFO, "Release Direct3D3" ));
- refCount = pHAL->lpD3D3->Release();
- pHAL->lpD3D3 = NULL;
- }
-
- if ( pHAL->lpDD4 != NULL )
- {
- DPF(( DBG_CNTX_INFO, "Release DDraw4" ));
- refCount = pHAL->lpDD4->Release();
- pHAL->lpDD4 = NULL;
- }
-
- if ( pHAL->lpDD != NULL )
- {
- DPF(( DBG_CNTX_INFO, "Release DDraw" ));
- refCount = pHAL->lpDD->Release();
- pHAL->lpDD = NULL;
- }
-}
-/*===========================================================================*/
-/* This function will first send (not post) a message to the client window */
-/* that this context is using. The client will respond by unbinding itself */
-/* and binding the 'default' context. This allows the API to be supported */
-/* until the window can be destroyed. Finally we post the quit message to */
-/* the client in hopes to end the application. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void FatalShutDown( PMESAD3DHAL pHAL )
-{
- /* Whip this baby in too try and support the API until we die... */
- if ( pHAL )
- SendMessage( pHAL->shared.hwnd, UM_FATALSHUTDOWN, 0L, 0L );
-
- /* Close the client application down. */
- PostQuitMessage( 0 );
-}
-
diff --git a/src/mesa/drivers/d3d/D3DMESA.H b/src/mesa/drivers/d3d/D3DMESA.H
deleted file mode 100644
index 71a7cd8aedf..00000000000
--- a/src/mesa/drivers/d3d/D3DMESA.H
+++ /dev/null
@@ -1,84 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef D3D_MESA_H
-#define D3D_MESA_H
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <windows.h>
-#include <ddraw.h>
-#include <d3d.h>
-#include "matrix.h"
-#include "context.h"
-#include "mtypes.h"
-#include "vb.h"
-#include "D3DShared.h"
-#include "Debug.h"
-#include "NULLProcs.h"
-/*===========================================================================*/
-/* Macros. */
-/*===========================================================================*/
-#define FLIP(h,y) (h-y)
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-struct __extensions__
-{
- PROC proc;
- char *name;
-};
-
-typedef GLbitfield (*ClearPROC)( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-typedef void (*WSpanRGBPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] );
-typedef void (*WSpanRGBAPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
-typedef void (*WSpanRGBAMonoPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] );
-typedef void (*WPixelsRGBAPROC)( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
-typedef void (*WPixelsRGBAMonoPROC)( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] );
-typedef void (*RSpanRGBAPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
-typedef void (*RPixelsRGBAPROC)( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
-
-typedef struct D3D_mesa_context
-{
- PMESAD3DSHARED pShared;
-
- GLcontext *gl_ctx; /* The core GL/Mesa context */
- GLvisual *gl_visual; /* Describes the buffers */
- GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers */
-
- HDC hdc;
- WNDPROC hOldProc;
-
- UCHAR rClear, /* Current clear colors. */
- gClear,
- bClear,
- aClear,
- rCurrent, /* Current rendering colors. */
- gCurrent,
- bCurrent,
- aCurrent;
-
- struct D3D_mesa_context *next;
-
-} D3DMESACONTEXT, *PD3DMESACONTEXT;
-/*===========================================================================*/
-/* Extern function prototypes. */
-/*===========================================================================*/
-extern void gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-extern D3DTLVERTEX D3DTLVertices[(VB_MAX*6)];
-
-#endif
-
diff --git a/src/mesa/drivers/d3d/D3DRaster.cpp b/src/mesa/drivers/d3d/D3DRaster.cpp
deleted file mode 100644
index 41e42ad94ce..00000000000
--- a/src/mesa/drivers/d3d/D3DRaster.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* This function clears the context bound to the supplied shared context. */
-/* The function takes the D3D flags D3DCLEAR_TARGET, D3DCLEAR_STENCIL and */
-/* D3DCLEAR_ZBUFFER. Set bAll to TRUE for a full clear else supply the coord*/
-/* of the rect to be cleared relative to the window. The color is always a */
-/* 32bit value (RGBA). Fill in the z-value and stencil if needed. */
-/* */
-/* TODO: this can be redone to be called by Mesa directly. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void ClearHAL( PMESAD3DSHARED pShared, DWORD dwFlags, BOOL bAll, int x, int y, int cx, int cy, DWORD dwColor, float zv, DWORD dwStencil )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- D3DRECT d3dRect;
-
-#ifdef D3D_DEBUG
- HRESULT rc;
-
- DPF(( DBG_FUNC, "CleaHAL();" ));
-
- /* Make sure we have enough info. */
- if ( (pHAL == NULL) || (pHAL->lpViewport == NULL) )
- return;
-#endif
-
- if ( bAll )
- {
- /* I assume my viewport is valid. */
- d3dRect.lX1 = pShared->rectV.left;
- d3dRect.lY1 = pShared->rectV.top;
- d3dRect.lX2 = pShared->rectV.right;
- d3dRect.lY2 = pShared->rectV.bottom;
- }
- else
- {
- d3dRect.lX1 = pShared->rectV.left + x;
- d3dRect.lY1 = pShared->rectV.top + y;
- d3dRect.lX2 = d3dRect.lX1 + cx;
- d3dRect.lY2 = d3dRect.lY1 + cy;
- }
-
-#ifdef D3D_DEBUG
- rc = pHAL->lpViewport->Clear2( 1, &d3dRect, dwFlags, dwColor, zv, dwStencil );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Clear2 ->", ErrorStringD3D(rc) );
- }
-#else
- pHAL->lpViewport->Clear2( 1, &d3dRect, dwFlags, dwColor, zv, dwStencil );
-#endif
-}
-/*===========================================================================*/
-/* Well this is the guts of it all. Here we rasterize the primitives that */
-/* are in their final form. OpenGL has done all the lighting, transfomations*/
-/* and clipping at this point. */
-/* */
-/* TODO: I'm not sure if I want to bother to check for errors on this call. */
-/* The overhead kills me... */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void DrawPrimitiveHAL( PMESAD3DSHARED pShared, D3DPRIMITIVETYPE dptPrimitiveType, D3DTLVERTEX *pVertices, DWORD dwCount )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
-#ifdef D3D_DEBUG
- HRESULT rc;
-
- DPF(( DBG_FUNC, "DrawPrimitveHAL();" ));
-
- /* Make sure we have enough info. */
- if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) )
- return;
-
- DPF(( DBG_PRIM_INFO, "DP( %d )", dwCount ));
-
- rc = pHAL->lpD3DDevice->DrawPrimitive( dptPrimitiveType,
- D3DFVF_TLVERTEX,
- (LPVOID)pVertices,
- dwCount,
- (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "DrawPrimitive ->", ErrorStringD3D(rc) );
- }
-#else
- pHAL->lpD3DDevice->DrawPrimitive( dptPrimitiveType,
- D3DFVF_TLVERTEX,
- (LPVOID)pVertices,
- dwCount,
- (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
-#endif
-}
-/*===========================================================================*/
-/* This call will handle the swapping of the buffers. Now I didn't bother */
-/* to support single buffered so this will be used for glFlush() as its all */
-/* the same. So first we do an EndScene as we are always considered to be in*/
-/* a BeginScene because when we leave we do a BeginScene. Now note that when*/
-/* the context is created in the first place we do a BeginScene also just to */
-/* get things going. The call will use either Flip/blt based on the type of */
-/* surface was created for rendering. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void SwapBuffersHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
-#ifdef D3D_DEBUG
- HRESULT rc;
-
- DPF(( DBG_FUNC, "SwapBuffersHAL();" ));
- DPF(( DBG_ALL_PROFILE, "=================SWAP===================" ));
-
- /* Make sure we have enough info. */
- if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) )
- return;
-
- /* Make sure we have enough info. */
- if ( pHAL->lpDDSPrimary != NULL )
- {
- rc = pHAL->lpD3DDevice->EndScene();
- if ( FAILED(rc) )
- {
- RIP( pHAL, "EndScene ->", ErrorStringD3D(rc) );
- }
-
- if ( pShared->bFlipable )
- {
- DPF(( DBG_CNTX_PROFILE, "Swap->FLIP" ));
- rc = pHAL->lpDDSPrimary->Flip( NULL, DDFLIP_WAIT );
- }
- else
- {
- DPF(( DBG_CNTX_PROFILE, "Swap->Blt" ));
- rc = pHAL->lpDDSPrimary->Blt( &pShared->rectW, pHAL->lpDDSRender, NULL, DDBLT_WAIT, NULL );
- }
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Blt (RENDER/PRIMARY) ->", ErrorStringD3D(rc) );
- }
-
- rc = pHAL->lpD3DDevice->BeginScene();
- if ( FAILED(rc) )
- {
- RIP( pHAL, "BeginScene ->", ErrorStringD3D(rc) );
- }
- }
-#else
- pHAL->lpD3DDevice->EndScene();
-
- if ( pShared->bFlipable )
- pHAL->lpDDSPrimary->Flip( NULL, DDFLIP_WAIT );
- else
- pHAL->lpDDSPrimary->Blt( &pShared->rectW, pHAL->lpDDSRender, NULL, DDBLT_WAIT, NULL );
-
- pHAL->lpD3DDevice->BeginScene();
-
-#endif
-}
-/*===========================================================================*/
-/* This function is a very thin wrapper for the D3D call 'SetRenderState'. */
-/* Using this function requires all the types to be defined by including the */
-/* D3D header file. */
-/* */
-/* TODO: would be much better to get ride of all these calls per VBRender. */
-/* I feel I should get this call into SetRenderStates() the RenderVB. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void SetStateHAL( PMESAD3DSHARED pShared, DWORD dwType, DWORD dwState )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
-#ifdef D3D_DEBUG
- HRESULT rc;
-
- DPF(( DBG_FUNC, "SetStateHAL();" ));
-
- /* Make sure we have enough info. */
- if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) )
- return;
-
- rc = pHAL->lpD3DDevice->SetRenderState( (D3DRENDERSTATETYPE)dwType, dwState );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "SetRenderState ->", ErrorStringD3D(rc) );
- }
-
-#else
- pHAL->lpD3DDevice->SetRenderState( (D3DRENDERSTATETYPE)dwType, dwState );
-#endif
-}
-
-
-
-
-
-
-
-
diff --git a/src/mesa/drivers/d3d/D3DShared.h b/src/mesa/drivers/d3d/D3DShared.h
deleted file mode 100644
index cc629e21111..00000000000
--- a/src/mesa/drivers/d3d/D3DShared.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef D3D_MESA_ALL_H
-#define D3D_MESA_ALL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <stdio.h>
-#include <string.h>
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-#define TM_ACTION_LOAD 0x01
-#define TM_ACTION_BIND 0x02
-#define TM_ACTION_UPDATE 0x04
-
-#define UM_FATALSHUTDOWN (WM_USER+42)
-/*===========================================================================*/
-/* Macros defines. */
-/*===========================================================================*/
-#define ALLOC(cb) malloc( (cb) )
-#define FREE(p) { free( (p) ); (p) = NULL; }
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-typedef struct _pixel_convert
-{
- int cb, /* Count in bytes of one pixel. */
- rShift, /* Shift count that postions each componet. */
- gShift,
- bShift,
- aShift;
- float rScale, /* Value that scales a color that ranges 0.0 -> 1.0 */
- gScale, /* to this pixel format. */
- bScale,
- aScale;
- DWORD dwRMask, /* Color mask per component. */
- dwGMask,
- dwBMask,
- dwAMask;
-
-} PIXELINFO, *PPIXELINFO;
-
-
-typedef struct _d3d_shared_info
-{
- HWND hwnd;
- BOOL bWindow,
- bFlipable,
- bForceSW,
- bHardware;
- RECT rectW, /* Window size and postion in screen space. */
- rectV; /* Viewport size and postion. */
- DWORD dwWidth, /* Current render size for quick checks. */
- dwHeight;
-
- PIXELINFO pixel;
- DWORD dwSrcBlendCaps[14], /* See D3DCAPS.CPP */
- dwDestBlendCaps[14],
- dwTexFunc[4];
-
-} MESAD3DSHARED, *PMESAD3DSHARED;
-
-typedef struct _render_options
-{
- BOOL bForceSoftware, /* TODO: Add user switches. */
- bStretchtoPrimary;
-
-} USER_CTRL, *PUSER_CRTL;
-
-enum { s_zero = 0,
- s_one,
- s_dst_color,
- s_one_minus_dst_color,
- s_src_alpha,
- s_one_minus_src_alpha,
- s_dst_alpha,
- s_one_minus_dst_alpha,
- s_src_alpha_saturate,
- s_constant_color,
- s_one_minus_constant_color,
- s_constant_alpha,
- s_one_minus_constant_alpha };
-
-enum { d_zero = 0,
- d_one,
- d_src_color,
- d_one_minus_src_color,
- d_src_alpha,
- d_one_minus_src_alpha,
- d_dst_alpha,
- d_one_minus_dst_alpha,
- d_constant_color,
- d_one_minus_constant_color,
- d_constant_alpha,
- d_one_minus_constant_alpha };
-
-enum { d3dtblend_decal = 0,
- d3dtblend_decalalpha,
- d3dtblend_modulate,
- d3dtblend_modulatealpha };
-
-/*===========================================================================*/
-/* Function prototypes. */
-/*===========================================================================*/
-PMESAD3DSHARED InitHAL( HWND hwnd );
-void TermHAL( PMESAD3DSHARED pShared );
-BOOL CreateHAL( PMESAD3DSHARED pShared );
-BOOL SetViewportHAL( PMESAD3DSHARED pShared, RECT *pRect, float minZ, float maxZ );
-
-void ClearHAL( PMESAD3DSHARED pShared, DWORD dwFlags, BOOL bAll, int x, int y, int cx, int cy, DWORD dwColor, float zv, DWORD dwStencil );
-void SetStateHAL( PMESAD3DSHARED pShared, DWORD dwType, DWORD dwState );
-void DrawPrimitiveHAL( PMESAD3DSHARED pShared, D3DPRIMITIVETYPE dptPrimitiveType, D3DTLVERTEX *pVertices, DWORD dwCount );
-
-void SwapBuffersHAL( PMESAD3DSHARED pShared );
-DDSURFACEDESC2 *LockHAL( PMESAD3DSHARED pShared, BOOL bBack );
-void UnlockHAL( PMESAD3DSHARED pShared, BOOL bBack );
-void UpdateScreenPosHAL( PMESAD3DSHARED pShared );
-void GetPixelInfoHAL( PMESAD3DSHARED pShared, PPIXELINFO pPixel );
-BOOL CreateTMgrHAL( PMESAD3DSHARED pShared, DWORD dwName, int level, DWORD dwRequestFlags, RECT *rectDirty, DWORD dwWidth, DWORD dwHeight, DWORD dwAction, void *pPixels );
-void DisableTMgrHAL( PMESAD3DSHARED pShared );
-
-
-int SaveDIBitmap( char *filename, BITMAPINFO *info, void *bits );
-int ARGB_SaveBitmap( char *filename, int width, int height, unsigned char *pARGB );
-int BGRA_SaveBitmap( char *filename, int width, int height, unsigned char *pBGRA );
-int BGR_SaveBitmap( char *filename, int width, int height, unsigned char *pBGR );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-extern float g_DepthScale, /* Mesa needs to scale Z in SW. The HAL */
- g_MaxDepth; /* doesn't but I wanted SW still to work.*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
diff --git a/src/mesa/drivers/d3d/D3DTEXT.CPP b/src/mesa/drivers/d3d/D3DTEXT.CPP
deleted file mode 100644
index 39855b65fa9..00000000000
--- a/src/mesa/drivers/d3d/D3DTEXT.CPP
+++ /dev/null
@@ -1,576 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "d3dText.h"
-
-/*=============================================================================
-
- 1
- ------
- | |
- 6 | | 2
- | 7 |
- ------
- | |
- 5 | | 3
- | |
- ------
- 4
-
- TL_0 TR_0
-TLL TL_1 TR_1 TRR
-
-MLL_0 ML_0 MR_0 MRR_0
-MLL_1 ML_1 MR_1 MRR_1
-
-BLL BL_0 BR_0 BRR
- BL_1 BR_1
-
-=============================================================================*/
-
-#define TLL 0
-#define TRR 1
-#define TL_0 2
-#define TL_1 3
-#define TR_0 4
-#define TR_1 5
-
-#define MLL_0 6
-#define MLL_1 7
-#define MRR_0 8
-#define MRR_1 9
-
-#define ML_0 10
-#define ML_1 11
-#define MR_0 12
-#define MR_1 13
-
-#define BL_0 14
-#define BL_1 15
-#define BR_0 16
-#define BR_1 17
-#define BLL 18
-#define BRR 19
-
-#define BIT1 0x00000001
-#define BIT2 0x00000002
-#define BIT3 0x00000004
-#define BIT4 0x00000008
-#define BIT5 0x00000010
-#define BIT6 0x00000020
-#define BIT7 0x00000040
-
-#define TOP BIT4
-#define MIDDLE BIT7
-#define BOTTOM BIT1
-#define TLEFT BIT5
-#define BLEFT BIT6
-#define LEFT (TLEFT|BLEFT)
-#define TRIGHT BIT3
-#define BRIGHT BIT2
-#define RIGHT (TRIGHT|BRIGHT)
-#define ALL 0xFFFFFFFF
-
-/*===========================================================================*/
-/* This is the static array that will map the ASCII value of the character */
-/* being draw to the bit mask that will be scan converted to the LED display.*/
-/*===========================================================================*/
-DWORD textBitMasks[] =
-{
- 0xFFFFFFFF, // 000
- 0xFFFFFFFF, // 001
- 0xFFFFFFFF, // 002
- 0xFFFFFFFF, // 003
- 0xFFFFFFFF, // 004
- 0xFFFFFFFF, // 005
- 0xFFFFFFFF, // 006
- 0xFFFFFFFF, // 007
- 0xFFFFFFFF, // 008
- 0xFFFFFFFF, // 009
- 0xFFFFFFFF, // 010
- 0xFFFFFFFF, // 011
- 0xFFFFFFFF, // 012
- 0xFFFFFFFF, // 013
- 0xFFFFFFFF, // 014
- 0xFFFFFFFF, // 015
- 0xFFFFFFFF, // 016
- 0xFFFFFFFF, // 017
- 0xFFFFFFFF, // 018
- 0xFFFFFFFF, // 019
- 0xFFFFFFFF, // 020
- 0xFFFFFFFF, // 021
- 0xFFFFFFFF, // 022
- 0xFFFFFFFF, // 023
- 0xFFFFFFFF, // 024
- 0xFFFFFFFF, // 025
- 0xFFFFFFFF, // 026
- 0xFFFFFFFF, // 027
- 0xFFFFFFFF, // 028
- 0xFFFFFFFF, // 029
- 0xFFFFFFFF, // 030
- 0XFFFFFFFF, // 031
- 0x00000000, // 032 'SPC'
- 0xFFFFFFFF, // 033
- 0xFFFFFFFF, // 034
- 0xFFFFFFFF, // 035
- 0xFFFFFFFF, // 036
- 0xFFFFFFFF, // 037
- 0xFFFFFFFF, // 038
- 0xFFFFFFFF, // 039
- 0xFFFFFFFF, // 040
- 0xFFFFFFFF, // 041
- 0xFFFFFFFF, // 042
- 0xFFFFFFFF, // 043
- 0xFFFFFFFF, // 044
- 0xFFFFFFFF, // 045
- 0xFFFFFFFF, // 046
- 0xFFFFFFFF, // 047
- (ALL &~ MIDDLE), // 048 '0'
- (RIGHT), // 049 '1'
- (ALL &~ TLEFT &~ BRIGHT), // 050 '2'
- (ALL &~ LEFT), // 051 '3'
- (TLEFT | MIDDLE | RIGHT), // 052 '4'
- (ALL &~ TRIGHT &~ BLEFT), // 053 '5'
- (ALL &~ TRIGHT), // 054 '6'
- (TOP | RIGHT), // 055 '7'
- (ALL), // 056 '8'
- (ALL &~ BOTTOM &~ BLEFT), // 057 '9'
- 0xFFFFFFFF, // 058
- 0xFFFFFFFF, // 059
- 0xFFFFFFFF, // 060
- 0XFFFFFFFF, // 061
- 0xFFFFFFFF, // 062
- 0xFFFFFFFF, // 063
- 0xFFFFFFFF, // 064
- (ALL &~ BOTTOM), // 065 'A'
- (ALL), // 066 'B'
- (TOP | LEFT | BOTTOM), // 067 'C'
- (ALL &~ MIDDLE), // 068 'D'
- (ALL &~ RIGHT), // 069 'E'
- (LEFT | TOP | MIDDLE), // 070 'F'
- 0x00000000, // 071 'G'
- (ALL &~ TOP &~ BOTTOM), // 072 'H'
- (RIGHT), // 073 'I'
- (RIGHT | BOTTOM), // 074 'J'
- 0x00000000, // 075 'K'
- (LEFT | BOTTOM), // 076 'L'
- 0x00000000, // 088 'M'
- 0x00000000, // 089 'N'
- (ALL &~ MIDDLE), // 090 'O'
- (ALL &~ BRIGHT &~ BOTTOM),// 091 'P'
- 0x00000000, // 092 'Q'
- 0x00000000, // 093 'R'
- (ALL &~ TRIGHT &~ BLEFT), // 094 'S'
- 0X00000000, // 095 'T'
- (LEFT | RIGHT | BOTTOM), // 096 'U'
- 0x00000000, // 097 'V'
- 0x00000000, // 098 'W'
- 0x00000000, // 099 'X'
- 0x00000000, // 1000 'Z'
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 100
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 104
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 108
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 112
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 116
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 120
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF // 124
-};
-
-#define CT 1.0f
-#define CX 7.0f
-#define CY 13.0f
-#define CM ((CY-(CT*3.0f))/2.0f)
-
-float lCoords[][2] =
-{
- /* Top outsides. */
- { 0, (CY-CT) },
- { CX, (CY-CT) },
-
- /* Top Line. */
- { CT, CY },
- { CT, (CY-CT) },
- { (CX-CT), CY },
- { (CX-CT), (CY-CT) },
-
- /* Middle outsides. */
- { 0.0f, (CT+CM+CT) },
- { 0.0f, (CT+CM) },
- { CX, (CT+CM+CT) },
- { CX, (CT+CM) },
-
- /* Middle Line. */
- { CT, (CT+CM+CT) },
- { CT, (CT+CM) },
- { (CX-CT), (CT+CM+CT) },
- { (CX-CT), (CT+CM) },
-
- /* Bottom line. */
- { CT, CT },
- { CT, 0.0f },
- { (CX-CT), CT },
- { (CX-CT), 0.0f },
-
- /* Bottom outsides. */
- { 0.0f, CT},
- { CX, CT }
-};
-
-static int ConvertCharacter( char *c, int cIndex, PD3DFONTMETRICS pfntMetrics );
-
-D3DTLVERTEX TextVertices[MAX_VERTICES];
-/*===========================================================================*/
-/* When we attach I will zero out the whole D3D vertex buffer I'm using for */
-/* the text. This way I don't need to set all the redundant values. I also */
-/* set all the oow values to 1 as I will be doing direct rendering. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-extern "C" BOOL InitD3DText( void )
-{
- int index;
-
- /* Set the D3D Vertex Buffer up once so we don't do redundant changes. */
- memset( &TextVertices[0], 0, sizeof(TextVertices) );
- for( index = 0; index < MAX_VERTICES; index++ )
- TextVertices[index].rhw = D3DVAL( 1.0 );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function takes a single character and draw it using the supplied */
-/* fontmetrics structure. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void d3dTextDrawString( char *pszString, int x, int y, PD3DFONTMETRICS pfntMetrics )
-{
- int cIndex,
- nIndex,
- index;
- float cWidth = CX,
- cHeight = CY;
-
- /* Find the max width/height of a character and add the spacing so */
- /* that we can use this value to calculate the x,y of the character.*/
- cWidth = (cWidth * pfntMetrics->fntXScale) + pfntMetrics->fntXSpacing;
- cHeight = (cHeight * pfntMetrics->fntYScale) + pfntMetrics->fntYSpacing;
-
- /* Walk the string. This must be NULL terminated. */
- for( cIndex = 0, nIndex = 0; *pszString; pszString++, cIndex = nIndex, x++ )
- {
- /* Convert the character and get the index into the text vertex buffer. */
- nIndex = ConvertCharacter( &pszString[0], cIndex, pfntMetrics );
- if ( (nIndex - cIndex) > 2 )
- {
- /* Modify the text vertex buffer based on the fntMetrics structure. */
- for( index = cIndex; index < nIndex; index++ )
- {
- /* Scale the character. */
- TextVertices[index].sx *= pfntMetrics->fntXScale;
- TextVertices[index].sy *= pfntMetrics->fntYScale;
-
- /* Move the character. */
- TextVertices[index].sx += (cWidth*x);
- TextVertices[index].sy += (cHeight*y);
-
- /* Set the color. */
- TextVertices[index].color = pfntMetrics->dwColor;
- }
- }
- }
-
- if ( nIndex < 3 )
- return;
-
- /* Set the states that slim things down. */
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_CULLMODE, D3DCULL_NONE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZWRITEENABLE , FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
-
- /* Blast them baby... */
- pfntMetrics->lpD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST,
- D3DFVF_TLVERTEX,
- (LPVOID)&TextVertices[0],
- nIndex,
- (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
-}
-/*===========================================================================*/
-/* This function takes a single character and draw it directly to the screen*/
-/* unsing the supplied fntMetrics structure. The character will be drawn at */
-/* the supplied x,y. The x,y position is relative to the top left and uses */
-/* the spacing in the fntMetrics structure. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void d3dTextDrawCharacter( char *c, int x, int y, PD3DFONTMETRICS pfntMetrics )
-{
- int cIndex = 0,
- index;
- float cWidth = CX,
- cHeight = CY;
-
- /* Convert the character and get the index into the text vertex buffer. */
- cIndex = ConvertCharacter( c, 0, pfntMetrics );
- if ( cIndex < 3 )
- return;
-
- /* Find the max width/height of a character and add the spacing so */
- /* that we can use this value to calculate the x,y of the character.*/
- cWidth = (cWidth * pfntMetrics->fntXScale) + pfntMetrics->fntXSpacing;
- cHeight = (cHeight * pfntMetrics->fntYScale) + pfntMetrics->fntYSpacing;
-
- /* Modify the text vertex buffer based on the fntMetrics structure. */
- for( index = 0; index < cIndex; index++ )
- {
- /* Scale the character. */
- TextVertices[index].sx *= pfntMetrics->fntXScale;
- TextVertices[index].sy *= pfntMetrics->fntYScale;
-
- /* Move the character. */
- TextVertices[index].sx += (cWidth*x);
- TextVertices[index].sy += (cHeight*y);
-
- /* Set the color. */
- TextVertices[index].color = pfntMetrics->dwColor;
- }
-
-
- /* Set the states that slim things down. */
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_CULLMODE, D3DCULL_NONE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZWRITEENABLE , FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
-
- /* Blast them baby... */
- pfntMetrics->lpD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST,
- D3DFVF_TLVERTEX,
- (LPVOID)&TextVertices[0],
- cIndex,
- (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
-}
-/*===========================================================================*/
-/* This function takes a single character and draw it using the supplied */
-/* fontmetrics structure. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static int ConvertCharacter( char *c, int cIndex, PD3DFONTMETRICS pfntMetrics )
-{
- DWORD asciiChar = (int)(*c);
-
- /* Handle the TOP line. */
- if ( textBitMasks[asciiChar] & BIT1 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_0][1] );
- }
-
- /* Handle the TOP/BOTTOM RIGHT lines. */
- // if ( textBitMasks[index] & (BIT2|BIT3) )
- if ( 1 == 0 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TRR][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
- }
- else
- {
- if ( textBitMasks[asciiChar] & BIT2 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TRR][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TR_1][1] );
- }
- if ( textBitMasks[asciiChar] & BIT3 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_1][1] );
- }
- }
-
- /* Handle the TOP/BOTTOM LEFT lines. */
- // if ( textBitMasks[asciiChar] & (BIT5|BIT6) )
- if ( 1 == 0 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TLL][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BLL][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BLL][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TLL][1] );
- }
- else
- {
- if ( textBitMasks[asciiChar] & BIT5 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BLL][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BLL][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_1][1] );
- }
- if ( textBitMasks[asciiChar] & BIT6 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TLL][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TLL][1] );
- }
- }
-
- /* Handle the MIDDLE line. */
- if ( textBitMasks[asciiChar] & BIT7 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_0][1] );
- }
-
- /* Handle the BOTTOM line. */
- if ( textBitMasks[asciiChar] & BIT4 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
- }
-
- return cIndex;
-}
-
-#undef CM
-#undef CY
-#undef CX
-#undef CT
-
-#undef TLL
-#undef TRR
-#undef TL_0
-#undef TL_1
-#undef TR_0
-#undef TR_1
-
-#undef MLL_0
-#undef MLL_1
-#undef MRR_0
-#undef MRR_1
-
-#undef ML_0
-#undef ML_1
-#undef MR_0
-#undef MR_1
-
-#undef BL_0
-#undef BL_1
-#undef BR_0
-#undef BR_1
-#undef BLL
-#undef BRR
-
-#undef BIT1
-#undef BIT2
-#undef BIT3
-#undef BIT4
-#undef BIT5
-#undef BIT6
-#undef BIT7
-
-#undef TOP
-#undef MIDDLE
-#undef BOTTOM
-#undef TLEFT
-#undef BLEFT
-#undef LEFT
-#undef TRIGHT
-#undef BRIGHT
-#undef RIGHT
-#undef ALL
diff --git a/src/mesa/drivers/d3d/D3DTextureMgr.cpp b/src/mesa/drivers/d3d/D3DTextureMgr.cpp
deleted file mode 100644
index a6600cab02c..00000000000
--- a/src/mesa/drivers/d3d/D3DTextureMgr.cpp
+++ /dev/null
@@ -1,947 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* Local function prototypes. */
-/*===========================================================================*/
-static void UpdateTexture( PTM_OBJECT pTMObj, BOOL bVideo, RECT *pRect, UCHAR *pixels );
-static BOOL LoadTextureInVideo( PMESAD3DHAL pHAL, PTM_OBJECT pTMObj );
-static BOOL FreeTextureMemory( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject );
-static BOOL DestroyTextureObject( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject );
-HRESULT CALLBACK EnumPFHook( LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext );
-/*===========================================================================*/
-/* This function will simply set the top of stack to NULL. I only used it */
-/* just incase I want to add something later. */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-BOOL InitTMgrHAL( PMESAD3DHAL pHAL )
-{
- DPF(( DBG_FUNC, "InitTMgrHAL();" ));
-
- /* Be clean my friend. */
- pHAL->pTMList = NULL;
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will walk the Texture Managers linked list and destroy all */
-/* surfaces (SYSTEM/VIDEO). The texture objects themselves also will be */
-/* freed. */
-/* NOTE: this is per/context. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void TermTMgrHAL( PMESAD3DHAL pHAL )
-{
- DPF(( DBG_FUNC, "TermTMgrHAL();" ));
-
- if ( pHAL && pHAL->pTMList )
- {
- /* Destroy the surface and remove the TMO from the stack. */
- while( DestroyTextureObject(pHAL,NULL) );
-
- /* Be clean my friend. */
- pHAL->pTMList = NULL;
- }
-}
-/*===========================================================================*/
-/* This function is a HACK as I don't know how I can disable a texture with-*/
-/* out booting it out. Is there know state change? */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void DisableTMgrHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
- DPF(( DBG_FUNC, "DisableTMgrHAL();" ));
-
- /* Check too see that we have a valid context. */
- if ( (pHAL == NULL) && (pHAL->lpD3DDevice != NULL) )
- {
- DPF(( DBG_TXT_WARN, "Null HAL/Direct3D Device!" ));
- return;
- }
-
- // TODO: This is a hack to shut off textures.
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
-}
-/*===========================================================================*/
-/* This function is the only entry into the TextureManager that Mesa/wgl */
-/* will see. It uses a dwAction to specify what we are doing. I did this as*/
-/* depending on the cards resources the action taken can change. */
-/* When this function is called we will always search the Texture Managers */
-/* linked list (per context remember) and try and find a structure that has */
-/* the same dwName. If we have a match we pull it out of the list and put it*/
-/* at the top of the list (TOL). If we don't find one then we create a struc*/
-/* and put it a TOL. This TOL idea makes for some caching as we will always */
-/* destroy Texture Surfaces from the bottom up... */
-/* All texture objects at this point will create a texture surface in System*/
-/* memory (SMEM). Then we will copy the Mesa texture into the surface using */
-/* the 'pixel' struc to get the translation info. So now this means that all*/
-/* textures that Mesa gives me I will have a Surface with a copy. If Mesa */
-/* changes the texture the I update the surface in (SMEM). */
-/* Now we have a texture struc and a Texture Surface in SMEM. At this point*/
-/* we create another surface on the card (VMEM). Finally we blt from the */
-/* SMEM to the VMEM and set the texture as current. Why do I need two? First*/
-/* this solves square textures. If the cards CAPS is square textures only */
-/* then I change the dimensions of the VMEM surface and the blt solves it for*/
-/* me. Second it saves me from filling D3D textures over and over if the */
-/* card needs to be creating and destroying surfaces because of low memory. */
-/* The surface in SMEM is expected to work always. When a surface has to be*/
-/* created in VMEM then we put it in a loop that tries to create the surface.*/
-/* If we create the surface ok then we brake from the loop. If we fail then */
-/* we will call 'FreeTextureMemory' that will return TRUE/FALSE as to whether*/
-/* memory was freed. If memory was freed then we can try again. If no memory*/
-/* was freed then it just can't fit. */
-/* 'FreeTextureMemory' will find the end of the list and start freeing VMEM */
-/* (never SMEM) surfaces that are not locked. */
-/* BIND - when we bind and there is a texture struct with a texture surface */
-/* in VMEM then we just make it current. If we have a struct and a surface */
-/* in SMEM but no VMEM surface then we create the surface in VMEM and blt */
-/* from the SMEM surface. If we have nothing its just like a creation... */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-extern "C" BOOL CreateTMgrHAL( PMESAD3DSHARED pShared, DWORD dwName, int level, DWORD dwRequestFlags,
- RECT *rectDirty, DWORD dwWidth, DWORD dwHeight, DWORD dwAction, void *pPixels )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- PTM_OBJECT pTMObj,
- pTemp;
- DDSURFACEDESC2 ddsd2;
- HRESULT rc;
-
-
- DPF(( DBG_FUNC, "CreateTMgrHAL();" ));
-
- DPF(( DBG_TXT_INFO, "Texture:" ));
- DPF(( DBG_TXT_INFO, "cx: %d cy: %d", dwWidth, dwHeight ));
- DPF(( DBG_TXT_INFO, "Rect:" ));
- if ( rectDirty )
- {
- DPF(( DBG_TXT_INFO, "x0: %d y0: %d", rectDirty->left, rectDirty->top ));
- DPF(( DBG_TXT_INFO, "x1: %d y1: %d", rectDirty->right, rectDirty->bottom ));
- }
-
- /* Check too see that we have a valid context. */
- if ( (pHAL == NULL) && (pHAL->lpD3DDevice != NULL) )
- {
- DPF(( DBG_TXT_WARN, "Null HAL/Direct3D Device!" ));
- return FALSE;
- }
-
- /*=================================================*/
- /* See if we can find this texture object by name. */
- /*=================================================*/
- for( pTMObj = pHAL->pTMList; pTMObj && (pTMObj->dwName != dwName); pTMObj = pTMObj->next );
-
- /*=========================================================*/
- /* Allocate a new object if we didn't get a matching name. */
- /*=========================================================*/
- if ( pTMObj == NULL )
- {
- pTMObj = (PTM_OBJECT)ALLOC( sizeof(TM_OBJECT) );
- if ( pTMObj == NULL )
- return FALSE;
- memset( pTMObj, 0, sizeof(TM_OBJECT) );
-
- /* Put the object at the beginning of the list. */
- pTMObj->next = pHAL->pTMList;
- if ( pTMObj->next )
- {
- pTemp = pTMObj->next;
- pTemp->prev = pTMObj;
- }
- pHAL->pTMList = pTMObj;
- }
- else
- {
- /*===============================================================*/
- /* Make some caching happen by pulling this object to the front. */
- /*===============================================================*/
- if ( pHAL->pTMList != pTMObj )
- {
- /* Pull the object out of the list. */
- if ( pTMObj->prev )
- {
- pTemp = pTMObj->prev;
- pTemp->next = pTMObj->next;
- }
- if ( pTMObj->next )
- {
- pTemp = pTMObj->next;
- pTemp->prev = pTMObj->prev;
- }
-
- pTMObj->prev = NULL;
- pTMObj->next = NULL;
-
- /* Put the object at the front of the list. */
- pTMObj->next = pHAL->pTMList;
- if ( pTMObj->next )
- {
- pTemp = pTMObj->next;
- pTemp->prev = pTMObj;
- }
- pHAL->pTMList = pTMObj;
- }
- }
-
- /*========================================================*/
- /* If we are doing BIND and the texture is in VID memory. */
- /*========================================================*/
- if ( (dwAction == TM_ACTION_BIND) && pTMObj->lpDDS_Video )
- {
- DPF(( DBG_TXT_PROFILE, "Cache HIT (%d)", dwName ));
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
- }
-
- /*=================================================================*/
- /* If we are doing BIND and the texture is at least in SYS memory. */
- /*=================================================================*/
- if ( (dwAction == TM_ACTION_BIND) && pTMObj->lpDDS_System )
- {
- DPF(( DBG_TXT_PROFILE, "Cache MISS (%d)", dwName ));
-
- /* Create the texture on the card. */
- rc = LoadTextureInVideo( pHAL, pTMObj );
- if ( rc == FALSE )
- return FALSE;
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
- }
-
- /*=========================================================*/
- /* If we are doing UPDATE then try in VID first for speed. */
- /*=========================================================*/
- if ( (dwAction == TM_ACTION_UPDATE) && pTMObj->lpDDS_Video &&
- !(pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY) )
- {
- DPF(( DBG_TXT_INFO, "Fix the SubTexture update Leigh!" ));
-
- /* Update the texture on the card. */
- UpdateTexture( pTMObj, TRUE, rectDirty, (UCHAR *)pPixels );
-
- /* We updated the texture in VID so kill the SYS so we know its dirty. */
- if ( pTMObj->lpDDS_System )
- {
- DPF(( DBG_TXT_INFO, "Release texture (SYS)" ));
- DX_RESTORE( pTMObj->lpDDS_System );
- pTMObj->lpDDS_System->Release();
- pTMObj->lpDDS_System = NULL;
- }
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
- }
-
- /*===========================================================*/
- /* If we are doing UPDATE then try in SYS still gives speed. */
- /*===========================================================*/
- if ( (dwAction == TM_ACTION_UPDATE) && pTMObj->lpDDS_System )
- {
- DPF(( DBG_TXT_INFO, "Fix the SubTexture update Leigh!" ));
-
- /* Update the texture in SYS. */
- UpdateTexture( pTMObj, FALSE, NULL, (UCHAR *)pPixels );
-
- /* We updated the SYS texture only so now blt to the VID. */
- rc = LoadTextureInVideo( pHAL, pTMObj );
- if ( rc == FALSE )
- return FALSE;
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
- }
-
- /* At this point we have a valid Texture Manager Object with updated */
- /* links. We now need to create or update a texture surface that is */
- /* in system memory. Every texture has a copy in system so we can use*/
- /* blt to solve problems with textures allocated on the card (square */
- /* only textures, pixelformats...). */
-
- // TODO: make support for update also. Dirty rectangle basicly...
-
- /* Kill the interface if we have one no matter what. */
- if ( pTMObj->lpD3DTexture2 )
- {
- DPF(( DBG_TXT_INFO, "Release Texture2" ));
- pTMObj->lpD3DTexture2->Release();
- pTMObj->lpD3DTexture2 = NULL;
- }
-
- /* Kill the system surface. TODO: should try to get the SubIMage going again */
- if ( pTMObj->lpDDS_System )
- {
- DPF(( DBG_TXT_INFO, "Release texture (SYS)" ));
- DX_RESTORE( pTMObj->lpDDS_System );
- pTMObj->lpDDS_System->Release();
- pTMObj->lpDDS_System = NULL;
- }
-
- /* Kill the Video surface. TODO: need some reuse system... */
- if ( pTMObj->lpDDS_Video )
- {
- DPF(( DBG_TXT_INFO, "Release texture (VID)" ));
- DX_RESTORE( pTMObj->lpDDS_Video );
- pTMObj->lpDDS_Video->Release();
- pTMObj->lpDDS_Video = NULL;
- }
-
- /*================================================================*/
- /* Translate the the Mesa/OpenGL pixel channels to the D3D flags. */
- /*================================================================*/
- switch( dwRequestFlags )
- {
- case GL_ALPHA:
- dwRequestFlags = DDPF_ALPHA;
- DPF(( DBG_TXT_WARN, "GL_ALPHA not supported!)" ));
- return FALSE;
-
- case GL_INTENSITY:
- case GL_LUMINANCE:
- DPF(( DBG_TXT_WARN, "GL_INTENSITY/GL_LUMINANCE not supported!)" ));
- dwRequestFlags = DDPF_LUMINANCE;
- return FALSE;
-
- case GL_LUMINANCE_ALPHA:
- DPF(( DBG_TXT_WARN, "GL_LUMINANCE_ALPHA not supported!)" ));
- dwRequestFlags = DDPF_LUMINANCE | DDPF_ALPHAPIXELS;
- return FALSE;
-
- case GL_RGB:
- DPF(( DBG_TXT_INFO, "Texture -> GL_RGB" ));
- dwRequestFlags = DDPF_RGB;
- break;
-
- case GL_RGBA:
- DPF(( DBG_TXT_INFO, "Texture -> GL_RGBA" ));
- dwRequestFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
- break;
- }
-
- /*==============================*/
- /* Populate the texture object. */
- /*==============================*/
- pTMObj->dwName = dwName;
- pTMObj->lpD3DDevice = pHAL->lpD3DDevice;
- pTMObj->dwFlags = dwRequestFlags;
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY )
- {
- DPF(( DBG_TXT_INFO, "Convert to Square..." ));
- pTMObj->dwSHeight = dwHeight;
- pTMObj->dwSWidth = dwWidth;
-
- /* Shrink non-square textures. */
- pTMObj->dwVHeight = (dwHeight > dwWidth) ? dwWidth : dwHeight;
- pTMObj->dwVWidth = (dwHeight > dwWidth) ? dwWidth : dwHeight;
- }
- else
- {
- pTMObj->dwSHeight = dwHeight;
- pTMObj->dwSWidth = dwWidth;
- pTMObj->dwVHeight = dwHeight;
- pTMObj->dwVWidth = dwWidth;
- }
-
- /*========================*/
- /* Create SYSTEM surface. */
- /*========================*/
-
- /* Request a surface in system memory. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- ddsd2.dwWidth = pTMObj->dwSWidth;
- ddsd2.dwHeight = pTMObj->dwSHeight;
- ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY;
- ddsd2.ddsCaps.dwCaps2 = 0L;
- memset( &ddsd2.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT) );
- ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT );
- ddsd2.ddpfPixelFormat.dwFlags = dwRequestFlags;
- rc = pHAL->lpD3DDevice->EnumTextureFormats( EnumPFHook, &ddsd2.ddpfPixelFormat );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "EnumerTextureFormats (SYSTEM)->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Create the surface using the enumerated pixelformat. */
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pTMObj->lpDDS_System, NULL );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "CreateSurface (TEXTURE/SYSTEM)->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Solve the pixel mapping info using the surface pixelformat. */
- Solve8BitChannelPixelFormat( &ddsd2.ddpfPixelFormat, &pTMObj->pixel );
-
- /*===================================================================*/
- /* Fill the texture using the PixelInfo structure to do the mapping. */
- /*===================================================================*/
- UpdateTexture( pTMObj, FALSE, NULL, (UCHAR *)pPixels );
-
- /*=======================*/
- /* Create VIDEO surface. */
- /*=======================*/
- rc = LoadTextureInVideo( pHAL, pTMObj );
- if ( rc == FALSE )
- return FALSE;
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will handle the creation and destruction of the texture */
-/* surfaces on the card. Using the dw'V'Width/Height dimensions the call */
-/* try and create the texture on the card and keep using FreeTextureMemory */
-/* until the surace can be created. Once the surface is created we get the */
-/* interface that we will use to make it the current texture. I didn't put */
-/* the code to make the texture current in this function as BIND needs to */
-/* use the same code and this function doesn't always get called when we do a*/
-/* bind. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static BOOL LoadTextureInVideo( PMESAD3DHAL pHAL, PTM_OBJECT pTMObj )
-{
- DDSURFACEDESC2 ddsd2;
- HRESULT rc;
-
- DPF(( DBG_FUNC, "LoadTextureInVideo();" ));
-
- /* Kill the interface if we have one no matter what. */
- if ( pTMObj->lpD3DTexture2 )
- {
- DPF(( DBG_TXT_INFO, "Release Texture2" ));
- pTMObj->lpD3DTexture2->Release();
- pTMObj->lpD3DTexture2 = NULL;
- }
-
- /* Kill the Video surface. TODO: need some reuse system... */
- if ( pTMObj->lpDDS_Video )
- {
- DPF(( DBG_TXT_INFO, "Release texture (VID)" ));
- DX_RESTORE( pTMObj->lpDDS_Video );
- pTMObj->lpDDS_Video->Release();
- pTMObj->lpDDS_Video = NULL;
- }
-
- /* Request a surface in Video memory. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- ddsd2.dwWidth = pTMObj->dwVWidth;
- ddsd2.dwHeight = pTMObj->dwVHeight;
- ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY;
- ddsd2.ddsCaps.dwCaps2 = 0L;
- memset( &ddsd2.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT) );
- ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT );
- ddsd2.ddpfPixelFormat.dwFlags = pTMObj->dwFlags;
- rc = pHAL->lpD3DDevice->EnumTextureFormats( EnumPFHook, &ddsd2.ddpfPixelFormat );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "EnumerTextureFormats ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Make sure we lock so we don't nuke this texture trying to free memory for it. */
- pTMObj->bLock = TRUE;
-
- /* Start a loop that will free all textures until we have created the texture */
- /* surface or we can't free up more memory. */
- do
- {
- /* Try to create the texture surface. */
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pTMObj->lpDDS_Video, NULL );
- if ( !FAILED(rc) )
- break;
-
- DPF(( DBG_TXT_INFO, "Free Texture Memory" ));
-
- /* DestroyTexture will return TRUE if a surface was freed. */
- } while( FreeTextureMemory(pHAL,NULL) );
-
- /* Make sure we unlock or we won't be able to nuke the TMO later. */
- pTMObj->bLock = FALSE;
-
- /* Did we create a valid texture surface? */
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed to load texture" ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- DX_RESTORE( pTMObj->lpDDS_System );
- DX_RESTORE( pTMObj->lpDDS_Video );
-
- DPF(( DBG_TXT_INFO, "Texture Blt SYSTEM -> VID" ));
-
- /* Now blt the texture in system memory to the card. */
- rc = pTMObj->lpDDS_Video->Blt( NULL, pTMObj->lpDDS_System, NULL, DDBLT_WAIT, NULL );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Blt (TEXTURE) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Get the Texture interface that is used to render with. */
- pTMObj->lpDDS_Video->QueryInterface( IID_IDirect3DTexture2, (void **)&pTMObj->lpD3DTexture2 );
- if ( pTMObj->lpD3DTexture2 == NULL )
- {
- DPF(( DBG_TXT_WARN, "Failed QueryTextureInterface" ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
-}
-/*===========================================================================*/
-/* If this function gets a texture object struc then we will try and free */
-/* it. If we get a NULL then we will search from the bottom up and free one */
-/* VMEM surface. I can only free when the surface isn't locked and of course*/
-/* there must be a VMEM surface. We never free SMEM surfaces as that isn't */
-/* the point. */
-/* TODO: should have a pointer to the bottom of the stack really. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static BOOL FreeTextureMemory( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject )
-{
- PTM_OBJECT pCurrent;
- BOOL bFreed = FALSE;
-
- DPF(( DBG_FUNC, "FreeTextureMemory();" ));
- DPF(( DBG_TXT_WARN, "FREE TEXTURE!" ));
-
- /* Just to be safe. */
- if ( !pHAL || !pHAL->pTMList )
- {
- DPF(( DBG_TXT_WARN, "FreeTextureMemory() -> NULL pHAL/pHAL->pTMList" ));
- return FALSE;
- }
-
- /* Free the last texture in the list. */
- if ( pTMObject == NULL )
- {
- DPF(( DBG_TXT_INFO, "Free Last texture in cache" ));
-
- /* Find the last texture object. */
- for( pCurrent = pHAL->pTMList; pCurrent->next; pCurrent = pCurrent->next );
-
- /* Now backup until we find a texture on the card. */
- while( pCurrent && (pCurrent->lpDDS_Video == NULL) && (pCurrent->bLock == FALSE) )
- pCurrent = pCurrent->prev;
-
- /* Didn't find anything. */
- if ( pCurrent == NULL )
- {
- DPF(( DBG_TXT_INFO, "No texture memory freed" ));
- return FALSE;
- }
- }
- else
- {
- /* See if we can find this texture object. */
- for( pCurrent = pHAL->pTMList; pCurrent && (pCurrent != pTMObject); pCurrent = pCurrent->next );
-
- /* Didn't find anything. */
- if ( pCurrent == NULL )
- {
- DPF(( DBG_TXT_INFO, "Requested texture to be freed NOT FOUND" ));
- return FALSE;
- }
- }
-
- /* Can't free this baby. */
- if ( pCurrent->bLock == TRUE )
- {
- DPF(( DBG_TXT_WARN, "Requested texture LOCKED" ));
- return FALSE;
- }
-
- /* Free the texture memory. */
- if ( pCurrent->lpD3DTexture2 )
- {
- DPF(( DBG_TXT_INFO, "Release Texture2" ));
- pCurrent->lpD3DTexture2->Release();
- pCurrent->lpD3DTexture2 = NULL;
- bFreed = TRUE;
- }
- if ( pCurrent->lpDDS_Video )
- {
- DPF(( DBG_TXT_INFO, "Release texture (VID):" ));
- DPF(( DBG_TXT_INFO, "dwName: %d", pCurrent->dwName ));
- DPF(( DBG_TXT_INFO, "cx: %d, cy: %d", pCurrent->dwVWidth, pCurrent->dwVHeight ));
- pCurrent->lpDDS_Video->Release();
- pCurrent->lpDDS_Video = NULL;
- bFreed = TRUE;
- }
-
- return bFreed;
-}
-/*===========================================================================*/
-/* This function searches the linked list of texture objects in the supplied*/
-/* D3Dwrapper structure. If it finds a match it will free it and pull it out*/
-/* of the linked list. The function works on the bases of a matching pointer*/
-/* to the object (not matching content). */
-/* If the function gets passed a NULL then we want to free the last texture */
-/* object in the list. Used in a loop to destory all. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static BOOL DestroyTextureObject( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject )
-{
- PTM_OBJECT pCurrent;
-
- DPF(( DBG_FUNC, "DestoryTextureObject();" ));
-
- /* Just to be safe. */
- if ( !pHAL || !pHAL->pTMList )
- {
- DPF(( DBG_TXT_WARN, "DestroyTextureObject() -> NULL pHAL/pHAL->pTMList" ));
- return FALSE;
- }
-
- /* Free the last texture in the list. */
- if ( pTMObject == NULL )
- {
- /* Find the last texture object. */
- for( pCurrent = pHAL->pTMList; pCurrent->next; pCurrent = pCurrent->next );
- }
- else
- {
- /* See if we can find this texture object. */
- for( pCurrent = pHAL->pTMList; pCurrent && (pCurrent != pTMObject); pCurrent = pCurrent->next );
-
- /* Didn't find anything. */
- if ( pCurrent == NULL )
- {
- DPF(( DBG_TXT_WARN, "No textures to be freed" ));
- return FALSE;
- }
- }
-
- /* Can't free this baby. */
- if ( pCurrent->bLock == TRUE )
- {
- DPF(( DBG_TXT_WARN, "Requested texture to be freed LOCKED" ));
- return FALSE;
- }
-
- /* Free the texture memory. */
- if ( pCurrent->lpD3DTexture2 )
- {
- DPF(( DBG_TXT_INFO, "Release Texture2" ));
- pCurrent->lpD3DTexture2->Release();
- pCurrent->lpD3DTexture2 = NULL;
- }
- if ( pCurrent->lpDDS_Video )
- {
- DPF(( DBG_TXT_INFO, "Release texture (VID):" ));
- pCurrent->lpDDS_Video->Release();
- pCurrent->lpDDS_Video = NULL;
- }
- if ( pCurrent->lpDDS_System )
- {
- DPF(( DBG_TXT_INFO, "Release texture (SYS):" ));
- pCurrent->lpDDS_System->Release();
- pCurrent->lpDDS_System = NULL;
- }
-
- /* Pull this texture out of the list. */
- if ( pCurrent == pHAL->pTMList )
- pHAL->pTMList = NULL;
- if ( pCurrent->prev )
- (pCurrent->prev)->next = pCurrent->next;
- if ( pCurrent->next )
- (pCurrent->next)->prev = pCurrent->prev;
- FREE( pCurrent );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function is the callback function that gets called when we are doing*/
-/* an enumeration of the texture formats supported by this device. The choice*/
-/* is made by checking to see if we have a match with the supplied D3D pixel-*/
-/* format. So the enumeration has to pass a desired D3D PF as the user var. */
-/*===========================================================================*/
-/* RETURN: D3DENUMRET_OK, D3DENUMRET_CANCEL. */
-/*===========================================================================*/
-static void UpdateTexture( PTM_OBJECT pTMObj, BOOL bVideo, RECT *pRect, UCHAR *pixels )
-{
- LPDIRECTDRAWSURFACE4 lpDDS;
- DDSURFACEDESC2 ddsd2;
- DWORD srcPitch,
- dwHeight,
- dwWidth,
- dwCol,
- dwColor;
- UCHAR *pSrc,
- *pSrcRow,
- *pDest,
- *pDestRow;
- int rc;
-
- // TODO: Do I need to pass the h/w when its in the object!
- DPF(( DBG_FUNC, "UpdateTexture();" ));
-
- /* Get the surface pointer we are looking for. */
- lpDDS = (bVideo) ? pTMObj->lpDDS_Video : pTMObj->lpDDS_System;
-
- /*===================================================================*/
- /* Fill the texture using the PixelInfo structure to do the mapping. */
- /*===================================================================*/
-
- /* Get the surface pointer. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof(DDSURFACEDESC2);
- rc = lpDDS->Lock( NULL, &ddsd2, DDLOCK_WAIT, NULL );
- if ( FAILED(rc) )
- {
- RIP( NULL, "Lock (TEXTURE/SYSTEM)->", ErrorStringD3D(rc) );
- return;
- }
-
- /* For now we are only updating the system surface so use its dimensions. */
- dwWidth = (bVideo) ? pTMObj->dwVWidth : pTMObj->dwSWidth;
- dwHeight = (bVideo) ? pTMObj->dwVHeight : pTMObj->dwSHeight;
-
- /* If we are updating the whole surface then the pDest/pSrc will */
- /* always be the same. */
- if ( pRect == NULL )
- {
- pDest = (UCHAR *)ddsd2.lpSurface;
- pSrc = pixels;
- }
-
- /* Fill the texture surface based on the pixelformat flags. */
- if ( pTMObj->dwFlags == (DDPF_RGB | DDPF_ALPHAPIXELS) )
- {
- srcPitch = dwWidth * 4;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth * 4) + (pRect->left * 4);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- dwColor = ( ((DWORD)(*(pSrc ) * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift );
- dwColor |= ( ((DWORD)(*(pSrc+1) * pTMObj->pixel.gScale)) << pTMObj->pixel.gShift );
- dwColor |= ( ((DWORD)(*(pSrc+2) * pTMObj->pixel.bScale)) << pTMObj->pixel.bShift );
- if ( pTMObj->pixel.aScale == -1.0 )
- dwColor |= ( (*(pSrc+3) & 0x80) ? (1 << pTMObj->pixel.aShift) : 0 );
- else
- dwColor |= ( ((DWORD)(*(pSrc+3) * pTMObj->pixel.aScale)) << pTMObj->pixel.aShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc += 4;
- }
- }
- }
- else if ( pTMObj->dwFlags == DDPF_RGB )
- {
- srcPitch = dwWidth * 3;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth * 3) + (pRect->left * 3);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- dwColor = ( ((DWORD)(*(pSrc ) * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift );
- dwColor |= ( ((DWORD)(*(pSrc+1) * pTMObj->pixel.gScale)) << pTMObj->pixel.gShift );
- dwColor |= ( ((DWORD)(*(pSrc+2) * pTMObj->pixel.bScale)) << pTMObj->pixel.bShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc += 3;
- }
- }
- }
- else if ( pTMObj->dwFlags == (DDPF_LUMINANCE | DDPF_ALPHAPIXELS) )
- {
- srcPitch = dwWidth * 2;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth * 2) + (pRect->left * 2);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- dwColor = ( ((DWORD)(*(pSrc ) * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift );
- if ( pTMObj->pixel.aScale == -1.0 )
- dwColor |= ( (*(pSrc+1) & 0x80) ? (1 << pTMObj->pixel.aShift) : 0 );
- else
- dwColor |= ( ((DWORD)(*(pSrc+1) * pTMObj->pixel.aScale)) << pTMObj->pixel.aShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc += 2;
- }
- }
- }
- else if ( pTMObj->dwFlags == DDPF_LUMINANCE )
- {
- srcPitch = dwWidth;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth) + (pRect->left);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- dwColor = ( ((DWORD)(*pSrc * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc++;
- }
- }
- }
- else if ( pTMObj->dwFlags == DDPF_ALPHAPIXELS )
- {
- srcPitch = dwWidth;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth) + (pRect->left);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- if ( pTMObj->pixel.aScale == -1.0 )
- dwColor = ( (*pSrc & 0x80) ? (1 << pTMObj->pixel.aShift) : 0 );
- else
- dwColor = ( ((DWORD)(*pSrc * pTMObj->pixel.aScale)) << pTMObj->pixel.aShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc++;
- }
- }
- }
-
- /* Unlock the surface. */
- rc = lpDDS->Unlock( NULL );
- if ( FAILED(rc) )
- {
- RIP( NULL, "Unlock (TEXTURE/SYSTEM)->", ErrorStringD3D(rc) );
- }
-}
-/*===========================================================================*/
-/* This function is the callback function that gets called when we are doing*/
-/* an enumeration of the texture formats supported by this device. The choice*/
-/* is made by checking to see if we have a match with the supplied D3D pixel-*/
-/* format. So the enumeration has to pass a desired D3D PF as the user var. */
-/*===========================================================================*/
-/* RETURN: D3DENUMRET_OK, D3DENUMRET_CANCEL. */
-/*===========================================================================*/
-HRESULT CALLBACK EnumPFHook( LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext )
-{
- LPDDPIXELFORMAT lpDDPixFmtRequest = (LPDDPIXELFORMAT)lpContext;
- PIXELINFO pixel;
-
- DPF(( DBG_FUNC, "EnumPFHook();" ));
-
- if ( lpDDPixFmt->dwFlags == lpDDPixFmtRequest->dwFlags )
- {
- /* Are we looking for an alpha channel? */
- if ( lpDDPixFmtRequest->dwFlags & DDPF_ALPHAPIXELS )
- {
- /* Try for something that has more then 1bits of Alpha. */
- Solve8BitChannelPixelFormat( lpDDPixFmt, &pixel );
- if ( pixel.aScale == -1.0 )
- {
- /* Save this format no matter what as its a match of sorts. */
- memcpy( lpDDPixFmtRequest, lpDDPixFmt, sizeof(DDPIXELFORMAT) );
- return D3DENUMRET_OK;
- }
- }
-
- /* Save this format as its a good match. */
- memcpy( lpDDPixFmtRequest, lpDDPixFmt, sizeof(DDPIXELFORMAT) );
-
- /* We are happy at this point so lets leave. */
- return D3DENUMRET_CANCEL;
- }
-
- return D3DENUMRET_OK;
-}
-
-
diff --git a/src/mesa/drivers/d3d/D3DTextureMgr.h b/src/mesa/drivers/d3d/D3DTextureMgr.h
deleted file mode 100644
index 8a64ceaaec7..00000000000
--- a/src/mesa/drivers/d3d/D3DTextureMgr.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef _TEXTURE_MGR_INC
-#define _TEXTURE_MGR_INC
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <windows.h>
-#include <ddraw.h>
-#include <d3d.h>
-#include <stdlib.h>
-#include <stdlib.h>
-#include "GL/gl.h"
-/*========================================================================*/
-/* Defines. */
-/*========================================================================*/
-/*========================================================================*/
-/* Type defines. */
-/*========================================================================*/
-typedef struct _local_texture_object
-{
- DWORD dwName,
- dwPriority,
- dwFlags,
- dwSWidth,
- dwSHeight,
- dwVWidth,
- dwVHeight;
- BOOL bLock,
- bDirty; /* I only update VID on SubImage calls so the system */
- /* texture can get invalid. */
-
- LPDIRECT3DDEVICE3 lpD3DDevice; /* If the device changes we must get new handles... */
- LPDIRECTDRAWSURFACE4 lpDDS_System,
- lpDDS_Video;
- LPDIRECT3DTEXTURE2 lpD3DTexture2;
-
- PIXELINFO pixel;
-
- struct _local_texture_object *next;
- struct _local_texture_object *prev;
-
-} TM_OBJECT, *PTM_OBJECT;
-/*========================================================================*/
-/* Function prototypes. */
-/*========================================================================*/
-void APIENTRY InitTMD3D( void *pVoid );
-void APIENTRY TermTMD3D( void *pVoid );
-/*========================================================================*/
-/* Global variables declaration. */
-/*========================================================================*/
-
-#endif
diff --git a/src/mesa/drivers/d3d/D3DUTILS.CPP b/src/mesa/drivers/d3d/D3DUTILS.CPP
deleted file mode 100644
index 02664f96e4d..00000000000
--- a/src/mesa/drivers/d3d/D3DUTILS.CPP
+++ /dev/null
@@ -1,638 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* Local only functions. */
-/*===========================================================================*/
-static int CountTrailingZeros( DWORD dwMask );
-/*===========================================================================*/
-/* This function is used to get the pointer to the surface and the pitch for*/
-/* the scanline rendering functions. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" DDSURFACEDESC2 *LockHAL( PMESAD3DSHARED pShared, BOOL bBack )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- static DDSURFACEDESC2 ddsd2;
- HRESULT rc;
-
- DPF(( DBG_FUNC, "LockHAL();" ));
-
- /* Set the request structure up first. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof(DDSURFACEDESC2);
-
- /* Make sure we have enough info. */
- if ( pHAL )
- {
- rc = pHAL->lpDDSRender->Lock( NULL, &ddsd2, DDLOCK_WAIT, NULL );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Lock (RENDER) ->", ErrorStringD3D(rc) );
- }
- }
-
- return &ddsd2;
-}
-/*===========================================================================*/
-/* This is just a simple wrapper. I probably don't need to do any error */
-/* checking as the Lock must have worked inorder to get here... */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void UnlockHAL( PMESAD3DSHARED pShared, BOOL bBack )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- HRESULT rc;
-
- DPF(( DBG_FUNC, "UnlockHAL();" ));
-
- /* Make sure we have enough info. */
- if ( pHAL )
- {
- rc = pHAL->lpDDSRender->Unlock( NULL );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Unlock (RENDER) ->", ErrorStringD3D(rc) );
- }
- }
-}
-/*===========================================================================*/
-/* This function will track the main/Primary window that will be used as the*/
-/* target for the Blt in SwapBuffers. As a side effect the call will check */
-/* to see if the primary surface is the same size and position as the screen.*/
-/* If they are the same size we will call it fullscreen... */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void UpdateScreenPosHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- POINT pt;
- DWORD dwWidth, dwHeight;
-
- DPF(( DBG_FUNC, "UpdateScreenPosHAL();" ));
-
- /* Make sure we have enough info. */
- if ( pHAL != NULL )
- {
- /* Update the windows screen position. */
- GetClientRect( pShared->hwnd, &pShared->rectW );
- pt.x = pt.y = 0;
- ClientToScreen( pShared->hwnd, &pt );
- OffsetRect( &pShared->rectW, pt.x, pt.y);
-
- /* Compare the primary to the screen. */
- dwWidth = GetSystemMetrics( SM_CXSCREEN );
- dwHeight = GetSystemMetrics( SM_CYSCREEN );
- if ( (pShared->rectW.left > 0) || (pShared->rectW.top > 0) ||
- (pShared->rectW.right > dwWidth) || (pShared->rectW.bottom > dwHeight) )
- pShared->bWindow = TRUE;
- else
- pShared->bWindow = FALSE;
- }
-}
-/*===========================================================================*/
-/* This function will fill in the pixel info structure defined in D3Dshared.*/
-/* Basicly it will take a DirectDraw pixelformat structure and make scaling */
-/* values that will convert from 8bit channels to whatever the supplied ddpf */
-/* uses. Also we will generate shift values that will be used to get move */
-/* each component of the pixel into place. */
-/* I have now added a special case for a 1bit alpha channel. If I find a 1b*/
-/* alpha then I will set the scale to -1.0 which should be unique. Later I */
-/* can check the alpha scale value too see if its -1.0 and thus handle it. I*/
-/* was finding that the case was not working tom my advantage so this is my */
-/* HACK for the day. As a TODO I should work on this... */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void Solve8BitChannelPixelFormat( DDPIXELFORMAT *pddpf, PPIXELINFO pPixel )
-{
- DPF(( DBG_FUNC, "Solve8BitChannelPixelFromat();" ));
-
- memset( pPixel, 0, sizeof(PPIXELINFO) );
-
- /* Check too see if the color space is valid in the PF. */
- if ( pddpf->dwFlags & DDPF_RGB )
- {
- /* Solve the red stuff. */
- pPixel->dwRMask = pddpf->dwRBitMask;
- pPixel->rShift = CountTrailingZeros( pPixel->dwRMask );
- pPixel->rScale = (float)0.00392156 * (float)(pPixel->dwRMask >> pPixel->rShift);
-
- /* Solve the green thingy's. */
- pPixel->dwGMask = pddpf->dwGBitMask;
- pPixel->gShift = CountTrailingZeros( pPixel->dwGMask );
- pPixel->gScale = (float)0.00392156 * (float)(pPixel->dwGMask >> pPixel->gShift);
-
- /* Solve the blues. */
- pPixel->dwBMask = pddpf->dwBBitMask;
- pPixel->bShift = CountTrailingZeros( pddpf->dwBBitMask );
- pPixel->bScale = (float)0.00392156 * (float)(pddpf->dwBBitMask >> pPixel->bShift);
- }
-
- /* Do the alpha channel if there is one. */
- if ( pddpf->dwFlags & DDPF_ALPHAPIXELS )
- {
- pPixel->dwAMask = pddpf->dwRGBAlphaBitMask;
- pPixel->aShift = CountTrailingZeros( pPixel->dwAMask );
-
- /* Special case a 1bit alpha. */
- if ( (pPixel->dwAMask >> pPixel->aShift) == 1 )
- pPixel->aScale = -1.0;
- else
- pPixel->aScale = (float)0.00392156 * (float)(pPixel->dwAMask >> pPixel->aShift);
- }
-
- /* Get the size of the pixel in bytes. Should work as dwRGBBitCount is in a union. */
- pPixel->cb = pddpf->dwRGBBitCount / 8;
-}
-/*===========================================================================*/
-/* See RETURN :) */
-/*===========================================================================*/
-/* RETURN: number of contiguous zeros starting from the right. */
-/*===========================================================================*/
-static int CountTrailingZeros( DWORD dwMask )
-{
- DWORD Mask;
-
- if ( dwMask == 0 )
- return 32;
-
- /* Can't take credit for this one! */
- Mask = dwMask & -(int)dwMask;
- return ((Mask & 0xFFFF0000)!=0) << 4
- | ((Mask & 0xFF00FF00)!=0) << 3
- | ((Mask & 0xF0F0F0F0)!=0) << 2
- | ((Mask & 0xCCCCCCCC)!=0) << 1
- | ((Mask & 0xAAAAAAAA)!=0);
-}
-/*===========================================================================*/
-/* This function will convert the DDraw error code to its macro string. The*/
-/* returned pointer is static so you need not worry about memory managemnet */
-/* but the error message gets written over from call to call... */
-/*===========================================================================*/
-/* RETURN: pointer to the single static buffer that hold the error message. */
-/*===========================================================================*/
-char *ErrorStringD3D( HRESULT hr )
-{
- static char errorString[128];
-
- switch( hr )
- {
- case DDERR_ALREADYINITIALIZED:
- strcpy( errorString, "DDERR_ALREADYINITIALIZED" );
- break;
-
- case DDERR_CANNOTATTACHSURFACE:
- strcpy( errorString, "DDERR_CANNOTATTACHSURFACE" );
- break;
-
- case DDERR_CANNOTDETACHSURFACE:
- strcpy( errorString, "DDERR_CANNOTDETACHSURFACE" );
- break;
-
- case DDERR_CURRENTLYNOTAVAIL:
- strcpy( errorString, "DDERR_CURRENTLYNOTAVAIL" );
- break;
-
- case DDERR_EXCEPTION:
- strcpy( errorString, "DDERR_EXCEPTION" );
- break;
-
- case DDERR_GENERIC:
- strcpy( errorString, "DDERR_GENERIC" );
- break;
-
- case DDERR_HEIGHTALIGN:
- strcpy( errorString, "DDERR_HEIGHTALIGN" );
- break;
-
- case DDERR_INCOMPATIBLEPRIMARY:
- strcpy( errorString, "DDERR_INCOMPATIBLEPRIMARY" );
- break;
-
- case DDERR_INVALIDCAPS:
- strcpy( errorString, "DDERR_INVALIDCAPS" );
- break;
-
- case DDERR_INVALIDCLIPLIST:
- strcpy( errorString, "DDERR_INVALIDCLIPLIST" );
- break;
-
- case DDERR_INVALIDMODE:
- strcpy( errorString, "DDERR_INVALIDMODE" );
- break;
-
- case DDERR_INVALIDOBJECT:
- strcpy( errorString, "DDERR_INVALIDOBJECT" );
- break;
-
- case DDERR_INVALIDPARAMS:
- strcpy( errorString, "DDERR_INVALIDPARAMS" );
- break;
-
- case DDERR_INVALIDPIXELFORMAT:
- strcpy( errorString, "DDERR_INVALIDPIXELFORMAT" );
- break;
-
- case DDERR_INVALIDRECT:
- strcpy( errorString, "DDERR_INVALIDRECT" );
- break;
-
- case DDERR_LOCKEDSURFACES:
- strcpy( errorString, "DDERR_LOCKEDSURFACES" );
- break;
-
- case DDERR_NO3D:
- strcpy( errorString, "DDERR_NO3D" );
- break;
-
- case DDERR_NOALPHAHW:
- strcpy( errorString, "DDERR_NOALPHAHW" );
- break;
-
- case DDERR_NOCLIPLIST:
- strcpy( errorString, "DDERR_NOCLIPLIST" );
- break;
-
- case DDERR_NOCOLORCONVHW:
- strcpy( errorString, "DDERR_NOCOLORCONVHW" );
- break;
-
- case DDERR_NOCOOPERATIVELEVELSET:
- strcpy( errorString, "DDERR_NOCOOPERATIVELEVELSET" );
- break;
-
- case DDERR_NOCOLORKEY:
- strcpy( errorString, "DDERR_NOCOLORKEY" );
- break;
-
- case DDERR_NOCOLORKEYHW:
- strcpy( errorString, "DDERR_NOCOLORKEYHW" );
- break;
-
- case DDERR_NODIRECTDRAWSUPPORT:
- strcpy( errorString, "DDERR_NODIRECTDRAWSUPPORT" );
- break;
-
- case DDERR_NOEXCLUSIVEMODE:
- strcpy( errorString, "DDERR_NOEXCLUSIVEMODE" );
- break;
-
- case DDERR_NOFLIPHW:
- strcpy( errorString, "DDERR_NOFLIPHW" );
- break;
-
- case DDERR_NOGDI:
- strcpy( errorString, "DDERR_NOGDI" );
- break;
-
- case DDERR_NOMIRRORHW:
- strcpy( errorString, "DDERR_NOMIRRORHW" );
- break;
-
- case DDERR_NOTFOUND:
- strcpy( errorString, "DDERR_NOTFOUND" );
- break;
-
- case DDERR_NOOVERLAYHW:
- strcpy( errorString, "DDERR_NOOVERLAYHW" );
- break;
-
- case DDERR_OVERLAPPINGRECTS:
- strcpy( errorString, "DDERR_OVERLAPPINGRECTS" );
- break;
-
- case DDERR_NORASTEROPHW:
- strcpy( errorString, "DDERR_NORASTEROPHW" );
- break;
-
- case DDERR_NOROTATIONHW:
- strcpy( errorString, "DDERR_NOROTATIONHW" );
- break;
-
- case DDERR_NOSTRETCHHW:
- strcpy( errorString, "DDERR_NOSTRETCHHW" );
- break;
-
- case DDERR_NOT4BITCOLOR:
- strcpy( errorString, "DDERR_NOT4BITCOLOR" );
- break;
-
- case DDERR_NOT4BITCOLORINDEX:
- strcpy( errorString, "DDERR_NOT4BITCOLORINDEX" );
- break;
-
- case DDERR_NOT8BITCOLOR:
- strcpy( errorString, "DDERR_NOT8BITCOLOR" );
- break;
-
- case DDERR_NOTEXTUREHW:
- strcpy( errorString, "DDERR_NOTEXTUREHW" );
- break;
-
- case DDERR_NOVSYNCHW:
- strcpy( errorString, "DDERR_NOVSYNCHW" );
- break;
-
- case DDERR_NOZBUFFERHW:
- strcpy( errorString, "DDERR_NOZBUFFERHW" );
- break;
-
- case DDERR_NOZOVERLAYHW:
- strcpy( errorString, "DDERR_NOZOVERLAYHW" );
- break;
-
- case DDERR_OUTOFCAPS:
- strcpy( errorString, "DDERR_OUTOFCAPS" );
- break;
-
- case DDERR_OUTOFMEMORY:
- strcpy( errorString, "DDERR_OUTOFMEMORY" );
- break;
-
- case DDERR_OUTOFVIDEOMEMORY:
- strcpy( errorString, "DDERR_OUTOFVIDEOMEMORY" );
- break;
-
- case DDERR_OVERLAYCANTCLIP:
- strcpy( errorString, "DDERR_OVERLAYCANTCLIP" );
- break;
-
- case DDERR_OVERLAYCOLORKEYONLYONEACTIVE:
- strcpy( errorString, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE" );
- break;
-
- case DDERR_PALETTEBUSY:
- strcpy( errorString, "DDERR_PALETTEBUSY" );
- break;
-
- case DDERR_COLORKEYNOTSET:
- strcpy( errorString, "DDERR_COLORKEYNOTSET" );
- break;
-
- case DDERR_SURFACEALREADYATTACHED:
- strcpy( errorString, "DDERR_SURFACEALREADYATTACHED" );
- break;
-
- case DDERR_SURFACEALREADYDEPENDENT:
- strcpy( errorString, "DDERR_SURFACEALREADYDEPENDENT" );
- break;
-
- case DDERR_SURFACEBUSY:
- strcpy( errorString, "DDERR_SURFACEBUSY" );
- break;
-
- case DDERR_CANTLOCKSURFACE:
- strcpy( errorString, "DDERR_CANTLOCKSURFACE" );
- break;
-
- case DDERR_SURFACEISOBSCURED:
- strcpy( errorString, "DDERR_SURFACEISOBSCURED" );
- break;
-
- case DDERR_SURFACELOST:
- strcpy( errorString, "DDERR_SURFACELOST" );
- break;
-
- case DDERR_SURFACENOTATTACHED:
- strcpy( errorString, "DDERR_SURFACENOTATTACHED" );
- break;
-
- case DDERR_TOOBIGHEIGHT:
- strcpy( errorString, "DDERR_TOOBIGHEIGHT" );
- break;
-
- case DDERR_TOOBIGSIZE:
- strcpy( errorString, "DDERR_TOOBIGSIZE" );
- break;
-
- case DDERR_TOOBIGWIDTH:
- strcpy( errorString, "DDERR_TOOBIGWIDTH" );
- break;
-
- case DDERR_UNSUPPORTED:
- strcpy( errorString, "DDERR_UNSUPPORTED" );
- break;
-
- case DDERR_UNSUPPORTEDFORMAT:
- strcpy( errorString, "DDERR_UNSUPPORTEDFORMAT" );
- break;
-
- case DDERR_UNSUPPORTEDMASK:
- strcpy( errorString, "DDERR_UNSUPPORTEDMASK" );
- break;
-
- case DDERR_INVALIDSTREAM:
- strcpy( errorString, "DDERR_INVALIDSTREAM" );
- break;
-
- case DDERR_VERTICALBLANKINPROGRESS:
- strcpy( errorString, "DDERR_VERTICALBLANKINPROGRESS" );
- break;
-
- case DDERR_WASSTILLDRAWING:
- strcpy( errorString, "DDERR_WASSTILLDRAWING" );
- break;
-
- case DDERR_XALIGN:
- strcpy( errorString, "DDERR_XALIGN" );
- break;
-
- case DDERR_INVALIDDIRECTDRAWGUID:
- strcpy( errorString, "DDERR_INVALIDDIRECTDRAWGUID" );
- break;
-
- case DDERR_DIRECTDRAWALREADYCREATED:
- strcpy( errorString, "DDERR_DIRECTDRAWALREADYCREATED" );
- break;
-
- case DDERR_NODIRECTDRAWHW:
- strcpy( errorString, "DDERR_NODIRECTDRAWHW" );
- break;
-
- case DDERR_PRIMARYSURFACEALREADYEXISTS:
- strcpy( errorString, "DDERR_PRIMARYSURFACEALREADYEXISTS" );
- break;
-
- case DDERR_NOEMULATION:
- strcpy( errorString, "DDERR_NOEMULATION" );
- break;
-
- case DDERR_REGIONTOOSMALL:
- strcpy( errorString, "DDERR_REGIONTOOSMALL" );
- break;
-
- case DDERR_CLIPPERISUSINGHWND:
- strcpy( errorString, "DDERR_CLIPPERISUSINGHWND" );
- break;
-
- case DDERR_NOCLIPPERATTACHED:
- strcpy( errorString, "DDERR_NOCLIPPERATTACHED" );
- break;
-
- case DDERR_NOHWND:
- strcpy( errorString, "DDERR_NOHWND" );
- break;
-
- case DDERR_HWNDSUBCLASSED:
- strcpy( errorString, "DDERR_HWNDSUBCLASSED" );
- break;
-
- case DDERR_HWNDALREADYSET:
- strcpy( errorString, "DDERR_HWNDALREADYSET" );
- break;
-
- case DDERR_NOPALETTEATTACHED:
- strcpy( errorString, "DDERR_NOPALETTEATTACHED" );
- break;
-
- case DDERR_NOPALETTEHW:
- strcpy( errorString, "DDERR_NOPALETTEHW" );
- break;
-
- case DDERR_BLTFASTCANTCLIP:
- strcpy( errorString, "DDERR_BLTFASTCANTCLIP" );
- break;
-
- case DDERR_NOBLTHW:
- strcpy( errorString, "DDERR_NOBLTHW" );
- break;
-
- case DDERR_NODDROPSHW:
- strcpy( errorString, "DDERR_NODDROPSHW" );
- break;
-
- case DDERR_OVERLAYNOTVISIBLE:
- strcpy( errorString, "DDERR_OVERLAYNOTVISIBLE" );
- break;
-
- case DDERR_NOOVERLAYDEST:
- strcpy( errorString, "DDERR_NOOVERLAYDEST" );
- break;
-
- case DDERR_INVALIDPOSITION:
- strcpy( errorString, "DDERR_INVALIDPOSITION" );
- break;
-
- case DDERR_NOTAOVERLAYSURFACE:
- strcpy( errorString, "DDERR_NOTAOVERLAYSURFACE" );
- break;
-
- case DDERR_EXCLUSIVEMODEALREADYSET:
- strcpy( errorString, "DDERR_EXCLUSIVEMODEALREADYSET" );
- break;
-
- case DDERR_NOTFLIPPABLE:
- strcpy( errorString, "DDERR_NOTFLIPPABLE" );
- break;
-
- case DDERR_CANTDUPLICATE:
- strcpy( errorString, "DDERR_CANTDUPLICATE" );
- break;
-
- case DDERR_NOTLOCKED:
- strcpy( errorString, "DDERR_NOTLOCKED" );
- break;
-
- case DDERR_CANTCREATEDC:
- strcpy( errorString, "DDERR_CANTCREATEDC" );
- break;
-
- case DDERR_NODC:
- strcpy( errorString, "DDERR_NODC" );
- break;
-
- case DDERR_WRONGMODE:
- strcpy( errorString, "DDERR_WRONGMODE" );
- break;
-
- case DDERR_IMPLICITLYCREATED:
- strcpy( errorString, "DDERR_IMPLICITLYCREATED" );
- break;
-
- case DDERR_NOTPALETTIZED:
- strcpy( errorString, "DDERR_NOTPALETTIZED" );
- break;
-
- case DDERR_UNSUPPORTEDMODE:
- strcpy( errorString, "DDERR_UNSUPPORTEDMODE" );
- break;
-
- case DDERR_NOMIPMAPHW:
- strcpy( errorString, "DDERR_NOMIPMAPHW" );
- break;
-
- case DDERR_INVALIDSURFACETYPE:
- strcpy( errorString, "DDERR_INVALIDSURFACETYPE" );
- break;
-
- case DDERR_NOOPTIMIZEHW:
- strcpy( errorString, "DDERR_NOOPTIMIZEHW" );
- break;
-
- case DDERR_NOTLOADED:
- strcpy( errorString, "DDERR_NOTLOADED" );
- break;
-
- case DDERR_NOFOCUSWINDOW:
- strcpy( errorString, "DDERR_NOFOCUSWINDOW" );
- break;
-
- case DDERR_DCALREADYCREATED:
- strcpy( errorString, "DDERR_DCALREADYCREATED" );
- break;
-
- case DDERR_NONONLOCALVIDMEM:
- strcpy( errorString, "DDERR_NONONLOCALVIDMEM" );
- break;
-
- case DDERR_CANTPAGELOCK:
- strcpy( errorString, "DDERR_CANTPAGELOCK" );
- break;
-
- case DDERR_CANTPAGEUNLOCK:
- strcpy( errorString, "DDERR_CANTPAGEUNLOCK" );
- break;
-
- case DDERR_NOTPAGELOCKED:
- strcpy( errorString, "DDERR_NOTPAGELOCKED" );
- break;
-
- case DDERR_MOREDATA:
- strcpy( errorString, "DDERR_MOREDATA" );
- break;
-
- case DDERR_EXPIRED:
- strcpy( errorString, "DDERR_EXPIRED" );
- break;
-
- case DDERR_VIDEONOTACTIVE:
- strcpy( errorString, "DDERR_VIDEONOTACTIVE" );
- break;
-
- case DDERR_DEVICEDOESNTOWNSURFACE:
- strcpy( errorString, "DDERR_DEVICEDOESNTOWNSURFACE" );
- break;
-
- case DDERR_NOTINITIALIZED:
- strcpy( errorString, "DDERR_NOTINITIALIZED" );
- break;
-
- default:
- strcpy( errorString, "<unknown error code>" );
- break;
- }
-
- return &errorString[0];
-}
diff --git a/src/mesa/drivers/d3d/D3Dvbrender.c b/src/mesa/drivers/d3d/D3Dvbrender.c
deleted file mode 100644
index 09857f1dc8d..00000000000
--- a/src/mesa/drivers/d3d/D3Dvbrender.c
+++ /dev/null
@@ -1,2149 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include <stdio.h>
-#include "clip.h"
-#include "context.h"
-#include "light.h"
-#include "lines.h"
-#include "macros.h"
-#include "matrix.h"
-#include "pb.h"
-#include "points.h"
-#include "mtypes.h"
-#include "vb.h"
-#include "vbrender.h"
-#include "xform.h"
-#include "D3DMesa.h"
-
-static void SetRenderStates( GLcontext *ctx );
-static void DebugRenderStates( GLcontext *ctx, BOOL bForce );
-
-static void RenderPointsVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderTriangleVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderTriangleFanVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderTriangleStripVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderQuadVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderQuad( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4, GLuint pv );
-void RenderOneTriangle( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint pv );
-void RenderOneLine( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );
-
-/* I went with a D3D vertex buffer that is 6 times that of the Mesa one */
-/* instead of having the D3D one flush when its full. This way Mesa will*/
-/* handle all the flushing. I need x6 as points can use 4 vertex each. */
-D3DTLVERTEX D3DTLVertices[ (VB_MAX*6) ];
-GLuint VList[VB_SIZE];
-/*===========================================================================*/
-/* Compute Z offsets for a polygon with plane defined by (A,B,C,D) */
-/* D is not needed. TODO: Currently we are calculating this but not using it.*/
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void OffsetPolygon( GLcontext *ctx, GLfloat a, GLfloat b, GLfloat c )
-{
- GLfloat ac,
- bc,
- m,
- offset;
-
- DPF(( DBG_FUNC, "OffsetPolygon();" ));
-
- if ( (c < 0.001F) && (c > - 0.001F) )
- {
- /* Prevents underflow problems. */
- ctx->PointZoffset = 0.0F;
- ctx->LineZoffset = 0.0F;
- ctx->PolygonZoffset = 0.0F;
- }
- else
- {
- ac = a / c;
- bc = b / c;
- if ( ac < 0.0F )
- ac = -ac;
- if ( bc<0.0F )
- bc = -bc;
- m = MAX2( ac, bc ); /* m = sqrt( ac*ac + bc*bc ); */
-
- offset = (m * ctx->Polygon.OffsetFactor + ctx->Polygon.OffsetUnits);
- ctx->PointZoffset = ctx->Polygon.OffsetPoint ? offset : 0.0F;
- ctx->LineZoffset = ctx->Polygon.OffsetLine ? offset : 0.0F;
- ctx->PolygonZoffset = ctx->Polygon.OffsetFill ? offset : 0.0F;
- }
-
- DPF(( DBG_PRIM_INFO, "OffsetPolygon: %f", offset ));
-}
-/*===========================================================================*/
-/* Compute signed area of the n-sided polgyon specified by vertices */
-/* vb->Win[] and vertex list vlist[]. */
-/* A clockwise polygon will return a negative area. A counter-clockwise */
-/* polygon will return a positive area. I have changed this function to */
-/* actually calculate twice the area as its faster and still gives the sign. */
-/*===========================================================================*/
-/* RETURN: signed area of the polgon. */
-/*===========================================================================*/
-static GLfloat PolygonArea( const struct vertex_buffer *vb, GLuint n, const GLuint vlist[] )
-{
- GLfloat area;
- GLuint i;
-
- DPF(( DBG_FUNC, "PolygonArea();" ));
-
-#define j0 vlist[i]
-#define j1 vlist[(i+1)%n]
-#define x0 vb->Win[j0][0]
-#define y0 vb->Win[j0][1]
-#define x1 vb->Win[j1][0]
-#define y1 vb->Win[j1][1]
-
- /* area = sum of trapezoids */
- for( i = 0, area = 0.0; i < n; i++ )
- area += ((x0 - x1) * (y0 + y1)); /* Note: no divide by two here! */
-
-#undef x0
-#undef y0
-#undef x1
-#undef y1
-#undef j1
-#undef j0
-
- // TODO: I don't see the point or * 0.5 as we just want the sign...
- return area;
-}
-/*===========================================================================*/
-/* Render a polygon that needs clipping on at least one vertex. The function*/
-/* will first clip the polygon to any user clipping planes then clip to the */
-/* viewing volume. The final polygon will be draw as single triangles that */
-/* first need minor proccessing (culling, offset, etc) before we draw the */
-/* polygon as a fan. NOTE: the fan is draw as single triangles as its not */
-/* formed sequentaly in the VB but is in the vlist[]. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderClippedPolygon( GLcontext *ctx, GLuint n, GLuint vlist[] )
-{
- struct vertex_buffer *VB = ctx->VB;
- GLfloat (*win)[3] = VB->Win,
- *proj = ctx->ProjectionMatrix,
- ex, ey,
- fx, fy, c,
- wInv;
- GLuint index,
- pv,
- facing;
-
- DPF(( DBG_FUNC, "RenderClippedPolygon();" ));
-
- DPF(( DBG_PRIM_INFO, "RenderClippedtPolygon( %d )", n ));
-
- /* Which vertex dictates the color when flat shading. */
- pv = (ctx->Primitive==GL_POLYGON) ? vlist[0] : vlist[n-1];
-
- /* Clipping may introduce new vertices. New vertices will be stored in */
- /* the vertex buffer arrays starting with location VB->Free. After we've*/
- /* rendered the polygon, these extra vertices can be overwritten. */
- VB->Free = VB_MAX;
-
- /* Clip against user clipping planes in eye coord space. */
- if ( ctx->Transform.AnyClip )
- {
- n = gl_userclip_polygon( ctx, n, vlist );
- if ( n < 3 )
- return;
-
- /* Transform vertices from eye to clip coordinates: clip = Proj * eye */
- for( index = 0; index < n; index++ )
- {
- TRANSFORM_POINT( VB->Clip[vlist[index]], proj, VB->Eye[vlist[index]] );
- }
- }
-
- /* Clip against view volume in clip coord space */
- n = gl_viewclip_polygon( ctx, n, vlist );
- if ( n < 3 )
- return;
-
- /* Transform new vertices from clip to ndc to window coords. */
- /* ndc = clip / W window = viewport_mapping(ndc) */
- /* Note that window Z values are scaled to the range of integer */
- /* depth buffer values. */
-
- /* Only need to compute window coords for new vertices */
- for( index = VB_MAX; index < VB->Free; index++ )
- {
- if ( VB->Clip[index][3] != 0.0F )
- {
- wInv = 1.0F / VB->Clip[index][3];
-
- win[index][0] = VB->Clip[index][0] * wInv * ctx->Viewport.Sx + ctx->Viewport.Tx;
- win[index][1] = VB->Clip[index][1] * wInv * ctx->Viewport.Sy + ctx->Viewport.Ty;
- win[index][2] = VB->Clip[index][2] * wInv * ctx->Viewport.Sz + ctx->Viewport.Tz;
- }
- else
- {
- /* Can't divide by zero, so... */
- win[index][0] = win[index][1] = win[index][2] = 0.0F;
- }
- }
-
- /* Draw filled polygon as a triangle fan */
- for( index = 2; index < n; index++ )
- {
- /* Compute orientation of triangle */
- ex = win[vlist[index-1]][0] - win[vlist[0]][0];
- ey = win[vlist[index-1]][1] - win[vlist[0]][1];
- fx = win[vlist[index]][0] - win[vlist[0]][0];
- fy = win[vlist[index]][1] - win[vlist[0]][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* finish computing plane equation of polygon, compute offset */
- GLfloat fz = win[vlist[index]][2] - win[vlist[0]][2];
- GLfloat ez = win[vlist[index-1]][2] - win[vlist[0]][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
- RenderOneTriangle( ctx, vlist[0], vlist[index-1], vlist[index], pv );
- }
-}
-/*===========================================================================*/
-/* This function gets called when either the vertex buffer is full or glEnd */
-/* has been called. If the we aren't in rendering mode (FEEDBACK) then I */
-/* pass the vertex buffer back to Mesa to deal with by returning FALSE. */
-/* If I can render the primitive types in the buffer directly then I will */
-/* return TRUE after I render the vertex buffer and reset the vertex buffer. */
-/* */
-/* TODO: I don't handle the special case of when the vertex buffer is full */
-/* and we have a primitive that bounds this buffer and the next one to */
-/* come. I'm not sure right now if Mesa handles this for me... */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-GLboolean RenderVertexBuffer( GLcontext *ctx, GLboolean allDone )
-{
- struct vertex_buffer *VB = ctx->VB;
- GLuint index,
- vlist[VB_SIZE];
-
- DPF(( DBG_FUNC, "RenderVertexBuffer();" ));
-
- /* We only need to hook actual tri's that need rendering. */
- if ( ctx->RenderMode != GL_RENDER )
- {
- // (ctx->Visual->AccumBits > 0) )
- // (ctx->Visual->StencilBits > 0) )
- DPF(( DBG_PRIM_INFO, "Passing VB back to Mesa" ));
- return FALSE;
- }
-
- /* I'm going to set the states here so that all functions will */
- /* be assured to have the right states. If Mesa's vertex bufefr */
- /* function calls one of my primitive functions (TRI,POINT,LINE) */
- /* it will need the right states. So instead of doing it in the */
- /* primitive function I will always do it here at risk of some */
- /* slow down to some cases... */
- SetRenderStates( ctx );
-
- switch( ctx->Primitive )
- {
- case GL_POINTS:
- DPF(( DBG_PRIM_INFO, "GL_POINTS( %d )", VB->Count ));
- RenderPointsVB( ctx, 0, VB->Count );
- break;
-
- case GL_LINES:
- case GL_LINE_STRIP:
- case GL_LINE_LOOP:
- /* Not supported functions yet so pass back that we failed to */
- /* render the vertex buffer and Mesa will have to do it. */
- DPF(( DBG_PRIM_INFO, "GL_LINE_?( %d )", VB->Count ));
- return FALSE;
-
- case GL_TRIANGLES:
- if ( VB->Count < 3 )
- {
- DPF(( DBG_PRIM_WARN, "GL_TRIANGLES( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_TRIANGLES( %d )", VB->Count ));
- RenderTriangleVB( ctx, 0, VB->Count );
- break;
-
- case GL_TRIANGLE_STRIP:
- if ( VB->Count < 3 )
- {
- DPF(( DBG_PRIM_WARN, "GL_TRIANGLE_STRIP( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_TRIANGLE_STRIP( %d )", VB->Count ));
- RenderTriangleStripVB( ctx, 0, VB->Count );
- break;
-
- case GL_TRIANGLE_FAN:
- if ( VB->Count < 3 )
- {
- DPF(( DBG_PRIM_WARN, "GL_TRIANGLE_FAN( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_TRIANGLE_FAN( %d )", VB->Count ));
- RenderTriangleFanVB( ctx, 0, VB->Count );
- break;
-
- case GL_QUADS:
- if ( VB->Count < 4 )
- {
- DPF(( DBG_PRIM_WARN, "GL_QUADS( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_QUADS( %d )", VB->Count ));
- RenderQuadVB( ctx, 0, VB->Count );
- break;
-
- case GL_QUAD_STRIP:
- if ( VB->Count < 4 )
- {
- DPF(( DBG_PRIM_WARN, "GL_QUAD_STRIP( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_QUAD_STRIP( %d )", VB->Count ));
-
- if ( VB->ClipOrMask )
- {
- for( index = 3; index < VB->Count; index += 2 )
- {
- if ( VB->ClipMask[index-3] & VB->ClipMask[index-2] & VB->ClipMask[index-1] & VB->ClipMask[index] & CLIP_ALL_BITS )
- {
- /* All points clipped by common plane */
- DPF(( DBG_PRIM_WARN, "GL_QUAD_STRIP( %d )", VB->Count ));
- continue;
- }
- else if ( VB->ClipMask[index-3] | VB->ClipMask[index-2] | VB->ClipMask[index-1] | VB->ClipMask[index] )
- {
- vlist[0] = index - 3;
- vlist[1] = index - 2;
- vlist[2] = index;
- vlist[3] = index - 1;
- RenderClippedPolygon( ctx, 4, vlist );
- }
- else
- {
- RenderQuad( ctx, (index-3), (index-2), index, (index-1), index );
- }
- }
- }
- else
- {
- /* No clipping needed */
- for( index = 3; index < VB->Count; index += 2 )
- RenderQuad( ctx, (index-3), (index-2), index, (index-1), index );
- }
- break;
-
- case GL_POLYGON:
- if ( VB->Count < 3 )
- {
- DPF(( DBG_PRIM_WARN, "GL_POLYGON( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_POLYGON( %d )", VB->Count ));
-
- /* All points clipped by common plane, draw nothing */
- if ( !(VB->ClipAndMask & CLIP_ALL_BITS) )
- RenderTriangleFanVB( ctx, 0, VB->Count );
- break;
-
- default:
- /* should never get here */
- _mesa_problem( ctx, "invalid mode in gl_render_vb" );
- }
-
- DPF(( DBG_PRIM_INFO, "ResetVB" ));
-
- /* We return TRUE to indicate we rendered the VB. */
- gl_reset_vb( ctx, allDone );
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will render the current vertex buffer as triangles. The */
-/* buffer has to be able to be rendered directly. This means that we are */
-/* filled, no offsets, no culling and one sided rendering. Also we must be */
-/* in render mode of course. */
-/* First I will fill the global D3D vertice buffer. Next I will set all the*/
-/* states for D3D based on the current OGL state. Finally I pass the D3D VB */
-/* to the wrapper that call DrawPrimitives. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderTriangleVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int index,
- cVertex,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing;
-
- DPF(( DBG_FUNC, "RenderTriangleVB" ));
-
- if ( !VB->ClipOrMask )
- {
- DPF(( DBG_PRIM_INFO, "DirectTriangles( %d )", (end-start) ));
- for( index = start, cVertex = 0; index < end; )
- {
- dwPVColor = (VB->Color[(index+2)][3]<<24) | (VB->Color[(index+2)][0]<<16) | (VB->Color[(index+2)][1]<<8) | VB->Color[(index+2)][2];
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2];
- index++;
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2];
- index++;
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color= dwPVColor;
- index++;
- }
- }
- else
- {
-#define v1 index
-#define v2 (index+1)
-#define v3 (index+2)
-
- for( index = start, cVertex = 0; index < end; index += 3 )
- {
- if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & CLIP_ALL_BITS )
- {
- continue;
- }
- else if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] )
- {
- VList[0] = v1;
- VList[1] = v2;
- VList[2] = v3;
- RenderClippedPolygon( ctx, 3, VList );
- continue;
- }
-
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- /* Solve the prevoking vertex color as we need it for the 3rd triangle and flat shading. */
- dwPVColor = (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= dwPVColor;
- }
-#undef v1
-#undef v2
-#undef v3
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex > 2 )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
-}
-/*===========================================================================*/
-/* This function will render the current vertex buffer as a triangle fan. */
-/* The buffer has to be able to be rendered directly. This means that we are*/
-/* filled, no offsets, no culling and one sided rendering. Also we must be */
-/* in render mode of course. */
-/* First I will fill the global D3D vertice buffer. Next I will set all the*/
-/* states for D3D based on the current OGL state. Finally I pass the D3D VB */
-/* to the wrapper that call DrawPrimitives. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderTriangleFanVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int index,
- cVertex,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing;
- DWORD dwPVColor;
-
- DPF(( DBG_FUNC, "RenderTriangleFanVB();" ));
-
- /* Special case that we can blast the fan without culling, offset, etc... */
- if ( !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) )
- {
- DPF(( DBG_PRIM_INFO, "DirectTriangles( %d )", (end-start) ));
-
- /* Seed the the fan. */
- D3DTLVertices[0].sx = D3DVAL( VB->Win[start][0] );
- D3DTLVertices[0].sy = D3DVAL( (height - VB->Win[start][1]) );
- D3DTLVertices[0].sz = D3DVAL( VB->Win[start][2] );
- D3DTLVertices[0].tu = D3DVAL( VB->TexCoord[start][0] );
- D3DTLVertices[0].tv = D3DVAL( VB->TexCoord[start][1] );
- D3DTLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[start][3]) );
- D3DTLVertices[0].color= (VB->Color[start][3]<<24) | (VB->Color[start][0]<<16) | (VB->Color[start][1]<<8) | VB->Color[start][2];
-
- /* Seed the the fan. */
- D3DTLVertices[1].sx = D3DVAL( VB->Win[(start+1)][0] );
- D3DTLVertices[1].sy = D3DVAL( (height - VB->Win[(start+1)][1]) );
- D3DTLVertices[1].sz = D3DVAL( VB->Win[(start+1)][2] );
- D3DTLVertices[1].tu = D3DVAL( VB->TexCoord[(start+1)][0] );
- D3DTLVertices[1].tv = D3DVAL( VB->TexCoord[(start+1)][1] );
- D3DTLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[(start+1)][3]) );
- D3DTLVertices[1].color= (VB->Color[(start+1)][3]<<24) | (VB->Color[(start+1)][0]<<16) | (VB->Color[(start+1)][1]<<8) | VB->Color[(start+1)][2];
-
- for( index = (start+2), cVertex = 2; index < end; index++, cVertex++ )
- {
- /*=================================*/
- /* Add the next vertex to the fan. */
- /*=================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex].color = (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2];
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLEFAN, &D3DTLVertices[0], cVertex );
- }
- else
- {
-#define v1 start
-#define v2 (index-1)
-#define v3 index
-
- for( index = (start+2), cVertex = 0; index < end; index++ )
- {
- if ( VB->ClipOrMask )
- {
- /* All points clipped by common plane */
- if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & CLIP_ALL_BITS )
- {
- continue;
- }
- else if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] )
- {
- VList[0] = v1;
- VList[1] = v2;
- VList[2] = v3;
- RenderClippedPolygon( ctx, 3, VList );
- continue;
- }
- }
-
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- dwPVColor = (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= dwPVColor;
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
-#undef v1
-#undef v2
-#undef v3
- }
-}
-/*===========================================================================*/
-/* This function will render the current vertex buffer as a triangle strip. */
-/* The buffer has to be able to be rendered directly. This means that we are*/
-/* filled, no offsets, no culling and one sided rendering. Also we must be */
-/* in render mode of course. */
-/* First I will fill the global D3D vertice buffer. Next I will set all the*/
-/* states for D3D based on the current OGL state. Finally I pass the D3D VB */
-/* to the wrapper that call DrawPrimitives. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderTriangleStripVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int index,
- cVertex = 0,
- v1, v2, v3,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing;
- DWORD dwPVColor;
-
- DPF(( DBG_FUNC, "RenderTriangleStripVB();" ));
-
- /* Special case that we can blast the fan without culling, offset, etc... */
- if ( !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) )
- {
- DPF(( DBG_PRIM_PROFILE, "DirectTriangles" ));
-
- /* Seed the the strip. */
- D3DTLVertices[0].sx = D3DVAL( VB->Win[start][0] );
- D3DTLVertices[0].sy = D3DVAL( (height - VB->Win[start][1]) );
- D3DTLVertices[0].sz = D3DVAL( VB->Win[start][2] );
- D3DTLVertices[0].tu = D3DVAL( VB->TexCoord[start][0] );
- D3DTLVertices[0].tv = D3DVAL( VB->TexCoord[start][1] );
- D3DTLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[start][3]) );
- D3DTLVertices[0].color= (VB->Color[start][3]<<24) | (VB->Color[start][0]<<16) | (VB->Color[start][1]<<8) | VB->Color[start][2];
-
- /* Seed the the strip. */
- D3DTLVertices[1].sx = D3DVAL( VB->Win[(start+1)][0] );
- D3DTLVertices[1].sy = D3DVAL( (height - VB->Win[(start+1)][1]) );
- D3DTLVertices[1].sz = D3DVAL( VB->Win[(start+1)][2] );
- D3DTLVertices[1].tu = D3DVAL( VB->TexCoord[(start+1)][0] );
- D3DTLVertices[1].tv = D3DVAL( VB->TexCoord[(start+1)][1] );
- D3DTLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[(start+1)][3]) );
- D3DTLVertices[1].color= (VB->Color[(start+1)][3]<<24) | (VB->Color[(start+1)][0]<<16) | (VB->Color[(start+1)][1]<<8) | VB->Color[(start+1)][2];
-
- for( index = (start+2), cVertex = 2; index < end; index++, cVertex++ )
- {
- /*===================================*/
- /* Add the next vertex to the strip. */
- /*===================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex].color = (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2];
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLESTRIP, &D3DTLVertices[0], cVertex );
- }
- else
- {
- for( index = (start+2); index < end; index++ )
- {
- /* We need to switch order so that winding won't be a problem. */
- if ( index & 1 )
- {
- v1 = index - 1;
- v2 = index - 2;
- v3 = index - 0;
- }
- else
- {
- v1 = index - 2;
- v2 = index - 1;
- v3 = index - 0;
- }
-
- /* All vertices clipped by common plane */
- if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & CLIP_ALL_BITS )
- continue;
-
- /* Check if any vertices need clipping. */
- if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] )
- {
- VList[0] = v1;
- VList[1] = v2;
- VList[2] = v3;
- RenderClippedPolygon( ctx, 3, VList );
- }
- else
- {
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* Polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- /* Need right color if we have two sided lighting. */
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
-
- /* Solve the prevoking vertex color as we need it for the 3rd triangle and flat shading. */
- dwPVColor = (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= dwPVColor;
- }
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
- }
-}
-/*===========================================================================*/
-/* This function will render the current vertex buffer as Quads. The buffer*/
-/* has to be able to be rendered directly. This means that we are filled, no*/
-/* offsets, no culling and one sided rendering. Also we must be in render */
-/* mode of cource. */
-/* First I will fill the global D3D vertice buffer. Next I will set all the*/
-/* states for D3D based on the current OGL state. Finally I pass the D3D VB */
-/* to the wrapper that call DrawPrimitives. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderQuadVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int index,
- cVertex,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing; /* 0=front, 1=back */
-
- DPF(( DBG_FUNC, "RenderQuadVB();" ));
-
-#define v1 (index)
-#define v2 (index+1)
-#define v3 (index+2)
-#define v4 (index+3)
-
- if ( !VB->ClipOrMask )
- {
- DPF(( DBG_PRIM_PROFILE, "DirectTriangles" ));
-
- for( cVertex = 0, index = start; index < end; index += 4 )
- {
- if ( ctx->Light.ShadeModel == GL_FLAT )
- dwPVColor = (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v1][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v2][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v3][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v1][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v3][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v4][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v4][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v4][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v4][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v4][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v4][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
- }
- }
- else
- {
- for( cVertex = 0, index = start; index < end; index += 4 )
- {
- if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & VB->ClipMask[v4] & CLIP_ALL_BITS )
- {
- continue;
- }
- else if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] | VB->ClipMask[v4] )
- {
- VList[0] = v1;
- VList[1] = v2;
- VList[2] = v3;
- VList[3] = v4;
- RenderClippedPolygon( ctx, 4, VList );
- continue;
- }
-
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
-
- if ( ctx->Light.ShadeModel == GL_FLAT )
- dwPVColor = (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v4][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v4][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v4][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v4][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v4][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v4][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
- }
- }
-
-#undef v4
-#undef v3
-#undef v2
-#undef v1
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
-}
-/*===========================================================================*/
-/* */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static void RenderQuad( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4, GLuint pv )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing; /* 0=front, 1=back */
- static D3DTLVERTEX TLVertices[6];
-
- DPF(( DBG_FUNC, "RenderQuad" ));
- DPF(( DBG_PRIM_INFO, "RenderQuad( 1 )" ));
-
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- return;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- return;
-
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
-
- if ( ctx->Light.ShadeModel == GL_FLAT )
- dwPVColor = (VB->Color[pv][3]<<24) | (VB->Color[pv][0]<<16) | (VB->Color[pv][1]<<8) | VB->Color[pv][2];
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- TLVertices[0].sx = D3DVAL( VB->Win[v1][0] );
- TLVertices[0].sy = D3DVAL( (height - VB->Win[v1][1]) );
- TLVertices[0].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- TLVertices[0].tu = D3DVAL( VB->TexCoord[v1][0] );
- TLVertices[0].tv = D3DVAL( VB->TexCoord[v1][1] );
- TLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- TLVertices[0].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- TLVertices[1].sx = D3DVAL( VB->Win[v2][0] );
- TLVertices[1].sy = D3DVAL( (height - VB->Win[v2][1]) );
- TLVertices[1].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- TLVertices[1].tu = D3DVAL( VB->TexCoord[v2][0] );
- TLVertices[1].tv = D3DVAL( VB->TexCoord[v2][1] );
- TLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- TLVertices[1].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- TLVertices[2].sx = D3DVAL( VB->Win[v3][0] );
- TLVertices[2].sy = D3DVAL( (height - VB->Win[v3][1]) );
- TLVertices[2].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- TLVertices[2].tu = D3DVAL( VB->TexCoord[v3][0] );
- TLVertices[2].tv = D3DVAL( VB->TexCoord[v3][1] );
- TLVertices[2].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- TLVertices[2].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- TLVertices[3].sx = D3DVAL( VB->Win[v3][0] );
- TLVertices[3].sy = D3DVAL( (height - VB->Win[v3][1]) );
- TLVertices[3].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- TLVertices[3].tu = D3DVAL( VB->TexCoord[v3][0] );
- TLVertices[3].tv = D3DVAL( VB->TexCoord[v3][1] );
- TLVertices[3].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- TLVertices[3].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- TLVertices[4].sx = D3DVAL( VB->Win[v4][0] );
- TLVertices[4].sy = D3DVAL( (height - VB->Win[v4][1]) );
- TLVertices[4].sz = D3DVAL( (VB->Win[v4][2] + ctx->PolygonZoffset) );
- TLVertices[4].tu = D3DVAL( VB->TexCoord[v4][0] );
- TLVertices[4].tv = D3DVAL( VB->TexCoord[v4][1] );
- TLVertices[4].rhw = D3DVAL( (1.0 / VB->Clip[v4][3]) );
- TLVertices[4].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
-
- TLVertices[5].sx = D3DVAL( VB->Win[v1][0] );
- TLVertices[5].sy = D3DVAL( (height - VB->Win[v1][1]) );
- TLVertices[5].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- TLVertices[5].tu = D3DVAL( VB->TexCoord[v1][0] );
- TLVertices[5].tv = D3DVAL( VB->TexCoord[v1][1] );
- TLVertices[5].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- TLVertices[5].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- /* Draw the two triangles. */
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &TLVertices[0], 6 );
-}
-/*===========================================================================*/
-/* */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-void RenderOneTriangle( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- static D3DTLVERTEX TLVertices[3];
-
- DPF(( DBG_FUNC, "RenderOneTriangle" ));
- DPF(( DBG_PRIM_INFO, "RenderTriangle( 1 )" ));
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- if ( ctx->Light.ShadeModel == GL_FLAT )
- dwPVColor = (VB->Color[pv][3]<<24) | (VB->Color[pv][0]<<16) | (VB->Color[pv][1]<<8) | VB->Color[pv][2];
-
- TLVertices[0].sx = D3DVAL( VB->Win[v1][0] );
- TLVertices[0].sy = D3DVAL( (height - VB->Win[v1][1]) );
- TLVertices[0].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- TLVertices[0].tu = D3DVAL( VB->TexCoord[v1][0] );
- TLVertices[0].tv = D3DVAL( VB->TexCoord[v1][1] );
- TLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- TLVertices[0].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
- DPF(( DBG_PRIM_INFO, "V1 -> x:%f y:%f z:%f c:%x",
- TLVertices[0].sx,
- TLVertices[0].sy,
- TLVertices[0].sz,
- TLVertices[0].color ));
-
- TLVertices[1].sx = D3DVAL( VB->Win[v2][0] );
- TLVertices[1].sy = D3DVAL( (height - VB->Win[v2][1]) );
- TLVertices[1].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- TLVertices[1].tu = D3DVAL( VB->TexCoord[v2][0] );
- TLVertices[1].tv = D3DVAL( VB->TexCoord[v2][1] );
- TLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- TLVertices[1].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
- DPF(( DBG_PRIM_INFO, "V2 -> x:%f y:%f z:%f c:%x",
- TLVertices[1].sx,
- TLVertices[1].sy,
- TLVertices[1].sz,
- TLVertices[1].color ));
-
- TLVertices[2].sx = D3DVAL( VB->Win[v3][0] );
- TLVertices[2].sy = D3DVAL( (height - VB->Win[v3][1]) );
- TLVertices[2].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- TLVertices[2].tu = D3DVAL( VB->TexCoord[v3][0] );
- TLVertices[2].tv = D3DVAL( VB->TexCoord[v3][1] );
- TLVertices[2].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- TLVertices[2].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
- DPF(( DBG_PRIM_INFO, "V3 -> x:%f y:%f z:%f c:%x",
- TLVertices[2].sx,
- TLVertices[2].sy,
- TLVertices[2].sz,
- TLVertices[2].color ));
-
- /* Draw the triangle. */
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &TLVertices[0], 3 );
-}
-/*===========================================================================*/
-/* */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-void RenderOneLine( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- static D3DTLVERTEX TLVertices[2];
-
- DPF(( DBG_FUNC, "RenderOneLine" ));
- DPF(( DBG_PRIM_INFO, "RenderLine( 1 )" ));
-
- if ( VB->MonoColor )
- dwPVColor = (pContext->aCurrent<<24) | (pContext->rCurrent<<16) | (pContext->gCurrent<<8) | pContext->bCurrent;
- else
- dwPVColor = (VB->Color[pv][3]<<24) | (VB->Color[pv][0]<<16) | (VB->Color[pv][1]<<8) | VB->Color[pv][2];
-
- TLVertices[0].sx = D3DVAL( VB->Win[v1][0] );
- TLVertices[0].sy = D3DVAL( (height - VB->Win[v1][1]) );
- TLVertices[0].sz = D3DVAL( (VB->Win[v1][2] + ctx->LineZoffset) );
- TLVertices[0].tu = D3DVAL( VB->TexCoord[v1][0] );
- TLVertices[0].tv = D3DVAL( VB->TexCoord[v1][1] );
- TLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- TLVertices[0].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- TLVertices[1].sx = D3DVAL( VB->Win[v2][0] );
- TLVertices[1].sy = D3DVAL( (height - VB->Win[v2][1]) );
- TLVertices[1].sz = D3DVAL( (VB->Win[v2][2] + ctx->LineZoffset) );
- TLVertices[1].tu = D3DVAL( VB->TexCoord[v2][0] );
- TLVertices[1].tv = D3DVAL( VB->TexCoord[v2][1] );
- TLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- TLVertices[1].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- /* Draw line from (x0,y0) to (x1,y1) with current pixel color/index */
- DrawPrimitiveHAL( pContext->pShared, D3DPT_LINELIST, &TLVertices[0], 2 );
-}
-/*===========================================================================*/
-/* This function was written to convert points into triangles. I did this */
-/* as all card accelerate triangles and most drivers do this anyway. In hind*/
-/* thought this might be a bad idea as some cards do better. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderPointsVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- struct pixel_buffer *PB = ctx->PB;
- GLuint index;
- GLfloat radius, z,
- xmin, ymin,
- xmax, ymax;
- GLint cVertex,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
-
- DPF(( DBG_FUNC, "RenderPointsVB();" ));
-
- radius = CLAMP( ctx->Point.Size, MIN_POINT_SIZE, MAX_POINT_SIZE ) * 0.5F;
-
- for( index = start, cVertex = 0; index <= end; index++ )
- {
- if ( VB->ClipMask[index] == 0 )
- {
- xmin = D3DVAL( VB->Win[index][0] - radius );
- xmax = D3DVAL( VB->Win[index][0] + radius );
- ymin = D3DVAL( height - VB->Win[index][1] - radius );
- ymax = D3DVAL( height - VB->Win[index][1] + radius );
- z = D3DVAL( (VB->Win[index][2] + ctx->PointZoffset) );
-
- dwPVColor = (VB->Color[index][3]<<24) |
- (VB->Color[index][0]<<16) |
- (VB->Color[index][1]<<8) |
- VB->Color[index][2];
-
- D3DTLVertices[cVertex].sx = xmin;
- D3DTLVertices[cVertex].sy = ymax;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmin;
- D3DTLVertices[cVertex].sy = ymin;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmax;
- D3DTLVertices[cVertex].sy = ymin;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmax;
- D3DTLVertices[cVertex].sy = ymin;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmax;
- D3DTLVertices[cVertex].sy = ymax;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmin;
- D3DTLVertices[cVertex].sy = ymax;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
- }
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
-}
-/*===========================================================================*/
-/* This gets call before we render any primitives so that the current OGL */
-/* states will be mapped the D3D context. I'm still not sure how D3D works */
-/* but I'm finding that it doesn't act like a state machine as OGL is. It */
-/* looks like the state gets set back to the defaults after a DrawPrimitives */
-/* or an EndScene. Also I set states that are the default even though this */
-/* is redundant as the defaults seem screwed up. */
-/* TODO: make a batch call. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void SetRenderStates( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DWORD dwFunc;
- static BOOL bTexture = FALSE;
- static int texName = -1;
-
- DPF(( DBG_FUNC, "SetRenderStates();" ));
-
- if ( g_DBGMask & DBG_STATES )
- DebugRenderStates( ctx, FALSE );
-
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE );
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_DITHERENABLE, (ctx->Color.DitherFlag) ? TRUE : FALSE );
-
- /*================================================*/
- /* Check too see if there are new TEXTURE states. */
- /*================================================*/
- if ( ctx->Texture._EnabledUnits )
- {
- switch( ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode )
- {
- case GL_MODULATE:
- if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA )
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_modulatealpha];
- else
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_modulate];
- break;
-
- case GL_BLEND:
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decalalpha];
- break;
-
- case GL_REPLACE:
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decal];
- break;
-
- case GL_DECAL:
- if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA )
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decalalpha];
- else
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decal];
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_TEXTUREMAPBLEND, dwFunc );
-
- switch( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MagFilter )
- {
- case GL_NEAREST:
- dwFunc = D3DFILTER_NEAREST;
- break;
- case GL_LINEAR:
- dwFunc = D3DFILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- dwFunc = D3DFILTER_MIPNEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- dwFunc = D3DFILTER_LINEARMIPNEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- dwFunc = D3DFILTER_MIPLINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- dwFunc = D3DFILTER_LINEARMIPLINEAR;
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_TEXTUREMAG, dwFunc );
-
- switch( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MinFilter )
- {
- case GL_NEAREST:
- dwFunc = D3DFILTER_NEAREST;
- break;
- case GL_LINEAR:
- dwFunc = D3DFILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- dwFunc = D3DFILTER_MIPNEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- dwFunc = D3DFILTER_LINEARMIPNEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- dwFunc = D3DFILTER_MIPLINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- dwFunc = D3DFILTER_LINEARMIPLINEAR;
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_TEXTUREMIN, dwFunc );
-
- /* Another hack to cut down on redundant texture binding. */
- // if ( texName != ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name )
- // {
- texName = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name;
- CreateTMgrHAL( pContext->pShared,
- texName,
- 0,
- ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format,
- (RECT *)NULL,
- ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Width,
- ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Height,
- TM_ACTION_BIND,
- (void *)ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Data );
- // }
- bTexture = TRUE;
- }
- else
- {
- /* This is nasty but should cut down on the number of redundant calls. */
- if ( bTexture == TRUE )
- {
- DisableTMgrHAL( pContext->pShared );
- bTexture = FALSE;
- }
- }
-
- /*===============================================*/
- /* Check too see if there are new RASTER states. */
- /*===============================================*/
-
- // TODO: no concept of front & back.
- switch( ctx->Polygon.FrontMode )
- {
- case GL_POINT:
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_FILLMODE, D3DFILL_POINT );
- break;
- case GL_LINE:
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_FILLMODE, D3DFILL_WIREFRAME );
- break;
- case GL_FILL:
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID );
- break;
- }
-
- /*************/
- /* Z-Buffer. */
- /*************/
- if ( ctx->Depth.Test == GL_TRUE )
- {
- switch( ctx->Depth.Func )
- {
- case GL_NEVER:
- dwFunc = D3DCMP_NEVER;
- break;
- case GL_LESS:
- dwFunc = D3DCMP_LESS;
- break;
- case GL_GEQUAL:
- dwFunc = D3DCMP_GREATEREQUAL;
- break;
- case GL_LEQUAL:
- dwFunc = D3DCMP_LESSEQUAL;
- break;
- case GL_GREATER:
- dwFunc = D3DCMP_GREATER;
- break;
- case GL_NOTEQUAL:
- dwFunc = D3DCMP_NOTEQUAL;
- break;
- case GL_EQUAL:
- dwFunc = D3DCMP_EQUAL;
- break;
- case GL_ALWAYS:
- dwFunc = D3DCMP_ALWAYS;
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZFUNC, dwFunc );
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZENABLE, TRUE );
- }
- else
- {
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZENABLE, FALSE );
- }
-
- /*******************/
- /* Z-Write Enable. */
- /*******************/
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZWRITEENABLE , (ctx->Depth.Mask == GL_TRUE) ? TRUE : FALSE );
-
- /***************/
- /* Alpha test. */
- /***************/
- if ( ctx->Color.AlphaEnabled == GL_TRUE )
- {
- switch( ctx->Color.AlphaFunc )
- {
- case GL_NEVER:
- dwFunc = D3DCMP_NEVER;
- break;
- case GL_LESS:
- dwFunc = D3DCMP_LESS;
- break;
- case GL_GEQUAL:
- dwFunc = D3DCMP_GREATEREQUAL;
- break;
- case GL_LEQUAL:
- dwFunc = D3DCMP_LESSEQUAL;
- break;
- case GL_GREATER:
- dwFunc = D3DCMP_GREATER;
- break;
- case GL_NOTEQUAL:
- dwFunc = D3DCMP_NOTEQUAL;
- break;
- case GL_EQUAL:
- dwFunc = D3DCMP_EQUAL;
- break;
- case GL_ALWAYS:
- dwFunc = D3DCMP_ALWAYS;
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHAFUNC , dwFunc );
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
- }
- else
- {
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
- }
-
- /****************/
- /* Alpha blend. */
- /****************/
- if ( ctx->Color.BlendEnabled == GL_TRUE )
- {
- switch( ctx->Color.BlendSrc )
- {
- case GL_ZERO:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_zero];
- break;
- case GL_ONE:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one];
- break;
- case GL_DST_COLOR:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_dst_color];
- break;
- case GL_ONE_MINUS_DST_COLOR:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_dst_color];
- break;
- case GL_SRC_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_src_alpha];
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_src_alpha];
- break;
- case GL_DST_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_dst_alpha];
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_dst_alpha];
- break;
- case GL_SRC_ALPHA_SATURATE:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_src_alpha_saturate];
- break;
- case GL_CONSTANT_COLOR:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_constant_color];
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_constant_color];
- break;
- case GL_CONSTANT_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_constant_alpha];
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_constant_alpha];
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_SRCBLEND, dwFunc );
-
- switch( ctx->Color.BlendDst )
- {
- case GL_ZERO:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_zero];
- break;
- case GL_ONE:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one];
- break;
- case GL_SRC_COLOR:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_src_color];
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_src_color];
- break;
- case GL_SRC_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_src_alpha];
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_src_alpha];
- break;
- case GL_DST_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_dst_alpha];
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_dst_alpha];
- break;
- case GL_CONSTANT_COLOR:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_constant_color];
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_constant_color];
- break;
- case GL_CONSTANT_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_constant_alpha];
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_constant_alpha];
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_DESTBLEND, dwFunc );
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
- }
- else
- {
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
- }
-}
-/*===========================================================================*/
-/* If this function is called it will track the changes to the current */
-/* states that I'm setting in Direct3D. I did this so that the DPF's would */
-/* be under control! */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void DebugRenderStates( GLcontext *ctx, BOOL bForce )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DWORD dwFunc;
- static int dither = -1,
- texture = -1,
- textName = -1,
- textEnv = -1,
- textMin = -1,
- textMag = -1,
- polyMode = -1,
- depthTest = -1,
- depthFunc = -1,
- depthMask = -1,
- alphaTest = -1,
- alphaFunc = -1,
- blend = -1,
- blendSrc = -1,
- blendDest = -1;
-
- /* Force a displayed update of all current states. */
- if ( bForce )
- {
- dither = texture = textName = textEnv = textMin = textMag = -1;
- polyMode = depthTest = depthFunc = depthMask = -1;
- alphaTest = alphaFunc = blend = blendSrc = blendDest = -1;
- }
-
- if ( dither != ctx->Color.DitherFlag )
- {
- dither = ctx->Color.DitherFlag;
- DPF(( 0, "\tDither\t\t%s", (dither) ? "ENABLED" : "--------" ));
- }
- if ( depthTest != ctx->Depth.Test )
- {
- depthTest = ctx->Depth.Test;
- DPF(( 0, "\tDepth Test\t%s", (depthTest) ? "ENABLED" : "--------" ));
- }
- if ( alphaTest != ctx->Color.AlphaEnabled )
- {
- alphaTest = ctx->Color.AlphaEnabled;
-
- DPF(( 0, "\tAlpha Test\t%s", (alphaTest) ? "ENABLED" : "--------" ));
- }
- if ( blend != ctx->Color.BlendEnabled )
- {
- blend = ctx->Color.BlendEnabled;
-
- DPF(( 0, "\tBlending\t%s", (blend) ? "ENABLED" : "--------" ));
- }
-
- /*================================================*/
- /* Check too see if there are new TEXTURE states. */
- /*================================================*/
- if ( texture != ctx->Texture._EnabledUnits )
- {
- texture = ctx->Texture._EnabledUnits;
- DPF(( 0, "\tTexture\t\t%s", (texture) ? "ENABLED" : "--------" ));
- }
-
- if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current )
- {
- if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name != textName )
- {
- textName = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name;
- DPF(( 0, "\tTexture Name:\t%d", textName ));
- DPF(( 0, "\tTexture Format:\t%s",
- (ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA) ?
- "GL_RGBA" : "GLRGB" ));
- }
-
- if ( textEnv != ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode )
- {
- textEnv = ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode;
-
- switch( textEnv )
- {
- case GL_MODULATE:
- DPF(( 0, "\tTexture\tMode\tGL_MODULATE" ));
- break;
- case GL_BLEND:
- DPF(( 0, "\tTexture\tMode\tGL_BLEND" ));
- break;
- case GL_REPLACE:
- DPF(( 0, "\tTexture\tMode\tGL_REPLACE" ));
- break;
- case GL_DECAL:
- DPF(( 0, "\tTexture\tMode\tGL_DECAL" ));
- break;
- }
- }
-
- if ( textMag != ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MagFilter )
- {
- textMag = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MagFilter;
-
- switch( textMag )
- {
- case GL_NEAREST:
- DPF(( 0, "\tTexture MAG\tGL_NEAREST" ));
- break;
- case GL_LINEAR:
- DPF(( 0, "\tTexture MAG\tGL_LINEAR" ));
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- DPF(( 0, "\tTexture MAG\tGL_NEAREST_MIPMAP_NEAREST" ));
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- DPF(( 0, "\tTexture MAG\tGL_LINEAR_MIPMAP_NEAREST" ));
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- DPF(( 0, "\tTexture MAG\tGL_NEAREST_MIPMAP_LINEAR" ));
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- DPF(( 0, "\tTexture MAG\tGL_LINEAR_MIPMAP_LINEAR" ));
- break;
- }
- }
-
- if ( textMin != ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MinFilter )
- {
- textMin = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MinFilter;
-
- switch( textMin )
- {
- case GL_NEAREST:
- DPF(( 0, "\tTexture MIN\tGL_NEAREST" ));
- break;
- case GL_LINEAR:
- DPF(( 0, "\tTexture MIN\tGL_LINEAR" ));
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- DPF(( 0, "\tTexture MIN\tGL_NEAREST_MIPMAP_NEAREST" ));
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- DPF(( 0, "\tTexture MIN\tGL_LINEAR_MIPMAP_NEAREST" ));
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- DPF(( 0, "\tTexture MIN\tGL_LINEAR_MIPMAP_LINEAR" ));
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- DPF(( 0, "\tTexture MIN\tGL_LINEAR_MIPMAP_LINEAR" ));
- break;
- }
- }
- }
-
- if ( ctx->Polygon.FrontMode != polyMode )
- {
- polyMode = ctx->Polygon.FrontMode;
-
- switch( polyMode )
- {
- case GL_POINT:
- DPF(( 0, "\tMode\t\tGL_POINT" ));
- break;
- case GL_LINE:
- DPF(( 0, "\tMode\t\tGL_LINE" ));
- break;
- case GL_FILL:
- DPF(( 0, "\tMode\t\tGL_FILL" ));
- break;
- }
- }
-
- if ( depthFunc != ctx->Depth.Func )
- {
- depthFunc = ctx->Depth.Func;
-
- switch( depthFunc )
- {
- case GL_NEVER:
- DPF(( 0, "\tDepth Func\tGL_NEVER" ));
- break;
- case GL_LESS:
- DPF(( 0, "\tDepth Func\tGL_LESS" ));
- break;
- case GL_GEQUAL:
- DPF(( 0, "\tDepth Func\tGL_GEQUAL" ));
- break;
- case GL_LEQUAL:
- DPF(( 0, "\tDepth Func\tGL_LEQUAL" ));
- break;
- case GL_GREATER:
- DPF(( 0, "\tDepth Func\tGL_GREATER" ));
- break;
- case GL_NOTEQUAL:
- DPF(( 0, "\tDepth Func\tGL_NOTEQUAL" ));
- break;
- case GL_EQUAL:
- DPF(( 0, "\tDepth Func\tGL_EQUAL" ));
- break;
- case GL_ALWAYS:
- DPF(( 0, "\tDepth Func\tGL_ALWAYS" ));
- break;
- }
- }
-
- if ( depthMask != ctx->Depth.Mask )
- {
- depthMask = ctx->Depth.Mask;
- DPF(( 0, "\tZWrite\t\t%s", (depthMask) ? "ENABLED" : "--------" ));
- }
-
- if ( alphaFunc != ctx->Color.AlphaFunc )
- {
- alphaFunc = ctx->Color.AlphaFunc;
-
- switch( alphaFunc )
- {
- case GL_NEVER:
- DPF(( 0, "\tAlpha Func\tGL_NEVER" ));
- break;
- case GL_LESS:
- DPF(( 0, "\tAlpha Func\tGL_LESS" ));
- break;
- case GL_GEQUAL:
- DPF(( 0, "\tAlpha Func\tGL_GEQUAL" ));
- break;
- case GL_LEQUAL:
- DPF(( 0, "\tAlpha Func\tGL_LEQUAL" ));
- break;
- case GL_GREATER:
- DPF(( 0, "\tAlpha Func\tGL_GREATER" ));
- break;
- case GL_NOTEQUAL:
- DPF(( 0, "\tAlpha Func\tGL_NOTEQUAL" ));
- break;
- case GL_EQUAL:
- DPF(( 0, "\tAlpha Func\tGL_EQUAL" ));
- break;
- case GL_ALWAYS:
- DPF(( 0, "\tAlpha Func\tGL_ALWAYS" ));
- break;
- }
- }
-
- if ( blendSrc != ctx->Color.BlendSrc )
- {
- blendSrc = ctx->Color.BlendSrc;
-
- switch( blendSrc )
- {
- case GL_ZERO:
- DPF(( 0, "\tSRC Blend\tGL_ZERO" ));
- break;
- case GL_ONE:
- DPF(( 0, "\tSRC Blend\tGL_ONE" ));
- break;
- case GL_DST_COLOR:
- DPF(( 0, "\tSRC Blend\tGL_DST_COLOR" ));
- break;
- case GL_ONE_MINUS_DST_COLOR:
- DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_DST_COLOR" ));
- break;
- case GL_SRC_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_SRC_ALPHA" ));
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_MINUS_SRC_ALPHA" ));
- break;
- case GL_DST_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_DST_ALPHA" ));
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_DST_ALPHA" ));
- break;
- case GL_SRC_ALPHA_SATURATE:
- DPF(( 0, "\tSRC Blend\tGL_SRC_ALPHA_SATURATE" ));
- break;
- case GL_CONSTANT_COLOR:
- DPF(( 0, "\tSRC Blend\tGL_CONSTANT_COLOR" ));
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_CONSTANT_COLOR" ));
- break;
- case GL_CONSTANT_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_CONSTANT_ALPHA" ));
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_CONSTANT_ALPHA" ));
- break;
- }
- }
-
- if ( blendDest != ctx->Color.BlendDst )
- {
- blendDest = ctx->Color.BlendDst;
-
- switch( blendDest )
- {
- case GL_ZERO:
- DPF(( 0, "\tDST Blend\tGL_ZERO" ));
- break;
- case GL_ONE:
- DPF(( 0, "\tDST Blend\tGL_ONE" ));
- break;
- case GL_SRC_COLOR:
- DPF(( 0, "\tDST Blend\tGL_SRC_COLOR" ));
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_SRC_COLOR" ));
- break;
- case GL_SRC_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_SRC_ALPHA" ));
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_SRC_ALPHA" ));
- break;
- case GL_DST_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_DST_ALPHA" ));
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_DST_ALPHA" ));
- break;
- case GL_CONSTANT_COLOR:
- DPF(( 0, "\tDST Blend\tGL_CONSTANT_COLOR" ));
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_CONSTANT_COLOR" ));
- break;
- case GL_CONSTANT_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_CONSTANT_ALPHA" ));
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_CONSTANT_ALPHA" ));
- break;
- }
- }
-}
diff --git a/src/mesa/drivers/d3d/DDrawPROCS.c b/src/mesa/drivers/d3d/DDrawPROCS.c
deleted file mode 100644
index 10dcfdbabba..00000000000
--- a/src/mesa/drivers/d3d/DDrawPROCS.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DMesa.h"
-/*===========================================================================*/
-/* This call will clear the render surface using the pixel info built from */
-/* the surface at creation time. The call uses Lock/Unlock to access the */
-/* surface. The call also special cases a full clear or a dirty rectangle. */
-/* Finally the call returns the new clear mask that reflects that the color */
-/* buffer was cleared. */
-/*===========================================================================*/
-/* RETURN: the original mask with the bits cleared that represents the buffer*/
-/* or buffers we just cleared. */
-/*===========================================================================*/
-GLbitfield ClearBuffers( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer,
- *pScanLine;
- int index,
- index2;
- DWORD dwColor;
-
- if ( mask & GL_COLOR_BUFFER_BIT )
- {
- /* Lock the surface to get the surface pointer. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Solve the color once only. */
- dwColor = ( ((DWORD)((float)pContext->rClear * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)pContext->gClear * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)pContext->bClear * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- if ( all )
- {
- for( index = 0, pScanLine = (UCHAR *)pddsd2->lpSurface; index < pContext->pShared->dwHeight; index++, pScanLine += pddsd2->lPitch )
- for( pBuffer = pScanLine, index2 = 0; index2 < pContext->pShared->dwWidth; index2++, pBuffer += pContext->pShared->pixel.cb )
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- else
- {
- pScanLine = ((UCHAR *)pddsd2->lpSurface) +
- ( (FLIP( pContext->pShared->dwHeight, (y+height)) * pddsd2->lPitch) + (x * pContext->pShared->pixel.cb) );
-
- for( index = 0; index < height; index++, pScanLine += pddsd2->lPitch )
- {
- for( index2 = 0, pBuffer = pScanLine; index2 < width; index2++, pBuffer += pContext->pShared->pixel.cb )
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- UnlockHAL( pContext->pShared, TRUE );
- }
-
- return (mask & ~GL_COLOR_BUFFER_BIT);
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The alpha is ignored as Mesa does it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WSpanRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Find the start of the span. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + (x*pContext->pShared->pixel.cb);
-
- if ( mask )
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- if ( mask[index] )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgb[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgb[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgb[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
- }
- else
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgb[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgb[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgb[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The alpha is ignored as Mesa does it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Find the start of the span. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + (x*pContext->pShared->pixel.cb);
-
- if ( mask )
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- if ( mask[index] )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
- }
- else
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The color is solved once from the current */
-/* color components. The alpha is ignored as Mesa is doing it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WSpanRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Lock the surface to get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Solve the color once only. (no alpha) */
- dwColor = ( ((DWORD)((float)pContext->rCurrent * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)pContext->gCurrent * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)pContext->bCurrent * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- /* Find the start of the span. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + (x*pContext->pShared->pixel.cb);
-
- if ( mask )
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- if ( mask[index] )
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- else
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The alpha is ignored as Mesa does it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- if ( mask )
- {
- for( index = 0; index < n; index++ )
- {
- if ( mask[index] )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- /* Find the pixel. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb);
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
- }
- else
- {
- for( index = 0; index < n; index++ )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- /* Find the pixel. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb);
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The color is solved once from the current */
-/* color components. The alpha is ignored as Mesa is doing it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WPixelsRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Solve the color once only. I don't uses the alpha. */
- dwColor = ( ((DWORD)((float)pContext->rCurrent * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)pContext->gCurrent * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)pContext->bCurrent * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- if ( mask )
- {
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++ )
- {
- if ( mask[index] )
- {
- /* Find the pixel. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb);
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
- }
- else
- {
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++ )
- {
- /* Find the pixel. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb);
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc isn't written for speed rather its to handle the general case. */
-/* I grab each pixel from the surface and unpack the info using the PIXELINFO*/
-/* structure that was generated from the OffScreen surface pixelformat. The */
-/* function will not fill in the alpha value as Mesa I have Mesa allocate its*/
-/* own alpha channel when the context was created. I did this as I didn't */
-/* feel that it was worth the effort to try and get HW to work (bus bound). */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void RSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD *pdwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Find the start of the span. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface +
- (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) +
- (x*pContext->pShared->pixel.cb);
-
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- pdwColor = (DWORD *)pBuffer;
- rgba[index][RCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwRMask) >> pContext->pShared->pixel.rShift) / pContext->pShared->pixel.rScale);
- rgba[index][GCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwGMask) >> pContext->pShared->pixel.gShift) / pContext->pShared->pixel.gScale);
- rgba[index][BCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwBMask) >> pContext->pShared->pixel.bShift) / pContext->pShared->pixel.bScale);
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc isn't written for speed rather its to handle the general case. */
-/* I grab each pixel from the surface and unpack the info using the PIXELINFO*/
-/* structure that was generated from the OffScreen surface pixelformat. The */
-/* function will not fill in the alpha value as Mesa I have Mesa allocate its*/
-/* own alpha channel when the context was created. I did this as I didn't */
-/* feel that it was worth the effort to try and get HW to work (bus bound). */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void RPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- int index;
- DWORD *pdwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- if ( mask )
- {
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++ )
- {
- if ( mask[index] )
- {
- /* Find the start of the pixel. Invert y for Windows. */
- pdwColor = (DWORD *)((UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb));
- rgba[index][RCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwRMask) >> pContext->pShared->pixel.rShift) / pContext->pShared->pixel.rScale);
- rgba[index][GCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwGMask) >> pContext->pShared->pixel.gShift) / pContext->pShared->pixel.gScale);
- rgba[index][BCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwBMask) >> pContext->pShared->pixel.bShift) / pContext->pShared->pixel.bScale);
- }
- }
- }
- else
- {
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++ )
- {
- /* Find the start of the pixel. Invert y for Windows. */
- pdwColor = (DWORD *)((UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb));
- rgba[index][RCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwRMask) >> pContext->pShared->pixel.rShift) / pContext->pShared->pixel.rScale);
- rgba[index][GCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwGMask) >> pContext->pShared->pixel.gShift) / pContext->pShared->pixel.gScale);
- rgba[index][BCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwBMask) >> pContext->pShared->pixel.bShift) / pContext->pShared->pixel.bScale);
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
diff --git a/src/mesa/drivers/d3d/DEBUG.C b/src/mesa/drivers/d3d/DEBUG.C
deleted file mode 100644
index 79e273903ac..00000000000
--- a/src/mesa/drivers/d3d/DEBUG.C
+++ /dev/null
@@ -1,143 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "Debug.h"
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-DWORD g_DBGMask = DBG_ALL_ERROR;
-/*===========================================================================*/
-/* This is your basic DPF function with printf like support. The function */
-/* also works with a global debug mask variable. I have written support that*/
-/* allows for the user's enviroment variable space to be read and set the */
-/* masks. This is done when the dll starts and is only in the debug version.*/
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void _cdecl DebugPrint( int mask, char *pszFormat, ... )
-{
- char buffer[512];
- va_list args;
-
- /* A mask of 0 will always pass. Easy to remeber. */
- if ( (mask == 0) || (mask & g_DBGMask) )
- {
- va_start( args, pszFormat );
-
- if ( mask & DBG_ALL_ERROR )
- OutputDebugString( "MesaD3D: (ERROR)" );
- else
- OutputDebugString( "MesaD3D: " );
-
- vsprintf( buffer, pszFormat, args );
- strcat( buffer, "\n" );
- OutputDebugString( buffer );
-
- va_end( args );
- }
-}
-/*===========================================================================*/
-/* This call reads the users enviroment variables and sets any debug mask */
-/* that they have set to TRUE. Now the value must be "TRUE". */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void ReadDBGEnv( void )
-{
- g_DBGMask = DBG_ALL_ERROR;
-
-#define IS_VAR_SET(v) if ( getenv( # v ) && !strcmp(getenv( # v ),"TRUE") ) g_DBGMask |= v;
-
- IS_VAR_SET( DBG_FUNC );
- IS_VAR_SET( DBG_STATES );
-
- IS_VAR_SET( DBG_CNTX_INFO );
- IS_VAR_SET( DBG_CNTX_WARN );
- IS_VAR_SET( DBG_CNTX_PROFILE );
- IS_VAR_SET( DBG_CNTX_ERROR );
- IS_VAR_SET( DBG_CNTX_ALL );
-
- IS_VAR_SET( DBG_PRIM_INFO );
- IS_VAR_SET( DBG_PRIM_WARN );
- IS_VAR_SET( DBG_PRIM_PROFILE );
- IS_VAR_SET( DBG_PRIM_ERROR );
- IS_VAR_SET( DBG_PRIM_ALL );
-
- IS_VAR_SET( DBG_TXT_INFO );
- IS_VAR_SET( DBG_TXT_WARN );
- IS_VAR_SET( DBG_TXT_PROFILE );
- IS_VAR_SET( DBG_TXT_ERROR );
- IS_VAR_SET( DBG_TXT_ALL );
-
- IS_VAR_SET( DBG_ALL_INFO );
- IS_VAR_SET( DBG_ALL_WARN );
- IS_VAR_SET( DBG_ALL_PROFILE );
- IS_VAR_SET( DBG_ALL_ERROR );
- IS_VAR_SET( DBG_ALL );
-
-#undef IS_VAR_SET
-}
-/*===========================================================================*/
-/* This function will take a pointer to a DDSURFACEDESC2 structure & display*/
-/* the parsed information using a DPF call. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void DebugPixelFormat( char *pszSurfaceName, DDPIXELFORMAT *pddpf )
-{
- char buffer[256];
-
- /* Parse the flag type and write the string equivalent. */
- if ( pddpf->dwFlags & DDPF_ALPHA )
- strcat( buffer, "DDPF_ALPHA " );
- if ( pddpf->dwFlags & DDPF_ALPHAPIXELS )
- strcat( buffer, "DDPF_ALPHAPIXELS " );
- if ( pddpf->dwFlags & DDPF_ALPHAPREMULT )
- strcat( buffer, "DDPF_ALPHAPREMULT " );
- if ( pddpf->dwFlags & DDPF_BUMPLUMINANCE )
- strcat( buffer, "DDPF_BUMPLUMINANCE " );
- if ( pddpf->dwFlags & DDPF_BUMPDUDV )
- strcat( buffer, "DDPF_BUMPDUDV " );
- if ( pddpf->dwFlags & DDPF_COMPRESSED )
- strcat( buffer, "DDPF_COMPRESSED " );
- if ( pddpf->dwFlags & DDPF_FOURCC )
- strcat( buffer, "DDPF_FOURCC " );
- if ( pddpf->dwFlags & DDPF_LUMINANCE )
- strcat( buffer, "DDPF_LUMINANCE " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXED1 )
- strcat( buffer, "DDPF_PALETTEINDEXED1 " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXED2 )
- strcat( buffer, "DDPF_PALETTEINDEXED2 " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXED4 )
- strcat( buffer, "DDPF_PALETTEINDEXED4 " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXED8 )
- strcat( buffer, "DDPF_PALETTEINDEXED8 " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXEDTO8 )
- strcat( buffer, "DDPF_PALETTEINDEXEDTO8 " );
- if ( pddpf->dwFlags & DDPF_RGB )
- strcat( buffer, "DDPF_RGB " );
- if ( pddpf->dwFlags & DDPF_RGBTOYUV )
- strcat( buffer, "DDPF_RGBTOYUV " );
- if ( pddpf->dwFlags & DDPF_STENCILBUFFER )
- strcat( buffer, "DDPF_STENCILBUFFER " );
- if ( pddpf->dwFlags & DDPF_YUV )
- strcat( buffer, "DDPF_YUV " );
- if ( pddpf->dwFlags & DDPF_ZBUFFER )
- strcat( buffer, "DDPF_ZBUFFER " );
- if ( pddpf->dwFlags & DDPF_ZPIXELS )
- strcat( buffer, "DDPF_ZPIXELS " );
-
- DPF(( (DBG_TXT_INFO|DBG_CNTX_INFO),"%s", buffer ));
-}
-
-
-
-
-
diff --git a/src/mesa/drivers/d3d/DEBUG.H b/src/mesa/drivers/d3d/DEBUG.H
deleted file mode 100644
index daeeb722784..00000000000
--- a/src/mesa/drivers/d3d/DEBUG.H
+++ /dev/null
@@ -1,90 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef _DEBUG_H
-#define _DEBUG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <stdio.h>
-#include <string.h>
-#include <ddraw.h>
-#include <d3d.h>
-#include "D3DShared.h"
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Macros defines. */
-/*===========================================================================*/
-#define DBG_FUNC 0x00000001
-#define DBG_STATES 0x00000002
-
-#define DBG_CNTX_INFO 0x00000010
-#define DBG_CNTX_WARN 0x00000020
-#define DBG_CNTX_PROFILE 0x00000040
-#define DBG_CNTX_ERROR 0x00000080
-#define DBG_CNTX_ALL 0x000000F0
-
-#define DBG_PRIM_INFO 0x00000100
-#define DBG_PRIM_WARN 0x00000200
-#define DBG_PRIM_PROFILE 0x00000400
-#define DBG_PRIM_ERROR 0x00000800
-#define DBG_PRIM_ALL 0x00000F00
-
-#define DBG_TXT_INFO 0x00001000
-#define DBG_TXT_WARN 0x00002000
-#define DBG_TXT_PROFILE 0x00004000
-#define DBG_TXT_ERROR 0x00008000
-#define DBG_TXT_ALL 0x0000F000
-
-#define DBG_ALL_INFO 0x11111110
-#define DBG_ALL_WARN 0x22222220
-#define DBG_ALL_PROFILE 0x44444440
-#define DBG_ALL_ERROR 0x88888880
-#define DBG_ALL 0xFFFFFFFF
-
-#ifdef D3D_DEBUG
-# define DPF(arg) DebugPrint arg
-# define RIP(pH,msg,err) OutputDebugString(msg); \
- OutputDebugString(err); \
- OutputDebugString("\n"); \
- FatalShutDown(pH)
-#else
-# define DPF(arg)
-# define RIP(pH,msg,err) FatalShutDown(pH)
-#endif
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Function prototypes. */
-/*===========================================================================*/
-extern void ReadDBGEnv( void );
-extern void _cdecl DebugPrint( int mask, char *pszFormat, ... );
-extern void DebugPixelFormat( char *pszSurfaceName, DDPIXELFORMAT *pddpf );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-extern DWORD g_DBGMask;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
diff --git a/src/mesa/drivers/d3d/DbgEnv.bat b/src/mesa/drivers/d3d/DbgEnv.bat
deleted file mode 100644
index acea0458565..00000000000
--- a/src/mesa/drivers/d3d/DbgEnv.bat
+++ /dev/null
@@ -1,25 +0,0 @@
-SET DBG_FUNC=FALSE
-
-SET DBG_CNTX_INFO=TRUE
-SET DBG_CNTX_WARN=TRUE
-SET DBG_CNTX_PROFILE=FALSE
-SET DBG_CNTX_ERROR=TRUE
-SET DBG_CNTX_ALL=TRUE
-
-SET DBG_PRIM_INFO=FALSE
-SET DBG_PRIM_WARN=FALSE
-SET DBG_PRIM_PROFILE=FALSE
-SET DBG_PRIM_ERROR=TRUE
-SET DBG_PRIM_ALL=FALSE
-
-SET DBG_TXT_INFO=FALSE
-SET DBG_TXT_WARN=TRUE
-SET DBG_TXT_PROFILE=FALSE
-SET DBG_TXT_ERROR=TRUE
-SET DBG_TXT_ALL=FALSE
-
-SET DBG_ALL_INFO=FALSE
-SET DBG_ALL_WARN=TRUE
-SET DBG_ALL_PROFILE=FALSE
-SET DBG_ALL_ERROR=TRUE
-SET DBG_ALL=FALSE
diff --git a/src/mesa/drivers/d3d/MAKEFILE b/src/mesa/drivers/d3d/MAKEFILE
deleted file mode 100644
index 6aa88f3cef4..00000000000
--- a/src/mesa/drivers/d3d/MAKEFILE
+++ /dev/null
@@ -1,101 +0,0 @@
-##############################################################################
-#
-# Mesa-3.0 Makefile for DirectX 6 Driver
-#
-# By Leigh McRae
-#
-# http://www.altsoftware.com/
-#
-# Copyright (c) 1999-1998 alt.software inc. All Rights Reserved
-##############################################################################
-NAME=
-TARGET= WGL Driver (D3DHAL)
-
-D3D_DIR=$(MAKEDIR)\D3D
-TARGET_DIR=e:\WinNT\System32
-TEMP_DIR=c:\Temp
-
-SPACE=-
-LINKER=link.exe
-
-INCLUDE=$(SDKROOT)\include;$(INCLUDE)
-LIB=$(SDKROOT)\lib;$(LIB)
-##############################################################################
-CFLAGS = /c /nologo /W1 /G5 /I..\ /I..\..\Include \
- /D "_WIN32" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "MESAD3D"
-CPPFLAGS= /c /nologo /W1 /G5 /I..\ /I..\..\Include \
- /D "_WIN32" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "MESAD3D"
-
-!IF "$(DEBUG)" == "1"
-
-CFLAGS = /MTd /Od /Z7 /Yd /D "_DEBUG" /D "D3D_DEBUG" $(CFLAGS)
-CPPFLAGS = /MTd /Od /Z7 /Yd /D "_DEBUG" /D "D3D_DEBUG" $(CPPFLAGS)
-BUILD_TYPE=debug
-
-!ELSE
-
-CFLAGS = /MT /Ox /D "NDEBUG" $(CFLAGS)
-CPPFLAGS = /MT /Ox /D "NDEBUG" $(CPPFLAGS)
-BUILD_TYPE=release
-
-!ENDIF
-##############################################################################
-SRCS_WGL = wgl.c D3Dvbrender.c DDrawPROCS.c NULLProcs.c Debug.c
-SRCS_HAL = D3DInit.cpp D3DRaster.cpp D3DTextureMgr.cpp D3DUtils.cpp D3DCaps.cpp
-OBJS_WGL = $(SRCS_WGL:.c=.obj)
-OBJS_HAL = $(SRCS_HAL:.cpp=.obj)
-
-WINLIBS = kernel32.lib user32.lib gdi32.lib oldnames.lib
-DXLIBS =
-LIBS = $(WINLIBS) $(DXLIBS)
-###############################################################################
-# Primary Targets #
-###############################################################################
-
-default: header WGL HAL footer
-
-all: default
-
-WGL : $(OBJS_WGL)
-
-HAL : $(OBJS_HAL)
-
-install : forceit
- @echo $(SPACE)
- @echo ========================================
- @echo Install files created.
- @echo ========================================
-
-
-###############################################################################
-# Secondary Targets #
-###############################################################################
-
-clean:
- @echo ========================================
- @echo Cleaning $(TARGET)
- @del *.obj
- @del *.dep
- @del *.exp
- @del *.ncb
- @del *.plg
- @del *.lib
- @echo ========================================
-
-header:
- @echo ============================================================
- @echo Building $(TARGET) ($(BUILD_TYPE) version)
- @echo ============================================================
- @echo $(SPACE)
-
-footer:
- @echo $(SPACE)
- @echo ============================================================
- @echo DONE building $(TARGET) ($(BUILD_TYPE) version)
- @echo ============================================================
-
-forceit:
-
-
-
-
diff --git a/src/mesa/drivers/d3d/NULLProcs.h b/src/mesa/drivers/d3d/NULLProcs.h
deleted file mode 100644
index f0bbd2162dd..00000000000
--- a/src/mesa/drivers/d3d/NULLProcs.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef NULL_MESA_PROCS_INC
-#define NULL_MESA_PROCS_INC
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include "matrix.h"
-#include "context.h"
-#include "types.h"
-#include "vb.h"
-/*===========================================================================*/
-/* Macros. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-void NULLSetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-void NULLClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-GLboolean NULLSetBuffer( GLcontext *ctx, GLenum mode );
-void NULLGetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height );
-GLbitfield NULLClearBuffers( GLcontext *ctx, GLbitfield m, GLboolean a, GLint x, GLint y, GLint w, GLint h );
-void NULLWrSpRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][3], const GLubyte m[] );
-void NULLWrSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][4], const GLubyte m[] );
-void NULLWrSpRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte m[] );
-void NULLWrPiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte r[][4], const GLubyte m[] );
-void NULLWrPiRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte m[] );
-void NULLReSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte r[][4] );
-void NULLRePiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte r[][4], const GLubyte m[] );
-/*===========================================================================*/
-/* Extern function prototypes. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-
-#endif
-
diff --git a/src/mesa/drivers/d3d/NullProcs.c b/src/mesa/drivers/d3d/NullProcs.c
deleted file mode 100644
index d6fb598074b..00000000000
--- a/src/mesa/drivers/d3d/NullProcs.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef NULL_MESA_PROCS_INC
-#define NULL_MESA_PROCS_INC
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include "matrix.h"
-#include "context.h"
-#include "mtypes.h"
-#include "vb.h"
-/*===========================================================================*/
-/* Macros. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-void NULLSetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-void NULLClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-GLboolean NULLSetBuffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bit );
-void NULLGetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height );
-GLbitfield NULLClearBuffers( GLcontext *ctx, GLbitfield m, GLboolean a, GLint x, GLint y, GLint w, GLint h );
-void NULLWrSpRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][3], const GLubyte m[] );
-void NULLWrSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][4], const GLubyte m[] );
-void NULLWrSpRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte m[] );
-void NULLWrPiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte r[][4], const GLubyte m[] );
-void NULLWrPiRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte m[] );
-void NULLReSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte r[][4] );
-void NULLRePiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte r[][4], const GLubyte m[] );
-/*===========================================================================*/
-/* Extern function prototypes. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-
-#endif
-
diff --git a/src/mesa/drivers/d3d/OPENGL32.DEF b/src/mesa/drivers/d3d/OPENGL32.DEF
deleted file mode 100644
index bc0304da331..00000000000
--- a/src/mesa/drivers/d3d/OPENGL32.DEF
+++ /dev/null
@@ -1,442 +0,0 @@
-;===========================================================================
-;
-; Mesa-3.0 DirectX 6 Driver
-;
-; By Leigh McRae
-;
-; http://www.altsoftware.com/
-;
-; Copyright (c) 1999-1998 alt.software inc. All Rights Reserved
-;===========================================================================
-NAME OpenGL32.DLL
-DESCRIPTION "Mesa-3.0 DX6 Driver Version 0.5"
-
-EXPORTS
- DllMain
- glAccum
- glAlphaFunc
- glAreTexturesResident
- glAreTexturesResidentEXT
- glArrayElement
- glArrayElementEXT
- glBegin
- glBindTexture
- glBindTextureEXT
- glBitmap
- glBlendColorEXT
- glBlendEquationEXT
- glBlendFunc
- glCallList
- glCallLists
- glClear
- glClearAccum
- glClearColor
- glClearDepth
- glClearIndex
- glClearStencil
- glClipPlane
- glColor3b
- glColor3bv
- glColor3d
- glColor3dv
- glColor3f
- glColor3fv
- glColor3i
- glColor3iv
- glColor3s
- glColor3sv
- glColor3ub
- glColor3ubv
- glColor3ui
- glColor3uiv
- glColor3us
- glColor3usv
- glColor4b
- glColor4bv
- glColor4d
- glColor4dv
- glColor4f
- glColor4fv
- glColor4i
- glColor4iv
- glColor4s
- glColor4sv
- glColor4ub
- glColor4ubv
- glColor4ui
- glColor4uiv
- glColor4us
- glColor4usv
- glColorMask
- glColorMaterial
- glColorPointer
- glColorPointerEXT
- glColorSubTableEXT
- glColorTableEXT
- glCopyPixels
- glCopyTexImage1D
- glCopyTexImage2D
- glCopyTexSubImage1D
- glCopyTexSubImage2D
- glCopyTexSubImage3DEXT
- glCullFace
- glDeleteLists
- glDeleteTextures
- glDeleteTexturesEXT
- glDepthFunc
- glDepthMask
- glDepthRange
- glDisable
- glDisableClientState
- glDrawArrays
- glDrawArraysEXT
- glDrawBuffer
- glDrawElements
- glDrawPixels
- glEdgeFlag
- glEdgeFlagPointer
- glEdgeFlagPointerEXT
- glEdgeFlagv
- glEnable
- glEnableClientState
- glEnd
- glEndList
- glEvalCoord1d
- glEvalCoord1dv
- glEvalCoord1f
- glEvalCoord1fv
- glEvalCoord2d
- glEvalCoord2dv
- glEvalCoord2f
- glEvalCoord2fv
- glEvalMesh1
- glEvalMesh2
- glEvalPoint1
- glEvalPoint2
- glFeedbackBuffer
- glFinish
- glFlush
- glFogf
- glFogfv
- glFogi
- glFogiv
- glFrontFace
- glFrustum
- glGenLists
- glGenTextures
- glGenTexturesEXT
- glGetBooleanv
- glGetClipPlane
- glGetColorTableEXT
- glGetColorTableParameterfvEXT
- glGetColorTableParameterivEXT
- glGetDoublev
- glGetError
- glGetFloatv
- glGetIntegerv
- glGetLightfv
- glGetLightiv
- glGetMapdv
- glGetMapfv
- glGetMapiv
- glGetMaterialfv
- glGetMaterialiv
- glGetPixelMapfv
- glGetPixelMapuiv
- glGetPixelMapusv
- glGetPointerv
- glGetPointervEXT
- glGetPolygonStipple
- glGetString
- glGetTexEnvfv
- glGetTexEnviv
- glGetTexGendv
- glGetTexGenfv
- glGetTexGeniv
- glGetTexImage
- glGetTexLevelParameterfv
- glGetTexLevelParameteriv
- glGetTexParameterfv
- glGetTexParameteriv
- glHint
- glIndexd
- glIndexdv
- glIndexf
- glIndexfv
- glIndexi
- glIndexiv
- glIndexMask
- glIndexPointer
- glIndexPointerEXT
- glIndexs
- glIndexsv
- glIndexub
- glIndexubv
- glInitNames
- glInterleavedArrays
- glIsEnabled
- glIsList
- glIsTexture
- glIsTextureEXT
- glLightf
- glLightfv
- glLighti
- glLightiv
- glLightModelf
- glLightModelfv
- glLightModeli
- glLightModeliv
- glLineStipple
- glLineWidth
- glListBase
- glLoadIdentity
- glLoadMatrixd
- glLoadMatrixf
- glLoadName
- glLogicOp
- glMap1d
- glMap1f
- glMap2d
- glMap2f
- glMapGrid1d
- glMapGrid1f
- glMapGrid2d
- glMapGrid2f
- glMaterialf
- glMaterialfv
- glMateriali
- glMaterialiv
- glMatrixMode
- glMultMatrixd
- glMultMatrixf
- glNewList
- glNormal3b
- glNormal3bv
- glNormal3d
- glNormal3dv
- glNormal3f
- glNormal3fv
- glNormal3i
- glNormal3iv
- glNormal3s
- glNormal3sv
- glNormalPointer
- glNormalPointerEXT
- glOrtho
- glPassThrough
- glPixelMapfv
- glPixelMapuiv
- glPixelMapusv
- glPixelStoref
- glPixelStorei
- glPixelTransferf
- glPixelTransferi
- glPixelZoom
- glPointParameterfEXT
- glPointParameterfvEXT
- glPointSize
- glPolygonMode
- glPolygonOffset
- glPolygonOffsetEXT
- glPolygonStipple
- glPopAttrib
- glPopClientAttrib
- glPopMatrix
- glPopName
- glPrioritizeTextures
- glPrioritizeTexturesEXT
- glPushAttrib
- glPushClientAttrib
- glPushMatrix
- glPushName
- glRasterPos2d
- glRasterPos2dv
- glRasterPos2f
- glRasterPos2fv
- glRasterPos2i
- glRasterPos2iv
- glRasterPos2s
- glRasterPos2sv
- glRasterPos3d
- glRasterPos3dv
- glRasterPos3f
- glRasterPos3fv
- glRasterPos3i
- glRasterPos3iv
- glRasterPos3s
- glRasterPos3sv
- glRasterPos4d
- glRasterPos4dv
- glRasterPos4f
- glRasterPos4fv
- glRasterPos4i
- glRasterPos4iv
- glRasterPos4s
- glRasterPos4sv
- glReadBuffer
- glReadPixels
- glRectd
- glRectdv
- glRectf
- glRectfv
- glRecti
- glRectiv
- glRects
- glRectsv
- glRenderMode
- glResizeBuffersMESA
- glRotated
- glRotatef
- glScaled
- glScalef
- glScissor
- glSelectBuffer
- glShadeModel
- glStencilFunc
- glStencilMask
- glStencilOp
- glTexCoord1d
- glTexCoord1dv
- glTexCoord1f
- glTexCoord1fv
- glTexCoord1i
- glTexCoord1iv
- glTexCoord1s
- glTexCoord1sv
- glTexCoord2d
- glTexCoord2dv
- glTexCoord2f
- glTexCoord2fv
- glTexCoord2i
- glTexCoord2iv
- glTexCoord2s
- glTexCoord2sv
- glTexCoord3d
- glTexCoord3dv
- glTexCoord3f
- glTexCoord3fv
- glTexCoord3i
- glTexCoord3iv
- glTexCoord3s
- glTexCoord3sv
- glTexCoord4d
- glTexCoord4dv
- glTexCoord4f
- glTexCoord4fv
- glTexCoord4i
- glTexCoord4iv
- glTexCoord4s
- glTexCoord4sv
- glTexCoordPointer
- glTexCoordPointerEXT
- glTexEnvf
- glTexEnvfv
- glTexEnvi
- glTexEnviv
- glTexGend
- glTexGendv
- glTexGenf
- glTexGenfv
- glTexGeni
- glTexGeniv
- glTexImage1D
- glTexImage2D
- glTexImage3DEXT
- glTexParameterf
- glTexParameterfv
- glTexParameteri
- glTexParameteriv
- glTexSubImage1D
- glTexSubImage2D
- glTexSubImage3DEXT
- glTranslated
- glTranslatef
- glVertex2d
- glVertex2dv
- glVertex2f
- glVertex2fv
- glVertex2i
- glVertex2iv
- glVertex2s
- glVertex2sv
- glVertex3d
- glVertex3dv
- glVertex3f
- glVertex3fv
- glVertex3i
- glVertex3iv
- glVertex3s
- glVertex3sv
- glVertex4d
- glVertex4dv
- glVertex4f
- glVertex4fv
- glVertex4i
- glVertex4iv
- glVertex4s
- glVertex4sv
- glVertexPointer
- glVertexPointerEXT
- glViewport
- glWindowPos2dMESA
- glWindowPos2dvMESA
- glWindowPos2fMESA
- glWindowPos2fvMESA
- glWindowPos2iMESA
- glWindowPos2ivMESA
- glWindowPos2sMESA
- glWindowPos2svMESA
- glWindowPos3dMESA
- glWindowPos3dvMESA
- glWindowPos3fMESA
- glWindowPos3fvMESA
- glWindowPos3iMESA
- glWindowPos3ivMESA
- glWindowPos3sMESA
- glWindowPos3svMESA
- glWindowPos4dMESA
- glWindowPos4dvMESA
- glWindowPos4fMESA
- glWindowPos4fvMESA
- glWindowPos4iMESA
- glWindowPos4ivMESA
- glWindowPos4sMESA
- glWindowPos4svMESA
-; WMesaCreateContext
-; WMesaDestroyContext
-; WMesaMakeCurrent
-; WMesaPaletteChange
-; WMesaSwapBuffers
-; OSMesaCreateContext
-; OSMesaDestroyContext
-; OSMesaMakeCurrent
-; OSMesaGetCurrentContext
-; OSMesaPixelStore
-; OSMesaGetIntegerv
-; OSMesaGetDepthBuffer
- wglCopyContext
- wglCreateContext
- wglCreateLayerContext
- wglDeleteContext
-; wglDescribeLayerPlane
- wglGetCurrentContext
- wglGetCurrentDC
-; wglGetLayerPaletteEntries
- wglGetProcAddress
- wglMakeCurrent
-; wglRealizeLayerPalette
-; wglSetLayerPaletteEntries
- wglShareLists
- wglSwapLayerBuffers
- wglUseFontBitmapsA
- wglUseFontBitmapsW
- wglUseFontOutlinesA
- wglUseFontOutlinesW
- wglChoosePixelFormat
- wglDescribePixelFormat
- wglGetPixelFormat
- wglSetPixelFormat
- wglSwapBuffers
-
-
-
diff --git a/src/mesa/drivers/d3d/WGL.C b/src/mesa/drivers/d3d/WGL.C
deleted file mode 100644
index 170d094ed49..00000000000
--- a/src/mesa/drivers/d3d/WGL.C
+++ /dev/null
@@ -1,1262 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 Makefile for DirectX 6 */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1998-1997 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DMesa.h"
-/*===========================================================================*/
-/* Window managment. */
-/*===========================================================================*/
-static BOOL InitOpenGL( HINSTANCE hInst );
-static BOOL TermOpenGL( HINSTANCE hInst );
-static BOOL ResizeContext( GLcontext *ctx );
-static BOOL MakeCurrent( D3DMESACONTEXT *pContext );
-static void DestroyContext( D3DMESACONTEXT *pContext );
-static BOOL UnBindWindow( D3DMESACONTEXT *pContext );
-LONG APIENTRY wglMonitorProc( HWND hwnd, UINT message, UINT wParam, LONG lParam );
-/*===========================================================================*/
-/* Mesa hooks. */
-/*===========================================================================*/
-static void SetupDDPointers( GLcontext *ctx );
-static void SetupSWDDPointers( GLcontext *ctx );
-static void SetupHWDDPointers( GLcontext *ctx );
-static void SetupNULLDDPointers( GLcontext *ctx );
-static const char *RendererString( void );
-
-/* State Management hooks. */
-static void SetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-static void ClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-static GLboolean SetBuffer( GLcontext *ctx, GLenum buffer );
-
-/* Window Management hooks. */
-static void GetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height );
-static void SetViewport( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h );
-static void Flush( GLcontext *ctx );
-
-/* Span rendering hooks. */
-void WSpanRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] );
-void WSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
-void WSpanRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] );
-void WPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
-void WPixelsRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] );
-void RSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
-void RPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
-GLbitfield ClearBuffers( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-
-/* Primitve rendering hooks. */
-GLboolean RenderVertexBuffer( GLcontext *ctx, GLboolean allDone );
-void RenderOneTriangle( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint pv );
-void RenderOneLine( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );
-GLbitfield ClearBuffersD3D( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-
-/* Texture Management hooks. */
-static void TextureBind( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj );
-static void TextureLoad( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint internalFormat, const struct gl_texture_image *image );
-static void TextureSubImage( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLint internalFormat, const struct gl_texture_image *image );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-D3DMESACONTEXT *pD3DCurrent,
- *pD3DDefault; /* Thin support context. */
-
-struct __extensions__ ext[] = {
-
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
-};
-
-int qt_ext = sizeof(ext) / sizeof(ext[0]);
-float g_DepthScale,
- g_MaxDepth;
-/*===========================================================================*/
-/* When a process loads this DLL we will setup the linked list for context */
-/* management and create a default context that will support the API until */
-/* the user creates and binds thier own. This THIN default context is useful*/
-/* to have around. */
-/* When the process terminates we will clean up all resources here. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY DllMain( HINSTANCE hInst, DWORD reason, LPVOID reserved )
-{
- switch( reason )
- {
- case DLL_PROCESS_ATTACH:
- return InitOpenGL( hInst );
-
- case DLL_PROCESS_DETACH:
- return TermOpenGL( hInst );
- }
-
- return TRUE;
-}
-/*===========================================================================*/
-/* The first thing we do when this dll is hit is connect to the dll that has*/
-/* handles all the DirectX 6 rendering. I decided to use another dll as DX6 */
-/* is all C++ and Mesa-3.0 is C (thats a good thing). This way I can write */
-/* the DX6 in C++ and Mesa-3.0 in C without having to worry about linkage. */
-/* I feel this is easy and better then using static wrappers as it is likely */
-/* faster and it allows me to just develope the one without compiling the */
-/* other. */
-/* NOTE that at this point we don't have much other than a very thin context*/
-/* that will support the API calls only to the point of not causing the app */
-/* to crash from the API table being empty. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static BOOL InitOpenGL( HINSTANCE hInst )
-{
- /* Allocate and clear the default context. */
- pD3DDefault = (PD3DMESACONTEXT)ALLOC( sizeof(D3DMESACONTEXT) );
- if ( pD3DDefault == NULL )
- return FALSE;
- memset( pD3DDefault, 0, sizeof(D3DMESACONTEXT) );
-
- /* Clear the D3D vertex buffer so that values not used will be zero. This */
- /* save me from some redundant work. */
- memset( &D3DTLVertices, 0, sizeof(D3DTLVertices) );
-
- /* Update the link. We uses a circular list so that it is easy to */
- /* add and search. This context will also be used for head and tail.*/
- pD3DDefault->next = pD3DDefault;
-
- /*========================================================================*/
- /* Do all core Mesa stuff. */
- /*========================================================================*/
- pD3DDefault->gl_visual = _mesa_create_visual( TRUE,
- FALSE, /* db_flag */
- GL_FALSE, /* stereo */
- 8,8,8,8, /* r, g, b, a bits */
- 0, /* index bits */
- 16, /* depth_bits */
- 8, /* stencil_bits */
- 8,8,8,8, /* accum_bits */
- 1 );
-
- if ( pD3DDefault->gl_visual == NULL)
- {
- FREE( pD3DDefault );
- return FALSE;
- }
-
- /* Allocate a new Mesa context */
- pD3DDefault->gl_ctx = _mesa_create_context( pD3DDefault->gl_visual, NULL, pD3DDefault, GL_TRUE );
- if ( pD3DDefault->gl_ctx == NULL )
- {
- _mesa_destroy_visual( pD3DDefault->gl_visual );
- FREE( pD3DDefault );
- return FALSE;
- }
-
- /* Allocate a new Mesa frame buffer */
- pD3DDefault->gl_buffer = _mesa_create_framebuffer( pD3DDefault->gl_visual );
- if ( pD3DDefault->gl_buffer == NULL )
- {
- _mesa_destroy_visual( pD3DDefault->gl_visual );
- _mesa_destroy_context( pD3DDefault->gl_ctx );
- FREE( pD3DDefault );
- return FALSE;
- }
- SetupDDPointers( pD3DDefault->gl_ctx );
- _mesa_make_current( pD3DDefault->gl_ctx, pD3DDefault->gl_buffer );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will create a new D3D context but will not create the D3D */
-/* surfaces or even an instance of D3D (see at GetBufferSize). The only stuff*/
-/* done here is the internal Mesa stuff and some Win32 handles. */
-/*===========================================================================*/
-/* RETURN: casted pointer to the context, NULL. */
-/*===========================================================================*/
-HGLRC APIENTRY wglCreateContext( HDC hdc )
-{
- D3DMESACONTEXT *pNewContext;
- DWORD dwCoopFlags = DDSCL_NORMAL;
- RECT rectClient;
- POINT pt;
-
- /* ALLOC and clear the new context. */
- pNewContext = (PD3DMESACONTEXT)ALLOC( sizeof(D3DMESACONTEXT) );
- if ( pNewContext == NULL )
- {
- SetLastError( 0 );
- return (HGLRC)NULL;
- }
- memset( pNewContext, 0, sizeof(D3DMESACONTEXT) );
-
- /*========================================================================*/
- /* Do all core Mesa stuff. */
- /*========================================================================*/
-
- /* TODO: support more then one visual. */
- pNewContext->gl_visual = _mesa_create_visual( TRUE,
- TRUE, /* db_flag */
- GL_FALSE, /* stereo */
- 8,8,8,8, /* r, g, b, a bits */
- 0, /* index bits */
- 16, /* depth_bits */
- 8, /* stencil_bits */
- 16,16,16,16,/* accum_bits */
- 1 );
- if ( pNewContext->gl_visual == NULL)
- {
- FREE( pNewContext );
- SetLastError( 0 );
- return (HGLRC)NULL;
- }
-
- /* Allocate a new Mesa context */
- pNewContext->gl_ctx = _mesa_create_context( pNewContext->gl_visual, NULL, pNewContext, GL_TRUE );
- if ( pNewContext->gl_ctx == NULL )
- {
- _mesa_destroy_visual( pNewContext->gl_visual );
- FREE( pNewContext );
- SetLastError( 0 );
- return (HGLRC)NULL;
- }
-
- /* Allocate a new Mesa frame buffer */
- pNewContext->gl_buffer = _mesa_create_framebuffer( pNewContext->gl_visual );
- if ( pNewContext->gl_buffer == NULL )
- {
- _mesa_destroy_visual( pNewContext->gl_visual );
- _mesa_destroy_context( pNewContext->gl_ctx );
- FREE( pNewContext );
- SetLastError( 0 );
- return (HGLRC)NULL;
- }
-
- /*========================================================================*/
- /* Do all the driver stuff. */
- /*========================================================================*/
- pNewContext->hdc = hdc;
- pNewContext->next = pD3DDefault->next;
- pD3DDefault->next = pNewContext; /* Add to circular list. */
-
- /* Create the HAL for the new context. */
- pNewContext->pShared = InitHAL( WindowFromDC(hdc) );
-
- return (HGLRC)pNewContext;
-}
-/*===========================================================================*/
-/* This is a wrapper function that is supported by MakeCurrent. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglMakeCurrent( HDC hdc, HGLRC hglrc )
-{
- return MakeCurrent((D3DMESACONTEXT *)hglrc);
-}
-/*===========================================================================*/
-/* MakeCurrent will unbind whatever context is current (if any) & then bind */
-/* the supplied context. A context that is bound has it's window proc hooked*/
-/* with the wglMonitorProc and the context pointer is saved in pD3DCurrent. */
-/* Once the context is bound we update the Mesa-3.0 hooks (SetDDPointers) and*/
-/* the viewport (Mesa-.30 and DX6). */
-/* */
-/* TODO: this function can't fail. */
-/*===========================================================================*/
-/* RETURN: TRUE */
-/*===========================================================================*/
-static BOOL MakeCurrent( D3DMESACONTEXT *pContext )
-{
- D3DMESACONTEXT *pNext;
-
- /*====================================================================*/
- /* This is a special case that is a request to have no context bound. */
- /*====================================================================*/
- if ( pContext == NULL )
- {
- /* Walk the whole list. We start and end at the Default context. */
- for( pNext = pD3DDefault->next; pNext != pD3DDefault; pNext = pNext->next )
- UnBindWindow( pNext );
-
- return TRUE;
- }
-
- /*=================================================*/
- /* Make for a fast redundant use of this function. */
- /*=================================================*/
- if ( pD3DCurrent == pContext )
- return TRUE;
-
- /*=============================*/
- /* Unbind the current context. */
- /*=============================*/
- UnBindWindow( pD3DCurrent );
-
- /*=====================================*/
- /* Let Mesa-3.0 we have a new context. */
- /*=====================================*/
- SetupDDPointers( pContext->gl_ctx );
- _mesa_make_current( pContext->gl_ctx, pContext->gl_buffer );
-
- /* We are done so set the internal current context. */
- if ( pContext != pD3DDefault )
- {
- ResizeContext( pContext->gl_ctx );
- pContext->hOldProc = (WNDPROC)GetWindowLong( pContext->pShared->hwnd, GWL_WNDPROC );
- SetWindowLong( pContext->pShared->hwnd, GWL_WNDPROC, (LONG)wglMonitorProc );
- }
- pD3DCurrent = pContext;
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will only return the current window size. I have re-done */
-/* this function so that it doesn't check the current size and react to it as*/
-/* I should be able to have all the react code in the WM_SIZE message. The */
-/* old version would check the current window size and create/resize the HAL */
-/* surfaces if they have changed. I needed to delay the creation if the */
-/* surfaces because sometimes I wouldn't have a window size so this is where */
-/* I delayed it. If you are reading this then all went ok! */
-/* The default context will return a zero sized window and I'm not sure if */
-/* this is ok at this point (TODO). */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void GetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* Fall through for the default because that is one of the uses for it. */
- if ( pContext == pD3DDefault )
- {
- *width = 0;
- *height = 0;
- }
- else
- {
- *width = pContext->pShared->dwWidth;
- *height = pContext->pShared->dwHeight;
- }
-}
-/*===========================================================================*/
-/* */
-/* */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static BOOL ResizeContext( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx,
- *pCurrentTemp;
- RECT rectClient;
- POINT pt;
- DWORD dwWidth,
- dwHeight;
- static BOOL bDDrawLock = FALSE;
-
- /* Make sure we have some values. */
- if ( (pContext->hdc == NULL ) ||
- (pContext->pShared->hwnd != WindowFromDC(pContext->hdc)) ||
- (pContext == pD3DDefault) )
- return FALSE;
-
- /* Having problems with DDraw sending resize messages before I was done. */
- if( bDDrawLock == TRUE )
- return FALSE;
-
- // TODO: don't think I need this anymore.
- pCurrentTemp = pD3DCurrent;
- pD3DCurrent = pD3DDefault;
- bDDrawLock = TRUE;
-
- /* Get the current window dimentions. */
- UpdateScreenPosHAL( pContext->pShared );
- dwWidth = pContext->pShared->rectW.right - pContext->pShared->rectW.left;
- dwHeight = pContext->pShared->rectW.bottom - pContext->pShared->rectW.top;
-
- /* Is the size of the OffScreen Render different? */
- if ( (dwWidth != pContext->pShared->dwWidth) || (dwHeight != pContext->pShared->dwHeight) )
- {
- /* Create all the D3D surfaces and device. */
- CreateHAL( pContext->pShared );
-
- /* I did this so that software rendering would still work as */
- /* I don't need to scale the z values twice. */
- g_DepthScale = (pContext->pShared->bHardware) ? 1.0 : ((float)0x00FFFFFF);
- g_MaxDepth = (pContext->pShared->bHardware) ? 1.0 : ((float)0x00FFFFFF);
- gl_DepthRange( pContext->gl_ctx, ctx->Viewport.Near, ctx->Viewport.Far );
-
- /* Make sure we have a viewport. */
- gl_Viewport( pContext->gl_ctx, 0, 0, dwWidth, dwHeight );
-
- /* Update Mesa as we might have changed from SW <-> HW. */
- SetupDDPointers( pContext->gl_ctx );
- _mesa_make_current( pContext->gl_ctx, pContext->gl_buffer );
-
- /* If we are in HW we need to load the current texture if there is one already. */
- // if ( (ctx->Texture.Set[ctx->Texture.CurrentSet].Current != NULL) &&
- // (pContext->pShared->bHardware == TRUE) )
- // {
- // CreateTMgrHAL( pContext->pShared,
- // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name,
- // 0,
- // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Format,
- // (RECT *)NULL,
- // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Width,
- // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Height,
- // TM_ACTION_BIND,
- // (void *)ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Data );
- // }
- }
-
- // TODO: don't think I need this anymore.
- pD3DCurrent = pCurrentTemp;
- bDDrawLock = FALSE;
-
- return TRUE;
-}
-
-/*===========================================================================*
-/* This function will Blt the render buffer to the PRIMARY surface. I repeat*/
-/* this code for the other SwapBuffer like functions and the flush (didn't */
-/* want the function calling overhead). Thsi could have been a macro... */
-/* */
-/* TODO: there are some problems with viewport/scissoring. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglSwapBuffers( HDC hdc )
-{
- /* Fall through for the default because that is one of the uses for it. */
- if ( pD3DCurrent == pD3DDefault )
- return FALSE;
-
- SwapBuffersHAL( pD3DCurrent->pShared );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* Same as wglSwapBuffers. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY SwapBuffers( HDC hdc )
-{
- /* Fall through for the default because that is one of the uses for it. */
- if ( pD3DCurrent == pD3DDefault )
- return FALSE;
-
- SwapBuffersHAL( pD3DCurrent->pShared );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This should be ok as none of the SwapBuffers will cause a redundant Blt */
-/* as none of my Swap functions will call flush. This should also allow */
-/* sinlge buffered applications to work (not really worried though). Some */
-/* applications may flush then swap but then this is there fault IMHO. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void Flush( GLcontext *ctx )
-{
- /* Fall through for the default because that is one of the uses for it. */
- if ( pD3DCurrent == pD3DDefault )
- return;
-
- SwapBuffersHAL( pD3DCurrent->pShared );
-}
-/*===========================================================================*/
-/* For now this function will ignore the supplied PF. If I'm going to allow */
-/* the user to choice the mode and device at startup I'm going to have to do */
-/* something different. */
-/* */
-/* TODO: use the linked list of modes to build a pixel format to be returned */
-/* to the caller. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY wglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd )
-{
- return 1;
-}
-/*===========================================================================*/
-/* See wglChoosePixelFormat. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY ChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd )
-{
- return wglChoosePixelFormat(hdc,ppfd);
-}
-/*===========================================================================*/
-/* This function (for now) returns a static PF everytime. This is just to */
-/* allow things to continue. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY wglDescribePixelFormat( HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd )
-{
- static PIXELFORMATDESCRIPTOR pfd =
- {
- sizeof(PIXELFORMATDESCRIPTOR), /* size */
- 1, /* version */
- PFD_SUPPORT_OPENGL |
- PFD_DRAW_TO_WINDOW |
- PFD_DOUBLEBUFFER, /* support double-buffering */
- PFD_TYPE_RGBA, /* color type */
- 16, /* prefered color depth */
- 0, 0, 0, 0, 0, 0, /* color bits (ignored) */
- 0, /* no alpha buffer */
- 0, /* alpha bits (ignored) */
- 0, /* no accumulation buffer */
- 0, 0, 0, 0, /* accum bits (ignored) */
- 16, /* depth buffer */
- 0, /* no stencil buffer */
- 0, /* no auxiliary buffers */
- PFD_MAIN_PLANE, /* main layer */
- 0, /* reserved */
- 0, 0, 0, /* no layer, visible, damage masks */
- };
-
- /* Return the address of this static PF if one was requested. */
- if ( ppfd != NULL )
- memcpy( ppfd, &pfd, sizeof(PIXELFORMATDESCRIPTOR) );
-
- return 1;
-}
-/*===========================================================================*/
-/* See wglDescribePixelFormat. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY DescribePixelFormat( HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd )
-{
- return wglDescribePixelFormat(hdc,iPixelFormat,nBytes,ppfd);
-}
-/*===========================================================================*/
-/* This function will always return 1 for now. Just to allow for support. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY wglGetPixelFormat( HDC hdc )
-{
- return 1;
-}
-/*===========================================================================*/
-/* See wglGetPixelFormat. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY GetPixelFormat( HDC hdc )
-{
- return wglGetPixelFormat(hdc);
-}
-/*===========================================================================*/
-/* This will aways work for now. */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-BOOL APIENTRY wglSetPixelFormat( HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *ppfd )
-{
- return TRUE;
-}
-/*===========================================================================*/
-/* See wglSetPixelFormat. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY SetPixelFormat( HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *ppfd )
-{
- return wglSetPixelFormat(hdc,iPixelFormat,ppfd);
-}
-/*===========================================================================*/
-/* This is a wrapper function that is supported by my own internal function.*/
-/* that takes my own D3D Mesa context structure. This so I can reuse the */
-/* function (no need for speed). */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-BOOL APIENTRY wglDeleteContext( HGLRC hglrc )
-{
- DestroyContext( (D3DMESACONTEXT *)hglrc );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* Simple getter function that uses a cast. */
-/*===========================================================================*/
-/* RETURN: casted pointer to the context, NULL. */
-/*===========================================================================*/
-HGLRC APIENTRY wglGetCurrentContext( VOID )
-{
- return (pD3DCurrent) ? (HGLRC)pD3DCurrent : (HGLRC)NULL;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglCopyContext( HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: NULL. */
-/*===========================================================================*/
-HGLRC APIENTRY wglCreateLayerContext( HDC hdc,int iLayerPlane )
-{
- SetLastError( 0 );
- return (HGLRC)NULL;
-}
-/*===========================================================================*/
-/* Simple getter function. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-HDC APIENTRY wglGetCurrentDC( VOID )
-{
- return (pD3DCurrent) ? pD3DCurrent->hdc : (HDC)NULL;
-}
-/*===========================================================================*/
-/* Simply call that searches the supported extensions for a match & returns */
-/* the pointer to the function that lends support. */
-/*===========================================================================*/
-/* RETURN: pointer to API call, NULL. */
-/*===========================================================================*/
-PROC APIENTRY wglGetProcAddress( LPCSTR lpszProc )
-{
- int index;
-
- for( index = 0; index < qt_ext; index++ )
- if( !strcmp(lpszProc,ext[index].name) )
- return ext[index].proc;
-
- SetLastError( 0 );
- return NULL;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglShareLists( HGLRC hglrc1, HGLRC hglrc2 )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglUseFontBitmaps( HDC fontDevice, DWORD firstChar, DWORD numChars, DWORD listBase )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglUseFontBitmapsW( HDC hdc,DWORD first,DWORD count,DWORD listBase )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglUseFontOutlinesW( HDC hdc,DWORD first,DWORD count, DWORD listBase,FLOAT deviation, FLOAT extrusion,int format, LPGLYPHMETRICSFLOAT lpgmf )
-{
- SetLastError( 0 );
- return FALSE ;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglSwapLayerBuffers( HDC hdc, UINT fuPlanes )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* This function will be hooked into the window that has been bound. Right */
-/* now it is used to track the window size and position. Also the we clean */
-/* up the currrent context when the window is close/destroyed. */
-/* */
-/* TODO: there might be something wrong here as some games (Heretic II) don't*/
-/* track the window quit right. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-LONG APIENTRY wglMonitorProc( HWND hwnd, UINT message, UINT wParam, LONG lParam )
-{
- WNDPROC hOldProc;
- GLint width,
- height;
-
- switch( message )
- {
-// case WM_PAINT:
-// break;
-// case WM_ACTIVATE:
-// break;
-// case WM_SHOWWINDOW:
-// break;
-
- case UM_FATALSHUTDOWN:
- /* Support the API until we die... */
- MakeCurrent( pD3DDefault );
- break;
-
- case WM_MOVE:
- case WM_DISPLAYCHANGE:
- case WM_SIZE:
- ResizeContext( pD3DCurrent->gl_ctx );
- break;
-
- case WM_CLOSE:
- case WM_DESTROY:
- /* Support the API until we die... */
- hOldProc = pD3DCurrent->hOldProc;
- DestroyContext( pD3DCurrent );
- return (hOldProc)(hwnd,message,wParam,lParam);
- }
-
- return (pD3DCurrent->hOldProc)(hwnd,message,wParam,lParam);
-}
-
-/**********************************************************************/
-/***** Miscellaneous device driver funcs *****/
-/**********************************************************************/
-
-/*===========================================================================*/
-/* Not reacting to this as I'm only supporting drawing to the back buffer */
-/* right now. */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-static GLboolean SetBuffer( GLcontext *ctx, GLenum buffer )
-{
- if (buffer == GL_BACK_LEFT)
- return GL_TRUE;
- else
- return GL_FALSE;
-}
-/*===========================================================================*/
-/* This proc will be called by Mesa when the viewport has been set. So if */
-/* we have a context and it isn't the default then we should let D3D know of */
-/* the change. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void SetViewport( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- RECT rect;
-
- /* Make sure we can set a viewport. */
- if ( pContext->pShared && (pContext != pD3DDefault) )
- {
- // TODO: might be needed.
- UpdateScreenPosHAL( pContext->pShared );
- rect.left = x;
- rect.right = x + w;
- rect.top = y;
- rect.bottom = y + h;
-
- // TODO: shared struct should make this call smaller
- SetViewportHAL( pContext->pShared, &rect, 0.0F, 1.0F );
- }
-}
-/*===========================================================================*/
-/* This function could be better I guess but I decided just to grab the four*/
-/* components and store then seperately. Makes it easier to use IMHO. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void ClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- pContext->aClear = a;
- pContext->bClear = b;
- pContext->gClear = g;
- pContext->rClear = r;
-}
-/*===========================================================================*/
-/* This function could be better I guess but I decided just to grab the four*/
-/* components and store then seperately. Makes it easier to use IMHO. */
-/* (is there an echo in here?) */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void SetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- pContext->aCurrent = a;
- pContext->bCurrent = b;
- pContext->gCurrent = g;
- pContext->rCurrent = r;
-}
-/*===========================================================================*/
-/* */
-/* */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static const char *RendererString( void )
-{
- static char pszRender[64];
-
- strcpy( pszRender, "altD3D " );
-
- if ( pD3DCurrent->pShared->bHardware )
- strcat( pszRender, "(HW)");
- else
- strcat( pszRender, "(SW)");
-
- return (const char *)pszRender;
-}
-/*===========================================================================*/
-/* This function will choose which set of pointers Mesa will use based on */
-/* whether we hard using hardware or software. I have added another set of */
-/* pointers that will do nothing but stop the API from crashing. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void SetupDDPointers( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- // TODO: write a generic NULL support for the span render.
- if ( pContext->pShared && pContext->pShared->bHardware )
- {
- ctx->Driver.UpdateState = SetupHWDDPointers;
- }
- else if ( pContext == pD3DDefault )
- {
- ctx->Driver.UpdateState = SetupNULLDDPointers;
- }
- else
- {
- ctx->Driver.UpdateState = SetupSWDDPointers;
- }
-}
-/*===========================================================================*/
-/* This function will populate all the Mesa driver hooks. This version of */
-/* hooks will do nothing but support the API when we don't have a valid */
-/* context bound. This is mostly for applications that don't behave right */
-/* and also to help exit as clean as possable when we have a FatalError. */
-/*===========================================================================*/
-/* RETURN: pointer to the specific function. */
-/*===========================================================================*/
-static void SetupNULLDDPointers( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* Initialize all the pointers in the DD struct. Do this whenever */
- /* a new context is made current or we change buffers via set_buffer! */
- ctx->Driver.UpdateState = SetupNULLDDPointers;
-
- /* State management hooks. */
- ctx->Driver.Color = NULLSetColor;
- ctx->Driver.ClearColor = NULLClearColor;
- ctx->Driver.Clear = NULLClearBuffers;
- ctx->Driver.SetBuffer = NULLSetBuffer;
-
- /* Window management hooks. */
- ctx->Driver.GetBufferSize = NULLGetBufferSize;
-
- /* Primitive rendering hooks. */
- ctx->Driver.TriangleFunc = NULL;
- ctx->Driver.RenderVB = NULL;
-
- /* Pixel/span writing functions: */
- ctx->Driver.WriteRGBASpan = NULLWrSpRGBA;
- ctx->Driver.WriteRGBSpan = NULLWrSpRGB;
- ctx->Driver.WriteMonoRGBASpan = NULLWrSpRGBAMono;
- ctx->Driver.WriteRGBAPixels = NULLWrPiRGBA;
- ctx->Driver.WriteMonoRGBAPixels = NULLWrPiRGBAMono;
-
- /* Pixel/span reading functions: */
- ctx->Driver.ReadRGBASpan = NULLReSpRGBA;
- ctx->Driver.ReadRGBAPixels = NULLRePiRGBA;
-
- /* Misc. hooks. */
- ctx->Driver.RendererString = RendererString;
-}
-/*===========================================================================*/
-/* This function will populate all the Mesa driver hooks. There are two of */
-/* these functions. One if we have hardware support and one is there is only*/
-/* software. These functions will be called by Mesa and by the wgl.c when we*/
-/* have resized (or created) the buffers. The thing is that if a window gets*/
-/* resized we may loose hardware support or gain it... */
-/*===========================================================================*/
-/* RETURN: pointer to the specific function. */
-/*===========================================================================*/
-static void SetupSWDDPointers( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* Initialize all the pointers in the DD struct. Do this whenever */
- /* a new context is made current or we change buffers via set_buffer! */
- ctx->Driver.UpdateState = SetupSWDDPointers;
-
- /* State management hooks. */
- ctx->Driver.Color = SetColor;
- ctx->Driver.ClearColor = ClearColor;
- ctx->Driver.Clear = ClearBuffers;
- ctx->Driver.SetBuffer = SetBuffer;
-
- /* Window management hooks. */
- ctx->Driver.GetBufferSize = GetBufferSize;
- ctx->Driver.Viewport = SetViewport;
-
- /* Primitive rendering hooks. */
- ctx->Driver.TriangleFunc = NULL;
- ctx->Driver.RenderVB = NULL;
-
- /* Texture management hooks. */
-
- /* Pixel/span writing functions: */
- ctx->Driver.WriteRGBASpan = WSpanRGBA;
- ctx->Driver.WriteRGBSpan = WSpanRGB;
- ctx->Driver.WriteMonoRGBASpan = WSpanRGBAMono;
- ctx->Driver.WriteRGBAPixels = WPixelsRGBA;
- ctx->Driver.WriteMonoRGBAPixels = WPixelsRGBAMono;
-
- /* Pixel/span reading functions: */
- ctx->Driver.ReadRGBASpan = RSpanRGBA;
- ctx->Driver.ReadRGBAPixels = RPixelsRGBA;
-
- /* Misc. hooks. */
- ctx->Driver.Flush = Flush;
- ctx->Driver.RendererString = RendererString;
-}
-/*===========================================================================*/
-/* This function will populate all the Mesa driver hooks. There are two of */
-/* these functions. One if we have hardware support and one is there is only*/
-/* software. These functions will be called by Mesa and by the wgl.c when we*/
-/* have resized (or created) the buffers. The thing is that if a window gets*/
-/* resized we may loose hardware support or gain it... */
-/*===========================================================================*/
-/* RETURN: pointer to the specific function. */
-/*===========================================================================*/
-static void SetupHWDDPointers( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* Initialize all the pointers in the DD struct. Do this whenever */
- /* a new context is made current or we change buffers via set_buffer! */
- ctx->Driver.UpdateState = SetupHWDDPointers;
-
- /* State management hooks. */
- ctx->Driver.Color = SetColor;
- ctx->Driver.ClearColor = ClearColor;
- ctx->Driver.Clear = ClearBuffersD3D;
- ctx->Driver.SetBuffer = SetBuffer;
-
- /* Window management hooks. */
- ctx->Driver.GetBufferSize = GetBufferSize;
- ctx->Driver.Viewport = SetViewport;
-
- /* Primitive rendering hooks. */
- ctx->Driver.TriangleFunc = RenderOneTriangle;
- ctx->Driver.LineFunc = RenderOneLine;
- ctx->Driver.RenderVB = RenderVertexBuffer;
-
- /* Pixel/span writing functions: */
- ctx->Driver.WriteRGBASpan = WSpanRGBA;
- ctx->Driver.WriteRGBSpan = WSpanRGB;
- ctx->Driver.WriteMonoRGBASpan = WSpanRGBAMono;
- ctx->Driver.WriteRGBAPixels = WPixelsRGBA;
- ctx->Driver.WriteMonoRGBAPixels = WPixelsRGBAMono;
-
- /* Pixel/span reading functions: */
- ctx->Driver.ReadRGBASpan = RSpanRGBA;
- ctx->Driver.ReadRGBAPixels = RPixelsRGBA;
-
- /* Texture management hooks. */
- // ctx->Driver.BindTexture = TextureBind;
- ctx->Driver.TexImage = TextureLoad;
- ctx->Driver.TexSubImage = TextureSubImage;
-
- /* Misc. hooks. */
- ctx->Driver.Flush = Flush;
- ctx->Driver.RendererString = RendererString;
-}
-/*===========================================================================*/
-/* This function will release all resources used by the DLL. Every context */
-/* will be clobbered by releaseing all driver desources and then freeing the */
-/* context memory. Most all the work is done in DestroyContext. */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-static BOOL TermOpenGL( HINSTANCE hInst )
-{
- D3DMESACONTEXT *pTmp,
- *pNext;
-
- /* Just incase we are still getting paint msg. */
- MakeCurrent( pD3DDefault );
-
- /* Walk the list until we get back to the default context. */
- for( pTmp = pD3DDefault->next; pTmp != pD3DDefault; pTmp = pNext )
- {
- pNext = pTmp->next;
- DestroyContext( pTmp );
- }
- DestroyContext( pD3DDefault );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function is an internal function that will clean up all the Mesa */
-/* context bound to this D3D context. Also any D3D stuff that this context */
-/* uses will be unloaded. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static void DestroyContext( D3DMESACONTEXT *pContext )
-{
- D3DMESACONTEXT *pTmp;
-
- /* Walk the list until we find the context before this one. */
- for( pTmp = pD3DDefault; pTmp && (pTmp->next != pContext); pTmp = pTmp->next )
- if ( pTmp == pTmp->next )
- break;
-
- /* If we never found it it must already be deleted. */
- if ( pTmp->next != pContext )
- return;
-
- /* Make sure we are not using this context. */
- if ( pContext == pD3DCurrent )
- MakeCurrent( pD3DDefault );
-
- /* Free the Mesa stuff. */
- if ( pContext->gl_visual )
- {
- _mesa_destroy_visual( pContext->gl_visual );
- pContext->gl_visual = NULL;
- }
- if ( pContext->gl_buffer )
- {
- _mesa_destroy_framebuffer( pContext->gl_buffer );
- pContext->gl_buffer = NULL;
- }
- if ( pContext->gl_ctx )
- {
- _mesa_destroy_context( pContext->gl_ctx );
- pContext->gl_ctx = NULL;
- }
-
- /* Now dump the D3D. */
- if ( pContext->pShared )
- TermHAL( pContext->pShared );
-
- /* Update the previous context's link. */
- pTmp->next = pContext->next;
-
- /* Gonzo. */
- FREE( pContext );
-}
-/*===========================================================================*/
-/* This function will pull the supplied context away from Win32. Basicly it*/
-/* will remove the hook from the window Proc. */
-/* */
-/* TODO: might want to serialize this stuff... */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static BOOL UnBindWindow( D3DMESACONTEXT *pContext )
-{
- if ( pContext == NULL )
- return FALSE;
-
- if ( pContext == pD3DDefault )
- return TRUE;
-
- /* Make sure we always have a context bound. */
- if ( pContext == pD3DCurrent )
- pD3DCurrent = pD3DDefault;
-
- SetWindowLong( pContext->pShared->hwnd, GWL_WNDPROC, (LONG)pContext->hOldProc );
- pContext->hOldProc = NULL;
-
- return TRUE;
-}
-/*===========================================================================*/
-/* There are two cases that allow for a faster clear when we know that the */
-/* whole buffer is cleared and that there is no clipping. */
-/*===========================================================================*/
-/* RETURN: the original mask with the bits cleared that represents the buffer*
-/* or buffers we just cleared. */
-/*===========================================================================*/
-GLbitfield ClearBuffersD3D( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DWORD dwFlags = 0;
-
- if ( mask & GL_COLOR_BUFFER_BIT )
- {
- dwFlags |= D3DCLEAR_TARGET;
- mask &= ~GL_COLOR_BUFFER_BIT;
- }
- if ( mask & GL_DEPTH_BUFFER_BIT )
- {
- dwFlags |= D3DCLEAR_ZBUFFER;
- mask &= ~GL_DEPTH_BUFFER_BIT;
- }
- if ( dwFlags == 0 )
- return mask;
-
- ClearHAL( pContext->pShared,
- dwFlags,
- all,
- x, y,
- width, height,
- ((pContext->aClear<<24) | (pContext->rClear<<16) | (pContext->gClear<<8) | (pContext->bClear)),
- ctx->Depth.Clear,
- 0 );
-
- return mask;
-}
-
-
-
-/*===========================================================================*/
-/* TEXTURE MANAGER: ok here is how I did textures. Mesa-3.0 will keep track*/
-/* of all the textures for us. So this means that at anytime we can go to */
-/* the Mesa context and get the current texture. With this in mind this is */
-/* what I did. I really don't care about what textures get or are loaded */
-/* until I actually have to draw a tri that is textured. At this point I */
-/* must have the texture so I demand the texture by destorying all other */
-/* texture surfaces if need be and load the current one. This allows for the*/
-/* best preformance on low memory cards as time is not wasted loading and */
-/* unload textures. */
-/*===========================================================================*/
-
-
-
-
-
-/*===========================================================================*/
-/* TextureLoad will try and create a D3D surface from the supplied texture */
-/* object if its level 0 (first). The surface will be fully filled with the */
-/* texture. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void TextureLoad( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint internalFormat, const struct gl_texture_image *image )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* TODO: only doing first LOD. */
- if ( (ctx->DriverCtx == NULL) || (level != 0) )
- return;
-
- CreateTMgrHAL( pContext->pShared,
- tObj->Name,
- level,
- tObj->Image[level]->Format,
- (RECT *)NULL,
- tObj->Image[level]->Width,
- tObj->Image[level]->Height,
- TM_ACTION_LOAD,
- (void *)tObj->Image[level]->Data );
-}
-/*===========================================================================*/
-/* TextureBind make sure that the texture is on the card. Thats it. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void TextureBind( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* TODO: only doing first LOD. */
- if ( (tObj->Image[0] == NULL) || (ctx->DriverCtx == NULL) )
- return;
-
- CreateTMgrHAL( pContext->pShared,
- tObj->Name,
- 0,
- tObj->Image[0]->Format,
- (RECT *)NULL,
- tObj->Image[0]->Width,
- tObj->Image[0]->Height,
- TM_ACTION_BIND,
- (void *)tObj->Image[0]->Data );
-}
-/*===========================================================================*/
-/* TextureSubImage will make sure that the texture being updated is updated */
-/* if its on the card. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void TextureSubImage( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLint internalFormat, const struct gl_texture_image *image )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- RECT rect;
-
- /* TODO: only doing first LOD. */
- if ( (ctx->DriverCtx == NULL) || (level > 0) )
- return;
-
- /* Create a dirty rectangle structure. */
- rect.left = xoffset;
- rect.right = xoffset + width;
- rect.top = yoffset;
- rect.bottom = yoffset + height;
-
- CreateTMgrHAL( pContext->pShared,
- tObj->Name,
- 0,
- tObj->Image[0]->Format,
- &rect,
- tObj->Image[0]->Width,
- tObj->Image[0]->Height,
- TM_ACTION_UPDATE,
- (void *)tObj->Image[0]->Data );
-}
-
diff --git a/src/mesa/drivers/d3d/d3dText.h b/src/mesa/drivers/d3d/d3dText.h
deleted file mode 100644
index 9ff0650518b..00000000000
--- a/src/mesa/drivers/d3d/d3dText.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef D3D_TEXT_H
-#define D3D_TEXT_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <windows.h>
-#include <ddraw.h>
-#include <d3d.h>
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-#define D3DLTEXT_BITSUSED 0xFFFFFFFF
-#define MAX_VERTICES 700 // (14*40) 14 per character, 40 characters
-/*===========================================================================*/
-/* Macros defines. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-typedef struct _d3dText_metrics
-{
- float fntYScale,
- fntXScale;
-
- int fntXSpacing,
- fntYSpacing;
-
- DWORD dwColor;
- LPDIRECT3DDEVICE3 lpD3DDevice;
-
-} D3DFONTMETRICS, *PD3DFONTMETRICS;
-/*===========================================================================*/
-/* Function prototypes. */
-/*===========================================================================*/
-extern BOOL InitD3DText( void );
-extern void d3dTextDrawCharacter( char *c, int x, int y, PD3DFONTMETRICS pfntMetrics );
-extern void d3dTextDrawString( char *pszString, int x, int y, PD3DFONTMETRICS pfntMetrics );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/mesa/drivers/directfb/Makefile b/src/mesa/drivers/directfb/Makefile
deleted file mode 100644
index 94c82a2c9c9..00000000000
--- a/src/mesa/drivers/directfb/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-# src/mesa/drivers/directfb/Makefile
-
-TOP = ../../../..
-
-include $(TOP)/configs/current
-
-
-INCLUDE_DIRS = \
- -I$(TOP)/include \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mesa/glapi \
- -I$(TOP)/src/mesa/math \
- -I$(TOP)/src/mesa/tnl \
- -I$(TOP)/src/mesa/shader \
- -I$(TOP)/src/mesa/swrast \
- -I$(TOP)/src/mesa/swrast_setup
-
-DFB_CFLAGS = $(shell pkg-config --cflags directfb)
-DFB_MODULEDIR = $(shell pkg-config --variable=moduledir directfb-internal)
-
-DIRECTFBGL_MESA_SOURCES = ../common/driverfuncs.c idirectfbgl_mesa.c
-
-DIRECTFBGL_MESA_OBJECTS = $(DIRECTFBGL_MESA_SOURCES:.c=.o)
-
-DIRECTFBGL_MESA = libidirectfbgl_mesa.so
-
-LIBS = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DFB_CFLAGS) $< -o $@
-
-
-default: directfb-libgl directfbgl_mesa
-
-
-# XXX this used to be in src/mesa/Makefile and is probably broken now
-directfb-libgl: $(LIBS)
- @ $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
- -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(LIBS) \
- $(GL_LIB_DEPS)
-
-
-
-# Mesa DirectFBGL module
-directfbgl_mesa: $(DIRECTFBGL_MESA_OBJECTS)
- $(CC) -shared $(CFLAGS) $(DIRECTFBGL_MESA_OBJECTS) -o $(DIRECTFBGL_MESA) \
- -Wl,-soname -Wl,$(DIRECTFBGL_MESA) -L$(TOP)/$(LIB_DIR) -lGL -lm
-
-
-install:
- @if test -d $(DFB_MODULEDIR); then \
- echo "Installing DirectFBGL module."; \
- else \
- echo "*** Failed to determine DirectFB module's directory."; \
- echo "*** Installation aborted."; \
- exit 1; \
- fi;
- test -d $(DFB_MODULEDIR)/interfaces/IDirectFBGL/ || mkdir $(DFB_MODULEDIR)/interfaces/IDirectFBGL/
- install -m 755 $(DIRECTFBGL_MESA) $(DFB_MODULEDIR)/interfaces/IDirectFBGL/
-
-
-clean:
- -rm -f *.o *.so
-
diff --git a/src/mesa/drivers/directfb/idirectfbgl_mesa.c b/src/mesa/drivers/directfb/idirectfbgl_mesa.c
deleted file mode 100644
index 85a6f036724..00000000000
--- a/src/mesa/drivers/directfb/idirectfbgl_mesa.c
+++ /dev/null
@@ -1,982 +0,0 @@
-/*
- * Copyright (C) 2004-2007 Claudio Ciccani <klan@directfb.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * Based on glfbdev.c, written by Brian Paul.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <pthread.h>
-
-#include <directfb.h>
-#include <directfb_version.h>
-
-#include <directfbgl.h>
-
-#include <direct/mem.h>
-#include <direct/messages.h>
-#include <direct/interface.h>
-
-#undef CLAMP
-#include "main/glheader.h"
-#include "main/buffers.h"
-#include "main/context.h"
-#include "main/extensions.h"
-#include "main/framebuffer.h"
-#include "main/renderbuffer.h"
-#include "main/imports.h"
-#include "main/texformat.h"
-#include "main/teximage.h"
-#include "main/texstore.h"
-#include "vbo/vbo.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "drivers/common/driverfuncs.h"
-
-
-#define VERSION_CODE( M, m, r ) (((M) * 1000) + ((m) * 100) + ((r)))
-#define DIRECTFB_VERSION_CODE VERSION_CODE( DIRECTFB_MAJOR_VERSION, \
- DIRECTFB_MINOR_VERSION, \
- DIRECTFB_MICRO_VERSION )
-
-
-static DFBResult
-Probe( void *data );
-
-static DFBResult
-Construct( IDirectFBGL *thiz,
- IDirectFBSurface *surface );
-
-#include <direct/interface_implementation.h>
-
-DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBGL, Mesa )
-
-/*
- * private data struct of IDirectFBGL
- */
-typedef struct {
- int ref; /* reference counter */
-
- int locked;
-
- IDirectFBSurface *surface;
- DFBSurfacePixelFormat format;
- int width;
- int height;
-
- struct {
- GLubyte *start;
- GLubyte *end;
- int pitch;
- } video;
-
- GLvisual visual;
- GLframebuffer framebuffer;
- GLcontext context;
- struct gl_renderbuffer render;
-} IDirectFBGL_data;
-
-/******************************************************************************/
-
-static pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
-static unsigned int global_ref = 0;
-
-static INLINE int directfbgl_init( void )
-{
- pthread_mutexattr_t attr;
- int ret;
-
- if (global_ref++)
- return 0;
-
- pthread_mutexattr_init( &attr );
- pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_ERRORCHECK );
- ret = pthread_mutex_init( &global_lock, &attr );
- pthread_mutexattr_destroy( &attr );
-
- return ret;
-}
-
-static INLINE void directfbgl_finish( void )
-{
- if (--global_ref == 0)
- pthread_mutex_destroy( &global_lock );
-}
-
-#define directfbgl_lock() pthread_mutex_lock( &global_lock )
-#define directfbgl_unlock() pthread_mutex_unlock( &global_lock )
-
-/******************************************************************************/
-
-static bool directfbgl_init_visual ( GLvisual *visual,
- DFBSurfacePixelFormat format );
-static bool directfbgl_create_context ( GLcontext *context,
- GLframebuffer *framebuffer,
- GLvisual *visual,
- IDirectFBGL_data *data );
-static void directfbgl_destroy_context( GLcontext *context,
- GLframebuffer *framebuffer );
-
-/******************************************************************************/
-
-
-static void
-IDirectFBGL_Mesa_Destruct( IDirectFBGL *thiz )
-{
- IDirectFBGL_data *data = (IDirectFBGL_data*) thiz->priv;
-
- directfbgl_destroy_context( &data->context, &data->framebuffer );
-
- if (data->surface)
- data->surface->Release( data->surface );
-
- DIRECT_DEALLOCATE_INTERFACE( thiz );
-
- directfbgl_finish();
-}
-
-static DFBResult
-IDirectFBGL_Mesa_AddRef( IDirectFBGL *thiz )
-{
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- data->ref++;
-
- return DFB_OK;
-}
-
-static DFBResult
-IDirectFBGL_Mesa_Release( IDirectFBGL *thiz )
-{
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL )
-
- if (--data->ref == 0)
- IDirectFBGL_Mesa_Destruct( thiz );
-
- return DFB_OK;
-}
-
-static DFBResult
-IDirectFBGL_Mesa_Lock( IDirectFBGL *thiz )
-{
- IDirectFBSurface *surface;
- int width = 0;
- int height = 0;
- DFBResult ret;
-
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- if (data->locked) {
- data->locked++;
- return DFB_OK;
- }
-
- if (directfbgl_lock())
- return DFB_LOCKED;
-
- surface = data->surface;
- surface->GetSize( surface, &width, &height );
-
- ret = surface->Lock( surface, DSLF_READ | DSLF_WRITE,
- (void*)&data->video.start, &data->video.pitch );
- if (ret) {
- D_ERROR( "DirectFBGL/Mesa: couldn't lock surface.\n" );
- directfbgl_unlock();
- return ret;
- }
- data->video.end = data->video.start + (height-1) * data->video.pitch;
-
- data->render.Data = data->video.start;
-
- _mesa_make_current( &data->context,
- &data->framebuffer, &data->framebuffer );
-
- if (data->width != width || data->height != height) {
- _mesa_resize_framebuffer( &data->context,
- &data->framebuffer, width, height );
- data->width = width;
- data->height = height;
- }
-
- data->locked++;
-
- return DFB_OK;
-}
-
-static DFBResult
-IDirectFBGL_Mesa_Unlock( IDirectFBGL *thiz )
-{
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- if (!data->locked)
- return DFB_OK;
-
- if (--data->locked == 0) {
- _mesa_make_current( NULL, NULL, NULL );
-
- data->surface->Unlock( data->surface );
-
- directfbgl_unlock();
- }
-
- return DFB_OK;
-}
-
-static DFBResult
-IDirectFBGL_Mesa_GetAttributes( IDirectFBGL *thiz,
- DFBGLAttributes *attributes )
-{
- DFBSurfaceCapabilities caps;
- GLvisual *visual;
-
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- if (!attributes)
- return DFB_INVARG;
-
- data->surface->GetCapabilities( data->surface, &caps );
-
- visual = &data->visual;
-
- attributes->buffer_size = visual->rgbBits ? : visual->indexBits;
- attributes->depth_size = visual->depthBits;
- attributes->stencil_size = visual->stencilBits;
- attributes->aux_buffers = visual->numAuxBuffers;
- attributes->red_size = visual->redBits;
- attributes->green_size = visual->greenBits;
- attributes->blue_size = visual->blueBits;
- attributes->alpha_size = visual->alphaBits;
- attributes->accum_red_size = visual->accumRedBits;
- attributes->accum_green_size = visual->accumGreenBits;
- attributes->accum_blue_size = visual->accumBlueBits;
- attributes->accum_alpha_size = visual->accumAlphaBits;
- attributes->double_buffer = ((caps & DSCAPS_FLIPPING) != 0);
- attributes->stereo = (visual->stereoMode != 0);
-
- return DFB_OK;
-}
-
-#if DIRECTFBGL_INTERFACE_VERSION >= 1
-static DFBResult
-IDirectFBGL_Mesa_GetProcAddress( IDirectFBGL *thiz,
- const char *name,
- void **ret_address )
-{
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- if (!name)
- return DFB_INVARG;
-
- if (!ret_address)
- return DFB_INVARG;
-
- *ret_address = _glapi_get_proc_address( name );
-
- return (*ret_address) ? DFB_OK : DFB_UNSUPPORTED;
-}
-#endif
-
-
-/* exported symbols */
-
-static DFBResult
-Probe( void *data )
-{
- return DFB_OK;
-}
-
-static DFBResult
-Construct( IDirectFBGL *thiz, IDirectFBSurface *surface )
-{
- DFBResult ret;
-
- /* Initialize global resources. */
- if (directfbgl_init())
- return DFB_INIT;
-
- /* Allocate interface data. */
- DIRECT_ALLOCATE_INTERFACE_DATA( thiz, IDirectFBGL );
-
- /* Initialize interface data. */
- data->ref = 1;
-
- /* Duplicate destination surface. */
- ret = surface->GetSubSurface( surface, NULL, &data->surface );
- if (ret) {
- IDirectFBGL_Mesa_Destruct( thiz );
- return ret;
- }
-
- data->surface->GetPixelFormat( data->surface, &data->format );
- data->surface->GetSize( data->surface, &data->width, &data->height );
-
- /* Configure visual. */
- if (!directfbgl_init_visual( &data->visual, data->format )) {
- D_ERROR( "DirectFBGL/Mesa: failed to initialize visual.\n" );
- IDirectFBGL_Mesa_Destruct( thiz );
- return DFB_UNSUPPORTED;
- }
-
- /* Create context. */
- if (!directfbgl_create_context( &data->context,
- &data->framebuffer,
- &data->visual, data )) {
- D_ERROR( "DirectFBGL/Mesa: failed to create context.\n" );
- IDirectFBGL_Mesa_Destruct( thiz );
- return DFB_UNSUPPORTED;
- }
-
- /* Assign interface pointers. */
- thiz->AddRef = IDirectFBGL_Mesa_AddRef;
- thiz->Release = IDirectFBGL_Mesa_Release;
- thiz->Lock = IDirectFBGL_Mesa_Lock;
- thiz->Unlock = IDirectFBGL_Mesa_Unlock;
- thiz->GetAttributes = IDirectFBGL_Mesa_GetAttributes;
-#if DIRECTFBGL_INTERFACE_VERSION >= 1
- thiz->GetProcAddress = IDirectFBGL_Mesa_GetProcAddress;
-#endif
-
- return DFB_OK;
-}
-
-
-/***************************** Driver functions ******************************/
-
-static const GLubyte*
-dfbGetString( GLcontext *ctx, GLenum pname )
-{
- return NULL;
-}
-
-static void
-dfbUpdateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-}
-
-static void
-dfbGetBufferSize( GLframebuffer *buffer, GLuint *width, GLuint *height )
-{
- GLcontext *ctx = _mesa_get_current_context();
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-
- *width = (GLuint) data->width;
- *height = (GLuint) data->height;
-}
-
-/**
- * We only implement this function as a mechanism to check if the
- * framebuffer size has changed (and update corresponding state).
- */
-static void
-dfbSetViewport( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
-{
- /* Nothing to do (the surface can't be resized while it's locked). */
- return;
-}
-
-static void
-dfbClear( GLcontext *ctx, GLbitfield mask )
-{
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-
-#define BUFFER_BIT_MASK (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT | \
- BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT )
- if (mask & BUFFER_BIT_MASK &&
- ctx->Color.ColorMask[0][0] &&
- ctx->Color.ColorMask[0][1] &&
- ctx->Color.ColorMask[0][2] &&
- ctx->Color.ColorMask[0][3])
- {
- DFBRegion clip;
- GLubyte a, r, g, b;
-
- UNCLAMPED_FLOAT_TO_UBYTE( a, ctx->Color.ClearColor[ACOMP] );
- UNCLAMPED_FLOAT_TO_UBYTE( r, ctx->Color.ClearColor[RCOMP] );
- UNCLAMPED_FLOAT_TO_UBYTE( g, ctx->Color.ClearColor[GCOMP] );
- UNCLAMPED_FLOAT_TO_UBYTE( b, ctx->Color.ClearColor[BCOMP] );
-
- clip.x1 = ctx->DrawBuffer->_Xmin;
- clip.y1 = ctx->DrawBuffer->_Ymin;
- clip.x2 = ctx->DrawBuffer->_Xmax - 1;
- clip.y2 = ctx->DrawBuffer->_Ymax - 1;
- data->surface->SetClip( data->surface, &clip );
-
- data->surface->Unlock( data->surface );
-
- data->surface->Clear( data->surface, r, g, b, a );
-
- data->surface->Lock( data->surface, DSLF_READ | DSLF_WRITE,
- (void*)&data->video.start, &data->video.pitch );
- data->video.end = data->video.start + (data->height-1) * data->video.pitch;
- data->render.Data = data->video.start;
-
- mask &= ~BUFFER_BIT_MASK;
- }
-#undef BUFFER_BIT_MASK
-
- if (mask)
- _swrast_Clear( ctx, mask );
-}
-
-
-/************************ RenderBuffer functions *****************************/
-
-static void
-dfbDeleteRenderbuffer( struct gl_renderbuffer *render )
-{
- return;
-}
-
-static GLboolean
-dfbRenderbufferStorage( GLcontext *ctx, struct gl_renderbuffer *render,
- GLenum internalFormat, GLuint width, GLuint height )
-{
- return GL_TRUE;
-}
-
-
-/***************************** Span functions ********************************/
-
-/* RGB332 */
-#define NAME(PREFIX) PREFIX##_RGB332
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = data->video.end - (Y) * data->video.pitch + (X);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[RCOMP]) & 0xe0) ) | \
- (((S[GCOMP]) & 0xe0) >> 3) | \
- (((S[BCOMP]) ) >> 6) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0xe0) ); \
- D[GCOMP] = ((*P & 0x1c) << 3); \
- D[BCOMP] = ((*P & 0x03) << 6); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* ARGB4444 */
-#define NAME(PREFIX) PREFIX##_ARGB4444
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( 0xf000 | \
- (((S[RCOMP]) & 0xf0) << 4) | \
- (((S[GCOMP]) & 0xf0) ) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[ACOMP]) & 0xf0) << 8) | \
- (((S[RCOMP]) & 0xf0) << 4) | \
- (((S[GCOMP]) & 0xf0) ) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x0f00) >> 4) | ((*P & 0x0f00) >> 8); \
- D[GCOMP] = ((*P & 0x00f0) ) | ((*P & 0x00f0) >> 4); \
- D[BCOMP] = ((*P & 0x000f) << 4) | ((*P & 0x000f) ); \
- D[ACOMP] = ((*P & 0xf000) >> 8) | ((*P & 0xf000) >> 12)
-
-#include "swrast/s_spantemp.h"
-
-/* RGB444 */
-#define NAME(PREFIX) PREFIX##_RGB444
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[RCOMP]) & 0xf0) << 4) | \
- (((S[GCOMP]) & 0xf0) ) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x0f00) >> 4) | ((*P & 0x0f00) >> 8); \
- D[GCOMP] = ((*P & 0x00f0) ) | ((*P & 0x00f0) >> 4); \
- D[BCOMP] = ((*P & 0x000f) << 4) | ((*P & 0x000f) ); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* ARGB2554 */
-#define NAME(PREFIX) PREFIX##_ARGB2554
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( 0xc000 | \
- (((S[RCOMP]) & 0xf8) << 6) | \
- (((S[GCOMP]) & 0xf8) << 1) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[ACOMP]) & 0xc0) << 8) | \
- (((S[RCOMP]) & 0xf8) << 6) | \
- (((S[GCOMP]) & 0xf8) << 1) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x3e00) >> 9); \
- D[GCOMP] = ((*P & 0x01f0) >> 4); \
- D[BCOMP] = ((*P & 0x000f) << 4); \
- D[ACOMP] = ((*P & 0xc000) >> 14)
-
-#include "swrast/s_spantemp.h"
-
-/* ARGB1555 */
-#define NAME(PREFIX) PREFIX##_ARGB1555
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( 0x8000 | \
- (((S[RCOMP]) & 0xf8) << 7) | \
- (((S[GCOMP]) & 0xf8) << 2) | \
- (((S[BCOMP]) ) >> 3) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[ACOMP]) & 0x80) << 16) | \
- (((S[RCOMP]) & 0xf8) << 7) | \
- (((S[GCOMP]) & 0xf8) << 2) | \
- (((S[BCOMP]) ) >> 3) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x7c00) >> 7) | ((*P & 0x7c00) >> 12); \
- D[GCOMP] = ((*P & 0x03e0) >> 2) | ((*P & 0x03e0) >> 7); \
- D[BCOMP] = ((*P & 0x001f) << 3) | ((*P & 0x001f) << 2); \
- D[ACOMP] = ((*P & 0x8000) ? 0xff : 0)
-
-#include "swrast/s_spantemp.h"
-
-/* RGB555 */
-#define NAME(PREFIX) PREFIX##_RGB555
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[RCOMP]) & 0xf8) << 7) | \
- (((S[GCOMP]) & 0xf8) << 2) | \
- (((S[BCOMP]) ) >> 3) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x7c00) >> 7) | ((*P & 0x7c00) >> 12); \
- D[GCOMP] = ((*P & 0x03e0) >> 2) | ((*P & 0x03e0) >> 7); \
- D[BCOMP] = ((*P & 0x001f) << 3) | ((*P & 0x001f) << 2); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* RGB16 */
-#define NAME(PREFIX) PREFIX##_RGB16
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[RCOMP]) & 0xf8) << 8) | \
- (((S[GCOMP]) & 0xfc) << 3) | \
- (((S[BCOMP]) ) >> 3) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0xf800) >> 8) | ((*P & 0xf800) >> 13); \
- D[GCOMP] = ((*P & 0x07e0) >> 3) | ((*P & 0x07e0) >> 9); \
- D[BCOMP] = ((*P & 0x001f) << 3) | ((*P & 0x001f) >> 2); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* RGB24 */
-#define NAME(PREFIX) PREFIX##_RGB24
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = data->video.end - (Y) * data->video.pitch + (X) * 3;
-#define INC_PIXEL_PTR(P) P += 3
-#define STORE_PIXEL(P, X, Y, S) \
- P[0] = S[BCOMP]; P[1] = S[GCOMP]; P[2] = S[BCOMP]
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = P[2]; D[GCOMP] = P[1]; D[BCOMP] = P[0]; D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* RGB32 */
-#define NAME(PREFIX) PREFIX##_RGB32
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint*) (data->video.end - (Y) * data->video.pitch + (X) * 4);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( ((S[RCOMP]) << 16) | \
- ((S[GCOMP]) << 8) | \
- ((S[BCOMP]) ) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x00ff0000) >> 16); \
- D[GCOMP] = ((*P & 0x0000ff00) >> 8); \
- D[BCOMP] = ((*P & 0x000000ff) ); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* ARGB */
-#define NAME(PREFIX) PREFIX##_ARGB
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint*) (data->video.end - (Y) * data->video.pitch + (X) * 4);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( 0xff000000 | \
- ((S[RCOMP]) << 16) | \
- ((S[GCOMP]) << 8) | \
- ((S[BCOMP]) ) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( ((S[ACOMP]) << 24) | \
- ((S[RCOMP]) << 16) | \
- ((S[GCOMP]) << 8) | \
- ((S[BCOMP]) ) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x00ff0000) >> 16); \
- D[GCOMP] = ((*P & 0x0000ff00) >> 8); \
- D[BCOMP] = ((*P & 0x000000ff) ); \
- D[ACOMP] = ((*P & 0xff000000) >> 24)
-
-#include "swrast/s_spantemp.h"
-
-/* AiRGB */
-#define NAME(PREFIX) PREFIX##_AiRGB
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint*) (data->video.end - (Y) * data->video.pitch + (X) * 4);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( ((S[RCOMP]) << 16) | \
- ((S[GCOMP]) << 8) | \
- ((S[BCOMP]) ) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[ACOMP]) ^ 0xff) << 24) | \
- (((S[RCOMP]) ) << 16) | \
- (((S[GCOMP]) ) << 8) | \
- (((S[BCOMP]) ) ) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x00ff0000) >> 16); \
- D[GCOMP] = ((*P & 0x0000ff00) >> 8); \
- D[BCOMP] = ((*P & 0x000000ff) ); \
- D[ACOMP] = (((*P & 0xff000000) >> 24) ^ 0xff)
-
-#include "swrast/s_spantemp.h"
-
-
-/*****************************************************************************/
-
-static bool
-directfbgl_init_visual( GLvisual *visual,
- DFBSurfacePixelFormat format )
-{
- GLboolean rgbFlag = GL_TRUE;
- GLboolean dbFlag = GL_FALSE;
- GLboolean stereoFlag = GL_FALSE;
- GLint redBits = 0;
- GLint blueBits = 0;
- GLint greenBits = 0;
- GLint alphaBits = 0;
- GLint indexBits = 0;
- GLint depthBits = 0;
- GLint stencilBits = 0;
- GLint accumRedBits = 0;
- GLint accumGreenBits = 0;
- GLint accumBlueBits = 0;
- GLint accumAlphaBits = 0;
- GLint numSamples = 0;
-
- /* FIXME: LUT8 support. */
- switch (format) {
- case DSPF_RGB332:
- redBits = 3;
- greenBits = 3;
- blueBits = 2;
- break;
- case DSPF_ARGB4444:
- alphaBits = 4;
- case DSPF_RGB444:
- redBits = 4;
- greenBits = 4;
- blueBits = 4;
- break;
- case DSPF_ARGB2554:
- alphaBits = 2;
- redBits = 5;
- greenBits = 5;
- blueBits = 4;
- break;
- case DSPF_ARGB1555:
- alphaBits = 1;
- case DSPF_RGB555:
- redBits = 5;
- greenBits = 5;
- blueBits = 5;
- break;
- case DSPF_RGB16:
- redBits = 5;
- greenBits = 6;
- blueBits = 5;
- break;
- case DSPF_ARGB:
- case DSPF_AiRGB:
- alphaBits = 8;
- case DSPF_RGB24:
- case DSPF_RGB32:
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
- break;
- default:
- D_WARN( "unsupported pixelformat" );
- return false;
- }
-
- if (rgbFlag) {
- accumRedBits = redBits;
- accumGreenBits = greenBits;
- accumBlueBits = blueBits;
- accumAlphaBits = alphaBits;
- depthBits = redBits + greenBits + blueBits;
- stencilBits = alphaBits;
- } else
- depthBits = 8;
-
- return _mesa_initialize_visual( visual,
- rgbFlag, dbFlag, stereoFlag,
- redBits, greenBits, blueBits, alphaBits,
- indexBits, depthBits, stencilBits,
- accumRedBits, accumGreenBits,
- accumBlueBits, accumAlphaBits,
- numSamples );
-}
-
-static bool
-directfbgl_create_context( GLcontext *context,
- GLframebuffer *framebuffer,
- GLvisual *visual,
- IDirectFBGL_data *data )
-{
- struct dd_function_table functions;
-
- _mesa_initialize_window_framebuffer( framebuffer, visual );
-
- _mesa_init_driver_functions( &functions );
- functions.GetString = dfbGetString;
- functions.UpdateState = dfbUpdateState;
- functions.GetBufferSize = dfbGetBufferSize;
- functions.Viewport = dfbSetViewport;
- functions.Clear = dfbClear;
-
- if (!_mesa_initialize_context( context, visual, NULL,
- &functions, (void*) data )) {
- D_DEBUG( "DirectFBGL/Mesa: _mesa_initialize_context() failed.\n" );
- _mesa_free_framebuffer_data( framebuffer );
- return false;
- }
-
- _swrast_CreateContext( context );
- _vbo_CreateContext( context );
- _tnl_CreateContext( context );
- _swsetup_CreateContext( context );
- _swsetup_Wakeup( context );
-
- _mesa_init_renderbuffer( &data->render, 0 );
- data->render.InternalFormat = GL_RGBA;
- data->render._BaseFormat = GL_RGBA;
- data->render.DataType = GL_UNSIGNED_BYTE;
- data->render.Data = data->video.start;
- data->render.Delete = dfbDeleteRenderbuffer;
- data->render.AllocStorage = dfbRenderbufferStorage;
-
- switch (data->format) {
- case DSPF_RGB332:
- data->render.GetRow = get_row_RGB332;
- data->render.GetValues = get_values_RGB332;
- data->render.PutRow = put_row_RGB332;
- data->render.PutRowRGB = put_row_rgb_RGB332;
- data->render.PutMonoRow = put_mono_row_RGB332;
- data->render.PutValues = put_values_RGB332;
- data->render.PutMonoValues = put_mono_values_RGB332;
- break;
- case DSPF_ARGB4444:
- data->render.GetRow = get_row_ARGB4444;
- data->render.GetValues = get_values_ARGB4444;
- data->render.PutRow = put_row_ARGB4444;
- data->render.PutRowRGB = put_row_rgb_ARGB4444;
- data->render.PutMonoRow = put_mono_row_ARGB4444;
- data->render.PutValues = put_values_ARGB4444;
- data->render.PutMonoValues = put_mono_values_ARGB4444;
- break;
- case DSPF_RGB444:
- data->render.GetRow = get_row_RGB444;
- data->render.GetValues = get_values_RGB444;
- data->render.PutRow = put_row_RGB444;
- data->render.PutRowRGB = put_row_rgb_RGB444;
- data->render.PutMonoRow = put_mono_row_RGB444;
- data->render.PutValues = put_values_RGB444;
- data->render.PutMonoValues = put_mono_values_RGB444;
- break;
- case DSPF_ARGB2554:
- data->render.GetRow = get_row_ARGB2554;
- data->render.GetValues = get_values_ARGB2554;
- data->render.PutRow = put_row_ARGB2554;
- data->render.PutRowRGB = put_row_rgb_ARGB2554;
- data->render.PutMonoRow = put_mono_row_ARGB2554;
- data->render.PutValues = put_values_ARGB2554;
- data->render.PutMonoValues = put_mono_values_ARGB2554;
- break;
- case DSPF_ARGB1555:
- data->render.GetRow = get_row_ARGB1555;
- data->render.GetValues = get_values_ARGB1555;
- data->render.PutRow = put_row_ARGB1555;
- data->render.PutRowRGB = put_row_rgb_ARGB1555;
- data->render.PutMonoRow = put_mono_row_ARGB1555;
- data->render.PutValues = put_values_ARGB1555;
- data->render.PutMonoValues = put_mono_values_ARGB1555;
- break;
- case DSPF_RGB555:
- data->render.GetRow = get_row_RGB555;
- data->render.GetValues = get_values_RGB555;
- data->render.PutRow = put_row_RGB555;
- data->render.PutRowRGB = put_row_rgb_RGB555;
- data->render.PutMonoRow = put_mono_row_RGB555;
- data->render.PutValues = put_values_RGB555;
- data->render.PutMonoValues = put_mono_values_RGB555;
- break;
- case DSPF_RGB16:
- data->render.GetRow = get_row_RGB16;
- data->render.GetValues = get_values_RGB16;
- data->render.PutRow = put_row_RGB16;
- data->render.PutRowRGB = put_row_rgb_RGB16;
- data->render.PutMonoRow = put_mono_row_RGB16;
- data->render.PutValues = put_values_RGB16;
- data->render.PutMonoValues = put_mono_values_RGB16;
- break;
- case DSPF_RGB24:
- data->render.GetRow = get_row_RGB24;
- data->render.GetValues = get_values_RGB24;
- data->render.PutRow = put_row_RGB24;
- data->render.PutRowRGB = put_row_rgb_RGB24;
- data->render.PutMonoRow = put_mono_row_RGB24;
- data->render.PutValues = put_values_RGB24;
- data->render.PutMonoValues = put_mono_values_RGB24;
- break;
- case DSPF_RGB32:
- data->render.GetRow = get_row_RGB32;
- data->render.GetValues = get_values_RGB32;
- data->render.PutRow = put_row_RGB32;
- data->render.PutRowRGB = put_row_rgb_RGB32;
- data->render.PutMonoRow = put_mono_row_RGB32;
- data->render.PutValues = put_values_RGB32;
- data->render.PutMonoValues = put_mono_values_RGB32;
- break;
- case DSPF_ARGB:
- data->render.GetRow = get_row_ARGB;
- data->render.GetValues = get_values_ARGB;
- data->render.PutRow = put_row_ARGB;
- data->render.PutRowRGB = put_row_rgb_ARGB;
- data->render.PutMonoRow = put_mono_row_ARGB;
- data->render.PutValues = put_values_ARGB;
- data->render.PutMonoValues = put_mono_values_ARGB;
- break;
- case DSPF_AiRGB:
- data->render.GetRow = get_row_AiRGB;
- data->render.GetValues = get_values_AiRGB;
- data->render.PutRow = put_row_AiRGB;
- data->render.PutRowRGB = put_row_rgb_AiRGB;
- data->render.PutMonoRow = put_mono_row_AiRGB;
- data->render.PutValues = put_values_AiRGB;
- data->render.PutMonoValues = put_mono_values_AiRGB;
- break;
- default:
- D_BUG( "unexpected pixelformat" );
- return false;
- }
-
- data->render.Width = data->width;
- data->render.Height = data->height;
-
- _mesa_add_renderbuffer( framebuffer, BUFFER_FRONT_LEFT, &data->render );
-
- _mesa_add_soft_renderbuffers( framebuffer,
- GL_FALSE,
- visual->haveDepthBuffer,
- visual->haveStencilBuffer,
- visual->haveAccumBuffer,
- GL_FALSE,
- GL_FALSE );
-
- TNL_CONTEXT( context )->Driver.RunPipeline = _tnl_run_pipeline;
-
- _mesa_enable_sw_extensions( context );
-
- return true;
-}
-
-static void
-directfbgl_destroy_context( GLcontext *context,
- GLframebuffer *framebuffer )
-{
- _swsetup_DestroyContext( context );
- _swrast_DestroyContext( context );
- _tnl_DestroyContext( context );
- _vbo_DestroyContext( context );
- //_mesa_free_framebuffer_data( framebuffer );
- _mesa_free_context_data( context );
-}
-
diff --git a/src/mesa/drivers/dos/blit.S b/src/mesa/drivers/dos/blit.S
deleted file mode 100644
index 02dc8400d8d..00000000000
--- a/src/mesa/drivers/dos/blit.S
+++ /dev/null
@@ -1,1040 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
- .file "blit.S"
-
-/*
- * extern unsigned int vesa_gran_mask, vesa_gran_shift;
- * extern int vl_video_selector;
-
- * extern void *vl_current_draw_buffer;
- * extern int vl_current_stride, vl_current_height;
- * extern int vl_current_offset, vl_current_delta;
- */
-
- .text
-
-/* Desc: VESA bank switching routine (BIOS)
- *
- * In : EBX=0, EDX = bank number
- * Out : -
- *
- * Note: thrashes EAX
- */
- .p2align 5,,31
-_vesa_swbankBIOS:
- movw $0x4f05, %ax
- int $0x10
- ret
-
- .p2align 2,,3
- .global _vesa_swbank
-_vesa_swbank: .long _vesa_swbankBIOS
-
-/* Desc: void vesa_b_dump_virtual (void);
- *
- * In : -
- * Out : -
- *
- * Note: uses current draw buffer
- */
- .p2align 5,,31
- .global _vesa_b_dump_virtual
-_vesa_b_dump_virtual:
- cld
- pushl %es
- pushl %ebx
- pushl %esi
- pushl %edi
- pushl %ebp
- movl _vl_video_selector, %es
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vesa_gran_shift, %ecx
- movl _vesa_gran_mask, %ebp
- movl %edi, %edx
- xorl %ebx, %ebx
- andl %ebp, %edi
- shrl %cl, %edx
- incl %ebp
- call *_vesa_swbank
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %eax
- movl _vl_current_delta, %ebx
- shrl $2, %ecx
- .balign 4
- 0:
- pushl %ecx
- .balign 4
- 1:
- cmpl %ebp, %edi
- jb 2f
- pushl %eax
- pushl %ebx
- incl %edx
- xorl %ebx, %ebx
- call *_vesa_swbank
- popl %ebx
- popl %eax
- subl %ebp, %edi
- .balign 4
- 2:
- movsl
- decl %ecx
- jnz 1b
- popl %ecx
- addl %ebx, %edi
- decl %eax
- jnz 0b
- popl %ebp
- popl %edi
- popl %esi
- popl %ebx
- popl %es
- ret
-
-/* Desc: void vesa_l_dump_virtual (void);
- *
- * In : -
- * Out : -
- *
- * Note: uses current draw buffer
- */
- .p2align 5,,31
- .global _vesa_l_dump_virtual
-_vesa_l_dump_virtual:
- cld
- pushl %es
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %es
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %eax
- shrl $2, %ecx
- .balign 4
- 0:
- pushl %ecx
- rep; movsl
- popl %ecx
- addl %eax, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- popl %es
- ret
-
-/* Desc: void vesa_l_dump_virtual_mmx (void);
- *
- * In : -
- * Out : -
- *
- * Note: uses current draw buffer
- */
- .p2align 5,,31
- .global _vesa_l_dump_virtual_mmx
-_vesa_l_dump_virtual_mmx:
-#ifdef USE_MMX_ASM
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %eax
- shrl $3, %ecx
- .balign 4
- 0:
- pushl %ecx
- .balign 4
- 1:
- movq (%esi), %mm0
- addl $8, %esi
- movq %mm0, %fs:(%edi)
- addl $8, %edi
- decl %ecx
- jnz 1b
- popl %ecx
- addl %eax, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- emms
-#endif
- ret
-
-
-
-#define CVT_32_TO_16(s, tmp) \
- /* SRC = bbbbbbbbggggggggrrrrrrrr******** */\
- movl %e##s##x, %tmp ;\
- /* TMP = bbbbbbbbggggggggrrrrrrrr******** */\
- shrb $2, %s##h ;\
- /* SRC = bbbbbbbbgggggg00rrrrrrrr******** */\
- andl $0xF80000, %tmp ;\
- /* TMP = 0000000000000000000rrrrr00000000 */\
- shrw $3, %s##x ;\
- /* SRC = bbbbbgggggg00000rrrrrrrr******** */\
- shrl $8, %tmp ;\
- /* TMP = 00000000000rrrrr0000000000000000 */\
- orl %tmp, %e##s##x ;\
- /* SRC = bbbbbggggggrrrrrrrrrrrrr******** */
-
-#define CVT_32_TO_15(s, tmp) \
- /* SRC = bbbbbbbbggggggggrrrrrrrr******** */\
- movl %e##s##x, %tmp ;\
- /* TMP = bbbbbbbbggggggggrrrrrrrr******** */\
- shrb $3, %s##h ;\
- /* SRC = bbbbbbbbgggggg00rrrrrrrr******** */\
- andl $0xF80000, %tmp ;\
- /* TMP = 0000000000000000000rrrrr00000000 */\
- shrw $3, %s##x ;\
- /* SRC = bbbbbgggggg00000rrrrrrrr******** */\
- shrl $9, %tmp ;\
- /* TMP = 00000000000rrrrr0000000000000000 */\
- orl %tmp, %e##s##x ;\
- /* SRC = bbbbbggggggrrrrrrrrrrrrr******** */
-
-#define CVT_16_TO_15(src, tmp) \
- /* SRC = bbbbbggggggrrrrrBBBBBGGGGGGRRRRR */\
- movl %src, %tmp ;\
- /* TMP = bbbbbggggggrrrrrBBBBBGGGGGGRRRRR */\
- andl $0x1F001F, %src ;\
- /* SRC = bbbbb00000000000BBBBB00000000000 */\
- andl $0xFFC0FFC0, %tmp ;\
- /* TMP = 000000gggggrrrrr000000GGGGGRRRRR */\
- shrl %tmp ;\
- /* TMP = 00000gggggrrrrr000000GGGGGRRRRR0 */\
- orl %tmp, %src ;\
- /* SRC = bbbbbgggggrrrrr0BBBBBGGGGGRRRRR0 */\
-
-
-
-/* transform BGRA to BGR */
- .p2align 5,,31
- .global _vesa_l_dump_32_to_24
-_vesa_l_dump_32_to_24:
- pushl %ebx
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %ecx
- 1:
- movl (%esi), %eax
- addl $4, %esi
- movw %ax, %fs:(%edi)
- shrl $16, %eax
- movb %al, %fs:2(%edi)
- addl $3, %edi
- subl $3, %ecx
- jnz 1b
- popl %ecx
- addl %ebx, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- popl %ebx
- ret
-
-/* transform BGRA to B5G6R5 */
- .p2align 5,,31
- .global _vesa_l_dump_32_to_16
-_vesa_l_dump_32_to_16:
- pushl %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %ecx
- 1:
- movl (%esi), %eax
- addl $4, %esi
- CVT_32_TO_16(a, ebp)
- movw %ax, %fs:(%edi)
- addl $2, %edi
- subl $2, %ecx
- jnz 1b
- popl %ecx
- addl %ebx, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- ret
-
-/* transform BGRA to B5G5R5 */
- .p2align 5,,31
- .global _vesa_l_dump_32_to_15
-_vesa_l_dump_32_to_15:
- pushl %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %ecx
- 1:
- movl (%esi), %eax
- addl $4, %esi
- CVT_32_TO_15(a, ebp)
- movw %ax, %fs:(%edi)
- addl $2, %edi
- subl $2, %ecx
- jnz 1b
- popl %ecx
- addl %ebx, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- ret
-
-/* transform BGRA to fake8 */
- .p2align 5,,31
- .global _vesa_l_dump_32_to_8
-_vesa_l_dump_32_to_8:
- pushl %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %edx
- pushl %ecx
- pushl %ebx
- 1:
- movl (%esi), %eax
- addl $4, %esi
-#if 1
- xorl %ebx, %ebx
- movl %eax, %edx
- movb %ah, %bl
- shrl $16, %edx
- andl $0xFF, %edx
- andl $0xFF, %eax
-
- movb _array_b(%eax), %al
- movb _array_r(%edx), %dl
- movb _array_g(%ebx), %bl
-
- imull $36, %eax
- imull $6, %ebx
- addl %edx, %eax
- addl %ebx, %eax
-#endif
- movb %al, %fs:(%edi)
- incl %edi
- decl %ecx
- jnz 1b
- popl %ebx
- popl %ecx
- popl %edx
- addl %ebx, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- ret
-
-/* transform BGR to BGRx */
- .p2align 5,,31
- .global _vesa_l_dump_24_to_32
-_vesa_l_dump_24_to_32:
- pushl %ebx
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %ecx
- 1:
- movl (%esi), %eax
- addl $3, %esi
- movl %eax, %fs:(%edi)
- addl $4, %edi
- subl $4, %ecx
- jnz 1b
- popl %ecx
- addl %ebx, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- popl %ebx
- ret
-
-/* transform BGR to fake8 */
- .p2align 5,,31
- .global _vesa_l_dump_24_to_8
-_vesa_l_dump_24_to_8:
- pushl %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %edx
- pushl %ecx
- pushl %ebx
- 1:
- movl (%esi), %eax
- addl $3, %esi
-#if 1
- xorl %ebx, %ebx
- movl %eax, %edx
- movb %ah, %bl
- shrl $16, %edx
- andl $0xFF, %edx
- andl $0xFF, %eax
-
- movb _array_b(%eax), %al
- movb _array_r(%edx), %dl
- movb _array_g(%ebx), %bl
-
- imull $36, %eax
- imull $6, %ebx
- addl %edx, %eax
- addl %ebx, %eax
-#endif
- movb %al, %fs:(%edi)
- incl %edi
- decl %ecx
- jnz 1b
- popl %ebx
- popl %ecx
- popl %edx
- addl %ebx, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- ret
-
-/* transform B5G6R5 to B5G5R5 */
- .p2align 5,,31
- .global _vesa_l_dump_16_to_15
-_vesa_l_dump_16_to_15:
- pushl %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %ecx
- 1:
- movl (%esi), %eax
- addl $4, %esi
- CVT_16_TO_15(eax, ebp)
- movl %eax, %fs:(%edi)
- addl $4, %edi
- subl $4, %ecx
- jnz 1b
- popl %ecx
- addl %ebx, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- ret
-
-/* transform B5G6R5 to fake8 */
- .p2align 5,,31
- .global _vesa_l_dump_16_to_8
-_vesa_l_dump_16_to_8:
- pushl %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %edx
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %ecx
- pushl %ebx
- 1:
- movl (%esi), %eax
- addl $4, %esi
-#if 1
- movl %eax, %ebx
- andl $0xFFFF, %eax
- shrl $16, %ebx
- movb _tab_16_8(%eax), %al
- movb _tab_16_8(%ebx), %ah
-#endif
- movw %ax, %fs:(%edi)
- addl $2, %edi
- subl $2, %ecx
- jnz 1b
- popl %ebx
- popl %ecx
- addl %ebx, %edi
- decl %edx
- jnz 0b
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- ret
-
-
-
- .p2align 5,,31
- .global _vesa_b_dump_32_to_24
-_vesa_b_dump_32_to_24:
- pushl %ebx
- pushl %esi
- pushl %edi
- pushl %ebp
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vesa_gran_shift, %ecx
- movl _vesa_gran_mask, %ebp
- movl %edi, %edx
- xorl %ebx, %ebx
- andl %ebp, %edi
- shrl %cl, %edx
- incl %ebp
- call *_vesa_swbank
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %eax
- movl $0x00FFFFFF, %ebx
- .balign 4
- 0:
- pushl %eax
- pushl %ecx
- .balign 4
- 1:
- cmpl %ebp, %edi
- jb 2f
- pushl %ebx
- incl %edx
- xorl %ebx, %ebx
- call *_vesa_swbank
- popl %ebx
- subl %ebp, %edi
- .balign 4
- 2:
- movb (%esi), %al /* XXX too many accesses */
- incl %esi
- rorl $8, %ebx
- jnc 2b
- movb %al, %fs:(%edi)
- incl %edi
- decl %ecx
- jnz 1b
- popl %ecx
- popl %eax
- addl _vl_current_delta, %edi
- decl %eax
- jnz 0b
- popl %ebp
- popl %edi
- popl %esi
- popl %ebx
- ret
-
- .p2align 5,,31
- .global _vesa_b_dump_32_to_16
-_vesa_b_dump_32_to_16:
- pushl %ebx
- pushl %esi
- pushl %edi
- pushl %ebp
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vesa_gran_shift, %ecx
- movl _vesa_gran_mask, %ebp
- movl %edi, %edx
- xorl %ebx, %ebx
- andl %ebp, %edi
- shrl %cl, %edx
- incl %ebp
- call *_vesa_swbank
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %eax
- .balign 4
- 0:
- pushl %eax
- pushl %ecx
- .balign 4
- 1:
- cmpl %ebp, %edi
- jb 2f
- incl %edx
- xorl %ebx, %ebx
- call *_vesa_swbank
- subl %ebp, %edi
- .balign 4
- 2:
- movl (%esi), %eax
- addl $4, %esi
- CVT_32_TO_16(a, ebx)
- movw %ax, %fs:(%edi)
- addl $2, %edi
- subl $2, %ecx
- jnz 1b
- popl %ecx
- popl %eax
- addl _vl_current_delta, %edi
- decl %eax
- jnz 0b
- popl %ebp
- popl %edi
- popl %esi
- popl %ebx
- ret
-
- .p2align 5,,31
- .global _vesa_b_dump_32_to_15
-_vesa_b_dump_32_to_15:
- pushl %ebx
- pushl %esi
- pushl %edi
- pushl %ebp
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vesa_gran_shift, %ecx
- movl _vesa_gran_mask, %ebp
- movl %edi, %edx
- xorl %ebx, %ebx
- andl %ebp, %edi
- shrl %cl, %edx
- incl %ebp
- call *_vesa_swbank
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %eax
- .balign 4
- 0:
- pushl %eax
- pushl %ecx
- .balign 4
- 1:
- cmpl %ebp, %edi
- jb 2f
- incl %edx
- xorl %ebx, %ebx
- call *_vesa_swbank
- subl %ebp, %edi
- .balign 4
- 2:
- movl (%esi), %eax
- addl $4, %esi
- CVT_32_TO_15(a, ebx)
- movw %ax, %fs:(%edi)
- addl $2, %edi
- subl $2, %ecx
- jnz 1b
- popl %ecx
- popl %eax
- addl _vl_current_delta, %edi
- decl %eax
- jnz 0b
- popl %ebp
- popl %edi
- popl %esi
- popl %ebx
- ret
-
- .p2align 5,,31
- .global _vesa_b_dump_32_to_8
-_vesa_b_dump_32_to_8:
- pushl %ebx
- pushl %esi
- pushl %edi
- pushl %ebp
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vesa_gran_shift, %ecx
- movl _vesa_gran_mask, %ebp
- movl %edi, %edx
- xorl %ebx, %ebx
- andl %ebp, %edi
- shrl %cl, %edx
- incl %ebp
- call *_vesa_swbank
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %eax
- .balign 4
- 0:
- pushl %eax
- pushl %ecx
- pushl %edx
- .balign 4
- 1:
- cmpl %ebp, %edi
- jb 2f
- popl %edx
- incl %edx
- pushl %edx
- xorl %ebx, %ebx
- call *_vesa_swbank
- subl %ebp, %edi
- .balign 4
- 2:
- movl (%esi), %eax
- addl $4, %esi
-#if 1
- xorl %ebx, %ebx
- movl %eax, %edx
- movb %ah, %bl
- shrl $16, %edx
- andl $0xFF, %edx
- andl $0xFF, %eax
-
- movb _array_b(%eax), %al
- movb _array_r(%edx), %dl
- movb _array_g(%ebx), %bl
-
- imull $36, %eax
- imull $6, %ebx
- addl %edx, %eax
- addl %ebx, %eax
-#endif
- movb %al, %fs:(%edi)
- incl %edi
- decl %ecx
- jnz 1b
- popl %edx
- popl %ecx
- popl %eax
- addl _vl_current_delta, %edi
- decl %eax
- jnz 0b
- popl %ebp
- popl %edi
- popl %esi
- popl %ebx
- ret
-
- .p2align 5,,31
- .global _vesa_b_dump_24_to_32
-_vesa_b_dump_24_to_32:
- pushl %ebx
- pushl %esi
- pushl %edi
- pushl %ebp
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vesa_gran_shift, %ecx
- movl _vesa_gran_mask, %ebp
- movl %edi, %edx
- xorl %ebx, %ebx
- andl %ebp, %edi
- shrl %cl, %edx
- incl %ebp
- call *_vesa_swbank
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %eax
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %eax
- pushl %ecx
- .balign 4
- 1:
- cmpl %ebp, %edi
- jb 2f
- pushl %ebx
- incl %edx
- xorl %ebx, %ebx
- call *_vesa_swbank
- popl %ebx
- subl %ebp, %edi
- .balign 4
- 2:
- movl (%esi), %eax
- addl $3, %esi
- movl %eax, %fs:(%edi)
- addl $4, %edi
- subl $4, %ecx
- jnz 1b
- popl %ecx
- popl %eax
- addl %ebx, %edi
- decl %eax
- jnz 0b
- popl %ebp
- popl %edi
- popl %esi
- popl %ebx
- ret
-
- .p2align 5,,31
- .global _vesa_b_dump_24_to_8
-_vesa_b_dump_24_to_8:
- pushl %ebx
- pushl %esi
- pushl %edi
- pushl %ebp
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vesa_gran_shift, %ecx
- movl _vesa_gran_mask, %ebp
- movl %edi, %edx
- xorl %ebx, %ebx
- andl %ebp, %edi
- shrl %cl, %edx
- incl %ebp
- call *_vesa_swbank
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %eax
- .balign 4
- 0:
- pushl %eax
- pushl %ecx
- pushl %edx
- .balign 4
- 1:
- cmpl %ebp, %edi
- jb 2f
- popl %edx
- incl %edx
- pushl %edx
- xorl %ebx, %ebx
- call *_vesa_swbank
- subl %ebp, %edi
- .balign 4
- 2:
- movl (%esi), %eax
- addl $3, %esi
-#if 1
- xorl %ebx, %ebx
- movl %eax, %edx
- movb %ah, %bl
- shrl $16, %edx
- andl $0xFF, %edx
- andl $0xFF, %eax
-
- movb _array_b(%eax), %al
- movb _array_r(%edx), %dl
- movb _array_g(%ebx), %bl
-
- imull $36, %eax
- imull $6, %ebx
- addl %edx, %eax
- addl %ebx, %eax
-#endif
- movb %al, %fs:(%edi)
- incl %edi
- decl %ecx
- jnz 1b
- popl %edx
- popl %ecx
- popl %eax
- addl _vl_current_delta, %edi
- decl %eax
- jnz 0b
- popl %ebp
- popl %edi
- popl %esi
- popl %ebx
- ret
-
- .p2align 5,,31
- .global _vesa_b_dump_16_to_15
-_vesa_b_dump_16_to_15:
- pushl %ebx
- pushl %esi
- pushl %edi
- pushl %ebp
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vesa_gran_shift, %ecx
- movl _vesa_gran_mask, %ebp
- movl %edi, %edx
- xorl %ebx, %ebx
- andl %ebp, %edi
- shrl %cl, %edx
- incl %ebp
- call *_vesa_swbank
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %eax
- .balign 4
- 0:
- pushl %eax
- pushl %ecx
- .balign 4
- 1:
- cmpl %ebp, %edi
- jb 2f
- incl %edx
- xorl %ebx, %ebx
- call *_vesa_swbank
- subl %ebp, %edi
- .balign 4
- 2:
- movw (%esi), %ax
- addl $2, %esi
- CVT_16_TO_15(eax, ebx)
- movw %ax, %fs:(%edi)
- addl $2, %edi
- subl $2, %ecx
- jnz 1b
- popl %ecx
- popl %eax
- addl _vl_current_delta, %edi
- decl %eax
- jnz 0b
- popl %ebp
- popl %edi
- popl %esi
- popl %ebx
- ret
-
- .p2align 5,,31
- .global _vesa_b_dump_16_to_8
-_vesa_b_dump_16_to_8:
- pushl %ebx
- pushl %esi
- pushl %edi
- pushl %ebp
- movl _vl_video_selector, %fs
- movl _vl_current_draw_buffer, %esi
- movl _vl_current_offset, %edi
- movl _vesa_gran_shift, %ecx
- movl _vesa_gran_mask, %ebp
- movl %edi, %edx
- xorl %ebx, %ebx
- andl %ebp, %edi
- shrl %cl, %edx
- incl %ebp
- call *_vesa_swbank
- movl _vl_current_stride, %ecx
- movl _vl_current_height, %eax
- movl _vl_current_delta, %ebx
- .balign 4
- 0:
- pushl %eax
- pushl %ecx
- .balign 4
- 1:
- cmpl %ebp, %edi
- jb 2f
- pushl %ebx
- incl %edx
- xorl %ebx, %ebx
- call *_vesa_swbank
- popl %ebx
- subl %ebp, %edi
- .balign 4
- 2:
- movw (%esi), %ax
- addl $2, %esi
-#if 1
- andl $0xFFFF, %eax
- movb _tab_16_8(%eax), %al
-#endif
- movb %al, %fs:(%edi)
- addl $1, %edi
- subl $1, %ecx
- jnz 1b
- popl %ecx
- popl %eax
- addl %ebx, %edi
- decl %eax
- jnz 0b
- popl %ebp
- popl %edi
- popl %esi
- popl %ebx
- ret
diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c
deleted file mode 100644
index 003c06a8fff..00000000000
--- a/src/mesa/drivers/dos/dmesa.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@users.sourceforge.net
- * Web : http://www.geocities.com/dborca
- */
-
-
-#include "main/context.h"
-#include "main/imports.h"
-#include "main/mtypes.h"
-
-#include "video.h"
-
-#include "GL/osmesa.h"
-#include "GL/dmesa.h"
-
-
-/*
- * This has nothing to do with Mesa Visual structure.
- * We keep this one around for backwards compatibility,
- * and to store video mode data for DMesaCreateContext.
- */
-struct dmesa_visual {
- GLenum format; /* OSMesa framebuffer format */
- GLint depthBits;
- GLint stencilBits;
- GLint accumBits;
-};
-
-/*
- * This has nothing to do with Mesa Buffer structure.
- * We keep this one around for backwards compatibility,
- * and to store various data.
- */
-struct dmesa_buffer {
- int xpos, ypos; /* position */
- int width, height; /* size in pixels */
- GLenum type;
- void *the_window; /* your window handle, etc */
-};
-
-/*
- * This has nothing to do with Mesa Context structure.
- * We keep this one around for backwards compatibility,
- * and to store real off-screen context.
- */
-struct dmesa_context {
- OSMesaContext osmesa;
- DMesaBuffer buffer;
-};
-
-
-static DMesaContext ctx;
-
-
-/****************************************************************************
- * DMesa Public API Functions
- ***************************************************************************/
-
-/*
- * The exact arguments to this function will depend on your window system
- */
-DMesaVisual
-DMesaCreateVisual (GLint width,
- GLint height,
- GLint colDepth,
- GLint refresh,
- GLboolean dbFlag,
- GLboolean rgbFlag,
- GLint alphaSize,
- GLint depthSize,
- GLint stencilSize,
- GLint accumSize)
-{
- DMesaVisual visual;
- GLenum format;
- int fbbits;
-
- if (dbFlag) {
- return NULL;
- }
-
- if (!rgbFlag) {
- format = OSMESA_COLOR_INDEX;
- fbbits = 8;
- } else if (alphaSize) {
- format = OSMESA_BGRA;
- fbbits = 32;
- } else if (colDepth == 15 || colDepth == 16) {
- format = OSMESA_RGB_565;
- fbbits = 16;
- } else {
- format = OSMESA_BGR;
- fbbits = 24;
- }
-
- if ((visual = (DMesaVisual)CALLOC_STRUCT(dmesa_visual)) == NULL) {
- return NULL;
- }
-
- if (vl_video_init(width, height, colDepth, rgbFlag, refresh, fbbits) <= 0) {
- FREE(visual);
- return NULL;
- }
-
- visual->format = format;
- visual->depthBits = depthSize;
- visual->stencilBits = stencilSize;
- visual->accumBits = accumSize;
- return visual;
-}
-
-
-void
-DMesaDestroyVisual (DMesaVisual visual)
-{
- vl_video_exit();
- FREE(visual);
-}
-
-
-DMesaBuffer
-DMesaCreateBuffer (DMesaVisual visual,
- GLint xpos, GLint ypos,
- GLint width, GLint height)
-{
- DMesaBuffer buffer;
- GLenum type;
- int bytesPerPixel;
-
- switch (visual->format) {
- case OSMESA_COLOR_INDEX:
- bytesPerPixel = 1;
- type = CHAN_TYPE;
- break;
- case OSMESA_RGB_565:
- bytesPerPixel = 2;
- type = GL_UNSIGNED_SHORT_5_6_5;
- break;
- case OSMESA_BGR:
- bytesPerPixel = 3;
- type = CHAN_TYPE;
- break;
- default:
- bytesPerPixel = 4;
- type = CHAN_TYPE;
- }
-
- if ((buffer = (DMesaBuffer)CALLOC_STRUCT(dmesa_buffer)) != NULL) {
- buffer->xpos = xpos;
- buffer->ypos = ypos;
- buffer->width = width;
- buffer->height = height;
- buffer->type = type;
- buffer->the_window = MALLOC(width * height * bytesPerPixel + 1);
- if (buffer->the_window == NULL) {
- FREE(buffer);
- buffer = NULL;
- }
- }
-
- return buffer;
-}
-
-
-void
-DMesaDestroyBuffer (DMesaBuffer buffer)
-{
- FREE(buffer->the_window);
- FREE(buffer);
-}
-
-
-DMesaContext
-DMesaCreateContext (DMesaVisual visual, DMesaContext share)
-{
- DMesaContext dmesa;
- if ((dmesa = (DMesaContext)CALLOC_STRUCT(dmesa_context)) != NULL) {
- dmesa->osmesa = OSMesaCreateContextExt(
- visual->format,
- visual->depthBits,
- visual->stencilBits,
- visual->accumBits,
- (share != NULL) ? share->osmesa : NULL);
- if (dmesa->osmesa == NULL) {
- FREE(dmesa);
- dmesa = NULL;
- }
- }
- return dmesa;
-}
-
-
-void
-DMesaDestroyContext (DMesaContext dmesa)
-{
- OSMesaDestroyContext(dmesa->osmesa);
- FREE(dmesa);
-}
-
-
-GLboolean
-DMesaMoveBuffer (GLint xpos, GLint ypos)
-{
- const DMesaContext dmesa = DMesaGetCurrentContext();
- DMesaBuffer b = dmesa->buffer;
-
- if (vl_sync_buffer(&b->the_window, xpos, ypos, b->width, b->height) == 0) {
- b->xpos = xpos;
- b->ypos = ypos;
- return GL_TRUE;
- }
-
- return GL_FALSE;
-}
-
-
-GLboolean
-DMesaResizeBuffer (GLint width, GLint height)
-{
- const DMesaContext dmesa = DMesaGetCurrentContext();
- DMesaBuffer b = dmesa->buffer;
-
- if (vl_sync_buffer(&b->the_window, b->xpos, b->ypos, width, height) == 0) {
- b->width = width;
- b->height = height;
- return GL_TRUE;
- }
-
- return GL_FALSE;
-}
-
-
-GLboolean
-DMesaMakeCurrent (DMesaContext dmesa, DMesaBuffer buffer)
-{
- if (dmesa == NULL || buffer == NULL) {
- ctx = NULL;
- return GL_TRUE;
- }
- if (OSMesaMakeCurrent(dmesa->osmesa, buffer->the_window,
- buffer->type,
- buffer->width, buffer->height) &&
- vl_sync_buffer(&buffer->the_window, buffer->xpos, buffer->ypos, buffer->width, buffer->height) == 0) {
- OSMesaPixelStore(OSMESA_Y_UP, GL_FALSE);
- dmesa->buffer = buffer;
- ctx = dmesa;
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-
-void
-DMesaSwapBuffers (DMesaBuffer buffer)
-{
- /* copy/swap back buffer to front if applicable */
- GET_CURRENT_CONTEXT(ctx);
- _mesa_notifySwapBuffers(ctx);
- vl_flip();
- (void)buffer;
-}
-
-
-void
-DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue)
-{
- vl_setCI(ndx, red, green, blue);
-}
-
-
-DMesaContext
-DMesaGetCurrentContext (void)
-{
- return ctx;
-}
-
-
-DMesaBuffer
-DMesaGetCurrentBuffer (void)
-{
- const DMesaContext dmesa = DMesaGetCurrentContext();
-
- if (dmesa != NULL) {
- return dmesa->buffer;
- }
-
- return NULL;
-}
-
-
-DMesaProc
-DMesaGetProcAddress (const char *name)
-{
- DMesaProc p = (DMesaProc)_glapi_get_proc_address(name);
-
- /* TODO: handle DMesa* namespace
- if (p == NULL) {
- }
- */
-
- return p;
-}
-
-
-int
-DMesaGetIntegerv (GLenum pname, GLint *params)
-{
- switch (pname) {
- case DMESA_GET_SCREEN_SIZE:
- vl_get(VL_GET_SCREEN_SIZE, params);
- break;
- case DMESA_GET_DRIVER_CAPS:
- params[0] = 0;
- break;
- case DMESA_GET_VIDEO_MODES:
- return vl_get(VL_GET_VIDEO_MODES, params);
- case DMESA_GET_BUFFER_ADDR: {
- const DMesaContext dmesa = DMesaGetCurrentContext();
- if (dmesa != NULL) {
- DMesaBuffer b = dmesa->buffer;
- if (b != NULL) {
- params[0] = (GLint)b->the_window;
- }
- }
- break;
- }
- default:
- return -1;
- }
-
- return 0;
-}
diff --git a/src/mesa/drivers/dos/dpmi.c b/src/mesa/drivers/dos/dpmi.c
deleted file mode 100644
index bd33b8856cf..00000000000
--- a/src/mesa/drivers/dos/dpmi.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
-#include <dpmi.h>
-
-#include "internal.h"
-
-
-#ifndef MAX
-#define MAX(x, y) (((x) < (y)) ? (y) : (x))
-#endif
-
-
-/* _create_linear_mapping:
- * Maps a physical address range into linear memory.
- */
-int
-_create_linear_mapping (unsigned long *linear, unsigned long physaddr, int size)
-{
- __dpmi_meminfo meminfo;
-
- if (physaddr >= 0x100000) {
- /* map into linear memory */
- meminfo.address = physaddr;
- meminfo.size = size;
- if (__dpmi_physical_address_mapping(&meminfo) != 0) {
- return -1;
- }
-
- *linear = meminfo.address;
- } else {
- /* exploit 1 -> 1 physical to linear mapping in low megabyte */
- *linear = physaddr;
- }
-
- return 0;
-}
-
-
-/* _remove_linear_mapping:
- * Frees the DPMI resources being used to map a linear address range.
- */
-void
-_remove_linear_mapping (unsigned long *linear)
-{
- __dpmi_meminfo meminfo;
-
- if (*linear) {
- if (*linear >= 0x100000) {
- meminfo.address = *linear;
- __dpmi_free_physical_address_mapping(&meminfo);
- }
-
- *linear = 0;
- }
-}
-
-
-/* _create_selector:
- * Allocates a selector to access a region of linear memory.
- */
-int
-_create_selector (int *segment, unsigned long base, int size)
-{
- /* allocate an ldt descriptor */
- if ((*segment=__dpmi_allocate_ldt_descriptors(1)) < 0) {
- *segment = 0;
- return -1;
- }
-
- /* create the linear mapping */
- if (_create_linear_mapping(&base, base, size)) {
- __dpmi_free_ldt_descriptor(*segment);
- *segment = 0;
- return -1;
- }
-
- /* set the descriptor base and limit */
- __dpmi_set_segment_base_address(*segment, base);
- __dpmi_set_segment_limit(*segment, MAX(size-1, 0xFFFF));
-
- return 0;
-}
-
-
-/* _remove_selector:
- * Frees a DPMI segment selector.
- */
-void
-_remove_selector (int *segment)
-{
- if (*segment) {
- unsigned long base;
- __dpmi_get_segment_base_address(*segment, &base);
- _remove_linear_mapping(&base);
- __dpmi_free_ldt_descriptor(*segment);
- *segment = 0;
- }
-}
-
-
-/* Desc: retrieve CPU MMX capability
- *
- * In : -
- * Out : FALSE if CPU cannot do MMX
- *
- * Note: -
- */
-int
-_can_mmx (void)
-{
-#ifdef USE_MMX_ASM
- int x86_cpu_features = 0;
- __asm("\n\
- pushfl \n\
- popl %%eax \n\
- movl %%eax, %%ecx \n\
- xorl $0x200000, %%eax\n\
- pushl %%eax \n\
- popfl \n\
- pushfl \n\
- popl %%eax \n\
- pushl %%ecx \n\
- popfl \n\
- xorl %%ecx, %%eax \n\
- jz 0f \n\
- movl $1, %%eax \n\
- cpuid \n\
- movl %%edx, %0 \n\
- 0: \n\
- ":"=g"(x86_cpu_features)::"%eax", "%ebx", "%ecx", "%edx");
- return (x86_cpu_features & 0x00800000);
-#else
- return 0;
-#endif
-}
diff --git a/src/mesa/drivers/dos/internal.h b/src/mesa/drivers/dos/internal.h
deleted file mode 100644
index 0fa7c772223..00000000000
--- a/src/mesa/drivers/dos/internal.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@users.sourceforge.net
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifndef INTERNAL_H_included
-#define INTERNAL_H_included
-
-#include "../main/mtypes.h"
-
-
-/*
- * general purpose defines, etc.
- */
-#ifndef FALSE
-#define FALSE 0
-#define TRUE !FALSE
-#endif
-
-#define __PACKED__ __attribute__((packed))
-
-typedef unsigned char word8;
-typedef unsigned short word16;
-typedef unsigned long word32;
-
-#define _16_ *(word16 *)&
-#define _32_ *(word32 *)&
-
-typedef void (*BLTFUNC) (void);
-
-
-/*
- * video mode structure
- */
-typedef struct vl_mode {
- int xres, yres;
- int bpp;
-
- int mode;
- int scanlen;
-
- int sel;
- int gran;
-} vl_mode;
-
-
-/*
- * video driver structure
- */
-typedef struct {
- vl_mode *(*init) (void);
- int (*entermode) (vl_mode *p, int refresh, int fbbits);
- void (*blit) (void);
- void (*setCI_f) (int index, float red, float green, float blue);
- void (*setCI_i) (int index, int red, int green, int blue);
- int (*get) (int pname, int *params);
- void (*restore) (void);
- void (*fini) (void);
-} vl_driver;
-
-
-/*
- * memory mapping
- */
-int _create_linear_mapping (unsigned long *linear, unsigned long physaddr, int size);
-void _remove_linear_mapping (unsigned long *linear);
-int _create_selector (int *segment, unsigned long base, int size);
-void _remove_selector (int *segment);
-
-
-/*
- * system routines
- */
-int _can_mmx (void);
-
-
-#endif
diff --git a/src/mesa/drivers/dos/null.c b/src/mesa/drivers/dos/null.c
deleted file mode 100644
index 55846299fbb..00000000000
--- a/src/mesa/drivers/dos/null.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@users.sourceforge.net
- * Web : http://www.geocities.com/dborca
- */
-
-
-#include <stdlib.h>
-#include <sys/segments.h>
-
-#include "video.h"
-#include "null.h"
-
-
-static vl_mode *modes;
-
-#define null_color_precision 8
-
-
-static void
-null_blit_nop (void)
-{
-}
-
-
-/* Desc: Attempts to detect NUL, check video modes and create selectors.
- *
- * In : -
- * Out : mode array
- *
- * Note: -
- */
-static vl_mode *
-null_init (void)
-{
- static int m[][2] = {
- { 320, 200 },
- { 320, 240 },
- { 400, 300 },
- { 512, 384 },
- { 640, 400 },
- { 640, 480 },
- { 800, 600 },
- { 1024, 768 },
- { 1280, 1024 },
- { 1600, 1200 }
- };
- static int b[] = {
- 8,
- 15,
- 16,
- 24,
- 32
- };
- const unsigned int m_count = sizeof(m) / sizeof(m[0]);
- const unsigned int b_count = sizeof(b) / sizeof(b[0]);
-
- unsigned int i, j, k;
-
- if (modes == NULL) {
- modes = malloc(sizeof(vl_mode) * (1 + m_count * b_count));
-
- if (modes != NULL) {
- for (k = 0, i = 0; i < m_count; i++) {
- for (j = 0; j < b_count; j++, k++) {
- modes[k].xres = m[i][0];
- modes[k].yres = m[i][1];
- modes[k].bpp = b[j];
- modes[k].mode = 0x4000;
- modes[k].scanlen = m[i][0] * ((b[j] + 7) / 8);
- modes[k].sel = -1;
- modes[k].gran = -1;
- }
- }
- modes[k].xres = -1;
- modes[k].yres = -1;
- modes[k].bpp = -1;
- modes[k].mode = 0xffff;
- modes[k].scanlen = -1;
- modes[k].sel = -1;
- modes[k].gran = -1;
- }
- }
-
- return modes;
-}
-
-
-/* Desc: Frees all resources allocated by NUL init code.
- *
- * In : -
- * Out : -
- *
- * Note: -
- */
-static void
-null_fini (void)
-{
- if (modes != NULL) {
- free(modes);
- modes = NULL;
- }
-}
-
-
-/* Desc: Attempts to enter specified video mode.
- *
- * In : ptr to mode structure, refresh rate
- * Out : 0 if success
- *
- * Note: -
- */
-static int
-null_entermode (vl_mode *p, int refresh, int fbbits)
-{
- NUL.blit = null_blit_nop;
-
- return 0;
-
- (void)(p && refresh && fbbits); /* silence compiler warning */
-}
-
-
-/* Desc: Restores to the mode prior to first call to null_entermode.
- *
- * In : -
- * Out : -
- *
- * Note: -
- */
-static void
-null_restore (void)
-{
-}
-
-
-/* Desc: set one palette entry
- *
- * In : color index, R, G, B
- * Out : -
- *
- * Note: uses integer values
- */
-static void
-null_setCI_i (int index, int red, int green, int blue)
-{
- (void)(index && red && green && blue); /* silence compiler warning */
-}
-
-
-/* Desc: set one palette entry
- *
- * In : color index, R, G, B
- * Out : -
- *
- * Note: uses normalized values
- */
-static void
-null_setCI_f (int index, float red, float green, float blue)
-{
- float max = (1 << null_color_precision) - 1;
-
- null_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max));
-}
-
-
-/* Desc: state retrieval
- *
- * In : parameter name, ptr to storage
- * Out : 0 if request successfully processed
- *
- * Note: -
- */
-static int
-null_get (int pname, int *params)
-{
- switch (pname) {
- default:
- params[0] = params[0]; /* silence compiler warning */
- return -1;
- }
- return 0;
-}
-
-
-/*
- * the driver
- */
-vl_driver NUL = {
- null_init,
- null_entermode,
- NULL,
- null_setCI_f,
- null_setCI_i,
- null_get,
- null_restore,
- null_fini
-};
diff --git a/src/mesa/drivers/dos/null.h b/src/mesa/drivers/dos/null.h
deleted file mode 100644
index bbdc7966e07..00000000000
--- a/src/mesa/drivers/dos/null.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifndef NULL_H_included
-#define NULL_H_included
-
-#include "internal.h"
-
-extern vl_driver NUL;
-
-#endif
diff --git a/src/mesa/drivers/dos/vesa.c b/src/mesa/drivers/dos/vesa.c
deleted file mode 100644
index 3fdd3e25db4..00000000000
--- a/src/mesa/drivers/dos/vesa.c
+++ /dev/null
@@ -1,719 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@users.sourceforge.net
- * Web : http://www.geocities.com/dborca
- */
-
-
-#include <dpmi.h>
-#include <pc.h>
-#include <stdlib.h>
-#include <stubinfo.h>
-#include <sys/exceptn.h>
-#include <sys/segments.h>
-#include <sys/farptr.h>
-#include <sys/movedata.h>
-
-#include "video.h"
-#include "vesa.h"
-
-
-static vl_mode modes[128];
-
-static word16 vesa_ver;
-static int banked_selector, linear_selector;
-static int oldmode = -1;
-
-static int vesa_color_precision = 6;
-
-static word16 *vesa_pmcode;
-unsigned int vesa_gran_mask, vesa_gran_shift;
-
-
-/*
- * VESA info
- */
-#define V_SIGN 0
-#define V_MINOR 4
-#define V_MAJOR 5
-#define V_OEM_OFS 6
-#define V_OEM_SEG 8
-#define V_MODE_OFS 14
-#define V_MODE_SEG 16
-#define V_MEMORY 18
-
-/*
- * mode info
- */
-#define M_ATTR 0
-#define M_GRAN 4
-#define M_SCANLEN 16
-#define M_XRES 18
-#define M_YRES 20
-#define M_BPP 25
-#define M_RED 31
-#define M_GREEN 33
-#define M_BLUE 35
-#define M_PHYS_PTR 40
-
-/*
- * VESA 3.0 CRTC timings structure
- */
-typedef struct CRTCInfoBlock {
- unsigned short HorizontalTotal;
- unsigned short HorizontalSyncStart;
- unsigned short HorizontalSyncEnd;
- unsigned short VerticalTotal;
- unsigned short VerticalSyncStart;
- unsigned short VerticalSyncEnd;
- unsigned char Flags;
- unsigned long PixelClock; /* units of Hz */
- unsigned short RefreshRate; /* units of 0.01 Hz */
- unsigned char reserved[40];
-} __PACKED__ CRTCInfoBlock;
-
-#define HNEG (1 << 2)
-#define VNEG (1 << 3)
-#define DOUBLESCAN (1 << 0)
-
-
-/* Desc: Attempts to detect VESA, check video modes and create selectors.
- *
- * In : -
- * Out : mode array
- *
- * Note: -
- */
-static vl_mode *
-vesa_init (void)
-{
- __dpmi_regs r;
- word16 *p;
- vl_mode *q;
- char vesa_info[512], tmp[512];
- int maxsize = 0;
- word32 linearfb = 0;
-
- if (vesa_ver) {
- return modes;
- }
-
- _farpokel(_stubinfo->ds_selector, 0, 0x32454256);
- r.x.ax = 0x4f00;
- r.x.di = 0;
- r.x.es = _stubinfo->ds_segment;
- __dpmi_int(0x10, &r);
- movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512);
- if ((r.x.ax != 0x004f) || ((_32_ vesa_info[V_SIGN]) != 0x41534556)) {
- return NULL;
- }
-
- p = (word16 *)(((_16_ vesa_info[V_MODE_SEG]) << 4) + (_16_ vesa_info[V_MODE_OFS]));
- q = modes;
- do {
- if ((q->mode = _farpeekw(__djgpp_dos_sel, (unsigned long)(p++))) == 0xffff) {
- break;
- }
-
- r.x.ax = 0x4f01;
- r.x.cx = q->mode;
- r.x.di = 512;
- r.x.es = _stubinfo->ds_segment;
- __dpmi_int(0x10, &r);
- movedata(_stubinfo->ds_selector, 512, _my_ds(), (unsigned)tmp, 256);
- switch (tmp[M_BPP]) {
- case 16:
- q->bpp = tmp[M_RED] + tmp[M_GREEN] + tmp[M_BLUE];
- break;
- case 8:
- case 15:
- case 24:
- case 32:
- q->bpp = tmp[M_BPP];
- break;
- default:
- q->bpp = 0;
- }
- if ((r.x.ax == 0x004f) && ((tmp[M_ATTR] & 0x11) == 0x11) && q->bpp) {
- q->xres = _16_ tmp[M_XRES];
- q->yres = _16_ tmp[M_YRES];
- q->scanlen = _16_ tmp[M_SCANLEN];
- q->gran = (_16_ tmp[M_GRAN]) << 10;
- if (tmp[M_ATTR] & 0x80) {
- vl_mode *q1 = q + 1;
- *q1 = *q++;
- linearfb = _32_ tmp[M_PHYS_PTR];
- q->mode |= 0x4000;
- }
- if (maxsize < (q->scanlen * q->yres)) {
- maxsize = q->scanlen * q->yres;
- }
- q++;
- }
- } while (TRUE);
-
- if (q == modes) {
- return NULL;
- }
- if (_create_selector(&banked_selector, 0xa0000, modes[0].gran)) {
- return NULL;
- }
- if (linearfb) {
- maxsize = ((maxsize + 0xfffUL) & ~0xfffUL);
- if (_create_selector(&linear_selector, linearfb, maxsize)) {
- linear_selector = banked_selector;
- }
- }
-
- for (q = modes; q->mode != 0xffff; q++) {
- q->sel = banked_selector;
- if (q->mode & 0x4000) {
- if (linear_selector != banked_selector) {
- q->sel = linear_selector;
- } else {
- q->mode &= ~0x4000;
- }
- }
- }
-
- if (vesa_info[V_MAJOR] >= 2) {
- r.x.ax = 0x4f0a;
- r.x.bx = 0;
- __dpmi_int(0x10, &r);
- if (r.x.ax == 0x004f) {
- vesa_pmcode = (word16 *)malloc(r.x.cx);
- if (vesa_pmcode != NULL) {
- movedata(__djgpp_dos_sel, (r.x.es << 4) + r.x.di, _my_ds(), (unsigned)vesa_pmcode, r.x.cx);
- if (vesa_pmcode[3]) {
- p = (word16 *)((long)vesa_pmcode + vesa_pmcode[3]);
- while (*p++ != 0xffff) {
- }
- } else {
- p = NULL;
- }
- if (p && (*p != 0xffff)) {
- free(vesa_pmcode);
- vesa_pmcode = NULL;
- } else {
- vesa_swbank = (void *)((long)vesa_pmcode + vesa_pmcode[0]);
- }
- }
- }
- }
-
- vesa_ver = _16_ vesa_info[V_MINOR];
- return modes;
-}
-
-
-/* Desc: Frees all resources allocated by VESA init code.
- *
- * In : -
- * Out : -
- *
- * Note: -
- */
-static void
-vesa_fini (void)
-{
- if (vesa_ver) {
- _remove_selector(&linear_selector);
- _remove_selector(&banked_selector);
- if (vesa_pmcode != NULL) {
- free(vesa_pmcode);
- vesa_pmcode = NULL;
- }
- }
-}
-
-
-/* Desc: Uses VESA 3.0 function 0x4F0B to find the closest pixel clock to the requested value.
- *
- * In : mode, clock
- * Out : desired clock
- *
- * Note: -
- */
-static unsigned long
-_closest_pixclk (int mode_no, unsigned long vclk)
-{
- __dpmi_regs r;
-
- r.x.ax = 0x4F0B;
- r.h.bl = 0;
- r.d.ecx = vclk;
- r.x.dx = mode_no;
- __dpmi_int(0x10, &r);
-
- return (r.x.ax == 0x004f) ? r.d.ecx : 0;
-}
-
-
-/* Desc: Calculates CRTC mode timings.
- *
- * In : crtc block, geometry, adjust
- * Out :
- *
- * Note:
- */
-static void
-_crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int xadjust, int yadjust)
-{
- int HTotal, VTotal;
- int HDisp, VDisp;
- int HSS, VSS;
- int HSE, VSE;
- int HSWidth, VSWidth;
- int SS, SE;
- int doublescan = FALSE;
-
- if (yres < 400) {
- doublescan = TRUE;
- yres *= 2;
- }
-
- HDisp = xres;
- HTotal = (int)(HDisp * 1.27) & ~0x7;
- HSWidth = (int)((HTotal - HDisp) / 5) & ~0x7;
- HSS = HDisp + 16;
- HSE = HSS + HSWidth;
- VDisp = yres;
- VTotal = VDisp * 1.07;
- VSWidth = (VTotal / 100) + 1;
- VSS = VDisp + ((int)(VTotal - VDisp) / 5) + 1;
- VSE = VSS + VSWidth;
-
- SS = HSS + xadjust;
- SE = HSE + xadjust;
-
- if (xadjust < 0) {
- if (SS < (HDisp + 8)) {
- SS = HDisp + 8;
- SE = SS + HSWidth;
- }
- } else {
- if ((HTotal - 24) < SE) {
- SE = HTotal - 24;
- SS = SE - HSWidth;
- }
- }
-
- HSS = SS;
- HSE = SE;
-
- SS = VSS + yadjust;
- SE = VSE + yadjust;
-
- if (yadjust < 0) {
- if (SS < (VDisp + 3)) {
- SS = VDisp + 3;
- SE = SS + VSWidth;
- }
- } else {
- if ((VTotal - 4) < SE) {
- SE = VTotal - 4;
- SS = SE - VSWidth;
- }
- }
-
- VSS = SS;
- VSE = SE;
-
- crtc->HorizontalTotal = HTotal;
- crtc->HorizontalSyncStart = HSS;
- crtc->HorizontalSyncEnd = HSE;
- crtc->VerticalTotal = VTotal;
- crtc->VerticalSyncStart = VSS;
- crtc->VerticalSyncEnd = VSE;
- crtc->Flags = HNEG | VNEG;
-
- if (doublescan) {
- crtc->Flags |= DOUBLESCAN;
- }
-}
-
-
-/* Desc: Attempts to choose a suitable blitter.
- *
- * In : ptr to mode structure, software framebuffer bits
- * Out : blitter funciton, or NULL
- *
- * Note: -
- */
-static BLTFUNC
-_choose_blitter (vl_mode *p, int fbbits)
-{
- BLTFUNC blitter;
-
- if (p->mode & 0x4000) {
- blitter = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual;
- switch (p->bpp) {
- case 8:
- switch (fbbits) {
- case 8:
- break;
- case 16:
- blitter = vesa_l_dump_16_to_8;
- break;
- case 24:
- blitter = vesa_l_dump_24_to_8;
- break;
- case 32:
- blitter = vesa_l_dump_32_to_8;
- break;
- case 15:
- default:
- return NULL;
- }
- break;
- case 15:
- switch (fbbits) {
- case 16:
- blitter = vesa_l_dump_16_to_15;
- break;
- case 32:
- blitter = vesa_l_dump_32_to_15;
- break;
- case 8:
- case 15:
- case 24:
- default:
- return NULL;
- }
- break;
- case 16:
- switch (fbbits) {
- case 16:
- break;
- case 32:
- blitter = vesa_l_dump_32_to_16;
- break;
- case 8:
- case 15:
- case 24:
- default:
- return NULL;
- }
- break;
- case 24:
- switch (fbbits) {
- case 24:
- break;
- case 32:
- blitter = vesa_l_dump_32_to_24;
- break;
- case 8:
- case 15:
- case 16:
- default:
- return NULL;
- }
- break;
- case 32:
- switch (fbbits) {
- case 24:
- blitter = vesa_l_dump_24_to_32;
- break;
- case 32:
- break;
- case 8:
- case 15:
- case 16:
- default:
- return NULL;
- }
- break;
- }
- } else {
- blitter = vesa_b_dump_virtual;
- switch (p->bpp) {
- case 8:
- switch (fbbits) {
- case 8:
- break;
- case 16:
- blitter = vesa_b_dump_16_to_8;
- break;
- case 24:
- blitter = vesa_b_dump_24_to_8;
- break;
- case 32:
- blitter = vesa_b_dump_32_to_8;
- break;
- case 15:
- default:
- return NULL;
- }
- break;
- case 15:
- switch (fbbits) {
- case 16:
- blitter = vesa_b_dump_16_to_15;
- break;
- case 32:
- blitter = vesa_b_dump_32_to_15;
- break;
- case 8:
- case 15:
- case 24:
- default:
- return NULL;
- }
- break;
- case 16:
- switch (fbbits) {
- case 16:
- break;
- case 32:
- blitter = vesa_b_dump_32_to_16;
- break;
- case 8:
- case 15:
- case 24:
- default:
- return NULL;
- }
- break;
- case 24:
- switch (fbbits) {
- case 24:
- break;
- case 32:
- blitter = vesa_b_dump_32_to_24;
- break;
- case 8:
- case 15:
- case 16:
- default:
- return NULL;
- }
- break;
- case 32:
- switch (fbbits) {
- case 24:
- blitter = vesa_b_dump_24_to_32;
- break;
- case 32:
- break;
- case 8:
- case 15:
- case 16:
- default:
- return NULL;
- }
- break;
- }
- }
-
- return blitter;
-}
-
-
-/* Desc: Attempts to enter specified video mode.
- *
- * In : ptr to mode structure, refresh rate
- * Out : 0 if success
- *
- * Note: -
- */
-static int
-vesa_entermode (vl_mode *p, int refresh, int fbbits)
-{
- __dpmi_regs r;
-
- if (!(p->mode & 0x4000)) {
- { int n; for (vesa_gran_shift = 0, n = p->gran; n; vesa_gran_shift++, n >>= 1); }
- vesa_gran_mask = (1 << (--vesa_gran_shift)) - 1;
- if ((unsigned)p->gran != (vesa_gran_mask + 1)) {
- return !0;
- }
- }
-
- VESA.blit = _choose_blitter(p, fbbits);
- if (VESA.blit == NULL) {
- return !0;
- }
-
- if (oldmode == -1) {
- r.x.ax = 0x4f03;
- __dpmi_int(0x10, &r);
- oldmode = r.x.bx;
- }
-
- r.x.ax = 0x4f02;
- r.x.bx = p->mode;
-
- if (refresh && ((vesa_ver >> 8) >= 3)) {
- /* VESA 3.0 stuff for controlling the refresh rate */
- CRTCInfoBlock crtc;
- unsigned long vclk;
- double f0;
-
- _crtc_timing(&crtc, p->xres, p->yres, 0, 0);
-
- vclk = (double)crtc.HorizontalTotal * crtc.VerticalTotal * refresh;
- vclk = _closest_pixclk(p->mode, vclk);
-
- if (vclk != 0) {
- f0 = (double)vclk / (crtc.HorizontalTotal * crtc.VerticalTotal);
- /*_current_refresh_rate = (int)(f0 + 0.5);*/
-
- crtc.PixelClock = vclk;
- crtc.RefreshRate = refresh * 100;
-
- movedata(_my_ds(), (unsigned)&crtc, _stubinfo->ds_selector, 0, sizeof(crtc));
-
- r.x.di = 0;
- r.x.es = _stubinfo->ds_segment;
- r.x.bx |= 0x0800;
- }
- }
-
- __dpmi_int(0x10, &r);
- if (r.x.ax != 0x004f) {
- return !0;
- }
-
- if (p->bpp == 8) {
- r.x.ax = 0x4f08;
- r.x.bx = 0x0800;
- __dpmi_int(0x10, &r);
- if (r.x.ax == 0x004f) {
- r.x.ax = 0x4f08;
- r.h.bl = 0x01;
- __dpmi_int(0x10, &r);
- vesa_color_precision = r.h.bh;
- }
- }
-
- return 0;
-}
-
-
-/* Desc: Restores to the mode prior to first call to vesa_entermode.
- *
- * In : -
- * Out : -
- *
- * Note: -
- */
-static void
-vesa_restore (void)
-{
- __dpmi_regs r;
-
- if (oldmode != -1) {
- if (oldmode < 0x100) {
- __asm("int $0x10"::"a"(oldmode));
- } else {
- r.x.ax = 0x4f02;
- r.x.bx = oldmode;
- __dpmi_int(0x10, &r);
- }
- oldmode = -1;
- }
-}
-
-
-/* Desc: set one palette entry
- *
- * In : color index, R, G, B
- * Out : -
- *
- * Note: uses integer values
- */
-static void
-vesa_setCI_i (int index, int red, int green, int blue)
-{
-#if 0
- __asm("\n\
- movw $0x1010, %%ax \n\
- movb %1, %%dh \n\
- movb %2, %%ch \n\
- int $0x10 \n\
- "::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx");
-#else
- outportb(0x03C8, index);
- outportb(0x03C9, red);
- outportb(0x03C9, green);
- outportb(0x03C9, blue);
-#endif
-}
-
-
-/* Desc: set one palette entry
- *
- * In : color index, R, G, B
- * Out : -
- *
- * Note: uses normalized values
- */
-static void
-vesa_setCI_f (int index, float red, float green, float blue)
-{
- float max = (1 << vesa_color_precision) - 1;
-
- vesa_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max));
-}
-
-
-/* Desc: state retrieval
- *
- * In : parameter name, ptr to storage
- * Out : 0 if request successfully processed
- *
- * Note: -
- */
-static int
-vesa_get (int pname, int *params)
-{
- switch (pname) {
- case VL_GET_CI_PREC:
- params[0] = vesa_color_precision;
- break;
- default:
- return -1;
- }
- return 0;
-}
-
-
-/*
- * the driver
- */
-vl_driver VESA = {
- vesa_init,
- vesa_entermode,
- NULL,
- vesa_setCI_f,
- vesa_setCI_i,
- vesa_get,
- vesa_restore,
- vesa_fini
-};
diff --git a/src/mesa/drivers/dos/vesa.h b/src/mesa/drivers/dos/vesa.h
deleted file mode 100644
index 4b3c3ab8329..00000000000
--- a/src/mesa/drivers/dos/vesa.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifndef VESA_H_included
-#define VESA_H_included
-
-#include "internal.h"
-
-extern void *vesa_swbank;
-
-extern void vesa_b_dump_virtual (void);
-extern void vesa_l_dump_virtual (void);
-extern void vesa_l_dump_virtual_mmx (void);
-
-extern void vesa_l_dump_32_to_24 (void);
-extern void vesa_l_dump_32_to_16 (void);
-extern void vesa_l_dump_32_to_15 (void);
-extern void vesa_l_dump_32_to_8 (void);
-extern void vesa_l_dump_24_to_32 (void);
-extern void vesa_l_dump_24_to_8 (void);
-extern void vesa_l_dump_16_to_15 (void);
-extern void vesa_l_dump_16_to_8 (void);
-
-extern void vesa_b_dump_32_to_24 (void);
-extern void vesa_b_dump_32_to_16 (void);
-extern void vesa_b_dump_32_to_15 (void);
-extern void vesa_b_dump_32_to_8 (void);
-extern void vesa_b_dump_24_to_32 (void);
-extern void vesa_b_dump_24_to_8 (void);
-extern void vesa_b_dump_16_to_15 (void);
-extern void vesa_b_dump_16_to_8 (void);
-
-extern vl_driver VESA;
-
-#endif
diff --git a/src/mesa/drivers/dos/vga.c b/src/mesa/drivers/dos/vga.c
deleted file mode 100644
index 5a6447dd87b..00000000000
--- a/src/mesa/drivers/dos/vga.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@users.sourceforge.net
- * Web : http://www.geocities.com/dborca
- */
-
-
-#include <pc.h>
-#include <stdlib.h>
-
-#include "video.h"
-#include "vga.h"
-
-
-static vl_mode modes[] = {
- {
- /* .xres = */ 320,
- /* .yres = */ 200,
- /* .bpp = */ 8,
- /* .mode = */ 0x13 | 0x4000,
- /* .scanlen = */ 320,
- /* .sel = */ -1,
- /* .gran = */ 320*200
- },
- {
- /* .xres = */ -1,
- /* .yres = */ -1,
- /* .bpp = */ -1,
- /* .mode = */ 0xffff,
- /* .scanlen = */ -1,
- /* .sel = */ -1,
- /* .gran = */ -1
- }
-};
-
-static word16 vga_ver;
-static int linear_selector;
-static int oldmode = -1;
-
-#define vga_color_precision 6
-
-
-/* Desc: Attempts to detect VGA, check video modes and create selectors.
- *
- * In : -
- * Out : mode array
- *
- * Note: -
- */
-static vl_mode *
-vga_init (void)
-{
- int rv = 0;
-
- if (vga_ver) {
- return modes;
- }
-
- __asm("\n\
- movw $0x1a00, %%ax \n\
- int $0x10 \n\
- cmpb $0x1a, %%al \n\
- jne 0f \n\
- cmpb $0x07, %%bl \n\
- jb 0f \n\
- andl $0xff, %%ebx \n\
- movl %%ebx, %0 \n\
- 0:":"=g"(rv)::"%eax", "%ebx");
- if (rv == 0) {
- return NULL;
- }
-
- if (_create_selector(&linear_selector, 0xa0000, 0x10000)) {
- return NULL;
- }
-
- modes[0].sel = linear_selector;
-
- vga_ver = rv;
- return modes;
-}
-
-
-/* Desc: Frees all resources allocated by VGA init code.
- *
- * In : -
- * Out : -
- *
- * Note: -
- */
-static void
-vga_fini (void)
-{
- if (vga_ver) {
- _remove_selector(&linear_selector);
- }
-}
-
-
-/* Desc: Attempts to choose a suitable blitter.
- *
- * In : ptr to mode structure, software framebuffer bits
- * Out : blitter funciton, or NULL
- *
- * Note: -
- */
-static BLTFUNC
-_choose_blitter (vl_mode *p, int fbbits)
-{
- BLTFUNC blitter;
-
- switch (fbbits) {
- case 8:
- blitter = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual;
- break;
- case 16:
- blitter = vesa_l_dump_16_to_8;
- break;
- case 24:
- blitter = vesa_l_dump_24_to_8;
- break;
- case 32:
- blitter = vesa_l_dump_32_to_8;
- break;
- default:
- return NULL;
- }
-
- return blitter;
-
- (void)p;
-}
-
-
-/* Desc: Attempts to enter specified video mode.
- *
- * In : ptr to mode structure, refresh rate
- * Out : 0 if success
- *
- * Note: -
- */
-static int
-vga_entermode (vl_mode *p, int refresh, int fbbits)
-{
- if (!(p->mode & 0x4000)) {
- return -1;
- }
-
- VGA.blit = _choose_blitter(p, fbbits);
- if (VGA.blit == NULL) {
- return !0;
- }
-
- if (oldmode == -1) {
- __asm("\n\
- movb $0x0f, %%ah \n\
- int $0x10 \n\
- andl $0xff, %%eax \n\
- movl %%eax, %0 \n\
- ":"=g"(oldmode)::"%eax", "%ebx");
- }
-
- __asm("int $0x10"::"a"(p->mode&0xff));
-
- return 0;
-
- (void)refresh; /* silence compiler warning */
-}
-
-
-/* Desc: Restores to the mode prior to first call to vga_entermode.
- *
- * In : -
- * Out : -
- *
- * Note: -
- */
-static void
-vga_restore (void)
-{
- if (oldmode != -1) {
- __asm("int $0x10"::"a"(oldmode));
- oldmode = -1;
- }
-}
-
-
-/* Desc: set one palette entry
- *
- * In : color index, R, G, B
- * Out : -
- *
- * Note: uses integer values
- */
-static void
-vga_setCI_i (int index, int red, int green, int blue)
-{
-#if 0
- __asm("\n\
- movw $0x1010, %%ax \n\
- movb %1, %%dh \n\
- movb %2, %%ch \n\
- int $0x10 \n\
- "::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx");
-#else
- outportb(0x03C8, index);
- outportb(0x03C9, red);
- outportb(0x03C9, green);
- outportb(0x03C9, blue);
-#endif
-}
-
-
-/* Desc: set one palette entry
- *
- * In : color index, R, G, B
- * Out : -
- *
- * Note: uses normalized values
- */
-static void
-vga_setCI_f (int index, float red, float green, float blue)
-{
- float max = (1 << vga_color_precision) - 1;
-
- vga_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max));
-}
-
-
-/* Desc: state retrieval
- *
- * In : parameter name, ptr to storage
- * Out : 0 if request successfully processed
- *
- * Note: -
- */
-static int
-vga_get (int pname, int *params)
-{
- switch (pname) {
- case VL_GET_CI_PREC:
- params[0] = vga_color_precision;
- break;
- default:
- return -1;
- }
- return 0;
-}
-
-
-/*
- * the driver
- */
-vl_driver VGA = {
- vga_init,
- vga_entermode,
- NULL,
- vga_setCI_f,
- vga_setCI_i,
- vga_get,
- vga_restore,
- vga_fini
-};
diff --git a/src/mesa/drivers/dos/vga.h b/src/mesa/drivers/dos/vga.h
deleted file mode 100644
index 7c17625a3ca..00000000000
--- a/src/mesa/drivers/dos/vga.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifndef VGA_H_included
-#define VGA_H_included
-
-#include "internal.h"
-#include "vesa.h"
-
-extern vl_driver VGA;
-
-#endif
diff --git a/src/mesa/drivers/dos/video.c b/src/mesa/drivers/dos/video.c
deleted file mode 100644
index 468207fbf6f..00000000000
--- a/src/mesa/drivers/dos/video.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@users.sourceforge.net
- * Web : http://www.geocities.com/dborca
- *
- * Thanks to CrazyPyro (Neil Funk) for FakeColor
- */
-
-
-#include <stdlib.h>
-
-#include "internal.h"
-#include "vesa.h"
-#include "vga.h"
-#include "null.h"
-#include "video.h"
-
-
-static vl_driver *drv;
-/* based upon mode specific data: valid entire session */
-int vl_video_selector;
-static vl_mode *video_mode;
-static int video_scanlen, video_bypp;
-/* valid until next buffer */
-void *vl_current_draw_buffer, *vl_current_read_buffer;
-int vl_current_stride, vl_current_width, vl_current_height, vl_current_bytes;
-int vl_current_offset, vl_current_delta;
-
-
-void (*vl_flip) (void);
-
-
-/* FakeColor data */
-#define R_CNT 6
-#define G_CNT 6
-#define B_CNT 6
-
-#define R_BIAS 7
-#define G_BIAS 7
-#define B_BIAS 7
-
-static word32 VGAPalette[256];
-word8 array_r[256];
-word8 array_g[256];
-word8 array_b[256];
-word8 tab_16_8[0x10000];
-
-
-/* lookup table for scaling 5 bit colors up to 8 bits */
-static int _rgb_scale_5[32] = {
- 0, 8, 16, 25, 33, 41, 49, 58,
- 66, 74, 82, 90, 99, 107, 115, 123,
- 132, 140, 148, 156, 165, 173, 181, 189,
- 197, 206, 214, 222, 230, 239, 247, 255
-};
-
-/* lookup table for scaling 6 bit colors up to 8 bits */
-static int _rgb_scale_6[64] = {
- 0, 4, 8, 12, 16, 20, 24, 28,
- 32, 36, 40, 45, 49, 53, 57, 61,
- 65, 69, 73, 77, 81, 85, 89, 93,
- 97, 101, 105, 109, 113, 117, 121, 125,
- 130, 134, 138, 142, 146, 150, 154, 158,
- 162, 166, 170, 174, 178, 182, 186, 190,
- 194, 198, 202, 206, 210, 215, 219, 223,
- 227, 231, 235, 239, 243, 247, 251, 255
-};
-
-
-/* Desc: color composition (w/o ALPHA)
- *
- * In : array of integers (R, G, B)
- * Out : color
- *
- * Note: -
- */
-static int
-v_mixrgb8fake (const unsigned char rgb[])
-{
- return array_b[rgb[2]]*G_CNT*R_CNT
- + array_g[rgb[1]]*R_CNT
- + array_r[rgb[0]];
-}
-
-
-/* Desc: color decomposition
- *
- * In : pixel offset, array of integers to hold color components (R, G, B, A)
- * Out : -
- *
- * Note: uses current read buffer
- */
-static void
-v_getrgb8fake6 (unsigned int offset, unsigned char rgb[])
-{
- word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]];
- rgb[0] = _rgb_scale_6[(c >> 16) & 0x3F];
- rgb[1] = _rgb_scale_6[(c >> 8) & 0x3F];
- rgb[2] = _rgb_scale_6[ c & 0x3F];
-}
-static void
-v_getrgb8fake8 (unsigned int offset, unsigned char rgb[])
-{
- word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]];
- rgb[0] = c >> 16;
- rgb[1] = c >> 8;
- rgb[2] = c;
-}
-
-
-/* Desc: create R5G6B5 to FakeColor table lookup
- *
- * In : -
- * Out : -
- *
- * Note: -
- */
-static void
-init_tab_16_8 (void)
-{
- int i;
- for (i = 0; i < 0x10000; i++) {
- unsigned char rgb[3];
- rgb[0] = _rgb_scale_5[(i >> 11) & 0x1F];
- rgb[1] = _rgb_scale_6[(i >> 5) & 0x3F];
- rgb[2] = _rgb_scale_5[ i & 0x1F];
- tab_16_8[i] = v_mixrgb8fake(rgb);
- }
- (void)v_getrgb8fake6;
- (void)v_getrgb8fake8;
-}
-
-
-/* Desc: set one palette entry
- *
- * In : index, R, G, B
- * Out : -
- *
- * Note: color components are in range [0.0 .. 1.0]
- */
-void
-vl_setCI (int index, float red, float green, float blue)
-{
- drv->setCI_f(index, red, green, blue);
-}
-
-
-/* Desc: set one palette entry
- *
- * In : color, R, G, B
- * Out : -
- *
- * Note: -
- */
-static void
-fake_setcolor (int c, int r, int g, int b)
-{
- VGAPalette[c] = 0xff000000 | (r<<16) | (g<<8) | b;
-
- drv->setCI_i(c, r, g, b);
-}
-
-
-/* Desc: build FakeColor palette
- *
- * In : CI precision in bits
- * Out : -
- *
- * Note: -
- */
-static void
-fake_buildpalette (int bits)
-{
- double c_r, c_g, c_b;
- int r, g, b, color = 0;
-
- double max = (1 << bits) - 1;
-
- for (b = 0; b < B_CNT; ++b) {
- for (g = 0; g < G_CNT; ++g) {
- for (r = 0; r < R_CNT; ++r) {
- c_r = 0.5 + (double)r * (max-R_BIAS) / (R_CNT-1.) + R_BIAS;
- c_g = 0.5 + (double)g * (max-G_BIAS) / (G_CNT-1.) + G_BIAS;
- c_b = 0.5 + (double)b * (max-B_BIAS) / (B_CNT-1.) + B_BIAS;
- fake_setcolor(color++, (int)c_r, (int)c_g, (int)c_b);
- }
- }
- }
-
- for (color = 0; color < 256; color++) {
- c_r = (double)color * R_CNT / 256.;
- c_g = (double)color * G_CNT / 256.;
- c_b = (double)color * B_CNT / 256.;
- array_r[color] = (int)c_r;
- array_g[color] = (int)c_g;
- array_b[color] = (int)c_b;
- }
-}
-
-
-/* Desc: initialize hardware
- *
- * In : -
- * Out : list of available modes
- *
- * Note: when returning non-NULL, global variable `drv' is guaranteed to be ok
- */
-static vl_mode *
-v_init_hw (void)
-{
- static vl_mode *q = NULL;
-
- if (q == NULL) {
- /* are we forced to NUL driver? */
- if (getenv("DMESA_NULDRV")) {
- if ((q = NUL.init()) != NULL) {
- drv = &NUL;
- }
- return q;
- }
- /* initialize hardware */
- if ((q = VESA.init()) != NULL) {
- drv = &VESA;
- } else if ((q = VGA.init()) != NULL) {
- drv = &VGA;
- } else {
- drv = NULL;
- }
- }
-
- return q;
-}
-
-
-/* Desc: sync buffer with video hardware
- *
- * In : ptr to old buffer, position, size
- * Out : 0 if success
- *
- * Note: -
- */
-int
-vl_sync_buffer (void **buffer, int x, int y, int width, int height)
-{
- if ((/*XXX*/width & 7) || (x < 0) || (y < 0) || (x+width > video_mode->xres) || (y+height > video_mode->yres)) {
- return -1;
- } else {
- void *newbuf = *buffer;
-
- if ((newbuf == NULL) || (vl_current_width != width) || (vl_current_height != height)) {
- newbuf = realloc(newbuf, width * height * video_bypp);
- }
-
- if (newbuf == NULL) {
- return -2;
- }
-
- vl_current_width = width;
- vl_current_height = height;
- vl_current_stride = vl_current_width * video_bypp;
- vl_current_bytes = vl_current_stride * height;
-
- vl_current_offset = video_scanlen * y + video_bypp * x;
- vl_current_delta = video_scanlen - vl_current_stride;
-
- vl_current_draw_buffer = vl_current_read_buffer = *buffer = newbuf;
- return 0;
- }
-}
-
-
-/* Desc: state retrieval
- *
- * In : name, storage
- * Out : -1 for an error
- *
- * Note: -
- */
-int
-vl_get (int pname, int *params)
-{
- switch (pname) {
- case VL_GET_SCREEN_SIZE:
- params[0] = video_mode->xres;
- params[1] = video_mode->yres;
- break;
- case VL_GET_VIDEO_MODES: {
- int n;
- vl_mode *q;
- if ((q = v_init_hw()) == NULL) {
- return -1;
- }
- /* count available visuals */
- for (n = 0; q->mode != 0xffff; q++) {
- if ((q + 1)->mode == (q->mode | 0x4000)) {
- /* same mode, but linear */
- q++;
- }
- if (params) {
- params[n] = (int)q;
- }
- n++;
- }
- return n;
- }
- default:
- return (drv != NULL) ? drv->get(pname, params) : -1;
- }
- return 0;
-}
-
-
-/* Desc: setup mode
- *
- * In : ptr to mode definition
- * Out : 0 if success
- *
- * Note: -
- */
-static int
-vl_setup_mode (vl_mode *p)
-{
- if (p == NULL) {
- return -1;
- }
-
- switch (p->bpp) {
- case 8:
- break;
- case 15:
- break;
- case 16:
- break;
- case 24:
- break;
- case 32:
- break;
- default:
- return -1;
- }
-
- video_mode = p;
- video_bypp = (p->bpp+7)/8;
- video_scanlen = p->scanlen;
- vl_video_selector = p->sel;
-
- return 0;
-}
-
-
-/* Desc: restore to the mode prior to first call to `vl_video_init'.
- *
- * In : -
- * Out : -
- *
- * Note: -
- */
-void
-vl_video_exit (void)
-{
- drv->restore();
- drv->fini();
- video_mode = NULL;
-}
-
-
-/* Desc: enter mode
- *
- * In : xres, yres, bits/pixel, RGB, refresh rate
- * Out : pixel width in bits if success
- *
- * Note: -
- */
-int
-vl_video_init (int width, int height, int bpp, int rgb, int refresh, int fbbits)
-{
- int fake;
- vl_mode *p, *q;
- unsigned int min;
-
- fake = 0;
- if (!rgb) {
- bpp = 8;
- } else if (bpp == 8) {
- fake = 1;
- }
-
- /* initialize hardware */
- if ((q = v_init_hw()) == NULL) {
- return 0;
- }
-
- /* search for a mode that fits our request */
- for (min = -1, p = NULL; q->mode != 0xffff; q++) {
- if ((q->xres >= width) && (q->yres >= height) && (q->bpp == bpp)) {
- if (min >= (unsigned)(q->xres * q->yres)) {
- min = q->xres * q->yres;
- p = q;
- }
- }
- }
-
- /* setup and enter mode */
- if ((vl_setup_mode(p) == 0) && (drv->entermode(p, refresh, fbbits) == 0)) {
- vl_flip = drv->blit;
- if (fake) {
- drv->get(VL_GET_CI_PREC, (int *)(&min));
- fake_buildpalette(min);
- init_tab_16_8();
- }
- return bpp;
- }
-
- /* abort */
- return 0;
-}
diff --git a/src/mesa/drivers/dos/video.h b/src/mesa/drivers/dos/video.h
deleted file mode 100644
index e0841167429..00000000000
--- a/src/mesa/drivers/dos/video.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver for Mesa
- *
- * Author: Daniel Borca
- * Email : dborca@users.sourceforge.net
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifndef VIDEO_H_included
-#define VIDEO_H_included
-
-typedef int fixed;
-
-#define VL_GET_CARD_NAME 0x0100
-#define VL_GET_VRAM 0x0101
-#define VL_GET_CI_PREC 0x0200
-#define VL_GET_HPIXELS 0x0201
-#define VL_GET_SCREEN_SIZE 0x0202
-#define VL_GET_VIDEO_MODES 0x0300
-
-extern void (*vl_flip) (void);
-
-void vl_setCI (int index, float red, float green, float blue);
-
-int vl_sync_buffer (void **buffer, int x, int y, int width, int height);
-int vl_get (int pname, int *params);
-
-void vl_video_exit (void);
-int vl_video_init (int width, int height, int bpp, int rgb, int refresh, int fbbits);
-
-#endif
diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template
index 39d25ce3f47..a0c25d26cdf 100644
--- a/src/mesa/drivers/dri/Makefile.template
+++ b/src/mesa/drivers/dri/Makefile.template
@@ -14,28 +14,11 @@ COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
../common/drirenderbuffer.c \
../common/dri_metaops.c
-ifeq ($(WINDOW_SYSTEM),dri)
-WINOBJ=
-WINLIB=
INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)
OBJECTS = $(C_SOURCES:.c=.o) \
$(ASM_SOURCES:.S=.o)
-else
-# miniglx
-WINOBJ=
-WINLIB=-L$(MESA)/src/glx/mini
-MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
-INCLUDES = $(MINIGLX_INCLUDES) \
- $(SHARED_INCLUDES) \
- $(PCIACCESS_CFLAGS)
-
-OBJECTS = $(C_SOURCES:.c=.o) \
- $(MINIGLX_SOURCES:.c=.o) \
- $(ASM_SOURCES:.S=.o)
-endif
-
### Include directories
SHARED_INCLUDES = \
@@ -55,7 +38,7 @@ SHARED_INCLUDES = \
$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
##### TARGETS #####
@@ -67,11 +50,10 @@ default: subdirs lib
lib: symlinks subdirs depend
@$(MAKE) $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
-$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) Makefile \
+$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) Makefile \
$(TOP)/src/mesa/drivers/dri/Makefile.template
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) \
- $(DRI_LIB_DEPS)
+ $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(DRI_LIB_DEPS)
$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 58a94b58682..890ae513397 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -127,6 +127,7 @@ static int driUnbindContext(__DRIcontext *pcp)
/* Let driver unbind drawable from context */
(*psp->DriverAPI.UnbindContext)(pcp);
+ assert(pdp);
if (pdp->refcount == 0) {
/* ERROR!!! */
return GL_FALSE;
@@ -189,6 +190,7 @@ static int driBindContext(__DRIcontext *pcp,
** initialize the drawable information if has not been done before.
*/
+ assert(psp);
if (!psp->dri2.enabled) {
if (pdp && !pdp->pStamp) {
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
@@ -242,12 +244,12 @@ __driUtilUpdateDrawableInfo(__DRIdrawable *pdp)
}
if (pdp->pClipRects) {
- _mesa_free(pdp->pClipRects);
+ free(pdp->pClipRects);
pdp->pClipRects = NULL;
}
if (pdp->pBackClipRects) {
- _mesa_free(pdp->pBackClipRects);
+ free(pdp->pBackClipRects);
pdp->pBackClipRects = NULL;
}
@@ -324,7 +326,7 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
if (!dPriv->numClipRects)
return;
- rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects);
+ rects = malloc(sizeof(*rects) * dPriv->numClipRects);
if (!rects)
return;
@@ -337,7 +339,7 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
}
driReportDamage(dPriv, rects, dPriv->numClipRects);
- _mesa_free(rects);
+ free(rects);
}
static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv,
@@ -430,7 +432,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
*/
(void) attrs;
- pdp = _mesa_malloc(sizeof *pdp);
+ pdp = malloc(sizeof *pdp);
if (!pdp) {
return NULL;
}
@@ -457,7 +459,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes,
renderType == GLX_PIXMAP_BIT)) {
- _mesa_free(pdp);
+ free(pdp);
return NULL;
}
@@ -510,14 +512,14 @@ static void dri_put_drawable(__DRIdrawable *pdp)
psp = pdp->driScreenPriv;
(*psp->DriverAPI.DestroyBuffer)(pdp);
if (pdp->pClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
- _mesa_free(pdp->pClipRects);
+ free(pdp->pClipRects);
pdp->pClipRects = NULL;
}
if (pdp->pBackClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
- _mesa_free(pdp->pBackClipRects);
+ free(pdp->pBackClipRects);
pdp->pBackClipRects = NULL;
}
- _mesa_free(pdp);
+ free(pdp);
}
}
@@ -547,7 +549,7 @@ driDestroyContext(__DRIcontext *pcp)
{
if (pcp) {
(*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
- _mesa_free(pcp);
+ free(pcp);
}
}
@@ -577,7 +579,7 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
__DRIcontext *pcp;
void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
- pcp = _mesa_malloc(sizeof *pcp);
+ pcp = malloc(sizeof *pcp);
if (!pcp)
return NULL;
@@ -602,7 +604,7 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
pcp->hHWContext = hwContext;
if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) {
- _mesa_free(pcp);
+ free(pcp);
return NULL;
}
@@ -656,7 +658,7 @@ static void driDestroyScreen(__DRIscreen *psp)
(void)drmCloseOnce(psp->fd);
}
- _mesa_free(psp);
+ free(psp);
}
}
@@ -675,6 +677,8 @@ setupLoaderExtensions(__DRIscreen *psp,
psp->systemTime = (__DRIsystemTimeExtension *) extensions[i];
if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0)
psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i];
+ if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0)
+ psp->dri2.image = (__DRIimageLookupExtension *) extensions[i];
}
}
@@ -718,7 +722,7 @@ driCreateNewScreen(int scrn,
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
- psp = _mesa_calloc(sizeof *psp);
+ psp = calloc(1, sizeof *psp);
if (!psp)
return NULL;
@@ -763,7 +767,7 @@ driCreateNewScreen(int scrn,
*driver_modes = driDriverAPI.InitScreen(psp);
if (*driver_modes == NULL) {
- _mesa_free(psp);
+ free(psp);
return NULL;
}
@@ -785,7 +789,7 @@ dri2CreateNewScreen(int scrn, int fd,
if (driDriverAPI.InitScreen2 == NULL)
return NULL;
- psp = _mesa_calloc(sizeof(*psp));
+ psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
@@ -807,7 +811,7 @@ dri2CreateNewScreen(int scrn, int fd,
psp->DriverAPI = driDriverAPI;
*driver_configs = driDriverAPI.InitScreen2(psp);
if (*driver_configs == NULL) {
- _mesa_free(psp);
+ free(psp);
return NULL;
}
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 2eadb9ac8c5..99c0f1e4422 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -544,6 +544,7 @@ struct __DRIscreenRec {
* fields will not be valid or initializaed in that case. */
int enabled;
__DRIdri2LoaderExtension *loader;
+ __DRIimageLookupExtension *image;
} dri2;
/* The lock actually in use, old sarea or DRI2 */
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c
index fe38f608a97..c9ce6e3cb64 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -32,7 +32,7 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
/* don't free rb->Data Chances are it's a memory mapped region for
* the dri drivers.
*/
- _mesa_free(rb);
+ free(rb);
}
@@ -59,18 +59,10 @@ driNewRenderbuffer(gl_format format, GLvoid *addr,
{
driRenderbuffer *drb;
- assert(format == GL_RGBA ||
- format == GL_RGB5 ||
- format == GL_RGBA8 ||
- format == GL_DEPTH_COMPONENT16 ||
- format == GL_DEPTH_COMPONENT24 ||
- format == GL_DEPTH_COMPONENT32 ||
- format == GL_STENCIL_INDEX8_EXT);
-
assert(cpp > 0);
assert(pitch > 0);
- drb = _mesa_calloc(sizeof(driRenderbuffer));
+ drb = calloc(1, sizeof(driRenderbuffer));
if (drb) {
const GLuint name = 0;
diff --git a/src/mesa/drivers/dri/common/spantmp.h b/src/mesa/drivers/dri/common/spantmp.h
index d5608b88065..cdc4f422ceb 100644
--- a/src/mesa/drivers/dri/common/spantmp.h
+++ b/src/mesa/drivers/dri/common/spantmp.h
@@ -288,7 +288,6 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_LOCK()
{
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- const GLubyte *mask = NULL; /* remove someday */
GLuint i;
LOCAL_VARS;
@@ -296,23 +295,11 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_CLIPLOOP()
{
- if (mask)
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
- else
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
+ for (i=0;i<n;i++) {
+ int fy = Y_FLIP( y[i] );
+ if (CLIPPIXEL( x[i], fy ))
+ READ_RGBA( rgba[i], x[i], fy );
+ }
}
HW_ENDCLIPLOOP();
}
diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h
index c1522269022..98422a85647 100644
--- a/src/mesa/drivers/dri/common/spantmp2.h
+++ b/src/mesa/drivers/dri/common/spantmp2.h
@@ -805,7 +805,6 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_LOCK()
{
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- GLubyte *mask = NULL; /* remove someday */
GLint i;
LOCAL_VARS;
@@ -813,23 +812,11 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_CLIPLOOP()
{
- if (mask)
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
- else
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
+ for (i=0;i<n;i++) {
+ int fy = Y_FLIP( y[i] );
+ if (CLIPPIXEL( x[i], fy ))
+ READ_RGBA( rgba[i], x[i], fy );
+ }
}
HW_ENDCLIPLOOP();
}
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index 833f9ad232a..b85b364c575 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -108,7 +108,7 @@ driGetRendererString( char * buffer, const char * hardware_name,
cpu = _mesa_get_cpu_string();
if (cpu) {
offset += sprintf(buffer + offset, " %s", cpu);
- _mesa_free(cpu);
+ free(cpu);
}
return offset;
@@ -275,10 +275,9 @@ driCheckDriDdxDrmVersions3(const char * driver_name,
}
/* Check that the DDX driver version is compatible */
- /* for miniglx we pass in -1 so we can ignore the DDX version */
- if ( (ddxActual->major != -1) && ((ddxActual->major < ddxExpected->major_min)
+ if ( (ddxActual->major < ddxExpected->major_min)
|| (ddxActual->major > ddxExpected->major_max)
- || (ddxActual->minor < ddxExpected->minor)) ) {
+ || (ddxActual->minor < ddxExpected->minor) ) {
fprintf(stderr, format2, driver_name, "DDX",
ddxExpected->major_min, ddxExpected->major_max, ddxExpected->minor,
ddxActual->major, ddxActual->minor, ddxActual->patch);
@@ -559,7 +558,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
}
num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes;
- configs = _mesa_calloc((num_modes + 1) * sizeof *configs);
+ configs = calloc(1, (num_modes + 1) * sizeof *configs);
if (configs == NULL)
return NULL;
@@ -568,7 +567,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
for ( i = 0 ; i < num_db_modes ; i++ ) {
for ( h = 0 ; h < num_msaa_modes; h++ ) {
for ( j = 0 ; j < num_accum_bits ; j++ ) {
- *c = _mesa_malloc (sizeof **c);
+ *c = malloc (sizeof **c);
modes = &(*c)->modes;
c++;
@@ -626,11 +625,10 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
modes->bindToTextureRgb = GL_TRUE;
modes->bindToTextureRgba = GL_TRUE;
modes->bindToMipmapTexture = GL_FALSE;
- modes->bindToTextureTargets = modes->rgbMode ?
- __DRI_ATTRIB_TEXTURE_1D_BIT |
- __DRI_ATTRIB_TEXTURE_2D_BIT |
- __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT :
- 0;
+ modes->bindToTextureTargets =
+ __DRI_ATTRIB_TEXTURE_1D_BIT |
+ __DRI_ATTRIB_TEXTURE_2D_BIT |
+ __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT;
}
}
}
@@ -653,7 +651,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
while (b[j] != NULL)
j++;
- all = _mesa_malloc((i + j + 1) * sizeof *all);
+ all = malloc((i + j + 1) * sizeof *all);
index = 0;
for (i = 0; a[i] != NULL; i++)
all[index++] = a[i];
@@ -661,8 +659,8 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
all[index++] = b[j];
all[index++] = NULL;
- _mesa_free(a);
- _mesa_free(b);
+ free(a);
+ free(b);
return all;
}
@@ -727,10 +725,7 @@ driGetConfigAttribIndex(const __DRIconfig *config,
{
switch (attribMap[index].attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
- if (config->modes.rgbMode)
- *value = __DRI_ATTRIB_RGBA_BIT;
- else
- *value = __DRI_ATTRIB_COLOR_INDEX_BIT;
+ *value = __DRI_ATTRIB_RGBA_BIT;
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG)
diff --git a/src/mesa/drivers/dri/fb/Doxyfile b/src/mesa/drivers/dri/fb/Doxyfile
deleted file mode 100644
index 31256db834a..00000000000
--- a/src/mesa/drivers/dri/fb/Doxyfile
+++ /dev/null
@@ -1,232 +0,0 @@
-# Doxyfile 1.3.2-Gideon
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = fb
-PROJECT_NUMBER = $VERSION$
-OUTPUT_DIRECTORY =
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-EXTRACT_ALL = NO
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = YES
-SHORT_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 8
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ALIASES =
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = NO
-SHOW_USED_FILES = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = /home/temp/Mesa/src/drv/fb
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.idl \
- *.odl \
- *.cs \
- *.C \
- *.H \
- *.tlh \
- *.diff \
- *.patch \
- *.moc \
- *.xpm
-RECURSIVE = yes
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS = *
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = YES
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = yes
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 1000
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
-CGI_NAME = search.cgi
-CGI_URL =
-DOC_URL =
-DOC_ABSPATH =
-BIN_ABSPATH = /usr/local/bin/
-EXT_DOC_PATHS =
diff --git a/src/mesa/drivers/dri/fb/Makefile b/src/mesa/drivers/dri/fb/Makefile
deleted file mode 100644
index 848e2041e27..00000000000
--- a/src/mesa/drivers/dri/fb/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-# src/mesa/drivers/dri/fb/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = fb_dri.so
-
-
-DRIVER_SOURCES = \
- fb_dri.c \
- $(EGL_SOURCES)
-
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-# XXX not 100% sure this is right
-#WINDOW_SYSTEM = solo
-
-include ../Makefile.template
-
diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c
deleted file mode 100644
index f37241dd69a..00000000000
--- a/src/mesa/drivers/dri/fb/fb_dri.c
+++ /dev/null
@@ -1,794 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Minimal swrast-based dri loadable driver.
- *
- * Todo:
- * -- Use malloced (rather than framebuffer) memory for backbuffer
- * -- 32bpp is hardwared -- fix
- *
- * NOTES:
- * -- No mechanism for cliprects or resize notification --
- * assumes this is a fullscreen device.
- * -- No locking -- assumes this is the only driver accessing this
- * device.
- * -- Doesn't (yet) make use of any acceleration or other interfaces
- * provided by fb. Would be entirely happy working against any
- * fullscreen interface.
- * -- HOWEVER: only a small number of pixelformats are supported, and
- * the mechanism for choosing between them makes some assumptions
- * that may not be valid everywhere.
- */
-
-#include "driver.h"
-#include "drm.h"
-#include "utils.h"
-#include "drirenderbuffer.h"
-
-#include "buffers.h"
-#include "main/extensions.h"
-#include "main/framebuffer.h"
-#include "main/renderbuffer.h"
-#include "vbo/vbo.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/tcontext.h"
-#include "tnl/t_pipeline.h"
-#include "drivers/common/driverfuncs.h"
-
-void fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis);
-
-typedef struct {
- GLcontext *glCtx; /* Mesa context */
-
- struct {
- __DRIcontext *context;
- __DRIscreen *screen;
- __DRIdrawable *drawable; /* drawable bound to this ctx */
- } dri;
-
-} fbContext, *fbContextPtr;
-
-#define FB_CONTEXT(ctx) ((fbContextPtr)(ctx->DriverCtx))
-
-
-static const GLubyte *
-get_string(GLcontext *ctx, GLenum pname)
-{
- (void) ctx;
- switch (pname) {
- case GL_RENDERER:
- return (const GLubyte *) "Mesa dumb framebuffer";
- default:
- return NULL;
- }
-}
-
-
-static void
-update_state( GLcontext *ctx, GLuint new_state )
-{
- /* not much to do here - pass it on */
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-}
-
-
-/**
- * Called by ctx->Driver.GetBufferSize from in core Mesa to query the
- * current framebuffer size.
- */
-static void
-get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- fbContextPtr fbmesa = FB_CONTEXT(ctx);
-
- *width = fbmesa->dri.drawable->w;
- *height = fbmesa->dri.drawable->h;
-}
-
-
-static void
-updateFramebufferSize(GLcontext *ctx)
-{
- fbContextPtr fbmesa = FB_CONTEXT(ctx);
- struct gl_framebuffer *fb = ctx->WinSysDrawBuffer;
- if (fbmesa->dri.drawable->w != fb->Width ||
- fbmesa->dri.drawable->h != fb->Height) {
- driUpdateFramebufferSize(ctx, fbmesa->dri.drawable);
- }
-}
-
-static void
-viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- /* XXX this should be called after we acquire the DRI lock, not here */
- updateFramebufferSize(ctx);
-}
-
-
-static void
-init_core_functions( struct dd_function_table *functions )
-{
- functions->GetString = get_string;
- functions->UpdateState = update_state;
- functions->GetBufferSize = get_buffer_size;
- functions->Viewport = viewport;
-
- functions->Clear = _swrast_Clear; /* could accelerate with blits */
-}
-
-
-/*
- * Generate code for span functions.
- */
-
-/* 24-bit BGR */
-#define NAME(PREFIX) PREFIX##_B8G8R8
-#define FORMAT GL_RGBA8
-#define SPAN_VARS \
- driRenderbuffer *drb = (driRenderbuffer *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 3;
-#define INC_PIXEL_PTR(P) P += 3
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[0] = VALUE[BCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[2] = VALUE[RCOMP]
-#define FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = SRC[2]; \
- DST[GCOMP] = SRC[1]; \
- DST[BCOMP] = SRC[0]; \
- DST[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-
-/* 32-bit BGRA */
-#define NAME(PREFIX) PREFIX##_B8G8R8A8
-#define FORMAT GL_RGBA8
-#define SPAN_VARS \
- driRenderbuffer *drb = (driRenderbuffer *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 4;
-#define INC_PIXEL_PTR(P) P += 4
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[0] = VALUE[BCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[2] = VALUE[RCOMP]; \
- DST[3] = VALUE[ACOMP]
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- DST[0] = VALUE[BCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[2] = VALUE[RCOMP]; \
- DST[3] = 0xff
-#define FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = SRC[2]; \
- DST[GCOMP] = SRC[1]; \
- DST[BCOMP] = SRC[0]; \
- DST[ACOMP] = SRC[3]
-
-#include "swrast/s_spantemp.h"
-
-
-/* 16-bit BGR (XXX implement dithering someday) */
-#define NAME(PREFIX) PREFIX##_B5G6R5
-#define FORMAT GL_RGBA8
-#define SPAN_VARS \
- driRenderbuffer *drb = (driRenderbuffer *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 2;
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[0] = ( (((VALUE[RCOMP]) & 0xf8) << 8) | (((VALUE[GCOMP]) & 0xfc) << 3) | ((VALUE[BCOMP]) >> 3) )
-#define FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = ( (((SRC[0]) >> 8) & 0xf8) | (((SRC[0]) >> 11) & 0x7) ); \
- DST[GCOMP] = ( (((SRC[0]) >> 3) & 0xfc) | (((SRC[0]) >> 5) & 0x3) ); \
- DST[BCOMP] = ( (((SRC[0]) << 3) & 0xf8) | (((SRC[0]) ) & 0x7) ); \
- DST[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-
-/* 15-bit BGR (XXX implement dithering someday) */
-#define NAME(PREFIX) PREFIX##_B5G5R5
-#define FORMAT GL_RGBA8
-#define SPAN_VARS \
- driRenderbuffer *drb = (driRenderbuffer *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 2;
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[0] = ( (((VALUE[RCOMP]) & 0xf8) << 7) | (((VALUE[GCOMP]) & 0xf8) << 2) | ((VALUE[BCOMP]) >> 3) )
-#define FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = ( (((SRC[0]) >> 7) & 0xf8) | (((SRC[0]) >> 10) & 0x7) ); \
- DST[GCOMP] = ( (((SRC[0]) >> 2) & 0xf8) | (((SRC[0]) >> 5) & 0x7) ); \
- DST[BCOMP] = ( (((SRC[0]) << 3) & 0xf8) | (((SRC[0]) ) & 0x7) ); \
- DST[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-
-/* 8-bit color index */
-#define NAME(PREFIX) PREFIX##_CI8
-#define FORMAT GL_COLOR_INDEX8_EXT
-#define SPAN_VARS \
- driRenderbuffer *drb = (driRenderbuffer *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- *DST = VALUE[0]
-#define FETCH_PIXEL(DST, SRC) \
- DST = SRC[0]
-
-#include "swrast/s_spantemp.h"
-
-
-
-void
-fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- ASSERT(drb->Base.InternalFormat == GL_RGBA);
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = get_row_B5G6R5;
- drb->Base.GetValues = get_values_B5G6R5;
- drb->Base.PutRow = put_row_B5G6R5;
- drb->Base.PutMonoRow = put_mono_row_B5G6R5;
- drb->Base.PutRowRGB = put_row_rgb_B5G6R5;
- drb->Base.PutValues = put_values_B5G6R5;
- drb->Base.PutMonoValues = put_mono_values_B5G6R5;
- }
- else if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
- drb->Base.GetRow = get_row_B5G5R5;
- drb->Base.GetValues = get_values_B5G5R5;
- drb->Base.PutRow = put_row_B5G5R5;
- drb->Base.PutMonoRow = put_mono_row_B5G5R5;
- drb->Base.PutRowRGB = put_row_rgb_B5G5R5;
- drb->Base.PutValues = put_values_B5G5R5;
- drb->Base.PutMonoValues = put_mono_values_B5G5R5;
- }
- else if (vis->redBits == 8 && vis->greenBits == 8 && vis->blueBits == 8
- && vis->alphaBits == 8) {
- drb->Base.GetRow = get_row_B8G8R8A8;
- drb->Base.GetValues = get_values_B8G8R8A8;
- drb->Base.PutRow = put_row_B8G8R8A8;
- drb->Base.PutMonoRow = put_mono_row_B8G8R8A8;
- drb->Base.PutRowRGB = put_row_rgb_B8G8R8A8;
- drb->Base.PutValues = put_values_B8G8R8A8;
- drb->Base.PutMonoValues = put_mono_values_B8G8R8A8;
- }
- else if (vis->redBits == 8 && vis->greenBits == 8 && vis->blueBits == 8
- && vis->alphaBits == 0) {
- drb->Base.GetRow = get_row_B8G8R8;
- drb->Base.GetValues = get_values_B8G8R8;
- drb->Base.PutRow = put_row_B8G8R8;
- drb->Base.PutMonoRow = put_mono_row_B8G8R8;
- drb->Base.PutRowRGB = put_row_rgb_B8G8R8;
- drb->Base.PutValues = put_values_B8G8R8;
- drb->Base.PutMonoValues = put_mono_values_B8G8R8;
- }
- else if (vis->indexBits == 8) {
- drb->Base.GetRow = get_row_CI8;
- drb->Base.GetValues = get_values_CI8;
- drb->Base.PutRow = put_row_CI8;
- drb->Base.PutMonoRow = put_mono_row_CI8;
- drb->Base.PutValues = put_values_CI8;
- drb->Base.PutMonoValues = put_mono_values_CI8;
- }
- }
- else {
- /* hardware z/stencil/etc someday */
- }
-}
-
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-fbInitDriver( __DRIscreen *sPriv )
-{
- sPriv->private = NULL;
- return GL_TRUE;
-}
-
-static void
-fbDestroyScreen( __DRIscreen *sPriv )
-{
-}
-
-
-/* Create the device specific context.
- */
-static GLboolean
-fbCreateContext( const __GLcontextModes *glVisual,
- __DRIcontext *driContextPriv,
- void *sharedContextPrivate)
-{
- fbContextPtr fbmesa;
- GLcontext *ctx, *shareCtx;
- struct dd_function_table functions;
-
- assert(glVisual);
- assert(driContextPriv);
-
- /* Allocate the Fb context */
- fbmesa = (fbContextPtr) _mesa_calloc( sizeof(*fbmesa) );
- if ( !fbmesa )
- return GL_FALSE;
-
- /* Init default driver functions then plug in our FBdev-specific functions
- */
- _mesa_init_driver_functions(&functions);
- init_core_functions(&functions);
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((fbContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- ctx = fbmesa->glCtx = _mesa_create_context(glVisual, shareCtx,
- &functions, (void *) fbmesa);
- if (!fbmesa->glCtx) {
- _mesa_free(fbmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = fbmesa;
-
- /* Create module contexts */
- _swrast_CreateContext( ctx );
- _vbo_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
- _swsetup_Wakeup( ctx );
-
-
- /* use default TCL pipeline */
- {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- }
-
- _mesa_enable_sw_extensions(ctx);
-
- return GL_TRUE;
-}
-
-
-static void
-fbDestroyContext( __DRIcontext *driContextPriv )
-{
- GET_CURRENT_CONTEXT(ctx);
- fbContextPtr fbmesa = (fbContextPtr) driContextPriv->driverPrivate;
- fbContextPtr current = ctx ? FB_CONTEXT(ctx) : NULL;
-
- /* check if we're deleting the currently bound context */
- if (fbmesa == current) {
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- /* Free fb context resources */
- if ( fbmesa ) {
- _swsetup_DestroyContext( fbmesa->glCtx );
- _tnl_DestroyContext( fbmesa->glCtx );
- _vbo_DestroyContext( fbmesa->glCtx );
- _swrast_DestroyContext( fbmesa->glCtx );
-
- /* free the Mesa context */
- fbmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context( fbmesa->glCtx );
-
- _mesa_free( fbmesa );
- }
-}
-
-
-/* Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- */
-static GLboolean
-fbCreateBuffer( __DRIscreen *driScrnPriv,
- __DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- struct gl_framebuffer *mesa_framebuffer;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- const GLboolean swDepth = mesaVis->depthBits > 0;
- const GLboolean swAlpha = mesaVis->alphaBits > 0;
- const GLboolean swAccum = mesaVis->accumRedBits > 0;
- const GLboolean swStencil = mesaVis->stencilBits > 0;
-
- mesa_framebuffer = _mesa_create_framebuffer(mesaVis);
- if (!mesa_framebuffer)
- return 0;
-
- /* XXX double-check these parameters (bpp vs cpp, etc) */
- {
- driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
- driScrnPriv->pFB,
- driScrnPriv->fbBPP / 8,
- driScrnPriv->fbOrigin,
- driScrnPriv->fbStride,
- driDrawPriv);
- fbSetSpanFunctions(drb, mesaVis);
- _mesa_add_renderbuffer(mesa_framebuffer,
- BUFFER_FRONT_LEFT, &drb->Base);
- }
- if (mesaVis->doubleBufferMode) {
- /* XXX what are the correct origin/stride values? */
- GLvoid *backBuf = _mesa_malloc(driScrnPriv->fbStride
- * driScrnPriv->fbHeight);
- driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
- backBuf,
- driScrnPriv->fbBPP /8,
- driScrnPriv->fbOrigin,
- driScrnPriv->fbStride,
- driDrawPriv);
- fbSetSpanFunctions(drb, mesaVis);
- _mesa_add_renderbuffer(mesa_framebuffer,
- BUFFER_BACK_LEFT, &drb->Base);
- }
-
- _mesa_add_soft_renderbuffers(mesa_framebuffer,
- GL_FALSE, /* color */
- swDepth,
- swStencil,
- swAccum,
- swAlpha, /* or always zero? */
- GL_FALSE /* aux */);
-
- driDrawPriv->driverPrivate = mesa_framebuffer;
-
- return 1;
- }
-}
-
-
-static void
-fbDestroyBuffer(__DRIdrawable *driDrawPriv)
-{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
-}
-
-
-
-/* If the backbuffer is on a videocard, this is extraordinarily slow!
- */
-static void
-fbSwapBuffers( __DRIdrawable *dPriv )
-{
- struct gl_framebuffer *mesa_framebuffer = (struct gl_framebuffer *)dPriv->driverPrivate;
- struct gl_renderbuffer * front_renderbuffer = mesa_framebuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
- void *frontBuffer = front_renderbuffer->Data;
- int currentPitch = ((driRenderbuffer *)front_renderbuffer)->pitch;
- void *backBuffer = mesa_framebuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer->Data;
-
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- fbContextPtr fbmesa = (fbContextPtr) dPriv->driContextPriv->driverPrivate;
- GLcontext *ctx = fbmesa->glCtx;
-
- if (ctx->Visual.doubleBufferMode) {
- int i;
- int offset = 0;
- char *tmp = _mesa_malloc(currentPitch);
-
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
-
- ASSERT(frontBuffer);
- ASSERT(backBuffer);
-
- for (i = 0; i < dPriv->h; i++) {
- _mesa_memcpy(tmp, (char *) backBuffer + offset,
- currentPitch);
- _mesa_memcpy((char *) frontBuffer + offset, tmp,
- currentPitch);
- offset += currentPitch;
- }
-
- _mesa_free(tmp);
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "fbSwapBuffers: drawable has no context!\n");
- }
-}
-
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-static GLboolean
-fbMakeCurrent( __DRIcontext *driContextPriv,
- __DRIdrawable *driDrawPriv,
- __DRIdrawable *driReadPriv )
-{
- if ( driContextPriv ) {
- fbContextPtr newFbCtx =
- (fbContextPtr) driContextPriv->driverPrivate;
-
- newFbCtx->dri.drawable = driDrawPriv;
-
- _mesa_make_current( newFbCtx->glCtx,
- driDrawPriv->driverPrivate,
- driReadPriv->driverPrivate);
- } else {
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- return GL_TRUE;
-}
-
-
-/* Force the context `c' to be unbound from its buffer.
- */
-static GLboolean
-fbUnbindContext( __DRIcontext *driContextPriv )
-{
- return GL_TRUE;
-}
-
-static struct __DriverAPIRec fbAPI = {
- .InitDriver = fbInitDriver,
- .DestroyScreen = fbDestroyScreen,
- .CreateContext = fbCreateContext,
- .DestroyContext = fbDestroyContext,
- .CreateBuffer = fbCreateBuffer,
- .DestroyBuffer = fbDestroyBuffer,
- .SwapBuffers = fbSwapBuffers,
- .MakeCurrent = fbMakeCurrent,
- .UnbindContext = fbUnbindContext,
-};
-
-
-
-static int
-__driValidateMode(const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-static int
-__driInitFBDev( struct DRIDriverContextRec *ctx )
-{
- /* Note that drmOpen will try to load the kernel module, if needed. */
- /* we need a fbdev drm driver - it will only track maps */
- ctx->drmFD = drmOpen("radeon", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- ctx->shared.SAREASize = SAREA_MAX;
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize,
- (unsigned long) ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- (unsigned long) ctx->shared.hSAREA, ctx->pSAREA,
- ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
-#ifndef _EMBEDDED
- 0,
-#else
- DRM_READ_ONLY,
-#endif
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- (unsigned long) ctx->shared.hFrameBuffer);
-
- return 1;
-}
-
-static void
-__driHaltFBDev( struct DRIDriverContextRec *ctx )
-{
-}
-
-struct DRIDriverRec __driDriver = {
- __driValidateMode,
- __driValidateMode,
- __driInitFBDev,
- __driHaltFBDev
-};
-
-static __GLcontextModes *
-fbFillInModes( __DRIscreen *psp,
- unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer )
-{
- __GLcontextModes * modes;
- __GLcontextModes * m;
- unsigned num_modes;
- unsigned depth_buffer_factor;
- unsigned back_buffer_factor;
- GLenum fb_format;
- GLenum fb_type;
-
- /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
- * enough to add support. Basically, if a context is created with an
- * fbconfig where the swap method is GLX_SWAP_COPY_OML, pageflipping
- * will never be used.
- */
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */
- };
-
- uint8_t depth_bits_array[2];
- uint8_t stencil_bits_array[2];
-
-
- depth_bits_array[0] = depth_bits;
- depth_bits_array[1] = depth_bits;
-
- /* Just like with the accumulation buffer, always provide some modes
- * with a stencil buffer. It will be a sw fallback, but some apps won't
- * care about that.
- */
- stencil_bits_array[0] = 0;
- stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
-
- depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
- back_buffer_factor = (have_back_buffer) ? 2 : 1;
-
- num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
- if ( pixel_bits == 16 ) {
- fb_format = GL_RGB;
- fb_type = GL_UNSIGNED_SHORT_5_6_5;
- }
- else {
- fb_format = GL_RGBA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) );
- m = modes;
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR ) ) {
- fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__ );
- return NULL;
- }
-
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_DIRECT_COLOR ) ) {
- fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__ );
- return NULL;
- }
-
- /* Mark the visual as slow if there are "fake" stencil bits.
- */
- for ( m = modes ; m != NULL ; m = m->next ) {
- if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) {
- m->visualRating = GLX_SLOW_CONFIG;
- }
- }
-
- return modes;
-}
-
-
-/**
- * This is the bootstrap function for the driver. libGL supplies all of the
- * requisite information about the system, and the driver initializes itself.
- * This routine also fills in the linked list pointed to by \c driver_modes
- * with the \c __GLcontextModes that the driver can support for windows or
- * pbuffers.
- *
- * \return A pointer to a \c __DRIscreen on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- __GLcontextModes ** driver_modes )
-{
- __DRIscreen *psp;
- static const __DRIversion ddx_expected = { 4, 0, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 5, 0 };
-
-
- if ( ! driCheckDriDdxDrmVersions2( "fb",
- dri_version, & dri_expected,
- ddx_version, & ddx_expected,
- drm_version, & drm_expected ) ) {
- return NULL;
- }
-
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
- ddx_version, dri_version, drm_version,
- frame_buffer, pSAREA, fd,
- internal_api_version, &fbAPI);
- if ( psp != NULL ) {
- *driver_modes = fbFillInModes( psp, psp->fbBPP,
- (psp->fbBPP == 16) ? 16 : 24,
- (psp->fbBPP == 16) ? 0 : 8,
- 1);
- }
-
- return (void *) psp;
-}
-
-/* This is the table of extensions that the loader will dlsym() for. */
-PUBLIC const __DRIextension *__driDriverExtensions[] = {
- &driCoreExtension.base,
- &driLegacyExtension.base,
- NULL
-};
diff --git a/src/mesa/drivers/dri/ffb/Makefile b/src/mesa/drivers/dri/ffb/Makefile
deleted file mode 100644
index e9da8f9066e..00000000000
--- a/src/mesa/drivers/dri/ffb/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-# src/mesa/drivers/dri/ffb/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = ffb_dri.so
-
-# not yet
-# MINIGLX_SOURCES = server/ffb_dri.c
-
-DRIVER_SOURCES = \
- ffb_bitmap.c \
- ffb_clear.c \
- ffb_dd.c \
- ffb_depth.c \
- ffb_fog.c \
- ffb_lines.c \
- ffb_points.c \
- ffb_span.c \
- ffb_state.c \
- ffb_stencil.c \
- ffb_tex.c \
- ffb_tris.c \
- ffb_vb.c \
- ffb_xmesa.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
diff --git a/src/mesa/drivers/dri/ffb/ffb_bitmap.c b/src/mesa/drivers/dri/ffb/ffb_bitmap.c
deleted file mode 100644
index b71a552c9dc..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_bitmap.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "ffb_context.h"
-#include "ffb_state.h"
-#include "ffb_lock.h"
-#include "ffb_bitmap.h"
-#include "swrast/swrast.h"
-#include "main/macros.h"
-
-/* Compute ceiling of integer quotient of A divided by B: */
-#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
-
-#undef FFB_BITMAP_TRACE
-
-static void
-ffb_bitmap(GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
- __DRIdrawable *dPriv = fmesa->driDrawable;
- unsigned int ppc, pixel;
- GLint row, col, row_stride;
- const GLubyte *src;
- char *buf;
-
- if (fmesa->bad_fragment_attrs != 0)
- _swrast_Bitmap(ctx, px, py, width,
- height, unpack, bitmap);
-
- pixel = (((((GLuint)(ctx->Current.RasterColor[0] * 255.0f)) & 0xff) << 0) |
- ((((GLuint)(ctx->Current.RasterColor[1] * 255.0f)) & 0xff) << 8) |
- ((((GLuint)(ctx->Current.RasterColor[2] * 255.0f)) & 0xff) << 16) |
- ((((GLuint)(ctx->Current.RasterColor[3] * 255.0f)) & 0xff) << 24));
-
-#ifdef FFB_BITMAP_TRACE
- fprintf(stderr, "ffb_bitmap: ppc(%08x) fbc(%08x) cmp(%08x) pixel(%08x)\n",
- fmesa->ppc, fmesa->fbc, fmesa->cmp, pixel);
-#endif
-
- LOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 1;
-
- if (fmesa->state_dirty)
- ffbSyncHardware(fmesa);
-
- ppc = fmesa->ppc;
-
- FFBFifo(fmesa, 4);
- ffb->ppc = ((ppc &
- ~(FFB_PPC_TBE_MASK | FFB_PPC_ZS_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK))
- | (FFB_PPC_TBE_TRANSPARENT | FFB_PPC_ZS_CONST | FFB_PPC_CS_CONST |
- (ctx->Color.BlendEnabled ? FFB_PPC_XS_CONST : FFB_PPC_XS_WID)));
- ffb->constz = ((GLuint) (ctx->Current.RasterPos[2] * 0x0fffffff));
- ffb->fg = pixel;
- ffb->fontinc = (0 << 16) | 32;
-
- buf = (char *)(fmesa->sfb32 + (dPriv->x << 2) + (dPriv->y << 13));
-
- row_stride = (unpack->Alignment * CEILING(width, 8 * unpack->Alignment));
- src = (const GLubyte *) (bitmap +
- (unpack->SkipRows * row_stride) +
- (unpack->SkipPixels / 8));
- if (unpack->LsbFirst == GL_TRUE) {
- for (row = 0; row < height; row++, src += row_stride) {
- const GLubyte *row_src = src;
- GLuint base_x, base_y;
-
- base_x = dPriv->x + px;
- base_y = dPriv->y + (dPriv->h - (py + row));
-
- FFBFifo(fmesa, 1);
- ffb->fontxy = (base_y << 16) | base_x;
-
- for (col = 0; col < width; col += 32, row_src += 4) {
- GLint bitnum, font_w = (width - col);
- GLuint font_data;
-
- if (font_w > 32)
- font_w = 32;
- font_data = 0;
- for (bitnum = 0; bitnum < 32; bitnum++) {
- const GLubyte val = row_src[bitnum >> 3];
-
- if (val & (1 << (bitnum & (8 - 1))))
- font_data |= (1 << (31 - bitnum));
- }
-
- FFBFifo(fmesa, 2);
- ffb->fontw = font_w;
- ffb->font = font_data;
- }
- }
- } else {
- for (row = 0; row < height; row++, src += row_stride) {
- const GLubyte *row_src = src;
- GLuint base_x, base_y;
-
- base_x = dPriv->x + px;
- base_y = dPriv->y + (dPriv->h - (py + row));
-
- FFBFifo(fmesa, 1);
- ffb->fontxy = (base_y << 16) | base_x;
-
- for (col = 0; col < width; col += 32, row_src += 4) {
- GLint font_w = (width - col);
-
- if (font_w > 32)
- font_w = 32;
- FFBFifo(fmesa, 2);
- ffb->fontw = font_w;
- ffb->font = (((unsigned int)row_src[0]) << 24 |
- ((unsigned int)row_src[1]) << 16 |
- ((unsigned int)row_src[2]) << 8 |
- ((unsigned int)row_src[3]) << 0);
- }
- }
- }
-
- FFBFifo(fmesa, 1);
- ffb->ppc = ppc;
- fmesa->ffbScreen->rp_active = 1;
-
- UNLOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 0;
-}
-
-void ffbDDInitBitmapFuncs(GLcontext *ctx)
-{
- ctx->Driver.Bitmap = ffb_bitmap;
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_bitmap.h b/src/mesa/drivers/dri/ffb/ffb_bitmap.h
deleted file mode 100644
index 0ccbc57bd09..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_bitmap.h
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#ifndef _FFB_BITMAP_H
-#define _FFB_BITMAP_H
-
-extern void ffbDDInitBitmapFuncs(GLcontext *);
-
-#endif /* !(_FFB_BITMAP_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_clear.c b/src/mesa/drivers/dri/ffb/ffb_clear.c
deleted file mode 100644
index aa3fa0a86c5..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_clear.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/mtypes.h"
-
-#include "main/mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_clear.h"
-#include "ffb_lock.h"
-
-#undef CLEAR_TRACE
-
-#define BOX_AREA(__w, __h) ((int)(__w) * (int)(__h))
-
-/* Compute the page aligned box for a page mode fast fill.
- * In 'ework' this returns greater than zero if there are some odd
- * edges to take care of which are outside of the page aligned area.
- * It will place less than zero there if the box is too small,
- * indicating that a different method must be used to fill it.
- */
-#define CreatorPageFillParms(ffp, x, y, w, h, px, py, pw, ph, ework) \
-do { int xdiff, ydiff; \
- int pf_bh = ffp->pagefill_height; \
- int pf_bw = ffp->pagefill_width; \
- py = ((y + (pf_bh - 1)) & ~(pf_bh - 1)); \
- ydiff = py - y; \
- px = ffp->Pf_AlignTab[x + (pf_bw - 1)]; \
- xdiff = px - x; \
- ph = ((h - ydiff) & ~(pf_bh - 1)); \
- if(ph <= 0) \
- ework = -1; \
- else { \
- pw = ffp->Pf_AlignTab[w - xdiff]; \
- if(pw <= 0) { \
- ework = -1; \
- } else { \
- ework = (((xdiff > 0) || \
- (ydiff > 0) || \
- ((w - pw) > 0) || \
- ((h - ph) > 0))) ? 1 : 0; \
- } \
- } \
-} while(0);
-
-struct ff_fixups {
- int x, y, width, height;
-};
-
-/* Compute fixups of non-page aligned areas after a page fill.
- * Return the number of fixups needed.
- */
-static INLINE int
-CreatorComputePageFillFixups(struct ff_fixups *fixups,
- int x, int y, int w, int h,
- int paligned_x, int paligned_y,
- int paligned_w, int paligned_h)
-{
- int nfixups = 0;
-
- /* FastFill Left */
- if(paligned_x != x) {
- fixups[nfixups].x = x;
- fixups[nfixups].y = paligned_y;
- fixups[nfixups].width = paligned_x - x;
- fixups[nfixups].height = paligned_h;
- nfixups++;
- }
- /* FastFill Top */
- if(paligned_y != y) {
- fixups[nfixups].x = x;
- fixups[nfixups].y = y;
- fixups[nfixups].width = w;
- fixups[nfixups].height = paligned_y - y;
- nfixups++;
- }
- /* FastFill Right */
- if((x+w) != (paligned_x+paligned_w)) {
- fixups[nfixups].x = (paligned_x+paligned_w);
- fixups[nfixups].y = paligned_y;
- fixups[nfixups].width = (x+w) - fixups[nfixups].x;
- fixups[nfixups].height = paligned_h;
- nfixups++;
- }
- /* FastFill Bottom */
- if((y+h) != (paligned_y+paligned_h)) {
- fixups[nfixups].x = x;
- fixups[nfixups].y = (paligned_y+paligned_h);
- fixups[nfixups].width = w;
- fixups[nfixups].height = (y+h) - fixups[nfixups].y;
- nfixups++;
- }
- return nfixups;
-}
-
-static void
-ffb_do_clear(GLcontext *ctx, __DRIdrawable *dPriv)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- FFBDRIPtr gDRIPriv = (FFBDRIPtr) fmesa->driScreen->pDevPriv;
- ffb_fbcPtr ffb = fmesa->regs;
- drm_clip_rect_t *box = dPriv->pClipRects;
- int nc = dPriv->numClipRects;
- GLint cx, cy, cw, ch;
-
- /* compute region after locking: */
- cx = ctx->DrawBuffer->_Xmin;
- cy = ctx->DrawBuffer->_Ymin;
- cw = ctx->DrawBuffer->_Xmax - cx;
- ch = ctx->DrawBuffer->_Ymax - cy;
-
- cy = dPriv->h - cy - ch;
- cx += dPriv->x;
- cy += dPriv->y;
-
- while (nc--) {
- GLint x = box[nc].x1;
- GLint y = box[nc].y1;
- GLint width = box[nc].x2 - x;
- GLint height = box[nc].y2 - y;
- int paligned_y, paligned_x;
- int paligned_h, paligned_w = 0;
- int extra_work;
-
- if (BOX_AREA(width, height) < gDRIPriv->fastfill_small_area) {
- FFBFifo(fmesa, 5);
- ffb->drawop = FFB_DRAWOP_RECTANGLE;
- ffb->by = y;
- ffb->bx = x;
- ffb->bh = height;
- ffb->bw = width;
- continue;
- }
-
- FFBFifo(fmesa, 1);
- ffb->drawop = FFB_DRAWOP_FASTFILL;
-
- if (gDRIPriv->disable_pagefill ||
- (width < (gDRIPriv->pagefill_width<<1)) ||
- (height < (gDRIPriv->pagefill_height<<1)))
- goto do_fastfill;
-
- CreatorPageFillParms(gDRIPriv,
- x, y, width, height,
- paligned_x, paligned_y,
- paligned_w, paligned_h, extra_work);
-
- if (extra_work < 0 ||
- BOX_AREA(paligned_w, paligned_h) < gDRIPriv->pagefill_small_area) {
- do_fastfill:
- FFBFifo(fmesa, 10);
- ffb->by = FFB_FASTFILL_COLOR_BLK;
- ffb->dy = 0;
- ffb->dx = 0;
- ffb->bh = gDRIPriv->fastfill_height;
- ffb->bw = (gDRIPriv->fastfill_width * 4);
- ffb->by = FFB_FASTFILL_BLOCK;
- ffb->dy = y;
- ffb->dx = x;
- ffb->bh = (height + (y & (gDRIPriv->fastfill_height - 1)));
- ffb->bx = (width + (x & (gDRIPriv->fastfill_width - 1)));
- continue;
- }
-
- /* Ok, page fill is possible and worth it. */
- FFBFifo(fmesa, 15);
- ffb->by = FFB_FASTFILL_COLOR_BLK;
- ffb->dy = 0;
- ffb->dx = 0;
- ffb->bh = gDRIPriv->fastfill_height;
- ffb->bw = gDRIPriv->fastfill_width * 4;
- ffb->by = FFB_FASTFILL_BLOCK_X;
- ffb->dy = 0;
- ffb->dx = 0;
- ffb->bh = gDRIPriv->pagefill_height;
- ffb->bw = gDRIPriv->pagefill_width * 4;
- ffb->by = FFB_FASTFILL_PAGE;
- ffb->dy = paligned_y;
- ffb->dx = paligned_x;
- ffb->bh = paligned_h;
- ffb->bx = paligned_w;
-
- if (extra_work) {
- struct ff_fixups local_fixups[4];
- int nfixups;
-
- nfixups = CreatorComputePageFillFixups(local_fixups,
- x, y, width, height,
- paligned_x, paligned_y,
- paligned_w, paligned_h);
- FFBFifo(fmesa, 5 + (nfixups * 5));
- ffb->by = FFB_FASTFILL_COLOR_BLK;
- ffb->dy = 0;
- ffb->dx = 0;
- ffb->bh = gDRIPriv->fastfill_height;
- ffb->bw = gDRIPriv->fastfill_width * 4;
-
- while (--nfixups >= 0) {
- int xx, yy, ww, hh;
-
- xx = local_fixups[nfixups].x;
- yy = local_fixups[nfixups].y;
- ffb->dy = yy;
- ffb->dx = xx;
- ww = (local_fixups[nfixups].width +
- (xx & (gDRIPriv->fastfill_width - 1)));
- hh = (local_fixups[nfixups].height +
- (yy & (gDRIPriv->fastfill_height - 1)));
- if (nfixups != 0) {
- ffb->by = FFB_FASTFILL_BLOCK;
- ffb->bh = hh;
- ffb->bw = ww;
- } else {
- ffb->bh = hh;
- ffb->by = FFB_FASTFILL_BLOCK;
- ffb->bx = ww;
- }
- }
- }
- }
-}
-
-void ffbDDClear(GLcontext *ctx, GLbitfield mask)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- unsigned int stcmask = BUFFER_BIT_STENCIL;
-
-#ifdef CLEAR_TRACE
- fprintf(stderr, "ffbDDClear: mask(%08x) \n", mask);
-#endif
- if (!(fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS))
- stcmask = 0;
-
- if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT | BUFFER_BIT_DEPTH | stcmask)) {
- ffb_fbcPtr ffb = fmesa->regs;
- unsigned int fbc, ppc;
-
- fbc = (FFB_FBC_XE_ON);
- ppc = (FFB_PPC_ACE_DISABLE | FFB_PPC_DCE_DISABLE |
- FFB_PPC_ABE_DISABLE | FFB_PPC_VCE_DISABLE |
- FFB_PPC_APE_DISABLE | FFB_PPC_XS_WID |
- FFB_PPC_ZS_CONST | FFB_PPC_CS_CONST);
-
- /* Y/X enables must be both on or both off. */
- if (mask & (BUFFER_BIT_DEPTH | stcmask)) {
- fbc |= (FFB_FBC_ZE_ON | FFB_FBC_YE_ON | FFB_FBC_WB_C);
- } else
- fbc |= FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF;
-
- /* All RGB enables must be both on or both off. */
- if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) {
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_WB_B;
- else
- fbc |= FFB_FBC_WB_A;
- }
- if (mask & BUFFER_BIT_BACK_LEFT) {
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_WB_A;
- else
- fbc |= FFB_FBC_WB_B;
- }
- fbc |= FFB_FBC_RGBE_ON;
- } else
- fbc |= FFB_FBC_RGBE_OFF;
-
- LOCK_HARDWARE(fmesa);
-
- if (dPriv->numClipRects) {
- FFBFifo(fmesa, 8);
- ffb->fbc = fbc;
- ffb->ppc = ppc;
- ffb->xclip = FFB_XCLIP_TEST_ALWAYS;
- ffb->cmp = 0x80808080;
- ffb->rop = FFB_ROP_NEW;
-
- if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT))
- ffb->fg = fmesa->clear_pixel;
- if (mask & BUFFER_BIT_DEPTH)
- ffb->constz = fmesa->clear_depth;
- if (mask & stcmask)
- ffb->consty = fmesa->clear_stencil;
-
- ffb_do_clear(ctx, dPriv);
-
- FFBFifo(fmesa, 6);
- ffb->ppc = fmesa->ppc;
- ffb->fbc = fmesa->fbc;
- ffb->xclip = fmesa->xclip;
- ffb->cmp = fmesa->cmp;
- ffb->rop = fmesa->rop;
- ffb->drawop = fmesa->drawop;
- if (mask & stcmask)
- ffb->consty = fmesa->consty;
- fmesa->ffbScreen->rp_active = 1;
- }
-
- UNLOCK_HARDWARE(fmesa);
-
- mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT |
- BUFFER_BIT_DEPTH | stcmask);
- }
-
- if (mask)
- _swrast_Clear(ctx, mask);
-}
-
diff --git a/src/mesa/drivers/dri/ffb/ffb_clear.h b/src/mesa/drivers/dri/ffb/ffb_clear.h
deleted file mode 100644
index c3b8ce714b3..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_clear.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _FFB_CLEAR_H
-#define _FFB_CLEAR_H
-
-extern void ffbDDClear(GLcontext *ctx, GLbitfield mask);
-
-#endif /* !(_FFB_CLEAR_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_context.h b/src/mesa/drivers/dri/ffb/ffb_context.h
deleted file mode 100644
index 4d1d53ff59f..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_context.h
+++ /dev/null
@@ -1,305 +0,0 @@
-
-#ifndef _FFB_CONTEXT_H
-#define _FFB_CONTEXT_H
-
-#include "dri_util.h"
-#include "drm.h"
-
-#include "main/mtypes.h"
-
-#include "ffb_xmesa.h"
-
-typedef struct {
- GLfloat alpha;
- GLfloat red;
- GLfloat green;
- GLfloat blue;
-} ffb_color;
-
-#define FFB_GET_ALPHA(VTX) \
- FFB_COLOR_FROM_FLOAT((VTX)->color[0].alpha)
-#define FFB_GET_RED(VTX) \
- FFB_COLOR_FROM_FLOAT((VTX)->color[0].red)
-#define FFB_GET_GREEN(VTX) \
- FFB_COLOR_FROM_FLOAT((VTX)->color[0].green)
-#define FFB_GET_BLUE(VTX) \
- FFB_COLOR_FROM_FLOAT((VTX)->color[0].blue)
-
-typedef struct {
- GLfloat x, y, z;
- ffb_color color[2];
-} ffb_vertex;
-
-#define FFB_DELAYED_VIEWPORT_VARS \
- GLfloat VP_SX = fmesa->hw_viewport[MAT_SX]; \
- GLfloat VP_TX = fmesa->hw_viewport[MAT_TX]; \
- GLfloat VP_SY = fmesa->hw_viewport[MAT_SY]; \
- GLfloat VP_TY = fmesa->hw_viewport[MAT_TY]; \
- GLfloat VP_SZ = fmesa->hw_viewport[MAT_SZ]; \
- GLfloat VP_TZ = fmesa->hw_viewport[MAT_TZ]; \
- (void) VP_SX; (void) VP_SY; (void) VP_SZ; \
- (void) VP_TX; (void) VP_TY; (void) VP_TZ
-
-#define FFB_GET_Z(VTX) \
- FFB_Z_FROM_FLOAT(VP_SZ * (VTX)->z + VP_TZ)
-#define FFB_GET_Y(VTX) \
- FFB_XY_FROM_FLOAT(VP_SY * (VTX)->y + VP_TY)
-#define FFB_GET_X(VTX) \
- FFB_XY_FROM_FLOAT(VP_SX * (VTX)->x + VP_TX)
-
-typedef void (*ffb_point_func)(GLcontext *, ffb_vertex *);
-typedef void (*ffb_line_func)(GLcontext *, ffb_vertex *, ffb_vertex *);
-typedef void (*ffb_tri_func)(GLcontext *, ffb_vertex *, ffb_vertex *,
- ffb_vertex *);
-typedef void (*ffb_quad_func)(GLcontext *, ffb_vertex *, ffb_vertex *,
- ffb_vertex *, ffb_vertex *);
-
-/* Immediate mode fast-path support. */
-typedef struct {
- GLfloat obj[4];
- GLfloat normal[4];
- GLfloat clip[4];
- GLuint mask;
- GLfloat color[4];
- GLfloat win[4];
- GLfloat eye[4];
-} ffbTnlVertex, *ffbTnlVertexPtr;
-
-typedef void (*ffb_interp_func)(GLfloat t,
- ffbTnlVertex *O,
- const ffbTnlVertex *I,
- const ffbTnlVertex *J);
-
-struct ffb_current_state {
- GLfloat color[4];
- GLfloat normal[4];
- GLfloat specular[4];
-};
-
-struct ffb_light_state {
- GLfloat base_color[3];
- GLfloat base_alpha;
-};
-
-struct ffb_vertex_state {
- struct ffb_current_state current;
- struct ffb_light_state light;
-};
-
-struct ffb_imm_vertex {
- ffbTnlVertex vertices[8];
- ffbTnlVertex *v0;
- ffbTnlVertex *v1;
- ffbTnlVertex *v2;
- ffbTnlVertex *v3;
-
- void (*save_vertex)(GLcontext *ctx, ffbTnlVertex *v);
- void (*flush_vertex)(GLcontext *ctx, ffbTnlVertex *v);
-
- ffb_interp_func interp;
-
- GLuint prim, format;
-
- GLvertexformat vtxfmt;
-};
-
-typedef struct ffb_context_t {
- GLcontext *glCtx;
- GLframebuffer *glBuffer;
-
- ffb_fbcPtr regs;
- volatile char *sfb32;
-
- int hw_locked;
-
- int back_buffer; /* 0 = bufferA, 1 = bufferB */
-
- /* Viewport matrix. */
- GLfloat hw_viewport[16];
-#define SUBPIXEL_X (-0.5F)
-#define SUBPIXEL_Y (-0.5F + 0.125)
-
- /* Vertices in driver format. */
- ffb_vertex *verts;
-
- /* Rasterization functions. */
- ffb_point_func draw_point;
- ffb_line_func draw_line;
- ffb_tri_func draw_tri;
- ffb_quad_func draw_quad;
-
- GLenum raster_primitive;
- GLenum render_primitive;
-
- GLfloat backface_sign;
- GLfloat depth_scale;
-
- GLfloat ffb_2_30_fixed_scale;
- GLfloat ffb_one_over_2_30_fixed_scale;
- GLfloat ffb_16_16_fixed_scale;
- GLfloat ffb_one_over_16_16_fixed_scale;
- GLfloat ffb_ubyte_color_scale;
- GLfloat ffb_zero;
-
- /* Immediate mode state. */
- struct ffb_vertex_state vtx_state;
- struct ffb_imm_vertex imm;
-
- /* Debugging knobs. */
- GLboolean debugFallbacks;
-
- /* This records state bits when a per-fragment attribute has
- * been set which prevents us from rendering in hardware.
- *
- * As attributes change, some of these bits may clear as
- * we move back within the chips capabilities. If they
- * all clear, we return to full hw rendering.
- */
- unsigned int bad_fragment_attrs;
-#define FFB_BADATTR_FOG 0x00000001 /* Bad fog possible only when < FFB2 */
-#define FFB_BADATTR_BLENDFUNC 0x00000002 /* Any non-const func based upon dst alpha */
-#define FFB_BADATTR_BLENDROP 0x00000004 /* Blend enabled and LogicOP != GL_COPY */
-#define FFB_BADATTR_BLENDEQN 0x00000008 /* Blend equation other than ADD */
-#define FFB_BADATTR_STENCIL 0x00000010 /* Stencil enabled when < FFB2+ */
-#define FFB_BADATTR_TEXTURE 0x00000020 /* Texture enabled */
-#define FFB_BADATTR_SWONLY 0x00000040 /* Environment var set */
-
- unsigned int state_dirty;
- unsigned int state_fifo_ents;
-#define FFB_STATE_FBC 0x00000001
-#define FFB_STATE_PPC 0x00000002
-#define FFB_STATE_DRAWOP 0x00000004
-#define FFB_STATE_ROP 0x00000008
-#define FFB_STATE_LPAT 0x00000010
-#define FFB_STATE_PMASK 0x00000020
-#define FFB_STATE_XPMASK 0x00000040
-#define FFB_STATE_YPMASK 0x00000080
-#define FFB_STATE_ZPMASK 0x00000100
-#define FFB_STATE_XCLIP 0x00000200
-#define FFB_STATE_CMP 0x00000400
-#define FFB_STATE_MATCHAB 0x00000800
-#define FFB_STATE_MAGNAB 0x00001000
-#define FFB_STATE_MATCHC 0x00002000
-#define FFB_STATE_MAGNC 0x00004000
-#define FFB_STATE_DCUE 0x00008000
-#define FFB_STATE_BLEND 0x00010000
-#define FFB_STATE_CLIP 0x00020000
-#define FFB_STATE_STENCIL 0x00040000
-#define FFB_STATE_APAT 0x00080000
-#define FFB_STATE_WID 0x00100000
-#define FFB_STATE_ALL 0x001fffff
-
- unsigned int state_all_fifo_ents;
-
-#define FFB_MAKE_DIRTY(FMESA, STATE_MASK, FIFO_ENTS) \
-do { if ((STATE_MASK) & ~((FMESA)->state_dirty)) { \
- (FMESA)->state_dirty |= (STATE_MASK); \
- (FMESA)->state_fifo_ents += FIFO_ENTS; \
- } \
-} while (0)
-
- /* General hw reg state. */
- unsigned int fbc;
- unsigned int ppc;
- unsigned int drawop;
- unsigned int rop;
-
- unsigned int lpat;
-#define FFB_LPAT_BAD 0xffffffff
-
- unsigned int wid;
- unsigned int pmask;
- unsigned int xpmask;
- unsigned int ypmask;
- unsigned int zpmask;
- unsigned int xclip;
- unsigned int cmp;
- unsigned int matchab;
- unsigned int magnab;
- unsigned int matchc;
- unsigned int magnc;
-
- /* Depth cue unit hw reg state. */
- unsigned int dcss; /* All FFB */
- unsigned int dcsf; /* All FFB */
- unsigned int dcsb; /* All FFB */
- unsigned int dczf; /* All FFB */
- unsigned int dczb; /* All FFB */
- unsigned int dcss1; /* >=FFB2 only */
- unsigned int dcss2; /* >=FFB2 only */
- unsigned int dcss3; /* >=FFB2 only */
- unsigned int dcs2; /* >=FFB2 only */
- unsigned int dcs3; /* >=FFB2 only */
- unsigned int dcs4; /* >=FFB2 only */
- unsigned int dcd2; /* >=FFB2 only */
- unsigned int dcd3; /* >=FFB2 only */
- unsigned int dcd4; /* >=FFB2 only */
-
- /* Blend unit hw reg state. */
- unsigned int blendc;
- unsigned int blendc1;
- unsigned int blendc2;
-
- /* ViewPort clipping hw reg state. */
- unsigned int vclipmin;
- unsigned int vclipmax;
- unsigned int vclipzmin;
- unsigned int vclipzmax;
- struct {
- unsigned int min;
- unsigned int max;
- } aux_clips[4];
-
- /* Stencil control hw reg state. >=FFB2+ only. */
- unsigned int stencil;
- unsigned int stencilctl;
- unsigned int consty; /* Stencil Ref */
-
- /* Area pattern (used for polygon stipples). */
- unsigned int pattern[32];
-
- /* Fog state. */
- float Znear, Zfar;
-
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
- int driFd;
-
- unsigned int clear_pixel;
- unsigned int clear_depth;
- unsigned int clear_stencil;
-
- unsigned int setupindex;
- unsigned int setupnewinputs;
- unsigned int new_gl_state;
-
- __DRIdrawable *driDrawable;
- __DRIscreen *driScreen;
- ffbScreenPrivate *ffbScreen;
- ffb_dri_state_t *ffb_sarea;
-} ffbContextRec, *ffbContextPtr;
-
-#define FFB_CONTEXT(ctx) ((ffbContextPtr)((ctx)->DriverCtx))
-
-/* We want the depth values written during software rendering
- * to match what the hardware is going to put there when we
- * hw render.
- *
- * The Z buffer is 28 bits deep. Smooth shaded primitives
- * specify a 2:30 signed fixed point Z value in the range 0.0
- * to 1.0 inclusive.
- *
- * So for example, when hw rendering, the largest Z value of
- * 1.0 would produce a value of 0x0fffffff in the actual Z
- * buffer, which is the maximum value.
- *
- * Mesa's depth type is a 32-bit uint, so we use the following macro
- * to convert to/from FFB hw Z values. Note we also have to clear
- * out the top bits as that is where the Y (stencil) buffer is stored
- * and during hw Z buffer reads it is always there. (During writes
- * we tell the hw to discard those top 4 bits).
- */
-#define Z_TO_MESA(VAL) ((GLuint)(((VAL) & 0x0fffffff) << (32 - 28)))
-#define Z_FROM_MESA(VAL) (((GLuint)((GLdouble)(VAL))) >> (32 - 28))
-
-#endif /* !(_FFB_CONTEXT_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_dd.c b/src/mesa/drivers/dri/ffb/ffb_dd.c
deleted file mode 100644
index 91b6d3153af..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_dd.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/mtypes.h"
-#include "main/mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_clear.h"
-#include "ffb_lock.h"
-
-#define FFB_DATE "20021125"
-
-PUBLIC const char __driConfigOptions[] = { 0 };
-const GLuint __driNConfigOptions = 0;
-
-/* Mesa's Driver Functions */
-
-static const GLubyte *ffbDDGetString(GLcontext *ctx, GLenum name)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- static char buffer[128];
-
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *) "David S. Miller";
-
- case GL_RENDERER:
- sprintf(buffer, "Mesa DRI FFB " FFB_DATE);
-
- if (fmesa->ffb_sarea->flags & FFB_DRI_FFB2)
- strncat(buffer, " FFB2", 5);
- if (fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS)
- strncat(buffer, " FFB2PLUS", 9);
- if (fmesa->ffb_sarea->flags & FFB_DRI_PAC1)
- strncat(buffer, " PAC1", 5);
- if (fmesa->ffb_sarea->flags & FFB_DRI_PAC2)
- strncat(buffer, " PAC2", 5);
-
-#ifdef USE_SPARC_ASM
- strncat(buffer, " Sparc", 6);
-#endif
-
- return (GLubyte *) buffer;
-
- default:
- return NULL;
- };
-}
-
-
-static void ffbBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- LOCK_HARDWARE(fmesa);
- *width = fmesa->driDrawable->w;
- *height = fmesa->driDrawable->h;
- UNLOCK_HARDWARE(fmesa);
-}
-
-void ffbDDExtensionsInit(GLcontext *ctx)
-{
- /* Nothing for now until we start to add
- * real acceleration. -DaveM
- */
-
- /* XXX Need to turn off GL_EXT_blend_func_separate for one.
- * XXX Also BlendEquation should be turned off too, what
- * XXX EXT is that assosciated with?
- */
-}
-
-static void ffbDDFinish(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- LOCK_HARDWARE(fmesa);
- FFBWait(fmesa, fmesa->regs);
- UNLOCK_HARDWARE(fmesa);
-}
-
-void ffbDDInitDriverFuncs(GLcontext *ctx)
-{
- ctx->Driver.GetBufferSize = ffbBufferSize;
- ctx->Driver.GetString = ffbDDGetString;
- ctx->Driver.Clear = ffbDDClear;
-
- ctx->Driver.Finish = ffbDDFinish;
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_dd.h b/src/mesa/drivers/dri/ffb/ffb_dd.h
deleted file mode 100644
index 1198cda30a1..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_dd.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D.
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#ifndef _FFB_DD_H
-#define _FFB_DD_H
-
-#include "main/context.h"
-
-void ffbDDInitDriverFuncs(GLcontext *ctx);
-void ffbDDExtensionsInit(GLcontext *ctx);
-
-#endif /* !(_FFB_DD_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_depth.c b/src/mesa/drivers/dri/ffb/ffb_depth.c
deleted file mode 100644
index d19385b776b..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_depth.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/mtypes.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_depth.h"
-#include "ffb_lock.h"
-
-
-#undef DEPTH_TRACE
-
-static void FFBWriteDepthSpan( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *values,
- const GLubyte mask[] )
-{
- const GLuint *depth = (const GLuint *) values;
-#ifdef DEPTH_TRACE
- fprintf(stderr, "FFBWriteDepthSpan: n(%d) x(%d) y(%d)\n",
- (int) n, x, y);
-#endif
- if (ctx->Depth.Mask) {
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- GLuint *zptr;
- GLuint i;
-
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = (FFB_FBC_WB_C | FFB_FBC_ZE_ON |
- FFB_FBC_YE_OFF | FFB_FBC_RGBE_OFF);
- fmesa->regs->ppc = FFB_PPC_ZS_VAR;
- FFBWait(fmesa, fmesa->regs);
-
- y = (dPriv->h - y);
- zptr = (GLuint *)
- ((char *)fmesa->sfb32 +
- ((dPriv->x + x) << 2) +
- ((dPriv->y + y) << 13));
-
- for (i = 0; i < n; i++) {
- if (mask[i]) {
- *zptr = Z_FROM_MESA(depth[i]);
- }
- zptr++;
- }
-
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->regs->ppc = fmesa->ppc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
- }
-}
-
-static void FFBWriteMonoDepthSpan( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *value, const GLubyte mask[] )
-{
- const GLuint depthVal = *((GLuint *) value);
- GLuint depths[MAX_WIDTH];
- GLuint i;
- for (i = 0; i < n; i++)
- depths[i] = depthVal;
- FFBWriteDepthSpan(ctx, rb, n, x, y, depths, mask);
-}
-
-static void FFBWriteDepthPixels( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const void *values,
- const GLubyte mask[] )
-{
- const GLuint *depth = (const GLuint *) values;
-#ifdef DEPTH_TRACE
- fprintf(stderr, "FFBWriteDepthPixels: n(%d)\n", (int) n);
-#endif
- if (ctx->Depth.Mask) {
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- char *zbase;
- GLuint i;
-
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = (FFB_FBC_WB_C | FFB_FBC_ZE_ON |
- FFB_FBC_YE_OFF | FFB_FBC_RGBE_OFF);
- fmesa->regs->ppc = FFB_PPC_ZS_VAR;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- zbase = ((char *)fmesa->sfb32 +
- (dPriv->x << 2) + (dPriv->y << 13));
-
- for (i = 0; i < n; i++) {
- GLint y1 = (dPriv->h - y[i]);
- GLint x1 = x[i];
- GLuint *zptr;
-
- zptr = (GLuint *)
- (zbase + (x1 << 2) + (y1 << 13));
- if (mask[i])
- *zptr = Z_FROM_MESA(depth[i]);
- }
-
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->regs->ppc = fmesa->ppc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
- }
-}
-
-static void FFBReadDepthSpan( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- void *values )
-{
- GLuint *depth = (GLuint *) values;
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- GLuint *zptr;
- GLuint i;
-
-#ifdef DEPTH_TRACE
- fprintf(stderr, "FFBReadDepthSpan: n(%d) x(%d) y(%d)\n",
- (int) n, x, y);
-#endif
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = FFB_FBC_RB_C;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- y = (dPriv->h - y);
- zptr = (GLuint *)
- ((char *)fmesa->sfb32 +
- ((dPriv->x + x) << 2) +
- ((dPriv->y + y) << 13));
-
- for (i = 0; i < n; i++) {
- depth[i] = Z_TO_MESA(*zptr);
- zptr++;
- }
-
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
-}
-
-static void FFBReadDepthPixels( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[], const GLint y[],
- void *values )
-{
- GLuint *depth = (GLuint *) values;
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- char *zbase;
- GLuint i;
-
-#ifdef DEPTH_TRACE
- fprintf(stderr, "FFBReadDepthPixels: n(%d)\n", (int) n);
-#endif
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = FFB_FBC_RB_C;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- zbase = ((char *)fmesa->sfb32 +
- (dPriv->x << 2) + (dPriv->y << 13));
-
- for (i = 0; i < n; i++) {
- GLint y1 = (dPriv->h - y[i]);
- GLint x1 = x[i];
- GLuint *zptr;
-
- zptr = (GLuint *)
- (zbase + (x1 << 2) + (y1 << 13));
- depth[i] = Z_TO_MESA(*zptr);
- }
-
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
-}
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-ffbSetDepthFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- assert(drb->Base.InternalFormat == GL_DEPTH_COMPONENT16);
- drb->Base.GetRow = FFBReadDepthSpan;
- drb->Base.GetValues = FFBReadDepthPixels;
- drb->Base.PutRow = FFBWriteDepthSpan;
- drb->Base.PutMonoRow = FFBWriteMonoDepthSpan;
- drb->Base.PutValues = FFBWriteDepthPixels;
- drb->Base.PutMonoValues = NULL;
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_depth.h b/src/mesa/drivers/dri/ffb/ffb_depth.h
deleted file mode 100644
index 8a1829ed494..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_depth.h
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#ifndef _FFB_DEPTH_H
-#define _FFB_DEPTH_H
-
-void ffbSetDepthFunctions(driRenderbuffer *drb, const GLvisual *vis);
-
-#endif /* !(_FFB_DEPTH_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_fifo.h b/src/mesa/drivers/dri/ffb/ffb_fifo.h
deleted file mode 100644
index a175f38643d..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_fifo.h
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#ifndef _FFB_FIFO_H
-#define _FFB_FIFO_H
-
-#define FFBFifo(__fmesa, __n) \
-do { ffbScreenPrivate *__fScrn = (__fmesa)->ffbScreen; \
- int __cur_slots = __fScrn->fifo_cache; \
- if ((__cur_slots - (__n)) < 0) { \
- ffb_fbcPtr __ffb = __fmesa->regs; \
- do { __cur_slots = (((int)__ffb->ucsr & FFB_UCSR_FIFO_MASK) - 4); \
- } while ((__cur_slots - (__n)) < 0); \
- } (__fScrn)->fifo_cache = (__cur_slots - (__n)); \
-} while(0)
-
-#define FFBWait(__fmesa, __ffb) \
-do { ffbScreenPrivate *__fScrn = (__fmesa)->ffbScreen; \
- if (__fScrn->rp_active) { \
- unsigned int __regval = (__ffb)->ucsr; \
- while((__regval & FFB_UCSR_ALL_BUSY) != 0) { \
- __regval = (__ffb)->ucsr; \
- } \
- __fScrn->fifo_cache = ((int)(__regval & FFB_UCSR_FIFO_MASK)) - 4; \
- __fScrn->rp_active = 0; \
- } \
-} while(0)
-
-#endif /* !(_FFB_FIFO_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_fog.c b/src/mesa/drivers/dri/ffb/ffb_fog.c
deleted file mode 100644
index e6eca2390ee..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_fog.c
+++ /dev/null
@@ -1,73 +0,0 @@
-
-/* FFB fog support:
- *
- * There are two levels of support for FOG in the Creator3D series.
- * Both involve a depth cue unit and 1 or 4 slope factors and scales
- * for varying the pixel intensity.
- *
- * Chips prior to FFB2 only have a single set of such settings, FFB2
- * and later have 4 settings.
- *
- * The basic depth cueing equation is:
- *
- * C_final = dcsf(z) * C_orig + (1 - dcsf(z)) * C_fog
- *
- * C_final -- The final color passed to blend unit or frame
- * buffer (if blending is disabled).
- *
- * C_orig -- The color we start with, which comes either from
- * the raster processor or cpu writes to the smart
- * framebuffer aperture.
- *
- * C_fog -- This is the "fog" color, ie. the desired color
- * at the deepest Z.
- *
- * dcsf(z) -- The depth cue scale as a function of Z.
- *
- * With pre-FFB2 chips there are four parameters to control the depth
- * cue scaling. Here is a diagram:
- *
- * 1.0 -------------
- * | | | |
- * | | | |
- * Sfront XXXXX---+---+
- * | |X | |
- * dcsf(z) | | X | |
- * | | X| |
- * Sback +---+---XXXXX
- * | | | |
- * 0.0 -------------
- * 0.0 Zf Zb 1.0
- *
- * z
- * Therefore:
- *
- * for Zf < z < Zb
- *
- * dcsf(z) = Sback + ((Sfront - Sback) / (Zf - Zb)) * (Zb - z)
- *
- * for z <= Zf
- *
- * dcsf(z) = Sfront
- *
- * for z >= Zb
- *
- * dcsf(z) = Sback
- *
- * With FFB2 and later, 3 more slope regions are provided, the first of
- * them starts at the end of the region defined above and ends at a
- * specified depth value, the next slop region starts there and ends
- * at the next specified depth value, and so on. Each of the 3 slope
- * regions also have scale and slope settings of their own.
- *
- * The C_fog color is programmed into the alpha blending unit color1
- * and color2 registers as follows:
- *
- * color1: -(C_fog)
- * color2: C_fog - bg
- *
- * If alpha blending is disabled, the bg factor is zero. Note that
- * the alpha blending color registers specify each of the RGB values
- * as 9 bit 1:8 signed numbers in the range -1.00 to 0.ff inclusive.
- * (ie. 0x100 == -1.00 and 0x0ff == +0.ff)
- */
diff --git a/src/mesa/drivers/dri/ffb/ffb_lines.c b/src/mesa/drivers/dri/ffb/ffb_lines.c
deleted file mode 100644
index 6dca4edd29b..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_lines.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/mtypes.h"
-#include "main/mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_lines.h"
-
-#undef FFB_LINE_TRACE
-
-#define FFB_LINE_FLAT_BIT 0x01
-#define FFB_LINE_ALPHA_BIT 0x02
-#define MAX_FFB_LINE_FUNCS 0x04
-
-static ffb_line_func ffb_line_tab[MAX_FFB_LINE_FUNCS];
-
-/* If the line is not wide, we can support all of the line
- * patterning and smooth shading features of OpenGL fully.
- */
-
-#define IND (0)
-#define TAG(x) x
-#include "ffb_linetmp.h"
-
-#define IND (FFB_LINE_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "ffb_linetmp.h"
-
-#define IND (FFB_LINE_ALPHA_BIT)
-#define TAG(x) x##_alpha
-#include "ffb_linetmp.h"
-
-#define IND (FFB_LINE_ALPHA_BIT|FFB_LINE_FLAT_BIT)
-#define TAG(x) x##_alpha_flat
-#include "ffb_linetmp.h"
-
-void ffbDDLinefuncInit(void)
-{
- init();
- init_flat();
- init_alpha();
- init_alpha_flat();
-}
-
-static void ffb_dd_line( GLcontext *ctx, GLuint e0, GLuint e1 )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_vertex *v0 = &fmesa->verts[e0];
- ffb_vertex *v1 = &fmesa->verts[e1];
- fmesa->draw_line( ctx, v0, v1 );
-}
-
-void ffbChooseLineState(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- tnl->Driver.Render.Line = ffb_dd_line;
-
- if (flags & DD_FLATSHADE)
- ind |= FFB_LINE_FLAT_BIT;
-
- if ((flags & DD_LINE_STIPPLE) != 0 &&
- fmesa->lpat == FFB_LPAT_BAD) {
- fmesa->draw_line = ffb_fallback_line;
- return;
- }
-
- /* If blending or the alpha test is enabled we need to
- * provide alpha components to the chip, else we can
- * do without it and thus feed vertex data to the chip
- * more efficiently.
- */
- if (ctx->Color.BlendEnabled || ctx->Color.AlphaEnabled)
- ind |= FFB_LINE_ALPHA_BIT;
-
- fmesa->draw_line = ffb_line_tab[ind];
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_lines.h b/src/mesa/drivers/dri/ffb/ffb_lines.h
deleted file mode 100644
index ddb93656539..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_lines.h
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#ifndef _FFB_LINES_H
-#define _FFB_LINES_H
-
-#include "ffb_context.h"
-
-#define _FFB_NEW_LINE (_DD_NEW_FLATSHADE | \
- _DD_NEW_LINE_WIDTH | \
- _DD_NEW_LINE_STIPPLE | \
- _DD_NEW_LINE_SMOOTH | \
- _NEW_COLOR)
-
-extern void ffbDDLinefuncInit(void);
-extern void ffbChooseLineState(GLcontext *);
-extern void ffb_fallback_line( GLcontext *ctx, ffb_vertex *v0, ffb_vertex *v1 );
-
-#endif /* !(_FFB_LINES_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_linetmp.h b/src/mesa/drivers/dri/ffb/ffb_linetmp.h
deleted file mode 100644
index 10e1375259b..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_linetmp.h
+++ /dev/null
@@ -1,80 +0,0 @@
-
-static INLINE void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0,
- ffb_vertex *v1 )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
-#if (IND & FFB_LINE_FLAT_BIT)
- const GLuint const_fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( v1->color[0] );
-#endif
- FFB_DELAYED_VIEWPORT_VARS;
-
-#ifdef FFB_LINE_TRACE
- fprintf(stderr, "FFB: ffb_line ["
-#if (IND & FFB_LINE_FLAT_BIT)
- " FLAT"
-#endif
-#if (IND & FFB_LINE_ALPHA_BIT)
- " ALPHA"
-#endif
- " ]\n");
-#endif
-
-#if (IND & FFB_LINE_FLAT_BIT)
- FFBFifo(fmesa, 1);
- ffb->fg = const_fg;
-#ifdef FFB_LINE_TRACE
- fprintf(stderr, "FFB: ffb_line confg_fg[%08x]\n", const_fg);
-#endif
-#endif
-
-#if (IND & FFB_LINE_FLAT_BIT)
- /* (2 * 3) + 1 */
- FFBFifo(fmesa, 7);
-#else
-#if (IND & FFB_LINE_ALPHA_BIT)
- /* (2 * 7) + 1 */
- FFBFifo(fmesa, 15);
-#else
- /* (2 * 6) + 1 */
- FFBFifo(fmesa, 13);
-#endif
-#endif
-
- /* Using DDLINE or AALINE, init the line pattern state. */
- ffb->lpat = fmesa->lpat;
-
-#if !(IND & FFB_LINE_FLAT_BIT)
-#if (IND & FFB_LINE_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v0);
-#endif
- ffb->red = FFB_GET_RED(v0);
- ffb->green = FFB_GET_GREEN(v0);
- ffb->blue = FFB_GET_BLUE(v0);
-#endif
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
-#if !(IND & FFB_LINE_FLAT_BIT)
-#if (IND & FFB_LINE_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v1);
-#endif
- ffb->red = FFB_GET_RED(v1);
- ffb->green = FFB_GET_GREEN(v1);
- ffb->blue = FFB_GET_BLUE(v1);
-#endif
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(init)(void)
-{
- ffb_line_tab[IND] = TAG(ffb_line);
-}
-
-#undef IND
-#undef TAG
diff --git a/src/mesa/drivers/dri/ffb/ffb_lock.h b/src/mesa/drivers/dri/ffb/ffb_lock.h
deleted file mode 100644
index 1fd3eb55125..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_lock.h
+++ /dev/null
@@ -1,36 +0,0 @@
-
-#ifndef _FFB_LOCK_H
-#define _FFB_LOCK_H
-
-#include "ffb_context.h"
-
-extern void ffbXMesaUpdateState(ffbContextPtr fmesa);
-#define FFB_UPDATE_STATE(fmesa) ffbXMesaUpdateState(fmesa)
-
-/* Lock the hardware and validate our state. This hardware can only ever
- * exist on SPARC platforms. Don't bother building the real LOCK_HARDWARE and
- * UNLOCK_HARDWARE code on non-SPARC platforms. The only reason the driver
- * gets built on non-SPARC is to catch build breakages earlier.
- */
-#if !defined(__sparc__)
-#define LOCK_HARDWARE(fmesa)
-#define UNLOCK_HARDWARE(fmesa)
-#else
-#define LOCK_HARDWARE(fmesa) \
- do { \
- DRM_CAS_RESULT(__ret); \
- DRM_CAS(fmesa->driHwLock, fmesa->hHWContext, \
- (DRM_LOCK_HELD | fmesa->hHWContext), __ret);\
- if (__ret) { \
- drmGetLock(fmesa->driFd, fmesa->hHWContext, 0); \
- FFB_UPDATE_STATE(fmesa); \
- } \
- } while (0)
-
-
-/* Unlock the hardware. */
-#define UNLOCK_HARDWARE(fmesa) \
- DRM_UNLOCK(fmesa->driFd, fmesa->driHwLock, fmesa->hHWContext);
-#endif
-
-#endif /* !(_FFB_LOCK_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_points.c b/src/mesa/drivers/dri/ffb/ffb_points.c
deleted file mode 100644
index 5bf4f8f0707..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_points.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/mtypes.h"
-#include "ffb_dd.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_points.h"
-
-
-#undef FFB_POINT_TRACE
-
-#define FFB_POINT_AA_BIT 0x01
-
-static ffb_point_func ffb_point_tab[0x08];
-
-#define IND (0)
-#define TAG(x) x
-#include "ffb_pointtmp.h"
-
-#define IND (FFB_POINT_AA_BIT)
-#define TAG(x) x##_aa
-#include "ffb_pointtmp.h"
-
-void ffbDDPointfuncInit(void)
-{
- init();
- init_aa();
-}
-
-static void ffb_dd_points( GLcontext *ctx, GLuint first, GLuint last )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_vertex *fverts = fmesa->verts;
- int i;
-
- if (VB->Elts == 0) {
- for ( i = first ; i < last ; i++ ) {
- if ( VB->ClipMask[i] == 0 ) {
- fmesa->draw_point( ctx, &fverts[i] );
- }
- }
- } else {
- for ( i = first ; i < last ; i++ ) {
- GLuint e = VB->Elts[i];
- if ( VB->ClipMask[e] == 0 ) {
- fmesa->draw_point( ctx, &fverts[e] );
- }
- }
- }
-}
-
-void ffbChoosePointState(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- tnl->Driver.Render.Points = ffb_dd_points;
-
- if (flags & DD_POINT_SMOOTH)
- ind |= FFB_POINT_AA_BIT;
-
- fmesa->draw_point = ffb_point_tab[ind];
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_points.h b/src/mesa/drivers/dri/ffb/ffb_points.h
deleted file mode 100644
index a7229de7f19..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_points.h
+++ /dev/null
@@ -1,14 +0,0 @@
-
-#ifndef _FFB_POINTS_H
-#define _FFB_POINTS_H
-
-extern void ffbDDPointfuncInit(void);
-
-#define _FFB_NEW_POINT (_DD_NEW_POINT_SIZE | \
- _DD_NEW_POINT_SMOOTH | \
- _NEW_COLOR)
-
-extern void ffbChoosePointState(GLcontext *);
-extern void ffb_fallback_point( GLcontext *ctx, ffb_vertex *v0 );
-
-#endif /* !(_FFB_POINTS_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_pointtmp.h b/src/mesa/drivers/dri/ffb/ffb_pointtmp.h
deleted file mode 100644
index 3003de70c69..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_pointtmp.h
+++ /dev/null
@@ -1,54 +0,0 @@
-
-static INLINE void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
- FFB_DELAYED_VIEWPORT_VARS;
-
-#ifdef FFB_POINT_TRACE
- fprintf(stderr, "FFB: ffb_point ["
-#if (IND & FFB_POINT_AA_BIT)
- "AA"
-#endif
- "] X(%f) Y(%f) Z(%f)\n",
- tmp->x, tmp->y, tmp->z);
-#endif
-
-#if (IND & FFB_POINT_AA_BIT)
- FFBFifo(fmesa, 4);
-
- ffb->fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( tmp->color[0] );
- ffb->z = FFB_GET_Z(tmp);
- ffb->y = FFB_GET_Y(tmp) + 0x8000 /* FIX ME */;
- ffb->x = FFB_GET_X(tmp) + 0x8000 /* FIX ME */;
-#else
- {
- unsigned int const_fg, const_z, h, w;
-
- const_fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( tmp->color[0] );
- const_z = Z_FROM_MESA(FFB_Z_TO_FLOAT(FFB_GET_Z(tmp)));
- h = FFB_GET_Y(tmp) >> 16;
- w = FFB_GET_X(tmp) >> 16;
-#ifdef FFB_POINT_TRACE
- fprintf(stderr, "FFB: ffb_point fg(%08x) z(%08x) h(%08x) w(%08x)\n",
- const_fg, const_z, h, w);
-#endif
- FFBFifo(fmesa, 4);
- ffb->fg = const_fg;
- ffb->constz = const_z;
- ffb->bh = h;
- ffb->bw = w;
- }
-#endif
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-
-static void TAG(init)(void)
-{
- ffb_point_tab[IND] = TAG(ffb_draw_point);
-}
-
-#undef IND
-#undef TAG
diff --git a/src/mesa/drivers/dri/ffb/ffb_rendertmp.h b/src/mesa/drivers/dri/ffb/ffb_rendertmp.h
deleted file mode 100644
index 64141c2c5f6..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_rendertmp.h
+++ /dev/null
@@ -1,645 +0,0 @@
-
-#define IMPL_LOCAL_VARS \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- ffb_fbcPtr ffb = fmesa->regs; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- FFB_DELAYED_VIEWPORT_VARS; \
- (void) fmesa; (void) ffb; (void) elt
-
-#if (IND & FFB_FLAT_BIT)
-#define FFB_DECLARE_CACHED_COLOR(NAME) \
- unsigned int NAME;
-#define FFB_COMPUTE_CACHED_COLOR(NAME, VTX) \
- NAME = FFB_PACK_CONST_UBYTE_ARGB_COLOR((VTX)->color[0])
-#define FFB_CACHED_COLOR_SAME(NAME1, NAME2) \
- ((NAME1) == (NAME2))
-#define FFB_CACHED_COLOR_SET(NAME) \
- ffb->fg = (NAME)
-#define FFB_CACHED_COLOR_UPDATE(NAME1, NAME2) \
- ffb->fg = (NAME1) = (NAME2)
-#define FFB_SET_PRIM_COLOR(COLOR_VERTEX) \
- ffb->fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR((COLOR_VERTEX)->color[0])
-#define FFB_PRIM_COLOR_COST 1
-#define FFB_SET_VERTEX_COLOR(VTX) /**/
-#define FFB_VERTEX_COLOR_COST 0
-#else
-#define FFB_DECLARE_CACHED_COLOR(NAME) /**/
-#define FFB_COMPUTE_CACHED_COLOR(NAME, VTX) /**/
-#define FFB_CACHED_COLOR_SAME(NAME1, NAME2) 0
-#define FFB_CACHED_COLOR_SET(NAME1) /**/
-#define FFB_CACHED_COLOR_UPDATE(NAME1, NAME2) /**/
-#define FFB_SET_PRIM_COLOR(COLOR_VERTEX) /**/
-#define FFB_PRIM_COLOR_COST 0
-#if (IND & FFB_ALPHA_BIT)
-#define FFB_SET_VERTEX_COLOR(VTX) \
- ffb->alpha = FFB_GET_ALPHA(VTX); \
- ffb->red = FFB_GET_RED(VTX); \
- ffb->green = FFB_GET_GREEN(VTX); \
- ffb->blue = FFB_GET_BLUE(VTX)
-#define FFB_VERTEX_COLOR_COST 4
-#else
-#define FFB_SET_VERTEX_COLOR(VTX) \
- ffb->red = FFB_GET_RED(VTX); \
- ffb->green = FFB_GET_GREEN(VTX); \
- ffb->blue = FFB_GET_BLUE(VTX)
-#define FFB_VERTEX_COLOR_COST 3
-#endif
-#endif
-
-#define RESET_STIPPLE ffb->lpat = fmesa->lpat;
-
-#if !(IND & (FFB_TRI_CULL_BIT))
-static void TAG(ffb_vb_points)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_POINTS);
- if (ctx->_TriangleCaps & DD_POINT_SMOOTH) {
- for (i = start; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i)];
-
- FFBFifo(fmesa, 4);
- ffb->fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR(v0->color[0]);
- ffb->z = FFB_GET_Z(v0);
- ffb->y = FFB_GET_Y(v0) + 0x8000 /* FIX ME */;
- ffb->x = FFB_GET_X(v0) + 0x8000 /* FIX ME */;
- }
- } else {
- for (i = start; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i)];
- FFBFifo(fmesa, 4);
- ffb->fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR(v0->color[0]);
- ffb->constz = Z_FROM_MESA(FFB_Z_TO_FLOAT(FFB_GET_Z(v0)));
- ffb->bh = FFB_GET_Y(v0) >> 16;
- ffb->bw = FFB_GET_X(v0) >> 16;
- }
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_lines)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_LINES);
- for (i = start + 1; i < count; i += 2) {
- ffb_vertex *v0 = &fmesa->verts[i - 1];
- ffb_vertex *v1 = &fmesa->verts[i - 0];
-
- FFBFifo(fmesa, (1 + FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 2) + 6));
-
- RESET_STIPPLE;
-
- FFB_SET_PRIM_COLOR(v1);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
- }
-}
-
-static void TAG(ffb_vb_line_loop)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_LINE_LOOP);
- if ((flags & PRIM_BEGIN) != 0) {
- ffb_vertex *v0 = &fmesa->verts[ELT(start + 0)];
- ffb_vertex *v1 = &fmesa->verts[ELT(start + 1)];
-
- FFBFifo(fmesa, (1 + FFB_PRIM_COLOR_COST +
- ((FFB_VERTEX_COLOR_COST * 2) + (3 * 2))));
-
- RESET_STIPPLE;
-
- FFB_SET_PRIM_COLOR(v1);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
- }
- for (i = start + 2; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i)];
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST + 3)));
-
- FFB_SET_PRIM_COLOR(v0);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->y = FFB_GET_Y(v0);
- ffb->x = FFB_GET_X(v0);
- }
- if ((flags & PRIM_END) != 0) {
- ffb_vertex *v0 = &fmesa->verts[ELT(start)];
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST + 3)));
-
- FFB_SET_PRIM_COLOR(v0);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->y = FFB_GET_Y(v0);
- ffb->x = FFB_GET_X(v0);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_line_strip)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- FFB_DECLARE_CACHED_COLOR(cached_fg)
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_LINE_STRIP);
- FFBFifo(fmesa, (1 + FFB_PRIM_COLOR_COST +
- ((FFB_VERTEX_COLOR_COST * 2) + (3 * 2))));
-
- RESET_STIPPLE;
-
- {
- ffb_vertex *v0 = &fmesa->verts[ELT(start + 0)];
- ffb_vertex *v1 = &fmesa->verts[ELT(start + 1)];
-
- FFB_COMPUTE_CACHED_COLOR(cached_fg, v0);
- FFB_CACHED_COLOR_SET(cached_fg);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
- }
-
- for (i = start + 2; i < count; i++) {
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 0)];
- FFB_DECLARE_CACHED_COLOR(new_fg)
-
- FFB_COMPUTE_CACHED_COLOR(new_fg, v1);
- if (FFB_CACHED_COLOR_SAME(cached_fg, new_fg)) {
- FFBFifo(fmesa, ((FFB_VERTEX_COLOR_COST * 1) + (3 * 1)));
- } else {
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 1) + (3 * 1)));
- FFB_CACHED_COLOR_UPDATE(cached_fg, new_fg);
- }
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-#endif /* !(IND & (FFB_TRI_CULL_BIT)) */
-
-/* OK, now things start getting fun :-) */
-#if (IND & (FFB_TRI_CULL_BIT))
-#define FFB_AREA_DECLARE GLfloat cc, ex, ey, fx, fy;
-#define FFB_COMPUTE_AREA_TRI(V0, V1, V2) \
-{ ex = (V1)->x - (V0)->x; \
- ey = (V1)->y - (V0)->y; \
- fx = (V2)->x - (V0)->x; \
- fy = (V2)->y - (V0)->y; \
- cc = ex*fy-ey*fx; \
-}
-#define FFB_COMPUTE_AREA_QUAD(V0, V1, V2, V3) \
-{ ex = (V2)->x - (V0)->x; \
- ey = (V2)->y - (V0)->y; \
- fx = (V3)->x - (V1)->x; \
- fy = (V3)->y - (V1)->y; \
- cc = ex*fy-ey*fx; \
-}
-#else
-#define FFB_AREA_DECLARE /**/
-#define FFB_COMPUTE_AREA_TRI(V0, V1, V2) do { } while(0)
-#define FFB_COMPUTE_AREA_QUAD(V0, V1, V2, V3) do { } while(0)
-#endif
-
-#if (IND & FFB_TRI_CULL_BIT)
-#define FFB_CULL_TRI(CULL_ACTION) \
- if (cc * fmesa->backface_sign > fmesa->ffb_zero) { \
- CULL_ACTION \
- }
-#define FFB_CULL_QUAD(CULL_ACTION) \
- if (cc * fmesa->backface_sign > fmesa->ffb_zero) { \
- CULL_ACTION \
- }
-#else
-#define FFB_CULL_TRI(CULL_ACTION) do { } while (0)
-#define FFB_CULL_QUAD(CULL_ACTION) do { } while (0)
-#endif
-
-static void TAG(ffb_vb_triangles)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_TRIANGLES);
- for (i = start + 2; i < count; i += 3) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 2)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 3) + 9));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_tri_strip)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- GLint parity = 0;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_TRIANGLE_STRIP);
-
- i = start + 2;
- goto something_clipped;
-
- something_clipped:
- for (; i < count; i++, parity ^= 1) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 2 + parity)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1 - parity)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 3) + 9));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- i++;
- parity ^= 1;
- break;
- }
-
- for (; i < count; i++, parity ^= 1) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 2 + parity)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1 - parity)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
- (void) v0; (void) v1;
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(i++; parity^=1; goto something_clipped;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 1) + 3));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_tri_fan)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_TRIANGLE_FAN);
-
- i = start + 2;
- goto something_clipped;
-
- something_clipped:
- for ( ; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(start)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 3) + 9));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- i++;
- break;
- }
-
- for (; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(start)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
- (void) v0; (void) v1;
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(i++; goto something_clipped;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 1) + 3));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->dmyf = FFB_GET_Y(v2);
- ffb->dmxf = FFB_GET_X(v2);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_poly)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_POLYGON);
-
- /* XXX Optimize XXX */
- for (i = start + 2; i < count; i++) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i)];
- ffb_vertex *v2 = &fmesa->verts[ELT(start)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_TRI(v0, v1, v2);
- FFB_CULL_TRI(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 3) + 9));
- FFB_SET_PRIM_COLOR(v2);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_quads)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_QUADS);
-
- for (i = start + 3; i < count; i += 4) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 3)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 2)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v3 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_QUAD(v0, v1, v2, v3);
- FFB_CULL_QUAD(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 4) + 12));
- FFB_SET_PRIM_COLOR(v3);
-
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- FFB_SET_VERTEX_COLOR(v3);
- ffb->z = FFB_GET_Z(v3);
- ffb->dmyf = FFB_GET_Y(v3);
- ffb->dmxf = FFB_GET_X(v3);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_vb_quad_strip)(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- GLint i;
- IMPL_LOCAL_VARS;
-
-#ifdef FFB_RENDER_TRACE
- fprintf(stderr, "%s: start(%d) count(%d) flags(%x)\n",
- __FUNCTION__, start, count, flags);
-#endif
- ffbRenderPrimitive(ctx, GL_QUAD_STRIP);
-
- /* XXX Optimize XXX */
- for (i = start + 3; i < count; i += 2) {
- ffb_vertex *v0 = &fmesa->verts[ELT(i - 1)];
- ffb_vertex *v1 = &fmesa->verts[ELT(i - 3)];
- ffb_vertex *v2 = &fmesa->verts[ELT(i - 2)];
- ffb_vertex *v3 = &fmesa->verts[ELT(i - 0)];
- FFB_AREA_DECLARE
-
- FFB_COMPUTE_AREA_QUAD(v0, v1, v2, v3);
- FFB_CULL_QUAD(continue;);
-
- FFBFifo(fmesa, (FFB_PRIM_COLOR_COST +
- (FFB_VERTEX_COLOR_COST * 4) + 12));
- FFB_SET_PRIM_COLOR(v3);
-
- FFB_DUMP_VERTEX(v0);
- FFB_SET_VERTEX_COLOR(v0);
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_DUMP_VERTEX(v1);
- FFB_SET_VERTEX_COLOR(v1);
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_DUMP_VERTEX(v2);
- FFB_SET_VERTEX_COLOR(v2);
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- FFB_DUMP_VERTEX(v3);
- FFB_SET_VERTEX_COLOR(v3);
- ffb->z = FFB_GET_Z(v3);
- ffb->dmyf = FFB_GET_Y(v3);
- ffb->dmxf = FFB_GET_X(v3);
- }
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void (*TAG(render_tab)[GL_POLYGON + 2])(GLcontext *, GLuint, GLuint, GLuint) =
-{
-#if !(IND & (FFB_TRI_CULL_BIT))
- TAG(ffb_vb_points),
- TAG(ffb_vb_lines),
- TAG(ffb_vb_line_loop),
- TAG(ffb_vb_line_strip),
-#else
- NULL,
- NULL,
- NULL,
- NULL,
-#endif
- TAG(ffb_vb_triangles),
- TAG(ffb_vb_tri_strip),
- TAG(ffb_vb_tri_fan),
- TAG(ffb_vb_quads),
- TAG(ffb_vb_quad_strip),
- TAG(ffb_vb_poly),
- ffb_vb_noop,
-};
-
-#undef IND
-#undef TAG
-
-#undef IMPL_LOCAL_VARS
-#undef FFB_DECLARE_CACHED_COLOR
-#undef FFB_COMPUTE_CACHED_COLOR
-#undef FFB_CACHED_COLOR_SAME
-#undef FFB_CACHED_COLOR_SET
-#undef FFB_CACHED_COLOR_UPDATE
-#undef FFB_SET_PRIM_COLOR
-#undef FFB_PRIM_COLOR_COST
-#undef FFB_SET_VERTEX_COLOR
-#undef FFB_VERTEX_COLOR_COST
-#undef RESET_STIPPLE
-#undef FFB_AREA_DECLARE
-#undef FFB_COMPUTE_AREA_TRI
-#undef FFB_COMPUTE_AREA_QUAD
-#undef FFB_CULL_TRI
-#undef FFB_CULL_QUAD
diff --git a/src/mesa/drivers/dri/ffb/ffb_span.c b/src/mesa/drivers/dri/ffb/ffb_span.c
deleted file mode 100644
index 61901cccadd..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_span.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/mtypes.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_lock.h"
-
-#define DBG 0
-
-#define HW_LOCK() \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- if (!fmesa->hw_locked) \
- LOCK_HARDWARE(fmesa);
-
-#define HW_UNLOCK() \
- if (!fmesa->hw_locked) \
- UNLOCK_HARDWARE(fmesa); \
-
-#define LOCAL_VARS \
- __DRIdrawable *dPriv = fmesa->driDrawable; \
- GLuint height = dPriv->h; \
- GLuint p; \
- char *buf; \
- (void) p
-
-#define INIT_MONO_PIXEL(p, color) \
- p = ((color[0] << 0) | \
- (color[1] << 8) | \
- (color[2] << 16))
-
-/* We use WID clipping, so this test always passes. */
-#define CLIPPIXEL(__x, __y) (1)
-
-/* And also, due to WID clipping, we need not do anything
- * special here.
- */
-#define CLIPSPAN(__x,__y,__n,__x1,__n1,__i) \
- __n1 = __n; \
- __x1 = __x; \
-
-#define HW_CLIPLOOP() \
-do { unsigned int fbc, ppc, cmp; \
- FFBWait(fmesa, fmesa->regs); \
- fbc = fmesa->regs->fbc; ppc = fmesa->regs->ppc; cmp = fmesa->regs->cmp; \
- fmesa->regs->fbc = ((fbc & \
- ~(FFB_FBC_WB_C | FFB_FBC_ZE_MASK | FFB_FBC_RGBE_MASK)) \
- | (FFB_FBC_ZE_OFF | FFB_FBC_RGBE_MASK)); \
- fmesa->regs->ppc = ((ppc & \
- ~(FFB_PPC_XS_MASK | FFB_PPC_ABE_MASK | FFB_PPC_DCE_MASK | \
- FFB_PPC_APE_MASK | FFB_PPC_CS_MASK)) \
- | (FFB_PPC_XS_WID | FFB_PPC_ABE_DISABLE | \
- FFB_PPC_DCE_DISABLE | FFB_PPC_APE_DISABLE | \
- FFB_PPC_CS_VAR)); \
- fmesa->regs->cmp = ((cmp & ~(0xff << 16)) | (0x80 << 16)); \
- fmesa->ffbScreen->rp_active = 1; \
- FFBWait(fmesa, fmesa->regs); \
- buf = (char *)(fmesa->sfb32 + (dPriv->x << 2) + (dPriv->y << 13));\
- if (dPriv->numClipRects) {
-
-#define HW_ENDCLIPLOOP() \
- } \
- fmesa->regs->fbc = fbc; \
- fmesa->regs->ppc = ppc; \
- fmesa->regs->cmp = cmp; \
- fmesa->ffbScreen->rp_active = 1; \
-} while(0)
-
-#define Y_FLIP(__y) (height - __y - 1)
-
-#define READ_RGBA(rgba,__x,__y) \
-do { GLuint p = *(GLuint *)(buf + ((__x)<<2) + ((__y)<<13)); \
- rgba[0] = (p >> 0) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 16) & 0xff; \
- rgba[3] = 0xff; \
-} while(0)
-
-#define WRITE_RGBA(__x, __y, __r, __g, __b, __a) \
- *(GLuint *)(buf + ((__x)<<2) + ((__y)<<13)) = \
- ((((__r) & 0xff) << 0) | \
- (((__g) & 0xff) << 8) | \
- (((__b) & 0xff) << 16))
-
-#define WRITE_PIXEL(__x, __y, __p) \
- *(GLuint *)(buf + ((__x)<<2) + ((__y)<<13)) = (__p)
-
-#define TAG(x) ffb##x##_888
-
-#include "spantmp.h"
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-ffbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- assert(vis->redBits == 8);
- assert(vis->greenBits == 8);
- assert(vis->blueBits == 8);
- ffbInitPointers_888(&drb->Base);
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_span.h b/src/mesa/drivers/dri/ffb/ffb_span.h
deleted file mode 100644
index 37506cf30e6..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_span.h
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#ifndef _FFB_SPAN_H
-#define _FFB_SPAN_H
-
-#include "drirenderbuffer.h"
-
-void ffbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis);
-
-#endif /* !(_FFB_SPAN_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_state.c b/src/mesa/drivers/dri/ffb/ffb_state.c
deleted file mode 100644
index c09d2fef838..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_state.c
+++ /dev/null
@@ -1,1222 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/mtypes.h"
-#include "main/colormac.h"
-#include "main/enums.h"
-
-#include "vbo/vbo.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_tris.h"
-#include "ffb_state.h"
-
-#undef STATE_TRACE
-
-static unsigned int ffbComputeAlphaFunc(GLcontext *ctx)
-{
- unsigned int xclip;
- GLubyte alphaRef;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDAlphaFunc: func(%s) ref(%02x)\n",
- _mesa_lookup_enum_by_nr(ctx->Color.AlphaFunc),
- ctx->Color.AlphaRef & 0xff);
-#endif
-
- switch (ctx->Color.AlphaFunc) {
- case GL_NEVER: xclip = FFB_XCLIP_TEST_NEVER; break;
- case GL_LESS: xclip = FFB_XCLIP_TEST_LT; break;
- case GL_EQUAL: xclip = FFB_XCLIP_TEST_EQ; break;
- case GL_LEQUAL: xclip = FFB_XCLIP_TEST_LE; break;
- case GL_GREATER: xclip = FFB_XCLIP_TEST_GT; break;
- case GL_NOTEQUAL: xclip = FFB_XCLIP_TEST_NE; break;
- case GL_GEQUAL: xclip = FFB_XCLIP_TEST_GE; break;
- case GL_ALWAYS: xclip = FFB_XCLIP_TEST_ALWAYS; break;
-
- default:
- return FFB_XCLIP_TEST_ALWAYS | 0x00;
- }
-
- CLAMPED_FLOAT_TO_UBYTE(alphaRef, ctx->Color.AlphaRef);
- xclip |= (alphaRef & 0xff);
-
- return xclip;
-}
-
-static void ffbDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- if (ctx->Color.AlphaEnabled) {
- unsigned int xclip = ffbComputeAlphaFunc(ctx);
-
- if (fmesa->xclip != xclip) {
- fmesa->xclip = xclip;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_XCLIP, 1);
- }
- }
-}
-
-static void ffbDDBlendEquationSeparate(GLcontext *ctx,
- GLenum modeRGB, GLenum modeA)
-{
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDBlendEquation: mode(%s)\n",
- _mesa_lookup_enum_by_nr(modeRGB));
-#endif
- assert( modeRGB == modeA );
- FALLBACK( ctx, (modeRGB != GL_FUNC_ADD), FFB_BADATTR_BLENDEQN);
-}
-
-static void ffbDDBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int blendc = 1 << 4;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDBlendFuncSeparate: sRGB(%s) dRGB(%s) sA(%s) dA(%s)\n",
- _mesa_lookup_enum_by_nr(sfactorRGB),
- _mesa_lookup_enum_by_nr(dfactorRGB),
- _mesa_lookup_enum_by_nr(sfactorA),
- _mesa_lookup_enum_by_nr(dfactorA));
-#endif
- switch (ctx->Color.BlendSrcRGB) {
- case GL_ZERO:
- blendc |= (0 << 0);
- break;
-
- case GL_ONE:
- blendc |= (1 << 0);
- break;
-
- case GL_ONE_MINUS_SRC_ALPHA:
- blendc |= (2 << 0);
- break;
-
- case GL_SRC_ALPHA:
- blendc |= (3 << 0);
- break;
-
- default:
- if (ctx->Color.BlendEnabled)
- FALLBACK( ctx, FFB_BADATTR_BLENDFUNC, GL_TRUE );
- return;
- };
-
- switch (ctx->Color.BlendDstRGB) {
- case GL_ZERO:
- blendc |= (0 << 2);
- break;
-
- case GL_ONE:
- blendc |= (1 << 2);
- break;
-
- case GL_ONE_MINUS_SRC_ALPHA:
- blendc |= (2 << 2);
- break;
-
- case GL_SRC_ALPHA:
- blendc |= (3 << 2);
- break;
-
- default:
- if (ctx->Color.BlendEnabled)
- FALLBACK( ctx, FFB_BADATTR_BLENDFUNC, GL_TRUE );
- return;
- };
-
- if (ctx->Color.BlendEnabled &&
- ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY) {
- /* We could avoid this if sfactor is GL_ONE and
- * dfactor is GL_ZERO. I do not think that is even
- * worthwhile to check because if someone is using
- * blending they use more interesting settings and
- * also it would add more state tracking to a lot
- * of the code in this file.
- */
- FALLBACK(ctx, FFB_BADATTR_BLENDROP, GL_TRUE);
- return;
- }
-
- FALLBACK( ctx, (FFB_BADATTR_BLENDFUNC|FFB_BADATTR_BLENDROP), GL_FALSE );
-
- if (blendc != fmesa->blendc) {
- fmesa->blendc = blendc;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_BLEND, 1);
- }
-}
-
-static void ffbDDDepthFunc(GLcontext *ctx, GLenum func)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint cmp;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDDepthFunc: func(%s)\n",
- _mesa_lookup_enum_by_nr(func));
-#endif
-
- switch (func) {
- case GL_NEVER:
- cmp = FFB_CMP_MAGN_NEVER;
- break;
- case GL_ALWAYS:
- cmp = FFB_CMP_MAGN_ALWAYS;
- break;
- case GL_LESS:
- cmp = FFB_CMP_MAGN_LT;
- break;
- case GL_LEQUAL:
- cmp = FFB_CMP_MAGN_LE;
- break;
- case GL_EQUAL:
- cmp = FFB_CMP_MAGN_EQ;
- break;
- case GL_GREATER:
- cmp = FFB_CMP_MAGN_GT;
- break;
- case GL_GEQUAL:
- cmp = FFB_CMP_MAGN_GE;
- break;
- case GL_NOTEQUAL:
- cmp = FFB_CMP_MAGN_NE;
- break;
- default:
- return;
- };
-
- if (! ctx->Depth.Test)
- cmp = FFB_CMP_MAGN_ALWAYS;
-
- cmp <<= 16;
- cmp = (fmesa->cmp & ~(0xff<<16)) | cmp;
- if (cmp != fmesa->cmp) {
- fmesa->cmp = cmp;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_CMP, 1);
- }
-}
-
-static void ffbDDDepthMask(GLcontext *ctx, GLboolean flag)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint fbc = fmesa->fbc;
- GLboolean enabled_now;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDDepthMask: flag(%d)\n", flag);
-#endif
-
- if ((fbc & FFB_FBC_ZE_MASK) == FFB_FBC_ZE_OFF)
- enabled_now = GL_FALSE;
- else
- enabled_now = GL_TRUE;
-
- if (flag != enabled_now) {
- fbc &= ~FFB_FBC_ZE_MASK;
- if (flag) {
- fbc |= FFB_FBC_WB_C | FFB_FBC_ZE_ON;
- } else {
- fbc |= FFB_FBC_ZE_OFF;
- fbc &= ~FFB_FBC_WB_C;
- }
- fmesa->fbc = fbc;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_FBC, 1);
- }
-}
-
-static void
-ffbDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func,
- GLint ref, GLuint mask)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int stencil, stencilctl, consty;
-
- /* We will properly update sw/hw state when stenciling is
- * enabled.
- */
- if (! ctx->Stencil._Enabled)
- return;
-
- stencilctl = fmesa->stencilctl;
- stencilctl &= ~(7 << 16);
-
- switch (func) {
- case GL_ALWAYS: stencilctl |= (0 << 16); break;
- case GL_GREATER: stencilctl |= (1 << 16); break;
- case GL_EQUAL: stencilctl |= (2 << 16); break;
- case GL_GEQUAL: stencilctl |= (3 << 16); break;
- case GL_NEVER: stencilctl |= (4 << 16); break;
- case GL_LEQUAL: stencilctl |= (5 << 16); break;
- case GL_NOTEQUAL: stencilctl |= (6 << 16); break;
- case GL_LESS: stencilctl |= (7 << 16); break;
-
- default:
- return;
- };
-
- consty = ref & 0xf;
-
- stencil = fmesa->stencil;
- stencil &= ~(0xf << 20);
- stencil |= (mask & 0xf) << 20;
-
- if (fmesa->stencil != stencil ||
- fmesa->stencilctl != stencilctl ||
- fmesa->consty != consty) {
- fmesa->stencil = stencil;
- fmesa->stencilctl = stencilctl;
- fmesa->consty = consty;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_STENCIL, 6);
- }
-}
-
-static void
-ffbDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- mask &= 0xf;
- if (fmesa->ypmask != mask) {
- fmesa->ypmask = mask;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_YPMASK, 1);
- }
-}
-
-static void
-ffbDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail,
- GLenum zfail, GLenum zpass)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int stencilctl;
-
- /* We will properly update sw/hw state when stenciling is
- * enabled.
- */
- if (! ctx->Stencil._Enabled)
- return;
-
- stencilctl = fmesa->stencilctl;
- stencilctl &= ~(0xfff00000);
-
- switch (fail) {
- case GL_ZERO: stencilctl |= (0 << 28); break;
- case GL_KEEP: stencilctl |= (1 << 28); break;
- case GL_INVERT: stencilctl |= (2 << 28); break;
- case GL_REPLACE: stencilctl |= (3 << 28); break;
- case GL_INCR: stencilctl |= (4 << 28); break;
- case GL_DECR: stencilctl |= (5 << 28); break;
-
- default:
- return;
- };
-
- switch (zfail) {
- case GL_ZERO: stencilctl |= (0 << 24); break;
- case GL_KEEP: stencilctl |= (1 << 24); break;
- case GL_INVERT: stencilctl |= (2 << 24); break;
- case GL_REPLACE: stencilctl |= (3 << 24); break;
- case GL_INCR: stencilctl |= (4 << 24); break;
- case GL_DECR: stencilctl |= (5 << 24); break;
-
- default:
- return;
- };
-
- switch (zpass) {
- case GL_ZERO: stencilctl |= (0 << 20); break;
- case GL_KEEP: stencilctl |= (1 << 20); break;
- case GL_INVERT: stencilctl |= (2 << 20); break;
- case GL_REPLACE: stencilctl |= (3 << 20); break;
- case GL_INCR: stencilctl |= (4 << 20); break;
- case GL_DECR: stencilctl |= (5 << 20); break;
-
- default:
- return;
- };
-
- if (fmesa->stencilctl != stencilctl) {
- fmesa->stencilctl = stencilctl;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_STENCIL, 6);
- }
-}
-
-static void ffbCalcViewportRegs(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- GLuint xmin, xmax, ymin, ymax, zmin, zmax;
- unsigned int vcmin, vcmax;
-
- xmin = ctx->Viewport.X + dPriv->x;
- xmax = xmin + ctx->Viewport.Width;
- ymax = dPriv->y + dPriv->h - ctx->Viewport.Y;
- ymin = ymax - ctx->Viewport.Height;
- if (ctx->Scissor.Enabled) {
- GLuint sc_xmin, sc_xmax, sc_ymin, sc_ymax;
-
- sc_xmin = ctx->Viewport.X + dPriv->x;
- sc_xmax = sc_xmin + ctx->Viewport.Width;
- sc_ymax = dPriv->y + dPriv->h - ctx->Viewport.Y;
- sc_ymin = sc_ymax - ctx->Viewport.Height;
- if (sc_xmin > xmin)
- xmin = sc_xmin;
- if (sc_xmax < xmax)
- xmax = sc_xmax;
- if (sc_ymin > ymin)
- ymin = sc_ymin;
- if (sc_ymax < ymax)
- ymax = sc_ymax;
- }
- zmin = ((GLdouble)ctx->Viewport.Near * 0x0fffffff);
- zmax = ((GLdouble)ctx->Viewport.Far * 0x0fffffff);
-
- vcmin = ((ymin & 0xffff) << 16) | (xmin & 0xffff);
- vcmax = ((ymax & 0xffff) << 16) | (xmax & 0xffff);
- if (fmesa->vclipmin != vcmin ||
- fmesa->vclipmax != vcmax ||
- fmesa->vclipzmin != zmin ||
- fmesa->vclipzmax != zmax) {
- fmesa->vclipmin = vcmin;
- fmesa->vclipmax = vcmax;
- fmesa->vclipzmin = zmin;
- fmesa->vclipzmax = zmax;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_CLIP, (4 + (4 * 2)));
- }
-}
-
-void ffbCalcViewport(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = fmesa->hw_viewport;
- __DRIdrawable *dPriv = fmesa->driDrawable;
-
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + dPriv->x + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + dPriv->h + dPriv->y + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * ((GLdouble)1.0 / (GLdouble)0x0fffffff);
- m[MAT_TZ] = v[MAT_TZ] * ((GLdouble)1.0 / (GLdouble)0x0fffffff);
-
- fmesa->depth_scale = ((GLdouble)1.0 / (GLdouble)0x0fffffff);
-
- ffbCalcViewportRegs(ctx);
-
- fmesa->setupnewinputs |= VERT_BIT_POS;
-}
-
-static void ffbDDViewport(GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height)
-{
- ffbCalcViewport(ctx);
-}
-
-static void ffbDDDepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval)
-{
- ffbCalcViewport(ctx);
-}
-
-static void ffbDDScissor(GLcontext *ctx, GLint cx, GLint cy,
- GLsizei cw, GLsizei ch)
-{
- ffbCalcViewport(ctx);
-}
-
-static void ffbDDDrawBuffer(GLcontext *ctx, GLenum buffer)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int fbc = fmesa->fbc;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDDrawBuffer: mode(%s)\n",
- _mesa_lookup_enum_by_nr(buffer));
-#endif
- fbc &= ~(FFB_FBC_WB_AB | FFB_FBC_RB_MASK);
- switch (buffer) {
- case GL_FRONT:
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_WB_B | FFB_FBC_RB_B;
- else
- fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
- break;
-
- case GL_BACK:
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
- else
- fbc |= FFB_FBC_WB_B | FFB_FBC_RB_B;
- break;
-
- case GL_FRONT_AND_BACK:
- fbc |= FFB_FBC_WB_AB;
- break;
-
- default:
- return;
- };
-
- if (fbc != fmesa->fbc) {
- fmesa->fbc = fbc;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_FBC, 1);
- }
-}
-
-
-static void ffbDDReadBuffer(GLcontext *ctx, GLenum buffer)
-{
- /* no-op, unless you implement h/w glRead/CopyPixels */
-}
-
-
-/*
- * Specifies buffer for sw fallbacks (spans)
- */
-#if 000
-/* XXX
- * This function is obsolete. It's not clear how this really effected
- * span reading/writing above. The span functions should use the
- * incoming driRenderbuffer (gl_renderbuffer) pointer to determine how
- * to read from the specified bufer.
- */
-static void ffbDDSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLuint bufferBit)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int fbc = fmesa->fbc;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDSetReadBuffer: mode(%s)\n",
- _mesa_lookup_enum_by_nr(buffer));
-#endif
- fbc &= ~(FFB_FBC_RB_MASK);
- switch (bufferBit) {
- case BUFFER_BIT_FRONT_LEFT:
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_RB_B;
- else
- fbc |= FFB_FBC_RB_A;
- break;
-
- case BUFFER_BIT_BACK_LEFT:
- if (fmesa->back_buffer == 0)
- fbc |= FFB_FBC_RB_A;
- else
- fbc |= FFB_FBC_RB_B;
- break;
-
- default:
- _mesa_problem(ctx, "Unexpected buffer in ffbDDSetBuffer()");
- return;
- };
-
- if (fbc != fmesa->fbc) {
- fmesa->fbc = fbc;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_FBC, 1);
- }
-}
-#endif
-
-
-static void ffbDDClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLubyte c[4];
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
-
- fmesa->clear_pixel = ((c[0] << 0) |
- (c[1] << 8) |
- (c[2] << 16));
-}
-
-static void ffbDDClearDepth(GLcontext *ctx, GLclampd depth)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- fmesa->clear_depth = Z_FROM_MESA(depth * 4294967295.0f);
-}
-
-static void ffbDDClearStencil(GLcontext *ctx, GLint stencil)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- fmesa->clear_stencil = stencil & 0xf;
-}
-
-/* XXX Actually, should I be using FBC controls for this? -DaveM */
-static void ffbDDColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int new_pmask = 0x0;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDColorMask: r(%d) g(%d) b(%d) a(%d)\n",
- r, g, b, a);
-#endif
- if (r)
- new_pmask |= 0x000000ff;
- if (g)
- new_pmask |= 0x0000ff00;
- if (b)
- new_pmask |= 0x00ff0000;
- if (a)
- new_pmask |= 0xff000000;
-
- if (fmesa->pmask != new_pmask) {
- fmesa->pmask = new_pmask;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_PMASK, 1);
- }
-}
-
-static void ffbDDLogicOp(GLcontext *ctx, GLenum op)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int rop;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDLogicOp: op(%s)\n",
- _mesa_lookup_enum_by_nr(op));
-#endif
- switch (op) {
- case GL_CLEAR: rop = FFB_ROP_ZERO; break;
- case GL_SET: rop = FFB_ROP_ONES; break;
- case GL_COPY: rop = FFB_ROP_NEW; break;
- case GL_AND: rop = FFB_ROP_NEW_AND_OLD; break;
- case GL_NAND: rop = FFB_ROP_NEW_AND_NOLD; break;
- case GL_OR: rop = FFB_ROP_NEW_OR_OLD; break;
- case GL_NOR: rop = FFB_ROP_NEW_OR_NOLD; break;
- case GL_XOR: rop = FFB_ROP_NEW_XOR_OLD; break;
- case GL_NOOP: rop = FFB_ROP_OLD; break;
- case GL_COPY_INVERTED: rop = FFB_ROP_NNEW; break;
- case GL_INVERT: rop = FFB_ROP_NOLD; break;
- case GL_EQUIV: rop = FFB_ROP_NNEW_XOR_NOLD; break;
- case GL_AND_REVERSE: rop = FFB_ROP_NEW_AND_NOLD; break;
- case GL_AND_INVERTED: rop = FFB_ROP_NNEW_AND_OLD; break;
- case GL_OR_REVERSE: rop = FFB_ROP_NEW_OR_NOLD; break;
- case GL_OR_INVERTED: rop = FFB_ROP_NNEW_OR_OLD; break;
-
- default:
- return;
- };
-
- rop |= fmesa->rop & ~0xff;
- if (rop != fmesa->rop) {
- fmesa->rop = rop;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_ROP, 1);
-
- if (op == GL_COPY)
- FALLBACK( ctx, FFB_BADATTR_BLENDROP, GL_FALSE );
- }
-}
-
-#if 0
-/* XXX Also need to track near/far just like 3dfx driver.
- * XXX
- * XXX Actually, that won't work, because the 3dfx chip works by
- * XXX having 1/w coordinates fed to it for each primitive, and
- * XXX it uses this to index it's 64 entry fog table.
- */
-static void ffb_fog_linear(GLcontext *ctx, ffbContextPtr fmesa)
-{
- GLfloat c = ctx->ProjectionMatrix.m[10];
- GLfloat d = ctx->ProjectionMatrix.m[14];
- GLfloat tz = ctx->Viewport.WindowMap.m[MAT_TZ];
- GLfloat szInv = 1.0F / ctx->Viewport.WindowMap.m[MAT_SZ];
- GLfloat fogEnd = ctx->Fog.End;
- GLfloat fogScale = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
- GLfloat ndcz;
- GLfloat eyez;
- GLfloat Zzero, Zone;
- unsigned int zb, zf;
-
- /* Compute the Z at which f reaches 0.0, this is the full
- * saturation point.
- *
- * Thus compute Z (as seen by the chip during rendering),
- * such that:
- *
- * 0.0 = (fogEnd - eyez) * fogScale
- *
- * fogScale is usually not zero, thus we are looking for:
- *
- * fogEnd = eyez
- *
- * fogEnd = -d / (c + ((Z - tz) * szInv))
- * fogEnd * (c + ((Z - tz) * szInv)) = -d
- * (c + ((Z - tz) * szInv)) = -d / fogEnd
- * (Z - tz) * szInv = (-d / fogEnd) - c
- * (Z - tz) = ((-d / fogEnd) - c) / szInv
- * Z = (((-d / fogEnd) - c) / szInv) + tz
- */
- Zzero = (((-d / fogEnd) - c) / szInv) + tz;
-
- /* Compute the Z at which f reaches 1.0, this is where
- * the incoming frag's full intensity is shown. This
- * equation is:
- *
- * 1.0 = (fogEnd - eyez)
- *
- * We are looking for:
- *
- * 1.0 + eyez = fogEnd
- *
- * 1.0 + (-d / (c + ((Z - tz) * szInv))) = fogEnd
- * -d / (c + ((Z - tz) * szInv)) = fogEnd - 1.0
- * -d / (FogEnd - 1.0) = (c + ((Z - tz) * szInv))
- * (-d / (fogEnd - 1.0)) - c = ((Z - tz) * szInv)
- * ((-d / (fogEnd - 1.0)) - c) / szInv = (Z - tz)
- * (((-d / (fogEnd - 1.0)) - c) / szInv) + tz = Z
- */
- Zone = (((-d / (fogEnd - 1.0)) - c) / szInv) + tz;
-
- /* FFB's Zfront must be less than Zback, thus we may have
- * to invert Sf/Sb to satisfy this constraint.
- */
- if (Zzero < Zone) {
- sf = 0.0;
- sb = 1.0;
- zf = Z_FROM_MESA(Zzero);
- zb = Z_FROM_MESA(Zone);
- } else {
- sf = 1.0;
- sb = 0.0;
- zf = Z_FROM_MESA(Zone);
- zb = Z_FROM_MESA(Zzero);
- }
-}
-#endif
-
-static void ffbDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDFogfv: pname(%s)\n", _mesa_lookup_enum_by_nr(pname));
-#endif
-}
-
-static void ffbDDLineStipple(GLcontext *ctx, GLint factor, GLushort pattern)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDLineStipple: factor(%d) pattern(%04x)\n",
- factor, pattern);
-#endif
- if (ctx->Line.StippleFlag) {
- factor = ctx->Line.StippleFactor;
- pattern = ctx->Line.StipplePattern;
- if ((GLuint) factor > 15) {
- fmesa->lpat = FFB_LPAT_BAD;
- } else {
- fmesa->lpat = ((factor << FFB_LPAT_SCALEVAL_SHIFT) |
- (0 << FFB_LPAT_PATLEN_SHIFT) |
- ((pattern & 0xffff) << FFB_LPAT_PATTERN_SHIFT));
- }
- } else {
- fmesa->lpat = 0;
- }
-}
-
-void ffbXformAreaPattern(ffbContextPtr fmesa, const GLubyte *mask)
-{
- __DRIdrawable *dPriv = fmesa->driDrawable;
- int i, lines, xoff;
-
- lines = 0;
- i = (dPriv->y + dPriv->h) & (32 - 1);
- xoff = dPriv->x & (32 - 1);
- while (lines++ < 32) {
- GLuint raw =
- (((GLuint)mask[0] << 24) |
- ((GLuint)mask[1] << 16) |
- ((GLuint)mask[2] << 8) |
- ((GLuint)mask[3] << 0));
-
- fmesa->pattern[i] =
- (raw << xoff) | (raw >> (32 - xoff));
- i = (i - 1) & (32 - 1);
- mask += 4;
- }
-
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_APAT, 32);
-}
-
-static void ffbDDPolygonStipple(GLcontext *ctx, const GLubyte *mask)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDPolygonStipple: state(%d)\n",
- ctx->Polygon.StippleFlag);
-#endif
- ffbXformAreaPattern(fmesa, mask);
-}
-
-static void ffbDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- unsigned int tmp;
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDEnable: %s state(%d)\n",
- _mesa_lookup_enum_by_nr(cap), state);
-#endif
- switch (cap) {
- case GL_ALPHA_TEST:
- if (state)
- tmp = ffbComputeAlphaFunc(ctx);
- else
- tmp = FFB_XCLIP_TEST_ALWAYS;
-
- if (tmp != fmesa->xclip) {
- fmesa->xclip = tmp;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_XCLIP, 1);
- }
- break;
-
- case GL_BLEND:
- tmp = (fmesa->ppc & ~FFB_PPC_ABE_MASK);
- if (state) {
- tmp |= FFB_PPC_ABE_ENABLE;
- } else {
- tmp |= FFB_PPC_ABE_DISABLE;
- }
- if (fmesa->ppc != tmp) {
- fmesa->ppc = tmp;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_PPC, 1);
- ffbDDBlendFuncSeparate(ctx, 0, 0, 0, 0 );
- }
- break;
-
- case GL_DEPTH_TEST:
- if (state)
- tmp = 0x0fffffff;
- else
- tmp = 0x00000000;
- if (tmp != fmesa->magnc) {
- unsigned int fbc = fmesa->fbc;
- fbc &= ~FFB_FBC_ZE_MASK;
- if (state)
- fbc |= FFB_FBC_ZE_ON;
- else
- fbc |= FFB_FBC_ZE_OFF;
- fmesa->fbc = fbc;
- ffbDDDepthFunc(ctx, ctx->Depth.Func);
- fmesa->magnc = tmp;
- FFB_MAKE_DIRTY(fmesa, (FFB_STATE_MAGNC | FFB_STATE_FBC), 2);
- }
- break;
-
- case GL_SCISSOR_TEST:
- ffbDDScissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height);
- break;
-
- case GL_STENCIL_TEST:
- if (!(fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS)) {
- FALLBACK( ctx, FFB_BADATTR_STENCIL, state );
- }
-
- tmp = fmesa->fbc & ~FFB_FBC_YE_MASK;
- if (state) {
- ffbDDStencilFuncSeparate(ctx, GL_FRONT,
- ctx->Stencil.Function[0],
- ctx->Stencil.Ref[0],
- ctx->Stencil.ValueMask[0]);
- ffbDDStencilMaskSeparate(ctx, GL_FRONT,
- ctx->Stencil.WriteMask[0]);
- ffbDDStencilOpSeparate(ctx, GL_FRONT,
- ctx->Stencil.FailFunc[0],
- ctx->Stencil.ZFailFunc[0],
- ctx->Stencil.ZPassFunc[0]);
- tmp |= FFB_FBC_YE_MASK;
- } else {
- fmesa->stencil = 0xf0000000;
- fmesa->stencilctl = 0x33300000;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_STENCIL, 6);
- tmp |= FFB_FBC_YE_OFF;
- }
- if (tmp != fmesa->fbc) {
- fmesa->fbc = tmp;
- FFB_MAKE_DIRTY(fmesa, FFB_STATE_FBC, 1);
- }
- break;
-
- case GL_FOG:
- /* Until I implement the fog support... */
- FALLBACK( ctx, FFB_BADATTR_FOG, state );
- break;
-
- case GL_LINE_STIPPLE:
- if (! state)
- fmesa->lpat = 0;
- else
- ffbDDLineStipple(ctx,
- ctx->Line.StippleFactor,
- ctx->Line.StipplePattern);
- break;
-
- case GL_POLYGON_STIPPLE:
- /* Do nothing, we interrogate the state during
- * reduced primitive changes. Since our caller
- * will set NEW_POLYGON in the ctx NewState this
- * will cause the driver rasterization functions
- * to be reevaluated, which will cause us to force
- * a reduced primitive change next rendering pass
- * and it all works out.
- */
- break;
-
- default:
- break;
- };
-}
-
-void ffbSyncHardware(ffbContextPtr fmesa)
-{
- ffb_fbcPtr ffb = fmesa->regs;
- unsigned int dirty;
- int i;
-
- FFBFifo(fmesa, fmesa->state_fifo_ents);
-
- dirty = fmesa->state_dirty;
- if (dirty & (FFB_STATE_FBC | FFB_STATE_PPC | FFB_STATE_DRAWOP |
- FFB_STATE_ROP | FFB_STATE_LPAT | FFB_STATE_WID)) {
- if (dirty & FFB_STATE_FBC)
- ffb->fbc = fmesa->fbc;
- if (dirty & FFB_STATE_PPC)
- ffb->ppc = fmesa->ppc;
- if (dirty & FFB_STATE_DRAWOP)
- ffb->drawop = fmesa->drawop;
- if (dirty & FFB_STATE_ROP)
- ffb->rop = fmesa->rop;
- if (dirty & FFB_STATE_LPAT)
- ffb->rop = fmesa->lpat;
- if (dirty & FFB_STATE_WID)
- ffb->wid = fmesa->wid;
- }
- if (dirty & (FFB_STATE_PMASK | FFB_STATE_XPMASK | FFB_STATE_YPMASK |
- FFB_STATE_ZPMASK | FFB_STATE_XCLIP | FFB_STATE_CMP |
- FFB_STATE_MATCHAB | FFB_STATE_MAGNAB | FFB_STATE_MATCHC |
- FFB_STATE_MAGNC)) {
- if (dirty & FFB_STATE_PMASK)
- ffb->pmask = fmesa->pmask;
- if (dirty & FFB_STATE_XPMASK)
- ffb->xpmask = fmesa->xpmask;
- if (dirty & FFB_STATE_YPMASK)
- ffb->ypmask = fmesa->ypmask;
- if (dirty & FFB_STATE_ZPMASK)
- ffb->zpmask = fmesa->zpmask;
- if (dirty & FFB_STATE_XCLIP)
- ffb->xclip = fmesa->xclip;
- if (dirty & FFB_STATE_CMP)
- ffb->cmp = fmesa->cmp;
- if (dirty & FFB_STATE_MATCHAB)
- ffb->matchab = fmesa->matchab;
- if (dirty & FFB_STATE_MAGNAB)
- ffb->magnab = fmesa->magnab;
- if (dirty & FFB_STATE_MATCHC)
- ffb->matchc = fmesa->matchc;
- if (dirty & FFB_STATE_MAGNC)
- ffb->magnc = fmesa->magnc;
- }
-
- if (dirty & FFB_STATE_DCUE) {
- ffb->dcss = fmesa->dcss;
- ffb->dcsf = fmesa->dcsf;
- ffb->dcsb = fmesa->dcsb;
- ffb->dczf = fmesa->dczf;
- ffb->dczb = fmesa->dczb;
- if (fmesa->ffb_sarea->flags & (FFB_DRI_FFB2 | FFB_DRI_FFB2PLUS)) {
- ffb->dcss1 = fmesa->dcss1;
- ffb->dcss2 = fmesa->dcss2;
- ffb->dcss3 = fmesa->dcss3;
- ffb->dcs2 = fmesa->dcs2;
- ffb->dcs3 = fmesa->dcs3;
- ffb->dcs4 = fmesa->dcs4;
- ffb->dcd2 = fmesa->dcd2;
- ffb->dcd3 = fmesa->dcd3;
- ffb->dcd4 = fmesa->dcd4;
- }
- }
-
- if (dirty & FFB_STATE_BLEND) {
- ffb->blendc = fmesa->blendc;
- ffb->blendc1 = fmesa->blendc1;
- ffb->blendc2 = fmesa->blendc2;
- }
-
- if (dirty & FFB_STATE_CLIP) {
- ffb->vclipmin = fmesa->vclipmin;
- ffb->vclipmax = fmesa->vclipmax;
- ffb->vclipzmin = fmesa->vclipzmin;
- ffb->vclipzmax = fmesa->vclipzmax;
- for (i = 0; i < 4; i++) {
- ffb->auxclip[i].min = fmesa->aux_clips[i].min;
- ffb->auxclip[i].max = fmesa->aux_clips[i].max;
- }
- }
-
- if ((dirty & FFB_STATE_STENCIL) &&
- (fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS)) {
- ffb->stencil = fmesa->stencil;
- ffb->stencilctl = fmesa->stencilctl;
- ffb->fbc = FFB_FBC_WB_C;
- ffb->rawstencilctl = (fmesa->stencilctl | (1 << 19));
- ffb->fbc = fmesa->fbc;
- ffb->consty = fmesa->consty;
- }
-
- if (dirty & FFB_STATE_APAT) {
- for (i = 0; i < 32; i++)
- ffb->pattern[i] = fmesa->pattern[i];
- }
-
- fmesa->state_dirty = 0;
- fmesa->state_fifo_ents = 0;
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void ffbDDUpdateState(GLcontext *ctx, GLuint newstate)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- /* When we are hw rendering, changing certain kinds of
- * state does not require flushing all of our context.
- */
- if (fmesa->bad_fragment_attrs == 0 &&
- (newstate & ~_NEW_COLOR) == 0)
- return;
-
- _swrast_InvalidateState( ctx, newstate );
- _swsetup_InvalidateState( ctx, newstate );
- _vbo_InvalidateState( ctx, newstate );
- _tnl_InvalidateState( ctx, newstate );
-
- if (newstate & _NEW_TEXTURE)
- FALLBACK( ctx, FFB_BADATTR_TEXTURE,
- (ctx->Texture._EnabledUnits != 0));
-
-#ifdef STATE_TRACE
- fprintf(stderr, "ffbDDUpdateState: newstate(%08x)\n", newstate);
-#endif
-
- fmesa->new_gl_state |= newstate;
-
- /* Force a reduced primitive change next rendering
- * pass.
- */
- fmesa->raster_primitive = GL_POLYGON + 1;
-
-#if 0
- /* When the modelview matrix changes, this changes what
- * the eye coordinates will be so we have to recompute
- * the depth cueing parameters.
- *
- * XXX DD_HAVE_HARDWARE_FOG.
- */
- if (ctx->Fog.Enabled && (newstate & _NEW_MODELVIEW))
- ffb_update_fog();
-#endif
-}
-
-
-void ffbDDInitStateFuncs(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- ctx->Driver.UpdateState = ffbDDUpdateState;
-
- ctx->Driver.Enable = ffbDDEnable;
- ctx->Driver.AlphaFunc = ffbDDAlphaFunc;
- ctx->Driver.BlendEquationSeparate = ffbDDBlendEquationSeparate;
- ctx->Driver.BlendFuncSeparate = ffbDDBlendFuncSeparate;
- ctx->Driver.DepthFunc = ffbDDDepthFunc;
- ctx->Driver.DepthMask = ffbDDDepthMask;
- ctx->Driver.Fogfv = ffbDDFogfv;
- ctx->Driver.LineStipple = ffbDDLineStipple;
- ctx->Driver.PolygonStipple = ffbDDPolygonStipple;
- ctx->Driver.Scissor = ffbDDScissor;
- ctx->Driver.ColorMask = ffbDDColorMask;
- ctx->Driver.LogicOpcode = ffbDDLogicOp;
- ctx->Driver.Viewport = ffbDDViewport;
- ctx->Driver.DepthRange = ffbDDDepthRange;
-
- if (fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS) {
- ctx->Driver.StencilFuncSeparate = ffbDDStencilFuncSeparate;
- ctx->Driver.StencilMaskSeparate = ffbDDStencilMaskSeparate;
- ctx->Driver.StencilOpSeparate = ffbDDStencilOpSeparate;
- }
-
- ctx->Driver.DrawBuffer = ffbDDDrawBuffer;
- ctx->Driver.ReadBuffer = ffbDDReadBuffer;
- ctx->Driver.ClearColor = ffbDDClearColor;
- ctx->Driver.ClearDepth = ffbDDClearDepth;
- ctx->Driver.ClearStencil = ffbDDClearStencil;
-
- /* We will support color index modes later... -DaveM */
- /*
- ctx->Driver.ClearIndex = 0;
- ctx->Driver.IndexMask = 0;
- */
-}
-
-void ffbDDInitContextHwState(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- int fifo_count = 0;
- int i;
-
- fmesa->hw_locked = 0;
-
- fmesa->bad_fragment_attrs = 0;
- fmesa->state_dirty = FFB_STATE_ALL;
- fmesa->new_gl_state = ~0;
-
- fifo_count = 1;
- fmesa->fbc = (FFB_FBC_WE_FORCEON | FFB_FBC_WM_COMBINED |
- FFB_FBC_SB_BOTH | FFB_FBC_ZE_MASK |
- FFB_FBC_YE_OFF | FFB_FBC_XE_OFF |
- FFB_FBC_RGBE_MASK);
- if (ctx->Visual.doubleBufferMode) {
- /* Buffer B is the initial back buffer. */
- fmesa->back_buffer = 1;
- fmesa->fbc |= FFB_FBC_WB_BC | FFB_FBC_RB_B;
- } else {
- fmesa->back_buffer = 0;
- fmesa->fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
- }
-
- fifo_count += 1;
- fmesa->ppc = (FFB_PPC_ACE_DISABLE | FFB_PPC_DCE_DISABLE |
- FFB_PPC_ABE_DISABLE | FFB_PPC_VCE_3D |
- FFB_PPC_APE_DISABLE | FFB_PPC_TBE_OPAQUE |
- FFB_PPC_ZS_CONST | FFB_PPC_YS_CONST |
- FFB_PPC_XS_WID | FFB_PPC_CS_VAR);
-
- fifo_count += 3;
- fmesa->drawop = FFB_DRAWOP_RECTANGLE;
-
- /* GL_COPY is the default LogicOp. */
- fmesa->rop = (FFB_ROP_NEW << 16) | (FFB_ROP_NEW << 8) | FFB_ROP_NEW;
-
- /* No line patterning enabled. */
- fmesa->lpat = 0x00000000;
-
- /* We do not know the WID value until the first context switch. */
- fifo_count += 1;
- fmesa->wid = ~0;
-
- fifo_count += 5;
-
- /* ColorMask, all enabled. */
- fmesa->pmask = 0xffffffff;
-
- fmesa->xpmask = 0x000000ff;
- fmesa->ypmask = 0x0000000f;
- fmesa->zpmask = 0x0fffffff;
-
- /* AlphaFunc GL_ALWAYS, AlphaRef 0 */
- fmesa->xclip = FFB_XCLIP_TEST_ALWAYS | 0x00;
-
- /* This sets us up to use WID clipping (so the DRI clipping
- * rectangle is unneeded by us). All other match and magnitude
- * tests are set to pass.
- */
- fifo_count += 5;
- fmesa->cmp = ((FFB_CMP_MATCH_ALWAYS << 24) | /* MATCH C */
- (FFB_CMP_MAGN_ALWAYS << 16) | /* MAGN C */
- (FFB_CMP_MATCH_EQ << 8) | /* MATCH AB */
- (FFB_CMP_MAGN_ALWAYS << 0)); /* MAGN AB */
- fmesa->matchab = 0xff000000;
- fmesa->magnab = 0x00000000;
- fmesa->matchc = 0x00000000;
- fmesa->magnc = 0x00000000;
-
- /* Depth cue parameters, all zeros to start. */
- fifo_count += 14;
- fmesa->dcss = 0x00000000;
- fmesa->dcsf = 0x00000000;
- fmesa->dcsb = 0x00000000;
- fmesa->dczf = 0x00000000;
- fmesa->dczb = 0x00000000;
- fmesa->dcss1 = 0x00000000;
- fmesa->dcss2 = 0x00000000;
- fmesa->dcss3 = 0x00000000;
- fmesa->dcs2 = 0x00000000;
- fmesa->dcs3 = 0x00000000;
- fmesa->dcs4 = 0x00000000;
- fmesa->dcd2 = 0x00000000;
- fmesa->dcd3 = 0x00000000;
- fmesa->dcd4 = 0x00000000;
-
- /* Alpha blending unit state. */
- fifo_count += 3;
- fmesa->blendc = (1 << 0) | (0 << 2); /* src(GL_ONE) | dst(GL_ZERO) */
- fmesa->blendc1 = 0x00000000;
- fmesa->blendc2 = 0x00000000;
-
- /* ViewPort clip state. */
- fifo_count += 4 + (4 * 2);
- fmesa->vclipmin = 0x00000000;
- fmesa->vclipmax = 0xffffffff;
- fmesa->vclipzmin = 0x00000000;
- fmesa->vclipzmax = 0x0fffffff;
- for (i = 0; i < 4; i++) {
- fmesa->aux_clips[0].min = 0x00000000;
- fmesa->aux_clips[0].max = 0x00000000;
- }
-
- /* Stenciling state. */
- fifo_count += 6;
- fmesa->stencil = 0xf0000000; /* Stencil MASK, Y plane */
- fmesa->stencilctl = 0x33300000; /* All stencil tests disabled */
- fmesa->consty = 0x0;
-
- /* Area pattern, used for polygon stipples. */
- fifo_count += 32;
- for (i = 0; i < 32; i++)
- fmesa->pattern[i] = 0x00000000;
-
- fmesa->state_fifo_ents = fifo_count;
- fmesa->state_all_fifo_ents = fifo_count;
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_state.h b/src/mesa/drivers/dri/ffb/ffb_state.h
deleted file mode 100644
index 19e72085fd1..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_state.h
+++ /dev/null
@@ -1,12 +0,0 @@
-
-#ifndef _FFB_STATE_H
-#define _FFB_STATE_H
-
-extern void ffbDDInitStateFuncs(GLcontext *);
-extern void ffbDDInitContextHwState(GLcontext *);
-
-extern void ffbCalcViewport(GLcontext *);
-extern void ffbXformAreaPattern(ffbContextPtr, const GLubyte *);
-extern void ffbSyncHardware(ffbContextPtr fmesa);
-
-#endif /* !(_FFB_STATE_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_stencil.c b/src/mesa/drivers/dri/ffb/ffb_stencil.c
deleted file mode 100644
index 10cdfbc616e..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_stencil.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/mtypes.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_stencil.h"
-#include "ffb_lock.h"
-
-#undef STENCIL_TRACE
-
-static void FFBWriteStencilSpan( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *values, const GLubyte mask[] )
-{
- const GLubyte *stencil = (const GLubyte *) values;
-#ifdef STENCIL_TRACE
- fprintf(stderr, "FFBWriteStencilSpan: n(%d) x(%d) y(%d)\n",
- (int) n, x, y);
-#endif
- if (ctx->Depth.Mask) {
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- GLuint *zptr;
- GLuint i;
-
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = (FFB_FBC_WB_C | FFB_FBC_ZE_OFF |
- FFB_FBC_YE_ON | FFB_FBC_RGBE_OFF);
- fmesa->regs->ppc = FFB_PPC_YS_VAR;
- FFBWait(fmesa, fmesa->regs);
-
- y = (dPriv->h - y);
- zptr = (GLuint *)
- ((char *)fmesa->sfb32 +
- ((dPriv->x + x) << 2) +
- ((dPriv->y + y) << 13));
-
- for (i = 0; i < n; i++) {
- if (mask[i])
- *zptr = (stencil[i] & 0xf) << 28;
- zptr++;
- }
-
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->regs->ppc = fmesa->ppc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
- }
-}
-
-static void FFBWriteStencilPixels( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[], const GLint y[],
- const void *values, const GLubyte mask[] )
-{
- const GLubyte *stencil = (const GLubyte *) values;
-#ifdef STENCIL_TRACE
- fprintf(stderr, "FFBWriteStencilPixels: n(%d)\n", (int) n);
-#endif
- if (ctx->Depth.Mask) {
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- char *zbase;
- GLuint i;
-
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = (FFB_FBC_WB_C | FFB_FBC_ZE_OFF |
- FFB_FBC_YE_ON | FFB_FBC_RGBE_OFF);
- fmesa->regs->ppc = FFB_PPC_YS_VAR;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- zbase = ((char *)fmesa->sfb32 +
- (dPriv->x << 2) + (dPriv->y << 13));
-
- for (i = 0; i < n; i++) {
- GLint y1 = (dPriv->h - y[i]);
- GLint x1 = x[i];
- GLuint *zptr;
-
- zptr = (GLuint *)
- (zbase + (x1 << 2) + (y1 << 13));
- if (mask[i])
- *zptr = (stencil[i] & 0xf) << 28;
- }
-
- FFBFifo(fmesa, 2);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->regs->ppc = fmesa->ppc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
- }
-}
-
-static void FFBReadStencilSpan( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- void *values)
-{
- GLubyte *stencil = (GLubyte *) values;
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- GLuint *zptr;
- GLuint i;
-
-#ifdef STENCIL_TRACE
- fprintf(stderr, "FFBReadStencilSpan: n(%d) x(%d) y(%d)\n",
- (int) n, x, y);
-#endif
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = FFB_FBC_RB_C;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- y = (dPriv->h - y);
- zptr = (GLuint *)
- ((char *)fmesa->sfb32 +
- ((dPriv->x + x) << 2) +
- ((dPriv->y + y) << 13));
-
- for (i = 0; i < n; i++) {
- stencil[i] = (*zptr >> 28) & 0xf;
- zptr++;
- }
-
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
-}
-
-static void FFBReadStencilPixels( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- void *values )
-{
- GLubyte *stencil = (GLubyte *) values;
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawable *dPriv = fmesa->driDrawable;
- char *zbase;
- GLuint i;
-
-#ifdef STENCIL_TRACE
- fprintf(stderr, "FFBReadStencilPixels: n(%d)\n", (int) n);
-#endif
- if (!fmesa->hw_locked)
- LOCK_HARDWARE(fmesa);
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = FFB_FBC_RB_C;
- fmesa->ffbScreen->rp_active = 1;
- FFBWait(fmesa, fmesa->regs);
-
- zbase = ((char *)fmesa->sfb32 +
- (dPriv->x << 2) + (dPriv->y << 13));
-
- for (i = 0; i < n; i++) {
- GLint y1 = (dPriv->h - y[i]);
- GLint x1 = x[i];
- GLuint *zptr;
-
- zptr = (GLuint *)
- (zbase + (x1 << 2) + (y1 << 13));
- stencil[i] = (*zptr >> 28) & 0xf;
- }
-
- FFBFifo(fmesa, 1);
- fmesa->regs->fbc = fmesa->fbc;
- fmesa->ffbScreen->rp_active = 1;
- if (!fmesa->hw_locked)
- UNLOCK_HARDWARE(fmesa);
-}
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-ffbSetStencilFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- assert(drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT);
- drb->Base.GetRow = FFBReadStencilSpan;
- drb->Base.GetValues = FFBReadStencilPixels;
- drb->Base.PutRow = FFBWriteStencilSpan;
- /*drb->Base.PutMonoRow = FFBWriteMonoStencilSpan;*/
- drb->Base.PutValues = FFBWriteStencilPixels;
- drb->Base.PutMonoValues = NULL;
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_stencil.h b/src/mesa/drivers/dri/ffb/ffb_stencil.h
deleted file mode 100644
index 2d529980d16..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_stencil.h
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#ifndef _FFB_STENCIL_H
-#define _FFB_STENCIL_H
-
-void ffbSetStencilFunctions(driRenderbuffer *drb, const GLvisual *vis);
-
-#endif /* !(_FFB_STENCIL_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_tex.c b/src/mesa/drivers/dri/ffb/ffb_tex.c
deleted file mode 100644
index 95058e9069f..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_tex.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "ffb_tex.h"
-
-/* No texture unit, all software. */
-void ffbDDInitTexFuncs(GLcontext *ctx)
-{
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_tex.h b/src/mesa/drivers/dri/ffb/ffb_tex.h
deleted file mode 100644
index 4032e73209d..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_tex.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D.
- * Copyright (C) 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#ifndef _FFB_TEX_H
-#define _FFB_TEX_H
-
-extern void ffbDDInitTexFuncs(GLcontext *ctx);
-
-#endif /* !(_FFB_DD_H) */
-
diff --git a/src/mesa/drivers/dri/ffb/ffb_tris.c b/src/mesa/drivers/dri/ffb/ffb_tris.c
deleted file mode 100644
index 8bf5ae498fd..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_tris.c
+++ /dev/null
@@ -1,945 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/macros.h"
-#include "swrast/swrast.h"
-#include "swrast/s_context.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "ffb_context.h"
-#include "ffb_tris.h"
-#include "ffb_lines.h"
-#include "ffb_lock.h"
-#include "ffb_points.h"
-#include "ffb_state.h"
-#include "ffb_vb.h"
-
-#undef TRI_DEBUG
-#undef FFB_RENDER_TRACE
-#undef STATE_TRACE
-
-#ifdef TRI_DEBUG
-static void ffb_print_vertex(const ffb_vertex *v)
-{
- fprintf(stderr, "Vertex @(%p): "
- "X[%f] Y[%f] Z[%f]\n",
- v, v->x, v->y, v->z);
- fprintf(stderr, "Vertex @(%p): "
- "A[%f] R[%f] G[%f] B[%f]\n",
- v,
- v->color[0].alpha,
- v->color[0].red,
- v->color[0].green,
- v->color[0].blue);
-}
-#define FFB_DUMP_VERTEX(V) ffb_print_vertex(V)
-#else
-#define FFB_DUMP_VERTEX(V) do { } while(0)
-#endif
-
-#define FFB_ALPHA_BIT 0x01
-#define FFB_FLAT_BIT 0x02
-#define FFB_TRI_CULL_BIT 0x04
-#define MAX_FFB_RENDER_FUNCS 0x08
-
-/***********************************************************************
- * Build low-level triangle/quad rasterize functions *
- ***********************************************************************/
-
-#define FFB_TRI_FLAT_BIT 0x01
-#define FFB_TRI_ALPHA_BIT 0x02
-/*#define FFB_TRI_CULL_BIT 0x04*/
-
-static ffb_tri_func ffb_tri_tab[0x8];
-static ffb_quad_func ffb_quad_tab[0x8];
-
-#define IND (0)
-#define TAG(x) x
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_CULL_BIT)
-#define TAG(x) x##_cull
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_CULL_BIT|FFB_TRI_FLAT_BIT)
-#define TAG(x) x##_cull_flat
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_ALPHA_BIT)
-#define TAG(x) x##_alpha
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_ALPHA_BIT|FFB_TRI_FLAT_BIT)
-#define TAG(x) x##_alpha_flat
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_ALPHA_BIT|FFB_TRI_CULL_BIT)
-#define TAG(x) x##_alpha_cull
-#include "ffb_tritmp.h"
-
-#define IND (FFB_TRI_ALPHA_BIT|FFB_TRI_CULL_BIT|FFB_TRI_FLAT_BIT)
-#define TAG(x) x##_alpha_cull_flat
-#include "ffb_tritmp.h"
-
-static void init_tri_tab(void)
-{
- ffb_init();
- ffb_init_flat();
- ffb_init_cull();
- ffb_init_cull_flat();
- ffb_init_alpha();
- ffb_init_alpha_flat();
- ffb_init_alpha_cull();
- ffb_init_alpha_cull_flat();
-}
-
-/* Build a SWvertex from a hardware vertex. */
-static void ffb_translate_vertex(GLcontext *ctx, const ffb_vertex *src,
- SWvertex *dst)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLfloat *m = ctx->Viewport._WindowMap.m;
- const GLfloat sx = m[0];
- const GLfloat sy = m[5];
- const GLfloat sz = m[10];
- const GLfloat tx = m[12];
- const GLfloat ty = m[13];
- const GLfloat tz = m[14];
-
- dst->attrib[FRAG_ATTRIB_WPOS][0] = sx * src->x + tx;
- dst->attrib[FRAG_ATTRIB_WPOS][1] = sy * src->y + ty;
- dst->attrib[FRAG_ATTRIB_WPOS][2] = sz * src->z + tz;
- dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
-
- dst->color[0] = FFB_UBYTE_FROM_COLOR(src->color[0].red);
- dst->color[1] = FFB_UBYTE_FROM_COLOR(src->color[0].green);
- dst->color[2] = FFB_UBYTE_FROM_COLOR(src->color[0].blue);
- dst->color[3] = FFB_UBYTE_FROM_COLOR(src->color[0].alpha);
-}
-
-/***********************************************************************
- * Build fallback triangle/quad rasterize functions *
- ***********************************************************************/
-
-static void ffb_fallback_triangle(GLcontext *ctx, ffb_vertex *v0,
- ffb_vertex *v1, ffb_vertex *v2)
-{
- SWvertex v[3];
-
- ffb_translate_vertex(ctx, v0, &v[0]);
- ffb_translate_vertex(ctx, v1, &v[1]);
- ffb_translate_vertex(ctx, v2, &v[2]);
-
- _swrast_Triangle(ctx, &v[0], &v[1], &v[2]);
-}
-
-static void ffb_fallback_quad(GLcontext *ctx,
- ffb_vertex *v0, ffb_vertex *v1,
- ffb_vertex *v2, ffb_vertex *v3)
-{
- SWvertex v[4];
-
- ffb_translate_vertex(ctx, v0, &v[0]);
- ffb_translate_vertex(ctx, v1, &v[1]);
- ffb_translate_vertex(ctx, v2, &v[2]);
- ffb_translate_vertex(ctx, v3, &v[3]);
-
- _swrast_Quad(ctx, &v[0], &v[1], &v[2], &v[3]);
-}
-
-void ffb_fallback_line(GLcontext *ctx, ffb_vertex *v0, ffb_vertex *v1)
-{
- SWvertex v[2];
-
- ffb_translate_vertex(ctx, v0, &v[0]);
- ffb_translate_vertex(ctx, v1, &v[1]);
-
- _swrast_Line(ctx, &v[0], &v[1]);
-}
-
-void ffb_fallback_point(GLcontext *ctx, ffb_vertex *v0)
-{
- SWvertex v[1];
-
- ffb_translate_vertex(ctx, v0, &v[0]);
-
- _swrast_Point(ctx, &v[0]);
-}
-
-/***********************************************************************
- * Rasterization functions for culled tris/quads *
- ***********************************************************************/
-
-static void ffb_nodraw_triangle(GLcontext *ctx, ffb_vertex *v0,
- ffb_vertex *v1, ffb_vertex *v2)
-{
- (void) (ctx && v0 && v1 && v2);
-}
-
-static void ffb_nodraw_quad(GLcontext *ctx,
- ffb_vertex *v0, ffb_vertex *v1,
- ffb_vertex *v2, ffb_vertex *v3)
-{
- (void) (ctx && v0 && v1 && v2 && v3);
-}
-
-static void ffb_update_cullsign(GLcontext *ctx)
-{
- GLfloat backface_sign = 1;
-
- switch (ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace==GL_CCW)
- backface_sign = -1;
- break;
-
- case GL_FRONT:
- if (ctx->Polygon.FrontFace!=GL_CCW)
- backface_sign = -1;
- break;
-
- default:
- break;
- };
-
- FFB_CONTEXT(ctx)->backface_sign = backface_sign;
-}
-
-/***********************************************************************
- * Choose triangle/quad rasterize functions *
- ***********************************************************************/
-
-void ffbChooseTriangleState(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- if (flags & DD_TRI_SMOOTH) {
- fmesa->draw_tri = ffb_fallback_triangle;
- fmesa->draw_quad = ffb_fallback_quad;
- return;
- }
-
- if (flags & DD_FLATSHADE)
- ind |= FFB_TRI_FLAT_BIT;
-
- if (ctx->Polygon.CullFlag) {
- if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) {
- fmesa->draw_tri = ffb_nodraw_triangle;
- fmesa->draw_quad = ffb_nodraw_quad;
- return;
- }
-
- ind |= FFB_TRI_CULL_BIT;
- ffb_update_cullsign(ctx);
- } else
- FFB_CONTEXT(ctx)->backface_sign = 0;
-
- /* If blending or the alpha test is enabled we need to
- * provide alpha components to the chip, else we can
- * do without it and thus feed vertex data to the chip
- * more efficiently.
- */
- if (ctx->Color.BlendEnabled || ctx->Color.AlphaEnabled)
- ind |= FFB_TRI_ALPHA_BIT;
-
- fmesa->draw_tri = ffb_tri_tab[ind];
- fmesa->draw_quad = ffb_quad_tab[ind];
-}
-
-static const GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-static void ffbRenderPrimitive(GLcontext *ctx, GLenum prim);
-static void ffbRasterPrimitive(GLcontext *ctx, GLenum rprim);
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define FFB_OFFSET_BIT 0x01
-#define FFB_TWOSIDE_BIT 0x02
-#define FFB_UNFILLED_BIT 0x04
-#define FFB_MAX_TRIFUNC 0x08
-
-static struct {
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[FFB_MAX_TRIFUNC];
-
-#define DO_OFFSET (IND & FFB_OFFSET_BIT)
-#define DO_UNFILLED (IND & FFB_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & FFB_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_QUAD 1
-#define DO_FULL_QUAD 1
-#define DO_TRI 1
-#define DO_LINE 0
-#define DO_POINTS 0
-
-#define QUAD( a, b, c, d ) fmesa->draw_quad( ctx, a, b, c, d )
-#define TRI( a, b, c ) fmesa->draw_tri( ctx, a, b, c )
-#define LINE( a, b ) fmesa->draw_line( ctx, a, b )
-#define POINT( a ) fmesa->draw_point( ctx, a )
-
-#define HAVE_BACK_COLORS 1
-#define HAVE_RGBA 1
-#define HAVE_SPEC 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX ffb_vertex
-#define TAB rast_tab
-
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define DEPTH_SCALE (fmesa->depth_scale)
-#define VERT_X(_v) (_v->x)
-#define VERT_Y(_v) (_v->y)
-#define VERT_Z(_v) (_v->z)
-#define AREA_IS_CCW( a ) (a < fmesa->ffb_zero)
-#define GET_VERTEX(e) (&fmesa->verts[e])
-#define INSANE_VERTICES
-#define VERT_SET_Z(v,val) ((v)->z = (val))
-#define VERT_Z_ADD(v,val) ((v)->z += (val))
-
-#define VERT_COPY_RGBA1( _v ) _v->color[0] = _v->color[1]
-#define VERT_COPY_RGBA( v0, v1 ) v0->color[0] = v1->color[0]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->color[0]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->color[0] = color[idx]
-
-#define LOCAL_VARS(n) \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- __DRIdrawable *dPriv = fmesa->driDrawable; \
- ffb_color color[n] = { { 0 } }; \
- (void) color; (void) dPriv;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (fmesa->raster_primitive != reduced_prim[x]) \
- ffbRasterPrimitive( ctx, reduced_prim[x] )
-#define RENDER_PRIMITIVE fmesa->render_primitive
-#define TAG(x) x
-#include "tnl_dd/t_dd_unfilled.h"
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_TWOSIDE_BIT|FFB_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_OFFSET_BIT|FFB_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_TWOSIDE_BIT|FFB_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FFB_TWOSIDE_BIT|FFB_OFFSET_BIT|FFB_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
-}
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void ffbRenderClippedPolygon(GLcontext *ctx, const GLuint *elts, GLuint n)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint prim = fmesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon. */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON](ctx, 0, n, PRIM_BEGIN|PRIM_END);
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive. */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify(ctx, prim);
-}
-
-static void ffbRenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line(ctx, ii, jj);
-}
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-static void ffb_vb_noop(GLcontext *ctx, GLuint start, GLuint count, GLuint flags)
-{
- (void)(ctx && start && count && flags);
-}
-
-#define ELT(x) x
-
-#define IND 0
-#define TAG(x) x
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_ALPHA_BIT)
-#define TAG(x) x##_alpha
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_ALPHA_BIT)
-#define TAG(x) x##_flat_alpha
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_TRI_CULL_BIT)
-#define TAG(x) x##_tricull
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_flat_tricull
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_ALPHA_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_alpha_tricull
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_ALPHA_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_flat_alpha_tricull
-#include "ffb_rendertmp.h"
-
-#undef ELT
-#define ELT(x) elt[x]
-
-#define IND 0
-#define TAG(x) x##_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT)
-#define TAG(x) x##_flat_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_ALPHA_BIT)
-#define TAG(x) x##_alpha_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_ALPHA_BIT)
-#define TAG(x) x##_flat_alpha_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_TRI_CULL_BIT)
-#define TAG(x) x##_tricull_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_flat_tricull_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_ALPHA_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_alpha_tricull_elt
-#include "ffb_rendertmp.h"
-
-#define IND (FFB_FLAT_BIT | FFB_ALPHA_BIT | FFB_TRI_CULL_BIT)
-#define TAG(x) x##_flat_alpha_tricull_elt
-#include "ffb_rendertmp.h"
-
-static void *render_tabs[MAX_FFB_RENDER_FUNCS];
-static void *render_tabs_elt[MAX_FFB_RENDER_FUNCS];
-
-static void init_render_tab(void)
-{
- int i;
-
- render_tabs[0] = render_tab;
- render_tabs[FFB_FLAT_BIT] = render_tab_flat;
- render_tabs[FFB_ALPHA_BIT] = render_tab_alpha;
- render_tabs[FFB_FLAT_BIT|FFB_ALPHA_BIT] = render_tab_flat_alpha;
- render_tabs[FFB_TRI_CULL_BIT] = render_tab_tricull;
- render_tabs[FFB_FLAT_BIT|FFB_TRI_CULL_BIT] = render_tab_flat_tricull;
- render_tabs[FFB_ALPHA_BIT|FFB_TRI_CULL_BIT] = render_tab_alpha_tricull;
- render_tabs[FFB_FLAT_BIT|FFB_ALPHA_BIT|FFB_TRI_CULL_BIT] =
- render_tab_flat_alpha_tricull;
-
- render_tabs_elt[0] = render_tab_elt;
- render_tabs_elt[FFB_FLAT_BIT] = render_tab_flat_elt;
- render_tabs_elt[FFB_ALPHA_BIT] = render_tab_alpha_elt;
- render_tabs_elt[FFB_FLAT_BIT|FFB_ALPHA_BIT] = render_tab_flat_alpha_elt;
- render_tabs_elt[FFB_TRI_CULL_BIT] = render_tab_tricull_elt;
- render_tabs_elt[FFB_FLAT_BIT|FFB_TRI_CULL_BIT] = render_tab_flat_tricull_elt;
- render_tabs_elt[FFB_ALPHA_BIT|FFB_TRI_CULL_BIT] = render_tab_alpha_tricull_elt;
- render_tabs_elt[FFB_FLAT_BIT|FFB_ALPHA_BIT|FFB_TRI_CULL_BIT] =
- render_tab_flat_alpha_tricull_elt;
-
- for (i = 0; i < MAX_FFB_RENDER_FUNCS; i++) {
- tnl_render_func *rf = render_tabs[i];
- tnl_render_func *rfe = render_tabs_elt[i];
-
- if (i & FFB_TRI_CULL_BIT) {
- int from_idx = (i & ~FFB_TRI_CULL_BIT);
- tnl_render_func *rf_from = render_tabs[from_idx];
- tnl_render_func *rfe_from = render_tabs_elt[from_idx];
- int j;
-
- for (j = GL_POINTS; j < GL_TRIANGLES; j++) {
- rf[j] = rf_from[j];
- rfe[j] = rfe_from[j];
- }
- }
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#ifdef FFB_RENDER_TRACE
-static void ffbPrintRenderFlags(GLuint index, GLuint render_index)
-{
- fprintf(stderr,
- "ffbChooseRenderState: "
- "index(%s%s%s) "
- "render_index(%s%s%s)\n",
- ((index & FFB_TWOSIDE_BIT) ? "twoside " : ""),
- ((index & FFB_OFFSET_BIT) ? "offset " : ""),
- ((index & FFB_UNFILLED_BIT) ? "unfilled " : ""),
- ((render_index & FFB_FLAT_BIT) ? "flat " : ""),
- ((render_index & FFB_ALPHA_BIT) ? "alpha " : ""),
- ((render_index & FFB_TRI_CULL_BIT) ? "tricull " : ""));
-}
-#endif
-
-void ffbChooseRenderState(GLcontext *ctx)
-{
- GLuint flags = ctx->_TriangleCaps;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint index = 0;
-
- /* Per-primitive fallbacks and the selection of fmesa->draw_* are
- * handled elsewhere.
- */
- if (flags & DD_TRI_LIGHT_TWOSIDE)
- index |= FFB_TWOSIDE_BIT;
-
- if (flags & DD_TRI_OFFSET)
- index |= FFB_OFFSET_BIT;
-
- if (flags & DD_TRI_UNFILLED)
- index |= FFB_UNFILLED_BIT;
-
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- GLuint render_index = 0;
-
- if (flags & DD_FLATSHADE)
- render_index |= FFB_FLAT_BIT;
-
- if (ctx->Color.BlendEnabled || ctx->Color.AlphaEnabled)
- render_index |= FFB_ALPHA_BIT;
-
- if (ctx->Polygon.CullFlag)
- render_index |= FFB_TRI_CULL_BIT;
-
-#ifdef FFB_RENDER_TRACE
- ffbPrintRenderFlags(index, render_index);
-#endif
- tnl->Driver.Render.PrimTabVerts = render_tabs[render_index];
- tnl->Driver.Render.PrimTabElts = render_tabs_elt[render_index];
- } else {
-#ifdef FFB_RENDER_TRACE
- ffbPrintRenderFlags(index, 0);
-#endif
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- }
-
- tnl->Driver.Render.ClippedPolygon = ffbRenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = ffbRenderClippedLine;
-}
-
-static void ffbRunPipeline(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- if (fmesa->bad_fragment_attrs == 0 &&
- fmesa->new_gl_state) {
- if (fmesa->new_gl_state & _FFB_NEW_TRIANGLE)
- ffbChooseTriangleState(ctx);
- if (fmesa->new_gl_state & _FFB_NEW_LINE)
- ffbChooseLineState(ctx);
- if (fmesa->new_gl_state & _FFB_NEW_POINT)
- ffbChoosePointState(ctx);
- if (fmesa->new_gl_state & _FFB_NEW_RENDER)
- ffbChooseRenderState(ctx);
- if (fmesa->new_gl_state & _FFB_NEW_VERTEX)
- ffbChooseVertexState(ctx);
-
- fmesa->new_gl_state = 0;
- }
-
- _tnl_run_pipeline(ctx);
-}
-
-static void ffbRenderStart(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- LOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 1;
-
- if (fmesa->state_dirty != 0)
- ffbSyncHardware(fmesa);
-}
-
-static void ffbRenderFinish(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- UNLOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 0;
-}
-
-/* Even when doing full software rendering we need to
- * wrap render{start,finish} so that the hardware is kept
- * in sync (because multipass rendering changes the write
- * buffer etc.)
- */
-static void ffbSWRenderStart(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- LOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 1;
-
- if (fmesa->state_dirty != 0)
- ffbSyncHardware(fmesa);
-}
-
-static void ffbSWRenderFinish(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- UNLOCK_HARDWARE(fmesa);
- fmesa->hw_locked = 0;
-}
-
-static void ffbRasterPrimitive(GLcontext *ctx, GLenum rprim)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint drawop, fbc, ppc;
- int do_sw = 0;
-
- fmesa->raster_primitive = rprim;
-
- drawop = fmesa->drawop;
- fbc = fmesa->fbc;
- ppc = fmesa->ppc & ~(FFB_PPC_ZS_MASK | FFB_PPC_CS_MASK);
-
-#ifdef STATE_TRACE
- fprintf(stderr,
- "ffbReducedPrimitiveChange: rprim(%d) ", rprim);
-#endif
- switch(rprim) {
- case GL_POINTS:
-#ifdef STATE_TRACE
- fprintf(stderr, "GL_POINTS ");
-#endif
- if (fmesa->draw_point == ffb_fallback_point) {
- do_sw = 1;
- break;
- }
-
- if (ctx->Point.SmoothFlag) {
- ppc |= (FFB_PPC_ZS_VAR | FFB_PPC_CS_CONST);
- drawop = FFB_DRAWOP_AADOT;
- } else {
- ppc |= (FFB_PPC_ZS_CONST | FFB_PPC_CS_CONST);
- drawop = FFB_DRAWOP_DOT;
- }
- break;
-
- case GL_LINES:
-#ifdef STATE_TRACE
- fprintf(stderr, "GL_LINES ");
-#endif
- if (fmesa->draw_line == ffb_fallback_line) {
- do_sw = 1;
- break;
- }
-
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- ppc |= FFB_PPC_ZS_VAR | FFB_PPC_CS_CONST;
- } else {
- ppc |= FFB_PPC_ZS_VAR | FFB_PPC_CS_VAR;
- }
- if (ctx->Line.SmoothFlag)
- drawop = FFB_DRAWOP_AALINE;
- else
- drawop = FFB_DRAWOP_DDLINE;
- break;
-
- case GL_TRIANGLES:
-#ifdef STATE_TRACE
- fprintf(stderr, "GL_POLYGON ");
-#endif
- if (fmesa->draw_tri == ffb_fallback_triangle) {
- do_sw = 1;
- break;
- }
-
- ppc &= ~FFB_PPC_APE_MASK;
- if (ctx->Polygon.StippleFlag)
- ppc |= FFB_PPC_APE_ENABLE;
- else
- ppc |= FFB_PPC_APE_DISABLE;
-
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- ppc |= FFB_PPC_ZS_VAR | FFB_PPC_CS_CONST;
- } else {
- ppc |= FFB_PPC_ZS_VAR | FFB_PPC_CS_VAR;
- }
- drawop = FFB_DRAWOP_TRIANGLE;
- break;
-
- default:
-#ifdef STATE_TRACE
- fprintf(stderr, "unknown %d!\n", rprim);
-#endif
- return;
- };
-
-#ifdef STATE_TRACE
- fprintf(stderr, "do_sw(%d) ", do_sw);
-#endif
- if (do_sw != 0) {
- fbc &= ~(FFB_FBC_WB_C);
- fbc &= ~(FFB_FBC_ZE_MASK | FFB_FBC_RGBE_MASK);
- fbc |= FFB_FBC_ZE_OFF | FFB_FBC_RGBE_MASK;
- ppc &= ~(FFB_PPC_XS_MASK | FFB_PPC_ABE_MASK |
- FFB_PPC_DCE_MASK | FFB_PPC_APE_MASK);
- ppc |= (FFB_PPC_ZS_VAR | FFB_PPC_CS_VAR | FFB_PPC_XS_WID |
- FFB_PPC_ABE_DISABLE | FFB_PPC_DCE_DISABLE |
- FFB_PPC_APE_DISABLE);
- } else {
- fbc |= FFB_FBC_WB_C;
- fbc &= ~(FFB_FBC_RGBE_MASK);
- fbc |= FFB_FBC_RGBE_MASK;
- ppc &= ~(FFB_PPC_ABE_MASK | FFB_PPC_XS_MASK);
- if (ctx->Color.BlendEnabled) {
- if ((rprim == GL_POINTS && !ctx->Point.SmoothFlag) ||
- (rprim != GL_POINTS && ctx->_TriangleCaps & DD_FLATSHADE))
- ppc |= FFB_PPC_ABE_ENABLE | FFB_PPC_XS_CONST;
- else
- ppc |= FFB_PPC_ABE_ENABLE | FFB_PPC_XS_VAR;
- } else {
- ppc |= FFB_PPC_ABE_DISABLE | FFB_PPC_XS_WID;
- }
- }
-#ifdef STATE_TRACE
- fprintf(stderr, "fbc(%08x) ppc(%08x)\n", fbc, ppc);
-#endif
-
- FFBFifo(fmesa, 4);
- if (fmesa->drawop != drawop)
- fmesa->regs->drawop = fmesa->drawop = drawop;
- if (fmesa->fbc != fbc)
- fmesa->regs->fbc = fmesa->fbc = fbc;
- if (fmesa->ppc != ppc)
- fmesa->regs->ppc = fmesa->ppc = ppc;
- if (do_sw != 0) {
- fmesa->regs->cmp =
- (fmesa->cmp & ~(0xff<<16)) | (0x80 << 16);
- } else
- fmesa->regs->cmp = fmesa->cmp;
-}
-
-static void ffbRenderPrimitive(GLcontext *ctx, GLenum prim)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- fmesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (fmesa->raster_primitive != rprim) {
- ffbRasterPrimitive( ctx, rprim );
- }
-}
-
-
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static char *fallbackStrings[] = {
- "Fog enabled",
- "Blend function",
- "Blend ROP",
- "Blend equation",
- "Stencil",
- "Texture",
- "LIBGL_SOFTWARE_RENDERING"
-};
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
-
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-void ffbFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = fmesa->bad_fragment_attrs;
-
- if (mode) {
- fmesa->bad_fragment_attrs |= bit;
- if (oldfallback == 0) {
-/* FFB_FIREVERTICES(fmesa); */
- _swsetup_Wakeup( ctx );
- if (fmesa->debugFallbacks)
- fprintf(stderr, "FFB begin software fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- } else {
- fmesa->bad_fragment_attrs &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
-
- tnl->Driver.Render.Start = ffbRenderStart;
- tnl->Driver.Render.PrimitiveNotify = ffbRenderPrimitive;
- tnl->Driver.Render.Finish = ffbRenderFinish;
- fmesa->new_gl_state = ~0;
-
- /* Just re-choose everything:
- */
- ffbChooseVertexState(ctx);
- ffbChooseRenderState(ctx);
- ffbChooseTriangleState(ctx);
- ffbChooseLineState(ctx);
- ffbChoosePointState(ctx);
-
- if (fmesa->debugFallbacks)
- fprintf(stderr, "FFB end software fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
-}
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void ffbDDInitRenderFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- init_tri_tab();
- init_render_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = ffbRunPipeline;
- tnl->Driver.Render.Start = ffbRenderStart;
- tnl->Driver.Render.Finish = ffbRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = ffbRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
-
- swrast->Driver.SpanRenderStart = ffbSWRenderStart;
- swrast->Driver.SpanRenderFinish = ffbSWRenderFinish;
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_tris.h b/src/mesa/drivers/dri/ffb/ffb_tris.h
deleted file mode 100644
index 116b8e07f15..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_tris.h
+++ /dev/null
@@ -1,25 +0,0 @@
-
-#ifndef _FFB_TRIS_H
-#define _FFB_TRIS_H
-
-extern void ffbDDInitRenderFuncs( GLcontext *ctx );
-
-
-#define _FFB_NEW_RENDER (_DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_UNFILLED)
-
-extern void ffbChooseRenderState(GLcontext *ctx);
-
-
-#define _FFB_NEW_TRIANGLE (_DD_NEW_TRI_SMOOTH | \
- _DD_NEW_FLATSHADE | \
- _NEW_POLYGON | \
- _NEW_COLOR)
-
-extern void ffbChooseTriangleState(GLcontext *ctx);
-
-extern void ffbFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( ctx, bit, mode ) ffbFallback( ctx, bit, mode )
-
-#endif /* !(_FFB_TRIS_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_tritmp.h b/src/mesa/drivers/dri/ffb/ffb_tritmp.h
deleted file mode 100644
index 324a871ec42..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_tritmp.h
+++ /dev/null
@@ -1,238 +0,0 @@
-
-static void TAG(ffb_triangle)( GLcontext *ctx,
- ffb_vertex *v0,
- ffb_vertex *v1,
- ffb_vertex *v2 )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
-#if (IND & FFB_TRI_FLAT_BIT)
- GLuint const_fg;
-#endif
- FFB_DELAYED_VIEWPORT_VARS;
-
-#ifdef TRI_DEBUG
- fprintf(stderr, "FFB: ffb_triangle ["
-#if (IND & FFB_TRI_CULL_BIT)
- " CULL"
-#endif
-#if (IND & FFB_TRI_FLAT_BIT)
- " FLAT"
-#endif
-#if (IND & FFB_TRI_ALPHA_BIT)
- " ALPHA"
-#endif
- " ]\n");
-#endif
-
-#if (IND & FFB_TRI_CULL_BIT)
- { /* NOTE: These are not viewport transformed yet. */
- GLfloat ex = v1->x - v0->x;
- GLfloat ey = v1->y - v0->y;
- GLfloat fx = v2->x - v0->x;
- GLfloat fy = v2->y - v0->y;
- GLfloat c = ex*fy-ey*fx;
-
- /* Culled... */
- if (c * fmesa->backface_sign > fmesa->ffb_zero)
- return;
- }
-#endif
-
-#if (IND & FFB_TRI_FLAT_BIT)
- const_fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( v2->color[0] );
-#ifdef TRI_DEBUG
- fprintf(stderr, "FFB_tri: const_fg %08x (B[%f] G[%f] R[%f])\n",
- const_fg,
- FFB_2_30_FIXED_TO_FLOAT(v2->color[0].blue),
- FFB_2_30_FIXED_TO_FLOAT(v2->color[0].green),
- FFB_2_30_FIXED_TO_FLOAT(v2->color[0].red));
-#endif
-#endif
-
-
-#if (IND & FFB_TRI_FLAT_BIT)
- FFBFifo(fmesa, 1);
- ffb->fg = const_fg;
-#endif
-
-#if (IND & FFB_TRI_FLAT_BIT)
- FFBFifo(fmesa, 9);
-#else
-#if (IND & FFB_TRI_ALPHA_BIT)
- FFBFifo(fmesa, 21);
-#else
- FFBFifo(fmesa, 18);
-#endif
-#endif
-
- FFB_DUMP_VERTEX(v0);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v0);
-#endif
- ffb->red = FFB_GET_RED(v0);
- ffb->green = FFB_GET_GREEN(v0);
- ffb->blue = FFB_GET_BLUE(v0);
-#endif
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_DUMP_VERTEX(v1);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v1);
-#endif
- ffb->red = FFB_GET_RED(v1);
- ffb->green = FFB_GET_GREEN(v1);
- ffb->blue = FFB_GET_BLUE(v1);
-#endif
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_DUMP_VERTEX(v2);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v2);
-#endif
- ffb->red = FFB_GET_RED(v2);
- ffb->green = FFB_GET_GREEN(v2);
- ffb->blue = FFB_GET_BLUE(v2);
-#endif
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-
-static void TAG(ffb_quad)(GLcontext *ctx,
- ffb_vertex *v0,
- ffb_vertex *v1,
- ffb_vertex *v2,
- ffb_vertex *v3 )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_fbcPtr ffb = fmesa->regs;
-#if (IND & FFB_TRI_FLAT_BIT)
- GLuint const_fg;
-#endif
- FFB_DELAYED_VIEWPORT_VARS;
-
-#ifdef TRI_DEBUG
- fprintf(stderr, "FFB: ffb_quad ["
-#if (IND & FFB_TRI_CULL_BIT)
- " CULL"
-#endif
-#if (IND & FFB_TRI_FLAT_BIT)
- " FLAT"
-#endif
-#if (IND & FFB_TRI_ALPHA_BIT)
- " ALPHA"
-#endif
- " ]\n");
-#endif /* TRI_DEBUG */
-
-#if (IND & FFB_TRI_CULL_BIT)
- { /* NOTE: These are not viewport transformed yet. */
- GLfloat ex = v2->x - v0->x;
- GLfloat ey = v2->y - v0->y;
- GLfloat fx = v3->x - v1->x;
- GLfloat fy = v3->y - v1->y;
- GLfloat c = ex*fy-ey*fx;
-
- /* Culled... */
- if (c * fmesa->backface_sign > fmesa->ffb_zero)
- return;
- }
-#endif
-
-#if (IND & FFB_TRI_FLAT_BIT)
- const_fg = FFB_PACK_CONST_UBYTE_ARGB_COLOR( v3->color[0] );
-#ifdef TRI_DEBUG
- fprintf(stderr, "FFB_quad: const_fg %08x (B[%f] G[%f] R[%f])\n",
- const_fg,
- FFB_2_30_FIXED_TO_FLOAT(v3->color[0].blue),
- FFB_2_30_FIXED_TO_FLOAT(v3->color[0].green),
- FFB_2_30_FIXED_TO_FLOAT(v3->color[0].red));
-#endif
-#endif
-
-
-#if (IND & FFB_TRI_FLAT_BIT)
- FFBFifo(fmesa, 13);
- ffb->fg = const_fg;
-#else
-#if (IND & FFB_TRI_ALPHA_BIT)
- FFBFifo(fmesa, 28);
-#else
- FFBFifo(fmesa, 24);
-#endif
-#endif
-
- FFB_DUMP_VERTEX(v0);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v0);
-#endif
- ffb->red = FFB_GET_RED(v0);
- ffb->green = FFB_GET_GREEN(v0);
- ffb->blue = FFB_GET_BLUE(v0);
-#endif
- ffb->z = FFB_GET_Z(v0);
- ffb->ryf = FFB_GET_Y(v0);
- ffb->rxf = FFB_GET_X(v0);
-
- FFB_DUMP_VERTEX(v1);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v1);
-#endif
- ffb->red = FFB_GET_RED(v1);
- ffb->green = FFB_GET_GREEN(v1);
- ffb->blue = FFB_GET_BLUE(v1);
-#endif
- ffb->z = FFB_GET_Z(v1);
- ffb->y = FFB_GET_Y(v1);
- ffb->x = FFB_GET_X(v1);
-
- FFB_DUMP_VERTEX(v2);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v2);
-#endif
- ffb->red = FFB_GET_RED(v2);
- ffb->green = FFB_GET_GREEN(v2);
- ffb->blue = FFB_GET_BLUE(v2);
-#endif
- ffb->z = FFB_GET_Z(v2);
- ffb->y = FFB_GET_Y(v2);
- ffb->x = FFB_GET_X(v2);
-
- FFB_DUMP_VERTEX(v3);
-#if !(IND & FFB_TRI_FLAT_BIT)
-#if (IND & FFB_TRI_ALPHA_BIT)
- ffb->alpha = FFB_GET_ALPHA(v3);
-#endif
- ffb->red = FFB_GET_RED(v3);
- ffb->green = FFB_GET_GREEN(v3);
- ffb->blue = FFB_GET_BLUE(v3);
-#endif
- ffb->z = FFB_GET_Z(v3);
- ffb->dmyf = FFB_GET_Y(v3);
- ffb->dmxf = FFB_GET_X(v3);
-
- fmesa->ffbScreen->rp_active = 1;
-}
-
-static void TAG(ffb_init)(void)
-{
- ffb_tri_tab[IND] = TAG(ffb_triangle);
- ffb_quad_tab[IND] = TAG(ffb_quad);
-}
-
-#undef IND
-#undef TAG
diff --git a/src/mesa/drivers/dri/ffb/ffb_vb.c b/src/mesa/drivers/dri/ffb/ffb_vb.c
deleted file mode 100644
index ca8ffb27219..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_vb.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "ffb_xmesa.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "main/imports.h"
-#include "tnl/t_context.h"
-
-#undef VB_DEBUG
-
-static void ffb_copy_pv_oneside(GLcontext *ctx, GLuint edst, GLuint esrc)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_vertex *dst = &fmesa->verts[edst];
- ffb_vertex *src = &fmesa->verts[esrc];
-
-#ifdef VB_DEBUG
- fprintf(stderr, "ffb_copy_pv_oneside: edst(%d) esrc(%d)\n", edst, esrc);
-#endif
- dst->color[0].alpha = src->color[0].alpha;
- dst->color[0].red = src->color[0].red;
- dst->color[0].green = src->color[0].green;
- dst->color[0].blue = src->color[0].blue;
-}
-
-static void ffb_copy_pv_twoside(GLcontext *ctx, GLuint edst, GLuint esrc)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- ffb_vertex *dst = &fmesa->verts[edst];
- ffb_vertex *src = &fmesa->verts[esrc];
-
-#ifdef VB_DEBUG
- fprintf(stderr, "ffb_copy_pv_twoside: edst(%d) esrc(%d)\n", edst, esrc);
-#endif
- dst->color[0].alpha = src->color[0].alpha;
- dst->color[0].red = src->color[0].red;
- dst->color[0].green = src->color[0].green;
- dst->color[0].blue = src->color[0].blue;
- dst->color[1].alpha = src->color[1].alpha;
- dst->color[1].red = src->color[1].red;
- dst->color[1].green = src->color[1].green;
- dst->color[1].blue = src->color[1].blue;
-}
-
-#define FFB_VB_RGBA_BIT 0x01
-#define FFB_VB_XYZ_BIT 0x02
-#define FFB_VB_TWOSIDE_BIT 0x04
-#define FFB_VB_MAX 0x08
-
-typedef void (*ffb_emit_func)(GLcontext *, GLuint, GLuint);
-
-static struct {
- ffb_emit_func emit;
- tnl_interp_func interp;
-} setup_tab[FFB_VB_MAX];
-
-
-#define IND (FFB_VB_XYZ_BIT)
-#define TAG(x) x##_w
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_RGBA_BIT)
-#define TAG(x) x##_g
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_TWOSIDE_BIT)
-#define TAG(x) x##_t
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_XYZ_BIT | FFB_VB_TWOSIDE_BIT)
-#define TAG(x) x##_wt
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_RGBA_BIT | FFB_VB_TWOSIDE_BIT)
-#define TAG(x) x##_gt
-#include "ffb_vbtmp.h"
-
-#define IND (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT | FFB_VB_TWOSIDE_BIT)
-#define TAG(x) x##_wgt
-#include "ffb_vbtmp.h"
-
-static void init_setup_tab( void )
-{
- init_w();
- init_g();
- init_wg();
- init_t();
- init_wt();
- init_gt();
- init_wgt();
-}
-
-#ifdef VB_DEBUG
-static void ffbPrintSetupFlags(char *msg, GLuint flags)
-{
- fprintf(stderr, "%s(%x): %s%s%s\n",
- msg,
- (int)flags,
- (flags & FFB_VB_XYZ_BIT) ? " xyz," : "",
- (flags & FFB_VB_RGBA_BIT) ? " rgba," : "",
- (flags & FFB_VB_TWOSIDE_BIT) ? " twoside," : "");
-}
-#endif
-
-static void ffbDDBuildVertices(GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- newinputs |= fmesa->setupnewinputs;
- fmesa->setupnewinputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_POS) {
- setup_tab[fmesa->setupindex].emit(ctx, start, count);
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= (FFB_VB_RGBA_BIT | FFB_VB_TWOSIDE_BIT);
-
- ind &= fmesa->setupindex;
-
- if (ind)
- setup_tab[ind].emit(ctx, start, count);
- }
-}
-
-void ffbChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- int ind = FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
- ind |= FFB_VB_TWOSIDE_BIT;
-
-#ifdef VB_DEBUG
- ffbPrintSetupFlags("ffb: full setup function", ind);
-#endif
-
- fmesa->setupindex = ind;
-
- tnl->Driver.Render.BuildVertices = ffbDDBuildVertices;
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- if (ind & FFB_VB_TWOSIDE_BIT)
- tnl->Driver.Render.CopyPV = ffb_copy_pv_twoside;
- else
- tnl->Driver.Render.CopyPV = ffb_copy_pv_oneside;
-}
-
-void ffbInitVB( GLcontext *ctx )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- fmesa->verts = (ffb_vertex *)ALIGN_MALLOC(size * sizeof(ffb_vertex), 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-
-void ffbFreeVB( GLcontext *ctx )
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- if (fmesa->verts) {
- ALIGN_FREE(fmesa->verts);
- fmesa->verts = 0;
- }
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_vb.h b/src/mesa/drivers/dri/ffb/ffb_vb.h
deleted file mode 100644
index 238b9940bfa..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_vb.h
+++ /dev/null
@@ -1,44 +0,0 @@
-
-#ifndef _FFB_VB_H
-#define _FFB_VB_H
-
-#include "main/mtypes.h"
-#include "main/macros.h"
-#include "tnl/t_context.h"
-#include "swrast/swrast.h"
-
-#define __FFB_2_30_FIXED_SCALE 1073741824.0f
-#define FFB_2_30_FLOAT_TO_FIXED(X) \
- (IROUND((X) * fmesa->ffb_2_30_fixed_scale))
-#define FFB_2_30_FIXED_TO_FLOAT(X) \
- (((GLfloat)(X)) * fmesa->ffb_one_over_2_30_fixed_scale)
-
-#define __FFB_16_16_FIXED_SCALE 65536.0f
-#define FFB_16_16_FLOAT_TO_FIXED(X) \
- (IROUND((X) * fmesa->ffb_16_16_fixed_scale))
-#define FFB_16_16_FIXED_TO_FLOAT(X) \
- (((GLfloat)(X)) * fmesa->ffb_one_over_16_16_fixed_scale)
-
-#define FFB_Z_FROM_FLOAT(VAL) FFB_2_30_FLOAT_TO_FIXED(VAL)
-#define FFB_Z_TO_FLOAT(VAL) FFB_2_30_FIXED_TO_FLOAT(VAL)
-#define FFB_XY_FROM_FLOAT(VAL) FFB_16_16_FLOAT_TO_FIXED(VAL)
-#define FFB_XY_TO_FLOAT(VAL) FFB_16_16_FIXED_TO_FLOAT(VAL)
-
-#define FFB_UBYTE_FROM_COLOR(VAL) ((IROUND((VAL) * fmesa->ffb_ubyte_color_scale)))
-
-#define FFB_PACK_CONST_UBYTE_ARGB_COLOR(C) \
- ((FFB_UBYTE_FROM_COLOR(C.alpha) << 24) | \
- (FFB_UBYTE_FROM_COLOR(C.blue) << 16) | \
- (FFB_UBYTE_FROM_COLOR(C.green) << 8) | \
- (FFB_UBYTE_FROM_COLOR(C.red) << 0))
-
-#define FFB_COLOR_FROM_FLOAT(VAL) FFB_2_30_FLOAT_TO_FIXED(VAL)
-
-#define _FFB_NEW_VERTEX (_DD_NEW_TRI_LIGHT_TWOSIDE)
-
-extern void ffbDDSetupInit(void);
-extern void ffbChooseVertexState(GLcontext *);
-extern void ffbInitVB( GLcontext *ctx );
-extern void ffbFreeVB( GLcontext *ctx );
-
-#endif /* !(_FFB_VB_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_vbtmp.h b/src/mesa/drivers/dri/ffb/ffb_vbtmp.h
deleted file mode 100644
index c548ef3ad58..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_vbtmp.h
+++ /dev/null
@@ -1,150 +0,0 @@
-
-static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-#if defined(VB_DEBUG) || (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT))
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- GLfloat (*col0)[4];
- GLuint col0_stride;
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- GLfloat (*col1)[4];
- GLuint col1_stride;
-#endif
-#endif
-#if (IND & FFB_VB_XYZ_BIT)
- GLfloat (*proj)[4] = VB->NdcPtr->data;
- GLuint proj_stride = VB->NdcPtr->stride;
- const GLubyte *mask = VB->ClipMask;
-#endif
- ffb_vertex *v = &fmesa->verts[start];
- int i;
-
-#ifdef VB_DEBUG
- fprintf(stderr, "FFB: ffb_emit ["
-#if (IND & (FFB_VB_XYZ_BIT))
- " XYZ"
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- " RGBA"
-#endif
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- " TWOSIDE"
-#endif
- "] start(%d) end(%d) import(%d)\n",
- start, end,
- VB->importable_data);
-#endif
-
-#if (IND & (FFB_VB_RGBA_BIT))
- col0 = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
- col0_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- col1 = VB->BackfaceColorPtr->data;
- col1_stride = VB->BackfaceColorPtr->stride;
-#endif
-#endif
-
- {
- if (start) {
-#if (IND & (FFB_VB_XYZ_BIT))
- proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride);
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- col0 = (GLfloat (*)[4])((GLubyte *)col0 + start * col0_stride);
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- col1 = (GLfloat (*)[4])((GLubyte *)col1 + start * col1_stride);
-#endif
-#endif
- }
- for (i = start; i < end; i++, v++) {
-#if (IND & (FFB_VB_XYZ_BIT))
- if (mask[i] == 0) {
- v->x = proj[0][0];
- v->y = proj[0][1];
- v->z = proj[0][2];
- }
- proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- v->color[0].alpha = CLAMP(col0[0][3], 0.0f, 1.0f);
- v->color[0].red = CLAMP(col0[0][0], 0.0f, 1.0f);
- v->color[0].green = CLAMP(col0[0][1], 0.0f, 1.0f);
- v->color[0].blue = CLAMP(col0[0][2], 0.0f, 1.0f);
- col0 = (GLfloat (*)[4])((GLubyte *)col0 + col0_stride);
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- v->color[1].alpha = CLAMP(col1[0][3], 0.0f, 1.0f);
- v->color[1].red = CLAMP(col1[0][0], 0.0f, 1.0f);
- v->color[1].green = CLAMP(col1[0][1], 0.0f, 1.0f);
- v->color[1].blue = CLAMP(col1[0][2], 0.0f, 1.0f);
- col1 = (GLfloat (*)[4])((GLubyte *)col1 + col1_stride);
-#endif
-#endif
- }
- }
-}
-
-static void TAG(interp)(GLcontext *ctx, GLfloat t,
- GLuint edst, GLuint eout, GLuint ein,
- GLboolean force_boundary)
-{
-#if (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT))
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-#endif
-#if (IND & (FFB_VB_XYZ_BIT))
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- const GLfloat *dstclip = VB->ClipPtr->data[edst];
- GLfloat oow = 1.0 / dstclip[3];
-#endif
-#if (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT))
- ffb_vertex *dst = &fmesa->verts[edst];
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- ffb_vertex *in = &fmesa->verts[eout];
- ffb_vertex *out = &fmesa->verts[ein];
-#endif
-
-#ifdef VB_DEBUG
- fprintf(stderr, "FFB: ffb_interp ["
-#if (IND & (FFB_VB_XYZ_BIT))
- " XYZ"
-#endif
-#if (IND & (FFB_VB_RGBA_BIT))
- " RGBA"
-#endif
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- " TWOSIDE"
-#endif
- "] edst(%d) eout(%d) ein(%d)\n",
- edst, eout, ein);
-#endif
-
-#if (IND & (FFB_VB_XYZ_BIT))
- dst->x = dstclip[0] * oow;
- dst->y = dstclip[1] * oow;
- dst->z = dstclip[2] * oow;
-#endif
-
-#if (IND & (FFB_VB_RGBA_BIT))
- INTERP_F(t, dst->color[0].alpha, out->color[0].alpha, in->color[0].alpha);
- INTERP_F(t, dst->color[0].red, out->color[0].red, in->color[0].red);
- INTERP_F(t, dst->color[0].green, out->color[0].green, in->color[0].green);
- INTERP_F(t, dst->color[0].blue, out->color[0].blue, in->color[0].blue);
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- INTERP_F(t, dst->color[1].alpha, out->color[1].alpha, in->color[1].alpha);
- INTERP_F(t, dst->color[1].red, out->color[1].red, in->color[1].red);
- INTERP_F(t, dst->color[1].green, out->color[1].green, in->color[1].green);
- INTERP_F(t, dst->color[1].blue, out->color[1].blue, in->color[1].blue);
-#endif
-#endif
-}
-
-static void TAG(init)(void)
-{
- setup_tab[IND].emit = TAG(emit);
- setup_tab[IND].interp = TAG(interp);
-}
-
-#undef IND
-#undef TAG
diff --git a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c b/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c
deleted file mode 100644
index 90f44b0e911..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "main/glheader.h"
-#include "api_noop.h"
-#include "main/context.h"
-#include "light.h"
-#include "main/macros.h"
-#include "main/imports.h"
-#include "main/mtypes.h"
-#include "main/simple_list.h"
-#include "vtxfmt.h"
-#include "ffb_xmesa.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "tnl/tnl.h"
-#include "tnl/tcontext.h"
-
-#include "ffb_vtxfmt.h"
-
-#define TNL_VERTEX ffbTnlVertex
-
-#define INTERP_RGBA(t, out, a, b) \
-do { \
- GLint i; \
- for ( i = 0 ; i < 4 ; i++ ) { \
- GLfloat fa = a[i]; \
- GLfloat fb = b[i]; \
- out[i] = LINTERP( t, fa, fb ); \
- } \
-} while (0)
-
-/* Color functions: */
-
-static INLINE void ffb_recalc_base_color(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- struct gl_light *light;
-
- COPY_3V(fmesa->vtx_state.light.base_color, ctx->Light._BaseColor[0]);
- foreach (light, &ctx->Light.EnabledList) {
- ACC_3V(fmesa->vtx_state.light.base_color,
- light->_MatAmbient[0]);
- }
-
- fmesa->vtx_state.light.base_alpha = ctx->Light._BaseAlpha[0];
-}
-
-#define GET_CURRENT \
- GET_CURRENT_CONTEXT(ctx); \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx)
-
-#define CURRENT_COLOR(COMP) fmesa->vtx_state.current.color[COMP]
-#define CURRENT_SPECULAR(COMP) fmesa->vtx_state.current.specular[COMP]
-#define COLOR_IS_FLOAT
-#define RECALC_BASE_COLOR(ctx) ffb_recalc_base_color(ctx)
-
-#define TAG(x) ffb_##x
-#include "tnl_dd/t_dd_imm_capi.h"
-
-/* Normal functions: */
-
-struct ffb_norm_tab {
- void (*normal3f_multi)(GLfloat x, GLfloat y, GLfloat z);
- void (*normal3fv_multi)(const GLfloat *v);
- void (*normal3f_single)(GLfloat x, GLfloat y, GLfloat z);
- void (*normal3fv_single)(const GLfloat *v);
-};
-
-static struct ffb_norm_tab norm_tab[0x4];
-
-#define HAVE_HW_LIGHTING 0
-#define GET_CURRENT_VERTEX \
- GET_CURRENT_CONTEXT(ctx); \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- ffbTnlVertexPtr v = fmesa->imm.v0
-
-#define CURRENT_NORMAL fmesa->vtx_state.current.normal
-#define BASE_COLOR fmesa->vtx_state.light.base_color
-#define BASE_ALPHA fmesa->vtx_state.light.base_alpha
-#define VERT_COLOR( COMP ) v->color[COMP]
-#define VERT_COLOR_IS_FLOAT
-
-#define IND (0)
-#define TAG(x) ffb_##x
-#define PRESERVE_NORMAL_DEFS
-#include "tnl_dd/t_dd_imm_napi.h"
-
-#define IND (NORM_RESCALE)
-#define TAG(x) ffb_##x##_rescale
-#define PRESERVE_NORMAL_DEFS
-#include "tnl_dd/t_dd_imm_napi.h"
-
-#define IND (NORM_NORMALIZE)
-#define TAG(x) ffb_##x##_normalize
-#include "tnl_dd/t_dd_imm_napi.h"
-
-static void ffb_init_norm_funcs(void)
-{
- ffb_init_norm();
- ffb_init_norm_rescale();
- ffb_init_norm_normalize();
-}
-
-static void choose_normals(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint index;
-
- if (ctx->Light.Enabled) {
- if (ctx->Transform.Normalize) {
- index = NORM_NORMALIZE;
- } else if (!ctx->Transform.RescaleNormals &&
- ctx->_ModelViewInvScale != 1.0) {
- index = NORM_RESCALE;
- } else {
- index = 0;
- }
-
- if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev) {
- SET_Normal3f(ctx->Exec, norm_tab[index].normal3f_single);
- SET_Normal3fv(ctx->Exec, norm_tab[index].normal3fv_single);
- } else {
- SET_Normal3f(ctx->Exec, norm_tab[index].normal3f_multi);
- SET_Normal3fv(ctx->Exec, norm_tab[index].normal3fv_multi);
- }
- } else {
- SET_Normal3f(ctx->Exec, _mesa_noop_Normal3f);
- SET_Normal3fv(ctx->Exec, _mesa_noop_Normal3fv);
- }
-}
-
-static void ffb_choose_Normal3f(GLfloat x, GLfloat y, GLfloat z)
-{
- choose_normals();
- CALL_Normal3f(GET_DISPATCH(), (x, y, z));
-}
-
-static void ffb_choose_Normal3fv(const GLfloat *v)
-{
- choose_normals();
- CALL_Normal3fv(GET_DISPATCH(), (v));
-}
-
-/* Vertex functions: */
-
-#define GET_CURRENT_VERTEX \
- GET_CURRENT_CONTEXT(ctx); \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx); \
- ffbTnlVertexPtr v = fmesa->imm.v0
-
-#define CURRENT_VERTEX v->obj
-#define SAVE_VERTEX fmesa->imm.save_vertex(ctx, v)
-
-#define TAG(x) ffb_##x
-#include "tnl_dd/t_dd_imm_vapi.h"
-
-struct ffb_vert_tab {
- void (*save_vertex)(GLcontext *ctx, ffbTnlVertexPtr v);
- void (*interpolate_vertex)(GLfloat t,
- ffbTnlVertex *O,
- const ffbTnlVertex *I,
- const ffbTnlVertex *J);
-};
-
-static struct ffb_vert_tab vert_tab[0xf];
-
-#define VTX_NORMAL 0x0
-#define VTX_RGBA 0x1
-
-#define LOCAL_VARS \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx)
-
-#define CURRENT_COLOR fmesa->vtx_state.current.color
-#define COLOR_IS_FLOAT
-#define FLUSH_VERTEX fmesa->imm.flush_vertex( ctx, v );
-
-#define IND (VTX_NORMAL)
-#define TAG(x) ffb_##x##_NORMAL
-#define PRESERVE_VERTEX_DEFS
-#include "tnl_dd/t_dd_imm_vertex.h"
-
-#define IND (VTX_RGBA)
-#define TAG(x) ffb_##x##_RGBA
-#include "tnl_dd/t_dd_imm_vertex.h"
-
-static void ffb_init_vert_funcs( void )
-{
- ffb_init_vert_NORMAL();
- ffb_init_vert_RGBA();
-}
-
-#define LOCAL_VARS \
- ffbContextPtr fmesa = FFB_CONTEXT(ctx)
-
-#define GET_INTERP_FUNC \
- ffb_interp_func interp = fmesa->imm.interp
-
-#define FLUSH_VERTEX fmesa->imm.flush_vertex
-#define IMM_VERTEX( V ) fmesa->imm.V
-#define IMM_VERTICES( n ) fmesa->imm.vertices[n]
-
-#define EMIT_VERTEX_USES_HWREGS
-
-/* XXX Implement me XXX */
-#define EMIT_VERTEX_TRI(VTX0, VTX1, VTX2) \
- do { } while (0)
-#define EMIT_VERTEX_LINE(VTX0, VTX1) \
- do { } while (0)
-#define EMIT_VERTEX_POINT(VTX0) \
- do { } while (0)
-
-#define TAG(x) ffb_##x
-#include "tnl_dd/t_dd_imm_primtmp.h"
-
-/* Bzzt: Material changes are lost on fallback. */
-static void ffb_Materialfv(GLenum face, GLenum pname,
- const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- _mesa_noop_Materialfv( face, pname, params );
- ffb_recalc_base_color( ctx );
-}
-
-/* Fallback functions: */
-
-static void ffb_do_fallback(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- struct ffb_current_state *current = &fmesa->vtx_state.current;
-
- /* Tell tnl to restore its exec vtxfmt, rehook its driver callbacks
- * and revive internal state that depended on those callbacks:
- */
- _tnl_wakeup_exec(ctx);
-
- /* Replay enough vertices that the current primitive is continued
- * correctly:
- */
- if (fmesa->imm.prim != PRIM_OUTSIDE_BEGIN_END )
- CALL_Begin(GET_DISPATCH(), (fmesa->imm.prim));
-
- if (ctx->Light.Enabled) {
- /* Catch ColorMaterial */
- CALL_Color4fv(GET_DISPATCH(), (ctx->Current.Color));
- CALL_Normal3fv(GET_DISPATCH(), (current->normal));
- } else {
- CALL_Color4fv(GET_DISPATCH(), (current->color));
- }
-}
-
-#define PRE_LOOPBACK( FUNC ) do { \
- GET_CURRENT_CONTEXT(ctx); \
- ffb_do_fallback( ctx ); \
-} while (0)
-
-#define TAG(x) ffb_fallback_##x
-#include "vtxfmt_tmp.h"
-
-static void ffb_Begin(GLenum prim)
-{
- GET_CURRENT_CONTEXT(ctx);
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- if (prim > GL_POLYGON) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glBegin" );
- return;
- }
-
- if (fmesa->imm.prim != PRIM_OUTSIDE_BEGIN_END) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" );
- return;
- }
-
- ctx->Driver.NeedFlush |= (FLUSH_STORED_VERTICES |
- FLUSH_UPDATE_CURRENT);
-
- fmesa->imm.prim = prim;
- fmesa->imm.v0 = &fmesa->imm.vertices[0];
- fmesa->imm.save_vertex = ffb_save_vertex_RGBA;
- fmesa->imm.flush_vertex = ffb_flush_tab[prim];
-
- /* XXX Lock hardware, update FBC, PPC, DRAWOP, etc. XXX */
-}
-
-static void ffb_End(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
-
- if (fmesa->imm.prim == PRIM_OUTSIDE_BEGIN_END) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
- return;
- }
-
- fmesa->imm.prim = PRIM_OUTSIDE_BEGIN_END;
-
- ctx->Driver.NeedFlush &= ~(FLUSH_STORED_VERTICES |
- FLUSH_UPDATE_CURRENT);
-
- /* XXX Unlock hardware, etc. */
-}
-
-void ffbInitTnlModule(GLcontext *ctx)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- GLvertexformat *vfmt = &(fmesa->imm.vtxfmt);
-
- /* Work in progress... */
- return;
-
- ffb_init_norm_funcs();
- ffb_init_vert_funcs();
-
- /* start by initializing to no-op functions */
- _mesa_noop_vtxfmt_init(vfmt);
-
- /* Handled fully in supported states: */
- vfmt->ArrayElement = NULL; /* FIXME: ... */
- vfmt->Color3f = ffb_choose_Color3f;
- vfmt->Color3fv = ffb_choose_Color3fv;
- vfmt->Color3ub = ffb_choose_Color3ub;
- vfmt->Color3ubv = ffb_choose_Color3ubv;
- vfmt->Color4f = ffb_choose_Color4f;
- vfmt->Color4fv = ffb_choose_Color4fv;
- vfmt->Color4ub = ffb_choose_Color4ub;
- vfmt->Color4ubv = ffb_choose_Color4ubv;
- vfmt->FogCoordfvEXT = ffb_FogCoordfvEXT;
- vfmt->FogCoordfEXT = ffb_FogCoordfEXT;
- vfmt->Materialfv = ffb_Materialfv;
- vfmt->MultiTexCoord1fARB = ffb_fallback_MultiTexCoord1fARB;
- vfmt->MultiTexCoord1fvARB = ffb_fallback_MultiTexCoord1fvARB;
- vfmt->MultiTexCoord2fARB = ffb_fallback_MultiTexCoord2fARB;
- vfmt->MultiTexCoord2fvARB = ffb_fallback_MultiTexCoord2fvARB;
- vfmt->MultiTexCoord3fARB = ffb_fallback_MultiTexCoord3fARB;
- vfmt->MultiTexCoord3fvARB = ffb_fallback_MultiTexCoord3fvARB;
- vfmt->MultiTexCoord4fARB = ffb_fallback_MultiTexCoord4fARB;
- vfmt->MultiTexCoord4fvARB = ffb_fallback_MultiTexCoord4fvARB;
- vfmt->Normal3f = ffb_choose_Normal3f;
- vfmt->Normal3fv = ffb_choose_Normal3fv;
- vfmt->SecondaryColor3ubEXT = ffb_SecondaryColor3ubEXT;
- vfmt->SecondaryColor3ubvEXT = ffb_SecondaryColor3ubvEXT;
- vfmt->SecondaryColor3fEXT = ffb_SecondaryColor3fEXT;
- vfmt->SecondaryColor3fvEXT = ffb_SecondaryColor3fvEXT;
- vfmt->TexCoord1f = ffb_fallback_TexCoord1f;
- vfmt->TexCoord1fv = ffb_fallback_TexCoord1fv;
- vfmt->TexCoord2f = ffb_fallback_TexCoord2f;
- vfmt->TexCoord2fv = ffb_fallback_TexCoord2fv;
- vfmt->TexCoord3f = ffb_fallback_TexCoord3f;
- vfmt->TexCoord3fv = ffb_fallback_TexCoord3fv;
- vfmt->TexCoord4f = ffb_fallback_TexCoord4f;
- vfmt->TexCoord4fv = ffb_fallback_TexCoord4fv;
-
- vfmt->Vertex2f = ffb_Vertex2f;
- vfmt->Vertex2fv = ffb_Vertex2fv;
- vfmt->Vertex3f = ffb_Vertex3f;
- vfmt->Vertex3fv = ffb_Vertex3fv;
- vfmt->Vertex4f = ffb_Vertex4f;
- vfmt->Vertex4fv = ffb_Vertex4fv;
-
- vfmt->Begin = ffb_Begin;
- vfmt->End = ffb_End;
-
- vfmt->DrawArrays = NULL;
- vfmt->DrawElements = NULL;
-
- /* Active but unsupported -- fallback if we receive these:
- *
- * All of these fallbacks can be fixed with additional code, except
- * CallList, unless we build a play_immediate_noop() command which
- * turns an immediate back into glBegin/glEnd commands...
- */
- vfmt->CallList = ffb_fallback_CallList;
- vfmt->EvalCoord1f = ffb_fallback_EvalCoord1f;
- vfmt->EvalCoord1fv = ffb_fallback_EvalCoord1fv;
- vfmt->EvalCoord2f = ffb_fallback_EvalCoord2f;
- vfmt->EvalCoord2fv = ffb_fallback_EvalCoord2fv;
- vfmt->EvalMesh1 = ffb_fallback_EvalMesh1;
- vfmt->EvalMesh2 = ffb_fallback_EvalMesh2;
- vfmt->EvalPoint1 = ffb_fallback_EvalPoint1;
- vfmt->EvalPoint2 = ffb_fallback_EvalPoint2;
-
- vfmt->prefer_float_colors = GL_TRUE;
-
- fmesa->imm.prim = PRIM_OUTSIDE_BEGIN_END;
-
- /* THIS IS A HACK! */
- _mesa_install_exec_vtxfmt( ctx, vfmt );
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.h b/src/mesa/drivers/dri/ffb/ffb_vtxfmt.h
deleted file mode 100644
index 4d9125cd156..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.h
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#ifndef _FFB_VTXFMT_H
-#define _FFB_VTXFMT_H
-
-extern void ffbInitTnlModule(GLcontext *);
-
-#endif /* !(_FFB_VTXFMT_H) */
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
deleted file mode 100644
index bd1044a2bff..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c
+++ /dev/null
@@ -1,729 +0,0 @@
-/*
- *
- * GLX Hardware Device Driver for Sun Creator/Creator3D
- * Copyright (C) 2000, 2001 David S. Miller
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * David S. Miller <davem@redhat.com>
- */
-
-#include "ffb_xmesa.h"
-#include "main/context.h"
-#include "main/framebuffer.h"
-#include "main/renderbuffer.h"
-#include "main/simple_list.h"
-#include "main/imports.h"
-#include "utils.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "vbo/vbo.h"
-#include "drivers/common/driverfuncs.h"
-
-#include "ffb_context.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_stencil.h"
-#include "ffb_clear.h"
-#include "ffb_vb.h"
-#include "ffb_tris.h"
-#include "ffb_lines.h"
-#include "ffb_points.h"
-#include "ffb_state.h"
-#include "ffb_lock.h"
-#include "ffb_vtxfmt.h"
-#include "ffb_bitmap.h"
-
-#include "drm_sarea.h"
-
-#include "drirenderbuffer.h"
-
-static GLboolean
-ffbInitDriver(__DRIscreen *sPriv)
-{
- ffbScreenPrivate *ffbScreen;
- FFBDRIPtr gDRIPriv = (FFBDRIPtr) sPriv->pDevPriv;
- drmAddress map;
-
- if (getenv("LIBGL_FORCE_XSERVER"))
- return GL_FALSE;
-
-
- if (sPriv->devPrivSize != sizeof(FFBDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(FFBDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area. */
- ffbScreen = (ffbScreenPrivate *) MALLOC(sizeof(ffbScreenPrivate));
- if (!ffbScreen)
- return GL_FALSE;
-
- /* Map FBC registers. */
- if (drmMap(sPriv->fd,
- gDRIPriv->hFbcRegs,
- gDRIPriv->sFbcRegs,
- &map)) {
- FREE(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->regs = (ffb_fbcPtr) map;
-
- /* Map ramdac registers. */
- if (drmMap(sPriv->fd,
- gDRIPriv->hDacRegs,
- gDRIPriv->sDacRegs,
- &map)) {
- drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
- FREE(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->dac = (ffb_dacPtr) map;
-
- /* Map "Smart" framebuffer views. */
- if (drmMap(sPriv->fd,
- gDRIPriv->hSfb8r,
- gDRIPriv->sSfb8r,
- &map)) {
- drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
- drmUnmap((drmAddress)ffbScreen->dac, gDRIPriv->sDacRegs);
- FREE(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->sfb8r = (volatile char *) map;
-
- if (drmMap(sPriv->fd,
- gDRIPriv->hSfb32,
- gDRIPriv->sSfb32,
- &map)) {
- drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
- drmUnmap((drmAddress)ffbScreen->dac, gDRIPriv->sDacRegs);
- drmUnmap((drmAddress)ffbScreen->sfb8r, gDRIPriv->sSfb8r);
- FREE(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->sfb32 = (volatile char *) map;
-
- if (drmMap(sPriv->fd,
- gDRIPriv->hSfb64,
- gDRIPriv->sSfb64,
- &map)) {
- drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
- drmUnmap((drmAddress)ffbScreen->dac, gDRIPriv->sDacRegs);
- drmUnmap((drmAddress)ffbScreen->sfb8r, gDRIPriv->sSfb8r);
- drmUnmap((drmAddress)ffbScreen->sfb32, gDRIPriv->sSfb32);
- FREE(ffbScreen);
- return GL_FALSE;
- }
- ffbScreen->sfb64 = (volatile char *) map;
-
- ffbScreen->fifo_cache = 0;
- ffbScreen->rp_active = 0;
-
- ffbScreen->sPriv = sPriv;
- sPriv->private = (void *) ffbScreen;
-
- ffbDDLinefuncInit();
- ffbDDPointfuncInit();
-
- return GL_TRUE;
-}
-
-
-static void
-ffbDestroyScreen(__DRIscreen *sPriv)
-{
- ffbScreenPrivate *ffbScreen = sPriv->private;
- FFBDRIPtr gDRIPriv = (FFBDRIPtr) sPriv->pDevPriv;
-
- drmUnmap((drmAddress)ffbScreen->regs, gDRIPriv->sFbcRegs);
- drmUnmap((drmAddress)ffbScreen->dac, gDRIPriv->sDacRegs);
- drmUnmap((drmAddress)ffbScreen->sfb8r, gDRIPriv->sSfb8r);
- drmUnmap((drmAddress)ffbScreen->sfb32, gDRIPriv->sSfb32);
- drmUnmap((drmAddress)ffbScreen->sfb64, gDRIPriv->sSfb64);
-
- FREE(ffbScreen);
-}
-
-static const struct tnl_pipeline_stage *ffb_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- /* REMOVE: fog coord stage */
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- /* REMOVE: point attenuation stage */
- &_tnl_render_stage,
- 0,
-};
-
-/* Create and initialize the Mesa and driver specific context data */
-static GLboolean
-ffbCreateContext(const __GLcontextModes *mesaVis,
- __DRIcontext *driContextPriv,
- void *sharedContextPrivate)
-{
- ffbContextPtr fmesa;
- GLcontext *ctx, *shareCtx;
- __DRIscreen *sPriv;
- ffbScreenPrivate *ffbScreen;
- char *debug;
- struct dd_function_table functions;
-
- /* Allocate ffb context */
- fmesa = (ffbContextPtr) CALLOC(sizeof(ffbContextRec));
- if (!fmesa)
- return GL_FALSE;
-
- _mesa_init_driver_functions(&functions);
-
- /* Allocate Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((ffbContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- fmesa->glCtx = _mesa_create_context(mesaVis, shareCtx,
- &functions, fmesa);
- if (!fmesa->glCtx) {
- FREE(fmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = fmesa;
- ctx = fmesa->glCtx;
-
- sPriv = driContextPriv->driScreenPriv;
- ffbScreen = (ffbScreenPrivate *) sPriv->private;
-
- /* Dri stuff. */
- fmesa->hHWContext = driContextPriv->hHWContext;
- fmesa->driFd = sPriv->fd;
- fmesa->driHwLock = &sPriv->pSAREA->lock;
-
- fmesa->ffbScreen = ffbScreen;
- fmesa->driScreen = sPriv;
- fmesa->ffb_sarea = FFB_DRISHARE(sPriv->pSAREA);
-
- /* Register and framebuffer pointers. */
- fmesa->regs = ffbScreen->regs;
- fmesa->sfb32 = ffbScreen->sfb32;
-
- ffbDDInitContextHwState(ctx);
-
- /* Default clear and depth colors. */
- {
- GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
- GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
- GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
-
- fmesa->clear_pixel = ((r << 0) |
- (g << 8) |
- (b << 16));
- }
- fmesa->clear_depth = Z_FROM_MESA(ctx->Depth.Clear * 4294967295.0f);
- fmesa->clear_stencil = ctx->Stencil.Clear & 0xf;
-
- /* No wide points. */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- /* Disable wide lines as we can't antialias them correctly in
- * hardware.
- */
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 1.0;
- ctx->Const.MaxLineWidthAA = 1.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- ctx->Const.MaxDrawBuffers = 1;
-
- /* Instead of having GCC emit these constants a zillion times
- * everywhere in the driver, put them here.
- */
- fmesa->ffb_2_30_fixed_scale = __FFB_2_30_FIXED_SCALE;
- fmesa->ffb_one_over_2_30_fixed_scale = (1.0 / __FFB_2_30_FIXED_SCALE);
- fmesa->ffb_16_16_fixed_scale = __FFB_16_16_FIXED_SCALE;
- fmesa->ffb_one_over_16_16_fixed_scale = (1.0 / __FFB_16_16_FIXED_SCALE);
- fmesa->ffb_ubyte_color_scale = 255.0f;
- fmesa->ffb_zero = 0.0f;
-
- fmesa->debugFallbacks = GL_FALSE;
- debug = getenv("LIBGL_DEBUG");
- if (debug && strstr(debug, "fallbacks"))
- fmesa->debugFallbacks = GL_TRUE;
-
- /* Initialize the software rasterizer and helper modules. */
- _swrast_CreateContext( ctx );
- _vbo_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* All of this need only be done once for a new context. */
- /* XXX these should be moved right after the
- * _mesa_init_driver_functions() call above.
- */
- ffbDDExtensionsInit(ctx);
- ffbDDInitDriverFuncs(ctx);
- ffbDDInitStateFuncs(ctx);
- ffbDDInitRenderFuncs(ctx);
- /*ffbDDInitTexFuncs(ctx); not needed */
- ffbDDInitBitmapFuncs(ctx);
- ffbInitVB(ctx);
-
-#if 0
- ffbInitTnlModule(ctx);
-#endif
-
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, ffb_pipeline);
-
- return GL_TRUE;
-}
-
-static void
-ffbDestroyContext(__DRIcontext *driContextPriv)
-{
- ffbContextPtr fmesa = (ffbContextPtr) driContextPriv->driverPrivate;
-
- if (fmesa) {
- ffbFreeVB(fmesa->glCtx);
-
- _swsetup_DestroyContext( fmesa->glCtx );
- _tnl_DestroyContext( fmesa->glCtx );
- _vbo_DestroyContext( fmesa->glCtx );
- _swrast_DestroyContext( fmesa->glCtx );
-
- /* free the Mesa context */
- fmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(fmesa->glCtx);
-
- FREE(fmesa);
- }
-}
-
-/* Create and initialize the Mesa and driver specific pixmap buffer data */
-static GLboolean
-ffbCreateBuffer(__DRIscreen *driScrnPriv,
- __DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- /* Mesa checks for pitch > 0, but ffb doesn't use pitches */
- int bogusPitch = 1;
- int bpp = 4; /* we've always got a 32bpp framebuffer */
- int offset = 0; /* always at 0 for offset */
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- } else {
- GLboolean swStencil = (mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24);
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, bpp, offset, bogusPitch,
- driDrawPriv);
- ffbSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, bpp, offset, bogusPitch,
- driDrawPriv);
- ffbSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, bpp, offset,
- bogusPitch, driDrawPriv);
- ffbSetDepthFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(MESA_FORMAT_S8, NULL, bpp, offset,
- bogusPitch, driDrawPriv);
- ffbSetStencilFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-ffbDestroyBuffer(__DRIdrawable *driDrawPriv)
-{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
-}
-
-
-#define USE_FAST_SWAP
-
-static void
-ffbSwapBuffers( __DRIdrawable *dPriv )
-{
- ffbContextPtr fmesa = (ffbContextPtr) dPriv->driContextPriv->driverPrivate;
- unsigned int fbc, wid, wid_reg_val, dac_db_bit;
- unsigned int shadow_dac_addr, active_dac_addr;
- ffb_fbcPtr ffb;
- ffb_dacPtr dac;
-
- if (fmesa == NULL ||
- fmesa->glCtx->Visual.doubleBufferMode == 0)
- return;
-
- /* Flush pending rendering commands */
- _mesa_notifySwapBuffers(fmesa->glCtx);
-
- ffb = fmesa->regs;
- dac = fmesa->ffbScreen->dac;
-
- fbc = fmesa->fbc;
- wid = fmesa->wid;
-
- /* Swap the buffer we render into and read pixels from. */
- fmesa->back_buffer ^= 1;
-
- /* If we are writing into both buffers, don't mess with
- * the WB setting.
- */
- if ((fbc & FFB_FBC_WB_AB) != FFB_FBC_WB_AB) {
- if ((fbc & FFB_FBC_WB_A) != 0)
- fbc = (fbc & ~FFB_FBC_WB_A) | FFB_FBC_WB_B;
- else
- fbc = (fbc & ~FFB_FBC_WB_B) | FFB_FBC_WB_A;
- }
-
- /* But either way, we must flip the read buffer setting. */
- if ((fbc & FFB_FBC_RB_A) != 0)
- fbc = (fbc & ~FFB_FBC_RB_A) | FFB_FBC_RB_B;
- else
- fbc = (fbc & ~FFB_FBC_RB_B) | FFB_FBC_RB_A;
-
- LOCK_HARDWARE(fmesa);
-
- if (fmesa->fbc != fbc) {
- FFBFifo(fmesa, 1);
- ffb->fbc = fmesa->fbc = fbc;
- fmesa->ffbScreen->rp_active = 1;
- }
-
- /* And swap the buffer displayed in the WID. */
- if (fmesa->ffb_sarea->flags & FFB_DRI_PAC1) {
- shadow_dac_addr = FFBDAC_PAC1_SPWLUT(wid);
- active_dac_addr = FFBDAC_PAC1_APWLUT(wid);
- dac_db_bit = FFBDAC_PAC1_WLUT_DB;
- } else {
- shadow_dac_addr = FFBDAC_PAC2_SPWLUT(wid);
- active_dac_addr = FFBDAC_PAC2_APWLUT(wid);
- dac_db_bit = FFBDAC_PAC2_WLUT_DB;
- }
-
- FFBWait(fmesa, ffb);
-
- wid_reg_val = DACCFG_READ(dac, active_dac_addr);
- if (fmesa->back_buffer == 0)
- wid_reg_val |= dac_db_bit;
- else
- wid_reg_val &= ~dac_db_bit;
-#ifdef USE_FAST_SWAP
- DACCFG_WRITE(dac, active_dac_addr, wid_reg_val);
-#else
- DACCFG_WRITE(dac, shadow_dac_addr, wid_reg_val);
-
- /* Schedule the window transfer. */
- DACCFG_WRITE(dac, FFBDAC_CFG_WTCTRL,
- (FFBDAC_CFG_WTCTRL_TCMD | FFBDAC_CFG_WTCTRL_TE));
-
- {
- int limit = 1000000;
- while (limit--) {
- unsigned int wtctrl = DACCFG_READ(dac, FFBDAC_CFG_WTCTRL);
-
- if ((wtctrl & FFBDAC_CFG_WTCTRL_DS) == 0)
- break;
- }
- }
-#endif
-
- UNLOCK_HARDWARE(fmesa);
-}
-
-static void ffb_init_wid(ffbContextPtr fmesa, unsigned int wid)
-{
- ffb_dacPtr dac = fmesa->ffbScreen->dac;
- unsigned int wid_reg_val, dac_db_bit, active_dac_addr;
- unsigned int shadow_dac_addr;
-
- if (fmesa->ffb_sarea->flags & FFB_DRI_PAC1) {
- shadow_dac_addr = FFBDAC_PAC1_SPWLUT(wid);
- active_dac_addr = FFBDAC_PAC1_APWLUT(wid);
- dac_db_bit = FFBDAC_PAC1_WLUT_DB;
- } else {
- shadow_dac_addr = FFBDAC_PAC2_SPWLUT(wid);
- active_dac_addr = FFBDAC_PAC2_APWLUT(wid);
- dac_db_bit = FFBDAC_PAC2_WLUT_DB;
- }
-
- wid_reg_val = DACCFG_READ(dac, active_dac_addr);
- wid_reg_val &= ~dac_db_bit;
-#ifdef USE_FAST_SWAP
- DACCFG_WRITE(dac, active_dac_addr, wid_reg_val);
-#else
- DACCFG_WRITE(dac, shadow_dac_addr, wid_reg_val);
-
- /* Schedule the window transfer. */
- DACCFG_WRITE(dac, FFBDAC_CFG_WTCTRL,
- (FFBDAC_CFG_WTCTRL_TCMD | FFBDAC_CFG_WTCTRL_TE));
-
- {
- int limit = 1000000;
- while (limit--) {
- unsigned int wtctrl = DACCFG_READ(dac, FFBDAC_CFG_WTCTRL);
-
- if ((wtctrl & FFBDAC_CFG_WTCTRL_DS) == 0)
- break;
- }
- }
-#endif
-}
-
-/* Force the context `c' to be the current context and associate with it
- buffer `b' */
-static GLboolean
-ffbMakeCurrent(__DRIcontext *driContextPriv,
- __DRIdrawable *driDrawPriv,
- __DRIdrawable *driReadPriv)
-{
- if (driContextPriv) {
- ffbContextPtr fmesa = (ffbContextPtr) driContextPriv->driverPrivate;
- int first_time;
-
- fmesa->driDrawable = driDrawPriv;
-
- _mesa_make_current(fmesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
-
- first_time = 0;
- if (fmesa->wid == ~0) {
- first_time = 1;
- if (getenv("LIBGL_SOFTWARE_RENDERING"))
- FALLBACK( fmesa->glCtx, FFB_BADATTR_SWONLY, GL_TRUE );
- }
-
- LOCK_HARDWARE(fmesa);
- if (first_time) {
- fmesa->wid = fmesa->ffb_sarea->wid_table[driDrawPriv->index];
- ffb_init_wid(fmesa, fmesa->wid);
- }
-
- fmesa->state_dirty |= FFB_STATE_ALL;
- fmesa->state_fifo_ents = fmesa->state_all_fifo_ents;
- ffbSyncHardware(fmesa);
- UNLOCK_HARDWARE(fmesa);
-
- if (first_time) {
- /* Also, at the first switch to a new context,
- * we need to clear all the hw buffers.
- */
- ffbDDClear(fmesa->glCtx,
- (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT |
- BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL));
- }
- } else {
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-/* Force the context `c' to be unbound from its buffer */
-static GLboolean
-ffbUnbindContext(__DRIcontext *driContextPriv)
-{
- return GL_TRUE;
-}
-
-void ffbXMesaUpdateState(ffbContextPtr fmesa)
-{
- __DRIdrawable *dPriv = fmesa->driDrawable;
- __DRIscreen *sPriv = fmesa->driScreen;
- int stamp = dPriv->lastStamp;
-
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
- if (dPriv->lastStamp != stamp) {
- GLcontext *ctx = fmesa->glCtx;
-
- ffbCalcViewport(ctx);
- driUpdateFramebufferSize(ctx, dPriv);
- if (ctx->Polygon.StippleFlag) {
- ffbXformAreaPattern(fmesa,
- (const GLubyte *)ctx->PolygonStipple);
- }
- }
-}
-
-static const __DRIconfig **
-ffbFillInModes( __DRIscreen *psp,
- unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer )
-{
- __DRIconfig **configs;
- __GLcontextModes *m;
- unsigned depth_buffer_factor;
- unsigned back_buffer_factor;
- GLenum fb_format;
- GLenum fb_type;
- int i;
-
- /* GLX_SWAP_COPY_OML is only supported because the FFB driver doesn't
- * support pageflipping at all.
- */
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
- };
-
- uint8_t depth_bits_array[3];
- uint8_t stencil_bits_array[3];
- uint8_t msaa_samples_array[1];
-
- depth_bits_array[0] = 0;
- depth_bits_array[1] = depth_bits;
- depth_bits_array[2] = depth_bits;
-
- /* Just like with the accumulation buffer, always provide some modes
- * with a stencil buffer. It will be a sw fallback, but some apps won't
- * care about that.
- */
- stencil_bits_array[0] = 0;
- stencil_bits_array[1] = 0;
- stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits;
-
- msaa_samples_array[0] = 0;
-
- depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
- back_buffer_factor = (have_back_buffer) ? 3 : 1;
-
- if ( pixel_bits == 16 ) {
- fb_format = GL_RGB;
- fb_type = GL_UNSIGNED_SHORT_5_6_5;
- }
- else {
- fb_format = GL_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- configs = driCreateConfigs(fb_format, fb_type,
- depth_bits_array, stencil_bits_array,
- depth_buffer_factor, back_buffer_modes,
- back_buffer_factor,
- msaa_samples_array, 1, GL_TRUE);
- if (configs == NULL) {
- fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
- __LINE__);
- return NULL;
- }
-
- /* Mark the visual as slow if there are "fake" stencil bits.
- */
- for (i = 0; configs[i]; i++) {
- m = &configs[i]->modes;
- if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
- m->visualRating = GLX_SLOW_CONFIG;
- }
- }
-
- return (const __DRIconfig **) configs;
-}
-
-
-/**
- * This is the driver specific part of the createNewScreen entry point.
- *
- * \todo maybe fold this into intelInitDriver
- *
- * \return the __GLcontextModes supported by this driver
- */
-static const __DRIconfig **
-ffbInitScreen(__DRIscreen *psp)
-{
- static const __DRIversion ddx_expected = { 0, 1, 1 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 0, 0, 1 };
-
- if ( ! driCheckDriDdxDrmVersions2( "ffb",
- &psp->dri_version, & dri_expected,
- &psp->ddx_version, & ddx_expected,
- &psp->drm_version, & drm_expected ) )
- return NULL;
-
- if (!ffbInitDriver(psp))
- return NULL;
-
- return ffbFillInModes( psp, 32, 16, 0, GL_TRUE );
-}
-
-const struct __DriverAPIRec driDriverAPI = {
- .InitScreen = ffbInitScreen,
- .DestroyScreen = ffbDestroyScreen,
- .CreateContext = ffbCreateContext,
- .DestroyContext = ffbDestroyContext,
- .CreateBuffer = ffbCreateBuffer,
- .DestroyBuffer = ffbDestroyBuffer,
- .SwapBuffers = ffbSwapBuffers,
- .MakeCurrent = ffbMakeCurrent,
- .UnbindContext = ffbUnbindContext,
- .GetSwapInfo = NULL,
- .GetDrawableMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-/* This is the table of extensions that the loader will dlsym() for. */
-PUBLIC const __DRIextension *__driDriverExtensions[] = {
- &driCoreExtension.base,
- &driLegacyExtension.base,
- NULL
-};
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.h b/src/mesa/drivers/dri/ffb/ffb_xmesa.h
deleted file mode 100644
index 2b1740d2219..00000000000
--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.h
+++ /dev/null
@@ -1,25 +0,0 @@
-
-#ifndef _FFB_XMESA_H_
-#define _FFB_XMESA_H_
-
-#include <sys/time.h>
-#include "dri_util.h"
-#include "main/mtypes.h"
-#include "ffb_drishare.h"
-#include "ffb_regs.h"
-#include "ffb_dac.h"
-#include "ffb_fifo.h"
-
-typedef struct {
- __DRIscreen *sPriv;
- ffb_fbcPtr regs;
- ffb_dacPtr dac;
- volatile char *sfb8r;
- volatile char *sfb32;
- volatile char *sfb64;
-
- int fifo_cache;
- int rp_active;
-} ffbScreenPrivate;
-
-#endif /* !(_FFB_XMESA_H) */
diff --git a/src/mesa/drivers/dri/ffb/server/ffb_dac.h b/src/mesa/drivers/dri/ffb/server/ffb_dac.h
deleted file mode 100644
index ac4a75b4598..00000000000
--- a/src/mesa/drivers/dri/ffb/server/ffb_dac.h
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Acceleration for the Creator and Creator3D framebuffer - DAC register layout.
- *
- * Copyright (C) 2000 David S. Miller (davem@redhat.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef _FFB_DAC_H
-#define _FFB_DAC_H
-
-#define Bool int
-
-/* FFB utilizes two different ramdac chips:
- *
- * 1) BT9068 "Pacifica1", used in all FFB1 and
- * FFB2 boards.
- *
- * 2) BT498(a) "Pacifica2", used in FFB2+ and
- * AFB boards.
- *
- * They are mostly equivalent, except in a few key areas:
- *
- * 1) WID register layout
- * 2) Number of CLUT tables
- * 3) Presence of Window Address Mask register
- * 4) Method of GAMMA correction support
- */
-
-/* NOTE: All addresses described in this file are DAC
- * indirect addresses.
- */
-
-/* DAC color values are in the following format. */
-#define FFBDAC_COLOR_BLUE 0x00ff0000
-#define FFBDAC_COLOR_BLUE_SHFT 16
-#define FFBDAC_COLOR_GREEN 0x0000ff00
-#define FFBDAC_COLOR_GREEN_SHFT 8
-#define FFBDAC_COLOR_RED 0x000000ff
-#define FFBDAC_COLOR_RED_SHFT 0
-
-/* Cursor DAC register addresses. */
-#define FFBDAC_CUR_BITMAP_P0 0x000 /* Plane 0 cursor bitmap */
-#define FFBDAC_CUR_BITMAP_P1 0x080 /* Plane 1 cursor bitmap */
-#define FFBDAC_CUR_CTRL 0x100 /* Cursor control */
-#define FFBDAC_CUR_COLOR0 0x101 /* Cursor Color 0 */
-#define FFBDAC_CUR_COLOR1 0x102 /* Cursor Color 1 (bg) */
-#define FFBDAC_CUR_COLOR2 0x103 /* Cursor Color 2 (fg) */
-#define FFBDAC_CUR_POS 0x104 /* Active cursor position */
-
-/* Cursor control register.
- * WARNING: Be careful, reverse logic on these bits.
- */
-#define FFBDAC_CUR_CTRL_P0 0x00000001 /* Plane0 display disable */
-#define FFBDAC_CUR_CTRL_P1 0x00000002 /* Plane1 display disable */
-
-/* Active cursor position register */
-#define FFBDAC_CUR_POS_Y_SIGN 0x80000000 /* Sign of Y position */
-#define FFBDAC_CUR_POS_Y 0x0fff0000 /* Y position */
-#define FFBDAC_CUR_POS_X_SIGN 0x00008000 /* Sign of X position */
-#define FFBDAC_CUR_POS_X 0x00000fff /* X position */
-
-/* Configuration and Palette DAC register addresses. */
-#define FFBDAC_CFG_PPLLCTRL 0x0000 /* Pixel PLL Control */
-#define FFBDAC_CFG_GPLLCTRL 0x0001 /* General Purpose PLL Control */
-#define FFBDAC_CFG_PFCTRL 0x1000 /* Pixel Format Control */
-#define FFBDAC_CFG_UCTRL 0x1001 /* User Control */
-#define FFBDAC_CFG_CLUP_BASE 0x2000 /* Color Lookup Palette */
-#define FFBDAC_CFG_CLUP(entry) (FFBDAC_CFG_CLUP_BASE + ((entry) * 0x100))
-#define FFBDAC_PAC2_SOVWLUT0 0x3100 /* Shadow Overlay Window Lookup 0*/
-#define FFBDAC_PAC2_SOVWLUT1 0x3101 /* Shadow Overlay Window Lookup 1*/
-#define FFBDAC_PAC2_SOVWLUT2 0x3102 /* Shadow Overlay Window Lookup 2*/
-#define FFBDAC_PAC2_SOVWLUT3 0x3103 /* Shadow Overlay Window Lookup 3*/
-#define FFBDAC_PAC2_AOVWLUT0 0x3210 /* Active Overlay Window Lookup 0*/
-#define FFBDAC_PAC2_AOVWLUT1 0x3211 /* Active Overlay Window Lookup 1*/
-#define FFBDAC_PAC2_AOVWLUT2 0x3212 /* Active Overlay Window Lookup 2*/
-#define FFBDAC_PAC2_AOVWLUT3 0x3213 /* Active Overlay Window Lookup 3*/
-#define FFBDAC_CFG_WTCTRL 0x3150 /* Window Transfer Control */
-#define FFBDAC_CFG_TMCTRL 0x3151 /* Transparent Mask Control */
-#define FFBDAC_CFG_TCOLORKEY 0x3152 /* Transparent Color Key */
-#define FFBDAC_CFG_WAMASK 0x3153 /* Window Address Mask (PAC2 only) */
-#define FFBDAC_PAC1_SPWLUT_BASE 0x3100 /* Shadow Primary Window Lookups */
-#define FFBDAC_PAC1_SPWLUT(entry) (FFBDAC_PAC1_SPWLUT_BASE + (entry))
-#define FFBDAC_PAC1_APWLUT_BASE 0x3120 /* Active Primary Window Lookups */
-#define FFBDAC_PAC1_APWLUT(entry) (FFBDAC_PAC1_APWLUT_BASE + (entry))
-#define FFBDAC_PAC2_SPWLUT_BASE 0x3200 /* Shadow Primary Window Lookups */
-#define FFBDAC_PAC2_SPWLUT(entry) (FFBDAC_PAC2_SPWLUT_BASE + (entry))
-#define FFBDAC_PAC2_APWLUT_BASE 0x3240 /* Active Primary Window Lookups */
-#define FFBDAC_PAC2_APWLUT(entry) (FFBDAC_PAC2_APWLUT_BASE + (entry))
-#define FFBDAC_CFG_SANAL 0x5000 /* Signature Analysis Control */
-#define FFBDAC_CFG_DACCTRL 0x5001 /* DAC Control */
-#define FFBDAC_CFG_TGEN 0x6000 /* Timing Generator Control */
-#define FFBDAC_CFG_VBNP 0x6001 /* Vertical Blank Negation Point */
-#define FFBDAC_CFG_VBAP 0x6002 /* Vertical Blank Assertion Point*/
-#define FFBDAC_CFG_VSNP 0x6003 /* Vertical Sync Negation Point */
-#define FFBDAC_CFG_VSAP 0x6004 /* Vertical Sync Assertion Point */
-#define FFBDAC_CFG_HSNP 0x6005 /* Horz Serration Negation Point */
-#define FFBDAC_CFG_HBNP 0x6006 /* Horz Blank Negation Point */
-#define FFBDAC_CFG_HBAP 0x6007 /* Horz Blank Assertion Point */
-#define FFBDAC_CFG_HSYNCNP 0x6008 /* Horz Sync Negation Point */
-#define FFBDAC_CFG_HSYNCAP 0x6009 /* Horz Sync Assertion Point */
-#define FFBDAC_CFG_HSCENNP 0x600A /* Horz SCEN Negation Point */
-#define FFBDAC_CFG_HSCENAP 0x600B /* Horz SCEN Assertion Point */
-#define FFBDAC_CFG_EPNP 0x600C /* Eql'zing Pulse Negation Point */
-#define FFBDAC_CFG_EINP 0x600D /* Eql'zing Intvl Negation Point */
-#define FFBDAC_CFG_EIAP 0x600E /* Eql'zing Intvl Assertion Point*/
-#define FFBDAC_CFG_TGVC 0x600F /* Timing Generator Vert Counter */
-#define FFBDAC_CFG_TGHC 0x6010 /* Timing Generator Horz Counter */
-#define FFBDAC_CFG_DID 0x8000 /* Device Identification */
-#define FFBDAC_CFG_MPDATA 0x8001 /* Monitor Port Data */
-#define FFBDAC_CFG_MPSENSE 0x8002 /* Monitor Port Sense */
-
-/* Pixel PLL Control Register */
-#define FFBDAC_CFG_PPLLCTRL_M 0x0000007f /* PLL VCO Multiplicand */
-#define FFBDAC_CFG_PPLLCTRL_D 0x00000780 /* PLL VCO Divisor */
-#define FFBDAC_CFG_PPLLCTRL_PFD 0x00001800 /* Post VCO Frequency Divider */
-#define FFBDAC_CFG_PPLLCTRL_EN 0x00004000 /* Enable PLL as pixel clock src */
-
-/* General Purpose PLL Control Register */
-#define FFBDAC_CFG_GPLLCTRL_M 0x0000007f /* PLL VCO Multiplicand */
-#define FFBDAC_CFG_GPLLCTRL_D 0x00000780 /* PLL VCO Divisor */
-#define FFBDAC_CFG_GPLLCTRL_PFD 0x00001800 /* Post VCO Frequency Divider */
-#define FFBDAC_CFG_GPLLCTRL_EN 0x00004000 /* Enable PLL as Gen. Purpose clk*/
-
-/* Pixel Format Control Register */
-#define FFBDAC_CFG_PFCTRL_2_1 0x00000000 /* 2:1 pixel interleave format */
-#define FFBDAC_CFG_PFCTRL_4_1 0x00000001 /* 4:1 pixel interleave format */
-#define FFBDAC_CFG_PFCTRL_42_1 0x00000002 /* 4/2:1 pixel interleave format */
-#define FFBDAC_CFG_PFCTRL_82_1 0x00000003 /* 8/2:1 pixel interleave format */
-
-/* User Control Register */
-#define FFBDAC_UCTRL_IPDISAB 0x00000001 /* Disable input pullup resistors*/
-#define FFBDAC_UCTRL_ABLANK 0x00000002 /* Asynchronous Blank */
-#define FFBDAC_UCTRL_DBENAB 0x00000004 /* Double-Buffer Enable */
-#define FFBDAC_UCTRL_OVENAB 0x00000008 /* Overlay Enable */
-#define FFBDAC_UCTRL_WMODE 0x00000030 /* Window Mode */
-#define FFBDAC_UCTRL_WM_COMB 0x00000000 /* Window Mode = Combined */
-#define FFBDAC_UCTRL_WM_S4 0x00000010 /* Window Mode = Seperate_4 */
-#define FFBDAC_UCTRL_WM_S8 0x00000020 /* Window Mode = Seperate_8 */
-#define FFBDAC_UCTRL_WM_RESV 0x00000030 /* Window Mode = reserved */
-#define FFBDAC_UCTRL_MANREV 0x00000f00 /* 4-bit Manufacturing Revision */
-
-/* Overlay Window Lookup Registers (PAC2 only) */
-#define FFBDAC_CFG_OVWLUT_PSEL 0x0000000f /* Palette Section, Seperate_4 */
-#define FFBDAC_CFG_OVWLUT_PTBL 0x00000030 /* Palette Table */
-#define FFBDAC_CFG_OVWLUT_LKUP 0x00000100 /* 1 = Use palette, 0 = Bypass */
-#define FFBDAC_CFG_OVWLUT_OTYP 0x00000c00 /* Overlay Type */
-#define FFBDAC_CFG_OVWLUT_O_N 0x00000000 /* Overlay Type - None */
-#define FFBDAC_CFG_OVWLUT_O_T 0x00000400 /* Overlay Type - Transparent */
-#define FFBDAC_CFG_OVWLUT_O_O 0x00000800 /* Overlay Type - Opaque */
-#define FFBDAC_CFG_OVWLUT_O_R 0x00000c00 /* Overlay Type - Reserved */
-#define FFBDAC_CFG_OVWLUT_PCS 0x00003000 /* Psuedocolor Src */
-#define FFBDAC_CFG_OVWLUT_P_XO 0x00000000 /* Psuedocolor Src - XO[7:0] */
-#define FFBDAC_CFG_OVWLUT_P_R 0x00001000 /* Psuedocolor Src - R[7:0] */
-#define FFBDAC_CFG_OVWLUT_P_G 0x00002000 /* Psuedocolor Src - G[7:0] */
-#define FFBDAC_CFG_OVWLUT_P_B 0x00003000 /* Psuedocolor Src - B[7:0] */
-
-/* Window Transfer Control Register */
-#define FFBDAC_CFG_WTCTRL_DS 0x00000001 /* Device Status, 1 = Busy */
-#define FFBDAC_CFG_WTCTRL_TCMD 0x00000002 /* Transfer Command
- * 1 = Transfer, 0 = No Action
- */
-#define FFBDAC_CFG_WTCTRL_TE 0x00000004 /* Transfer Event
- * 1 = Next Frame, 0 = Next Field
- */
-#define FFBDAC_CFG_WTCTRL_DRD 0x00000008 /* Drawing Data
- * 1 = Local Drawing Active
- * 0 = Local Drawing Idle
- */
-#define FFBDAC_CFG_WTCTRL_DRS 0x00000010 /* Drawing Status
- * 1 = Network Drawing Active
- * 0 = Network Drawing Idle
- */
-
-/* Transparent Mask Control Register */
-#define FFBDAC_CFG_TMCTRL_OMSK 0x000000ff /* Overlay Mask */
-
-/* Transparent Color Key Register */
-#define FFBDAC_CFG_TCOLORKEY_K 0x000000ff /* Overlay Color Key */
-
-/* Window Address Mask Register (PAC2 only) */
-#define FFBDAC_CFG_WAMASK_PMSK 0x0000003f /* PWLUT select PMASK */
-#define FFBDAC_CFG_WAMASK_OMSK 0x00000300 /* OWLUT control OMASK */
-
-/* (non-Overlay) Window Lookup Table Registers, PAC1 format */
-#define FFBDAC_PAC1_WLUT_DB 0x00000020 /* 0 = Buffer A, 1 = Buffer B */
-#define FFBDAC_PAC1_WLUT_C 0x0000001c /* C: Color Model Selection */
-#define FFBDAC_PAC1_WLUT_C_8P 0x00000000 /* C: 8bpp Pseudocolor */
-#define FFBDAC_PAC1_WLUT_C_8LG 0x00000004 /* C: 8bpp Linear Grey */
-#define FFBDAC_PAC1_WLUT_C_8NG 0x00000008 /* C: 8bpp Non-Linear Grey */
-#define FFBDAC_PAC1_WLUT_C_24D 0x00000010 /* C: 24bpp Directcolor */
-#define FFBDAC_PAC1_WLUT_C_24LT 0x00000014 /* C: 24bpp Linear Truecolor */
-#define FFBDAC_PAC1_WLUT_C_24NT 0x00000018 /* C: 24bpp Non-Linear Truecolor */
-#define FFBDAC_PAC1_WLUT_PCS 0x00000003 /* Pseudocolor Src */
-#define FFBDAC_PAC1_WLUT_P_XO 0x00000000 /* Pseudocolor Src - XO[7:0] */
-#define FFBDAC_PAC1_WLUT_P_R 0x00000001 /* Pseudocolor Src - R[7:0] */
-#define FFBDAC_PAC1_WLUT_P_G 0x00000002 /* Pseudocolor Src - G[7:0] */
-#define FFBDAC_PAC1_WLUT_P_B 0x00000003 /* Pseudocolor Src - B[7:0] */
-
-/* (non-Overlay) Window Lookup Table Registers, PAC2 format */
-#define FFBDAC_PAC2_WLUT_PTBL 0x00000030 /* Palette Table Entry */
-#define FFBDAC_PAC2_WLUT_LKUP 0x00000100 /* 1 = Use palette, 0 = Bypass */
-#define FFBDAC_PAC2_WLUT_PCS 0x00003000 /* Pseudocolor Src */
-#define FFBDAC_PAC2_WLUT_P_XO 0x00000000 /* Pseudocolor Src - XO[7:0] */
-#define FFBDAC_PAC2_WLUT_P_R 0x00001000 /* Pseudocolor Src - R[7:0] */
-#define FFBDAC_PAC2_WLUT_P_G 0x00002000 /* Pseudocolor Src - G[7:0] */
-#define FFBDAC_PAC2_WLUT_P_B 0x00003000 /* Pseudocolor Src - B[7:0] */
-#define FFBDAC_PAC2_WLUT_DEPTH 0x00004000 /* 0 = Pseudocolor, 1 = Truecolor*/
-#define FFBDAC_PAC2_WLUT_DB 0x00008000 /* 0 = Buffer A, 1 = Buffer B */
-
-/* Signature Analysis Control Register */
-#define FFBDAC_CFG_SANAL_SRR 0x000000ff /* DAC Seed/Result for Red */
-#define FFBDAC_CFG_SANAL_SRG 0x0000ff00 /* DAC Seed/Result for Green */
-#define FFBDAC_CFG_SANAL_SRB 0x00ff0000 /* DAC Seed/Result for Blue */
-#define FFBDAC_CFG_SANAL_RQST 0x01000000 /* Signature Capture Request */
-#define FFBDAC_CFG_SANAL_BSY 0x02000000 /* Signature Analysis Busy */
-#define FFBDAC_CFG_SANAL_DSM 0x04000000 /* Data Strobe Mode
- * 0 = Signature Analysis Mode
- * 1 = Data Strobe Mode
- */
-
-/* DAC Control Register */
-#define FFBDAC_CFG_DACCTRL_O2 0x00000003 /* Operand 2 Select
- * 00 = Normal Operation
- * 01 = Select 145mv Reference
- * 10 = Select Blue DAC Output
- * 11 = Reserved
- */
-#define FFBDAC_CFG_DACCTRL_O1 0x0000000c /* Operand 1 Select
- * 00 = Normal Operation
- * 01 = Select Green DAC Output
- * 10 = Select Red DAC Output
- * 11 = Reserved
- */
-#define FFBDAC_CFG_DACCTRL_CR 0x00000010 /* Comparator Result
- * 0 = operand1 < operand2
- * 1 = operand1 > operand2
- */
-#define FFBDAC_CFG_DACCTRL_SGE 0x00000020 /* Sync-on-Green Enable */
-#define FFBDAC_CFG_DACCTRL_PE 0x00000040 /* Pedestal Enable */
-#define FFBDAC_CFG_DACCTRL_VPD 0x00000080 /* VSYNC* Pin Disable */
-#define FFBDAC_CFG_DACCTRL_SPB 0x00000100 /* Sync Polarity Bit
- * 0 = VSYNC* and CSYNC* active low
- * 1 = VSYNC* and CSYNC* active high
- */
-
-/* Timing Generator Control Register */
-#define FFBDAC_CFG_TGEN_VIDE 0x00000001 /* Video Enable */
-#define FFBDAC_CFG_TGEN_TGE 0x00000002 /* Timing Generator Enable */
-#define FFBDAC_CFG_TGEN_HSD 0x00000004 /* HSYNC* Disabled */
-#define FFBDAC_CFG_TGEN_VSD 0x00000008 /* VSYNC* Disabled */
-#define FFBDAC_CFG_TGEN_EQD 0x00000010 /* Equalization Disabled */
-#define FFBDAC_CFG_TGEN_MM 0x00000020 /* 0 = Slave, 1 = Master */
-#define FFBDAC_CFG_TGEN_IM 0x00000040 /* 1 = Interlaced Mode */
-
-/* Device Identification Register, should be 0xA236E1AD for FFB bt497/bt498 */
-#define FFBDAC_CFG_DID_ONE 0x00000001 /* Always set */
-#define FFBDAC_CFG_DID_MANUF 0x00000ffe /* Manufacturer ID */
-#define FFBDAC_CFG_DID_PNUM 0x0ffff000 /* Device Part Number */
-#define FFBDAC_CFG_DID_REV 0xf0000000 /* Device Revision */
-
-/* Monitor Port Data Register */
-#define FFBDAC_CFG_MPDATA_SCL 0x00000001 /* SCL Data */
-#define FFBDAC_CFG_MPDATA_SDA 0x00000002 /* SDA Data */
-
-/* Monitor Port Sense Register */
-#define FFBDAC_CFG_MPSENSE_SCL 0x00000001 /* SCL Sense */
-#define FFBDAC_CFG_MPSENSE_SDA 0x00000002 /* SDA Sense */
-
-/* DAC register access shorthands. */
-#define DACCUR_READ(DAC, ADDR) ((DAC)->cur = (ADDR), (DAC)->curdata)
-#define DACCUR_WRITE(DAC, ADDR, VAL) ((DAC)->cur = (ADDR), (DAC)->curdata = (VAL))
-#define DACCFG_READ(DAC, ADDR) ((DAC)->cfg = (ADDR), (DAC)->cfgdata)
-#define DACCFG_WRITE(DAC, ADDR, VAL) ((DAC)->cfg = (ADDR), (DAC)->cfgdata = (VAL))
-
-typedef struct ffb_dac_hwstate {
- unsigned int ppllctrl;
- unsigned int gpllctrl;
- unsigned int pfctrl;
- unsigned int uctrl;
- unsigned int clut[256 * 4]; /* One 256 entry clut on PAC1, 4 on PAC2 */
- unsigned int ovluts[4]; /* Overlay WLUTS, PAC2 only */
- unsigned int wtctrl;
- unsigned int tmctrl;
- unsigned int tcolorkey;
- unsigned int wamask;
- unsigned int pwluts[64];
- unsigned int dacctrl;
- unsigned int tgen;
- unsigned int vbnp;
- unsigned int vbap;
- unsigned int vsnp;
- unsigned int vsap;
- unsigned int hsnp;
- unsigned int hbnp;
- unsigned int hbap;
- unsigned int hsyncnp;
- unsigned int hsyncap;
- unsigned int hscennp;
- unsigned int hscenap;
- unsigned int epnp;
- unsigned int einp;
- unsigned int eiap;
-} ffb_dac_hwstate_t;
-
-typedef struct {
- Bool InUse;
-
- /* The following fields are undefined unless InUse is TRUE. */
- int refcount;
- Bool canshare;
- unsigned int wlut_regval;
- int buffer; /* 0 = Buffer A, 1 = Buffer B */
- int depth; /* 8 or 32 bpp */
- int greyscale; /* 1 = greyscale, 0 = color */
- int linear; /* 1 = linear, 0 = non-linear */
- int direct; /* 1 = 24bpp directcolor */
- int channel; /* 0 = X, 1 = R, 2 = G, 3 = B */
- int palette; /* Only PAC2 has multiple CLUTs */
-} ffb_wid_info_t;
-
-#define FFB_MAX_PWIDS 64
-typedef struct {
- int num_wids;
- int wid_shift; /* To get X channel value */
- ffb_wid_info_t wid_pool[FFB_MAX_PWIDS];
-} ffb_wid_pool_t;
-
-typedef struct ffb_dac_info {
- unsigned int flags;
-#define FFB_DAC_PAC1 0x00000001 /* Pacifica1 DAC, BT9068 */
-#define FFB_DAC_PAC2 0x00000002 /* Pacifica2 DAC, BT498 */
-#define FFB_DAC_ICURCTL 0x00000004 /* Inverted CUR_CTRL bits */
-
- unsigned int kernel_wid;
-
- /* These registers need to be modified when changing DAC
- * timing state, so at init time we capture their values.
- */
- unsigned int ffbcfg0;
- unsigned int ffbcfg2;
- unsigned int ffb_passin_ctrl; /* FFB2+/AFB only */
-
- ffb_dac_hwstate_t kern_dac_state;
- ffb_dac_hwstate_t x_dac_state;
-
- ffb_wid_pool_t wid_table;
-} ffb_dac_info_t;
-
-#endif /* _FFB_DAC_H */
diff --git a/src/mesa/drivers/dri/ffb/server/ffb_drishare.h b/src/mesa/drivers/dri/ffb/server/ffb_drishare.h
deleted file mode 100644
index 69fefa3f0a1..00000000000
--- a/src/mesa/drivers/dri/ffb/server/ffb_drishare.h
+++ /dev/null
@@ -1,47 +0,0 @@
-
-#ifndef _FFB_DRISHARE_H
-#define _FFB_DRISHARE_H
-
-typedef struct ffb_dri_state {
- int flags;
-#define FFB_DRI_FFB2 0x00000001
-#define FFB_DRI_FFB2PLUS 0x00000002
-#define FFB_DRI_PAC1 0x00000004
-#define FFB_DRI_PAC2 0x00000008
-
- /* Indexed by DRI drawable id. */
-#define FFB_DRI_NWIDS 64
- unsigned int wid_table[FFB_DRI_NWIDS];
-} ffb_dri_state_t;
-
-#define FFB_DRISHARE(SAREA) \
- ((ffb_dri_state_t *) (((char *)(SAREA)) + sizeof(drm_sarea_t)))
-
-typedef struct {
- drm_handle_t hFbcRegs;
- drmSize sFbcRegs;
-
- drm_handle_t hDacRegs;
- drmSize sDacRegs;
-
- drm_handle_t hSfb8r;
- drmSize sSfb8r;
-
- drm_handle_t hSfb32;
- drmSize sSfb32;
-
- drm_handle_t hSfb64;
- drmSize sSfb64;
-
- /* Fastfill/Pagefill parameters. */
- unsigned char disable_pagefill;
- int fastfill_small_area;
- int pagefill_small_area;
- int fastfill_height;
- int fastfill_width;
- int pagefill_height;
- int pagefill_width;
- short Pf_AlignTab[0x800];
-} FFBDRIRec, *FFBDRIPtr;
-
-#endif /* !(_FFB_DRISHARE_H) */
diff --git a/src/mesa/drivers/dri/ffb/server/ffb_regs.h b/src/mesa/drivers/dri/ffb/server/ffb_regs.h
deleted file mode 100644
index bda5840d609..00000000000
--- a/src/mesa/drivers/dri/ffb/server/ffb_regs.h
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Acceleration for the Creator and Creator3D framebuffer - register layout.
- *
- * Copyright (C) 1998,1999,2000 Jakub Jelinek (jakub@redhat.com)
- * Copyright (C) 1998 Michal Rehacek (majkl@iname.com)
- * Copyright (C) 1999 David S. Miller (davem@redhat.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * JAKUB JELINEK, MICHAL REHACEK, OR DAVID MILLER BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef FFBREGS_H
-#define FFBREGS_H
-
-/* Auxilliary clips. */
-typedef struct {
- volatile unsigned int min;
- volatile unsigned int max;
-} ffb_auxclip, *ffb_auxclipPtr;
-
-/* FFB register set. */
-typedef struct _ffb_fbc {
- /* Next vertex registers, on the right we list which drawops
- * use said register and the logical name the register has in
- * that context.
- */ /* DESCRIPTION DRAWOP(NAME) */
-/*0x00*/unsigned int pad1[3]; /* Reserved */
-/*0x0c*/volatile unsigned int alpha; /* ALPHA Transparency */
-/*0x10*/volatile unsigned int red; /* RED */
-/*0x14*/volatile unsigned int green; /* GREEN */
-/*0x18*/volatile unsigned int blue; /* BLUE */
-/*0x1c*/volatile unsigned int z; /* DEPTH */
-/*0x20*/volatile unsigned int y; /* Y triangle(DOYF) */
- /* aadot(DYF) */
- /* ddline(DYF) */
- /* aaline(DYF) */
-/*0x24*/volatile unsigned int x; /* X triangle(DOXF) */
- /* aadot(DXF) */
- /* ddline(DXF) */
- /* aaline(DXF) */
-/*0x28*/unsigned int pad2[2]; /* Reserved */
-/*0x30*/volatile unsigned int ryf; /* Y (alias to DOYF) ddline(RYF) */
- /* aaline(RYF) */
- /* triangle(RYF) */
-/*0x34*/volatile unsigned int rxf; /* X ddline(RXF) */
- /* aaline(RXF) */
- /* triangle(RXF) */
-/*0x38*/unsigned int pad3[2]; /* Reserved */
-/*0x40*/volatile unsigned int dmyf; /* Y (alias to DOYF) triangle(DMYF) */
-/*0x44*/volatile unsigned int dmxf; /* X triangle(DMXF) */
-/*0x48*/unsigned int pad4[2]; /* Reserved */
-/*0x50*/volatile unsigned int ebyi; /* Y (alias to RYI) polygon(EBYI) */
-/*0x54*/volatile unsigned int ebxi; /* X polygon(EBXI) */
-/*0x58*/unsigned int pad5[2]; /* Reserved */
-/*0x60*/volatile unsigned int by; /* Y brline(RYI) */
- /* fastfill(OP) */
- /* polygon(YI) */
- /* rectangle(YI) */
- /* bcopy(SRCY) */
- /* vscroll(SRCY) */
-/*0x64*/volatile unsigned int bx; /* X brline(RXI) */
- /* polygon(XI) */
- /* rectangle(XI) */
- /* bcopy(SRCX) */
- /* vscroll(SRCX) */
- /* fastfill(GO) */
-/*0x68*/volatile unsigned int dy; /* destination Y fastfill(DSTY) */
- /* bcopy(DSRY) */
- /* vscroll(DSRY) */
-/*0x6c*/volatile unsigned int dx; /* destination X fastfill(DSTX) */
- /* bcopy(DSTX) */
- /* vscroll(DSTX) */
-/*0x70*/volatile unsigned int bh; /* Y (alias to RYI) brline(DYI) */
- /* dot(DYI) */
- /* polygon(ETYI) */
- /* Height fastfill(H) */
- /* bcopy(H) */
- /* vscroll(H) */
- /* Y count fastfill(NY) */
-/*0x74*/volatile unsigned int bw; /* X dot(DXI) */
- /* brline(DXI) */
- /* polygon(ETXI) */
- /* fastfill(W) */
- /* bcopy(W) */
- /* vscroll(W) */
- /* fastfill(NX) */
-/*0x78*/unsigned int pad6[2]; /* Reserved */
-/*0x80*/unsigned int pad7[32]; /* Reserved */
-
- /* Setup Unit's vertex state register */
-/*100*/ volatile unsigned int suvtx;
-/*104*/ unsigned int pad8[63]; /* Reserved */
-
- /* Frame Buffer Control Registers */
-/*200*/ volatile unsigned int ppc; /* Pixel Processor Control */
-/*204*/ volatile unsigned int wid; /* Current WID */
-/*208*/ volatile unsigned int fg; /* FG data */
-/*20c*/ volatile unsigned int bg; /* BG data */
-/*210*/ volatile unsigned int consty; /* Constant Y */
-/*214*/ volatile unsigned int constz; /* Constant Z */
-/*218*/ volatile unsigned int xclip; /* X Clip */
-/*21c*/ volatile unsigned int dcss; /* Depth Cue Scale Slope */
-/*220*/ volatile unsigned int vclipmin; /* Viewclip XY Min Bounds */
-/*224*/ volatile unsigned int vclipmax; /* Viewclip XY Max Bounds */
-/*228*/ volatile unsigned int vclipzmin; /* Viewclip Z Min Bounds */
-/*22c*/ volatile unsigned int vclipzmax; /* Viewclip Z Max Bounds */
-/*230*/ volatile unsigned int dcsf; /* Depth Cue Scale Front Bound */
-/*234*/ volatile unsigned int dcsb; /* Depth Cue Scale Back Bound */
-/*238*/ volatile unsigned int dczf; /* Depth Cue Z Front */
-/*23c*/ volatile unsigned int dczb; /* Depth Cue Z Back */
-/*240*/ unsigned int pad9; /* Reserved */
-/*244*/ volatile unsigned int blendc; /* Alpha Blend Control */
-/*248*/ volatile unsigned int blendc1; /* Alpha Blend Color 1 */
-/*24c*/ volatile unsigned int blendc2; /* Alpha Blend Color 2 */
-/*250*/ volatile unsigned int fbramitc; /* FB RAM Interleave Test Control */
-/*254*/ volatile unsigned int fbc; /* Frame Buffer Control */
-/*258*/ volatile unsigned int rop; /* Raster OPeration */
-/*25c*/ volatile unsigned int cmp; /* Frame Buffer Compare */
-/*260*/ volatile unsigned int matchab; /* Buffer AB Match Mask */
-/*264*/ volatile unsigned int matchc; /* Buffer C(YZ) Match Mask */
-/*268*/ volatile unsigned int magnab; /* Buffer AB Magnitude Mask */
-/*26c*/ volatile unsigned int magnc; /* Buffer C(YZ) Magnitude Mask */
-/*270*/ volatile unsigned int fbcfg0; /* Frame Buffer Config 0 */
-/*274*/ volatile unsigned int fbcfg1; /* Frame Buffer Config 1 */
-/*278*/ volatile unsigned int fbcfg2; /* Frame Buffer Config 2 */
-/*27c*/ volatile unsigned int fbcfg3; /* Frame Buffer Config 3 */
-/*280*/ volatile unsigned int ppcfg; /* Pixel Processor Config */
-/*284*/ volatile unsigned int pick; /* Picking Control */
-/*288*/ volatile unsigned int fillmode; /* FillMode */
-/*28c*/ volatile unsigned int fbramwac; /* FB RAM Write Address Control */
-/*290*/ volatile unsigned int pmask; /* RGB PlaneMask */
-/*294*/ volatile unsigned int xpmask; /* X PlaneMask */
-/*298*/ volatile unsigned int ypmask; /* Y PlaneMask */
-/*29c*/ volatile unsigned int zpmask; /* Z PlaneMask */
-/*2a0*/ ffb_auxclip auxclip[4]; /* Auxilliary Viewport Clip */
-
- /* New 3dRAM III support regs */
-/*2c0*/ volatile unsigned int rawblend2;
-/*2c4*/ volatile unsigned int rawpreblend;
-/*2c8*/ volatile unsigned int rawstencil;
-/*2cc*/ volatile unsigned int rawstencilctl;
-/*2d0*/ volatile unsigned int threedram1;
-/*2d4*/ volatile unsigned int threedram2;
-/*2d8*/ volatile unsigned int passin;
-/*2dc*/ volatile unsigned int rawclrdepth;
-/*2e0*/ volatile unsigned int rawpmask;
-/*2e4*/ volatile unsigned int rawcsrc;
-/*2e8*/ volatile unsigned int rawmatch;
-/*2ec*/ volatile unsigned int rawmagn;
-/*2f0*/ volatile unsigned int rawropblend;
-/*2f4*/ volatile unsigned int rawcmp;
-/*2f8*/ volatile unsigned int rawwac;
-/*2fc*/ volatile unsigned int fbramid;
-
-/*300*/ volatile unsigned int drawop; /* Draw OPeration */
-/*304*/ unsigned int pad10[2]; /* Reserved */
-/*30c*/ volatile unsigned int lpat; /* Line Pattern control */
-/*310*/ unsigned int pad11; /* Reserved */
-/*314*/ volatile unsigned int fontxy; /* XY Font coordinate */
-/*318*/ volatile unsigned int fontw; /* Font Width */
-/*31c*/ volatile unsigned int fontinc; /* Font Increment */
-/*320*/ volatile unsigned int font; /* Font bits */
-/*324*/ unsigned int pad12[3]; /* Reserved */
-/*330*/ volatile unsigned int blend2;
-/*334*/ volatile unsigned int preblend;
-/*338*/ volatile unsigned int stencil;
-/*33c*/ volatile unsigned int stencilctl;
-
-/*340*/ unsigned int pad13[4]; /* Reserved */
-/*350*/ volatile unsigned int dcss1; /* Depth Cue Scale Slope 1 */
-/*354*/ volatile unsigned int dcss2; /* Depth Cue Scale Slope 2 */
-/*358*/ volatile unsigned int dcss3; /* Depth Cue Scale Slope 3 */
-/*35c*/ volatile unsigned int widpmask;
-/*360*/ volatile unsigned int dcs2;
-/*364*/ volatile unsigned int dcs3;
-/*368*/ volatile unsigned int dcs4;
-/*36c*/ unsigned int pad14; /* Reserved */
-/*370*/ volatile unsigned int dcd2;
-/*374*/ volatile unsigned int dcd3;
-/*378*/ volatile unsigned int dcd4;
-/*37c*/ unsigned int pad15; /* Reserved */
-/*380*/ volatile unsigned int pattern[32]; /* area Pattern */
-/*400*/ unsigned int pad16[8]; /* Reserved */
-/*420*/ volatile unsigned int reset; /* chip RESET */
-/*424*/ unsigned int pad17[247]; /* Reserved */
-/*800*/ volatile unsigned int devid; /* Device ID */
-/*804*/ unsigned int pad18[63]; /* Reserved */
-/*900*/ volatile unsigned int ucsr; /* User Control & Status Register */
-/*904*/ unsigned int pad19[31]; /* Reserved */
-/*980*/ volatile unsigned int mer; /* Mode Enable Register */
-/*984*/ unsigned int pad20[1439]; /* Reserved */
-} ffb_fbc, *ffb_fbcPtr;
-
-/* Draw operations */
-#define FFB_DRAWOP_DOT 0x00
-#define FFB_DRAWOP_AADOT 0x01
-#define FFB_DRAWOP_BRLINECAP 0x02
-#define FFB_DRAWOP_BRLINEOPEN 0x03
-#define FFB_DRAWOP_DDLINE 0x04
-#define FFB_DRAWOP_AALINE 0x05
-#define FFB_DRAWOP_TRIANGLE 0x06
-#define FFB_DRAWOP_POLYGON 0x07
-#define FFB_DRAWOP_RECTANGLE 0x08
-#define FFB_DRAWOP_FASTFILL 0x09
-#define FFB_DRAWOP_BCOPY 0x0a /* Not implemented in any FFB, VIS is faster */
-#define FFB_DRAWOP_VSCROLL 0x0b /* Up to 12x faster than BCOPY, 3-4x faster than VIS */
-
-/* FastFill operation codes. */
-#define FFB_FASTFILL_PAGE 0x01
-#define FFB_FASTFILL_BLOCK 0x02
-#define FFB_FASTFILL_COLOR_BLK 0x03
-#define FFB_FASTFILL_BLOCK_X 0x04
-
-/* Spanfill Unit Line Pattern */
-#define FFB_LPAT_SCALEPTR 0xf0000000
-#define FFB_LPAT_SCALEPTR_SHIFT 28
-#define FFB_LPAT_PATPTR 0x0f000000
-#define FFB_LPAT_PATPTR_SHIFT 24
-#define FFB_LPAT_SCALEVAL 0x00f00000
-#define FFB_LPAT_SCALEVAL_SHIFT 20
-#define FFB_LPAT_PATLEN 0x000f0000
-#define FFB_LPAT_PATLEN_SHIFT 16
-#define FFB_LPAT_PATTERN 0x0000ffff
-#define FFB_LPAT_PATTERN_SHIFT 0
-
-/* Pixel processor control */
-/* Force WID */
-#define FFB_PPC_FW_DISABLE 0x800000
-#define FFB_PPC_FW_ENABLE 0xc00000
-#define FFB_PPC_FW_MASK 0xc00000
-/* Auxiliary clip */
-#define FFB_PPC_ACE_DISABLE 0x040000
-#define FFB_PPC_ACE_AUX_SUB 0x080000
-#define FFB_PPC_ACE_AUX_ADD 0x0c0000
-#define FFB_PPC_ACE_MASK 0x0c0000
-/* Depth cue */
-#define FFB_PPC_DCE_DISABLE 0x020000
-#define FFB_PPC_DCE_ENABLE 0x030000
-#define FFB_PPC_DCE_MASK 0x030000
-/* Alpha blend */
-#define FFB_PPC_ABE_DISABLE 0x008000
-#define FFB_PPC_ABE_ENABLE 0x00c000
-#define FFB_PPC_ABE_MASK 0x00c000
-/* View clip */
-#define FFB_PPC_VCE_DISABLE 0x001000
-#define FFB_PPC_VCE_2D 0x002000
-#define FFB_PPC_VCE_3D 0x003000
-#define FFB_PPC_VCE_MASK 0x003000
-/* Area pattern */
-#define FFB_PPC_APE_DISABLE 0x000800
-#define FFB_PPC_APE_ENABLE 0x000c00
-#define FFB_PPC_APE_MASK 0x000c00
-/* Transparent background */
-#define FFB_PPC_TBE_OPAQUE 0x000200
-#define FFB_PPC_TBE_TRANSPARENT 0x000300
-#define FFB_PPC_TBE_MASK 0x000300
-/* Z source */
-#define FFB_PPC_ZS_VAR 0x000080
-#define FFB_PPC_ZS_CONST 0x0000c0
-#define FFB_PPC_ZS_MASK 0x0000c0
-/* Y source */
-#define FFB_PPC_YS_VAR 0x000020
-#define FFB_PPC_YS_CONST 0x000030
-#define FFB_PPC_YS_MASK 0x000030
-/* X source */
-#define FFB_PPC_XS_WID 0x000004
-#define FFB_PPC_XS_VAR 0x000008
-#define FFB_PPC_XS_CONST 0x00000c
-#define FFB_PPC_XS_MASK 0x00000c
-/* Color (BGR) source */
-#define FFB_PPC_CS_VAR 0x000002
-#define FFB_PPC_CS_CONST 0x000003
-#define FFB_PPC_CS_MASK 0x000003
-
-/* X Clip */
-#define FFB_XCLIP_XREF 0x000000ff
-#define FFB_XCLIP_TEST_MASK 0x00070000
-#define FFB_XCLIP_TEST_ALWAYS 0x00000000
-#define FFB_XCLIP_TEST_GT 0x00010000
-#define FFB_XCLIP_TEST_EQ 0x00020000
-#define FFB_XCLIP_TEST_GE 0x00030000
-#define FFB_XCLIP_TEST_NEVER 0x00040000
-#define FFB_XCLIP_TEST_LE 0x00050000
-#define FFB_XCLIP_TEST_NE 0x00060000
-#define FFB_XCLIP_TEST_LT 0x00070000
-
-/* FB Control register */
-/* Write buffer dest */
-#define FFB_FBC_WB_A 0x20000000
-#define FFB_FBC_WB_B 0x40000000
-#define FFB_FBC_WB_AB 0x60000000
-#define FFB_FBC_WB_C 0x80000000
-#define FFB_FBC_WB_AC 0xa0000000
-#define FFB_FBC_WB_BC 0xc0000000
-#define FFB_FBC_WB_ABC 0xe0000000
-#define FFB_FBC_WB_MASK 0xe0000000
-/* Write enable */
-#define FFB_FBC_WE_FORCEOFF 0x00100000
-#define FFB_FBC_WE_FORCEON 0x00200000
-#define FFB_FBC_WE_USE_WMASK 0x00300000
-#define FFB_FBC_WE_MASK 0x00300000
-/* Write group mode */
-#define FFB_FBC_WM_RSVD 0x00040000
-#define FFB_FBC_WM_COMBINED 0x00080000
-#define FFB_FBC_WM_SEPARATE 0x000c0000
-#define FFB_FBC_WM_MASK 0x000c0000
-/* Read buffer src */
-#define FFB_FBC_RB_A 0x00004000
-#define FFB_FBC_RB_B 0x00008000
-#define FFB_FBC_RB_C 0x0000c000
-#define FFB_FBC_RB_MASK 0x0000c000
-/* Stereo buf dest */
-#define FFB_FBC_SB_LEFT 0x00001000
-#define FFB_FBC_SB_RIGHT 0x00002000
-#define FFB_FBC_SB_BOTH 0x00003000
-#define FFB_FBC_SB_MASK 0x00003000
-/* Z plane group enable */
-#define FFB_FBC_ZE_OFF 0x00000400
-#define FFB_FBC_ZE_ON 0x00000800
-#define FFB_FBC_ZE_MASK 0x00000c00
-/* Y plane group enable */
-#define FFB_FBC_YE_OFF 0x00000100
-#define FFB_FBC_YE_ON 0x00000200
-#define FFB_FBC_YE_MASK 0x00000300
-/* X plane group enable */
-#define FFB_FBC_XE_OFF 0x00000040
-#define FFB_FBC_XE_ON 0x00000080
-#define FFB_FBC_XE_MASK 0x000000c0
-/* B plane group enable */
-#define FFB_FBC_BE_OFF 0x00000010
-#define FFB_FBC_BE_ON 0x00000020
-#define FFB_FBC_BE_MASK 0x00000030
-/* G plane group enable */
-#define FFB_FBC_GE_OFF 0x00000004
-#define FFB_FBC_GE_ON 0x00000008
-#define FFB_FBC_GE_MASK 0x0000000c
-/* R plane group enable */
-#define FFB_FBC_RE_OFF 0x00000001
-#define FFB_FBC_RE_ON 0x00000002
-#define FFB_FBC_RE_MASK 0x00000003
-/* Combined */
-#define FFB_FBC_RGBE_OFF 0x00000015
-#define FFB_FBC_RGBE_ON 0x0000002a
-#define FFB_FBC_RGBE_MASK 0x0000003f
-
-/* Raster OP */
-#define FFB_ROP_YZ_MASK 0x008f0000
-#define FFB_ROP_X_MASK 0x00008f00
-#define FFB_ROP_RGB_MASK 0x0000008f
-
-/* Now the rops themselves which get shifted into the
- * above fields.
- */
-#define FFB_ROP_EDIT_BIT 0x80
-#define FFB_ROP_ZERO 0x80
-#define FFB_ROP_NEW_AND_OLD 0x81
-#define FFB_ROP_NEW_AND_NOLD 0x82
-#define FFB_ROP_NEW 0x83
-#define FFB_ROP_NNEW_AND_OLD 0x84
-#define FFB_ROP_OLD 0x85
-#define FFB_ROP_NEW_XOR_OLD 0x86
-#define FFB_ROP_NEW_OR_OLD 0x87
-#define FFB_ROP_NNEW_AND_NOLD 0x88
-#define FFB_ROP_NNEW_XOR_NOLD 0x89
-#define FFB_ROP_NOLD 0x8a
-#define FFB_ROP_NEW_OR_NOLD 0x8b
-#define FFB_ROP_NNEW 0x8c
-#define FFB_ROP_NNEW_OR_OLD 0x8d
-#define FFB_ROP_NNEW_OR_NOLD 0x8e
-#define FFB_ROP_ONES 0x8f
-
-/* FB Compare */
-#define FFB_CMP_MATCHC_MASK 0x8f000000
-#define FFB_CMP_MAGNC_MASK 0x00870000
-#define FFB_CMP_MATCHAB_MASK 0x0000ff00
-#define FFB_CMP_MAGNAB_MASK 0x000000ff
-
-/* Compare Match codes */
-#define FFB_CMP_MATCH_EDIT_BIT 0x80
-#define FFB_CMP_MATCH_ALWAYS 0x80
-#define FFB_CMP_MATCH_NEVER 0x81
-#define FFB_CMP_MATCH_EQ 0x82
-#define FFB_CMP_MATCH_NE 0x83
-#define FFB_CMP_MATCH_A_ALWAYS 0xc0
-#define FFB_CMP_MATCH_B_ALWAYS 0xa0
-
-/* Compare Magnitude codes */
-#define FFB_CMP_MAGN_EDIT_BIT 0x80
-#define FFB_CMP_MAGN_ALWAYS 0x80
-#define FFB_CMP_MAGN_GT 0x81
-#define FFB_CMP_MAGN_EQ 0x82
-#define FFB_CMP_MAGN_GE 0x83
-#define FFB_CMP_MAGN_NEVER 0x84
-#define FFB_CMP_MAGN_LE 0x85
-#define FFB_CMP_MAGN_NE 0x86
-#define FFB_CMP_MAGN_LT 0x87
-#define FFB_CMP_MAGN_A_ALWAYS 0xc0
-#define FFB_CMP_MAGN_B_ALWAYS 0xa0
-
-/* User Control and Status */
-#define FFB_UCSR_FIFO_MASK 0x00000fff
-#define FFB_UCSR_PICK_NO_HIT 0x00020000
-#define FFB_UCSR_PICK_HIT 0x00030000
-#define FFB_UCSR_PICK_DISABLE 0x00080000
-#define FFB_UCSR_PICK_ENABLE 0x000c0000
-#define FFB_UCSR_FB_BUSY 0x01000000
-#define FFB_UCSR_RP_BUSY 0x02000000
-#define FFB_UCSR_ALL_BUSY (FFB_UCSR_RP_BUSY|FFB_UCSR_FB_BUSY)
-#define FFB_UCSR_READ_ERR 0x40000000
-#define FFB_UCSR_FIFO_OVFL 0x80000000
-#define FFB_UCSR_ALL_ERRORS (FFB_UCSR_READ_ERR|FFB_UCSR_FIFO_OVFL)
-
-/* Mode Enable Register */
-#define FFB_MER_EIRA 0x00000080 /* Enable read-ahead, increasing */
-#define FFB_MER_EDRA 0x000000c0 /* Enable read-ahead, decreasing */
-#define FFB_MER_DRA 0x00000040 /* No read-ahead */
-
-/* FBram Config 0 */
-#define FFB_FBCFG0_RFTIME 0xff800000
-#define FFB_FBCFG0_XMAX 0x007c0000
-#define FFB_FBCFG0_YMAX 0x0003ffc0
-#define FFB_FBCFG0_RES_MASK 0x00000030
-#define FFB_FBCFG0_RES_HIGH 0x00000030 /* 1920x1360 */
-#define FFB_FBCFG0_RES_STD 0x00000020 /* 1280x1024 */
-#define FFB_FBCFG0_RES_STEREO 0x00000010 /* 960x580 */
-#define FFB_FBCFG0_RES_PRTRAIT 0x00000000 /* 1280x2048 */
-#define FFB_FBCFG0_ITRLACE 0x00000000
-#define FFB_FBCFG0_SEQUENTIAL 0x00000008
-#define FFB_FBCFG0_DRENA 0x00000004
-#define FFB_FBCFG0_BPMODE 0x00000002
-#define FFB_FBCFG0_RFRSH_RST 0x00000001
-
-typedef struct _ffb_dac {
- volatile unsigned int cfg;
- volatile unsigned int cfgdata;
- volatile unsigned int cur;
- volatile unsigned int curdata;
-} ffb_dac, *ffb_dacPtr;
-
-/* Writing 2 32-bit registers at a time using 64-bit stores. -DaveM */
-#if defined(__GNUC__) && defined(USE_VIS)
-/* 64-bit register writing support.
- * Note: "lo" means "low address".
- */
-#define FFB_WRITE64_COMMON(__regp, __lo32, __hi32, REG0, REG1) \
-do { __extension__ register unsigned int __r0 __asm__(""#REG0); \
- __extension__ register unsigned int __r1 __asm__(""#REG1); \
- __r0 = (__lo32); \
- __r1 = (__hi32); \
- __asm__ __volatile__ ("sllx\t%0, 32, %%g1\n\t" \
- "srl\t%1, 0, %1\n\t" \
- "or\t%%g1, %1, %%g1\n\t" \
- "stx\t%%g1, %2" \
- : : "r" (__r0), "r" (__r1), "m" (*(__regp)) : "g1"); \
-} while(0)
-
-#define FFB_WRITE64P(__regp, __srcp) \
-do { __asm__ __volatile__ ("ldx\t%0, %%g2;" \
- "stx\t%%g2, %1" \
- : : "m" (*(__srcp)), "m" (*(__regp)) \
- : "g2"); \
-} while(0)
-
-#define FFB_WRITE64(__regp, __lo32, __hi32) \
- FFB_WRITE64_COMMON(__regp, __lo32, __hi32, g2, g3)
-#define FFB_WRITE64_2(__regp, __lo32, __hi32) \
- FFB_WRITE64_COMMON(__regp, __lo32, __hi32, g4, g5)
-#define FFB_WRITE64_3(__regp, __lo32, __hi32) \
- FFB_WRITE64_COMMON(__regp, __lo32, __hi32, o4, o5)
-
-#else /* Do not use 64-bit writes. */
-
-#define FFB_WRITE64(__regp, __lo32, __hi32) \
-do { volatile unsigned int *__p = (__regp); \
- *__p = (__lo32); \
- *(__p + 1) = (__hi32); \
-} while(0)
-
-#define FFB_WRITE64P(__regp, __srcp) \
-do { volatile unsigned int *__p = (__regp); \
- unsigned int *__q = (__srcp); \
- *__p = *__q; \
- *(__p + 1) = *(__q + 1); \
-} while(0)
-
-#define FFB_WRITE64_2(__regp, __lo32, __hi32) \
- FFB_WRITE64(__regp, __lo32, __hi32)
-#define FFB_WRITE64_3(__regp, __lo32, __hi32) \
- FFB_WRITE64(__regp, __lo32, __hi32)
-#endif
-
-#endif /* FFBREGS_H */
diff --git a/src/mesa/drivers/dri/gamma/Makefile b/src/mesa/drivers/dri/gamma/Makefile
deleted file mode 100644
index 09df1578fc7..00000000000
--- a/src/mesa/drivers/dri/gamma/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-# src/mesa/drivers/dri/gamma/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = gamma_dri.so
-
-# Not yet
-# MINIGLX_SOURCES = server/gamma_dri.c
-
-DRIVER_SOURCES = \
- gamma_context.c \
- gamma_dd.c \
- gamma_inithw.c \
- gamma_lock.c \
- gamma_render.c \
- gamma_screen.c \
- gamma_span.c \
- gamma_state.c \
- gamma_tex.c \
- gamma_texmem.c \
- gamma_texstate.c \
- gamma_tris.c \
- gamma_vb.c \
- gamma_xmesa.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
diff --git a/src/mesa/drivers/dri/gamma/gamma_client.h b/src/mesa/drivers/dri/gamma/gamma_client.h
deleted file mode 100644
index 6dcf2e9438b..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_client.h
+++ /dev/null
@@ -1,6184 +0,0 @@
-/* Automaticallly generated -- do not edit */
-#ifndef _GLINT_CLIENT_H_
-#define _GLINT_CLIENT_H_
-/* **********************************************************************/
-/* START OF glint_extra.h INCLUSION */
-/* **********************************************************************/
-
-/* glint_extra.h
- * Created: Fri Apr 2 23:32:05 1999 by faith@precisioninsight.com
- * Revised: Fri Apr 2 23:33:00 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- *
- */
-
-#define AreaStippleEnable 0x00001
-#define LineStippleEnable 0x00002
-#define GResetLineStipple 0x00004
-#define FastFillEnable 0x00008
-#define PrimitiveLine 0x00000
-#define PrimitiveTrapezoid 0x00040
-#define PrimitivePoint 0x00080
-#define PrimitiveRectangle 0x000C0
-#define AntialiasEnable 0x00100
-#define AntialiasingQuality 0x00200
-#define UsePointTable 0x00400
-#define SyncOnBitMask 0x00800
-#define SyncOnHostData 0x01000
-#define TextureEnable 0x02000
-#define FogEnable 0x04000
-#define CoverageEnable 0x08000
-#define SubPixelCorrectionEnable 0x10000
-#define SpanOperation 0x40000
-
-
-/* **********************************************************************/
-/* END OF glint_extra.h INCLUSION */
-/* **********************************************************************/
-
-
-#define GlintResetStatus 0x0000
-#define GlintResetStatusReg 0
-#define GlintResetStatusOff 0x0000
-#define GlintResetStatusSec 0x0000
-#define GlintResetStatusSecReg 2
-#define GlintResetStatusSecOff 0x0000
-
-#define GlintIntEnable 0x0008
-#define GlintIntEnableReg 0
-#define GlintIntEnableOff 0x0008
-#define GlintIntEnableSec 0x0008
-#define GlintIntEnableSecReg 2
-#define GlintIntEnableSecOff 0x0008
-
-#define GlintIntFlags 0x0010
-#define GlintIntFlagsReg 0
-#define GlintIntFlagsOff 0x0010
-#define GlintIntFlagsSec 0x0010
-#define GlintIntFlagsSecReg 2
-#define GlintIntFlagsSecOff 0x0010
-
-#define GlintInFIFOSpace 0x0018
-#define GlintInFIFOSpaceReg 0
-#define GlintInFIFOSpaceOff 0x0018
-#define GlintInFIFOSpaceSec 0x0018
-#define GlintInFIFOSpaceSecReg 2
-#define GlintInFIFOSpaceSecOff 0x0018
-
-#define GlintOutFIFOWords 0x0020
-#define GlintOutFIFOWordsReg 0
-#define GlintOutFIFOWordsOff 0x0020
-#define GlintOutFIFOWordsSec 0x0020
-#define GlintOutFIFOWordsSecReg 2
-#define GlintOutFIFOWordsSecOff 0x0020
-
-#define GlintDMAAddress 0x0028
-#define GlintDMAAddressReg 0
-#define GlintDMAAddressOff 0x0028
-#define GlintDMAAddressSec 0x0028
-#define GlintDMAAddressSecReg 2
-#define GlintDMAAddressSecOff 0x0028
-
-#define GlintDMACount 0x0030
-#define GlintDMACountReg 0
-#define GlintDMACountOff 0x0030
-#define GlintDMACountSec 0x0030
-#define GlintDMACountSecReg 2
-#define GlintDMACountSecOff 0x0030
-
-#define GlintErrorFlags 0x0038
-#define GlintErrorFlagsReg 0
-#define GlintErrorFlagsOff 0x0038
-#define GlintErrorFlagsSec 0x0038
-#define GlintErrorFlagsSecReg 2
-#define GlintErrorFlagsSecOff 0x0038
-
-#define GlintVClkCtl 0x0040
-#define GlintVClkCtlReg 0
-#define GlintVClkCtlOff 0x0040
-#define GlintVClkCtlSec 0x0040
-#define GlintVClkCtlSecReg 2
-#define GlintVClkCtlSecOff 0x0040
-
-#define GlintTestRegister 0x0048
-#define GlintTestRegisterReg 0
-#define GlintTestRegisterOff 0x0048
-#define GlintTestRegisterSec 0x0048
-#define GlintTestRegisterSecReg 2
-#define GlintTestRegisterSecOff 0x0048
-
-#define GlintAperture0 0x0050
-#define GlintAperture0Reg 0
-#define GlintAperture0Off 0x0050
-#define GlintAperture0Sec 0x0050
-#define GlintAperture0SecReg 2
-#define GlintAperture0SecOff 0x0050
-
-#define GlintAperture1 0x0058
-#define GlintAperture1Reg 0
-#define GlintAperture1Off 0x0058
-#define GlintAperture1Sec 0x0058
-#define GlintAperture1SecReg 2
-#define GlintAperture1SecOff 0x0058
-
-#define GlintDMAControl 0x0060
-#define GlintDMAControlReg 0
-#define GlintDMAControlOff 0x0060
-#define GlintDMAControlSec 0x0060
-#define GlintDMAControlSecReg 2
-#define GlintDMAControlSecOff 0x0060
-
-#define GlintFIFODis 0x0068
-#define GlintFIFODisReg 0
-#define GlintFIFODisOff 0x0068
-#define GlintFIFODisSec 0x0068
-#define GlintFIFODisSecReg 2
-#define GlintFIFODisSecOff 0x0068
-
-#define GlintLBMemoryCtl 0x1000
-#define GlintLBMemoryCtlReg 1
-#define GlintLBMemoryCtlOff 0x0000
-#define GlintLBMemoryCtlSec 0x1000
-#define GlintLBMemoryCtlSecReg 3
-#define GlintLBMemoryCtlSecOff 0x0000
-
-#define GlintLBMemoryEDO 0x1008
-#define GlintLBMemoryEDOReg 1
-#define GlintLBMemoryEDOOff 0x0008
-#define GlintLBMemoryEDOSec 0x1008
-#define GlintLBMemoryEDOSecReg 3
-#define GlintLBMemoryEDOSecOff 0x0008
-
-#define GlintFBMemoryCtl 0x1800
-#define GlintFBMemoryCtlReg 1
-#define GlintFBMemoryCtlOff 0x0800
-#define GlintFBMemoryCtlSec 0x1800
-#define GlintFBMemoryCtlSecReg 3
-#define GlintFBMemoryCtlSecOff 0x0800
-
-#define GlintFBModeSel 0x1808
-#define GlintFBModeSelReg 1
-#define GlintFBModeSelOff 0x0808
-#define GlintFBModeSelSec 0x1808
-#define GlintFBModeSelSecReg 3
-#define GlintFBModeSelSecOff 0x0808
-
-#define GlintFBGCWrMask 0x1810
-#define GlintFBGCWrMaskReg 1
-#define GlintFBGCWrMaskOff 0x0810
-#define GlintFBGCWrMaskSec 0x1810
-#define GlintFBGCWrMaskSecReg 3
-#define GlintFBGCWrMaskSecOff 0x0810
-
-#define GlintFBGCColorLower 0x1818
-#define GlintFBGCColorLowerReg 1
-#define GlintFBGCColorLowerOff 0x0818
-#define GlintFBGCColorLowerSec 0x1818
-#define GlintFBGCColorLowerSecReg 3
-#define GlintFBGCColorLowerSecOff 0x0818
-
-#define GlintFBTXMemCtl 0x1820
-#define GlintFBTXMemCtlReg 1
-#define GlintFBTXMemCtlOff 0x0820
-#define GlintFBTXMemCtlSec 0x1820
-#define GlintFBTXMemCtlSecReg 3
-#define GlintFBTXMemCtlSecOff 0x0820
-
-#define GlintFBWrMask 0x1830
-#define GlintFBWrMaskReg 1
-#define GlintFBWrMaskOff 0x0830
-#define GlintFBWrMaskSec 0x1830
-#define GlintFBWrMaskSecReg 3
-#define GlintFBWrMaskSecOff 0x0830
-
-#define GlintFBGCColorUpper 0x1838
-#define GlintFBGCColorUpperReg 1
-#define GlintFBGCColorUpperOff 0x0838
-#define GlintFBGCColorUpperSec 0x1838
-#define GlintFBGCColorUpperSecReg 3
-#define GlintFBGCColorUpperSecOff 0x0838
-
-#define GlintVTGHLimit 0x3000
-#define GlintVTGHLimitReg 1
-#define GlintVTGHLimitOff 0x2000
-#define GlintVTGHLimitSec 0x3000
-#define GlintVTGHLimitSecReg 3
-#define GlintVTGHLimitSecOff 0x2000
-
-#define GlintVTGHSyncStart 0x3008
-#define GlintVTGHSyncStartReg 1
-#define GlintVTGHSyncStartOff 0x2008
-#define GlintVTGHSyncStartSec 0x3008
-#define GlintVTGHSyncStartSecReg 3
-#define GlintVTGHSyncStartSecOff 0x2008
-
-#define GlintVTGHSyncEnd 0x3010
-#define GlintVTGHSyncEndReg 1
-#define GlintVTGHSyncEndOff 0x2010
-#define GlintVTGHSyncEndSec 0x3010
-#define GlintVTGHSyncEndSecReg 3
-#define GlintVTGHSyncEndSecOff 0x2010
-
-#define GlintVTGHBlankEnd 0x3018
-#define GlintVTGHBlankEndReg 1
-#define GlintVTGHBlankEndOff 0x2018
-#define GlintVTGHBlankEndSec 0x3018
-#define GlintVTGHBlankEndSecReg 3
-#define GlintVTGHBlankEndSecOff 0x2018
-
-#define GlintVTGVLimit 0x3020
-#define GlintVTGVLimitReg 1
-#define GlintVTGVLimitOff 0x2020
-#define GlintVTGVLimitSec 0x3020
-#define GlintVTGVLimitSecReg 3
-#define GlintVTGVLimitSecOff 0x2020
-
-#define GlintVTGVSyncStart 0x3028
-#define GlintVTGVSyncStartReg 1
-#define GlintVTGVSyncStartOff 0x2028
-#define GlintVTGVSyncStartSec 0x3028
-#define GlintVTGVSyncStartSecReg 3
-#define GlintVTGVSyncStartSecOff 0x2028
-
-#define GlintVTGVSyncEnd 0x3030
-#define GlintVTGVSyncEndReg 1
-#define GlintVTGVSyncEndOff 0x2030
-#define GlintVTGVSyncEndSec 0x3030
-#define GlintVTGVSyncEndSecReg 3
-#define GlintVTGVSyncEndSecOff 0x2030
-
-#define GlintVTGVBlankEnd 0x3038
-#define GlintVTGVBlankEndReg 1
-#define GlintVTGVBlankEndOff 0x2038
-#define GlintVTGVBlankEndSec 0x3038
-#define GlintVTGVBlankEndSecReg 3
-#define GlintVTGVBlankEndSecOff 0x2038
-
-#define GlintVTGHGateStart 0x3040
-#define GlintVTGHGateStartReg 1
-#define GlintVTGHGateStartOff 0x2040
-#define GlintVTGHGateStartSec 0x3040
-#define GlintVTGHGateStartSecReg 3
-#define GlintVTGHGateStartSecOff 0x2040
-
-#define GlintVTGHGateEnd 0x3048
-#define GlintVTGHGateEndReg 1
-#define GlintVTGHGateEndOff 0x2048
-#define GlintVTGHGateEndSec 0x3048
-#define GlintVTGHGateEndSecReg 3
-#define GlintVTGHGateEndSecOff 0x2048
-
-#define GlintVTGVGateStart 0x3050
-#define GlintVTGVGateStartReg 1
-#define GlintVTGVGateStartOff 0x2050
-#define GlintVTGVGateStartSec 0x3050
-#define GlintVTGVGateStartSecReg 3
-#define GlintVTGVGateStartSecOff 0x2050
-
-#define GlintVTGVGateEnd 0x3058
-#define GlintVTGVGateEndReg 1
-#define GlintVTGVGateEndOff 0x2058
-#define GlintVTGVGateEndSec 0x3058
-#define GlintVTGVGateEndSecReg 3
-#define GlintVTGVGateEndSecOff 0x2058
-
-#define GlintVTGPolarity 0x3060
-#define GlintVTGPolarityReg 1
-#define GlintVTGPolarityOff 0x2060
-#define GlintVTGPolaritySec 0x3060
-#define GlintVTGPolaritySecReg 3
-#define GlintVTGPolaritySecOff 0x2060
-
-#define GlintVTGFrameRowAddr 0x3068
-#define GlintVTGFrameRowAddrReg 1
-#define GlintVTGFrameRowAddrOff 0x2068
-#define GlintVTGFrameRowAddrSec 0x3068
-#define GlintVTGFrameRowAddrSecReg 3
-#define GlintVTGFrameRowAddrSecOff 0x2068
-
-#define GlintVTGVLineNumber 0x3070
-#define GlintVTGVLineNumberReg 1
-#define GlintVTGVLineNumberOff 0x2070
-#define GlintVTGVLineNumberSec 0x3070
-#define GlintVTGVLineNumberSecReg 3
-#define GlintVTGVLineNumberSecOff 0x2070
-
-#define GlintVTGSerialClk 0x3078
-#define GlintVTGSerialClkReg 1
-#define GlintVTGSerialClkOff 0x2078
-#define GlintVTGSerialClkSec 0x3078
-#define GlintVTGSerialClkSecReg 3
-#define GlintVTGSerialClkSecOff 0x2078
-
-#define GlintVTGModeCtl 0x3080
-#define GlintVTGModeCtlReg 1
-#define GlintVTGModeCtlOff 0x2080
-#define GlintVTGModeCtlSec 0x3080
-#define GlintVTGModeCtlSecReg 3
-#define GlintVTGModeCtlSecOff 0x2080
-
-#define GlintOutputFIFO 0x2000
-#define GlintOutputFIFOReg 1
-#define GlintOutputFIFOOff 0x1000
-#define GlintOutputFIFOSec 0x2000
-#define GlintOutputFIFOSecReg 3
-#define GlintOutputFIFOSecOff 0x1000
-
-#define GlintGInFIFOSpace 0x0018
-#define GlintGInFIFOSpaceReg 0
-#define GlintGInFIFOSpaceOff 0x0018
-
-#define GlintGDMAAddress 0x0028
-#define GlintGDMAAddressReg 0
-#define GlintGDMAAddressOff 0x0028
-
-#define GlintGDMACount 0x0030
-#define GlintGDMACountReg 0
-#define GlintGDMACountOff 0x0030
-
-#define GlintGDMAControl 0x0060
-#define GlintGDMAControlReg 0
-#define GlintGDMAControlOff 0x0060
-
-#define GlintGOutDMA 0x0080
-#define GlintGOutDMAReg 0
-#define GlintGOutDMAOff 0x0080
-
-#define GlintGOutDMACount 0x0088
-#define GlintGOutDMACountReg 0
-#define GlintGOutDMACountOff 0x0088
-
-#define GlintGResetStatus 0x0800
-#define GlintGResetStatusReg 0
-#define GlintGResetStatusOff 0x0800
-
-#define GlintGIntEnable 0x0808
-#define GlintGIntEnableReg 0
-#define GlintGIntEnableOff 0x0808
-
-#define GlintGIntFlags 0x0810
-#define GlintGIntFlagsReg 0
-#define GlintGIntFlagsOff 0x0810
-
-#define GlintGErrorFlags 0x0838
-#define GlintGErrorFlagsReg 0
-#define GlintGErrorFlagsOff 0x0838
-
-#define GlintGTestRegister 0x0848
-#define GlintGTestRegisterReg 0
-#define GlintGTestRegisterOff 0x0848
-
-#define GlintGFIFODis 0x0868
-#define GlintGFIFODisReg 0
-#define GlintGFIFODisOff 0x0868
-
-#define GlintGChipConfig 0x0870
-#define GlintGChipConfigReg 0
-#define GlintGChipConfigOff 0x0870
-
-#define GlintGCSRAperture 0x0878
-#define GlintGCSRApertureReg 0
-#define GlintGCSRApertureOff 0x0878
-
-#define GlintGPageTableAddr 0x0c00
-#define GlintGPageTableAddrReg 0
-#define GlintGPageTableAddrOff 0x0c00
-
-#define GlintGPageTableLength 0x0c08
-#define GlintGPageTableLengthReg 0
-#define GlintGPageTableLengthOff 0x0c08
-
-#define GlintGDelayTimer 0x0c38
-#define GlintGDelayTimerReg 0
-#define GlintGDelayTimerOff 0x0c38
-
-#define GlintGCommandMode 0x0c40
-#define GlintGCommandModeReg 0
-#define GlintGCommandModeOff 0x0c40
-
-#define GlintGCommandIntEnable 0x0c48
-#define GlintGCommandIntEnableReg 0
-#define GlintGCommandIntEnableOff 0x0c48
-
-#define GlintGCommandIntFlags 0x0c50
-#define GlintGCommandIntFlagsReg 0
-#define GlintGCommandIntFlagsOff 0x0c50
-
-#define GlintGCommandErrorFlags 0x0c58
-#define GlintGCommandErrorFlagsReg 0
-#define GlintGCommandErrorFlagsOff 0x0c58
-
-#define GlintGCommandStatus 0x0c60
-#define GlintGCommandStatusReg 0
-#define GlintGCommandStatusOff 0x0c60
-
-#define GlintGCommandFaultingAddr 0x0c68
-#define GlintGCommandFaultingAddrReg 0
-#define GlintGCommandFaultingAddrOff 0x0c68
-
-#define GlintGVertexFaultingAddr 0x0c70
-#define GlintGVertexFaultingAddrReg 0
-#define GlintGVertexFaultingAddrOff 0x0c70
-
-#define GlintGWriteFaultingAddr 0x0c88
-#define GlintGWriteFaultingAddrReg 0
-#define GlintGWriteFaultingAddrOff 0x0c88
-
-#define GlintGFeedbackSelectCount 0x0c98
-#define GlintGFeedbackSelectCountReg 0
-#define GlintGFeedbackSelectCountOff 0x0c98
-
-#define GlintGGammaProcessorMode 0x0cb8
-#define GlintGGammaProcessorModeReg 0
-#define GlintGGammaProcessorModeOff 0x0cb8
-
-#define GlintGVGAShadow 0x0d00
-#define GlintGVGAShadowReg 0
-#define GlintGVGAShadowOff 0x0d00
-
-#define GlintGMultGLINTAperture 0x0d08
-#define GlintGMultGLINTApertureReg 0
-#define GlintGMultGLINTApertureOff 0x0d08
-
-#define GlintGMultGLINT1 0x0d10
-#define GlintGMultGLINT1Reg 0
-#define GlintGMultGLINT1Off 0x0d10
-
-#define GlintGMultGLINT2 0x0d18
-#define GlintGMultGLINT2Reg 0
-#define GlintGMultGLINT2Off 0x0d18
-
-#define GlintStartXDom 0x8000
-#define GlintStartXDomTag 0x0000
-#define GlintStartXDomReg 1
-#define GlintStartXDomOff 0x7000
-#define GlintStartXDomSec 0x8000
-#define GlintStartXDomSecReg 3
-#define GlintStartXDomSecOff 0x7000
-
-#define GlintdXDom 0x8008
-#define GlintdXDomTag 0x0001
-#define GlintdXDomReg 1
-#define GlintdXDomOff 0x7008
-#define GlintdXDomSec 0x8008
-#define GlintdXDomSecReg 3
-#define GlintdXDomSecOff 0x7008
-
-#define GlintStartXSub 0x8010
-#define GlintStartXSubTag 0x0002
-#define GlintStartXSubReg 1
-#define GlintStartXSubOff 0x7010
-#define GlintStartXSubSec 0x8010
-#define GlintStartXSubSecReg 3
-#define GlintStartXSubSecOff 0x7010
-
-#define GlintdXSub 0x8018
-#define GlintdXSubTag 0x0003
-#define GlintdXSubReg 1
-#define GlintdXSubOff 0x7018
-#define GlintdXSubSec 0x8018
-#define GlintdXSubSecReg 3
-#define GlintdXSubSecOff 0x7018
-
-#define GlintStartY 0x8020
-#define GlintStartYTag 0x0004
-#define GlintStartYReg 1
-#define GlintStartYOff 0x7020
-#define GlintStartYSec 0x8020
-#define GlintStartYSecReg 3
-#define GlintStartYSecOff 0x7020
-
-#define GlintdY 0x8028
-#define GlintdYTag 0x0005
-#define GlintdYReg 1
-#define GlintdYOff 0x7028
-#define GlintdYSec 0x8028
-#define GlintdYSecReg 3
-#define GlintdYSecOff 0x7028
-
-#define GlintGLINTCount 0x8030
-#define GlintGLINTCountTag 0x0006
-#define GlintGLINTCountReg 1
-#define GlintGLINTCountOff 0x7030
-#define GlintGLINTCountSec 0x8030
-#define GlintGLINTCountSecReg 3
-#define GlintGLINTCountSecOff 0x7030
-
-#define GlintRender 0x8038
-#define GlintRenderTag 0x0007
-#define GlintRenderReg 1
-#define GlintRenderOff 0x7038
-#define GlintRenderSec 0x8038
-#define GlintRenderSecReg 3
-#define GlintRenderSecOff 0x7038
-
-#define GlintContinueNewLine 0x8040
-#define GlintContinueNewLineTag 0x0008
-#define GlintContinueNewLineReg 1
-#define GlintContinueNewLineOff 0x7040
-#define GlintContinueNewLineSec 0x8040
-#define GlintContinueNewLineSecReg 3
-#define GlintContinueNewLineSecOff 0x7040
-
-#define GlintContinueNewDom 0x8048
-#define GlintContinueNewDomTag 0x0009
-#define GlintContinueNewDomReg 1
-#define GlintContinueNewDomOff 0x7048
-#define GlintContinueNewDomSec 0x8048
-#define GlintContinueNewDomSecReg 3
-#define GlintContinueNewDomSecOff 0x7048
-
-#define GlintContinueNewSub 0x8050
-#define GlintContinueNewSubTag 0x000a
-#define GlintContinueNewSubReg 1
-#define GlintContinueNewSubOff 0x7050
-#define GlintContinueNewSubSec 0x8050
-#define GlintContinueNewSubSecReg 3
-#define GlintContinueNewSubSecOff 0x7050
-
-#define GlintContinue 0x8058
-#define GlintContinueTag 0x000b
-#define GlintContinueReg 1
-#define GlintContinueOff 0x7058
-#define GlintContinueSec 0x8058
-#define GlintContinueSecReg 3
-#define GlintContinueSecOff 0x7058
-
-#define GlintFlushSpan 0x8060
-#define GlintFlushSpanTag 0x000c
-#define GlintFlushSpanReg 1
-#define GlintFlushSpanOff 0x7060
-#define GlintFlushSpanSec 0x8060
-#define GlintFlushSpanSecReg 3
-#define GlintFlushSpanSecOff 0x7060
-
-#define GlintBitMaskPattern 0x8068
-#define GlintBitMaskPatternTag 0x000d
-#define GlintBitMaskPatternReg 1
-#define GlintBitMaskPatternOff 0x7068
-#define GlintBitMaskPatternSec 0x8068
-#define GlintBitMaskPatternSecReg 3
-#define GlintBitMaskPatternSecOff 0x7068
-
-#define GlintPointTable0 0x8080
-#define GlintPointTable0Tag 0x0010
-#define GlintPointTable0Reg 1
-#define GlintPointTable0Off 0x7080
-#define GlintPointTable0Sec 0x8080
-#define GlintPointTable0SecReg 3
-#define GlintPointTable0SecOff 0x7080
-
-#define GlintPointTable1 0x8088
-#define GlintPointTable1Tag 0x0011
-#define GlintPointTable1Reg 1
-#define GlintPointTable1Off 0x7088
-#define GlintPointTable1Sec 0x8088
-#define GlintPointTable1SecReg 3
-#define GlintPointTable1SecOff 0x7088
-
-#define GlintPointTable2 0x8090
-#define GlintPointTable2Tag 0x0012
-#define GlintPointTable2Reg 1
-#define GlintPointTable2Off 0x7090
-#define GlintPointTable2Sec 0x8090
-#define GlintPointTable2SecReg 3
-#define GlintPointTable2SecOff 0x7090
-
-#define GlintPointTable3 0x8098
-#define GlintPointTable3Tag 0x0013
-#define GlintPointTable3Reg 1
-#define GlintPointTable3Off 0x7098
-#define GlintPointTable3Sec 0x8098
-#define GlintPointTable3SecReg 3
-#define GlintPointTable3SecOff 0x7098
-
-#define GlintRasterizerMode 0x80a0
-#define GlintRasterizerModeTag 0x0014
-#define GlintRasterizerModeReg 1
-#define GlintRasterizerModeOff 0x70a0
-#define GlintRasterizerModeSec 0x80a0
-#define GlintRasterizerModeSecReg 3
-#define GlintRasterizerModeSecOff 0x70a0
-
-#define GlintYLimits 0x80a8
-#define GlintYLimitsTag 0x0015
-#define GlintYLimitsReg 1
-#define GlintYLimitsOff 0x70a8
-#define GlintYLimitsSec 0x80a8
-#define GlintYLimitsSecReg 3
-#define GlintYLimitsSecOff 0x70a8
-
-#define GlintScanLineOwnership 0x80b0
-#define GlintScanLineOwnershipTag 0x0016
-#define GlintScanLineOwnershipReg 1
-#define GlintScanLineOwnershipOff 0x70b0
-#define GlintScanLineOwnershipSec 0x80b0
-#define GlintScanLineOwnershipSecReg 3
-#define GlintScanLineOwnershipSecOff 0x70b0
-
-#define GlintWaitForCompletion 0x80b8
-#define GlintWaitForCompletionTag 0x0017
-#define GlintWaitForCompletionReg 1
-#define GlintWaitForCompletionOff 0x70b8
-#define GlintWaitForCompletionSec 0x80b8
-#define GlintWaitForCompletionSecReg 3
-#define GlintWaitForCompletionSecOff 0x70b8
-
-#define GlintPixelSize 0x80c0
-#define GlintPixelSizeTag 0x0018
-#define GlintPixelSizeReg 1
-#define GlintPixelSizeOff 0x70c0
-#define GlintPixelSizeSec 0x80c0
-#define GlintPixelSizeSecReg 3
-#define GlintPixelSizeSecOff 0x70c0
-
-#define GlintScissorMode 0x8180
-#define GlintScissorModeTag 0x0030
-#define GlintScissorModeReg 1
-#define GlintScissorModeOff 0x7180
-#define GlintScissorModeSec 0x8180
-#define GlintScissorModeSecReg 3
-#define GlintScissorModeSecOff 0x7180
-
-#define GlintScissorMinXY 0x8188
-#define GlintScissorMinXYTag 0x0031
-#define GlintScissorMinXYReg 1
-#define GlintScissorMinXYOff 0x7188
-#define GlintScissorMinXYSec 0x8188
-#define GlintScissorMinXYSecReg 3
-#define GlintScissorMinXYSecOff 0x7188
-
-#define GlintScissorMaxXY 0x8190
-#define GlintScissorMaxXYTag 0x0032
-#define GlintScissorMaxXYReg 1
-#define GlintScissorMaxXYOff 0x7190
-#define GlintScissorMaxXYSec 0x8190
-#define GlintScissorMaxXYSecReg 3
-#define GlintScissorMaxXYSecOff 0x7190
-
-#define GlintScreenSize 0x8198
-#define GlintScreenSizeTag 0x0033
-#define GlintScreenSizeReg 1
-#define GlintScreenSizeOff 0x7198
-#define GlintScreenSizeSec 0x8198
-#define GlintScreenSizeSecReg 3
-#define GlintScreenSizeSecOff 0x7198
-
-#define GlintAreaStippleMode 0x81a0
-#define GlintAreaStippleModeTag 0x0034
-#define GlintAreaStippleModeReg 1
-#define GlintAreaStippleModeOff 0x71a0
-#define GlintAreaStippleModeSec 0x81a0
-#define GlintAreaStippleModeSecReg 3
-#define GlintAreaStippleModeSecOff 0x71a0
-
-#define GlintLineStippleMode 0x81a8
-#define GlintLineStippleModeTag 0x0035
-#define GlintLineStippleModeReg 1
-#define GlintLineStippleModeOff 0x71a8
-#define GlintLineStippleModeSec 0x81a8
-#define GlintLineStippleModeSecReg 3
-#define GlintLineStippleModeSecOff 0x71a8
-
-#define GlintLoadLineStippleCounters 0x81b0
-#define GlintLoadLineStippleCountersTag 0x0036
-#define GlintLoadLineStippleCountersReg 1
-#define GlintLoadLineStippleCountersOff 0x71b0
-#define GlintLoadLineStippleCountersSec 0x81b0
-#define GlintLoadLineStippleCountersSecReg 3
-#define GlintLoadLineStippleCountersSecOff 0x71b0
-
-#define GlintUpdateLineStippleCounters 0x81b8
-#define GlintUpdateLineStippleCountersTag 0x0037
-#define GlintUpdateLineStippleCountersReg 1
-#define GlintUpdateLineStippleCountersOff 0x71b8
-#define GlintUpdateLineStippleCountersSec 0x81b8
-#define GlintUpdateLineStippleCountersSecReg 3
-#define GlintUpdateLineStippleCountersSecOff 0x71b8
-
-#define GlintSaveLineStippleState 0x81c0
-#define GlintSaveLineStippleStateTag 0x0038
-#define GlintSaveLineStippleStateReg 1
-#define GlintSaveLineStippleStateOff 0x71c0
-#define GlintSaveLineStippleStateSec 0x81c0
-#define GlintSaveLineStippleStateSecReg 3
-#define GlintSaveLineStippleStateSecOff 0x71c0
-
-#define GlintWindowOrigin 0x81c8
-#define GlintWindowOriginTag 0x0039
-#define GlintWindowOriginReg 1
-#define GlintWindowOriginOff 0x71c8
-#define GlintWindowOriginSec 0x81c8
-#define GlintWindowOriginSecReg 3
-#define GlintWindowOriginSecOff 0x71c8
-
-#define GlintAreaStipplePattern0 0x8200
-#define GlintAreaStipplePattern0Tag 0x0040
-#define GlintAreaStipplePattern0Reg 1
-#define GlintAreaStipplePattern0Off 0x7200
-#define GlintAreaStipplePattern0Sec 0x8200
-#define GlintAreaStipplePattern0SecReg 3
-#define GlintAreaStipplePattern0SecOff 0x7200
-
-#define GlintAreaStipplePattern1 0x8208
-#define GlintAreaStipplePattern1Tag 0x0041
-#define GlintAreaStipplePattern1Reg 1
-#define GlintAreaStipplePattern1Off 0x7208
-#define GlintAreaStipplePattern1Sec 0x8208
-#define GlintAreaStipplePattern1SecReg 3
-#define GlintAreaStipplePattern1SecOff 0x7208
-
-#define GlintAreaStipplePattern2 0x8210
-#define GlintAreaStipplePattern2Tag 0x0042
-#define GlintAreaStipplePattern2Reg 1
-#define GlintAreaStipplePattern2Off 0x7210
-#define GlintAreaStipplePattern2Sec 0x8210
-#define GlintAreaStipplePattern2SecReg 3
-#define GlintAreaStipplePattern2SecOff 0x7210
-
-#define GlintAreaStipplePattern3 0x8218
-#define GlintAreaStipplePattern3Tag 0x0043
-#define GlintAreaStipplePattern3Reg 1
-#define GlintAreaStipplePattern3Off 0x7218
-#define GlintAreaStipplePattern3Sec 0x8218
-#define GlintAreaStipplePattern3SecReg 3
-#define GlintAreaStipplePattern3SecOff 0x7218
-
-#define GlintAreaStipplePattern4 0x8220
-#define GlintAreaStipplePattern4Tag 0x0044
-#define GlintAreaStipplePattern4Reg 1
-#define GlintAreaStipplePattern4Off 0x7220
-#define GlintAreaStipplePattern4Sec 0x8220
-#define GlintAreaStipplePattern4SecReg 3
-#define GlintAreaStipplePattern4SecOff 0x7220
-
-#define GlintAreaStipplePattern5 0x8228
-#define GlintAreaStipplePattern5Tag 0x0045
-#define GlintAreaStipplePattern5Reg 1
-#define GlintAreaStipplePattern5Off 0x7228
-#define GlintAreaStipplePattern5Sec 0x8228
-#define GlintAreaStipplePattern5SecReg 3
-#define GlintAreaStipplePattern5SecOff 0x7228
-
-#define GlintAreaStipplePattern6 0x8230
-#define GlintAreaStipplePattern6Tag 0x0046
-#define GlintAreaStipplePattern6Reg 1
-#define GlintAreaStipplePattern6Off 0x7230
-#define GlintAreaStipplePattern6Sec 0x8230
-#define GlintAreaStipplePattern6SecReg 3
-#define GlintAreaStipplePattern6SecOff 0x7230
-
-#define GlintAreaStipplePattern7 0x8238
-#define GlintAreaStipplePattern7Tag 0x0047
-#define GlintAreaStipplePattern7Reg 1
-#define GlintAreaStipplePattern7Off 0x7238
-#define GlintAreaStipplePattern7Sec 0x8238
-#define GlintAreaStipplePattern7SecReg 3
-#define GlintAreaStipplePattern7SecOff 0x7238
-
-#define GlintAreaStipplePattern8 0x8240
-#define GlintAreaStipplePattern8Tag 0x0048
-#define GlintAreaStipplePattern8Reg 1
-#define GlintAreaStipplePattern8Off 0x7240
-#define GlintAreaStipplePattern8Sec 0x8240
-#define GlintAreaStipplePattern8SecReg 3
-#define GlintAreaStipplePattern8SecOff 0x7240
-
-#define GlintAreaStipplePattern9 0x8248
-#define GlintAreaStipplePattern9Tag 0x0049
-#define GlintAreaStipplePattern9Reg 1
-#define GlintAreaStipplePattern9Off 0x7248
-#define GlintAreaStipplePattern9Sec 0x8248
-#define GlintAreaStipplePattern9SecReg 3
-#define GlintAreaStipplePattern9SecOff 0x7248
-
-#define GlintAreaStipplePattern10 0x8250
-#define GlintAreaStipplePattern10Tag 0x004a
-#define GlintAreaStipplePattern10Reg 1
-#define GlintAreaStipplePattern10Off 0x7250
-#define GlintAreaStipplePattern10Sec 0x8250
-#define GlintAreaStipplePattern10SecReg 3
-#define GlintAreaStipplePattern10SecOff 0x7250
-
-#define GlintAreaStipplePattern11 0x8258
-#define GlintAreaStipplePattern11Tag 0x004b
-#define GlintAreaStipplePattern11Reg 1
-#define GlintAreaStipplePattern11Off 0x7258
-#define GlintAreaStipplePattern11Sec 0x8258
-#define GlintAreaStipplePattern11SecReg 3
-#define GlintAreaStipplePattern11SecOff 0x7258
-
-#define GlintAreaStipplePattern12 0x8260
-#define GlintAreaStipplePattern12Tag 0x004c
-#define GlintAreaStipplePattern12Reg 1
-#define GlintAreaStipplePattern12Off 0x7260
-#define GlintAreaStipplePattern12Sec 0x8260
-#define GlintAreaStipplePattern12SecReg 3
-#define GlintAreaStipplePattern12SecOff 0x7260
-
-#define GlintAreaStipplePattern13 0x8268
-#define GlintAreaStipplePattern13Tag 0x004d
-#define GlintAreaStipplePattern13Reg 1
-#define GlintAreaStipplePattern13Off 0x7268
-#define GlintAreaStipplePattern13Sec 0x8268
-#define GlintAreaStipplePattern13SecReg 3
-#define GlintAreaStipplePattern13SecOff 0x7268
-
-#define GlintAreaStipplePattern14 0x8270
-#define GlintAreaStipplePattern14Tag 0x004e
-#define GlintAreaStipplePattern14Reg 1
-#define GlintAreaStipplePattern14Off 0x7270
-#define GlintAreaStipplePattern14Sec 0x8270
-#define GlintAreaStipplePattern14SecReg 3
-#define GlintAreaStipplePattern14SecOff 0x7270
-
-#define GlintAreaStipplePattern15 0x8278
-#define GlintAreaStipplePattern15Tag 0x004f
-#define GlintAreaStipplePattern15Reg 1
-#define GlintAreaStipplePattern15Off 0x7278
-#define GlintAreaStipplePattern15Sec 0x8278
-#define GlintAreaStipplePattern15SecReg 3
-#define GlintAreaStipplePattern15SecOff 0x7278
-
-#define GlintAreaStipplePattern16 0x8280
-#define GlintAreaStipplePattern16Tag 0x0050
-#define GlintAreaStipplePattern16Reg 1
-#define GlintAreaStipplePattern16Off 0x7280
-#define GlintAreaStipplePattern16Sec 0x8280
-#define GlintAreaStipplePattern16SecReg 3
-#define GlintAreaStipplePattern16SecOff 0x7280
-
-#define GlintAreaStipplePattern17 0x8288
-#define GlintAreaStipplePattern17Tag 0x0051
-#define GlintAreaStipplePattern17Reg 1
-#define GlintAreaStipplePattern17Off 0x7288
-#define GlintAreaStipplePattern17Sec 0x8288
-#define GlintAreaStipplePattern17SecReg 3
-#define GlintAreaStipplePattern17SecOff 0x7288
-
-#define GlintAreaStipplePattern18 0x8290
-#define GlintAreaStipplePattern18Tag 0x0052
-#define GlintAreaStipplePattern18Reg 1
-#define GlintAreaStipplePattern18Off 0x7290
-#define GlintAreaStipplePattern18Sec 0x8290
-#define GlintAreaStipplePattern18SecReg 3
-#define GlintAreaStipplePattern18SecOff 0x7290
-
-#define GlintAreaStipplePattern19 0x8298
-#define GlintAreaStipplePattern19Tag 0x0053
-#define GlintAreaStipplePattern19Reg 1
-#define GlintAreaStipplePattern19Off 0x7298
-#define GlintAreaStipplePattern19Sec 0x8298
-#define GlintAreaStipplePattern19SecReg 3
-#define GlintAreaStipplePattern19SecOff 0x7298
-
-#define GlintAreaStipplePattern20 0x82a0
-#define GlintAreaStipplePattern20Tag 0x0054
-#define GlintAreaStipplePattern20Reg 1
-#define GlintAreaStipplePattern20Off 0x72a0
-#define GlintAreaStipplePattern20Sec 0x82a0
-#define GlintAreaStipplePattern20SecReg 3
-#define GlintAreaStipplePattern20SecOff 0x72a0
-
-#define GlintAreaStipplePattern21 0x82a8
-#define GlintAreaStipplePattern21Tag 0x0055
-#define GlintAreaStipplePattern21Reg 1
-#define GlintAreaStipplePattern21Off 0x72a8
-#define GlintAreaStipplePattern21Sec 0x82a8
-#define GlintAreaStipplePattern21SecReg 3
-#define GlintAreaStipplePattern21SecOff 0x72a8
-
-#define GlintAreaStipplePattern22 0x82b0
-#define GlintAreaStipplePattern22Tag 0x0056
-#define GlintAreaStipplePattern22Reg 1
-#define GlintAreaStipplePattern22Off 0x72b0
-#define GlintAreaStipplePattern22Sec 0x82b0
-#define GlintAreaStipplePattern22SecReg 3
-#define GlintAreaStipplePattern22SecOff 0x72b0
-
-#define GlintAreaStipplePattern23 0x82b8
-#define GlintAreaStipplePattern23Tag 0x0057
-#define GlintAreaStipplePattern23Reg 1
-#define GlintAreaStipplePattern23Off 0x72b8
-#define GlintAreaStipplePattern23Sec 0x82b8
-#define GlintAreaStipplePattern23SecReg 3
-#define GlintAreaStipplePattern23SecOff 0x72b8
-
-#define GlintAreaStipplePattern24 0x82c0
-#define GlintAreaStipplePattern24Tag 0x0058
-#define GlintAreaStipplePattern24Reg 1
-#define GlintAreaStipplePattern24Off 0x72c0
-#define GlintAreaStipplePattern24Sec 0x82c0
-#define GlintAreaStipplePattern24SecReg 3
-#define GlintAreaStipplePattern24SecOff 0x72c0
-
-#define GlintAreaStipplePattern25 0x82c8
-#define GlintAreaStipplePattern25Tag 0x0059
-#define GlintAreaStipplePattern25Reg 1
-#define GlintAreaStipplePattern25Off 0x72c8
-#define GlintAreaStipplePattern25Sec 0x82c8
-#define GlintAreaStipplePattern25SecReg 3
-#define GlintAreaStipplePattern25SecOff 0x72c8
-
-#define GlintAreaStipplePattern26 0x82d0
-#define GlintAreaStipplePattern26Tag 0x005a
-#define GlintAreaStipplePattern26Reg 1
-#define GlintAreaStipplePattern26Off 0x72d0
-#define GlintAreaStipplePattern26Sec 0x82d0
-#define GlintAreaStipplePattern26SecReg 3
-#define GlintAreaStipplePattern26SecOff 0x72d0
-
-#define GlintAreaStipplePattern27 0x82d8
-#define GlintAreaStipplePattern27Tag 0x005b
-#define GlintAreaStipplePattern27Reg 1
-#define GlintAreaStipplePattern27Off 0x72d8
-#define GlintAreaStipplePattern27Sec 0x82d8
-#define GlintAreaStipplePattern27SecReg 3
-#define GlintAreaStipplePattern27SecOff 0x72d8
-
-#define GlintAreaStipplePattern28 0x82e0
-#define GlintAreaStipplePattern28Tag 0x005c
-#define GlintAreaStipplePattern28Reg 1
-#define GlintAreaStipplePattern28Off 0x72e0
-#define GlintAreaStipplePattern28Sec 0x82e0
-#define GlintAreaStipplePattern28SecReg 3
-#define GlintAreaStipplePattern28SecOff 0x72e0
-
-#define GlintAreaStipplePattern29 0x82e8
-#define GlintAreaStipplePattern29Tag 0x005d
-#define GlintAreaStipplePattern29Reg 1
-#define GlintAreaStipplePattern29Off 0x72e8
-#define GlintAreaStipplePattern29Sec 0x82e8
-#define GlintAreaStipplePattern29SecReg 3
-#define GlintAreaStipplePattern29SecOff 0x72e8
-
-#define GlintAreaStipplePattern30 0x82f0
-#define GlintAreaStipplePattern30Tag 0x005e
-#define GlintAreaStipplePattern30Reg 1
-#define GlintAreaStipplePattern30Off 0x72f0
-#define GlintAreaStipplePattern30Sec 0x82f0
-#define GlintAreaStipplePattern30SecReg 3
-#define GlintAreaStipplePattern30SecOff 0x72f0
-
-#define GlintAreaStipplePattern31 0x82f8
-#define GlintAreaStipplePattern31Tag 0x005f
-#define GlintAreaStipplePattern31Reg 1
-#define GlintAreaStipplePattern31Off 0x72f8
-#define GlintAreaStipplePattern31Sec 0x82f8
-#define GlintAreaStipplePattern31SecReg 3
-#define GlintAreaStipplePattern31SecOff 0x72f8
-
-#define GlintRouterMode 0x8840
-#define GlintRouterModeTag 0x0108
-#define GlintRouterModeReg 1
-#define GlintRouterModeOff 0x7840
-#define GlintRouterModeSec 0x8840
-#define GlintRouterModeSecReg 3
-#define GlintRouterModeSecOff 0x7840
-
-#define GlintTextureAddressMode 0x8380
-#define GlintTextureAddressModeTag 0x0070
-#define GlintTextureAddressModeReg 1
-#define GlintTextureAddressModeOff 0x7380
-#define GlintTextureAddressModeSec 0x8380
-#define GlintTextureAddressModeSecReg 3
-#define GlintTextureAddressModeSecOff 0x7380
-
-#define GlintSStart 0x8388
-#define GlintSStartTag 0x0071
-#define GlintSStartReg 1
-#define GlintSStartOff 0x7388
-#define GlintSStartSec 0x8388
-#define GlintSStartSecReg 3
-#define GlintSStartSecOff 0x7388
-
-#define GlintdSdx 0x8390
-#define GlintdSdxTag 0x0072
-#define GlintdSdxReg 1
-#define GlintdSdxOff 0x7390
-#define GlintdSdxSec 0x8390
-#define GlintdSdxSecReg 3
-#define GlintdSdxSecOff 0x7390
-
-#define GlintdSdyDom 0x8398
-#define GlintdSdyDomTag 0x0073
-#define GlintdSdyDomReg 1
-#define GlintdSdyDomOff 0x7398
-#define GlintdSdyDomSec 0x8398
-#define GlintdSdyDomSecReg 3
-#define GlintdSdyDomSecOff 0x7398
-
-#define GlintTStart 0x83a0
-#define GlintTStartTag 0x0074
-#define GlintTStartReg 1
-#define GlintTStartOff 0x73a0
-#define GlintTStartSec 0x83a0
-#define GlintTStartSecReg 3
-#define GlintTStartSecOff 0x73a0
-
-#define GlintdTdx 0x83a8
-#define GlintdTdxTag 0x0075
-#define GlintdTdxReg 1
-#define GlintdTdxOff 0x73a8
-#define GlintdTdxSec 0x83a8
-#define GlintdTdxSecReg 3
-#define GlintdTdxSecOff 0x73a8
-
-#define GlintdTdyDom 0x83b0
-#define GlintdTdyDomTag 0x0076
-#define GlintdTdyDomReg 1
-#define GlintdTdyDomOff 0x73b0
-#define GlintdTdyDomSec 0x83b0
-#define GlintdTdyDomSecReg 3
-#define GlintdTdyDomSecOff 0x73b0
-
-#define GlintQStart 0x83b8
-#define GlintQStartTag 0x0077
-#define GlintQStartReg 1
-#define GlintQStartOff 0x73b8
-#define GlintQStartSec 0x83b8
-#define GlintQStartSecReg 3
-#define GlintQStartSecOff 0x73b8
-
-#define GlintdQdx 0x83c0
-#define GlintdQdxTag 0x0078
-#define GlintdQdxReg 1
-#define GlintdQdxOff 0x73c0
-#define GlintdQdxSec 0x83c0
-#define GlintdQdxSecReg 3
-#define GlintdQdxSecOff 0x73c0
-
-#define GlintdQdyDom 0x83c8
-#define GlintdQdyDomTag 0x0079
-#define GlintdQdyDomReg 1
-#define GlintdQdyDomOff 0x73c8
-#define GlintdQdyDomSec 0x83c8
-#define GlintdQdyDomSecReg 3
-#define GlintdQdyDomSecOff 0x73c8
-
-#define GlintLOD 0x83d0
-#define GlintLODTag 0x007a
-#define GlintLODReg 1
-#define GlintLODOff 0x73d0
-#define GlintLODSec 0x83d0
-#define GlintLODSecReg 3
-#define GlintLODSecOff 0x73d0
-
-#define GlintdSdy 0x83d8
-#define GlintdSdyTag 0x007b
-#define GlintdSdyReg 1
-#define GlintdSdyOff 0x73d8
-#define GlintdSdySec 0x83d8
-#define GlintdSdySecReg 3
-#define GlintdSdySecOff 0x73d8
-
-#define GlintdTdy 0x83e0
-#define GlintdTdyTag 0x007c
-#define GlintdTdyReg 1
-#define GlintdTdyOff 0x73e0
-#define GlintdTdySec 0x83e0
-#define GlintdTdySecReg 3
-#define GlintdTdySecOff 0x73e0
-
-#define GlintdQdy 0x83e8
-#define GlintdQdyTag 0x007d
-#define GlintdQdyReg 1
-#define GlintdQdyOff 0x73e8
-#define GlintdQdySec 0x83e8
-#define GlintdQdySecReg 3
-#define GlintdQdySecOff 0x73e8
-
-#define GlintTextureReadMode 0x8480
-#define GlintTextureReadModeTag 0x0090
-#define GlintTextureReadModeReg 1
-#define GlintTextureReadModeOff 0x7480
-#define GlintTextureReadModeSec 0x8480
-#define GlintTextureReadModeSecReg 3
-#define GlintTextureReadModeSecOff 0x7480
-
-#define GlintTextureFormat 0x8488
-#define GlintTextureFormatTag 0x0091
-#define GlintTextureFormatReg 1
-#define GlintTextureFormatOff 0x7488
-#define GlintTextureFormatSec 0x8488
-#define GlintTextureFormatSecReg 3
-#define GlintTextureFormatSecOff 0x7488
-
-#define GlintTextureCacheControl 0x8490
-#define GlintTextureCacheControlTag 0x0092
-#define GlintTextureCacheControlReg 1
-#define GlintTextureCacheControlOff 0x7490
-#define GlintTextureCacheControlSec 0x8490
-#define GlintTextureCacheControlSecReg 3
-#define GlintTextureCacheControlSecOff 0x7490
-
-#define GlintGLINTBorderColor 0x84a8
-#define GlintGLINTBorderColorTag 0x0095
-#define GlintGLINTBorderColorReg 1
-#define GlintGLINTBorderColorOff 0x74a8
-#define GlintGLINTBorderColorSec 0x84a8
-#define GlintGLINTBorderColorSecReg 3
-#define GlintGLINTBorderColorSecOff 0x74a8
-
-#define GlintTexelLUTIndex 0x84c0
-#define GlintTexelLUTIndexTag 0x0098
-#define GlintTexelLUTIndexReg 1
-#define GlintTexelLUTIndexOff 0x74c0
-#define GlintTexelLUTIndexSec 0x84c0
-#define GlintTexelLUTIndexSecReg 3
-#define GlintTexelLUTIndexSecOff 0x74c0
-
-#define GlintTexelLUTData 0x84c8
-#define GlintTexelLUTDataTag 0x0099
-#define GlintTexelLUTDataReg 1
-#define GlintTexelLUTDataOff 0x74c8
-#define GlintTexelLUTDataSec 0x84c8
-#define GlintTexelLUTDataSecReg 3
-#define GlintTexelLUTDataSecOff 0x74c8
-
-#define GlintTexelLUTAddress 0x84d0
-#define GlintTexelLUTAddressTag 0x009a
-#define GlintTexelLUTAddressReg 1
-#define GlintTexelLUTAddressOff 0x74d0
-#define GlintTexelLUTAddressSec 0x84d0
-#define GlintTexelLUTAddressSecReg 3
-#define GlintTexelLUTAddressSecOff 0x74d0
-
-#define GlintTexelLUTTransfer 0x84d8
-#define GlintTexelLUTTransferTag 0x009b
-#define GlintTexelLUTTransferReg 1
-#define GlintTexelLUTTransferOff 0x74d8
-#define GlintTexelLUTTransferSec 0x84d8
-#define GlintTexelLUTTransferSecReg 3
-#define GlintTexelLUTTransferSecOff 0x74d8
-
-#define GlintTextureFilterMode 0x84e0
-#define GlintTextureFilterModeTag 0x009c
-#define GlintTextureFilterModeReg 1
-#define GlintTextureFilterModeOff 0x74e0
-#define GlintTextureFilterModeSec 0x84e0
-#define GlintTextureFilterModeSecReg 3
-#define GlintTextureFilterModeSecOff 0x74e0
-
-#define GlintTextureChromaUpper 0x84e8
-#define GlintTextureChromaUpperTag 0x009d
-#define GlintTextureChromaUpperReg 1
-#define GlintTextureChromaUpperOff 0x74e8
-#define GlintTextureChromaUpperSec 0x84e8
-#define GlintTextureChromaUpperSecReg 3
-#define GlintTextureChromaUpperSecOff 0x74e8
-
-#define GlintTextureChromaLower 0x84f0
-#define GlintTextureChromaLowerTag 0x009e
-#define GlintTextureChromaLowerReg 1
-#define GlintTextureChromaLowerOff 0x74f0
-#define GlintTextureChromaLowerSec 0x84f0
-#define GlintTextureChromaLowerSecReg 3
-#define GlintTextureChromaLowerSecOff 0x74f0
-
-#define GlintTxBaseAddr0 0x8500
-#define GlintTxBaseAddr0Tag 0x00a0
-#define GlintTxBaseAddr0Reg 1
-#define GlintTxBaseAddr0Off 0x7500
-#define GlintTxBaseAddr0Sec 0x8500
-#define GlintTxBaseAddr0SecReg 3
-#define GlintTxBaseAddr0SecOff 0x7500
-
-#define GlintTxBaseAddr1 0x8508
-#define GlintTxBaseAddr1Tag 0x00a1
-#define GlintTxBaseAddr1Reg 1
-#define GlintTxBaseAddr1Off 0x7508
-#define GlintTxBaseAddr1Sec 0x8508
-#define GlintTxBaseAddr1SecReg 3
-#define GlintTxBaseAddr1SecOff 0x7508
-
-#define GlintTxBaseAddr2 0x8510
-#define GlintTxBaseAddr2Tag 0x00a2
-#define GlintTxBaseAddr2Reg 1
-#define GlintTxBaseAddr2Off 0x7510
-#define GlintTxBaseAddr2Sec 0x8510
-#define GlintTxBaseAddr2SecReg 3
-#define GlintTxBaseAddr2SecOff 0x7510
-
-#define GlintTxBaseAddr3 0x8518
-#define GlintTxBaseAddr3Tag 0x00a3
-#define GlintTxBaseAddr3Reg 1
-#define GlintTxBaseAddr3Off 0x7518
-#define GlintTxBaseAddr3Sec 0x8518
-#define GlintTxBaseAddr3SecReg 3
-#define GlintTxBaseAddr3SecOff 0x7518
-
-#define GlintTxBaseAddr4 0x8520
-#define GlintTxBaseAddr4Tag 0x00a4
-#define GlintTxBaseAddr4Reg 1
-#define GlintTxBaseAddr4Off 0x7520
-#define GlintTxBaseAddr4Sec 0x8520
-#define GlintTxBaseAddr4SecReg 3
-#define GlintTxBaseAddr4SecOff 0x7520
-
-#define GlintTxBaseAddr5 0x8528
-#define GlintTxBaseAddr5Tag 0x00a5
-#define GlintTxBaseAddr5Reg 1
-#define GlintTxBaseAddr5Off 0x7528
-#define GlintTxBaseAddr5Sec 0x8528
-#define GlintTxBaseAddr5SecReg 3
-#define GlintTxBaseAddr5SecOff 0x7528
-
-#define GlintTxBaseAddr6 0x8530
-#define GlintTxBaseAddr6Tag 0x00a6
-#define GlintTxBaseAddr6Reg 1
-#define GlintTxBaseAddr6Off 0x7530
-#define GlintTxBaseAddr6Sec 0x8530
-#define GlintTxBaseAddr6SecReg 3
-#define GlintTxBaseAddr6SecOff 0x7530
-
-#define GlintTxBaseAddr7 0x8538
-#define GlintTxBaseAddr7Tag 0x00a7
-#define GlintTxBaseAddr7Reg 1
-#define GlintTxBaseAddr7Off 0x7538
-#define GlintTxBaseAddr7Sec 0x8538
-#define GlintTxBaseAddr7SecReg 3
-#define GlintTxBaseAddr7SecOff 0x7538
-
-#define GlintTxBaseAddr8 0x8540
-#define GlintTxBaseAddr8Tag 0x00a8
-#define GlintTxBaseAddr8Reg 1
-#define GlintTxBaseAddr8Off 0x7540
-#define GlintTxBaseAddr8Sec 0x8540
-#define GlintTxBaseAddr8SecReg 3
-#define GlintTxBaseAddr8SecOff 0x7540
-
-#define GlintTxBaseAddr9 0x8548
-#define GlintTxBaseAddr9Tag 0x00a9
-#define GlintTxBaseAddr9Reg 1
-#define GlintTxBaseAddr9Off 0x7548
-#define GlintTxBaseAddr9Sec 0x8548
-#define GlintTxBaseAddr9SecReg 3
-#define GlintTxBaseAddr9SecOff 0x7548
-
-#define GlintTxBaseAddr10 0x8550
-#define GlintTxBaseAddr10Tag 0x00aa
-#define GlintTxBaseAddr10Reg 1
-#define GlintTxBaseAddr10Off 0x7550
-#define GlintTxBaseAddr10Sec 0x8550
-#define GlintTxBaseAddr10SecReg 3
-#define GlintTxBaseAddr10SecOff 0x7550
-
-#define GlintTxBaseAddr11 0x8558
-#define GlintTxBaseAddr11Tag 0x00ab
-#define GlintTxBaseAddr11Reg 1
-#define GlintTxBaseAddr11Off 0x7558
-#define GlintTxBaseAddr11Sec 0x8558
-#define GlintTxBaseAddr11SecReg 3
-#define GlintTxBaseAddr11SecOff 0x7558
-
-#define GlintTxBaseAddr12 0x8560
-#define GlintTxBaseAddr12Tag 0x00ac
-#define GlintTxBaseAddr12Reg 1
-#define GlintTxBaseAddr12Off 0x7560
-#define GlintTxBaseAddr12Sec 0x8560
-#define GlintTxBaseAddr12SecReg 3
-#define GlintTxBaseAddr12SecOff 0x7560
-
-#define GlintTexelLUT0 0x8e80
-#define GlintTexelLUT0Tag 0x01d0
-#define GlintTexelLUT0Reg 1
-#define GlintTexelLUT0Off 0x7e80
-#define GlintTexelLUT0Sec 0x8e80
-#define GlintTexelLUT0SecReg 3
-#define GlintTexelLUT0SecOff 0x7e80
-
-#define GlintTexelLUT1 0x8e88
-#define GlintTexelLUT1Tag 0x01d1
-#define GlintTexelLUT1Reg 1
-#define GlintTexelLUT1Off 0x7e88
-#define GlintTexelLUT1Sec 0x8e88
-#define GlintTexelLUT1SecReg 3
-#define GlintTexelLUT1SecOff 0x7e88
-
-#define GlintTexelLUT2 0x8e90
-#define GlintTexelLUT2Tag 0x01d2
-#define GlintTexelLUT2Reg 1
-#define GlintTexelLUT2Off 0x7e90
-#define GlintTexelLUT2Sec 0x8e90
-#define GlintTexelLUT2SecReg 3
-#define GlintTexelLUT2SecOff 0x7e90
-
-#define GlintTexelLUT3 0x8e98
-#define GlintTexelLUT3Tag 0x01d3
-#define GlintTexelLUT3Reg 1
-#define GlintTexelLUT3Off 0x7e98
-#define GlintTexelLUT3Sec 0x8e98
-#define GlintTexelLUT3SecReg 3
-#define GlintTexelLUT3SecOff 0x7e98
-
-#define GlintTexelLUT4 0x8ea0
-#define GlintTexelLUT4Tag 0x01d4
-#define GlintTexelLUT4Reg 1
-#define GlintTexelLUT4Off 0x7ea0
-#define GlintTexelLUT4Sec 0x8ea0
-#define GlintTexelLUT4SecReg 3
-#define GlintTexelLUT4SecOff 0x7ea0
-
-#define GlintTexelLUT5 0x8ea8
-#define GlintTexelLUT5Tag 0x01d5
-#define GlintTexelLUT5Reg 1
-#define GlintTexelLUT5Off 0x7ea8
-#define GlintTexelLUT5Sec 0x8ea8
-#define GlintTexelLUT5SecReg 3
-#define GlintTexelLUT5SecOff 0x7ea8
-
-#define GlintTexelLUT6 0x8eb0
-#define GlintTexelLUT6Tag 0x01d6
-#define GlintTexelLUT6Reg 1
-#define GlintTexelLUT6Off 0x7eb0
-#define GlintTexelLUT6Sec 0x8eb0
-#define GlintTexelLUT6SecReg 3
-#define GlintTexelLUT6SecOff 0x7eb0
-
-#define GlintTexelLUT7 0x8eb8
-#define GlintTexelLUT7Tag 0x01d7
-#define GlintTexelLUT7Reg 1
-#define GlintTexelLUT7Off 0x7eb8
-#define GlintTexelLUT7Sec 0x8eb8
-#define GlintTexelLUT7SecReg 3
-#define GlintTexelLUT7SecOff 0x7eb8
-
-#define GlintTexelLUT8 0x8ec0
-#define GlintTexelLUT8Tag 0x01d8
-#define GlintTexelLUT8Reg 1
-#define GlintTexelLUT8Off 0x7ec0
-#define GlintTexelLUT8Sec 0x8ec0
-#define GlintTexelLUT8SecReg 3
-#define GlintTexelLUT8SecOff 0x7ec0
-
-#define GlintTexelLUT9 0x8ec8
-#define GlintTexelLUT9Tag 0x01d9
-#define GlintTexelLUT9Reg 1
-#define GlintTexelLUT9Off 0x7ec8
-#define GlintTexelLUT9Sec 0x8ec8
-#define GlintTexelLUT9SecReg 3
-#define GlintTexelLUT9SecOff 0x7ec8
-
-#define GlintTexelLUT10 0x8ed0
-#define GlintTexelLUT10Tag 0x01da
-#define GlintTexelLUT10Reg 1
-#define GlintTexelLUT10Off 0x7ed0
-#define GlintTexelLUT10Sec 0x8ed0
-#define GlintTexelLUT10SecReg 3
-#define GlintTexelLUT10SecOff 0x7ed0
-
-#define GlintTexelLUT11 0x8ed8
-#define GlintTexelLUT11Tag 0x01db
-#define GlintTexelLUT11Reg 1
-#define GlintTexelLUT11Off 0x7ed8
-#define GlintTexelLUT11Sec 0x8ed8
-#define GlintTexelLUT11SecReg 3
-#define GlintTexelLUT11SecOff 0x7ed8
-
-#define GlintTexelLUT12 0x8ee0
-#define GlintTexelLUT12Tag 0x01dc
-#define GlintTexelLUT12Reg 1
-#define GlintTexelLUT12Off 0x7ee0
-#define GlintTexelLUT12Sec 0x8ee0
-#define GlintTexelLUT12SecReg 3
-#define GlintTexelLUT12SecOff 0x7ee0
-
-#define GlintTexelLUT13 0x8ee8
-#define GlintTexelLUT13Tag 0x01dd
-#define GlintTexelLUT13Reg 1
-#define GlintTexelLUT13Off 0x7ee8
-#define GlintTexelLUT13Sec 0x8ee8
-#define GlintTexelLUT13SecReg 3
-#define GlintTexelLUT13SecOff 0x7ee8
-
-#define GlintTexelLUT14 0x8ef0
-#define GlintTexelLUT14Tag 0x01de
-#define GlintTexelLUT14Reg 1
-#define GlintTexelLUT14Off 0x7ef0
-#define GlintTexelLUT14Sec 0x8ef0
-#define GlintTexelLUT14SecReg 3
-#define GlintTexelLUT14SecOff 0x7ef0
-
-#define GlintTexelLUT15 0x8ef8
-#define GlintTexelLUT15Tag 0x01df
-#define GlintTexelLUT15Reg 1
-#define GlintTexelLUT15Off 0x7ef8
-#define GlintTexelLUT15Sec 0x8ef8
-#define GlintTexelLUT15SecReg 3
-#define GlintTexelLUT15SecOff 0x7ef8
-
-#define GlintTexel0 0x8600
-#define GlintTexel0Tag 0x00c0
-#define GlintTexel0Reg 1
-#define GlintTexel0Off 0x7600
-#define GlintTexel0Sec 0x8600
-#define GlintTexel0SecReg 3
-#define GlintTexel0SecOff 0x7600
-
-#define GlintTexel1 0x8608
-#define GlintTexel1Tag 0x00c1
-#define GlintTexel1Reg 1
-#define GlintTexel1Off 0x7608
-#define GlintTexel1Sec 0x8608
-#define GlintTexel1SecReg 3
-#define GlintTexel1SecOff 0x7608
-
-#define GlintTexel2 0x8610
-#define GlintTexel2Tag 0x00c2
-#define GlintTexel2Reg 1
-#define GlintTexel2Off 0x7610
-#define GlintTexel2Sec 0x8610
-#define GlintTexel2SecReg 3
-#define GlintTexel2SecOff 0x7610
-
-#define GlintTexel3 0x8618
-#define GlintTexel3Tag 0x00c3
-#define GlintTexel3Reg 1
-#define GlintTexel3Off 0x7618
-#define GlintTexel3Sec 0x8618
-#define GlintTexel3SecReg 3
-#define GlintTexel3SecOff 0x7618
-
-#define GlintTexel4 0x8620
-#define GlintTexel4Tag 0x00c4
-#define GlintTexel4Reg 1
-#define GlintTexel4Off 0x7620
-#define GlintTexel4Sec 0x8620
-#define GlintTexel4SecReg 3
-#define GlintTexel4SecOff 0x7620
-
-#define GlintTexel5 0x8628
-#define GlintTexel5Tag 0x00c5
-#define GlintTexel5Reg 1
-#define GlintTexel5Off 0x7628
-#define GlintTexel5Sec 0x8628
-#define GlintTexel5SecReg 3
-#define GlintTexel5SecOff 0x7628
-
-#define GlintTexel6 0x8630
-#define GlintTexel6Tag 0x00c6
-#define GlintTexel6Reg 1
-#define GlintTexel6Off 0x7630
-#define GlintTexel6Sec 0x8630
-#define GlintTexel6SecReg 3
-#define GlintTexel6SecOff 0x7630
-
-#define GlintTexel7 0x8638
-#define GlintTexel7Tag 0x00c7
-#define GlintTexel7Reg 1
-#define GlintTexel7Off 0x7638
-#define GlintTexel7Sec 0x8638
-#define GlintTexel7SecReg 3
-#define GlintTexel7SecOff 0x7638
-
-#define GlintInterp0 0x8640
-#define GlintInterp0Tag 0x00c8
-#define GlintInterp0Reg 1
-#define GlintInterp0Off 0x7640
-#define GlintInterp0Sec 0x8640
-#define GlintInterp0SecReg 3
-#define GlintInterp0SecOff 0x7640
-
-#define GlintInterp1 0x8648
-#define GlintInterp1Tag 0x00c9
-#define GlintInterp1Reg 1
-#define GlintInterp1Off 0x7648
-#define GlintInterp1Sec 0x8648
-#define GlintInterp1SecReg 3
-#define GlintInterp1SecOff 0x7648
-
-#define GlintInterp2 0x8650
-#define GlintInterp2Tag 0x00ca
-#define GlintInterp2Reg 1
-#define GlintInterp2Off 0x7650
-#define GlintInterp2Sec 0x8650
-#define GlintInterp2SecReg 3
-#define GlintInterp2SecOff 0x7650
-
-#define GlintInterp3 0x8658
-#define GlintInterp3Tag 0x00cb
-#define GlintInterp3Reg 1
-#define GlintInterp3Off 0x7658
-#define GlintInterp3Sec 0x8658
-#define GlintInterp3SecReg 3
-#define GlintInterp3SecOff 0x7658
-
-#define GlintInterp4 0x8660
-#define GlintInterp4Tag 0x00cc
-#define GlintInterp4Reg 1
-#define GlintInterp4Off 0x7660
-#define GlintInterp4Sec 0x8660
-#define GlintInterp4SecReg 3
-#define GlintInterp4SecOff 0x7660
-
-#define GlintTextureFilter 0x8668
-#define GlintTextureFilterTag 0x00cd
-#define GlintTextureFilterReg 1
-#define GlintTextureFilterOff 0x7668
-#define GlintTextureFilterSec 0x8668
-#define GlintTextureFilterSecReg 3
-#define GlintTextureFilterSecOff 0x7668
-
-#define GlintTextureColorMode 0x8680
-#define GlintTextureColorModeTag 0x00d0
-#define GlintTextureColorModeReg 1
-#define GlintTextureColorModeOff 0x7680
-#define GlintTextureColorModeSec 0x8680
-#define GlintTextureColorModeSecReg 3
-#define GlintTextureColorModeSecOff 0x7680
-
-#define GlintTextureEnvColor 0x8688
-#define GlintTextureEnvColorTag 0x00d1
-#define GlintTextureEnvColorReg 1
-#define GlintTextureEnvColorOff 0x7688
-#define GlintTextureEnvColorSec 0x8688
-#define GlintTextureEnvColorSecReg 3
-#define GlintTextureEnvColorSecOff 0x7688
-
-#define GlintFogMode 0x8690
-#define GlintFogModeTag 0x00d2
-#define GlintFogModeReg 1
-#define GlintFogModeOff 0x7690
-#define GlintFogModeSec 0x8690
-#define GlintFogModeSecReg 3
-#define GlintFogModeSecOff 0x7690
-
-#define GlintFogColor 0x8698
-#define GlintFogColorTag 0x00d3
-#define GlintFogColorReg 1
-#define GlintFogColorOff 0x7698
-#define GlintFogColorSec 0x8698
-#define GlintFogColorSecReg 3
-#define GlintFogColorSecOff 0x7698
-
-#define GlintFStart 0x86a0
-#define GlintFStartTag 0x00d4
-#define GlintFStartReg 1
-#define GlintFStartOff 0x76a0
-#define GlintFStartSec 0x86a0
-#define GlintFStartSecReg 3
-#define GlintFStartSecOff 0x76a0
-
-#define GlintdFdx 0x86a8
-#define GlintdFdxTag 0x00d5
-#define GlintdFdxReg 1
-#define GlintdFdxOff 0x76a8
-#define GlintdFdxSec 0x86a8
-#define GlintdFdxSecReg 3
-#define GlintdFdxSecOff 0x76a8
-
-#define GlintdFdyDom 0x86b0
-#define GlintdFdyDomTag 0x00d6
-#define GlintdFdyDomReg 1
-#define GlintdFdyDomOff 0x76b0
-#define GlintdFdyDomSec 0x86b0
-#define GlintdFdyDomSecReg 3
-#define GlintdFdyDomSecOff 0x76b0
-
-#define GlintKsStart 0x86c8
-#define GlintKsStartTag 0x00d9
-#define GlintKsStartReg 1
-#define GlintKsStartOff 0x76c8
-#define GlintKsStartSec 0x86c8
-#define GlintKsStartSecReg 3
-#define GlintKsStartSecOff 0x76c8
-
-#define GlintdKsdx 0x86d0
-#define GlintdKsdxTag 0x00da
-#define GlintdKsdxReg 1
-#define GlintdKsdxOff 0x76d0
-#define GlintdKsdxSec 0x86d0
-#define GlintdKsdxSecReg 3
-#define GlintdKsdxSecOff 0x76d0
-
-#define GlintdKsdyDom 0x86d8
-#define GlintdKsdyDomTag 0x00db
-#define GlintdKsdyDomReg 1
-#define GlintdKsdyDomOff 0x76d8
-#define GlintdKsdyDomSec 0x86d8
-#define GlintdKsdyDomSecReg 3
-#define GlintdKsdyDomSecOff 0x76d8
-
-#define GlintKdStart 0x86e0
-#define GlintKdStartTag 0x00dc
-#define GlintKdStartReg 1
-#define GlintKdStartOff 0x76e0
-#define GlintKdStartSec 0x86e0
-#define GlintKdStartSecReg 3
-#define GlintKdStartSecOff 0x76e0
-
-#define GlintdKdStart 0x86e8
-#define GlintdKdStartTag 0x00dd
-#define GlintdKdStartReg 1
-#define GlintdKdStartOff 0x76e8
-#define GlintdKdStartSec 0x86e8
-#define GlintdKdStartSecReg 3
-#define GlintdKdStartSecOff 0x76e8
-
-#define GlintdKddyDom 0x86f0
-#define GlintdKddyDomTag 0x00de
-#define GlintdKddyDomReg 1
-#define GlintdKddyDomOff 0x76f0
-#define GlintdKddyDomSec 0x86f0
-#define GlintdKddyDomSecReg 3
-#define GlintdKddyDomSecOff 0x76f0
-
-#define GlintRStart 0x8780
-#define GlintRStartTag 0x00f0
-#define GlintRStartReg 1
-#define GlintRStartOff 0x7780
-#define GlintRStartSec 0x8780
-#define GlintRStartSecReg 3
-#define GlintRStartSecOff 0x7780
-
-#define GlintdRdx 0x8788
-#define GlintdRdxTag 0x00f1
-#define GlintdRdxReg 1
-#define GlintdRdxOff 0x7788
-#define GlintdRdxSec 0x8788
-#define GlintdRdxSecReg 3
-#define GlintdRdxSecOff 0x7788
-
-#define GlintdRdyDom 0x8790
-#define GlintdRdyDomTag 0x00f2
-#define GlintdRdyDomReg 1
-#define GlintdRdyDomOff 0x7790
-#define GlintdRdyDomSec 0x8790
-#define GlintdRdyDomSecReg 3
-#define GlintdRdyDomSecOff 0x7790
-
-#define GlintGStart 0x8798
-#define GlintGStartTag 0x00f3
-#define GlintGStartReg 1
-#define GlintGStartOff 0x7798
-#define GlintGStartSec 0x8798
-#define GlintGStartSecReg 3
-#define GlintGStartSecOff 0x7798
-
-#define GlintdGdx 0x87a0
-#define GlintdGdxTag 0x00f4
-#define GlintdGdxReg 1
-#define GlintdGdxOff 0x77a0
-#define GlintdGdxSec 0x87a0
-#define GlintdGdxSecReg 3
-#define GlintdGdxSecOff 0x77a0
-
-#define GlintdGdyDom 0x87a8
-#define GlintdGdyDomTag 0x00f5
-#define GlintdGdyDomReg 1
-#define GlintdGdyDomOff 0x77a8
-#define GlintdGdyDomSec 0x87a8
-#define GlintdGdyDomSecReg 3
-#define GlintdGdyDomSecOff 0x77a8
-
-#define GlintBStart 0x87b0
-#define GlintBStartTag 0x00f6
-#define GlintBStartReg 1
-#define GlintBStartOff 0x77b0
-#define GlintBStartSec 0x87b0
-#define GlintBStartSecReg 3
-#define GlintBStartSecOff 0x77b0
-
-#define GlintdBdx 0x87b8
-#define GlintdBdxTag 0x00f7
-#define GlintdBdxReg 1
-#define GlintdBdxOff 0x77b8
-#define GlintdBdxSec 0x87b8
-#define GlintdBdxSecReg 3
-#define GlintdBdxSecOff 0x77b8
-
-#define GlintdBdyDom 0x87c0
-#define GlintdBdyDomTag 0x00f8
-#define GlintdBdyDomReg 1
-#define GlintdBdyDomOff 0x77c0
-#define GlintdBdyDomSec 0x87c0
-#define GlintdBdyDomSecReg 3
-#define GlintdBdyDomSecOff 0x77c0
-
-#define GlintAStart 0x87c8
-#define GlintAStartTag 0x00f9
-#define GlintAStartReg 1
-#define GlintAStartOff 0x77c8
-#define GlintAStartSec 0x87c8
-#define GlintAStartSecReg 3
-#define GlintAStartSecOff 0x77c8
-
-#define GlintdAdx 0x87d0
-#define GlintdAdxTag 0x00fa
-#define GlintdAdxReg 1
-#define GlintdAdxOff 0x77d0
-#define GlintdAdxSec 0x87d0
-#define GlintdAdxSecReg 3
-#define GlintdAdxSecOff 0x77d0
-
-#define GlintdAdyDom 0x87d8
-#define GlintdAdyDomTag 0x00fb
-#define GlintdAdyDomReg 1
-#define GlintdAdyDomOff 0x77d8
-#define GlintdAdyDomSec 0x87d8
-#define GlintdAdyDomSecReg 3
-#define GlintdAdyDomSecOff 0x77d8
-
-#define GlintColorDDAMode 0x87e0
-#define GlintColorDDAModeTag 0x00fc
-#define GlintColorDDAModeReg 1
-#define GlintColorDDAModeOff 0x77e0
-#define GlintColorDDAModeSec 0x87e0
-#define GlintColorDDAModeSecReg 3
-#define GlintColorDDAModeSecOff 0x77e0
-
-#define GlintConstantColor 0x87e8
-#define GlintConstantColorTag 0x00fd
-#define GlintConstantColorReg 1
-#define GlintConstantColorOff 0x77e8
-#define GlintConstantColorSec 0x87e8
-#define GlintConstantColorSecReg 3
-#define GlintConstantColorSecOff 0x77e8
-
-#define GlintGLINTColor 0x87f0
-#define GlintGLINTColorTag 0x00fe
-#define GlintGLINTColorReg 1
-#define GlintGLINTColorOff 0x77f0
-#define GlintGLINTColorSec 0x87f0
-#define GlintGLINTColorSecReg 3
-#define GlintGLINTColorSecOff 0x77f0
-
-#define GlintAlphaTestMode 0x8800
-#define GlintAlphaTestModeTag 0x0100
-#define GlintAlphaTestModeReg 1
-#define GlintAlphaTestModeOff 0x7800
-#define GlintAlphaTestModeSec 0x8800
-#define GlintAlphaTestModeSecReg 3
-#define GlintAlphaTestModeSecOff 0x7800
-
-#define GlintAntialiasMode 0x8808
-#define GlintAntialiasModeTag 0x0101
-#define GlintAntialiasModeReg 1
-#define GlintAntialiasModeOff 0x7808
-#define GlintAntialiasModeSec 0x8808
-#define GlintAntialiasModeSecReg 3
-#define GlintAntialiasModeSecOff 0x7808
-
-#define GlintAlphaBlendMode 0x8810
-#define GlintAlphaBlendModeTag 0x0102
-#define GlintAlphaBlendModeReg 1
-#define GlintAlphaBlendModeOff 0x7810
-#define GlintAlphaBlendModeSec 0x8810
-#define GlintAlphaBlendModeSecReg 3
-#define GlintAlphaBlendModeSecOff 0x7810
-
-#define GlintChromaUpper 0x8f08
-#define GlintChromaUpperTag 0x01e1
-#define GlintChromaUpperReg 1
-#define GlintChromaUpperOff 0x7f08
-#define GlintChromaUpperSec 0x8f08
-#define GlintChromaUpperSecReg 3
-#define GlintChromaUpperSecOff 0x7f08
-
-#define GlintChromaLower 0x8f10
-#define GlintChromaLowerTag 0x01e2
-#define GlintChromaLowerReg 1
-#define GlintChromaLowerOff 0x7f10
-#define GlintChromaLowerSec 0x8f10
-#define GlintChromaLowerSecReg 3
-#define GlintChromaLowerSecOff 0x7f10
-
-#define GlintChromaTestMode 0x8f18
-#define GlintChromaTestModeTag 0x01e3
-#define GlintChromaTestModeReg 1
-#define GlintChromaTestModeOff 0x7f18
-#define GlintChromaTestModeSec 0x8f18
-#define GlintChromaTestModeSecReg 3
-#define GlintChromaTestModeSecOff 0x7f18
-
-#define GlintDitherMode 0x8818
-#define GlintDitherModeTag 0x0103
-#define GlintDitherModeReg 1
-#define GlintDitherModeOff 0x7818
-#define GlintDitherModeSec 0x8818
-#define GlintDitherModeSecReg 3
-#define GlintDitherModeSecOff 0x7818
-
-#define GlintFBSoftwareWriteMask 0x8820
-#define GlintFBSoftwareWriteMaskTag 0x0104
-#define GlintFBSoftwareWriteMaskReg 1
-#define GlintFBSoftwareWriteMaskOff 0x7820
-#define GlintFBSoftwareWriteMaskSec 0x8820
-#define GlintFBSoftwareWriteMaskSecReg 3
-#define GlintFBSoftwareWriteMaskSecOff 0x7820
-
-#define GlintLogicalOpMode 0x8828
-#define GlintLogicalOpModeTag 0x0105
-#define GlintLogicalOpModeReg 1
-#define GlintLogicalOpModeOff 0x7828
-#define GlintLogicalOpModeSec 0x8828
-#define GlintLogicalOpModeSecReg 3
-#define GlintLogicalOpModeSecOff 0x7828
-
-#define GlintFBWriteData 0x8830
-#define GlintFBWriteDataTag 0x0106
-#define GlintFBWriteDataReg 1
-#define GlintFBWriteDataOff 0x7830
-#define GlintFBWriteDataSec 0x8830
-#define GlintFBWriteDataSecReg 3
-#define GlintFBWriteDataSecOff 0x7830
-
-#define GlintLBReadMode 0x8880
-#define GlintLBReadModeTag 0x0110
-#define GlintLBReadModeReg 1
-#define GlintLBReadModeOff 0x7880
-#define GlintLBReadModeSec 0x8880
-#define GlintLBReadModeSecReg 3
-#define GlintLBReadModeSecOff 0x7880
-
-#define GlintLBReadFormat 0x8888
-#define GlintLBReadFormatTag 0x0111
-#define GlintLBReadFormatReg 1
-#define GlintLBReadFormatOff 0x7888
-#define GlintLBReadFormatSec 0x8888
-#define GlintLBReadFormatSecReg 3
-#define GlintLBReadFormatSecOff 0x7888
-
-#define GlintLBSourceOffset 0x8890
-#define GlintLBSourceOffsetTag 0x0112
-#define GlintLBSourceOffsetReg 1
-#define GlintLBSourceOffsetOff 0x7890
-#define GlintLBSourceOffsetSec 0x8890
-#define GlintLBSourceOffsetSecReg 3
-#define GlintLBSourceOffsetSecOff 0x7890
-
-#define GlintLBStencil 0x88a8
-#define GlintLBStencilTag 0x0115
-#define GlintLBStencilReg 1
-#define GlintLBStencilOff 0x78a8
-#define GlintLBStencilSec 0x88a8
-#define GlintLBStencilSecReg 3
-#define GlintLBStencilSecOff 0x78a8
-
-#define GlintLBDepth 0x88b0
-#define GlintLBDepthTag 0x0116
-#define GlintLBDepthReg 1
-#define GlintLBDepthOff 0x78b0
-#define GlintLBDepthSec 0x88b0
-#define GlintLBDepthSecReg 3
-#define GlintLBDepthSecOff 0x78b0
-
-#define GlintLBWindowBase 0x88b8
-#define GlintLBWindowBaseTag 0x0117
-#define GlintLBWindowBaseReg 1
-#define GlintLBWindowBaseOff 0x78b8
-#define GlintLBWindowBaseSec 0x88b8
-#define GlintLBWindowBaseSecReg 3
-#define GlintLBWindowBaseSecOff 0x78b8
-
-#define GlintLBWriteMode 0x88c0
-#define GlintLBWriteModeTag 0x0118
-#define GlintLBWriteModeReg 1
-#define GlintLBWriteModeOff 0x78c0
-#define GlintLBWriteModeSec 0x88c0
-#define GlintLBWriteModeSecReg 3
-#define GlintLBWriteModeSecOff 0x78c0
-
-#define GlintLBWriteFormat 0x88c8
-#define GlintLBWriteFormatTag 0x0119
-#define GlintLBWriteFormatReg 1
-#define GlintLBWriteFormatOff 0x78c8
-#define GlintLBWriteFormatSec 0x88c8
-#define GlintLBWriteFormatSecReg 3
-#define GlintLBWriteFormatSecOff 0x78c8
-
-#define GlintTextureData 0x88e8
-#define GlintTextureDataTag 0x011d
-#define GlintTextureDataReg 1
-#define GlintTextureDataOff 0x78e8
-#define GlintTextureDataSec 0x88e8
-#define GlintTextureDataSecReg 3
-#define GlintTextureDataSecOff 0x78e8
-
-#define GlintTextureDownloadOffset 0x88f0
-#define GlintTextureDownloadOffsetTag 0x011e
-#define GlintTextureDownloadOffsetReg 1
-#define GlintTextureDownloadOffsetOff 0x78f0
-#define GlintTextureDownloadOffsetSec 0x88f0
-#define GlintTextureDownloadOffsetSecReg 3
-#define GlintTextureDownloadOffsetSecOff 0x78f0
-
-#define GlintLBWindowOffset 0x88f8
-#define GlintLBWindowOffsetTag 0x011f
-#define GlintLBWindowOffsetReg 1
-#define GlintLBWindowOffsetOff 0x78f8
-#define GlintLBWindowOffsetSec 0x88f8
-#define GlintLBWindowOffsetSecReg 3
-#define GlintLBWindowOffsetSecOff 0x78f8
-
-#define GlintGLINTWindow 0x8980
-#define GlintGLINTWindowTag 0x0130
-#define GlintGLINTWindowReg 1
-#define GlintGLINTWindowOff 0x7980
-#define GlintGLINTWindowSec 0x8980
-#define GlintGLINTWindowSecReg 3
-#define GlintGLINTWindowSecOff 0x7980
-
-#define GlintStencilMode 0x8988
-#define GlintStencilModeTag 0x0131
-#define GlintStencilModeReg 1
-#define GlintStencilModeOff 0x7988
-#define GlintStencilModeSec 0x8988
-#define GlintStencilModeSecReg 3
-#define GlintStencilModeSecOff 0x7988
-
-#define GlintStencilData 0x8990
-#define GlintStencilDataTag 0x0132
-#define GlintStencilDataReg 1
-#define GlintStencilDataOff 0x7990
-#define GlintStencilDataSec 0x8990
-#define GlintStencilDataSecReg 3
-#define GlintStencilDataSecOff 0x7990
-
-#define GlintGLINTStencil 0x8998
-#define GlintGLINTStencilTag 0x0133
-#define GlintGLINTStencilReg 1
-#define GlintGLINTStencilOff 0x7998
-#define GlintGLINTStencilSec 0x8998
-#define GlintGLINTStencilSecReg 3
-#define GlintGLINTStencilSecOff 0x7998
-
-#define GlintDepthMode 0x89a0
-#define GlintDepthModeTag 0x0134
-#define GlintDepthModeReg 1
-#define GlintDepthModeOff 0x79a0
-#define GlintDepthModeSec 0x89a0
-#define GlintDepthModeSecReg 3
-#define GlintDepthModeSecOff 0x79a0
-
-#define GlintGLINTDepth 0x89a8
-#define GlintGLINTDepthTag 0x0135
-#define GlintGLINTDepthReg 1
-#define GlintGLINTDepthOff 0x79a8
-#define GlintGLINTDepthSec 0x89a8
-#define GlintGLINTDepthSecReg 3
-#define GlintGLINTDepthSecOff 0x79a8
-
-#define GlintZStartU 0x89b0
-#define GlintZStartUTag 0x0136
-#define GlintZStartUReg 1
-#define GlintZStartUOff 0x79b0
-#define GlintZStartUSec 0x89b0
-#define GlintZStartUSecReg 3
-#define GlintZStartUSecOff 0x79b0
-
-#define GlintZStartL 0x89b8
-#define GlintZStartLTag 0x0137
-#define GlintZStartLReg 1
-#define GlintZStartLOff 0x79b8
-#define GlintZStartLSec 0x89b8
-#define GlintZStartLSecReg 3
-#define GlintZStartLSecOff 0x79b8
-
-#define GlintdZdxU 0x89c0
-#define GlintdZdxUTag 0x0138
-#define GlintdZdxUReg 1
-#define GlintdZdxUOff 0x79c0
-#define GlintdZdxUSec 0x89c0
-#define GlintdZdxUSecReg 3
-#define GlintdZdxUSecOff 0x79c0
-
-#define GlintdZdxL 0x89c8
-#define GlintdZdxLTag 0x0139
-#define GlintdZdxLReg 1
-#define GlintdZdxLOff 0x79c8
-#define GlintdZdxLSec 0x89c8
-#define GlintdZdxLSecReg 3
-#define GlintdZdxLSecOff 0x79c8
-
-#define GlintdZdyDomU 0x89d0
-#define GlintdZdyDomUTag 0x013a
-#define GlintdZdyDomUReg 1
-#define GlintdZdyDomUOff 0x79d0
-#define GlintdZdyDomUSec 0x89d0
-#define GlintdZdyDomUSecReg 3
-#define GlintdZdyDomUSecOff 0x79d0
-
-#define GlintdZdyDomL 0x89d8
-#define GlintdZdyDomLTag 0x013b
-#define GlintdZdyDomLReg 1
-#define GlintdZdyDomLOff 0x79d8
-#define GlintdZdyDomLSec 0x89d8
-#define GlintdZdyDomLSecReg 3
-#define GlintdZdyDomLSecOff 0x79d8
-
-#define GlintFastClearDepth 0x89e0
-#define GlintFastClearDepthTag 0x013c
-#define GlintFastClearDepthReg 1
-#define GlintFastClearDepthOff 0x79e0
-#define GlintFastClearDepthSec 0x89e0
-#define GlintFastClearDepthSecReg 3
-#define GlintFastClearDepthSecOff 0x79e0
-
-#define GlintFBReadMode 0x8a80
-#define GlintFBReadModeTag 0x0150
-#define GlintFBReadModeReg 1
-#define GlintFBReadModeOff 0x7a80
-#define GlintFBReadModeSec 0x8a80
-#define GlintFBReadModeSecReg 3
-#define GlintFBReadModeSecOff 0x7a80
-
-#define GlintFBSourceOffset 0x8a88
-#define GlintFBSourceOffsetTag 0x0151
-#define GlintFBSourceOffsetReg 1
-#define GlintFBSourceOffsetOff 0x7a88
-#define GlintFBSourceOffsetSec 0x8a88
-#define GlintFBSourceOffsetSecReg 3
-#define GlintFBSourceOffsetSecOff 0x7a88
-
-#define GlintFBPixelOffset 0x8a90
-#define GlintFBPixelOffsetTag 0x0152
-#define GlintFBPixelOffsetReg 1
-#define GlintFBPixelOffsetOff 0x7a90
-#define GlintFBPixelOffsetSec 0x8a90
-#define GlintFBPixelOffsetSecReg 3
-#define GlintFBPixelOffsetSecOff 0x7a90
-
-#define GlintFBColor 0x8a98
-#define GlintFBColorTag 0x0153
-#define GlintFBColorReg 1
-#define GlintFBColorOff 0x7a98
-#define GlintFBColorSec 0x8a98
-#define GlintFBColorSecReg 3
-#define GlintFBColorSecOff 0x7a98
-
-#define GlintFBData 0x8aa0
-#define GlintFBDataTag 0x0154
-#define GlintFBDataReg 1
-#define GlintFBDataOff 0x7aa0
-#define GlintFBDataSec 0x8aa0
-#define GlintFBDataSecReg 3
-#define GlintFBDataSecOff 0x7aa0
-
-#define GlintFBSourceData 0x8aa8
-#define GlintFBSourceDataTag 0x0155
-#define GlintFBSourceDataReg 1
-#define GlintFBSourceDataOff 0x7aa8
-#define GlintFBSourceDataSec 0x8aa8
-#define GlintFBSourceDataSecReg 3
-#define GlintFBSourceDataSecOff 0x7aa8
-
-#define GlintFBWindowBase 0x8ab0
-#define GlintFBWindowBaseTag 0x0156
-#define GlintFBWindowBaseReg 1
-#define GlintFBWindowBaseOff 0x7ab0
-#define GlintFBWindowBaseSec 0x8ab0
-#define GlintFBWindowBaseSecReg 3
-#define GlintFBWindowBaseSecOff 0x7ab0
-
-#define GlintFBWriteMode 0x8ab8
-#define GlintFBWriteModeTag 0x0157
-#define GlintFBWriteModeReg 1
-#define GlintFBWriteModeOff 0x7ab8
-#define GlintFBWriteModeSec 0x8ab8
-#define GlintFBWriteModeSecReg 3
-#define GlintFBWriteModeSecOff 0x7ab8
-
-#define GlintFBHardwareWriteMask 0x8ac0
-#define GlintFBHardwareWriteMaskTag 0x0158
-#define GlintFBHardwareWriteMaskReg 1
-#define GlintFBHardwareWriteMaskOff 0x7ac0
-#define GlintFBHardwareWriteMaskSec 0x8ac0
-#define GlintFBHardwareWriteMaskSecReg 3
-#define GlintFBHardwareWriteMaskSecOff 0x7ac0
-
-#define GlintFBBlockColor 0x8ac8
-#define GlintFBBlockColorTag 0x0159
-#define GlintFBBlockColorReg 1
-#define GlintFBBlockColorOff 0x7ac8
-#define GlintFBBlockColorSec 0x8ac8
-#define GlintFBBlockColorSecReg 3
-#define GlintFBBlockColorSecOff 0x7ac8
-
-#define GlintPatternRamMode 0x8af8
-#define GlintPatternRamModeTag 0x015f
-#define GlintPatternRamModeReg 1
-#define GlintPatternRamModeOff 0x7af8
-#define GlintPatternRamModeSec 0x8af8
-#define GlintPatternRamModeSecReg 3
-#define GlintPatternRamModeSecOff 0x7af8
-
-#define GlintPatternRamData0 0x8b00
-#define GlintPatternRamData0Tag 0x0160
-#define GlintPatternRamData0Reg 1
-#define GlintPatternRamData0Off 0x7b00
-#define GlintPatternRamData0Sec 0x8b00
-#define GlintPatternRamData0SecReg 3
-#define GlintPatternRamData0SecOff 0x7b00
-
-#define GlintPatternRamData1 0x8b08
-#define GlintPatternRamData1Tag 0x0161
-#define GlintPatternRamData1Reg 1
-#define GlintPatternRamData1Off 0x7b08
-#define GlintPatternRamData1Sec 0x8b08
-#define GlintPatternRamData1SecReg 3
-#define GlintPatternRamData1SecOff 0x7b08
-
-#define GlintPatternRamData2 0x8b10
-#define GlintPatternRamData2Tag 0x0162
-#define GlintPatternRamData2Reg 1
-#define GlintPatternRamData2Off 0x7b10
-#define GlintPatternRamData2Sec 0x8b10
-#define GlintPatternRamData2SecReg 3
-#define GlintPatternRamData2SecOff 0x7b10
-
-#define GlintPatternRamData3 0x8b18
-#define GlintPatternRamData3Tag 0x0163
-#define GlintPatternRamData3Reg 1
-#define GlintPatternRamData3Off 0x7b18
-#define GlintPatternRamData3Sec 0x8b18
-#define GlintPatternRamData3SecReg 3
-#define GlintPatternRamData3SecOff 0x7b18
-
-#define GlintPatternRamData4 0x8b20
-#define GlintPatternRamData4Tag 0x0164
-#define GlintPatternRamData4Reg 1
-#define GlintPatternRamData4Off 0x7b20
-#define GlintPatternRamData4Sec 0x8b20
-#define GlintPatternRamData4SecReg 3
-#define GlintPatternRamData4SecOff 0x7b20
-
-#define GlintPatternRamData5 0x8b28
-#define GlintPatternRamData5Tag 0x0165
-#define GlintPatternRamData5Reg 1
-#define GlintPatternRamData5Off 0x7b28
-#define GlintPatternRamData5Sec 0x8b28
-#define GlintPatternRamData5SecReg 3
-#define GlintPatternRamData5SecOff 0x7b28
-
-#define GlintPatternRamData6 0x8b30
-#define GlintPatternRamData6Tag 0x0166
-#define GlintPatternRamData6Reg 1
-#define GlintPatternRamData6Off 0x7b30
-#define GlintPatternRamData6Sec 0x8b30
-#define GlintPatternRamData6SecReg 3
-#define GlintPatternRamData6SecOff 0x7b30
-
-#define GlintPatternRamData7 0x8b38
-#define GlintPatternRamData7Tag 0x0167
-#define GlintPatternRamData7Reg 1
-#define GlintPatternRamData7Off 0x7b38
-#define GlintPatternRamData7Sec 0x8b38
-#define GlintPatternRamData7SecReg 3
-#define GlintPatternRamData7SecOff 0x7b38
-
-#define GlintPatternRamData8 0x8b40
-#define GlintPatternRamData8Tag 0x0168
-#define GlintPatternRamData8Reg 1
-#define GlintPatternRamData8Off 0x7b40
-#define GlintPatternRamData8Sec 0x8b40
-#define GlintPatternRamData8SecReg 3
-#define GlintPatternRamData8SecOff 0x7b40
-
-#define GlintPatternRamData9 0x8b48
-#define GlintPatternRamData9Tag 0x0169
-#define GlintPatternRamData9Reg 1
-#define GlintPatternRamData9Off 0x7b48
-#define GlintPatternRamData9Sec 0x8b48
-#define GlintPatternRamData9SecReg 3
-#define GlintPatternRamData9SecOff 0x7b48
-
-#define GlintPatternRamData10 0x8b50
-#define GlintPatternRamData10Tag 0x016a
-#define GlintPatternRamData10Reg 1
-#define GlintPatternRamData10Off 0x7b50
-#define GlintPatternRamData10Sec 0x8b50
-#define GlintPatternRamData10SecReg 3
-#define GlintPatternRamData10SecOff 0x7b50
-
-#define GlintPatternRamData11 0x8b58
-#define GlintPatternRamData11Tag 0x016b
-#define GlintPatternRamData11Reg 1
-#define GlintPatternRamData11Off 0x7b58
-#define GlintPatternRamData11Sec 0x8b58
-#define GlintPatternRamData11SecReg 3
-#define GlintPatternRamData11SecOff 0x7b58
-
-#define GlintPatternRamData12 0x8b60
-#define GlintPatternRamData12Tag 0x016c
-#define GlintPatternRamData12Reg 1
-#define GlintPatternRamData12Off 0x7b60
-#define GlintPatternRamData12Sec 0x8b60
-#define GlintPatternRamData12SecReg 3
-#define GlintPatternRamData12SecOff 0x7b60
-
-#define GlintPatternRamData13 0x8b68
-#define GlintPatternRamData13Tag 0x016d
-#define GlintPatternRamData13Reg 1
-#define GlintPatternRamData13Off 0x7b68
-#define GlintPatternRamData13Sec 0x8b68
-#define GlintPatternRamData13SecReg 3
-#define GlintPatternRamData13SecOff 0x7b68
-
-#define GlintPatternRamData14 0x8b70
-#define GlintPatternRamData14Tag 0x016e
-#define GlintPatternRamData14Reg 1
-#define GlintPatternRamData14Off 0x7b70
-#define GlintPatternRamData14Sec 0x8b70
-#define GlintPatternRamData14SecReg 3
-#define GlintPatternRamData14SecOff 0x7b70
-
-#define GlintPatternRamData15 0x8b78
-#define GlintPatternRamData15Tag 0x016f
-#define GlintPatternRamData15Reg 1
-#define GlintPatternRamData15Off 0x7b78
-#define GlintPatternRamData15Sec 0x8b78
-#define GlintPatternRamData15SecReg 3
-#define GlintPatternRamData15SecOff 0x7b78
-
-#define GlintPatternRamData16 0x8b80
-#define GlintPatternRamData16Tag 0x0170
-#define GlintPatternRamData16Reg 1
-#define GlintPatternRamData16Off 0x7b80
-#define GlintPatternRamData16Sec 0x8b80
-#define GlintPatternRamData16SecReg 3
-#define GlintPatternRamData16SecOff 0x7b80
-
-#define GlintPatternRamData17 0x8b88
-#define GlintPatternRamData17Tag 0x0171
-#define GlintPatternRamData17Reg 1
-#define GlintPatternRamData17Off 0x7b88
-#define GlintPatternRamData17Sec 0x8b88
-#define GlintPatternRamData17SecReg 3
-#define GlintPatternRamData17SecOff 0x7b88
-
-#define GlintPatternRamData18 0x8b90
-#define GlintPatternRamData18Tag 0x0172
-#define GlintPatternRamData18Reg 1
-#define GlintPatternRamData18Off 0x7b90
-#define GlintPatternRamData18Sec 0x8b90
-#define GlintPatternRamData18SecReg 3
-#define GlintPatternRamData18SecOff 0x7b90
-
-#define GlintPatternRamData19 0x8b98
-#define GlintPatternRamData19Tag 0x0173
-#define GlintPatternRamData19Reg 1
-#define GlintPatternRamData19Off 0x7b98
-#define GlintPatternRamData19Sec 0x8b98
-#define GlintPatternRamData19SecReg 3
-#define GlintPatternRamData19SecOff 0x7b98
-
-#define GlintPatternRamData20 0x8ba0
-#define GlintPatternRamData20Tag 0x0174
-#define GlintPatternRamData20Reg 1
-#define GlintPatternRamData20Off 0x7ba0
-#define GlintPatternRamData20Sec 0x8ba0
-#define GlintPatternRamData20SecReg 3
-#define GlintPatternRamData20SecOff 0x7ba0
-
-#define GlintPatternRamData21 0x8ba8
-#define GlintPatternRamData21Tag 0x0175
-#define GlintPatternRamData21Reg 1
-#define GlintPatternRamData21Off 0x7ba8
-#define GlintPatternRamData21Sec 0x8ba8
-#define GlintPatternRamData21SecReg 3
-#define GlintPatternRamData21SecOff 0x7ba8
-
-#define GlintPatternRamData22 0x8bb0
-#define GlintPatternRamData22Tag 0x0176
-#define GlintPatternRamData22Reg 1
-#define GlintPatternRamData22Off 0x7bb0
-#define GlintPatternRamData22Sec 0x8bb0
-#define GlintPatternRamData22SecReg 3
-#define GlintPatternRamData22SecOff 0x7bb0
-
-#define GlintPatternRamData23 0x8bb8
-#define GlintPatternRamData23Tag 0x0177
-#define GlintPatternRamData23Reg 1
-#define GlintPatternRamData23Off 0x7bb8
-#define GlintPatternRamData23Sec 0x8bb8
-#define GlintPatternRamData23SecReg 3
-#define GlintPatternRamData23SecOff 0x7bb8
-
-#define GlintPatternRamData24 0x8bc0
-#define GlintPatternRamData24Tag 0x0178
-#define GlintPatternRamData24Reg 1
-#define GlintPatternRamData24Off 0x7bc0
-#define GlintPatternRamData24Sec 0x8bc0
-#define GlintPatternRamData24SecReg 3
-#define GlintPatternRamData24SecOff 0x7bc0
-
-#define GlintPatternRamData25 0x8bc8
-#define GlintPatternRamData25Tag 0x0179
-#define GlintPatternRamData25Reg 1
-#define GlintPatternRamData25Off 0x7bc8
-#define GlintPatternRamData25Sec 0x8bc8
-#define GlintPatternRamData25SecReg 3
-#define GlintPatternRamData25SecOff 0x7bc8
-
-#define GlintPatternRamData26 0x8bd0
-#define GlintPatternRamData26Tag 0x017a
-#define GlintPatternRamData26Reg 1
-#define GlintPatternRamData26Off 0x7bd0
-#define GlintPatternRamData26Sec 0x8bd0
-#define GlintPatternRamData26SecReg 3
-#define GlintPatternRamData26SecOff 0x7bd0
-
-#define GlintPatternRamData27 0x8bd8
-#define GlintPatternRamData27Tag 0x017b
-#define GlintPatternRamData27Reg 1
-#define GlintPatternRamData27Off 0x7bd8
-#define GlintPatternRamData27Sec 0x8bd8
-#define GlintPatternRamData27SecReg 3
-#define GlintPatternRamData27SecOff 0x7bd8
-
-#define GlintPatternRamData28 0x8be0
-#define GlintPatternRamData28Tag 0x017c
-#define GlintPatternRamData28Reg 1
-#define GlintPatternRamData28Off 0x7be0
-#define GlintPatternRamData28Sec 0x8be0
-#define GlintPatternRamData28SecReg 3
-#define GlintPatternRamData28SecOff 0x7be0
-
-#define GlintPatternRamData29 0x8be8
-#define GlintPatternRamData29Tag 0x017d
-#define GlintPatternRamData29Reg 1
-#define GlintPatternRamData29Off 0x7be8
-#define GlintPatternRamData29Sec 0x8be8
-#define GlintPatternRamData29SecReg 3
-#define GlintPatternRamData29SecOff 0x7be8
-
-#define GlintPatternRamData30 0x8bf0
-#define GlintPatternRamData30Tag 0x017e
-#define GlintPatternRamData30Reg 1
-#define GlintPatternRamData30Off 0x7bf0
-#define GlintPatternRamData30Sec 0x8bf0
-#define GlintPatternRamData30SecReg 3
-#define GlintPatternRamData30SecOff 0x7bf0
-
-#define GlintPatternRamData31 0x8bf8
-#define GlintPatternRamData31Tag 0x017f
-#define GlintPatternRamData31Reg 1
-#define GlintPatternRamData31Off 0x7bf8
-#define GlintPatternRamData31Sec 0x8bf8
-#define GlintPatternRamData31SecReg 3
-#define GlintPatternRamData31SecOff 0x7bf8
-
-#define GlintFBBlockColorU 0x8c68
-#define GlintFBBlockColorUTag 0x018d
-#define GlintFBBlockColorUReg 1
-#define GlintFBBlockColorUOff 0x7c68
-#define GlintFBBlockColorUSec 0x8c68
-#define GlintFBBlockColorUSecReg 3
-#define GlintFBBlockColorUSecOff 0x7c68
-
-#define GlintFBBlockColorL 0x8c70
-#define GlintFBBlockColorLTag 0x018e
-#define GlintFBBlockColorLReg 1
-#define GlintFBBlockColorLOff 0x7c70
-#define GlintFBBlockColorLSec 0x8c70
-#define GlintFBBlockColorLSecReg 3
-#define GlintFBBlockColorLSecOff 0x7c70
-
-#define GlintSuspendUntilFrameBlank 0x8c78
-#define GlintSuspendUntilFrameBlankTag 0x018f
-#define GlintSuspendUntilFrameBlankReg 1
-#define GlintSuspendUntilFrameBlankOff 0x7c78
-#define GlintSuspendUntilFrameBlankSec 0x8c78
-#define GlintSuspendUntilFrameBlankSecReg 3
-#define GlintSuspendUntilFrameBlankSecOff 0x7c78
-
-#define GlintFilterMode 0x8c00
-#define GlintFilterModeTag 0x0180
-#define GlintFilterModeReg 1
-#define GlintFilterModeOff 0x7c00
-#define GlintFilterModeSec 0x8c00
-#define GlintFilterModeSecReg 3
-#define GlintFilterModeSecOff 0x7c00
-
-#define GlintStatisticMode 0x8c08
-#define GlintStatisticModeTag 0x0181
-#define GlintStatisticModeReg 1
-#define GlintStatisticModeOff 0x7c08
-#define GlintStatisticModeSec 0x8c08
-#define GlintStatisticModeSecReg 3
-#define GlintStatisticModeSecOff 0x7c08
-
-#define GlintMinRegion 0x8c10
-#define GlintMinRegionTag 0x0182
-#define GlintMinRegionReg 1
-#define GlintMinRegionOff 0x7c10
-#define GlintMinRegionSec 0x8c10
-#define GlintMinRegionSecReg 3
-#define GlintMinRegionSecOff 0x7c10
-
-#define GlintMaxRegion 0x8c18
-#define GlintMaxRegionTag 0x0183
-#define GlintMaxRegionReg 1
-#define GlintMaxRegionOff 0x7c18
-#define GlintMaxRegionSec 0x8c18
-#define GlintMaxRegionSecReg 3
-#define GlintMaxRegionSecOff 0x7c18
-
-#define GlintResetPickResult 0x8c20
-#define GlintResetPickResultTag 0x0184
-#define GlintResetPickResultReg 1
-#define GlintResetPickResultOff 0x7c20
-#define GlintResetPickResultSec 0x8c20
-#define GlintResetPickResultSecReg 3
-#define GlintResetPickResultSecOff 0x7c20
-
-#define GlintMitHitRegion 0x8c28
-#define GlintMitHitRegionTag 0x0185
-#define GlintMitHitRegionReg 1
-#define GlintMitHitRegionOff 0x7c28
-#define GlintMitHitRegionSec 0x8c28
-#define GlintMitHitRegionSecReg 3
-#define GlintMitHitRegionSecOff 0x7c28
-
-#define GlintMaxHitRegion 0x8c30
-#define GlintMaxHitRegionTag 0x0186
-#define GlintMaxHitRegionReg 1
-#define GlintMaxHitRegionOff 0x7c30
-#define GlintMaxHitRegionSec 0x8c30
-#define GlintMaxHitRegionSecReg 3
-#define GlintMaxHitRegionSecOff 0x7c30
-
-#define GlintPickResult 0x8c38
-#define GlintPickResultTag 0x0187
-#define GlintPickResultReg 1
-#define GlintPickResultOff 0x7c38
-#define GlintPickResultSec 0x8c38
-#define GlintPickResultSecReg 3
-#define GlintPickResultSecOff 0x7c38
-
-#define GlintGLINTSync 0x8c40
-#define GlintGLINTSyncTag 0x0188
-#define GlintGLINTSyncReg 1
-#define GlintGLINTSyncOff 0x7c40
-#define GlintGLINTSyncSec 0x8c40
-#define GlintGLINTSyncSecReg 3
-#define GlintGLINTSyncSecOff 0x7c40
-
-#define GlintKsRStart 0x8c80
-#define GlintKsRStartTag 0x0190
-#define GlintKsRStartReg 1
-#define GlintKsRStartOff 0x7c80
-#define GlintKsRStartSec 0x8c80
-#define GlintKsRStartSecReg 3
-#define GlintKsRStartSecOff 0x7c80
-
-#define GlintdKsRdx 0x8c88
-#define GlintdKsRdxTag 0x0191
-#define GlintdKsRdxReg 1
-#define GlintdKsRdxOff 0x7c88
-#define GlintdKsRdxSec 0x8c88
-#define GlintdKsRdxSecReg 3
-#define GlintdKsRdxSecOff 0x7c88
-
-#define GlintdKsRdyDom 0x8c90
-#define GlintdKsRdyDomTag 0x0192
-#define GlintdKsRdyDomReg 1
-#define GlintdKsRdyDomOff 0x7c90
-#define GlintdKsRdyDomSec 0x8c90
-#define GlintdKsRdyDomSecReg 3
-#define GlintdKsRdyDomSecOff 0x7c90
-
-#define GlintKsGStart 0x8c98
-#define GlintKsGStartTag 0x0193
-#define GlintKsGStartReg 1
-#define GlintKsGStartOff 0x7c98
-#define GlintKsGStartSec 0x8c98
-#define GlintKsGStartSecReg 3
-#define GlintKsGStartSecOff 0x7c98
-
-#define GlintdKsGdx 0x8ca0
-#define GlintdKsGdxTag 0x0194
-#define GlintdKsGdxReg 1
-#define GlintdKsGdxOff 0x7ca0
-#define GlintdKsGdxSec 0x8ca0
-#define GlintdKsGdxSecReg 3
-#define GlintdKsGdxSecOff 0x7ca0
-
-#define GlintdKsGdyDom 0x8ca8
-#define GlintdKsGdyDomTag 0x0195
-#define GlintdKsGdyDomReg 1
-#define GlintdKsGdyDomOff 0x7ca8
-#define GlintdKsGdyDomSec 0x8ca8
-#define GlintdKsGdyDomSecReg 3
-#define GlintdKsGdyDomSecOff 0x7ca8
-
-#define GlintKsBStart 0x8cb0
-#define GlintKsBStartTag 0x0196
-#define GlintKsBStartReg 1
-#define GlintKsBStartOff 0x7cb0
-#define GlintKsBStartSec 0x8cb0
-#define GlintKsBStartSecReg 3
-#define GlintKsBStartSecOff 0x7cb0
-
-#define GlintdKsBdx 0x8cb8
-#define GlintdKsBdxTag 0x0197
-#define GlintdKsBdxReg 1
-#define GlintdKsBdxOff 0x7cb8
-#define GlintdKsBdxSec 0x8cb8
-#define GlintdKsBdxSecReg 3
-#define GlintdKsBdxSecOff 0x7cb8
-
-#define GlintdKsBdyDom 0x8cc0
-#define GlintdKsBdyDomTag 0x0198
-#define GlintdKsBdyDomReg 1
-#define GlintdKsBdyDomOff 0x7cc0
-#define GlintdKsBdyDomSec 0x8cc0
-#define GlintdKsBdyDomSecReg 3
-#define GlintdKsBdyDomSecOff 0x7cc0
-
-#define GlintKdRStart 0x8d00
-#define GlintKdRStartTag 0x01a0
-#define GlintKdRStartReg 1
-#define GlintKdRStartOff 0x7d00
-#define GlintKdRStartSec 0x8d00
-#define GlintKdRStartSecReg 3
-#define GlintKdRStartSecOff 0x7d00
-
-#define GlintdKdRdx 0x8d08
-#define GlintdKdRdxTag 0x01a1
-#define GlintdKdRdxReg 1
-#define GlintdKdRdxOff 0x7d08
-#define GlintdKdRdxSec 0x8d08
-#define GlintdKdRdxSecReg 3
-#define GlintdKdRdxSecOff 0x7d08
-
-#define GlintdKdRdyDom 0x8d10
-#define GlintdKdRdyDomTag 0x01a2
-#define GlintdKdRdyDomReg 1
-#define GlintdKdRdyDomOff 0x7d10
-#define GlintdKdRdyDomSec 0x8d10
-#define GlintdKdRdyDomSecReg 3
-#define GlintdKdRdyDomSecOff 0x7d10
-
-#define GlintKdGStart 0x8d18
-#define GlintKdGStartTag 0x01a3
-#define GlintKdGStartReg 1
-#define GlintKdGStartOff 0x7d18
-#define GlintKdGStartSec 0x8d18
-#define GlintKdGStartSecReg 3
-#define GlintKdGStartSecOff 0x7d18
-
-#define GlintdKdGdx 0x8d20
-#define GlintdKdGdxTag 0x01a4
-#define GlintdKdGdxReg 1
-#define GlintdKdGdxOff 0x7d20
-#define GlintdKdGdxSec 0x8d20
-#define GlintdKdGdxSecReg 3
-#define GlintdKdGdxSecOff 0x7d20
-
-#define GlintdKdGdyDom 0x8d28
-#define GlintdKdGdyDomTag 0x01a5
-#define GlintdKdGdyDomReg 1
-#define GlintdKdGdyDomOff 0x7d28
-#define GlintdKdGdyDomSec 0x8d28
-#define GlintdKdGdyDomSecReg 3
-#define GlintdKdGdyDomSecOff 0x7d28
-
-#define GlintKdBStart 0x8d30
-#define GlintKdBStartTag 0x01a6
-#define GlintKdBStartReg 1
-#define GlintKdBStartOff 0x7d30
-#define GlintKdBStartSec 0x8d30
-#define GlintKdBStartSecReg 3
-#define GlintKdBStartSecOff 0x7d30
-
-#define GlintdKdBdx 0x8d38
-#define GlintdKdBdxTag 0x01a7
-#define GlintdKdBdxReg 1
-#define GlintdKdBdxOff 0x7d38
-#define GlintdKdBdxSec 0x8d38
-#define GlintdKdBdxSecReg 3
-#define GlintdKdBdxSecOff 0x7d38
-
-#define GlintdKdBdyDom 0x8d40
-#define GlintdKdBdyDomTag 0x01a8
-#define GlintdKdBdyDomReg 1
-#define GlintdKdBdyDomOff 0x7d40
-#define GlintdKdBdyDomSec 0x8d40
-#define GlintdKdBdyDomSecReg 3
-#define GlintdKdBdyDomSecOff 0x7d40
-
-#define GlintContextDump 0x8dc0
-#define GlintContextDumpTag 0x01b8
-#define GlintContextDumpReg 1
-#define GlintContextDumpOff 0x7dc0
-
-#define GlintContextRestore 0x8dc8
-#define GlintContextRestoreTag 0x01b9
-#define GlintContextRestoreReg 1
-#define GlintContextRestoreOff 0x7dc8
-
-#define GlintContextData 0x8dd0
-#define GlintContextDataTag 0x01ba
-#define GlintContextDataReg 1
-#define GlintContextDataOff 0x7dd0
-
-#define GlintFeedbackToken 0x8f80
-#define GlintFeedbackTokenTag 0x01f0
-#define GlintFeedbackTokenReg 1
-#define GlintFeedbackTokenOff 0x7f80
-
-#define GlintFeedbackX 0x8f88
-#define GlintFeedbackXTag 0x01f1
-#define GlintFeedbackXReg 1
-#define GlintFeedbackXOff 0x7f88
-
-#define GlintFeedbackY 0x8f90
-#define GlintFeedbackYTag 0x01f2
-#define GlintFeedbackYReg 1
-#define GlintFeedbackYOff 0x7f90
-
-#define GlintFeedbackZ 0x8f98
-#define GlintFeedbackZTag 0x01f3
-#define GlintFeedbackZReg 1
-#define GlintFeedbackZOff 0x7f98
-
-#define GlintFeedbackW 0x8fa0
-#define GlintFeedbackWTag 0x01f4
-#define GlintFeedbackWReg 1
-#define GlintFeedbackWOff 0x7fa0
-
-#define GlintFeedbackRed 0x8fa8
-#define GlintFeedbackRedTag 0x01f5
-#define GlintFeedbackRedReg 1
-#define GlintFeedbackRedOff 0x7fa8
-
-#define GlintFeedbackGreen 0x8fb0
-#define GlintFeedbackGreenTag 0x01f6
-#define GlintFeedbackGreenReg 1
-#define GlintFeedbackGreenOff 0x7fb0
-
-#define GlintFeedbackBlue 0x8fb8
-#define GlintFeedbackBlueTag 0x01f7
-#define GlintFeedbackBlueReg 1
-#define GlintFeedbackBlueOff 0x7fb8
-
-#define GlintFeedbackAlpha 0x8fc0
-#define GlintFeedbackAlphaTag 0x01f8
-#define GlintFeedbackAlphaReg 1
-#define GlintFeedbackAlphaOff 0x7fc0
-
-#define GlintFeedbackS 0x8fc8
-#define GlintFeedbackSTag 0x01f9
-#define GlintFeedbackSReg 1
-#define GlintFeedbackSOff 0x7fc8
-
-#define GlintFeedbackT 0x8fd0
-#define GlintFeedbackTTag 0x01fa
-#define GlintFeedbackTReg 1
-#define GlintFeedbackTOff 0x7fd0
-
-#define GlintFeedbackR 0x8fd8
-#define GlintFeedbackRTag 0x01fb
-#define GlintFeedbackRReg 1
-#define GlintFeedbackROff 0x7fd8
-
-#define GlintFeedbackQ 0x8fe0
-#define GlintFeedbackQTag 0x01fc
-#define GlintFeedbackQReg 1
-#define GlintFeedbackQOff 0x7fe0
-
-#define GlintSelectRecord 0x8fe8
-#define GlintSelectRecordTag 0x01fd
-#define GlintSelectRecordReg 1
-#define GlintSelectRecordOff 0x7fe8
-
-#define GlintPassThrough 0x8ff0
-#define GlintPassThroughTag 0x01fe
-#define GlintPassThroughReg 1
-#define GlintPassThroughOff 0x7ff0
-
-#define GlintEndOfFeedback 0x8ff8
-#define GlintEndOfFeedbackTag 0x01ff
-#define GlintEndOfFeedbackReg 1
-#define GlintEndOfFeedbackOff 0x7ff8
-
-#define GlintV0FixedS 0x9000
-#define GlintV0FixedSTag 0x0200
-#define GlintV0FixedSReg 1
-#define GlintV0FixedSOff 0x8000
-
-#define GlintV0FixedT 0x9008
-#define GlintV0FixedTTag 0x0201
-#define GlintV0FixedTReg 1
-#define GlintV0FixedTOff 0x8008
-
-#define GlintV0FixedQ 0x9010
-#define GlintV0FixedQTag 0x0202
-#define GlintV0FixedQReg 1
-#define GlintV0FixedQOff 0x8010
-
-#define GlintV0FixedKs 0x9018
-#define GlintV0FixedKsTag 0x0203
-#define GlintV0FixedKsReg 1
-#define GlintV0FixedKsOff 0x8018
-
-#define GlintV0FixedKd 0x9020
-#define GlintV0FixedKdTag 0x0204
-#define GlintV0FixedKdReg 1
-#define GlintV0FixedKdOff 0x8020
-
-#define GlintV0FixedR 0x9028
-#define GlintV0FixedRTag 0x0205
-#define GlintV0FixedRReg 1
-#define GlintV0FixedROff 0x8028
-
-#define GlintV0FixedG 0x9030
-#define GlintV0FixedGTag 0x0206
-#define GlintV0FixedGReg 1
-#define GlintV0FixedGOff 0x8030
-
-#define GlintV0FixedB 0x9038
-#define GlintV0FixedBTag 0x0207
-#define GlintV0FixedBReg 1
-#define GlintV0FixedBOff 0x8038
-
-#define GlintV0FixedA 0x9040
-#define GlintV0FixedATag 0x0208
-#define GlintV0FixedAReg 1
-#define GlintV0FixedAOff 0x8040
-
-#define GlintV0FixedF 0x9048
-#define GlintV0FixedFTag 0x0209
-#define GlintV0FixedFReg 1
-#define GlintV0FixedFOff 0x8048
-
-#define GlintV0FixedX 0x9050
-#define GlintV0FixedXTag 0x020a
-#define GlintV0FixedXReg 1
-#define GlintV0FixedXOff 0x8050
-
-#define GlintV0FixedY 0x9058
-#define GlintV0FixedYTag 0x020b
-#define GlintV0FixedYReg 1
-#define GlintV0FixedYOff 0x8058
-
-#define GlintV0FixedZ 0x9060
-#define GlintV0FixedZTag 0x020c
-#define GlintV0FixedZReg 1
-#define GlintV0FixedZOff 0x8060
-
-#define GlintV1FixedS 0x9080
-#define GlintV1FixedSTag 0x0210
-#define GlintV1FixedSReg 1
-#define GlintV1FixedSOff 0x8080
-
-#define GlintV1FixedT 0x9088
-#define GlintV1FixedTTag 0x0211
-#define GlintV1FixedTReg 1
-#define GlintV1FixedTOff 0x8088
-
-#define GlintV1FixedQ 0x9090
-#define GlintV1FixedQTag 0x0212
-#define GlintV1FixedQReg 1
-#define GlintV1FixedQOff 0x8090
-
-#define GlintV1FixedKs 0x9098
-#define GlintV1FixedKsTag 0x0213
-#define GlintV1FixedKsReg 1
-#define GlintV1FixedKsOff 0x8098
-
-#define GlintV1FixedKd 0x90a0
-#define GlintV1FixedKdTag 0x0214
-#define GlintV1FixedKdReg 1
-#define GlintV1FixedKdOff 0x80a0
-
-#define GlintV1FixedR 0x90a8
-#define GlintV1FixedRTag 0x0215
-#define GlintV1FixedRReg 1
-#define GlintV1FixedROff 0x80a8
-
-#define GlintV1FixedG 0x90b0
-#define GlintV1FixedGTag 0x0216
-#define GlintV1FixedGReg 1
-#define GlintV1FixedGOff 0x80b0
-
-#define GlintV1FixedB 0x90b8
-#define GlintV1FixedBTag 0x0217
-#define GlintV1FixedBReg 1
-#define GlintV1FixedBOff 0x80b8
-
-#define GlintV1FixedA 0x90c0
-#define GlintV1FixedATag 0x0218
-#define GlintV1FixedAReg 1
-#define GlintV1FixedAOff 0x80c0
-
-#define GlintV1FixedF 0x90c8
-#define GlintV1FixedFTag 0x0219
-#define GlintV1FixedFReg 1
-#define GlintV1FixedFOff 0x80c8
-
-#define GlintV1FixedX 0x90d0
-#define GlintV1FixedXTag 0x021a
-#define GlintV1FixedXReg 1
-#define GlintV1FixedXOff 0x80d0
-
-#define GlintV1FixedY 0x90d8
-#define GlintV1FixedYTag 0x021b
-#define GlintV1FixedYReg 1
-#define GlintV1FixedYOff 0x80d8
-
-#define GlintV1FixedZ 0x90e0
-#define GlintV1FixedZTag 0x021c
-#define GlintV1FixedZReg 1
-#define GlintV1FixedZOff 0x80e0
-
-#define GlintV2FixedS 0x9100
-#define GlintV2FixedSTag 0x0220
-#define GlintV2FixedSReg 1
-#define GlintV2FixedSOff 0x8100
-
-#define GlintV2FixedT 0x9108
-#define GlintV2FixedTTag 0x0221
-#define GlintV2FixedTReg 1
-#define GlintV2FixedTOff 0x8108
-
-#define GlintV2FixedQ 0x9110
-#define GlintV2FixedQTag 0x0222
-#define GlintV2FixedQReg 1
-#define GlintV2FixedQOff 0x8110
-
-#define GlintV2FixedKs 0x9118
-#define GlintV2FixedKsTag 0x0223
-#define GlintV2FixedKsReg 1
-#define GlintV2FixedKsOff 0x8118
-
-#define GlintV2FixedKd 0x9120
-#define GlintV2FixedKdTag 0x0224
-#define GlintV2FixedKdReg 1
-#define GlintV2FixedKdOff 0x8120
-
-#define GlintV2FixedR 0x9128
-#define GlintV2FixedRTag 0x0225
-#define GlintV2FixedRReg 1
-#define GlintV2FixedROff 0x8128
-
-#define GlintV2FixedG 0x9130
-#define GlintV2FixedGTag 0x0226
-#define GlintV2FixedGReg 1
-#define GlintV2FixedGOff 0x8130
-
-#define GlintV2FixedB 0x9138
-#define GlintV2FixedBTag 0x0227
-#define GlintV2FixedBReg 1
-#define GlintV2FixedBOff 0x8138
-
-#define GlintV2FixedA 0x9140
-#define GlintV2FixedATag 0x0228
-#define GlintV2FixedAReg 1
-#define GlintV2FixedAOff 0x8140
-
-#define GlintV2FixedF 0x9148
-#define GlintV2FixedFTag 0x0229
-#define GlintV2FixedFReg 1
-#define GlintV2FixedFOff 0x8148
-
-#define GlintV2FixedX 0x9150
-#define GlintV2FixedXTag 0x022a
-#define GlintV2FixedXReg 1
-#define GlintV2FixedXOff 0x8150
-
-#define GlintV2FixedY 0x9158
-#define GlintV2FixedYTag 0x022b
-#define GlintV2FixedYReg 1
-#define GlintV2FixedYOff 0x8158
-
-#define GlintV2FixedZ 0x9160
-#define GlintV2FixedZTag 0x022c
-#define GlintV2FixedZReg 1
-#define GlintV2FixedZOff 0x8160
-
-#define GlintV0FloatS 0x9180
-#define GlintV0FloatSTag 0x0230
-#define GlintV0FloatSReg 1
-#define GlintV0FloatSOff 0x8180
-
-#define GlintV0FloatT 0x9188
-#define GlintV0FloatTTag 0x0231
-#define GlintV0FloatTReg 1
-#define GlintV0FloatTOff 0x8188
-
-#define GlintV0FloatQ 0x9190
-#define GlintV0FloatQTag 0x0232
-#define GlintV0FloatQReg 1
-#define GlintV0FloatQOff 0x8190
-
-#define GlintV0FloatKs 0x9198
-#define GlintV0FloatKsTag 0x0233
-#define GlintV0FloatKsReg 1
-#define GlintV0FloatKsOff 0x8198
-
-#define GlintV0FloatKd 0x91a0
-#define GlintV0FloatKdTag 0x0234
-#define GlintV0FloatKdReg 1
-#define GlintV0FloatKdOff 0x81a0
-
-#define GlintV0FloatR 0x91a8
-#define GlintV0FloatRTag 0x0235
-#define GlintV0FloatRReg 1
-#define GlintV0FloatROff 0x81a8
-
-#define GlintV0FloatG 0x91b0
-#define GlintV0FloatGTag 0x0236
-#define GlintV0FloatGReg 1
-#define GlintV0FloatGOff 0x81b0
-
-#define GlintV0FloatB 0x91b8
-#define GlintV0FloatBTag 0x0237
-#define GlintV0FloatBReg 1
-#define GlintV0FloatBOff 0x81b8
-
-#define GlintV0FloatA 0x91c0
-#define GlintV0FloatATag 0x0238
-#define GlintV0FloatAReg 1
-#define GlintV0FloatAOff 0x81c0
-
-#define GlintV0FloatF 0x91c8
-#define GlintV0FloatFTag 0x0239
-#define GlintV0FloatFReg 1
-#define GlintV0FloatFOff 0x81c8
-
-#define GlintV0FloatX 0x91d0
-#define GlintV0FloatXTag 0x023a
-#define GlintV0FloatXReg 1
-#define GlintV0FloatXOff 0x81d0
-
-#define GlintV0FloatY 0x91d8
-#define GlintV0FloatYTag 0x023b
-#define GlintV0FloatYReg 1
-#define GlintV0FloatYOff 0x81d8
-
-#define GlintV0FloatZ 0x91e0
-#define GlintV0FloatZTag 0x023c
-#define GlintV0FloatZReg 1
-#define GlintV0FloatZOff 0x81e0
-
-#define GlintV1FloatS 0x9200
-#define GlintV1FloatSTag 0x0240
-#define GlintV1FloatSReg 1
-#define GlintV1FloatSOff 0x8200
-
-#define GlintV1FloatT 0x9208
-#define GlintV1FloatTTag 0x0241
-#define GlintV1FloatTReg 1
-#define GlintV1FloatTOff 0x8208
-
-#define GlintV1FloatQ 0x9210
-#define GlintV1FloatQTag 0x0242
-#define GlintV1FloatQReg 1
-#define GlintV1FloatQOff 0x8210
-
-#define GlintV1FloatKs 0x9218
-#define GlintV1FloatKsTag 0x0243
-#define GlintV1FloatKsReg 1
-#define GlintV1FloatKsOff 0x8218
-
-#define GlintV1FloatKd 0x9220
-#define GlintV1FloatKdTag 0x0244
-#define GlintV1FloatKdReg 1
-#define GlintV1FloatKdOff 0x8220
-
-#define GlintV1FloatR 0x9228
-#define GlintV1FloatRTag 0x0245
-#define GlintV1FloatRReg 1
-#define GlintV1FloatROff 0x8228
-
-#define GlintV1FloatG 0x9230
-#define GlintV1FloatGTag 0x0246
-#define GlintV1FloatGReg 1
-#define GlintV1FloatGOff 0x8230
-
-#define GlintV1FloatB 0x9238
-#define GlintV1FloatBTag 0x0247
-#define GlintV1FloatBReg 1
-#define GlintV1FloatBOff 0x8238
-
-#define GlintV1FloatA 0x9240
-#define GlintV1FloatATag 0x0248
-#define GlintV1FloatAReg 1
-#define GlintV1FloatAOff 0x8240
-
-#define GlintV1FloatF 0x9248
-#define GlintV1FloatFTag 0x0249
-#define GlintV1FloatFReg 1
-#define GlintV1FloatFOff 0x8248
-
-#define GlintV1FloatX 0x9250
-#define GlintV1FloatXTag 0x024a
-#define GlintV1FloatXReg 1
-#define GlintV1FloatXOff 0x8250
-
-#define GlintV1FloatY 0x9258
-#define GlintV1FloatYTag 0x024b
-#define GlintV1FloatYReg 1
-#define GlintV1FloatYOff 0x8258
-
-#define GlintV1FloatZ 0x9260
-#define GlintV1FloatZTag 0x024c
-#define GlintV1FloatZReg 1
-#define GlintV1FloatZOff 0x8260
-
-#define GlintV2FloatS 0x9280
-#define GlintV2FloatSTag 0x0250
-#define GlintV2FloatSReg 1
-#define GlintV2FloatSOff 0x8280
-
-#define GlintV2FloatT 0x9288
-#define GlintV2FloatTTag 0x0251
-#define GlintV2FloatTReg 1
-#define GlintV2FloatTOff 0x8288
-
-#define GlintV2FloatQ 0x9290
-#define GlintV2FloatQTag 0x0252
-#define GlintV2FloatQReg 1
-#define GlintV2FloatQOff 0x8290
-
-#define GlintV2FloatKs 0x9298
-#define GlintV2FloatKsTag 0x0253
-#define GlintV2FloatKsReg 1
-#define GlintV2FloatKsOff 0x8298
-
-#define GlintV2FloatKd 0x92a0
-#define GlintV2FloatKdTag 0x0254
-#define GlintV2FloatKdReg 1
-#define GlintV2FloatKdOff 0x82a0
-
-#define GlintV2FloatR 0x92a8
-#define GlintV2FloatRTag 0x0255
-#define GlintV2FloatRReg 1
-#define GlintV2FloatROff 0x82a8
-
-#define GlintV2FloatG 0x92b0
-#define GlintV2FloatGTag 0x0256
-#define GlintV2FloatGReg 1
-#define GlintV2FloatGOff 0x82b0
-
-#define GlintV2FloatB 0x92b8
-#define GlintV2FloatBTag 0x0257
-#define GlintV2FloatBReg 1
-#define GlintV2FloatBOff 0x82b8
-
-#define GlintV2FloatA 0x92c0
-#define GlintV2FloatATag 0x0258
-#define GlintV2FloatAReg 1
-#define GlintV2FloatAOff 0x82c0
-
-#define GlintV2FloatF 0x92c8
-#define GlintV2FloatFTag 0x0259
-#define GlintV2FloatFReg 1
-#define GlintV2FloatFOff 0x82c8
-
-#define GlintV2FloatX 0x92d0
-#define GlintV2FloatXTag 0x025a
-#define GlintV2FloatXReg 1
-#define GlintV2FloatXOff 0x82d0
-
-#define GlintV2FloatY 0x92d8
-#define GlintV2FloatYTag 0x025b
-#define GlintV2FloatYReg 1
-#define GlintV2FloatYOff 0x82d8
-
-#define GlintV2FloatZ 0x92e0
-#define GlintV2FloatZTag 0x025c
-#define GlintV2FloatZReg 1
-#define GlintV2FloatZOff 0x82e0
-
-#define GlintDeltaMode 0x9300
-#define GlintDeltaModeTag 0x0260
-#define GlintDeltaModeReg 1
-#define GlintDeltaModeOff 0x8300
-
-#define GlintDrawTriangle 0x9308
-#define GlintDrawTriangleTag 0x0261
-#define GlintDrawTriangleReg 1
-#define GlintDrawTriangleOff 0x8308
-
-#define GlintRepeatTriangle 0x9310
-#define GlintRepeatTriangleTag 0x0262
-#define GlintRepeatTriangleReg 1
-#define GlintRepeatTriangleOff 0x8310
-
-#define GlintDrawLine01 0x9318
-#define GlintDrawLine01Tag 0x0263
-#define GlintDrawLine01Reg 1
-#define GlintDrawLine01Off 0x8318
-
-#define GlintDrawLine10 0x9320
-#define GlintDrawLine10Tag 0x0264
-#define GlintDrawLine10Reg 1
-#define GlintDrawLine10Off 0x8320
-
-#define GlintRepeatLine 0x9328
-#define GlintRepeatLineTag 0x0265
-#define GlintRepeatLineReg 1
-#define GlintRepeatLineOff 0x8328
-
-#define GlintEpilogueTag 0x9368
-#define GlintEpilogueTagTag 0x026d
-#define GlintEpilogueTagReg 1
-#define GlintEpilogueTagOff 0x8368
-
-#define GlintEpilogueData 0x9370
-#define GlintEpilogueDataTag 0x026e
-#define GlintEpilogueDataReg 1
-#define GlintEpilogueDataOff 0x8370
-
-#define GlintBroadcastMask 0x9378
-#define GlintBroadcastMaskTag 0x026f
-#define GlintBroadcastMaskReg 1
-#define GlintBroadcastMaskOff 0x8378
-
-#define GlintXBias 0x9480
-#define GlintXBiasTag 0x0290
-#define GlintXBiasReg 1
-#define GlintXBiasOff 0x8480
-
-#define GlintYBias 0x9488
-#define GlintYBiasTag 0x0291
-#define GlintYBiasReg 1
-#define GlintYBiasOff 0x8488
-
-#define GlintPointMode 0x9490
-#define GlintPointModeTag 0x0292
-#define GlintPointModeReg 1
-#define GlintPointModeOff 0x8490
-
-#define GlintPointSize 0x9498
-#define GlintPointSizeTag 0x0293
-#define GlintPointSizeReg 1
-#define GlintPointSizeOff 0x8498
-
-#define GlintAApointSize 0x94a0
-#define GlintAApointSizeTag 0x0294
-#define GlintAApointSizeReg 1
-#define GlintAApointSizeOff 0x84a0
-
-#define GlintLineMode 0x94a8
-#define GlintLineModeTag 0x0295
-#define GlintLineModeReg 1
-#define GlintLineModeOff 0x84a8
-
-#define GlintLineWidth 0x94b0
-#define GlintLineWidthTag 0x0296
-#define GlintLineWidthReg 1
-#define GlintLineWidthOff 0x84b0
-
-#define GlintLineWidthOffset 0x94b8
-#define GlintLineWidthOffsetTag 0x0297
-#define GlintLineWidthOffsetReg 1
-#define GlintLineWidthOffsetOff 0x84b8
-
-#define GlintAAlineWidth 0x94c0
-#define GlintAAlineWidthTag 0x0298
-#define GlintAAlineWidthReg 1
-#define GlintAAlineWidthOff 0x84c0
-
-#define GlintTriangleMode 0x94c8
-#define GlintTriangleModeTag 0x0299
-#define GlintTriangleModeReg 1
-#define GlintTriangleModeOff 0x84c8
-
-#define GlintRectangleMode 0x94d0
-#define GlintRectangleModeTag 0x029a
-#define GlintRectangleModeReg 1
-#define GlintRectangleModeOff 0x84d0
-
-#define GlintRectangleWidth 0x94d8
-#define GlintRectangleWidthTag 0x029b
-#define GlintRectangleWidthReg 1
-#define GlintRectangleWidthOff 0x84d8
-
-#define GlintRectangleHeight 0x94e0
-#define GlintRectangleHeightTag 0x029c
-#define GlintRectangleHeightReg 1
-#define GlintRectangleHeightOff 0x84e0
-
-#define GlintRectangle2DMode 0x94e8
-#define GlintRectangle2DModeTag 0x029d
-#define GlintRectangle2DModeReg 1
-#define GlintRectangle2DModeOff 0x84e8
-
-#define GlintRectangle2DControl 0x94f0
-#define GlintRectangle2DControlTag 0x029e
-#define GlintRectangle2DControlReg 1
-#define GlintRectangle2DControlOff 0x84f0
-
-#define GlintTransformMode 0x9508
-#define GlintTransformModeTag 0x02a1
-#define GlintTransformModeReg 1
-#define GlintTransformModeOff 0x8508
-
-#define GlintGeometryMode 0x9510
-#define GlintGeometryModeTag 0x02a2
-#define GlintGeometryModeReg 1
-#define GlintGeometryModeOff 0x8510
-
-#define GlintNormalizeMode 0x9518
-#define GlintNormalizeModeTag 0x02a3
-#define GlintNormalizeModeReg 1
-#define GlintNormalizeModeOff 0x8518
-
-#define GlintLightingMode 0x9520
-#define GlintLightingModeTag 0x02a4
-#define GlintLightingModeReg 1
-#define GlintLightingModeOff 0x8520
-
-#define GlintColorMaterialMode 0x9528
-#define GlintColorMaterialModeTag 0x02a5
-#define GlintColorMaterialModeReg 1
-#define GlintColorMaterialModeOff 0x8528
-
-#define GlintMaterialMode 0x9530
-#define GlintMaterialModeTag 0x02a6
-#define GlintMaterialModeReg 1
-#define GlintMaterialModeOff 0x8530
-
-#define GlintSelectResult 0x9580
-#define GlintSelectResultTag 0x02b0
-#define GlintSelectResultReg 1
-#define GlintSelectResultOff 0x8580
-
-#define GlintBegin 0x9590
-#define GlintBeginTag 0x02b2
-#define GlintBeginReg 1
-#define GlintBeginOff 0x8590
-
-#define GlintEnd 0x9598
-#define GlintEndTag 0x02b3
-#define GlintEndReg 1
-#define GlintEndOff 0x8598
-
-#define GlintEdgeFlag 0x95a0
-#define GlintEdgeFlagTag 0x02b4
-#define GlintEdgeFlagReg 1
-#define GlintEdgeFlagOff 0x85a0
-
-#define GlintObjectIDvalue 0x95a8
-#define GlintObjectIDvalueTag 0x02b5
-#define GlintObjectIDvalueReg 1
-#define GlintObjectIDvalueOff 0x85a8
-
-#define GlintIncrementObjectID 0x95b0
-#define GlintIncrementObjectIDTag 0x02b6
-#define GlintIncrementObjectIDReg 1
-#define GlintIncrementObjectIDOff 0x85b0
-
-#define GlintTransformCurrent 0x95b8
-#define GlintTransformCurrentTag 0x02b7
-#define GlintTransformCurrentReg 1
-#define GlintTransformCurrentOff 0x85b8
-
-#define GlintSaveCurrent 0x95c8
-#define GlintSaveCurrentTag 0x02b9
-#define GlintSaveCurrentReg 1
-#define GlintSaveCurrentOff 0x85c8
-
-#define GlintRestoreCurrent 0x95d0
-#define GlintRestoreCurrentTag 0x02ba
-#define GlintRestoreCurrentReg 1
-#define GlintRestoreCurrentOff 0x85d0
-
-#define GlintInitNames 0x95d8
-#define GlintInitNamesTag 0x02bb
-#define GlintInitNamesReg 1
-#define GlintInitNamesOff 0x85d8
-
-#define GlintPushName 0x95e0
-#define GlintPushNameTag 0x02bc
-#define GlintPushNameReg 1
-#define GlintPushNameOff 0x85e0
-
-#define GlintPopName 0x95e8
-#define GlintPopNameTag 0x02bd
-#define GlintPopNameReg 1
-#define GlintPopNameOff 0x85e8
-
-#define GlintLoadName 0x95f0
-#define GlintLoadNameTag 0x02be
-#define GlintLoadNameReg 1
-#define GlintLoadNameOff 0x85f0
-
-#define GlintGeomRectangle 0x96a0
-#define GlintGeomRectangleTag 0x02d4
-#define GlintGeomRectangleReg 1
-#define GlintGeomRectangleOff 0x86a0
-
-#define GlintDrawRectangle2D 0x97a0
-#define GlintDrawRectangle2DTag 0x02f4
-#define GlintDrawRectangle2DReg 1
-#define GlintDrawRectangle2DOff 0x87a0
-
-#define GlintNz 0x9800
-#define GlintNzTag 0x0300
-#define GlintNzReg 1
-#define GlintNzOff 0x8800
-
-#define GlintNy 0x9808
-#define GlintNyTag 0x0301
-#define GlintNyReg 1
-#define GlintNyOff 0x8808
-
-#define GlintNx 0x9810
-#define GlintNxTag 0x0302
-#define GlintNxReg 1
-#define GlintNxOff 0x8810
-
-#define GlintCa 0x9818
-#define GlintCaTag 0x0303
-#define GlintCaReg 1
-#define GlintCaOff 0x8818
-
-#define GlintCb 0x9820
-#define GlintCbTag 0x0304
-#define GlintCbReg 1
-#define GlintCbOff 0x8820
-
-#define GlintCg 0x9828
-#define GlintCgTag 0x0305
-#define GlintCgReg 1
-#define GlintCgOff 0x8828
-
-#define GlintCr3 0x9830
-#define GlintCr3Tag 0x0306
-#define GlintCr3Reg 1
-#define GlintCr3Off 0x8830
-
-#define GlintCr4 0x9838
-#define GlintCr4Tag 0x0307
-#define GlintCr4Reg 1
-#define GlintCr4Off 0x8838
-
-#define GlintTt2 0x9840
-#define GlintTt2Tag 0x0308
-#define GlintTt2Reg 1
-#define GlintTt2Off 0x8840
-
-#define GlintTs2 0x9848
-#define GlintTs2Tag 0x0309
-#define GlintTs2Reg 1
-#define GlintTs2Off 0x8848
-
-#define GlintVw 0x9850
-#define GlintVwTag 0x030a
-#define GlintVwReg 1
-#define GlintVwOff 0x8850
-
-#define GlintVz 0x9858
-#define GlintVzTag 0x030b
-#define GlintVzReg 1
-#define GlintVzOff 0x8858
-
-#define GlintVy 0x9860
-#define GlintVyTag 0x030c
-#define GlintVyReg 1
-#define GlintVyOff 0x8860
-
-#define GlintVx2 0x9868
-#define GlintVx2Tag 0x030d
-#define GlintVx2Reg 1
-#define GlintVx2Off 0x8868
-
-#define GlintVx3 0x9870
-#define GlintVx3Tag 0x030e
-#define GlintVx3Reg 1
-#define GlintVx3Off 0x8870
-
-#define GlintVx4 0x9878
-#define GlintVx4Tag 0x030f
-#define GlintVx4Reg 1
-#define GlintVx4Off 0x8878
-
-#define GlintFNz 0x9880
-#define GlintFNzTag 0x0310
-#define GlintFNzReg 1
-#define GlintFNzOff 0x8880
-
-#define GlintFNy 0x9888
-#define GlintFNyTag 0x0311
-#define GlintFNyReg 1
-#define GlintFNyOff 0x8888
-
-#define GlintFNx 0x9890
-#define GlintFNxTag 0x0312
-#define GlintFNxReg 1
-#define GlintFNxOff 0x8890
-
-#define GlintPackedColor3 0x9898
-#define GlintPackedColor3Tag 0x0313
-#define GlintPackedColor3Reg 1
-#define GlintPackedColor3Off 0x8898
-
-#define GlintPackedColor4 0x98a0
-#define GlintPackedColor4Tag 0x0314
-#define GlintPackedColor4Reg 1
-#define GlintPackedColor4Off 0x88a0
-
-#define GlintTq4 0x98a8
-#define GlintTq4Tag 0x0315
-#define GlintTq4Reg 1
-#define GlintTq4Off 0x88a8
-
-#define GlintTr4 0x98b0
-#define GlintTr4Tag 0x0316
-#define GlintTr4Reg 1
-#define GlintTr4Off 0x88b0
-
-#define GlintTt4 0x98b8
-#define GlintTt4Tag 0x0317
-#define GlintTt4Reg 1
-#define GlintTt4Off 0x88b8
-
-#define GlintTs4 0x98c0
-#define GlintTs4Tag 0x0318
-#define GlintTs4Reg 1
-#define GlintTs4Off 0x88c0
-
-#define GlintRPw 0x98c8
-#define GlintRPwTag 0x0319
-#define GlintRPwReg 1
-#define GlintRPwOff 0x88c8
-
-#define GlintRPz 0x98d0
-#define GlintRPzTag 0x031a
-#define GlintRPzReg 1
-#define GlintRPzOff 0x88d0
-
-#define GlintRPy 0x98d8
-#define GlintRPyTag 0x031b
-#define GlintRPyReg 1
-#define GlintRPyOff 0x88d8
-
-#define GlintRPx2 0x98e0
-#define GlintRPx2Tag 0x031c
-#define GlintRPx2Reg 1
-#define GlintRPx2Off 0x88e0
-
-#define GlintRPx3 0x98e8
-#define GlintRPx3Tag 0x031d
-#define GlintRPx3Reg 1
-#define GlintRPx3Off 0x88e8
-
-#define GlintRPx4 0x98f0
-#define GlintRPx4Tag 0x031e
-#define GlintRPx4Reg 1
-#define GlintRPx4Off 0x88f0
-
-#define GlintTs1 0x98f8
-#define GlintTs1Tag 0x031f
-#define GlintTs1Reg 1
-#define GlintTs1Off 0x88f8
-
-#define GlintModelViewMatrix0 0x9900
-#define GlintModelViewMatrix0Tag 0x0320
-#define GlintModelViewMatrix0Reg 1
-#define GlintModelViewMatrix0Off 0x8900
-
-#define GlintModelViewMatrix1 0x9908
-#define GlintModelViewMatrix1Tag 0x0321
-#define GlintModelViewMatrix1Reg 1
-#define GlintModelViewMatrix1Off 0x8908
-
-#define GlintModelViewMatrix2 0x9910
-#define GlintModelViewMatrix2Tag 0x0322
-#define GlintModelViewMatrix2Reg 1
-#define GlintModelViewMatrix2Off 0x8910
-
-#define GlintModelViewMatrix3 0x9918
-#define GlintModelViewMatrix3Tag 0x0323
-#define GlintModelViewMatrix3Reg 1
-#define GlintModelViewMatrix3Off 0x8918
-
-#define GlintModelViewMatrix4 0x9920
-#define GlintModelViewMatrix4Tag 0x0324
-#define GlintModelViewMatrix4Reg 1
-#define GlintModelViewMatrix4Off 0x8920
-
-#define GlintModelViewMatrix5 0x9928
-#define GlintModelViewMatrix5Tag 0x0325
-#define GlintModelViewMatrix5Reg 1
-#define GlintModelViewMatrix5Off 0x8928
-
-#define GlintModelViewMatrix6 0x9930
-#define GlintModelViewMatrix6Tag 0x0326
-#define GlintModelViewMatrix6Reg 1
-#define GlintModelViewMatrix6Off 0x8930
-
-#define GlintModelViewMatrix7 0x9938
-#define GlintModelViewMatrix7Tag 0x0327
-#define GlintModelViewMatrix7Reg 1
-#define GlintModelViewMatrix7Off 0x8938
-
-#define GlintModelViewMatrix8 0x9940
-#define GlintModelViewMatrix8Tag 0x0328
-#define GlintModelViewMatrix8Reg 1
-#define GlintModelViewMatrix8Off 0x8940
-
-#define GlintModelViewMatrix9 0x9948
-#define GlintModelViewMatrix9Tag 0x0329
-#define GlintModelViewMatrix9Reg 1
-#define GlintModelViewMatrix9Off 0x8948
-
-#define GlintModelViewMatrix10 0x9950
-#define GlintModelViewMatrix10Tag 0x032a
-#define GlintModelViewMatrix10Reg 1
-#define GlintModelViewMatrix10Off 0x8950
-
-#define GlintModelViewMatrix11 0x9958
-#define GlintModelViewMatrix11Tag 0x032b
-#define GlintModelViewMatrix11Reg 1
-#define GlintModelViewMatrix11Off 0x8958
-
-#define GlintModelViewMatrix12 0x9960
-#define GlintModelViewMatrix12Tag 0x032c
-#define GlintModelViewMatrix12Reg 1
-#define GlintModelViewMatrix12Off 0x8960
-
-#define GlintModelViewMatrix13 0x9968
-#define GlintModelViewMatrix13Tag 0x032d
-#define GlintModelViewMatrix13Reg 1
-#define GlintModelViewMatrix13Off 0x8968
-
-#define GlintModelViewMatrix14 0x9970
-#define GlintModelViewMatrix14Tag 0x032e
-#define GlintModelViewMatrix14Reg 1
-#define GlintModelViewMatrix14Off 0x8970
-
-#define GlintModelViewMatrix15 0x9978
-#define GlintModelViewMatrix15Tag 0x032f
-#define GlintModelViewMatrix15Reg 1
-#define GlintModelViewMatrix15Off 0x8978
-
-#define GlintModelViewProjectionMatrix0 0x9980
-#define GlintModelViewProjectionMatrix0Tag 0x0330
-#define GlintModelViewProjectionMatrix0Reg 1
-#define GlintModelViewProjectionMatrix0Off 0x8980
-
-#define GlintModelViewProjectionMatrix1 0x9988
-#define GlintModelViewProjectionMatrix1Tag 0x0331
-#define GlintModelViewProjectionMatrix1Reg 1
-#define GlintModelViewProjectionMatrix1Off 0x8988
-
-#define GlintModelViewProjectionMatrix2 0x9990
-#define GlintModelViewProjectionMatrix2Tag 0x0332
-#define GlintModelViewProjectionMatrix2Reg 1
-#define GlintModelViewProjectionMatrix2Off 0x8990
-
-#define GlintModelViewProjectionMatrix3 0x9998
-#define GlintModelViewProjectionMatrix3Tag 0x0333
-#define GlintModelViewProjectionMatrix3Reg 1
-#define GlintModelViewProjectionMatrix3Off 0x8998
-
-#define GlintModelViewProjectionMatrix4 0x99a0
-#define GlintModelViewProjectionMatrix4Tag 0x0334
-#define GlintModelViewProjectionMatrix4Reg 1
-#define GlintModelViewProjectionMatrix4Off 0x89a0
-
-#define GlintModelViewProjectionMatrix5 0x99a8
-#define GlintModelViewProjectionMatrix5Tag 0x0335
-#define GlintModelViewProjectionMatrix5Reg 1
-#define GlintModelViewProjectionMatrix5Off 0x89a8
-
-#define GlintModelViewProjectionMatrix6 0x99b0
-#define GlintModelViewProjectionMatrix6Tag 0x0336
-#define GlintModelViewProjectionMatrix6Reg 1
-#define GlintModelViewProjectionMatrix6Off 0x89b0
-
-#define GlintModelViewProjectionMatrix7 0x99b8
-#define GlintModelViewProjectionMatrix7Tag 0x0337
-#define GlintModelViewProjectionMatrix7Reg 1
-#define GlintModelViewProjectionMatrix7Off 0x89b8
-
-#define GlintModelViewProjectionMatrix8 0x99c0
-#define GlintModelViewProjectionMatrix8Tag 0x0338
-#define GlintModelViewProjectionMatrix8Reg 1
-#define GlintModelViewProjectionMatrix8Off 0x89c0
-
-#define GlintModelViewProjectionMatrix9 0x99c8
-#define GlintModelViewProjectionMatrix9Tag 0x0339
-#define GlintModelViewProjectionMatrix9Reg 1
-#define GlintModelViewProjectionMatrix9Off 0x89c8
-
-#define GlintModelViewProjectionMatrix10 0x99d0
-#define GlintModelViewProjectionMatrix10Tag 0x033a
-#define GlintModelViewProjectionMatrix10Reg 1
-#define GlintModelViewProjectionMatrix10Off 0x89d0
-
-#define GlintModelViewProjectionMatrix11 0x99d8
-#define GlintModelViewProjectionMatrix11Tag 0x033b
-#define GlintModelViewProjectionMatrix11Reg 1
-#define GlintModelViewProjectionMatrix11Off 0x89d8
-
-#define GlintModelViewProjectionMatrix12 0x99e0
-#define GlintModelViewProjectionMatrix12Tag 0x033c
-#define GlintModelViewProjectionMatrix12Reg 1
-#define GlintModelViewProjectionMatrix12Off 0x89e0
-
-#define GlintModelViewProjectionMatrix13 0x99e8
-#define GlintModelViewProjectionMatrix13Tag 0x033d
-#define GlintModelViewProjectionMatrix13Reg 1
-#define GlintModelViewProjectionMatrix13Off 0x89e8
-
-#define GlintModelViewProjectionMatrix14 0x99f0
-#define GlintModelViewProjectionMatrix14Tag 0x033e
-#define GlintModelViewProjectionMatrix14Reg 1
-#define GlintModelViewProjectionMatrix14Off 0x89f0
-
-#define GlintModelViewProjectionMatrix15 0x99f8
-#define GlintModelViewProjectionMatrix15Tag 0x033f
-#define GlintModelViewProjectionMatrix15Reg 1
-#define GlintModelViewProjectionMatrix15Off 0x89f8
-
-#define GlintNormalMatrix0 0x9a00
-#define GlintNormalMatrix0Tag 0x0340
-#define GlintNormalMatrix0Reg 1
-#define GlintNormalMatrix0Off 0x8a00
-
-#define GlintNormalMatrix1 0x9a08
-#define GlintNormalMatrix1Tag 0x0341
-#define GlintNormalMatrix1Reg 1
-#define GlintNormalMatrix1Off 0x8a08
-
-#define GlintNormalMatrix2 0x9a10
-#define GlintNormalMatrix2Tag 0x0342
-#define GlintNormalMatrix2Reg 1
-#define GlintNormalMatrix2Off 0x8a10
-
-#define GlintNormalMatrix3 0x9a18
-#define GlintNormalMatrix3Tag 0x0343
-#define GlintNormalMatrix3Reg 1
-#define GlintNormalMatrix3Off 0x8a18
-
-#define GlintNormalMatrix4 0x9a20
-#define GlintNormalMatrix4Tag 0x0344
-#define GlintNormalMatrix4Reg 1
-#define GlintNormalMatrix4Off 0x8a20
-
-#define GlintNormalMatrix5 0x9a28
-#define GlintNormalMatrix5Tag 0x0345
-#define GlintNormalMatrix5Reg 1
-#define GlintNormalMatrix5Off 0x8a28
-
-#define GlintNormalMatrix6 0x9a30
-#define GlintNormalMatrix6Tag 0x0346
-#define GlintNormalMatrix6Reg 1
-#define GlintNormalMatrix6Off 0x8a30
-
-#define GlintNormalMatrix7 0x9a38
-#define GlintNormalMatrix7Tag 0x0347
-#define GlintNormalMatrix7Reg 1
-#define GlintNormalMatrix7Off 0x8a38
-
-#define GlintNormalMatrix8 0x9a40
-#define GlintNormalMatrix8Tag 0x0348
-#define GlintNormalMatrix8Reg 1
-#define GlintNormalMatrix8Off 0x8a40
-
-#define GlintTextureMatrix0 0x9a80
-#define GlintTextureMatrix0Tag 0x0350
-#define GlintTextureMatrix0Reg 1
-#define GlintTextureMatrix0Off 0x8a80
-
-#define GlintTextureMatrix1 0x9a88
-#define GlintTextureMatrix1Tag 0x0351
-#define GlintTextureMatrix1Reg 1
-#define GlintTextureMatrix1Off 0x8a88
-
-#define GlintTextureMatrix2 0x9a90
-#define GlintTextureMatrix2Tag 0x0352
-#define GlintTextureMatrix2Reg 1
-#define GlintTextureMatrix2Off 0x8a90
-
-#define GlintTextureMatrix3 0x9a98
-#define GlintTextureMatrix3Tag 0x0353
-#define GlintTextureMatrix3Reg 1
-#define GlintTextureMatrix3Off 0x8a98
-
-#define GlintTextureMatrix4 0x9aa0
-#define GlintTextureMatrix4Tag 0x0354
-#define GlintTextureMatrix4Reg 1
-#define GlintTextureMatrix4Off 0x8aa0
-
-#define GlintTextureMatrix5 0x9aa8
-#define GlintTextureMatrix5Tag 0x0355
-#define GlintTextureMatrix5Reg 1
-#define GlintTextureMatrix5Off 0x8aa8
-
-#define GlintTextureMatrix6 0x9ab0
-#define GlintTextureMatrix6Tag 0x0356
-#define GlintTextureMatrix6Reg 1
-#define GlintTextureMatrix6Off 0x8ab0
-
-#define GlintTextureMatrix7 0x9ab8
-#define GlintTextureMatrix7Tag 0x0357
-#define GlintTextureMatrix7Reg 1
-#define GlintTextureMatrix7Off 0x8ab8
-
-#define GlintTextureMatrix8 0x9ac0
-#define GlintTextureMatrix8Tag 0x0358
-#define GlintTextureMatrix8Reg 1
-#define GlintTextureMatrix8Off 0x8ac0
-
-#define GlintTextureMatrix9 0x9ac8
-#define GlintTextureMatrix9Tag 0x0359
-#define GlintTextureMatrix9Reg 1
-#define GlintTextureMatrix9Off 0x8ac8
-
-#define GlintTextureMatrix10 0x9ad0
-#define GlintTextureMatrix10Tag 0x035a
-#define GlintTextureMatrix10Reg 1
-#define GlintTextureMatrix10Off 0x8ad0
-
-#define GlintTextureMatrix11 0x9ad8
-#define GlintTextureMatrix11Tag 0x035b
-#define GlintTextureMatrix11Reg 1
-#define GlintTextureMatrix11Off 0x8ad8
-
-#define GlintTextureMatrix12 0x9ae0
-#define GlintTextureMatrix12Tag 0x035c
-#define GlintTextureMatrix12Reg 1
-#define GlintTextureMatrix12Off 0x8ae0
-
-#define GlintTextureMatrix13 0x9ae8
-#define GlintTextureMatrix13Tag 0x035d
-#define GlintTextureMatrix13Reg 1
-#define GlintTextureMatrix13Off 0x8ae8
-
-#define GlintTextureMatrix14 0x9af0
-#define GlintTextureMatrix14Tag 0x035e
-#define GlintTextureMatrix14Reg 1
-#define GlintTextureMatrix14Off 0x8af0
-
-#define GlintTextureMatrix15 0x9af8
-#define GlintTextureMatrix15Tag 0x035f
-#define GlintTextureMatrix15Reg 1
-#define GlintTextureMatrix15Off 0x8af8
-
-#define GlintTexGen0 0x9b00
-#define GlintTexGen0Tag 0x0360
-#define GlintTexGen0Reg 1
-#define GlintTexGen0Off 0x8b00
-
-#define GlintTexGen1 0x9b08
-#define GlintTexGen1Tag 0x0361
-#define GlintTexGen1Reg 1
-#define GlintTexGen1Off 0x8b08
-
-#define GlintTexGen2 0x9b10
-#define GlintTexGen2Tag 0x0362
-#define GlintTexGen2Reg 1
-#define GlintTexGen2Off 0x8b10
-
-#define GlintTexGen3 0x9b18
-#define GlintTexGen3Tag 0x0363
-#define GlintTexGen3Reg 1
-#define GlintTexGen3Off 0x8b18
-
-#define GlintTexGen4 0x9b20
-#define GlintTexGen4Tag 0x0364
-#define GlintTexGen4Reg 1
-#define GlintTexGen4Off 0x8b20
-
-#define GlintTexGen5 0x9b28
-#define GlintTexGen5Tag 0x0365
-#define GlintTexGen5Reg 1
-#define GlintTexGen5Off 0x8b28
-
-#define GlintTexGen6 0x9b30
-#define GlintTexGen6Tag 0x0366
-#define GlintTexGen6Reg 1
-#define GlintTexGen6Off 0x8b30
-
-#define GlintTexGen7 0x9b38
-#define GlintTexGen7Tag 0x0367
-#define GlintTexGen7Reg 1
-#define GlintTexGen7Off 0x8b38
-
-#define GlintTexGen8 0x9b40
-#define GlintTexGen8Tag 0x0368
-#define GlintTexGen8Reg 1
-#define GlintTexGen8Off 0x8b40
-
-#define GlintTexGen9 0x9b48
-#define GlintTexGen9Tag 0x0369
-#define GlintTexGen9Reg 1
-#define GlintTexGen9Off 0x8b48
-
-#define GlintTexGen10 0x9b50
-#define GlintTexGen10Tag 0x036a
-#define GlintTexGen10Reg 1
-#define GlintTexGen10Off 0x8b50
-
-#define GlintTexGen11 0x9b58
-#define GlintTexGen11Tag 0x036b
-#define GlintTexGen11Reg 1
-#define GlintTexGen11Off 0x8b58
-
-#define GlintTexGen12 0x9b60
-#define GlintTexGen12Tag 0x036c
-#define GlintTexGen12Reg 1
-#define GlintTexGen12Off 0x8b60
-
-#define GlintTexGen13 0x9b68
-#define GlintTexGen13Tag 0x036d
-#define GlintTexGen13Reg 1
-#define GlintTexGen13Off 0x8b68
-
-#define GlintTexGen14 0x9b70
-#define GlintTexGen14Tag 0x036e
-#define GlintTexGen14Reg 1
-#define GlintTexGen14Off 0x8b70
-
-#define GlintTexGen15 0x9b78
-#define GlintTexGen15Tag 0x036f
-#define GlintTexGen15Reg 1
-#define GlintTexGen15Off 0x8b78
-
-#define GlintViewPortScaleX 0x9b80
-#define GlintViewPortScaleXTag 0x0370
-#define GlintViewPortScaleXReg 1
-#define GlintViewPortScaleXOff 0x8b80
-
-#define GlintViewPortScaleY 0x9b88
-#define GlintViewPortScaleYTag 0x0371
-#define GlintViewPortScaleYReg 1
-#define GlintViewPortScaleYOff 0x8b88
-
-#define GlintViewPortScaleZ 0x9b90
-#define GlintViewPortScaleZTag 0x0372
-#define GlintViewPortScaleZReg 1
-#define GlintViewPortScaleZOff 0x8b90
-
-#define GlintViewPortOffsetX 0x9b98
-#define GlintViewPortOffsetXTag 0x0373
-#define GlintViewPortOffsetXReg 1
-#define GlintViewPortOffsetXOff 0x8b98
-
-#define GlintViewPortOffsetY 0x9ba0
-#define GlintViewPortOffsetYTag 0x0374
-#define GlintViewPortOffsetYReg 1
-#define GlintViewPortOffsetYOff 0x8ba0
-
-#define GlintViewPortOffsetZ 0x9ba8
-#define GlintViewPortOffsetZTag 0x0375
-#define GlintViewPortOffsetZReg 1
-#define GlintViewPortOffsetZOff 0x8ba8
-
-#define GlintFogDensity 0x9bb0
-#define GlintFogDensityTag 0x0376
-#define GlintFogDensityReg 1
-#define GlintFogDensityOff 0x8bb0
-
-#define GlintFogScale 0x9bb8
-#define GlintFogScaleTag 0x0377
-#define GlintFogScaleReg 1
-#define GlintFogScaleOff 0x8bb8
-
-#define GlintFogEnd 0x9bc0
-#define GlintFogEndTag 0x0378
-#define GlintFogEndReg 1
-#define GlintFogEndOff 0x8bc0
-
-#define GlintPolygonOffsetFactor 0x9bc8
-#define GlintPolygonOffsetFactorTag 0x0379
-#define GlintPolygonOffsetFactorReg 1
-#define GlintPolygonOffsetFactorOff 0x8bc8
-
-#define GlintPolygonOffsetBias 0x9bd0
-#define GlintPolygonOffsetBiasTag 0x037a
-#define GlintPolygonOffsetBiasReg 1
-#define GlintPolygonOffsetBiasOff 0x8bd0
-
-#define GlintLineClipLengthThreshold 0x9bd8
-#define GlintLineClipLengthThresholdTag 0x037b
-#define GlintLineClipLengthThresholdReg 1
-#define GlintLineClipLengthThresholdOff 0x8bd8
-
-#define GlintTriangleClipAreaThreshold 0x9be0
-#define GlintTriangleClipAreaThresholdTag 0x037c
-#define GlintTriangleClipAreaThresholdReg 1
-#define GlintTriangleClipAreaThresholdOff 0x8be0
-
-#define GlintRasterPosXIncrement 0x9be8
-#define GlintRasterPosXIncrementTag 0x037d
-#define GlintRasterPosXIncrementReg 1
-#define GlintRasterPosXIncrementOff 0x8be8
-
-#define GlintRasterPosYIncrement 0x9bf0
-#define GlintRasterPosYIncrementTag 0x037e
-#define GlintRasterPosYIncrementReg 1
-#define GlintRasterPosYIncrementOff 0x8bf0
-
-#define GlintUserClip0X 0x9c00
-#define GlintUserClip0XTag 0x0380
-#define GlintUserClip0XReg 1
-#define GlintUserClip0XOff 0x8c00
-
-#define GlintUserClip0Y 0x9c08
-#define GlintUserClip0YTag 0x0381
-#define GlintUserClip0YReg 1
-#define GlintUserClip0YOff 0x8c08
-
-#define GlintUserClip0Z 0x9c10
-#define GlintUserClip0ZTag 0x0382
-#define GlintUserClip0ZReg 1
-#define GlintUserClip0ZOff 0x8c10
-
-#define GlintUserClip0W 0x9c18
-#define GlintUserClip0WTag 0x0383
-#define GlintUserClip0WReg 1
-#define GlintUserClip0WOff 0x8c18
-
-#define GlintUserClip1X 0x9c20
-#define GlintUserClip1XTag 0x0384
-#define GlintUserClip1XReg 1
-#define GlintUserClip1XOff 0x8c20
-
-#define GlintUserClip1Y 0x9c28
-#define GlintUserClip1YTag 0x0385
-#define GlintUserClip1YReg 1
-#define GlintUserClip1YOff 0x8c28
-
-#define GlintUserClip1Z 0x9c30
-#define GlintUserClip1ZTag 0x0386
-#define GlintUserClip1ZReg 1
-#define GlintUserClip1ZOff 0x8c30
-
-#define GlintUserClip1W 0x9c38
-#define GlintUserClip1WTag 0x0387
-#define GlintUserClip1WReg 1
-#define GlintUserClip1WOff 0x8c38
-
-#define GlintUserClip2X 0x9c40
-#define GlintUserClip2XTag 0x0388
-#define GlintUserClip2XReg 1
-#define GlintUserClip2XOff 0x8c40
-
-#define GlintUserClip2Y 0x9c48
-#define GlintUserClip2YTag 0x0389
-#define GlintUserClip2YReg 1
-#define GlintUserClip2YOff 0x8c48
-
-#define GlintUserClip2Z 0x9c50
-#define GlintUserClip2ZTag 0x038a
-#define GlintUserClip2ZReg 1
-#define GlintUserClip2ZOff 0x8c50
-
-#define GlintUserClip2W 0x9c58
-#define GlintUserClip2WTag 0x038b
-#define GlintUserClip2WReg 1
-#define GlintUserClip2WOff 0x8c58
-
-#define GlintUserClip3X 0x9c60
-#define GlintUserClip3XTag 0x038c
-#define GlintUserClip3XReg 1
-#define GlintUserClip3XOff 0x8c60
-
-#define GlintUserClip3Y 0x9c68
-#define GlintUserClip3YTag 0x038d
-#define GlintUserClip3YReg 1
-#define GlintUserClip3YOff 0x8c68
-
-#define GlintUserClip3Z 0x9c70
-#define GlintUserClip3ZTag 0x038e
-#define GlintUserClip3ZReg 1
-#define GlintUserClip3ZOff 0x8c70
-
-#define GlintUserClip3W 0x9c78
-#define GlintUserClip3WTag 0x038f
-#define GlintUserClip3WReg 1
-#define GlintUserClip3WOff 0x8c78
-
-#define GlintUserClip4X 0x9c80
-#define GlintUserClip4XTag 0x0390
-#define GlintUserClip4XReg 1
-#define GlintUserClip4XOff 0x8c80
-
-#define GlintUserClip4Y 0x9c88
-#define GlintUserClip4YTag 0x0391
-#define GlintUserClip4YReg 1
-#define GlintUserClip4YOff 0x8c88
-
-#define GlintUserClip4Z 0x9c90
-#define GlintUserClip4ZTag 0x0392
-#define GlintUserClip4ZReg 1
-#define GlintUserClip4ZOff 0x8c90
-
-#define GlintUserClip4W 0x9c98
-#define GlintUserClip4WTag 0x0393
-#define GlintUserClip4WReg 1
-#define GlintUserClip4WOff 0x8c98
-
-#define GlintUserClip5X 0x9ca0
-#define GlintUserClip5XTag 0x0394
-#define GlintUserClip5XReg 1
-#define GlintUserClip5XOff 0x8ca0
-
-#define GlintUserClip5Y 0x9ca8
-#define GlintUserClip5YTag 0x0395
-#define GlintUserClip5YReg 1
-#define GlintUserClip5YOff 0x8ca8
-
-#define GlintUserClip5Z 0x9cb0
-#define GlintUserClip5ZTag 0x0396
-#define GlintUserClip5ZReg 1
-#define GlintUserClip5ZOff 0x8cb0
-
-#define GlintUserClip5W 0x9cb8
-#define GlintUserClip5WTag 0x0397
-#define GlintUserClip5WReg 1
-#define GlintUserClip5WOff 0x8cb8
-
-#define GlintRasterPosXOffset 0x9ce8
-#define GlintRasterPosXOffsetTag 0x039d
-#define GlintRasterPosXOffsetReg 1
-#define GlintRasterPosXOffsetOff 0x8ce8
-
-#define GlintRasterPosYOffset 0x9cf0
-#define GlintRasterPosYOffsetTag 0x039e
-#define GlintRasterPosYOffsetReg 1
-#define GlintRasterPosYOffsetOff 0x8cf0
-
-#define GlintAttenuationCutOff 0x9cf8
-#define GlintAttenuationCutOffTag 0x039f
-#define GlintAttenuationCutOffReg 1
-#define GlintAttenuationCutOffOff 0x8cf8
-
-#define GlintLight0Mode 0x9d00
-#define GlintLight0ModeTag 0x03a0
-#define GlintLight0ModeReg 1
-#define GlintLight0ModeOff 0x8d00
-
-#define GlintLight0AmbientIntensityRed 0x9d08
-#define GlintLight0AmbientIntensityRedTag 0x03a1
-#define GlintLight0AmbientIntensityRedReg 1
-#define GlintLight0AmbientIntensityRedOff 0x8d08
-
-#define GlintLight0AmbientIntensityGreen 0x9d10
-#define GlintLight0AmbientIntensityGreenTag 0x03a2
-#define GlintLight0AmbientIntensityGreenReg 1
-#define GlintLight0AmbientIntensityGreenOff 0x8d10
-
-#define GlintLight0AmbientIntensityBlue 0x9d18
-#define GlintLight0AmbientIntensityBlueTag 0x03a3
-#define GlintLight0AmbientIntensityBlueReg 1
-#define GlintLight0AmbientIntensityBlueOff 0x8d18
-
-#define GlintLight0DiffuseIntensityRed 0x9d20
-#define GlintLight0DiffuseIntensityRedTag 0x03a4
-#define GlintLight0DiffuseIntensityRedReg 1
-#define GlintLight0DiffuseIntensityRedOff 0x8d20
-
-#define GlintLight0DiffuseIntensityGreen 0x9d28
-#define GlintLight0DiffuseIntensityGreenTag 0x03a5
-#define GlintLight0DiffuseIntensityGreenReg 1
-#define GlintLight0DiffuseIntensityGreenOff 0x8d28
-
-#define GlintLight0DiffuseIntensityBlue 0x9d30
-#define GlintLight0DiffuseIntensityBlueTag 0x03a6
-#define GlintLight0DiffuseIntensityBlueReg 1
-#define GlintLight0DiffuseIntensityBlueOff 0x8d30
-
-#define GlintLight0SpecularIntensityRed 0x9d38
-#define GlintLight0SpecularIntensityRedTag 0x03a7
-#define GlintLight0SpecularIntensityRedReg 1
-#define GlintLight0SpecularIntensityRedOff 0x8d38
-
-#define GlintLight0SpecularIntensityGreen 0x9d40
-#define GlintLight0SpecularIntensityGreenTag 0x03a8
-#define GlintLight0SpecularIntensityGreenReg 1
-#define GlintLight0SpecularIntensityGreenOff 0x8d40
-
-#define GlintLight0SpecularIntensityBlue 0x9d48
-#define GlintLight0SpecularIntensityBlueTag 0x03a9
-#define GlintLight0SpecularIntensityBlueReg 1
-#define GlintLight0SpecularIntensityBlueOff 0x8d48
-
-#define GlintLight0PositionX 0x9d50
-#define GlintLight0PositionXTag 0x03aa
-#define GlintLight0PositionXReg 1
-#define GlintLight0PositionXOff 0x8d50
-
-#define GlintLight0PositionY 0x9d58
-#define GlintLight0PositionYTag 0x03ab
-#define GlintLight0PositionYReg 1
-#define GlintLight0PositionYOff 0x8d58
-
-#define GlintLight0PositionZ 0x9d60
-#define GlintLight0PositionZTag 0x03ac
-#define GlintLight0PositionZReg 1
-#define GlintLight0PositionZOff 0x8d60
-
-#define GlintLight0PositionW 0x9d68
-#define GlintLight0PositionWTag 0x03ad
-#define GlintLight0PositionWReg 1
-#define GlintLight0PositionWOff 0x8d68
-
-#define GlintLight0SpotlightDirectionX 0x9d70
-#define GlintLight0SpotlightDirectionXTag 0x03ae
-#define GlintLight0SpotlightDirectionXReg 1
-#define GlintLight0SpotlightDirectionXOff 0x8d70
-
-#define GlintLight0SpotlightDirectionY 0x9d78
-#define GlintLight0SpotlightDirectionYTag 0x03af
-#define GlintLight0SpotlightDirectionYReg 1
-#define GlintLight0SpotlightDirectionYOff 0x8d78
-
-#define GlintLight0SpotlightDirectionZ 0x9d80
-#define GlintLight0SpotlightDirectionZTag 0x03b0
-#define GlintLight0SpotlightDirectionZReg 1
-#define GlintLight0SpotlightDirectionZOff 0x8d80
-
-#define GlintLight0SpotlightExponent 0x9d88
-#define GlintLight0SpotlightExponentTag 0x03b1
-#define GlintLight0SpotlightExponentReg 1
-#define GlintLight0SpotlightExponentOff 0x8d88
-
-#define GlintLight0CosSpotlightCutoffAngle 0x9d90
-#define GlintLight0CosSpotlightCutoffAngleTag 0x03b2
-#define GlintLight0CosSpotlightCutoffAngleReg 1
-#define GlintLight0CosSpotlightCutoffAngleOff 0x8d90
-
-#define GlintLight0ConstantAttenuation 0x9d98
-#define GlintLight0ConstantAttenuationTag 0x03b3
-#define GlintLight0ConstantAttenuationReg 1
-#define GlintLight0ConstantAttenuationOff 0x8d98
-
-#define GlintLight0LinearAttenuation 0x9da0
-#define GlintLight0LinearAttenuationTag 0x03b4
-#define GlintLight0LinearAttenuationReg 1
-#define GlintLight0LinearAttenuationOff 0x8da0
-
-#define GlintLight0QuadraticAttenuation 0x9da8
-#define GlintLight0QuadraticAttenuationTag 0x03b5
-#define GlintLight0QuadraticAttenuationReg 1
-#define GlintLight0QuadraticAttenuationOff 0x8da8
-
-#define GlintLight1Mode 0x9db0
-#define GlintLight1ModeTag 0x03b6
-#define GlintLight1ModeReg 1
-#define GlintLight1ModeOff 0x8db0
-
-#define GlintLight1AmbientIntensityRed 0x9db8
-#define GlintLight1AmbientIntensityRedTag 0x03b7
-#define GlintLight1AmbientIntensityRedReg 1
-#define GlintLight1AmbientIntensityRedOff 0x8db8
-
-#define GlintLight1AmbientIntensityGreen 0x9dc0
-#define GlintLight1AmbientIntensityGreenTag 0x03b8
-#define GlintLight1AmbientIntensityGreenReg 1
-#define GlintLight1AmbientIntensityGreenOff 0x8dc0
-
-#define GlintLight1AmbientIntensityBlue 0x9dc8
-#define GlintLight1AmbientIntensityBlueTag 0x03b9
-#define GlintLight1AmbientIntensityBlueReg 1
-#define GlintLight1AmbientIntensityBlueOff 0x8dc8
-
-#define GlintLight1DiffuseIntensityRed 0x9dd0
-#define GlintLight1DiffuseIntensityRedTag 0x03ba
-#define GlintLight1DiffuseIntensityRedReg 1
-#define GlintLight1DiffuseIntensityRedOff 0x8dd0
-
-#define GlintLight1DiffuseIntensityGreen 0x9dd8
-#define GlintLight1DiffuseIntensityGreenTag 0x03bb
-#define GlintLight1DiffuseIntensityGreenReg 1
-#define GlintLight1DiffuseIntensityGreenOff 0x8dd8
-
-#define GlintLight1DiffuseIntensityBlue 0x9de0
-#define GlintLight1DiffuseIntensityBlueTag 0x03bc
-#define GlintLight1DiffuseIntensityBlueReg 1
-#define GlintLight1DiffuseIntensityBlueOff 0x8de0
-
-#define GlintLight1SpecularIntensityRed 0x9de8
-#define GlintLight1SpecularIntensityRedTag 0x03bd
-#define GlintLight1SpecularIntensityRedReg 1
-#define GlintLight1SpecularIntensityRedOff 0x8de8
-
-#define GlintLight1SpecularIntensityGreen 0x9df0
-#define GlintLight1SpecularIntensityGreenTag 0x03be
-#define GlintLight1SpecularIntensityGreenReg 1
-#define GlintLight1SpecularIntensityGreenOff 0x8df0
-
-#define GlintLight1SpecularIntensityBlue 0x9df8
-#define GlintLight1SpecularIntensityBlueTag 0x03bf
-#define GlintLight1SpecularIntensityBlueReg 1
-#define GlintLight1SpecularIntensityBlueOff 0x8df8
-
-#define GlintLight1PositionX 0x9e00
-#define GlintLight1PositionXTag 0x03c0
-#define GlintLight1PositionXReg 1
-#define GlintLight1PositionXOff 0x8e00
-
-#define GlintLight1PositionY 0x9e08
-#define GlintLight1PositionYTag 0x03c1
-#define GlintLight1PositionYReg 1
-#define GlintLight1PositionYOff 0x8e08
-
-#define GlintLight1PositionZ 0x9e10
-#define GlintLight1PositionZTag 0x03c2
-#define GlintLight1PositionZReg 1
-#define GlintLight1PositionZOff 0x8e10
-
-#define GlintLight1PositionW 0x9e18
-#define GlintLight1PositionWTag 0x03c3
-#define GlintLight1PositionWReg 1
-#define GlintLight1PositionWOff 0x8e18
-
-#define GlintLight1SpotlightDirectionX 0x9e20
-#define GlintLight1SpotlightDirectionXTag 0x03c4
-#define GlintLight1SpotlightDirectionXReg 1
-#define GlintLight1SpotlightDirectionXOff 0x8e20
-
-#define GlintLight1SpotlightDirectionY 0x9e28
-#define GlintLight1SpotlightDirectionYTag 0x03c5
-#define GlintLight1SpotlightDirectionYReg 1
-#define GlintLight1SpotlightDirectionYOff 0x8e28
-
-#define GlintLight1SpotlightDirectionZ 0x9e30
-#define GlintLight1SpotlightDirectionZTag 0x03c6
-#define GlintLight1SpotlightDirectionZReg 1
-#define GlintLight1SpotlightDirectionZOff 0x8e30
-
-#define GlintLight1SpotlightExponent 0x9e38
-#define GlintLight1SpotlightExponentTag 0x03c7
-#define GlintLight1SpotlightExponentReg 1
-#define GlintLight1SpotlightExponentOff 0x8e38
-
-#define GlintLight1CosSpotlightCutoffAngle 0x9e40
-#define GlintLight1CosSpotlightCutoffAngleTag 0x03c8
-#define GlintLight1CosSpotlightCutoffAngleReg 1
-#define GlintLight1CosSpotlightCutoffAngleOff 0x8e40
-
-#define GlintLight1ConstantAttenuation 0x9e48
-#define GlintLight1ConstantAttenuationTag 0x03c9
-#define GlintLight1ConstantAttenuationReg 1
-#define GlintLight1ConstantAttenuationOff 0x8e48
-
-#define GlintLight1LinearAttenuation 0x9e50
-#define GlintLight1LinearAttenuationTag 0x03ca
-#define GlintLight1LinearAttenuationReg 1
-#define GlintLight1LinearAttenuationOff 0x8e50
-
-#define GlintLight1QuadraticAttenuation 0x9e58
-#define GlintLight1QuadraticAttenuationTag 0x03cb
-#define GlintLight1QuadraticAttenuationReg 1
-#define GlintLight1QuadraticAttenuationOff 0x8e58
-
-#define GlintLight2Mode 0x9e60
-#define GlintLight2ModeTag 0x03cc
-#define GlintLight2ModeReg 1
-#define GlintLight2ModeOff 0x8e60
-
-#define GlintLight2AmbientIntensityRed 0x9e68
-#define GlintLight2AmbientIntensityRedTag 0x03cd
-#define GlintLight2AmbientIntensityRedReg 1
-#define GlintLight2AmbientIntensityRedOff 0x8e68
-
-#define GlintLight2AmbientIntensityGreen 0x9e70
-#define GlintLight2AmbientIntensityGreenTag 0x03ce
-#define GlintLight2AmbientIntensityGreenReg 1
-#define GlintLight2AmbientIntensityGreenOff 0x8e70
-
-#define GlintLight2AmbientIntensityBlue 0x9e78
-#define GlintLight2AmbientIntensityBlueTag 0x03cf
-#define GlintLight2AmbientIntensityBlueReg 1
-#define GlintLight2AmbientIntensityBlueOff 0x8e78
-
-#define GlintLight2DiffuseIntensityRed 0x9e80
-#define GlintLight2DiffuseIntensityRedTag 0x03d0
-#define GlintLight2DiffuseIntensityRedReg 1
-#define GlintLight2DiffuseIntensityRedOff 0x8e80
-
-#define GlintLight2DiffuseIntensityGreen 0x9e88
-#define GlintLight2DiffuseIntensityGreenTag 0x03d1
-#define GlintLight2DiffuseIntensityGreenReg 1
-#define GlintLight2DiffuseIntensityGreenOff 0x8e88
-
-#define GlintLight2DiffuseIntensityBlue 0x9e90
-#define GlintLight2DiffuseIntensityBlueTag 0x03d2
-#define GlintLight2DiffuseIntensityBlueReg 1
-#define GlintLight2DiffuseIntensityBlueOff 0x8e90
-
-#define GlintLight2SpecularIntensityRed 0x9e98
-#define GlintLight2SpecularIntensityRedTag 0x03d3
-#define GlintLight2SpecularIntensityRedReg 1
-#define GlintLight2SpecularIntensityRedOff 0x8e98
-
-#define GlintLight2SpecularIntensityGreen 0x9ea0
-#define GlintLight2SpecularIntensityGreenTag 0x03d4
-#define GlintLight2SpecularIntensityGreenReg 1
-#define GlintLight2SpecularIntensityGreenOff 0x8ea0
-
-#define GlintLight2SpecularIntensityBlue 0x9ea8
-#define GlintLight2SpecularIntensityBlueTag 0x03d5
-#define GlintLight2SpecularIntensityBlueReg 1
-#define GlintLight2SpecularIntensityBlueOff 0x8ea8
-
-#define GlintLight2PositionX 0x9eb0
-#define GlintLight2PositionXTag 0x03d6
-#define GlintLight2PositionXReg 1
-#define GlintLight2PositionXOff 0x8eb0
-
-#define GlintLight2PositionY 0x9eb8
-#define GlintLight2PositionYTag 0x03d7
-#define GlintLight2PositionYReg 1
-#define GlintLight2PositionYOff 0x8eb8
-
-#define GlintLight2PositionZ 0x9ec0
-#define GlintLight2PositionZTag 0x03d8
-#define GlintLight2PositionZReg 1
-#define GlintLight2PositionZOff 0x8ec0
-
-#define GlintLight2PositionW 0x9ec8
-#define GlintLight2PositionWTag 0x03d9
-#define GlintLight2PositionWReg 1
-#define GlintLight2PositionWOff 0x8ec8
-
-#define GlintLight2SpotlightDirectionX 0x9ed0
-#define GlintLight2SpotlightDirectionXTag 0x03da
-#define GlintLight2SpotlightDirectionXReg 1
-#define GlintLight2SpotlightDirectionXOff 0x8ed0
-
-#define GlintLight2SpotlightDirectionY 0x9ed8
-#define GlintLight2SpotlightDirectionYTag 0x03db
-#define GlintLight2SpotlightDirectionYReg 1
-#define GlintLight2SpotlightDirectionYOff 0x8ed8
-
-#define GlintLight2SpotlightDirectionZ 0x9ee0
-#define GlintLight2SpotlightDirectionZTag 0x03dc
-#define GlintLight2SpotlightDirectionZReg 1
-#define GlintLight2SpotlightDirectionZOff 0x8ee0
-
-#define GlintLight2SpotlightExponent 0x9ee8
-#define GlintLight2SpotlightExponentTag 0x03dd
-#define GlintLight2SpotlightExponentReg 1
-#define GlintLight2SpotlightExponentOff 0x8ee8
-
-#define GlintLight2CosSpotlightCutoffAngle 0x9ef0
-#define GlintLight2CosSpotlightCutoffAngleTag 0x03de
-#define GlintLight2CosSpotlightCutoffAngleReg 1
-#define GlintLight2CosSpotlightCutoffAngleOff 0x8ef0
-
-#define GlintLight2ConstantAttenuation 0x9ef8
-#define GlintLight2ConstantAttenuationTag 0x03df
-#define GlintLight2ConstantAttenuationReg 1
-#define GlintLight2ConstantAttenuationOff 0x8ef8
-
-#define GlintLight2LinearAttenuation 0x9f00
-#define GlintLight2LinearAttenuationTag 0x03e0
-#define GlintLight2LinearAttenuationReg 1
-#define GlintLight2LinearAttenuationOff 0x8f00
-
-#define GlintLight2QuadraticAttenuation 0x9f08
-#define GlintLight2QuadraticAttenuationTag 0x03e1
-#define GlintLight2QuadraticAttenuationReg 1
-#define GlintLight2QuadraticAttenuationOff 0x8f08
-
-#define GlintLight3Mode 0x9f10
-#define GlintLight3ModeTag 0x03e2
-#define GlintLight3ModeReg 1
-#define GlintLight3ModeOff 0x8f10
-
-#define GlintLight3AmbientIntensityRed 0x9f18
-#define GlintLight3AmbientIntensityRedTag 0x03e3
-#define GlintLight3AmbientIntensityRedReg 1
-#define GlintLight3AmbientIntensityRedOff 0x8f18
-
-#define GlintLight3AmbientIntensityGreen 0x9f20
-#define GlintLight3AmbientIntensityGreenTag 0x03e4
-#define GlintLight3AmbientIntensityGreenReg 1
-#define GlintLight3AmbientIntensityGreenOff 0x8f20
-
-#define GlintLight3AmbientIntensityBlue 0x9f28
-#define GlintLight3AmbientIntensityBlueTag 0x03e5
-#define GlintLight3AmbientIntensityBlueReg 1
-#define GlintLight3AmbientIntensityBlueOff 0x8f28
-
-#define GlintLight3DiffuseIntensityRed 0x9f30
-#define GlintLight3DiffuseIntensityRedTag 0x03e6
-#define GlintLight3DiffuseIntensityRedReg 1
-#define GlintLight3DiffuseIntensityRedOff 0x8f30
-
-#define GlintLight3DiffuseIntensityGreen 0x9f38
-#define GlintLight3DiffuseIntensityGreenTag 0x03e7
-#define GlintLight3DiffuseIntensityGreenReg 1
-#define GlintLight3DiffuseIntensityGreenOff 0x8f38
-
-#define GlintLight3DiffuseIntensityBlue 0x9f40
-#define GlintLight3DiffuseIntensityBlueTag 0x03e8
-#define GlintLight3DiffuseIntensityBlueReg 1
-#define GlintLight3DiffuseIntensityBlueOff 0x8f40
-
-#define GlintLight3SpecularIntensityRed 0x9f48
-#define GlintLight3SpecularIntensityRedTag 0x03e9
-#define GlintLight3SpecularIntensityRedReg 1
-#define GlintLight3SpecularIntensityRedOff 0x8f48
-
-#define GlintLight3SpecularIntensityGreen 0x9f50
-#define GlintLight3SpecularIntensityGreenTag 0x03ea
-#define GlintLight3SpecularIntensityGreenReg 1
-#define GlintLight3SpecularIntensityGreenOff 0x8f50
-
-#define GlintLight3SpecularIntensityBlue 0x9f58
-#define GlintLight3SpecularIntensityBlueTag 0x03eb
-#define GlintLight3SpecularIntensityBlueReg 1
-#define GlintLight3SpecularIntensityBlueOff 0x8f58
-
-#define GlintLight3PositionX 0x9f60
-#define GlintLight3PositionXTag 0x03ec
-#define GlintLight3PositionXReg 1
-#define GlintLight3PositionXOff 0x8f60
-
-#define GlintLight3PositionY 0x9f68
-#define GlintLight3PositionYTag 0x03ed
-#define GlintLight3PositionYReg 1
-#define GlintLight3PositionYOff 0x8f68
-
-#define GlintLight3PositionZ 0x9f70
-#define GlintLight3PositionZTag 0x03ee
-#define GlintLight3PositionZReg 1
-#define GlintLight3PositionZOff 0x8f70
-
-#define GlintLight3PositionW 0x9f78
-#define GlintLight3PositionWTag 0x03ef
-#define GlintLight3PositionWReg 1
-#define GlintLight3PositionWOff 0x8f78
-
-#define GlintLight3SpotlightDirectionX 0x9f80
-#define GlintLight3SpotlightDirectionXTag 0x03f0
-#define GlintLight3SpotlightDirectionXReg 1
-#define GlintLight3SpotlightDirectionXOff 0x8f80
-
-#define GlintLight3SpotlightDirectionY 0x9f88
-#define GlintLight3SpotlightDirectionYTag 0x03f1
-#define GlintLight3SpotlightDirectionYReg 1
-#define GlintLight3SpotlightDirectionYOff 0x8f88
-
-#define GlintLight3SpotlightDirectionZ 0x9f90
-#define GlintLight3SpotlightDirectionZTag 0x03f2
-#define GlintLight3SpotlightDirectionZReg 1
-#define GlintLight3SpotlightDirectionZOff 0x8f90
-
-#define GlintLight3SpotlightExponent 0x9f98
-#define GlintLight3SpotlightExponentTag 0x03f3
-#define GlintLight3SpotlightExponentReg 1
-#define GlintLight3SpotlightExponentOff 0x8f98
-
-#define GlintLight3CosSpotlightCutoffAngle 0x9fa0
-#define GlintLight3CosSpotlightCutoffAngleTag 0x03f4
-#define GlintLight3CosSpotlightCutoffAngleReg 1
-#define GlintLight3CosSpotlightCutoffAngleOff 0x8fa0
-
-#define GlintLight3ConstantAttenuation 0x9fa8
-#define GlintLight3ConstantAttenuationTag 0x03f5
-#define GlintLight3ConstantAttenuationReg 1
-#define GlintLight3ConstantAttenuationOff 0x8fa8
-
-#define GlintLight3LinearAttenuation 0x9fb0
-#define GlintLight3LinearAttenuationTag 0x03f6
-#define GlintLight3LinearAttenuationReg 1
-#define GlintLight3LinearAttenuationOff 0x8fb0
-
-#define GlintLight3QuadraticAttenuation 0x9fb8
-#define GlintLight3QuadraticAttenuationTag 0x03f7
-#define GlintLight3QuadraticAttenuationReg 1
-#define GlintLight3QuadraticAttenuationOff 0x8fb8
-
-#define GlintLight4Mode 0x9fc0
-#define GlintLight4ModeTag 0x03f8
-#define GlintLight4ModeReg 1
-#define GlintLight4ModeOff 0x8fc0
-
-#define GlintLight4AmbientIntensityRed 0x9fc8
-#define GlintLight4AmbientIntensityRedTag 0x03f9
-#define GlintLight4AmbientIntensityRedReg 1
-#define GlintLight4AmbientIntensityRedOff 0x8fc8
-
-#define GlintLight4AmbientIntensityGreen 0x9fd0
-#define GlintLight4AmbientIntensityGreenTag 0x03fa
-#define GlintLight4AmbientIntensityGreenReg 1
-#define GlintLight4AmbientIntensityGreenOff 0x8fd0
-
-#define GlintLight4AmbientIntensityBlue 0x9fd8
-#define GlintLight4AmbientIntensityBlueTag 0x03fb
-#define GlintLight4AmbientIntensityBlueReg 1
-#define GlintLight4AmbientIntensityBlueOff 0x8fd8
-
-#define GlintLight4DiffuseIntensityRed 0x9fe0
-#define GlintLight4DiffuseIntensityRedTag 0x03fc
-#define GlintLight4DiffuseIntensityRedReg 1
-#define GlintLight4DiffuseIntensityRedOff 0x8fe0
-
-#define GlintLight4DiffuseIntensityGreen 0x9fe8
-#define GlintLight4DiffuseIntensityGreenTag 0x03fd
-#define GlintLight4DiffuseIntensityGreenReg 1
-#define GlintLight4DiffuseIntensityGreenOff 0x8fe8
-
-#define GlintLight4DiffuseIntensityBlue 0x9ff0
-#define GlintLight4DiffuseIntensityBlueTag 0x03fe
-#define GlintLight4DiffuseIntensityBlueReg 1
-#define GlintLight4DiffuseIntensityBlueOff 0x8ff0
-
-#define GlintLight4SpecularIntensityRed 0x9ff8
-#define GlintLight4SpecularIntensityRedTag 0x03ff
-#define GlintLight4SpecularIntensityRedReg 1
-#define GlintLight4SpecularIntensityRedOff 0x8ff8
-
-#define GlintLight4SpecularIntensityGreen 0xa000
-#define GlintLight4SpecularIntensityGreenTag 0x0400
-#define GlintLight4SpecularIntensityGreenReg 1
-#define GlintLight4SpecularIntensityGreenOff 0x9000
-
-#define GlintLight4SpecularIntensityBlue 0xa008
-#define GlintLight4SpecularIntensityBlueTag 0x0401
-#define GlintLight4SpecularIntensityBlueReg 1
-#define GlintLight4SpecularIntensityBlueOff 0x9008
-
-#define GlintLight4PositionX 0xa010
-#define GlintLight4PositionXTag 0x0402
-#define GlintLight4PositionXReg 1
-#define GlintLight4PositionXOff 0x9010
-
-#define GlintLight4PositionY 0xa018
-#define GlintLight4PositionYTag 0x0403
-#define GlintLight4PositionYReg 1
-#define GlintLight4PositionYOff 0x9018
-
-#define GlintLight4PositionZ 0xa020
-#define GlintLight4PositionZTag 0x0404
-#define GlintLight4PositionZReg 1
-#define GlintLight4PositionZOff 0x9020
-
-#define GlintLight4PositionW 0xa028
-#define GlintLight4PositionWTag 0x0405
-#define GlintLight4PositionWReg 1
-#define GlintLight4PositionWOff 0x9028
-
-#define GlintLight4SpotlightDirectionX 0xa030
-#define GlintLight4SpotlightDirectionXTag 0x0406
-#define GlintLight4SpotlightDirectionXReg 1
-#define GlintLight4SpotlightDirectionXOff 0x9030
-
-#define GlintLight4SpotlightDirectionY 0xa038
-#define GlintLight4SpotlightDirectionYTag 0x0407
-#define GlintLight4SpotlightDirectionYReg 1
-#define GlintLight4SpotlightDirectionYOff 0x9038
-
-#define GlintLight4SpotlightDirectionZ 0xa040
-#define GlintLight4SpotlightDirectionZTag 0x0408
-#define GlintLight4SpotlightDirectionZReg 1
-#define GlintLight4SpotlightDirectionZOff 0x9040
-
-#define GlintLight4SpotlightExponent 0xa048
-#define GlintLight4SpotlightExponentTag 0x0409
-#define GlintLight4SpotlightExponentReg 1
-#define GlintLight4SpotlightExponentOff 0x9048
-
-#define GlintLight4CosSpotlightCutoffAngle 0xa050
-#define GlintLight4CosSpotlightCutoffAngleTag 0x040a
-#define GlintLight4CosSpotlightCutoffAngleReg 1
-#define GlintLight4CosSpotlightCutoffAngleOff 0x9050
-
-#define GlintLight4ConstantAttenuation 0xa058
-#define GlintLight4ConstantAttenuationTag 0x040b
-#define GlintLight4ConstantAttenuationReg 1
-#define GlintLight4ConstantAttenuationOff 0x9058
-
-#define GlintLight4LinearAttenuation 0xa060
-#define GlintLight4LinearAttenuationTag 0x040c
-#define GlintLight4LinearAttenuationReg 1
-#define GlintLight4LinearAttenuationOff 0x9060
-
-#define GlintLight4QuadraticAttenuation 0xa068
-#define GlintLight4QuadraticAttenuationTag 0x040d
-#define GlintLight4QuadraticAttenuationReg 1
-#define GlintLight4QuadraticAttenuationOff 0x9068
-
-#define GlintLight5Mode 0xa070
-#define GlintLight5ModeTag 0x040e
-#define GlintLight5ModeReg 1
-#define GlintLight5ModeOff 0x9070
-
-#define GlintLight5AmbientIntensityRed 0xa078
-#define GlintLight5AmbientIntensityRedTag 0x040f
-#define GlintLight5AmbientIntensityRedReg 1
-#define GlintLight5AmbientIntensityRedOff 0x9078
-
-#define GlintLight5AmbientIntensityGreen 0xa080
-#define GlintLight5AmbientIntensityGreenTag 0x0410
-#define GlintLight5AmbientIntensityGreenReg 1
-#define GlintLight5AmbientIntensityGreenOff 0x9080
-
-#define GlintLight5AmbientIntensityBlue 0xa088
-#define GlintLight5AmbientIntensityBlueTag 0x0411
-#define GlintLight5AmbientIntensityBlueReg 1
-#define GlintLight5AmbientIntensityBlueOff 0x9088
-
-#define GlintLight5DiffuseIntensityRed 0xa090
-#define GlintLight5DiffuseIntensityRedTag 0x0412
-#define GlintLight5DiffuseIntensityRedReg 1
-#define GlintLight5DiffuseIntensityRedOff 0x9090
-
-#define GlintLight5DiffuseIntensityGreen 0xa098
-#define GlintLight5DiffuseIntensityGreenTag 0x0413
-#define GlintLight5DiffuseIntensityGreenReg 1
-#define GlintLight5DiffuseIntensityGreenOff 0x9098
-
-#define GlintLight5DiffuseIntensityBlue 0xa0a0
-#define GlintLight5DiffuseIntensityBlueTag 0x0414
-#define GlintLight5DiffuseIntensityBlueReg 1
-#define GlintLight5DiffuseIntensityBlueOff 0x90a0
-
-#define GlintLight5SpecularIntensityRed 0xa0a8
-#define GlintLight5SpecularIntensityRedTag 0x0415
-#define GlintLight5SpecularIntensityRedReg 1
-#define GlintLight5SpecularIntensityRedOff 0x90a8
-
-#define GlintLight5SpecularIntensityGreen 0xa0b0
-#define GlintLight5SpecularIntensityGreenTag 0x0416
-#define GlintLight5SpecularIntensityGreenReg 1
-#define GlintLight5SpecularIntensityGreenOff 0x90b0
-
-#define GlintLight5SpecularIntensityBlue 0xa0b8
-#define GlintLight5SpecularIntensityBlueTag 0x0417
-#define GlintLight5SpecularIntensityBlueReg 1
-#define GlintLight5SpecularIntensityBlueOff 0x90b8
-
-#define GlintLight5PositionX 0xa0c0
-#define GlintLight5PositionXTag 0x0418
-#define GlintLight5PositionXReg 1
-#define GlintLight5PositionXOff 0x90c0
-
-#define GlintLight5PositionY 0xa0c8
-#define GlintLight5PositionYTag 0x0419
-#define GlintLight5PositionYReg 1
-#define GlintLight5PositionYOff 0x90c8
-
-#define GlintLight5PositionZ 0xa0d0
-#define GlintLight5PositionZTag 0x041a
-#define GlintLight5PositionZReg 1
-#define GlintLight5PositionZOff 0x90d0
-
-#define GlintLight5PositionW 0xa0d8
-#define GlintLight5PositionWTag 0x041b
-#define GlintLight5PositionWReg 1
-#define GlintLight5PositionWOff 0x90d8
-
-#define GlintLight5SpotlightDirectionX 0xa0e0
-#define GlintLight5SpotlightDirectionXTag 0x041c
-#define GlintLight5SpotlightDirectionXReg 1
-#define GlintLight5SpotlightDirectionXOff 0x90e0
-
-#define GlintLight5SpotlightDirectionY 0xa0e8
-#define GlintLight5SpotlightDirectionYTag 0x041d
-#define GlintLight5SpotlightDirectionYReg 1
-#define GlintLight5SpotlightDirectionYOff 0x90e8
-
-#define GlintLight5SpotlightDirectionZ 0xa0f0
-#define GlintLight5SpotlightDirectionZTag 0x041e
-#define GlintLight5SpotlightDirectionZReg 1
-#define GlintLight5SpotlightDirectionZOff 0x90f0
-
-#define GlintLight5SpotlightExponent 0xa0f8
-#define GlintLight5SpotlightExponentTag 0x041f
-#define GlintLight5SpotlightExponentReg 1
-#define GlintLight5SpotlightExponentOff 0x90f8
-
-#define GlintLight5CosSpotlightCutoffAngle 0xa100
-#define GlintLight5CosSpotlightCutoffAngleTag 0x0420
-#define GlintLight5CosSpotlightCutoffAngleReg 1
-#define GlintLight5CosSpotlightCutoffAngleOff 0x9100
-
-#define GlintLight5ConstantAttenuation 0xa108
-#define GlintLight5ConstantAttenuationTag 0x0421
-#define GlintLight5ConstantAttenuationReg 1
-#define GlintLight5ConstantAttenuationOff 0x9108
-
-#define GlintLight5LinearAttenuation 0xa110
-#define GlintLight5LinearAttenuationTag 0x0422
-#define GlintLight5LinearAttenuationReg 1
-#define GlintLight5LinearAttenuationOff 0x9110
-
-#define GlintLight5QuadraticAttenuation 0xa118
-#define GlintLight5QuadraticAttenuationTag 0x0423
-#define GlintLight5QuadraticAttenuationReg 1
-#define GlintLight5QuadraticAttenuationOff 0x9118
-
-#define GlintLight6Mode 0xa120
-#define GlintLight6ModeTag 0x0424
-#define GlintLight6ModeReg 1
-#define GlintLight6ModeOff 0x9120
-
-#define GlintLight6AmbientIntensityRed 0xa128
-#define GlintLight6AmbientIntensityRedTag 0x0425
-#define GlintLight6AmbientIntensityRedReg 1
-#define GlintLight6AmbientIntensityRedOff 0x9128
-
-#define GlintLight6AmbientIntensityGreen 0xa130
-#define GlintLight6AmbientIntensityGreenTag 0x0426
-#define GlintLight6AmbientIntensityGreenReg 1
-#define GlintLight6AmbientIntensityGreenOff 0x9130
-
-#define GlintLight6AmbientIntensityBlue 0xa138
-#define GlintLight6AmbientIntensityBlueTag 0x0427
-#define GlintLight6AmbientIntensityBlueReg 1
-#define GlintLight6AmbientIntensityBlueOff 0x9138
-
-#define GlintLight6DiffuseIntensityRed 0xa140
-#define GlintLight6DiffuseIntensityRedTag 0x0428
-#define GlintLight6DiffuseIntensityRedReg 1
-#define GlintLight6DiffuseIntensityRedOff 0x9140
-
-#define GlintLight6DiffuseIntensityGreen 0xa148
-#define GlintLight6DiffuseIntensityGreenTag 0x0429
-#define GlintLight6DiffuseIntensityGreenReg 1
-#define GlintLight6DiffuseIntensityGreenOff 0x9148
-
-#define GlintLight6DiffuseIntensityBlue 0xa150
-#define GlintLight6DiffuseIntensityBlueTag 0x042a
-#define GlintLight6DiffuseIntensityBlueReg 1
-#define GlintLight6DiffuseIntensityBlueOff 0x9150
-
-#define GlintLight6SpecularIntensityRed 0xa158
-#define GlintLight6SpecularIntensityRedTag 0x042b
-#define GlintLight6SpecularIntensityRedReg 1
-#define GlintLight6SpecularIntensityRedOff 0x9158
-
-#define GlintLight6SpecularIntensityGreen 0xa160
-#define GlintLight6SpecularIntensityGreenTag 0x042c
-#define GlintLight6SpecularIntensityGreenReg 1
-#define GlintLight6SpecularIntensityGreenOff 0x9160
-
-#define GlintLight6SpecularIntensityBlue 0xa168
-#define GlintLight6SpecularIntensityBlueTag 0x042d
-#define GlintLight6SpecularIntensityBlueReg 1
-#define GlintLight6SpecularIntensityBlueOff 0x9168
-
-#define GlintLight6PositionX 0xa170
-#define GlintLight6PositionXTag 0x042e
-#define GlintLight6PositionXReg 1
-#define GlintLight6PositionXOff 0x9170
-
-#define GlintLight6PositionY 0xa178
-#define GlintLight6PositionYTag 0x042f
-#define GlintLight6PositionYReg 1
-#define GlintLight6PositionYOff 0x9178
-
-#define GlintLight6PositionZ 0xa180
-#define GlintLight6PositionZTag 0x0430
-#define GlintLight6PositionZReg 1
-#define GlintLight6PositionZOff 0x9180
-
-#define GlintLight6PositionW 0xa188
-#define GlintLight6PositionWTag 0x0431
-#define GlintLight6PositionWReg 1
-#define GlintLight6PositionWOff 0x9188
-
-#define GlintLight6SpotlightDirectionX 0xa190
-#define GlintLight6SpotlightDirectionXTag 0x0432
-#define GlintLight6SpotlightDirectionXReg 1
-#define GlintLight6SpotlightDirectionXOff 0x9190
-
-#define GlintLight6SpotlightDirectionY 0xa198
-#define GlintLight6SpotlightDirectionYTag 0x0433
-#define GlintLight6SpotlightDirectionYReg 1
-#define GlintLight6SpotlightDirectionYOff 0x9198
-
-#define GlintLight6SpotlightDirectionZ 0xa1a0
-#define GlintLight6SpotlightDirectionZTag 0x0434
-#define GlintLight6SpotlightDirectionZReg 1
-#define GlintLight6SpotlightDirectionZOff 0x91a0
-
-#define GlintLight6SpotlightExponent 0xa1a8
-#define GlintLight6SpotlightExponentTag 0x0435
-#define GlintLight6SpotlightExponentReg 1
-#define GlintLight6SpotlightExponentOff 0x91a8
-
-#define GlintLight6CosSpotlightCutoffAngle 0xa1b0
-#define GlintLight6CosSpotlightCutoffAngleTag 0x0436
-#define GlintLight6CosSpotlightCutoffAngleReg 1
-#define GlintLight6CosSpotlightCutoffAngleOff 0x91b0
-
-#define GlintLight6ConstantAttenuation 0xa1b8
-#define GlintLight6ConstantAttenuationTag 0x0437
-#define GlintLight6ConstantAttenuationReg 1
-#define GlintLight6ConstantAttenuationOff 0x91b8
-
-#define GlintLight6LinearAttenuation 0xa1c0
-#define GlintLight6LinearAttenuationTag 0x0438
-#define GlintLight6LinearAttenuationReg 1
-#define GlintLight6LinearAttenuationOff 0x91c0
-
-#define GlintLight6QuadraticAttenuation 0xa1c8
-#define GlintLight6QuadraticAttenuationTag 0x0439
-#define GlintLight6QuadraticAttenuationReg 1
-#define GlintLight6QuadraticAttenuationOff 0x91c8
-
-#define GlintLight7Mode 0xa1d0
-#define GlintLight7ModeTag 0x043a
-#define GlintLight7ModeReg 1
-#define GlintLight7ModeOff 0x91d0
-
-#define GlintLight7AmbientIntensityRed 0xa1d8
-#define GlintLight7AmbientIntensityRedTag 0x043b
-#define GlintLight7AmbientIntensityRedReg 1
-#define GlintLight7AmbientIntensityRedOff 0x91d8
-
-#define GlintLight7AmbientIntensityGreen 0xa1e0
-#define GlintLight7AmbientIntensityGreenTag 0x043c
-#define GlintLight7AmbientIntensityGreenReg 1
-#define GlintLight7AmbientIntensityGreenOff 0x91e0
-
-#define GlintLight7AmbientIntensityBlue 0xa1e8
-#define GlintLight7AmbientIntensityBlueTag 0x043d
-#define GlintLight7AmbientIntensityBlueReg 1
-#define GlintLight7AmbientIntensityBlueOff 0x91e8
-
-#define GlintLight7DiffuseIntensityRed 0xa1f0
-#define GlintLight7DiffuseIntensityRedTag 0x043e
-#define GlintLight7DiffuseIntensityRedReg 1
-#define GlintLight7DiffuseIntensityRedOff 0x91f0
-
-#define GlintLight7DiffuseIntensityGreen 0xa1f8
-#define GlintLight7DiffuseIntensityGreenTag 0x043f
-#define GlintLight7DiffuseIntensityGreenReg 1
-#define GlintLight7DiffuseIntensityGreenOff 0x91f8
-
-#define GlintLight7DiffuseIntensityBlue 0xa200
-#define GlintLight7DiffuseIntensityBlueTag 0x0440
-#define GlintLight7DiffuseIntensityBlueReg 1
-#define GlintLight7DiffuseIntensityBlueOff 0x9200
-
-#define GlintLight7SpecularIntensityRed 0xa208
-#define GlintLight7SpecularIntensityRedTag 0x0441
-#define GlintLight7SpecularIntensityRedReg 1
-#define GlintLight7SpecularIntensityRedOff 0x9208
-
-#define GlintLight7SpecularIntensityGreen 0xa210
-#define GlintLight7SpecularIntensityGreenTag 0x0442
-#define GlintLight7SpecularIntensityGreenReg 1
-#define GlintLight7SpecularIntensityGreenOff 0x9210
-
-#define GlintLight7SpecularIntensityBlue 0xa218
-#define GlintLight7SpecularIntensityBlueTag 0x0443
-#define GlintLight7SpecularIntensityBlueReg 1
-#define GlintLight7SpecularIntensityBlueOff 0x9218
-
-#define GlintLight7PositionX 0xa220
-#define GlintLight7PositionXTag 0x0444
-#define GlintLight7PositionXReg 1
-#define GlintLight7PositionXOff 0x9220
-
-#define GlintLight7PositionY 0xa228
-#define GlintLight7PositionYTag 0x0445
-#define GlintLight7PositionYReg 1
-#define GlintLight7PositionYOff 0x9228
-
-#define GlintLight7PositionZ 0xa230
-#define GlintLight7PositionZTag 0x0446
-#define GlintLight7PositionZReg 1
-#define GlintLight7PositionZOff 0x9230
-
-#define GlintLight7PositionW 0xa238
-#define GlintLight7PositionWTag 0x0447
-#define GlintLight7PositionWReg 1
-#define GlintLight7PositionWOff 0x9238
-
-#define GlintLight7SpotlightDirectionX 0xa240
-#define GlintLight7SpotlightDirectionXTag 0x0448
-#define GlintLight7SpotlightDirectionXReg 1
-#define GlintLight7SpotlightDirectionXOff 0x9240
-
-#define GlintLight7SpotlightDirectionY 0xa248
-#define GlintLight7SpotlightDirectionYTag 0x0449
-#define GlintLight7SpotlightDirectionYReg 1
-#define GlintLight7SpotlightDirectionYOff 0x9248
-
-#define GlintLight7SpotlightDirectionZ 0xa250
-#define GlintLight7SpotlightDirectionZTag 0x044a
-#define GlintLight7SpotlightDirectionZReg 1
-#define GlintLight7SpotlightDirectionZOff 0x9250
-
-#define GlintLight7SpotlightExponent 0xa258
-#define GlintLight7SpotlightExponentTag 0x044b
-#define GlintLight7SpotlightExponentReg 1
-#define GlintLight7SpotlightExponentOff 0x9258
-
-#define GlintLight7CosSpotlightCutoffAngle 0xa260
-#define GlintLight7CosSpotlightCutoffAngleTag 0x044c
-#define GlintLight7CosSpotlightCutoffAngleReg 1
-#define GlintLight7CosSpotlightCutoffAngleOff 0x9260
-
-#define GlintLight7ConstantAttenuation 0xa268
-#define GlintLight7ConstantAttenuationTag 0x044d
-#define GlintLight7ConstantAttenuationReg 1
-#define GlintLight7ConstantAttenuationOff 0x9268
-
-#define GlintLight7LinearAttenuation 0xa270
-#define GlintLight7LinearAttenuationTag 0x044e
-#define GlintLight7LinearAttenuationReg 1
-#define GlintLight7LinearAttenuationOff 0x9270
-
-#define GlintLight7QuadraticAttenuation 0xa278
-#define GlintLight7QuadraticAttenuationTag 0x044f
-#define GlintLight7QuadraticAttenuationReg 1
-#define GlintLight7QuadraticAttenuationOff 0x9278
-
-#define GlintLight8Mode 0xa280
-#define GlintLight8ModeTag 0x0450
-#define GlintLight8ModeReg 1
-#define GlintLight8ModeOff 0x9280
-
-#define GlintLight8AmbientIntensityRed 0xa288
-#define GlintLight8AmbientIntensityRedTag 0x0451
-#define GlintLight8AmbientIntensityRedReg 1
-#define GlintLight8AmbientIntensityRedOff 0x9288
-
-#define GlintLight8AmbientIntensityGreen 0xa290
-#define GlintLight8AmbientIntensityGreenTag 0x0452
-#define GlintLight8AmbientIntensityGreenReg 1
-#define GlintLight8AmbientIntensityGreenOff 0x9290
-
-#define GlintLight8AmbientIntensityBlue 0xa298
-#define GlintLight8AmbientIntensityBlueTag 0x0453
-#define GlintLight8AmbientIntensityBlueReg 1
-#define GlintLight8AmbientIntensityBlueOff 0x9298
-
-#define GlintLight8DiffuseIntensityRed 0xa2a0
-#define GlintLight8DiffuseIntensityRedTag 0x0454
-#define GlintLight8DiffuseIntensityRedReg 1
-#define GlintLight8DiffuseIntensityRedOff 0x92a0
-
-#define GlintLight8DiffuseIntensityGreen 0xa2a8
-#define GlintLight8DiffuseIntensityGreenTag 0x0455
-#define GlintLight8DiffuseIntensityGreenReg 1
-#define GlintLight8DiffuseIntensityGreenOff 0x92a8
-
-#define GlintLight8DiffuseIntensityBlue 0xa2b0
-#define GlintLight8DiffuseIntensityBlueTag 0x0456
-#define GlintLight8DiffuseIntensityBlueReg 1
-#define GlintLight8DiffuseIntensityBlueOff 0x92b0
-
-#define GlintLight8SpecularIntensityRed 0xa2b8
-#define GlintLight8SpecularIntensityRedTag 0x0457
-#define GlintLight8SpecularIntensityRedReg 1
-#define GlintLight8SpecularIntensityRedOff 0x92b8
-
-#define GlintLight8SpecularIntensityGreen 0xa2c0
-#define GlintLight8SpecularIntensityGreenTag 0x0458
-#define GlintLight8SpecularIntensityGreenReg 1
-#define GlintLight8SpecularIntensityGreenOff 0x92c0
-
-#define GlintLight8SpecularIntensityBlue 0xa2c8
-#define GlintLight8SpecularIntensityBlueTag 0x0459
-#define GlintLight8SpecularIntensityBlueReg 1
-#define GlintLight8SpecularIntensityBlueOff 0x92c8
-
-#define GlintLight8PositionX 0xa2d0
-#define GlintLight8PositionXTag 0x045a
-#define GlintLight8PositionXReg 1
-#define GlintLight8PositionXOff 0x92d0
-
-#define GlintLight8PositionY 0xa2d8
-#define GlintLight8PositionYTag 0x045b
-#define GlintLight8PositionYReg 1
-#define GlintLight8PositionYOff 0x92d8
-
-#define GlintLight8PositionZ 0xa2e0
-#define GlintLight8PositionZTag 0x045c
-#define GlintLight8PositionZReg 1
-#define GlintLight8PositionZOff 0x92e0
-
-#define GlintLight8PositionW 0xa2e8
-#define GlintLight8PositionWTag 0x045d
-#define GlintLight8PositionWReg 1
-#define GlintLight8PositionWOff 0x92e8
-
-#define GlintLight8SpotlightDirectionX 0xa2f0
-#define GlintLight8SpotlightDirectionXTag 0x045e
-#define GlintLight8SpotlightDirectionXReg 1
-#define GlintLight8SpotlightDirectionXOff 0x92f0
-
-#define GlintLight8SpotlightDirectionY 0xa2f8
-#define GlintLight8SpotlightDirectionYTag 0x045f
-#define GlintLight8SpotlightDirectionYReg 1
-#define GlintLight8SpotlightDirectionYOff 0x92f8
-
-#define GlintLight8SpotlightDirectionZ 0xa300
-#define GlintLight8SpotlightDirectionZTag 0x0460
-#define GlintLight8SpotlightDirectionZReg 1
-#define GlintLight8SpotlightDirectionZOff 0x9300
-
-#define GlintLight8SpotlightExponent 0xa308
-#define GlintLight8SpotlightExponentTag 0x0461
-#define GlintLight8SpotlightExponentReg 1
-#define GlintLight8SpotlightExponentOff 0x9308
-
-#define GlintLight8CosSpotlightCutoffAngle 0xa310
-#define GlintLight8CosSpotlightCutoffAngleTag 0x0462
-#define GlintLight8CosSpotlightCutoffAngleReg 1
-#define GlintLight8CosSpotlightCutoffAngleOff 0x9310
-
-#define GlintLight8ConstantAttenuation 0xa318
-#define GlintLight8ConstantAttenuationTag 0x0463
-#define GlintLight8ConstantAttenuationReg 1
-#define GlintLight8ConstantAttenuationOff 0x9318
-
-#define GlintLight8LinearAttenuation 0xa320
-#define GlintLight8LinearAttenuationTag 0x0464
-#define GlintLight8LinearAttenuationReg 1
-#define GlintLight8LinearAttenuationOff 0x9320
-
-#define GlintLight8QuadraticAttenuation 0xa328
-#define GlintLight8QuadraticAttenuationTag 0x0465
-#define GlintLight8QuadraticAttenuationReg 1
-#define GlintLight8QuadraticAttenuationOff 0x9328
-
-#define GlintLight9Mode 0xa330
-#define GlintLight9ModeTag 0x0466
-#define GlintLight9ModeReg 1
-#define GlintLight9ModeOff 0x9330
-
-#define GlintLight9AmbientIntensityRed 0xa338
-#define GlintLight9AmbientIntensityRedTag 0x0467
-#define GlintLight9AmbientIntensityRedReg 1
-#define GlintLight9AmbientIntensityRedOff 0x9338
-
-#define GlintLight9AmbientIntensityGreen 0xa340
-#define GlintLight9AmbientIntensityGreenTag 0x0468
-#define GlintLight9AmbientIntensityGreenReg 1
-#define GlintLight9AmbientIntensityGreenOff 0x9340
-
-#define GlintLight9AmbientIntensityBlue 0xa348
-#define GlintLight9AmbientIntensityBlueTag 0x0469
-#define GlintLight9AmbientIntensityBlueReg 1
-#define GlintLight9AmbientIntensityBlueOff 0x9348
-
-#define GlintLight9DiffuseIntensityRed 0xa350
-#define GlintLight9DiffuseIntensityRedTag 0x046a
-#define GlintLight9DiffuseIntensityRedReg 1
-#define GlintLight9DiffuseIntensityRedOff 0x9350
-
-#define GlintLight9DiffuseIntensityGreen 0xa358
-#define GlintLight9DiffuseIntensityGreenTag 0x046b
-#define GlintLight9DiffuseIntensityGreenReg 1
-#define GlintLight9DiffuseIntensityGreenOff 0x9358
-
-#define GlintLight9DiffuseIntensityBlue 0xa360
-#define GlintLight9DiffuseIntensityBlueTag 0x046c
-#define GlintLight9DiffuseIntensityBlueReg 1
-#define GlintLight9DiffuseIntensityBlueOff 0x9360
-
-#define GlintLight9SpecularIntensityRed 0xa368
-#define GlintLight9SpecularIntensityRedTag 0x046d
-#define GlintLight9SpecularIntensityRedReg 1
-#define GlintLight9SpecularIntensityRedOff 0x9368
-
-#define GlintLight9SpecularIntensityGreen 0xa370
-#define GlintLight9SpecularIntensityGreenTag 0x046e
-#define GlintLight9SpecularIntensityGreenReg 1
-#define GlintLight9SpecularIntensityGreenOff 0x9370
-
-#define GlintLight9SpecularIntensityBlue 0xa378
-#define GlintLight9SpecularIntensityBlueTag 0x046f
-#define GlintLight9SpecularIntensityBlueReg 1
-#define GlintLight9SpecularIntensityBlueOff 0x9378
-
-#define GlintLight9PositionX 0xa380
-#define GlintLight9PositionXTag 0x0470
-#define GlintLight9PositionXReg 1
-#define GlintLight9PositionXOff 0x9380
-
-#define GlintLight9PositionY 0xa388
-#define GlintLight9PositionYTag 0x0471
-#define GlintLight9PositionYReg 1
-#define GlintLight9PositionYOff 0x9388
-
-#define GlintLight9PositionZ 0xa390
-#define GlintLight9PositionZTag 0x0472
-#define GlintLight9PositionZReg 1
-#define GlintLight9PositionZOff 0x9390
-
-#define GlintLight9PositionW 0xa398
-#define GlintLight9PositionWTag 0x0473
-#define GlintLight9PositionWReg 1
-#define GlintLight9PositionWOff 0x9398
-
-#define GlintLight9SpotlightDirectionX 0xa3a0
-#define GlintLight9SpotlightDirectionXTag 0x0474
-#define GlintLight9SpotlightDirectionXReg 1
-#define GlintLight9SpotlightDirectionXOff 0x93a0
-
-#define GlintLight9SpotlightDirectionY 0xa3a8
-#define GlintLight9SpotlightDirectionYTag 0x0475
-#define GlintLight9SpotlightDirectionYReg 1
-#define GlintLight9SpotlightDirectionYOff 0x93a8
-
-#define GlintLight9SpotlightDirectionZ 0xa3b0
-#define GlintLight9SpotlightDirectionZTag 0x0476
-#define GlintLight9SpotlightDirectionZReg 1
-#define GlintLight9SpotlightDirectionZOff 0x93b0
-
-#define GlintLight9SpotlightExponent 0xa3b8
-#define GlintLight9SpotlightExponentTag 0x0477
-#define GlintLight9SpotlightExponentReg 1
-#define GlintLight9SpotlightExponentOff 0x93b8
-
-#define GlintLight9CosSpotlightCutoffAngle 0xa3c0
-#define GlintLight9CosSpotlightCutoffAngleTag 0x0478
-#define GlintLight9CosSpotlightCutoffAngleReg 1
-#define GlintLight9CosSpotlightCutoffAngleOff 0x93c0
-
-#define GlintLight9ConstantAttenuation 0xa3c8
-#define GlintLight9ConstantAttenuationTag 0x0479
-#define GlintLight9ConstantAttenuationReg 1
-#define GlintLight9ConstantAttenuationOff 0x93c8
-
-#define GlintLight9LinearAttenuation 0xa3d0
-#define GlintLight9LinearAttenuationTag 0x047a
-#define GlintLight9LinearAttenuationReg 1
-#define GlintLight9LinearAttenuationOff 0x93d0
-
-#define GlintLight9QuadraticAttenuation 0xa3d8
-#define GlintLight9QuadraticAttenuationTag 0x047b
-#define GlintLight9QuadraticAttenuationReg 1
-#define GlintLight9QuadraticAttenuationOff 0x93d8
-
-#define GlintLight10Mode 0xa3e0
-#define GlintLight10ModeTag 0x047c
-#define GlintLight10ModeReg 1
-#define GlintLight10ModeOff 0x93e0
-
-#define GlintLight10AmbientIntensityRed 0xa3e8
-#define GlintLight10AmbientIntensityRedTag 0x047d
-#define GlintLight10AmbientIntensityRedReg 1
-#define GlintLight10AmbientIntensityRedOff 0x93e8
-
-#define GlintLight10AmbientIntensityGreen 0xa3f0
-#define GlintLight10AmbientIntensityGreenTag 0x047e
-#define GlintLight10AmbientIntensityGreenReg 1
-#define GlintLight10AmbientIntensityGreenOff 0x93f0
-
-#define GlintLight10AmbientIntensityBlue 0xa3f8
-#define GlintLight10AmbientIntensityBlueTag 0x047f
-#define GlintLight10AmbientIntensityBlueReg 1
-#define GlintLight10AmbientIntensityBlueOff 0x93f8
-
-#define GlintLight10DiffuseIntensityRed 0xa400
-#define GlintLight10DiffuseIntensityRedTag 0x0480
-#define GlintLight10DiffuseIntensityRedReg 1
-#define GlintLight10DiffuseIntensityRedOff 0x9400
-
-#define GlintLight10DiffuseIntensityGreen 0xa408
-#define GlintLight10DiffuseIntensityGreenTag 0x0481
-#define GlintLight10DiffuseIntensityGreenReg 1
-#define GlintLight10DiffuseIntensityGreenOff 0x9408
-
-#define GlintLight10DiffuseIntensityBlue 0xa410
-#define GlintLight10DiffuseIntensityBlueTag 0x0482
-#define GlintLight10DiffuseIntensityBlueReg 1
-#define GlintLight10DiffuseIntensityBlueOff 0x9410
-
-#define GlintLight10SpecularIntensityRed 0xa418
-#define GlintLight10SpecularIntensityRedTag 0x0483
-#define GlintLight10SpecularIntensityRedReg 1
-#define GlintLight10SpecularIntensityRedOff 0x9418
-
-#define GlintLight10SpecularIntensityGreen 0xa420
-#define GlintLight10SpecularIntensityGreenTag 0x0484
-#define GlintLight10SpecularIntensityGreenReg 1
-#define GlintLight10SpecularIntensityGreenOff 0x9420
-
-#define GlintLight10SpecularIntensityBlue 0xa428
-#define GlintLight10SpecularIntensityBlueTag 0x0485
-#define GlintLight10SpecularIntensityBlueReg 1
-#define GlintLight10SpecularIntensityBlueOff 0x9428
-
-#define GlintLight10PositionX 0xa430
-#define GlintLight10PositionXTag 0x0486
-#define GlintLight10PositionXReg 1
-#define GlintLight10PositionXOff 0x9430
-
-#define GlintLight10PositionY 0xa438
-#define GlintLight10PositionYTag 0x0487
-#define GlintLight10PositionYReg 1
-#define GlintLight10PositionYOff 0x9438
-
-#define GlintLight10PositionZ 0xa440
-#define GlintLight10PositionZTag 0x0488
-#define GlintLight10PositionZReg 1
-#define GlintLight10PositionZOff 0x9440
-
-#define GlintLight10PositionW 0xa448
-#define GlintLight10PositionWTag 0x0489
-#define GlintLight10PositionWReg 1
-#define GlintLight10PositionWOff 0x9448
-
-#define GlintLight10SpotlightDirectionX 0xa450
-#define GlintLight10SpotlightDirectionXTag 0x048a
-#define GlintLight10SpotlightDirectionXReg 1
-#define GlintLight10SpotlightDirectionXOff 0x9450
-
-#define GlintLight10SpotlightDirectionY 0xa458
-#define GlintLight10SpotlightDirectionYTag 0x048b
-#define GlintLight10SpotlightDirectionYReg 1
-#define GlintLight10SpotlightDirectionYOff 0x9458
-
-#define GlintLight10SpotlightDirectionZ 0xa460
-#define GlintLight10SpotlightDirectionZTag 0x048c
-#define GlintLight10SpotlightDirectionZReg 1
-#define GlintLight10SpotlightDirectionZOff 0x9460
-
-#define GlintLight10SpotlightExponent 0xa468
-#define GlintLight10SpotlightExponentTag 0x048d
-#define GlintLight10SpotlightExponentReg 1
-#define GlintLight10SpotlightExponentOff 0x9468
-
-#define GlintLight10CosSpotlightCutoffAngle 0xa470
-#define GlintLight10CosSpotlightCutoffAngleTag 0x048e
-#define GlintLight10CosSpotlightCutoffAngleReg 1
-#define GlintLight10CosSpotlightCutoffAngleOff 0x9470
-
-#define GlintLight10ConstantAttenuation 0xa478
-#define GlintLight10ConstantAttenuationTag 0x048f
-#define GlintLight10ConstantAttenuationReg 1
-#define GlintLight10ConstantAttenuationOff 0x9478
-
-#define GlintLight10LinearAttenuation 0xa480
-#define GlintLight10LinearAttenuationTag 0x0490
-#define GlintLight10LinearAttenuationReg 1
-#define GlintLight10LinearAttenuationOff 0x9480
-
-#define GlintLight10QuadraticAttenuation 0xa488
-#define GlintLight10QuadraticAttenuationTag 0x0491
-#define GlintLight10QuadraticAttenuationReg 1
-#define GlintLight10QuadraticAttenuationOff 0x9488
-
-#define GlintLight11Mode 0xa490
-#define GlintLight11ModeTag 0x0492
-#define GlintLight11ModeReg 1
-#define GlintLight11ModeOff 0x9490
-
-#define GlintLight11AmbientIntensiveRed 0xa498
-#define GlintLight11AmbientIntensiveRedTag 0x0493
-#define GlintLight11AmbientIntensiveRedReg 1
-#define GlintLight11AmbientIntensiveRedOff 0x9498
-
-#define GlintLight11AmbientIntensityGreen 0xa4a0
-#define GlintLight11AmbientIntensityGreenTag 0x0494
-#define GlintLight11AmbientIntensityGreenReg 1
-#define GlintLight11AmbientIntensityGreenOff 0x94a0
-
-#define GlintLight11AmbientIntensityBlue 0xa4a8
-#define GlintLight11AmbientIntensityBlueTag 0x0495
-#define GlintLight11AmbientIntensityBlueReg 1
-#define GlintLight11AmbientIntensityBlueOff 0x94a8
-
-#define GlintLight11DiffuseIntensityRed 0xa4b0
-#define GlintLight11DiffuseIntensityRedTag 0x0496
-#define GlintLight11DiffuseIntensityRedReg 1
-#define GlintLight11DiffuseIntensityRedOff 0x94b0
-
-#define GlintLight11DiffuseIntensityGreen 0xa4b8
-#define GlintLight11DiffuseIntensityGreenTag 0x0497
-#define GlintLight11DiffuseIntensityGreenReg 1
-#define GlintLight11DiffuseIntensityGreenOff 0x94b8
-
-#define GlintLight11DiffuseIntensityBlue 0xa4c0
-#define GlintLight11DiffuseIntensityBlueTag 0x0498
-#define GlintLight11DiffuseIntensityBlueReg 1
-#define GlintLight11DiffuseIntensityBlueOff 0x94c0
-
-#define GlintLight11SpecularIntensityRed 0xa4c8
-#define GlintLight11SpecularIntensityRedTag 0x0499
-#define GlintLight11SpecularIntensityRedReg 1
-#define GlintLight11SpecularIntensityRedOff 0x94c8
-
-#define GlintLight11SpecularIntensityGreen 0xa4d0
-#define GlintLight11SpecularIntensityGreenTag 0x049a
-#define GlintLight11SpecularIntensityGreenReg 1
-#define GlintLight11SpecularIntensityGreenOff 0x94d0
-
-#define GlintLight11SpecularIntensityBlue 0xa4d8
-#define GlintLight11SpecularIntensityBlueTag 0x049b
-#define GlintLight11SpecularIntensityBlueReg 1
-#define GlintLight11SpecularIntensityBlueOff 0x94d8
-
-#define GlintLight11PositionX 0xa4e0
-#define GlintLight11PositionXTag 0x049c
-#define GlintLight11PositionXReg 1
-#define GlintLight11PositionXOff 0x94e0
-
-#define GlintLight11PositionY 0xa4e8
-#define GlintLight11PositionYTag 0x049d
-#define GlintLight11PositionYReg 1
-#define GlintLight11PositionYOff 0x94e8
-
-#define GlintLight11PositionZ 0xa4f0
-#define GlintLight11PositionZTag 0x049e
-#define GlintLight11PositionZReg 1
-#define GlintLight11PositionZOff 0x94f0
-
-#define GlintLight11PositionW 0xa4f8
-#define GlintLight11PositionWTag 0x049f
-#define GlintLight11PositionWReg 1
-#define GlintLight11PositionWOff 0x94f8
-
-#define GlintLight11SpotlightDirectionX 0xa500
-#define GlintLight11SpotlightDirectionXTag 0x04a0
-#define GlintLight11SpotlightDirectionXReg 1
-#define GlintLight11SpotlightDirectionXOff 0x9500
-
-#define GlintLight11SpotlightDirectionY 0xa508
-#define GlintLight11SpotlightDirectionYTag 0x04a1
-#define GlintLight11SpotlightDirectionYReg 1
-#define GlintLight11SpotlightDirectionYOff 0x9508
-
-#define GlintLight11SpotlightDirectionZ 0xa510
-#define GlintLight11SpotlightDirectionZTag 0x04a2
-#define GlintLight11SpotlightDirectionZReg 1
-#define GlintLight11SpotlightDirectionZOff 0x9510
-
-#define GlintLight11SpotlightExponent 0xa518
-#define GlintLight11SpotlightExponentTag 0x04a3
-#define GlintLight11SpotlightExponentReg 1
-#define GlintLight11SpotlightExponentOff 0x9518
-
-#define GlintLight11CosSpotlightCutoffAngle 0xa520
-#define GlintLight11CosSpotlightCutoffAngleTag 0x04a4
-#define GlintLight11CosSpotlightCutoffAngleReg 1
-#define GlintLight11CosSpotlightCutoffAngleOff 0x9520
-
-#define GlintLight11ConstantAttenuation 0xa528
-#define GlintLight11ConstantAttenuationTag 0x04a5
-#define GlintLight11ConstantAttenuationReg 1
-#define GlintLight11ConstantAttenuationOff 0x9528
-
-#define GlintLight11LinearAttenuation 0xa530
-#define GlintLight11LinearAttenuationTag 0x04a6
-#define GlintLight11LinearAttenuationReg 1
-#define GlintLight11LinearAttenuationOff 0x9530
-
-#define GlintLight11QuadraticAttenuation 0xa538
-#define GlintLight11QuadraticAttenuationTag 0x04a7
-#define GlintLight11QuadraticAttenuationReg 1
-#define GlintLight11QuadraticAttenuationOff 0x9538
-
-#define GlintLight12Mode 0xa540
-#define GlintLight12ModeTag 0x04a8
-#define GlintLight12ModeReg 1
-#define GlintLight12ModeOff 0x9540
-
-#define GlintLight12AmbientIntensityRed 0xa548
-#define GlintLight12AmbientIntensityRedTag 0x04a9
-#define GlintLight12AmbientIntensityRedReg 1
-#define GlintLight12AmbientIntensityRedOff 0x9548
-
-#define GlintLight12AmbientIntensityGreen 0xa550
-#define GlintLight12AmbientIntensityGreenTag 0x04aa
-#define GlintLight12AmbientIntensityGreenReg 1
-#define GlintLight12AmbientIntensityGreenOff 0x9550
-
-#define GlintLight12AmbientIntensityBlue 0xa558
-#define GlintLight12AmbientIntensityBlueTag 0x04ab
-#define GlintLight12AmbientIntensityBlueReg 1
-#define GlintLight12AmbientIntensityBlueOff 0x9558
-
-#define GlintLight12DiffuseIntensityRed 0xa560
-#define GlintLight12DiffuseIntensityRedTag 0x04ac
-#define GlintLight12DiffuseIntensityRedReg 1
-#define GlintLight12DiffuseIntensityRedOff 0x9560
-
-#define GlintLight12DiffuseIntensityGreen 0xa568
-#define GlintLight12DiffuseIntensityGreenTag 0x04ad
-#define GlintLight12DiffuseIntensityGreenReg 1
-#define GlintLight12DiffuseIntensityGreenOff 0x9568
-
-#define GlintLight12DiffuseIntensityBlue 0xa570
-#define GlintLight12DiffuseIntensityBlueTag 0x04ae
-#define GlintLight12DiffuseIntensityBlueReg 1
-#define GlintLight12DiffuseIntensityBlueOff 0x9570
-
-#define GlintLight12SpecularIntensityRed 0xa578
-#define GlintLight12SpecularIntensityRedTag 0x04af
-#define GlintLight12SpecularIntensityRedReg 1
-#define GlintLight12SpecularIntensityRedOff 0x9578
-
-#define GlintLight12SpecularIntensityGreen 0xa580
-#define GlintLight12SpecularIntensityGreenTag 0x04b0
-#define GlintLight12SpecularIntensityGreenReg 1
-#define GlintLight12SpecularIntensityGreenOff 0x9580
-
-#define GlintLight12SpecularIntensityBlue 0xa588
-#define GlintLight12SpecularIntensityBlueTag 0x04b1
-#define GlintLight12SpecularIntensityBlueReg 1
-#define GlintLight12SpecularIntensityBlueOff 0x9588
-
-#define GlintLight12PositionX 0xa590
-#define GlintLight12PositionXTag 0x04b2
-#define GlintLight12PositionXReg 1
-#define GlintLight12PositionXOff 0x9590
-
-#define GlintLight12PositionY 0xa598
-#define GlintLight12PositionYTag 0x04b3
-#define GlintLight12PositionYReg 1
-#define GlintLight12PositionYOff 0x9598
-
-#define GlintLight12PositionZ 0xa5a0
-#define GlintLight12PositionZTag 0x04b4
-#define GlintLight12PositionZReg 1
-#define GlintLight12PositionZOff 0x95a0
-
-#define GlintLight12PositionW 0xa5a8
-#define GlintLight12PositionWTag 0x04b5
-#define GlintLight12PositionWReg 1
-#define GlintLight12PositionWOff 0x95a8
-
-#define GlintLight12SpotlightDirectionX 0xa5b0
-#define GlintLight12SpotlightDirectionXTag 0x04b6
-#define GlintLight12SpotlightDirectionXReg 1
-#define GlintLight12SpotlightDirectionXOff 0x95b0
-
-#define GlintLight12SpotlightDirectionY 0xa5b8
-#define GlintLight12SpotlightDirectionYTag 0x04b7
-#define GlintLight12SpotlightDirectionYReg 1
-#define GlintLight12SpotlightDirectionYOff 0x95b8
-
-#define GlintLight12SpotlightDirectionZ 0xa5c0
-#define GlintLight12SpotlightDirectionZTag 0x04b8
-#define GlintLight12SpotlightDirectionZReg 1
-#define GlintLight12SpotlightDirectionZOff 0x95c0
-
-#define GlintLight12SpotlightExponent 0xa5c8
-#define GlintLight12SpotlightExponentTag 0x04b9
-#define GlintLight12SpotlightExponentReg 1
-#define GlintLight12SpotlightExponentOff 0x95c8
-
-#define GlintLight12CosSpotlightCutoffAngle 0xa5d0
-#define GlintLight12CosSpotlightCutoffAngleTag 0x04ba
-#define GlintLight12CosSpotlightCutoffAngleReg 1
-#define GlintLight12CosSpotlightCutoffAngleOff 0x95d0
-
-#define GlintLight12ConstantAttenuation 0xa5d8
-#define GlintLight12ConstantAttenuationTag 0x04bb
-#define GlintLight12ConstantAttenuationReg 1
-#define GlintLight12ConstantAttenuationOff 0x95d8
-
-#define GlintLight12LinearAttenuation 0xa5e0
-#define GlintLight12LinearAttenuationTag 0x04bc
-#define GlintLight12LinearAttenuationReg 1
-#define GlintLight12LinearAttenuationOff 0x95e0
-
-#define GlintLight12QuadraticAttenuation 0xa5e8
-#define GlintLight12QuadraticAttenuationTag 0x04bd
-#define GlintLight12QuadraticAttenuationReg 1
-#define GlintLight12QuadraticAttenuationOff 0x95e8
-
-#define GlintLight13Mode 0xa5f0
-#define GlintLight13ModeTag 0x04be
-#define GlintLight13ModeReg 1
-#define GlintLight13ModeOff 0x95f0
-
-#define GlintLight13AmbientIntensityRed 0xa5f8
-#define GlintLight13AmbientIntensityRedTag 0x04bf
-#define GlintLight13AmbientIntensityRedReg 1
-#define GlintLight13AmbientIntensityRedOff 0x95f8
-
-#define GlintLight13AmbientIntensityGreen 0xa600
-#define GlintLight13AmbientIntensityGreenTag 0x04c0
-#define GlintLight13AmbientIntensityGreenReg 1
-#define GlintLight13AmbientIntensityGreenOff 0x9600
-
-#define GlintLight13AmbientIntensityBlue 0xa608
-#define GlintLight13AmbientIntensityBlueTag 0x04c1
-#define GlintLight13AmbientIntensityBlueReg 1
-#define GlintLight13AmbientIntensityBlueOff 0x9608
-
-#define GlintLight13DiffuseIntensityRed 0xa610
-#define GlintLight13DiffuseIntensityRedTag 0x04c2
-#define GlintLight13DiffuseIntensityRedReg 1
-#define GlintLight13DiffuseIntensityRedOff 0x9610
-
-#define GlintLight13DiffuseIntensityGreen 0xa618
-#define GlintLight13DiffuseIntensityGreenTag 0x04c3
-#define GlintLight13DiffuseIntensityGreenReg 1
-#define GlintLight13DiffuseIntensityGreenOff 0x9618
-
-#define GlintLight13DiffuseIntensityBlue 0xa620
-#define GlintLight13DiffuseIntensityBlueTag 0x04c4
-#define GlintLight13DiffuseIntensityBlueReg 1
-#define GlintLight13DiffuseIntensityBlueOff 0x9620
-
-#define GlintLight13SpecularIntensityRed 0xa628
-#define GlintLight13SpecularIntensityRedTag 0x04c5
-#define GlintLight13SpecularIntensityRedReg 1
-#define GlintLight13SpecularIntensityRedOff 0x9628
-
-#define GlintLight13SpecularIntensityGreen 0xa630
-#define GlintLight13SpecularIntensityGreenTag 0x04c6
-#define GlintLight13SpecularIntensityGreenReg 1
-#define GlintLight13SpecularIntensityGreenOff 0x9630
-
-#define GlintLight13SpecularIntensityBlue 0xa638
-#define GlintLight13SpecularIntensityBlueTag 0x04c7
-#define GlintLight13SpecularIntensityBlueReg 1
-#define GlintLight13SpecularIntensityBlueOff 0x9638
-
-#define GlintLight13PositionX 0xa640
-#define GlintLight13PositionXTag 0x04c8
-#define GlintLight13PositionXReg 1
-#define GlintLight13PositionXOff 0x9640
-
-#define GlintLight13PositionY 0xa648
-#define GlintLight13PositionYTag 0x04c9
-#define GlintLight13PositionYReg 1
-#define GlintLight13PositionYOff 0x9648
-
-#define GlintLight13PositionZ 0xa650
-#define GlintLight13PositionZTag 0x04ca
-#define GlintLight13PositionZReg 1
-#define GlintLight13PositionZOff 0x9650
-
-#define GlintLight13PositionW 0xa658
-#define GlintLight13PositionWTag 0x04cb
-#define GlintLight13PositionWReg 1
-#define GlintLight13PositionWOff 0x9658
-
-#define GlintLight13SpotlightDirectionX 0xa660
-#define GlintLight13SpotlightDirectionXTag 0x04cc
-#define GlintLight13SpotlightDirectionXReg 1
-#define GlintLight13SpotlightDirectionXOff 0x9660
-
-#define GlintLight13SpotlightDirectionY 0xa668
-#define GlintLight13SpotlightDirectionYTag 0x04cd
-#define GlintLight13SpotlightDirectionYReg 1
-#define GlintLight13SpotlightDirectionYOff 0x9668
-
-#define GlintLight13SpotlightDirectionZ 0xa670
-#define GlintLight13SpotlightDirectionZTag 0x04ce
-#define GlintLight13SpotlightDirectionZReg 1
-#define GlintLight13SpotlightDirectionZOff 0x9670
-
-#define GlintLight13SpotlightExponent 0xa678
-#define GlintLight13SpotlightExponentTag 0x04cf
-#define GlintLight13SpotlightExponentReg 1
-#define GlintLight13SpotlightExponentOff 0x9678
-
-#define GlintLight13CosSpotlightCutoffAngle 0xa680
-#define GlintLight13CosSpotlightCutoffAngleTag 0x04d0
-#define GlintLight13CosSpotlightCutoffAngleReg 1
-#define GlintLight13CosSpotlightCutoffAngleOff 0x9680
-
-#define GlintLight13ConstantAttenuation 0xa688
-#define GlintLight13ConstantAttenuationTag 0x04d1
-#define GlintLight13ConstantAttenuationReg 1
-#define GlintLight13ConstantAttenuationOff 0x9688
-
-#define GlintLight13LinearAttenuation 0xa690
-#define GlintLight13LinearAttenuationTag 0x04d2
-#define GlintLight13LinearAttenuationReg 1
-#define GlintLight13LinearAttenuationOff 0x9690
-
-#define GlintLight13QuadraticAttenuation 0xa698
-#define GlintLight13QuadraticAttenuationTag 0x04d3
-#define GlintLight13QuadraticAttenuationReg 1
-#define GlintLight13QuadraticAttenuationOff 0x9698
-
-#define GlintLight14Mode 0xa6a0
-#define GlintLight14ModeTag 0x04d4
-#define GlintLight14ModeReg 1
-#define GlintLight14ModeOff 0x96a0
-
-#define GlintLight14AmbientIntensityRed 0xa6a8
-#define GlintLight14AmbientIntensityRedTag 0x04d5
-#define GlintLight14AmbientIntensityRedReg 1
-#define GlintLight14AmbientIntensityRedOff 0x96a8
-
-#define GlintLight14AmbientIntensityGreen 0xa6b0
-#define GlintLight14AmbientIntensityGreenTag 0x04d6
-#define GlintLight14AmbientIntensityGreenReg 1
-#define GlintLight14AmbientIntensityGreenOff 0x96b0
-
-#define GlintLight14AmbientIntensityBlue 0xa6b8
-#define GlintLight14AmbientIntensityBlueTag 0x04d7
-#define GlintLight14AmbientIntensityBlueReg 1
-#define GlintLight14AmbientIntensityBlueOff 0x96b8
-
-#define GlintLight14DiffuseIntensityRed 0xa6c0
-#define GlintLight14DiffuseIntensityRedTag 0x04d8
-#define GlintLight14DiffuseIntensityRedReg 1
-#define GlintLight14DiffuseIntensityRedOff 0x96c0
-
-#define GlintLight14DiffuseIntensityGreen 0xa6c8
-#define GlintLight14DiffuseIntensityGreenTag 0x04d9
-#define GlintLight14DiffuseIntensityGreenReg 1
-#define GlintLight14DiffuseIntensityGreenOff 0x96c8
-
-#define GlintLight14DiffuseIntensityBlue 0xa6d0
-#define GlintLight14DiffuseIntensityBlueTag 0x04da
-#define GlintLight14DiffuseIntensityBlueReg 1
-#define GlintLight14DiffuseIntensityBlueOff 0x96d0
-
-#define GlintLight14SpecularIntensityRed 0xa6d8
-#define GlintLight14SpecularIntensityRedTag 0x04db
-#define GlintLight14SpecularIntensityRedReg 1
-#define GlintLight14SpecularIntensityRedOff 0x96d8
-
-#define GlintLight14SpecularIntensityGreen 0xa6e0
-#define GlintLight14SpecularIntensityGreenTag 0x04dc
-#define GlintLight14SpecularIntensityGreenReg 1
-#define GlintLight14SpecularIntensityGreenOff 0x96e0
-
-#define GlintLight14SpecularIntensityBlue 0xa6e8
-#define GlintLight14SpecularIntensityBlueTag 0x04dd
-#define GlintLight14SpecularIntensityBlueReg 1
-#define GlintLight14SpecularIntensityBlueOff 0x96e8
-
-#define GlintLight14PositionX 0xa6f0
-#define GlintLight14PositionXTag 0x04de
-#define GlintLight14PositionXReg 1
-#define GlintLight14PositionXOff 0x96f0
-
-#define GlintLight14PositionY 0xa6f8
-#define GlintLight14PositionYTag 0x04df
-#define GlintLight14PositionYReg 1
-#define GlintLight14PositionYOff 0x96f8
-
-#define GlintLight14PositionZ 0xa700
-#define GlintLight14PositionZTag 0x04e0
-#define GlintLight14PositionZReg 1
-#define GlintLight14PositionZOff 0x9700
-
-#define GlintLight14PositionW 0xa708
-#define GlintLight14PositionWTag 0x04e1
-#define GlintLight14PositionWReg 1
-#define GlintLight14PositionWOff 0x9708
-
-#define GlintLight14SpotlightDirectionX 0xa710
-#define GlintLight14SpotlightDirectionXTag 0x04e2
-#define GlintLight14SpotlightDirectionXReg 1
-#define GlintLight14SpotlightDirectionXOff 0x9710
-
-#define GlintLight14SpotlightDirectionY 0xa718
-#define GlintLight14SpotlightDirectionYTag 0x04e3
-#define GlintLight14SpotlightDirectionYReg 1
-#define GlintLight14SpotlightDirectionYOff 0x9718
-
-#define GlintLight14SpotlightDirectionZ 0xa720
-#define GlintLight14SpotlightDirectionZTag 0x04e4
-#define GlintLight14SpotlightDirectionZReg 1
-#define GlintLight14SpotlightDirectionZOff 0x9720
-
-#define GlintLight14SpotlightExponent 0xa728
-#define GlintLight14SpotlightExponentTag 0x04e5
-#define GlintLight14SpotlightExponentReg 1
-#define GlintLight14SpotlightExponentOff 0x9728
-
-#define GlintLight14CosSpotlightCutoffAngle 0xa730
-#define GlintLight14CosSpotlightCutoffAngleTag 0x04e6
-#define GlintLight14CosSpotlightCutoffAngleReg 1
-#define GlintLight14CosSpotlightCutoffAngleOff 0x9730
-
-#define GlintLight14ConstantAttenuation 0xa738
-#define GlintLight14ConstantAttenuationTag 0x04e7
-#define GlintLight14ConstantAttenuationReg 1
-#define GlintLight14ConstantAttenuationOff 0x9738
-
-#define GlintLight14LinearAttenuation 0xa740
-#define GlintLight14LinearAttenuationTag 0x04e8
-#define GlintLight14LinearAttenuationReg 1
-#define GlintLight14LinearAttenuationOff 0x9740
-
-#define GlintLight14QuadraticAttenuation 0xa748
-#define GlintLight14QuadraticAttenuationTag 0x04e9
-#define GlintLight14QuadraticAttenuationReg 1
-#define GlintLight14QuadraticAttenuationOff 0x9748
-
-#define GlintLight15Mode 0xa750
-#define GlintLight15ModeTag 0x04ea
-#define GlintLight15ModeReg 1
-#define GlintLight15ModeOff 0x9750
-
-#define GlintLight15AmbientIntensityRed 0xa758
-#define GlintLight15AmbientIntensityRedTag 0x04eb
-#define GlintLight15AmbientIntensityRedReg 1
-#define GlintLight15AmbientIntensityRedOff 0x9758
-
-#define GlintLight15AmbientIntensityGreen 0xa760
-#define GlintLight15AmbientIntensityGreenTag 0x04ec
-#define GlintLight15AmbientIntensityGreenReg 1
-#define GlintLight15AmbientIntensityGreenOff 0x9760
-
-#define GlintLight15AmbientIntensityBlue 0xa768
-#define GlintLight15AmbientIntensityBlueTag 0x04ed
-#define GlintLight15AmbientIntensityBlueReg 1
-#define GlintLight15AmbientIntensityBlueOff 0x9768
-
-#define GlintLight15DiffuseIntensityRed 0xa770
-#define GlintLight15DiffuseIntensityRedTag 0x04ee
-#define GlintLight15DiffuseIntensityRedReg 1
-#define GlintLight15DiffuseIntensityRedOff 0x9770
-
-#define GlintLight15DiffuseIntensityGreen 0xa778
-#define GlintLight15DiffuseIntensityGreenTag 0x04ef
-#define GlintLight15DiffuseIntensityGreenReg 1
-#define GlintLight15DiffuseIntensityGreenOff 0x9778
-
-#define GlintLight15DiffuseIntensityBlue 0xa780
-#define GlintLight15DiffuseIntensityBlueTag 0x04f0
-#define GlintLight15DiffuseIntensityBlueReg 1
-#define GlintLight15DiffuseIntensityBlueOff 0x9780
-
-#define GlintLight15SpecularIntensityRed 0xa788
-#define GlintLight15SpecularIntensityRedTag 0x04f1
-#define GlintLight15SpecularIntensityRedReg 1
-#define GlintLight15SpecularIntensityRedOff 0x9788
-
-#define GlintLight15SpecularIntensityGreen 0xa790
-#define GlintLight15SpecularIntensityGreenTag 0x04f2
-#define GlintLight15SpecularIntensityGreenReg 1
-#define GlintLight15SpecularIntensityGreenOff 0x9790
-
-#define GlintLight15SpecularIntensityBlue 0xa798
-#define GlintLight15SpecularIntensityBlueTag 0x04f3
-#define GlintLight15SpecularIntensityBlueReg 1
-#define GlintLight15SpecularIntensityBlueOff 0x9798
-
-#define GlintLight15PositionX 0xa7a0
-#define GlintLight15PositionXTag 0x04f4
-#define GlintLight15PositionXReg 1
-#define GlintLight15PositionXOff 0x97a0
-
-#define GlintLight15PositionY 0xa7a8
-#define GlintLight15PositionYTag 0x04f5
-#define GlintLight15PositionYReg 1
-#define GlintLight15PositionYOff 0x97a8
-
-#define GlintLight15PositionZ 0xa7b0
-#define GlintLight15PositionZTag 0x04f6
-#define GlintLight15PositionZReg 1
-#define GlintLight15PositionZOff 0x97b0
-
-#define GlintLight15PositionW 0xa7b8
-#define GlintLight15PositionWTag 0x04f7
-#define GlintLight15PositionWReg 1
-#define GlintLight15PositionWOff 0x97b8
-
-#define GlintLight15SpotlightDirectionX 0xa7c0
-#define GlintLight15SpotlightDirectionXTag 0x04f8
-#define GlintLight15SpotlightDirectionXReg 1
-#define GlintLight15SpotlightDirectionXOff 0x97c0
-
-#define GlintLight15SpotlightDirectionY 0xa7c8
-#define GlintLight15SpotlightDirectionYTag 0x04f9
-#define GlintLight15SpotlightDirectionYReg 1
-#define GlintLight15SpotlightDirectionYOff 0x97c8
-
-#define GlintLight15SpotlightDirectionZ 0xa7d0
-#define GlintLight15SpotlightDirectionZTag 0x04fa
-#define GlintLight15SpotlightDirectionZReg 1
-#define GlintLight15SpotlightDirectionZOff 0x97d0
-
-#define GlintLight15SpotlightExponent 0xa7d8
-#define GlintLight15SpotlightExponentTag 0x04fb
-#define GlintLight15SpotlightExponentReg 1
-#define GlintLight15SpotlightExponentOff 0x97d8
-
-#define GlintLight15CosSpotlightCutoffAngle 0xa7e0
-#define GlintLight15CosSpotlightCutoffAngleTag 0x04fc
-#define GlintLight15CosSpotlightCutoffAngleReg 1
-#define GlintLight15CosSpotlightCutoffAngleOff 0x97e0
-
-#define GlintLight15ConstantAttenuation 0xa7e8
-#define GlintLight15ConstantAttenuationTag 0x04fd
-#define GlintLight15ConstantAttenuationReg 1
-#define GlintLight15ConstantAttenuationOff 0x97e8
-
-#define GlintLight15LinearAttenuation 0xa7f0
-#define GlintLight15LinearAttenuationTag 0x04fe
-#define GlintLight15LinearAttenuationReg 1
-#define GlintLight15LinearAttenuationOff 0x97f0
-
-#define GlintLight15QuadraticAttenuation 0xa7f8
-#define GlintLight15QuadraticAttenuationTag 0x04ff
-#define GlintLight15QuadraticAttenuationReg 1
-#define GlintLight15QuadraticAttenuationOff 0x97f8
-
-#define GlintSceneAmbientColorRed 0xa800
-#define GlintSceneAmbientColorRedTag 0x0500
-#define GlintSceneAmbientColorRedReg 1
-#define GlintSceneAmbientColorRedOff 0x9800
-
-#define GlintSceneAmbientColorGreen 0xa808
-#define GlintSceneAmbientColorGreenTag 0x0501
-#define GlintSceneAmbientColorGreenReg 1
-#define GlintSceneAmbientColorGreenOff 0x9808
-
-#define GlintSceneAmbientColorBlue 0xa810
-#define GlintSceneAmbientColorBlueTag 0x0502
-#define GlintSceneAmbientColorBlueReg 1
-#define GlintSceneAmbientColorBlueOff 0x9810
-
-#define GlintFrontAmbientColorRed 0xa880
-#define GlintFrontAmbientColorRedTag 0x0510
-#define GlintFrontAmbientColorRedReg 1
-#define GlintFrontAmbientColorRedOff 0x9880
-
-#define GlintFrontAmbientColorGreen 0xa888
-#define GlintFrontAmbientColorGreenTag 0x0511
-#define GlintFrontAmbientColorGreenReg 1
-#define GlintFrontAmbientColorGreenOff 0x9888
-
-#define GlintFrontAmbientColorBlue 0xa890
-#define GlintFrontAmbientColorBlueTag 0x0512
-#define GlintFrontAmbientColorBlueReg 1
-#define GlintFrontAmbientColorBlueOff 0x9890
-
-#define GlintFrontDiffuseColorRed 0xa898
-#define GlintFrontDiffuseColorRedTag 0x0513
-#define GlintFrontDiffuseColorRedReg 1
-#define GlintFrontDiffuseColorRedOff 0x9898
-
-#define GlintFrontDiffuseColorGreen 0xa8a0
-#define GlintFrontDiffuseColorGreenTag 0x0514
-#define GlintFrontDiffuseColorGreenReg 1
-#define GlintFrontDiffuseColorGreenOff 0x98a0
-
-#define GlintFrontDiffuseColorBlue 0xa8a8
-#define GlintFrontDiffuseColorBlueTag 0x0515
-#define GlintFrontDiffuseColorBlueReg 1
-#define GlintFrontDiffuseColorBlueOff 0x98a8
-
-#define GlintFrontAlpha 0xa8b0
-#define GlintFrontAlphaTag 0x0516
-#define GlintFrontAlphaReg 1
-#define GlintFrontAlphaOff 0x98b0
-
-#define GlintFrontSpecularColorRed 0xa8b8
-#define GlintFrontSpecularColorRedTag 0x0517
-#define GlintFrontSpecularColorRedReg 1
-#define GlintFrontSpecularColorRedOff 0x98b8
-
-#define GlintFrontSpecularColorGreen 0xa8c0
-#define GlintFrontSpecularColorGreenTag 0x0518
-#define GlintFrontSpecularColorGreenReg 1
-#define GlintFrontSpecularColorGreenOff 0x98c0
-
-#define GlintFrontSpecularColorBlue 0xa8c8
-#define GlintFrontSpecularColorBlueTag 0x0519
-#define GlintFrontSpecularColorBlueReg 1
-#define GlintFrontSpecularColorBlueOff 0x98c8
-
-#define GlintFrontEmissiveColorRed 0xa8d0
-#define GlintFrontEmissiveColorRedTag 0x051a
-#define GlintFrontEmissiveColorRedReg 1
-#define GlintFrontEmissiveColorRedOff 0x98d0
-
-#define GlintFrontEmissiveColorGreen 0xa8d8
-#define GlintFrontEmissiveColorGreenTag 0x051b
-#define GlintFrontEmissiveColorGreenReg 1
-#define GlintFrontEmissiveColorGreenOff 0x98d8
-
-#define GlintFrontEmissiveColorBlue 0xa8e0
-#define GlintFrontEmissiveColorBlueTag 0x051c
-#define GlintFrontEmissiveColorBlueReg 1
-#define GlintFrontEmissiveColorBlueOff 0x98e0
-
-#define GlintFrontSpecularExponent 0xa8e8
-#define GlintFrontSpecularExponentTag 0x051d
-#define GlintFrontSpecularExponentReg 1
-#define GlintFrontSpecularExponentOff 0x98e8
-
-#define GlintBackAmbientColorRed 0xa900
-#define GlintBackAmbientColorRedTag 0x0520
-#define GlintBackAmbientColorRedReg 1
-#define GlintBackAmbientColorRedOff 0x9900
-
-#define GlintBackAmbientColorGreen 0xa908
-#define GlintBackAmbientColorGreenTag 0x0521
-#define GlintBackAmbientColorGreenReg 1
-#define GlintBackAmbientColorGreenOff 0x9908
-
-#define GlintBackAmbientColorBlue 0xa910
-#define GlintBackAmbientColorBlueTag 0x0522
-#define GlintBackAmbientColorBlueReg 1
-#define GlintBackAmbientColorBlueOff 0x9910
-
-#define GlintBackDiffuseColorRed 0xa918
-#define GlintBackDiffuseColorRedTag 0x0523
-#define GlintBackDiffuseColorRedReg 1
-#define GlintBackDiffuseColorRedOff 0x9918
-
-#define GlintBackDiffuseColorGreen 0xa920
-#define GlintBackDiffuseColorGreenTag 0x0524
-#define GlintBackDiffuseColorGreenReg 1
-#define GlintBackDiffuseColorGreenOff 0x9920
-
-#define GlintBackDiffuseColorBlue 0xa928
-#define GlintBackDiffuseColorBlueTag 0x0525
-#define GlintBackDiffuseColorBlueReg 1
-#define GlintBackDiffuseColorBlueOff 0x9928
-
-#define GlintBackAlpha 0xa930
-#define GlintBackAlphaTag 0x0526
-#define GlintBackAlphaReg 1
-#define GlintBackAlphaOff 0x9930
-
-#define GlintBackSpecularColorRed 0xa938
-#define GlintBackSpecularColorRedTag 0x0527
-#define GlintBackSpecularColorRedReg 1
-#define GlintBackSpecularColorRedOff 0x9938
-
-#define GlintBackSpecularColorGreen 0xa940
-#define GlintBackSpecularColorGreenTag 0x0528
-#define GlintBackSpecularColorGreenReg 1
-#define GlintBackSpecularColorGreenOff 0x9940
-
-#define GlintBackSpecularColorBlue 0xa948
-#define GlintBackSpecularColorBlueTag 0x0529
-#define GlintBackSpecularColorBlueReg 1
-#define GlintBackSpecularColorBlueOff 0x9948
-
-#define GlintBackEmissiveColorRed 0xa950
-#define GlintBackEmissiveColorRedTag 0x052a
-#define GlintBackEmissiveColorRedReg 1
-#define GlintBackEmissiveColorRedOff 0x9950
-
-#define GlintBackEmissiveColorGreen 0xa958
-#define GlintBackEmissiveColorGreenTag 0x052b
-#define GlintBackEmissiveColorGreenReg 1
-#define GlintBackEmissiveColorGreenOff 0x9958
-
-#define GlintBackEmissiveColorBlue 0xa960
-#define GlintBackEmissiveColorBlueTag 0x052c
-#define GlintBackEmissiveColorBlueReg 1
-#define GlintBackEmissiveColorBlueOff 0x9960
-
-#define GlintBackSpecularExponent 0xa968
-#define GlintBackSpecularExponentTag 0x052d
-#define GlintBackSpecularExponentReg 1
-#define GlintBackSpecularExponentOff 0x9968
-
-#define GlintDMAAddr 0xa980
-#define GlintDMAAddrTag 0x0530
-#define GlintDMAAddrReg 1
-#define GlintDMAAddrOff 0x9980
-
-#define GlintGammaDMACount 0xa988
-#define GlintGammaDMACountTag 0x0531
-#define GlintGammaDMACountReg 1
-#define GlintGammaDMACountOff 0x9988
-
-#define GlintCommandInterrupt 0xa990
-#define GlintCommandInterruptTag 0x0532
-#define GlintCommandInterruptReg 1
-#define GlintCommandInterruptOff 0x9990
-
-#define GlintDMACall 0xa998
-#define GlintDMACallTag 0x0533
-#define GlintDMACallReg 1
-#define GlintDMACallOff 0x9998
-
-#define GlintDMAReturn 0xa9a0
-#define GlintDMAReturnTag 0x0534
-#define GlintDMAReturnReg 1
-#define GlintDMAReturnOff 0x99a0
-
-#define GlintDMARectangularRead 0xa9a8
-#define GlintDMARectangularReadTag 0x0535
-#define GlintDMARectangularReadReg 1
-#define GlintDMARectangularReadOff 0x99a8
-
-#define GlintDMARectangleReadAddress 0xa9b0
-#define GlintDMARectangleReadAddressTag 0x0536
-#define GlintDMARectangleReadAddressReg 1
-#define GlintDMARectangleReadAddressOff 0x99b0
-
-#define GlintDMARectangleReadLinePitch 0xa9b8
-#define GlintDMARectangleReadLinePitchTag 0x0537
-#define GlintDMARectangleReadLinePitchReg 1
-#define GlintDMARectangleReadLinePitchOff 0x99b8
-
-#define GlintDMARectangleReadTarget 0xa9c0
-#define GlintDMARectangleReadTargetTag 0x0538
-#define GlintDMARectangleReadTargetReg 1
-#define GlintDMARectangleReadTargetOff 0x99c0
-
-#define GlintDMARectangleWrite 0xa9c8
-#define GlintDMARectangleWriteTag 0x0539
-#define GlintDMARectangleWriteReg 1
-#define GlintDMARectangleWriteOff 0x99c8
-
-#define GlintDMARectangleWriteAddress 0xa9d0
-#define GlintDMARectangleWriteAddressTag 0x053a
-#define GlintDMARectangleWriteAddressReg 1
-#define GlintDMARectangleWriteAddressOff 0x99d0
-
-#define GlintDMARectangleWriteLinePitch 0xa9d8
-#define GlintDMARectangleWriteLinePitchTag 0x053b
-#define GlintDMARectangleWriteLinePitchReg 1
-#define GlintDMARectangleWriteLinePitchOff 0x99d8
-
-#define GlintDMAOutputAddress 0xa9e0
-#define GlintDMAOutputAddressTag 0x053c
-#define GlintDMAOutputAddressReg 1
-#define GlintDMAOutputAddressOff 0x99e0
-
-#define GlintDMAOutputCount 0xa9e8
-#define GlintDMAOutputCountTag 0x053d
-#define GlintDMAOutputCountReg 1
-#define GlintDMAOutputCountOff 0x99e8
-
-#define GlintDMAReadGLINTSource 0xa9f0
-#define GlintDMAReadGLINTSourceTag 0x053e
-#define GlintDMAReadGLINTSourceReg 1
-#define GlintDMAReadGLINTSourceOff 0x99f0
-
-#define GlintDMAFeedback 0xaa10
-#define GlintDMAFeedbackTag 0x0542
-#define GlintDMAFeedbackReg 1
-#define GlintDMAFeedbackOff 0x9a10
-
-#define GlintTransformModeAnd 0xaa80
-#define GlintTransformModeAndTag 0x0550
-#define GlintTransformModeAndReg 1
-#define GlintTransformModeAndOff 0x9a80
-
-#define GlintTransformModeOr 0xaa88
-#define GlintTransformModeOrTag 0x0551
-#define GlintTransformModeOrReg 1
-#define GlintTransformModeOrOff 0x9a88
-
-#define GlintGeometryModeAnd 0xaa90
-#define GlintGeometryModeAndTag 0x0552
-#define GlintGeometryModeAndReg 1
-#define GlintGeometryModeAndOff 0x9a90
-
-#define GlintGeometryModeOr 0xaa98
-#define GlintGeometryModeOrTag 0x0553
-#define GlintGeometryModeOrReg 1
-#define GlintGeometryModeOrOff 0x9a98
-
-#define GlintNormalizeModeAnd 0xaaa0
-#define GlintNormalizeModeAndTag 0x0554
-#define GlintNormalizeModeAndReg 1
-#define GlintNormalizeModeAndOff 0x9aa0
-
-#define GlintNormalizeModeOr 0xaaa8
-#define GlintNormalizeModeOrTag 0x0555
-#define GlintNormalizeModeOrReg 1
-#define GlintNormalizeModeOrOff 0x9aa8
-
-#define GlintLightingModeAnd 0xaab0
-#define GlintLightingModeAndTag 0x0556
-#define GlintLightingModeAndReg 1
-#define GlintLightingModeAndOff 0x9ab0
-
-#define GlintLightingModeOr 0xaab8
-#define GlintLightingModeOrTag 0x0557
-#define GlintLightingModeOrReg 1
-#define GlintLightingModeOrOff 0x9ab8
-
-#define GlintColorMaterialModeAnd 0xaac0
-#define GlintColorMaterialModeAndTag 0x0558
-#define GlintColorMaterialModeAndReg 1
-#define GlintColorMaterialModeAndOff 0x9ac0
-
-#define GlintColorMaterialModeOr 0xaac8
-#define GlintColorMaterialModeOrTag 0x0559
-#define GlintColorMaterialModeOrReg 1
-#define GlintColorMaterialModeOrOff 0x9ac8
-
-#define GlintDeltaModeAnd 0xaad0
-#define GlintDeltaModeAndTag 0x055a
-#define GlintDeltaModeAndReg 1
-#define GlintDeltaModeAndOff 0x9ad0
-
-#define GlintDeltaModeOr 0xaad8
-#define GlintDeltaModeOrTag 0x055b
-#define GlintDeltaModeOrReg 1
-#define GlintDeltaModeOrOff 0x9ad8
-
-#define GlintPointModeAnd 0xaae0
-#define GlintPointModeAndTag 0x055c
-#define GlintPointModeAndReg 1
-#define GlintPointModeAndOff 0x9ae0
-
-#define GlintPointModeOr 0xaae8
-#define GlintPointModeOrTag 0x055d
-#define GlintPointModeOrReg 1
-#define GlintPointModeOrOff 0x9ae8
-
-#define GlintLineModeAnd 0xaaf0
-#define GlintLineModeAndTag 0x055e
-#define GlintLineModeAndReg 1
-#define GlintLineModeAndOff 0x9af0
-
-#define GlintLineModeOr 0xaaf8
-#define GlintLineModeOrTag 0x055f
-#define GlintLineModeOrReg 1
-#define GlintLineModeOrOff 0x9af8
-
-#define GlintTriangleModeAnd 0xab00
-#define GlintTriangleModeAndTag 0x0560
-#define GlintTriangleModeAndReg 1
-#define GlintTriangleModeAndOff 0x9b00
-
-#define GlintTriangleModeOr 0xab08
-#define GlintTriangleModeOrTag 0x0561
-#define GlintTriangleModeOrReg 1
-#define GlintTriangleModeOrOff 0x9b08
-
-#define GlintMaterialModeAnd 0xab10
-#define GlintMaterialModeAndTag 0x0562
-#define GlintMaterialModeAndReg 1
-#define GlintMaterialModeAndOff 0x9b10
-
-#define GlintMaterialModeOr 0xab18
-#define GlintMaterialModeOrTag 0x0563
-#define GlintMaterialModeOrReg 1
-#define GlintMaterialModeOrOff 0x9b18
-
-#define GlintWindowAnd 0xab80
-#define GlintWindowAndTag 0x0570
-#define GlintWindowAndReg 1
-#define GlintWindowAndOff 0x9b80
-
-#define GlintWindowOr 0xab88
-#define GlintWindowOrTag 0x0571
-#define GlintWindowOrReg 1
-#define GlintWindowOrOff 0x9b88
-
-#define GlintLBReadModeAnd 0xab90
-#define GlintLBReadModeAndTag 0x0572
-#define GlintLBReadModeAndReg 1
-#define GlintLBReadModeAndOff 0x9b90
-
-#define GlintLBReadModeOr 0xab98
-#define GlintLBReadModeOrTag 0x0573
-#define GlintLBReadModeOrReg 1
-#define GlintLBReadModeOrOff 0x9b98
-#endif
diff --git a/src/mesa/drivers/dri/gamma/gamma_context.c b/src/mesa/drivers/dri/gamma/gamma_context.c
deleted file mode 100644
index bab5b69a8e4..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_context.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- *
- */
-#include "gammacontext.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "vbo/vbo.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "main/context.h"
-#include "main/simple_list.h"
-#include "main/imports.h"
-#include "main/matrix.h"
-#include "main/extensions.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-#include "main/simple_list.h"
-#include "main/mm.h"
-
-
-#include "gamma_vb.h"
-#include "gamma_tris.h"
-
-extern const struct tnl_pipeline_stage _gamma_render_stage;
-
-static const struct tnl_pipeline_stage *gamma_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- /* REMOVE: point attenuation stage */
-#if 1
- &_gamma_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
- __DRIcontext *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreen *sPriv = driContextPriv->driScreenPriv;
- gammaContextPtr gmesa;
- gammaScreenPtr gammascrn;
- GLINTSAREADRIPtr saPriv=(GLINTSAREADRIPtr)(((char*)sPriv->pSAREA)+
- sizeof(drm_sarea_t));
- struct dd_function_table functions;
-
- gmesa = (gammaContextPtr) CALLOC( sizeof(*gmesa) );
- if (!gmesa)
- return GL_FALSE;
-
- /* Init default driver functions then plug in our gamma-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions( &functions );
- gammaDDInitTextureFuncs( &functions );
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((gammaContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- gmesa->glCtx = _mesa_create_context(glVisual, shareCtx,
- &functions, (void *) gmesa);
- if (!gmesa->glCtx) {
- FREE(gmesa);
- return GL_FALSE;
- }
-
- gmesa->driContext = driContextPriv;
- gmesa->driScreen = sPriv;
- gmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */
-
- gmesa->hHWContext = driContextPriv->hHWContext;
- gmesa->driHwLock = &sPriv->pSAREA->lock;
- gmesa->driFd = sPriv->fd;
- gmesa->sarea = saPriv;
-
- gammascrn = gmesa->gammaScreen = (gammaScreenPtr)(sPriv->private);
-
- ctx = gmesa->glCtx;
-
- ctx->Const.MaxTextureLevels = GAMMA_TEX_MAXLEVELS;
- ctx->Const.MaxTextureUnits = 1; /* Permedia 3 */
- ctx->Const.MaxTextureImageUnits = 1;
- ctx->Const.MaxTextureCoordUnits = 1;
-
- ctx->Const.MinLineWidth = 0.0;
- ctx->Const.MaxLineWidth = 255.0;
-
- ctx->Const.MinLineWidthAA = 0.0;
- ctx->Const.MaxLineWidthAA = 65536.0;
-
- ctx->Const.MinPointSize = 0.0;
- ctx->Const.MaxPointSize = 255.0;
-
- ctx->Const.MinPointSizeAA = 0.5; /* 4x4 quality mode */
- ctx->Const.MaxPointSizeAA = 16.0;
- ctx->Const.PointSizeGranularity = 0.25;
-
- ctx->Const.MaxDrawBuffers = 1;
-
- gmesa->texHeap = mmInit( 0, gmesa->gammaScreen->textureSize );
-
- make_empty_list(&gmesa->TexObjList);
- make_empty_list(&gmesa->SwappedOut);
-
- gmesa->CurrentTexObj[0] = 0;
- gmesa->CurrentTexObj[1] = 0; /* Permedia 3, second texture */
-
- gmesa->RenderIndex = ~0;
-
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _vbo_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, gamma_pipeline );
-
- /* Configure swrast & TNL to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
- _tnl_allow_pixel_fog( ctx, GL_FALSE );
- _tnl_allow_vertex_fog( ctx, GL_TRUE );
-
- gammaInitVB( ctx );
- gammaDDInitExtensions( ctx );
- /* XXX these should really go right after _mesa_init_driver_functions() */
- gammaDDInitDriverFuncs( ctx );
- gammaDDInitStateFuncs( ctx );
- gammaDDInitSpanFuncs( ctx );
- gammaDDInitTriFuncs( ctx );
- gammaDDInitState( gmesa );
-
- gammaInitTextureObjects( ctx );
-
- driContextPriv->driverPrivate = (void *)gmesa;
-
- GET_FIRST_DMA(gmesa->driFd, gmesa->hHWContext,
- 1, &gmesa->bufIndex, &gmesa->bufSize,
- &gmesa->buf, &gmesa->bufCount, gammascrn);
-
-#ifdef DO_VALIDATE
- GET_FIRST_DMA(gmesa->driFd, gmesa->hHWContext,
- 1, &gmesa->WCbufIndex, &gmesa->WCbufSize,
- &gmesa->WCbuf, &gmesa->WCbufCount, gammascrn);
-#endif
-
- switch (glVisual->depthBits) {
- case 16:
- gmesa->DeltaMode = DM_Depth16;
- gmesa->depth_scale = 1.0f / 0xffff;
- break;
- case 24:
- gmesa->DeltaMode = DM_Depth24;
- gmesa->depth_scale = 1.0f / 0xffffff;
- break;
- case 32:
- gmesa->DeltaMode = DM_Depth32;
- gmesa->depth_scale = 1.0f / 0xffffffff;
- break;
- default:
- break;
- }
-
- gmesa->DepthSize = glVisual->depthBits;
- gmesa->Flags = GAMMA_FRONT_BUFFER;
- gmesa->Flags |= (glVisual->doubleBufferMode ? GAMMA_BACK_BUFFER : 0);
- gmesa->Flags |= (gmesa->DepthSize > 0 ? GAMMA_DEPTH_BUFFER : 0);
-
- gmesa->EnabledFlags = GAMMA_FRONT_BUFFER;
- gmesa->EnabledFlags |= (glVisual->doubleBufferMode ? GAMMA_BACK_BUFFER : 0);
-
-
- if (gmesa->Flags & GAMMA_BACK_BUFFER) {
- gmesa->readOffset = gmesa->drawOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
- } else {
- gmesa->readOffset = gmesa->drawOffset = 0;
- }
-
- gammaInitHW( gmesa );
-
- driContextPriv->driverPrivate = (void *)gmesa;
-
- return GL_TRUE;
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_context.h b/src/mesa/drivers/dri/gamma/gamma_context.h
deleted file mode 100644
index c386aa3007a..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_context.h
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- */
-
-#ifndef _GAMMA_CONTEXT_H_
-#define _GAMMA_CONTEXT_H_
-
-#include "dri_util.h"
-#include "drm.h"
-#include "drm_sarea.h"
-#include "colormac.h"
-#include "gamma_regs.h"
-#include "gamma_main/macros.h"
-#include "gamma_screen.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "glint_dri.h"
-#include "main/mm.h"
-
-typedef union {
- unsigned int i;
- float f;
-} dmaBufRec, *dmaBuf;
-
-/* Flags for context */
-#define GAMMA_FRONT_BUFFER 0x00000001
-#define GAMMA_BACK_BUFFER 0x00000002
-#define GAMMA_DEPTH_BUFFER 0x00000004
-#define GAMMA_STENCIL_BUFFER 0x00000008
-#define GAMMA_ACCUM_BUFFER 0x00000010
-
-#define GAMMA_MAX_TEXTURE_SIZE 2048
-
-/* These are the minimum requirements and should probably be increased */
-#define MAX_MODELVIEW_STACK 16
-#define MAX_PROJECTION_STACK 2
-#define MAX_TEXTURE_STACK 2
-
-extern void gammaDDUpdateHWState(GLcontext *ctx);
-extern gammaScreenPtr gammaCreateScreen(__DRIscreen *sPriv);
-extern void gammaDestroyScreen(__DRIscreen *sPriv);
-extern GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
- __DRIcontext *driContextPriv,
- void *sharedContextPrivate);
-
-#define GAMMA_UPLOAD_ALL 0xffffffff
-#define GAMMA_UPLOAD_CLIPRECTS 0x00000002
-#define GAMMA_UPLOAD_ALPHA 0x00000004
-#define GAMMA_UPLOAD_BLEND 0x00000008
-#define GAMMA_UPLOAD_DEPTH 0x00000010
-#define GAMMA_UPLOAD_VIEWPORT 0x00000020
-#define GAMMA_UPLOAD_SHADE 0x00000040
-#define GAMMA_UPLOAD_CLIP 0x00000080
-#define GAMMA_UPLOAD_MASKS 0x00000100
-#define GAMMA_UPLOAD_WINDOW 0x00000200 /* defunct */
-#define GAMMA_UPLOAD_GEOMETRY 0x00000400
-#define GAMMA_UPLOAD_POLYGON 0x00000800
-#define GAMMA_UPLOAD_DITHER 0x00001000
-#define GAMMA_UPLOAD_LOGICOP 0x00002000
-#define GAMMA_UPLOAD_FOG 0x00004000
-#define GAMMA_UPLOAD_LIGHT 0x00008000
-#define GAMMA_UPLOAD_CONTEXT 0x00010000
-#define GAMMA_UPLOAD_TEX0 0x00020000
-#define GAMMA_UPLOAD_STIPPLE 0x00040000
-#define GAMMA_UPLOAD_TRANSFORM 0x00080000
-#define GAMMA_UPLOAD_LINEMODE 0x00100000
-#define GAMMA_UPLOAD_POINTMODE 0x00200000
-#define GAMMA_UPLOAD_TRIMODE 0x00400000
-
-#define GAMMA_NEW_CLIP 0x00000001
-#define GAMMA_NEW_WINDOW 0x00000002
-#define GAMMA_NEW_CONTEXT 0x00000004
-#define GAMMA_NEW_TEXTURE 0x00000008 /* defunct */
-#define GAMMA_NEW_ALPHA 0x00000010
-#define GAMMA_NEW_DEPTH 0x00000020
-#define GAMMA_NEW_MASKS 0x00000040
-#define GAMMA_NEW_POLYGON 0x00000080
-#define GAMMA_NEW_CULL 0x00000100
-#define GAMMA_NEW_LOGICOP 0x00000200
-#define GAMMA_NEW_FOG 0x00000400
-#define GAMMA_NEW_LIGHT 0x00000800
-#define GAMMA_NEW_STIPPLE 0x00001000
-#define GAMMA_NEW_ALL 0xffffffff
-
-#define GAMMA_FALLBACK_TRI 0x00000001
-#define GAMMA_FALLBACK_TEXTURE 0x00000002
-
-#define FLUSH_BATCH(gmesa) do { \
- /*FLUSH_DMA_BUFFER(gmesa);*/ \
-} while(0)
-
-struct gamma_context;
-typedef struct gamma_context gammaContextRec;
-typedef struct gamma_context *gammaContextPtr;
-typedef struct gamma_texture_object_t *gammaTextureObjectPtr;
-
-#define VALID_GAMMA_TEXTURE_OBJECT(tobj) (tobj)
-
-#define GAMMA_TEX_MAXLEVELS 12 /* 2K x 2K */
-
-/* For shared texture space managment, these texture objects may also
- * be used as proxies for regions of texture memory containing other
- * client's textures. Such proxy textures (not to be confused with GL
- * proxy textures) are subject to the same LRU aging we use for our
- * own private textures, and thus we have a mechanism where we can
- * fairly decide between kicking out our own textures and those of
- * other clients.
- *
- * Non-local texture objects have a valid MemBlock to describe the
- * region managed by the other client, and can be identified by
- * 't->globj == 0'
- */
-struct gamma_texture_object_t {
- struct gamma_texture_object_t *next, *prev;
-
- GLuint age;
- struct gl_texture_object *globj;
-
- int Pitch;
- int Height;
- int texelBytes;
- int totalSize;
- int bound;
-
- struct mem_block *MemBlock;
- char * BufAddr;
-
- GLuint min_level;
- GLuint max_level;
- GLuint dirty_images;
-
- GLint firstLevel, lastLevel; /* upload tObj->Image[0][first .. lastLevel] */
-
- struct {
- const struct gl_texture_image *image;
- int offset; /* into BufAddr */
- int height;
- int internalFormat;
- } image[GAMMA_TEX_MAXLEVELS];
-
- uint32_t TextureBaseAddr[GAMMA_TEX_MAXLEVELS];
- uint32_t TextureAddressMode;
- uint32_t TextureColorMode;
- uint32_t TextureFilterMode;
- uint32_t TextureFormat;
- uint32_t TextureReadMode;
- uint32_t TextureBorderColor;
-};
-
-#define GAMMA_NO_PALETTE 0x0
-#define GAMMA_USE_PALETTE 0x1
-#define GAMMA_UPDATE_PALETTE 0x2
-#define GAMMA_FALLBACK_PALETTE 0x4
-
-void gammaUpdateTextureState( GLcontext *ctx );
-
-void gammaDestroyTexObj( gammaContextPtr gmesa, gammaTextureObjectPtr t );
-void gammaSwapOutTexObj( gammaContextPtr gmesa, gammaTextureObjectPtr t );
-void gammaUploadTexImages( gammaContextPtr gmesa, gammaTextureObjectPtr t );
-
-void gammaResetGlobalLRU( gammaContextPtr gmesa );
-void gammaUpdateTexLRU( gammaContextPtr gmesa, gammaTextureObjectPtr t );
-void gammaTexturesGone( gammaContextPtr gmesa,
- GLuint start, GLuint end,
- GLuint in_use );
-
-void gammaEmitHwState( gammaContextPtr gmesa );
-void gammaDDInitExtensions( GLcontext *ctx );
-void gammaDDInitDriverFuncs( GLcontext *ctx );
-void gammaDDInitSpanFuncs( GLcontext *ctx );
-void gammaDDInitState( gammaContextPtr gmesa );
-void gammaInitHW( gammaContextPtr gmesa );
-void gammaDDInitStateFuncs( GLcontext *ctx );
-void gammaDDInitTextureFuncs( struct dd_function_table *table );
-void gammaInitTextureObjects( GLcontext *ctx );
-void gammaDDInitTriFuncs( GLcontext *ctx );
-
-void gammaUpdateWindow( GLcontext *ctx );
-void gammaUpdateViewportOffset( GLcontext *ctx );
-
-void gammaPrintLocalLRU( gammaContextPtr gmesa );
-void gammaPrintGlobalLRU( gammaContextPtr gmesa );
-
-extern void gammaFallback( gammaContextPtr gmesa, GLuint bit, GLboolean mode );
-#define FALLBACK( imesa, bit, mode ) gammaFallback( imesa, bit, mode )
-
-/* Use the templated vertex formats. Only one of these is used in gamma.
- */
-#define TAG(x) gamma##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*gamma_quad_func)( gammaContextPtr,
- const gammaVertex *,
- const gammaVertex *,
- const gammaVertex *,
- const gammaVertex * );
-typedef void (*gamma_tri_func)( gammaContextPtr,
- const gammaVertex *,
- const gammaVertex *,
- const gammaVertex * );
-typedef void (*gamma_line_func)( gammaContextPtr,
- const gammaVertex *,
- const gammaVertex * );
-typedef void (*gamma_point_func)( gammaContextPtr,
- const gammaVertex * );
-
-
-struct gamma_context {
- GLcontext *glCtx; /* Mesa context */
-
- __DRIcontext *driContext;
- __DRIscreen *driScreen;
- __DRIdrawable *driDrawable;
-
- GLuint new_gl_state;
- GLuint new_state;
- GLuint dirty;
-
- GLINTSAREADRIPtr sarea;
-
- /* Mirrors of some DRI state
- */
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
- int driFd;
-
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
-
- dmaBuf buf; /* DMA buffer for regular cmds */
- int bufIndex;
- int bufSize;
- int bufCount;
-
- dmaBuf WCbuf; /* DMA buffer for window changed cmds */
- int WCbufIndex;
- int WCbufSize;
- int WCbufCount;
-
- gammaScreenPtr gammaScreen; /* Screen private DRI data */
-
- int drawOffset;
- int readOffset;
-
- gamma_point_func draw_point;
- gamma_line_func draw_line;
- gamma_tri_func draw_tri;
- gamma_quad_func draw_quad;
-
- GLuint Fallback;
- GLuint RenderIndex;
- GLuint SetupNewInputs;
- GLuint SetupIndex;
-
- GLuint vertex_format;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLubyte *verts;
-
- GLfloat hw_viewport[16];
- GLuint hw_primitive;
- GLenum render_primitive;
-
- GLfloat depth_scale;
-
- gammaTextureObjectPtr CurrentTexObj[2];
- struct gamma_texture_object_t TexObjList;
- struct gamma_texture_object_t SwappedOut;
- GLenum TexEnvImageFmt[2];
-
- struct mem_block *texHeap;
-
- unsigned int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
- unsigned int lastStamp;
-
-
- uint32_t ClearColor;
- uint32_t Color;
- uint32_t DitherMode;
- uint32_t ClearDepth;
- uint32_t FogMode;
- uint32_t AreaStippleMode;
- uint32_t LBReadFormat;
- uint32_t LBWriteFormat;
- uint32_t LineMode;
- uint32_t PointMode;
- uint32_t TriangleMode;
- uint32_t AntialiasMode;
- GLfloat ViewportScaleX;
- GLfloat ViewportScaleY;
- GLfloat ViewportScaleZ;
- GLfloat ViewportOffsetX;
- GLfloat ViewportOffsetY;
- GLfloat ViewportOffsetZ;
- int MatrixMode;
- int DepthMode;
- int TransformMode;
- int LBReadMode;
- int FBReadMode;
- int FBWindowBase;
- int LBWindowBase;
- int ColorDDAMode;
- int GeometryMode;
- int AlphaTestMode;
- int AlphaBlendMode;
- int AB_FBReadMode;
- int AB_FBReadMode_Save;
- int DeltaMode;
- int ColorMaterialMode;
- int FBHardwareWriteMask;
- int MaterialMode;
- int NormalizeMode;
- int LightingMode;
- int Light0Mode;
- int Light1Mode;
- int Light2Mode;
- int Light3Mode;
- int Light4Mode;
- int Light5Mode;
- int Light6Mode;
- int Light7Mode;
- int Light8Mode;
- int Light9Mode;
- int Light10Mode;
- int Light11Mode;
- int Light12Mode;
- int Light13Mode;
- int Light14Mode;
- int Light15Mode;
- int LogicalOpMode;
- int ScissorMode;
- int ScissorMaxXY;
- int ScissorMinXY;
- int Window; /* GID part probably should be in draw priv */
- int WindowOrigin;
- int x, y, w, h; /* Probably should be in drawable priv */
- int FrameCount; /* Probably should be in drawable priv */
- int NotClipped; /* Probably should be in drawable priv */
- int WindowChanged; /* Probably should be in drawabl... */
- int Flags;
- int EnabledFlags;
- int DepthSize;
- int Begin;
- GLenum ErrorValue;
- int Texture1DEnabled;
- int Texture2DEnabled;
-
- float ModelView[16];
- float Proj[16];
- float ModelViewProj[16];
- float Texture[16];
-
- float ModelViewStack[(MAX_MODELVIEW_STACK-1)*16];
- int ModelViewCount;
- float ProjStack[(MAX_PROJECTION_STACK-1)*16];
- int ProjCount;
- float TextureStack[(MAX_TEXTURE_STACK-1)*16];
- int TextureCount;
-};
-
-static INLINE GLuint gammaPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return PACK_COLOR_565( r, g, b );
- case 4:
- return PACK_COLOR_8888( a, r, g, b );
- default:
- return 0;
- }
-}
-
-#define GAMMA_CONTEXT(ctx) ((gammaContextPtr)(ctx->DriverCtx))
-
-#endif /* _GAMMA_CONTEXT_H_ */
diff --git a/src/mesa/drivers/dri/gamma/gamma_dd.c b/src/mesa/drivers/dri/gamma/gamma_dd.c
deleted file mode 100644
index 7a81ef59937..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_dd.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- */
-
-#include "gammacontext.h"
-#include "gamma_vb.h"
-#include "gamma_lock.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-
-#include "main/context.h"
-#include "swrast/swrast.h"
-
-#define GAMMA_DATE "20021125"
-
-
-/* Return the width and height of the current color buffer.
- */
-static void gammaDDGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- GAMMAHW_LOCK( gmesa );
- *width = gmesa->driDrawable->w;
- *height = gmesa->driDrawable->h;
- GAMMAHW_UNLOCK( gmesa );
-}
-
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *gammaDDGetString( GLcontext *ctx, GLenum name )
-{
- static char buffer[128];
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"VA Linux Systems, Inc.";
-
- case GL_RENDERER:
- sprintf( buffer, "Mesa DRI Gamma " GAMMA_DATE );
-
- /* Append any CPU-specific information.
- */
-#ifdef USE_X86_ASM
- if ( _mesa_x86_cpu_features ) {
- strncat( buffer, " x86", 4 );
- }
-#ifdef USE_MMX_ASM
- if ( cpu_has_mmx ) {
- strncat( buffer, "/MMX", 4 );
- }
-#endif
-#ifdef USE_3DNOW_ASM
- if ( cpu_has_3dnow ) {
- strncat( buffer, "/3DNow!", 7 );
- }
-#endif
-#ifdef USE_SSE_ASM
- if ( cpu_has_xmm ) {
- strncat( buffer, "/SSE", 4 );
- }
-#endif
-#endif
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-/* Enable the extensions supported by this driver.
- */
-void gammaDDInitExtensions( GLcontext *ctx )
-{
- /* None... */
-}
-
-/* Initialize the driver's misc functions.
- */
-void gammaDDInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = gammaDDGetBufferSize;
- ctx->Driver.GetString = gammaDDGetString;
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_inithw.c b/src/mesa/drivers/dri/gamma/gamma_inithw.c
deleted file mode 100644
index 525ad89354b..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_inithw.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#include "gammacontext.h"
-#include "glint_dri.h"
-
-void gammaInitHW( gammaContextPtr gmesa )
-{
- GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)gmesa->driScreen->pDevPriv;
- int i;
-
- if (gDRIPriv->numMultiDevices == 2) {
- /* Set up each MX's ScanLineOwnership for OpenGL */
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, BroadcastMask, 1);
- WRITE(gmesa->buf, ScanLineOwnership, 5); /* Use bottom left as [0,0] */
- WRITE(gmesa->buf, BroadcastMask, 2);
- WRITE(gmesa->buf, ScanLineOwnership, 1); /* Use bottom left as [0,0] */
- /* Broadcast to both MX's */
- WRITE(gmesa->buf, BroadcastMask, 3);
- FLUSH_DMA_BUFFER(gmesa);
- }
-
- gmesa->AlphaBlendMode = (AlphaBlendModeDisable |
- AB_Src_One |
- AB_Dst_Zero |
- AB_NoAlphaBufferPresent |
- AB_ColorFmt_8888 |
- AB_ColorOrder_RGB |
- AB_OpenGLType |
- AB_AlphaDst_FBData |
- AB_ColorConversionScale |
- AB_AlphaConversionScale);
-
- gmesa->DitherMode = DitherModeEnable | DM_ColorOrder_RGB;
-
- switch (gmesa->gammaScreen->cpp) {
- case 2:
- gmesa->DitherMode |= DM_ColorFmt_5555;
- gmesa->AlphaBlendMode |= AB_ColorFmt_5555;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PixelSize, 1);
- break;
- case 4:
- gmesa->DitherMode |= DM_ColorFmt_8888;
- gmesa->AlphaBlendMode |= AB_ColorFmt_8888;
- WRITE(gmesa->buf, PixelSize, 0);
- break;
- }
-
- /* FIXME for stencil, gid, etc */
- switch (gmesa->DepthSize) {
- case 16:
- gmesa->LBReadFormat =
- (LBRF_DepthWidth16 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos16 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos24 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos32 );
- gmesa->LBWriteFormat =
- (LBRF_DepthWidth16 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos16 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos24 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos32 );
- break;
- case 24:
- gmesa->LBReadFormat =
- (LBRF_DepthWidth24 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos24 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos32 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos36 );
- gmesa->LBWriteFormat =
- (LBRF_DepthWidth24 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos24 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos32 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos36 );
- break;
- case 32:
- gmesa->LBReadFormat =
- (LBRF_DepthWidth32 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos32 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos40 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos44 );
- gmesa->LBWriteFormat =
- (LBRF_DepthWidth32 |
- LBRF_StencilWidth8 |
- LBRF_StencilPos32 |
- LBRF_FrameCount8 |
- LBRF_FrameCountPos40 |
- LBRF_GIDWidth4 |
- LBRF_GIDPos44 );
- break;
- }
-
- gmesa->FBHardwareWriteMask = 0xffffffff;
- gmesa->FogMode = FogModeDisable;
- gmesa->ClearDepth = 0xffffffff;
- gmesa->AreaStippleMode = AreaStippleModeDisable;
- gmesa->x = 0;
- gmesa->y = 0;
- gmesa->w = 0;
- gmesa->h = 0;
- gmesa->FrameCount = 0;
- gmesa->MatrixMode = GL_MODELVIEW;
- gmesa->ModelViewCount = 0;
- gmesa->ProjCount = 0;
- gmesa->TextureCount = 0;
- gmesa->PointMode = PM_AntialiasQuality_4x4;
- gmesa->LineMode = LM_AntialiasQuality_4x4;
- gmesa->TriangleMode = TM_AntialiasQuality_4x4;
- gmesa->AntialiasMode = AntialiasModeDisable;
-
- for (i = 0; i < 16; i++)
- if (i % 5 == 0)
- gmesa->ModelView[i] =
- gmesa->Proj[i] =
- gmesa->ModelViewProj[i] =
- gmesa->Texture[i] = 1.0;
- else
- gmesa->ModelView[i] =
- gmesa->Proj[i] =
- gmesa->ModelViewProj[i] =
- gmesa->Texture[i] = 0.0;
-
- gmesa->LBReadMode = (LBReadSrcDisable |
- LBReadDstDisable |
- LBDataTypeDefault |
- LBWindowOriginBot |
- gDRIPriv->pprod);
- gmesa->FBReadMode = (FBReadSrcDisable |
- FBReadDstDisable |
- FBDataTypeDefault |
- FBWindowOriginBot |
- gDRIPriv->pprod);
-
- if (gDRIPriv->numMultiDevices == 2) {
- gmesa->LBReadMode |= LBScanLineInt2;
- gmesa->FBReadMode |= FBScanLineInt2;
- gmesa->LBWindowBase = gmesa->driScreen->fbWidth *
- (gmesa->driScreen->fbHeight/2 - 1);
- gmesa->FBWindowBase = gmesa->driScreen->fbWidth *
- (gmesa->driScreen->fbHeight/2 - 1);
- } else {
- gmesa->LBWindowBase = gmesa->driScreen->fbWidth *
- (gmesa->driScreen->fbHeight - 1);
- gmesa->FBWindowBase = gmesa->driScreen->fbWidth *
- (gmesa->driScreen->fbHeight - 1);
- }
-
- gmesa->Begin = (B_AreaStippleDisable |
- B_LineStippleDisable |
- B_AntiAliasDisable |
- B_TextureDisable |
- B_FogDisable |
- B_SubPixelCorrectEnable |
- B_PrimType_Null);
-
- gmesa->ColorDDAMode = (ColorDDAEnable |
- ColorDDAGouraud);
-
- gmesa->GeometryMode = (GM_TextureDisable |
- GM_FogDisable |
- GM_FogExp |
- GM_FrontPolyFill |
- GM_BackPolyFill |
- GM_FrontFaceCCW |
- GM_PolyCullDisable |
- GM_PolyCullBack |
- GM_ClipShortLinesDisable |
- GM_ClipSmallTrisDisable |
- GM_RenderMode |
- GM_Feedback2D |
- GM_CullFaceNormDisable |
- GM_AutoFaceNormDisable |
- GM_GouraudShading |
- GM_UserClipNone |
- GM_PolyOffsetPointDisable |
- GM_PolyOffsetLineDisable |
- GM_PolyOffsetFillDisable |
- GM_InvertFaceNormCullDisable);
-
- gmesa->AlphaTestMode = (AlphaTestModeDisable |
- AT_Always);
-
- gmesa->AB_FBReadMode_Save = gmesa->AB_FBReadMode = 0;
-
- gmesa->Window = (WindowEnable | /* For GID testing */
- W_PassIfEqual |
- (0 << 5)); /* GID part is set from draw priv (below) */
-
- gmesa->NotClipped = GL_FALSE;
- gmesa->WindowChanged = GL_TRUE;
-
- gmesa->Texture1DEnabled = GL_FALSE;
- gmesa->Texture2DEnabled = GL_FALSE;
-
- gmesa->DepthMode |= (DepthModeDisable |
- DM_WriteMask |
- DM_Less);
-
- gmesa->DeltaMode |= (DM_SubPixlCorrectionEnable |
- DM_SmoothShadingEnable |
- DM_Target500TXMX);
-
- gmesa->LightingMode = LightingModeDisable | LightingModeSpecularEnable;
- gmesa->Light0Mode = LNM_Off;
- gmesa->Light1Mode = LNM_Off;
- gmesa->Light2Mode = LNM_Off;
- gmesa->Light3Mode = LNM_Off;
- gmesa->Light4Mode = LNM_Off;
- gmesa->Light5Mode = LNM_Off;
- gmesa->Light6Mode = LNM_Off;
- gmesa->Light7Mode = LNM_Off;
- gmesa->Light8Mode = LNM_Off;
- gmesa->Light9Mode = LNM_Off;
- gmesa->Light10Mode = LNM_Off;
- gmesa->Light11Mode = LNM_Off;
- gmesa->Light12Mode = LNM_Off;
- gmesa->Light13Mode = LNM_Off;
- gmesa->Light14Mode = LNM_Off;
- gmesa->Light15Mode = LNM_Off;
-
- gmesa->LogicalOpMode = LogicalOpModeDisable;
-
- gmesa->MaterialMode = MaterialModeDisable;
-
- gmesa->ScissorMode = UserScissorDisable | ScreenScissorDisable;
-
- gmesa->TransformMode = XM_UseModelViewProjMatrix |
- XM_TexGenModeS_None |
- XM_TexGenModeT_None |
- XM_TexGenModeR_None |
- XM_TexGenModeQ_None;
-
- CHECK_DMA_BUFFER(gmesa, 20);
- WRITE(gmesa->buf, LineStippleMode, 0);
- WRITE(gmesa->buf, RouterMode, 0);
- WRITE(gmesa->buf, TextureAddressMode, 0);
- WRITE(gmesa->buf, TextureReadMode, 0);
- WRITE(gmesa->buf, TextureFilterMode, 0);
- WRITE(gmesa->buf, TextureColorMode, 0);
- WRITE(gmesa->buf, StencilMode, 0);
- WRITE(gmesa->buf, PatternRamMode, 0);
- WRITE(gmesa->buf, ChromaTestMode, 0);
- WRITE(gmesa->buf, StatisticMode, 0);
- WRITE(gmesa->buf, AreaStippleMode, gmesa->AreaStippleMode);
- WRITE(gmesa->buf, ScissorMode, gmesa->ScissorMode);
- WRITE(gmesa->buf, FogMode, gmesa->FogMode);
- WRITE(gmesa->buf, AntialiasMode, gmesa->AntialiasMode);
- WRITE(gmesa->buf, LogicalOpMode, gmesa->LogicalOpMode);
- WRITE(gmesa->buf, TriangleMode, gmesa->TriangleMode);
- WRITE(gmesa->buf, PointMode, gmesa->PointMode);
- WRITE(gmesa->buf, LineMode, gmesa->LineMode);
- WRITE(gmesa->buf, LBWriteFormat, gmesa->LBWriteFormat);
- WRITE(gmesa->buf, LBReadFormat, gmesa->LBReadFormat);
-
- /* Framebuffer initialization */
- CHECK_DMA_BUFFER(gmesa, 10);
- WRITE(gmesa->buf, FBSourceData, 0);
- WRITE(gmesa->buf, FBReadMode, gmesa->FBReadMode);
- if (gmesa->EnabledFlags & GAMMA_BACK_BUFFER) {
- if (gDRIPriv->numMultiDevices == 2) {
- WRITE(gmesa->buf, FBPixelOffset,
- (gmesa->driScreen->fbHeight/2)*gmesa->driScreen->fbWidth);
- } else {
- WRITE(gmesa->buf, FBPixelOffset,
- gmesa->driScreen->fbHeight*gmesa->driScreen->fbWidth);
- }
- } else
- WRITE(gmesa->buf, FBPixelOffset, 0);
- WRITE(gmesa->buf, FBSourceOffset, 0);
- WRITE(gmesa->buf, FBHardwareWriteMask, 0xffffffff);
- WRITE(gmesa->buf, FBSoftwareWriteMask, 0xffffffff);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeEnable);
- WRITE(gmesa->buf, FBWindowBase, gmesa->FBWindowBase);
- WRITE(gmesa->buf, ScreenSize, ((gmesa->driScreen->fbHeight << 16) |
- (gmesa->driScreen->fbWidth)));
- WRITE(gmesa->buf, WindowOrigin, 0x00000000);
-
- /* Localbuffer initialization */
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode);
- WRITE(gmesa->buf, LBSourceOffset, 0);
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeEnable);
- WRITE(gmesa->buf, LBWindowOffset, 0);
- WRITE(gmesa->buf, LBWindowBase, gmesa->LBWindowBase);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 1);
-
- CHECK_DMA_BUFFER(gmesa, 11);
- WRITE(gmesa->buf, DepthMode, gmesa->DepthMode);
- WRITE(gmesa->buf, ColorDDAMode, gmesa->ColorDDAMode);
- WRITE(gmesa->buf, FBBlockColor, 0x00000000);
- WRITE(gmesa->buf, ConstantColor, 0x00000000);
- WRITE(gmesa->buf, AlphaTestMode, gmesa->AlphaTestMode);
- WRITE(gmesa->buf, AlphaBlendMode, gmesa->AlphaBlendMode);
- WRITE(gmesa->buf, DitherMode, gmesa->DitherMode);
- if (gDRIPriv->numMultiDevices == 2)
- WRITE(gmesa->buf, RasterizerMode, RM_MultiGLINT | RM_BiasCoordNearHalf);
- else
- WRITE(gmesa->buf, RasterizerMode, RM_BiasCoordNearHalf);
- WRITE(gmesa->buf, GLINTWindow, gmesa->Window);
- WRITE(gmesa->buf, FastClearDepth, gmesa->ClearDepth);
- WRITE(gmesa->buf, GLINTDepth, gmesa->ClearDepth);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, EdgeFlag, EdgeFlagEnable);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewMatrix0, 1.0);
- WRITEF(gmesa->buf, ModelViewMatrix1, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix2, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix3, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix4, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix5, 1.0);
- WRITEF(gmesa->buf, ModelViewMatrix6, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix7, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix8, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix9, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix10, 1.0);
- WRITEF(gmesa->buf, ModelViewMatrix11, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix12, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix13, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix14, 0.0);
- WRITEF(gmesa->buf, ModelViewMatrix15, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix0, 1.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix1, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix2, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix3, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix4, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix5, 1.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix6, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix7, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix8, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix9, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix10, 1.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix11, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix12, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix13, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix14, 0.0);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix15, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, TextureMatrix0, 1.0);
- WRITEF(gmesa->buf, TextureMatrix1, 0.0);
- WRITEF(gmesa->buf, TextureMatrix2, 0.0);
- WRITEF(gmesa->buf, TextureMatrix3, 0.0);
- WRITEF(gmesa->buf, TextureMatrix4, 0.0);
- WRITEF(gmesa->buf, TextureMatrix5, 1.0);
- WRITEF(gmesa->buf, TextureMatrix6, 0.0);
- WRITEF(gmesa->buf, TextureMatrix7, 0.0);
- WRITEF(gmesa->buf, TextureMatrix8, 0.0);
- WRITEF(gmesa->buf, TextureMatrix9, 0.0);
- WRITEF(gmesa->buf, TextureMatrix10, 1.0);
- WRITEF(gmesa->buf, TextureMatrix11, 0.0);
- WRITEF(gmesa->buf, TextureMatrix12, 0.0);
- WRITEF(gmesa->buf, TextureMatrix13, 0.0);
- WRITEF(gmesa->buf, TextureMatrix14, 0.0);
- WRITEF(gmesa->buf, TextureMatrix15, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, TexGen0, 0.0);
- WRITEF(gmesa->buf, TexGen1, 0.0);
- WRITEF(gmesa->buf, TexGen2, 0.0);
- WRITEF(gmesa->buf, TexGen3, 0.0);
- WRITEF(gmesa->buf, TexGen4, 0.0);
- WRITEF(gmesa->buf, TexGen5, 0.0);
- WRITEF(gmesa->buf, TexGen6, 0.0);
- WRITEF(gmesa->buf, TexGen7, 0.0);
- WRITEF(gmesa->buf, TexGen8, 0.0);
- WRITEF(gmesa->buf, TexGen9, 0.0);
- WRITEF(gmesa->buf, TexGen10, 0.0);
- WRITEF(gmesa->buf, TexGen11, 0.0);
- WRITEF(gmesa->buf, TexGen12, 0.0);
- WRITEF(gmesa->buf, TexGen13, 0.0);
- WRITEF(gmesa->buf, TexGen14, 0.0);
- WRITEF(gmesa->buf, TexGen15, 0.0);
-
- CHECK_DMA_BUFFER(gmesa, 9);
- WRITEF(gmesa->buf, NormalMatrix0, 1.0);
- WRITEF(gmesa->buf, NormalMatrix1, 0.0);
- WRITEF(gmesa->buf, NormalMatrix2, 0.0);
- WRITEF(gmesa->buf, NormalMatrix3, 0.0);
- WRITEF(gmesa->buf, NormalMatrix4, 1.0);
- WRITEF(gmesa->buf, NormalMatrix5, 0.0);
- WRITEF(gmesa->buf, NormalMatrix6, 0.0);
- WRITEF(gmesa->buf, NormalMatrix7, 0.0);
- WRITEF(gmesa->buf, NormalMatrix8, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITEF(gmesa->buf, FogDensity, 0.0);
- WRITEF(gmesa->buf, FogEnd, 0.0);
- WRITEF(gmesa->buf, FogScale, 0.0);
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITEF(gmesa->buf, LineClipLengthThreshold, 0.0);
- WRITEF(gmesa->buf, TriangleClipAreaThreshold, 0.0);
-
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, GeometryMode, gmesa->GeometryMode);
- WRITE(gmesa->buf, NormalizeMode, NormalizeModeDisable);
- WRITE(gmesa->buf, LightingMode, gmesa->LightingMode);
- WRITE(gmesa->buf, ColorMaterialMode, ColorMaterialModeDisable);
- WRITE(gmesa->buf, MaterialMode, MaterialModeDisable);
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, FrontSpecularExponent, 0); /* fixed point */
- WRITE(gmesa->buf, BackSpecularExponent, 0); /* fixed point */
-
- CHECK_DMA_BUFFER(gmesa, 29);
- WRITEF(gmesa->buf, FrontAmbientColorRed, 0.2);
- WRITEF(gmesa->buf, FrontAmbientColorGreen, 0.2);
- WRITEF(gmesa->buf, FrontAmbientColorBlue, 0.2);
- WRITEF(gmesa->buf, BackAmbientColorRed, 0.2);
- WRITEF(gmesa->buf, BackAmbientColorGreen, 0.2);
- WRITEF(gmesa->buf, BackAmbientColorBlue, 0.2);
- WRITEF(gmesa->buf, FrontDiffuseColorRed, 0.8);
- WRITEF(gmesa->buf, FrontDiffuseColorGreen, 0.8);
- WRITEF(gmesa->buf, FrontDiffuseColorBlue, 0.8);
- WRITEF(gmesa->buf, BackDiffuseColorRed, 0.8);
- WRITEF(gmesa->buf, BackDiffuseColorGreen, 0.8);
- WRITEF(gmesa->buf, BackDiffuseColorBlue, 0.8);
- WRITEF(gmesa->buf, FrontSpecularColorRed, 0.0);
- WRITEF(gmesa->buf, FrontSpecularColorGreen, 0.0);
- WRITEF(gmesa->buf, FrontSpecularColorBlue, 0.0);
- WRITEF(gmesa->buf, BackSpecularColorRed, 0.0);
- WRITEF(gmesa->buf, BackSpecularColorGreen, 0.0);
- WRITEF(gmesa->buf, BackSpecularColorBlue, 0.0);
- WRITEF(gmesa->buf, FrontEmissiveColorRed, 0.0);
- WRITEF(gmesa->buf, FrontEmissiveColorGreen, 0.0);
- WRITEF(gmesa->buf, FrontEmissiveColorBlue, 0.0);
- WRITEF(gmesa->buf, BackEmissiveColorRed, 0.0);
- WRITEF(gmesa->buf, BackEmissiveColorGreen, 0.0);
- WRITEF(gmesa->buf, BackEmissiveColorBlue, 0.0);
- WRITEF(gmesa->buf, SceneAmbientColorRed, 0.2);
- WRITEF(gmesa->buf, SceneAmbientColorGreen, 0.2);
- WRITEF(gmesa->buf, SceneAmbientColorBlue, 0.2);
- WRITEF(gmesa->buf, FrontAlpha, 1.0);
- WRITEF(gmesa->buf, BackAlpha, 1.0);
-
- CHECK_DMA_BUFFER(gmesa, 7);
- WRITE(gmesa->buf, PointSize, 1);
- WRITEF(gmesa->buf, AApointSize, 1.0);
- WRITE(gmesa->buf, LineWidth, 1);
- WRITEF(gmesa->buf, AAlineWidth, 1.0);
- WRITE(gmesa->buf, LineWidthOffset, 0);
- WRITE(gmesa->buf, TransformMode, gmesa->TransformMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
-
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITE(gmesa->buf, Light0Mode, LNM_Off);
- WRITE(gmesa->buf, Light1Mode, LNM_Off);
- WRITE(gmesa->buf, Light2Mode, LNM_Off);
- WRITE(gmesa->buf, Light3Mode, LNM_Off);
- WRITE(gmesa->buf, Light4Mode, LNM_Off);
- WRITE(gmesa->buf, Light5Mode, LNM_Off);
- WRITE(gmesa->buf, Light6Mode, LNM_Off);
- WRITE(gmesa->buf, Light7Mode, LNM_Off);
- WRITE(gmesa->buf, Light8Mode, LNM_Off);
- WRITE(gmesa->buf, Light9Mode, LNM_Off);
- WRITE(gmesa->buf, Light10Mode, LNM_Off);
- WRITE(gmesa->buf, Light11Mode, LNM_Off);
- WRITE(gmesa->buf, Light12Mode, LNM_Off);
- WRITE(gmesa->buf, Light13Mode, LNM_Off);
- WRITE(gmesa->buf, Light14Mode, LNM_Off);
- WRITE(gmesa->buf, Light15Mode, LNM_Off);
-
- CHECK_DMA_BUFFER(gmesa, 22);
- WRITEF(gmesa->buf, Light0AmbientIntensityBlue, 0.0);
- WRITEF(gmesa->buf, Light0AmbientIntensityGreen, 0.0);
- WRITEF(gmesa->buf, Light0AmbientIntensityRed, 0.0);
- WRITEF(gmesa->buf, Light0DiffuseIntensityBlue, 1.0);
- WRITEF(gmesa->buf, Light0DiffuseIntensityGreen, 1.0);
- WRITEF(gmesa->buf, Light0DiffuseIntensityRed, 1.0);
- WRITEF(gmesa->buf, Light0SpecularIntensityBlue, 1.0);
- WRITEF(gmesa->buf, Light0SpecularIntensityGreen, 1.0);
- WRITEF(gmesa->buf, Light0SpecularIntensityRed, 1.0);
- WRITEF(gmesa->buf, Light0SpotlightDirectionZ, 0.0);
- WRITEF(gmesa->buf, Light0SpotlightDirectionY, 0.0);
- WRITEF(gmesa->buf, Light0SpotlightDirectionX, -1.0);
- WRITEF(gmesa->buf, Light0SpotlightExponent, 0.0);
- WRITEF(gmesa->buf, Light0PositionZ, 0.0);
- WRITEF(gmesa->buf, Light0PositionY, 0.0);
- WRITEF(gmesa->buf, Light0PositionX, 1.0);
- WRITEF(gmesa->buf, Light0PositionW, 0.0);
- WRITEF(gmesa->buf, Light0CosSpotlightCutoffAngle, -1.0);
- WRITEF(gmesa->buf, Light0ConstantAttenuation, 1.0);
- WRITEF(gmesa->buf, Light0LinearAttenuation, 0.0);
- WRITEF(gmesa->buf, Light0QuadraticAttenuation,0.0);
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITEF(gmesa->buf, XBias, 0.0);
- WRITEF(gmesa->buf, YBias, 0.0);
-
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, ViewPortScaleX, gmesa->driScreen->fbWidth/4);
- WRITEF(gmesa->buf, ViewPortScaleY, gmesa->driScreen->fbHeight/4);
- WRITEF(gmesa->buf, ViewPortScaleZ, 1.0f);
- WRITEF(gmesa->buf, ViewPortOffsetX, gmesa->x);
- WRITEF(gmesa->buf, ViewPortOffsetY, gmesa->y);
- WRITEF(gmesa->buf, ViewPortOffsetZ, 0.0f);
-
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITEF(gmesa->buf, Nz, 1.0);
- WRITEF(gmesa->buf, Ny, 0.0);
- WRITEF(gmesa->buf, Nx, 0.0);
-
- /* Send the initialization commands to the HW */
- FLUSH_DMA_BUFFER(gmesa);
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_lock.c b/src/mesa/drivers/dri/gamma/gamma_lock.c
deleted file mode 100644
index cd4acef24da..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_lock.c
+++ /dev/null
@@ -1,60 +0,0 @@
-
-#include "gammacontext.h"
-#include "gamma_lock.h"
-#include "drirenderbuffer.h"
-
-#ifdef DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-
-/* Update the hardware state. This is called if another context has
- * grabbed the hardware lock, which includes the X server. This
- * function also updates the driver's window state after the X server
- * moves, resizes or restacks a window -- the change will be reflected
- * in the drawable position and clip rects. Since the X server grabs
- * the hardware lock when it changes the window state, this routine will
- * automatically be called after such a change.
- */
-void gammaGetLock( gammaContextPtr gmesa, GLuint flags )
-{
- __DRIdrawable *dPriv = gmesa->driDrawable;
- __DRIscreen *sPriv = gmesa->driScreen;
-
- drmGetLock( gmesa->driFd, gmesa->hHWContext, flags );
-
- /* The window might have moved, so we might need to get new clip
- * rects.
- *
- * NOTE: This releases and regrabs the hw lock to allow the X server
- * to respond to the DRI protocol request for new drawable info.
- * Since the hardware state depends on having the latest drawable
- * clip rects, all state checking must be done _after_ this call.
- */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
-
- if ( gmesa->lastStamp != dPriv->lastStamp ) {
- driUpdateFramebufferSize(gmesa->glCtx, dPriv);
- gmesa->lastStamp = dPriv->lastStamp;
- gmesa->new_state |= GAMMA_NEW_WINDOW | GAMMA_NEW_CLIP;
- }
-
- gmesa->numClipRects = dPriv->numClipRects;
- gmesa->pClipRects = dPriv->pClipRects;
-
-#if 0
- gmesa->dirty = ~0;
-
- if ( sarea->ctxOwner != gmesa->hHWContext ) {
- sarea->ctxOwner = gmesa->hHWContext;
- gmesa->dirty = GAMMA_UPLOAD_ALL;
- }
-
- for ( i = 0 ; i < gmesa->lastTexHeap ; i++ ) {
- if ( sarea->texAge[i] != gmesa->lastTexAge[i] ) {
- gammaAgeTextures( gmesa, i );
- }
- }
-#endif
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_lock.h b/src/mesa/drivers/dri/gamma/gamma_lock.h
deleted file mode 100644
index 2d117320da2..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_lock.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef __GAMMA_LOCK_H__
-#define __GAMMA_LOCK_H__
-
-extern void gammaGetLock( gammaContextPtr gmesa, GLuint flags );
-
-/* Turn DEBUG_LOCKING on to find locking conflicts.
- */
-#define DEBUG_LOCKING 0
-
-#if DEBUG_LOCKING
-extern char *prevLockFile;
-extern int prevLockLine;
-
-#define DEBUG_LOCK() \
- do { \
- prevLockFile = (__FILE__); \
- prevLockLine = (__LINE__); \
- } while (0)
-
-#define DEBUG_RESET() \
- do { \
- prevLockFile = 0; \
- prevLockLine = 0; \
- } while (0)
-
-#define DEBUG_CHECK_LOCK() \
- do { \
- if ( prevLockFile ) { \
- fprintf( stderr, \
- "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
- exit( 1 ); \
- } \
- } while (0)
-
-#else
-
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-
-#endif
-
-/*
- * !!! We may want to separate locks from locks with validation. This
- * could be used to improve performance for those things commands that
- * do not do any drawing !!!
- */
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( gmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( gmesa->driHwLock, gmesa->hHWContext, \
- (DRM_LOCK_HELD | gmesa->hHWContext), __ret ); \
- if ( __ret ) \
- gammaGetLock( gmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware.
- */
-#define UNLOCK_HARDWARE( gmesa ) \
- do { \
- DRM_UNLOCK( gmesa->driFd, \
- gmesa->driHwLock, \
- gmesa->hHWContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#define GAMMAHW_LOCK( gmesa ) \
- DRM_UNLOCK(gmesa->driFd, gmesa->driHwLock, gmesa->hHWContext); \
- DRM_SPINLOCK(&gmesa->driScreen->pSAREA->drawable_lock, \
- gmesa->driScreen->drawLockID); \
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
-
-#define GAMMAHW_UNLOCK( gmesa ) \
- DRM_SPINUNLOCK(&gmesa->driScreen->pSAREA->drawable_lock, \
- gmesa->driScreen->drawLockID); \
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa);
-
-#endif /* __GAMMA_LOCK_H__ */
diff --git a/src/mesa/drivers/dri/gamma/gamma_macros.h b/src/mesa/drivers/dri/gamma/gamma_macros.h
deleted file mode 100644
index d962dcdb566..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_macros.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- */
-
-#ifndef _GAMMA_MACROS_H_
-#define _GAMMA_MACROS_H_
-
-#define DEBUG_DRMDMA
-#define DEBUG_ERRORS
-#define DEBUG_COMMANDS_NOT
-#define DEBUG_VERBOSE_NOT
-#define DEBUG_VERBOSE_EXTRA_NOT
-
-#define RANDOMIZE_COLORS_NOT
-#define TURN_OFF_CLEARS_NOT
-#define CULL_ALL_PRIMS_NOT
-#define TURN_OFF_DEPTH_NOT
-#define TURN_OFF_BLEND_NOT
-#define FAST_CLEAR_4_NOT
-#define FORCE_DEPTH32_NOT
-#define DONT_SEND_DMA_NOT
-#define TURN_OFF_FCP_NOT
-#define TURN_OFF_TEXTURES_NOT
-#define DO_VALIDATE
-
-#define GAMMA_DMA_BUFFER_SIZE 4096
-
-#if 0
-#define GAMMA_DMA_SEND_FLAGS DRM_DMA_PRIORITY
-#define GAMMA_DMA_SEND_FLAGS DRM_DMA_BLOCK
-#else
-/* MUST use non-blocking dma flags for drawable lock routines */
-#define GAMMA_DMA_SEND_FLAGS 0
-#endif
-
-#if 0
-#define GAMMA_DMA_GET_FLAGS \
- (DRM_DMA_SMALLER_OK | DRM_DMA_LARGER_OK | DRM_DMA_WAIT)
-#else
-#define GAMMA_DMA_GET_FLAGS DRM_DMA_WAIT
-#endif
-
-#if defined(DEBUG_DRMDMA) || defined(DEBUG_COMMANDS) || defined(DEBUG_VERBOSE)
-#include <stdio.h>
-#endif
-
-/* Note: The argument to DEBUG_GLCMDS() _must_ be enclosed in parenthesis */
-#ifdef DEBUG_VERBOSE
-#define DEBUG_GLCMDS(s) printf s
-#else
-#define DEBUG_GLCMDS(s)
-#endif
-
-/* Note: The argument to DEBUG_DMACMDS() _must_ be enclosed in parenthesis */
-#ifdef DEBUG_DRMDMA
-#define DEBUG_DMACMDS(s) printf s
-#else
-#define DEBUG_DMACMDS(s)
-#endif
-
-/* Note: The argument to DEBUG_WRITE() _must_ be enclosed in parenthesis */
-#ifdef DEBUG_COMMANDS
-#define DEBUG_WRITE(s) printf s
-#else
-#define DEBUG_WRITE(s)
-#endif
-
-/* Note: The argument to DEBUG_ERROR() _must_ be enclosed in parenthesis */
-#ifdef DEBUG_ERRORS
-#define DEBUG_ERROR(s) printf s
-#else
-#define DEBUG_ERROR(s)
-#endif
-
-#define WRITEV(buf,val1,val2,val3,val4) \
-do { \
- buf++->i = 0x9C008300; \
- buf++->f = val1; \
- buf++->f = val2; \
- buf++->f = val3; \
- buf++->f = val4; \
-} while (0)
-
-#define WRITE(buf,reg,val) \
-do { \
- buf++->i = Glint##reg##Tag; \
- buf++->i = val; \
- DEBUG_WRITE(("WRITE(buf, %s, 0x%08x);\n", #reg, (int)val)); \
-} while (0)
-
-#define WRITEF(buf,reg,val) \
-do { \
- buf++->i = Glint##reg##Tag; \
- buf++->f = val; \
- DEBUG_WRITE(("WRITEF(buf, %s, %f);\n", #reg, (float)val)); \
-} while (0)
-
-#define CHECK_WC_DMA_BUFFER(gcp,n) \
-do { \
- (gcp)->WCbufCount += (n<<1); \
-} while (0)
-
-#define CHECK_DMA_BUFFER(gcp,n) \
-do { \
- if ((gcp)->bufCount+(n<<1) >= (gcp)->bufSize) \
- PROCESS_DMA_BUFFER(gcp); \
- (gcp)->bufCount += (n<<1); \
-} while (0)
-
-#define CHECK_DMA_BUFFER2(gcp,n) \
-do { \
- if ((gcp)->bufCount+n >= (gcp)->bufSize) \
- PROCESS_DMA_BUFFER(gcp); \
- (gcp)->bufCount += n; \
-} while (0)
-
-#define FLUSH_DMA_BUFFER(gcp) \
-do { \
- if (gcp->bufCount) \
- PROCESS_DMA_BUFFER(gcp); \
-} while (0)
-
-#ifdef DONT_SEND_DMA
-#define GET_DMA(fd, hHWCtx, n, idx, size)
-#define SEND_DMA(fd, hHWCtx,n, idx, cnt)
-#else
-#define GET_DMA(fd, hHWCtx, n, idx, size) \
-do { \
- drmDMAReq dma; \
- int retcode, i; \
- \
- dma.context = (hHWCtx); \
- dma.send_count = 0; \
- dma.send_list = NULL; \
- dma.send_sizes = NULL; \
- dma.flags = GAMMA_DMA_GET_FLAGS; \
- dma.request_count = (n); \
- dma.request_size = GAMMA_DMA_BUFFER_SIZE; \
- dma.request_list = (idx); \
- dma.request_sizes = (size); \
- \
- do { \
- if ((retcode = drmDMA((fd), &dma))) { \
- DEBUG_DMACMDS(("drmDMA returned %d\n", retcode)); \
- } \
- } while (!(dma).granted_count); \
- \
- for (i = 0; i < (n); i++) { \
- (size)[i] >>= 2; /* Convert from bytes to words */ \
- } \
-} while (0)
-
-#define SEND_DMA(fd, hHWCtx, n, idx, cnt) \
-do { \
- drmDMAReq dma; \
- int retcode, i; \
- \
- for (i = 0; i < (n); i++) { \
- (cnt)[i] <<= 2; /* Convert from words to bytes */ \
- } \
- \
- dma.context = (hHWCtx); \
- dma.send_count = 1; \
- dma.send_list = (idx); \
- dma.send_sizes = (cnt); \
- dma.flags = GAMMA_DMA_SEND_FLAGS; \
- dma.request_count = 0; \
- dma.request_size = 0; \
- dma.request_list = NULL; \
- dma.request_sizes = NULL; \
- \
- if ((retcode = drmDMA((fd), &dma))) { \
- DEBUG_DMACMDS(("drmDMA returned %d\n", retcode)); \
- } \
- \
- for (i = 0; i < (n); i++) { \
- (cnt)[i] = 0; \
- } \
-} while (0)
-#endif
-
-#define GET_FIRST_DMA(fd, hHWCtx, n, idx, size, buf, cnt, gPriv) \
-do { \
- int i; \
- \
- GET_DMA(fd, hHWCtx, n, idx, size); \
- \
- for (i = 0; i < (n); i++) { \
- (buf)[i] = (dmaBuf)(gPriv)->bufs->list[(idx)[i]].address; \
- (cnt)[i] = 0; \
- } \
-} while (0)
-
-#define PROCESS_DMA_BUFFER_TOP_HALF(gcp) \
-do { \
- SEND_DMA((gcp)->driFd, \
- (gcp)->hHWContext, 1, &(gcp)->bufIndex, &(gcp)->bufCount); \
-} while (0)
-
-#define PROCESS_DMA_BUFFER_BOTTOM_HALF(gcp) \
-do { \
- GET_DMA((gcp)->driFd, \
- (gcp)->hHWContext, 1, &(gcp)->bufIndex, &(gcp)->bufSize); \
- \
- (gcp)->buf = \
- (dmaBuf)(gcp)->gammaScreen->bufs->list[(gcp)->bufIndex].address; \
-} while (0)
-
-#define PROCESS_DMA_BUFFER(gcp) \
-do { \
- VALIDATE_DRAWABLE_INFO(gcp); \
- PROCESS_DMA_BUFFER_TOP_HALF(gcp); \
- PROCESS_DMA_BUFFER_BOTTOM_HALF(gcp); \
-} while (0)
-
-#ifdef DO_VALIDATE
-#define VALIDATE_DRAWABLE_INFO_NO_LOCK(gcp) \
-do { \
- /*__DRIscreen *psp = gcp->driScreen;*/ \
- __DRIdrawable *pdp = gcp->driDrawable; \
- \
- if (*(pdp->pStamp) != pdp->lastStamp) { \
- int old_index = pdp->index; \
- while (*(pdp->pStamp) != pdp->lastStamp) { \
- DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \
- } \
- if (pdp->index != old_index) { \
- gcp->Window &= ~W_GIDMask; \
- gcp->Window |= (pdp->index << 5); \
- CHECK_WC_DMA_BUFFER(gcp, 1); \
- WRITE(gcp->WCbuf, GLINTWindow, gcp->Window|(gcp->FrameCount<<9));\
- } \
- \
- gammaUpdateViewportOffset( gcp->glCtx); \
- \
- if (pdp->numClipRects == 1 && \
- pdp->pClipRects->x1 == pdp->x && \
- pdp->pClipRects->x2 == (pdp->x+pdp->w) && \
- pdp->pClipRects->y1 == pdp->y && \
- pdp->pClipRects->y2 == (pdp->y+pdp->h)) { \
- CHECK_WC_DMA_BUFFER(gcp, 1); \
- WRITE(gcp->WCbuf, Rectangle2DControl, 0); \
- gcp->NotClipped = GL_TRUE; \
- } else { \
- CHECK_WC_DMA_BUFFER(gcp, 1); \
- WRITE(gcp->WCbuf, Rectangle2DControl, 1); \
- gcp->NotClipped = GL_FALSE; \
- } \
- gcp->WindowChanged = GL_TRUE; \
- \
- if (gcp->WCbufCount) { \
- SEND_DMA((gcp)->gammaScreen->driScreen->fd, \
- (gcp)->hHWContext, 1, &(gcp)->WCbufIndex, \
- &(gcp)->WCbufCount); \
- (gcp)->WCbufIndex = -1; \
- } \
- } \
-} while (0)
-
-#define VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gcp) \
-do { \
- if ((gcp)->WCbufIndex < 0) { \
- GET_DMA((gcp)->gammaScreen->driScreen->fd, \
- (gcp)->hHWContext, 1, &(gcp)->WCbufIndex, \
- &(gcp)->WCbufSize); \
- \
- (gcp)->WCbuf = \
- (dmaBuf)(gcp)->gammaScreen->bufs-> \
- list[(gcp)->WCbufIndex].address; \
- } \
-} while (0)
-
-#define VALIDATE_DRAWABLE_INFO(gcp) \
-do { \
- __DRIscreen *psp = gcp->driScreen; \
-if (gcp->driDrawable) { \
- DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gcp); \
- DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gcp); \
-} \
-} while (0)
-#else
-#define VALIDATE_DRAWABLE_INFO(gcp)
-#endif
-
-#define CALC_LOG2(l2,s) \
-do { \
- int __s = s; \
- l2 = 0; \
- while (__s > 1) { ++l2; __s >>= 1; } \
-} while (0)
-
-#endif /* _GAMMA_MACROS_H_ */
diff --git a/src/mesa/drivers/dri/gamma/gamma_regs.h b/src/mesa/drivers/dri/gamma/gamma_regs.h
deleted file mode 100644
index 9e1c735019d..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_regs.h
+++ /dev/null
@@ -1,658 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- */
-
-#ifndef _GAMMA_REGS_H_
-#define _GAMMA_REGS_H_
-
-#include "gamma_client.h"
-
-/**************** MX FLAGS ****************/
-/* FBReadMode */
-#define FBReadSrcDisable 0x00000000
-#define FBReadSrcEnable 0x00000200
-#define FBReadDstDisable 0x00000000
-#define FBReadDstEnable 0x00000400
-#define FBDataTypeDefault 0x00000000
-#define FBDataTypeColor 0x00008000
-#define FBWindowOriginTop 0x00000000
-#define FBWindowOriginBot 0x00010000
-#define FBScanLineInt1 0x00000000
-#define FBScanLineInt2 0x00800000
-#define FBScanLineInt4 0x01000000
-#define FBScanLineInt8 0x01800000
-#define FBSrcAddrConst 0x00000000
-#define FBSrcAddrIndex 0x10000000
-#define FBSrcAddrCoord 0x20000000
-
-/* LBReadMode */
-#define LBPartialProdMask 0x000001ff
-#define LBReadSrcDisable 0x00000000
-#define LBReadSrcEnable 0x00000200
-#define LBReadDstDisable 0x00000000
-#define LBReadDstEnable 0x00000400
-#define LBDataTypeDefault 0x00000000
-#define LBDataTypeStencil 0x00010000
-#define LBDataTypeDepth 0x00020000
-#define LBWindowOriginTop 0x00000000
-#define LBWindowOriginBot 0x00040000
-#define LBScanLineInt1 0x00000000
-#define LBScanLineInt2 0x00100000
-#define LBScanLineInt4 0x00200000
-#define LBScanLineInt8 0x00300000
-
-/* ColorDDAMode */
-#define ColorDDADisable 0x00000000
-#define ColorDDAEnable 0x00000001
-#define ColorDDAFlat 0x00000000
-#define ColorDDAGouraud 0x00000002
-#define ColorDDAShadingMask 0x00000002
-
-/* AlphaTestMode */
-#define AlphaTestModeDisable 0x00000000
-#define AlphaTestModeEnable 0x00000001
-#define AT_Never 0x00000000
-#define AT_Less 0x00000002
-#define AT_Equal 0x00000004
-#define AT_LessEqual 0x00000006
-#define AT_Greater 0x00000008
-#define AT_NotEqual 0x0000000a
-#define AT_GreaterEqual 0x0000000c
-#define AT_Always 0x0000000e
-#define AT_CompareMask 0x0000000e
-#define AT_RefValueMask 0x00000ff0
-
-/* AlphaBlendMode */
-#define AlphaBlendModeDisable 0x00000000
-#define AlphaBlendModeEnable 0x00000001
-#define AB_Src_Zero 0x00000000
-#define AB_Src_One 0x00000002
-#define AB_Src_DstColor 0x00000004
-#define AB_Src_OneMinusDstColor 0x00000006
-#define AB_Src_SrcAlpha 0x00000008
-#define AB_Src_OneMinusSrcAlpha 0x0000000a
-#define AB_Src_DstAlpha 0x0000000c
-#define AB_Src_OneMinusDstAlpha 0x0000000e
-#define AB_Src_SrcAlphaSaturate 0x00000010
-#define AB_SrcBlendMask 0x0000001e
-#define AB_Dst_Zero 0x00000000
-#define AB_Dst_One 0x00000020
-#define AB_Dst_SrcColor 0x00000040
-#define AB_Dst_OneMinusSrcColor 0x00000060
-#define AB_Dst_SrcAlpha 0x00000080
-#define AB_Dst_OneMinusSrcAlpha 0x000000a0
-#define AB_Dst_DstAlpha 0x000000c0
-#define AB_Dst_OneMinusDstAlpha 0x000000e0
-#define AB_DstBlendMask 0x000000e0
-#define AB_ColorFmt_8888 0x00000000
-#define AB_ColorFmt_5555 0x00000100
-#define AB_ColorFmt_4444 0x00000200
-#define AB_ColorFmt_4444Front 0x00000300
-#define AB_ColorFmt_4444Back 0x00000400
-#define AB_ColorFmt_332Front 0x00000500
-#define AB_ColorFmt_332Back 0x00000600
-#define AB_ColorFmt_121Front 0x00000700
-#define AB_ColorFmt_121Back 0x00000800
-#define AB_ColorFmt_555Back 0x00000d00
-#define AB_ColorFmt_CI8 0x00000e00
-#define AB_ColorFmt_CI4 0x00000f00
-#define AB_AlphaBufferPresent 0x00000000
-#define AB_NoAlphaBufferPresent 0x00001000
-#define AB_ColorOrder_BGR 0x00000000
-#define AB_ColorOrder_RGB 0x00002000
-#define AB_OpenGLType 0x00000000
-#define AB_QuickDraw3DType 0x00004000
-#define AB_AlphaDst_FBData 0x00000000
-#define AB_AlphaDst_FBSourceData 0x00008000
-#define AB_ColorConversionScale 0x00000000
-#define AB_ColorConversionShift 0x00010000
-#define AB_AlphaConversionScale 0x00000000
-#define AB_AlphaConversionShift 0x00020000
-
-/* AntialiasMode */
-#define AntialiasModeDisable 0x00000000
-#define AntialiasModeEnable 0x00000001
-
-/* AreaStippleMode */
-#define AreaStippleModeDisable 0x00000000
-#define AreaStippleModeEnable 0x00000001
-#define ASM_X32 0x00000008
-#define ASM_Y32 0x00000040
-
-/* DepthMode */
-#define DepthModeDisable 0x00000000
-#define DepthModeEnable 0x00000001
-#define DM_WriteMask 0x00000002
-#define DM_SourceFragment 0x00000000
-#define DM_SourceLBData 0x00000004
-#define DM_SourceDepthRegister 0x00000008
-#define DM_SourceLBSourceData 0x0000000c
-#define DM_SourceMask 0x0000000c
-#define DM_Never 0x00000000
-#define DM_Less 0x00000010
-#define DM_Equal 0x00000020
-#define DM_LessEqual 0x00000030
-#define DM_Greater 0x00000040
-#define DM_NotEqual 0x00000050
-#define DM_GreaterEqual 0x00000060
-#define DM_Always 0x00000070
-#define DM_CompareMask 0x00000070
-
-/* FBWriteMode */
-#define FBWriteModeDisable 0x00000000
-#define FBWriteModeEnable 0x00000001
-#define FBW_UploadColorData 0x00000008
-
-/* FogMode */
-#define FogModeDisable 0x00000000
-#define FogModeEnable 0x00000001
-
-/* LBWriteMode */
-#define LBWriteModeDisable 0x00000000
-#define LBWriteModeEnable 0x00000001
-#define LBW_UploadNone 0x00000000
-#define LBW_UploadDepth 0x00000002
-#define LBW_UploadStencil 0x00000004
-
-/* LBRead/Write Format */
-#define LBRF_DepthWidth15 0x03 /* only permedia */
-#define LBRF_DepthWidth16 0x00
-#define LBRF_DepthWidth24 0x01
-#define LBRF_DepthWidth32 0x02
-#define LBRF_StencilWidth0 (0 << 2)
-#define LBRF_StencilWidth4 (1 << 2)
-#define LBRF_StencilWidth8 (2 << 2)
-#define LBRF_StencilPos16 (0 << 4)
-#define LBRF_StencilPos20 (1 << 4)
-#define LBRF_StencilPos24 (2 << 4)
-#define LBRF_StencilPos28 (3 << 4)
-#define LBRF_StencilPos32 (4 << 4)
-#define LBRF_FrameCount0 (0 << 7)
-#define LBRF_FrameCount4 (1 << 7)
-#define LBRF_FrameCount8 (2 << 7)
-#define LBRF_FrameCountPos16 (0 << 9)
-#define LBRF_FrameCountPos20 (1 << 9)
-#define LBRF_FrameCountPos24 (2 << 9)
-#define LBRF_FrameCountPos28 (3 << 9)
-#define LBRF_FrameCountPos32 (4 << 9)
-#define LBRF_FrameCountPos36 (5 << 9)
-#define LBRF_FrameCountPos40 (6 << 9)
-#define LBRF_GIDWidth0 (0 << 12)
-#define LBRF_GIDWidth4 (1 << 12)
-#define LBRF_GIDPos16 (0 << 13)
-#define LBRF_GIDPos20 (1 << 13)
-#define LBRF_GIDPos24 (2 << 13)
-#define LBRF_GIDPos28 (3 << 13)
-#define LBRF_GIDPos32 (4 << 13)
-#define LBRF_GIDPos36 (5 << 13)
-#define LBRF_GIDPos40 (6 << 13)
-#define LBRF_GIDPos44 (7 << 13)
-#define LBRF_GIDPos48 (8 << 13)
-#define LBRF_Compact32 (1 << 17)
-
-/* StencilMode */
-#define StencilDisable 0x00000000
-#define StencilEnable 0x00000001
-
-/* RouterMode */
-#define R_Order_TextureDepth 0x00000000
-#define R_Order_DepthTexture 0x00000001
-
-/* ScissorMode */
-#define UserScissorDisable 0x00000000
-#define UserScissorEnable 0x00000001
-#define ScreenScissorDisable 0x00000000
-#define ScreenScissorEnable 0x00000002
-
-/* DitherMode */
-#define DitherModeDisable 0x00000000
-#define DitherModeEnable 0x00000001
-#define DM_DitherDisable 0x00000000
-#define DM_DitherEnable 0x00000002
-#define DM_ColorFmt_8888 0x00000000
-#define DM_ColorFmt_5555 0x00000004
-#define DM_ColorFmt_4444 0x00000008
-#define DM_ColorFmt_4444Front 0x0000000c
-#define DM_ColorFmt_4444Back 0x00000010
-#define DM_ColorFmt_332Front 0x00000014
-#define DM_ColorFmt_332Back 0x00000018
-#define DM_ColorFmt_121Front 0x0000001c
-#define DM_ColorFmt_121Back 0x00000020
-#define DM_ColorFmt_555Back 0x00000024
-#define DM_ColorFmt_CI8 0x00000028
-#define DM_ColorFmt_CI4 0x0000002c
-#define DM_XOffsetMask 0x000000c0
-#define DM_YOffsetMask 0x00000300
-#define DM_ColorOrder_BGR 0x00000000
-#define DM_ColorOrder_RGB 0x00000400
-#define DM_AlphaDitherDefault 0x00000000
-#define DM_AlphaDitherNone 0x00004000
-#define DM_Truncate 0x00000000
-#define DM_Round 0x00008000
-
-/* RasterizerMode */
-#define RM_MirrorBitMask 0x00000001
-#define RM_InvertBitMask 0x00000002
-#define RM_FractionAdjNo 0x00000000
-#define RM_FractionAdjZero 0x00000004
-#define RM_FractionAdjHalf 0x00000008
-#define RM_FractionAdjNearHalf 0x0000000c
-#define RM_BiasCoordZero 0x00000000
-#define RM_BiasCoordHalf 0x00000010
-#define RM_BiasCoordNearHalf 0x00000020
-#define RM_BitMaskByteSwap_ABCD 0x00000000
-#define RM_BitMaskByteSwap_BADC 0x00000080
-#define RM_BitMaskByteSwap_CDAB 0x00000100
-#define RM_BitMaskByteSwap_DCBA 0x00000180
-#define RM_BitMaskPacked 0x00000000
-#define RM_BitMaskEveryScanline 0x00000200
-#define RM_BitMaskOffsetMask 0x00007c00
-#define RM_HostDataByteSwap_ABCD 0x00000000
-#define RM_HostDataByteSwap_BADC 0x00008000
-#define RM_HostDataByteSwap_CDAB 0x00010000
-#define RM_HostDataByteSwap_DCBA 0x00018000
-#define RM_SingleGLINT 0x00000000
-#define RM_MultiGLINT 0x00020000
-#define RM_YLimitsEnable 0x00040000
-
-/* Window */
-#define WindowDisable 0x00000000
-#define WindowEnable 0x00000001
-#define W_AlwaysPass 0x00000000
-#define W_NeverPass 0x00000002
-#define W_PassIfEqual 0x00000004
-#define W_PassIfNotEqual 0x00000006
-#define W_CompareMask 0x00000006
-#define W_ForceLBUpdate 0x00000008
-#define W_LBUpdateFromSource 0x00000000
-#define W_LBUpdateFromRegisters 0x00000010
-#define W_GIDMask 0x000001e0
-#define W_FrameCountMask 0x0001fe00
-#define W_StencilFCP 0x00020000
-#define W_DepthFCP 0x00040000
-#define W_OverrideWriteFiltering 0x00080000
-
-/* TextureAddressMode */
-#define TextureAddressModeDisable 0x00000000
-#define TextureAddressModeEnable 0x00000001
-#define TAM_SWrap_Clamp 0x00000000
-#define TAM_SWrap_Repeat 0x00000002
-#define TAM_SWrap_Mirror 0x00000004
-#define TAM_SWrap_Mask 0x00000006
-#define TAM_TWrap_Clamp 0x00000000
-#define TAM_TWrap_Repeat 0x00000008
-#define TAM_TWrap_Mirror 0x00000010
-#define TAM_TWrap_Mask 0x00000018
-#define TAM_Operation_2D 0x00000000
-#define TAM_Operation_3D 0x00000020
-#define TAM_InhibitDDAInit 0x00000040
-#define TAM_LODDisable 0x00000000
-#define TAM_LODEnable 0x00000080
-#define TAM_DY_Disable 0x00000000
-#define TAM_DY_Enable 0x00000100
-#define TAM_WidthMask 0x00001e00
-#define TAM_HeightMask 0x0001e000
-#define TAM_TexMapType_1D 0x00000000
-#define TAM_TexMapType_2D 0x00020000
-#define TAM_TexMapType_Mask 0x00020000
-
-/* TextureReadMode */
-#define TextureReadModeDisable 0x00000000
-#define TextureReadModeEnable 0x00000001
-#define TRM_WidthMask 0x0000001e
-#define TRM_HeightMask 0x000001e0
-#define TRM_Depth1 0x00000000
-#define TRM_Depth2 0x00000200
-#define TRM_Depth4 0x00000400
-#define TRM_Depth8 0x00000600
-#define TRM_Depth16 0x00000800
-#define TRM_Depth32 0x00000a00
-#define TRM_DepthMask 0x00000e00
-#define TRM_Border 0x00001000
-#define TRM_Patch 0x00002000
-#define TRM_Mag_Nearest 0x00000000
-#define TRM_Mag_Linear 0x00004000
-#define TRM_Mag_Mask 0x00004000
-#define TRM_Min_Nearest 0x00000000
-#define TRM_Min_Linear 0x00008000
-#define TRM_Min_NearestMMNearest 0x00010000
-#define TRM_Min_NearestMMLinear 0x00018000
-#define TRM_Min_LinearMMNearest 0x00020000
-#define TRM_Min_LinearMMLinear 0x00028000
-#define TRM_Min_Mask 0x00038000
-#define TRM_UWrap_Clamp 0x00000000
-#define TRM_UWrap_Repeat 0x00040000
-#define TRM_UWrap_Mirror 0x00080000
-#define TRM_UWrap_Mask 0x000c0000
-#define TRM_VWrap_Clamp 0x00000000
-#define TRM_VWrap_Repeat 0x00100000
-#define TRM_VWrap_Mirror 0x00200000
-#define TRM_VWrap_Mask 0x00300000
-#define TRM_TexMapType_1D 0x00000000
-#define TRM_TexMapType_2D 0x00400000
-#define TRM_TexMapType_Mask 0x00400000
-#define TRM_MipMapDisable 0x00000000
-#define TRM_MipMapEnable 0x00800000
-#define TRM_PrimaryCacheDisable 0x00000000
-#define TRM_PrimaryCacheEnable 0x01000000
-#define TRM_FBSourceAddr_None 0x00000000
-#define TRM_FBSourceAddr_Index 0x02000000
-#define TRM_FBSourceAddr_Coord 0x04000000
-#define TRM_BorderClamp 0x08000000
-
-/* TextureColorMode */
-#define TextureColorModeDisable 0x00000000
-#define TextureColorModeEnable 0x00000001
-#define TCM_Modulate 0x00000000
-#define TCM_Decal 0x00000002
-#define TCM_Blend 0x00000004
-#define TCM_Replace 0x00000006
-#define TCM_ApplicationMask 0x0000000e
-#define TCM_OpenGLType 0x00000000
-#define TCM_QuickDraw3DType 0x00000010
-#define TCM_KdDDA_Disable 0x00000000
-#define TCM_KdDDA_Enable 0x00000020
-#define TCM_KsDDA_Disable 0x00000000
-#define TCM_KsDDA_Enable 0x00000040
-#define TCM_BaseFormat_Alpha 0x00000000
-#define TCM_BaseFormat_Lum 0x00000080
-#define TCM_BaseFormat_LumAlpha 0x00000100
-#define TCM_BaseFormat_Intensity 0x00000180
-#define TCM_BaseFormat_RGB 0x00000200
-#define TCM_BaseFormat_RGBA 0x00000280
-#define TCM_BaseFormatMask 0x00000380
-#define TCM_LoadMode_None 0x00000000
-#define TCM_LoadMode_Ks 0x00000400
-#define TCM_LoadMode_Kd 0x00000800
-
-/* TextureCacheControl */
-#define TCC_Invalidate 0x00000001
-#define TCC_Disable 0x00000000
-#define TCC_Enable 0x00000002
-
-/* TextureFilterMode */
-#define TextureFilterModeDisable 0x00000000
-#define TextureFilterModeEnable 0x00000001
-#define TFM_AlphaMapEnable 0x00000002
-#define TFM_AlphaMapSense 0x00000004
-
-/* TextureFormat */
-#define TF_LittleEndian 0x00000000
-#define TF_BigEndian 0x00000001
-#define TF_16Bit_565 0x00000000
-#define TF_16Bit_555 0x00000002
-#define TF_ColorOrder_BGR 0x00000000
-#define TF_ColorOrder_RGB 0x00000004
-#define TF_Compnents_1 0x00000000
-#define TF_Compnents_2 0x00000008
-#define TF_Compnents_3 0x00000010
-#define TF_Compnents_4 0x00000018
-#define TF_CompnentsMask 0x00000018
-#define TF_OutputFmt_Texel 0x00000000
-#define TF_OutputFmt_Color 0x00000020
-#define TF_OutputFmt_BitMask 0x00000040
-#define TF_OutputFmtMask 0x00000060
-#define TF_MirrorEnable 0x00000080
-#define TF_InvertEnable 0x00000100
-#define TF_ByteSwapEnable 0x00000200
-#define TF_LUTOffsetMask 0x0003fc00
-#define TF_OneCompFmt_Lum 0x00000000
-#define TF_OneCompFmt_Alpha 0x00040000
-#define TF_OneCompFmt_Intensity 0x00080000
-#define TF_OneCompFmt_Mask 0x000c0000
-/**************** MX FLAGS ****************/
-
-/************** GAMMA FLAGS ***************/
-/* GeometryMode */
-#define GM_TextureDisable 0x00000000
-#define GM_TextureEnable 0x00000001
-#define GM_FogDisable 0x00000000
-#define GM_FogEnable 0x00000002
-#define GM_FogLinear 0x00000000
-#define GM_FogExp 0x00000004
-#define GM_FogExpSquared 0x00000008
-#define GM_FogMask 0x0000000C
-#define GM_FrontPolyPoint 0x00000000
-#define GM_FrontPolyLine 0x00000010
-#define GM_FrontPolyFill 0x00000020
-#define GM_BackPolyPoint 0x00000000
-#define GM_BackPolyLine 0x00000040
-#define GM_BackPolyFill 0x00000080
-#define GM_FB_PolyMask 0x000000F0
-#define GM_FrontFaceCW 0x00000000
-#define GM_FrontFaceCCW 0x00000100
-#define GM_FFMask 0x00000100
-#define GM_PolyCullDisable 0x00000000
-#define GM_PolyCullEnable 0x00000200
-#define GM_PolyCullFront 0x00000000
-#define GM_PolyCullBack 0x00000400
-#define GM_PolyCullBoth 0x00000800
-#define GM_PolyCullMask 0x00000c00
-#define GM_ClipShortLinesDisable 0x00000000
-#define GM_ClipShortLinesEnable 0x00001000
-#define GM_ClipSmallTrisDisable 0x00000000
-#define GM_ClipSmallTrisEnable 0x00002000
-#define GM_RenderMode 0x00000000
-#define GM_SelectMode 0x00004000
-#define GM_FeedbackMode 0x00008000
-#define GM_Feedback2D 0x00000000
-#define GM_Feedback3D 0x00010000
-#define GM_Feedback3DColor 0x00020000
-#define GM_Feedback3DColorTexture 0x00030000
-#define GM_Feedback4DColorTexture 0x00040000
-#define GM_CullFaceNormDisable 0x00000000
-#define GM_CullFaceNormEnable 0x00080000
-#define GM_AutoFaceNormDisable 0x00000000
-#define GM_AutoFaceNormEnable 0x00100000
-#define GM_GouraudShading 0x00000000
-#define GM_FlatShading 0x00200000
-#define GM_ShadingMask 0x00200000
-#define GM_UserClipNone 0x00000000
-#define GM_UserClip0 0x00400000
-#define GM_UserClip1 0x00800000
-#define GM_UserClip2 0x01000000
-#define GM_UserClip3 0x02000000
-#define GM_UserClip4 0x04000000
-#define GM_UserClip5 0x08000000
-#define GM_PolyOffsetPointDisable 0x00000000
-#define GM_PolyOffsetPointEnable 0x10000000
-#define GM_PolyOffsetLineDisable 0x00000000
-#define GM_PolyOffsetLineEnable 0x20000000
-#define GM_PolyOffsetFillDisable 0x00000000
-#define GM_PolyOffsetFillEnable 0x40000000
-#define GM_InvertFaceNormCullDisable 0x00000000
-#define GM_InvertFaceNormCullEnable 0x80000000
-
-/* Begin */
-#define B_AreaStippleDisable 0x00000000
-#define B_AreaStippleEnable 0x00000001
-#define B_LineStippleDisable 0x00000000
-#define B_LineStippleEnable 0x00000002
-#define B_AntiAliasDisable 0x00000000
-#define B_AntiAliasEnable 0x00000100
-#define B_TextureDisable 0x00000000
-#define B_TextureEnable 0x00002000
-#define B_FogDisable 0x00000000
-#define B_FogEnable 0x00004000
-#define B_SubPixelCorrectDisable 0x00000000
-#define B_SubPixelCorrectEnable 0x00010000
-#define B_PrimType_Null 0x00000000
-#define B_PrimType_Points 0x10000000
-#define B_PrimType_Lines 0x20000000
-#define B_PrimType_LineLoop 0x30000000
-#define B_PrimType_LineStrip 0x40000000
-#define B_PrimType_Triangles 0x50000000
-#define B_PrimType_TriangleStrip 0x60000000
-#define B_PrimType_TriangleFan 0x70000000
-#define B_PrimType_Quads 0x80000000
-#define B_PrimType_QuadStrip 0x90000000
-#define B_PrimType_Polygon 0xa0000000
-#define B_PrimType_Mask 0xf0000000
-
-/* EdgeFlag */
-#define EdgeFlagDisable 0x00000000
-#define EdgeFlagEnable 0x00000001
-
-/* NormalizeMode */
-#define NormalizeModeDisable 0x00000000
-#define NormalizeModeEnable 0x00000001
-#define FaceNormalDisable 0x00000000
-#define FaceNormalEnable 0x00000002
-#define InvertAutoFaceNormal 0x00000004
-
-/* LightingMode */
-#define LightingModeDisable 0x00000000
-#define LightingModeEnable 0x00000001
-#define LightingModeTwoSides 0x00000004
-#define LightingModeLocalViewer 0x00000008
-#define LightingModeSpecularEnable 0x00008000
-
-/* Light0Mode */
-#define Light0ModeDisable 0x00000000
-#define Light0ModeEnable 0x00000001
-#define Light0ModeSpotLight 0x00000002
-#define Light0ModeAttenuation 0x00000004
-#define Light0ModeLocal 0x00000008
-
-/* Light0Mode */
-#define Light1ModeDisable 0x00000000
-#define Light1ModeEnable 0x00000001
-#define Light1ModeSpotLight 0x00000002
-#define Light1ModeAttenuation 0x00000004
-#define Light1ModeLocal 0x00000008
-
-/* ColorMaterialMode */
-#define ColorMaterialModeDisable 0x00000000
-#define ColorMaterialModeEnable 0x00000001
-#define ColorMaterialModeFront 0x00000000
-#define ColorMaterialModeBack 0x00000002
-#define ColorMaterialModeFrontAndBack 0x00000004
-#define ColorMaterialModeEmission 0x00000000
-#define ColorMaterialModeAmbient 0x00000008
-#define ColorMaterialModeDiffuse 0x00000010
-#define ColorMaterialModeSpecular 0x00000018
-#define ColorMaterialModeAmbAndDiff 0x00000020
-#define ColorMaterialModeMask 0x0000003e
-
-/* MaterialMode */
-#define MaterialModeDisable 0x00000000
-#define MaterialModeEnable 0x00000001
-#define MaterialModeTwoSides 0x00000080
-
-/* DeltaMode */
-#define DM_Target300SX 0x00000000
-#define DM_Target500TXMX 0x00000001
-#define DM_Depth16 0x00000004
-#define DM_Depth24 0x00000008
-#define DM_Depth32 0x0000000c
-#define DM_FogEnable 0x00000010
-#define DM_TextureEnable 0x00000020
-#define DM_SmoothShadingEnable 0x00000040
-#define DM_DepthEnable 0x00000080
-#define DM_SpecularEnable 0x00000100
-#define DM_DiffuseEnable 0x00000200
-#define DM_SubPixlCorrectionEnable 0x00000400
-#define DM_DiamondExit 0x00000800
-#define DM_NoDraw 0x00001000
-#define DM_ClampEnable 0x00002000
-#define DM_TextureParameterAsGiven 0x00000000
-#define DM_TextureParameterClamped 0x00004000
-#define DM_TextureParameterNormalized 0x00008000
-#define DM_BiasCoords 0x00080000
-#define DM_ColorDiffuse 0x00100000
-#define DM_ColorSpecular 0x00200000
-#define DM_FlatShadingMethod 0x00400000
-
-/* PointMode */
-#define PM_AntialiasDisable 0x00000000
-#define PM_AntialiasEnable 0x00000001
-#define PM_AntialiasQuality_4x4 0x00000000
-#define PM_AntialiasQuality_8x8 0x00000002
-
-/* LogicalOpMode */
-#define LogicalOpModeDisable 0x00000000
-#define LogicalOpModeEnable 0x00000001
-#define LogicalOpModeMask 0x0000001e
-
-/* LineMode */
-#define LM_StippleDisable 0x00000000
-#define LM_StippleEnable 0x00000001
-#define LM_RepeatFactorMask 0x000003fe
-#define LM_StippleMask 0x03fffc00
-#define LM_MirrorDisable 0x00000000
-#define LM_MirrorEnable 0x04000000
-#define LM_AntialiasDisable 0x00000000
-#define LM_AntialiasEnable 0x08000000
-#define LM_AntialiasQuality_4x4 0x00000000
-#define LM_AntialiasQuality_8x8 0x10000000
-
-/* TriangleMode */
-#define TM_AntialiasDisable 0x00000000
-#define TM_AntialiasEnable 0x00000001
-#define TM_AntialiasQuality_4x4 0x00000000
-#define TM_AntialiasQuality_8x8 0x00000002
-#define TM_UseTriPacketInterface 0x00000004
-
-/* TransformMode */
-#define XM_UseModelViewMatrix 0x00000001
-#define XM_UseModelViewProjMatrix 0x00000002
-#define XM_XformNormals 0x00000004
-#define XM_XformFaceNormals 0x00000008
-#define XM_XformTexture 0x00000010
-#define XM_XMask 0x00000013
-#define XM_TexGenModeS_None 0x00000000
-#define XM_TexGenModeS_ObjLinear 0x00000020
-#define XM_TexGenModeS_EyeLinear 0x00000040
-#define XM_TexGenModeS_SphereMap 0x00000060
-#define XM_TexGenModeT_None 0x00000000
-#define XM_TexGenModeT_ObjLinear 0x00000080
-#define XM_TexGenModeT_EyeLinear 0x00000100
-#define XM_TexGenModeT_SphereMap 0x00000180
-#define XM_TexGenModeR_None 0x00000000
-#define XM_TexGenModeR_ObjLinear 0x00000200
-#define XM_TexGenModeR_EyeLinear 0x00000400
-#define XM_TexGenModeR_SphereMap 0x00000600
-#define XM_TexGenModeQ_None 0x00000000
-#define XM_TexGenModeQ_ObjLinear 0x00000800
-#define XM_TexGenModeQ_EyeLinear 0x00001000
-#define XM_TexGenModeQQSphereMap 0x00001800
-#define XM_TexGenS 0x00002000
-#define XM_TexGenT 0x00004000
-#define XM_TexGenR 0x00008000
-#define XM_TexGenQ 0x00010000
-
-/* LightNMode */
-#define LNM_Off 0x00000000
-#define LNM_On 0x00000001
-/************** GAMMA FLAGS ***************/
-
-#endif /* _GAMMA_REGS_H_ */
diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c
deleted file mode 100644
index a03a93d132c..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_render.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- *
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/macros.h"
-#include "main/imports.h"
-#include "main/mtypes.h"
-
-#include "tnl/tcontext.h"
-
-#include "gammacontext.h"
-#include "gamma_tris.h"
-#include "gamma_vb.h"
-
-
-/* !! Should template this eventually !! */
-
-static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLfloat (*coord)[4];
- GLuint coord_stride;
- GLfloat (*col)[4];
- GLuint col_stride;
- int i;
- GLuint tc0_stride = 0;
- GLfloat (*tc0)[4] = 0;
- GLuint tc0_size = 0;
-
- col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
- col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0]->stride;
- tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0]->data;
- tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0]->size;
- coord = VB->ClipPtr->data;
- coord_stride = VB->ClipPtr->stride;
- } else {
- coord = VB->NdcPtr->data;
- coord_stride = VB->NdcPtr->stride;
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 9);
- WRITEF(gmesa->buf, Tq4, tc0[i][3]);
- WRITEF(gmesa->buf, Tr4, tc0[i][2]);
- WRITEF(gmesa->buf, Tt4, tc0[i][0]);
- WRITEF(gmesa->buf, Ts4, tc0[i][1]);
- WRITE(gmesa->buf, PackedColor4, *(uint32_t*)col[i]);
- WRITEF(gmesa->buf, Vw, coord[i][3]);
- WRITEF(gmesa->buf, Vz, coord[i][2]);
- WRITEF(gmesa->buf, Vy, coord[i][1]);
- WRITEF(gmesa->buf, Vx4, coord[i][0]);
- }
- } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 7);
- WRITEF(gmesa->buf, Tt2, tc0[i][0]);
- WRITEF(gmesa->buf, Ts2, tc0[i][1]);
- WRITE(gmesa->buf, PackedColor4, *(uint32_t*)col[i]);
- WRITEF(gmesa->buf, Vw, coord[i][3]);
- WRITEF(gmesa->buf, Vz, coord[i][2]);
- WRITEF(gmesa->buf, Vy, coord[i][1]);
- WRITEF(gmesa->buf, Vx4, coord[i][0]);
- }
- } else {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITE(gmesa->buf, PackedColor4, *(uint32_t*)col[i]);
- WRITEF(gmesa->buf, Vz, coord[i][2]);
- WRITEF(gmesa->buf, Vy, coord[i][1]);
- WRITEF(gmesa->buf, Vx3, coord[i][0]);
- }
- }
-}
-
-#define HAVE_POINTS 1
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_QUADS 1
-#define HAVE_QUAD_STRIPS 1
-#define HAVE_POLYGONS 1
-
-#define HAVE_ELTS 0
-
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- B_PrimType_Points,
- B_PrimType_Lines,
- B_PrimType_LineLoop,
- B_PrimType_LineStrip,
- B_PrimType_Triangles,
- B_PrimType_TriangleStrip,
- B_PrimType_TriangleFan,
- B_PrimType_Quads,
- B_PrimType_QuadStrip,
- B_PrimType_Polygon
-};
-
-static INLINE void gammaStartPrimitive( gammaContextPtr gmesa, GLenum prim )
-{
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, gmesa->Begin | hw_prim[prim]);
-}
-
-static INLINE void gammaEndPrimitive( gammaContextPtr gmesa )
-{
- GLcontext *ctx = gmesa->glCtx;
-
- if ( ctx->Line.SmoothFlag ||
- ctx->Polygon.SmoothFlag ||
- ctx->Point.SmoothFlag ) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
- }
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-#define LOCAL_VARS gammaContextPtr gmesa = GAMMA_CONTEXT(ctx)
-#define INIT( prim ) gammaStartPrimitive( gmesa, prim )
-#define FLUSH() gammaEndPrimitive( gmesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- (gmesa->bufSize - gmesa->bufCount) / 2
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- GAMMA_DMA_BUFFER_SIZE / 2
-
-#define ALLOC_VERTS( nr ) (void *)0 /* todo: explicit alloc */
-#define EMIT_VERTS( ctx, j, nr, buf ) (gamma_emit(ctx, j, (j)+(nr)), (void *)0)
-
-#define TAG(x) gamma_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean gamma_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
- tnl_render_func *tab;
-
- /* GH: THIS IS A HACK!!! */
- if (VB->ClipOrMask || gmesa->RenderIndex != 0)
- return GL_TRUE; /* don't handle clipping here */
-
- /* We don't do elts */
- if (VB->Elts || !gamma_validate_render( ctx, VB ))
- return GL_TRUE;
-
- tab = TAG(render_tab_verts);
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = _tnl_translate_prim(&VB->Primitive[i]);
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, prim);
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-const struct tnl_pipeline_stage _gamma_render_stage =
-{
- "gamma render",
- NULL,
- NULL,
- NULL,
- NULL,
- gamma_run_render /* run */
-};
diff --git a/src/mesa/drivers/dri/gamma/gamma_screen.c b/src/mesa/drivers/dri/gamma/gamma_screen.c
deleted file mode 100644
index f72a4a56969..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_screen.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- */
-
-#include "gammacontext.h"
-#include "gamma_vb.h"
-#include "glint_dri.h"
-
-#include "main/imports.h"
-
-gammaScreenPtr gammaCreateScreen( __DRIscreen *sPriv )
-{
- gammaScreenPtr gammaScreen;
- GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)sPriv->pDevPriv;
- int i;
-
- if (sPriv->devPrivSize != sizeof(GLINTDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(GLINTDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
-#if 0
- /* Check the DRI externsion version */
- if ( sPriv->driMajor != 3 || sPriv->driMinor != 1 ) {
- __driUtilMessage( "Gamma DRI driver expected DRI version 4.0.x "
- "but got version %d.%d.%d",
- sPriv->driMajor, sPriv->driMinor, sPriv->driPatch );
- return NULL;
- }
-
- /* Check that the DDX driver version is compatible */
- if ( sPriv->ddxMajor != 4 ||
- sPriv->ddxMinor != 0 ||
- sPriv->ddxPatch < 0 ) {
- __driUtilMessage( "r128 DRI driver expected DDX driver version 4.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch );
- return GL_FALSE;
- }
-
- /* Check that the DRM driver version is compatible */
- if ( sPriv->drmMajor != 2 ||
- sPriv->drmMinor != 1 ||
- sPriv->drmPatch < 0 ) {
- __driUtilMessage( "r128 DRI driver expected DRM driver version 2.1.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch );
- return GL_FALSE;
- }
-#endif
-
- /* Allocate the private area */
- gammaScreen = (gammaScreenPtr) CALLOC( sizeof(*gammaScreen) );
- if ( !gammaScreen ) return NULL;
-
- gammaScreen->regionCount = 4; /* Magic number. Can we fix this? */
-
- gammaScreen->regions = CALLOC(gammaScreen->regionCount *
- sizeof(gammaRegion));
-
- gammaScreen->regions[0].handle = gDRIPriv->registers0.handle;
- gammaScreen->regions[0].size = gDRIPriv->registers0.size;
- gammaScreen->regions[1].handle = gDRIPriv->registers1.handle;
- gammaScreen->regions[1].size = gDRIPriv->registers1.size;
- gammaScreen->regions[2].handle = gDRIPriv->registers2.handle;
- gammaScreen->regions[2].size = gDRIPriv->registers2.size;
- gammaScreen->regions[3].handle = gDRIPriv->registers3.handle;
- gammaScreen->regions[3].size = gDRIPriv->registers3.size;
-
- /* Next, map all the regions */
- for (i = 0; i < gammaScreen->regionCount; i++) {
- if (drmMap(sPriv->fd,
- gammaScreen->regions[i].handle,
- gammaScreen->regions[i].size,
- &gammaScreen->regions[i].map)) {
- while (--i > 0) {
- (void)drmUnmap(gammaScreen->regions[i].map,
- gammaScreen->regions[i].size);
- }
- return GL_FALSE;
- }
- }
-
- /* Get the list of dma buffers */
- gammaScreen->bufs = drmMapBufs(sPriv->fd);
-
- if (!gammaScreen->bufs) {
- while (gammaScreen->regionCount > 0) {
- (void)drmUnmap(gammaScreen->regions[gammaScreen->regionCount].map,
- gammaScreen->regions[gammaScreen->regionCount].size);
- gammaScreen->regionCount--;
- }
- return GL_FALSE;
- }
-
- gammaScreen->textureSize = gDRIPriv->textureSize;
- gammaScreen->logTextureGranularity = gDRIPriv->logTextureGranularity;
- gammaScreen->cpp = gDRIPriv->cpp;
- gammaScreen->frontOffset = gDRIPriv->frontOffset;
- gammaScreen->frontPitch = gDRIPriv->frontPitch;
- gammaScreen->backOffset = gDRIPriv->backOffset;
- gammaScreen->backPitch = gDRIPriv->backPitch;
- gammaScreen->backX = gDRIPriv->backX;
- gammaScreen->backY = gDRIPriv->backY;
- gammaScreen->depthOffset = gDRIPriv->depthOffset;
- gammaScreen->depthPitch = gDRIPriv->depthPitch;
-
- gammaScreen->driScreen = sPriv;
-
- return gammaScreen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-void gammaDestroyScreen( __DRIscreen *sPriv )
-{
- gammaScreenPtr gammaScreen = (gammaScreenPtr)sPriv->private;
-
- /* First, unmap the dma buffers */
- drmUnmapBufs( gammaScreen->bufs );
-
- /* Next, unmap all the regions */
- while (gammaScreen->regionCount > 0) {
- (void)drmUnmap(gammaScreen->regions[gammaScreen->regionCount].map,
- gammaScreen->regions[gammaScreen->regionCount].size);
- gammaScreen->regionCount--;
- }
- FREE(gammaScreen->regions);
- FREE(gammaScreen);
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_screen.h b/src/mesa/drivers/dri/gamma/gamma_screen.h
deleted file mode 100644
index c716ea89c29..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_screen.h
+++ /dev/null
@@ -1,30 +0,0 @@
-typedef struct _gammaRegion {
- drm_handle_t handle;
- drmSize size;
- drmAddress map;
-} gammaRegion, *gammaRegionPtr;
-
-typedef struct {
-
- int regionCount; /* Count of register regions */
- gammaRegion *regions; /* Vector of mapped region info */
-
- drmBufMapPtr bufs; /* Map of DMA buffers */
-
- __DRIscreen *driScreen; /* Back pointer to DRI screen */
-
- int cpp;
- int frontPitch;
- int frontOffset;
-
- int backPitch;
- int backOffset;
- int backX;
- int backY;
-
- int depthOffset;
- int depthPitch;
-
- int textureSize;
- int logTextureGranularity;
-} gammaScreenRec, *gammaScreenPtr;
diff --git a/src/mesa/drivers/dri/gamma/gamma_span.c b/src/mesa/drivers/dri/gamma/gamma_span.c
deleted file mode 100644
index 3f0b81800c5..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_span.c
+++ /dev/null
@@ -1,314 +0,0 @@
-
-#include "gammacontext.h"
-#include "gamma_lock.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
- gammaScreenPtr gammascrn = gmesa->gammaScreen; \
- __DRIscreen *sPriv = gmesa->driScreen; \
- __DRIdrawable *dPriv = gmesa->driDrawable; \
- GLuint pitch = sPriv->fbWidth * gammascrn->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- gmesa->drawOffset + \
- (dPriv->x * gammascrn->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) buf; (void) p
-
-/* FIXME! Depth/Stencil read/writes don't work ! */
-#define LOCAL_DEPTH_VARS \
- gammaScreenPtr gammascrn = gmesa->gammaScreen; \
- __DRIdrawable *dPriv = gmesa->driDrawable; \
- __DRIscreen *sPriv = gmesa->driScreen; \
- GLuint pitch = gammascrn->depthPitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- gammascrn->depthOffset + \
- dPriv->x * gammascrn->cpp + \
- dPriv->y * pitch)
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-#define HW_LOCK() \
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
- FLUSH_DMA_BUFFER(gmesa); \
- gammaGetLock( gmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); \
- GAMMAHW_LOCK( gmesa );
-
-#define HW_UNLOCK() GAMMAHW_UNLOCK( gmesa )
-
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_565( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \
- rgba[0] = (p >> 8) & 0xf8; \
- rgba[1] = (p >> 3) & 0xfc; \
- rgba[2] = (p << 3) & 0xf8; \
- rgba[3] = 0xff; \
- if ( rgba[0] & 0x08 ) rgba[0] |= 0x07; \
- if ( rgba[1] & 0x04 ) rgba[1] |= 0x03; \
- if ( rgba[2] & 0x08 ) rgba[2] |= 0x07; \
- } while (0)
-
-#define TAG(x) gamma##x##_RGB565
-#include "spantmp.h"
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_8888( color[3], color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16) | \
- (a << 24) )
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
-} while (0)
-
-#define TAG(x) gamma##x##_ARGB8888
-#include "spantmp.h"
-
-
-/* 16 bit depthbuffer functions.
- */
-#define VALUE_TYPE GLushort
-
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
-
-#define TAG(x) gamma##x##_16
-#include "depthtmp.h"
-
-
-#if 0 /* Unused */
-/* 32 bit depthbuffer functions.
- */
-#define VALUE_TYPE GLuint
-
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch);
-
-#define TAG(x) gamma##x##_32
-#include "depthtmp.h"
-#endif
-
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#define VALUE_TYPE GLuint
-
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \
- tmp &= 0xff; \
- tmp |= (d) & 0xffffff00; \
- *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch) & ~0xff;
-
-
-#define TAG(x) gamma##x##_24_8
-#include "depthtmp.h"
-
-#if 0
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xffffff00; \
- tmp |= d & 0xff; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xff;
-
-#define TAG(x) gamma##x##_24_8
-#include "stenciltmp.h"
-
-static void gammaReadRGBASpan8888( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- gammaScreenPtr gammascrn = gmesa->gammaScreen;
- uint32_t dwords1, dwords2, i = 0;
- char *src = (char *)rgba[0];
- GLuint read = n * gammascrn->cpp; /* Number of bytes we are expecting */
- uint32_t data;
-
- FLUSH_DMA_BUFFER(gmesa);
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode & ~(LBReadSrcEnable | LBReadDstEnable));
- WRITE(gmesa->buf, ColorDDAMode, ColorDDAEnable);
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeDisable);
- WRITE(gmesa->buf, FBReadMode, (gmesa->FBReadMode & ~FBReadSrcEnable) | FBReadDstEnable | FBDataTypeColor);
- WRITE(gmesa->buf, FilterMode, 0x200); /* Pass FBColorData */
- WRITE(gmesa->buf, FBWriteMode, FBW_UploadColorData | FBWriteModeDisable);
- WRITE(gmesa->buf, StartXSub, (x+n)<<16);
- WRITE(gmesa->buf, StartXDom, x<<16);
- WRITE(gmesa->buf, StartY, y<<16);
- WRITE(gmesa->buf, GLINTCount, 1);
- WRITE(gmesa->buf, dXDom, 0<<16);
- WRITE(gmesa->buf, dXSub, 0<<16);
- WRITE(gmesa->buf, dY, 1<<16);
- WRITE(gmesa->buf, Render, PrimitiveTrapezoid);
- FLUSH_DMA_BUFFER(gmesa);
-
-moredata:
-
- dwords1 = *(volatile uint32_t*)(void *)(((uint8_t*)gammascrn->regions[0].map) + (GlintOutFIFOWords));
- dwords2 = *(volatile uint32_t*)(void *)(((uint8_t*)gammascrn->regions[2].map) + (GlintOutFIFOWords));
-
- if (dwords1) {
- memcpy(src, (char*)gammascrn->regions[1].map + 0x1000, dwords1 << 2);
- src += dwords1 << 2;
- read -= dwords1 << 2;
- }
- if (dwords2) {
- memcpy(src, (char*)gammascrn->regions[3].map + 0x1000, dwords2 << 2);
- src += dwords2 << 2;
- read -= dwords2 << 2;
- }
-
- if (read)
- goto moredata;
-
-done:
-
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITE(gmesa->buf, ColorDDAMode, gmesa->ColorDDAMode);
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeEnable);
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode);
- WRITE(gmesa->buf, FBReadMode, gmesa->FBReadMode);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeEnable);
- WRITE(gmesa->buf, FilterMode, 0x400);
-}
-#endif
-
-static void gammaSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- gmesa->readOffset = 0;
- break;
- case BUFFER_BIT_BACK_LEFT:
- gmesa->readOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
- break;
- default:
- _mesa_problem(ctx, "Unexpected buffer 0x%x in gammaSetBuffer()", bufferBit);
- }
-}
-
-
-void gammaDDInitSpanFuncs( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = gammaSetBuffer;
-
- switch ( gmesa->gammaScreen->cpp ) {
- case 2:
- swdd->WriteRGBASpan = gammaWriteRGBASpan_RGB565;
- swdd->WriteRGBSpan = gammaWriteRGBSpan_RGB565;
- swdd->WriteMonoRGBASpan = gammaWriteMonoRGBASpan_RGB565;
- swdd->WriteRGBAPixels = gammaWriteRGBAPixels_RGB565;
- swdd->WriteMonoRGBAPixels = gammaWriteMonoRGBAPixels_RGB565;
- swdd->ReadRGBASpan = gammaReadRGBASpan_RGB565;
- swdd->ReadRGBAPixels = gammaReadRGBAPixels_RGB565;
- break;
-
- case 4:
- swdd->WriteRGBASpan = gammaWriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = gammaWriteRGBSpan_ARGB8888;
- swdd->WriteMonoRGBASpan = gammaWriteMonoRGBASpan_ARGB8888;
- swdd->WriteRGBAPixels = gammaWriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBAPixels = gammaWriteMonoRGBAPixels_ARGB8888;
-#if 1
- swdd->ReadRGBASpan = gammaReadRGBASpan_ARGB8888;
-#else
- swdd->ReadRGBASpan = gammaReadRGBASpan8888;
-#endif
- swdd->ReadRGBAPixels = gammaReadRGBAPixels_ARGB8888;
- break;
-
- default:
- break;
- }
-
- switch ( gmesa->glCtx->Visual.depthBits ) {
- case 16:
- swdd->ReadDepthSpan = gammaReadDepthSpan_16;
- swdd->WriteDepthSpan = gammaWriteDepthSpan_16;
- swdd->ReadDepthPixels = gammaReadDepthPixels_16;
- swdd->WriteDepthPixels = gammaWriteDepthPixels_16;
- break;
-
- case 24:
- swdd->ReadDepthSpan = gammaReadDepthSpan_24_8;
- swdd->WriteDepthSpan = gammaWriteDepthSpan_24_8;
- swdd->ReadDepthPixels = gammaReadDepthPixels_24_8;
- swdd->WriteDepthPixels = gammaWriteDepthPixels_24_8;
-
-#if 0
- swdd->ReadStencilSpan = gammaReadStencilSpan_24_8;
- swdd->WriteStencilSpan = gammaWriteStencilSpan_24_8;
- swdd->ReadStencilPixels = gammaReadStencilPixels_24_8;
- swdd->WriteStencilPixels = gammaWriteStencilPixels_24_8;
-#endif
- break;
-
- default:
- break;
- }
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_state.c b/src/mesa/drivers/dri/gamma/gamma_state.c
deleted file mode 100644
index 47df37466d7..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_state.c
+++ /dev/null
@@ -1,1722 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- * 3DLabs Gamma driver
- */
-
-#include "gammacontext.h"
-#include "gamma_main/macros.h"
-#include "buffers.h"
-#include "main/macros.h"
-#include "glint_dri.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "vbo/vbo.h"
-#include "tnl/tnl.h"
-
-#define ENABLELIGHTING 0
-
-/* =============================================================
- * Alpha blending
- */
-
-static void gammaUpdateAlphaMode( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- uint32_t a = gmesa->AlphaTestMode;
- uint32_t b = gmesa->AlphaBlendMode;
- uint32_t f = gmesa->AB_FBReadMode_Save = 0;
- GLubyte refByte = (GLint) (ctx->Color.AlphaRef * 255.0);
-
- a &= ~(AT_CompareMask | AT_RefValueMask);
- b &= ~(AB_SrcBlendMask | AB_DstBlendMask);
-
- a |= refByte << 4;
-
- switch ( ctx->Color.AlphaFunc ) {
- case GL_NEVER:
- a |= AT_Never;
- break;
- case GL_LESS:
- a |= AT_Less;
- break;
- case GL_EQUAL:
- a |= AT_Equal;
- break;
- case GL_LEQUAL:
- a |= AT_LessEqual;
- break;
- case GL_GEQUAL:
- a |= AT_GreaterEqual;
- break;
- case GL_GREATER:
- a |= AT_Greater;
- break;
- case GL_NOTEQUAL:
- a |= AT_NotEqual;
- break;
- case GL_ALWAYS:
- a |= AT_Always;
- break;
- }
-
- if ( ctx->Color.AlphaEnabled ) {
- f |= FBReadDstEnable;
- a |= AlphaTestModeEnable;
- } else {
- a &= ~AlphaTestModeEnable;
- }
-
- switch ( ctx->Color.BlendSrcRGB ) {
- case GL_ZERO:
- b |= AB_Src_Zero;
- break;
- case GL_ONE:
- b |= AB_Src_One;
- break;
- case GL_DST_COLOR:
- b |= AB_Src_DstColor;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- b |= AB_Src_OneMinusDstColor;
- break;
- case GL_SRC_ALPHA:
- b |= AB_Src_SrcAlpha;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= AB_Src_OneMinusSrcAlpha;
- break;
- case GL_DST_ALPHA:
- b |= AB_Src_DstAlpha;
- f |= FBReadSrcEnable;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= AB_Src_OneMinusDstAlpha;
- f |= FBReadSrcEnable;
- break;
- case GL_SRC_ALPHA_SATURATE:
- b |= AB_Src_SrcAlphaSaturate;
- break;
- }
-
- switch ( ctx->Color.BlendDstRGB ) {
- case GL_ZERO:
- b |= AB_Dst_Zero;
- break;
- case GL_ONE:
- b |= AB_Dst_One;
- break;
- case GL_SRC_COLOR:
- b |= AB_Dst_SrcColor;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- b |= AB_Dst_OneMinusSrcColor;
- break;
- case GL_SRC_ALPHA:
- b |= AB_Dst_SrcAlpha;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= AB_Dst_OneMinusSrcAlpha;
- break;
- case GL_DST_ALPHA:
- b |= AB_Dst_DstAlpha;
- f |= FBReadSrcEnable;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= AB_Dst_OneMinusDstAlpha;
- f |= FBReadSrcEnable;
- break;
- }
-
- if ( ctx->Color.BlendEnabled ) {
- f |= FBReadDstEnable;
- b |= AlphaBlendModeEnable;
- } else {
- b &= ~AlphaBlendModeEnable;
- }
-
- if ( gmesa->AlphaTestMode != a ) {
- gmesa->AlphaTestMode = a;
- gmesa->dirty |= GAMMA_UPLOAD_ALPHA;
- }
- if ( gmesa->AlphaBlendMode != b) {
- gmesa->AlphaBlendMode = b;
- gmesa->dirty |= GAMMA_UPLOAD_BLEND;
- }
- gmesa->AB_FBReadMode_Save = f;
-}
-
-static void gammaDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- (void) ref;
-
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_ALPHA;
-}
-
-static void gammaDDBlendEquationSeparate( GLcontext *ctx,
- GLenum modeRGB, GLenum modeA )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- assert( modeRGB == modeA );
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_ALPHA;
-}
-
-static void gammaDDBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_ALPHA;
-}
-
-
-/* ================================================================
- * Buffer clear
- */
-
-static void gammaDDClear( GLcontext *ctx, GLbitfield mask )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)gmesa->driScreen->pDevPriv;
- GLuint temp = 0;
-
- FLUSH_BATCH( gmesa );
-
- /* Update and emit any new state. We need to do this here to catch
- * changes to the masks.
- * FIXME: Just update the masks?
- */
- if ( gmesa->new_state )
- gammaDDUpdateHWState( ctx );
-
-#ifdef DO_VALIDATE
- /* Flush any partially filled buffers */
- FLUSH_DMA_BUFFER(gmesa);
-
- DRM_SPINLOCK(&gmesa->driScreen->pSAREA->drawable_lock,
- gmesa->driScreen->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
-#endif
-
- if (mask & BUFFER_BIT_DEPTH) {
- /* Turn off writes the FB */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeDisable);
-
- mask &= ~BUFFER_BIT_DEPTH;
-
- /*
- * Turn Rectangle2DControl off when the window is not clipped
- * (i.e., the GID tests are not necessary). This dramatically
- * increases the performance of the depth clears.
- */
- if (!gmesa->NotClipped) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 1);
- }
-
- temp = (gmesa->LBReadMode & LBPartialProdMask) | LBWindowOriginBot;
- if (gDRIPriv->numMultiDevices == 2) temp |= LBScanLineInt2;
-
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, LBReadMode, temp);
- WRITE(gmesa->buf, DeltaMode, DM_DepthEnable);
- WRITE(gmesa->buf, DepthMode, (DepthModeEnable |
- DM_Always |
- DM_SourceDepthRegister |
- DM_WriteMask));
- WRITE(gmesa->buf, GLINTDepth, gmesa->ClearDepth);
-
- /* Increment the frame count */
- gmesa->FrameCount++;
-#ifdef FAST_CLEAR_4
- gmesa->FrameCount &= 0x0f;
-#else
- gmesa->FrameCount &= 0xff;
-#endif
-
- /* Force FCP to be written */
- WRITE(gmesa->buf, GLINTWindow, (WindowEnable |
- W_PassIfEqual |
- (gmesa->Window & W_GIDMask) |
- W_DepthFCP |
- W_LBUpdateFromRegisters |
- W_OverrideWriteFiltering |
- (gmesa->FrameCount << 9)));
-
- /* Clear part of the depth and FCP buffers */
- {
- int y = gmesa->driScreen->fbHeight - gmesa->driDrawable->y - gmesa->driDrawable->h;
- int x = gmesa->driDrawable->x;
- int w = gmesa->driDrawable->w;
- int h = gmesa->driDrawable->h;
-#ifndef TURN_OFF_FCP
- float hsub = h;
-
- if (gmesa->WindowChanged) {
- gmesa->WindowChanged = GL_FALSE;
- } else {
-#ifdef FAST_CLEAR_4
- hsub /= 16;
-#else
- hsub /= 256;
-#endif
-
- /* Handle the case where the height < # of FCPs */
- if (hsub < 1.0) {
- if (gmesa->FrameCount > h)
- gmesa->FrameCount = 0;
- h = 1;
- y += gmesa->FrameCount;
- } else {
- h = (gmesa->FrameCount+1)*hsub;
- h -= (int)(gmesa->FrameCount*hsub);
- y += gmesa->FrameCount*hsub;
- }
- }
-#endif
- if (h && w) {
-#if 0
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, Rectangle2DMode, ((h & 0xfff)<<12) |
- (w & 0xfff) );
- WRITE(gmesa->buf, DrawRectangle2D, ((y & 0xffff)<<16) |
- (x & 0xffff) );
-#else
- CHECK_DMA_BUFFER(gmesa, 8);
- WRITE(gmesa->buf, StartXDom, x<<16);
- WRITE(gmesa->buf, StartY, y<<16);
- WRITE(gmesa->buf, StartXSub, (x+w)<<16);
- WRITE(gmesa->buf, GLINTCount, h);
- WRITE(gmesa->buf, dY, 1<<16);
- WRITE(gmesa->buf, dXDom, 0<<16);
- WRITE(gmesa->buf, dXSub, 0<<16);
- WRITE(gmesa->buf, Render, 0x00000040); /* NOT_DONE */
-#endif
- }
- }
-
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITE(gmesa->buf, DepthMode, gmesa->DepthMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode);
- WRITE(gmesa->buf, GLINTWindow, gmesa->Window);
- WRITE(gmesa->buf, FastClearDepth, gmesa->ClearDepth);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeEnable);
-
- /* Turn on Depth FCP */
- if (gmesa->Window & W_DepthFCP) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, WindowOr, (gmesa->FrameCount << 9));
- }
-
- /* Turn off GID clipping if window is not clipped */
- if (gmesa->NotClipped) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 0);
- }
- }
-
- if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) {
- int y = gmesa->driScreen->fbHeight - gmesa->driDrawable->y - gmesa->driDrawable->h;
- int x = gmesa->driDrawable->x;
- int w = gmesa->driDrawable->w;
- int h = gmesa->driDrawable->h;
-
- mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
-
- if (x < 0) { w -= -x; x = 0; }
-
- /* Turn on GID clipping if window is clipped */
- if (!gmesa->NotClipped) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 1);
- }
-
- CHECK_DMA_BUFFER(gmesa, 18);
- WRITE(gmesa->buf, FBBlockColor, gmesa->ClearColor);
- WRITE(gmesa->buf, ColorDDAMode, ColorDDADisable);
- WRITE(gmesa->buf, FBWriteMode, FBWriteModeEnable);
- WRITE(gmesa->buf, DepthMode, 0);
- WRITE(gmesa->buf, DeltaMode, 0);
- WRITE(gmesa->buf, AlphaBlendMode, 0);
-#if 1
- WRITE(gmesa->buf, dY, 1<<16);
- WRITE(gmesa->buf, dXDom, 0<<16);
- WRITE(gmesa->buf, dXSub, 0<<16);
- WRITE(gmesa->buf, StartXSub, (x+w)<<16);
- WRITE(gmesa->buf, GLINTCount, h);
- WRITE(gmesa->buf, StartXDom, x<<16);
- WRITE(gmesa->buf, StartY, y<<16);
- WRITE(gmesa->buf, Render, 0x00000048); /* NOT_DONE */
-#else
- WRITE(gmesa->buf, Rectangle2DMode, (((h & 0xfff)<<12) |
- (w & 0xfff)));
- WRITE(gmesa->buf, DrawRectangle2D, (((y & 0xffff)<<16) |
- (x & 0xffff)));
-#endif
- WRITE(gmesa->buf, DepthMode, gmesa->DepthMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
- WRITE(gmesa->buf, AlphaBlendMode, gmesa->AlphaBlendMode);
- WRITE(gmesa->buf, ColorDDAMode, gmesa->ColorDDAMode);
-
- /* Turn off GID clipping if window is clipped */
- if (gmesa->NotClipped) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Rectangle2DControl, 0);
- }
- }
-
-#ifdef DO_VALIDATE
- PROCESS_DMA_BUFFER_TOP_HALF(gmesa);
-
- DRM_SPINUNLOCK(&gmesa->driScreen->pSAREA->drawable_lock,
- gmesa->driScreen->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa);
-
- PROCESS_DMA_BUFFER_BOTTOM_HALF(gmesa);
-#endif
-
- if ( mask )
- _swrast_Clear( ctx, mask );
-}
-
-/* =============================================================
- * Depth testing
- */
-
-static void gammaUpdateZMode( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- uint32_t z = gmesa->DepthMode;
- uint32_t delta = gmesa->DeltaMode;
- uint32_t window = gmesa->Window;
- uint32_t lbread = gmesa->LBReadMode;
-
- z &= ~DM_CompareMask;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- z |= DM_Never;
- break;
- case GL_ALWAYS:
- z |= DM_Always;
- break;
- case GL_LESS:
- z |= DM_Less;
- break;
- case GL_LEQUAL:
- z |= DM_LessEqual;
- break;
- case GL_EQUAL:
- z |= DM_Equal;
- break;
- case GL_GEQUAL:
- z |= DM_GreaterEqual;
- break;
- case GL_GREATER:
- z |= DM_Greater;
- break;
- case GL_NOTEQUAL:
- z |= DM_NotEqual;
- break;
- }
-
- if ( ctx->Depth.Test ) {
- z |= DepthModeEnable;
- delta |= DM_DepthEnable;
- window |= W_DepthFCP;
- lbread |= LBReadDstEnable;
- } else {
- z &= ~DepthModeEnable;
- delta &= ~DM_DepthEnable;
- window &= ~W_DepthFCP;
- lbread &= ~LBReadDstEnable;
- }
-
- if ( ctx->Depth.Mask ) {
- z |= DM_WriteMask;
- } else {
- z &= ~DM_WriteMask;
- }
-
-#if 0
- if ( gmesa->DepthMode != z ){
-#endif
- gmesa->DepthMode = z;
- gmesa->DeltaMode = delta;
- gmesa->Window = window;
- gmesa->LBReadMode = lbread;
- gmesa->dirty |= GAMMA_UPLOAD_DEPTH;
-#if 0
- }
-#endif
-}
-
-static void gammaDDDepthFunc( GLcontext *ctx, GLenum func )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_DEPTH;
-}
-
-static void gammaDDDepthMask( GLcontext *ctx, GLboolean flag )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_DEPTH;
-}
-
-static void gammaDDClearDepth( GLcontext *ctx, GLclampd d )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- switch ( gmesa->DepthSize ) {
- case 16:
- gmesa->ClearDepth = d * 0x0000ffff;
- break;
- case 24:
- gmesa->ClearDepth = d * 0x00ffffff;
- break;
- case 32:
- gmesa->ClearDepth = d * 0xffffffff;
- break;
- }
-}
-
-static void gammaDDFinish( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_DMA_BUFFER(gmesa);
-}
-
-static void gammaDDFlush( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_DMA_BUFFER(gmesa);
-}
-
-/* =============================================================
- * Fog
- */
-
-static void gammaUpdateFogAttrib( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- uint32_t f = gmesa->FogMode;
- uint32_t g = gmesa->GeometryMode;
- uint32_t d = gmesa->DeltaMode;
-
- if (ctx->Fog.Enabled) {
- f |= FogModeEnable;
- g |= GM_FogEnable;
- d |= DM_FogEnable;
- } else {
- f &= ~FogModeEnable;
- g &= ~GM_FogEnable;
- d &= ~DM_FogEnable;
- }
-
- g &= ~GM_FogMask;
-
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- g |= GM_FogLinear;
- break;
- case GL_EXP:
- g |= GM_FogExp;
- break;
- case GL_EXP2:
- g |= GM_FogExpSquared;
- break;
- }
-
- if ( gmesa->FogMode != f ) {
- gmesa->FogMode = f;
- gmesa->dirty |= GAMMA_UPLOAD_FOG;
- }
-
- if ( gmesa->GeometryMode != g ) {
- gmesa->GeometryMode = g;
- gmesa->dirty |= GAMMA_UPLOAD_GEOMETRY;
- }
-
- if ( gmesa->DeltaMode != d ) {
- gmesa->DeltaMode = d;
- gmesa->dirty |= GAMMA_UPLOAD_DEPTH;
- }
-}
-
-#if 0
-static void gammaDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_FOG;
-}
-#endif
-
-/* =============================================================
- * Lines
- */
-static void gammaDDLineWidth( GLcontext *ctx, GLfloat width )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITE(gmesa->buf, LineWidth, (GLuint)width);
- WRITEF(gmesa->buf, AAlineWidth, width);
- WRITE(gmesa->buf, LineWidthOffset, (GLuint)(width-1)/2);
-}
-
-static void gammaDDLineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- gmesa->LineMode &= ~(LM_StippleMask | LM_RepeatFactorMask);
- gmesa->LineMode |= ((GLuint)(factor - 1) << 1) | ((GLuint)pattern << 10);
-
- gmesa->dirty |= GAMMA_UPLOAD_LINEMODE;
-}
-
-
-
-/* =============================================================
- * Points
- */
-static void gammaDDPointSize( GLcontext *ctx, GLfloat size )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, PointSize, (GLuint)size);
- WRITEF(gmesa->buf, AApointSize, size);
-}
-
-/* =============================================================
- * Polygon
- */
-
-static void gammaUpdatePolygon( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- uint32_t g = gmesa->GeometryMode;
-
- g &= ~(GM_PolyOffsetFillEnable | GM_PolyOffsetPointEnable |
- GM_PolyOffsetLineEnable);
-
- if (ctx->Polygon.OffsetFill) g |= GM_PolyOffsetFillEnable;
- if (ctx->Polygon.OffsetPoint) g |= GM_PolyOffsetPointEnable;
- if (ctx->Polygon.OffsetLine) g |= GM_PolyOffsetLineEnable;
-
- g &= ~GM_FB_PolyMask;
-
- switch (ctx->Polygon.FrontMode) {
- case GL_FILL:
- g |= GM_FrontPolyFill;
- break;
- case GL_LINE:
- g |= GM_FrontPolyLine;
- break;
- case GL_POINT:
- g |= GM_FrontPolyPoint;
- break;
- }
-
- switch (ctx->Polygon.BackMode) {
- case GL_FILL:
- g |= GM_BackPolyFill;
- break;
- case GL_LINE:
- g |= GM_BackPolyLine;
- break;
- case GL_POINT:
- g |= GM_BackPolyPoint;
- break;
- }
-
- if ( gmesa->GeometryMode != g ) {
- gmesa->GeometryMode = g;
- gmesa->dirty |= GAMMA_UPLOAD_GEOMETRY;
- }
-
- gmesa->dirty |= GAMMA_UPLOAD_POLYGON;
-}
-
-static void gammaDDPolygonMode( GLcontext *ctx, GLenum face, GLenum mode)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state |= GAMMA_NEW_POLYGON;
-}
-
-static void gammaUpdateStipple( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- if (ctx->Polygon.StippleFlag) {
- gmesa->AreaStippleMode |= AreaStippleModeEnable/* | ASM_X32 | ASM_Y32*/;
- } else {
- gmesa->AreaStippleMode &= ~AreaStippleModeEnable;
- }
-
- gmesa->dirty |= GAMMA_UPLOAD_STIPPLE;
-}
-
-static void gammaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_STIPPLE;
-}
-
-/* =============================================================
- * Clipping
- */
-
-static void gammaUpdateClipping( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLint x1, y1, x2, y2;
-
- if ( gmesa->driDrawable ) {
- x1 = gmesa->driDrawable->x + ctx->Scissor.X;
- y1 = gmesa->driScreen->fbHeight -
- (gmesa->driDrawable->y +
- gmesa->driDrawable->h) + ctx->Scissor.Y;
- x2 = x1 + ctx->Scissor.Width;
- y2 = y1 + ctx->Scissor.Height;
-
- gmesa->ScissorMinXY = x1 | (y1 << 16);
- gmesa->ScissorMaxXY = x2 | (y2 << 16);
- if (ctx->Scissor.Enabled)
- gmesa->ScissorMode |= UserScissorEnable;
- else
- gmesa->ScissorMode &= ~UserScissorEnable;
-
- gmesa->dirty |= GAMMA_UPLOAD_CLIP;
- }
-}
-
-static void gammaDDScissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CLIP;
-}
-
-/* =============================================================
- * Culling
- */
-
-static void gammaUpdateCull( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- uint32_t g = gmesa->GeometryMode;
-
- g &= ~(GM_PolyCullMask | GM_FFMask);
-
- if (ctx->Polygon.FrontFace == GL_CCW) {
- g |= GM_FrontFaceCCW;
- } else {
- g |= GM_FrontFaceCW;
- }
-
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- g |= GM_PolyCullFront;
- break;
- case GL_BACK:
- g |= GM_PolyCullBack;
- break;
- case GL_FRONT_AND_BACK:
- g |= GM_PolyCullBoth;
- break;
- }
-
- if ( ctx->Polygon.CullFlag ) {
- g |= GM_PolyCullEnable;
- } else {
- g &= ~GM_PolyCullEnable;
- }
-
- if ( gmesa->GeometryMode != g ) {
- gmesa->GeometryMode = g;
- gmesa->dirty |= GAMMA_UPLOAD_GEOMETRY;
- }
-}
-
-static void gammaDDCullFace( GLcontext *ctx, GLenum mode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CULL;
-}
-
-static void gammaDDFrontFace( GLcontext *ctx, GLenum mode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CULL;
-}
-
-/* =============================================================
- * Masks
- */
-
-static void gammaUpdateMasks( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
-
- GLuint mask = gammaPackColor( gmesa->gammaScreen->cpp,
- ctx->Color.ColorMask[0][RCOMP],
- ctx->Color.ColorMask[0][GCOMP],
- ctx->Color.ColorMask[0][BCOMP],
- ctx->Color.ColorMask[0][ACOMP] );
-
- if (gmesa->gammaScreen->cpp == 2) mask |= mask << 16;
-
- if ( gmesa->FBHardwareWriteMask != mask ) {
- gmesa->FBHardwareWriteMask = mask;
- gmesa->dirty |= GAMMA_UPLOAD_MASKS;
- }
-}
-
-static void gammaDDColorMask( GLcontext *ctx, GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_MASKS;
-}
-
-/* =============================================================
- * Rendering attributes
- *
- * We really don't want to recalculate all this every time we bind a
- * texture. These things shouldn't change all that often, so it makes
- * sense to break them out of the core texture state update routines.
- */
-
-#if ENABLELIGHTING
-static void gammaDDLightfv(GLcontext *ctx, GLenum light, GLenum pname,
- const GLfloat *params, GLint nParams)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLfloat l,x,y,z,w;
-
- switch(light) {
- case GL_LIGHT0:
- switch (pname) {
- case GL_AMBIENT:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* We don't do alpha */
- WRITEF(gmesa->buf, Light0AmbientIntensityBlue, params[2]);
- WRITEF(gmesa->buf, Light0AmbientIntensityGreen, params[1]);
- WRITEF(gmesa->buf, Light0AmbientIntensityRed, params[0]);
- break;
- case GL_DIFFUSE:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* We don't do alpha */
- WRITEF(gmesa->buf, Light0DiffuseIntensityBlue, params[2]);
- WRITEF(gmesa->buf, Light0DiffuseIntensityGreen, params[1]);
- WRITEF(gmesa->buf, Light0DiffuseIntensityRed, params[0]);
- break;
- case GL_SPECULAR:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* We don't do alpha */
- WRITEF(gmesa->buf, Light0SpecularIntensityBlue, params[2]);
- WRITEF(gmesa->buf, Light0SpecularIntensityGreen, params[1]);
- WRITEF(gmesa->buf, Light0SpecularIntensityRed, params[0]);
- break;
- case GL_POSITION:
- /* Normalize <x,y,z> */
- x = params[0]; y = params[1]; z = params[2]; w = params[3];
- l = sqrt(x*x + y*y + z*z + w*w);
- w /= l;
- x /= l;
- y /= l;
- z /= l;
- if (params[3] != 0.0) {
- gmesa->Light0Mode |= Light0ModeAttenuation;
- gmesa->Light0Mode |= Light0ModeLocal;
- } else {
- gmesa->Light0Mode &= ~Light0ModeAttenuation;
- gmesa->Light0Mode &= ~Light0ModeLocal;
- }
- CHECK_DMA_BUFFER(gmesa, 5);
- WRITE(gmesa->buf, Light0Mode, gmesa->Light0Mode);
- WRITEF(gmesa->buf, Light0PositionW, w);
- WRITEF(gmesa->buf, Light0PositionZ, z);
- WRITEF(gmesa->buf, Light0PositionY, y);
- WRITEF(gmesa->buf, Light0PositionX, x);
- break;
- case GL_SPOT_DIRECTION:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* WRITEF(gmesa->buf, Light0SpotlightDirectionW, params[3]); */
- WRITEF(gmesa->buf, Light0SpotlightDirectionZ, params[2]);
- WRITEF(gmesa->buf, Light0SpotlightDirectionY, params[1]);
- WRITEF(gmesa->buf, Light0SpotlightDirectionX, params[0]);
- break;
- case GL_SPOT_EXPONENT:
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITEF(gmesa->buf, Light0SpotlightExponent, params[0]);
- break;
- case GL_SPOT_CUTOFF:
- if (params[0] != 180.0)
- gmesa->Light0Mode |= Light0ModeSpotLight;
- else
- gmesa->Light0Mode &= ~Light0ModeSpotLight;
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, Light0Mode, gmesa->Light0Mode);
- WRITEF(gmesa->buf, Light0CosSpotlightCutoffAngle, cos(params[0]*DEG2RAD));
- break;
- case GL_CONSTANT_ATTENUATION:
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITEF(gmesa->buf, Light0ConstantAttenuation, params[0]);
- break;
- case GL_LINEAR_ATTENUATION:
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITEF(gmesa->buf, Light0LinearAttenuation, params[0]);
- break;
- case GL_QUADRATIC_ATTENUATION:
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITEF(gmesa->buf, Light0QuadraticAttenuation, params[0]);
- break;
- }
- break;
- }
-}
-
-static void gammaDDLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *params )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT:
- CHECK_DMA_BUFFER(gmesa, 3);
- /* We don't do alpha */
- WRITEF(gmesa->buf, SceneAmbientColorBlue, params[2]);
- WRITEF(gmesa->buf, SceneAmbientColorGreen, params[1]);
- WRITEF(gmesa->buf, SceneAmbientColorRed, params[0]);
- break;
- case GL_LIGHT_MODEL_LOCAL_VIEWER:
- if (params[0] != 0.0)
- gmesa->LightingMode |= LightingModeLocalViewer;
- else
- gmesa->LightingMode &= ~LightingModeLocalViewer;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, LightingMode, gmesa->LightingMode);
- break;
- case GL_LIGHT_MODEL_TWO_SIDE:
- if (params[0] == 1.0f) {
- gmesa->LightingMode |= LightingModeTwoSides;
- gmesa->MaterialMode |= MaterialModeTwoSides;
- } else {
- gmesa->LightingMode &= ~LightingModeTwoSides;
- gmesa->MaterialMode &= ~MaterialModeTwoSides;
- }
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, LightingMode, gmesa->LightingMode);
- WRITE(gmesa->buf, MaterialMode, gmesa->MaterialMode);
- break;
- }
-}
-#endif
-
-static void gammaDDShadeModel( GLcontext *ctx, GLenum mode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- uint32_t g = gmesa->GeometryMode;
- uint32_t c = gmesa->ColorDDAMode;
-
- g &= ~GM_ShadingMask;
- c &= ~ColorDDAShadingMask;
-
- switch ( mode ) {
- case GL_FLAT:
- g |= GM_FlatShading;
- c |= ColorDDAFlat;
- break;
- case GL_SMOOTH:
- g |= GM_GouraudShading;
- c |= ColorDDAGouraud;
- break;
- default:
- return;
- }
-
- if ( gmesa->ColorDDAMode != c ) {
- FLUSH_BATCH( gmesa );
- gmesa->ColorDDAMode = c;
-
- gmesa->dirty |= GAMMA_UPLOAD_SHADE;
- }
-
- if ( gmesa->GeometryMode != g ) {
- FLUSH_BATCH( gmesa );
- gmesa->GeometryMode = g;
-
- gmesa->dirty |= GAMMA_UPLOAD_GEOMETRY;
- }
-}
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void gammaDDClearColor( GLcontext *ctx, const GLfloat color[4])
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLubyte c[4];
- UNCLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- UNCLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- UNCLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- UNCLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- gmesa->ClearColor = gammaPackColor( gmesa->gammaScreen->cpp,
- c[0], c[1], c[2], c[3] );
-
- if (gmesa->gammaScreen->cpp == 2) gmesa->ClearColor |= gmesa->ClearColor<<16;
-}
-
-
-static void gammaDDLogicalOpcode( GLcontext *ctx, GLenum opcode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- if ( ctx->Color.ColorLogicOpEnabled ) {
- gmesa->LogicalOpMode = opcode << 1 | LogicalOpModeEnable;
- } else {
- gmesa->LogicalOpMode = LogicalOpModeDisable;
- }
-
- gmesa->dirty |= GAMMA_UPLOAD_LOGICOP;
-}
-
-static void gammaDDDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- FLUSH_BATCH( gmesa );
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- gmesa->drawOffset = gmesa->readOffset = 0;
- break;
- case GL_BACK_LEFT:
- gmesa->drawOffset = gmesa->readOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
- break;
- }
-}
-
-static void gammaDDReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* XXX anything? */
-}
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-void gammaUpdateWindow( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- __DRIdrawable *dPriv = gmesa->driDrawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = gmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat sx = v[MAT_SX];
- GLfloat tx = v[MAT_TX] + xoffset;
- GLfloat sy = v[MAT_SY];
- GLfloat ty = v[MAT_TY] + yoffset;
- GLfloat sz = v[MAT_SZ] * gmesa->depth_scale;
- GLfloat tz = v[MAT_TZ] * gmesa->depth_scale;
-
- gmesa->dirty |= GAMMA_UPLOAD_VIEWPORT;
-
- gmesa->ViewportScaleX = sx;
- gmesa->ViewportScaleY = sy;
- gmesa->ViewportScaleZ = sz;
- gmesa->ViewportOffsetX = tx;
- gmesa->ViewportOffsetY = ty;
- gmesa->ViewportOffsetZ = tz;
-}
-
-
-
-static void gammaDDViewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- gammaUpdateWindow( ctx );
-}
-
-static void gammaDDDepthRange( GLcontext *ctx, GLclampd nearval,
- GLclampd farval )
-{
- gammaUpdateWindow( ctx );
-}
-
-void gammaUpdateViewportOffset( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- __DRIdrawable *dPriv = gmesa->driDrawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = gmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat tx = v[MAT_TX] + xoffset;
- GLfloat ty = v[MAT_TY] + yoffset;
-
- if ( gmesa->ViewportOffsetX != tx ||
- gmesa->ViewportOffsetY != ty )
- {
- gmesa->ViewportOffsetX = tx;
- gmesa->ViewportOffsetY = ty;
-
- gmesa->new_state |= GAMMA_NEW_WINDOW;
- }
-
- gmesa->new_state |= GAMMA_NEW_CLIP;
-}
-
-#if 0
-/*
- * Matrix
- */
-
-static void gammaLoadHWMatrix(GLcontext *ctx)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- const GLfloat *m;
-
- gmesa->TransformMode &= ~XM_XformTexture;
-
- switch (ctx->Transform.MatrixMode) {
- case GL_MODELVIEW:
- gmesa->TransformMode |= XM_UseModelViewMatrix;
- m = ctx->ModelviewMatrixStack.Top->m;
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewMatrix0, m[0]);
- WRITEF(gmesa->buf, ModelViewMatrix1, m[1]);
- WRITEF(gmesa->buf, ModelViewMatrix2, m[2]);
- WRITEF(gmesa->buf, ModelViewMatrix3, m[3]);
- WRITEF(gmesa->buf, ModelViewMatrix4, m[4]);
- WRITEF(gmesa->buf, ModelViewMatrix5, m[5]);
- WRITEF(gmesa->buf, ModelViewMatrix6, m[6]);
- WRITEF(gmesa->buf, ModelViewMatrix7, m[7]);
- WRITEF(gmesa->buf, ModelViewMatrix8, m[8]);
- WRITEF(gmesa->buf, ModelViewMatrix9, m[9]);
- WRITEF(gmesa->buf, ModelViewMatrix10, m[10]);
- WRITEF(gmesa->buf, ModelViewMatrix11, m[11]);
- WRITEF(gmesa->buf, ModelViewMatrix12, m[12]);
- WRITEF(gmesa->buf, ModelViewMatrix13, m[13]);
- WRITEF(gmesa->buf, ModelViewMatrix14, m[14]);
- WRITEF(gmesa->buf, ModelViewMatrix15, m[15]);
- break;
- case GL_PROJECTION:
- m = ctx->ProjectionMatrixStack.Top->m;
- CHECK_DMA_BUFFER(gmesa, 16);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix0, m[0]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix1, m[1]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix2, m[2]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix3, m[3]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix4, m[4]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix5, m[5]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix6, m[6]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix7, m[7]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix8, m[8]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix9, m[9]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix10, m[10]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix11, m[11]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix12, m[12]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix13, m[13]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix14, m[14]);
- WRITEF(gmesa->buf, ModelViewProjectionMatrix15, m[15]);
- break;
- case GL_TEXTURE:
- m = ctx->TextureMatrixStack[0].Top->m;
- CHECK_DMA_BUFFER(gmesa, 16);
- gmesa->TransformMode |= XM_XformTexture;
- WRITEF(gmesa->buf, TextureMatrix0, m[0]);
- WRITEF(gmesa->buf, TextureMatrix1, m[1]);
- WRITEF(gmesa->buf, TextureMatrix2, m[2]);
- WRITEF(gmesa->buf, TextureMatrix3, m[3]);
- WRITEF(gmesa->buf, TextureMatrix4, m[4]);
- WRITEF(gmesa->buf, TextureMatrix5, m[5]);
- WRITEF(gmesa->buf, TextureMatrix6, m[6]);
- WRITEF(gmesa->buf, TextureMatrix7, m[7]);
- WRITEF(gmesa->buf, TextureMatrix8, m[8]);
- WRITEF(gmesa->buf, TextureMatrix9, m[9]);
- WRITEF(gmesa->buf, TextureMatrix10, m[10]);
- WRITEF(gmesa->buf, TextureMatrix11, m[11]);
- WRITEF(gmesa->buf, TextureMatrix12, m[12]);
- WRITEF(gmesa->buf, TextureMatrix13, m[13]);
- WRITEF(gmesa->buf, TextureMatrix14, m[14]);
- WRITEF(gmesa->buf, TextureMatrix15, m[15]);
- break;
-
- default:
- /* ERROR!!! -- how did this happen? */
- break;
- }
-
- gmesa->dirty |= GAMMA_UPLOAD_TRANSFORM;
-}
-#endif
-
-/* =============================================================
- * State enable/disable
- */
-
-static void gammaDDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- switch ( cap ) {
- case GL_ALPHA_TEST:
- case GL_BLEND:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_ALPHA;
- break;
-
- case GL_CULL_FACE:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CULL;
- break;
-
- case GL_DEPTH_TEST:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_DEPTH;
- break;
-
- case GL_DITHER:
- do {
- uint32_t d = gmesa->DitherMode;
- FLUSH_BATCH( gmesa );
-
- if ( state ) {
- d |= DM_DitherEnable;
- } else {
- d &= ~DM_DitherEnable;
- }
-
- if ( gmesa->DitherMode != d ) {
- gmesa->DitherMode = d;
- gmesa->dirty |= GAMMA_UPLOAD_DITHER;
- }
- } while (0);
- break;
-
-#if 0
- case GL_FOG:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_FOG;
- break;
-#endif
-
- case GL_INDEX_LOGIC_OP:
- case GL_COLOR_LOGIC_OP:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_LOGICOP;
- break;
-
-#if ENABLELIGHTING
- case GL_LIGHTING:
- do {
- uint32_t l = gmesa->LightingMode;
- FLUSH_BATCH( gmesa );
-
- if ( state ) {
- l |= LightingModeEnable;
- } else {
- l &= ~LightingModeEnable;
- }
-
- if ( gmesa->LightingMode != l ) {
- gmesa->LightingMode = l;
- gmesa->dirty |= GAMMA_UPLOAD_LIGHT;
- }
- } while (0);
- break;
-
- case GL_COLOR_MATERIAL:
- do {
- uint32_t m = gmesa->MaterialMode;
- FLUSH_BATCH( gmesa );
-
- if ( state ) {
- m |= MaterialModeEnable;
- } else {
- m &= ~MaterialModeEnable;
- }
-
- if ( gmesa->MaterialMode != m ) {
- gmesa->MaterialMode = m;
- gmesa->dirty |= GAMMA_UPLOAD_LIGHT;
- }
- } while (0);
- break;
-#endif
-
- case GL_LINE_SMOOTH:
- FLUSH_BATCH( gmesa );
- if ( state ) {
- gmesa->AntialiasMode |= AntialiasModeEnable;
- gmesa->LineMode |= LM_AntialiasEnable;
- } else {
- gmesa->AntialiasMode &= ~AntialiasModeEnable;
- gmesa->LineMode &= ~LM_AntialiasEnable;
- }
- gmesa->dirty |= GAMMA_UPLOAD_LINEMODE;
- break;
-
- case GL_POINT_SMOOTH:
- FLUSH_BATCH( gmesa );
- if ( state ) {
- gmesa->AntialiasMode |= AntialiasModeEnable;
- gmesa->PointMode |= PM_AntialiasEnable;
- } else {
- gmesa->AntialiasMode &= ~AntialiasModeEnable;
- gmesa->PointMode &= ~PM_AntialiasEnable;
- }
- gmesa->dirty |= GAMMA_UPLOAD_POINTMODE;
- break;
-
- case GL_POLYGON_SMOOTH:
- FLUSH_BATCH( gmesa );
- if ( state ) {
- gmesa->AntialiasMode |= AntialiasModeEnable;
- gmesa->TriangleMode |= TM_AntialiasEnable;
- } else {
- gmesa->AntialiasMode &= ~AntialiasModeEnable;
- gmesa->TriangleMode &= ~TM_AntialiasEnable;
- }
- gmesa->dirty |= GAMMA_UPLOAD_TRIMODE;
- break;
-
- case GL_SCISSOR_TEST:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_CLIP;
- break;
-
- case GL_POLYGON_OFFSET_FILL:
- case GL_POLYGON_OFFSET_POINT:
- case GL_POLYGON_OFFSET_LINE:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_POLYGON;
- break;
-
- case GL_LINE_STIPPLE:
- FLUSH_BATCH( gmesa );
- if ( state )
- gmesa->LineMode |= LM_StippleEnable;
- else
- gmesa->LineMode &= ~LM_StippleEnable;
- gmesa->dirty |= GAMMA_UPLOAD_LINEMODE;
- break;
-
- case GL_POLYGON_STIPPLE:
- FLUSH_BATCH( gmesa );
- gmesa->new_state |= GAMMA_NEW_STIPPLE;
- break;
-
- default:
- return;
- }
-}
-
-/* =============================================================
- * State initialization, management
- */
-
-
-/*
- * Load the current context's state into the hardware.
- *
- * NOTE: Be VERY careful about ensuring the context state is marked for
- * upload, the only place it shouldn't be uploaded is when the setup
- * state has changed in ReducedPrimitiveChange as this comes right after
- * a state update.
- *
- * Blits of any type should always upload the context and masks after
- * they are done.
- */
-void gammaEmitHwState( gammaContextPtr gmesa )
-{
- if (!gmesa->driDrawable) return;
-
- if (!gmesa->dirty) return;
-
-#ifdef DO_VALIDATE
- /* Flush any partially filled buffers */
- FLUSH_DMA_BUFFER(gmesa);
-
- DRM_SPINLOCK(&gmesa->driScreen->pSAREA->drawable_lock,
- gmesa->driScreen->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
-#endif
-
- if (gmesa->dirty & GAMMA_UPLOAD_VIEWPORT) {
- gmesa->dirty &= ~GAMMA_UPLOAD_VIEWPORT;
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, ViewPortOffsetX, gmesa->ViewportOffsetX);
- WRITEF(gmesa->buf, ViewPortOffsetY, gmesa->ViewportOffsetY);
- WRITEF(gmesa->buf, ViewPortOffsetZ, gmesa->ViewportOffsetZ);
- WRITEF(gmesa->buf, ViewPortScaleX, gmesa->ViewportScaleX);
- WRITEF(gmesa->buf, ViewPortScaleY, gmesa->ViewportScaleY);
- WRITEF(gmesa->buf, ViewPortScaleZ, gmesa->ViewportScaleZ);
- }
- if ( (gmesa->dirty & GAMMA_UPLOAD_POINTMODE) ||
- (gmesa->dirty & GAMMA_UPLOAD_LINEMODE) ||
- (gmesa->dirty & GAMMA_UPLOAD_TRIMODE) ) {
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, AntialiasMode, gmesa->AntialiasMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_POINTMODE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_POINTMODE;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PointMode, gmesa->PointMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_LINEMODE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_LINEMODE;
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, LineMode, gmesa->LineMode);
- WRITE(gmesa->buf, LineStippleMode, gmesa->LineMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_TRIMODE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_TRIMODE;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TriangleMode, gmesa->TriangleMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_FOG) {
- GLchan c[3], col;
- UNCLAMPED_FLOAT_TO_RGB_CHAN( c, gmesa->glCtx->Fog.Color );
- col = gammaPackColor(4, c[0], c[1], c[2], 0);
- gmesa->dirty &= ~GAMMA_UPLOAD_FOG;
- CHECK_DMA_BUFFER(gmesa, 5);
-#if 0
- WRITE(gmesa->buf, FogMode, gmesa->FogMode);
- WRITE(gmesa->buf, FogColor, col);
- WRITEF(gmesa->buf, FStart, gmesa->glCtx->Fog.Start);
-#endif
- WRITEF(gmesa->buf, FogEnd, gmesa->glCtx->Fog.End);
- WRITEF(gmesa->buf, FogDensity, gmesa->glCtx->Fog.Density);
- WRITEF(gmesa->buf, FogScale,
- 1.0f/(gmesa->glCtx->Fog.End - gmesa->glCtx->Fog.Start));
- }
- if (gmesa->dirty & GAMMA_UPLOAD_DITHER) {
- gmesa->dirty &= ~GAMMA_UPLOAD_DITHER;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, DitherMode, gmesa->DitherMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_LOGICOP) {
- gmesa->dirty &= ~GAMMA_UPLOAD_LOGICOP;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, LogicalOpMode, gmesa->LogicalOpMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_CLIP) {
- gmesa->dirty &= ~GAMMA_UPLOAD_CLIP;
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITE(gmesa->buf, ScissorMinXY, gmesa->ScissorMinXY);
- WRITE(gmesa->buf, ScissorMaxXY, gmesa->ScissorMaxXY);
- WRITE(gmesa->buf, ScissorMode, gmesa->ScissorMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_MASKS) {
- gmesa->dirty &= ~GAMMA_UPLOAD_MASKS;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FBHardwareWriteMask, gmesa->FBHardwareWriteMask);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_ALPHA) {
- gmesa->dirty &= ~GAMMA_UPLOAD_ALPHA;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, AlphaTestMode, gmesa->AlphaTestMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_BLEND) {
- gmesa->dirty &= ~GAMMA_UPLOAD_BLEND;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, AlphaBlendMode, gmesa->AlphaBlendMode);
- }
- CHECK_DMA_BUFFER(gmesa, 1);
- if (gmesa->glCtx->Color.BlendEnabled || gmesa->glCtx->Color.AlphaEnabled) {
- WRITE(gmesa->buf, FBReadMode, gmesa->FBReadMode | gmesa->AB_FBReadMode_Save);
- } else {
- WRITE(gmesa->buf, FBReadMode, gmesa->FBReadMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_LIGHT) {
- gmesa->dirty &= ~GAMMA_UPLOAD_LIGHT;
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, LightingMode, gmesa->LightingMode);
- WRITE(gmesa->buf, MaterialMode, gmesa->MaterialMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_SHADE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_SHADE;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, ColorDDAMode, gmesa->ColorDDAMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_POLYGON) {
- gmesa->dirty &= ~GAMMA_UPLOAD_POLYGON;
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITEF(gmesa->buf, PolygonOffsetBias, gmesa->glCtx->Polygon.OffsetUnits);
- WRITEF(gmesa->buf, PolygonOffsetFactor, gmesa->glCtx->Polygon.OffsetFactor);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_STIPPLE) {
- gmesa->dirty &= ~GAMMA_UPLOAD_STIPPLE;
- CHECK_DMA_BUFFER(gmesa, 33);
- WRITE(gmesa->buf, AreaStippleMode, gmesa->AreaStippleMode);
- WRITE(gmesa->buf, AreaStipplePattern0, gmesa->glCtx->PolygonStipple[0]);
- WRITE(gmesa->buf, AreaStipplePattern1, gmesa->glCtx->PolygonStipple[1]);
- WRITE(gmesa->buf, AreaStipplePattern2, gmesa->glCtx->PolygonStipple[2]);
- WRITE(gmesa->buf, AreaStipplePattern3, gmesa->glCtx->PolygonStipple[3]);
- WRITE(gmesa->buf, AreaStipplePattern4, gmesa->glCtx->PolygonStipple[4]);
- WRITE(gmesa->buf, AreaStipplePattern5, gmesa->glCtx->PolygonStipple[5]);
- WRITE(gmesa->buf, AreaStipplePattern6, gmesa->glCtx->PolygonStipple[6]);
- WRITE(gmesa->buf, AreaStipplePattern7, gmesa->glCtx->PolygonStipple[7]);
- WRITE(gmesa->buf, AreaStipplePattern8, gmesa->glCtx->PolygonStipple[8]);
- WRITE(gmesa->buf, AreaStipplePattern9, gmesa->glCtx->PolygonStipple[9]);
- WRITE(gmesa->buf, AreaStipplePattern10, gmesa->glCtx->PolygonStipple[10]);
- WRITE(gmesa->buf, AreaStipplePattern11, gmesa->glCtx->PolygonStipple[11]);
- WRITE(gmesa->buf, AreaStipplePattern12, gmesa->glCtx->PolygonStipple[12]);
- WRITE(gmesa->buf, AreaStipplePattern13, gmesa->glCtx->PolygonStipple[13]);
- WRITE(gmesa->buf, AreaStipplePattern14, gmesa->glCtx->PolygonStipple[14]);
- WRITE(gmesa->buf, AreaStipplePattern15, gmesa->glCtx->PolygonStipple[15]);
- WRITE(gmesa->buf, AreaStipplePattern16, gmesa->glCtx->PolygonStipple[16]);
- WRITE(gmesa->buf, AreaStipplePattern17, gmesa->glCtx->PolygonStipple[17]);
- WRITE(gmesa->buf, AreaStipplePattern18, gmesa->glCtx->PolygonStipple[18]);
- WRITE(gmesa->buf, AreaStipplePattern19, gmesa->glCtx->PolygonStipple[19]);
- WRITE(gmesa->buf, AreaStipplePattern20, gmesa->glCtx->PolygonStipple[20]);
- WRITE(gmesa->buf, AreaStipplePattern21, gmesa->glCtx->PolygonStipple[21]);
- WRITE(gmesa->buf, AreaStipplePattern22, gmesa->glCtx->PolygonStipple[22]);
- WRITE(gmesa->buf, AreaStipplePattern23, gmesa->glCtx->PolygonStipple[23]);
- WRITE(gmesa->buf, AreaStipplePattern24, gmesa->glCtx->PolygonStipple[24]);
- WRITE(gmesa->buf, AreaStipplePattern25, gmesa->glCtx->PolygonStipple[25]);
- WRITE(gmesa->buf, AreaStipplePattern26, gmesa->glCtx->PolygonStipple[26]);
- WRITE(gmesa->buf, AreaStipplePattern27, gmesa->glCtx->PolygonStipple[27]);
- WRITE(gmesa->buf, AreaStipplePattern28, gmesa->glCtx->PolygonStipple[28]);
- WRITE(gmesa->buf, AreaStipplePattern29, gmesa->glCtx->PolygonStipple[29]);
- WRITE(gmesa->buf, AreaStipplePattern30, gmesa->glCtx->PolygonStipple[30]);
- WRITE(gmesa->buf, AreaStipplePattern31, gmesa->glCtx->PolygonStipple[31]);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_DEPTH) {
- gmesa->dirty &= ~GAMMA_UPLOAD_DEPTH;
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITE(gmesa->buf, DepthMode, gmesa->DepthMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
- WRITE(gmesa->buf, GLINTWindow,gmesa->Window | (gmesa->FrameCount << 9));
- WRITE(gmesa->buf, LBReadMode, gmesa->LBReadMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_GEOMETRY) {
- gmesa->dirty &= ~GAMMA_UPLOAD_GEOMETRY;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, GeometryMode, gmesa->GeometryMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_TRANSFORM) {
- gmesa->dirty &= ~GAMMA_UPLOAD_TRANSFORM;
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TransformMode, gmesa->TransformMode);
- }
- if (gmesa->dirty & GAMMA_UPLOAD_TEX0) {
- gammaTextureObjectPtr curTex = gmesa->CurrentTexObj[0];
- gmesa->dirty &= ~GAMMA_UPLOAD_TEX0;
- if (curTex) {
- CHECK_DMA_BUFFER(gmesa, 21);
- WRITE(gmesa->buf, GeometryMode, gmesa->GeometryMode | GM_TextureEnable);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode | DM_TextureEnable);
- WRITE(gmesa->buf, TextureAddressMode, curTex->TextureAddressMode);
- WRITE(gmesa->buf, TextureReadMode, curTex->TextureReadMode);
- WRITE(gmesa->buf, TextureColorMode, curTex->TextureColorMode);
- WRITE(gmesa->buf, TextureFilterMode, curTex->TextureFilterMode);
- WRITE(gmesa->buf, TextureFormat, curTex->TextureFormat);
- WRITE(gmesa->buf, GLINTBorderColor, curTex->TextureBorderColor);
- WRITE(gmesa->buf, TxBaseAddr0, curTex->TextureBaseAddr[0]);
- WRITE(gmesa->buf, TxBaseAddr1, curTex->TextureBaseAddr[1]);
- WRITE(gmesa->buf, TxBaseAddr2, curTex->TextureBaseAddr[2]);
- WRITE(gmesa->buf, TxBaseAddr3, curTex->TextureBaseAddr[3]);
- WRITE(gmesa->buf, TxBaseAddr4, curTex->TextureBaseAddr[4]);
- WRITE(gmesa->buf, TxBaseAddr5, curTex->TextureBaseAddr[5]);
- WRITE(gmesa->buf, TxBaseAddr6, curTex->TextureBaseAddr[6]);
- WRITE(gmesa->buf, TxBaseAddr7, curTex->TextureBaseAddr[7]);
- WRITE(gmesa->buf, TxBaseAddr8, curTex->TextureBaseAddr[8]);
- WRITE(gmesa->buf, TxBaseAddr9, curTex->TextureBaseAddr[9]);
- WRITE(gmesa->buf, TxBaseAddr10, curTex->TextureBaseAddr[10]);
- WRITE(gmesa->buf, TxBaseAddr11, curTex->TextureBaseAddr[11]);
- WRITE(gmesa->buf, TextureCacheControl, (TCC_Enable | TCC_Invalidate));
- } else {
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITE(gmesa->buf, GeometryMode, gmesa->GeometryMode);
- WRITE(gmesa->buf, DeltaMode, gmesa->DeltaMode);
- WRITE(gmesa->buf, TextureAddressMode, TextureAddressModeDisable);
- WRITE(gmesa->buf, TextureReadMode, TextureReadModeDisable);
- WRITE(gmesa->buf, TextureFilterMode, TextureFilterModeDisable);
- WRITE(gmesa->buf, TextureColorMode, TextureColorModeDisable);
- }
- }
-#ifdef DO_VALIDATE
- PROCESS_DMA_BUFFER_TOP_HALF(gmesa);
-
- DRM_SPINUNLOCK(&gmesa->driScreen->pSAREA->drawable_lock,
- gmesa->driScreen->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa);
-
- PROCESS_DMA_BUFFER_BOTTOM_HALF(gmesa);
-#endif
-}
-
-void gammaDDUpdateHWState( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- int new_state = gmesa->new_state;
-
- if ( new_state )
- {
- FLUSH_BATCH( gmesa );
-
- gmesa->new_state = 0;
-
- /* Update the various parts of the context's state.
- */
- if ( new_state & GAMMA_NEW_ALPHA )
- gammaUpdateAlphaMode( ctx );
-
- if ( new_state & GAMMA_NEW_DEPTH )
- gammaUpdateZMode( ctx );
-
- if ( new_state & GAMMA_NEW_FOG )
- gammaUpdateFogAttrib( ctx );
-
- if ( new_state & GAMMA_NEW_CLIP )
- gammaUpdateClipping( ctx );
-
- if ( new_state & GAMMA_NEW_POLYGON )
- gammaUpdatePolygon( ctx );
-
- if ( new_state & GAMMA_NEW_CULL )
- gammaUpdateCull( ctx );
-
- if ( new_state & GAMMA_NEW_MASKS )
- gammaUpdateMasks( ctx );
-
- if ( new_state & GAMMA_NEW_WINDOW )
- gammaUpdateWindow( ctx );
-
- if ( new_state & GAMMA_NEW_STIPPLE )
- gammaUpdateStipple( ctx );
- }
-
- /* HACK ! */
-
- gammaEmitHwState( gmesa );
-}
-
-
-static void gammaDDUpdateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- GAMMA_CONTEXT(ctx)->new_gl_state |= new_state;
-}
-
-
-/* Initialize the context's hardware state.
- */
-void gammaDDInitState( gammaContextPtr gmesa )
-{
- gmesa->new_state = 0;
-}
-
-/* Initialize the driver's state functions.
- */
-void gammaDDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = gammaDDUpdateState;
-
- ctx->Driver.Clear = gammaDDClear;
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearColor = gammaDDClearColor;
- ctx->Driver.DrawBuffer = gammaDDDrawBuffer;
- ctx->Driver.ReadBuffer = gammaDDReadBuffer;
-
- ctx->Driver.IndexMask = NULL;
- ctx->Driver.ColorMask = gammaDDColorMask;
-
- ctx->Driver.AlphaFunc = gammaDDAlphaFunc;
- ctx->Driver.BlendEquationSeparate = gammaDDBlendEquationSeparate;
- ctx->Driver.BlendFuncSeparate = gammaDDBlendFuncSeparate;
- ctx->Driver.ClearDepth = gammaDDClearDepth;
- ctx->Driver.CullFace = gammaDDCullFace;
- ctx->Driver.FrontFace = gammaDDFrontFace;
- ctx->Driver.DepthFunc = gammaDDDepthFunc;
- ctx->Driver.DepthMask = gammaDDDepthMask;
- ctx->Driver.DepthRange = gammaDDDepthRange;
- ctx->Driver.Enable = gammaDDEnable;
- ctx->Driver.Finish = gammaDDFinish;
- ctx->Driver.Flush = gammaDDFlush;
-#if 0
- ctx->Driver.Fogfv = gammaDDFogfv;
-#endif
- ctx->Driver.Hint = NULL;
- ctx->Driver.LineWidth = gammaDDLineWidth;
- ctx->Driver.LineStipple = gammaDDLineStipple;
-#if ENABLELIGHTING
- ctx->Driver.Lightfv = gammaDDLightfv;
- ctx->Driver.LightModelfv = gammaDDLightModelfv;
-#endif
- ctx->Driver.LogicOpcode = gammaDDLogicalOpcode;
- ctx->Driver.PointSize = gammaDDPointSize;
- ctx->Driver.PolygonMode = gammaDDPolygonMode;
- ctx->Driver.PolygonStipple = gammaDDPolygonStipple;
- ctx->Driver.Scissor = gammaDDScissor;
- ctx->Driver.ShadeModel = gammaDDShadeModel;
- ctx->Driver.Viewport = gammaDDViewport;
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_tex.c b/src/mesa/drivers/dri/gamma/gamma_tex.c
deleted file mode 100644
index 694e5eba5bb..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_tex.c
+++ /dev/null
@@ -1,434 +0,0 @@
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/colormac.h"
-#include "main/imports.h"
-#include "main/simple_list.h"
-#include "main/enums.h"
-#include "main/mm.h"
-#include "main/texstore.h"
-#include "main/teximage.h"
-#include "main/texobj.h"
-
-#include "swrast/swrast.h"
-
-#include "gammacontext.h"
-
-
-/*
- * Compute the 'S2.4' lod bias factor from the floating point OpenGL bias.
- */
-#if 0
-static GLuint gammaComputeLodBias(GLfloat bias)
-{
- return bias;
-}
-#endif
-
-static void gammaSetTexWrapping(gammaTextureObjectPtr t,
- GLenum wraps, GLenum wrapt)
-{
- uint32_t t1 = t->TextureAddressMode;
- uint32_t t2 = t->TextureReadMode;
-
- t1 &= ~(TAM_SWrap_Mask | TAM_TWrap_Mask);
- t2 &= ~(TRM_UWrap_Mask | TRM_VWrap_Mask);
-
- if (wraps != GL_CLAMP) {
- t1 |= TAM_SWrap_Repeat;
- t2 |= TRM_UWrap_Repeat;
- }
-
- if (wrapt != GL_CLAMP) {
- t1 |= TAM_TWrap_Repeat;
- t2 |= TRM_VWrap_Repeat;
- }
-
- t->TextureAddressMode = t1;
- t->TextureReadMode = t2;
-}
-
-
-static void gammaSetTexFilter(gammaContextPtr gmesa,
- gammaTextureObjectPtr t,
- GLenum minf, GLenum magf,
- GLfloat bias)
-{
- uint32_t t1 = t->TextureAddressMode;
- uint32_t t2 = t->TextureReadMode;
-
- t2 &= ~(TRM_Mag_Mask | TRM_Min_Mask);
-
- switch (minf) {
- case GL_NEAREST:
- t1 &= ~TAM_LODEnable;
- t2 &= ~TRM_MipMapEnable;
- t2 |= TRM_Min_Nearest;
- break;
- case GL_LINEAR:
- t1 &= ~TAM_LODEnable;
- t2 &= ~TRM_MipMapEnable;
- t2 |= TRM_Min_Linear;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t2 |= TRM_Min_NearestMMNearest;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t2 |= TRM_Min_LinearMMNearest;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- t2 |= TRM_Min_NearestMMLinear;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- t2 |= TRM_Min_LinearMMLinear;
- break;
- default:
- break;
- }
-
- switch (magf) {
- case GL_NEAREST:
- t2 |= TRM_Mag_Nearest;
- break;
- case GL_LINEAR:
- t2 |= TRM_Mag_Linear;
- break;
- default:
- break;
- }
-
- t->TextureAddressMode = t1;
- t->TextureReadMode = t2;
-}
-
-
-static void gammaSetTexBorderColor(gammaContextPtr gmesa,
- gammaTextureObjectPtr t,
- const GLfloat color[4])
-{
- GLubyte c[4];
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
- t->TextureBorderColor = PACK_COLOR_8888(c[0], c[1], c[2], c[3]);
-}
-
-
-static void gammaTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData;
- if (!t)
- return;
-
- /* Can't do the update now as we don't know whether to flush
- * vertices or not. Setting gmesa->new_state means that
- * gammaUpdateTextureState() will be called before any triangles are
- * rendered. If a statechange has occurred, it will be detected at
- * that point, and buffered vertices flushed.
- */
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- {
- GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias;
- gammaSetTexFilter( gmesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- }
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- gammaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- gammaSetTexBorderColor( gmesa, t, tObj->BorderColor.f );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative for Radeon. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- gammaSwapOutTexObj( gmesa, t );
- break;
-
- default:
- return;
- }
-
- if (t == gmesa->CurrentTexObj[0])
- gmesa->dirty |= GAMMA_UPLOAD_TEX0;
-
-#if 0
- if (t == gmesa->CurrentTexObj[1]) {
- gmesa->dirty |= GAMMA_UPLOAD_TEX1;
- }
-#endif
-}
-
-
-static void gammaTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
-
- /* Only one env color. Need a fallback if env colors are different
- * and texture setup references env color in both units.
- */
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR: {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLfloat *fc = texUnit->EnvColor;
- GLuint r, g, b, a, col;
- CLAMPED_FLOAT_TO_UBYTE(r, fc[0]);
- CLAMPED_FLOAT_TO_UBYTE(g, fc[1]);
- CLAMPED_FLOAT_TO_UBYTE(b, fc[2]);
- CLAMPED_FLOAT_TO_UBYTE(a, fc[3]);
-
- col = ((a << 24) |
- (r << 16) |
- (g << 8) |
- (b << 0));
-
- break;
- }
- case GL_TEXTURE_ENV_MODE:
- gmesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
- break;
-
- case GL_TEXTURE_LOD_BIAS_EXT:
-#if 0 /* ?!?!?! */
- {
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData;
- (void) t;
- /* XXX Looks like there's something missing here */
- }
-#endif
- break;
-
- default:
- break;
- }
-}
-
-#if 0
-static void gammaTexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *pack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) texObj->DriverData;
- if (t) {
- gammaSwapOutTexObj( GAMMA_CONTEXT(ctx), t );
- }
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, pack, texObj, texImage );
-}
-#endif
-
-#if 0
-static void gammaTexSubImage1D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *pack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) texObj->DriverData;
- if (t) {
- gammaSwapOutTexObj( GAMMA_CONTEXT(ctx), t );
- }
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, pack, texObj,
- texImage);
-}
-#endif
-
-static void gammaTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) texObj->DriverData;
- if (t) {
- gammaSwapOutTexObj( GAMMA_CONTEXT(ctx), t );
- }
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
-}
-
-static void gammaTexSubImage2D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) texObj->DriverData;
- if (t) {
- gammaSwapOutTexObj( GAMMA_CONTEXT(ctx), t );
- }
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-}
-
-static void gammaBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData;
-
- if (!t) {
- GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias;
- t = CALLOC_STRUCT(gamma_texture_object_t);
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->globj = tObj;
-
- t->TextureAddressMode = TextureAddressModeEnable | TAM_Operation_3D |
- TAM_DY_Enable | TAM_LODEnable;
- t->TextureReadMode = TextureReadModeEnable | TRM_PrimaryCacheEnable |
- TRM_MipMapEnable | TRM_BorderClamp | TRM_Border;
- t->TextureColorMode = TextureColorModeEnable;
- t->TextureFilterMode = TextureFilterModeEnable;
-
- if (target == GL_TEXTURE_2D) {
- t->TextureAddressMode |= TAM_TexMapType_2D;
- t->TextureReadMode |= TRM_TexMapType_2D;
- }
- else if (target == GL_TEXTURE_1D) {
- t->TextureAddressMode |= TAM_TexMapType_1D;
- t->TextureReadMode |= TRM_TexMapType_1D;
- }
-
- t->TextureColorMode = TextureColorModeEnable;
-
- t->TextureFilterMode = TextureFilterModeEnable;
-
-#ifdef MESA_LITTLE_ENDIAN
- t->TextureFormat = (TF_LittleEndian |
-#else
- t->TextureFormat = (TF_BigEndian |
-#endif
- TF_ColorOrder_RGB |
- TF_OutputFmt_Texel);
-
- t->dirty_images = ~0;
-
- tObj->DriverData = t;
- make_empty_list( t );
-
- gammaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- gammaSetTexFilter( gmesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- gammaSetTexBorderColor( gmesa, t, tObj->BorderColor.f );
- }
-}
-
-static void gammaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData;
-
- if (t) {
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
-#if 0
- if (gmesa)
- GAMMA_FIREVERTICES( gmesa );
-#endif
- gammaDestroyTexObj( gmesa, t );
- tObj->DriverData = 0;
- }
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, tObj);
-}
-
-static GLboolean gammaIsTextureResident( GLcontext *ctx,
- struct gl_texture_object *tObj )
-{
- gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData;
- return t && t->MemBlock;
-}
-
-#ifdef UNUSED
-/**
- * Allocate a new texture object.
- * Called via ctx->Driver.NewTextureObject.
- * Note: this function will be called during context creation to
- * allocate the default texture objects.
- * Note: we could use containment here to 'derive' the driver-specific
- * texture object from the core mesa gl_texture_object. Not done at this time.
- */
-static struct gl_texture_object *
-gammaNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- return obj;
-}
-#endif
-
-void gammaInitTextureObjects( GLcontext *ctx )
-{
- struct gl_texture_object *texObj;
- GLuint tmp = ctx->Texture.CurrentUnit;
-
- ctx->Texture.CurrentUnit = 0;
-
- texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX];
- gammaBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
- gammaBindTexture( ctx, GL_TEXTURE_2D, texObj );
-
-#if 0
- ctx->Texture.CurrentUnit = 1;
-
- texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX];
- gammaBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX];
- gammaBindTexture( ctx, GL_TEXTURE_2D, texObj );
-#endif
-
- ctx->Texture.CurrentUnit = tmp;
-}
-
-
-void gammaDDInitTextureFuncs( struct dd_function_table *functions )
-{
- functions->TexEnv = gammaTexEnv;
- functions->TexImage2D = gammaTexImage2D;
- functions->TexSubImage2D = gammaTexSubImage2D;
- functions->BindTexture = gammaBindTexture;
- functions->DeleteTexture = gammaDeleteTexture;
- functions->TexParameter = gammaTexParameter;
- functions->IsTextureResident = gammaIsTextureResident;
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_texmem.c b/src/mesa/drivers/dri/gamma/gamma_texmem.c
deleted file mode 100644
index 4cb47e179ee..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_texmem.c
+++ /dev/null
@@ -1,534 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "main/glheader.h"
-#include "colormac.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "main/simple_list.h"
-#include "main/enums.h"
-
-#include "main/mm.h"
-#include "glint_dri.h"
-#include "gammacontext.h"
-#include "gamma_lock.h"
-
-void gammaDestroyTexObj(gammaContextPtr gmesa, gammaTextureObjectPtr t)
-{
- if (!t) return;
-
- /* This is sad - need to sync *in case* we upload a texture
- * to this newly free memory...
- */
- if (t->MemBlock) {
- mmFreeMem(t->MemBlock);
- t->MemBlock = 0;
-
- if (gmesa && t->age > gmesa->dirtyAge)
- gmesa->dirtyAge = t->age;
- }
-
- if (t->globj)
- t->globj->DriverData = 0;
-
- if (gmesa) {
- if (gmesa->CurrentTexObj[0] == t) {
- gmesa->CurrentTexObj[0] = 0;
- gmesa->dirty &= ~GAMMA_UPLOAD_TEX0;
- }
-
-#if 0
- if (gmesa->CurrentTexObj[1] == t) {
- gmesa->CurrentTexObj[1] = 0;
- gmesa->dirty &= ~GAMMA_UPLOAD_TEX1;
- }
-#endif
- }
-
- remove_from_list(t);
- free(t);
-}
-
-
-void gammaSwapOutTexObj(gammaContextPtr gmesa, gammaTextureObjectPtr t)
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (t->MemBlock) {
- mmFreeMem(t->MemBlock);
- t->MemBlock = 0;
-
- if (t->age > gmesa->dirtyAge)
- gmesa->dirtyAge = t->age;
- }
-
- t->dirty_images = ~0;
- move_to_tail(&(gmesa->SwappedOut), t);
-}
-
-
-
-/* Upload an image from mesa's internal copy.
- */
-static void gammaUploadTexLevel( gammaContextPtr gmesa, gammaTextureObjectPtr t, int level )
-{
- const struct gl_texture_image *image = t->image[level].image;
- int i,j;
- int l2d;
-#if 0
- int offset = 0;
-#endif
- int words, depthLog2;
-
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- l2d = 5; /* 32bits per texel == 1<<5 */
-
- if (level == 0) {
- t->TextureAddressMode &= ~(TAM_WidthMask | TAM_HeightMask);
- t->TextureAddressMode |= (image->WidthLog2 << 9) |
- (image->HeightLog2 << 13);
- t->TextureReadMode &= ~(TRM_WidthMask | TRM_HeightMask |
- TRM_DepthMask | TRM_Border |
- TRM_Patch);
- t->TextureReadMode |= (image->WidthLog2 << 1) |
- (image->HeightLog2 << 5) |
- (l2d << 9);
- t->TextureFormat &= ~(TF_CompnentsMask | TF_OneCompFmt_Mask);
- }
-
- t->TextureBaseAddr[level] = /* ??? */
- (unsigned long)(t->image[level].offset + t->BufAddr) << 5;
-
- CALC_LOG2(depthLog2, 1<<l2d);
- words = (image->Width * image->Height) >> (5-depthLog2);
-
- CHECK_DMA_BUFFER(gmesa, 3);
- WRITE(gmesa->buf, LBWindowBase, t->TextureBaseAddr[level] >> 5);
- WRITE(gmesa->buf, TextureCacheControl, (TCC_Enable | TCC_Invalidate));
- WRITE(gmesa->buf, WaitForCompletion, 0);
- FLUSH_DMA_BUFFER(gmesa);
-
- switch (t->image[level].internalFormat) {
- case GL_RGB:
- case 3:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_3;
-
-#if 0 /* This is the texture download code we SHOULD be using */
- /* In the routines below, but this causes an DMA overrun - WHY ? */
- while (offset < words) {
- int count = gmesa->bufSize;
- int i;
- count -= 3;
- if (count > words-offset) count = words-offset;
-
- gmesa->buf->i = GlintTextureDownloadOffsetTag;
- gmesa->buf++;
- gmesa->buf->i = offset;
- gmesa->buf++;
- gmesa->buf->i = (GlintTextureDataTag | ((count-1) << 16));
- gmesa->buf++;
-
- for (i = 0; i < count; i++) {
- gmesa->buf->i = PACK_COLOR_565(src[0],src[1],src[2]);
- gmesa->buf++;
- src += 3;
- }
-
- gmesa->bufCount = count+3; /* texture data + 3 values */
- offset += count;
-
- FLUSH_DMA_BUFFER(gmesa);
- }
-#else
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_565(src[0],src[1],src[2]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src += 3;
- }
- FLUSH_DMA_BUFFER(gmesa);
-#endif
- }
- break;
-
- case GL_RGBA:
- case 4:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_4;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_8888(src[0],src[1],src[2],src[3]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src += 4;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- case GL_LUMINANCE:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_1 | TF_OneCompFmt_Lum;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_888(src[0],src[0],src[0]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src ++;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- case GL_INTENSITY:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_1 | TF_OneCompFmt_Intensity;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_8888(src[0],src[0],src[0],src[0]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src ++;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- case GL_LUMINANCE_ALPHA:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_2;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_8888(src[0],src[0],src[0],src[1]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src += 2;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- case GL_ALPHA:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- if (level == 0)
- t->TextureFormat |= TF_Compnents_1 | TF_OneCompFmt_Alpha;
-
- /* The UGLY way, and SLOW !, but the above sometimes causes
- * a DMA overrun error ??? FIXME ! */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureDownloadOffset, 0);
- for (i = 0; i < words; i++) {
- unsigned int data;
- data = PACK_COLOR_8888(255,255,255,src[0]);
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, TextureData, data);
- src += 1;
- }
- FLUSH_DMA_BUFFER(gmesa);
- }
- break;
-
- /* TODO: Translate color indices *now*:
- */
- case GL_COLOR_INDEX:
- {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[level].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) {
- for (i = 0 ; i < image->Width ; i++) {
- dst[i] = src[0];
- src += 1;
- }
- }
- }
- break;
-
- default:
- fprintf(stderr, "Not supported texture format %s\n",
- _mesa_lookup_enum_by_nr(image->Format));
- }
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, WaitForCompletion, 0);
- WRITE(gmesa->buf, LBWindowBase, gmesa->LBWindowBase);
-}
-
-void gammaPrintLocalLRU( gammaContextPtr gmesa )
-{
- gammaTextureObjectPtr t;
- int sz = 1 << (gmesa->gammaScreen->logTextureGranularity);
-
- foreach( t, &gmesa->TexObjList ) {
- if (!t->globj)
- fprintf(stderr, "Placeholder %d at %x sz %x\n",
- t->MemBlock->ofs / sz,
- t->MemBlock->ofs,
- t->MemBlock->size);
- else
- fprintf(stderr, "Texture at %x sz %x\n",
- t->MemBlock->ofs,
- t->MemBlock->size);
-
- }
-}
-
-void gammaPrintGlobalLRU( gammaContextPtr gmesa )
-{
- int i, j;
- GAMMATextureRegionPtr list = gmesa->sarea->texList;
-
- for (i = 0, j = GAMMA_NR_TEX_REGIONS ; i < GAMMA_NR_TEX_REGIONS ; i++) {
- fprintf(stderr, "list[%d] age %d next %d prev %d\n",
- j, list[j].age, list[j].next, list[j].prev);
- j = list[j].next;
- if (j == GAMMA_NR_TEX_REGIONS) break;
- }
-
- if (j != GAMMA_NR_TEX_REGIONS)
- fprintf(stderr, "Loop detected in global LRU\n");
-}
-
-
-void gammaResetGlobalLRU( gammaContextPtr gmesa )
-{
- GAMMATextureRegionPtr list = gmesa->sarea->texList;
- int sz = 1 << gmesa->gammaScreen->logTextureGranularity;
- int i;
-
- /* (Re)initialize the global circular LRU list. The last element
- * in the array (GAMMA_NR_TEX_REGIONS) is the sentinal. Keeping it
- * at the end of the array allows it to be addressed rationally
- * when looking up objects at a particular location in texture
- * memory.
- */
- for (i = 0 ; (i+1) * sz <= gmesa->gammaScreen->textureSize ; i++) {
- list[i].prev = i-1;
- list[i].next = i+1;
- list[i].age = 0;
- }
-
- i--;
- list[0].prev = GAMMA_NR_TEX_REGIONS;
- list[i].prev = i-1;
- list[i].next = GAMMA_NR_TEX_REGIONS;
- list[GAMMA_NR_TEX_REGIONS].prev = i;
- list[GAMMA_NR_TEX_REGIONS].next = 0;
- gmesa->sarea->texAge = 0;
-}
-
-
-void gammaUpdateTexLRU( gammaContextPtr gmesa, gammaTextureObjectPtr t )
-{
- int i;
- int logsz = gmesa->gammaScreen->logTextureGranularity;
- int start = t->MemBlock->ofs >> logsz;
- int end = (t->MemBlock->ofs + t->MemBlock->size - 1) >> logsz;
- GAMMATextureRegionPtr list = gmesa->sarea->texList;
-
- gmesa->texAge = ++gmesa->sarea->texAge;
-
- /* Update our local LRU
- */
- move_to_head( &(gmesa->TexObjList), t );
-
- /* Update the global LRU
- */
- for (i = start ; i <= end ; i++) {
-
- list[i].in_use = 1;
- list[i].age = gmesa->texAge;
-
- /* remove_from_list(i)
- */
- list[(unsigned)list[i].next].prev = list[i].prev;
- list[(unsigned)list[i].prev].next = list[i].next;
-
- /* insert_at_head(list, i)
- */
- list[i].prev = GAMMA_NR_TEX_REGIONS;
- list[i].next = list[GAMMA_NR_TEX_REGIONS].next;
- list[(unsigned)list[GAMMA_NR_TEX_REGIONS].next].prev = i;
- list[GAMMA_NR_TEX_REGIONS].next = i;
- }
-}
-
-
-/* Called for every shared texture region which has increased in age
- * since we last held the lock.
- *
- * Figures out which of our textures have been ejected by other clients,
- * and pushes a placeholder texture onto the LRU list to represent
- * the other client's textures.
- */
-void gammaTexturesGone( gammaContextPtr gmesa,
- GLuint offset,
- GLuint size,
- GLuint in_use )
-{
- gammaTextureObjectPtr t, tmp;
-
- foreach_s ( t, tmp, &gmesa->TexObjList ) {
-
- if (t->MemBlock->ofs >= offset + size ||
- t->MemBlock->ofs + t->MemBlock->size <= offset)
- continue;
-
- /* It overlaps - kick it off. Need to hold onto the currently bound
- * objects, however.
- */
- gammaSwapOutTexObj( gmesa, t );
- }
-
- if (in_use) {
- t = (gammaTextureObjectPtr) calloc(1,sizeof(*t));
- if (!t) return;
-
- t->MemBlock = mmAllocMem( gmesa->texHeap, size, 0, offset);
- insert_at_head( &gmesa->TexObjList, t );
- }
-
- /* Reload any lost textures referenced by current vertex buffer.
- */
-#if 0
- if (gmesa->vertex_buffer) {
- int i, j;
-
- fprintf(stderr, "\n\nreload tex\n");
-
- for (i = 0 ; i < gmesa->statenr ; i++) {
- for (j = 0 ; j < 2 ; j++) {
- gammaTextureObjectPtr t = gmesa->state_tex[j][i];
- if (t) {
- if (t->MemBlock == 0)
- gammaUploadTexImages( gmesa, t );
- }
- }
- }
-
- /* Hard to do this with the lock held:
- */
-/* GAMMA_FIREVERTICES( gmesa ); */
- }
-#endif
-}
-
-
-
-
-
-/* This is called with the lock held. May have to eject our own and/or
- * other client's texture objects to make room for the upload.
- */
-void gammaUploadTexImages( gammaContextPtr gmesa, gammaTextureObjectPtr t )
-{
- int i;
- int ofs;
- int numLevels;
-
- /* /fprintf(stderr, "%s\n", __FUNCTION__); */
-#if 0
- LOCK_HARDWARE( gmesa );
-#endif
-
- /* Do we need to eject LRU texture objects?
- */
- if (!t->MemBlock) {
- while (1)
- {
- t->MemBlock = mmAllocMem( gmesa->texHeap, t->totalSize, 12, 0 );
- if (t->MemBlock)
- break;
-
- if (gmesa->TexObjList.prev == gmesa->CurrentTexObj[0] ||
- gmesa->TexObjList.prev == gmesa->CurrentTexObj[1]) {
- fprintf(stderr, "Hit bound texture in upload\n");
- gammaPrintLocalLRU( gmesa );
- return;
- }
-
- if (gmesa->TexObjList.prev == &(gmesa->TexObjList)) {
- fprintf(stderr, "Failed to upload texture, sz %d\n", t->totalSize);
- mmDumpMemInfo( gmesa->texHeap );
- return;
- }
-
- gammaSwapOutTexObj( gmesa, gmesa->TexObjList.prev );
- }
-
- ofs = t->MemBlock->ofs;
- t->BufAddr = (char *)(unsigned long)(gmesa->LBWindowBase + ofs); /* ??? */
-
- if (t == gmesa->CurrentTexObj[0])
- gmesa->dirty |= GAMMA_UPLOAD_TEX0;
-
-#if 0
- if (t == gmesa->CurrentTexObj[1])
- gmesa->dirty |= GAMMA_UPLOAD_TEX1;
-#endif
-
- gammaUpdateTexLRU( gmesa, t );
- }
-
-#if 0
- if (gmesa->dirtyAge >= GET_DISPATCH_AGE(gmesa))
- gammaWaitAgeLocked( gmesa, gmesa->dirtyAge );
-#endif
-
- numLevels = t->lastLevel - t->firstLevel + 1;
- for (i = 0 ; i < numLevels ; i++)
- if (t->dirty_images & (1<<i))
- gammaUploadTexLevel( gmesa, t, i );
-
- t->dirty_images = 0;
-
-#if 0
- UNLOCK_HARDWARE( gmesa );
-#endif
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_texstate.c b/src/mesa/drivers/dri/gamma/gamma_texstate.c
deleted file mode 100644
index b3a318d581b..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_texstate.c
+++ /dev/null
@@ -1,215 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "main/glheader.h"
-#include "main/macros.h"
-#include "main/mtypes.h"
-#include "main/simple_list.h"
-#include "main/enums.h"
-
-#include "main/mm.h"
-#include "gammacontext.h"
-
-static void gammaSetTexImages( gammaContextPtr gmesa,
- struct gl_texture_object *tObj )
-{
- GLuint height, width, pitch, i, log_pitch;
- gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- GLint firstLevel, lastLevel, numLevels;
- GLint log2Width, log2Height;
-
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- t->texelBytes = 2;
-
- /* Compute which mipmap levels we really want to send to the hardware.
- * This depends on the base image size, GL_TEXTURE_MIN_LOD,
- * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
- * Yes, this looks overly complicated, but it's all needed.
- */
- if (tObj->MinFilter == GL_LINEAR || tObj->MinFilter == GL_NEAREST) {
- firstLevel = lastLevel = tObj->BaseLevel;
- }
- else {
- firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, tObj->BaseLevel);
- lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, tObj->BaseLevel);
- lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2);
- lastLevel = MIN2(lastLevel, tObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- }
-
- /* save these values */
- t->firstLevel = firstLevel;
- t->lastLevel = lastLevel;
-
- numLevels = lastLevel - firstLevel + 1;
-
- log2Width = tObj->Image[0][firstLevel]->WidthLog2;
- log2Height = tObj->Image[0][firstLevel]->HeightLog2;
-
-
- /* Figure out the amount of memory required to hold all the mipmap
- * levels. Choose the smallest pitch to accomodate the largest
- * mipmap:
- */
- width = tObj->Image[0][firstLevel]->Width * t->texelBytes;
- for (pitch = 32, log_pitch=2 ; pitch < width ; pitch *= 2 )
- log_pitch++;
-
- /* All images must be loaded at this pitch. Count the number of
- * lines required:
- */
- for ( height = i = 0 ; i < numLevels ; i++ ) {
- t->image[i].image = tObj->Image[0][firstLevel + i];
- t->image[i].offset = height * pitch;
- t->image[i].internalFormat = baseImage->Format;
- height += t->image[i].image->Height;
- t->TextureBaseAddr[i] = /* ??? */
- (unsigned long)(t->image[i].offset + t->BufAddr) << 5;
-
- }
-
- t->Pitch = pitch;
- t->totalSize = height*pitch;
- t->max_level = i-1;
- gmesa->dirty |= GAMMA_UPLOAD_TEX0 /* | GAMMA_UPLOAD_TEX1*/;
-
- gammaUploadTexImages( gmesa, t );
-}
-
-static void gammaUpdateTexEnv( GLcontext *ctx, GLuint unit )
-{
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLuint format = tObj->Image[0][tObj->BaseLevel]->Format;
- gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData;
- GLuint tc;
-
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- tc = t->TextureColorMode & ~(TCM_BaseFormatMask | TCM_ApplicationMask);
-
- switch (format) {
- case GL_RGB:
- tc |= TCM_BaseFormat_RGB;
- break;
- case GL_LUMINANCE:
- tc |= TCM_BaseFormat_Lum;
- break;
- case GL_ALPHA:
- tc |= TCM_BaseFormat_Alpha;
- break;
- case GL_LUMINANCE_ALPHA:
- tc |= TCM_BaseFormat_LumAlpha;
- break;
- case GL_INTENSITY:
- tc |= TCM_BaseFormat_Intensity;
- break;
- case GL_RGBA:
- tc |= TCM_BaseFormat_RGBA;
- break;
- case GL_COLOR_INDEX:
- break;
- }
-
- switch (texUnit->EnvMode) {
- case GL_REPLACE:
- tc |= TCM_Replace;
- break;
- case GL_MODULATE:
- tc |= TCM_Modulate;
- break;
- case GL_ADD:
- /* do nothing ???*/
- break;
- case GL_DECAL:
- tc |= TCM_Decal;
- break;
- case GL_BLEND:
- tc |= TCM_Blend;
- break;
- default:
- fprintf(stderr, "unknown tex env mode");
- return;
- }
-
- t->TextureColorMode = tc;
-}
-
-
-
-
-static void gammaUpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT)
- {
- struct gl_texture_object *tObj = texUnit->_Current;
- gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData;
-
- /* Upload teximages (not pipelined)
- */
- if (t->dirty_images) {
- gammaSetTexImages( gmesa, tObj );
- if (!t->MemBlock) {
- FALLBACK( gmesa, GAMMA_FALLBACK_TEXTURE, GL_TRUE );
- return;
- }
- }
-
-#if 0
- if (tObj->Image[0][tObj->BaseLevel]->Border > 0) {
- FALLBACK( gmesa, GAMMA_FALLBACK_TEXTURE, GL_TRUE );
- return;
- }
-#endif
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if (gmesa->CurrentTexObj[unit] != t) {
- gmesa->dirty |= GAMMA_UPLOAD_TEX0 /* << unit */;
- gmesa->CurrentTexObj[unit] = t;
- gammaUpdateTexLRU( gmesa, t ); /* done too often */
- }
-
- /* Update texture environment if texture object image format or
- * texture environment state has changed.
- */
- if (tObj->Image[0][tObj->BaseLevel]->Format != gmesa->TexEnvImageFmt[unit]) {
- gmesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format;
- gammaUpdateTexEnv( ctx, unit );
- }
- }
- else if (texUnit->_ReallyEnabled) {
- FALLBACK( gmesa, GAMMA_FALLBACK_TEXTURE, GL_TRUE );
- }
- else /*if (gmesa->CurrentTexObj[unit])*/ {
- gmesa->CurrentTexObj[unit] = 0;
- gmesa->TexEnvImageFmt[unit] = 0;
- gmesa->dirty &= ~(GAMMA_UPLOAD_TEX0<<unit);
- }
-}
-
-
-void gammaUpdateTextureState( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
- FALLBACK( gmesa, GAMMA_FALLBACK_TEXTURE, GL_FALSE );
- gammaUpdateTexUnit( ctx, 0 );
-#if 0
- gammaUpdateTexUnit( ctx, 1 );
-#endif
-}
-
-
-
diff --git a/src/mesa/drivers/dri/gamma/gamma_tris.c b/src/mesa/drivers/dri/gamma/gamma_tris.c
deleted file mode 100644
index 2903daf3f12..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_tris.c
+++ /dev/null
@@ -1,659 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Keith Whitwell, <keith@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- */
-
-#include "gammacontext.h"
-#include "gamma_vb.h"
-#include "gamma_tris.h"
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/macros.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/tcontext.h"
-#include "tnl/t_pipeline.h"
-
-
-/***********************************************************************
- * Build hardware rasterization functions *
- ***********************************************************************/
-
-#define GAMMA_RAST_ALPHA_BIT 0x01
-#define GAMMA_RAST_TEX_BIT 0x02
-#define GAMMA_RAST_FLAT_BIT 0x04
-
-static gamma_point_func gamma_point_tab[0x8];
-static gamma_line_func gamma_line_tab[0x8];
-static gamma_tri_func gamma_tri_tab[0x8];
-static gamma_quad_func gamma_quad_tab[0x8];
-
-#define IND (0)
-#define TAG(x) x
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_ALPHA_BIT)
-#define TAG(x) x##_alpha
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_TEX_BIT)
-#define TAG(x) x##_tex
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_ALPHA_BIT|GAMMA_RAST_TEX_BIT)
-#define TAG(x) x##_alpha_tex
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_ALPHA_BIT|GAMMA_RAST_FLAT_BIT)
-#define TAG(x) x##_alpha_flat
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_TEX_BIT|GAMMA_RAST_FLAT_BIT)
-#define TAG(x) x##_tex_flat
-#include "gamma_tritmp.h"
-
-#define IND (GAMMA_RAST_ALPHA_BIT|GAMMA_RAST_TEX_BIT|GAMMA_RAST_FLAT_BIT)
-#define TAG(x) x##_alpha_tex_flat
-#include "gamma_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- gamma_init();
- gamma_init_alpha();
- gamma_init_tex();
- gamma_init_alpha_tex();
- gamma_init_flat();
- gamma_init_alpha_flat();
- gamma_init_tex_flat();
- gamma_init_alpha_tex_flat();
-}
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-static void
-gamma_fallback_quad( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1,
- const gammaVertex *v2,
- const gammaVertex *v3 )
-{
- GLcontext *ctx = gmesa->glCtx;
- SWvertex v[4];
- gamma_translate_vertex( ctx, v0, &v[0] );
- gamma_translate_vertex( ctx, v1, &v[1] );
- gamma_translate_vertex( ctx, v2, &v[2] );
- gamma_translate_vertex( ctx, v3, &v[3] );
- _swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] );
-}
-
-static void
-gamma_fallback_tri( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1,
- const gammaVertex *v2 )
-{
- GLcontext *ctx = gmesa->glCtx;
- SWvertex v[3];
- gamma_translate_vertex( ctx, v0, &v[0] );
- gamma_translate_vertex( ctx, v1, &v[1] );
- gamma_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-static void
-gamma_fallback_line( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1 )
-{
- GLcontext *ctx = gmesa->glCtx;
- SWvertex v[2];
- gamma_translate_vertex( ctx, v0, &v[0] );
- gamma_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-#if 0
-static void
-gamma_fallback_point( gammaContextPtr gmesa,
- const gammaVertex *v0 )
-{
- GLcontext *ctx = gmesa->glCtx;
- SWvertex v[1];
- gamma_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-#endif
-
-
-/***********************************************************************
- * Choose rasterization functions *
- ***********************************************************************/
-
-#define _GAMMA_NEW_RASTER_STATE (_NEW_FOG | \
- _NEW_TEXTURE | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_POINT_SMOOTH | \
- _DD_NEW_TRI_STIPPLE | \
- _DD_NEW_LINE_STIPPLE)
-
-#define LINE_FALLBACK (0)
-#define TRI_FALLBACK (0)
-
-static void gammaChooseRasterState(GLcontext *ctx)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- if ( ctx->Line.SmoothFlag ||
- ctx->Polygon.SmoothFlag ||
- ctx->Point.SmoothFlag )
- gmesa->Begin |= B_AntiAliasEnable;
- else
- gmesa->Begin &= ~B_AntiAliasEnable;
-
- if ( ctx->Texture.Unit[0]._ReallyEnabled ) {
- ind |= GAMMA_RAST_TEX_BIT;
- gmesa->Begin |= B_TextureEnable;
- } else
- gmesa->Begin &= ~B_TextureEnable;
-
- if (flags & DD_LINE_STIPPLE)
- gmesa->Begin |= B_LineStippleEnable;
- else
- gmesa->Begin &= ~B_LineStippleEnable;
-
- if (flags & DD_TRI_STIPPLE)
- gmesa->Begin |= B_AreaStippleEnable;
- else
- gmesa->Begin &= ~B_AreaStippleEnable;
-
- if (ctx->Fog.Enabled)
- gmesa->Begin |= B_FogEnable;
- else
- gmesa->Begin &= ~B_FogEnable;
-
- if (ctx->Color.BlendEnabled || ctx->Color.AlphaEnabled)
- ind |= GAMMA_RAST_ALPHA_BIT;
-
- if ( flags & DD_FLATSHADE )
- ind |= GAMMA_RAST_FLAT_BIT;
-
- gmesa->draw_line = gamma_line_tab[ind];
- gmesa->draw_tri = gamma_tri_tab[ind];
- gmesa->draw_quad = gamma_quad_tab[ind];
- gmesa->draw_point = gamma_point_tab[ind];
-
- /* Hook in fallbacks for specific primitives. CURRENTLY DISABLED
- */
- if (flags & LINE_FALLBACK)
- gmesa->draw_line = gamma_fallback_line;
-
- if (flags & TRI_FALLBACK) {
- gmesa->draw_tri = gamma_fallback_tri;
- gmesa->draw_quad = gamma_fallback_quad;
- }
-}
-
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- gmesa->draw_tri( gmesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- gmesa->draw_quad( gmesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- gmesa->draw_line( gmesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- gmesa->draw_point( gmesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define GAMMA_OFFSET_BIT 0x01
-#define GAMMA_TWOSIDE_BIT 0x02
-#define GAMMA_UNFILLED_BIT 0x04
-#define GAMMA_FALLBACK_BIT 0x08
-#define GAMMA_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[GAMMA_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & GAMMA_FALLBACK_BIT)
-#define DO_OFFSET 0 /* (IND & GAMMA_OFFSET_BIT) */
-#define DO_UNFILLED 0 /* (IND & GAMMA_UNFILLED_BIT) */
-#define DO_TWOSIDE (IND & GAMMA_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 0
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX gammaVertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (gmesa->verts + (e * gmesa->vertex_size * sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE(v->ub4[4][0], (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v->ub4[4][1], (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v->ub4[4][2], (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v->ub4[4][3], (c)[3]); \
-} while (0)
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[4]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[4] = color[idx]
-
-#define LOCAL_VARS(n) \
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
- GLuint color[n]; \
- (void) color;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- B_PrimType_Points,
- B_PrimType_Lines,
- B_PrimType_Lines,
- B_PrimType_Lines,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles,
- B_PrimType_Triangles
-};
-
-static void gammaResetLineStipple( GLcontext *ctx );
-static void gammaRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void gammaRenderPrimitive( GLcontext *ctx, GLenum prim );
-
-#define RASTERIZE(x) if (gmesa->hw_primitive != hw_prim[x]) \
- gammaRasterPrimitive( ctx, hw_prim[x] )
-#define RENDER_PRIMITIVE gmesa->render_primitive
-#define TAG(x) x
-#define IND GAMMA_FALLBACK_BIT
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_TWOSIDE_BIT|GAMMA_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_OFFSET_BIT|GAMMA_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_TWOSIDE_BIT|GAMMA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (GAMMA_TWOSIDE_BIT|GAMMA_OFFSET_BIT|GAMMA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-
-static void init_render_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
-}
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (gammaVertex *)(gammaverts + (x * size * sizeof(int)))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- gmesa->draw_point( gmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- gmesa->draw_line( gmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- gmesa->draw_tri( gmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- gmesa->draw_quad( gmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) gammaRenderPrimitive( ctx, x );
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx); \
- const GLuint size = gmesa->vertex_size; \
- const char *gammaverts = (char *)gmesa->verts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) stipple;
-#define RESET_STIPPLE if ( stipple ) gammaResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) gamma_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void gammaRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint prim = gmesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-static void gammaRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-
-#define _GAMMA_NEW_RENDERSTATE (_DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET)
-
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-static void gammaChooseRenderState(GLcontext *ctx)
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= GAMMA_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= GAMMA_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= GAMMA_UNFILLED_BIT;
- }
-
- if (gmesa->RenderIndex != index) {
- gmesa->RenderIndex = index;
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (gmesa->RenderIndex == 0)
- tnl->Driver.Render.PrimTabVerts = gamma_render_tab_verts;
- else
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = gammaRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = gammaRenderClippedPoly;
- }
-}
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-
-/* Determine the rasterized primitive when not drawing unfilled
- * polygons.
- *
- * Used only for the default render stage which always decomposes
- * primitives to trianges/lines/points. For the accelerated stage,
- * which renders strips as strips, the equivalent calculations are
- * performed in gammarender.c.
- */
-
-static void gammaRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- if (gmesa->hw_primitive != hwprim)
- gmesa->hw_primitive = hwprim;
-}
-
-static void gammaRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- gmesa->render_primitive = prim;
-}
-
-static void gammaRunPipeline( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- if ( gmesa->new_state )
- gammaDDUpdateHWState( ctx );
-
- if (gmesa->new_gl_state) {
- if (gmesa->new_gl_state & _NEW_TEXTURE)
- gammaUpdateTextureState( ctx );
-
- if (!gmesa->Fallback) {
- if (gmesa->new_gl_state & _GAMMA_NEW_VERTEX)
- gammaChooseVertexState( ctx );
-
- if (gmesa->new_gl_state & _GAMMA_NEW_RASTER_STATE)
- gammaChooseRasterState( ctx );
-
- if (gmesa->new_gl_state & _GAMMA_NEW_RENDERSTATE)
- gammaChooseRenderState( ctx );
- }
-
- gmesa->new_gl_state = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void gammaRenderStart( GLcontext *ctx )
-{
- /* Check for projective texturing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
- gammaCheckTexSizes( ctx );
-}
-
-static void gammaRenderFinish( GLcontext *ctx )
-{
- if (0)
- _swrast_flush( ctx ); /* never needed */
-}
-
-static void gammaResetLineStipple( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
-
- /* Reset the hardware stipple counter.
- */
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, UpdateLineStippleCounters, 0);
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-
-void gammaFallback( gammaContextPtr gmesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = gmesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = gmesa->Fallback;
-
- if (mode) {
- gmesa->Fallback |= bit;
- if (oldfallback == 0) {
- _swsetup_Wakeup( ctx );
- _tnl_need_projected_coords( ctx, GL_TRUE );
- gmesa->RenderIndex = ~0;
- }
- }
- else {
- gmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = gammaRenderStart;
- tnl->Driver.Render.PrimitiveNotify = gammaRenderPrimitive;
- tnl->Driver.Render.Finish = gammaRenderFinish;
- tnl->Driver.Render.BuildVertices = gammaBuildVertices;
- tnl->Driver.Render.ResetLineStipple = gammaResetLineStipple;
- gmesa->new_gl_state |= (_GAMMA_NEW_RENDERSTATE|
- _GAMMA_NEW_RASTER_STATE|
- _GAMMA_NEW_VERTEX);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void gammaDDInitTriFuncs( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- init_render_tab();
- firsttime = 0;
- }
-
- gmesa->RenderIndex = ~0;
-
- tnl->Driver.RunPipeline = gammaRunPipeline;
- tnl->Driver.Render.Start = gammaRenderStart;
- tnl->Driver.Render.Finish = gammaRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = gammaRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = gammaResetLineStipple;
- tnl->Driver.Render.BuildVertices = gammaBuildVertices;
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_tris.h b/src/mesa/drivers/dri/gamma/gamma_tris.h
deleted file mode 100644
index 02bec286903..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_tris.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Keith Whitwell, <keith@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- */
-
-#ifndef _GAMMA_TRIS_H
-#define _GAMMA_TRIS_H
-
-extern void gammaDDTrifuncInit(void);
-extern void gammaDDChooseTriRenderState(GLcontext *);
-
-
-
-#endif /* !(_GAMMA_TRIS_H) */
diff --git a/src/mesa/drivers/dri/gamma/gamma_tritmp.h b/src/mesa/drivers/dri/gamma/gamma_tritmp.h
deleted file mode 100644
index bea2508d4a2..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_tritmp.h
+++ /dev/null
@@ -1,496 +0,0 @@
-
-static void TAG(gamma_point)( gammaContextPtr gmesa,
- const gammaVertex *v0 )
-{
- uint32_t vColor;
- uint32_t vBegin;
-
- vBegin = gmesa->Begin | B_PrimType_Points;
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, vBegin);
-
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v0->v.color.alpha << 24) |
- (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v0->v.u0);
- WRITEF(gmesa->buf, Ts2, v0->v.v0);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
-#endif
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-static void TAG(gamma_line)( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1 )
-{
- uint32_t vColor;
- uint32_t vBegin;
-
- vBegin = gmesa->Begin | B_PrimType_Lines;
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, vBegin);
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v0->v.color.alpha << 24) |
- (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#else
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v1->v.color.alpha << 24) |
- (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v0->v.u0);
- WRITEF(gmesa->buf, Ts2, v0->v.v0);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v1->v.color.alpha << 24) |
- (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v1->v.u0);
- WRITEF(gmesa->buf, Ts2, v1->v.v0);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
-#endif
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-static void TAG(gamma_triangle)( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1,
- const gammaVertex *v2 )
-{
- uint32_t vColor;
- uint32_t vBegin;
-
- vBegin = gmesa->Begin | B_PrimType_Triangles;
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, vBegin);
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v0->v.color.alpha << 24) |
- (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#else
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v2->v.color.alpha << 24) |
- (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v0->v.u0);
- WRITEF(gmesa->buf, Ts2, v0->v.v0);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v1->v.color.alpha << 24) |
- (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v1->v.u0);
- WRITEF(gmesa->buf, Ts2, v1->v.v0);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v2->v.color.alpha << 24) |
- (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v2->v.u0);
- WRITEF(gmesa->buf, Ts2, v2->v.v0);
- WRITEF(gmesa->buf, Vw, v2->v.w);
- WRITEF(gmesa->buf, Vz, v2->v.z);
- WRITEF(gmesa->buf, Vy, v2->v.y);
- WRITEF(gmesa->buf, Vx4, v2->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v2->v.w);
- WRITEF(gmesa->buf, Vz, v2->v.z);
- WRITEF(gmesa->buf, Vy, v2->v.y);
- WRITEF(gmesa->buf, Vx4, v2->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
-#endif
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-static void TAG(gamma_quad)( gammaContextPtr gmesa,
- const gammaVertex *v0,
- const gammaVertex *v1,
- const gammaVertex *v2,
- const gammaVertex *v3 )
-{
- uint32_t vColor;
- uint32_t vBegin;
-
- vBegin = gmesa->Begin | B_PrimType_Quads;
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, Begin, vBegin);
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v0->v.color.alpha << 24) |
- (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v0->v.color.blue << 16) |
- (v0->v.color.green << 8) |
- (v0->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#else
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v3->v.color.alpha << 24) |
- (v3->v.color.blue << 16) |
- (v3->v.color.green << 8) |
- (v3->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v3->v.color.blue << 16) |
- (v3->v.color.green << 8) |
- (v3->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v0->v.u0);
- WRITEF(gmesa->buf, Ts2, v0->v.v0);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v0->v.w);
- WRITEF(gmesa->buf, Vz, v0->v.z);
- WRITEF(gmesa->buf, Vy, v0->v.y);
- WRITEF(gmesa->buf, Vx4, v0->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v1->v.color.alpha << 24) |
- (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v1->v.color.blue << 16) |
- (v1->v.color.green << 8) |
- (v1->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v1->v.u0);
- WRITEF(gmesa->buf, Ts2, v1->v.v0);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v1->v.w);
- WRITEF(gmesa->buf, Vz, v1->v.z);
- WRITEF(gmesa->buf, Vy, v1->v.y);
- WRITEF(gmesa->buf, Vx4, v1->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v2->v.color.alpha << 24) |
- (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v2->v.color.blue << 16) |
- (v2->v.color.green << 8) |
- (v2->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v2->v.u0);
- WRITEF(gmesa->buf, Ts2, v2->v.v0);
- WRITEF(gmesa->buf, Vw, v2->v.w);
- WRITEF(gmesa->buf, Vz, v2->v.z);
- WRITEF(gmesa->buf, Vy, v2->v.y);
- WRITEF(gmesa->buf, Vx4, v2->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v2->v.w);
- WRITEF(gmesa->buf, Vz, v2->v.z);
- WRITEF(gmesa->buf, Vy, v2->v.y);
- WRITEF(gmesa->buf, Vx4, v2->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
-#if (IND & GAMMA_RAST_ALPHA_BIT)
- vColor = (v3->v.color.alpha << 24) |
- (v3->v.color.blue << 16) |
- (v3->v.color.green << 8) |
- (v3->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor4, vColor);
-#else
- vColor = (v3->v.color.blue << 16) |
- (v3->v.color.green << 8) |
- (v3->v.color.red << 0);
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, PackedColor3, vColor);
-#endif
-#endif
-
-#if (IND & GAMMA_RAST_TEX_BIT)
- CHECK_DMA_BUFFER(gmesa, 6);
- WRITEF(gmesa->buf, Tt2, v3->v.u0);
- WRITEF(gmesa->buf, Ts2, v3->v.v0);
- WRITEF(gmesa->buf, Vw, v3->v.w);
- WRITEF(gmesa->buf, Vz, v3->v.z);
- WRITEF(gmesa->buf, Vy, v3->v.y);
- WRITEF(gmesa->buf, Vx4, v3->v.x);
-#else
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITEF(gmesa->buf, Vw, v3->v.w);
- WRITEF(gmesa->buf, Vz, v3->v.z);
- WRITEF(gmesa->buf, Vy, v3->v.y);
- WRITEF(gmesa->buf, Vx4, v3->v.x);
-#endif
-
-#if !(IND & GAMMA_RAST_FLAT_BIT)
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, FlushSpan, 0);
-#endif
-
- CHECK_DMA_BUFFER(gmesa, 1);
- WRITE(gmesa->buf, End, 0);
-}
-
-static void TAG(gamma_init)(void)
-{
- gamma_point_tab[IND] = TAG(gamma_point);
- gamma_line_tab[IND] = TAG(gamma_line);
- gamma_tri_tab[IND] = TAG(gamma_triangle);
- gamma_quad_tab[IND] = TAG(gamma_quad);
-}
-
-#undef IND
-#undef TAG
diff --git a/src/mesa/drivers/dri/gamma/gamma_vb.c b/src/mesa/drivers/dri/gamma/gamma_vb.c
deleted file mode 100644
index 23ca0714c59..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_vb.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Keith Whitwell, <keith@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- */
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/imports.h"
-#include "main/macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tcontext.h"
-#include "tnl/tnl.h"
-
-#include "gammacontext.h"
-#include "gamma_vb.h"
-#include "gamma_tris.h"
-
-
-#define GAMMA_TEX0_BIT 0x1
-#define GAMMA_RGBA_BIT 0x2
-#define GAMMA_XYZW_BIT 0x4
-#define GAMMA_PTEX_BIT 0x8
-#define GAMMA_FOG_BIT 0x10
-#define GAMMA_SPEC_BIT 0x20
-#define GAMMA_MAX_SETUP 0x40
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- tnl_interp_func interp;
- tnl_copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_size;
- GLuint vertex_format;
-} setup_tab[GAMMA_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT 1
-#define NOTEX_VERTEX_FORMAT 2
-#define TEX0_VERTEX_FORMAT 3
-#define TEX1_VERTEX_FORMAT 0
-#define PROJ_TEX1_VERTEX_FORMAT 0
-#define TEX2_VERTEX_FORMAT 0
-#define TEX3_VERTEX_FORMAT 0
-#define PROJ_TEX3_VERTEX_FORMAT 0
-
-#define DO_XYZW (IND & GAMMA_XYZW_BIT)
-#define DO_RGBA (IND & GAMMA_RGBA_BIT)
-#define DO_SPEC (IND & GAMMA_SPEC_BIT)
-#define DO_FOG (IND & GAMMA_FOG_BIT)
-#define DO_TEX0 (IND & GAMMA_TEX0_BIT)
-#define DO_TEX1 0
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & GAMMA_PTEX_BIT)
-
-#define VERTEX gammaVertex
-#define VERTEX_COLOR gamma_color_t
-#define GET_VIEWPORT_MAT() 0
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() GAMMA_CONTEXT(ctx)->vertex_format
-#define GET_VERTEX_STORE() GAMMA_CONTEXT(ctx)->verts
-#define GET_VERTEX_SIZE() GAMMA_CONTEXT(ctx)->vertex_size * sizeof(GLuint)
-#define INVALIDATE_STORED_VERTICES()
-
-#define HAVE_HW_VIEWPORT 1
-#define HAVE_HW_DIVIDE 1
-#define HAVE_RGBA_COLOR 0 /* we're BGRA */
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 0
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 1
-
-#define PTEX_FALLBACK() /* never needed */
-
-#define INTERP_VERTEX setup_tab[GAMMA_CONTEXT(ctx)->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[GAMMA_CONTEXT(ctx)->SetupIndex].copy_pv
-
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) gamma_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_TEX0_BIT|GAMMA_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_SPEC_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_SPEC_BIT|GAMMA_TEX0_BIT|\
- GAMMA_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_TEX0_BIT|\
- GAMMA_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT|\
- GAMMA_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_XYZW_BIT|GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT|\
- GAMMA_TEX0_BIT|GAMMA_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_FOG_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_SPEC_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (GAMMA_RGBA_BIT|GAMMA_FOG_BIT|GAMMA_SPEC_BIT|GAMMA_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgpt0();
- init_wgst0();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgfpt0();
- init_wgfst0();
- init_wgfspt0();
- init_t0();
- init_f();
- init_ft0();
- init_g();
- init_gs();
- init_gt0();
- init_gst0();
- init_gf();
- init_gfs();
- init_gft0();
- init_gfst0();
-}
-
-void gammaCheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
-
- if (!setup_tab[gmesa->SetupIndex].check_tex_sizes(ctx)) {
- /* Invalidate stored verts
- */
- gmesa->SetupNewInputs = ~0;
- gmesa->SetupIndex |= GAMMA_PTEX_BIT;
-
- if (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[gmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[gmesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void gammaBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
- GLuint stride = gmesa->vertex_size * sizeof(int);
- GLubyte *v = ((GLubyte *)gmesa->verts + (start * stride));
-
- newinputs |= gmesa->SetupNewInputs;
- gmesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_POS) {
- setup_tab[gmesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= GAMMA_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= GAMMA_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= GAMMA_TEX0_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= GAMMA_FOG_BIT;
-
- if (gmesa->SetupIndex & GAMMA_PTEX_BIT)
- ind = ~0;
-
- ind &= gmesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void gammaChooseVertexState( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint ind = GAMMA_XYZW_BIT|GAMMA_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= GAMMA_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= GAMMA_FOG_BIT;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- _tnl_need_projected_coords( ctx, GL_FALSE );
- ind |= GAMMA_TEX0_BIT;
- } else
- _tnl_need_projected_coords( ctx, GL_FALSE );
-
- gmesa->SetupIndex = ind;
-
- if (setup_tab[ind].vertex_format != gmesa->vertex_format) {
- gmesa->vertex_format = setup_tab[ind].vertex_format;
- gmesa->vertex_size = setup_tab[ind].vertex_size;
- }
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = gamma_interp_extras;
- tnl->Driver.Render.CopyPV = gamma_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-}
-
-
-void gammaInitVB( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- gmesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- gmesa->vertex_size = 16; /* FIXME - only one vertex setup */
- }
- }
-}
-
-
-void gammaFreeVB( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- if (gmesa->verts) {
- ALIGN_FREE(gmesa->verts);
- gmesa->verts = 0;
- }
-}
diff --git a/src/mesa/drivers/dri/gamma/gamma_vb.h b/src/mesa/drivers/dri/gamma/gamma_vb.h
deleted file mode 100644
index 8701226f590..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_vb.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- * Keith Whitwell, <keith@tungstengraphics.com>
- *
- * 3DLabs Gamma driver.
- */
-
-#ifndef GAMMAVB_INC
-#define GAMMAVB_INC
-
-#include "main/mtypes.h"
-#include "swrast/swrast.h"
-
-#define _GAMMA_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE)
-
-
-extern void gammaChooseVertexState( GLcontext *ctx );
-extern void gammaCheckTexSizes( GLcontext *ctx );
-extern void gammaBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-
-extern void gamma_import_float_colors( GLcontext *ctx );
-extern void gamma_import_float_spec_colors( GLcontext *ctx );
-
-extern void gamma_translate_vertex( GLcontext *ctx,
- const gammaVertex *src,
- SWvertex *dst );
-
-extern void gammaInitVB( GLcontext *ctx );
-extern void gammaFreeVB( GLcontext *ctx );
-
-extern void gamma_print_vertex( GLcontext *ctx, const gammaVertex *v );
-extern void gammaPrintSetupFlags(char *msg, GLuint flags );
-
-#endif
diff --git a/src/mesa/drivers/dri/gamma/gamma_xmesa.c b/src/mesa/drivers/dri/gamma/gamma_xmesa.c
deleted file mode 100644
index e49ab5bae35..00000000000
--- a/src/mesa/drivers/dri/gamma/gamma_xmesa.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright 2001 by Alan Hourihane.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
- *
- * 3DLabs Gamma driver
- */
-
-#include "gammacontext.h"
-#include "gamma_vb.h"
-#include "main/context.h"
-#include "main/matrix.h"
-#include "glint_dri.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "vbo/vbo.h"
-
-static GLboolean
-gammaInitDriver(__DRIscreen *sPriv)
-{
- sPriv->private = (void *) gammaCreateScreen( sPriv );
-
- if (!sPriv->private) {
- gammaDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static void
-gammaDestroyContext(__DRIcontext *driContextPriv)
-{
- gammaContextPtr gmesa = (gammaContextPtr)driContextPriv->driverPrivate;
-
- if (gmesa) {
- _swsetup_DestroyContext( gmesa->glCtx );
- _tnl_DestroyContext( gmesa->glCtx );
- _vbo_DestroyContext( gmesa->glCtx );
- _swrast_DestroyContext( gmesa->glCtx );
-
- gammaFreeVB( gmesa->glCtx );
-
- /* free the Mesa context */
- gmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(gmesa->glCtx);
-
- FREE(gmesa);
- driContextPriv->driverPrivate = NULL;
- }
-}
-
-
-static GLboolean
-gammaCreateBuffer( __DRIscreen *driScrnPriv,
- __DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0
- );
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-gammaDestroyBuffer(__DRIdrawable *driDrawPriv)
-{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
-}
-
-static void
-gammaSwapBuffers( __DRIdrawable *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- gammaContextPtr gmesa;
- __DRIscreen *driScrnPriv;
- GLcontext *ctx;
-
- gmesa = (gammaContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = gmesa->glCtx;
- driScrnPriv = gmesa->driScreen;
-
- _mesa_notifySwapBuffers(ctx);
-
- VALIDATE_DRAWABLE_INFO(gmesa);
-
- /* Flush any partially filled buffers */
- FLUSH_DMA_BUFFER(gmesa);
-
- DRM_SPINLOCK(&driScrnPriv->pSAREA->drawable_lock,
- driScrnPriv->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
-
- if (gmesa->EnabledFlags & GAMMA_BACK_BUFFER) {
- int src, dst, x0, y0, x1, h;
- int i;
- int nRect = dPriv->numClipRects;
- drm_clip_rect_t *pRect = dPriv->pClipRects;
- __DRIscreen *driScrnPriv = gmesa->driScreen;
- GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)driScrnPriv->pDevPriv;
-
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, FBReadMode, (gmesa->FBReadMode |
- FBReadSrcEnable));
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeDisable);
-
- for (i = 0; i < nRect; i++, pRect++) {
- x0 = pRect->x1;
- x1 = pRect->x2;
- h = pRect->y2 - pRect->y1;
-
- y0 = driScrnPriv->fbHeight - (pRect->y1+h);
- if (gDRIPriv->numMultiDevices == 2)
- src = (y0/2)*driScrnPriv->fbWidth+x0;
- else
- src = y0*driScrnPriv->fbWidth+x0;
-
- y0 += driScrnPriv->fbHeight;
- if (gDRIPriv->numMultiDevices == 2)
- dst = (y0/2)*driScrnPriv->fbWidth+x0;
- else
- dst = y0*driScrnPriv->fbWidth+x0;
-
- CHECK_DMA_BUFFER(gmesa, 9);
- WRITE(gmesa->buf, StartXDom, x0<<16); /* X0dest */
- WRITE(gmesa->buf, StartY, y0<<16); /* Y0dest */
- WRITE(gmesa->buf, StartXSub, x1<<16); /* X1dest */
- WRITE(gmesa->buf, GLINTCount, h); /* H */
- WRITE(gmesa->buf, dY, 1<<16); /* ydir */
- WRITE(gmesa->buf, dXDom, 0<<16);
- WRITE(gmesa->buf, dXSub, 0<<16);
- WRITE(gmesa->buf, FBSourceOffset, (dst-src));
- WRITE(gmesa->buf, Render, 0x00040048); /* NOT_DONE */
- }
-
- /*
- ** NOTE: FBSourceOffset (above) is backwards from what is
- ** described in the manual (i.e., dst-src instead of src-dst)
- ** due to our using the bottom-left window origin instead of the
- ** top-left window origin.
- */
-
- /* Restore FBReadMode */
- CHECK_DMA_BUFFER(gmesa, 2);
- WRITE(gmesa->buf, FBReadMode, (gmesa->FBReadMode |
- gmesa->AB_FBReadMode));
- WRITE(gmesa->buf, LBWriteMode, LBWriteModeEnable);
- }
-
- if (gmesa->EnabledFlags & GAMMA_BACK_BUFFER)
- PROCESS_DMA_BUFFER_TOP_HALF(gmesa);
-
- DRM_SPINUNLOCK(&driScrnPriv->pSAREA->drawable_lock,
- driScrnPriv->drawLockID);
- VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa);
-
- if (gmesa->EnabledFlags & GAMMA_BACK_BUFFER)
- PROCESS_DMA_BUFFER_BOTTOM_HALF(gmesa);
- } else {
- _mesa_problem(NULL, "gammaSwapBuffers: drawable has no context!\n");
- }
-}
-
-static GLboolean
-gammaMakeCurrent(__DRIcontext *driContextPriv,
- __DRIdrawable *driDrawPriv,
- __DRIdrawable *driReadPriv)
-{
- if (driContextPriv) {
- GET_CURRENT_CONTEXT(ctx);
- gammaContextPtr oldGammaCtx = ctx ? GAMMA_CONTEXT(ctx) : NULL;
- gammaContextPtr newGammaCtx = (gammaContextPtr) driContextPriv->driverPrivate;
-
- if ( newGammaCtx != oldGammaCtx ) {
- newGammaCtx->dirty = ~0;
- }
-
- if (newGammaCtx->driDrawable != driDrawPriv) {
- newGammaCtx->driDrawable = driDrawPriv;
- gammaUpdateWindow ( newGammaCtx->glCtx );
- gammaUpdateViewportOffset( newGammaCtx->glCtx );
- }
-
-#if 0
- newGammaCtx->Window &= ~W_GIDMask;
- newGammaCtx->Window |= (driDrawPriv->index << 5);
- CHECK_DMA_BUFFER(newGammaCtx,1);
- WRITE(newGammaCtx->buf, GLINTWindow, newGammaCtx->Window);
-#endif
-
-newGammaCtx->new_state |= GAMMA_NEW_WINDOW; /* FIXME */
-
- _mesa_make_current2( newGammaCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
- } else {
- _mesa_make_current( 0, 0 );
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-gammaUnbindContext( __DRIcontext *driContextPriv )
-{
- return GL_TRUE;
-}
-
-const struct __DriverAPIRec driDriverAPI = {
- gammaInitDriver,
- gammaDestroyScreen,
- gammaCreateContext,
- gammaDestroyContext,
- gammaCreateBuffer,
- gammaDestroyBuffer,
- gammaSwapBuffers,
- gammaMakeCurrent,
- gammaUnbindContext
-};
-
-
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreen.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreen *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &gammaAPI);
- return (void *) psp;
-}
-
-/* This is the table of extensions that the loader will dlsym() for. */
-PUBLIC const __DRIextension *__driDriverExtensions[] = {
- &driCoreExtension.base,
- &driLegacyExtension.base,
- NULL
-};
diff --git a/src/mesa/drivers/dri/gamma/server/glint_common.h b/src/mesa/drivers/dri/gamma/server/glint_common.h
deleted file mode 100644
index 36554e4ac22..00000000000
--- a/src/mesa/drivers/dri/gamma/server/glint_common.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* glint_common.h -- common header definitions for Gamma 2D/3D/DRM suite
- *
- * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Converted to common header format:
- * Jens Owen <jens@tungstengraphics.com>
- *
- *
- */
-
-#ifndef _GLINT_COMMON_H_
-#define _GLINT_COMMON_H_
-
-/*
- * WARNING: If you change any of these defines, make sure to change
- * the kernel include file as well (gamma_drm.h)
- */
-
-/* Driver specific DRM command indices
- * NOTE: these are not OS specific, but they are driver specific
- */
-#define DRM_GAMMA_INIT 0x00
-#define DRM_GAMMA_COPY 0x01
-
-typedef struct {
- enum {
- GAMMA_INIT_DMA = 0x01,
- GAMMA_CLEANUP_DMA = 0x02
- } func;
- int sarea_priv_offset;
- int pcimode;
- unsigned int mmio0;
- unsigned int mmio1;
- unsigned int mmio2;
- unsigned int mmio3;
- unsigned int buffers_offset;
- int num_rast;
-} drmGAMMAInit;
-
-extern int drmGAMMAInitDMA( int fd, drmGAMMAInit *info );
-extern int drmGAMMACleanupDMA( int fd );
-
-#endif
diff --git a/src/mesa/drivers/dri/gamma/server/glint_dri.h b/src/mesa/drivers/dri/gamma/server/glint_dri.h
deleted file mode 100644
index df1992a5d1e..00000000000
--- a/src/mesa/drivers/dri/gamma/server/glint_dri.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Author:
- * Jens Owen <jens@tungstengraphics.com>
- *
- */
-
-#ifndef _GLINT_DRI_H_
-#define _GLINT_DRI_H_
-
-#include "xf86drm.h"
-#include "glint_common.h"
-
-typedef struct {
- unsigned int GDeltaMode;
- unsigned int GDepthMode;
- unsigned int GGeometryMode;
- unsigned int GTransformMode;
-} GAMMAContextRegionRec, *GAMMAContextRegionPtr;
-
-typedef struct {
- unsigned char next, prev; /* indices to form a circular LRU */
- unsigned char in_use; /* owned by a client, or free? */
- int age; /* tracked by clients to update local LRU's */
-} GAMMATextureRegionRec, *GAMMATextureRegionPtr;
-
-typedef struct {
- GAMMAContextRegionRec context_state;
-
- unsigned int dirty;
-
- /* Maintain an LRU of contiguous regions of texture space. If
- * you think you own a region of texture memory, and it has an
- * age different to the one you set, then you are mistaken and
- * it has been stolen by another client. If global texAge
- * hasn't changed, there is no need to walk the list.
- *
- * These regions can be used as a proxy for the fine-grained
- * texture information of other clients - by maintaining them
- * in the same lru which is used to age their own textures,
- * clients have an approximate lru for the whole of global
- * texture space, and can make informed decisions as to which
- * areas to kick out. There is no need to choose whether to
- * kick out your own texture or someone else's - simply eject
- * them all in LRU order.
- */
-
-#define GAMMA_NR_TEX_REGIONS 64
- GAMMATextureRegionRec texList[GAMMA_NR_TEX_REGIONS+1];
- /* Last elt is sentinal */
- int texAge; /* last time texture was uploaded */
- int last_enqueue; /* last time a buffer was enqueued */
- int last_dispatch; /* age of the most recently dispatched buffer */
- int last_quiescent; /* */
- int ctxOwner; /* last context to upload state */
-
- int vertex_prim;
-} GLINTSAREADRIRec, *GLINTSAREADRIPtr;
-
-/*
- * Glint specific record passed back to client driver
- * via DRIGetDeviceInfo request
- */
-typedef struct {
- drmRegion registers0;
- drmRegion registers1;
- drmRegion registers2;
- drmRegion registers3;
- int numMultiDevices;
- int pprod;
- int cpp;
- int frontOffset;
- int frontPitch;
- int backOffset;
- int backPitch;
- int backX;
- int backY;
- int depthOffset;
- int depthPitch;
- int textureSize;
- int logTextureGranularity;
-} GLINTDRIRec, *GLINTDRIPtr;
-
-#define GLINT_DRI_BUF_COUNT 256
-#define GLINT_DRI_BUF_SIZE 4096
-
-#define GAMMA_NR_TEX_REGIONS 64
-
-#define DMA_WRITE(val,reg) \
-do { \
- pGlint->buf2D++ = Glint##reg##Tag; \
- pGlint->buf2D++ = val; \
-} while (0)
-
-#endif /* _GLINT_DRI_H_ */
diff --git a/src/mesa/drivers/dri/i810/Makefile b/src/mesa/drivers/dri/i810/Makefile
index 3874faee518..54a837d5ea9 100644
--- a/src/mesa/drivers/dri/i810/Makefile
+++ b/src/mesa/drivers/dri/i810/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
LIBNAME = i810_dri.so
-# Not yet
-# MINIGLX_SOURCES = server/i810_dri.c
-
DRIVER_SOURCES = \
i810context.c \
i810ioctl.c \
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index 1c4deef319f..56708c97cbb 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -131,12 +131,12 @@ static drmBufMapPtr i810_create_empty_buffers(void)
{
drmBufMapPtr retval;
- retval = (drmBufMapPtr)ALIGN_MALLOC(sizeof(drmBufMap), 32);
+ retval = (drmBufMapPtr)_mesa_align_malloc(sizeof(drmBufMap), 32);
if(retval == NULL) return NULL;
memset(retval, 0, sizeof(drmBufMap));
- retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I810_DMA_BUF_NR, 32);
+ retval->list = (drmBufPtr)_mesa_align_malloc(sizeof(drmBuf) * I810_DMA_BUF_NR, 32);
if(retval->list == NULL) {
- ALIGN_FREE(retval);
+ _mesa_align_free(retval);
return NULL;
}
memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR);
diff --git a/src/mesa/drivers/dri/i810/i810texmem.c b/src/mesa/drivers/dri/i810/i810texmem.c
index bb426a41122..6e6b21cf2b9 100644
--- a/src/mesa/drivers/dri/i810/i810texmem.c
+++ b/src/mesa/drivers/dri/i810/i810texmem.c
@@ -155,6 +155,7 @@ int i810UploadTexImagesLocked( i810ContextPtr imesa, i810TextureObjectPtr t )
return -1;
}
+ assert(t->base.memBlock);
ofs = t->base.memBlock->ofs;
t->BufAddr = imesa->i810Screen->tex.map + ofs;
t->Setup[I810_TEXREG_MI3] = imesa->i810Screen->textureOffset + ofs;
diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c
index 213ba541cee..1492f711c93 100644
--- a/src/mesa/drivers/dri/i810/i810tris.c
+++ b/src/mesa/drivers/dri/i810/i810tris.c
@@ -218,7 +218,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
diff --git a/src/mesa/drivers/dri/i810/i810vb.c b/src/mesa/drivers/dri/i810/i810vb.c
index 09a772258c5..70301a2d2ec 100644
--- a/src/mesa/drivers/dri/i810/i810vb.c
+++ b/src/mesa/drivers/dri/i810/i810vb.c
@@ -464,7 +464,7 @@ void i810InitVB( GLcontext *ctx )
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- imesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32);
+ imesa->verts = (GLubyte *)_mesa_align_malloc(size * 4 * 16, 32);
{
static int firsttime = 1;
@@ -480,7 +480,7 @@ void i810FreeVB( GLcontext *ctx )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
if (imesa->verts) {
- ALIGN_FREE(imesa->verts);
+ _mesa_align_free(imesa->verts);
imesa->verts = 0;
}
}
diff --git a/src/mesa/drivers/dri/i810/server/i810_dri.c b/src/mesa/drivers/dri/i810/server/i810_dri.c
deleted file mode 100644
index f52797c5ed2..00000000000
--- a/src/mesa/drivers/dri/i810/server/i810_dri.c
+++ /dev/null
@@ -1,975 +0,0 @@
-/**
- * \file server/i810_dri.c
- * \brief File to perform the device-specific initialization tasks typically
- * done in the X server.
- *
- * Here they are converted to run in the client (or perhaps a standalone
- * process), and to work with the frame buffer device rather than the X
- * server infrastructure.
- *
- * Copyright (C) 2004 Dave Airlie (airlied@linux.ie)
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-
-#include "i810.h"
-#include "i810_dri.h"
-#include "i810_reg.h"
-
-
-static int i810_pitches[] = {
- 512,
- 1024,
- 2048,
- 4096,
- 0
-};
-
-static int i810_pitch_flags[] = {
- 0x0,
- 0x1,
- 0x2,
- 0x3,
- 0
-};
-
-static unsigned int i810_drm_version = 0;
-
-static int
-I810AllocLow(I810MemRange * result, I810MemRange * pool, int size)
-{
- if (size > pool->Size)
- return 0;
-
- pool->Size -= size;
- result->Size = size;
- result->Start = pool->Start;
- result->End = pool->Start += size;
-
- return 1;
-}
-
-static int
-I810AllocHigh(I810MemRange * result, I810MemRange * pool, int size)
-{
- if (size > pool->Size)
- return 0;
-
- pool->Size -= size;
- result->Size = size;
- result->End = pool->End;
- result->Start = pool->End -= size;
-
- return 1;
-}
-
-
-/**
- * \brief Wait for free FIFO entries.
- *
- * \param ctx display handle.
- * \param entries number of free entries to wait.
- *
- * It polls the free entries from the chip until it reaches the requested value
- * or a timeout (3000 tries) occurs. Aborts the program if the FIFO times out.
- */
-static void I810WaitForFifo( const DRIDriverContext *ctx,
- int entries )
-{
-}
-
-/**
- * \brief Reset graphics card to known state.
- *
- * \param ctx display handle.
- *
- * Resets the values of several I810 registers.
- */
-static void I810EngineReset( const DRIDriverContext *ctx )
-{
- unsigned char *I810MMIO = ctx->MMIOAddress;
-}
-
-/**
- * \brief Restore the drawing engine.
- *
- * \param ctx display handle
- *
- * Resets the graphics card and sets initial values for several registers of
- * the card's drawing engine.
- *
- * Turns on the i810 command processor engine (i.e., the ringbuffer).
- */
-static int I810EngineRestore( const DRIDriverContext *ctx )
-{
- I810Ptr info = ctx->driverPrivate;
- unsigned char *I810MMIO = ctx->MMIOAddress;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- return 1;
-}
-
-
-/**
- * \brief Shutdown the drawing engine.
- *
- * \param ctx display handle
- *
- * Turns off the command processor engine & restores the graphics card
- * to a state that fbdev understands.
- */
-static int I810EngineShutdown( const DRIDriverContext *ctx )
-{
- drmI810Init info;
- int ret;
-
- memset(&info, 0, sizeof(drmI810Init));
- info.func = I810_CLEANUP_DMA;
-
- ret = drmCommandWrite(ctx->drmFD, DRM_I810_INIT, &info, sizeof(drmI810Init));
- if (ret>0)
- {
- fprintf(stderr,"[dri] I810 DMA Cleanup failed\n");
- return -errno;
- }
- return 0;
-}
-
-/**
- * \brief Compute base 2 logarithm.
- *
- * \param val value.
- *
- * \return base 2 logarithm of \p val.
- */
-static int I810MinBits(int val)
-{
- int bits;
-
- if (!val) return 1;
- for (bits = 0; val; val >>= 1, ++bits);
- return bits;
-}
-
-static int I810DRIAgpPreInit( const DRIDriverContext *ctx, I810Ptr info)
-{
-
- if (drmAgpAcquire(ctx->drmFD) < 0) {
- fprintf(stderr, "[gart] AGP not available\n");
- return 0;
- }
-
-
- if (drmAgpEnable(ctx->drmFD, 0) < 0) {
- fprintf(stderr, "[gart] AGP not enabled\n");
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
-}
-
-/**
- * \brief Initialize the AGP state
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return one on success, or zero on failure.
- *
- * Acquires and enables the AGP device. Reserves memory in the AGP space for
- * the ring buffer, vertex buffers and textures. Initialize the I810
- * registers to point to that memory and add client mappings.
- */
-static int I810DRIAgpInit( const DRIDriverContext *ctx, I810Ptr info)
-{
- unsigned char *I810MMIO = ctx->MMIOAddress;
- int ret;
- int s, l;
- unsigned long dcacheHandle;
- unsigned long agpHandle;
- int pitch_idx = 0;
- int back_size = 0;
- int sysmem_size = 0;
- int width = ctx->shared.virtualWidth * ctx->cpp;
-
-
- info->backHandle = DRM_AGP_NO_HANDLE;
- info->zHandle = DRM_AGP_NO_HANDLE;
- info->sysmemHandle = DRM_AGP_NO_HANDLE;
- info->dcacheHandle = DRM_AGP_NO_HANDLE;
-
- memset(&info->DcacheMem, 0, sizeof(I810MemRange));
- memset(&info->BackBuffer, 0, sizeof(I810MemRange));
- memset(&info->DepthBuffer, 0, sizeof(I810MemRange));
-
- drmAgpAlloc(ctx->drmFD, 4096 * 1024, 1, NULL, &dcacheHandle);
- info->dcacheHandle = dcacheHandle;
-
- fprintf(stderr, "[agp] dcacheHandle : 0x%x\n", dcacheHandle);
-
-#define Elements(x) sizeof(x)/sizeof(*x)
- for (pitch_idx = 0; pitch_idx < Elements(i810_pitches); pitch_idx++)
- if (width <= i810_pitches[pitch_idx])
- break;
-
- if (pitch_idx == Elements(i810_pitches)) {
- fprintf(stderr,"[dri] Couldn't find depth/back buffer pitch\n");
- exit(-1);
- }
- else
- {
- int lines = (ctx->shared.virtualWidth + 15) / 16 * 16;
- back_size = i810_pitches[pitch_idx] * lines;
- back_size = ((back_size + 4096 - 1) / 4096) * 4096;
- }
-
- sysmem_size = ctx->shared.fbSize;
- fprintf(stderr,"sysmem_size is %lu back_size is %lu\n", sysmem_size, back_size);
- if (dcacheHandle != DRM_AGP_NO_HANDLE) {
- if (back_size > 4 * 1024 * 1024) {
- fprintf(stderr,"[dri] Backsize is larger then 4 meg\n");
- sysmem_size = sysmem_size - 2 * back_size;
- drmAgpFree(ctx->drmFD, dcacheHandle);
- info->dcacheHandle = dcacheHandle = DRM_AGP_NO_HANDLE;
- } else {
- sysmem_size = sysmem_size - back_size;
- }
- } else {
- sysmem_size = sysmem_size - 2 * back_size;
- }
-
- info->SysMem.Start=0;
- info->SysMem.Size = sysmem_size;
- info->SysMem.End = sysmem_size;
-
- if (dcacheHandle != DRM_AGP_NO_HANDLE) {
- if (drmAgpBind(ctx->drmFD, dcacheHandle, info->DepthOffset) == 0) {
- memset(&info->DcacheMem, 0, sizeof(I810MemRange));
- fprintf(stderr,"[agp] GART: Found 4096K Z buffer memory\n");
- info->DcacheMem.Start = info->DepthOffset;
- info->DcacheMem.Size = 1024 * 4096;
- info->DcacheMem.End = info->DcacheMem.Start + info->DcacheMem.Size;
- } else {
- fprintf(stderr, "[agp] GART: dcache bind failed\n");
- drmAgpFree(ctx->drmFD, dcacheHandle);
- info->dcacheHandle = dcacheHandle = DRM_AGP_NO_HANDLE;
- }
- } else {
- fprintf(stderr, "[agp] GART: no dcache memory found\n");
- }
-
- drmAgpAlloc(ctx->drmFD, back_size, 0, NULL, &agpHandle);
- info->backHandle = agpHandle;
-
- if (agpHandle != DRM_AGP_NO_HANDLE) {
- if (drmAgpBind(ctx->drmFD, agpHandle, info->BackOffset) == 0) {
- fprintf(stderr, "[agp] Bound backbuffer memory\n");
-
- info->BackBuffer.Start = info->BackOffset;
- info->BackBuffer.Size = back_size;
- info->BackBuffer.End = (info->BackBuffer.Start +
- info->BackBuffer.Size);
- } else {
- fprintf(stderr,"[agp] Unable to bind backbuffer. Disabling DRI.\n");
- return 0;
- }
- } else {
- fprintf(stderr, "[dri] Unable to allocate backbuffer memory. Disabling DRI.\n");
- return 0;
- }
-
- if (dcacheHandle == DRM_AGP_NO_HANDLE) {
- drmAgpAlloc(ctx->drmFD, back_size, 0, NULL, &agpHandle);
-
- info->zHandle = agpHandle;
-
- if (agpHandle != DRM_AGP_NO_HANDLE) {
- if (drmAgpBind(ctx->drmFD, agpHandle, info->DepthOffset) == 0) {
- fprintf(stderr,"[agp] Bound depthbuffer memory\n");
- info->DepthBuffer.Start = info->DepthOffset;
- info->DepthBuffer.Size = back_size;
- info->DepthBuffer.End = (info->DepthBuffer.Start +
- info->DepthBuffer.Size);
- } else {
- fprintf(stderr,"[agp] Unable to bind depthbuffer. Disabling DRI.\n");
- return 0;
- }
- } else {
- fprintf(stderr,"[agp] Unable to allocate depthbuffer memory. Disabling DRI.\n");
- return 0;
- }
- }
-
- /* Now allocate and bind the agp space. This memory will include the
- * regular framebuffer as well as texture memory.
- */
- drmAgpAlloc(ctx->drmFD, sysmem_size, 0, NULL, &agpHandle);
- info->sysmemHandle = agpHandle;
-
- if (agpHandle != DRM_AGP_NO_HANDLE) {
- if (drmAgpBind(ctx->drmFD, agpHandle, 0) == 0) {
- fprintf(stderr, "[agp] Bound System Texture Memory\n");
- } else {
- fprintf(stderr, "[agp] Unable to bind system texture memory. Disabling DRI.\n");
- return 0;
- }
- } else {
- fprintf(stderr, "[agp] Unable to allocate system texture memory. Disabling DRI.\n");
- return 0;
- }
-
- info->auxPitch = i810_pitches[pitch_idx];
- info->auxPitchBits = i810_pitch_flags[pitch_idx];
-
- return 1;
-}
-
-
-/**
- * \brief Initialize the kernel data structures and enable the CP engine.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * This function is a wrapper around the DRM_I810_CP_INIT command, passing
- * all the parameters in a drmI810Init structure.
- */
-static int I810DRIKernelInit( const DRIDriverContext *ctx,
- I810Ptr info)
-{
- int cpp = ctx->bpp / 8;
- drmI810Init drmInfo;
- int ret;
- I810RingBuffer *ring = &(info->LpRing);
-
- /* This is the struct passed to the kernel module for its initialization */
- memset(&drmInfo, 0, sizeof(drmI810Init));
-
- /* make sure we have at least 1.4 */
- drmInfo.func = I810_INIT_DMA_1_4;
-
- drmInfo.ring_start = ring->mem.Start;
- drmInfo.ring_end = ring->mem.End;
- drmInfo.ring_size = ring->mem.Size;
-
- drmInfo.mmio_offset = (unsigned int)info->regs;
- drmInfo.buffers_offset = (unsigned int)info->buffer_map;
- drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
-
- drmInfo.front_offset = 0;
- drmInfo.back_offset = info->BackBuffer.Start;
- drmInfo.depth_offset = info->DepthBuffer.Start;
-
- drmInfo.w = ctx->shared.virtualWidth;
- drmInfo.h = ctx->shared.virtualHeight;
- drmInfo.pitch = info->auxPitch;
- drmInfo.pitch_bits = info->auxPitchBits;
-
-
- ret = drmCommandWrite(ctx->drmFD, DRM_I810_INIT, &drmInfo,
- sizeof(drmI810Init));
-
- return ret >= 0;
-}
-
-
-/**
- * \brief Add a map for the vertex buffers that will be accessed by any
- * DRI-based clients.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return one on success, or zero on failure.
- *
- * Calls drmAddBufs() with the previously allocated vertex buffers.
- */
-static int I810DRIBufInit( const DRIDriverContext *ctx, I810Ptr info )
-{
- /* Initialize vertex buffers */
- info->bufNumBufs = drmAddBufs(ctx->drmFD,
- I810_DMA_BUF_NR,
- I810_DMA_BUF_SZ,
- DRM_AGP_BUFFER,
- info->BufferMem.Start);
-
- if (info->bufNumBufs <= 0) {
- fprintf(stderr,
- "[drm] Could not create vertex/indirect buffers list\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] Added %d %d byte vertex/indirect buffers\n",
- info->bufNumBufs, I810_DMA_BUF_SZ);
-
- return 1;
-}
-
-/**
- * \brief Install an IRQ handler.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * Attempts to install an IRQ handler via drmCtlInstHandler(), falling back to
- * IRQ-free operation on failure.
- */
-static void I810DRIIrqInit(const DRIDriverContext *ctx,
- I810Ptr info)
-{
- if (!info->irq) {
- info->irq = drmGetInterruptFromBusID(ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if ((drmCtlInstHandler(ctx->drmFD, info->irq)) != 0) {
- fprintf(stderr,
- "[drm] failure adding irq handler, "
- "there is a device already using that irq\n"
- "[drm] falling back to irq-free operation\n");
- info->irq = 0;
- }
- }
-
- if (info->irq)
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- info->irq);
-}
-
-static int I810CheckDRMVersion( const DRIDriverContext *ctx,
- I810Ptr info )
-{
- drmVersionPtr version;
-
- version = drmGetVersion(ctx->drmFD);
- if (version) {
- int req_minor, req_patch;
-
- req_minor = 4;
- req_patch = 0;
-
- i810_drm_version = (version->version_major<<16) | version->version_minor;
- if (version->version_major != 1 ||
- version->version_minor < req_minor ||
- (version->version_minor == req_minor &&
- version->version_patchlevel < req_patch)) {
- /* Incompatible drm version */
- fprintf(stderr,
- "[dri] I810DRIScreenInit failed because of a version "
- "mismatch.\n"
- "[dri] i810.o kernel module version is %d.%d.%d "
- "but version 1.%d.%d or newer is needed.\n"
- "[dri] Disabling DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel,
- req_minor,
- req_patch);
- drmFreeVersion(version);
- return 0;
- }
-
- info->drmMinor = version->version_minor;
- drmFreeVersion(version);
- }
-
- return 1;
-}
-
-static int I810MemoryInit( const DRIDriverContext *ctx, I810Ptr info )
-{
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int cpp = ctx->cpp;
- int bufferSize = (ctx->shared.virtualHeight * width_bytes);
- int depthSize = (((ctx->shared.virtualHeight+15) & ~15) * width_bytes);
- int l;
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->BackBuffer.Start,
- info->BackBuffer.Size, DRM_AGP, 0,
- &info->backbuffer) < 0) {
- fprintf(stderr, "[drm] drmAddMap(backbuffer) failed. Disabling DRI\n");
- return 0;
- }
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->DepthBuffer.Start,
- info->DepthBuffer.Size, DRM_AGP, 0,
- &info->depthbuffer) < 0) {
- fprintf(stderr, "[drm] drmAddMap(depthbuffer) failed. Disabling DRI.\n");
- return 0;
- }
-
- if (!I810AllocLow(&(info->FrontBuffer), &(info->SysMem), (((ctx->shared.virtualHeight * width_bytes) + 4095) & ~4095)))
- {
- fprintf(stderr,"Framebuffer allocation failed\n");
- return 0;
- }
- else
- fprintf(stderr,"Frame buffer at 0x%.8x (%luk, %lu bytes)\n",
- info->FrontBuffer.Start,
- info->FrontBuffer.Size / 1024, info->FrontBuffer.Size);
-
- memset(&(info->LpRing), 0, sizeof(I810RingBuffer));
- if (I810AllocLow(&(info->LpRing.mem), &(info->SysMem), 16 * 4096)) {
- fprintf(stderr,
- "Ring buffer at 0x%.8x (%luk, %lu bytes)\n",
- info->LpRing.mem.Start,
- info->LpRing.mem.Size / 1024, info->LpRing.mem.Size);
-
- info->LpRing.tail_mask = info->LpRing.mem.Size - 1;
- info->LpRing.virtual_start = info->LpRing.mem.Start;
- info->LpRing.head = 0;
- info->LpRing.tail = 0;
- info->LpRing.space = 0;
- } else {
- fprintf(stderr, "Ring buffer allocation failed\n");
- return (0);
- }
-
- /* Allocate buffer memory */
- I810AllocHigh(&(info->BufferMem), &(info->SysMem),
- I810_DMA_BUF_NR * I810_DMA_BUF_SZ);
-
-
- fprintf(stderr, "[dri] Buffer map : %lx\n",
- info->BufferMem.Start);
-
- if (info->BufferMem.Start == 0 ||
- info->BufferMem.End - info->BufferMem.Start >
- I810_DMA_BUF_NR * I810_DMA_BUF_SZ) {
- fprintf(stderr,"[dri] Not enough memory for dma buffers. Disabling DRI.\n");
- return 0;
- }
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->BufferMem.Start,
- info->BufferMem.Size, DRM_AGP, 0, &info->buffer_map) < 0) {
- fprintf(stderr, "[drm] drmAddMap(buffer_map) failed. Disabling DRI.\n");
- return 0;
- }
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->LpRing.mem.Start,
- info->LpRing.mem.Size, DRM_AGP, 0, &info->ring_map) < 0) {
- fprintf(stderr, "[drm] drmAddMap(ring_map) failed. Disabling DRI. \n");
- return 0;
- }
-
- /* Front, back and depth buffers - everything else texture??
- */
- info->textureSize = info->SysMem.Size;
-
- if (info->textureSize < 0)
- return 0;
-
-
- l = I810MinBits((info->textureSize-1) / I810_NR_TEX_REGIONS);
- if (l < I810_LOG_MIN_TEX_REGION_SIZE) l = I810_LOG_MIN_TEX_REGION_SIZE;
-
- /* Round the texture size up to the nearest whole number of
- * texture regions. Again, be greedy about this, don't
- * round down.
- */
- info->logTextureGranularity = l;
- info->textureSize = (info->textureSize >> l) << l;
-
- /* Set a minimum usable local texture heap size. This will fit
- * two 256x256x32bpp textures.
- */
- if (info->textureSize < 512 * 1024) {
- info->textureOffset = 0;
- info->textureSize = 0;
- }
-
- I810AllocLow(&(info->TexMem), &(info->SysMem), info->textureSize);
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->TexMem.Start,
- info->TexMem.Size, DRM_AGP, 0, &info->textures) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(textures) failed. Disabling DRI.\n");
- return 0;
- }
-
- /* Reserve space for textures */
- fprintf(stderr,
- "Will use back buffer at offset 0x%x\n",
- info->BackOffset);
- fprintf(stderr,
- "Will use depth buffer at offset 0x%x\n",
- info->DepthOffset);
- fprintf(stderr,
- "Will use %d kb for textures at offset 0x%x\n",
- info->TexMem.Size/1024, info->TexMem.Start);
-
- return 1;
-}
-
-
-
-/**
- * Called at the start of each server generation.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * Performs static frame buffer allocation. Opens the DRM device and add maps
- * to the SAREA, framebuffer and MMIO regions. Fills in \p info with more
- * information. Creates a \e server context to grab the lock for the
- * initialization ioctls and calls the other initilization functions in this
- * file. Starts the CP engine via the DRM_I810_CP_START command.
- *
- * Setups a I810DRIRec structure to be passed to i810_dri.so for its
- * initialization.
- */
-static int I810ScreenInit( DRIDriverContext *ctx, I810Ptr info )
-{
- I810DRIPtr pI810DRI;
- int err;
-
- usleep(100);
- /*assert(!ctx->IsClient);*/
-
- /* from XFree86 driver */
- info->DepthOffset = 0x3000000;
- info->BackOffset = 0x3800000;
- {
- int width_bytes = (ctx->shared.virtualWidth * ctx->cpp);
- int maxy = ctx->shared.fbSize / width_bytes;
-
-
- if (maxy <= ctx->shared.virtualHeight * 3) {
- fprintf(stderr,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (ctx->shared.virtualWidth * ctx->shared.virtualHeight *
- ctx->cpp * 3 + 1023) / 1024,
- ctx->shared.fbSize / 1024);
- return 0;
- }
- }
-
-
- info->regsSize = ctx->MMIOSize;
- ctx->shared.SAREASize = 0x2000;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("i810", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- if (drmAddMap(ctx->drmFD,
- ctx->MMIOStart,
- ctx->MMIOSize,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &info->regs) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08x\n", info->regs);
-
- I810DRIAgpPreInit(ctx, info);
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
-#ifndef _EMBEDDED
- 0,
-#else
- DRM_READ_ONLY,
-#endif
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
- /* Check the i810 DRM version */
- if (!I810CheckDRMVersion(ctx, info)) {
- return 0;
- }
-
- /* Initialize AGP */
- if (!I810DRIAgpInit(ctx, info)) {
- return 0;
- }
-
-
- /* Memory manager setup */
- if (!I810MemoryInit(ctx, info)) {
- return 0;
- }
-
- /* Initialize the SAREA private data structure */
- {
- I810SAREAPtr pSAREAPriv;
- pSAREAPriv = (I810SAREAPtr)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
- // pSAREAPriv->pf_enabled=1;
- }
-
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the vertex buffers list */
- if (!I810DRIBufInit(ctx, info)) {
- fprintf(stderr, "I810DRIBufInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize the kernel data structures */
- if (!I810DRIKernelInit(ctx, info)) {
- fprintf(stderr, "I810DRIKernelInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize IRQ */
- I810DRIIrqInit(ctx, info);
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
-#if 0
- memset((char *)ctx->FBAddress,
- 0,
- info->auxPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- memset((char *)info->backbuffer,
- 0,
- info->auxPitch * ctx->cpp * ctx->shared.virtualHeight );
-#endif
-
- /* This is the struct passed to i810_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(I810DRIRec));
- ctx->driverClientMsgSize = sizeof(I810DRIRec);
- pI810DRI = (I810DRIPtr)ctx->driverClientMsg;
-
- pI810DRI->regs = info->regs;
- pI810DRI->regsSize = info->regsSize;
- // regsMap is unused
-
- pI810DRI->backbufferSize = info->BackBuffer.Size;
- pI810DRI->backbuffer = info->backbuffer;
-
- pI810DRI->depthbufferSize = info->DepthBuffer.Size;
- pI810DRI->depthbuffer = info->depthbuffer;
-
- pI810DRI->textures = info->textures;
- pI810DRI->textureSize = info->textureSize;
-
- pI810DRI->agp_buffers = info->buffer_map;
- pI810DRI->agp_buf_size = info->BufferMem.Size;
-
- pI810DRI->deviceID = info->Chipset;
- pI810DRI->width = ctx->shared.virtualWidth;
- pI810DRI->height = ctx->shared.virtualHeight;
- pI810DRI->mem = ctx->shared.fbSize;
- pI810DRI->cpp = ctx->bpp / 8;
- pI810DRI->bitsPerPixel = ctx->bpp;
- pI810DRI->fbOffset = info->FrontBuffer.Start;
- pI810DRI->fbStride = info->auxPitch;
-
- pI810DRI->backOffset = info->BackBuffer.Start;
- pI810DRI->depthOffset = info->DepthBuffer.Start;
-
- pI810DRI->auxPitch = info->auxPitch;
- pI810DRI->auxPitchBits = info->auxPitchBits;
-
- pI810DRI->logTextureGranularity = info->logTextureGranularity;
- pI810DRI->textureOffset = info->TexMem.Start;
-
- pI810DRI->ringOffset = info->LpRing.mem.Start;
- pI810DRI->ringSize = info->LpRing.mem.Size;
-
- // drmBufs looks unused
- pI810DRI->irq = info->irq;
- pI810DRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- /* Don't release the lock now - let the VT switch handler do it. */
- return 1;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa i810ValidateMode().
- */
-static int i810ValidateMode( const DRIDriverContext *ctx )
-{
- unsigned char *I810MMIO = ctx->MMIOAddress;
- I810Ptr info = ctx->driverPrivate;
-
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa i810ValidateMode().
- */
-static int i810PostValidateMode( const DRIDriverContext *ctx )
-{
- unsigned char *I810MMIO = ctx->MMIOAddress;
- I810Ptr info = ctx->driverPrivate;
-
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls I810ScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int i810InitFBDev( DRIDriverContext *ctx )
-{
- I810Ptr info = calloc(1, sizeof(*info));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- }
-
- ctx->driverPrivate = (void *)info;
-
- info->Chipset = ctx->chipset;
-
- if (!I810ScreenInit( ctx, info ))
- return 0;
-
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void i810HaltFBDev( DRIDriverContext *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-extern void i810NotifyFocus( int );
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-const struct DRIDriverRec __driDriver = {
- i810ValidateMode,
- i810PostValidateMode,
- i810InitFBDev,
- i810HaltFBDev,
- I810EngineShutdown,
- I810EngineRestore,
-#ifndef _EMBEDDED
- 0,
-#else
- i810NotifyFocus,
-#endif
-};
diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile
index dc15ae425c9..5b49d0c77c6 100644
--- a/src/mesa/drivers/dri/i915/Makefile
+++ b/src/mesa/drivers/dri/i915/Makefile
@@ -4,8 +4,6 @@ include $(TOP)/configs/current
LIBNAME = i915_dri.so
-MINIGLX_SOURCES = server/intel_dri.c
-
DRIVER_SOURCES = \
i830_context.c \
i830_state.c \
diff --git a/src/mesa/drivers/dri/i915/i830_context.h b/src/mesa/drivers/dri/i915/i830_context.h
index b755d48678b..d7eb9c2d44b 100644
--- a/src/mesa/drivers/dri/i915/i830_context.h
+++ b/src/mesa/drivers/dri/i915/i830_context.h
@@ -34,7 +34,8 @@
#define I830_FALLBACK_COLORMASK 0x2000
#define I830_FALLBACK_STENCIL 0x4000
#define I830_FALLBACK_STIPPLE 0x8000
-#define I830_FALLBACK_LOGICOP 0x10000
+#define I830_FALLBACK_LOGICOP 0x20000
+#define I830_FALLBACK_DRAW_OFFSET 0x200000
#define I830_UPLOAD_CTX 0x1
#define I830_UPLOAD_BUFFERS 0x2
diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c
index 7525f9f2e05..e8f7e378ec7 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -122,6 +122,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
GLuint *state = i830->state.Tex[unit], format, pitch;
GLint lodbias;
GLubyte border[4];
+ GLuint dst_x, dst_y;
memset(state, 0, sizeof(state));
@@ -132,7 +133,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
i830->state.tex_buffer[unit] = NULL;
}
- if (!intelObj->imageOverride && !intel_finalize_mipmap_tree(intel, unit))
+ if (!intel_finalize_mipmap_tree(intel, unit))
return GL_FALSE;
/* Get first image here, since intelObj->firstLevel will get set in
@@ -140,42 +141,20 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
*/
firstImage = tObj->Image[0][intelObj->firstLevel];
- if (intelObj->imageOverride) {
- i830->state.tex_buffer[unit] = NULL;
- i830->state.tex_offset[unit] = intelObj->textureOffset;
+ intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0,
+ &dst_x, &dst_y);
- switch (intelObj->depthOverride) {
- case 32:
- format = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- break;
- case 24:
- default:
- format = MAPSURF_32BIT | MT_32BIT_XRGB8888;
- break;
- case 16:
- format = MAPSURF_16BIT | MT_16BIT_RGB565;
- break;
- }
-
- pitch = intelObj->pitchOverride;
- } else {
- GLuint dst_x, dst_y;
-
- intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0,
- &dst_x, &dst_y);
-
- dri_bo_reference(intelObj->mt->region->buffer);
- i830->state.tex_buffer[unit] = intelObj->mt->region->buffer;
- /* XXX: This calculation is probably broken for tiled images with
- * a non-page-aligned offset.
- */
- i830->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) *
- intelObj->mt->cpp;
+ dri_bo_reference(intelObj->mt->region->buffer);
+ i830->state.tex_buffer[unit] = intelObj->mt->region->buffer;
+ /* XXX: This calculation is probably broken for tiled images with
+ * a non-page-aligned offset.
+ */
+ i830->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) *
+ intelObj->mt->cpp;
- format = translate_texture_format(firstImage->TexFormat,
- firstImage->InternalFormat);
- pitch = intelObj->mt->pitch * intelObj->mt->cpp;
- }
+ format = translate_texture_format(firstImage->TexFormat,
+ firstImage->InternalFormat);
+ pitch = intelObj->mt->pitch * intelObj->mt->cpp;
state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
(LOAD_TEXTURE_MAP0 << unit) | 4);
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
index a8df77c600e..be96419ff19 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -496,15 +496,13 @@ i830_emit_state(struct intel_context *intel)
OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR0]);
OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR1]);
OUT_RELOC(state->draw_region->buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- state->draw_region->draw_offset);
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
if (state->depth_region) {
OUT_BATCH(state->Buffer[I830_DESTREG_DBUFADDR0]);
OUT_BATCH(state->Buffer[I830_DESTREG_DBUFADDR1]);
OUT_RELOC(state->depth_region->buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- state->depth_region->draw_offset);
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
}
OUT_BATCH(state->Buffer[I830_DESTREG_DV0]);
@@ -598,6 +596,7 @@ i830_set_draw_region(struct intel_context *intel,
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
GLuint value;
struct i830_hw_state *state = &i830->state;
+ uint32_t draw_x, draw_y;
if (state->draw_region != color_regions[0]) {
intel_region_release(&state->draw_region);
@@ -652,14 +651,40 @@ i830_set_draw_region(struct intel_context *intel,
}
state->Buffer[I830_DESTREG_DV1] = value;
+ /* We set up the drawing rectangle to be offset into the color
+ * region's location in the miptree. If it doesn't match with
+ * depth's offsets, we can't render to it.
+ *
+ * (Well, not actually true -- the hw grew a bit to let depth's
+ * offset get forced to 0,0. We may want to use that if people are
+ * hitting that case. Also, some configurations may be supportable
+ * by tweaking the start offset of the buffers around, which we
+ * can't do in general due to tiling)
+ */
+ FALLBACK(intel, I830_FALLBACK_DRAW_OFFSET,
+ (depth_region && color_regions[0]) &&
+ (depth_region->draw_x != color_regions[0]->draw_x ||
+ depth_region->draw_y != color_regions[0]->draw_y));
+
+ if (color_regions[0]) {
+ draw_x = color_regions[0]->draw_x;
+ draw_y = color_regions[0]->draw_y;
+ } else if (depth_region) {
+ draw_x = depth_region->draw_x;
+ draw_y = depth_region->draw_y;
+ } else {
+ draw_x = 0;
+ draw_y = 0;
+ }
+
state->Buffer[I830_DESTREG_DRAWRECT0] = _3DSTATE_DRAWRECT_INFO;
state->Buffer[I830_DESTREG_DRAWRECT1] = 0;
- state->Buffer[I830_DESTREG_DRAWRECT2] = 0; /* xmin, ymin */
+ state->Buffer[I830_DESTREG_DRAWRECT2] = (draw_y << 16) | draw_x;
state->Buffer[I830_DESTREG_DRAWRECT3] =
- (ctx->DrawBuffer->Width & 0xffff) |
- (ctx->DrawBuffer->Height << 16);
- state->Buffer[I830_DESTREG_DRAWRECT4] = 0; /* xoff, yoff */
- state->Buffer[I830_DESTREG_DRAWRECT5] = 0;
+ ((ctx->DrawBuffer->Width + draw_x) & 0xffff) |
+ ((ctx->DrawBuffer->Height + draw_y) << 16);
+ state->Buffer[I830_DESTREG_DRAWRECT4] = (draw_y << 16) | draw_x;
+ state->Buffer[I830_DESTREG_DRAWRECT5] = MI_NOOP;
I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS);
}
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index ed9a44ff246..4d86aae87d9 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -108,7 +108,7 @@ i915CreateContext(const __GLcontextModes * mesaVis,
return GL_FALSE;
if (0)
- _mesa_printf("\ntexmem-0-3 branch\n\n");
+ printf("\ntexmem-0-3 branch\n\n");
i915InitVtbl(i915);
diff --git a/src/mesa/drivers/dri/i915/i915_context.h b/src/mesa/drivers/dri/i915/i915_context.h
index 60b357ec28d..b5169280f6b 100644
--- a/src/mesa/drivers/dri/i915/i915_context.h
+++ b/src/mesa/drivers/dri/i915/i915_context.h
@@ -40,6 +40,7 @@
#define I915_FALLBACK_POLYGON_SMOOTH 0x40000
#define I915_FALLBACK_POINT_SMOOTH 0x80000
#define I915_FALLBACK_POINT_SPRITE_COORD_ORIGIN 0x100000
+#define I915_FALLBACK_DRAW_OFFSET 0x200000
#define I915_UPLOAD_CTX 0x1
#define I915_UPLOAD_BUFFERS 0x2
diff --git a/src/mesa/drivers/dri/i915/i915_debug.c b/src/mesa/drivers/dri/i915/i915_debug.c
index fecfac30339..4569fb918ea 100644
--- a/src/mesa/drivers/dri/i915/i915_debug.c
+++ b/src/mesa/drivers/dri/i915/i915_debug.c
@@ -31,27 +31,25 @@
#include "i915_context.h"
#include "i915_debug.h"
-#define PRINTF( ... ) _mesa_printf( __VA_ARGS__ )
-
static GLboolean debug( struct debug_stream *stream, const char *name, GLuint len )
{
GLuint i;
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
if (len == 0) {
- PRINTF("Error - zero length packet (0x%08x)\n", stream->ptr[0]);
+ printf("Error - zero length packet (0x%08x)\n", stream->ptr[0]);
assert(0);
return GL_FALSE;
}
if (stream->print_addresses)
- PRINTF("%08x: ", stream->offset);
+ printf("%08x: ", stream->offset);
- PRINTF("%s (%d dwords):\n", name, len);
+ printf("%s (%d dwords):\n", name, len);
for (i = 0; i < len; i++)
- PRINTF("\t0x%08x\n", ptr[i]);
- PRINTF("\n");
+ printf("\t0x%08x\n", ptr[i]);
+ printf("\n");
stream->offset += len * sizeof(GLuint);
@@ -88,17 +86,17 @@ static GLboolean debug_prim( struct debug_stream *stream, const char *name,
- PRINTF("%s %s (%d dwords):\n", name, prim, len);
- PRINTF("\t0x%08x\n", ptr[0]);
+ printf("%s %s (%d dwords):\n", name, prim, len);
+ printf("\t0x%08x\n", ptr[0]);
for (i = 1; i < len; i++) {
if (dump_floats)
- PRINTF("\t0x%08x // %f\n", ptr[i], *(GLfloat *)&ptr[i]);
+ printf("\t0x%08x // %f\n", ptr[i], *(GLfloat *)&ptr[i]);
else
- PRINTF("\t0x%08x\n", ptr[i]);
+ printf("\t0x%08x\n", ptr[i]);
}
- PRINTF("\n");
+ printf("\n");
stream->offset += len * sizeof(GLuint);
@@ -113,15 +111,15 @@ static GLboolean debug_program( struct debug_stream *stream, const char *name, G
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
if (len == 0) {
- PRINTF("Error - zero length packet (0x%08x)\n", stream->ptr[0]);
+ printf("Error - zero length packet (0x%08x)\n", stream->ptr[0]);
assert(0);
return GL_FALSE;
}
if (stream->print_addresses)
- PRINTF("%08x: ", stream->offset);
+ printf("%08x: ", stream->offset);
- PRINTF("%s (%d dwords):\n", name, len);
+ printf("%s (%d dwords):\n", name, len);
i915_disassemble_program( ptr, len );
stream->offset += len * sizeof(GLuint);
@@ -135,17 +133,17 @@ static GLboolean debug_chain( struct debug_stream *stream, const char *name, GLu
GLuint old_offset = stream->offset + len * sizeof(GLuint);
GLuint i;
- PRINTF("%s (%d dwords):\n", name, len);
+ printf("%s (%d dwords):\n", name, len);
for (i = 0; i < len; i++)
- PRINTF("\t0x%08x\n", ptr[i]);
+ printf("\t0x%08x\n", ptr[i]);
stream->offset = ptr[1] & ~0x3;
if (stream->offset < old_offset)
- PRINTF("\n... skipping backwards from 0x%x --> 0x%x ...\n\n",
+ printf("\n... skipping backwards from 0x%x --> 0x%x ...\n\n",
old_offset, stream->offset );
else
- PRINTF("\n... skipping from 0x%x --> 0x%x ...\n\n",
+ printf("\n... skipping from 0x%x --> 0x%x ...\n\n",
old_offset, stream->offset );
@@ -165,10 +163,10 @@ static GLboolean debug_variable_length_prim( struct debug_stream *stream )
len = 1+(i+2)/2;
- PRINTF("3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len);
+ printf("3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len);
for (i = 0; i < len; i++)
- PRINTF("\t0x%08x\n", ptr[i]);
- PRINTF("\n");
+ printf("\t0x%08x\n", ptr[i]);
+ printf("\n");
stream->offset += len * sizeof(GLuint);
return GL_TRUE;
@@ -178,9 +176,9 @@ static GLboolean debug_variable_length_prim( struct debug_stream *stream )
#define BITS( dw, hi, lo, ... ) \
do { \
unsigned himask = 0xffffffffU >> (31 - (hi)); \
- PRINTF("\t\t "); \
- PRINTF(__VA_ARGS__); \
- PRINTF(": 0x%x\n", ((dw) & himask) >> (lo)); \
+ printf("\t\t "); \
+ printf(__VA_ARGS__); \
+ printf(": 0x%x\n", ((dw) & himask) >> (lo)); \
} while (0)
#define MBZ( dw, hi, lo) do { \
@@ -194,9 +192,9 @@ do { \
#define FLAG( dw, bit, ... ) \
do { \
if (((dw) >> (bit)) & 1) { \
- PRINTF("\t\t "); \
- PRINTF(__VA_ARGS__); \
- PRINTF("\n"); \
+ printf("\t\t "); \
+ printf(__VA_ARGS__); \
+ printf("\n"); \
} \
} while (0)
@@ -208,17 +206,17 @@ static GLboolean debug_load_immediate( struct debug_stream *stream,
GLuint bits = (ptr[0] >> 4) & 0xff;
GLuint j = 0;
- PRINTF("%s (%d dwords, flags: %x):\n", name, len, bits);
- PRINTF("\t0x%08x\n", ptr[j++]);
+ printf("%s (%d dwords, flags: %x):\n", name, len, bits);
+ printf("\t0x%08x\n", ptr[j++]);
if (bits & (1<<0)) {
- PRINTF("\t LIS0: 0x%08x\n", ptr[j]);
- PRINTF("\t vb address: 0x%08x\n", (ptr[j] & ~0x3));
+ printf("\t LIS0: 0x%08x\n", ptr[j]);
+ printf("\t vb address: 0x%08x\n", (ptr[j] & ~0x3));
BITS(ptr[j], 0, 0, "vb invalidate disable");
j++;
}
if (bits & (1<<1)) {
- PRINTF("\t LIS1: 0x%08x\n", ptr[j]);
+ printf("\t LIS1: 0x%08x\n", ptr[j]);
BITS(ptr[j], 29, 24, "vb dword width");
BITS(ptr[j], 21, 16, "vb dword pitch");
BITS(ptr[j], 15, 0, "vb max index");
@@ -226,7 +224,7 @@ static GLboolean debug_load_immediate( struct debug_stream *stream,
}
if (bits & (1<<2)) {
int i;
- PRINTF("\t LIS2: 0x%08x\n", ptr[j]);
+ printf("\t LIS2: 0x%08x\n", ptr[j]);
for (i = 0; i < 8; i++) {
unsigned tc = (ptr[j] >> (i * 4)) & 0xf;
if (tc != 0xf)
@@ -235,11 +233,11 @@ static GLboolean debug_load_immediate( struct debug_stream *stream,
j++;
}
if (bits & (1<<3)) {
- PRINTF("\t LIS3: 0x%08x\n", ptr[j]);
+ printf("\t LIS3: 0x%08x\n", ptr[j]);
j++;
}
if (bits & (1<<4)) {
- PRINTF("\t LIS4: 0x%08x\n", ptr[j]);
+ printf("\t LIS4: 0x%08x\n", ptr[j]);
BITS(ptr[j], 31, 23, "point width");
BITS(ptr[j], 22, 19, "line width");
FLAG(ptr[j], 18, "alpha flatshade");
@@ -261,7 +259,7 @@ static GLboolean debug_load_immediate( struct debug_stream *stream,
j++;
}
if (bits & (1<<5)) {
- PRINTF("\t LIS5: 0x%08x\n", ptr[j]);
+ printf("\t LIS5: 0x%08x\n", ptr[j]);
BITS(ptr[j], 31, 28, "rgba write disables");
FLAG(ptr[j], 27, "force dflt point width");
FLAG(ptr[j], 26, "last pixel enable");
@@ -279,7 +277,7 @@ static GLboolean debug_load_immediate( struct debug_stream *stream,
j++;
}
if (bits & (1<<6)) {
- PRINTF("\t LIS6: 0x%08x\n", ptr[j]);
+ printf("\t LIS6: 0x%08x\n", ptr[j]);
FLAG(ptr[j], 31, "alpha test enable");
BITS(ptr[j], 30, 28, "alpha func");
BITS(ptr[j], 27, 20, "alpha ref");
@@ -296,7 +294,7 @@ static GLboolean debug_load_immediate( struct debug_stream *stream,
}
- PRINTF("\n");
+ printf("\n");
assert(j == len);
@@ -315,34 +313,34 @@ static GLboolean debug_load_indirect( struct debug_stream *stream,
GLuint bits = (ptr[0] >> 8) & 0x3f;
GLuint i, j = 0;
- PRINTF("%s (%d dwords):\n", name, len);
- PRINTF("\t0x%08x\n", ptr[j++]);
+ printf("%s (%d dwords):\n", name, len);
+ printf("\t0x%08x\n", ptr[j++]);
for (i = 0; i < 6; i++) {
if (bits & (1<<i)) {
switch (1<<(8+i)) {
case LI0_STATE_STATIC_INDIRECT:
- PRINTF(" STATIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(" 0x%08x\n", ptr[j++]);
+ printf(" STATIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ printf(" 0x%08x\n", ptr[j++]);
break;
case LI0_STATE_DYNAMIC_INDIRECT:
- PRINTF(" DYNAMIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ printf(" DYNAMIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
break;
case LI0_STATE_SAMPLER:
- PRINTF(" SAMPLER: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(" 0x%08x\n", ptr[j++]);
+ printf(" SAMPLER: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ printf(" 0x%08x\n", ptr[j++]);
break;
case LI0_STATE_MAP:
- PRINTF(" MAP: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(" 0x%08x\n", ptr[j++]);
+ printf(" MAP: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ printf(" 0x%08x\n", ptr[j++]);
break;
case LI0_STATE_PROGRAM:
- PRINTF(" PROGRAM: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(" 0x%08x\n", ptr[j++]);
+ printf(" PROGRAM: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ printf(" 0x%08x\n", ptr[j++]);
break;
case LI0_STATE_CONSTANTS:
- PRINTF(" CONSTANTS: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
- PRINTF(" 0x%08x\n", ptr[j++]);
+ printf(" CONSTANTS: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++;
+ printf(" 0x%08x\n", ptr[j++]);
break;
default:
assert(0);
@@ -352,10 +350,10 @@ static GLboolean debug_load_indirect( struct debug_stream *stream,
}
if (bits == 0) {
- PRINTF("\t DUMMY: 0x%08x\n", ptr[j++]);
+ printf("\t DUMMY: 0x%08x\n", ptr[j++]);
}
- PRINTF("\n");
+ printf("\n");
assert(j == len);
@@ -368,7 +366,7 @@ static GLboolean debug_load_indirect( struct debug_stream *stream,
static void BR13( struct debug_stream *stream,
GLuint val )
{
- PRINTF("\t0x%08x\n", val);
+ printf("\t0x%08x\n", val);
FLAG(val, 30, "clipping enable");
BITS(val, 25, 24, "color depth (3==32bpp)");
BITS(val, 23, 16, "raster op");
@@ -384,11 +382,11 @@ static void BR2223( struct debug_stream *stream,
BR22.val = val22;
BR23.val = val23;
- PRINTF("\t0x%08x\n", val22);
+ printf("\t0x%08x\n", val22);
BITS(val22, 31, 16, "dest y1");
BITS(val22, 15, 0, "dest x1");
- PRINTF("\t0x%08x\n", val23);
+ printf("\t0x%08x\n", val23);
BITS(val23, 31, 16, "dest y2");
BITS(val23, 15, 0, "dest x2");
@@ -400,13 +398,13 @@ static void BR2223( struct debug_stream *stream,
static void BR09( struct debug_stream *stream,
GLuint val )
{
- PRINTF("\t0x%08x -- dest address\n", val);
+ printf("\t0x%08x -- dest address\n", val);
}
static void BR26( struct debug_stream *stream,
GLuint val )
{
- PRINTF("\t0x%08x\n", val);
+ printf("\t0x%08x\n", val);
BITS(val, 31, 16, "src y1");
BITS(val, 15, 0, "src x1");
}
@@ -414,20 +412,20 @@ static void BR26( struct debug_stream *stream,
static void BR11( struct debug_stream *stream,
GLuint val )
{
- PRINTF("\t0x%08x\n", val);
+ printf("\t0x%08x\n", val);
BITS(val, 15, 0, "src pitch");
}
static void BR12( struct debug_stream *stream,
GLuint val )
{
- PRINTF("\t0x%08x -- src address\n", val);
+ printf("\t0x%08x -- src address\n", val);
}
static void BR16( struct debug_stream *stream,
GLuint val )
{
- PRINTF("\t0x%08x -- color\n", val);
+ printf("\t0x%08x -- color\n", val);
}
static GLboolean debug_copy_blit( struct debug_stream *stream,
@@ -437,8 +435,8 @@ static GLboolean debug_copy_blit( struct debug_stream *stream,
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
int j = 0;
- PRINTF("%s (%d dwords):\n", name, len);
- PRINTF("\t0x%08x\n", ptr[j++]);
+ printf("%s (%d dwords):\n", name, len);
+ printf("\t0x%08x\n", ptr[j++]);
BR13(stream, ptr[j++]);
BR2223(stream, ptr[j], ptr[j+1]);
@@ -460,8 +458,8 @@ static GLboolean debug_color_blit( struct debug_stream *stream,
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
int j = 0;
- PRINTF("%s (%d dwords):\n", name, len);
- PRINTF("\t0x%08x\n", ptr[j++]);
+ printf("%s (%d dwords):\n", name, len);
+ printf("\t0x%08x\n", ptr[j++]);
BR13(stream, ptr[j++]);
BR2223(stream, ptr[j], ptr[j+1]);
@@ -481,8 +479,8 @@ static GLboolean debug_modes4( struct debug_stream *stream,
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
int j = 0;
- PRINTF("%s (%d dwords):\n", name, len);
- PRINTF("\t0x%08x\n", ptr[j]);
+ printf("%s (%d dwords):\n", name, len);
+ printf("\t0x%08x\n", ptr[j]);
BITS(ptr[j], 21, 18, "logicop func");
FLAG(ptr[j], 17, "stencil test mask modify-enable");
FLAG(ptr[j], 16, "stencil write mask modify-enable");
@@ -502,26 +500,26 @@ static GLboolean debug_map_state( struct debug_stream *stream,
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
int j = 0;
- PRINTF("%s (%d dwords):\n", name, len);
- PRINTF("\t0x%08x\n", ptr[j++]);
+ printf("%s (%d dwords):\n", name, len);
+ printf("\t0x%08x\n", ptr[j++]);
{
- PRINTF("\t0x%08x\n", ptr[j]);
+ printf("\t0x%08x\n", ptr[j]);
BITS(ptr[j], 15, 0, "map mask");
j++;
}
while (j < len) {
{
- PRINTF("\t TMn.0: 0x%08x\n", ptr[j]);
- PRINTF("\t map address: 0x%08x\n", (ptr[j] & ~0x3));
+ printf("\t TMn.0: 0x%08x\n", ptr[j]);
+ printf("\t map address: 0x%08x\n", (ptr[j] & ~0x3));
FLAG(ptr[j], 1, "vertical line stride");
FLAG(ptr[j], 0, "vertical line stride offset");
j++;
}
{
- PRINTF("\t TMn.1: 0x%08x\n", ptr[j]);
+ printf("\t TMn.1: 0x%08x\n", ptr[j]);
BITS(ptr[j], 31, 21, "height");
BITS(ptr[j], 20, 10, "width");
BITS(ptr[j], 9, 7, "surface format");
@@ -532,7 +530,7 @@ static GLboolean debug_map_state( struct debug_stream *stream,
j++;
}
{
- PRINTF("\t TMn.2: 0x%08x\n", ptr[j]);
+ printf("\t TMn.2: 0x%08x\n", ptr[j]);
BITS(ptr[j], 31, 21, "dword pitch");
BITS(ptr[j], 20, 15, "cube face enables");
BITS(ptr[j], 14, 9, "max lod");
@@ -554,18 +552,18 @@ static GLboolean debug_sampler_state( struct debug_stream *stream,
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
int j = 0;
- PRINTF("%s (%d dwords):\n", name, len);
- PRINTF("\t0x%08x\n", ptr[j++]);
+ printf("%s (%d dwords):\n", name, len);
+ printf("\t0x%08x\n", ptr[j++]);
{
- PRINTF("\t0x%08x\n", ptr[j]);
+ printf("\t0x%08x\n", ptr[j]);
BITS(ptr[j], 15, 0, "sampler mask");
j++;
}
while (j < len) {
{
- PRINTF("\t TSn.0: 0x%08x\n", ptr[j]);
+ printf("\t TSn.0: 0x%08x\n", ptr[j]);
FLAG(ptr[j], 31, "reverse gamma");
FLAG(ptr[j], 30, "planar to packed");
FLAG(ptr[j], 29, "yuv->rgb");
@@ -582,7 +580,7 @@ static GLboolean debug_sampler_state( struct debug_stream *stream,
}
{
- PRINTF("\t TSn.1: 0x%08x\n", ptr[j]);
+ printf("\t TSn.1: 0x%08x\n", ptr[j]);
BITS(ptr[j], 31, 24, "min lod");
MBZ( ptr[j], 23, 18 );
FLAG(ptr[j], 17, "kill pixel enable");
@@ -597,7 +595,7 @@ static GLboolean debug_sampler_state( struct debug_stream *stream,
j++;
}
{
- PRINTF("\t TSn.2: 0x%08x (default color)\n", ptr[j]);
+ printf("\t TSn.2: 0x%08x (default color)\n", ptr[j]);
j++;
}
}
@@ -614,11 +612,11 @@ static GLboolean debug_dest_vars( struct debug_stream *stream,
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
int j = 0;
- PRINTF("%s (%d dwords):\n", name, len);
- PRINTF("\t0x%08x\n", ptr[j++]);
+ printf("%s (%d dwords):\n", name, len);
+ printf("\t0x%08x\n", ptr[j++]);
{
- PRINTF("\t0x%08x\n", ptr[j]);
+ printf("\t0x%08x\n", ptr[j]);
FLAG(ptr[j], 31, "early classic ztest");
FLAG(ptr[j], 30, "opengl tex default color");
FLAG(ptr[j], 29, "bypass iz");
@@ -649,11 +647,11 @@ static GLboolean debug_buf_info( struct debug_stream *stream,
GLuint *ptr = (GLuint *)(stream->ptr + stream->offset);
int j = 0;
- PRINTF("%s (%d dwords):\n", name, len);
- PRINTF("\t0x%08x\n", ptr[j++]);
+ printf("%s (%d dwords):\n", name, len);
+ printf("\t0x%08x\n", ptr[j++]);
{
- PRINTF("\t0x%08x\n", ptr[j]);
+ printf("\t0x%08x\n", ptr[j]);
BITS(ptr[j], 28, 28, "aux buffer id");
BITS(ptr[j], 27, 24, "buffer id (7=depth, 3=back)");
FLAG(ptr[j], 23, "use fence regs");
@@ -665,7 +663,7 @@ static GLboolean debug_buf_info( struct debug_stream *stream,
j++;
}
- PRINTF("\t0x%08x -- buffer base address\n", ptr[j++]);
+ printf("\t0x%08x -- buffer base address\n", ptr[j++]);
stream->offset += len * sizeof(GLuint);
assert(j == len);
@@ -826,7 +824,7 @@ i915_dump_batchbuffer( GLuint *start,
GLuint bytes = (end - start) * 4;
GLboolean done = GL_FALSE;
- PRINTF("\n\nBATCH: (%d)\n", bytes / 4);
+ printf("\n\nBATCH: (%d)\n", bytes / 4);
stream.offset = 0;
stream.ptr = (char *)start;
@@ -843,7 +841,7 @@ i915_dump_batchbuffer( GLuint *start,
stream.offset >= 0);
}
- PRINTF("END-BATCH\n\n\n");
+ printf("END-BATCH\n\n\n");
}
diff --git a/src/mesa/drivers/dri/i915/i915_debug_fp.c b/src/mesa/drivers/dri/i915/i915_debug_fp.c
index bf500e54fa2..adfc9e89454 100644
--- a/src/mesa/drivers/dri/i915/i915_debug_fp.c
+++ b/src/mesa/drivers/dri/i915/i915_debug_fp.c
@@ -31,8 +31,6 @@
#include "i915_debug.h"
#include "main/imports.h"
-#define PRINTF( ... ) _mesa_printf( __VA_ARGS__ )
-
static const char *opcodes[0x20] = {
"NOP",
"ADD",
@@ -123,27 +121,27 @@ print_reg_type_nr(GLuint type, GLuint nr)
case REG_TYPE_T:
switch (nr) {
case T_DIFFUSE:
- PRINTF("T_DIFFUSE");
+ printf("T_DIFFUSE");
return;
case T_SPECULAR:
- PRINTF("T_SPECULAR");
+ printf("T_SPECULAR");
return;
case T_FOG_W:
- PRINTF("T_FOG_W");
+ printf("T_FOG_W");
return;
default:
- PRINTF("T_TEX%d", nr);
+ printf("T_TEX%d", nr);
return;
}
case REG_TYPE_OC:
if (nr == 0) {
- PRINTF("oC");
+ printf("oC");
return;
}
break;
case REG_TYPE_OD:
if (nr == 0) {
- PRINTF("oD");
+ printf("oD");
return;
}
break;
@@ -151,7 +149,7 @@ print_reg_type_nr(GLuint type, GLuint nr)
break;
}
- PRINTF("%s[%d]", regname[type], nr);
+ printf("%s[%d]", regname[type], nr);
}
#define REG_SWIZZLE_MASK 0x7777
@@ -172,33 +170,33 @@ print_reg_neg_swizzle(GLuint reg)
(reg & REG_NEGATE_MASK) == 0)
return;
- PRINTF(".");
+ printf(".");
for (i = 3; i >= 0; i--) {
if (reg & (1 << ((i * 4) + 3)))
- PRINTF("-");
+ printf("-");
switch ((reg >> (i * 4)) & 0x7) {
case 0:
- PRINTF("x");
+ printf("x");
break;
case 1:
- PRINTF("y");
+ printf("y");
break;
case 2:
- PRINTF("z");
+ printf("z");
break;
case 3:
- PRINTF("w");
+ printf("w");
break;
case 4:
- PRINTF("0");
+ printf("0");
break;
case 5:
- PRINTF("1");
+ printf("1");
break;
default:
- PRINTF("?");
+ printf("?");
break;
}
}
@@ -223,15 +221,15 @@ print_dest_reg(GLuint dword)
print_reg_type_nr(type, nr);
if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL)
return;
- PRINTF(".");
+ printf(".");
if (dword & A0_DEST_CHANNEL_X)
- PRINTF("x");
+ printf("x");
if (dword & A0_DEST_CHANNEL_Y)
- PRINTF("y");
+ printf("y");
if (dword & A0_DEST_CHANNEL_Z)
- PRINTF("z");
+ printf("z");
if (dword & A0_DEST_CHANNEL_W)
- PRINTF("w");
+ printf("w");
}
@@ -246,29 +244,29 @@ print_arith_op(GLuint opcode, const GLuint * program)
if (opcode != A0_NOP) {
print_dest_reg(program[0]);
if (program[0] & A0_DEST_SATURATE)
- PRINTF(" = SATURATE ");
+ printf(" = SATURATE ");
else
- PRINTF(" = ");
+ printf(" = ");
}
- PRINTF("%s ", opcodes[opcode]);
+ printf("%s ", opcodes[opcode]);
print_src_reg(GET_SRC0_REG(program[0], program[1]));
if (args[opcode] == 1) {
- PRINTF("\n");
+ printf("\n");
return;
}
- PRINTF(", ");
+ printf(", ");
print_src_reg(GET_SRC1_REG(program[1], program[2]));
if (args[opcode] == 2) {
- PRINTF("\n");
+ printf("\n");
return;
}
- PRINTF(", ");
+ printf(", ");
print_src_reg(GET_SRC2_REG(program[2]));
- PRINTF("\n");
+ printf("\n");
return;
}
@@ -277,24 +275,24 @@ static void
print_tex_op(GLuint opcode, const GLuint * program)
{
print_dest_reg(program[0] | A0_DEST_CHANNEL_ALL);
- PRINTF(" = ");
+ printf(" = ");
- PRINTF("%s ", opcodes[opcode]);
+ printf("%s ", opcodes[opcode]);
- PRINTF("S[%d],", program[0] & T0_SAMPLER_NR_MASK);
+ printf("S[%d],", program[0] & T0_SAMPLER_NR_MASK);
print_reg_type_nr((program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) &
REG_TYPE_MASK,
(program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK);
- PRINTF("\n");
+ printf("\n");
}
static void
print_dcl_op(GLuint opcode, const GLuint * program)
{
- PRINTF("%s ", opcodes[opcode]);
+ printf("%s ", opcodes[opcode]);
print_dest_reg(program[0] | A0_DEST_CHANNEL_ALL);
- PRINTF("\n");
+ printf("\n");
}
@@ -304,7 +302,7 @@ i915_disassemble_program(const GLuint * program, GLuint sz)
GLuint size = program[0] & 0x1ff;
GLint i;
- PRINTF("\t\tBEGIN\n");
+ printf("\t\tBEGIN\n");
assert(size + 2 == sz);
@@ -312,7 +310,7 @@ i915_disassemble_program(const GLuint * program, GLuint sz)
for (i = 1; i < sz; i += 3, program += 3) {
GLuint opcode = program[0] & (0x1f << 24);
- PRINTF("\t\t");
+ printf("\t\t");
if ((GLint) opcode >= A0_NOP && opcode <= A0_SLT)
print_arith_op(opcode >> 24, program);
@@ -321,10 +319,10 @@ i915_disassemble_program(const GLuint * program, GLuint sz)
else if (opcode == D0_DCL)
print_dcl_op(opcode >> 24, program);
else
- PRINTF("Unknown opcode 0x%x\n", opcode);
+ printf("Unknown opcode 0x%x\n", opcode);
}
- PRINTF("\t\tEND\n\n");
+ printf("\t\tEND\n\n");
}
diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c
index d9588e5b56d..fe3908f580a 100644
--- a/src/mesa/drivers/dri/i915/i915_tex_layout.c
+++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c
@@ -145,8 +145,8 @@ i915_miptree_layout_cube(struct intel_context *intel,
intel_miptree_set_image_offset(mt, level, face, x, y);
if (d == 0)
- _mesa_printf("cube mipmap %d/%d (%d..%d) is 0x0\n",
- face, level, mt->first_level, mt->last_level);
+ printf("cube mipmap %d/%d (%d..%d) is 0x0\n",
+ face, level, mt->first_level, mt->last_level);
d >>= 1;
x += step_offsets[face][0] * d;
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index 3ee4c8653a9..a1ab8f8b6d2 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -150,7 +150,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
i915->state.tex_buffer[unit] = NULL;
}
- if (!intelObj->imageOverride && !intel_finalize_mipmap_tree(intel, unit))
+ if (!intel_finalize_mipmap_tree(intel, unit))
return GL_FALSE;
/* Get first image here, since intelObj->firstLevel will get set in
@@ -158,34 +158,14 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
*/
firstImage = tObj->Image[0][intelObj->firstLevel];
- if (intelObj->imageOverride) {
- i915->state.tex_buffer[unit] = NULL;
- i915->state.tex_offset[unit] = intelObj->textureOffset;
+ dri_bo_reference(intelObj->mt->region->buffer);
+ i915->state.tex_buffer[unit] = intelObj->mt->region->buffer;
+ i915->state.tex_offset[unit] = 0; /* Always the origin of the miptree */
- switch (intelObj->depthOverride) {
- case 32:
- format = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- break;
- case 24:
- default:
- format = MAPSURF_32BIT | MT_32BIT_XRGB8888;
- break;
- case 16:
- format = MAPSURF_16BIT | MT_16BIT_RGB565;
- break;
- }
-
- pitch = intelObj->pitchOverride;
- } else {
- dri_bo_reference(intelObj->mt->region->buffer);
- i915->state.tex_buffer[unit] = intelObj->mt->region->buffer;
- i915->state.tex_offset[unit] = 0; /* Always the origin of the miptree */
-
- format = translate_texture_format(firstImage->TexFormat,
- firstImage->InternalFormat,
- tObj->DepthMode);
- pitch = intelObj->mt->pitch * intelObj->mt->cpp;
- }
+ format = translate_texture_format(firstImage->TexFormat,
+ firstImage->InternalFormat,
+ tObj->DepthMode);
+ pitch = intelObj->mt->pitch * intelObj->mt->cpp;
state[I915_TEXREG_MS3] =
(((firstImage->Height - 1) << MS3_HEIGHT_SHIFT) |
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 392126b7dca..0a93e64b1fa 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -55,6 +55,7 @@ i915_render_prevalidate(struct intel_context *intel)
static void
i915_render_start(struct intel_context *intel)
{
+ intel_prepare_render(intel);
}
@@ -377,15 +378,13 @@ i915_emit_state(struct intel_context *intel)
OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR0]);
OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR1]);
OUT_RELOC(state->draw_region->buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- state->draw_region->draw_offset);
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
if (state->depth_region) {
OUT_BATCH(state->Buffer[I915_DESTREG_DBUFADDR0]);
OUT_BATCH(state->Buffer[I915_DESTREG_DBUFADDR1]);
OUT_RELOC(state->depth_region->buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- state->depth_region->draw_offset);
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
}
OUT_BATCH(state->Buffer[I915_DESTREG_DV0]);
@@ -533,6 +532,7 @@ i915_set_draw_region(struct intel_context *intel,
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
GLuint value;
struct i915_hw_state *state = &i915->state;
+ uint32_t draw_x, draw_y;
if (state->draw_region != color_regions[0]) {
intel_region_release(&state->draw_region);
@@ -595,14 +595,41 @@ i915_set_draw_region(struct intel_context *intel,
}
state->Buffer[I915_DESTREG_DV1] = value;
- state->Buffer[I915_DESTREG_DRAWRECT0] = _3DSTATE_DRAWRECT_INFO;
- state->Buffer[I915_DESTREG_DRAWRECT1] = 0;
- state->Buffer[I915_DESTREG_DRAWRECT2] = 0; /* xmin, ymin */
- state->Buffer[I915_DESTREG_DRAWRECT3] =
- (ctx->DrawBuffer->Width & 0xffff) |
- (ctx->DrawBuffer->Height << 16);
- state->Buffer[I915_DESTREG_DRAWRECT4] = 0; /* xoff, yoff */
- state->Buffer[I915_DESTREG_DRAWRECT5] = 0;
+ /* We set up the drawing rectangle to be offset into the color
+ * region's location in the miptree. If it doesn't match with
+ * depth's offsets, we can't render to it.
+ *
+ * (Well, not actually true -- the hw grew a bit to let depth's
+ * offset get forced to 0,0. We may want to use that if people are
+ * hitting that case. Also, some configurations may be supportable
+ * by tweaking the start offset of the buffers around, which we
+ * can't do in general due to tiling)
+ */
+ FALLBACK(intel, I915_FALLBACK_DRAW_OFFSET,
+ (depth_region && color_regions[0]) &&
+ (depth_region->draw_x != color_regions[0]->draw_x ||
+ depth_region->draw_y != color_regions[0]->draw_y));
+
+ if (color_regions[0]) {
+ draw_x = color_regions[0]->draw_x;
+ draw_y = color_regions[0]->draw_y;
+ } else if (depth_region) {
+ draw_x = depth_region->draw_x;
+ draw_y = depth_region->draw_y;
+ } else {
+ draw_x = 0;
+ draw_y = 0;
+ }
+
+ /* When changing drawing rectangle offset, an MI_FLUSH is first required. */
+ state->Buffer[I915_DESTREG_DRAWRECT0] = MI_FLUSH;
+ state->Buffer[I915_DESTREG_DRAWRECT1] = _3DSTATE_DRAWRECT_INFO;
+ state->Buffer[I915_DESTREG_DRAWRECT2] = 0;
+ state->Buffer[I915_DESTREG_DRAWRECT3] = (draw_y << 16) | draw_x;
+ state->Buffer[I915_DESTREG_DRAWRECT4] =
+ ((ctx->DrawBuffer->Width + draw_x) & 0xffff) |
+ ((ctx->DrawBuffer->Height + draw_y) << 16);
+ state->Buffer[I915_DESTREG_DRAWRECT5] = (draw_y << 16) | draw_x;
I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);
}
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index 6d498c56542..fb191fe346f 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -66,7 +66,7 @@ intel_flush_inline_primitive(struct intel_context *intel)
assert(intel->prim.primitive != ~0);
-/* _mesa_printf("/\n"); */
+/* printf("/\n"); */
if (used < 8)
goto do_discard;
@@ -93,13 +93,12 @@ static void intel_start_inline(struct intel_context *intel, uint32_t prim)
intel->no_batch_wrap = GL_TRUE;
- /*_mesa_printf("%s *", __progname);*/
+ /*printf("%s *", __progname);*/
/* Emit a slot which will be filled with the inline primitive
* command later.
*/
- BEGIN_BATCH(2);
- OUT_BATCH(0);
+ BEGIN_BATCH(1);
assert((intel->batch->dirty_state & (1<<1)) == 0);
@@ -111,7 +110,7 @@ static void intel_start_inline(struct intel_context *intel, uint32_t prim)
ADVANCE_BATCH();
intel->no_batch_wrap = GL_FALSE;
-/* _mesa_printf(">"); */
+/* printf(">"); */
}
static void intel_wrap_inline(struct intel_context *intel)
@@ -133,7 +132,7 @@ static GLuint *intel_extend_inline(struct intel_context *intel, GLuint dwords)
if (intel_batchbuffer_space(intel->batch) < sz)
intel_wrap_inline(intel);
-/* _mesa_printf("."); */
+/* printf("."); */
intel->vtbl.assert_not_dirty(intel);
@@ -218,7 +217,7 @@ void intel_flush_prim(struct intel_context *intel)
intel->prim.count = 0;
offset = intel->prim.start_offset;
intel->prim.start_offset = intel->prim.current_offset;
- if (!intel->gen >= 3)
+ if (intel->gen < 3)
intel->prim.start_offset = ALIGN(intel->prim.start_offset, 128);
intel->prim.flush = NULL;
@@ -604,7 +603,6 @@ static struct
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
@@ -1178,6 +1176,8 @@ static char *fallbackStrings[] = {
[17] = "Logic op",
[18] = "Smooth polygon",
[19] = "Smooth point",
+ [20] = "point sprite coord origin",
+ [21] = "depth/color drawing offset",
};
diff --git a/src/mesa/drivers/dri/i915/server/intel_dri.c b/src/mesa/drivers/dri/i915/server/intel_dri.c
deleted file mode 120000
index effdd26448a..00000000000
--- a/src/mesa/drivers/dri/i915/server/intel_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../intel/server/intel_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile
index 7758a792fde..a242580273f 100644
--- a/src/mesa/drivers/dri/i965/Makefile
+++ b/src/mesa/drivers/dri/i965/Makefile
@@ -84,11 +84,21 @@ DRIVER_SOURCES = \
brw_wm_pass2.c \
brw_wm_sampler_state.c \
brw_wm_state.c \
- brw_wm_surface_state.c
+ brw_wm_surface_state.c \
+ gen6_cc.c \
+ gen6_clip_state.c \
+ gen6_depthstencil.c \
+ gen6_gs_state.c \
+ gen6_sampler_state.c \
+ gen6_scissor_state.c \
+ gen6_sf_state.c \
+ gen6_urb.c \
+ gen6_viewport_state.c \
+ gen6_vs_state.c \
+ gen6_wm_state.c
C_SOURCES = \
$(COMMON_SOURCES) \
- $(MINIGLX_SOURCES) \
$(DRIVER_SOURCES)
ASM_SOURCES =
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 65f51be3410..a512896f315 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -78,7 +78,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
GLcontext *ctx = &intel->ctx;
if (!brw) {
- _mesa_printf("%s: failed to alloc context\n", __FUNCTION__);
+ printf("%s: failed to alloc context\n", __FUNCTION__);
return GL_FALSE;
}
@@ -87,7 +87,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
if (!intelInitContext( intel, mesaVis, driContextPriv,
sharedContextPrivate, &functions )) {
- _mesa_printf("%s: failed to init intel context\n", __FUNCTION__);
+ printf("%s: failed to init intel context\n", __FUNCTION__);
FREE(brw);
return GL_FALSE;
}
@@ -150,7 +150,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
ctx->Const.FragmentProgram.MaxEnvParams);
- if (intel->is_ironlake || intel->is_g4x) {
+ if (intel->is_ironlake || intel->is_g4x || intel->gen >= 6) {
brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45;
brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45;
brw->has_surface_tile_offset = GL_TRUE;
@@ -170,7 +170,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
brw->urb.size = 384;
brw->vs_max_threads = 32;
brw->wm_max_threads = 10 * 5;
- } else {
+ } else if (intel->gen < 6) {
brw->urb.size = 256;
brw->vs_max_threads = 16;
brw->wm_max_threads = 8 * 4;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 21c4cd38a72..d6fc37e4d89 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -282,6 +282,9 @@ struct brw_vs_ouput_sizes {
enum brw_cache_id {
+ BRW_BLEND_STATE,
+ BRW_DEPTH_STENCIL_STATE,
+ BRW_COLOR_CALC_STATE,
BRW_CC_VP,
BRW_CC_UNIT,
BRW_WM_PROG,
@@ -290,7 +293,7 @@ enum brw_cache_id {
BRW_WM_UNIT,
BRW_SF_PROG,
BRW_SF_VP,
- BRW_SF_UNIT,
+ BRW_SF_UNIT, /* scissor state on gen6 */
BRW_VS_UNIT,
BRW_VS_PROG,
BRW_GS_UNIT,
@@ -354,6 +357,9 @@ struct brw_tracked_state {
/* Flags for brw->state.cache.
*/
+#define CACHE_NEW_BLEND_STATE (1<<BRW_BLEND_STATE)
+#define CACHE_NEW_DEPTH_STENCIL_STATE (1<<BRW_DEPTH_STENCIL_STATE)
+#define CACHE_NEW_COLOR_CALC_STATE (1<<BRW_COLOR_CALC_STATE)
#define CACHE_NEW_CC_VP (1<<BRW_CC_VP)
#define CACHE_NEW_CC_UNIT (1<<BRW_CC_UNIT)
#define CACHE_NEW_WM_PROG (1<<BRW_WM_PROG)
@@ -538,7 +544,8 @@ struct brw_context
GLuint nr_sf_entries;
GLuint nr_cs_entries;
-/* GLuint vs_size; */
+ /* gen6 */
+ GLuint vs_size;
/* GLuint gs_size; */
/* GLuint clip_size; */
/* GLuint sf_size; */
@@ -643,9 +650,16 @@ struct brw_context
struct {
+ /* gen4 */
dri_bo *prog_bo;
- dri_bo *state_bo;
dri_bo *vp_bo;
+
+ /* gen6 */
+ dri_bo *blend_state_bo;
+ dri_bo *depth_stencil_state_bo;
+ dri_bo *color_calc_state_bo;
+
+ dri_bo *state_bo;
} cc;
struct {
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 6cb8edb611f..4e78b08cfed 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -114,13 +114,13 @@ static void calculate_curbe_offsets( struct brw_context *brw )
brw->curbe.total_size = reg;
if (0)
- _mesa_printf("curbe wm %d+%d clip %d+%d vs %d+%d\n",
- brw->curbe.wm_start,
- brw->curbe.wm_size,
- brw->curbe.clip_start,
- brw->curbe.clip_size,
- brw->curbe.vs_start,
- brw->curbe.vs_size );
+ printf("curbe wm %d+%d clip %d+%d vs %d+%d\n",
+ brw->curbe.wm_start,
+ brw->curbe.wm_size,
+ brw->curbe.clip_start,
+ brw->curbe.clip_size,
+ brw->curbe.vs_start,
+ brw->curbe.vs_size );
brw->state.dirty.brw |= BRW_NEW_CURBE_OFFSETS;
}
@@ -179,7 +179,6 @@ static GLfloat fixed_plane[6][4] = {
*/
static void prepare_constant_buffer(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
GLcontext *ctx = &brw->intel.ctx;
const struct brw_vertex_program *vp =
brw_vertex_program_const(brw->vertex_program);
@@ -199,7 +198,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
return;
}
- buf = (GLfloat *) _mesa_calloc(bufsz);
+ buf = (GLfloat *) calloc(1, bufsz);
/* fragment shader constants */
if (brw->curbe.wm_size) {
@@ -280,13 +279,13 @@ static void prepare_constant_buffer(struct brw_context *brw)
if (0) {
for (i = 0; i < sz*16; i+=4)
- _mesa_printf("curbe %d.%d: %f %f %f %f\n", i/8, i&4,
- buf[i+0], buf[i+1], buf[i+2], buf[i+3]);
+ printf("curbe %d.%d: %f %f %f %f\n", i/8, i&4,
+ buf[i+0], buf[i+1], buf[i+2], buf[i+3]);
- _mesa_printf("last_buf %p buf %p sz %d/%d cmp %d\n",
- brw->curbe.last_buf, buf,
- bufsz, brw->curbe.last_bufsz,
- brw->curbe.last_buf ? memcmp(buf, brw->curbe.last_buf, bufsz) : -1);
+ printf("last_buf %p buf %p sz %d/%d cmp %d\n",
+ brw->curbe.last_buf, buf,
+ bufsz, brw->curbe.last_bufsz,
+ brw->curbe.last_buf ? memcmp(buf, brw->curbe.last_buf, bufsz) : -1);
}
if (brw->curbe.curbe_bo != NULL &&
@@ -294,12 +293,12 @@ static void prepare_constant_buffer(struct brw_context *brw)
bufsz == brw->curbe.last_bufsz &&
memcmp(buf, brw->curbe.last_buf, bufsz) == 0) {
/* constants have not changed */
- _mesa_free(buf);
+ free(buf);
}
else {
/* constants have changed */
if (brw->curbe.last_buf)
- _mesa_free(brw->curbe.last_buf);
+ free(brw->curbe.last_buf);
brw->curbe.last_buf = buf;
brw->curbe.last_bufsz = bufsz;
@@ -307,7 +306,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
if (brw->curbe.curbe_bo != NULL &&
brw->curbe.curbe_next_offset + bufsz > brw->curbe.curbe_bo->size)
{
- intel_bo_unmap_gtt_preferred(intel, brw->curbe.curbe_bo);
+ drm_intel_gem_bo_unmap_gtt(brw->curbe.curbe_bo);
dri_bo_unreference(brw->curbe.curbe_bo);
brw->curbe.curbe_bo = NULL;
}
@@ -319,7 +318,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
brw->curbe.curbe_bo = dri_bo_alloc(brw->intel.bufmgr, "CURBE",
4096, 1 << 6);
brw->curbe.curbe_next_offset = 0;
- intel_bo_map_gtt_preferred(intel, brw->curbe.curbe_bo, GL_TRUE);
+ drm_intel_gem_bo_map_gtt(brw->curbe.curbe_bo);
}
brw->curbe.curbe_offset = brw->curbe.curbe_next_offset;
diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index ea0d7e05d41..bb1b5f5ef03 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -530,6 +530,7 @@
#define BRW_OPCODE_POP 47
#define BRW_OPCODE_WAIT 48
#define BRW_OPCODE_SEND 49
+#define BRW_OPCODE_MATH 56
#define BRW_OPCODE_ADD 64
#define BRW_OPCODE_MUL 65
#define BRW_OPCODE_AVG 66
@@ -727,7 +728,8 @@
#define BRW_MATH_FUNCTION_SIN 6 /* was 7 */
#define BRW_MATH_FUNCTION_COS 7 /* was 8 */
#define BRW_MATH_FUNCTION_SINCOS 8 /* was 6 */
-#define BRW_MATH_FUNCTION_TAN 9
+#define BRW_MATH_FUNCTION_TAN 9 /* gen4 */
+#define BRW_MATH_FUNCTION_FDIV 9 /* gen6+ */
#define BRW_MATH_FUNCTION_POW 10
#define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER 11
#define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT 12
@@ -778,17 +780,33 @@
#define CMD_PIPELINED_STATE_POINTERS 0x7800
#define CMD_BINDING_TABLE_PTRS 0x7801
+# define GEN6_BINDING_TABLE_MODIFY_VS (1 << 8)
+# define GEN6_BINDING_TABLE_MODIFY_GS (1 << 9)
+# define GEN6_BINDING_TABLE_MODIFY_PS (1 << 10)
+
+#define CMD_3D_SAMPLER_STATE_POINTERS 0x7802 /* SNB+ */
+# define PS_SAMPLER_STATE_CHANGE (1 << 12)
+# define GS_SAMPLER_STATE_CHANGE (1 << 9)
+# define VS_SAMPLER_STATE_CHANGE (1 << 8)
+/* DW1: VS */
+/* DW2: GS */
+/* DW3: PS */
#define CMD_VERTEX_BUFFER 0x7808
# define BRW_VB0_INDEX_SHIFT 27
+# define GEN6_VB0_INDEX_SHIFT 26
# define BRW_VB0_ACCESS_VERTEXDATA (0 << 26)
# define BRW_VB0_ACCESS_INSTANCEDATA (1 << 26)
+# define GEN6_VB0_ACCESS_VERTEXDATA (0 << 20)
+# define GEN6_VB0_ACCESS_INSTANCEDATA (1 << 20)
# define BRW_VB0_PITCH_SHIFT 0
#define CMD_VERTEX_ELEMENT 0x7809
# define BRW_VE0_INDEX_SHIFT 27
+# define GEN6_VE0_INDEX_SHIFT 26
# define BRW_VE0_FORMAT_SHIFT 16
# define BRW_VE0_VALID (1 << 26)
+# define GEN6_VE0_VALID (1 << 25)
# define BRW_VE0_SRC_OFFSET_SHIFT 0
# define BRW_VE1_COMPONENT_NOSTORE 0
# define BRW_VE1_COMPONENT_STORE_SRC 1
@@ -805,8 +823,219 @@
# define BRW_VE1_DST_OFFSET_SHIFT 0
#define CMD_INDEX_BUFFER 0x780a
-#define CMD_VF_STATISTICS_965 0x780b
+#define CMD_VF_STATISTICS_965 0x780b
#define CMD_VF_STATISTICS_GM45 0x680b
+#define CMD_3D_CC_STATE_POINTERS 0x780e /* GEN6+ */
+
+#define CMD_URB 0x7805 /* GEN6+ */
+# define GEN6_URB_VS_SIZE_SHIFT 16
+# define GEN6_URB_VS_ENTRIES_SHIFT 0
+# define GEN6_URB_GS_SIZE_SHIFT 8
+# define GEN6_URB_GS_ENTRIES_SHIFT 0
+
+#define CMD_VIEWPORT_STATE_POINTERS 0x780d /* GEN6+ */
+# define GEN6_CC_VIEWPORT_MODIFY (1 << 12)
+# define GEN6_SF_VIEWPORT_MODIFY (1 << 11)
+# define GEN6_CLIP_VIEWPORT_MODIFY (1 << 10)
+
+#define CMD_3D_SCISSOR_STATE_POINTERS 0x780f /* GEN6+ */
+
+#define CMD_3D_VS_STATE 0x7810 /* GEN6+ */
+/* DW2 */
+# define GEN6_VS_SPF_MODE (1 << 31)
+# define GEN6_VS_VECTOR_MASK_ENABLE (1 << 30)
+# define GEN6_VS_SAMPLER_COUNT_SHIFT 27
+# define GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18
+/* DW4 */
+# define GEN6_VS_DISPATCH_START_GRF_SHIFT 20
+# define GEN6_VS_URB_READ_LENGTH_SHIFT 11
+# define GEN6_VS_URB_ENTRY_READ_OFFSET_SHIFT 4
+/* DW5 */
+# define GEN6_VS_MAX_THREADS_SHIFT 25
+# define GEN6_VS_STATISTICS_ENABLE (1 << 10)
+# define GEN6_VS_CACHE_DISABLE (1 << 1)
+# define GEN6_VS_ENABLE (1 << 0)
+
+#define CMD_3D_GS_STATE 0x7811 /* GEN6+ */
+/* DW2 */
+# define GEN6_GS_SPF_MODE (1 << 31)
+# define GEN6_GS_VECTOR_MASK_ENABLE (1 << 30)
+# define GEN6_GS_SAMPLER_COUNT_SHIFT 27
+# define GEN6_GS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18
+/* DW4 */
+# define GEN6_GS_URB_READ_LENGTH_SHIFT 11
+# define GEN6_GS_URB_ENTRY_READ_OFFSET_SHIFT 4
+# define GEN6_GS_DISPATCH_START_GRF_SHIFT 0
+/* DW5 */
+# define GEN6_GS_MAX_THREADS_SHIFT 25
+# define GEN6_GS_STATISTICS_ENABLE (1 << 10)
+# define GEN6_GS_SO_STATISTICS_ENABLE (1 << 9)
+# define GEN6_GS_RENDERING_ENABLE (1 << 8)
+/* DW6 */
+# define GEN6_GS_ENABLE (1 << 15)
+
+#define CMD_3D_CLIP_STATE 0x7812 /* GEN6+ */
+/* DW1 */
+# define GEN6_CLIP_STATISTICS_ENABLE (1 << 10)
+/* DW2 */
+# define GEN6_CLIP_ENABLE (1 << 31)
+# define GEN6_CLIP_API_OGL (0 << 30)
+# define GEN6_CLIP_API_D3D (1 << 30)
+# define GEN6_CLIP_XY_TEST (1 << 28)
+# define GEN6_CLIP_Z_TEST (1 << 27)
+# define GEN6_CLIP_GB_TEST (1 << 26)
+# define GEN6_CLIP_MODE_NORMAL (0 << 13)
+# define GEN6_CLIP_MODE_REJECT_ALL (3 << 13)
+# define GEN6_CLIP_MODE_ACCEPT_ALL (4 << 13)
+# define GEN6_CLIP_PERSPECTIVE_DIVIDE_DISABLE (1 << 9)
+# define GEN6_CLIP_BARYCENTRIC_ENABLE (1 << 8)
+# define GEN6_CLIP_TRI_PROVOKE_SHIFT 4
+# define GEN6_CLIP_LINE_PROVOKE_SHIFT 2
+# define GEN6_CLIP_TRIFAN_PROVOKE_SHIFT 0
+/* DW3 */
+# define GEN6_CLIP_MIN_POINT_WIDTH_SHIFT 17
+# define GEN6_CLIP_MAX_POINT_WIDTH_SHIFT 6
+
+#define CMD_3D_SF_STATE 0x7813 /* GEN6+ */
+/* DW1 */
+# define GEN6_SF_NUM_OUTPUTS_SHIFT 22
+# define GEN6_SF_SWIZZLE_ENABLE (1 << 21)
+# define GEN6_SF_POINT_SPRITE_LOWERLEFT (1 << 20)
+# define GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT 11
+# define GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT 4
+/* DW2 */
+# define GEN6_SF_LEGACY_GLOBAL_DEPTH_BIAS (1 << 11)
+# define GEN6_SF_STATISTICS_ENABLE (1 << 10)
+# define GEN6_SF_GLOBAL_DEPTH_OFFSET_SOLID (1 << 9)
+# define GEN6_SF_GLOBAL_DEPTH_OFFSET_WIREFRAME (1 << 8)
+# define GEN6_SF_GLOBAL_DEPTH_OFFSET_POINT (1 << 7)
+# define GEN6_SF_FRONT_SOLID (0 << 5)
+# define GEN6_SF_FRONT_WIREFRAME (1 << 5)
+# define GEN6_SF_FRONT_POINT (2 << 5)
+# define GEN6_SF_BACK_SOLID (0 << 3)
+# define GEN6_SF_BACK_WIREFRAME (1 << 3)
+# define GEN6_SF_BACK_POINT (2 << 3)
+# define GEN6_SF_VIEWPORT_TRANSFORM_ENABLE (1 << 1)
+# define GEN6_SF_WINDING_CCW (1 << 0)
+/* DW3 */
+# define GEN6_SF_LINE_AA_ENABLE (1 << 31)
+# define GEN6_SF_CULL_BOTH (0 << 29)
+# define GEN6_SF_CULL_NONE (1 << 29)
+# define GEN6_SF_CULL_FRONT (2 << 29)
+# define GEN6_SF_CULL_BACK (3 << 29)
+# define GEN6_SF_LINE_WIDTH_SHIFT 18 /* U3.7 */
+# define GEN6_SF_LINE_END_CAP_WIDTH_0_5 (0 << 16)
+# define GEN6_SF_LINE_END_CAP_WIDTH_1_0 (1 << 16)
+# define GEN6_SF_LINE_END_CAP_WIDTH_2_0 (2 << 16)
+# define GEN6_SF_LINE_END_CAP_WIDTH_4_0 (3 << 16)
+# define GEN6_SF_SCISSOR_ENABLE (1 << 11)
+# define GEN6_SF_MSRAST_OFF_PIXEL (0 << 8)
+# define GEN6_SF_MSRAST_OFF_PATTERN (1 << 8)
+# define GEN6_SF_MSRAST_ON_PIXEL (2 << 8)
+# define GEN6_SF_MSRAST_ON_PATTERN (3 << 8)
+/* DW4 */
+# define GEN6_SF_TRI_PROVOKE_SHIFT 29
+# define GEN6_SF_LINE_PROVOKE_SHIFT 27
+# define GEN6_SF_TRIFAN_PROVOKE_SHIFT 25
+# define GEN6_SF_LINE_AA_MODE_MANHATTAN (0 << 14)
+# define GEN6_SF_LINE_AA_MODE_TRUE (1 << 14)
+# define GEN6_SF_VERTEX_SUBPIXEL_8BITS (0 << 12)
+# define GEN6_SF_VERTEX_SUBPIXEL_4BITS (1 << 12)
+# define GEN6_SF_USE_STATE_POINT_WIDTH (1 << 11)
+# define GEN6_SF_POINT_WIDTH_SHIFT 0 /* U8.3 */
+/* DW5: depth offset constant */
+/* DW6: depth offset scale */
+/* DW7: depth offset clamp */
+/* DW8 */
+# define ATTRIBUTE_1_OVERRIDE_W (1 << 31)
+# define ATTRIBUTE_1_OVERRIDE_Z (1 << 30)
+# define ATTRIBUTE_1_OVERRIDE_Y (1 << 29)
+# define ATTRIBUTE_1_OVERRIDE_X (1 << 28)
+# define ATTRIBUTE_1_CONST_SOURCE_SHIFT 25
+# define ATTRIBUTE_1_SWIZZLE_SHIFT 22
+# define ATTRIBUTE_1_SOURCE_SHIFT 16
+# define ATTRIBUTE_0_OVERRIDE_W (1 << 15)
+# define ATTRIBUTE_0_OVERRIDE_Z (1 << 14)
+# define ATTRIBUTE_0_OVERRIDE_Y (1 << 13)
+# define ATTRIBUTE_0_OVERRIDE_X (1 << 12)
+# define ATTRIBUTE_0_CONST_SOURCE_SHIFT 9
+# define ATTRIBUTE_0_SWIZZLE_SHIFT 6
+# define ATTRIBUTE_0_SOURCE_SHIFT 0
+/* DW16: Point sprite texture coordinate enables */
+/* DW17: Constant interpolation enables */
+/* DW18: attr 0-7 wrap shortest enables */
+/* DW19: attr 8-16 wrap shortest enables */
+
+#define CMD_3D_WM_STATE 0x7814 /* GEN6+ */
+/* DW1: kernel pointer */
+/* DW2 */
+# define GEN6_WM_SPF_MODE (1 << 31)
+# define GEN6_WM_VECTOR_MASK_ENABLE (1 << 30)
+# define GEN6_WM_SAMPLER_COUNT_SHIFT 27
+# define GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT 18
+/* DW3: scratch space */
+/* DW4 */
+# define GEN6_WM_STATISTICS_ENABLE (1 << 31)
+# define GEN6_WM_DEPTH_CLEAR (1 << 30)
+# define GEN6_WM_DEPTH_RESOLVE (1 << 28)
+# define GEN6_WM_HIERARCHICAL_DEPTH_RESOLVE (1 << 27)
+# define GEN6_WM_DISPATCH_START_GRF_SHIFT_0 16
+# define GEN6_WM_DISPATCH_START_GRF_SHIFT_1 8
+# define GEN6_WM_DISPATCH_START_GRF_SHIFT_2 0
+/* DW5 */
+# define GEN6_WM_MAX_THREADS_SHIFT 25
+# define GEN6_WM_KILL_ENABLE (1 << 22)
+# define GEN6_WM_COMPUTED_DEPTH (1 << 21)
+# define GEN6_WM_USES_SOURCE_DEPTH (1 << 20)
+# define GEN6_WM_DISPATCH_ENABLE (1 << 19)
+# define GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5 (0 << 16)
+# define GEN6_WM_LINE_END_CAP_AA_WIDTH_1_0 (1 << 16)
+# define GEN6_WM_LINE_END_CAP_AA_WIDTH_2_0 (2 << 16)
+# define GEN6_WM_LINE_END_CAP_AA_WIDTH_4_0 (3 << 16)
+# define GEN6_WM_LINE_AA_WIDTH_0_5 (0 << 14)
+# define GEN6_WM_LINE_AA_WIDTH_1_0 (1 << 14)
+# define GEN6_WM_LINE_AA_WIDTH_2_0 (2 << 14)
+# define GEN6_WM_LINE_AA_WIDTH_4_0 (3 << 14)
+# define GEN6_WM_POLYGON_STIPPLE_ENABLE (1 << 13)
+# define GEN6_WM_LINE_STIPPLE_ENABLE (1 << 12)
+# define GEN6_WM_OMASK_TO_RENDER_TARGET (1 << 9)
+# define GEN6_WM_USES_SOURCE_W (1 << 8)
+# define GEN6_WM_DUAL_SOURCE_BLEND_ENABLE (1 << 7)
+# define GEN6_WM_32_DISPATCH_ENABLE (1 << 2)
+# define GEN6_WM_16_DISPATCH_ENABLE (1 << 1)
+# define GEN6_WM_8_DISPATCH_ENABLE (1 << 0)
+/* DW6 */
+# define GEN6_WM_NUM_SF_OUTPUTS_SHIFT 20
+# define GEN6_WM_POSOFFSET_NONE (0 << 18)
+# define GEN6_WM_POSOFFSET_CENTROID (2 << 18)
+# define GEN6_WM_POSOFFSET_SAMPLE (3 << 18)
+# define GEN6_WM_POSITION_ZW_PIXEL (0 << 16)
+# define GEN6_WM_POSITION_ZW_CENTROID (2 << 16)
+# define GEN6_WM_POSITION_ZW_SAMPLE (3 << 16)
+# define GEN6_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC (1 << 15)
+# define GEN6_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC (1 << 14)
+# define GEN6_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC (1 << 13)
+# define GEN6_WM_PERSPECTIVE_SAMPLE_BARYCENTRIC (1 << 12)
+# define GEN6_WM_PERSPECTIVE_CENTROID_BARYCENTRIC (1 << 11)
+# define GEN6_WM_PERSPECTIVE_PIXEL_BARYCENTRIC (1 << 10)
+# define GEN6_WM_POINT_RASTRULE_UPPER_RIGHT (1 << 9)
+# define GEN6_WM_MSRAST_OFF_PIXEL (0 << 1)
+# define GEN6_WM_MSRAST_OFF_PATTERN (1 << 1)
+# define GEN6_WM_MSRAST_ON_PIXEL (2 << 1)
+# define GEN6_WM_MSRAST_ON_PATTERN (3 << 1)
+# define GEN6_WM_MSDISPMODE_PERPIXEL (1 << 0)
+/* DW7: kernel 1 pointer */
+/* DW8: kernel 2 pointer */
+
+#define CMD_3D_CONSTANT_VS_STATE 0x7815 /* GEN6+ */
+#define CMD_3D_CONSTANT_GS_STATE 0x7816 /* GEN6+ */
+#define CMD_3D_CONSTANT_PS_STATE 0x7817 /* GEN6+ */
+# define GEN6_CONSTANT_BUFFER_3_ENABLE (1 << 15)
+# define GEN6_CONSTANT_BUFFER_2_ENABLE (1 << 14)
+# define GEN6_CONSTANT_BUFFER_1_ENABLE (1 << 13)
+# define GEN6_CONSTANT_BUFFER_0_ENABLE (1 << 12)
+
+#define CMD_3D_SAMPLE_MASK 0x7818 /* GEN6+ */
#define CMD_DRAW_RECT 0x7900
#define CMD_BLEND_CONSTANT_COLOR 0x7901
@@ -818,6 +1047,25 @@
#define CMD_GLOBAL_DEPTH_OFFSET_CLAMP 0x7909
#define CMD_AA_LINE_PARAMETERS 0x790a
+#define CMD_GS_SVB_INDEX 0x790b /* CTG+ */
+/* DW1 */
+# define SVB_INDEX_SHIFT 29
+# define SVB_LOAD_INTERNAL_VERTEX_COUNT (1 << 0) /* SNB+ */
+/* DW2: SVB index */
+/* DW3: SVB maximum index */
+
+#define CMD_3D_MULTISAMPLE 0x790d /* SNB+ */
+/* DW1 */
+# define MS_PIXEL_LOCATION_CENTER (0 << 4)
+# define MS_PIXEL_LOCATION_UPPER_LEFT (1 << 4)
+# define MS_NUMSAMPLES_1 (0 << 1)
+# define MS_NUMSAMPLES_4 (2 << 1)
+# define MS_NUMSAMPLES_8 (3 << 1)
+
+#define CMD_3D_CLEAR_PARAMS 0x7910 /* ILK+ */
+# define DEPTH_CLEAR_VALID (1 << 15)
+/* DW1: depth clear value */
+
#define CMD_PIPE_CONTROL 0x7a00
#define CMD_3D_PRIM 0x7b00
diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c
index a8f6b993ac3..54699cf8d34 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -74,9 +74,9 @@ struct {
[BRW_OPCODE_JMPI] = { .name = "jmpi", .nsrc = 1, .ndst = 0 },
[BRW_OPCODE_IF] = { .name = "if", .nsrc = 2, .ndst = 0 },
[BRW_OPCODE_IFF] = { .name = "iff", .nsrc = 1, .ndst = 01 },
- [BRW_OPCODE_WHILE] = { .name = "while", .nsrc = 1, .ndst = 0 },
+ [BRW_OPCODE_WHILE] = { .name = "while", .nsrc = 2, .ndst = 0 },
[BRW_OPCODE_ELSE] = { .name = "else", .nsrc = 2, .ndst = 0 },
- [BRW_OPCODE_BREAK] = { .name = "break", .nsrc = 1, .ndst = 0 },
+ [BRW_OPCODE_BREAK] = { .name = "break", .nsrc = 2, .ndst = 0 },
[BRW_OPCODE_CONTINUE] = { .name = "cont", .nsrc = 1, .ndst = 0 },
[BRW_OPCODE_HALT] = { .name = "halt", .nsrc = 1, .ndst = 0 },
[BRW_OPCODE_MSAVE] = { .name = "msave", .nsrc = 1, .ndst = 1 },
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 976249091e9..e348d4686b1 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -82,7 +82,7 @@ static GLuint brw_set_prim(struct brw_context *brw, GLenum prim)
GLcontext *ctx = &brw->intel.ctx;
if (INTEL_DEBUG & DEBUG_PRIMS)
- _mesa_printf("PRIM: %s\n", _mesa_lookup_enum_by_nr(prim));
+ printf("PRIM: %s\n", _mesa_lookup_enum_by_nr(prim));
/* Slight optimization to avoid the GS program when not needed:
*/
@@ -125,7 +125,7 @@ static void brw_emit_prim(struct brw_context *brw,
struct intel_context *intel = &brw->intel;
if (INTEL_DEBUG & DEBUG_PRIMS)
- _mesa_printf("PRIM: %s %d %d\n", _mesa_lookup_enum_by_nr(prim->mode),
+ printf("PRIM: %s %d %d\n", _mesa_lookup_enum_by_nr(prim->mode),
prim->start, prim->count);
prim_packet.header.opcode = CMD_3D_PRIM;
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index c46b9ba89ce..71a43577bfd 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -169,7 +169,7 @@ static GLuint get_surface_type( GLenum type, GLuint size,
GLenum format, GLboolean normalized )
{
if (INTEL_DEBUG & DEBUG_VERTS)
- _mesa_printf("type %s size %d normalized %d\n",
+ printf("type %s size %d normalized %d\n",
_mesa_lookup_enum_by_nr(type), size, normalized);
if (normalized) {
@@ -276,7 +276,6 @@ copy_array_to_vbo_array( struct brw_context *brw,
struct brw_vertex_element *element,
GLuint dst_stride)
{
- struct intel_context *intel = &brw->intel;
GLuint size = element->count * dst_stride;
get_space(brw, size, &element->bo, &element->offset);
@@ -289,52 +288,26 @@ copy_array_to_vbo_array( struct brw_context *brw,
}
if (dst_stride == element->glarray->StrideB) {
- if (intel->intelScreen->kernel_exec_fencing) {
- drm_intel_gem_bo_map_gtt(element->bo);
- memcpy((char *)element->bo->virtual + element->offset,
- element->glarray->Ptr, size);
- drm_intel_gem_bo_unmap_gtt(element->bo);
- } else {
- dri_bo_subdata(element->bo,
- element->offset,
- size,
- element->glarray->Ptr);
- }
+ drm_intel_gem_bo_map_gtt(element->bo);
+ memcpy((char *)element->bo->virtual + element->offset,
+ element->glarray->Ptr, size);
+ drm_intel_gem_bo_unmap_gtt(element->bo);
} else {
char *dest;
const unsigned char *src = element->glarray->Ptr;
int i;
- if (intel->intelScreen->kernel_exec_fencing) {
- drm_intel_gem_bo_map_gtt(element->bo);
- dest = element->bo->virtual;
- dest += element->offset;
-
- for (i = 0; i < element->count; i++) {
- memcpy(dest, src, dst_stride);
- src += element->glarray->StrideB;
- dest += dst_stride;
- }
-
- drm_intel_gem_bo_unmap_gtt(element->bo);
- } else {
- void *data;
-
- data = _mesa_malloc(dst_stride * element->count);
- dest = data;
- for (i = 0; i < element->count; i++) {
- memcpy(dest, src, dst_stride);
- src += element->glarray->StrideB;
- dest += dst_stride;
- }
+ drm_intel_gem_bo_map_gtt(element->bo);
+ dest = element->bo->virtual;
+ dest += element->offset;
- dri_bo_subdata(element->bo,
- element->offset,
- size,
- data);
-
- _mesa_free(data);
+ for (i = 0; i < element->count; i++) {
+ memcpy(dest, src, dst_stride);
+ src += element->glarray->StrideB;
+ dest += dst_stride;
}
+
+ drm_intel_gem_bo_unmap_gtt(element->bo);
}
}
@@ -355,7 +328,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
/* First build an array of pointers to ve's in vb.inputs_read
*/
if (0)
- _mesa_printf("%s %d..%d\n", __FUNCTION__, min_index, max_index);
+ printf("%s %d..%d\n", __FUNCTION__, min_index, max_index);
/* Accumulate the list of enabled arrays. */
brw->vb.nr_enabled = 0;
@@ -503,10 +476,17 @@ static void brw_emit_vertices(struct brw_context *brw)
if (brw->vb.nr_enabled == 0) {
BEGIN_BATCH(3);
OUT_BATCH((CMD_VERTEX_ELEMENT << 16) | 1);
- OUT_BATCH((0 << BRW_VE0_INDEX_SHIFT) |
- BRW_VE0_VALID |
- (BRW_SURFACEFORMAT_R32G32B32A32_FLOAT << BRW_VE0_FORMAT_SHIFT) |
- (0 << BRW_VE0_SRC_OFFSET_SHIFT));
+ if (IS_GEN6(intel->intelScreen->deviceID)) {
+ OUT_BATCH((0 << GEN6_VE0_INDEX_SHIFT) |
+ GEN6_VE0_VALID |
+ (BRW_SURFACEFORMAT_R32G32B32A32_FLOAT << BRW_VE0_FORMAT_SHIFT) |
+ (0 << BRW_VE0_SRC_OFFSET_SHIFT));
+ } else {
+ OUT_BATCH((0 << BRW_VE0_INDEX_SHIFT) |
+ BRW_VE0_VALID |
+ (BRW_SURFACEFORMAT_R32G32B32A32_FLOAT << BRW_VE0_FORMAT_SHIFT) |
+ (0 << BRW_VE0_SRC_OFFSET_SHIFT));
+ }
OUT_BATCH((BRW_VE1_COMPONENT_STORE_0 << BRW_VE1_COMPONENT_0_SHIFT) |
(BRW_VE1_COMPONENT_STORE_0 << BRW_VE1_COMPONENT_1_SHIFT) |
(BRW_VE1_COMPONENT_STORE_0 << BRW_VE1_COMPONENT_2_SHIFT) |
@@ -527,14 +507,22 @@ static void brw_emit_vertices(struct brw_context *brw)
for (i = 0; i < brw->vb.nr_enabled; i++) {
struct brw_vertex_element *input = brw->vb.enabled[i];
+ uint32_t dw0;
+
+ if (intel->gen >= 6) {
+ dw0 = GEN6_VB0_ACCESS_VERTEXDATA |
+ (i << GEN6_VB0_INDEX_SHIFT);
+ } else {
+ dw0 = BRW_VB0_ACCESS_VERTEXDATA |
+ (i << BRW_VB0_INDEX_SHIFT);
+ }
- OUT_BATCH((i << BRW_VB0_INDEX_SHIFT) |
- BRW_VB0_ACCESS_VERTEXDATA |
+ OUT_BATCH(dw0 |
(input->stride << BRW_VB0_PITCH_SHIFT));
OUT_RELOC(input->bo,
I915_GEM_DOMAIN_VERTEX, 0,
input->offset);
- if (intel->is_ironlake) {
+ if (intel->is_ironlake || intel->gen >= 6) {
OUT_RELOC(input->bo,
I915_GEM_DOMAIN_VERTEX, 0,
input->bo->size - 1);
@@ -565,12 +553,19 @@ static void brw_emit_vertices(struct brw_context *brw)
break;
}
- OUT_BATCH((i << BRW_VE0_INDEX_SHIFT) |
- BRW_VE0_VALID |
- (format << BRW_VE0_FORMAT_SHIFT) |
- (0 << BRW_VE0_SRC_OFFSET_SHIFT));
+ if (IS_GEN6(intel->intelScreen->deviceID)) {
+ OUT_BATCH((i << GEN6_VE0_INDEX_SHIFT) |
+ GEN6_VE0_VALID |
+ (format << BRW_VE0_FORMAT_SHIFT) |
+ (0 << BRW_VE0_SRC_OFFSET_SHIFT));
+ } else {
+ OUT_BATCH((i << BRW_VE0_INDEX_SHIFT) |
+ BRW_VE0_VALID |
+ (format << BRW_VE0_FORMAT_SHIFT) |
+ (0 << BRW_VE0_SRC_OFFSET_SHIFT));
+ }
- if (intel->is_ironlake)
+ if (intel->is_ironlake || intel->gen >= 6)
OUT_BATCH((comp0 << BRW_VE1_COMPONENT_0_SHIFT) |
(comp1 << BRW_VE1_COMPONENT_1_SHIFT) |
(comp2 << BRW_VE1_COMPONENT_2_SHIFT) |
@@ -624,13 +619,9 @@ static void brw_prepare_indices(struct brw_context *brw)
/* Straight upload
*/
- if (intel->intelScreen->kernel_exec_fencing) {
- drm_intel_gem_bo_map_gtt(bo);
- memcpy((char *)bo->virtual + offset, index_buffer->ptr, ib_size);
- drm_intel_gem_bo_unmap_gtt(bo);
- } else {
- dri_bo_subdata(bo, offset, ib_size, index_buffer->ptr);
- }
+ drm_intel_gem_bo_map_gtt(bo);
+ memcpy((char *)bo->virtual + offset, index_buffer->ptr, ib_size);
+ drm_intel_gem_bo_unmap_gtt(bo);
} else {
offset = (GLuint) (unsigned long) index_buffer->ptr;
brw->ib.start_vertex_offset = 0;
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
index 1df561386e6..4e7c1226ad4 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -237,7 +237,7 @@ brw_resolve_cals(struct brw_compile *c)
struct brw_glsl_call *call, *next;
for (call = c->first_call; call; call = next) {
next = call->next;
- _mesa_free(call);
+ free(call);
}
c->first_call = NULL;
}
@@ -247,7 +247,7 @@ brw_resolve_cals(struct brw_compile *c)
struct brw_glsl_label *label, *next;
for (label = c->first_label; label; label = next) {
next = label->next;
- _mesa_free(label);
+ free(label);
}
c->first_label = NULL;
}
diff --git a/src/mesa/drivers/dri/i965/brw_eu_debug.c b/src/mesa/drivers/dri/i965/brw_eu_debug.c
index 29f3f6d02fa..99453afdcaf 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_debug.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_debug.c
@@ -54,9 +54,9 @@ void brw_print_reg( struct brw_reg hwreg )
"f"
};
- _mesa_printf("%s%s",
- hwreg.abs ? "abs/" : "",
- hwreg.negate ? "-" : "");
+ printf("%s%s",
+ hwreg.abs ? "abs/" : "",
+ hwreg.negate ? "-" : "");
if (hwreg.file == BRW_GENERAL_REGISTER_FILE &&
hwreg.nr % 2 == 0 &&
@@ -66,7 +66,7 @@ void brw_print_reg( struct brw_reg hwreg )
hwreg.hstride == BRW_HORIZONTAL_STRIDE_1 &&
hwreg.type == BRW_REGISTER_TYPE_F) {
/* vector register */
- _mesa_printf("vec%d", hwreg.nr);
+ printf("vec%d", hwreg.nr);
}
else if (hwreg.file == BRW_GENERAL_REGISTER_FILE &&
hwreg.vstride == BRW_VERTICAL_STRIDE_0 &&
@@ -74,13 +74,13 @@ void brw_print_reg( struct brw_reg hwreg )
hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 &&
hwreg.type == BRW_REGISTER_TYPE_F) {
/* "scalar" register */
- _mesa_printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4);
+ printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4);
}
else if (hwreg.file == BRW_IMMEDIATE_VALUE) {
- _mesa_printf("imm %f", hwreg.dw1.f);
+ printf("imm %f", hwreg.dw1.f);
}
else {
- _mesa_printf("%s%d.%d<%d;%d,%d>:%s",
+ printf("%s%d.%d<%d;%d,%d>:%s",
file[hwreg.file],
hwreg.nr,
hwreg.subnr / type_sz(hwreg.type),
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 8d6ac008396..f69d5296137 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -102,8 +102,6 @@ static void brw_set_dest( struct brw_instruction *insn,
static void brw_set_src0( struct brw_instruction *insn,
struct brw_reg reg )
{
- assert(reg.file != BRW_MESSAGE_REGISTER_FILE);
-
if (reg.type != BRW_ARCHITECTURE_REGISTER_FILE)
assert(reg.nr < 128);
@@ -323,7 +321,7 @@ static void brw_set_urb_message( struct brw_context *brw,
struct intel_context *intel = &brw->intel;
brw_set_src1(insn, brw_imm_d(0));
- if (intel->is_ironlake) {
+ if (intel->is_ironlake || intel->gen >= 6) {
insn->bits3.urb_igdng.opcode = 0; /* ? */
insn->bits3.urb_igdng.offset = offset;
insn->bits3.urb_igdng.swizzle_control = swizzle_control;
@@ -334,8 +332,16 @@ static void brw_set_urb_message( struct brw_context *brw,
insn->bits3.urb_igdng.response_length = response_length;
insn->bits3.urb_igdng.msg_length = msg_length;
insn->bits3.urb_igdng.end_of_thread = end_of_thread;
- insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_URB;
- insn->bits2.send_igdng.end_of_thread = end_of_thread;
+ if (intel->gen >= 6) {
+ /* For SNB, the SFID bits moved to the condmod bits, and
+ * EOT stayed in bits3 above. Does the EOT bit setting
+ * below on Ironlake even do anything?
+ */
+ insn->header.destreg__conditionalmod = BRW_MESSAGE_TARGET_URB;
+ } else {
+ insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_URB;
+ insn->bits2.send_igdng.end_of_thread = end_of_thread;
+ }
} else {
insn->bits3.urb.opcode = 0; /* ? */
insn->bits3.urb.offset = offset;
@@ -917,26 +923,40 @@ void brw_math( struct brw_compile *p,
GLuint data_type,
GLuint precision )
{
- struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND);
- GLuint msg_length = (function == BRW_MATH_FUNCTION_POW) ? 2 : 1;
- GLuint response_length = (function == BRW_MATH_FUNCTION_SINCOS) ? 2 : 1;
+ struct intel_context *intel = &p->brw->intel;
- /* Example code doesn't set predicate_control for send
- * instructions.
- */
- insn->header.predicate_control = 0;
- insn->header.destreg__conditionalmod = msg_reg_nr;
+ if (intel->gen >= 6) {
+ struct brw_instruction *insn = next_insn(p, BRW_OPCODE_MATH);
- brw_set_dest(insn, dest);
- brw_set_src0(insn, src);
- brw_set_math_message(p->brw,
- insn,
- msg_length, response_length,
- function,
- BRW_MATH_INTEGER_UNSIGNED,
- precision,
- saturate,
- data_type);
+ /* Math is the same ISA format as other opcodes, except that CondModifier
+ * becomes FC[3:0] and ThreadCtrl becomes FC[5:4].
+ */
+ insn->header.destreg__conditionalmod = function;
+
+ brw_set_dest(insn, dest);
+ brw_set_src0(insn, src);
+ brw_set_src1(insn, brw_null_reg());
+ } else {
+ struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND);
+ GLuint msg_length = (function == BRW_MATH_FUNCTION_POW) ? 2 : 1;
+ GLuint response_length = (function == BRW_MATH_FUNCTION_SINCOS) ? 2 : 1;
+ /* Example code doesn't set predicate_control for send
+ * instructions.
+ */
+ insn->header.predicate_control = 0;
+ insn->header.destreg__conditionalmod = msg_reg_nr;
+
+ brw_set_dest(insn, dest);
+ brw_set_src0(insn, src);
+ brw_set_math_message(p->brw,
+ insn,
+ msg_length, response_length,
+ function,
+ BRW_MATH_INTEGER_UNSIGNED,
+ precision,
+ saturate,
+ data_type);
+ }
}
/**
@@ -1272,7 +1292,7 @@ void brw_SAMPLE(struct brw_compile *p,
GLboolean need_stall = 0;
if (writemask == 0) {
- /*_mesa_printf("%s: zero writemask??\n", __FUNCTION__); */
+ /*printf("%s: zero writemask??\n", __FUNCTION__); */
return;
}
@@ -1304,7 +1324,7 @@ void brw_SAMPLE(struct brw_compile *p,
if (newmask != writemask) {
need_stall = 1;
- /* _mesa_printf("need stall %x %x\n", newmask , writemask); */
+ /* printf("need stall %x %x\n", newmask , writemask); */
}
else {
struct brw_reg m1 = brw_message_reg(msg_reg_nr);
@@ -1377,7 +1397,18 @@ void brw_urb_WRITE(struct brw_compile *p,
GLuint offset,
GLuint swizzle)
{
- struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND);
+ struct intel_context *intel = &p->brw->intel;
+ struct brw_instruction *insn;
+
+ /* Sandybridge doesn't have the implied move for SENDs,
+ * and the first message register index comes from src0.
+ */
+ if (intel->gen >= 6) {
+ brw_MOV(p, brw_message_reg(msg_reg_nr), src0);
+ src0 = brw_message_reg(msg_reg_nr);
+ }
+
+ insn = next_insn(p, BRW_OPCODE_SEND);
assert(msg_length < BRW_MAX_MRF);
@@ -1385,7 +1416,8 @@ void brw_urb_WRITE(struct brw_compile *p,
brw_set_src0(insn, src0);
brw_set_src1(insn, brw_imm_d(0));
- insn->header.destreg__conditionalmod = msg_reg_nr;
+ if (intel->gen < 6)
+ insn->header.destreg__conditionalmod = msg_reg_nr;
brw_set_urb_message(p->brw,
insn,
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index f708ee00632..d030ed41f4a 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -136,6 +136,41 @@ const struct brw_tracked_state brw_binding_table_pointers = {
.emit = upload_binding_table_pointers,
};
+/**
+ * Upload the binding table pointers, which point each stage's array of surface
+ * state pointers.
+ *
+ * The binding table pointers are relative to the surface state base address,
+ * which is 0.
+ */
+static void upload_gen6_binding_table_pointers(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+
+ BEGIN_BATCH(4);
+ OUT_BATCH(CMD_BINDING_TABLE_PTRS << 16 |
+ GEN6_BINDING_TABLE_MODIFY_VS |
+ GEN6_BINDING_TABLE_MODIFY_GS |
+ GEN6_BINDING_TABLE_MODIFY_PS |
+ (4 - 2));
+ if (brw->vs.bind_bo != NULL)
+ OUT_RELOC(brw->vs.bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0); /* vs */
+ else
+ OUT_BATCH(0);
+ OUT_BATCH(0); /* gs */
+ OUT_RELOC(brw->wm.bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0); /* wm/ps */
+ ADVANCE_BATCH();
+}
+
+const struct brw_tracked_state gen6_binding_table_pointers = {
+ .dirty = {
+ .mesa = 0,
+ .brw = BRW_NEW_BATCH,
+ .cache = CACHE_NEW_SURF_BIND,
+ },
+ .prepare = prepare_binding_table_pointers,
+ .emit = upload_gen6_binding_table_pointers,
+};
/**
* Upload pointers to the per-stage state.
@@ -209,7 +244,14 @@ static void emit_depthbuffer(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
struct intel_region *region = brw->state.depth_region;
- unsigned int len = (intel->is_g4x || intel->is_ironlake) ? 6 : 5;
+ unsigned int len;
+
+ if (intel->gen >= 6)
+ len = 7;
+ else if (intel->is_g4x || intel->is_ironlake)
+ len = 6;
+ else
+ len = 5;
if (region == NULL) {
BEGIN_BATCH(len);
@@ -220,9 +262,12 @@ static void emit_depthbuffer(struct brw_context *brw)
OUT_BATCH(0);
OUT_BATCH(0);
- if (intel->is_g4x || intel->is_ironlake)
+ if (intel->is_g4x || intel->is_ironlake || intel->gen >= 6)
OUT_BATCH(0);
+ if (intel->gen >= 6)
+ OUT_BATCH(0);
+
ADVANCE_BATCH();
} else {
unsigned int format;
@@ -243,6 +288,8 @@ static void emit_depthbuffer(struct brw_context *brw)
}
assert(region->tiling != I915_TILING_X);
+ if (IS_GEN6(intel->intelScreen->deviceID))
+ assert(region->tiling != I915_TILING_NONE);
BEGIN_BATCH(len);
OUT_BATCH(CMD_DEPTH_BUFFER << 16 | (len - 2));
@@ -259,9 +306,20 @@ static void emit_depthbuffer(struct brw_context *brw)
((region->height - 1) << 19));
OUT_BATCH(0);
- if (intel->is_g4x || intel->is_ironlake)
+ if (intel->is_g4x || intel->is_ironlake || intel->gen >= 6)
OUT_BATCH(0);
+ if (intel->gen >= 6)
+ OUT_BATCH(0);
+
+ ADVANCE_BATCH();
+ }
+
+ /* Initialize it for safety. */
+ if (intel->gen >= 6) {
+ BEGIN_BATCH(2);
+ OUT_BATCH(CMD_3D_CLEAR_PARAMS << 16 | (2 - 2));
+ OUT_BATCH(0);
ADVANCE_BATCH();
}
}
@@ -435,6 +493,8 @@ const struct brw_tracked_state brw_line_stipple = {
static void upload_invarient_state( struct brw_context *brw )
{
+ struct intel_context *intel = &brw->intel;
+
{
/* 0x61040000 Pipeline Select */
/* PipelineSelect : 0 */
@@ -446,7 +506,7 @@ static void upload_invarient_state( struct brw_context *brw )
BRW_BATCH_STRUCT(brw, &ps);
}
- {
+ if (intel->gen < 6) {
struct brw_global_depth_offset_clamp gdo;
memset(&gdo, 0, sizeof(gdo));
@@ -459,6 +519,32 @@ static void upload_invarient_state( struct brw_context *brw )
BRW_BATCH_STRUCT(brw, &gdo);
}
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+
+ if (intel->gen >= 6) {
+ int i;
+
+ BEGIN_BATCH(3);
+ OUT_BATCH(CMD_3D_MULTISAMPLE << 16 | (3 - 2));
+ OUT_BATCH(MS_PIXEL_LOCATION_CENTER |
+ MS_NUMSAMPLES_1);
+ OUT_BATCH(0); /* positions for 4/8-sample */
+ ADVANCE_BATCH();
+
+ BEGIN_BATCH(2);
+ OUT_BATCH(CMD_3D_SAMPLE_MASK << 16 | (2 - 2));
+ OUT_BATCH(1);
+ ADVANCE_BATCH();
+
+ for (i = 0; i < 4; i++) {
+ BEGIN_BATCH(4);
+ OUT_BATCH(CMD_GS_SVB_INDEX << 16 | (4 - 2));
+ OUT_BATCH(i << SVB_INDEX_SHIFT);
+ OUT_BATCH(0);
+ OUT_BATCH(0xffffffff);
+ ADVANCE_BATCH();
+ }
+ }
/* 0x61020000 State Instruction Pointer */
{
@@ -509,7 +595,20 @@ static void upload_state_base_address( struct brw_context *brw )
/* Output the structure (brw_state_base_address) directly to the
* batchbuffer, so we can emit relocations inline.
*/
- if (intel->is_ironlake) {
+ if (intel->gen >= 6) {
+ BEGIN_BATCH(10);
+ OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (10 - 2));
+ OUT_BATCH(1); /* General state base address */
+ OUT_BATCH(1); /* Surface state base address */
+ OUT_BATCH(1); /* Dynamic state base address */
+ OUT_BATCH(1); /* Indirect object base address */
+ OUT_BATCH(1); /* Instruction base address */
+ OUT_BATCH(1); /* General state upper bound */
+ OUT_BATCH(1); /* Dynamic state upper bound */
+ OUT_BATCH(1); /* Indirect object upper bound */
+ OUT_BATCH(1); /* Instruction access upper bound */
+ ADVANCE_BATCH();
+ } else if (intel->is_ironlake) {
BEGIN_BATCH(8);
OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (8 - 2));
OUT_BATCH(1); /* General state base address */
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index c78f7b38aee..1fd957b3ad6 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -95,9 +95,17 @@ static void brwDeleteProgram( GLcontext *ctx,
struct gl_program *prog )
{
if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
- struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
- struct brw_fragment_program *brw_fprog = brw_fragment_program(fprog);
- dri_bo_unreference(brw_fprog->const_buffer);
+ struct gl_fragment_program *fp = (struct gl_fragment_program *) prog;
+ struct brw_fragment_program *brw_fp = brw_fragment_program(fp);
+
+ dri_bo_unreference(brw_fp->const_buffer);
+ }
+
+ if (prog->Target == GL_VERTEX_PROGRAM_ARB) {
+ struct gl_vertex_program *vp = (struct gl_vertex_program *) prog;
+ struct brw_vertex_program *brw_vp = brw_vertex_program(vp);
+
+ dri_bo_unreference(brw_vp->const_buffer);
}
_mesa_delete_program( ctx, prog );
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 5399a742449..6cce7e50890 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -73,7 +73,7 @@ brw_new_query_object(GLcontext *ctx, GLuint id)
{
struct brw_query_object *query;
- query = _mesa_calloc(sizeof(struct brw_query_object));
+ query = calloc(1, sizeof(struct brw_query_object));
query->Base.Id = id;
query->Base.Result = 0;
@@ -89,7 +89,7 @@ brw_delete_query(GLcontext *ctx, struct gl_query_object *q)
struct brw_query_object *query = (struct brw_query_object *)q;
dri_bo_unreference(query->bo);
- _mesa_free(query);
+ free(query);
}
static void
diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c
index 8e6839b8120..57d1c29ade1 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.c
+++ b/src/mesa/drivers/dri/i965/brw_sf.c
@@ -46,7 +46,6 @@
static void compile_sf_prog( struct brw_context *brw,
struct brw_sf_prog_key *key )
{
- GLcontext *ctx = &brw->intel.ctx;
struct brw_sf_compile c;
const GLuint *program;
GLuint program_size;
@@ -69,20 +68,14 @@ static void compile_sf_prog( struct brw_context *brw,
/* Construct map from attribute number to position in the vertex.
*/
- for (i = idx = 0; i < VERT_RESULT_MAX; i++)
+ for (i = idx = 0; i < VERT_RESULT_MAX; i++) {
if (c.key.attrs & BITFIELD64_BIT(i)) {
c.attr_to_idx[i] = idx;
c.idx_to_attr[idx] = i;
- if (i >= VERT_RESULT_TEX0 && i <= VERT_RESULT_TEX7) {
- c.point_attrs[i].CoordReplace =
- ctx->Point.CoordReplace[i - VERT_RESULT_TEX0];
- }
- else {
- c.point_attrs[i].CoordReplace = GL_FALSE;
- }
idx++;
}
-
+ }
+
/* Which primitive? Or all three?
*/
switch (key->primitive) {
@@ -162,6 +155,14 @@ static void upload_sf_prog(struct brw_context *brw)
}
key.do_point_sprite = ctx->Point.PointSprite;
+ if (key.do_point_sprite) {
+ int i;
+
+ for (i = 0; i < 8; i++) {
+ if (ctx->Point.CoordReplace[i])
+ key.point_sprite_coord_replace |= (1 << i);
+ }
+ }
key.sprite_origin_lower_left = (ctx->Point.SpriteOrigin == GL_LOWER_LEFT);
/* _NEW_LIGHT */
key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT);
diff --git a/src/mesa/drivers/dri/i965/brw_sf.h b/src/mesa/drivers/dri/i965/brw_sf.h
index 0ba731fac99..a0680a56f2c 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.h
+++ b/src/mesa/drivers/dri/i965/brw_sf.h
@@ -46,6 +46,7 @@
struct brw_sf_prog_key {
GLbitfield64 attrs;
+ uint8_t point_sprite_coord_replace;
GLuint primitive:2;
GLuint do_twoside_color:1;
GLuint do_flat_shading:1;
@@ -56,10 +57,6 @@ struct brw_sf_prog_key {
GLuint pad:24;
};
-struct brw_sf_point_tex {
- GLboolean CoordReplace;
-};
-
struct brw_sf_compile {
struct brw_compile func;
struct brw_sf_prog_key key;
@@ -100,7 +97,6 @@ struct brw_sf_compile {
GLubyte attr_to_idx[VERT_RESULT_MAX];
GLubyte idx_to_attr[VERT_RESULT_MAX];
- struct brw_sf_point_tex point_attrs[VERT_RESULT_MAX];
};
diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c
index bb08055e3bb..56f7c986e78 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c
@@ -354,6 +354,33 @@ static GLboolean calculate_masks( struct brw_sf_compile *c,
return is_last_attr;
}
+/* Calculates the predicate control for which channels of a reg
+ * (containing 2 attrs) to do point sprite coordinate replacement on.
+ */
+static uint16_t
+calculate_point_sprite_mask(struct brw_sf_compile *c, GLuint reg)
+{
+ int attr1, attr2;
+ uint16_t pc = 0;
+
+ attr1 = c->idx_to_attr[reg * 2];
+ if (attr1 >= VERT_RESULT_TEX0 && attr1 <= VERT_RESULT_TEX7) {
+ if (c->key.point_sprite_coord_replace & (1 << (attr1 - VERT_RESULT_TEX0)))
+ pc |= 0x0f;
+ }
+
+ if (reg * 2 + 1 < c->nr_setup_attrs) {
+ attr2 = c->idx_to_attr[reg * 2 + 1];
+ if (attr2 >= VERT_RESULT_TEX0 && attr2 <= VERT_RESULT_TEX7) {
+ if (c->key.point_sprite_coord_replace & (1 << (attr2 -
+ VERT_RESULT_TEX0)))
+ pc |= 0xf0;
+ }
+ }
+
+ return pc;
+}
+
void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate)
@@ -529,22 +556,27 @@ void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate)
copy_z_inv_w(c);
for (i = 0; i < c->nr_setup_regs; i++)
{
- struct brw_sf_point_tex *tex = &c->point_attrs[c->idx_to_attr[2*i]];
struct brw_reg a0 = offset(c->vert[0], i);
- GLushort pc, pc_persp, pc_linear;
+ GLushort pc, pc_persp, pc_linear, pc_coord_replace;
GLboolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
-
- if (pc_persp)
- {
- if (!tex->CoordReplace) {
- brw_set_predicate_control_flag_value(p, pc_persp);
- brw_MUL(p, a0, a0, c->inv_w[0]);
- }
+
+ pc_coord_replace = calculate_point_sprite_mask(c, i);
+ pc_persp &= ~pc_coord_replace;
+
+ if (pc_persp) {
+ brw_set_predicate_control_flag_value(p, pc_persp);
+ brw_MUL(p, a0, a0, c->inv_w[0]);
}
- if (tex->CoordReplace) {
- /* Caculate 1.0/PointWidth */
- brw_math(&c->func,
+ /* Point sprite coordinate replacement: A texcoord with this
+ * enabled gets replaced with the value (x, y, 0, 1) where x and
+ * y vary from 0 to 1 across the horizontal and vertical of the
+ * point.
+ */
+ if (pc_coord_replace) {
+ brw_set_predicate_control_flag_value(p, pc_coord_replace);
+ /* Caculate 1.0/PointWidth */
+ brw_math(&c->func,
c->tmp,
BRW_MATH_FUNCTION_INV,
BRW_MATH_SATURATE_NONE,
@@ -553,50 +585,51 @@ void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate)
BRW_MATH_DATA_SCALAR,
BRW_MATH_PRECISION_FULL);
- if (c->key.sprite_origin_lower_left) {
- brw_MUL(p, c->m1Cx, c->tmp, c->inv_w[0]);
- brw_MOV(p, vec1(suboffset(c->m1Cx, 1)), brw_imm_f(0.0));
- brw_MUL(p, c->m2Cy, c->tmp, negate(c->inv_w[0]));
- brw_MOV(p, vec1(suboffset(c->m2Cy, 0)), brw_imm_f(0.0));
- } else {
- brw_MUL(p, c->m1Cx, c->tmp, c->inv_w[0]);
- brw_MOV(p, vec1(suboffset(c->m1Cx, 1)), brw_imm_f(0.0));
- brw_MUL(p, c->m2Cy, c->tmp, c->inv_w[0]);
- brw_MOV(p, vec1(suboffset(c->m2Cy, 0)), brw_imm_f(0.0));
- }
- } else {
- brw_MOV(p, c->m1Cx, brw_imm_ud(0));
- brw_MOV(p, c->m2Cy, brw_imm_ud(0));
- }
+ brw_set_access_mode(p, BRW_ALIGN_16);
- {
- brw_set_predicate_control_flag_value(p, pc);
- if (tex->CoordReplace) {
- if (c->key.sprite_origin_lower_left) {
- brw_MUL(p, c->m3C0, c->inv_w[0], brw_imm_f(1.0));
- brw_MOV(p, vec1(suboffset(c->m3C0, 0)), brw_imm_f(0.0));
- }
- else
- brw_MOV(p, c->m3C0, brw_imm_f(0.0));
+ /* dA/dx, dA/dy */
+ brw_MOV(p, c->m1Cx, brw_imm_f(0.0));
+ brw_MOV(p, c->m2Cy, brw_imm_f(0.0));
+ brw_MOV(p, brw_writemask(c->m1Cx, WRITEMASK_X), c->tmp);
+ if (c->key.sprite_origin_lower_left) {
+ brw_MOV(p, brw_writemask(c->m2Cy, WRITEMASK_Y), negate(c->tmp));
} else {
- brw_MOV(p, c->m3C0, a0); /* constant value */
+ brw_MOV(p, brw_writemask(c->m2Cy, WRITEMASK_Y), c->tmp);
}
- /* Copy m0..m3 to URB.
- */
- brw_urb_WRITE(p,
- brw_null_reg(),
- 0,
- brw_vec8_grf(0, 0),
- 0, /* allocate */
- 1, /* used */
- 4, /* msg len */
- 0, /* response len */
- last, /* eot */
- last, /* writes complete */
- i*4, /* urb destination offset */
- BRW_URB_SWIZZLE_TRANSPOSE);
+ /* attribute constant offset */
+ brw_MOV(p, c->m3C0, brw_imm_f(0.0));
+ if (c->key.sprite_origin_lower_left) {
+ brw_MOV(p, brw_writemask(c->m3C0, WRITEMASK_YW), brw_imm_f(1.0));
+ } else {
+ brw_MOV(p, brw_writemask(c->m3C0, WRITEMASK_W), brw_imm_f(1.0));
+ }
+
+ brw_set_access_mode(p, BRW_ALIGN_1);
}
+
+ if (pc & ~pc_coord_replace) {
+ brw_set_predicate_control_flag_value(p, pc & ~pc_coord_replace);
+ brw_MOV(p, c->m1Cx, brw_imm_ud(0));
+ brw_MOV(p, c->m2Cy, brw_imm_ud(0));
+ brw_MOV(p, c->m3C0, a0); /* constant value */
+ }
+
+
+ brw_set_predicate_control_flag_value(p, pc);
+ /* Copy m0..m3 to URB. */
+ brw_urb_WRITE(p,
+ brw_null_reg(),
+ 0,
+ brw_vec8_grf(0, 0),
+ 0, /* allocate */
+ 1, /* used */
+ 4, /* msg len */
+ 0, /* response len */
+ last, /* eot */
+ last, /* writes complete */
+ i*4, /* urb destination offset */
+ BRW_URB_SWIZZLE_TRANSPOSE);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 536fe8b249b..f790cfabe25 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -90,6 +90,23 @@ const struct brw_tracked_state brw_drawing_rect;
const struct brw_tracked_state brw_indices;
const struct brw_tracked_state brw_vertices;
const struct brw_tracked_state brw_index_buffer;
+const struct brw_tracked_state gen6_binding_table_pointers;
+const struct brw_tracked_state gen6_blend_state;
+const struct brw_tracked_state gen6_cc_state_pointers;
+const struct brw_tracked_state gen6_cc_vp;
+const struct brw_tracked_state gen6_clip_state;
+const struct brw_tracked_state gen6_clip_vp;
+const struct brw_tracked_state gen6_color_calc_state;
+const struct brw_tracked_state gen6_depth_stencil_state;
+const struct brw_tracked_state gen6_gs_state;
+const struct brw_tracked_state gen6_sampler_state;
+const struct brw_tracked_state gen6_scissor_state;
+const struct brw_tracked_state gen6_sf_state;
+const struct brw_tracked_state gen6_sf_vp;
+const struct brw_tracked_state gen6_urb;
+const struct brw_tracked_state gen6_viewport_state;
+const struct brw_tracked_state gen6_vs_state;
+const struct brw_tracked_state gen6_wm_state;
/**
* Use same key for WM and VS surfaces.
diff --git a/src/mesa/drivers/dri/i965/brw_state_batch.c b/src/mesa/drivers/dri/i965/brw_state_batch.c
index ed8120d617f..39019412fda 100644
--- a/src/mesa/drivers/dri/i965/brw_state_batch.c
+++ b/src/mesa/drivers/dri/i965/brw_state_batch.c
@@ -57,8 +57,8 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw,
if (item->sz == sz && memcmp(item->header, newheader, sz) == 0)
return GL_FALSE;
if (item->sz != sz) {
- _mesa_free(item->header);
- item->header = _mesa_malloc(sz);
+ free(item->header);
+ item->header = malloc(sz);
item->sz = sz;
}
goto emit;
@@ -68,7 +68,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw,
assert(!item);
item = CALLOC_STRUCT(brw_cached_batch_item);
- item->header = _mesa_malloc(sz);
+ item->header = malloc(sz);
item->sz = sz;
item->next = brw->cached_batch_items;
brw->cached_batch_items = item;
diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
index 1369d97e21b..c08cb45b75c 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -150,7 +150,7 @@ rehash(struct brw_cache *cache)
GLuint size, i;
size = cache->size * 3;
- items = (struct brw_cache_item**) _mesa_calloc(size * sizeof(*items));
+ items = (struct brw_cache_item**) calloc(1, size * sizeof(*items));
for (i = 0; i < cache->size; i++)
for (c = cache->items[i]; c; c = next) {
@@ -237,7 +237,7 @@ brw_upload_cache_with_auxdata(struct brw_cache *cache,
/* Set up the memory containing the key, aux_data, and reloc_bufs */
- tmp = _mesa_malloc(key_size + aux_size + relocs_size);
+ tmp = malloc(key_size + aux_size + relocs_size);
memcpy(tmp, key, key_size);
memcpy(tmp + key_size, aux, aux_size);
@@ -266,7 +266,7 @@ brw_upload_cache_with_auxdata(struct brw_cache *cache,
}
if (INTEL_DEBUG & DEBUG_STATE)
- _mesa_printf("upload %s: %d bytes to cache id %d\n",
+ printf("upload %s: %d bytes to cache id %d\n",
cache->name[cache_id],
data_size, cache_id);
@@ -366,7 +366,7 @@ brw_init_non_surface_cache(struct brw_context *brw)
cache->size = 7;
cache->n_items = 0;
cache->items = (struct brw_cache_item **)
- _mesa_calloc(cache->size * sizeof(struct brw_cache_item));
+ calloc(1, cache->size * sizeof(struct brw_cache_item));
brw_init_cache_id(cache, "CC_VP", BRW_CC_VP);
brw_init_cache_id(cache, "CC_UNIT", BRW_CC_UNIT);
@@ -390,6 +390,7 @@ brw_init_non_surface_cache(struct brw_context *brw)
brw_init_cache_id(cache, "GS_UNIT", BRW_GS_UNIT);
brw_init_cache_id(cache, "GS_PROG", BRW_GS_PROG);
+ brw_init_cache_id(cache, "BLEND_STATE", BRW_BLEND_STATE);
}
@@ -403,7 +404,7 @@ brw_init_surface_cache(struct brw_context *brw)
cache->size = 7;
cache->n_items = 0;
cache->items = (struct brw_cache_item **)
- _mesa_calloc(cache->size * sizeof(struct brw_cache_item));
+ calloc(1, cache->size * sizeof(struct brw_cache_item));
brw_init_cache_id(cache, "SS_SURFACE", BRW_SS_SURFACE);
brw_init_cache_id(cache, "SS_SURF_BIND", BRW_SS_SURF_BIND);
@@ -425,7 +426,7 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
GLuint i;
if (INTEL_DEBUG & DEBUG_STATE)
- _mesa_printf("%s\n", __FUNCTION__);
+ printf("%s\n", __FUNCTION__);
for (i = 0; i < cache->size; i++) {
for (c = cache->items[i]; c; c = next) {
@@ -444,7 +445,7 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
cache->n_items = 0;
if (brw->curbe.last_buf) {
- _mesa_free(brw->curbe.last_buf);
+ free(brw->curbe.last_buf);
brw->curbe.last_buf = NULL;
}
@@ -465,7 +466,7 @@ brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo)
GLuint i;
if (INTEL_DEBUG & DEBUG_STATE)
- _mesa_printf("%s\n", __FUNCTION__);
+ printf("%s\n", __FUNCTION__);
for (i = 0; i < cache->size; i++) {
for (prev = &cache->items[i]; *prev;) {
@@ -493,7 +494,7 @@ void
brw_state_cache_check_size(struct brw_context *brw)
{
if (INTEL_DEBUG & DEBUG_STATE)
- _mesa_printf("%s (n_items=%d)\n", __FUNCTION__, brw->cache.n_items);
+ printf("%s (n_items=%d)\n", __FUNCTION__, brw->cache.n_items);
/* un-tuned guess. We've got around 20 state objects for a total of around
* 32k, so 1000 of them is around 1.5MB.
@@ -512,7 +513,7 @@ brw_destroy_cache(struct brw_context *brw, struct brw_cache *cache)
GLuint i;
if (INTEL_DEBUG & DEBUG_STATE)
- _mesa_printf("%s\n", __FUNCTION__);
+ printf("%s\n", __FUNCTION__);
brw_clear_cache(brw, cache);
for (i = 0; i < BRW_MAX_CACHE; i++) {
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 0ecbef1ef92..9e54f29f0f6 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -35,8 +35,15 @@
#include "brw_state.h"
#include "intel_batchbuffer.h"
#include "intel_buffers.h"
+#include "intel_chipset.h"
-static const struct brw_tracked_state *atoms[] =
+/* This is used to initialize brw->state.atoms[]. We could use this
+ * list directly except for a single atom, brw_constant_buffer, which
+ * has a .dirty value which changes according to the parameters of the
+ * current fragment and vertex programs, and so cannot be a static
+ * value.
+ */
+static const struct brw_tracked_state *gen4_atoms[] =
{
&brw_check_fallback,
@@ -95,6 +102,63 @@ static const struct brw_tracked_state *atoms[] =
&brw_constant_buffer
};
+const struct brw_tracked_state *gen6_atoms[] =
+{
+ &brw_check_fallback,
+
+ &brw_wm_input_sizes,
+ &brw_vs_prog,
+ &brw_gs_prog,
+ &brw_wm_prog,
+
+ &gen6_clip_vp,
+ &gen6_sf_vp,
+ &gen6_cc_vp,
+
+ /* Command packets: */
+ &brw_invarient_state,
+
+ &gen6_viewport_state, /* must do after *_vp stages */
+
+ &gen6_urb,
+ &gen6_blend_state, /* must do before cc unit */
+ &gen6_color_calc_state, /* must do before cc unit */
+ &gen6_depth_stencil_state, /* must do before cc unit */
+ &gen6_cc_state_pointers,
+
+ &brw_vs_surfaces, /* must do before unit */
+ &brw_wm_constant_surface, /* must do before wm surfaces/bind bo */
+ &brw_wm_surfaces, /* must do before samplers and unit */
+
+ &brw_wm_samplers,
+ &gen6_sampler_state,
+
+ &gen6_vs_state,
+ &gen6_gs_state,
+ &gen6_clip_state,
+ &gen6_sf_state,
+ &gen6_wm_state,
+
+ &gen6_scissor_state,
+
+ &brw_state_base_address,
+
+ &gen6_binding_table_pointers,
+
+ &brw_depthbuffer,
+
+ &brw_polygon_stipple,
+ &brw_polygon_stipple_offset,
+
+ &brw_line_stipple,
+ &brw_aa_line_parameters,
+
+ &brw_drawing_rect,
+
+ &brw_indices,
+ &brw_index_buffer,
+ &brw_vertices,
+};
void brw_init_state( struct brw_context *brw )
{
@@ -211,6 +275,7 @@ static struct dirty_bit_map brw_bits[] = {
};
static struct dirty_bit_map cache_bits[] = {
+ DEFINE_BIT(CACHE_NEW_BLEND_STATE),
DEFINE_BIT(CACHE_NEW_CC_VP),
DEFINE_BIT(CACHE_NEW_CC_UNIT),
DEFINE_BIT(CACHE_NEW_WM_PROG),
@@ -270,6 +335,8 @@ void brw_validate_state( struct brw_context *brw )
struct intel_context *intel = &brw->intel;
struct brw_state_flags *state = &brw->state.dirty;
GLuint i;
+ const struct brw_tracked_state **atoms;
+ int num_atoms;
brw_clear_validated_bos(brw);
@@ -278,6 +345,14 @@ void brw_validate_state( struct brw_context *brw )
brw_add_validated_bo(brw, intel->batch->buf);
+ if (IS_GEN6(intel->intelScreen->deviceID)) {
+ atoms = gen6_atoms;
+ num_atoms = ARRAY_SIZE(gen6_atoms);
+ } else {
+ atoms = gen4_atoms;
+ num_atoms = ARRAY_SIZE(gen4_atoms);
+ }
+
if (brw->emit_state_always) {
state->mesa |= ~0;
state->brw |= ~0;
@@ -305,7 +380,7 @@ void brw_validate_state( struct brw_context *brw )
brw->intel.Fallback = GL_FALSE; /* boolean, not bitfield */
/* do prepare stage for all atoms */
- for (i = 0; i < Elements(atoms); i++) {
+ for (i = 0; i < num_atoms; i++) {
const struct brw_tracked_state *atom = atoms[i];
if (brw->intel.Fallback)
@@ -337,9 +412,20 @@ void brw_validate_state( struct brw_context *brw )
void brw_upload_state(struct brw_context *brw)
{
+ struct intel_context *intel = &brw->intel;
struct brw_state_flags *state = &brw->state.dirty;
int i;
static int dirty_count = 0;
+ const struct brw_tracked_state **atoms;
+ int num_atoms;
+
+ if (IS_GEN6(intel->intelScreen->deviceID)) {
+ atoms = gen6_atoms;
+ num_atoms = ARRAY_SIZE(gen6_atoms);
+ } else {
+ atoms = gen4_atoms;
+ num_atoms = ARRAY_SIZE(gen4_atoms);
+ }
brw_clear_validated_bos(brw);
@@ -349,10 +435,10 @@ void brw_upload_state(struct brw_context *brw)
* state atoms are ordered correctly in the list.
*/
struct brw_state_flags examined, prev;
- _mesa_memset(&examined, 0, sizeof(examined));
+ memset(&examined, 0, sizeof(examined));
prev = *state;
- for (i = 0; i < Elements(atoms); i++) {
+ for (i = 0; i < num_atoms; i++) {
const struct brw_tracked_state *atom = atoms[i];
struct brw_state_flags generated;
@@ -381,7 +467,7 @@ void brw_upload_state(struct brw_context *brw)
}
}
else {
- for (i = 0; i < Elements(atoms); i++) {
+ for (i = 0; i < num_atoms; i++) {
const struct brw_tracked_state *atom = atoms[i];
if (brw->intel.Fallback)
diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h
index 66d4127271a..3c2adfc87d4 100644
--- a/src/mesa/drivers/dri/i965/brw_structs.h
+++ b/src/mesa/drivers/dri/i965/brw_structs.h
@@ -658,7 +658,105 @@ struct brw_clip_unit_state
GLfloat viewport_ymax;
};
+struct gen6_blend_state
+{
+ struct {
+ GLuint dest_blend_factor:5;
+ GLuint source_blend_factor:5;
+ GLuint pad3:1;
+ GLuint blend_func:3;
+ GLuint pad2:1;
+ GLuint ia_dest_blend_factor:5;
+ GLuint ia_source_blend_factor:5;
+ GLuint pad1:1;
+ GLuint ia_blend_func:3;
+ GLuint pad0:1;
+ GLuint ia_blend_enable:1;
+ GLuint blend_enable:1;
+ } blend0;
+
+ struct {
+ GLuint post_blend_clamp_enable:1;
+ GLuint pre_blend_clamp_enable:1;
+ GLuint clamp_range:2;
+ GLuint pad0:4;
+ GLuint x_dither_offset:2;
+ GLuint y_dither_offset:2;
+ GLuint dither_enable:1;
+ GLuint alpha_test_func:3;
+ GLuint alpha_test_enable:1;
+ GLuint pad1:1;
+ GLuint logic_op_func:4;
+ GLuint logic_op_enable:1;
+ GLuint pad2:1;
+ GLuint write_disable_b:1;
+ GLuint write_disable_g:1;
+ GLuint write_disable_r:1;
+ GLuint write_disable_a:1;
+ GLuint pad3:1;
+ GLuint alpha_to_coverage_dither:1;
+ GLuint alpha_to_one:1;
+ GLuint alpha_to_coverage:1;
+ } blend1;
+};
+
+struct gen6_color_calc_state
+{
+ struct {
+ GLuint alpha_test_format:1;
+ GLuint pad0:14;
+ GLuint round_disable:1;
+ GLuint bf_stencil_ref:8;
+ GLuint stencil_ref:8;
+ } cc0;
+ union {
+ GLfloat alpha_ref_f;
+ struct {
+ GLuint ui:8;
+ GLuint pad0:24;
+ } alpha_ref_fi;
+ } cc1;
+
+ GLfloat constant_r;
+ GLfloat constant_g;
+ GLfloat constant_b;
+ GLfloat constant_a;
+};
+
+struct gen6_depth_stencil_state
+{
+ struct {
+ GLuint pad0:3;
+ GLuint bf_stencil_pass_depth_pass_op:3;
+ GLuint bf_stencil_pass_depth_fail_op:3;
+ GLuint bf_stencil_fail_op:3;
+ GLuint bf_stencil_func:3;
+ GLuint bf_stencil_enable:1;
+ GLuint pad1:2;
+ GLuint stencil_write_enable:1;
+ GLuint stencil_pass_depth_pass_op:3;
+ GLuint stencil_pass_depth_fail_op:3;
+ GLuint stencil_fail_op:3;
+ GLuint stencil_func:3;
+ GLuint stencil_enable:1;
+ } ds0;
+
+ struct {
+ GLuint bf_stencil_write_mask:8;
+ GLuint bf_stencil_test_mask:8;
+ GLuint stencil_write_mask:8;
+ GLuint stencil_test_mask:8;
+ } ds1;
+
+ struct {
+ GLuint pad0:25;
+ GLuint depth_write_enable:1;
+ GLuint depth_test_func:3;
+ GLuint pad1:1;
+ GLuint depth_test_enable:1;
+ } ds2;
+};
struct brw_cc_unit_state
{
@@ -752,8 +850,6 @@ struct brw_cc_unit_state
} cc7;
};
-
-
struct brw_sf_unit_state
{
struct thread0 thread0;
@@ -813,6 +909,11 @@ struct brw_sf_unit_state
};
+struct gen6_scissor_state
+{
+ GLuint ymin, xmin;
+ GLuint ymax, xmax;
+};
struct brw_gs_unit_state
{
@@ -1043,6 +1144,15 @@ struct brw_sf_viewport
} scissor;
};
+struct gen6_sf_viewport {
+ GLfloat m00;
+ GLfloat m11;
+ GLfloat m22;
+ GLfloat m30;
+ GLfloat m31;
+ GLfloat m32;
+};
+
/* Documented in the subsystem/shared-functions/sampler chapter...
*/
struct brw_surface_state
diff --git a/src/mesa/drivers/dri/i965/brw_urb.c b/src/mesa/drivers/dri/i965/brw_urb.c
index f2cdb203b85..4f6b9002ad5 100644
--- a/src/mesa/drivers/dri/i965/brw_urb.c
+++ b/src/mesa/drivers/dri/i965/brw_urb.c
@@ -186,17 +186,17 @@ static void recalculate_urb_fence( struct brw_context *brw )
* entries and the values for minimum nr of entries
* provided above.
*/
- _mesa_printf("couldn't calculate URB layout!\n");
+ printf("couldn't calculate URB layout!\n");
exit(1);
}
if (INTEL_DEBUG & (DEBUG_URB|DEBUG_FALLBACKS))
- _mesa_printf("URB CONSTRAINED\n");
+ printf("URB CONSTRAINED\n");
}
done:
if (INTEL_DEBUG & DEBUG_URB)
- _mesa_printf("URB fence: %d ..VS.. %d ..GS.. %d ..CLP.. %d ..SF.. %d ..CS.. %d\n",
+ printf("URB fence: %d ..VS.. %d ..GS.. %d ..CLP.. %d ..SF.. %d ..CS.. %d\n",
brw->urb.vs_start,
brw->urb.gs_start,
brw->urb.clip_start,
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 4f4eef85e8c..a48804a660f 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -180,10 +180,12 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
c->first_output = reg;
c->first_overflow_output = 0;
- if (intel->is_ironlake)
- mrf = 8;
+ if (intel->gen >= 6)
+ mrf = 6;
+ else if (intel->is_ironlake)
+ mrf = 8;
else
- mrf = 4;
+ mrf = 4;
for (i = 0; i < VERT_RESULT_MAX; i++) {
if (c->prog_data.outputs_written & BITFIELD64_BIT(i)) {
@@ -279,17 +281,19 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
*/
attributes_in_vue = MAX2(c->nr_outputs, c->nr_inputs);
- if (intel->is_ironlake)
- c->prog_data.urb_entry_size = (attributes_in_vue + 6 + 3) / 4;
+ if (intel->gen >= 6)
+ c->prog_data.urb_entry_size = (attributes_in_vue + 4 + 7) / 8;
+ else if (intel->is_ironlake)
+ c->prog_data.urb_entry_size = (attributes_in_vue + 6 + 3) / 4;
else
- c->prog_data.urb_entry_size = (attributes_in_vue + 2 + 3) / 4;
+ c->prog_data.urb_entry_size = (attributes_in_vue + 2 + 3) / 4;
c->prog_data.total_grf = reg;
if (INTEL_DEBUG & DEBUG_VS) {
- _mesa_printf("%s NumAddrRegs %d\n", __FUNCTION__, c->vp->program.Base.NumAddressRegs);
- _mesa_printf("%s NumTemps %d\n", __FUNCTION__, c->vp->program.Base.NumTemporaries);
- _mesa_printf("%s reg = %d\n", __FUNCTION__, reg);
+ printf("%s NumAddrRegs %d\n", __FUNCTION__, c->vp->program.Base.NumAddressRegs);
+ printf("%s NumTemps %d\n", __FUNCTION__, c->vp->program.Base.NumTemporaries);
+ printf("%s reg = %d\n", __FUNCTION__, reg);
}
}
@@ -479,9 +483,11 @@ static void emit_math1( struct brw_vs_compile *c,
* whether that turns out to be a simulator bug or not:
*/
struct brw_compile *p = &c->func;
+ struct intel_context *intel = &p->brw->intel;
struct brw_reg tmp = dst;
- GLboolean need_tmp = (dst.dw1.bits.writemask != 0xf ||
- dst.file != BRW_GENERAL_REGISTER_FILE);
+ GLboolean need_tmp = (intel->gen < 6 &&
+ (dst.dw1.bits.writemask != 0xf ||
+ dst.file != BRW_GENERAL_REGISTER_FILE));
if (need_tmp)
tmp = get_tmp(c);
@@ -510,9 +516,11 @@ static void emit_math2( struct brw_vs_compile *c,
GLuint precision)
{
struct brw_compile *p = &c->func;
+ struct intel_context *intel = &p->brw->intel;
struct brw_reg tmp = dst;
- GLboolean need_tmp = (dst.dw1.bits.writemask != 0xf ||
- dst.file != BRW_GENERAL_REGISTER_FILE);
+ GLboolean need_tmp = (intel->gen < 6 &&
+ (dst.dw1.bits.writemask != 0xf ||
+ dst.file != BRW_GENERAL_REGISTER_FILE));
if (need_tmp)
tmp = get_tmp(c);
@@ -1191,7 +1199,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
struct brw_reg pos = c->regs[PROGRAM_OUTPUT][VERT_RESULT_HPOS];
struct brw_reg ndc;
int eot;
- GLuint len_vertext_header = 2;
+ GLuint len_vertex_header = 2;
if (c->key.copy_edgeflag) {
brw_MOV(p,
@@ -1199,12 +1207,14 @@ static void emit_vertex_write( struct brw_vs_compile *c)
get_reg(c, PROGRAM_INPUT, VERT_ATTRIB_EDGEFLAG));
}
- /* Build ndc coords */
- ndc = get_tmp(c);
- /* ndc = 1.0 / pos.w */
- emit_math1(c, BRW_MATH_FUNCTION_INV, ndc, brw_swizzle1(pos, 3), BRW_MATH_PRECISION_FULL);
- /* ndc.xyz = pos * ndc */
- brw_MUL(p, brw_writemask(ndc, WRITEMASK_XYZ), pos, ndc);
+ if (intel->gen < 6) {
+ /* Build ndc coords */
+ ndc = get_tmp(c);
+ /* ndc = 1.0 / pos.w */
+ emit_math1(c, BRW_MATH_FUNCTION_INV, ndc, brw_swizzle1(pos, 3), BRW_MATH_PRECISION_FULL);
+ /* ndc.xyz = pos * ndc */
+ brw_MUL(p, brw_writemask(ndc, WRITEMASK_XYZ), pos, ndc);
+ }
/* Update the header for point size, user clipping flags, and -ve rhw
* workaround.
@@ -1267,21 +1277,41 @@ static void emit_vertex_write( struct brw_vs_compile *c)
* of zeros followed by two sets of NDC coordinates:
*/
brw_set_access_mode(p, BRW_ALIGN_1);
- brw_MOV(p, offset(m0, 2), ndc);
-
- if (intel->is_ironlake) {
- /* There are 20 DWs (D0-D19) in VUE vertex header on Ironlake */
- brw_MOV(p, offset(m0, 3), pos); /* a portion of vertex header */
- /* m4, m5 contain the distances from vertex to the user clip planeXXX.
- * Seems it is useless for us.
- * m6 is used for aligning, so that the remainder of vertex element is
- * reg-aligned.
- */
- brw_MOV(p, offset(m0, 7), pos); /* the remainder of vertex element */
- len_vertext_header = 6;
+
+ if (intel->gen >= 6) {
+ /* There are 16 DWs (D0-D15) in VUE header on Sandybridge:
+ * dword 0-3 (m1) of the header is indices, point width, clip flags.
+ * dword 4-7 (m2) is the 4D space position
+ * dword 8-15 (m3,m4) of the vertex header is the user clip distance.
+ * m5 is the first vertex data we fill, which is the vertex position.
+ */
+ brw_MOV(p, offset(m0, 2), pos);
+ brw_MOV(p, offset(m0, 5), pos);
+ len_vertex_header = 4;
+ } else if (intel->is_ironlake) {
+ /* There are 20 DWs (D0-D19) in VUE header on Ironlake:
+ * dword 0-3 (m1) of the header is indices, point width, clip flags.
+ * dword 4-7 (m2) is the ndc position (set above)
+ * dword 8-11 (m3) of the vertex header is the 4D space position
+ * dword 12-19 (m4,m5) of the vertex header is the user clip distance.
+ * m6 is a pad so that the vertex element data is aligned
+ * m7 is the first vertex data we fill, which is the vertex position.
+ */
+ brw_MOV(p, offset(m0, 2), ndc);
+ brw_MOV(p, offset(m0, 3), pos);
+ brw_MOV(p, offset(m0, 7), pos);
+ len_vertex_header = 6;
} else {
- brw_MOV(p, offset(m0, 3), pos);
- len_vertext_header = 2;
+ /* There are 8 dwords in VUE header pre-Ironlake:
+ * dword 0-3 (m1) is indices, point width, clip flags.
+ * dword 4-7 (m2) is ndc position (set above)
+ *
+ * dword 8-11 (m3) is the first vertex data, which we always have be the
+ * vertex position.
+ */
+ brw_MOV(p, offset(m0, 2), ndc);
+ brw_MOV(p, offset(m0, 3), pos);
+ len_vertex_header = 2;
}
eot = (c->first_overflow_output == 0);
@@ -1292,7 +1322,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
c->r0, /* src */
0, /* allocate */
1, /* used */
- MIN2(c->nr_outputs + 1 + len_vertext_header, (BRW_MAX_MRF-1)), /* msg len */
+ MIN2(c->nr_outputs + 1 + len_vertex_header, (BRW_MAX_MRF-1)), /* msg len */
0, /* response len */
eot, /* eot */
eot, /* writes complete */
@@ -1444,9 +1474,9 @@ void brw_vs_emit(struct brw_vs_compile *c )
GLuint file;
if (INTEL_DEBUG & DEBUG_VS) {
- _mesa_printf("vs-mesa:\n");
+ printf("vs-mesa:\n");
_mesa_print_program(&c->vp->program.Base);
- _mesa_printf("\n");
+ printf("\n");
}
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
@@ -1687,11 +1717,13 @@ void brw_vs_emit(struct brw_vs_compile *c )
/* patch all the BREAK/CONT instructions from last BEGINLOOP */
while (inst0 > loop_inst[loop_depth]) {
inst0--;
- if (inst0->header.opcode == BRW_OPCODE_BREAK) {
+ if (inst0->header.opcode == BRW_OPCODE_BREAK &&
+ inst0->bits3.if_else.jump_count == 0) {
inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1);
inst0->bits3.if_else.pop_count = 0;
}
- else if (inst0->header.opcode == BRW_OPCODE_CONTINUE) {
+ else if (inst0->header.opcode == BRW_OPCODE_CONTINUE &&
+ inst0->bits3.if_else.jump_count == 0) {
inst0->bits3.if_else.jump_count = br * (inst1 - inst0);
inst0->bits3.if_else.pop_count = 0;
}
@@ -1796,9 +1828,9 @@ void brw_vs_emit(struct brw_vs_compile *c )
if (INTEL_DEBUG & DEBUG_VS) {
int i;
- _mesa_printf("vs-native:\n");
+ printf("vs-native:\n");
for (i = 0; i < p->nr_insn; i++)
brw_disasm(stderr, &p->store[i]);
- _mesa_printf("\n");
+ printf("\n");
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index ead623fc0ea..4007b5a15ce 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -67,13 +67,13 @@ brw_vs_update_constant_buffer(struct brw_context *brw)
*/
_mesa_load_state_parameters(&brw->intel.ctx, vp->program.Base.Parameters);
- intel_bo_map_gtt_preferred(intel, const_buffer, GL_TRUE);
+ drm_intel_gem_bo_map_gtt(const_buffer);
for (i = 0; i < params->NumParameters; i++) {
memcpy(const_buffer->virtual + i * 4 * sizeof(float),
params->ParameterValues[i],
4 * sizeof(float));
}
- intel_bo_unmap_gtt_preferred(intel, const_buffer);
+ drm_intel_gem_bo_unmap_gtt(const_buffer);
return const_buffer;
}
@@ -104,7 +104,7 @@ brw_update_vs_constant_surface( GLcontext *ctx,
/* If there's no constant buffer, then no surface BO is needed to point at
* it.
*/
- if (vp->const_buffer == 0) {
+ if (vp->const_buffer == NULL) {
drm_intel_bo_unreference(brw->vs.surf_bo[surf]);
brw->vs.surf_bo[surf] = NULL;
return;
@@ -132,7 +132,7 @@ brw_update_vs_constant_surface( GLcontext *ctx,
brw->vs.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
BRW_SS_SURFACE,
&key, sizeof(key),
- &key.bo, key.bo ? 1 : 0,
+ &key.bo, 1,
NULL);
if (brw->vs.surf_bo[surf] == NULL) {
brw->vs.surf_bo[surf] = brw_create_constant_surface(brw, &key);
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 681319dedfd..96a44bfbec7 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -67,11 +67,11 @@ static void brw_destroy_context( struct intel_context *intel )
brw_draw_destroy( brw );
brw_clear_validated_bos(brw);
if (brw->wm.compile_data) {
- _mesa_free(brw->wm.compile_data->instruction);
- _mesa_free(brw->wm.compile_data->vreg);
- _mesa_free(brw->wm.compile_data->refs);
- _mesa_free(brw->wm.compile_data->prog_instructions);
- _mesa_free(brw->wm.compile_data);
+ free(brw->wm.compile_data->instruction);
+ free(brw->wm.compile_data->vreg);
+ free(brw->wm.compile_data->refs);
+ free(brw->wm.compile_data->prog_instructions);
+ free(brw->wm.compile_data);
}
for (i = 0; i < brw->state.nr_color_regions; i++)
@@ -102,6 +102,9 @@ static void brw_destroy_context( struct intel_context *intel )
dri_bo_release(&brw->cc.prog_bo);
dri_bo_release(&brw->cc.state_bo);
dri_bo_release(&brw->cc.vp_bo);
+ dri_bo_release(&brw->cc.blend_state_bo);
+ dri_bo_release(&brw->cc.depth_stencil_state_bo);
+ dri_bo_release(&brw->cc.color_calc_state_bo);
}
@@ -141,7 +144,7 @@ static void brw_finish_batch(struct intel_context *intel)
brw_emit_query_end(brw);
if (brw->curbe.curbe_bo) {
- intel_bo_unmap_gtt_preferred(intel, brw->curbe.curbe_bo);
+ drm_intel_gem_bo_unmap_gtt(brw->curbe.curbe_bo);
drm_intel_bo_unreference(brw->curbe.curbe_bo);
brw->curbe.curbe_bo = NULL;
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 9191c81755d..991e1b964b8 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -151,11 +151,11 @@ static void do_wm_prog( struct brw_context *brw,
*/
return;
}
- c->instruction = _mesa_calloc(BRW_WM_MAX_INSN * sizeof(*c->instruction));
- c->prog_instructions = _mesa_calloc(BRW_WM_MAX_INSN *
+ c->instruction = calloc(1, BRW_WM_MAX_INSN * sizeof(*c->instruction));
+ c->prog_instructions = calloc(1, BRW_WM_MAX_INSN *
sizeof(*c->prog_instructions));
- c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg));
- c->refs = _mesa_calloc(BRW_WM_MAX_REF * sizeof(*c->refs));
+ c->vreg = calloc(1, BRW_WM_MAX_VREG * sizeof(*c->vreg));
+ c->refs = calloc(1, BRW_WM_MAX_REF * sizeof(*c->refs));
} else {
void *instruction = c->instruction;
void *prog_instructions = c->prog_instructions;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_debug.c b/src/mesa/drivers/dri/i965/brw_wm_debug.c
index 220821087c1..a78cc8b54e5 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_debug.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_debug.c
@@ -41,21 +41,21 @@ void brw_wm_print_value( struct brw_wm_compile *c,
if (c->state >= PASS2_DONE)
brw_print_reg(value->hw_reg);
else if( value == &c->undef_value )
- _mesa_printf("undef");
+ printf("undef");
else if( value - c->vreg >= 0 &&
value - c->vreg < BRW_WM_MAX_VREG)
- _mesa_printf("r%d", value - c->vreg);
+ printf("r%d", value - c->vreg);
else if (value - c->creg >= 0 &&
value - c->creg < BRW_WM_MAX_PARAM)
- _mesa_printf("c%d", value - c->creg);
+ printf("c%d", value - c->creg);
else if (value - c->payload.input_interp >= 0 &&
value - c->payload.input_interp < FRAG_ATTRIB_MAX)
- _mesa_printf("i%d", value - c->payload.input_interp);
+ printf("i%d", value - c->payload.input_interp);
else if (value - c->payload.depth >= 0 &&
value - c->payload.depth < FRAG_ATTRIB_MAX)
- _mesa_printf("d%d", value - c->payload.depth);
+ printf("d%d", value - c->payload.depth);
else
- _mesa_printf("?");
+ printf("?");
}
void brw_wm_print_ref( struct brw_wm_compile *c,
@@ -64,16 +64,16 @@ void brw_wm_print_ref( struct brw_wm_compile *c,
struct brw_reg hw_reg = ref->hw_reg;
if (ref->unspill_reg)
- _mesa_printf("UNSPILL(%x)/", ref->value->spill_slot);
+ printf("UNSPILL(%x)/", ref->value->spill_slot);
if (c->state >= PASS2_DONE)
brw_print_reg(ref->hw_reg);
else {
- _mesa_printf("%s", hw_reg.negate ? "-" : "");
- _mesa_printf("%s", hw_reg.abs ? "abs/" : "");
+ printf("%s", hw_reg.negate ? "-" : "");
+ printf("%s", hw_reg.abs ? "abs/" : "");
brw_wm_print_value(c, ref->value);
if ((hw_reg.nr&1) || hw_reg.subnr) {
- _mesa_printf("->%d.%d", (hw_reg.nr&1), hw_reg.subnr);
+ printf("->%d.%d", (hw_reg.nr&1), hw_reg.subnr);
}
}
}
@@ -84,22 +84,22 @@ void brw_wm_print_insn( struct brw_wm_compile *c,
GLuint i, arg;
GLuint nr_args = brw_wm_nr_args(inst->opcode);
- _mesa_printf("[");
+ printf("[");
for (i = 0; i < 4; i++) {
if (inst->dst[i]) {
brw_wm_print_value(c, inst->dst[i]);
if (inst->dst[i]->spill_slot)
- _mesa_printf("/SPILL(%x)",inst->dst[i]->spill_slot);
+ printf("/SPILL(%x)",inst->dst[i]->spill_slot);
}
else
- _mesa_printf("#");
+ printf("#");
if (i < 3)
- _mesa_printf(",");
+ printf(",");
}
- _mesa_printf("]");
+ printf("]");
if (inst->writemask != WRITEMASK_XYZW)
- _mesa_printf(".%s%s%s%s",
+ printf(".%s%s%s%s",
GET_BIT(inst->writemask, 0) ? "x" : "",
GET_BIT(inst->writemask, 1) ? "y" : "",
GET_BIT(inst->writemask, 2) ? "z" : "",
@@ -107,58 +107,58 @@ void brw_wm_print_insn( struct brw_wm_compile *c,
switch (inst->opcode) {
case WM_PIXELXY:
- _mesa_printf(" = PIXELXY");
+ printf(" = PIXELXY");
break;
case WM_DELTAXY:
- _mesa_printf(" = DELTAXY");
+ printf(" = DELTAXY");
break;
case WM_PIXELW:
- _mesa_printf(" = PIXELW");
+ printf(" = PIXELW");
break;
case WM_WPOSXY:
- _mesa_printf(" = WPOSXY");
+ printf(" = WPOSXY");
break;
case WM_PINTERP:
- _mesa_printf(" = PINTERP");
+ printf(" = PINTERP");
break;
case WM_LINTERP:
- _mesa_printf(" = LINTERP");
+ printf(" = LINTERP");
break;
case WM_CINTERP:
- _mesa_printf(" = CINTERP");
+ printf(" = CINTERP");
break;
case WM_FB_WRITE:
- _mesa_printf(" = FB_WRITE");
+ printf(" = FB_WRITE");
break;
case WM_FRONTFACING:
- _mesa_printf(" = FRONTFACING");
+ printf(" = FRONTFACING");
break;
default:
- _mesa_printf(" = %s", _mesa_opcode_string(inst->opcode));
+ printf(" = %s", _mesa_opcode_string(inst->opcode));
break;
}
if (inst->saturate)
- _mesa_printf("_SAT");
+ printf("_SAT");
for (arg = 0; arg < nr_args; arg++) {
- _mesa_printf(" [");
+ printf(" [");
for (i = 0; i < 4; i++) {
if (inst->src[arg][i]) {
brw_wm_print_ref(c, inst->src[arg][i]);
}
else
- _mesa_printf("%%");
+ printf("%%");
if (i < 3)
- _mesa_printf(",");
+ printf(",");
else
- _mesa_printf("]");
+ printf("]");
}
}
- _mesa_printf("\n");
+ printf("\n");
}
void brw_wm_print_program( struct brw_wm_compile *c,
@@ -166,9 +166,9 @@ void brw_wm_print_program( struct brw_wm_compile *c,
{
GLuint insn;
- _mesa_printf("%s:\n", stage);
+ printf("%s:\n", stage);
for (insn = 0; insn < c->nr_insns; insn++)
brw_wm_print_insn(c, &c->instruction[insn]);
- _mesa_printf("\n");
+ printf("\n");
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index fa0898c5862..9315bca3156 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -1622,10 +1622,10 @@ void brw_wm_emit( struct brw_wm_compile *c )
break;
default:
- _mesa_printf("Unsupported opcode %i (%s) in fragment shader\n",
- inst->opcode, inst->opcode < MAX_OPCODE ?
- _mesa_opcode_string(inst->opcode) :
- "unknown");
+ printf("Unsupported opcode %i (%s) in fragment shader\n",
+ inst->opcode, inst->opcode < MAX_OPCODE ?
+ _mesa_opcode_string(inst->opcode) :
+ "unknown");
}
for (i = 0; i < 4; i++)
@@ -1638,9 +1638,9 @@ void brw_wm_emit( struct brw_wm_compile *c )
if (INTEL_DEBUG & DEBUG_WM) {
int i;
- _mesa_printf("wm-native:\n");
+ printf("wm-native:\n");
for (i = 0; i < p->nr_insn; i++)
brw_disasm(stderr, &p->store[i]);
- _mesa_printf("\n");
+ printf("\n");
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index 3737faf26fb..d73c3915824 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -159,7 +159,7 @@ static struct prog_dst_register get_temp( struct brw_wm_compile *c )
int bit = _mesa_ffs( ~c->fp_temp );
if (!bit) {
- _mesa_printf("%s: out of temporaries\n", __FILE__);
+ printf("%s: out of temporaries\n", __FILE__);
exit(1);
}
@@ -1034,7 +1034,7 @@ static void print_insns( const struct prog_instruction *insn,
{
GLuint i;
for (i = 0; i < nr; i++, insn++) {
- _mesa_printf("%3d: ", i);
+ printf("%3d: ", i);
if (insn->Opcode < MAX_OPCODE)
_mesa_print_instruction(insn);
else if (insn->Opcode < MAX_WM_OPCODE) {
@@ -1045,7 +1045,7 @@ static void print_insns( const struct prog_instruction *insn,
3);
}
else
- _mesa_printf("965 Opcode %d\n", insn->Opcode);
+ printf("965 Opcode %d\n", insn->Opcode);
}
}
@@ -1060,9 +1060,9 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
GLuint insn;
if (INTEL_DEBUG & DEBUG_WM) {
- _mesa_printf("pre-fp:\n");
+ printf("pre-fp:\n");
_mesa_print_program(&fp->program.Base);
- _mesa_printf("\n");
+ printf("\n");
}
c->pixel_xy = src_undef();
@@ -1168,9 +1168,9 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
}
if (INTEL_DEBUG & DEBUG_WM) {
- _mesa_printf("pass_fp:\n");
+ printf("pass_fp:\n");
print_insns( c->prog_instructions, c->nr_fp_insns );
- _mesa_printf("\n");
+ printf("\n");
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index fde83eea620..ea3c2405af9 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -614,112 +614,6 @@ static void invoke_subroutine( struct brw_wm_compile *c,
}
}
-/* Workaround for using brw_wm_emit.c's emit functions, which expect
- * destination regs to be uniquely written. Moves arguments out to
- * temporaries as necessary for instructions which use their destination as
- * a temporary.
- */
-static void
-unalias3(struct brw_wm_compile *c,
- void (*func)(struct brw_compile *c,
- const struct brw_reg *dst,
- GLuint mask,
- const struct brw_reg *arg0,
- const struct brw_reg *arg1,
- const struct brw_reg *arg2),
- const struct brw_reg *dst,
- GLuint mask,
- const struct brw_reg *arg0,
- const struct brw_reg *arg1,
- const struct brw_reg *arg2)
-{
- struct brw_compile *p = &c->func;
- struct brw_reg tmp_arg0[4], tmp_arg1[4], tmp_arg2[4];
- int i, j;
- int mark = mark_tmps(c);
-
- for (j = 0; j < 4; j++) {
- tmp_arg0[j] = arg0[j];
- tmp_arg1[j] = arg1[j];
- tmp_arg2[j] = arg2[j];
- }
-
- for (i = 0; i < 4; i++) {
- if (mask & (1<<i)) {
- for (j = 0; j < 4; j++) {
- if (arg0[j].file == dst[i].file &&
- dst[i].nr == arg0[j].nr) {
- tmp_arg0[j] = alloc_tmp(c);
- brw_MOV(p, tmp_arg0[j], arg0[j]);
- }
- if (arg1[j].file == dst[i].file &&
- dst[i].nr == arg1[j].nr) {
- tmp_arg1[j] = alloc_tmp(c);
- brw_MOV(p, tmp_arg1[j], arg1[j]);
- }
- if (arg2[j].file == dst[i].file &&
- dst[i].nr == arg2[j].nr) {
- tmp_arg2[j] = alloc_tmp(c);
- brw_MOV(p, tmp_arg2[j], arg2[j]);
- }
- }
- }
- }
-
- func(p, dst, mask, tmp_arg0, tmp_arg1, tmp_arg2);
-
- release_tmps(c, mark);
-}
-
-/* Workaround for using brw_wm_emit.c's emit functions, which expect
- * destination regs to be uniquely written. Moves arguments out to
- * temporaries as necessary for instructions which use their destination as
- * a temporary.
- */
-static void
-unalias2(struct brw_wm_compile *c,
- void (*func)(struct brw_compile *c,
- const struct brw_reg *dst,
- GLuint mask,
- const struct brw_reg *arg0,
- const struct brw_reg *arg1),
- const struct brw_reg *dst,
- GLuint mask,
- const struct brw_reg *arg0,
- const struct brw_reg *arg1)
-{
- struct brw_compile *p = &c->func;
- struct brw_reg tmp_arg0[4], tmp_arg1[4];
- int i, j;
- int mark = mark_tmps(c);
-
- for (j = 0; j < 4; j++) {
- tmp_arg0[j] = arg0[j];
- tmp_arg1[j] = arg1[j];
- }
-
- for (i = 0; i < 4; i++) {
- if (mask & (1<<i)) {
- for (j = 0; j < 4; j++) {
- if (arg0[j].file == dst[i].file &&
- dst[i].nr == arg0[j].nr) {
- tmp_arg0[j] = alloc_tmp(c);
- brw_MOV(p, tmp_arg0[j], arg0[j]);
- }
- if (arg1[j].file == dst[i].file &&
- dst[i].nr == arg1[j].nr) {
- tmp_arg1[j] = alloc_tmp(c);
- brw_MOV(p, tmp_arg1[j], arg1[j]);
- }
- }
- }
- }
-
- func(p, dst, mask, tmp_arg0, tmp_arg1);
-
- release_tmps(c, mark);
-}
-
static void emit_arl(struct brw_wm_compile *c,
const struct prog_instruction *inst)
{
@@ -1813,14 +1707,29 @@ static void
get_argument_regs(struct brw_wm_compile *c,
const struct prog_instruction *inst,
int index,
+ struct brw_reg *dst,
struct brw_reg *regs,
int mask)
{
- int i;
+ struct brw_compile *p = &c->func;
+ int i, j;
for (i = 0; i < 4; i++) {
- if (mask & (1 << i))
+ if (mask & (1 << i)) {
regs[i] = get_src_reg(c, inst, index, i);
+
+ /* Unalias destination registers from our sources. */
+ if (regs[i].file == BRW_GENERAL_REGISTER_FILE) {
+ for (j = 0; j < 4; j++) {
+ if (memcmp(&regs[i], &dst[j], sizeof(regs[0])) == 0) {
+ struct brw_reg tmp = alloc_tmp(c);
+ brw_MOV(p, tmp, regs[i]);
+ regs[i] = tmp;
+ break;
+ }
+ }
+ }
+ }
}
}
@@ -1845,11 +1754,12 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
int dst_flags;
struct brw_reg args[3][4], dst[4];
int j;
+ int mark = mark_tmps( c );
c->cur_inst = i;
#if 0
- _mesa_printf("Inst %d: ", i);
+ printf("Inst %d: ", i);
_mesa_print_instruction(inst);
#endif
@@ -1866,7 +1776,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
}
}
for (j = 0; j < brw_wm_nr_args(inst->Opcode); j++)
- get_argument_regs(c, inst, j, args[j], WRITEMASK_XYZW);
+ get_argument_regs(c, inst, j, dst, args[j], WRITEMASK_XYZW);
dst_flags = inst->DstReg.WriteMask;
if (inst->SaturateMode == SATURATE_ZERO_ONE)
@@ -1920,8 +1830,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
emit_alu1(p, brw_RNDD, dst, dst_flags, args[0]);
break;
case OPCODE_LRP:
- unalias3(c, emit_lrp,
- dst, dst_flags, args[0], args[1], args[2]);
+ emit_lrp(p, dst, dst_flags, args[0], args[1], args[2]);
break;
case OPCODE_TRUNC:
emit_alu1(p, brw_RNDZ, dst, dst_flags, args[0]);
@@ -1961,10 +1870,10 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
emit_math1(c, BRW_MATH_FUNCTION_LOG, dst, dst_flags, args[0]);
break;
case OPCODE_MIN:
- unalias2(c, emit_min, dst, dst_flags, args[0], args[1]);
+ emit_min(p, dst, dst_flags, args[0], args[1]);
break;
case OPCODE_MAX:
- unalias2(c, emit_max, dst, dst_flags, args[0], args[1]);
+ emit_max(p, dst, dst_flags, args[0], args[1]);
break;
case OPCODE_DDX:
case OPCODE_DDY:
@@ -2103,11 +2012,13 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
/* patch all the BREAK/CONT instructions from last BGNLOOP */
while (inst0 > loop_inst[loop_depth]) {
inst0--;
- if (inst0->header.opcode == BRW_OPCODE_BREAK) {
+ if (inst0->header.opcode == BRW_OPCODE_BREAK &&
+ inst0->bits3.if_else.jump_count == 0) {
inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1);
inst0->bits3.if_else.pop_count = 0;
}
- else if (inst0->header.opcode == BRW_OPCODE_CONTINUE) {
+ else if (inst0->header.opcode == BRW_OPCODE_CONTINUE &&
+ inst0->bits3.if_else.jump_count == 0) {
inst0->bits3.if_else.jump_count = br * (inst1 - inst0);
inst0->bits3.if_else.pop_count = 0;
}
@@ -2115,10 +2026,13 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
}
break;
default:
- _mesa_printf("unsupported IR in fragment shader %d\n",
+ printf("unsupported IR in fragment shader %d\n",
inst->Opcode);
}
+ /* Release temporaries containing any unaliased source regs. */
+ release_tmps( c, mark );
+
if (inst->CondUpdate)
brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
else
@@ -2127,10 +2041,10 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
post_wm_emit(c);
if (INTEL_DEBUG & DEBUG_WM) {
- _mesa_printf("wm-native:\n");
+ printf("wm-native:\n");
for (i = 0; i < p->nr_insn; i++)
brw_disasm(stderr, &p->store[i]);
- _mesa_printf("\n");
+ printf("\n");
}
}
@@ -2141,7 +2055,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c)
{
if (INTEL_DEBUG & DEBUG_WM) {
- _mesa_printf("brw_wm_glsl_emit:\n");
+ printf("brw_wm_glsl_emit:\n");
}
/* initial instruction translation/simplification */
diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
index ff4c082d5e8..60bd92ed223 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
@@ -105,7 +105,7 @@ static const struct brw_wm_ref *get_param_ref( struct brw_wm_compile *c,
GLuint i = c->prog_data.nr_params++;
if (i >= BRW_WM_MAX_PARAM) {
- _mesa_printf("%s: out of params\n", __FUNCTION__);
+ printf("%s: out of params\n", __FUNCTION__);
c->prog_data.error = 1;
return NULL;
}
@@ -154,7 +154,7 @@ static const struct brw_wm_ref *get_const_ref( struct brw_wm_compile *c,
return c->constref[i].ref;
}
else {
- _mesa_printf("%s: out of constrefs\n", __FUNCTION__);
+ printf("%s: out of constrefs\n", __FUNCTION__);
c->prog_data.error = 1;
return NULL;
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 87387b1e2d5..d7650af3d9d 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -89,7 +89,6 @@ struct wm_sampler_key {
float max_aniso;
GLenum minfilter, magfilter;
GLenum comparemode, comparefunc;
- dri_bo *sdc_bo;
/** If target is cubemap, take context setting.
*/
@@ -105,7 +104,7 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key,
dri_bo *sdc_bo,
struct brw_sampler_state *sampler)
{
- _mesa_memset(sampler, 0, sizeof(*sampler));
+ memset(sampler, 0, sizeof(*sampler));
switch (key->minfilter) {
case GL_NEAREST:
@@ -230,7 +229,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
GLcontext *ctx = &brw->intel.ctx;
int unit;
- memset(key, 0, sizeof(*key));
+ key->sampler_count = 0;
for (unit = 0; unit < BRW_MAX_TEX_UNIT; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
@@ -241,6 +240,8 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
struct gl_texture_image *firstImage =
texObj->Image[0][intelObj->firstLevel];
+ memset(entry, 0, sizeof(*entry));
+
entry->tex_target = texObj->Target;
entry->seamless_cube_map = (texObj->Target == GL_TEXTURE_CUBE_MAP)
@@ -289,7 +290,7 @@ static void upload_wm_samplers( struct brw_context *brw )
{
GLcontext *ctx = &brw->intel.ctx;
struct wm_sampler_key key;
- int i;
+ int i, sampler_key_size;
brw_wm_sampler_populate_key(brw, &key);
@@ -303,8 +304,11 @@ static void upload_wm_samplers( struct brw_context *brw )
if (brw->wm.sampler_count == 0)
return;
+ /* Only include the populated portion of the key in the search. */
+ sampler_key_size = offsetof(struct wm_sampler_key,
+ sampler[key.sampler_count]);
brw->wm.sampler_bo = brw_search_cache(&brw->cache, BRW_SAMPLER,
- &key, sizeof(key),
+ &key, sampler_key_size,
brw->wm.sdc_bo, key.sampler_count,
NULL);
@@ -324,7 +328,7 @@ static void upload_wm_samplers( struct brw_context *brw )
}
brw->wm.sampler_bo = brw_upload_cache(&brw->cache, BRW_SAMPLER,
- &key, sizeof(key),
+ &key, sampler_key_size,
brw->wm.sdc_bo, key.sampler_count,
&sampler, sizeof(sampler));
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 1db438ae7b5..ce0bf0b97d2 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -207,33 +207,14 @@ brw_create_texture_surface( struct brw_context *brw,
surf.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
surf.ss0.surface_type = translate_tex_target(key->target);
- if (key->bo) {
- surf.ss0.surface_format = translate_tex_format(key->format,
- key->internal_format,
- key->depthmode);
- }
- else {
- switch (key->depth) {
- case 32:
- surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
- break;
- default:
- case 24:
- surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8X8_UNORM;
- break;
- case 16:
- surf.ss0.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM;
- break;
- }
- }
+ surf.ss0.surface_format = translate_tex_format(key->format,
+ key->internal_format,
+ key->depthmode);
/* This is ok for all textures with channel width 8bit or less:
*/
/* surf.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
- if (key->bo)
- surf.ss1.base_addr = key->bo->offset; /* reloc */
- else
- surf.ss1.base_addr = key->offset;
+ surf.ss1.base_addr = key->bo->offset; /* reloc */
surf.ss2.mip_count = key->last_level - key->first_level;
surf.ss2.width = key->width - 1;
@@ -255,17 +236,14 @@ brw_create_texture_surface( struct brw_context *brw,
bo = brw_upload_cache(&brw->surface_cache, BRW_SS_SURFACE,
key, sizeof(*key),
- &key->bo, key->bo ? 1 : 0,
+ &key->bo, 1,
&surf, sizeof(surf));
- if (key->bo) {
- /* Emit relocation to surface contents */
- dri_bo_emit_reloc(bo,
- I915_GEM_DOMAIN_SAMPLER, 0,
- 0,
- offsetof(struct brw_surface_state, ss1),
- key->bo);
- }
+ /* Emit relocation to surface contents */
+ drm_intel_bo_emit_reloc(bo, offsetof(struct brw_surface_state, ss1),
+ key->bo, 0,
+ I915_GEM_DOMAIN_SAMPLER, 0);
+
return bo;
}
@@ -281,19 +259,12 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit )
memset(&key, 0, sizeof(key));
- if (intelObj->imageOverride) {
- key.pitch = intelObj->pitchOverride / intelObj->mt->cpp;
- key.depth = intelObj->depthOverride;
- key.bo = NULL;
- key.offset = intelObj->textureOffset;
- } else {
- key.format = firstImage->TexFormat;
- key.internal_format = firstImage->InternalFormat;
- key.pitch = intelObj->mt->pitch;
- key.depth = firstImage->Depth;
- key.bo = intelObj->mt->region->buffer;
- key.offset = 0;
- }
+ key.format = firstImage->TexFormat;
+ key.internal_format = firstImage->InternalFormat;
+ key.pitch = intelObj->mt->pitch;
+ key.depth = firstImage->Depth;
+ key.bo = intelObj->mt->region->buffer;
+ key.offset = 0;
key.target = tObj->Target;
key.depthmode = tObj->DepthMode;
@@ -308,7 +279,7 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit )
brw->wm.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
BRW_SS_SURFACE,
&key, sizeof(key),
- &key.bo, key.bo ? 1 : 0,
+ &key.bo, 1,
NULL);
if (brw->wm.surf_bo[surf] == NULL) {
brw->wm.surf_bo[surf] = brw_create_texture_surface(brw, &key);
@@ -336,10 +307,7 @@ brw_create_constant_surface( struct brw_context *brw,
surf.ss0.surface_format = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT;
assert(key->bo);
- if (key->bo)
- surf.ss1.base_addr = key->bo->offset; /* reloc */
- else
- surf.ss1.base_addr = key->offset;
+ surf.ss1.base_addr = key->bo->offset; /* reloc */
surf.ss2.width = w & 0x7f; /* bits 6:0 of size or width */
surf.ss2.height = (w >> 7) & 0x1fff; /* bits 19:7 of size or width */
@@ -349,20 +317,16 @@ brw_create_constant_surface( struct brw_context *brw,
bo = brw_upload_cache(&brw->surface_cache, BRW_SS_SURFACE,
key, sizeof(*key),
- &key->bo, key->bo ? 1 : 0,
+ &key->bo, 1,
&surf, sizeof(surf));
- if (key->bo) {
- /* Emit relocation to surface contents. Section 5.1.1 of the gen4
- * bspec ("Data Cache") says that the data cache does not exist as
- * a separate cache and is just the sampler cache.
- */
- dri_bo_emit_reloc(bo,
- I915_GEM_DOMAIN_SAMPLER, 0,
- 0,
- offsetof(struct brw_surface_state, ss1),
- key->bo);
- }
+ /* Emit relocation to surface contents. Section 5.1.1 of the gen4
+ * bspec ("Data Cache") says that the data cache does not exist as
+ * a separate cache and is just the sampler cache.
+ */
+ drm_intel_bo_emit_reloc(bo, offsetof(struct brw_surface_state, ss1),
+ key->bo, 0,
+ I915_GEM_DOMAIN_SAMPLER, 0);
return bo;
}
@@ -420,7 +384,7 @@ brw_update_wm_constant_surface( GLcontext *ctx,
/* If there's no constant buffer, then no surface BO is needed to point at
* it.
*/
- if (fp->const_buffer == 0) {
+ if (fp->const_buffer == NULL) {
drm_intel_bo_unreference(brw->wm.surf_bo[surf]);
brw->wm.surf_bo[surf] = NULL;
return;
@@ -448,7 +412,7 @@ brw_update_wm_constant_surface( GLcontext *ctx,
brw->wm.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
BRW_SS_SURFACE,
&key, sizeof(key),
- &key.bo, key.bo ? 1 : 0,
+ &key.bo, 1,
NULL);
if (brw->wm.surf_bo[surf] == NULL) {
brw->wm.surf_bo[surf] = brw_create_constant_surface(brw, &key);
@@ -509,7 +473,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
struct gl_renderbuffer *rb,
unsigned int unit)
{
- struct intel_context *intel = &brw->intel;;
+ struct intel_context *intel = &brw->intel;
GLcontext *ctx = &intel->ctx;
dri_bo *region_bo = NULL;
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
@@ -576,18 +540,21 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
key.draw_x = 0;
key.draw_y = 0;
}
- /* _NEW_COLOR */
- memcpy(key.color_mask, ctx->Color.ColorMask[unit],
- sizeof(key.color_mask));
- /* As mentioned above, disable writes to the alpha component when the
- * renderbuffer is XRGB.
- */
- if (ctx->DrawBuffer->Visual.alphaBits == 0)
- key.color_mask[3] = GL_FALSE;
+ if (intel->gen < 6) {
+ /* _NEW_COLOR */
+ memcpy(key.color_mask, ctx->Color.ColorMask[unit],
+ sizeof(key.color_mask));
- key.color_blend = (!ctx->Color._LogicOpEnabled &&
- (ctx->Color.BlendEnabled & (1 << unit)));
+ /* As mentioned above, disable writes to the alpha component when the
+ * renderbuffer is XRGB.
+ */
+ if (ctx->DrawBuffer->Visual.alphaBits == 0)
+ key.color_mask[3] = GL_FALSE;
+
+ key.color_blend = (!ctx->Color._LogicOpEnabled &&
+ (ctx->Color.BlendEnabled & (1 << unit)));
+ }
dri_bo_unreference(brw->wm.surf_bo[unit]);
brw->wm.surf_bo[unit] = brw_search_cache(&brw->surface_cache,
@@ -639,12 +606,14 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
brw_set_surface_tiling(&surf, key.tiling);
surf.ss3.pitch = (key.pitch * key.cpp) - 1;
- /* _NEW_COLOR */
- surf.ss0.color_blend = key.color_blend;
- surf.ss0.writedisable_red = !key.color_mask[0];
- surf.ss0.writedisable_green = !key.color_mask[1];
- surf.ss0.writedisable_blue = !key.color_mask[2];
- surf.ss0.writedisable_alpha = !key.color_mask[3];
+ if (intel->gen < 6) {
+ /* _NEW_COLOR */
+ surf.ss0.color_blend = key.color_blend;
+ surf.ss0.writedisable_red = !key.color_mask[0];
+ surf.ss0.writedisable_green = !key.color_mask[1];
+ surf.ss0.writedisable_blue = !key.color_mask[2];
+ surf.ss0.writedisable_alpha = !key.color_mask[3];
+ }
/* Key size will never match key size for textures, so we're safe. */
brw->wm.surf_bo[unit] = brw_upload_cache(&brw->surface_cache,
diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c
new file mode 100644
index 00000000000..f7acad69129
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_cc.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+#include "brw_util.h"
+#include "intel_batchbuffer.h"
+#include "main/macros.h"
+
+struct gen6_blend_state_key {
+ GLboolean color_blend, alpha_enabled;
+ GLboolean dither;
+
+ GLenum logic_op;
+
+ GLenum blend_eq_rgb, blend_eq_a;
+ GLenum blend_src_rgb, blend_src_a;
+ GLenum blend_dst_rgb, blend_dst_a;
+
+ GLenum alpha_func;
+};
+
+static void
+blend_state_populate_key(struct brw_context *brw,
+ struct gen6_blend_state_key *key)
+{
+ GLcontext *ctx = &brw->intel.ctx;
+
+ memset(key, 0, sizeof(*key));
+
+ /* _NEW_COLOR */
+ if (ctx->Color._LogicOpEnabled)
+ key->logic_op = ctx->Color.LogicOp;
+ else
+ key->logic_op = GL_COPY;
+
+ /* _NEW_COLOR */
+ key->color_blend = ctx->Color.BlendEnabled;
+ if (key->color_blend) {
+ key->blend_eq_rgb = ctx->Color.BlendEquationRGB;
+ key->blend_eq_a = ctx->Color.BlendEquationA;
+ key->blend_src_rgb = ctx->Color.BlendSrcRGB;
+ key->blend_dst_rgb = ctx->Color.BlendDstRGB;
+ key->blend_src_a = ctx->Color.BlendSrcA;
+ key->blend_dst_a = ctx->Color.BlendDstA;
+ }
+
+ /* _NEW_COLOR */
+ key->alpha_enabled = ctx->Color.AlphaEnabled;
+ if (key->alpha_enabled) {
+ key->alpha_func = ctx->Color.AlphaFunc;
+ }
+
+ /* _NEW_COLOR */
+ key->dither = ctx->Color.DitherFlag;
+}
+
+/**
+ * Creates the state cache entry for the given CC unit key.
+ */
+static drm_intel_bo *
+blend_state_create_from_key(struct brw_context *brw,
+ struct gen6_blend_state_key *key)
+{
+ struct gen6_blend_state blend;
+ drm_intel_bo *bo;
+
+ memset(&blend, 0, sizeof(blend));
+
+ if (key->logic_op != GL_COPY) {
+ blend.blend1.logic_op_enable = 1;
+ blend.blend1.logic_op_func = intel_translate_logic_op(key->logic_op);
+ } else if (key->color_blend) {
+ GLenum eqRGB = key->blend_eq_rgb;
+ GLenum eqA = key->blend_eq_a;
+ GLenum srcRGB = key->blend_src_rgb;
+ GLenum dstRGB = key->blend_dst_rgb;
+ GLenum srcA = key->blend_src_a;
+ GLenum dstA = key->blend_dst_a;
+
+ if (eqRGB == GL_MIN || eqRGB == GL_MAX) {
+ srcRGB = dstRGB = GL_ONE;
+ }
+
+ if (eqA == GL_MIN || eqA == GL_MAX) {
+ srcA = dstA = GL_ONE;
+ }
+
+ blend.blend0.dest_blend_factor = brw_translate_blend_factor(dstRGB);
+ blend.blend0.source_blend_factor = brw_translate_blend_factor(srcRGB);
+ blend.blend0.blend_func = brw_translate_blend_equation(eqRGB);
+
+ blend.blend0.ia_dest_blend_factor = brw_translate_blend_factor(dstA);
+ blend.blend0.ia_source_blend_factor = brw_translate_blend_factor(srcA);
+ blend.blend0.ia_blend_func = brw_translate_blend_equation(eqA);
+
+ blend.blend0.blend_enable = 1;
+ blend.blend0.ia_blend_enable = (srcA != srcRGB ||
+ dstA != dstRGB ||
+ eqA != eqRGB);
+ }
+
+ if (key->alpha_enabled) {
+ blend.blend1.alpha_test_enable = 1;
+ blend.blend1.alpha_test_func = intel_translate_compare_func(key->alpha_func);
+
+ }
+
+ if (key->dither) {
+ blend.blend1.dither_enable = 1;
+ blend.blend1.y_dither_offset = 0;
+ blend.blend1.x_dither_offset = 0;
+ }
+
+ bo = brw_upload_cache(&brw->cache, BRW_BLEND_STATE,
+ key, sizeof(*key),
+ NULL, 0,
+ &blend, sizeof(blend));
+
+ return bo;
+}
+
+static void
+prepare_blend_state(struct brw_context *brw)
+{
+ struct gen6_blend_state_key key;
+
+ blend_state_populate_key(brw, &key);
+
+ drm_intel_bo_unreference(brw->cc.blend_state_bo);
+ brw->cc.blend_state_bo = brw_search_cache(&brw->cache, BRW_BLEND_STATE,
+ &key, sizeof(key),
+ NULL, 0,
+ NULL);
+
+ if (brw->cc.blend_state_bo == NULL)
+ brw->cc.blend_state_bo = blend_state_create_from_key(brw, &key);
+}
+
+const struct brw_tracked_state gen6_blend_state = {
+ .dirty = {
+ .mesa = _NEW_COLOR,
+ .brw = 0,
+ .cache = 0,
+ },
+ .prepare = prepare_blend_state,
+};
+
+struct gen6_color_calc_state_key {
+ GLubyte blend_constant_color[4];
+ GLclampf alpha_ref;
+ GLubyte stencil_ref[2];
+};
+
+static void
+color_calc_state_populate_key(struct brw_context *brw,
+ struct gen6_color_calc_state_key *key)
+{
+ GLcontext *ctx = &brw->intel.ctx;
+
+ memset(key, 0, sizeof(*key));
+
+ /* _NEW_STENCIL */
+ if (ctx->Stencil._Enabled) {
+ const unsigned back = ctx->Stencil._BackFace;
+
+ key->stencil_ref[0] = ctx->Stencil.Ref[0];
+ if (ctx->Stencil._TestTwoSide)
+ key->stencil_ref[1] = ctx->Stencil.Ref[back];
+ }
+
+ /* _NEW_COLOR */
+ if (ctx->Color.AlphaEnabled)
+ key->alpha_ref = ctx->Color.AlphaRef;
+
+ key->blend_constant_color[0] = ctx->Color.BlendColor[0];
+ key->blend_constant_color[1] = ctx->Color.BlendColor[1];
+ key->blend_constant_color[2] = ctx->Color.BlendColor[2];
+ key->blend_constant_color[3] = ctx->Color.BlendColor[3];
+}
+
+/**
+ * Creates the state cache entry for the given CC state key.
+ */
+static drm_intel_bo *
+color_calc_state_create_from_key(struct brw_context *brw,
+ struct gen6_color_calc_state_key *key)
+{
+ struct gen6_color_calc_state cc;
+ drm_intel_bo *bo;
+
+ memset(&cc, 0, sizeof(cc));
+
+ cc.cc0.alpha_test_format = BRW_ALPHATEST_FORMAT_UNORM8;
+ UNCLAMPED_FLOAT_TO_UBYTE(cc.cc1.alpha_ref_fi.ui, key->alpha_ref);
+
+ cc.cc0.stencil_ref = key->stencil_ref[0];
+ cc.cc0.bf_stencil_ref = key->stencil_ref[1];
+
+ cc.constant_r = key->blend_constant_color[0];
+ cc.constant_g = key->blend_constant_color[1];
+ cc.constant_b = key->blend_constant_color[2];
+ cc.constant_a = key->blend_constant_color[3];
+
+ bo = brw_upload_cache(&brw->cache, BRW_COLOR_CALC_STATE,
+ key, sizeof(*key),
+ NULL, 0,
+ &cc, sizeof(cc));
+
+ return bo;
+}
+
+static void
+prepare_color_calc_state(struct brw_context *brw)
+{
+ struct gen6_color_calc_state_key key;
+
+ color_calc_state_populate_key(brw, &key);
+
+ drm_intel_bo_unreference(brw->cc.state_bo);
+ brw->cc.state_bo = brw_search_cache(&brw->cache, BRW_COLOR_CALC_STATE,
+ &key, sizeof(key),
+ NULL, 0,
+ NULL);
+
+ if (brw->cc.state_bo == NULL)
+ brw->cc.state_bo = color_calc_state_create_from_key(brw, &key);
+}
+
+const struct brw_tracked_state gen6_color_calc_state = {
+ .dirty = {
+ .mesa = _NEW_COLOR,
+ .brw = 0,
+ .cache = 0,
+ },
+ .prepare = prepare_color_calc_state,
+};
+
+static void upload_cc_state_pointers(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+
+ BEGIN_BATCH(4);
+ OUT_BATCH(CMD_3D_CC_STATE_POINTERS << 16 | (4 - 2));
+ OUT_RELOC(brw->cc.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
+ OUT_RELOC(brw->cc.blend_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
+ OUT_RELOC(brw->cc.depth_stencil_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+}
+
+
+static void prepare_cc_state_pointers(struct brw_context *brw)
+{
+ brw_add_validated_bo(brw, brw->cc.state_bo);
+ brw_add_validated_bo(brw, brw->cc.blend_state_bo);
+ brw_add_validated_bo(brw, brw->cc.depth_stencil_state_bo);
+}
+
+const struct brw_tracked_state gen6_cc_state_pointers = {
+ .dirty = {
+ .mesa = 0,
+ .brw = BRW_NEW_BATCH,
+ .cache = (CACHE_NEW_BLEND_STATE |
+ CACHE_NEW_COLOR_CALC_STATE |
+ CACHE_NEW_DEPTH_STENCIL_STATE)
+ },
+ .prepare = prepare_cc_state_pointers,
+ .emit = upload_cc_state_pointers,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
new file mode 100644
index 00000000000..06f8145e32d
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+#include "intel_batchbuffer.h"
+
+static void
+upload_clip_state(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+ GLcontext *ctx = &intel->ctx;
+ uint32_t depth_clamp = 0;
+ uint32_t provoking;
+
+ if (!ctx->Transform.DepthClamp)
+ depth_clamp = GEN6_CLIP_Z_TEST;
+
+ if (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION) {
+ provoking = 0;
+ } else {
+ provoking =
+ (2 << GEN6_CLIP_TRI_PROVOKE_SHIFT) |
+ (2 << GEN6_CLIP_TRIFAN_PROVOKE_SHIFT) |
+ (1 << GEN6_CLIP_LINE_PROVOKE_SHIFT);
+ }
+
+ BEGIN_BATCH(4);
+ OUT_BATCH(CMD_3D_CLIP_STATE << 16 | (4 - 2));
+ OUT_BATCH(GEN6_CLIP_STATISTICS_ENABLE);
+ OUT_BATCH(GEN6_CLIP_ENABLE |
+ GEN6_CLIP_API_OGL |
+ GEN6_CLIP_MODE_REJECT_ALL | /* XXX: debug: get VS working */
+ GEN6_CLIP_XY_TEST |
+ depth_clamp |
+ provoking);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+}
+
+const struct brw_tracked_state gen6_clip_state = {
+ .dirty = {
+ .mesa = _NEW_TRANSFORM,
+ .brw = BRW_NEW_CONTEXT,
+ .cache = 0
+ },
+ .emit = upload_clip_state,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_depthstencil.c b/src/mesa/drivers/dri/i965/gen6_depthstencil.c
new file mode 100644
index 00000000000..4924f0fd559
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_depthstencil.c
@@ -0,0 +1,165 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+
+struct brw_depth_stencil_state_key {
+ GLenum depth_func;
+ GLboolean depth_test, depth_write;
+ GLboolean stencil, stencil_two_side;
+ GLenum stencil_func[2], stencil_fail_op[2];
+ GLenum stencil_pass_depth_fail_op[2], stencil_pass_depth_pass_op[2];
+ GLubyte stencil_write_mask[2], stencil_test_mask[2];
+};
+
+static void
+depth_stencil_state_populate_key(struct brw_context *brw,
+ struct brw_depth_stencil_state_key *key)
+{
+ GLcontext *ctx = &brw->intel.ctx;
+ const unsigned back = ctx->Stencil._BackFace;
+
+ memset(key, 0, sizeof(*key));
+
+ /* _NEW_STENCIL */
+ key->stencil = ctx->Stencil._Enabled;
+ key->stencil_two_side = ctx->Stencil._TestTwoSide;
+
+ if (key->stencil) {
+ key->stencil_func[0] = ctx->Stencil.Function[0];
+ key->stencil_fail_op[0] = ctx->Stencil.FailFunc[0];
+ key->stencil_pass_depth_fail_op[0] = ctx->Stencil.ZFailFunc[0];
+ key->stencil_pass_depth_pass_op[0] = ctx->Stencil.ZPassFunc[0];
+ key->stencil_write_mask[0] = ctx->Stencil.WriteMask[0];
+ key->stencil_test_mask[0] = ctx->Stencil.ValueMask[0];
+ }
+ if (key->stencil_two_side) {
+ key->stencil_func[1] = ctx->Stencil.Function[back];
+ key->stencil_fail_op[1] = ctx->Stencil.FailFunc[back];
+ key->stencil_pass_depth_fail_op[1] = ctx->Stencil.ZFailFunc[back];
+ key->stencil_pass_depth_pass_op[1] = ctx->Stencil.ZPassFunc[back];
+ key->stencil_write_mask[1] = ctx->Stencil.WriteMask[back];
+ key->stencil_test_mask[1] = ctx->Stencil.ValueMask[back];
+ }
+
+ key->depth_test = ctx->Depth.Test;
+ if (key->depth_test) {
+ key->depth_func = ctx->Depth.Func;
+ key->depth_write = ctx->Depth.Mask;
+ }
+}
+
+/**
+ * Creates the state cache entry for the given DEPTH_STENCIL_STATE state key.
+ */
+static dri_bo *
+depth_stencil_state_create_from_key(struct brw_context *brw,
+ struct brw_depth_stencil_state_key *key)
+{
+ struct gen6_depth_stencil_state ds;
+ dri_bo *bo;
+
+ memset(&ds, 0, sizeof(ds));
+
+ /* _NEW_STENCIL */
+ if (key->stencil) {
+ ds.ds0.stencil_enable = 1;
+ ds.ds0.stencil_func =
+ intel_translate_compare_func(key->stencil_func[0]);
+ ds.ds0.stencil_fail_op =
+ intel_translate_stencil_op(key->stencil_fail_op[0]);
+ ds.ds0.stencil_pass_depth_fail_op =
+ intel_translate_stencil_op(key->stencil_pass_depth_fail_op[0]);
+ ds.ds0.stencil_pass_depth_pass_op =
+ intel_translate_stencil_op(key->stencil_pass_depth_pass_op[0]);
+ ds.ds1.stencil_write_mask = key->stencil_write_mask[0];
+ ds.ds1.stencil_test_mask = key->stencil_test_mask[0];
+
+ if (key->stencil_two_side) {
+ ds.ds0.bf_stencil_enable = 1;
+ ds.ds0.bf_stencil_func =
+ intel_translate_compare_func(key->stencil_func[1]);
+ ds.ds0.bf_stencil_fail_op =
+ intel_translate_stencil_op(key->stencil_fail_op[1]);
+ ds.ds0.bf_stencil_pass_depth_fail_op =
+ intel_translate_stencil_op(key->stencil_pass_depth_fail_op[1]);
+ ds.ds0.bf_stencil_pass_depth_pass_op =
+ intel_translate_stencil_op(key->stencil_pass_depth_pass_op[1]);
+ ds.ds1.bf_stencil_write_mask = key->stencil_write_mask[1];
+ ds.ds1.bf_stencil_test_mask = key->stencil_test_mask[1];
+ }
+
+ /* Not really sure about this:
+ */
+ if (key->stencil_write_mask[0] ||
+ (key->stencil_two_side && key->stencil_write_mask[1]))
+ ds.ds0.stencil_write_enable = 1;
+ }
+
+ /* _NEW_DEPTH */
+ if (key->depth_test) {
+ ds.ds2.depth_test_enable = 1;
+ ds.ds2.depth_test_func = intel_translate_compare_func(key->depth_func);
+ ds.ds2.depth_write_enable = key->depth_write;
+ }
+
+ bo = brw_upload_cache(&brw->cache, BRW_DEPTH_STENCIL_STATE,
+ key, sizeof(*key),
+ NULL, 0,
+ &ds, sizeof(ds));
+
+ return bo;
+}
+
+static void
+prepare_depth_stencil_state(struct brw_context *brw)
+{
+ struct brw_depth_stencil_state_key key;
+
+ depth_stencil_state_populate_key(brw, &key);
+
+ dri_bo_unreference(brw->cc.depth_stencil_state_bo);
+ brw->cc.depth_stencil_state_bo = brw_search_cache(&brw->cache,
+ BRW_DEPTH_STENCIL_STATE,
+ &key, sizeof(key),
+ NULL, 0,
+ NULL);
+
+ if (brw->cc.depth_stencil_state_bo == NULL)
+ brw->cc.depth_stencil_state_bo =
+ depth_stencil_state_create_from_key(brw, &key);
+}
+
+const struct brw_tracked_state gen6_depth_stencil_state = {
+ .dirty = {
+ .mesa = _NEW_DEPTH | _NEW_STENCIL,
+ .brw = 0,
+ .cache = 0,
+ },
+ .prepare = prepare_depth_stencil_state,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_state.c b/src/mesa/drivers/dri/i965/gen6_gs_state.c
new file mode 100644
index 00000000000..161e7b85c28
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_gs_state.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+#include "intel_batchbuffer.h"
+
+static void
+upload_gs_state(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+
+ /* Disable all the constant buffers. */
+ BEGIN_BATCH(5);
+ OUT_BATCH(CMD_3D_CONSTANT_GS_STATE << 16 | (5 - 2));
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+
+ if (brw->gs.prog_bo) {
+ BEGIN_BATCH(7);
+ OUT_BATCH(CMD_3D_GS_STATE << 16 | (7 - 2));
+ OUT_RELOC(brw->gs.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
+ OUT_BATCH((0 << GEN6_GS_SAMPLER_COUNT_SHIFT) |
+ (0 << GEN6_GS_BINDING_TABLE_ENTRY_COUNT_SHIFT));
+ OUT_BATCH(0); /* scratch space base offset */
+ OUT_BATCH((1 << GEN6_GS_DISPATCH_START_GRF_SHIFT) |
+ (brw->gs.prog_data->urb_read_length << GEN6_GS_URB_READ_LENGTH_SHIFT) |
+ (0 << GEN6_GS_URB_ENTRY_READ_OFFSET_SHIFT));
+ OUT_BATCH((0 << GEN6_GS_MAX_THREADS_SHIFT) |
+ GEN6_GS_STATISTICS_ENABLE |
+ GEN6_GS_RENDERING_ENABLE);
+ OUT_BATCH(GEN6_GS_ENABLE);
+ ADVANCE_BATCH();
+ } else {
+ BEGIN_BATCH(7);
+ OUT_BATCH(CMD_3D_GS_STATE << 16 | (7 - 2));
+ OUT_BATCH(0); /* prog_bo */
+ OUT_BATCH((0 << GEN6_GS_SAMPLER_COUNT_SHIFT) |
+ (0 << GEN6_GS_BINDING_TABLE_ENTRY_COUNT_SHIFT));
+ OUT_BATCH(0); /* scratch space base offset */
+ OUT_BATCH((1 << GEN6_GS_DISPATCH_START_GRF_SHIFT) |
+ (0 << GEN6_GS_URB_READ_LENGTH_SHIFT) |
+ (0 << GEN6_GS_URB_ENTRY_READ_OFFSET_SHIFT));
+ OUT_BATCH((0 << GEN6_GS_MAX_THREADS_SHIFT) |
+ GEN6_GS_STATISTICS_ENABLE |
+ GEN6_GS_RENDERING_ENABLE);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+ }
+}
+
+const struct brw_tracked_state gen6_gs_state = {
+ .dirty = {
+ .mesa = _NEW_TRANSFORM,
+ .brw = (BRW_NEW_CURBE_OFFSETS |
+ BRW_NEW_URB_FENCE |
+ BRW_NEW_CONTEXT),
+ .cache = CACHE_NEW_GS_PROG
+ },
+ .emit = upload_gs_state,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_sampler_state.c b/src/mesa/drivers/dri/i965/gen6_sampler_state.c
new file mode 100644
index 00000000000..ab8e7516d23
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_sampler_state.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+#include "intel_batchbuffer.h"
+
+static void
+upload_sampler_state_pointers(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+
+ BEGIN_BATCH(4);
+ OUT_BATCH(CMD_3D_SAMPLER_STATE_POINTERS << 16 |
+ VS_SAMPLER_STATE_CHANGE |
+ GS_SAMPLER_STATE_CHANGE |
+ PS_SAMPLER_STATE_CHANGE |
+ (4 - 2));
+ OUT_BATCH(0); /* VS */
+ OUT_BATCH(0); /* GS */
+ if (brw->wm.sampler_bo)
+ OUT_RELOC(brw->wm.sampler_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
+ else
+ OUT_BATCH(0);
+
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+}
+
+
+static void
+prepare_sampler_state_pointers(struct brw_context *brw)
+{
+ brw_add_validated_bo(brw, brw->wm.sampler_bo);
+}
+
+const struct brw_tracked_state gen6_sampler_state = {
+ .dirty = {
+ .mesa = 0,
+ .brw = BRW_NEW_BATCH,
+ .cache = CACHE_NEW_SAMPLER
+ },
+ .prepare = prepare_sampler_state_pointers,
+ .emit = upload_sampler_state_pointers,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_scissor_state.c b/src/mesa/drivers/dri/i965/gen6_scissor_state.c
new file mode 100644
index 00000000000..2e21e5f7335
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_scissor_state.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+#include "intel_batchbuffer.h"
+
+static void
+prepare_scissor_state(struct brw_context *brw)
+{
+ GLcontext *ctx = &brw->intel.ctx;
+ const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0);
+ struct gen6_scissor_state scissor;
+
+ /* _NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT */
+
+ /* The scissor only needs to handle the intersection of drawable and
+ * scissor rect. Clipping to the boundaries of static shared buffers
+ * for front/back/depth is covered by looping over cliprects in brw_draw.c.
+ *
+ * Note that the hardware's coordinates are inclusive, while Mesa's min is
+ * inclusive but max is exclusive.
+ */
+ if (render_to_fbo) {
+ /* texmemory: Y=0=bottom */
+ scissor.xmin = ctx->DrawBuffer->_Xmin;
+ scissor.xmax = ctx->DrawBuffer->_Xmax - 1;
+ scissor.ymin = ctx->DrawBuffer->_Ymin;
+ scissor.ymax = ctx->DrawBuffer->_Ymax - 1;
+ }
+ else {
+ /* memory: Y=0=top */
+ scissor.xmin = ctx->DrawBuffer->_Xmin;
+ scissor.xmax = ctx->DrawBuffer->_Xmax - 1;
+ scissor.ymin = ctx->DrawBuffer->Height - ctx->DrawBuffer->_Ymax;
+ scissor.ymax = ctx->DrawBuffer->Height - ctx->DrawBuffer->_Ymin - 1;
+ }
+
+ drm_intel_bo_unreference(brw->sf.state_bo);
+ brw->sf.state_bo = brw_cache_data(&brw->cache, BRW_SF_UNIT,
+ &scissor, sizeof(scissor),
+ NULL, 0);
+}
+
+const struct brw_tracked_state gen6_scissor_state = {
+ .dirty = {
+ .mesa = _NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT,
+ .brw = 0,
+ .cache = 0,
+ },
+ .prepare = prepare_scissor_state,
+};
+
+static void upload_scissor_state_pointers(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+
+ BEGIN_BATCH(2);
+ OUT_BATCH(CMD_3D_SCISSOR_STATE_POINTERS << 16 | (2 - 2));
+ OUT_RELOC(brw->sf.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+}
+
+
+static void prepare_scissor_state_pointers(struct brw_context *brw)
+{
+ brw_add_validated_bo(brw, brw->sf.state_bo);
+}
+
+const struct brw_tracked_state gen6_scissor_state_pointers = {
+ .dirty = {
+ .mesa = 0,
+ .brw = BRW_NEW_BATCH,
+ .cache = CACHE_NEW_SF_UNIT
+ },
+ .prepare = prepare_scissor_state_pointers,
+ .emit = upload_scissor_state_pointers,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c
new file mode 100644
index 00000000000..8d96b44f1dc
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -0,0 +1,187 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+#include "brw_util.h"
+#include "main/macros.h"
+#include "intel_batchbuffer.h"
+
+static uint32_t
+get_attr_override(struct brw_context *brw, int attr)
+{
+ uint32_t attr_override;
+ int attr_index = 0, i;
+
+ /* Find the source index (0 = first attribute after the 4D position)
+ * for this output attribute. attr is currently a VERT_RESULT_* but should
+ * be FRAG_ATTRIB_*.
+ */
+ for (i = 0; i < attr; i++) {
+ if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(i))
+ attr_index++;
+ }
+ attr_override = attr_index;
+
+ return attr_index;
+}
+
+static void
+upload_sf_state(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+ GLcontext *ctx = &intel->ctx;
+ /* CACHE_NEW_VS_PROG */
+ uint32_t num_inputs = brw_count_bits(brw->vs.prog_data->outputs_written);
+ /* This should probably be FS inputs read */
+ uint32_t num_outputs = brw_count_bits(brw->vs.prog_data->outputs_written);
+ uint32_t dw1, dw2, dw3, dw4;
+ int i;
+ /* _NEW_BUFFER */
+ GLboolean render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
+ int attr = 0;
+
+ dw1 =
+ num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT |
+ (num_inputs + 1) / 2 << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
+ 3 << GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT;
+ dw2 = GEN6_SF_VIEWPORT_TRANSFORM_ENABLE |
+ GEN6_SF_STATISTICS_ENABLE;
+ dw3 = 0;
+ dw4 = 0;
+
+ /* _NEW_POLYGON */
+ if ((ctx->Polygon.FrontFace == GL_CCW) ^ render_to_fbo)
+ dw2 |= GEN6_SF_WINDING_CCW;
+
+ /* _NEW_SCISSOR */
+ if (ctx->Scissor.Enabled)
+ dw3 |= GEN6_SF_SCISSOR_ENABLE;
+
+ /* _NEW_POLYGON */
+ if (ctx->Polygon.CullFlag) {
+ switch (ctx->Polygon.CullFaceMode) {
+ case GL_FRONT:
+ dw3 |= GEN6_SF_CULL_BOTH;
+ break;
+ case GL_BACK:
+ dw3 |= GEN6_SF_CULL_BACK;
+ break;
+ case GL_FRONT_AND_BACK:
+ dw3 |= GEN6_SF_CULL_BOTH;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ } else {
+ dw3 |= GEN6_SF_CULL_NONE;
+ }
+
+ /* _NEW_LINE */
+ dw3 |= U_FIXED(CLAMP(ctx->Line.Width, 0.0, 7.99), 7) <<
+ GEN6_SF_LINE_WIDTH_SHIFT;
+ if (ctx->Line.SmoothFlag) {
+ dw3 |= GEN6_SF_LINE_AA_ENABLE;
+ dw3 |= GEN6_SF_LINE_AA_MODE_TRUE;
+ dw3 |= GEN6_SF_LINE_END_CAP_WIDTH_1_0;
+ }
+
+ /* _NEW_POINT */
+ if (ctx->Point._Attenuated)
+ dw4 |= GEN6_SF_USE_STATE_POINT_WIDTH;
+
+ dw4 |= U_FIXED(CLAMP(ctx->Point.Size, 0.125, 225.875), 3) <<
+ GEN6_SF_POINT_WIDTH_SHIFT;
+ if (render_to_fbo)
+ dw1 |= GEN6_SF_POINT_SPRITE_LOWERLEFT;
+
+ /* _NEW_LIGHT */
+ if (ctx->Light.ProvokingVertex != GL_FIRST_VERTEX_CONVENTION) {
+ dw4 |=
+ (2 << GEN6_SF_TRI_PROVOKE_SHIFT) |
+ (2 << GEN6_SF_TRIFAN_PROVOKE_SHIFT) |
+ (1 << GEN6_SF_LINE_PROVOKE_SHIFT);
+ } else {
+ dw4 |=
+ (1 << GEN6_SF_TRIFAN_PROVOKE_SHIFT);
+ }
+
+ BEGIN_BATCH(20);
+ OUT_BATCH(CMD_3D_SF_STATE << 16 | (20 - 2));
+ OUT_BATCH(dw1);
+ OUT_BATCH(dw2);
+ OUT_BATCH(dw3);
+ OUT_BATCH(dw4);
+ OUT_BATCH_F(ctx->Polygon.OffsetUnits * 2); /* constant. copied from gen4 */
+ OUT_BATCH_F(ctx->Polygon.OffsetFactor); /* scale */
+ OUT_BATCH_F(0.0); /* XXX: global depth offset clamp */
+ for (i = 0; i < 8; i++) {
+ uint32_t attr_overrides = 0;
+
+ /* These should be generating FS inputs read instead of VS
+ * outputs written
+ */
+ for (; attr < 64; attr++) {
+ if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(attr)) {
+ attr_overrides |= get_attr_override(brw, attr);
+ attr++;
+ break;
+ }
+ }
+
+ for (; attr < 64; attr++) {
+ if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(attr)) {
+ attr_overrides |= get_attr_override(brw, attr) << 16;
+ attr++;
+ break;
+ }
+ }
+ OUT_BATCH(attr_overrides);
+ }
+ OUT_BATCH(0); /* point sprite texcoord bitmask */
+ OUT_BATCH(0); /* constant interp bitmask */
+ OUT_BATCH(0); /* wrapshortest enables 0-7 */
+ OUT_BATCH(0); /* wrapshortest enables 8-15 */
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+}
+
+const struct brw_tracked_state gen6_sf_state = {
+ .dirty = {
+ .mesa = (_NEW_LIGHT |
+ _NEW_POLYGON |
+ _NEW_LINE |
+ _NEW_SCISSOR |
+ _NEW_BUFFERS),
+ .brw = BRW_NEW_CONTEXT,
+ .cache = CACHE_NEW_VS_PROG
+ },
+ .emit = upload_sf_state,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_urb.c b/src/mesa/drivers/dri/i965/gen6_urb.c
new file mode 100644
index 00000000000..5445e4035a9
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_urb.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "main/macros.h"
+#include "intel_batchbuffer.h"
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+
+static void
+prepare_urb( struct brw_context *brw )
+{
+ brw->urb.nr_vs_entries = 24;
+ if (brw->gs.prog_bo)
+ brw->urb.nr_gs_entries = 4;
+ else
+ brw->urb.nr_gs_entries = 0;
+ /* CACHE_NEW_VS_PROG */
+ brw->urb.vs_size = MIN2(brw->vs.prog_data->urb_entry_size, 1);
+
+ /* Check that the number of URB rows (8 floats each) allocated is less
+ * than the URB space.
+ */
+ assert((brw->urb.nr_vs_entries +
+ brw->urb.nr_gs_entries) * brw->urb.vs_size * 8 < 64 * 1024);
+}
+
+static void
+upload_urb(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+
+ assert(brw->urb.nr_vs_entries % 4 == 0);
+ assert(brw->urb.nr_gs_entries % 4 == 0);
+ /* GS requirement */
+ assert(!brw->gs.prog_bo || brw->urb.vs_size < 5);
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+
+ BEGIN_BATCH(3);
+ OUT_BATCH(CMD_URB << 16 | (3 - 2));
+ OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_VS_SIZE_SHIFT) |
+ ((brw->urb.nr_vs_entries) << GEN6_URB_VS_ENTRIES_SHIFT));
+ OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_GS_SIZE_SHIFT) |
+ ((brw->urb.nr_gs_entries) << GEN6_URB_GS_ENTRIES_SHIFT));
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+}
+
+const struct brw_tracked_state gen6_urb = {
+ .dirty = {
+ .mesa = 0,
+ .brw = BRW_NEW_CONTEXT,
+ .cache = CACHE_NEW_VS_PROG,
+ },
+ .prepare = prepare_urb,
+ .emit = upload_urb,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_viewport_state.c b/src/mesa/drivers/dri/i965/gen6_viewport_state.c
new file mode 100644
index 00000000000..0c2aa4206c6
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_viewport_state.c
@@ -0,0 +1,173 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+#include "intel_batchbuffer.h"
+#include "main/macros.h"
+
+/* The clip VP defines the guardband region where expensive clipping is skipped
+ * and fragments are allowed to be generated and clipped out cheaply by the SF.
+ *
+ * By setting it to NDC bounds of [-1,1], we don't do GB clipping. It's
+ * supposed to cause seams to become visible in apps due to shared edges taking
+ * different clip/no clip paths depending on whether the rest of the prim ends
+ * up in the guardband or not.
+ */
+static void
+prepare_clip_vp(struct brw_context *brw)
+{
+ struct brw_clipper_viewport vp;
+
+ vp.xmin = -1.0;
+ vp.xmax = 1.0;
+ vp.ymin = -1.0;
+ vp.ymax = 1.0;
+
+ drm_intel_bo_unreference(brw->clip.vp_bo);
+ brw->clip.vp_bo = brw_cache_data(&brw->cache, BRW_CLIP_VP,
+ &vp, sizeof(vp),
+ NULL, 0);
+}
+
+const struct brw_tracked_state gen6_clip_vp = {
+ .dirty = {
+ .mesa = _NEW_VIEWPORT, /* XXX: not really, but we need nonzero */
+ .brw = 0,
+ .cache = 0,
+ },
+ .prepare = prepare_clip_vp,
+};
+
+static void
+prepare_sf_vp(struct brw_context *brw)
+{
+ GLcontext *ctx = &brw->intel.ctx;
+ const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
+ struct brw_sf_viewport sfv;
+ GLfloat y_scale, y_bias;
+ const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0);
+ const GLfloat *v = ctx->Viewport._WindowMap.m;
+
+ memset(&sfv, 0, sizeof(sfv));
+
+ /* _NEW_BUFFERS */
+ if (render_to_fbo) {
+ y_scale = 1.0;
+ y_bias = 0;
+ } else {
+ y_scale = -1.0;
+ y_bias = ctx->DrawBuffer->Height;
+ }
+
+ /* _NEW_VIEWPORT */
+ sfv.viewport.m00 = v[MAT_SX];
+ sfv.viewport.m11 = v[MAT_SY] * y_scale;
+ sfv.viewport.m22 = v[MAT_SZ] * depth_scale;
+ sfv.viewport.m30 = v[MAT_TX];
+ sfv.viewport.m31 = v[MAT_TY] * y_scale + y_bias;
+ sfv.viewport.m32 = v[MAT_TZ] * depth_scale;
+
+ drm_intel_bo_unreference(brw->sf.vp_bo);
+ brw->sf.vp_bo = brw_cache_data(&brw->cache, BRW_SF_VP,
+ &sfv, sizeof(sfv),
+ NULL, 0);
+}
+
+const struct brw_tracked_state gen6_sf_vp = {
+ .dirty = {
+ .mesa = _NEW_VIEWPORT | _NEW_BUFFERS,
+ .brw = 0,
+ .cache = 0,
+ },
+ .prepare = prepare_sf_vp,
+};
+
+static void
+prepare_cc_vp(struct brw_context *brw)
+{
+ GLcontext *ctx = &brw->intel.ctx;
+ struct brw_cc_viewport ccv;
+
+ /* _NEW_TRANSOFORM */
+ if (ctx->Transform.DepthClamp) {
+ /* _NEW_VIEWPORT */
+ ccv.min_depth = MIN2(ctx->Viewport.Near, ctx->Viewport.Far);
+ ccv.max_depth = MAX2(ctx->Viewport.Near, ctx->Viewport.Far);
+ } else {
+ ccv.min_depth = 0.0;
+ ccv.max_depth = 1.0;
+ }
+
+ drm_intel_bo_unreference(brw->cc.vp_bo);
+ brw->cc.vp_bo = brw_cache_data(&brw->cache, BRW_CC_VP, &ccv, sizeof(ccv),
+ NULL, 0);
+}
+
+const struct brw_tracked_state gen6_cc_vp = {
+ .dirty = {
+ .mesa = _NEW_VIEWPORT | _NEW_TRANSFORM,
+ .brw = 0,
+ .cache = 0,
+ },
+ .prepare = prepare_cc_vp,
+};
+
+static void prepare_viewport_state_pointers(struct brw_context *brw)
+{
+ brw_add_validated_bo(brw, brw->sf.state_bo);
+}
+
+static void upload_viewport_state_pointers(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+
+ BEGIN_BATCH(4);
+ OUT_BATCH(CMD_VIEWPORT_STATE_POINTERS << 16 | (4 - 2) |
+ GEN6_CC_VIEWPORT_MODIFY |
+ GEN6_SF_VIEWPORT_MODIFY |
+ GEN6_CLIP_VIEWPORT_MODIFY);
+ OUT_RELOC(brw->clip.vp_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
+ OUT_RELOC(brw->sf.vp_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
+ OUT_RELOC(brw->cc.vp_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+}
+
+const struct brw_tracked_state gen6_viewport_state = {
+ .dirty = {
+ .mesa = 0,
+ .brw = BRW_NEW_BATCH,
+ .cache = (CACHE_NEW_CLIP_VP |
+ CACHE_NEW_SF_VP |
+ CACHE_NEW_CC_VP)
+ },
+ .prepare = prepare_viewport_state_pointers,
+ .emit = upload_viewport_state_pointers,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
new file mode 100644
index 00000000000..fe597dfb945
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+#include "brw_util.h"
+#include "shader/prog_parameter.h"
+#include "shader/prog_statevars.h"
+#include "intel_batchbuffer.h"
+
+static void
+upload_vs_state(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+ GLcontext *ctx = &intel->ctx;
+ const struct brw_vertex_program *vp =
+ brw_vertex_program_const(brw->vertex_program);
+ unsigned int nr_params = vp->program.Base.Parameters->NumParameters;
+ drm_intel_bo *constant_bo;
+ int i;
+
+ if (vp->use_const_buffer || nr_params == 0) {
+ /* Disable the push constant buffers. */
+ BEGIN_BATCH(5);
+ OUT_BATCH(CMD_3D_CONSTANT_VS_STATE << 16 | (5 - 2));
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+ } else {
+ if (brw->vertex_program->IsNVProgram)
+ _mesa_load_tracked_matrices(ctx);
+
+ /* Updates the ParamaterValues[i] pointers for all parameters of the
+ * basic type of PROGRAM_STATE_VAR.
+ */
+ _mesa_load_state_parameters(ctx, vp->program.Base.Parameters);
+
+ constant_bo = drm_intel_bo_alloc(intel->bufmgr, "VS constant_bo",
+ nr_params * 4 * sizeof(float),
+ 4096);
+ drm_intel_gem_bo_map_gtt(constant_bo);
+ for (i = 0; i < nr_params; i++) {
+ memcpy((char *)constant_bo->virtual + i * 4 * sizeof(float),
+ vp->program.Base.Parameters->ParameterValues[i],
+ 4 * sizeof(float));
+ }
+ drm_intel_gem_bo_unmap_gtt(constant_bo);
+
+ BEGIN_BATCH(5);
+ OUT_BATCH(CMD_3D_CONSTANT_VS_STATE << 16 |
+ GEN6_CONSTANT_BUFFER_0_ENABLE |
+ (5 - 2));
+ OUT_RELOC(constant_bo,
+ I915_GEM_DOMAIN_RENDER, 0, /* XXX: bad domain */
+ ALIGN(nr_params, 2) / 2 - 1);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+
+ drm_intel_bo_unreference(constant_bo);
+ }
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+
+ BEGIN_BATCH(6);
+ OUT_BATCH(CMD_3D_VS_STATE << 16 | (6 - 2));
+ OUT_RELOC(brw->vs.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
+ OUT_BATCH((0 << GEN6_VS_SAMPLER_COUNT_SHIFT) |
+ (brw->vs.nr_surfaces << GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT));
+ OUT_BATCH(0); /* scratch space base offset */
+ OUT_BATCH((1 << GEN6_VS_DISPATCH_START_GRF_SHIFT) |
+ (brw->vs.prog_data->urb_read_length << GEN6_VS_URB_READ_LENGTH_SHIFT) |
+ (0 << GEN6_VS_URB_ENTRY_READ_OFFSET_SHIFT));
+ OUT_BATCH((0 << GEN6_VS_MAX_THREADS_SHIFT) |
+ GEN6_VS_STATISTICS_ENABLE);
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+}
+
+const struct brw_tracked_state gen6_vs_state = {
+ .dirty = {
+ .mesa = _NEW_TRANSFORM | _NEW_PROGRAM_CONSTANTS,
+ .brw = (BRW_NEW_CURBE_OFFSETS |
+ BRW_NEW_NR_VS_SURFACES |
+ BRW_NEW_URB_FENCE |
+ BRW_NEW_CONTEXT),
+ .cache = CACHE_NEW_VS_PROG
+ },
+ .emit = upload_vs_state,
+};
diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c
new file mode 100644
index 00000000000..1eb17ca627d
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -0,0 +1,160 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "brw_context.h"
+#include "brw_state.h"
+#include "brw_defines.h"
+#include "brw_util.h"
+#include "shader/prog_parameter.h"
+#include "shader/prog_statevars.h"
+#include "intel_batchbuffer.h"
+
+static void
+upload_wm_state(struct brw_context *brw)
+{
+ struct intel_context *intel = &brw->intel;
+ GLcontext *ctx = &intel->ctx;
+ const struct brw_fragment_program *fp =
+ brw_fragment_program_const(brw->fragment_program);
+ unsigned int nr_params = fp->program.Base.Parameters->NumParameters;
+ drm_intel_bo *constant_bo;
+ int i;
+ uint32_t dw2, dw4, dw5, dw6;
+
+ if (fp->use_const_buffer || nr_params == 0) {
+ /* Disable the push constant buffers. */
+ BEGIN_BATCH(5);
+ OUT_BATCH(CMD_3D_CONSTANT_PS_STATE << 16 | (5 - 2));
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+ } else {
+ /* Updates the ParamaterValues[i] pointers for all parameters of the
+ * basic type of PROGRAM_STATE_VAR.
+ */
+ _mesa_load_state_parameters(ctx, fp->program.Base.Parameters);
+
+ constant_bo = drm_intel_bo_alloc(intel->bufmgr, "WM constant_bo",
+ nr_params * 4 * sizeof(float),
+ 4096);
+ drm_intel_gem_bo_map_gtt(constant_bo);
+ for (i = 0; i < nr_params; i++) {
+ memcpy((char *)constant_bo->virtual + i * 4 * sizeof(float),
+ fp->program.Base.Parameters->ParameterValues[i],
+ 4 * sizeof(float));
+ }
+ drm_intel_gem_bo_unmap_gtt(constant_bo);
+
+ BEGIN_BATCH(5);
+ OUT_BATCH(CMD_3D_CONSTANT_PS_STATE << 16 |
+ GEN6_CONSTANT_BUFFER_0_ENABLE |
+ (5 - 2));
+ OUT_RELOC(constant_bo,
+ I915_GEM_DOMAIN_RENDER, 0, /* XXX: bad domain */
+ ALIGN(nr_params, 2) / 2 - 1);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
+
+ drm_intel_bo_unreference(constant_bo);
+ }
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+
+ dw2 = dw4 = dw5 = dw6 = 0;
+ dw4 |= GEN6_WM_STATISTICS_ENABLE;
+ dw5 |= GEN6_WM_LINE_AA_WIDTH_1_0;
+ dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5;
+
+ /* BRW_NEW_NR_SURFACES */
+ dw2 |= brw->wm.nr_surfaces << GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT;
+
+ /* CACHE_NEW_SAMPLER */
+ dw2 |= (ALIGN(brw->wm.sampler_count, 4) / 4) << GEN6_WM_SAMPLER_COUNT_SHIFT;
+ dw4 |= (1 << GEN6_WM_DISPATCH_START_GRF_SHIFT_0);
+
+ dw5 |= (40 - 1) << GEN6_WM_MAX_THREADS_SHIFT;
+ dw5 |= GEN6_WM_DISPATCH_ENABLE;
+
+ /* BRW_NEW_FRAGMENT_PROGRAM */
+ if (fp->isGLSL)
+ dw5 |= GEN6_WM_8_DISPATCH_ENABLE;
+ else
+ dw5 |= GEN6_WM_16_DISPATCH_ENABLE;
+
+ /* _NEW_LINE */
+ if (ctx->Line.StippleFlag)
+ dw5 |= GEN6_WM_LINE_STIPPLE_ENABLE;
+
+ /* _NEW_POLYGONSTIPPLE */
+ if (ctx->Polygon.StippleFlag)
+ dw5 |= GEN6_WM_POLYGON_STIPPLE_ENABLE;
+
+ /* BRW_NEW_FRAGMENT_PROGRAM */
+ if (fp->program.Base.InputsRead & (1 << FRAG_ATTRIB_WPOS))
+ dw5 |= GEN6_WM_USES_SOURCE_DEPTH | GEN6_WM_USES_SOURCE_W;
+ if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
+ dw5 |= GEN6_WM_COMPUTED_DEPTH;
+
+ /* _NEW_COLOR */
+ if (fp->program.UsesKill || ctx->Color.AlphaEnabled)
+ dw5 |= GEN6_WM_KILL_ENABLE;
+
+ /* This should probably be FS inputs read */
+ dw6 |= brw_count_bits(brw->vs.prog_data->outputs_written) <<
+ GEN6_WM_NUM_SF_OUTPUTS_SHIFT;
+
+ BEGIN_BATCH(9);
+ OUT_BATCH(CMD_3D_WM_STATE << 16 | (9 - 2));
+ OUT_RELOC(brw->wm.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
+ OUT_BATCH(dw2);
+ OUT_BATCH(0); /* scratch space base offset */
+ OUT_BATCH(dw4);
+ OUT_BATCH(dw5);
+ OUT_BATCH(dw6);
+ OUT_BATCH(0); /* kernel 1 pointer */
+ OUT_BATCH(0); /* kernel 2 pointer */
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_emit_mi_flush(intel->batch);
+}
+
+const struct brw_tracked_state gen6_wm_state = {
+ .dirty = {
+ .mesa = _NEW_LINE | _NEW_POLYGONSTIPPLE | _NEW_COLOR,
+ .brw = (BRW_NEW_CURBE_OFFSETS |
+ BRW_NEW_FRAGMENT_PROGRAM |
+ BRW_NEW_NR_WM_SURFACES |
+ BRW_NEW_URB_FENCE |
+ BRW_NEW_BATCH),
+ .cache = CACHE_NEW_SAMPLER
+ },
+ .emit = upload_wm_state,
+};
diff --git a/src/mesa/drivers/dri/i965/server/intel_dri.c b/src/mesa/drivers/dri/i965/server/intel_dri.c
deleted file mode 120000
index effdd26448a..00000000000
--- a/src/mesa/drivers/dri/i965/server/intel_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../intel/server/intel_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index ae0f8a16f95..9768b0deee7 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -104,7 +104,8 @@ do_flush_locked(struct intel_batchbuffer *batch, GLuint used)
batch->map = NULL;
batch->ptr = NULL;
- dri_bo_exec(batch->buf, used, NULL, 0, (x_off & 0xffff) | (y_off << 16));
+ if (!intel->no_hw)
+ dri_bo_exec(batch->buf, used, NULL, 0, (x_off & 0xffff) | (y_off << 16));
if (INTEL_DEBUG & DEBUG_BATCH) {
dri_bo_map(batch->buf, GL_FALSE);
@@ -158,9 +159,10 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
}
/* Mark the end of the buffer. */
- *(GLuint *) (batch->ptr) = MI_BATCH_BUFFER_END; /* noop */
+ *(GLuint *) (batch->ptr) = MI_BATCH_BUFFER_END;
batch->ptr += 4;
used = batch->ptr - batch->map;
+ assert (used <= batch->buf->size);
/* Workaround for recursive batchbuffer flushing: If the window is
* moved, we can get into a case where we try to flush during a
@@ -208,9 +210,11 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
{
int ret;
+ assert(delta < buffer->size);
+
if (batch->ptr - batch->map > batch->buf->size)
- _mesa_printf ("bad relocation ptr %p map %p offset %d size %d\n",
- batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size);
+ printf ("bad relocation ptr %p map %p offset %d size %lu\n",
+ batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size);
ret = dri_bo_emit_reloc(batch->buf, read_domains, write_domain,
delta, batch->ptr - batch->map, buffer);
@@ -224,6 +228,33 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
return GL_TRUE;
}
+GLboolean
+intel_batchbuffer_emit_reloc_fenced(struct intel_batchbuffer *batch,
+ drm_intel_bo *buffer,
+ uint32_t read_domains, uint32_t write_domain,
+ uint32_t delta)
+{
+ int ret;
+
+ assert(delta < buffer->size);
+
+ if (batch->ptr - batch->map > batch->buf->size)
+ printf ("bad relocation ptr %p map %p offset %d size %lu\n",
+ batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size);
+ ret = drm_intel_bo_emit_reloc_fence(batch->buf, batch->ptr - batch->map,
+ buffer, delta,
+ read_domains, write_domain);
+
+ /*
+ * Using the old buffer offset, write in what the right data would
+ * be, in case the buffer doesn't move and we can short-circuit the
+ * relocation processing in the kernel
+ */
+ intel_batchbuffer_emit_dword (batch, buffer->offset + delta);
+
+ return GL_TRUE;
+}
+
void
intel_batchbuffer_data(struct intel_batchbuffer *batch,
const void *data, GLuint bytes)
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index b052b724d84..e5ad2617ab9 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -24,11 +24,13 @@ struct intel_batchbuffer
GLuint size;
+#ifdef DEBUG
/** Tracking of BEGIN_BATCH()/OUT_BATCH()/ADVANCE_BATCH() debugging */
struct {
GLuint total;
GLubyte *start_ptr;
} emit;
+#endif
GLuint dirty_state;
GLuint reserved_space;
@@ -64,8 +66,24 @@ GLboolean intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
uint32_t read_domains,
uint32_t write_domain,
uint32_t offset);
+GLboolean intel_batchbuffer_emit_reloc_fenced(struct intel_batchbuffer *batch,
+ drm_intel_bo *buffer,
+ uint32_t read_domains,
+ uint32_t write_domain,
+ uint32_t offset);
void intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch);
+static INLINE uint32_t float_as_int(float f)
+{
+ union {
+ float f;
+ uint32_t d;
+ } fi;
+
+ fi.f = f;
+ return fi.d;
+}
+
/* Inline functions - might actually be better off with these
* non-inlined. Certainly better off switching all command packets to
* be passed as structs rather than dwords, but that's a little bit of
@@ -81,49 +99,73 @@ intel_batchbuffer_space(struct intel_batchbuffer *batch)
static INLINE void
intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch, GLuint dword)
{
- assert(batch->map);
+#ifdef DEBUG
assert(intel_batchbuffer_space(batch) >= 4);
+#endif
*(GLuint *) (batch->ptr) = dword;
batch->ptr += 4;
}
static INLINE void
+intel_batchbuffer_emit_float(struct intel_batchbuffer *batch, float f)
+{
+ intel_batchbuffer_emit_dword(batch, float_as_int(f));
+}
+
+static INLINE void
intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
GLuint sz)
{
+#ifdef DEBUG
assert(sz < batch->size - 8);
+#endif
if (intel_batchbuffer_space(batch) < sz)
intel_batchbuffer_flush(batch);
}
+static INLINE void
+intel_batchbuffer_begin(struct intel_batchbuffer *batch, int n)
+{
+ intel_batchbuffer_require_space(batch, n * 4);
+#ifdef DEBUG
+ assert(batch->map);
+ assert(batch->emit.start_ptr == NULL);
+ batch->emit.total = n * 4;
+ batch->emit.start_ptr = batch->ptr;
+#endif
+}
+
+static INLINE void
+intel_batchbuffer_advance(struct intel_batchbuffer *batch)
+{
+#ifdef DEBUG
+ unsigned int _n = batch->ptr - batch->emit.start_ptr;
+ assert(batch->emit.start_ptr != NULL);
+ if (_n != batch->emit.total) {
+ fprintf(stderr, "ADVANCE_BATCH: %d of %d dwords emitted\n",
+ _n, batch->emit.total);
+ abort();
+ }
+ batch->emit.start_ptr = NULL;
+#endif
+}
+
/* Here are the crusty old macros, to be removed:
*/
#define BATCH_LOCALS
-#define BEGIN_BATCH(n) do { \
- intel_batchbuffer_require_space(intel->batch, (n)*4); \
- assert(intel->batch->emit.start_ptr == NULL); \
- intel->batch->emit.total = (n) * 4; \
- intel->batch->emit.start_ptr = intel->batch->ptr; \
-} while (0)
-
+#define BEGIN_BATCH(n) intel_batchbuffer_begin(intel->batch, n)
#define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d)
-
+#define OUT_BATCH_F(f) intel_batchbuffer_emit_float(intel->batch,f)
#define OUT_RELOC(buf, read_domains, write_domain, delta) do { \
- assert((unsigned) (delta) < buf->size); \
intel_batchbuffer_emit_reloc(intel->batch, buf, \
read_domains, write_domain, delta); \
} while (0)
+#define OUT_RELOC_FENCED(buf, read_domains, write_domain, delta) do { \
+ intel_batchbuffer_emit_reloc_fenced(intel->batch, buf, \
+ read_domains, write_domain, delta); \
+} while (0)
-#define ADVANCE_BATCH() do { \
- unsigned int _n = intel->batch->ptr - intel->batch->emit.start_ptr; \
- assert(intel->batch->emit.start_ptr != NULL); \
- if (_n != intel->batch->emit.total) { \
- fprintf(stderr, "ADVANCE_BATCH: %d of %d dwords emitted\n", \
- _n, intel->batch->emit.total); \
- abort(); \
- } \
- intel->batch->emit.start_ptr = NULL; \
-} while(0)
+#define ADVANCE_BATCH() intel_batchbuffer_advance(intel->batch);
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 5a60a17500e..f2769aa3e8c 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -89,6 +89,10 @@ intelEmitCopyBlit(struct intel_context *intel,
dri_bo *aper_array[3];
BATCH_LOCALS;
+ /* Blits are in a different ringbuffer so we don't use them. */
+ if (intel->gen >= 6)
+ return GL_FALSE;
+
if (dst_tiling != I915_TILING_NONE) {
if (dst_offset & 4095)
return GL_FALSE;
@@ -118,21 +122,20 @@ intelEmitCopyBlit(struct intel_context *intel,
intel_prepare_render(intel);
if (pass >= 2) {
- dri_bo_map(dst_buffer, GL_TRUE);
- dri_bo_map(src_buffer, GL_FALSE);
- _mesa_copy_rect((GLubyte *)dst_buffer->virtual + dst_offset,
- cpp,
- dst_pitch,
- dst_x, dst_y,
- w, h,
- (GLubyte *)src_buffer->virtual + src_offset,
- src_pitch,
- src_x, src_y);
-
- dri_bo_unmap(src_buffer);
- dri_bo_unmap(dst_buffer);
-
- return GL_TRUE;
+ drm_intel_gem_bo_map_gtt(dst_buffer);
+ drm_intel_gem_bo_map_gtt(src_buffer);
+ _mesa_copy_rect((GLubyte *)dst_buffer->virtual + dst_offset,
+ cpp,
+ dst_pitch,
+ dst_x, dst_y,
+ w, h,
+ (GLubyte *)src_buffer->virtual + src_offset,
+ src_pitch,
+ src_x, src_y);
+ drm_intel_gem_bo_unmap_gtt(src_buffer);
+ drm_intel_gem_bo_unmap_gtt(dst_buffer);
+
+ return GL_TRUE;
}
intel_batchbuffer_require_space(intel->batch, 8 * 4);
@@ -185,14 +188,14 @@ intelEmitCopyBlit(struct intel_context *intel,
OUT_BATCH(BR13 | (uint16_t)dst_pitch);
OUT_BATCH((dst_y << 16) | dst_x);
OUT_BATCH((dst_y2 << 16) | dst_x2);
- OUT_RELOC(dst_buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- dst_offset);
+ OUT_RELOC_FENCED(dst_buffer,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ dst_offset);
OUT_BATCH((src_y << 16) | src_x);
OUT_BATCH((uint16_t)src_pitch);
- OUT_RELOC(src_buffer,
- I915_GEM_DOMAIN_RENDER, 0,
- src_offset);
+ OUT_RELOC_FENCED(src_buffer,
+ I915_GEM_DOMAIN_RENDER, 0,
+ src_offset);
ADVANCE_BATCH();
intel_batchbuffer_emit_mi_flush(intel->batch);
@@ -218,6 +221,9 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
GLint cx, cy, cw, ch;
BATCH_LOCALS;
+ /* Blits are in a different ringbuffer so we don't use them. */
+ assert(intel->gen < 6);
+
/*
* Compute values for clearing the buffers.
*/
@@ -359,9 +365,9 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
OUT_BATCH(BR13);
OUT_BATCH((y1 << 16) | x1);
OUT_BATCH((y2 << 16) | x2);
- OUT_RELOC(write_buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- 0);
+ OUT_RELOC_FENCED(write_buffer,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ 0);
OUT_BATCH(clear_val);
ADVANCE_BATCH();
@@ -388,6 +394,10 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
int dwords = ALIGN(src_size, 8) / 4;
uint32_t opcode, br13, blit_cmd;
+ /* Blits are in a different ringbuffer so we don't use them. */
+ if (intel->gen >= 6)
+ return GL_FALSE;
+
if (dst_tiling != I915_TILING_NONE) {
if (dst_offset & 4095)
return GL_FALSE;
@@ -438,9 +448,9 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
OUT_BATCH(br13);
OUT_BATCH((0 << 16) | 0); /* clip x1, y1 */
OUT_BATCH((100 << 16) | 100); /* clip x2, y2 */
- OUT_RELOC(dst_buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- dst_offset);
+ OUT_RELOC_FENCED(dst_buffer,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ dst_offset);
OUT_BATCH(0); /* bg */
OUT_BATCH(fg_color); /* fg */
OUT_BATCH(0); /* pattern base addr */
@@ -473,6 +483,9 @@ intel_emit_linear_blit(struct intel_context *intel,
{
GLuint pitch, height;
+ /* Blits are in a different ringbuffer so we don't use them. */
+ assert(intel->gen < 6);
+
/* The pitch is a signed value. */
pitch = MIN2(size, (1 << 15) - 1);
height = size / pitch;
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 3b7015b5ad3..103aaf2b956 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -31,10 +31,12 @@
#include "main/macros.h"
#include "main/bufferobj.h"
-#include "intel_context.h"
#include "intel_blit.h"
#include "intel_buffer_objects.h"
#include "intel_batchbuffer.h"
+#include "intel_context.h"
+#include "intel_fbo.h"
+#include "intel_mipmap_tree.h"
#include "intel_regions.h"
static GLboolean
@@ -113,7 +115,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
if (obj->Pointer)
intel_bufferobj_unmap(ctx, 0, obj);
- _mesa_free(intel_obj->sys_buffer);
+ free(intel_obj->sys_buffer);
if (intel_obj->region) {
intel_bufferobj_release_region(intel, intel_obj);
}
@@ -121,7 +123,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
dri_bo_unreference(intel_obj->buffer);
}
- _mesa_free(intel_obj);
+ free(intel_obj);
}
@@ -155,7 +157,7 @@ intel_bufferobj_data(GLcontext * ctx,
dri_bo_unreference(intel_obj->buffer);
intel_obj->buffer = NULL;
}
- _mesa_free(intel_obj->sys_buffer);
+ free(intel_obj->sys_buffer);
intel_obj->sys_buffer = NULL;
if (size != 0) {
@@ -164,7 +166,7 @@ intel_bufferobj_data(GLcontext * ctx,
* with their contents anyway.
*/
if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) {
- intel_obj->sys_buffer = _mesa_malloc(size);
+ intel_obj->sys_buffer = malloc(size);
if (intel_obj->sys_buffer != NULL) {
if (data != NULL)
memcpy(intel_obj->sys_buffer, data, size);
@@ -285,7 +287,7 @@ intel_bufferobj_map(GLcontext * ctx,
return NULL;
}
- if (write_only && intel->intelScreen->kernel_exec_fencing) {
+ if (write_only) {
drm_intel_gem_bo_map_gtt(intel_obj->buffer);
intel_obj->mapped_gtt = GL_TRUE;
} else {
@@ -373,14 +375,13 @@ intel_bufferobj_map_range(GLcontext * ctx,
if ((access & GL_MAP_INVALIDATE_RANGE_BIT) &&
drm_intel_bo_busy(intel_obj->buffer)) {
if (access & GL_MAP_FLUSH_EXPLICIT_BIT) {
- intel_obj->range_map_buffer = _mesa_malloc(length);
+ intel_obj->range_map_buffer = malloc(length);
obj->Pointer = intel_obj->range_map_buffer;
} else {
intel_obj->range_map_bo = drm_intel_bo_alloc(intel->bufmgr,
"range map",
length, 64);
- if (!(access & GL_MAP_READ_BIT) &&
- intel->intelScreen->kernel_exec_fencing) {
+ if (!(access & GL_MAP_READ_BIT)) {
drm_intel_gem_bo_map_gtt(intel_obj->range_map_bo);
intel_obj->mapped_gtt = GL_TRUE;
} else {
@@ -393,8 +394,7 @@ intel_bufferobj_map_range(GLcontext * ctx,
return obj->Pointer;
}
- if (!(access & GL_MAP_READ_BIT) &&
- intel->intelScreen->kernel_exec_fencing) {
+ if (!(access & GL_MAP_READ_BIT)) {
drm_intel_gem_bo_map_gtt(intel_obj->buffer);
intel_obj->mapped_gtt = GL_TRUE;
} else {
@@ -523,7 +523,7 @@ intel_bufferobj_buffer(struct intel_context *intel,
intel_obj->Base.Size,
sys_buffer,
&intel_obj->Base);
- _mesa_free(sys_buffer);
+ free(sys_buffer);
intel_obj->sys_buffer = NULL;
}
@@ -588,6 +588,126 @@ intel_bufferobj_copy_subdata(GLcontext *ctx,
intel_batchbuffer_emit_mi_flush(intel->batch);
}
+#if FEATURE_APPLE_object_purgeable
+static GLenum
+intel_buffer_purgeable(GLcontext * ctx,
+ drm_intel_bo *buffer,
+ GLenum option)
+{
+ int retained = 0;
+
+ if (buffer != NULL)
+ retained = drm_intel_bo_madvise (buffer, I915_MADV_DONTNEED);
+
+ return retained ? GL_VOLATILE_APPLE : GL_RELEASED_APPLE;
+}
+
+static GLenum
+intel_buffer_object_purgeable(GLcontext * ctx,
+ struct gl_buffer_object *obj,
+ GLenum option)
+{
+ struct intel_buffer_object *intel;
+
+ intel = intel_buffer_object (obj);
+ if (intel->buffer != NULL)
+ return intel_buffer_purgeable (ctx, intel->buffer, option);
+
+ if (option == GL_RELEASED_APPLE) {
+ if (intel->sys_buffer != NULL) {
+ free(intel->sys_buffer);
+ intel->sys_buffer = NULL;
+ }
+
+ return GL_RELEASED_APPLE;
+ } else {
+ /* XXX Create the buffer and madvise(MADV_DONTNEED)? */
+ return intel_buffer_purgeable (ctx,
+ intel_bufferobj_buffer(intel_context(ctx),
+ intel, INTEL_READ),
+ option);
+ }
+}
+
+static GLenum
+intel_texture_object_purgeable(GLcontext * ctx,
+ struct gl_texture_object *obj,
+ GLenum option)
+{
+ struct intel_texture_object *intel;
+
+ intel = intel_texture_object(obj);
+ if (intel->mt == NULL || intel->mt->region == NULL)
+ return GL_RELEASED_APPLE;
+
+ return intel_buffer_purgeable (ctx, intel->mt->region->buffer, option);
+}
+
+static GLenum
+intel_render_object_purgeable(GLcontext * ctx,
+ struct gl_renderbuffer *obj,
+ GLenum option)
+{
+ struct intel_renderbuffer *intel;
+
+ intel = intel_renderbuffer(obj);
+ if (intel->region == NULL)
+ return GL_RELEASED_APPLE;
+
+ return intel_buffer_purgeable (ctx, intel->region->buffer, option);
+}
+
+static GLenum
+intel_buffer_unpurgeable(GLcontext * ctx,
+ drm_intel_bo *buffer,
+ GLenum option)
+{
+ int retained;
+
+ retained = 0;
+ if (buffer != NULL)
+ retained = drm_intel_bo_madvise (buffer, I915_MADV_WILLNEED);
+
+ return retained ? GL_RETAINED_APPLE : GL_UNDEFINED_APPLE;
+}
+
+static GLenum
+intel_buffer_object_unpurgeable(GLcontext * ctx,
+ struct gl_buffer_object *obj,
+ GLenum option)
+{
+ return intel_buffer_unpurgeable (ctx, intel_buffer_object (obj)->buffer, option);
+}
+
+static GLenum
+intel_texture_object_unpurgeable(GLcontext * ctx,
+ struct gl_texture_object *obj,
+ GLenum option)
+{
+ struct intel_texture_object *intel;
+
+ intel = intel_texture_object(obj);
+ if (intel->mt == NULL || intel->mt->region == NULL)
+ return GL_UNDEFINED_APPLE;
+
+ return intel_buffer_unpurgeable (ctx, intel->mt->region->buffer, option);
+}
+
+static GLenum
+intel_render_object_unpurgeable(GLcontext * ctx,
+ struct gl_renderbuffer *obj,
+ GLenum option)
+{
+ struct intel_renderbuffer *intel;
+
+ intel = intel_renderbuffer(obj);
+ if (intel->region == NULL)
+ return GL_UNDEFINED_APPLE;
+
+ return intel_buffer_unpurgeable (ctx, intel->region->buffer, option);
+}
+#endif
+
void
intelInitBufferObjectFuncs(struct dd_function_table *functions)
{
@@ -601,4 +721,14 @@ intelInitBufferObjectFuncs(struct dd_function_table *functions)
functions->FlushMappedBufferRange = intel_bufferobj_flush_mapped_range;
functions->UnmapBuffer = intel_bufferobj_unmap;
functions->CopyBufferSubData = intel_bufferobj_copy_subdata;
+
+#if FEATURE_APPLE_object_purgeable
+ functions->BufferObjectPurgeable = intel_buffer_object_purgeable;
+ functions->TextureObjectPurgeable = intel_texture_object_purgeable;
+ functions->RenderObjectPurgeable = intel_render_object_purgeable;
+
+ functions->BufferObjectUnpurgeable = intel_buffer_object_unpurgeable;
+ functions->TextureObjectUnpurgeable = intel_texture_object_unpurgeable;
+ functions->RenderObjectUnpurgeable = intel_render_object_unpurgeable;
+#endif
}
diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h
index 3dc8653a735..a0b22669253 100644
--- a/src/mesa/drivers/dri/intel/intel_chipset.h
+++ b/src/mesa/drivers/dri/intel/intel_chipset.h
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright © 2007 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -71,6 +71,8 @@
#define PCI_CHIP_ILD_G 0x0042
#define PCI_CHIP_ILM_G 0x0046
+#define PCI_CHIP_SANDYBRIDGE 0x0102
+
#define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \
devid == PCI_CHIP_I915_GM || \
devid == PCI_CHIP_I945_GM || \
@@ -104,14 +106,20 @@
devid == PCI_CHIP_Q33_G || \
devid == PCI_CHIP_Q35_G || IS_IGD(devid))
-#define IS_965(devid) (devid == PCI_CHIP_I965_G || \
+#define IS_GEN4(devid) (devid == PCI_CHIP_I965_G || \
devid == PCI_CHIP_I965_Q || \
devid == PCI_CHIP_I965_G_1 || \
devid == PCI_CHIP_I965_GM || \
devid == PCI_CHIP_I965_GME || \
devid == PCI_CHIP_I946_GZ || \
+ IS_G4X(devid))
+
+#define IS_GEN6(devid) (devid == PCI_CHIP_SANDYBRIDGE)
+
+#define IS_965(devid) (IS_GEN4(devid) || \
IS_G4X(devid) || \
- IS_IGDNG(devid))
+ IS_IGDNG(devid) || \
+ IS_GEN6(devid))
#define IS_9XX(devid) (IS_915(devid) || \
IS_945(devid) || \
diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c
index ca78681538c..03b24e2b51f 100644
--- a/src/mesa/drivers/dri/intel/intel_clear.c
+++ b/src/mesa/drivers/dri/intel/intel_clear.c
@@ -133,6 +133,12 @@ intelClear(GLcontext *ctx, GLbitfield mask)
}
}
+ if (intel->gen >= 6) {
+ /* Blits are in a different ringbuffer so we don't use them. */
+ tri_mask |= blit_mask;
+ blit_mask = 0;
+ }
+
/* SW fallback clearing */
swrast_mask = mask & ~tri_mask & ~blit_mask;
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 8f37fb82c1a..d6a1ba69524 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -206,6 +206,11 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
if (intel->is_front_buffer_rendering)
intel_flush(&intel->ctx, GL_FALSE);
+ /* Set this up front, so that in case our buffers get invalidated
+ * while we're getting new buffers, we don't clobber the stamp and
+ * thus ignore the invalidate. */
+ drawable->lastStamp = drawable->dri2.stamp;
+
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable);
@@ -376,7 +381,6 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
}
driUpdateFramebufferSize(&intel->ctx, drawable);
- drawable->lastStamp = drawable->dri2.stamp;
}
void
@@ -590,9 +594,13 @@ intelInitContext(struct intel_context *intel,
struct intel_screen *intelScreen = sPriv->private;
int bo_reuse_mode;
+ /* we can't do anything without a connection to the device */
+ if (intelScreen->bufmgr == NULL)
+ return GL_FALSE;
+
if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx,
functions, (void *) intel)) {
- _mesa_printf("%s: failed to init mesa context\n", __FUNCTION__);
+ printf("%s: failed to init mesa context\n", __FUNCTION__);
return GL_FALSE;
}
@@ -602,7 +610,11 @@ intelInitContext(struct intel_context *intel,
intel->driContext = driContextPriv;
intel->driFd = sPriv->fd;
- if (IS_965(intel->intelScreen->deviceID)) {
+ if (IS_GEN6(intel->intelScreen->deviceID)) {
+ intel->gen = 6;
+ intel->needs_ff_sync = GL_TRUE;
+ intel->has_luminance_srgb = GL_TRUE;
+ } else if (IS_965(intel->intelScreen->deviceID)) {
intel->gen = 4;
} else if (IS_9XX(intel->intelScreen->deviceID)) {
intel->gen = 3;
@@ -743,12 +755,6 @@ intelInitContext(struct intel_context *intel,
}
intel->use_texture_tiling = driQueryOptionb(&intel->optionCache,
"texture_tiling");
- if (intel->use_texture_tiling &&
- !intel->intelScreen->kernel_exec_fencing) {
- fprintf(stderr, "No kernel support for execution fencing, "
- "disabling texture tiling\n");
- intel->use_texture_tiling = GL_FALSE;
- }
intel->use_early_z = driQueryOptionb(&intel->optionCache, "early_z");
intel->prim.primitive = ~0;
@@ -879,6 +885,7 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
intel->driDrawable = driDrawPriv;
driContextPriv->dri2.draw_stamp = driDrawPriv->dri2.stamp - 1;
driContextPriv->dri2.read_stamp = driReadPriv->dri2.stamp - 1;
+ intel_prepare_render(intel);
}
else {
_mesa_make_current(NULL, NULL, NULL);
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index da5d901abf9..22736a93279 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -345,7 +345,7 @@ extern int INTEL_DEBUG;
#define DBG(...) do { \
if (INTEL_DEBUG & FILE_DEBUG_FLAG) \
- _mesa_printf(__VA_ARGS__); \
+ printf(__VA_ARGS__); \
} while(0)
#define PCI_CHIP_845_G 0x2562
@@ -475,25 +475,4 @@ is_power_of_two(uint32_t value)
return (value & (value - 1)) == 0;
}
-static INLINE void
-intel_bo_map_gtt_preferred(struct intel_context *intel,
- drm_intel_bo *bo,
- GLboolean write)
-{
- if (intel->intelScreen->kernel_exec_fencing)
- drm_intel_gem_bo_map_gtt(bo);
- else
- drm_intel_bo_map(bo, write);
-}
-
-static INLINE void
-intel_bo_unmap_gtt_preferred(struct intel_context *intel,
- drm_intel_bo *bo)
-{
- if (intel->intelScreen->kernel_exec_fencing)
- drm_intel_gem_bo_unmap_gtt(bo);
- else
- drm_intel_bo_unmap(bo);
-}
-
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_decode.c b/src/mesa/drivers/dri/intel/intel_decode.c
index a9dfe281cbd..5293482b35a 100644
--- a/src/mesa/drivers/dri/intel/intel_decode.c
+++ b/src/mesa/drivers/dri/intel/intel_decode.c
@@ -1437,6 +1437,12 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
{ 0x7909, 2, 2, "3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP" },
{ 0x790a, 3, 3, "3DSTATE_AA_LINE_PARAMETERS" },
{ 0x7b00, 6, 6, "3DPRIMITIVE" },
+ { 0x780e, 4, 4, "3DSTATE_CC_STATE_POINTERS" },
+ { 0x7810, 6, 6, "3DSTATE_VS_STATE" },
+ { 0x7811, 6, 6, "3DSTATE_GS_STATE" },
+ { 0x7812, 4, 4, "3DSTATE_CLIP_STATE" },
+ { 0x7815, 5, 5, "3DSTATE_CONSTANT_VS_STATE" },
+ { 0x7816, 5, 5, "3DSTATE_CONSTANT_GS_STATE" },
};
len = (data[0] & 0x0000ffff) + 2;
@@ -1592,7 +1598,7 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
return len;
case 0x7905:
- if (len != 5 && len != 6)
+ if (len < 5 || len > 7)
fprintf(out, "Bad count in 3DSTATE_DEPTH_BUFFER\n");
if (count < len)
BUFFER_FAIL(count, len, "3DSTATE_DEPTH_BUFFER");
@@ -1611,6 +1617,8 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
instr_out(data, hw_offset, 4, "volume depth\n");
if (len == 6)
instr_out(data, hw_offset, 5, "\n");
+ if (len == 7)
+ instr_out(data, hw_offset, 6, "render target view extent\n");
return len;
diff --git a/src/mesa/drivers/dri/intel/intel_depthtmp.h b/src/mesa/drivers/dri/intel/intel_depthtmp.h
deleted file mode 100644
index a9c75d44cf3..00000000000
--- a/src/mesa/drivers/dri/intel/intel_depthtmp.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright © 2009 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-/**
- * Wrapper around the depthtmp.h macrofest to generate spans code for
- * all the tiling styles.
- */
-
-#define VALUE_TYPE INTEL_VALUE_TYPE
-#define WRITE_DEPTH(_x, _y, d) \
- (*(INTEL_VALUE_TYPE *)(irb->region->buffer->virtual + \
- NO_TILE(_x, _y)) = d)
-#define READ_DEPTH(d, _x, _y) \
- d = *(INTEL_VALUE_TYPE *)(irb->region->buffer->virtual + \
- NO_TILE(_x, _y))
-#define TAG(x) INTEL_TAG(intel_gttmap_##x)
-#include "depthtmp.h"
-
-#define VALUE_TYPE INTEL_VALUE_TYPE
-#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(NO_TILE(_x, _y), d)
-#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(NO_TILE(_x, _y))
-#define TAG(x) INTEL_TAG(intel##x)
-#include "depthtmp.h"
-
-#define VALUE_TYPE INTEL_VALUE_TYPE
-#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(X_TILE(_x, _y), d)
-#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(X_TILE(_x, _y))
-#define TAG(x) INTEL_TAG(intel_XTile_##x)
-#include "depthtmp.h"
-
-#define VALUE_TYPE INTEL_VALUE_TYPE
-#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(Y_TILE(_x, _y), d)
-#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(Y_TILE(_x, _y))
-#define TAG(x) INTEL_TAG(intel_YTile_##x)
-#include "depthtmp.h"
-
-#undef INTEL_VALUE_TYPE
-#undef INTEL_WRITE_DEPTH
-#undef INTEL_READ_DEPTH
-#undef INTEL_TAG
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index 84c8d013e30..a1aac699c91 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -58,6 +58,7 @@
#define need_GL_EXT_secondary_color
#define need_GL_EXT_stencil_two_side
#define need_GL_APPLE_vertex_array_object
+#define need_GL_APPLE_object_purgeable
#define need_GL_ATI_separate_stencil
#define need_GL_ATI_envmap_bumpmap
#define need_GL_NV_point_sprite
@@ -121,6 +122,7 @@ static const struct dri_extension card_extensions[] = {
{ "GL_EXT_texture_lod_bias", NULL },
{ "GL_3DFX_texture_compression_FXT1", NULL },
{ "GL_APPLE_client_storage", NULL },
+ { "GL_APPLE_object_purgeable", GL_APPLE_object_purgeable_functions },
{ "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions},
{ "GL_MESA_pack_invert", NULL },
{ "GL_MESA_ycbcr_texture", NULL },
@@ -151,6 +153,7 @@ static const struct dri_extension i915_extensions[] = {
static const struct dri_extension brw_extensions[] = {
{ "GL_ARB_depth_clamp", NULL },
{ "GL_ARB_depth_texture", NULL },
+ { "GL_ARB_fragment_coord_conventions", NULL },
{ "GL_ARB_fragment_program", NULL },
{ "GL_ARB_fragment_program_shadow", NULL },
{ "GL_ARB_fragment_shader", NULL },
@@ -181,6 +184,7 @@ static const struct dri_extension arb_oq_extensions[] = {
{ NULL, NULL }
};
+
static const struct dri_extension fragment_shader_extensions[] = {
{ "GL_ARB_fragment_shader", NULL },
{ NULL, NULL }
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index d58ffd95fa6..a429f8d003d 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -70,14 +70,11 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb)
ASSERT(irb);
- if (irb->span_cache != NULL)
- _mesa_free(irb->span_cache);
-
if (intel && irb->region) {
intel_region_release(&irb->region);
}
- _mesa_free(irb);
+ free(irb);
}
@@ -200,6 +197,38 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
}
+#if FEATURE_OES_EGL_image
+static void
+intel_image_target_renderbuffer_storage(GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ void *image_handle)
+{
+ struct intel_context *intel = intel_context(ctx);
+ struct intel_renderbuffer *irb;
+ __DRIscreen *screen;
+ __DRIimage *image;
+
+ screen = intel->intelScreen->driScrnPriv;
+ image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle,
+ intel->driContext->loaderPrivate);
+ if (image == NULL)
+ return;
+
+ irb = intel_renderbuffer(rb);
+ if (irb->region)
+ intel_region_release(&irb->region);
+ intel_region_reference(&irb->region, image->region);
+
+ rb->InternalFormat = image->internal_format;
+ rb->Width = image->region->width;
+ rb->Height = image->region->height;
+ rb->Format = image->format;
+ rb->DataType = image->data_type;
+ rb->_BaseFormat = _mesa_base_fbo_format(&intel->ctx,
+ image->internal_format);
+}
+#endif
+
/**
* Called for each hardware renderbuffer when a _window_ is resized.
* Just update fields.
@@ -316,7 +345,7 @@ intel_create_renderbuffer(gl_format format)
default:
_mesa_problem(NULL,
"Unexpected intFormat in intel_create_renderbuffer");
- _mesa_free(irb);
+ free(irb);
return NULL;
}
@@ -468,7 +497,7 @@ intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
irb->Base.ClassID = INTEL_RB_CLASS;
if (!intel_update_wrapper(ctx, irb, texImage)) {
- _mesa_free(irb);
+ free(irb);
return NULL;
}
@@ -525,7 +554,7 @@ intel_render_texture(GLcontext * ctx,
return;
}
- DBG("Begin render texture tid %x tex=%u w=%d h=%d refcount=%d\n",
+ DBG("Begin render texture tid %lx tex=%u w=%d h=%d refcount=%d\n",
_glthread_GetID(),
att->Texture->Name, newImage->Width, newImage->Height,
irb->Base.RefCount);
@@ -651,4 +680,9 @@ intel_fbo_init(struct intel_context *intel)
intel->ctx.Driver.ResizeBuffers = intel_resize_buffers;
intel->ctx.Driver.ValidateFramebuffer = intel_validate_framebuffer;
intel->ctx.Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer;
+
+#if FEATURE_OES_EGL_image
+ intel->ctx.Driver.EGLImageTargetRenderbufferStorage =
+ intel_image_target_renderbuffer_storage;
+#endif
}
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h
index 586dbbbb25a..72413f73694 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -40,9 +40,6 @@ struct intel_renderbuffer
{
struct gl_renderbuffer Base;
struct intel_region *region;
-
- uint8_t *span_cache;
- unsigned long span_cache_offset;
};
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index cb5a341050b..4f14946ec72 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -119,8 +119,7 @@ intel_miptree_create(struct intel_context *intel,
struct intel_mipmap_tree *mt;
uint32_t tiling;
- if (intel->use_texture_tiling && compress_byte == 0 &&
- intel->intelScreen->kernel_exec_fencing) {
+ if (intel->use_texture_tiling && compress_byte == 0) {
if (intel->gen >= 4 &&
(base_format == GL_DEPTH_COMPONENT ||
base_format == GL_DEPTH_STENCIL_EXT))
@@ -238,11 +237,11 @@ int intel_miptree_pitch_align (struct intel_context *intel,
pitch = ALIGN(pitch * mt->cpp, pitch_align);
#ifdef I915
- /* XXX: At least the i915 seems very upset when the pitch is a multiple
- * of 1024 and sometimes 512 bytes - performance can drop by several
- * times. Go to the next multiple of the required alignment for now.
+ /* Do a little adjustment to linear allocations so that we avoid
+ * hitting the same channel of memory for 2 different pages when
+ * reading a 2x2 subspan or doing bilinear filtering.
*/
- if (!(pitch & 511) &&
+ if (tiling == I915_TILING_NONE && !(pitch & 511) &&
(pitch + pitch_align) < (1 << ctx->Const.MaxTextureLevels))
pitch += pitch_align;
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index eabfbf4af94..076fee89bdd 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -123,7 +123,7 @@ static GLuint get_bitmap_rect(GLsizei width, GLsizei height,
GLuint count = 0;
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s %d,%d %dx%d bitmap %dx%d skip %d src_offset %d mask %d\n",
+ printf("%s %d,%d %dx%d bitmap %dx%d skip %d src_offset %d mask %d\n",
__FUNCTION__, x,y,w,h,width,height,unpack->SkipPixels, src_offset, mask);
if (invert) {
@@ -395,7 +395,7 @@ intel_texture_bitmap(GLcontext * ctx,
}
/* Convert the A1 bitmap to an A8 format suitable for glTexImage */
- a8_bitmap = _mesa_calloc(width * height);
+ a8_bitmap = calloc(1, width * height);
_mesa_expand_bitmap(width, height, unpack, bitmap, a8_bitmap, width, 0xff);
if (_mesa_is_bufferobj(unpack->BufferObj)) {
@@ -430,7 +430,7 @@ intel_texture_bitmap(GLcontext * ctx,
_mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 1);
_mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0,
GL_ALPHA, GL_UNSIGNED_BYTE, a8_bitmap);
- _mesa_free(a8_bitmap);
+ free(a8_bitmap);
meta_set_fragment_program(&intel->meta, &intel->meta.bitmap_fp, fp);
_mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0,
@@ -516,7 +516,7 @@ intelBitmap(GLcontext * ctx,
return;
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
+ printf("%s: fallback to swrast\n", __FUNCTION__);
_swrast_Bitmap(ctx, x, y, width, height, unpack, pixels);
}
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index 10177228bd8..bd1dd13fb7d 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -147,7 +147,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
/* Unpack the supplied stencil values into a ubyte buffer. */
assert(sizeof(GLstencil) == sizeof(GLubyte));
- stencil_pixels = _mesa_malloc(width * height * sizeof(GLstencil));
+ stencil_pixels = malloc(width * height * sizeof(GLstencil));
for (row = 0; row < height; row++) {
GLvoid *source = _mesa_image_address2d(unpack, pixels,
width, height,
@@ -201,7 +201,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
_mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, width, height, 0,
GL_RED, GL_UNSIGNED_BYTE, stencil_pixels);
ctx->Unpack = old_unpack;
- _mesa_free(stencil_pixels);
+ free(stencil_pixels);
meta_set_passthrough_transform(&intel->meta);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c
index 514a17e2aa3..2ac3da7f42f 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c
@@ -80,7 +80,7 @@ do_blit_readpixels(GLcontext * ctx,
GLint dst_x, dst_y;
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s\n", __FUNCTION__);
+ printf("%s\n", __FUNCTION__);
if (!src)
return GL_FALSE;
@@ -89,7 +89,7 @@ do_blit_readpixels(GLcontext * ctx,
/* PBO only for now:
*/
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - not PBO\n", __FUNCTION__);
+ printf("%s - not PBO\n", __FUNCTION__);
return GL_FALSE;
}
@@ -97,13 +97,13 @@ do_blit_readpixels(GLcontext * ctx,
if (ctx->_ImageTransferState ||
!intel_check_blit_format(src, format, type)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - bad format for blit\n", __FUNCTION__);
+ printf("%s - bad format for blit\n", __FUNCTION__);
return GL_FALSE;
}
if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) {
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s: bad packing params\n", __FUNCTION__);
+ printf("%s: bad packing params\n", __FUNCTION__);
return GL_FALSE;
}
@@ -114,7 +114,7 @@ do_blit_readpixels(GLcontext * ctx,
if (pack->Invert) {
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
+ printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
return GL_FALSE;
}
else {
@@ -159,7 +159,7 @@ do_blit_readpixels(GLcontext * ctx,
}
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - DONE\n", __FUNCTION__);
+ printf("%s - DONE\n", __FUNCTION__);
return GL_TRUE;
}
@@ -181,7 +181,7 @@ intelReadPixels(GLcontext * ctx,
return;
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
+ printf("%s: fallback to swrast\n", __FUNCTION__);
/* Update Mesa state before calling down into _swrast_ReadPixels, as
* the spans code requires the computed buffer states to be up to date,
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 62b4ce61e44..f042bcbc28c 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -42,7 +42,7 @@
#include <sys/ioctl.h>
#include <errno.h>
-#include <main/hash.h>
+#include "main/hash.h"
#include "intel_context.h"
#include "intel_regions.h"
#include "intel_blit.h"
@@ -118,8 +118,7 @@ intel_region_map(struct intel_context *intel, struct intel_region *region)
if (region->pbo)
intel_region_cow(intel, region);
- if (region->tiling != I915_TILING_NONE &&
- intel->intelScreen->kernel_exec_fencing)
+ if (region->tiling != I915_TILING_NONE)
drm_intel_gem_bo_map_gtt(region->buffer);
else
dri_bo_map(region->buffer, GL_TRUE);
@@ -134,8 +133,7 @@ intel_region_unmap(struct intel_context *intel, struct intel_region *region)
{
_DBG("%s %p\n", __FUNCTION__, region);
if (!--region->map_refcount) {
- if (region->tiling != I915_TILING_NONE &&
- intel->intelScreen->kernel_exec_fencing)
+ if (region->tiling != I915_TILING_NONE)
drm_intel_gem_bo_unmap_gtt(region->buffer);
else
dri_bo_unmap(region->buffer);
@@ -180,36 +178,19 @@ intel_region_alloc(struct intel_context *intel,
{
dri_bo *buffer;
struct intel_region *region;
+ unsigned long flags = 0;
+ unsigned long aligned_pitch;
- /* If we're tiled, our allocations are in 8 or 32-row blocks, so
- * failure to align our height means that we won't allocate enough pages.
- *
- * If we're untiled, we still have to align to 2 rows high because the
- * data port accesses 2x2 blocks even if the bottom row isn't to be
- * rendered, so failure to align means we could walk off the end of the
- * GTT and fault.
- */
- if (tiling == I915_TILING_X)
- height = ALIGN(height, 8);
- else if (tiling == I915_TILING_Y)
- height = ALIGN(height, 32);
- else
- height = ALIGN(height, 2);
-
- /* If we're untiled, we have to align to 2 rows high because the
- * data port accesses 2x2 blocks even if the bottom row isn't to be
- * rendered, so failure to align means we could walk off the end of the
- * GTT and fault.
+ if (expect_accelerated_upload)
+ flags |= BO_ALLOC_FOR_RENDER;
+
+ buffer = drm_intel_bo_alloc_tiled(intel->bufmgr, "region",
+ width, height, cpp,
+ &tiling, &aligned_pitch, flags);
+ /* We've already chosen a pitch as part of miptree layout. It had
+ * better be the same.
*/
- height = ALIGN(height, 2);
-
- if (expect_accelerated_upload) {
- buffer = drm_intel_bo_alloc_for_render(intel->bufmgr, "region",
- pitch * cpp * height, 64);
- } else {
- buffer = drm_intel_bo_alloc(intel->bufmgr, "region",
- pitch * cpp * height, 64);
- }
+ assert(aligned_pitch == pitch * cpp);
region = intel_region_alloc_internal(intel, cpp, width, height,
pitch, buffer);
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h
index 6d36f3d88a0..7ee6a988eae 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -148,4 +148,12 @@ void _mesa_copy_rect(GLubyte * dst,
const GLubyte * src,
GLuint src_pitch, GLuint src_x, GLuint src_y);
+struct __DRIimageRec {
+ struct intel_region *region;
+ GLenum internal_format;
+ GLuint format;
+ GLenum data_type;
+ void *data;
+};
+
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 5e23aa8a1d6..6e4bb643651 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -30,6 +30,7 @@
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "main/hash.h"
+#include "main/fbobject.h"
#include "utils.h"
#include "xmlpool.h"
@@ -41,13 +42,11 @@
#include "intel_fbo.h"
#include "intel_screen.h"
#include "intel_tex.h"
+#include "intel_regions.h"
#include "i915_drm.h"
#define DRI_CONF_TEXTURE_TILING(def) \
- DRI_CONF_OPT_BEGIN(texture_tiling, bool, def) \
- DRI_CONF_DESC(en, "Enable texture tiling") \
- DRI_CONF_OPT_END \
PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN
@@ -63,11 +62,9 @@ PUBLIC const char __driConfigOptions[] =
DRI_CONF_DESC_END
DRI_CONF_OPT_END
-#ifdef I915
- DRI_CONF_TEXTURE_TILING(false)
-#else
- DRI_CONF_TEXTURE_TILING(true)
-#endif
+ DRI_CONF_OPT_BEGIN(texture_tiling, bool, true)
+ DRI_CONF_DESC(en, "Enable texture tiling")
+ DRI_CONF_OPT_END
DRI_CONF_OPT_BEGIN(early_z, bool, false)
DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).")
@@ -99,11 +96,6 @@ const GLuint __driNConfigOptions = 11;
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
#endif /*USE_NEW_INTERFACE */
-static const __DRItexOffsetExtension intelTexOffsetExtension = {
- { __DRI_TEX_OFFSET },
- intelSetTexOffset,
-};
-
static const __DRItexBufferExtension intelTexBufferExtension = {
{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
intelSetTexBuffer,
@@ -137,11 +129,102 @@ static const struct __DRI2flushExtensionRec intelFlushExtension = {
intelDRI2Invalidate,
};
+static __DRIimage *
+intel_create_image_from_name(__DRIcontext *context,
+ int width, int height, int format,
+ int name, int pitch, void *loaderPrivate)
+{
+ __DRIimage *image;
+ struct intel_context *intel = context->driverPrivate;
+ int cpp;
+
+ image = CALLOC(sizeof *image);
+ if (image == NULL)
+ return NULL;
+
+ switch (format) {
+ case __DRI_IMAGE_FORMAT_RGB565:
+ image->format = MESA_FORMAT_RGB565;
+ image->internal_format = GL_RGB;
+ image->data_type = GL_UNSIGNED_BYTE;
+ break;
+ case __DRI_IMAGE_FORMAT_XRGB8888:
+ image->format = MESA_FORMAT_XRGB8888;
+ image->internal_format = GL_RGB;
+ image->data_type = GL_UNSIGNED_BYTE;
+ break;
+ case __DRI_IMAGE_FORMAT_ARGB8888:
+ image->format = MESA_FORMAT_ARGB8888;
+ image->internal_format = GL_RGBA;
+ image->data_type = GL_UNSIGNED_BYTE;
+ break;
+ default:
+ free(image);
+ return NULL;
+ }
+
+ image->data = loaderPrivate;
+ cpp = _mesa_get_format_bytes(image->format);
+
+ image->region = intel_region_alloc_for_handle(intel, cpp, width, height,
+ pitch, name, "image");
+ if (image->region == NULL) {
+ FREE(image);
+ return NULL;
+ }
+
+ return image;
+}
+
+static __DRIimage *
+intel_create_image_from_renderbuffer(__DRIcontext *context,
+ int renderbuffer, void *loaderPrivate)
+{
+ __DRIimage *image;
+ struct intel_context *intel = context->driverPrivate;
+ struct gl_renderbuffer *rb;
+ struct intel_renderbuffer *irb;
+
+ rb = _mesa_lookup_renderbuffer(&intel->ctx, renderbuffer);
+ if (!rb) {
+ _mesa_error(&intel->ctx,
+ GL_INVALID_OPERATION, "glRenderbufferExternalMESA");
+ return NULL;
+ }
+
+ irb = intel_renderbuffer(rb);
+ image = CALLOC(sizeof *image);
+ if (image == NULL)
+ return NULL;
+
+ image->internal_format = rb->InternalFormat;
+ image->format = rb->Format;
+ image->data_type = rb->DataType;
+ image->data = loaderPrivate;
+ intel_region_reference(&image->region, irb->region);
+
+ return image;
+}
+
+static void
+intel_destroy_image(__DRIimage *image)
+{
+ intel_region_release(&image->region);
+ FREE(image);
+}
+
+static struct __DRIimageExtensionRec intelImageExtension = {
+ { __DRI_IMAGE, __DRI_IMAGE_VERSION },
+ intel_create_image_from_name,
+ intel_create_image_from_renderbuffer,
+ intel_destroy_image,
+};
+
static const __DRIextension *intelScreenExtensions[] = {
&driReadDrawableExtension,
- &intelTexOffsetExtension.base,
&intelTexBufferExtension.base,
&intelFlushExtension.base,
+ &intelImageExtension.base,
NULL
};
@@ -327,10 +410,13 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
return GL_FALSE;
}
- if (intel_get_param(spriv, I915_PARAM_NUM_FENCES_AVAIL, &num_fences))
- intelScreen->kernel_exec_fencing = !!num_fences;
- else
- intelScreen->kernel_exec_fencing = GL_FALSE;
+ if (!intel_get_param(spriv, I915_PARAM_NUM_FENCES_AVAIL, &num_fences) ||
+ num_fences == 0) {
+ fprintf(stderr, "[%s: %u] Kernel 2.6.29 required.\n", __func__, __LINE__);
+ return GL_FALSE;
+ }
+
+ drm_intel_bufmgr_gem_enable_fenced_relocs(intelScreen->bufmgr);
intelScreen->named_regions = _mesa_NewHashTable();
diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h
index 1ce476dacaa..5863093f001 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.h
+++ b/src/mesa/drivers/dri/intel/intel_screen.h
@@ -46,7 +46,6 @@ struct intel_screen
GLboolean no_vbo;
dri_bufmgr *bufmgr;
- GLboolean kernel_exec_fencing;
struct _mesa_HashTable *named_regions;
/**
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 97bb97265fb..fb5c01bc4dc 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -43,218 +43,6 @@ static void
intel_set_span_functions(struct intel_context *intel,
struct gl_renderbuffer *rb);
-#define SPAN_CACHE_SIZE 4096
-
-static void
-get_span_cache(struct intel_renderbuffer *irb, uint32_t offset)
-{
- if (irb->span_cache == NULL) {
- irb->span_cache = _mesa_malloc(SPAN_CACHE_SIZE);
- irb->span_cache_offset = -1;
- }
-
- if ((offset & ~(SPAN_CACHE_SIZE - 1)) != irb->span_cache_offset) {
- irb->span_cache_offset = offset & ~(SPAN_CACHE_SIZE - 1);
- dri_bo_get_subdata(irb->region->buffer, irb->span_cache_offset,
- SPAN_CACHE_SIZE, irb->span_cache);
- }
-}
-
-static void
-clear_span_cache(struct intel_renderbuffer *irb)
-{
- irb->span_cache_offset = -1;
-}
-
-static uint32_t
-pread_32(struct intel_renderbuffer *irb, uint32_t offset)
-{
- get_span_cache(irb, offset);
-
- return *(uint32_t *)(irb->span_cache + (offset & (SPAN_CACHE_SIZE - 1)));
-}
-
-static uint32_t
-pread_xrgb8888(struct intel_renderbuffer *irb, uint32_t offset)
-{
- get_span_cache(irb, offset);
-
- return *(uint32_t *)(irb->span_cache + (offset & (SPAN_CACHE_SIZE - 1))) |
- 0xff000000;
-}
-
-static uint16_t
-pread_16(struct intel_renderbuffer *irb, uint32_t offset)
-{
- get_span_cache(irb, offset);
-
- return *(uint16_t *)(irb->span_cache + (offset & (SPAN_CACHE_SIZE - 1)));
-}
-
-static uint8_t
-pread_8(struct intel_renderbuffer *irb, uint32_t offset)
-{
- get_span_cache(irb, offset);
-
- return *(uint8_t *)(irb->span_cache + (offset & (SPAN_CACHE_SIZE - 1)));
-}
-
-static void
-pwrite_32(struct intel_renderbuffer *irb, uint32_t offset, uint32_t val)
-{
- clear_span_cache(irb);
-
- dri_bo_subdata(irb->region->buffer, offset, 4, &val);
-}
-
-static void
-pwrite_xrgb8888(struct intel_renderbuffer *irb, uint32_t offset, uint32_t val)
-{
- clear_span_cache(irb);
-
- dri_bo_subdata(irb->region->buffer, offset, 3, &val);
-}
-
-static void
-pwrite_16(struct intel_renderbuffer *irb, uint32_t offset, uint16_t val)
-{
- clear_span_cache(irb);
-
- dri_bo_subdata(irb->region->buffer, offset, 2, &val);
-}
-
-static void
-pwrite_8(struct intel_renderbuffer *irb, uint32_t offset, uint8_t val)
-{
- clear_span_cache(irb);
-
- dri_bo_subdata(irb->region->buffer, offset, 1, &val);
-}
-
-static uint32_t no_tile_swizzle(struct intel_renderbuffer *irb,
- int x, int y)
-{
- return (y * irb->region->pitch + x) * irb->region->cpp;
-}
-
-/*
- * Deal with tiled surfaces
- */
-
-static uint32_t x_tile_swizzle(struct intel_renderbuffer *irb,
- int x, int y)
-{
- int tile_stride;
- int xbyte;
- int x_tile_off, y_tile_off;
- int x_tile_number, y_tile_number;
- int tile_off, tile_base;
-
- x += irb->region->draw_x;
- y += irb->region->draw_y;
-
- tile_stride = (irb->region->pitch * irb->region->cpp) << 3;
-
- xbyte = x * irb->region->cpp;
-
- x_tile_off = xbyte & 0x1ff;
- y_tile_off = y & 7;
-
- x_tile_number = xbyte >> 9;
- y_tile_number = y >> 3;
-
- tile_off = (y_tile_off << 9) + x_tile_off;
-
- switch (irb->region->bit_6_swizzle) {
- case I915_BIT_6_SWIZZLE_NONE:
- break;
- case I915_BIT_6_SWIZZLE_9:
- tile_off ^= ((tile_off >> 3) & 64);
- break;
- case I915_BIT_6_SWIZZLE_9_10:
- tile_off ^= ((tile_off >> 3) & 64) ^ ((tile_off >> 4) & 64);
- break;
- case I915_BIT_6_SWIZZLE_9_11:
- tile_off ^= ((tile_off >> 3) & 64) ^ ((tile_off >> 5) & 64);
- break;
- case I915_BIT_6_SWIZZLE_9_10_11:
- tile_off ^= ((tile_off >> 3) & 64) ^ ((tile_off >> 4) & 64) ^
- ((tile_off >> 5) & 64);
- break;
- default:
- fprintf(stderr, "Unknown tile swizzling mode %d\n",
- irb->region->bit_6_swizzle);
- exit(1);
- }
-
- tile_base = (x_tile_number << 12) + y_tile_number * tile_stride;
-
-#if 0
- printf("(%d,%d) -> %d + %d = %d (pitch = %d, tstride = %d)\n",
- x, y, tile_off, tile_base,
- tile_off + tile_base,
- irb->region->pitch, tile_stride);
-#endif
-
- return tile_base + tile_off;
-}
-
-static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
- int x, int y)
-{
- int tile_stride;
- int xbyte;
- int x_tile_off, y_tile_off;
- int x_tile_number, y_tile_number;
- int tile_off, tile_base;
-
- x += irb->region->draw_x;
- y += irb->region->draw_y;
-
- tile_stride = (irb->region->pitch * irb->region->cpp) << 5;
-
- xbyte = x * irb->region->cpp;
-
- x_tile_off = xbyte & 0x7f;
- y_tile_off = y & 0x1f;
-
- x_tile_number = xbyte >> 7;
- y_tile_number = y >> 5;
-
- tile_off = ((x_tile_off & ~0xf) << 5) + (y_tile_off << 4) +
- (x_tile_off & 0xf);
-
- switch (irb->region->bit_6_swizzle) {
- case I915_BIT_6_SWIZZLE_NONE:
- break;
- case I915_BIT_6_SWIZZLE_9:
- tile_off ^= ((tile_off >> 3) & 64);
- break;
- case I915_BIT_6_SWIZZLE_9_10:
- tile_off ^= ((tile_off >> 3) & 64) ^ ((tile_off >> 4) & 64);
- break;
- case I915_BIT_6_SWIZZLE_9_11:
- tile_off ^= ((tile_off >> 3) & 64) ^ ((tile_off >> 5) & 64);
- break;
- case I915_BIT_6_SWIZZLE_9_10_11:
- tile_off ^= ((tile_off >> 3) & 64) ^ ((tile_off >> 4) & 64) ^
- ((tile_off >> 5) & 64);
- break;
- default:
- fprintf(stderr, "Unknown tile swizzling mode %d\n",
- irb->region->bit_6_swizzle);
- exit(1);
- }
-
- tile_base = (x_tile_number << 12) + y_tile_number * tile_stride;
-
- return tile_base + tile_off;
-}
-
-/*
- break intelWriteRGBASpan_ARGB8888
-*/
-
#undef DBG
#define DBG 0
@@ -280,50 +68,43 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#define HW_UNLOCK()
-/* Convenience macros to avoid typing the swizzle argument over and over */
-#define NO_TILE(_X, _Y) no_tile_swizzle(irb, (_X), (_Y))
-#define X_TILE(_X, _Y) x_tile_swizzle(irb, (_X), (_Y))
-#define Y_TILE(_X, _Y) y_tile_swizzle(irb, (_X), (_Y))
+/* Convenience macros to avoid typing the address argument over and over */
+#define NO_TILE(_X, _Y) (((_Y) * irb->region->pitch + (_X)) * irb->region->cpp)
/* r5g6b5 color span and pixel functions */
-#define INTEL_PIXEL_FMT GL_RGB
-#define INTEL_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-#define INTEL_READ_VALUE(offset) pread_16(irb, offset)
-#define INTEL_WRITE_VALUE(offset, v) pwrite_16(irb, offset, v)
-#define INTEL_TAG(x) x##_RGB565
-#include "intel_spantmp.h"
+#define SPANTMP_PIXEL_FMT GL_RGB
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
+#define TAG(x) intel_##x##_RGB565
+#define TAG2(x,y) intel_##x##y_RGB565
+#include "spantmp2.h"
/* a4r4g4b4 color span and pixel functions */
-#define INTEL_PIXEL_FMT GL_BGRA
-#define INTEL_PIXEL_TYPE GL_UNSIGNED_SHORT_4_4_4_4_REV
-#define INTEL_READ_VALUE(offset) pread_16(irb, offset)
-#define INTEL_WRITE_VALUE(offset, v) pwrite_16(irb, offset, v)
-#define INTEL_TAG(x) x##_ARGB4444
-#include "intel_spantmp.h"
+#define SPANTMP_PIXEL_FMT GL_BGRA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_4_4_4_4_REV
+#define TAG(x) intel_##x##_ARGB4444
+#define TAG2(x,y) intel_##x##y_ARGB4444
+#include "spantmp2.h"
/* a1r5g5b5 color span and pixel functions */
-#define INTEL_PIXEL_FMT GL_BGRA
-#define INTEL_PIXEL_TYPE GL_UNSIGNED_SHORT_1_5_5_5_REV
-#define INTEL_READ_VALUE(offset) pread_16(irb, offset)
-#define INTEL_WRITE_VALUE(offset, v) pwrite_16(irb, offset, v)
-#define INTEL_TAG(x) x##_ARGB1555
-#include "intel_spantmp.h"
+#define SPANTMP_PIXEL_FMT GL_BGRA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_1_5_5_5_REV
+#define TAG(x) intel_##x##_ARGB1555
+#define TAG2(x,y) intel_##x##y##_ARGB1555
+#include "spantmp2.h"
/* a8r8g8b8 color span and pixel functions */
-#define INTEL_PIXEL_FMT GL_BGRA
-#define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-#define INTEL_READ_VALUE(offset) pread_32(irb, offset)
-#define INTEL_WRITE_VALUE(offset, v) pwrite_32(irb, offset, v)
-#define INTEL_TAG(x) x##_ARGB8888
-#include "intel_spantmp.h"
+#define SPANTMP_PIXEL_FMT GL_BGRA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
+#define TAG(x) intel_##x##_ARGB8888
+#define TAG2(x,y) intel_##x##y##_ARGB8888
+#include "spantmp2.h"
/* x8r8g8b8 color span and pixel functions */
-#define INTEL_PIXEL_FMT GL_BGR
-#define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-#define INTEL_READ_VALUE(offset) pread_xrgb8888(irb, offset)
-#define INTEL_WRITE_VALUE(offset, v) pwrite_xrgb8888(irb, offset, v)
-#define INTEL_TAG(x) x##_xRGB8888
-#include "intel_spantmp.h"
+#define SPANTMP_PIXEL_FMT GL_BGR
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
+#define TAG(x) intel_##x##_xRGB8888
+#define TAG2(x,y) intel_##x##y##_xRGB8888
+#include "spantmp2.h"
#define LOCAL_DEPTH_VARS \
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
@@ -339,52 +120,22 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
/* z16 depthbuffer functions. */
-#define INTEL_VALUE_TYPE GLushort
-#define INTEL_WRITE_DEPTH(offset, d) pwrite_16(irb, offset, d)
-#define INTEL_READ_DEPTH(offset) pread_16(irb, offset)
-#define INTEL_TAG(name) name##_z16
-#include "intel_depthtmp.h"
-
-/* z24x8 depthbuffer functions. */
-#define INTEL_VALUE_TYPE GLuint
-#define INTEL_WRITE_DEPTH(offset, d) pwrite_32(irb, offset, d)
-#define INTEL_READ_DEPTH(offset) pread_32(irb, offset)
-#define INTEL_TAG(name) name##_z24_x8
-#include "intel_depthtmp.h"
-
-
-/**
- ** 8-bit stencil function (XXX FBO: This is obsolete)
- **/
-/* XXX */
-#define WRITE_STENCIL(_x, _y, d) pwrite_8(irb, NO_TILE(_x, _y) + 3, d)
-#define READ_STENCIL(d, _x, _y) d = pread_8(irb, NO_TILE(_x, _y) + 3);
-#define TAG(x) intel_gttmap_##x##_z24_s8
-#include "stenciltmp.h"
-
-/**
- ** 8-bit stencil function (XXX FBO: This is obsolete)
- **/
-#define WRITE_STENCIL(_x, _y, d) pwrite_8(irb, NO_TILE(_x, _y) + 3, d)
-#define READ_STENCIL(d, _x, _y) d = pread_8(irb, NO_TILE(_x, _y) + 3);
-#define TAG(x) intel##x##_z24_s8
-#include "stenciltmp.h"
-
-/**
- ** 8-bit x-tile stencil function (XXX FBO: This is obsolete)
- **/
-#define WRITE_STENCIL(_x, _y, d) pwrite_8(irb, X_TILE(_x, _y) + 3, d)
-#define READ_STENCIL(d, _x, _y) d = pread_8(irb, X_TILE(_x, _y) + 3);
-#define TAG(x) intel_XTile_##x##_z24_s8
-#include "stenciltmp.h"
-
-/**
- ** 8-bit y-tile stencil function (XXX FBO: This is obsolete)
- **/
-#define WRITE_STENCIL(_x, _y, d) pwrite_8(irb, Y_TILE(_x, _y) + 3, d)
-#define READ_STENCIL(d, _x, _y) d = pread_8(irb, Y_TILE(_x, _y) + 3)
-#define TAG(x) intel_YTile_##x##_z24_s8
-#include "stenciltmp.h"
+#define VALUE_TYPE GLushort
+#define WRITE_DEPTH(_x, _y, d) \
+ (*(uint16_t *)(irb->region->buffer->virtual + NO_TILE(_x, _y)) = d)
+#define READ_DEPTH(d, _x, _y) \
+ d = *(uint16_t *)(irb->region->buffer->virtual + NO_TILE(_x, _y))
+#define TAG(x) intel_##x##_z16
+#include "depthtmp.h"
+
+/* z24_s8 and z24_x8 depthbuffer functions. */
+#define VALUE_TYPE GLuint
+#define WRITE_DEPTH(_x, _y, d) \
+ (*(uint32_t *)(irb->region->buffer->virtual + NO_TILE(_x, _y)) = d)
+#define READ_DEPTH(d, _x, _y) \
+ d = *(uint32_t *)(irb->region->buffer->virtual + NO_TILE(_x, _y))
+#define TAG(x) intel_##x##_z24_x8
+#include "depthtmp.h"
void
intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb)
@@ -394,8 +145,7 @@ intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb)
if (irb == NULL || irb->region == NULL)
return;
- if (intel->intelScreen->kernel_exec_fencing)
- drm_intel_gem_bo_map_gtt(irb->region->buffer);
+ drm_intel_gem_bo_map_gtt(irb->region->buffer);
intel_set_span_functions(intel, rb);
}
@@ -409,10 +159,7 @@ intel_renderbuffer_unmap(struct intel_context *intel,
if (irb == NULL || irb->region == NULL)
return;
- if (intel->intelScreen->kernel_exec_fencing)
- drm_intel_gem_bo_unmap_gtt(irb->region->buffer);
- else
- clear_span_cache(irb);
+ drm_intel_gem_bo_unmap_gtt(irb->region->buffer);
rb->GetRow = NULL;
rb->PutRow = NULL;
@@ -592,182 +339,34 @@ intel_set_span_functions(struct intel_context *intel,
struct gl_renderbuffer *rb)
{
struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb;
- uint32_t tiling = irb->region->tiling;
-
- if (intel->intelScreen->kernel_exec_fencing) {
- switch (irb->Base.Format) {
- case MESA_FORMAT_RGB565:
- intel_gttmap_InitPointers_RGB565(rb);
- break;
- case MESA_FORMAT_ARGB4444:
- intel_gttmap_InitPointers_ARGB4444(rb);
- break;
- case MESA_FORMAT_ARGB1555:
- intel_gttmap_InitPointers_ARGB1555(rb);
- break;
- case MESA_FORMAT_XRGB8888:
- intel_gttmap_InitPointers_xRGB8888(rb);
- break;
- case MESA_FORMAT_ARGB8888:
- intel_gttmap_InitPointers_ARGB8888(rb);
- break;
- case MESA_FORMAT_Z16:
- intel_gttmap_InitDepthPointers_z16(rb);
- break;
- case MESA_FORMAT_X8_Z24:
- intel_gttmap_InitDepthPointers_z24_x8(rb);
- break;
- case MESA_FORMAT_S8_Z24:
- /* There are a few different ways SW asks us to access the S8Z24 data:
- * Z24 depth-only depth reads
- * S8Z24 depth reads
- * S8Z24 stencil reads.
- */
- if (rb->Format == MESA_FORMAT_S8_Z24) {
- intel_gttmap_InitDepthPointers_z24_x8(rb);
- } else if (rb->Format == MESA_FORMAT_S8) {
- intel_gttmap_InitStencilPointers_z24_s8(rb);
- }
- break;
- default:
- _mesa_problem(NULL,
- "Unexpected MesaFormat %d in intelSetSpanFunctions",
- irb->Base.Format);
- break;
- }
- return;
- }
- /* If in GEM mode, we need to do the tile address swizzling ourselves,
- * instead of the fence registers handling it.
- */
switch (irb->Base.Format) {
case MESA_FORMAT_RGB565:
- switch (tiling) {
- case I915_TILING_NONE:
- default:
- intelInitPointers_RGB565(rb);
- break;
- case I915_TILING_X:
- intel_XTile_InitPointers_RGB565(rb);
- break;
- case I915_TILING_Y:
- intel_YTile_InitPointers_RGB565(rb);
- break;
- }
+ intel_InitPointers_RGB565(rb);
break;
case MESA_FORMAT_ARGB4444:
- switch (tiling) {
- case I915_TILING_NONE:
- default:
- intelInitPointers_ARGB4444(rb);
- break;
- case I915_TILING_X:
- intel_XTile_InitPointers_ARGB4444(rb);
- break;
- case I915_TILING_Y:
- intel_YTile_InitPointers_ARGB4444(rb);
- break;
- }
+ intel_InitPointers_ARGB4444(rb);
break;
case MESA_FORMAT_ARGB1555:
- switch (tiling) {
- case I915_TILING_NONE:
- default:
- intelInitPointers_ARGB1555(rb);
- break;
- case I915_TILING_X:
- intel_XTile_InitPointers_ARGB1555(rb);
- break;
- case I915_TILING_Y:
- intel_YTile_InitPointers_ARGB1555(rb);
- break;
- }
+ intel_InitPointers_ARGB1555(rb);
break;
case MESA_FORMAT_XRGB8888:
- switch (tiling) {
- case I915_TILING_NONE:
- default:
- intelInitPointers_xRGB8888(rb);
- break;
- case I915_TILING_X:
- intel_XTile_InitPointers_xRGB8888(rb);
- break;
- case I915_TILING_Y:
- intel_YTile_InitPointers_xRGB8888(rb);
- break;
- }
+ intel_InitPointers_xRGB8888(rb);
break;
case MESA_FORMAT_ARGB8888:
- /* 8888 RGBA */
- switch (tiling) {
- case I915_TILING_NONE:
- default:
- intelInitPointers_ARGB8888(rb);
- break;
- case I915_TILING_X:
- intel_XTile_InitPointers_ARGB8888(rb);
- break;
- case I915_TILING_Y:
- intel_YTile_InitPointers_ARGB8888(rb);
- break;
- }
+ intel_InitPointers_ARGB8888(rb);
break;
case MESA_FORMAT_Z16:
- switch (tiling) {
- case I915_TILING_NONE:
- default:
- intelInitDepthPointers_z16(rb);
- break;
- case I915_TILING_X:
- intel_XTile_InitDepthPointers_z16(rb);
- break;
- case I915_TILING_Y:
- intel_YTile_InitDepthPointers_z16(rb);
- break;
- }
+ intel_InitDepthPointers_z16(rb);
break;
case MESA_FORMAT_X8_Z24:
case MESA_FORMAT_S8_Z24:
- /* There are a few different ways SW asks us to access the S8Z24 data:
- * Z24 depth-only depth reads
- * S8Z24 depth reads
- * S8Z24 stencil reads.
- */
- if (rb->Format == MESA_FORMAT_S8_Z24) {
- switch (tiling) {
- case I915_TILING_NONE:
- default:
- intelInitDepthPointers_z24_x8(rb);
- break;
- case I915_TILING_X:
- intel_XTile_InitDepthPointers_z24_x8(rb);
- break;
- case I915_TILING_Y:
- intel_YTile_InitDepthPointers_z24_x8(rb);
- break;
- }
- } else if (rb->Format == MESA_FORMAT_S8) {
- switch (tiling) {
- case I915_TILING_NONE:
- default:
- intelInitStencilPointers_z24_s8(rb);
- break;
- case I915_TILING_X:
- intel_XTile_InitStencilPointers_z24_s8(rb);
- break;
- case I915_TILING_Y:
- intel_YTile_InitStencilPointers_z24_s8(rb);
- break;
- }
- } else {
- _mesa_problem(NULL,
- "Unexpected ActualFormat in intelSetSpanFunctions");
- }
+ intel_InitDepthPointers_z24_x8(rb);
break;
default:
_mesa_problem(NULL,
- "Unexpected MesaFormat in intelSetSpanFunctions");
+ "Unexpected MesaFormat %d in intelSetSpanFunctions",
+ irb->Base.Format);
break;
}
}
diff --git a/src/mesa/drivers/dri/intel/intel_spantmp.h b/src/mesa/drivers/dri/intel/intel_spantmp.h
deleted file mode 100644
index bad03398f68..00000000000
--- a/src/mesa/drivers/dri/intel/intel_spantmp.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright © 2009 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-/**
- * Wrapper around the spantmp.h macrofest to generate spans code for
- * all the tiling styles.
- */
-
-#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
-#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
-#define TAG(x) INTEL_TAG(intel_gttmap_##x)
-#define TAG2(x, y) INTEL_TAG(intel_gttmap_##x##y)
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
-#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
-#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(NO_TILE(_x, _y), v)
-#define GET_VALUE(_x, _y) INTEL_READ_VALUE(NO_TILE(_x, _y))
-#define TAG(x) INTEL_TAG(intel##x)
-#define TAG2(x, y) INTEL_TAG(intel##x)##y
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
-#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
-#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(X_TILE(_x, _y), v)
-#define GET_VALUE(_x, _y) INTEL_READ_VALUE(X_TILE(_x, _y))
-#define TAG(x) INTEL_TAG(intel_XTile_##x)
-#define TAG2(x, y) INTEL_TAG(intel_XTile_##x)##y
-#include "spantmp2.h"
-
-#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT
-#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE
-#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(Y_TILE(_x, _y), v)
-#define GET_VALUE(_x, _y) INTEL_READ_VALUE(Y_TILE(_x, _y))
-#define TAG(x) INTEL_TAG(intel_YTile_##x)
-#define TAG2(x, y) INTEL_TAG(intel_YTile_##x)##y
-#include "spantmp2.h"
-
-#undef INTEL_PIXEL_FMT
-#undef INTEL_PIXEL_TYPE
-#undef INTEL_WRITE_VALUE
-#undef INTEL_READ_VALUE
-#undef INTEL_TAG
diff --git a/src/mesa/drivers/dri/intel/intel_syncobj.c b/src/mesa/drivers/dri/intel/intel_syncobj.c
index 0d7889d3c25..d67f0cb4a68 100644
--- a/src/mesa/drivers/dri/intel/intel_syncobj.c
+++ b/src/mesa/drivers/dri/intel/intel_syncobj.c
@@ -50,7 +50,7 @@ intel_new_sync_object(GLcontext *ctx, GLuint id)
{
struct intel_sync_object *sync;
- sync = _mesa_calloc(sizeof(struct intel_sync_object));
+ sync = calloc(1, sizeof(struct intel_sync_object));
return &sync->Base;
}
@@ -61,7 +61,7 @@ intel_delete_sync_object(GLcontext *ctx, struct gl_sync_object *s)
struct intel_sync_object *sync = (struct intel_sync_object *)s;
drm_intel_bo_unreference(sync->bo);
- _mesa_free(sync);
+ free(sync);
}
static void
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 215a534a5c5..8bb6ae99fb1 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -146,7 +146,7 @@ timed_memcpy(void *dest, const void *src, size_t n)
double rate;
if ((((unsigned) src) & 63) || (((unsigned) dest) & 63))
- _mesa_printf("Warning - non-aligned texture copy!\n");
+ printf("Warning - non-aligned texture copy!\n");
t1 = fastrdtsc();
ret = do_memcpy(dest, src, n);
@@ -154,7 +154,7 @@ timed_memcpy(void *dest, const void *src, size_t n)
rate = time_diff(t1, t2);
rate /= (double) n;
- _mesa_printf("timed_memcpy: %u %u --> %f clocks/byte\n", t1, t2, rate);
+ printf("timed_memcpy: %u %u --> %f clocks/byte\n", t1, t2, rate);
return ret;
}
#endif /* DO_DEBUG */
diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h
index f3cc0fff5c8..4bb012dc65e 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.h
+++ b/src/mesa/drivers/dri/intel/intel_tex.h
@@ -45,8 +45,6 @@ void intelInitTextureCopyImageFuncs(struct dd_function_table *functions);
gl_format intelChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type);
-void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
- unsigned long long offset, GLint depth, GLuint pitch);
void intelSetTexBuffer(__DRIcontext *pDRICtx,
GLint target, __DRIdrawable *pDraw);
void intelSetTexBuffer2(__DRIcontext *pDRICtx,
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index aefd0b97d0c..bac36eeb569 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -706,29 +706,6 @@ intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
texObj, texImage, GL_TRUE);
}
-
-void
-intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
- unsigned long long offset, GLint depth, GLuint pitch)
-{
- struct intel_context *intel = pDRICtx->driverPrivate;
- struct gl_texture_object *tObj = _mesa_lookup_texture(&intel->ctx, texname);
- struct intel_texture_object *intelObj = intel_texture_object(tObj);
-
- if (!intelObj)
- return;
-
- if (intelObj->mt)
- intel_miptree_release(intel, &intelObj->mt);
-
- intelObj->imageOverride = GL_TRUE;
- intelObj->depthOverride = depth;
- intelObj->pitchOverride = pitch;
-
- if (offset)
- intelObj->textureOffset = offset;
-}
-
void
intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
GLint texture_format,
@@ -814,6 +791,54 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
intelSetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
}
+#if FEATURE_OES_EGL_image
+static void
+intel_image_target_texture_2d(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage,
+ GLeglImageOES image_handle)
+{
+ struct intel_context *intel = intel_context(ctx);
+ struct intel_texture_object *intelObj = intel_texture_object(texObj);
+ struct intel_texture_image *intelImage = intel_texture_image(texImage);
+ struct intel_mipmap_tree *mt;
+ __DRIscreen *screen;
+ __DRIimage *image;
+
+ screen = intel->intelScreen->driScrnPriv;
+ image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle,
+ intel->driContext->loaderPrivate);
+ if (image == NULL)
+ return;
+
+ mt = intel_miptree_create_for_region(intel, target,
+ image->internal_format,
+ 0, 0, image->region, 1, 0);
+ if (mt == NULL)
+ return;
+
+ if (intelImage->mt) {
+ intel_miptree_release(intel, &intelImage->mt);
+ assert(!texImage->Data);
+ }
+ if (intelObj->mt)
+ intel_miptree_release(intel, &intelObj->mt);
+
+ intelObj->mt = mt;
+ _mesa_init_teximage_fields(&intel->ctx, target, texImage,
+ image->region->width, image->region->height, 1,
+ 0, image->internal_format);
+
+ intelImage->face = target_to_face(target);
+ intelImage->level = 0;
+ texImage->TexFormat = image->format;
+ texImage->RowStride = image->region->pitch;
+ intel_miptree_reference(&intelImage->mt, intelObj->mt);
+
+ if (!intel_miptree_match_image(intelObj->mt, &intelImage->base))
+ fprintf(stderr, "miptree doesn't match image\n");
+}
+#endif
void
intelInitTextureImageFuncs(struct dd_function_table *functions)
@@ -825,4 +850,8 @@ intelInitTextureImageFuncs(struct dd_function_table *functions)
functions->CompressedTexImage2D = intelCompressedTexImage2D;
functions->GetCompressedTexImage = intelGetCompressedTexImage;
+
+#if FEATURE_OES_EGL_image
+ functions->EGLImageTargetTexture2D = intel_image_target_texture_2d;
+#endif
}
diff --git a/src/mesa/drivers/dri/intel/intel_tex_obj.h b/src/mesa/drivers/dri/intel/intel_tex_obj.h
index 3ad10d3d238..5f60e0ea4f3 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_obj.h
+++ b/src/mesa/drivers/dri/intel/intel_tex_obj.h
@@ -46,10 +46,6 @@ struct intel_texture_object
* regions will be copied to this region and the old storage freed.
*/
struct intel_mipmap_tree *mt;
-
- GLboolean imageOverride;
- GLint depthOverride;
- GLuint pitchOverride;
};
struct intel_texture_image
diff --git a/src/mesa/drivers/dri/intel/server/intel_dri.c b/src/mesa/drivers/dri/intel/server/intel_dri.c
deleted file mode 100644
index e49c4214ad4..00000000000
--- a/src/mesa/drivers/dri/intel/server/intel_dri.c
+++ /dev/null
@@ -1,1306 +0,0 @@
-/**
- * \file server/intel_dri.c
- * \brief File to perform the device-specific initialization tasks typically
- * done in the X server.
- *
- * Here they are converted to run in the client (or perhaps a standalone
- * process), and to work with the frame buffer device rather than the X
- * server infrastructure.
- *
- * Copyright (C) 2006 Dave Airlie (airlied@linux.ie)
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sub license, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice (including the
- next paragraph) shall be included in all copies or substantial portions
- of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR
- ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-
-#include "intel.h"
-#include "i830_dri.h"
-
-#include "memops.h"
-#include "pciaccess.h"
-
-static size_t drm_page_size;
-static int nextTile = 0;
-#define xf86DrvMsg(...) do {} while(0)
-
-static const int pitches[] = {
- 128 * 8,
- 128 * 16,
- 128 * 32,
- 128 * 64,
- 0
-};
-
-static Bool I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea);
-
-static unsigned long
-GetBestTileAlignment(unsigned long size)
-{
- unsigned long i;
-
- for (i = KB(512); i < size; i <<= 1)
- ;
-
- if (i > MB(64))
- i = MB(64);
-
- return i;
-}
-
-static void SetFenceRegs(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- int i;
- unsigned char *MMIO = ctx->MMIOAddress;
-
- for (i = 0; i < 8; i++) {
- OUTREG(FENCE + i * 4, pI830->Fence[i]);
- // if (I810_DEBUG & DEBUG_VERBOSE_VGA)
- fprintf(stderr,"Fence Register : %x\n", pI830->Fence[i]);
- }
-}
-
-/* Tiled memory is good... really, really good...
- *
- * Need to make it less likely that we miss out on this - probably
- * need to move the frontbuffer away from the 'guarenteed' alignment
- * of the first memory segment, or perhaps allocate a discontigous
- * framebuffer to get more alignment 'sweet spots'.
- */
-static void
-SetFence(const DRIDriverContext *ctx, I830Rec *pI830,
- int nr, unsigned int start, unsigned int pitch,
- unsigned int size)
-{
- unsigned int val;
- unsigned int fence_mask = 0;
- unsigned int fence_pitch;
-
- if (nr < 0 || nr > 7) {
- fprintf(stderr,
- "SetFence: fence %d out of range\n",nr);
- return;
- }
-
- pI830->Fence[nr] = 0;
-
- if (IS_I9XX(pI830))
- fence_mask = ~I915G_FENCE_START_MASK;
- else
- fence_mask = ~I830_FENCE_START_MASK;
-
- if (start & fence_mask) {
- fprintf(stderr,
- "SetFence: %d: start (0x%08x) is not %s aligned\n",
- nr, start, (IS_I9XX(pI830)) ? "1MB" : "512k");
- return;
- }
-
- if (start % size) {
- fprintf(stderr,
- "SetFence: %d: start (0x%08x) is not size (%dk) aligned\n",
- nr, start, size / 1024);
- return;
- }
-
- if (pitch & 127) {
- fprintf(stderr,
- "SetFence: %d: pitch (%d) not a multiple of 128 bytes\n",
- nr, pitch);
- return;
- }
-
- val = (start | FENCE_X_MAJOR | FENCE_VALID);
-
- if (IS_I9XX(pI830)) {
- switch (size) {
- case MB(1):
- val |= I915G_FENCE_SIZE_1M;
- break;
- case MB(2):
- val |= I915G_FENCE_SIZE_2M;
- break;
- case MB(4):
- val |= I915G_FENCE_SIZE_4M;
- break;
- case MB(8):
- val |= I915G_FENCE_SIZE_8M;
- break;
- case MB(16):
- val |= I915G_FENCE_SIZE_16M;
- break;
- case MB(32):
- val |= I915G_FENCE_SIZE_32M;
- break;
- case MB(64):
- val |= I915G_FENCE_SIZE_64M;
- break;
- default:
- fprintf(stderr,
- "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024);
- return;
- }
- } else {
- switch (size) {
- case KB(512):
- val |= FENCE_SIZE_512K;
- break;
- case MB(1):
- val |= FENCE_SIZE_1M;
- break;
- case MB(2):
- val |= FENCE_SIZE_2M;
- break;
- case MB(4):
- val |= FENCE_SIZE_4M;
- break;
- case MB(8):
- val |= FENCE_SIZE_8M;
- break;
- case MB(16):
- val |= FENCE_SIZE_16M;
- break;
- case MB(32):
- val |= FENCE_SIZE_32M;
- break;
- case MB(64):
- val |= FENCE_SIZE_64M;
- break;
- default:
- fprintf(stderr,
- "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024);
- return;
- }
- }
-
- if (IS_I9XX(pI830))
- fence_pitch = pitch / 512;
- else
- fence_pitch = pitch / 128;
-
- switch (fence_pitch) {
- case 1:
- val |= FENCE_PITCH_1;
- break;
- case 2:
- val |= FENCE_PITCH_2;
- break;
- case 4:
- val |= FENCE_PITCH_4;
- break;
- case 8:
- val |= FENCE_PITCH_8;
- break;
- case 16:
- val |= FENCE_PITCH_16;
- break;
- case 32:
- val |= FENCE_PITCH_32;
- break;
- case 64:
- val |= FENCE_PITCH_64;
- break;
- default:
- fprintf(stderr,
- "SetFence: %d: illegal pitch (%d)\n", nr, pitch);
- return;
- }
-
- pI830->Fence[nr] = val;
-}
-
-static Bool
-MakeTiles(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *pMem)
-{
- int pitch, ntiles, i;
-
- pitch = pMem->Pitch * ctx->cpp;
- /*
- * Simply try to break the region up into at most four pieces of size
- * equal to the alignment.
- */
- ntiles = ROUND_TO(pMem->Size, pMem->Alignment) / pMem->Alignment;
- if (ntiles >= 4) {
- return FALSE;
- }
-
- for (i = 0; i < ntiles; i++, nextTile++) {
- SetFence(ctx, pI830, nextTile, pMem->Start + i * pMem->Alignment,
- pitch, pMem->Alignment);
- }
- return TRUE;
-}
-
-static void I830SetupMemoryTiling(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- int i;
-
- /* Clear out */
- for (i = 0; i < 8; i++)
- pI830->Fence[i] = 0;
-
- nextTile = 0;
-
- if (pI830->BackBuffer.Alignment >= KB(512)) {
- if (MakeTiles(ctx, pI830, &(pI830->BackBuffer))) {
- fprintf(stderr,
- "Activating tiled memory for the back buffer.\n");
- } else {
- fprintf(stderr,
- "MakeTiles failed for the back buffer.\n");
- pI830->allowPageFlip = FALSE;
- }
- }
-
- if (pI830->DepthBuffer.Alignment >= KB(512)) {
- if (MakeTiles(ctx, pI830, &(pI830->DepthBuffer))) {
- fprintf(stderr,
- "Activating tiled memory for the depth buffer.\n");
- } else {
- fprintf(stderr,
- "MakeTiles failed for the depth buffer.\n");
- }
- }
-
- return;
-}
-
-static int I830DetectMemory(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- struct pci_device host_bridge, ig_dev;
- uint32_t gmch_ctrl;
- int memsize = 0;
- int range;
- uint32_t aper_size;
- uint32_t membase2 = 0;
-
- memset(&host_bridge, 0, sizeof(host_bridge));
- memset(&ig_dev, 0, sizeof(ig_dev));
-
- ig_dev.dev = 2;
-
- pci_device_cfg_read_u32(&host_bridge, &gmch_ctrl, I830_GMCH_CTRL);
-
- if (IS_I830(pI830) || IS_845G(pI830)) {
- if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) {
- aper_size = 0x80000000;
- } else {
- aper_size = 0x40000000;
- }
- } else {
- if (IS_I9XX(pI830)) {
- int ret;
- ret = pci_device_cfg_read_u32(&ig_dev, &membase2, 0x18);
- if (membase2 & 0x08000000)
- aper_size = 0x8000000;
- else
- aper_size = 0x10000000;
-
- fprintf(stderr,"aper size is %08X %08x %d\n", aper_size, membase2, ret);
- } else
- aper_size = 0x8000000;
- }
-
- pI830->aper_size = aper_size;
-
-
- /* We need to reduce the stolen size, by the GTT and the popup.
- * The GTT varying according the the FbMapSize and the popup is 4KB */
- range = (ctx->shared.fbSize / (1024*1024)) + 4;
-
- if (IS_I85X(pI830) || IS_I865G(pI830) || IS_I9XX(pI830)) {
- switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
- case I855_GMCH_GMS_STOLEN_1M:
- memsize = MB(1) - KB(range);
- break;
- case I855_GMCH_GMS_STOLEN_4M:
- memsize = MB(4) - KB(range);
- break;
- case I855_GMCH_GMS_STOLEN_8M:
- memsize = MB(8) - KB(range);
- break;
- case I855_GMCH_GMS_STOLEN_16M:
- memsize = MB(16) - KB(range);
- break;
- case I855_GMCH_GMS_STOLEN_32M:
- memsize = MB(32) - KB(range);
- break;
- case I915G_GMCH_GMS_STOLEN_48M:
- if (IS_I9XX(pI830))
- memsize = MB(48) - KB(range);
- break;
- case I915G_GMCH_GMS_STOLEN_64M:
- if (IS_I9XX(pI830))
- memsize = MB(64) - KB(range);
- break;
- }
- } else {
- switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
- case I830_GMCH_GMS_STOLEN_512:
- memsize = KB(512) - KB(range);
- break;
- case I830_GMCH_GMS_STOLEN_1024:
- memsize = MB(1) - KB(range);
- break;
- case I830_GMCH_GMS_STOLEN_8192:
- memsize = MB(8) - KB(range);
- break;
- case I830_GMCH_GMS_LOCAL:
- memsize = 0;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Local memory found, but won't be used.\n");
- break;
- }
- }
- if (memsize > 0) {
- fprintf(stderr,
- "detected %d kB stolen memory.\n", memsize / 1024);
- } else {
- fprintf(stderr,
- "no video memory detected.\n");
- }
- return memsize;
-}
-
-static int AgpInit(const DRIDriverContext *ctx, I830Rec *info)
-{
- unsigned long mode = 0x4;
-
- if (drmAgpAcquire(ctx->drmFD) < 0) {
- fprintf(stderr, "[gart] AGP not available\n");
- return 0;
- }
-
- if (drmAgpEnable(ctx->drmFD, mode) < 0) {
- fprintf(stderr, "[gart] AGP not enabled\n");
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
- else
- fprintf(stderr, "[gart] AGP enabled at %dx\n", ctx->agpmode);
-
- return 1;
-}
-
-/*
- * Allocate memory from the given pool. Grow the pool if needed and if
- * possible.
- */
-static unsigned long
-AllocFromPool(const DRIDriverContext *ctx, I830Rec *pI830,
- I830MemRange *result, I830MemPool *pool,
- long size, unsigned long alignment, int flags)
-{
- long needed, start, end;
-
- if (!result || !pool || !size)
- return 0;
-
- /* Calculate how much space is needed. */
- if (alignment <= GTT_PAGE_SIZE)
- needed = size;
- else {
- start = ROUND_TO(pool->Free.Start, alignment);
- end = ROUND_TO(start + size, alignment);
- needed = end - pool->Free.Start;
- }
- if (needed > pool->Free.Size) {
- return 0;
- }
-
- result->Start = ROUND_TO(pool->Free.Start, alignment);
- pool->Free.Start += needed;
- result->End = pool->Free.Start;
-
- pool->Free.Size = pool->Free.End - pool->Free.Start;
- result->Size = result->End - result->Start;
- result->Pool = pool;
- result->Alignment = alignment;
- return needed;
-}
-
-static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, long size, unsigned long alignment, I830MemRange *result)
-{
- unsigned long start, end;
- unsigned long newApStart, newApEnd;
- int ret;
- if (!result || !size)
- return 0;
-
- if (!alignment)
- alignment = 4;
-
- start = ROUND_TO(pI830->MemoryAperture.Start, alignment);
- end = ROUND_TO(start + size, alignment);
- newApStart = end;
- newApEnd = pI830->MemoryAperture.End;
-
- ret=drmAgpAlloc(ctx->drmFD, size, 0, &(result->Physical), (drm_handle_t *)&(result->Key));
-
- if (ret)
- {
- fprintf(stderr,"drmAgpAlloc failed %d\n", ret);
- return 0;
- }
- pI830->allocatedMemory += size;
- pI830->MemoryAperture.Start = newApStart;
- pI830->MemoryAperture.End = newApEnd;
- pI830->MemoryAperture.Size = newApEnd - newApStart;
- // pI830->FreeMemory -= size;
- result->Start = start;
- result->End = start + size;
- result->Size = size;
- result->Offset = start;
- result->Alignment = alignment;
- result->Pool = NULL;
-
- return size;
-}
-
-unsigned long
-I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830,
- I830MemRange *result, I830MemPool *pool, long size,
- unsigned long alignment, int flags)
-{
- unsigned long ret;
-
- if (!result)
- return 0;
-
- /* Make sure these are initialised. */
- result->Size = 0;
- result->Key = -1;
-
- if (!size) {
- return 0;
- }
-
- if (pool->Free.Size < size) {
- ret = AllocFromAGP(ctx, pI830, size, alignment, result);
- }
- else {
- ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
- if (ret == 0)
- ret = AllocFromAGP(ctx, pI830, size, alignment, result);
- }
- return ret;
-}
-
-static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem)
-{
- if (!mem)
- return FALSE;
-
- if (mem->Key == -1)
- return TRUE;
-
- return !drmAgpBind(ctx->drmFD, mem->Key, mem->Offset);
-}
-
-/* simple memory allocation routines needed */
-/* put ring buffer in low memory */
-/* need to allocate front, back, depth buffers aligned correctly,
- allocate ring buffer,
-*/
-
-/* */
-static Bool
-I830AllocateMemory(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- unsigned long size, ret;
- unsigned long lines, lineSize, align;
-
- /* allocate ring buffer */
- memset(pI830->LpRing, 0, sizeof(I830RingBuffer));
- pI830->LpRing->mem.Key = -1;
-
- size = PRIMARY_RINGBUFFER_SIZE;
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->LpRing->mem, &pI830->StolenPool, size, 0x1000, 0);
-
- if (ret != size)
- {
- fprintf(stderr,"unable to allocate ring buffer %ld\n", ret);
- return FALSE;
- }
-
- pI830->LpRing->tail_mask = pI830->LpRing->mem.Size - 1;
-
-
- /* allocate front buffer */
- memset(&(pI830->FrontBuffer), 0, sizeof(pI830->FrontBuffer));
- pI830->FrontBuffer.Key = -1;
- pI830->FrontBuffer.Pitch = ctx->shared.virtualWidth;
-
- align = KB(512);
-
- lineSize = ctx->shared.virtualWidth * ctx->cpp;
- lines = (ctx->shared.virtualHeight + 15) / 16 * 16;
- size = lineSize * lines;
- size = ROUND_TO_PAGE(size);
-
- align = GetBestTileAlignment(size);
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->FrontBuffer, &pI830->StolenPool, size, align, 0);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate front buffer %ld\n", ret);
- return FALSE;
- }
-
- memset(&(pI830->BackBuffer), 0, sizeof(pI830->BackBuffer));
- pI830->BackBuffer.Key = -1;
- pI830->BackBuffer.Pitch = ctx->shared.virtualWidth;
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->BackBuffer, &pI830->StolenPool, size, align, 0);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate back buffer %ld\n", ret);
- return FALSE;
- }
-
- memset(&(pI830->DepthBuffer), 0, sizeof(pI830->DepthBuffer));
- pI830->DepthBuffer.Key = -1;
- pI830->DepthBuffer.Pitch = ctx->shared.virtualWidth;
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->DepthBuffer, &pI830->StolenPool, size, align, 0);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate depth buffer %ld\n", ret);
- return FALSE;
- }
-
- memset(&(pI830->ContextMem), 0, sizeof(pI830->ContextMem));
- pI830->ContextMem.Key = -1;
- size = KB(32);
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->ContextMem, &pI830->StolenPool, size, align, 0);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate context buffer %ld\n", ret);
- return FALSE;
- }
-
-#if 0
- memset(&(pI830->TexMem), 0, sizeof(pI830->TexMem));
- pI830->TexMem.Key = -1;
-
- size = 32768 * 1024;
- ret = AllocFromAGP(ctx, pI830, size, align, &pI830->TexMem);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate texture memory %ld\n", ret);
- return FALSE;
- }
-#endif
-
- return TRUE;
-}
-
-static Bool
-I830BindMemory(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- if (!BindAgpRange(ctx, &pI830->LpRing->mem))
- return FALSE;
- if (!BindAgpRange(ctx, &pI830->FrontBuffer))
- return FALSE;
- if (!BindAgpRange(ctx, &pI830->BackBuffer))
- return FALSE;
- if (!BindAgpRange(ctx, &pI830->DepthBuffer))
- return FALSE;
- if (!BindAgpRange(ctx, &pI830->ContextMem))
- return FALSE;
-#if 0
- if (!BindAgpRange(ctx, &pI830->TexMem))
- return FALSE;
-#endif
- return TRUE;
-}
-
-static void SetupDRIMM(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- unsigned long aperEnd = ROUND_DOWN_TO(pI830->aper_size, GTT_PAGE_SIZE) / GTT_PAGE_SIZE;
- unsigned long aperStart = ROUND_TO(pI830->aper_size - KB(32768), GTT_PAGE_SIZE) / GTT_PAGE_SIZE;
-
- fprintf(stderr, "aper size is %08X\n", ctx->shared.fbSize);
- if (drmMMInit(ctx->drmFD, aperStart, aperEnd - aperStart, DRM_BO_MEM_TT)) {
- fprintf(stderr,
- "DRM MM Initialization Failed\n");
- } else {
- fprintf(stderr,
- "DRM MM Initialized at offset 0x%lx length %d page\n", aperStart, aperEnd-aperStart);
- }
-
-}
-
-static Bool
-I830CleanupDma(const DRIDriverContext *ctx)
-{
- drmI830Init info;
-
- memset(&info, 0, sizeof(drmI830Init));
- info.func = I830_CLEANUP_DMA;
-
- if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT,
- &info, sizeof(drmI830Init))) {
- fprintf(stderr, "I830 Dma Cleanup Failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static Bool
-I830InitDma(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- I830RingBuffer *ring = pI830->LpRing;
- drmI830Init info;
-
- memset(&info, 0, sizeof(drmI830Init));
- info.func = I830_INIT_DMA;
-
- info.ring_start = ring->mem.Start + pI830->LinearAddr;
- info.ring_end = ring->mem.End + pI830->LinearAddr;
- info.ring_size = ring->mem.Size;
-
- info.mmio_offset = (unsigned int)ctx->MMIOStart;
-
- info.sarea_priv_offset = sizeof(drm_sarea_t);
-
- info.front_offset = pI830->FrontBuffer.Start;
- info.back_offset = pI830->BackBuffer.Start;
- info.depth_offset = pI830->DepthBuffer.Start;
- info.w = ctx->shared.virtualWidth;
- info.h = ctx->shared.virtualHeight;
- info.pitch = ctx->shared.virtualWidth;
- info.back_pitch = pI830->BackBuffer.Pitch;
- info.depth_pitch = pI830->DepthBuffer.Pitch;
- info.cpp = ctx->cpp;
-
- if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT,
- &info, sizeof(drmI830Init))) {
- fprintf(stderr,
- "I830 Dma Initialization Failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static int I830CheckDRMVersion( const DRIDriverContext *ctx,
- I830Rec *pI830 )
-{
- drmVersionPtr version;
-
- version = drmGetVersion(ctx->drmFD);
-
- if (version) {
- int req_minor, req_patch;
-
- req_minor = 4;
- req_patch = 0;
-
- if (version->version_major != 1 ||
- version->version_minor < req_minor ||
- (version->version_minor == req_minor &&
- version->version_patchlevel < req_patch)) {
- /* Incompatible drm version */
- fprintf(stderr,
- "[dri] I830DRIScreenInit failed because of a version "
- "mismatch.\n"
- "[dri] i915.o kernel module version is %d.%d.%d "
- "but version 1.%d.%d or newer is needed.\n"
- "[dri] Disabling DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel,
- req_minor,
- req_patch);
- drmFreeVersion(version);
- return 0;
- }
-
- pI830->drmMinor = version->version_minor;
- drmFreeVersion(version);
- }
- return 1;
-}
-
-static void
-I830SetRingRegs(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- unsigned int itemp;
- unsigned char *MMIO = ctx->MMIOAddress;
-
- OUTREG(LP_RING + RING_LEN, 0);
- OUTREG(LP_RING + RING_TAIL, 0);
- OUTREG(LP_RING + RING_HEAD, 0);
-
- if ((long)(pI830->LpRing->mem.Start & I830_RING_START_MASK) !=
- pI830->LpRing->mem.Start) {
- fprintf(stderr,
- "I830SetRingRegs: Ring buffer start (%lx) violates its "
- "mask (%x)\n", pI830->LpRing->mem.Start, I830_RING_START_MASK);
- }
- /* Don't care about the old value. Reserved bits must be zero anyway. */
- itemp = pI830->LpRing->mem.Start & I830_RING_START_MASK;
- OUTREG(LP_RING + RING_START, itemp);
-
- if (((pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES) !=
- pI830->LpRing->mem.Size - 4096) {
- fprintf(stderr,
- "I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its "
- "mask (%x)\n", pI830->LpRing->mem.Size - 4096,
- I830_RING_NR_PAGES);
- }
- /* Don't care about the old value. Reserved bits must be zero anyway. */
- itemp = (pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES;
- itemp |= (RING_NO_REPORT | RING_VALID);
- OUTREG(LP_RING + RING_LEN, itemp);
-
- pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK;
- pI830->LpRing->tail = INREG(LP_RING + RING_TAIL);
- pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8);
- if (pI830->LpRing->space < 0)
- pI830->LpRing->space += pI830->LpRing->mem.Size;
-
- SetFenceRegs(ctx, pI830);
-
- /* RESET THE DISPLAY PIPE TO POINT TO THE FRONTBUFFER - hacky
- hacky hacky */
- OUTREG(DSPABASE, pI830->FrontBuffer.Start + pI830->LinearAddr);
-
-}
-
-static Bool
-I830SetParam(const DRIDriverContext *ctx, int param, int value)
-{
- drmI830SetParam sp;
-
- memset(&sp, 0, sizeof(sp));
- sp.param = param;
- sp.value = value;
-
- if (drmCommandWrite(ctx->drmFD, DRM_I830_SETPARAM, &sp, sizeof(sp))) {
- fprintf(stderr, "I830 SetParam Failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static Bool
-I830DRIMapScreenRegions(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
-{
- fprintf(stderr,
- "[drm] Mapping front buffer\n");
-
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)(sarea->front_offset + pI830->LinearAddr),
- sarea->front_size,
- DRM_FRAME_BUFFER, /*DRM_AGP,*/
- 0,
- &sarea->front_handle) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(front_handle) failed. Disabling DRI\n");
- return FALSE;
- }
- ctx->shared.hFrameBuffer = sarea->front_handle;
- ctx->shared.fbSize = sarea->front_size;
- fprintf(stderr, "[drm] Front Buffer = 0x%08x\n",
- sarea->front_handle);
-
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)(sarea->back_offset),
- sarea->back_size, DRM_AGP, 0,
- &sarea->back_handle) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(back_handle) failed. Disabling DRI\n");
- return FALSE;
- }
- fprintf(stderr, "[drm] Back Buffer = 0x%08x\n",
- sarea->back_handle);
-
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)sarea->depth_offset,
- sarea->depth_size, DRM_AGP, 0,
- &sarea->depth_handle) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(depth_handle) failed. Disabling DRI\n");
- return FALSE;
- }
- fprintf(stderr, "[drm] Depth Buffer = 0x%08x\n",
- sarea->depth_handle);
-
-#if 0
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)sarea->tex_offset,
- sarea->tex_size, DRM_AGP, 0,
- &sarea->tex_handle) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(tex_handle) failed. Disabling DRI\n");
- return FALSE;
- }
- fprintf(stderr, "[drm] textures = 0x%08x\n",
- sarea->tex_handle);
-#endif
- return TRUE;
-}
-
-
-static void
-I830DRIUnmapScreenRegions(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
-{
-#if 1
- if (sarea->front_handle) {
- drmRmMap(ctx->drmFD, sarea->front_handle);
- sarea->front_handle = 0;
- }
-#endif
- if (sarea->back_handle) {
- drmRmMap(ctx->drmFD, sarea->back_handle);
- sarea->back_handle = 0;
- }
- if (sarea->depth_handle) {
- drmRmMap(ctx->drmFD, sarea->depth_handle);
- sarea->depth_handle = 0;
- }
- if (sarea->tex_handle) {
- drmRmMap(ctx->drmFD, sarea->tex_handle);
- sarea->tex_handle = 0;
- }
-}
-
-static Bool
-I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
-{
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)pI830->LpRing->mem.Start,
- pI830->LpRing->mem.Size, DRM_AGP, 0,
- &pI830->ring_map) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(ring_map) failed. Disabling DRI\n");
- return FALSE;
- }
- fprintf(stderr, "[drm] ring buffer = 0x%08x\n",
- pI830->ring_map);
-
- if (I830InitDma(ctx, pI830) == FALSE) {
- return FALSE;
- }
-
- /* init to zero to be safe */
-
- I830DRIMapScreenRegions(ctx, pI830, sarea);
- SetupDRIMM(ctx, pI830);
-
- if (ctx->pciDevice != PCI_CHIP_845_G &&
- ctx->pciDevice != PCI_CHIP_I830_M) {
- I830SetParam(ctx, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 );
- }
-
- /* Okay now initialize the dma engine */
- {
- pI830->irq = drmGetInterruptFromBusID(ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if (drmCtlInstHandler(ctx->drmFD, pI830->irq)) {
- fprintf(stderr,
- "[drm] failure adding irq handler\n");
- pI830->irq = 0;
- return FALSE;
- }
- else
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- pI830->irq);
- }
-
- fprintf(stderr, "[dri] visual configs initialized\n");
-
- return TRUE;
-}
-
-static Bool
-I830ClearScreen(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
-{
- /* need to drmMap front and back buffers and zero them */
- drmAddress map_addr;
- int ret;
-
- ret = drmMap(ctx->drmFD,
- sarea->front_handle,
- sarea->front_size,
- &map_addr);
-
- if (ret)
- {
- fprintf(stderr, "Unable to map front buffer\n");
- return FALSE;
- }
-
- drimemsetio((char *)map_addr,
- 0,
- sarea->front_size);
- drmUnmap(map_addr, sarea->front_size);
-
-
- ret = drmMap(ctx->drmFD,
- sarea->back_handle,
- sarea->back_size,
- &map_addr);
-
- if (ret)
- {
- fprintf(stderr, "Unable to map back buffer\n");
- return FALSE;
- }
-
- drimemsetio((char *)map_addr,
- 0,
- sarea->back_size);
- drmUnmap(map_addr, sarea->back_size);
-
- return TRUE;
-}
-
-static Bool
-I830ScreenInit(DRIDriverContext *ctx, I830Rec *pI830)
-
-{
- I830DRIPtr pI830DRI;
- drmI830Sarea *pSAREAPriv;
- int err;
-
- drm_page_size = getpagesize();
-
- pI830->registerSize = ctx->MMIOSize;
- /* This is a hack for now. We have to have more than a 4k page here
- * because of the size of the state. However, the state should be
- * in a per-context mapping. This will be added in the Mesa 3.5 port
- * of the I830 driver.
- */
- ctx->shared.SAREASize = SAREA_MAX;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("i915", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08x\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
-
- }
-
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08x to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
-
- if (drmAddMap(ctx->drmFD,
- ctx->MMIOStart,
- ctx->MMIOSize,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &pI830->registerHandle) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08x\n", pI830->registerHandle);
-
-
- if (!I830CheckDRMVersion(ctx, pI830)) {
- return FALSE;
- }
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the SAREA private data structure */
- pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
-
- pI830->StolenMemory.Size = I830DetectMemory(ctx, pI830);
- pI830->StolenMemory.Start = 0;
- pI830->StolenMemory.End = pI830->StolenMemory.Size;
-
- pI830->MemoryAperture.Start = pI830->StolenMemory.End;
- pI830->MemoryAperture.End = KB(40000);
- pI830->MemoryAperture.Size = pI830->MemoryAperture.End - pI830->MemoryAperture.Start;
-
- pI830->StolenPool.Fixed = pI830->StolenMemory;
- pI830->StolenPool.Total = pI830->StolenMemory;
- pI830->StolenPool.Free = pI830->StolenPool.Total;
- pI830->FreeMemory = pI830->StolenPool.Total.Size;
-
- if (!AgpInit(ctx, pI830))
- return FALSE;
-
- if (I830AllocateMemory(ctx, pI830) == FALSE)
- {
- return FALSE;
- }
-
- if (I830BindMemory(ctx, pI830) == FALSE)
- {
- return FALSE;
- }
-
- pSAREAPriv->rotated_offset = -1;
- pSAREAPriv->rotated_size = 0;
- pSAREAPriv->rotated_pitch = ctx->shared.virtualWidth;
-
- pSAREAPriv->front_offset = pI830->FrontBuffer.Start;
- pSAREAPriv->front_size = pI830->FrontBuffer.Size;
- pSAREAPriv->width = ctx->shared.virtualWidth;
- pSAREAPriv->height = ctx->shared.virtualHeight;
- pSAREAPriv->pitch = ctx->shared.virtualWidth;
- pSAREAPriv->virtualX = ctx->shared.virtualWidth;
- pSAREAPriv->virtualY = ctx->shared.virtualHeight;
- pSAREAPriv->back_offset = pI830->BackBuffer.Start;
- pSAREAPriv->back_size = pI830->BackBuffer.Size;
- pSAREAPriv->depth_offset = pI830->DepthBuffer.Start;
- pSAREAPriv->depth_size = pI830->DepthBuffer.Size;
-#if 0
- pSAREAPriv->tex_offset = pI830->TexMem.Start;
- pSAREAPriv->tex_size = pI830->TexMem.Size;
-#endif
- pSAREAPriv->log_tex_granularity = pI830->TexGranularity;
-
- ctx->driverClientMsg = malloc(sizeof(I830DRIRec));
- ctx->driverClientMsgSize = sizeof(I830DRIRec);
- pI830DRI = (I830DRIPtr)ctx->driverClientMsg;
- pI830DRI->deviceID = pI830->Chipset;
- pI830DRI->regsSize = I830_REG_SIZE;
- pI830DRI->width = ctx->shared.virtualWidth;
- pI830DRI->height = ctx->shared.virtualHeight;
- pI830DRI->mem = ctx->shared.fbSize;
- pI830DRI->cpp = ctx->cpp;
-
- pI830DRI->bitsPerPixel = ctx->bpp;
- pI830DRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- err = I830DRIDoMappings(ctx, pI830, pSAREAPriv);
- if (err == FALSE)
- return FALSE;
-
- I830SetupMemoryTiling(ctx, pI830);
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
- I830ClearScreen(ctx, pI830, pSAREAPriv);
-
- I830SetRingRegs(ctx, pI830);
-
- return TRUE;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa radeonValidateMode().
- */
-static int i830ValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa i810ValidateMode().
- */
-static int i830PostValidateMode( const DRIDriverContext *ctx )
-{
- I830Rec *pI830 = ctx->driverPrivate;
-
- I830SetRingRegs(ctx, pI830);
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls I810ScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int i830InitFBDev( DRIDriverContext *ctx )
-{
- I830Rec *pI830 = calloc(1, sizeof(I830Rec));
- int i;
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- ctx->shared.Width = ctx->shared.virtualWidth;
- }
-
-
- for (i = 0; pitches[i] != 0; i++) {
- if (pitches[i] >= ctx->shared.virtualWidth) {
- ctx->shared.virtualWidth = pitches[i];
- break;
- }
- }
-
- ctx->driverPrivate = (void *)pI830;
-
- pI830->LpRing = calloc(1, sizeof(I830RingBuffer));
- pI830->Chipset = ctx->chipset;
- pI830->LinearAddr = ctx->FBStart;
-
- if (!I830ScreenInit( ctx, pI830 ))
- return 0;
-
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void i830HaltFBDev( DRIDriverContext *ctx )
-{
- drmI830Sarea *pSAREAPriv;
- I830Rec *pI830 = ctx->driverPrivate;
-
- if (pI830->irq) {
- drmCtlUninstHandler(ctx->drmFD);
- pI830->irq = 0; }
-
- I830CleanupDma(ctx);
-
- pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
-
- I830DRIUnmapScreenRegions(ctx, pI830, pSAREAPriv);
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-extern void i810NotifyFocus( int );
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-const struct DRIDriverRec __driDriver = {
- i830ValidateMode,
- i830PostValidateMode,
- i830InitFBDev,
- i830HaltFBDev,
- NULL,//I830EngineShutdown,
- NULL, //I830EngineRestore,
-#ifndef _EMBEDDED
- 0,
-#else
- i810NotifyFocus,
-#endif
-};
diff --git a/src/mesa/drivers/dri/mach64/Makefile b/src/mesa/drivers/dri/mach64/Makefile
index a8f463e9fd0..c20fdece297 100644
--- a/src/mesa/drivers/dri/mach64/Makefile
+++ b/src/mesa/drivers/dri/mach64/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
LIBNAME = mach64_dri.so
-# Not yet
-# MINIGLX_SOURCES = server/mach64_dri.c
-
DRIVER_SOURCES = \
mach64_context.c \
mach64_ioctl.c \
diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c
index 11bce31b12c..77e7e53ce04 100644
--- a/src/mesa/drivers/dri/mach64/mach64_context.c
+++ b/src/mesa/drivers/dri/mach64/mach64_context.c
@@ -211,7 +211,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
/* Allocate the vertex buffer
*/
- mmesa->vert_buf = ALIGN_MALLOC(MACH64_BUFFER_SIZE, 32);
+ mmesa->vert_buf = _mesa_align_malloc(MACH64_BUFFER_SIZE, 32);
if ( !mmesa->vert_buf )
return GL_FALSE;
mmesa->vert_used = 0;
@@ -291,7 +291,7 @@ void mach64DestroyContext( __DRIcontext *driContextPriv )
/* Free the vertex buffer */
if ( mmesa->vert_buf )
- ALIGN_FREE( mmesa->vert_buf );
+ _mesa_align_free( mmesa->vert_buf );
/* free the Mesa context */
mmesa->glCtx->DriverCtx = NULL;
diff --git a/src/mesa/drivers/dri/mach64/mach64_state.c b/src/mesa/drivers/dri/mach64/mach64_state.c
index b9093b5a139..69a5aea02ce 100644
--- a/src/mesa/drivers/dri/mach64/mach64_state.c
+++ b/src/mesa/drivers/dri/mach64/mach64_state.c
@@ -1156,12 +1156,10 @@ void mach64DDInitStateFuncs( GLcontext *ctx )
{
ctx->Driver.UpdateState = mach64DDInvalidateState;
- ctx->Driver.ClearIndex = NULL;
ctx->Driver.ClearColor = mach64DDClearColor;
ctx->Driver.DrawBuffer = mach64DDDrawBuffer;
ctx->Driver.ReadBuffer = mach64DDReadBuffer;
- ctx->Driver.IndexMask = NULL;
ctx->Driver.ColorMask = mach64DDColorMask;
ctx->Driver.AlphaFunc = mach64DDAlphaFunc;
ctx->Driver.BlendEquationSeparate = mach64DDBlendEquationSeparate;
diff --git a/src/mesa/drivers/dri/mach64/mach64_texmem.c b/src/mesa/drivers/dri/mach64/mach64_texmem.c
index 46cee4320d0..b09954ce235 100644
--- a/src/mesa/drivers/dri/mach64/mach64_texmem.c
+++ b/src/mesa/drivers/dri/mach64/mach64_texmem.c
@@ -305,6 +305,7 @@ void mach64UploadTexImages( mach64ContextPtr mmesa, mach64TexObjPtr t )
t->heap = heap;
/* Set the base offset of the texture image */
+ assert(t->base.memBlock);
t->bufAddr = mmesa->mach64Screen->texOffset[heap] + t->base.memBlock->ofs;
/* Force loading the new state into the hardware */
@@ -457,7 +458,9 @@ void mach64UploadMultiTexImages( mach64ContextPtr mmesa,
}
/* Set the base offset of the texture image */
+ assert(t0->base.memBlock);
t0->bufAddr = mmesa->mach64Screen->texOffset[heap] + t0->base.memBlock->ofs;
+ assert(t1->base.memBlock);
t1->bufAddr = mmesa->mach64Screen->texOffset[heap] + t1->base.memBlock->ofs;
/* Force loading the new state into the hardware */
diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c
index c2a0adfef02..a81d21afffa 100644
--- a/src/mesa/drivers/dri/mach64/mach64_tris.c
+++ b/src/mesa/drivers/dri/mach64/mach64_tris.c
@@ -1248,7 +1248,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.c b/src/mesa/drivers/dri/mach64/mach64_vb.c
index 00da8353769..046aff28a8c 100644
--- a/src/mesa/drivers/dri/mach64/mach64_vb.c
+++ b/src/mesa/drivers/dri/mach64/mach64_vb.c
@@ -619,7 +619,7 @@ void mach64InitVB( GLcontext *ctx )
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- mmesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32);
+ mmesa->verts = (GLubyte *)_mesa_align_malloc(size * 4 * 16, 32);
{
static int firsttime = 1;
@@ -635,7 +635,7 @@ void mach64FreeVB( GLcontext *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
if (mmesa->verts) {
- ALIGN_FREE(mmesa->verts);
+ _mesa_align_free(mmesa->verts);
mmesa->verts = 0;
}
}
diff --git a/src/mesa/drivers/dri/mga/Makefile b/src/mesa/drivers/dri/mga/Makefile
index 0cc329fb22d..92533bccc29 100644
--- a/src/mesa/drivers/dri/mga/Makefile
+++ b/src/mesa/drivers/dri/mga/Makefile
@@ -5,8 +5,6 @@ include $(TOP)/configs/current
LIBNAME = mga_dri.so
-MINIGLX_SOURCES = server/mga_dri.c
-
DRIVER_SOURCES = \
mgadd.c \
mgaioctl.c \
diff --git a/src/mesa/drivers/dri/mga/mgapixel.c b/src/mesa/drivers/dri/mga/mgapixel.c
index 69415f8a839..664f7c77c2b 100644
--- a/src/mesa/drivers/dri/mga/mgapixel.c
+++ b/src/mesa/drivers/dri/mga/mgapixel.c
@@ -600,7 +600,7 @@ mgaTryDrawPixels( GLcontext *ctx,
}
}
#else
- MEMCPY( address, pixels, rows*bufferpitch );
+ memcpy( address, pixels, rows*bufferpitch );
#endif
do_draw_pix( ctx, x, y, width, rows,
diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c
index 0253044761d..745d5e98525 100644
--- a/src/mesa/drivers/dri/mga/mgastate.c
+++ b/src/mesa/drivers/dri/mga/mgastate.c
@@ -1193,8 +1193,5 @@ void mgaDDInitStateFuncs( GLcontext *ctx )
ctx->Driver.Viewport = mgaViewport;
ctx->Driver.RenderMode = mgaRenderMode;
- ctx->Driver.ClearIndex = 0;
- ctx->Driver.IndexMask = 0;
-
TNL_CONTEXT(ctx)->Driver.RunPipeline = mgaRunPipeline;
}
diff --git a/src/mesa/drivers/dri/mga/mgatexmem.c b/src/mesa/drivers/dri/mga/mgatexmem.c
index 47be6f3c185..58afbbb279e 100644
--- a/src/mesa/drivers/dri/mga/mgatexmem.c
+++ b/src/mesa/drivers/dri/mga/mgatexmem.c
@@ -222,6 +222,7 @@ int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t )
return -1;
}
+ assert(t->base.memBlock);
ofs = mmesa->mgaScreen->textureOffset[ heap ]
+ t->base.memBlock->ofs;
diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c
index 4c58c3bdb04..07cf682f6e4 100644
--- a/src/mesa/drivers/dri/mga/mgatris.c
+++ b/src/mesa/drivers/dri/mga/mgatris.c
@@ -347,7 +347,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_BACK_COLORS 0
#define HAVE_SPEC 1
#define HAVE_HW_FLATSHADE 0
diff --git a/src/mesa/drivers/dri/mga/mgavb.c b/src/mesa/drivers/dri/mga/mgavb.c
index def5109863c..71bbf33f230 100644
--- a/src/mesa/drivers/dri/mga/mgavb.c
+++ b/src/mesa/drivers/dri/mga/mgavb.c
@@ -451,7 +451,7 @@ void mgaInitVB( GLcontext *ctx )
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- mmesa->verts = (GLubyte *)ALIGN_MALLOC(size * sizeof(mgaVertex), 32);
+ mmesa->verts = (GLubyte *)_mesa_align_malloc(size * sizeof(mgaVertex), 32);
{
static int firsttime = 1;
@@ -471,7 +471,7 @@ void mgaFreeVB( GLcontext *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
if (mmesa->verts) {
- ALIGN_FREE(mmesa->verts);
+ _mesa_align_free(mmesa->verts);
mmesa->verts = 0;
}
}
diff --git a/src/mesa/drivers/dri/mga/server/mga_dri.c b/src/mesa/drivers/dri/mga/server/mga_dri.c
deleted file mode 100644
index bc575e62ee8..00000000000
--- a/src/mesa/drivers/dri/mga/server/mga_dri.c
+++ /dev/null
@@ -1,1088 +0,0 @@
-
-/*
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES
- * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include "driver.h"
-#include "drm.h"
-#include "memops.h"
-
-#include "mga_reg.h"
-#include "mga.h"
-#include "mga_macros.h"
-#include "mga_dri.h"
-
-
-/* Quiescence, locking
- */
-#define MGA_TIMEOUT 2048
-
-static void MGAWaitForIdleDMA( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- drm_lock_t lock;
- int ret;
- int i = 0;
-
- memset( &lock, 0, sizeof(lock) );
-
- for (;;) {
- do {
- /* first ask for quiescent and flush */
- lock.flags = DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH;
- do {
- ret = drmCommandWrite( ctx->drmFD, DRM_MGA_FLUSH,
- &lock, sizeof( lock ) );
- } while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY );
-
- /* if it's still busy just try quiescent */
- if ( ret == -EBUSY ) {
- lock.flags = DRM_LOCK_QUIESCENT;
- do {
- ret = drmCommandWrite( ctx->drmFD, DRM_MGA_FLUSH,
- &lock, sizeof( lock ) );
- } while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY );
- }
- } while ( ( ret == -EBUSY ) && ( i++ < MGA_TIMEOUT ) );
-
- if ( ret == 0 )
- return;
-
- fprintf( stderr,
- "[dri] Idle timed out, resetting engine...\n" );
-
- drmCommandNone( ctx->drmFD, DRM_MGA_RESET );
- }
-}
-
-static unsigned int mylog2( unsigned int n )
-{
- unsigned int log2 = 1;
- while ( n > 1 ) n >>= 1, log2++;
- return log2;
-}
-
-static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga)
-{
- unsigned long mode;
- unsigned int vendor, device;
- int ret, count, i;
-
- if(pMga->agpSize < 12)pMga->agpSize = 12;
- if(pMga->agpSize > 64)pMga->agpSize = 64; /* cap */
-
- /* FIXME: Make these configurable...
- */
- pMga->agp.size = pMga->agpSize * 1024 * 1024;
-
- pMga->warp.offset = 0;
- pMga->warp.size = MGA_WARP_UCODE_SIZE;
-
- pMga->primary.offset = (pMga->warp.offset +
- pMga->warp.size);
- pMga->primary.size = 1024 * 1024;
-
- pMga->buffers.offset = (pMga->primary.offset +
- pMga->primary.size);
- pMga->buffers.size = MGA_NUM_BUFFERS * MGA_BUFFER_SIZE;
-
-
- pMga->agpTextures.offset = (pMga->buffers.offset +
- pMga->buffers.size);
-
- pMga->agpTextures.size = pMga->agp.size -
- pMga->agpTextures.offset;
-
- if ( drmAgpAcquire( ctx->drmFD ) < 0 ) {
- fprintf( stderr, "[agp] AGP not available\n" );
- return 0;
- }
-
- mode = drmAgpGetMode( ctx->drmFD ); /* Default mode */
- vendor = drmAgpVendorId( ctx->drmFD );
- device = drmAgpDeviceId( ctx->drmFD );
-
- mode &= ~MGA_AGP_MODE_MASK;
- switch ( pMga->agpMode ) {
- case 4:
- mode |= MGA_AGP_4X_MODE;
- case 2:
- mode |= MGA_AGP_2X_MODE;
- case 1:
- default:
- mode |= MGA_AGP_1X_MODE;
- }
-
-#if 0
- fprintf( stderr,
- "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n",
- mode, vendor, device,
- ctx->pciVendor,
- ctx->pciChipType );
-#endif
-
- if ( drmAgpEnable( ctx->drmFD, mode ) < 0 ) {
- fprintf( stderr, "[agp] AGP not enabled\n" );
- drmAgpRelease( ctx->drmFD );
- return 0;
- }
-
- if ( pMga->Chipset == PCI_CHIP_MGAG200 ) {
- switch ( pMga->agpMode ) {
- case 2:
- fprintf( stderr,
- "[drm] Enabling AGP 2x PLL encoding\n" );
- OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_ENABLE );
- break;
-
- case 1:
- default:
- fprintf( stderr,
- "[drm] Disabling AGP 2x PLL encoding\n" );
- OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_DISABLE );
- pMga->agpMode = 1;
- break;
- }
- }
-
- ret = drmAgpAlloc( ctx->drmFD, pMga->agp.size,
- 0, NULL, &pMga->agp.handle );
- if ( ret < 0 ) {
- fprintf( stderr, "[agp] Out of memory (%d)\n", ret );
- drmAgpRelease( ctx->drmFD );
- return 0;
- }
- fprintf( stderr,
- "[agp] %d kB allocated with handle 0x%08x\n",
- pMga->agp.size/1024, (unsigned int)pMga->agp.handle );
-
- if ( drmAgpBind( ctx->drmFD, pMga->agp.handle, 0 ) < 0 ) {
- fprintf( stderr, "[agp] Could not bind memory\n" );
- drmAgpFree( ctx->drmFD, pMga->agp.handle );
- drmAgpRelease( ctx->drmFD );
- return 0;
- }
-
- /* WARP microcode space
- */
- if ( drmAddMap( ctx->drmFD,
- pMga->warp.offset,
- pMga->warp.size,
- DRM_AGP, DRM_READ_ONLY,
- &pMga->warp.handle ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not add WARP microcode mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] WARP microcode handle = 0x%08x\n",
- pMga->warp.handle );
-
- if ( drmMap( ctx->drmFD,
- pMga->warp.handle,
- pMga->warp.size,
- &pMga->warp.map ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not map WARP microcode\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] WARP microcode mapped at 0x%08lx\n",
- (unsigned long)pMga->warp.map );
-
- /* Primary DMA space
- */
- if ( drmAddMap( ctx->drmFD,
- pMga->primary.offset,
- pMga->primary.size,
- DRM_AGP, DRM_READ_ONLY,
- &pMga->primary.handle ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not add primary DMA mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] Primary DMA handle = 0x%08x\n",
- pMga->primary.handle );
-
- if ( drmMap( ctx->drmFD,
- pMga->primary.handle,
- pMga->primary.size,
- &pMga->primary.map ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not map primary DMA\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] Primary DMA mapped at 0x%08lx\n",
- (unsigned long)pMga->primary.map );
-
- /* DMA buffers
- */
- if ( drmAddMap( ctx->drmFD,
- pMga->buffers.offset,
- pMga->buffers.size,
- DRM_AGP, 0,
- &pMga->buffers.handle ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not add DMA buffers mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] DMA buffers handle = 0x%08x\n",
- pMga->buffers.handle );
-
- if ( drmMap( ctx->drmFD,
- pMga->buffers.handle,
- pMga->buffers.size,
- &pMga->buffers.map ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not map DMA buffers\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] DMA buffers mapped at 0x%08lx\n",
- (unsigned long)pMga->buffers.map );
-
- count = drmAddBufs( ctx->drmFD,
- MGA_NUM_BUFFERS, MGA_BUFFER_SIZE,
- DRM_AGP_BUFFER, pMga->buffers.offset );
- if ( count <= 0 ) {
- fprintf( stderr,
- "[drm] failure adding %d %d byte DMA buffers\n",
- MGA_NUM_BUFFERS, MGA_BUFFER_SIZE );
- return 0;
- }
- fprintf( stderr,
- "[drm] Added %d %d byte DMA buffers\n",
- count, MGA_BUFFER_SIZE );
-
- i = mylog2(pMga->agpTextures.size / MGA_NR_TEX_REGIONS);
- if(i < MGA_LOG_MIN_TEX_REGION_SIZE)
- i = MGA_LOG_MIN_TEX_REGION_SIZE;
- pMga->agpTextures.size = (pMga->agpTextures.size >> i) << i;
-
- if ( drmAddMap( ctx->drmFD,
- pMga->agpTextures.offset,
- pMga->agpTextures.size,
- DRM_AGP, 0,
- &pMga->agpTextures.handle ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not add agpTexture mapping\n" );
- return 0;
- }
-/* should i map it ? */
- fprintf( stderr,
- "[agp] agpTexture handle = 0x%08x\n",
- pMga->agpTextures.handle );
- fprintf( stderr,
- "[agp] agpTexture size: %d kb\n", pMga->agpTextures.size/1024 );
-
- return 1;
-}
-
-static int MGADRIMapInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- pMga->registers.size = MGAIOMAPSIZE;
-
- if ( drmAddMap( ctx->drmFD,
- (drm_handle_t)pMga->IOAddress,
- pMga->registers.size,
- DRM_REGISTERS, DRM_READ_ONLY,
- &pMga->registers.handle ) < 0 ) {
- fprintf( stderr,
- "[drm] Could not add MMIO registers mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[drm] Registers handle = 0x%08lx\n",
- pMga->registers.handle );
-
- pMga->status.size = SAREA_MAX;
-
- if ( drmAddMap( ctx->drmFD, 0, pMga->status.size,
- DRM_SHM, DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL,
- &pMga->status.handle ) < 0 ) {
- fprintf( stderr,
- "[drm] Could not add status page mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[drm] Status handle = 0x%08x\n",
- pMga->status.handle );
-
- if ( drmMap( ctx->drmFD,
- pMga->status.handle,
- pMga->status.size,
- &pMga->status.map ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not map status page\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] Status page mapped at 0x%08lx\n",
- (unsigned long)pMga->status.map );
-
- return 1;
-}
-
-static int MGADRIKernelInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- drm_mga_init_t init;
- int ret;
-
- memset( &init, 0, sizeof(init) );
-
- init.func = MGA_INIT_DMA;
- init.sarea_priv_offset = sizeof(drm_sarea_t);
-
- switch ( pMga->Chipset ) {
- case PCI_CHIP_MGAG550:
- case PCI_CHIP_MGAG400:
- init.chipset = MGA_CARD_TYPE_G400;
- break;
- case PCI_CHIP_MGAG200:
- case PCI_CHIP_MGAG200_PCI:
- init.chipset = MGA_CARD_TYPE_G200;
- break;
- default:
- return 0;
- }
-
- init.sgram = 0; /* FIXME !pMga->HasSDRAM; */
-
-
- switch (ctx->bpp)
- {
- case 16:
- init.maccess = MGA_MACCESS_PW16;
- break;
- case 32:
- init.maccess = MGA_MACCESS_PW32;
- break;
- default:
- fprintf( stderr, "[mga] invalid bpp (%d)\n", ctx->bpp );
- return 0;
- }
-
-
- init.fb_cpp = ctx->bpp / 8;
- init.front_offset = pMga->frontOffset;
- init.front_pitch = pMga->frontPitch / init.fb_cpp;
- init.back_offset = pMga->backOffset;
- init.back_pitch = pMga->backPitch / init.fb_cpp;
-
- init.depth_cpp = ctx->bpp / 8;
- init.depth_offset = pMga->depthOffset;
- init.depth_pitch = pMga->depthPitch / init.depth_cpp;
-
- init.texture_offset[0] = pMga->textureOffset;
- init.texture_size[0] = pMga->textureSize;
-
- init.fb_offset = ctx->shared.hFrameBuffer;
- init.mmio_offset = pMga->registers.handle;
- init.status_offset = pMga->status.handle;
-
- init.warp_offset = pMga->warp.handle;
- init.primary_offset = pMga->primary.handle;
- init.buffers_offset = pMga->buffers.handle;
-
- init.texture_offset[1] = pMga->agpTextures.handle;
- init.texture_size[1] = pMga->agpTextures.size;
-
- ret = drmCommandWrite( ctx->drmFD, DRM_MGA_INIT, &init, sizeof(init));
- if ( ret < 0 ) {
- fprintf( stderr,
- "[drm] Failed to initialize DMA! (%d)\n", ret );
- return 0;
- }
-
- return 1;
-}
-
-static void MGADRIIrqInit(struct DRIDriverContextRec *ctx, MGAPtr pMga)
-{
- if (!pMga->irq)
- {
- pMga->irq = drmGetInterruptFromBusID(ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- fprintf(stderr, "[drm] got IRQ %d\n", pMga->irq);
-
- if((drmCtlInstHandler(ctx->drmFD, pMga->irq)) != 0)
- {
- fprintf(stderr,
- "[drm] failure adding irq handler, "
- "there is a device already using that irq\n"
- "[drm] falling back to irq-free operation\n");
- pMga->irq = 0;
- }
- else
- {
- pMga->reg_ien = INREG( MGAREG_IEN );
- }
- }
-
- if (pMga->irq)
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- pMga->irq);
-}
-
-static int MGADRIBuffersInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- pMga->drmBuffers = drmMapBufs( ctx->drmFD );
- if ( !pMga->drmBuffers )
- {
- fprintf( stderr,
- "[drm] Failed to map DMA buffers list\n" );
- return 0;
- }
-
- fprintf( stderr,
- "[drm] Mapped %d DMA buffers\n",
- pMga->drmBuffers->count );
-
- return 1;
-}
-
-static int MGAMemoryInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int bufferSize = ((ctx->shared.virtualHeight * width_bytes
- + MGA_BUFFER_ALIGN)
- & ~MGA_BUFFER_ALIGN);
- int depthSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes
- + MGA_BUFFER_ALIGN)
- & ~MGA_BUFFER_ALIGN);
- int l;
-
- pMga->frontOffset = 0;
- pMga->frontPitch = ctx->shared.virtualWidth * ctx->cpp;
-
- fprintf(stderr,
- "Using %d MB AGP aperture\n", pMga->agpSize);
- fprintf(stderr,
- "Using %d MB for vertex/indirect buffers\n", pMga->buffers.size>>20);
- fprintf(stderr,
- "Using %d MB for AGP textures\n", pMga->agpTextures.size>>20);
-
- /* Front, back and depth buffers - everything else texture??
- */
- pMga->textureSize = ctx->shared.fbSize - 2 * bufferSize - depthSize;
-
- if (pMga->textureSize < 0)
- return 0;
-
- l = mylog2( pMga->textureSize / MGA_NR_TEX_REGIONS );
- if ( l < MGA_LOG_MIN_TEX_REGION_SIZE )
- l = MGA_LOG_MIN_TEX_REGION_SIZE;
-
- /* Round the texture size up to the nearest whole number of
- * texture regions. Again, be greedy about this, don't
- * round down.
- */
- pMga->logTextureGranularity = l;
- pMga->textureSize = (pMga->textureSize >> l) << l;
-
- /* Set a minimum usable local texture heap size. This will fit
- * two 256x256x32bpp textures.
- */
- if (pMga->textureSize < 512 * 1024) {
- pMga->textureOffset = 0;
- pMga->textureSize = 0;
- }
-
- /* Reserve space for textures */
- pMga->textureOffset = ((ctx->shared.fbSize - pMga->textureSize +
- MGA_BUFFER_ALIGN) &
- ~MGA_BUFFER_ALIGN);
-
- /* Reserve space for the shared depth
- * buffer.
- */
- pMga->depthOffset = ((pMga->textureOffset - depthSize +
- MGA_BUFFER_ALIGN) &
- ~MGA_BUFFER_ALIGN);
- pMga->depthPitch = ctx->shared.virtualWidth * ctx->cpp;
-
- pMga->backOffset = ((pMga->depthOffset - bufferSize +
- MGA_BUFFER_ALIGN) &
- ~MGA_BUFFER_ALIGN);
- pMga->backPitch = ctx->shared.virtualWidth * ctx->cpp;
-
-
- fprintf(stderr,
- "Will use back buffer at offset 0x%x\n",
- pMga->backOffset);
- fprintf(stderr,
- "Will use depth buffer at offset 0x%x\n",
- pMga->depthOffset);
- fprintf(stderr,
- "Will use %d kb for textures at offset 0x%x\n",
- pMga->textureSize/1024, pMga->textureOffset);
-
- return 1;
-}
-
-static int MGACheckDRMVersion( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- drmVersionPtr version;
-
- /* Check the MGA DRM version */
- version = drmGetVersion(ctx->drmFD);
- if ( version ) {
- if ( version->version_major != 3 ||
- version->version_minor < 0 ) {
- /* incompatible drm version */
- fprintf( stderr,
- "[dri] MGADRIScreenInit failed because of a version mismatch.\n"
- "[dri] mga.o kernel module version is %d.%d.%d but version 3.0.x is needed.\n"
- "[dri] Disabling DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel );
- drmFreeVersion( version );
- return 0;
- }
- drmFreeVersion( version );
- }
-
- return 1;
-}
-
-static void print_client_msg( MGADRIPtr pMGADRI )
-{
- fprintf( stderr, "chipset: %d\n", pMGADRI->chipset );
-
- fprintf( stderr, "width: %d\n", pMGADRI->width );
- fprintf( stderr, "height: %d\n", pMGADRI->height );
- fprintf( stderr, "mem: %d\n", pMGADRI->mem );
- fprintf( stderr, "cpp: %d\n", pMGADRI->cpp );
-
- fprintf( stderr, "agpMode: %d\n", pMGADRI->agpMode );
-
- fprintf( stderr, "frontOffset: %d\n", pMGADRI->frontOffset );
- fprintf( stderr, "frontPitch: %d\n", pMGADRI->frontPitch );
-
- fprintf( stderr, "backOffset: %d\n", pMGADRI->backOffset );
- fprintf( stderr, "backPitch: %d\n", pMGADRI->backPitch );
-
- fprintf( stderr, "depthOffset: %d\n", pMGADRI->depthOffset );
- fprintf( stderr, "depthPitch: %d\n", pMGADRI->depthPitch );
-
- fprintf( stderr, "textureOffset: %d\n", pMGADRI->textureOffset );
- fprintf( stderr, "textureSize: %d\n", pMGADRI->textureSize );
-
- fprintf( stderr, "logTextureGranularity: %d\n", pMGADRI->logTextureGranularity );
- fprintf( stderr, "logAgpTextureGranularity: %d\n", pMGADRI->logAgpTextureGranularity );
-
- fprintf( stderr, "agpTextureHandle: %u\n", (unsigned int)pMGADRI->agpTextureOffset );
- fprintf( stderr, "agpTextureSize: %u\n", (unsigned int)pMGADRI->agpTextureSize );
-
-#if 0
- pMGADRI->registers.handle = pMga->registers.handle;
- pMGADRI->registers.size = pMga->registers.size;
- pMGADRI->status.handle = pMga->status.handle;
- pMGADRI->status.size = pMga->status.size;
- pMGADRI->primary.handle = pMga->primary.handle;
- pMGADRI->primary.size = pMga->primary.size;
- pMGADRI->buffers.handle = pMga->buffers.handle;
- pMGADRI->buffers.size = pMga->buffers.size;
- pMGADRI->sarea_priv_offset = sizeof(drm_sarea_t);
-#endif
-}
-
-static int MGAScreenInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- int i;
- int err;
- MGADRIPtr pMGADRI;
-
- usleep(100);
- /*assert(!ctx->IsClient);*/
-
- {
- int width_bytes = (ctx->shared.virtualWidth * ctx->cpp);
- int maxy = ctx->shared.fbSize / width_bytes;
-
-
- if (maxy <= ctx->shared.virtualHeight * 3) {
- fprintf(stderr,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (ctx->shared.virtualWidth * ctx->shared.virtualHeight *
- ctx->cpp * 3 + 1023) / 1024,
- ctx->shared.fbSize / 1024);
- return 0;
- }
- }
-
- switch(pMga->Chipset) {
- case PCI_CHIP_MGAG550:
- case PCI_CHIP_MGAG400:
- case PCI_CHIP_MGAG200:
-#if 0
- case PCI_CHIP_MGAG200_PCI:
-#endif
- break;
- default:
- fprintf(stderr, "[drm] Direct rendering only supported with G200/G400/G550 AGP\n");
- return 0;
- }
-
- fprintf( stderr,
- "[drm] bpp: %d depth: %d\n",
- ctx->bpp, ctx->bpp /* FIXME: depth */ );
-
- if ( (ctx->bpp / 8) != 2 &&
- (ctx->bpp / 8) != 4 ) {
- fprintf( stderr,
- "[dri] Direct rendering only supported in 16 and 32 bpp modes\n" );
- return 0;
- }
-
- ctx->shared.SAREASize = SAREA_MAX;
-
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("mga", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
- 0,
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
-
-#if 0 /* will be done in MGADRIMapInit */
- if (drmAddMap(ctx->drmFD,
- ctx->FixedInfo.mmio_start,
- ctx->FixedInfo.mmio_len,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &pMga->registers.handle) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08lx\n", pMga->registers.handle);
-#endif
-
-
- /* Check the mga DRM version */
- if (!MGACheckDRMVersion(ctx, pMga)) {
- return 0;
- }
-
- if ( !MGADRIAgpInit( ctx, pMga ) ) {
- return 0;
- }
-
- if ( !MGADRIMapInit( ctx, pMga ) ) {
- return 0;
- }
-
- /* Memory manager setup */
- if (!MGAMemoryInit(ctx, pMga)) {
- return 0;
- }
-
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the kernel data structures */
- if (!MGADRIKernelInit(ctx, pMga)) {
- fprintf(stderr, "MGADRIKernelInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize the vertex buffers list */
- if (!MGADRIBuffersInit(ctx, pMga)) {
- fprintf(stderr, "MGADRIBuffersInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize IRQ */
- MGADRIIrqInit(ctx, pMga);
-
-
- /* Initialize the SAREA private data structure */
- {
- drm_mga_sarea_t *pSAREAPriv;
- pSAREAPriv = (drm_mga_sarea_t *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
- }
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
- drimemsetio((char *)ctx->FBAddress + pMga->frontOffset,
- 0,
- pMga->frontPitch * ctx->shared.virtualHeight );
-
- drimemsetio((char *)ctx->FBAddress + pMga->backOffset,
- 0,
- pMga->backPitch * ctx->shared.virtualHeight );
-
- /* Can release the lock now */
-/* DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);*/
-
- /* This is the struct passed to radeon_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(MGADRIRec));
- ctx->driverClientMsgSize = sizeof(MGADRIRec);
-
- pMGADRI = (MGADRIPtr)ctx->driverClientMsg;
-
-
- switch(pMga->Chipset) {
- case PCI_CHIP_MGAG550:
- case PCI_CHIP_MGAG400:
- pMGADRI->chipset = MGA_CARD_TYPE_G400;
- break;
- case PCI_CHIP_MGAG200:
- case PCI_CHIP_MGAG200_PCI:
- pMGADRI->chipset = MGA_CARD_TYPE_G200;
- break;
- default:
- return 0;
- }
- pMGADRI->width = ctx->shared.virtualWidth;
- pMGADRI->height = ctx->shared.virtualHeight;
- pMGADRI->mem = ctx->shared.fbSize;
- pMGADRI->cpp = ctx->bpp / 8;
-
- pMGADRI->agpMode = pMga->agpMode;
-
- pMGADRI->frontOffset = pMga->frontOffset;
- pMGADRI->frontPitch = pMga->frontPitch;
- pMGADRI->backOffset = pMga->backOffset;
- pMGADRI->backPitch = pMga->backPitch;
- pMGADRI->depthOffset = pMga->depthOffset;
- pMGADRI->depthPitch = pMga->depthPitch;
- pMGADRI->textureOffset = pMga->textureOffset;
- pMGADRI->textureSize = pMga->textureSize;
- pMGADRI->logTextureGranularity = pMga->logTextureGranularity;
-
- i = mylog2( pMga->agpTextures.size / MGA_NR_TEX_REGIONS );
- if ( i < MGA_LOG_MIN_TEX_REGION_SIZE )
- i = MGA_LOG_MIN_TEX_REGION_SIZE;
-
- pMGADRI->logAgpTextureGranularity = i;
- pMGADRI->agpTextureOffset = (unsigned int)pMga->agpTextures.handle;
- pMGADRI->agpTextureSize = (unsigned int)pMga->agpTextures.size;
-
- pMGADRI->registers.handle = pMga->registers.handle;
- pMGADRI->registers.size = pMga->registers.size;
- pMGADRI->status.handle = pMga->status.handle;
- pMGADRI->status.size = pMga->status.size;
- pMGADRI->primary.handle = pMga->primary.handle;
- pMGADRI->primary.size = pMga->primary.size;
- pMGADRI->buffers.handle = pMga->buffers.handle;
- pMGADRI->buffers.size = pMga->buffers.size;
- pMGADRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- print_client_msg( pMGADRI );
-
- return 1;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa mgaValidateMode().
- */
-static int mgaValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa mgaValidateMode().
- */
-static int mgaPostValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls MGAScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memomry accessing it directly.
- */
-static int mgaInitFBDev( struct DRIDriverContextRec *ctx )
-{
- MGAPtr pMga = calloc(1, sizeof(*pMga));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- }
-
- ctx->driverPrivate = (void *)pMga;
-
- pMga->agpMode = MGA_DEFAULT_AGP_MODE;
- pMga->agpSize = MGA_DEFAULT_AGP_SIZE;
-
- pMga->Chipset = ctx->chipset;
-
- pMga->IOAddress = ctx->MMIOStart;
- pMga->IOBase = ctx->MMIOAddress;
-
- pMga->frontPitch = ctx->shared.virtualWidth * ctx->cpp;
-
- if (!MGAScreenInit( ctx, pMga ))
- return 0;
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void mgaHaltFBDev( struct DRIDriverContextRec *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = NULL;
- }
-}
-
-
-static int mgaEngineShutdown( const DRIDriverContext *ctx )
-{
- fprintf(stderr, "%s() is not yet implemented!\n", __FUNCTION__);
-
- return 1;
-}
-
-static int mgaEngineRestore( const DRIDriverContext *ctx )
-{
- fprintf(stderr, "%s() is not yet implemented!\n", __FUNCTION__);
-
- return 1;
-}
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-struct DRIDriverRec __driDriver = {
- mgaValidateMode,
- mgaPostValidateMode,
- mgaInitFBDev,
- mgaHaltFBDev,
- mgaEngineShutdown,
- mgaEngineRestore,
- 0
-};
-
-
-
-
-#if 0
-void MGADRICloseScreen( ScreenPtr pScreen )
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGAPtr pMga = MGAPTR(pScrn);
- MGADRIServerPrivatePtr pMga = pMga->DRIServerInfo;
- drmMGAInit init;
-
- if ( pMga->drmBuffers ) {
- drmUnmapBufs( pMga->drmBuffers );
- pMga->drmBuffers = NULL;
- }
-
- if (pMga->irq) {
- drmCtlUninstHandler(ctx->drmFD);
- pMga->irq = 0;
- }
-
- /* Cleanup DMA */
- memset( &init, 0, sizeof(drmMGAInit) );
- init.func = MGA_CLEANUP_DMA;
- drmCommandWrite( ctx->drmFD, DRM_MGA_INIT, &init, sizeof(drmMGAInit) );
-
- if ( pMga->status.map ) {
- drmUnmap( pMga->status.map, pMga->status.size );
- pMga->status.map = NULL;
- }
- if ( pMga->buffers.map ) {
- drmUnmap( pMga->buffers.map, pMga->buffers.size );
- pMga->buffers.map = NULL;
- }
- if ( pMga->primary.map ) {
- drmUnmap( pMga->primary.map, pMga->primary.size );
- pMga->primary.map = NULL;
- }
- if ( pMga->warp.map ) {
- drmUnmap( pMga->warp.map, pMga->warp.size );
- pMga->warp.map = NULL;
- }
-
- if ( pMga->agpTextures.map ) {
- drmUnmap( pMga->agpTextures.map, pMga->agpTextures.size );
- pMga->agpTextures.map = NULL;
- }
-
- if ( pMga->agp.handle ) {
- drmAgpUnbind( ctx->drmFD, pMga->agp.handle );
- drmAgpFree( ctx->drmFD, pMga->agp.handle );
- pMga->agp.handle = 0;
- drmAgpRelease( ctx->drmFD );
- }
-
- DRICloseScreen( pScreen );
-
- if ( pMga->pDRIInfo ) {
- if ( pMga->pDRIpMga->devPrivate ) {
- xfree( pMga->pDRIpMga->devPrivate );
- pMga->pDRIpMga->devPrivate = 0;
- }
- DRIDestroyInfoRec( pMga->pDRIInfo );
- pMga->pDRIInfo = 0;
- }
- if ( pMga->DRIServerInfo ) {
- xfree( pMga->DRIServerInfo );
- pMga->DRIServerInfo = 0;
- }
- if ( pMga->pVisualConfigs ) {
- xfree( pMga->pVisualConfigs );
- }
- if ( pMga->pVisualConfigsPriv ) {
- xfree( pMga->pVisualConfigsPriv );
- }
-}
-#endif
diff --git a/src/mesa/drivers/dri/nouveau/Makefile b/src/mesa/drivers/dri/nouveau/Makefile
index 43bc9f95161..7be19b26fda 100644
--- a/src/mesa/drivers/dri/nouveau/Makefile
+++ b/src/mesa/drivers/dri/nouveau/Makefile
@@ -8,8 +8,6 @@ DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs)
LIBNAME = nouveau_vieux_dri.so
-MINIGLX_SOURCES =
-
DRIVER_SOURCES = \
nouveau_screen.c \
nouveau_context.c \
@@ -42,6 +40,7 @@ DRIVER_SOURCES = \
nv20_state_polygon.c \
nv20_state_raster.c \
nv20_state_tex.c \
+ nv20_state_frag.c \
nv20_state_tnl.c
C_SOURCES = \
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
index 1118b96de12..5906ad6d396 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
@@ -72,7 +72,7 @@ nouveau_bufferobj_data(GLcontext *ctx, GLenum target, GLsizeiptrARB size,
if (data) {
nouveau_bo_map(nbo->bo, NOUVEAU_BO_WR);
- _mesa_memcpy(nbo->bo->map, data, size);
+ memcpy(nbo->bo->map, data, size);
nouveau_bo_unmap(nbo->bo);
}
@@ -87,7 +87,7 @@ nouveau_bufferobj_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset,
struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
nouveau_bo_map(nbo->bo, NOUVEAU_BO_WR);
- _mesa_memcpy(nbo->bo->map + offset, data, size);
+ memcpy(nbo->bo->map + offset, data, size);
nouveau_bo_unmap(nbo->bo);
}
@@ -99,7 +99,7 @@ nouveau_bufferobj_get_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset,
struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
nouveau_bo_map(nbo->bo, NOUVEAU_BO_RD);
- _mesa_memcpy(data, nbo->bo->map + offset, size);
+ memcpy(data, nbo->bo->map + offset, size);
nouveau_bo_unmap(nbo->bo);
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index b1b0e816431..502e01255cb 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -43,18 +43,23 @@
#define need_GL_EXT_framebuffer_object
#define need_GL_EXT_fog_coord
+#define need_GL_EXT_secondary_color
#include "main/remap_helper.h"
static const struct dri_extension nouveau_extensions[] = {
- { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
{ "GL_ARB_multitexture", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
+ { "GL_ARB_texture_env_add", NULL },
{ "GL_ARB_texture_env_combine", NULL },
{ "GL_ARB_texture_env_dot3", NULL },
- { "GL_ARB_texture_env_add", NULL },
+ { "GL_ARB_texture_mirrored_repeat", NULL },
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
+ { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
+ { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
+ { "GL_EXT_stencil_wrap", NULL },
+ { "GL_EXT_texture_lod_bias", NULL },
+ { "GL_NV_blend_square", NULL },
+ { "GL_SGIS_generate_mipmap", NULL },
{ NULL, NULL }
};
@@ -168,19 +173,19 @@ nouveau_context_destroy(__DRIcontext *dri_ctx)
context_drv(ctx)->context_destroy(ctx);
}
-static void
-nouveau_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
- unsigned int *stamp)
+void
+nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
{
- struct nouveau_context *nctx = context->driverPrivate;
- GLcontext *ctx = &nctx->base;
- __DRIscreen *screen = context->driScreenPriv;
- struct gl_framebuffer *fb = drawable->driverPrivate;
+ GLcontext *ctx = dri_ctx->driverPrivate;
+ __DRIscreen *screen = dri_ctx->driScreenPriv;
+ struct gl_framebuffer *fb = draw->driverPrivate;
unsigned int attachments[10];
__DRIbuffer *buffers = NULL;
int i = 0, count, ret;
- *stamp = *drawable->pStamp;
+ if (draw->lastStamp == *draw->pStamp)
+ return;
+ draw->lastStamp = *draw->pStamp;
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
if (fb->Visual.doubleBufferMode)
@@ -192,10 +197,9 @@ nouveau_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
else if (fb->Visual.haveStencilBuffer)
attachments[i++] = __DRI_BUFFER_STENCIL;
- buffers = (*screen->dri2.loader->getBuffers)(drawable,
- &drawable->w, &drawable->h,
+ buffers = (*screen->dri2.loader->getBuffers)(draw, &draw->w, &draw->h,
attachments, i, &count,
- drawable->loaderPrivate);
+ draw->loaderPrivate);
if (buffers == NULL)
return;
@@ -227,8 +231,8 @@ nouveau_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
rb = fb->Attachment[index].Renderbuffer;
s = &to_nouveau_renderbuffer(rb)->surface;
- s->width = drawable->w;
- s->height = drawable->h;
+ s->width = draw->w;
+ s->height = draw->h;
s->pitch = buffers[i].pitch;
s->cpp = buffers[i].cpp;
@@ -244,12 +248,25 @@ nouveau_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
ret = nouveau_bo_handle_ref(context_dev(ctx),
buffers[i].name, &s->bo);
assert(!ret);
-
- context_dirty(ctx, FRAMEBUFFER);
}
}
- _mesa_resize_framebuffer(ctx, fb, drawable->w, drawable->h);
+ _mesa_resize_framebuffer(NULL, fb, draw->w, draw->h);
+}
+
+static void
+update_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw,
+ int *stamp)
+{
+ GLcontext *ctx = dri_ctx->driverPrivate;
+ struct gl_framebuffer *fb = draw->driverPrivate;
+
+ *stamp = *draw->pStamp;
+
+ nouveau_update_renderbuffers(dri_ctx, draw);
+ _mesa_resize_framebuffer(ctx, fb, draw->w, draw->h);
+
+ context_dirty(ctx, FRAMEBUFFER);
}
GLboolean
@@ -260,16 +277,15 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *dri_draw,
struct nouveau_context *nctx = dri_ctx->driverPrivate;
GLcontext *ctx = &nctx->base;
- if (dri_draw->driverPrivate == ctx->WinSysDrawBuffer &&
- dri_read->driverPrivate == ctx->WinSysReadBuffer)
- return GL_TRUE;
-
/* Ask the X server for new renderbuffers. */
- nouveau_update_renderbuffers(dri_ctx, dri_draw,
- &nctx->drawable.d_stamp);
- if (dri_draw != dri_read)
- nouveau_update_renderbuffers(dri_ctx, dri_read,
- &nctx->drawable.r_stamp);
+ if (dri_draw->driverPrivate != ctx->WinSysDrawBuffer)
+ update_framebuffer(dri_ctx, dri_draw,
+ &dri_ctx->dri2.draw_stamp);
+
+ if (dri_draw != dri_read &&
+ dri_read->driverPrivate != ctx->WinSysReadBuffer)
+ update_framebuffer(dri_ctx, dri_read,
+ &dri_ctx->dri2.read_stamp);
/* Pass it down to mesa. */
_mesa_make_current(ctx, dri_draw->driverPrivate,
@@ -307,30 +323,20 @@ nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode)
void
nouveau_validate_framebuffer(GLcontext *ctx)
{
- struct nouveau_context *nctx = to_nouveau_context(ctx);
__DRIcontext *dri_ctx = to_nouveau_context(ctx)->dri_context;
__DRIdrawable *dri_draw = dri_ctx->driDrawablePriv;
__DRIdrawable *dri_read = dri_ctx->driReadablePriv;
- if ((ctx->DrawBuffer->Name == 0 &&
- nctx->drawable.d_stamp != *dri_draw->pStamp) ||
- (dri_draw != dri_read &&
- ctx->ReadBuffer->Name == 0 &&
- nctx->drawable.r_stamp != *dri_read->pStamp)) {
- if (nctx->drawable.dirty)
- ctx->Driver.Flush(ctx);
+ if (ctx->DrawBuffer->Name == 0 &&
+ dri_ctx->dri2.draw_stamp != *dri_draw->pStamp)
+ update_framebuffer(dri_ctx, dri_draw,
+ &dri_ctx->dri2.draw_stamp);
- /* Ask the X server for new renderbuffers. */
- nouveau_update_renderbuffers(dri_ctx, dri_draw,
- &nctx->drawable.d_stamp);
- if (dri_draw != dri_read)
- nouveau_update_renderbuffers(dri_ctx, dri_read,
- &nctx->drawable.r_stamp);
-
- if (nouveau_next_dirty_state(ctx) >= 0)
- FIRE_RING(context_chan(ctx));
- }
+ if (ctx->ReadBuffer->Name == 0 && dri_draw != dri_read &&
+ dri_ctx->dri2.read_stamp != *dri_read->pStamp)
+ update_framebuffer(dri_ctx, dri_read,
+ &dri_ctx->dri2.read_stamp);
- /* Someone's planning to draw something really soon. */
- nctx->drawable.dirty = GL_TRUE;
+ if (nouveau_next_dirty_state(ctx) >= 0)
+ FIRE_RING(context_chan(ctx));
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index efe3e5148b1..682f8a414e3 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -56,12 +56,6 @@ struct nouveau_hw_state {
struct nouveau_grobj *sifm;
};
-struct nouveau_drawable_state {
- GLboolean dirty;
- unsigned int d_stamp;
- unsigned int r_stamp;
-};
-
struct nouveau_context {
GLcontext base;
__DRIcontext *dri_context;
@@ -73,7 +67,6 @@ struct nouveau_context {
struct nouveau_hw_state hw;
struct nouveau_bo_state bo;
struct nouveau_render_state render;
- struct nouveau_drawable_state drawable;
};
#define to_nouveau_context(ctx) ((struct nouveau_context *)(ctx))
@@ -107,9 +100,11 @@ nouveau_context_deinit(GLcontext *ctx);
void
nouveau_context_destroy(__DRIcontext *dri_ctx);
+void
+nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw);
+
GLboolean
-nouveau_context_make_current(__DRIcontext *dri_ctx,
- __DRIdrawable *ddraw,
+nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *ddraw,
__DRIdrawable *rdraw);
GLboolean
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index bf0e20ca81c..1d12f43741f 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -67,8 +67,6 @@ nouveau_flush(GLcontext *ctx)
dri2->flushFrontBuffer(drawable, drawable->loaderPrivate);
}
-
- nctx->drawable.dirty = GL_FALSE;
}
static void
@@ -112,8 +110,8 @@ nouveau_clear(GLcontext *ctx, GLbitfield buffers)
mask = pack_zs_i(s->format,
(buffers & BUFFER_BIT_DEPTH &&
ctx->Depth.Mask) ? ~0 : 0,
- (buffers & BUFFER_BIT_STENCIL &&
- ctx->Stencil.WriteMask[0]) ? ~0 : 0);
+ (buffers & BUFFER_BIT_STENCIL ?
+ ctx->Stencil.WriteMask[0] : 0));
value = pack_zs_f(s->format,
ctx->Depth.Clear,
ctx->Stencil.Clear);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.h b/src/mesa/drivers/dri/nouveau/nouveau_driver.h
index 54bf981a0f5..283f6eac2c8 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.h
@@ -70,7 +70,7 @@ struct nouveau_driver {
};
#define nouveau_error(format, ...) \
- _mesa_fprintf(stderr, "%s: " format, __func__, ## __VA_ARGS__)
+ fprintf(stderr, "%s: " format, __func__, ## __VA_ARGS__)
void
nouveau_clear(GLcontext *ctx, GLbitfield buffers);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 91eade8d633..2ec3dc92420 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -70,9 +70,9 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum internalFormat)
case GL_DEPTH_COMPONENT24:
case GL_STENCIL_INDEX8_EXT:
case GL_DEPTH24_STENCIL8_EXT:
- rb->_BaseFormat = GL_DEPTH_COMPONENT;
+ rb->_BaseFormat = GL_DEPTH_STENCIL;
rb->Format = MESA_FORMAT_Z24_S8;
- rb->DataType = GL_UNSIGNED_INT;
+ rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
s->cpp = 4;
break;
default:
@@ -142,7 +142,6 @@ nouveau_renderbuffer_dri_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->Width = width;
rb->Height = height;
- context_dirty(ctx, FRAMEBUFFER);
return GL_TRUE;
}
@@ -216,6 +215,8 @@ get_tex_format(struct gl_texture_image *ti)
switch (ti->TexFormat) {
case MESA_FORMAT_ARGB8888:
return GL_RGBA8;
+ case MESA_FORMAT_XRGB8888:
+ return GL_RGB8;
case MESA_FORMAT_RGB565:
return GL_RGB5;
default:
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 71e57e17e67..18db12f6261 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -27,6 +27,7 @@
#include "nouveau_driver.h"
#include "nouveau_context.h"
#include "nouveau_fbo.h"
+#include "nouveau_texture.h"
#include "nouveau_drmif.h"
#include "nv04_driver.h"
#include "nv10_driver.h"
@@ -226,8 +227,15 @@ static const struct __DRI2flushExtensionRec nouveau_flush_extension = {
dri2InvalidateDrawable,
};
+static const struct __DRItexBufferExtensionRec nouveau_texbuffer_extension = {
+ { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
+ NULL,
+ nouveau_set_texbuffer,
+};
+
static const __DRIextension *nouveau_screen_extensions[] = {
&nouveau_flush_extension.base,
+ &nouveau_texbuffer_extension.base,
NULL
};
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_span.c b/src/mesa/drivers/dri/nouveau/nouveau_span.c
index dbbbf15b096..f1a56dd03af 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_span.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_span.c
@@ -61,6 +61,15 @@
#include "spantmp2.h"
+/* RGB888 span functions */
+#define SPANTMP_PIXEL_FMT GL_BGR
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
+#define TAG(x) nouveau_##x##_rgb888
+#define TAG2(x, y) nouveau_##x##_rgb888##y
+#define GET_PTR(x, y) (s->bo->map + (y)*s->pitch + (x)*s->cpp)
+
+#include "spantmp2.h"
+
/* ARGB8888 span functions */
#define SPANTMP_PIXEL_FMT GL_BGRA
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
@@ -101,6 +110,8 @@ renderbuffer_map_unmap(struct gl_renderbuffer *rb, GLboolean map)
nouveau_InitPointers_rgb565(rb);
break;
case MESA_FORMAT_XRGB8888:
+ nouveau_InitPointers_rgb888(rb);
+ break;
case MESA_FORMAT_ARGB8888:
nouveau_InitPointers_argb8888(rb);
break;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index d7278221754..bc610451b40 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -150,6 +150,7 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
break;
case GL_COLOR_SUM_EXT:
context_dirty(ctx, FRAG);
+ context_dirty(ctx, LIGHT_MODEL);
break;
case GL_CULL_FACE:
context_dirty(ctx, CULL_FACE);
@@ -243,12 +244,6 @@ nouveau_fog(GLcontext *ctx, GLenum pname, const GLfloat *params)
}
static void
-nouveau_index_mask(GLcontext *ctx, GLuint mask)
-{
- context_dirty(ctx, INDEX_MASK);
-}
-
-static void
nouveau_light(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params)
{
switch (pname) {
@@ -396,7 +391,6 @@ nouveau_tex_parameter(GLcontext *ctx, GLenum target,
const GLfloat *params)
{
switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
@@ -408,9 +402,10 @@ nouveau_tex_parameter(GLcontext *ctx, GLenum target,
context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
break;
+ case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_BASE_LEVEL:
case GL_TEXTURE_MAX_LEVEL:
- texture_dirty(t);
+ nouveau_texture_reallocate(ctx, t);
context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
break;
}
@@ -504,7 +499,6 @@ nouveau_state_init(GLcontext *ctx)
ctx->Driver.DrawBuffers = nouveau_draw_buffers;
ctx->Driver.Enable = nouveau_enable;
ctx->Driver.Fogfv = nouveau_fog;
- ctx->Driver.IndexMask = nouveau_index_mask;
ctx->Driver.Lightfv = nouveau_light;
ctx->Driver.LightModelfv = nouveau_light_model;
ctx->Driver.LineStipple = nouveau_line_stipple;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.h b/src/mesa/drivers/dri/nouveau/nouveau_state.h
index d001fa259aa..d01d962c9f2 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.h
@@ -47,7 +47,6 @@ enum {
NOUVEAU_STATE_FRAG,
NOUVEAU_STATE_FRAMEBUFFER,
NOUVEAU_STATE_FOG,
- NOUVEAU_STATE_INDEX_MASK,
NOUVEAU_STATE_LIGHT_ENABLE,
NOUVEAU_STATE_LIGHT_MODEL,
NOUVEAU_STATE_LIGHT_SOURCE0,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index ab6e93cceb4..bf365bfca34 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -27,6 +27,7 @@
#include "nouveau_driver.h"
#include "nouveau_context.h"
#include "nouveau_texture.h"
+#include "nouveau_fbo.h"
#include "nouveau_util.h"
#include "main/texobj.h"
@@ -36,6 +37,7 @@
#include "main/texgetimage.h"
#include "main/mipmap.h"
#include "main/texfetch.h"
+#include "main/teximage.h"
static struct gl_texture_object *
nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target)
@@ -81,10 +83,12 @@ nouveau_teximage_map(GLcontext *ctx, struct gl_texture_image *ti)
struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
int ret;
- ret = nouveau_bo_map(s->bo, NOUVEAU_BO_RDWR);
- assert(!ret);
+ if (s->bo) {
+ ret = nouveau_bo_map(s->bo, NOUVEAU_BO_RDWR);
+ assert(!ret);
- ti->Data = s->bo->map;
+ ti->Data = s->bo->map;
+ }
}
static void
@@ -92,7 +96,8 @@ nouveau_teximage_unmap(GLcontext *ctx, struct gl_texture_image *ti)
{
struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
- nouveau_bo_unmap(s->bo);
+ if (s->bo)
+ nouveau_bo_unmap(s->bo);
ti->Data = NULL;
}
@@ -103,43 +108,28 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
switch (internalFormat) {
case 4:
case GL_RGBA:
- case GL_RGB10_A2:
+ case GL_RGBA2:
+ case GL_RGBA4:
+ case GL_RGBA8:
case GL_RGBA12:
case GL_RGBA16:
- case GL_RGBA8:
+ case GL_RGB10_A2:
+ return MESA_FORMAT_ARGB8888;
+ case GL_RGB5_A1:
+ return MESA_FORMAT_ARGB1555;
+
case GL_RGB:
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return MESA_FORMAT_ARGB8888;
- case GL_RGB5_A1:
- return MESA_FORMAT_ARGB1555;
- case GL_RGBA2:
- case GL_RGBA4:
- return MESA_FORMAT_ARGB4444;
-
+ return MESA_FORMAT_XRGB8888;
case 3:
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
return MESA_FORMAT_RGB565;
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_ALPHA8:
- return MESA_FORMAT_A8;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_LUMINANCE8:
- return MESA_FORMAT_L8;
-
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
@@ -150,12 +140,27 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE8_ALPHA8:
return MESA_FORMAT_ARGB8888;
+ case 1:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ case GL_LUMINANCE8:
+ return MESA_FORMAT_L8;
+
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ case GL_ALPHA8:
+ return MESA_FORMAT_A8;
+
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_INTENSITY8:
- return MESA_FORMAT_ARGB8888;
+ return MESA_FORMAT_I8;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
@@ -171,6 +176,152 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
}
}
+static GLboolean
+teximage_fits(struct gl_texture_object *t, int level,
+ struct gl_texture_image *ti)
+{
+ struct nouveau_surface *s = &to_nouveau_texture(t)->surfaces[level];
+
+ return t->Target == GL_TEXTURE_RECTANGLE ||
+ (s->bo && s->width == ti->Width &&
+ s->height == ti->Height &&
+ s->format == ti->TexFormat);
+}
+
+static GLboolean
+validate_teximage(GLcontext *ctx, struct gl_texture_object *t,
+ int level, int x, int y, int z,
+ int width, int height, int depth)
+{
+ struct gl_texture_image *ti = t->Image[0][level];
+
+ if (ti && teximage_fits(t, level, ti)) {
+ struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces;
+ struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
+
+ if (t->Target == GL_TEXTURE_RECTANGLE)
+ nouveau_surface_ref(s, &ss[level]);
+ else
+ context_drv(ctx)->surface_copy(ctx, &ss[level], s,
+ x, y, x, y,
+ width, height);
+
+ return GL_TRUE;
+ }
+
+ return GL_FALSE;
+}
+
+static int
+get_last_level(struct gl_texture_object *t)
+{
+ struct gl_texture_image *base = t->Image[0][t->BaseLevel];
+
+ if (t->MinFilter == GL_NEAREST ||
+ t->MinFilter == GL_LINEAR || !base)
+ return t->BaseLevel;
+ else
+ return MIN2(t->BaseLevel + base->MaxLog2, t->MaxLevel);
+}
+
+static void
+relayout_texture(GLcontext *ctx, struct gl_texture_object *t)
+{
+ struct gl_texture_image *base = t->Image[0][t->BaseLevel];
+
+ if (base && t->Target != GL_TEXTURE_RECTANGLE) {
+ struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces;
+ struct nouveau_surface *s = &to_nouveau_teximage(base)->surface;
+ int i, ret, last = get_last_level(t);
+ unsigned size, offset = 0,
+ width = s->width,
+ height = s->height;
+
+ /* Deallocate the old storage. */
+ for (i = 0; i < MAX_TEXTURE_LEVELS; i++)
+ nouveau_bo_ref(NULL, &ss[i].bo);
+
+ /* Relayout the mipmap tree. */
+ for (i = t->BaseLevel; i <= last; i++) {
+ size = width * height * s->cpp;
+
+ /* Images larger than 16B have to be aligned. */
+ if (size > 16)
+ offset = align(offset, 64);
+
+ ss[i] = (struct nouveau_surface) {
+ .offset = offset,
+ .layout = SWIZZLED,
+ .format = s->format,
+ .width = width,
+ .height = height,
+ .cpp = s->cpp,
+ .pitch = width * s->cpp,
+ };
+
+ offset += size;
+ width = MAX2(1, width / 2);
+ height = MAX2(1, height / 2);
+ }
+
+ /* Get new storage. */
+ size = align(offset, 64);
+
+ ret = nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_MAP |
+ NOUVEAU_BO_GART | NOUVEAU_BO_VRAM,
+ 0, size, &ss[last].bo);
+ assert(!ret);
+
+ for (i = t->BaseLevel; i < last; i++)
+ nouveau_bo_ref(ss[last].bo, &ss[i].bo);
+ }
+}
+
+GLboolean
+nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t)
+{
+ struct nouveau_texture *nt = to_nouveau_texture(t);
+ int i, last = get_last_level(t);
+
+ if (!nt->surfaces[last].bo)
+ return GL_FALSE;
+
+ if (nt->dirty) {
+ nt->dirty = GL_FALSE;
+
+ /* Copy the teximages to the actual miptree. */
+ for (i = t->BaseLevel; i <= last; i++) {
+ struct nouveau_surface *s = &nt->surfaces[i];
+
+ validate_teximage(ctx, t, i, 0, 0, 0,
+ s->width, s->height, 1);
+ }
+ }
+
+ return GL_TRUE;
+}
+
+void
+nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
+{
+ texture_dirty(t);
+ relayout_texture(ctx, t);
+ nouveau_texture_validate(ctx, t);
+}
+
+static unsigned
+get_teximage_placement(struct gl_texture_image *ti)
+{
+ if (ti->TexFormat == MESA_FORMAT_A8 ||
+ ti->TexFormat == MESA_FORMAT_L8 ||
+ ti->TexFormat == MESA_FORMAT_I8)
+ /* 1 cpp formats will have to be swizzled by the CPU,
+ * so leave them in system RAM for now. */
+ return NOUVEAU_BO_MAP;
+ else
+ return NOUVEAU_BO_GART | NOUVEAU_BO_MAP;
+}
+
static void
nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
GLint internalFormat,
@@ -181,37 +332,45 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
struct gl_texture_image *ti)
{
struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
- unsigned bo_flags = NOUVEAU_BO_GART | NOUVEAU_BO_RDWR | NOUVEAU_BO_MAP;
int ret;
/* Allocate a new bo for the image. */
- nouveau_surface_alloc(ctx, s, LINEAR, bo_flags, ti->TexFormat,
- width, height);
+ nouveau_surface_alloc(ctx, s, LINEAR, get_teximage_placement(ti),
+ ti->TexFormat, width, height);
ti->RowStride = s->pitch / s->cpp;
pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, depth,
format, type, pixels, packing,
"glTexImage");
- if (!pixels)
- return;
-
- /* Store the pixel data. */
- nouveau_teximage_map(ctx, ti);
-
- ret = _mesa_texstore(ctx, dims, ti->_BaseFormat,
- ti->TexFormat, ti->Data,
- 0, 0, 0, s->pitch,
- ti->ImageOffsets,
- width, height, depth,
- format, type, pixels, packing);
- assert(ret);
+ if (pixels) {
+ /* Store the pixel data. */
+ nouveau_teximage_map(ctx, ti);
+
+ ret = _mesa_texstore(ctx, dims, ti->_BaseFormat,
+ ti->TexFormat, ti->Data,
+ 0, 0, 0, s->pitch,
+ ti->ImageOffsets,
+ width, height, depth,
+ format, type, pixels, packing);
+ assert(ret);
+
+ nouveau_teximage_unmap(ctx, ti);
+ _mesa_unmap_teximage_pbo(ctx, packing);
+
+ if (!validate_teximage(ctx, t, level, 0, 0, 0,
+ width, height, depth))
+ /* It doesn't fit, mark it as dirty. */
+ texture_dirty(t);
+ }
- nouveau_teximage_unmap(ctx, ti);
- _mesa_unmap_teximage_pbo(ctx, packing);
+ if (level == t->BaseLevel) {
+ if (!teximage_fits(t, level, ti))
+ relayout_texture(ctx, t);
+ nouveau_texture_validate(ctx, t);
+ }
context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
- texture_dirty(t);
}
static void
@@ -271,8 +430,9 @@ nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level,
packing, t, ti);
nouveau_teximage_unmap(ctx, ti);
- context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
- texture_dirty(t);
+ if (!to_nouveau_texture(t)->dirty)
+ validate_teximage(ctx, t, level, xoffset, yoffset, zoffset,
+ width, height, depth);
}
static void
@@ -290,8 +450,9 @@ nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, GLint level,
packing, t, ti);
nouveau_teximage_unmap(ctx, ti);
- context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
- texture_dirty(t);
+ if (!to_nouveau_texture(t)->dirty)
+ validate_teximage(ctx, t, level, xoffset, yoffset, 0,
+ width, height, 1);
}
static void
@@ -308,8 +469,9 @@ nouveau_texsubimage_1d(GLcontext *ctx, GLenum target, GLint level,
packing, t, ti);
nouveau_teximage_unmap(ctx, ti);
- context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
- texture_dirty(t);
+ if (!to_nouveau_texture(t)->dirty)
+ validate_teximage(ctx, t, level, xoffset, 0, 0,
+ width, 1, 1);
}
static void
@@ -332,6 +494,57 @@ nouveau_bind_texture(GLcontext *ctx, GLenum target,
context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
}
+static gl_format
+get_texbuffer_format(struct gl_renderbuffer *rb, GLint format)
+{
+ struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface;
+
+ if (s->cpp < 4)
+ return s->format;
+ else if (format == __DRI_TEXTURE_FORMAT_RGBA)
+ return MESA_FORMAT_ARGB8888;
+ else
+ return MESA_FORMAT_XRGB8888;
+}
+
+void
+nouveau_set_texbuffer(__DRIcontext *dri_ctx,
+ GLint target, GLint format,
+ __DRIdrawable *draw)
+{
+ struct nouveau_context *nctx = dri_ctx->driverPrivate;
+ GLcontext *ctx = &nctx->base;
+ struct gl_framebuffer *fb = draw->driverPrivate;
+ struct gl_renderbuffer *rb =
+ fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
+ struct gl_texture_object *t = _mesa_get_current_tex_object(ctx, target);
+ struct gl_texture_image *ti;
+ struct nouveau_surface *s;
+
+ _mesa_lock_texture(ctx, t);
+ ti = _mesa_get_tex_image(ctx, t, target, 0);
+ s = &to_nouveau_teximage(ti)->surface;
+
+ /* Update the texture surface with the given drawable. */
+ nouveau_update_renderbuffers(dri_ctx, draw);
+ nouveau_surface_ref(&to_nouveau_renderbuffer(rb)->surface, s);
+
+ /* Update the image fields. */
+ _mesa_init_teximage_fields(ctx, target, ti, s->width, s->height,
+ 1, 0, s->cpp);
+ ti->RowStride = s->pitch / s->cpp;
+ ti->TexFormat = s->format = get_texbuffer_format(rb, format);
+
+ /* Try to validate it. */
+ if (!validate_teximage(ctx, t, 0, 0, 0, 0, s->width, s->height, 1))
+ nouveau_texture_reallocate(ctx, t);
+
+ context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
+ context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
+
+ _mesa_unlock_texture(ctx, t);
+}
+
static void
nouveau_texture_map(GLcontext *ctx, struct gl_texture_object *t)
{
@@ -354,87 +567,6 @@ nouveau_texture_unmap(GLcontext *ctx, struct gl_texture_object *t)
}
}
-static void
-relayout_miptree(GLcontext *ctx, struct gl_texture_object *t)
-{
- struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces;
- unsigned last_level, offset = 0;
- unsigned size;
- int i, ret;
-
- if (t->MinFilter == GL_NEAREST ||
- t->MinFilter == GL_LINEAR)
- last_level = t->BaseLevel;
- else
- last_level = t->_MaxLevel;
-
- /* Deallocate the old storage. */
- for (i = 0; i < MAX_TEXTURE_LEVELS; i++)
- nouveau_bo_ref(NULL, &ss[i].bo);
-
- /* Relayout the mipmap tree. */
- for (i = t->BaseLevel; i <= last_level; i++) {
- struct nouveau_surface *s =
- &to_nouveau_teximage(t->Image[0][i])->surface;
-
- size = s->width * s->height * s->cpp;
-
- /* Images larger than 16B have to be aligned. */
- if (size > 16)
- offset = align(offset, 64);
-
- ss[i] = (struct nouveau_surface) {
- .offset = offset,
- .layout = SWIZZLED,
- .format = s->format,
- .width = s->width,
- .height = s->height,
- .cpp = s->cpp,
- .pitch = s->width * s->cpp,
- };
-
- offset += size;
- }
-
- /* Get new storage. */
- size = align(offset, 64);
-
- ret = nouveau_bo_new(context_dev(ctx),
- NOUVEAU_BO_GART | NOUVEAU_BO_VRAM,
- 0, size, &ss[last_level].bo);
- assert(!ret);
-
- for (i = t->BaseLevel; i < last_level; i++)
- nouveau_bo_ref(ss[last_level].bo, &ss[i].bo);
-}
-
-void
-nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t)
-{
- struct nouveau_texture *nt = to_nouveau_texture(t);
- int i;
-
- if (!nt->dirty)
- return;
-
- nt->dirty = GL_FALSE;
-
- relayout_miptree(ctx, t);
-
- /* Copy the teximages to the actual swizzled miptree. */
- for (i = t->BaseLevel; i < MAX_TEXTURE_LEVELS; i++) {
- struct gl_texture_image *ti = t->Image[0][i];
- struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
-
- if (!nt->surfaces[i].bo)
- break;
-
- context_drv(ctx)->surface_copy(ctx, &nt->surfaces[i], s,
- 0, 0, 0, 0,
- s->width, s->height);
- }
-}
-
void
nouveau_texture_functions_init(struct dd_function_table *functions)
{
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.h b/src/mesa/drivers/dri/nouveau/nouveau_texture.h
index 695c0897b59..b91facbdeb6 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.h
@@ -44,6 +44,14 @@ struct nouveau_texture {
to_nouveau_texture(t)->dirty = GL_TRUE;
void
+nouveau_set_texbuffer(__DRIcontext *dri_ctx,
+ GLint target, GLint format,
+ __DRIdrawable *draw);
+
+GLboolean
nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t);
+void
+nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t);
+
#endif
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h
index 076f225fedc..d6007aba2b9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_util.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h
@@ -173,4 +173,22 @@ OUT_RINGm(struct nouveau_channel *chan, float m[16])
OUT_RINGf(chan, m[4*j + i]);
}
+static inline GLboolean
+is_color_operand(int op)
+{
+ return op == GL_SRC_COLOR || op == GL_ONE_MINUS_SRC_COLOR;
+}
+
+static inline GLboolean
+is_negative_operand(int op)
+{
+ return op == GL_ONE_MINUS_SRC_COLOR || op == GL_ONE_MINUS_SRC_ALPHA;
+}
+
+static inline GLboolean
+is_texture_source(int s)
+{
+ return s == GL_TEXTURE || (s >= GL_TEXTURE0 && s <= GL_TEXTURE31);
+}
+
#endif
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 02c85807608..a365b977f29 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -24,8 +24,11 @@
*
*/
-#include "main/bufferobj.h"
#include "nouveau_bufferobj.h"
+#include "nouveau_util.h"
+
+#include "main/bufferobj.h"
+#include "main/image.h"
/* Arbitrary pushbuf length we can assume we can get with a single
* WAIT_RING. */
@@ -58,7 +61,11 @@ vbo_init_array(struct nouveau_array_state *a, int attr, int stride,
} else {
nouveau_bo_ref(NULL, &a->bo);
a->offset = 0;
- a->buf = ptr;
+
+ if (map)
+ a->buf = ptr;
+ else
+ a->buf = NULL;
}
if (a->buf)
@@ -94,11 +101,20 @@ vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib,
if (attr >= 0) {
const struct gl_client_array *array = arrays[attr];
+ int stride;
+
+ if (render->mode == VBO &&
+ !_mesa_is_bufferobj(array->BufferObj))
+ /* Pack client buffers. */
+ stride = align(_mesa_sizeof_type(array->Type)
+ * array->Size, 4);
+ else
+ stride = array->StrideB;
vbo_init_array(&render->attrs[attr], attr,
- array->StrideB, array->Size,
- array->Type, array->BufferObj,
- array->Ptr, render->mode == IMM);
+ stride, array->Size, array->Type,
+ array->BufferObj, array->Ptr,
+ render->mode == IMM);
}
}
}
@@ -227,6 +243,23 @@ vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays)
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_POS);
}
+static unsigned
+get_max_client_stride(GLcontext *ctx)
+{
+ struct nouveau_render_state *render = to_render_state(ctx);
+ int i, s = 0;
+
+ for (i = 0; i < render->attr_count; i++) {
+ int attr = render->map[i];
+ struct nouveau_array_state *a = &render->attrs[attr];
+
+ if (attr >= 0 && !a->bo)
+ s = MAX2(a->stride, s);
+ }
+
+ return s;
+}
+
static void
TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
@@ -241,12 +274,20 @@ vbo_maybe_split(GLcontext *ctx, const struct gl_client_array **arrays,
GLuint min_index, GLuint max_index)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_render_state *render = to_render_state(ctx);
unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * nctx->bo.count,
vert_avail = get_max_vertices(ctx, NULL, pushbuf_avail),
idx_avail = get_max_vertices(ctx, ib, pushbuf_avail);
+ int stride;
- if ((ib && ib->count > idx_avail) ||
- (!ib && max_index - min_index > vert_avail)) {
+ /* Try to keep client buffers smaller than the scratch BOs. */
+ if (render->mode == VBO &&
+ (stride = get_max_client_stride(ctx)))
+ vert_avail = MIN2(vert_avail,
+ RENDER_SCRATCH_SIZE / stride);
+
+ if (max_index - min_index > vert_avail ||
+ (ib && ib->count > idx_avail)) {
struct split_limits limits = {
.max_verts = vert_avail,
.max_indices = idx_avail,
@@ -276,17 +317,21 @@ vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays,
if (attr >= 0) {
const struct gl_client_array *array = arrays[attr];
struct nouveau_array_state *a = &render->attrs[attr];
- unsigned delta = (basevertex + min_index) * a->stride,
- size = (max_index - min_index + 1) * a->stride;
+ unsigned delta = (basevertex + min_index)
+ * array->StrideB;
if (a->bo) {
a->offset = (intptr_t)array->Ptr + delta;
} else {
- void *scratch = get_scratch_vbo(ctx, size,
- &a->bo,
- &a->offset);
-
- memcpy(scratch, a->buf + delta, size);
+ int j, n = max_index - min_index + 1;
+ char *sp = (char *)array->Ptr + delta;
+ char *dp = get_scratch_vbo(ctx, n * a->stride,
+ &a->bo, &a->offset);
+
+ for (j = 0; j < n; j++)
+ memcpy(dp + j * a->stride,
+ sp + j * array->StrideB,
+ a->stride);
}
}
}
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 1056171342c..a442425e448 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -40,6 +40,7 @@ nv04_context_engine(GLcontext *ctx)
if (ctx->Texture.Unit[0].EnvMode == GL_COMBINE ||
ctx->Texture.Unit[0].EnvMode == GL_BLEND ||
+ ctx->Texture.Unit[0].EnvMode == GL_ADD ||
ctx->Texture.Unit[1]._ReallyEnabled ||
ctx->Stencil.Enabled)
fahrenheit = hw->eng3dm;
@@ -264,7 +265,6 @@ const struct nouveau_driver nv04_driver = {
nouveau_emit_nothing,
nouveau_emit_nothing,
nouveau_emit_nothing,
- nouveau_emit_nothing,
nv04_emit_scissor,
nv04_defer_blend,
nv04_defer_control,
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
index aad1e491d2f..5e5e0c58742 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
@@ -63,7 +63,7 @@ nv04_emit_framebuffer(GLcontext *ctx, int emit)
return;
/* Render target */
- if (fb->_NumColorDrawBuffers) {
+ if (fb->_ColorDrawBuffers[0]) {
s = &to_nouveau_renderbuffer(
fb->_ColorDrawBuffers[0])->surface;
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
index 34ee2962023..d7c86d4178d 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
@@ -41,6 +41,7 @@
NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA0
struct combiner_state {
+ GLcontext *ctx;
int unit;
GLboolean alpha;
@@ -59,11 +60,12 @@ struct combiner_state {
/* Initialize a combiner_state struct from the texture unit
* context. */
-#define INIT_COMBINER(chan, rc, i) do { \
+#define INIT_COMBINER(chan, ctx, rc, i) do { \
struct gl_tex_env_combine_state *c = \
ctx->Texture.Unit[i]._CurrentCombine; \
- (rc)->alpha = __INIT_COMBINER_ALPHA_##chan; \
+ (rc)->ctx = ctx; \
(rc)->unit = i; \
+ (rc)->alpha = __INIT_COMBINER_ALPHA_##chan; \
(rc)->mode = c->Mode##chan; \
(rc)->source = c->Source##chan; \
(rc)->operand = c->Operand##chan; \
@@ -72,11 +74,11 @@ struct combiner_state {
} while (0)
/* Get the combiner source for the specified EXT_texture_env_combine
- * argument. */
+ * source. */
static uint32_t
-get_arg_source(struct combiner_state *rc, int arg)
+get_input_source(struct combiner_state *rc, int source)
{
- switch (rc->source[arg]) {
+ switch (source) {
case GL_TEXTURE:
return rc->unit ? COMBINER_SOURCE(TEXTURE1) :
COMBINER_SOURCE(TEXTURE0);
@@ -103,38 +105,53 @@ get_arg_source(struct combiner_state *rc, int arg)
}
/* Get the (possibly inverted) combiner input mapping for the
- * specified argument. */
+ * specified EXT_texture_env_combine operand. */
#define INVERT 0x1
static uint32_t
-get_arg_mapping(struct combiner_state *rc, int arg, int flags)
+get_input_mapping(struct combiner_state *rc, int operand, int flags)
{
int map = 0;
- switch (rc->operand[arg]) {
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- break;
+ if (!is_color_operand(operand) && !rc->alpha)
+ map |= COMBINER_ALPHA;
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- map |= rc->alpha ? 0 : COMBINER_ALPHA;
- break;
- }
+ if (is_negative_operand(operand) == !(flags & INVERT))
+ map |= COMBINER_INVERT;
- switch (rc->operand[arg]) {
- case GL_SRC_COLOR:
- case GL_SRC_ALPHA:
- map |= flags & INVERT ? COMBINER_INVERT : 0;
- break;
+ return map;
+}
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_ONE_MINUS_SRC_ALPHA:
- map |= flags & INVERT ? 0 : COMBINER_INVERT;
- break;
+static uint32_t
+get_input_arg(struct combiner_state *rc, int arg, int flags)
+{
+ int source = rc->source[arg];
+ int operand = rc->operand[arg];
+
+ /* Fake several unsupported texture formats. */
+ if (is_texture_source(source)) {
+ int i = (source == GL_TEXTURE ?
+ rc->unit : source - GL_TEXTURE0);
+ struct gl_texture_object *t = rc->ctx->Texture.Unit[i]._Current;
+ gl_format format = t->Image[0][t->BaseLevel]->TexFormat;
+
+ if (format == MESA_FORMAT_A8) {
+ /* Emulated using I8. */
+ if (is_color_operand(operand))
+ return COMBINER_SOURCE(ZERO) |
+ get_input_mapping(rc, operand, flags);
+
+ } else if (format == MESA_FORMAT_L8) {
+ /* Emulated using I8. */
+ if (!is_color_operand(operand))
+ return COMBINER_SOURCE(ZERO) |
+ get_input_mapping(rc, operand,
+ flags ^ INVERT);
+ }
}
- return map;
+ return get_input_source(rc, source) |
+ get_input_mapping(rc, operand, flags);
}
/* Bind the combiner input <in> to the combiner source <src>,
@@ -146,8 +163,7 @@ get_arg_mapping(struct combiner_state *rc, int arg, int flags)
/* Bind the combiner input <in> to the EXT_texture_env_combine
* argument <arg>, possibly inverted. */
#define INPUT_ARG(rc, in, arg, flags) \
- (rc)->hw |= (get_arg_source(rc, arg) | \
- get_arg_mapping(rc, arg, flags)) << COMBINER_SHIFT(in)
+ (rc)->hw |= get_input_arg(rc, arg, flags) << COMBINER_SHIFT(in)
#define UNSIGNED_OP(rc) \
(rc)->hw |= ((rc)->logscale ? \
@@ -222,10 +238,10 @@ nv04_emit_tex_env(GLcontext *ctx, int emit)
/* Compute the new combiner state. */
if (ctx->Texture.Unit[i]._ReallyEnabled) {
- INIT_COMBINER(A, &rc_a, i);
+ INIT_COMBINER(A, ctx, &rc_a, i);
setup_combiner(&rc_a);
- INIT_COMBINER(RGB, &rc_c, i);
+ INIT_COMBINER(RGB, ctx, &rc_c, i);
setup_combiner(&rc_c);
} else {
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index 5e3788d1854..c191571a5f8 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -61,12 +61,20 @@ get_stencil_op(unsigned op)
switch (op) {
case GL_KEEP:
return 0x1;
+ case GL_ZERO:
+ return 0x2;
+ case GL_REPLACE:
+ return 0x3;
case GL_INCR:
return 0x4;
case GL_DECR:
return 0x5;
case GL_INVERT:
return 0x6;
+ case GL_INCR_WRAP:
+ return 0x7;
+ case GL_DECR_WRAP:
+ return 0x8;
default:
assert(0);
}
@@ -78,8 +86,6 @@ get_texenv_mode(unsigned mode)
switch (mode) {
case GL_REPLACE:
return 0x1;
- case GL_ADD:
- return 0x2;
case GL_DECAL:
return 0x3;
case GL_MODULATE:
@@ -269,6 +275,10 @@ nv04_emit_blend(GLcontext *ctx, int emit)
else
blend |= NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_FLAT;
+ /* Secondary color */
+ if (NEED_SECONDARY_COLOR(ctx))
+ blend |= NV04_MULTITEX_TRIANGLE_BLEND_SPECULAR_ENABLE;
+
/* Fog. */
if (ctx->Fog.Enabled)
blend |= NV04_MULTITEX_TRIANGLE_BLEND_FOG_ENABLE;
@@ -298,7 +308,14 @@ nv04_emit_blend(GLcontext *ctx, int emit)
blend |= NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_FLAT;
/* Texture environment. */
- blend |= get_texenv_mode(ctx->Texture.Unit[0].EnvMode);
+ if (ctx->Texture._EnabledUnits)
+ blend |= get_texenv_mode(ctx->Texture.Unit[0].EnvMode);
+ else
+ blend |= get_texenv_mode(GL_MODULATE);
+
+ /* Secondary color */
+ if (NEED_SECONDARY_COLOR(ctx))
+ blend |= NV04_TEXTURED_TRIANGLE_BLEND_SPECULAR_ENABLE;
/* Fog. */
if (ctx->Fog.Enabled)
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
index 99ea310c65f..6d8762b7d1e 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
@@ -38,6 +38,7 @@ get_tex_format(struct gl_texture_image *ti)
switch (ti->TexFormat) {
case MESA_FORMAT_A8:
case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_Y8;
case MESA_FORMAT_ARGB1555:
return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A1R5G5B5;
@@ -47,6 +48,8 @@ get_tex_format(struct gl_texture_image *ti)
return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_R5G6B5;
case MESA_FORMAT_ARGB8888:
return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A8R8G8B8;
+ case MESA_FORMAT_XRGB8888:
+ return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_X8R8G8B8;
default:
assert(0);
}
@@ -89,7 +92,9 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
struct gl_texture_image *ti = t->Image[0][t->BaseLevel];
int lod_max = 1, lod_bias = 0;
- nouveau_texture_validate(ctx, t);
+ if (!nouveau_texture_validate(ctx, t))
+ return;
+
s = &to_nouveau_texture(t)->surfaces[t->BaseLevel];
if (t->MinFilter != GL_NEAREST &&
diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index 86fa1dcd7a6..e3febf7d2f7 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -216,8 +216,8 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
/* If area is too large to copy in one shot we must copy it in
* POT chunks to meet alignment requirements */
- assert(sub_w == w || _mesa_is_pow_two(sub_w));
- assert(sub_h == h || _mesa_is_pow_two(sub_h));
+ assert(sub_w == w || _mesa_is_pow_two(w));
+ assert(sub_h == h || _mesa_is_pow_two(h));
nouveau_bo_marko(bctx, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE,
src->bo, bo_flags | NOUVEAU_BO_RD);
@@ -239,8 +239,6 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
for (x = 0; x < w; x += sub_w) {
sub_w = MIN2(sub_w, w - x);
- /* Must be 64-byte aligned */
- assert(!(dst->offset & 63));
MARK_RING(chan, 15, 1);
@@ -277,10 +275,10 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
static void
nv04_surface_copy_m2mf(GLcontext *ctx,
- struct nouveau_surface *dst,
- struct nouveau_surface *src,
- int dx, int dy, int sx, int sy,
- int w, int h)
+ struct nouveau_surface *dst,
+ struct nouveau_surface *src,
+ int dx, int dy, int sx, int sy,
+ int w, int h)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
@@ -323,6 +321,82 @@ nv04_surface_copy_m2mf(GLcontext *ctx,
FIRE_RING(chan);
}
+typedef unsigned (*get_offset_t)(struct nouveau_surface *s,
+ unsigned x, unsigned y);
+
+static unsigned
+get_linear_offset(struct nouveau_surface *s, unsigned x, unsigned y)
+{
+ return x * s->cpp + y * s->pitch;
+}
+
+static unsigned
+get_swizzled_offset(struct nouveau_surface *s, unsigned x, unsigned y)
+{
+ unsigned k = log2i(MIN2(s->width, s->height));
+
+ unsigned u = (x & 0x001) << 0 |
+ (x & 0x002) << 1 |
+ (x & 0x004) << 2 |
+ (x & 0x008) << 3 |
+ (x & 0x010) << 4 |
+ (x & 0x020) << 5 |
+ (x & 0x040) << 6 |
+ (x & 0x080) << 7 |
+ (x & 0x100) << 8 |
+ (x & 0x200) << 9 |
+ (x & 0x400) << 10 |
+ (x & 0x800) << 11;
+
+ unsigned v = (y & 0x001) << 1 |
+ (y & 0x002) << 2 |
+ (y & 0x004) << 3 |
+ (y & 0x008) << 4 |
+ (y & 0x010) << 5 |
+ (y & 0x020) << 6 |
+ (y & 0x040) << 7 |
+ (y & 0x080) << 8 |
+ (y & 0x100) << 9 |
+ (y & 0x200) << 10 |
+ (y & 0x400) << 11 |
+ (y & 0x800) << 12;
+
+ return s->cpp * (((u | v) & ~(~0 << 2*k)) |
+ (x & (~0 << k)) << k |
+ (y & (~0 << k)) << k);
+}
+
+static void
+nv04_surface_copy_cpu(GLcontext *ctx,
+ struct nouveau_surface *dst,
+ struct nouveau_surface *src,
+ int dx, int dy, int sx, int sy,
+ int w, int h)
+{
+ int x, y;
+ get_offset_t get_dst = (dst->layout == SWIZZLED ?
+ get_swizzled_offset : get_linear_offset);
+ get_offset_t get_src = (src->layout == SWIZZLED ?
+ get_swizzled_offset : get_linear_offset);
+ void *dp, *sp;
+
+ nouveau_bo_map(dst->bo, NOUVEAU_BO_WR);
+ nouveau_bo_map(src->bo, NOUVEAU_BO_RD);
+
+ dp = dst->bo->map + dst->offset;
+ sp = src->bo->map + src->offset;
+
+ for (y = 0; y < h; y++) {
+ for (x = 0; x < w; x++) {
+ memcpy(dp + get_dst(dst, dx + x, dy + y),
+ sp + get_src(src, sx + x, sy + y), dst->cpp);
+ }
+ }
+
+ nouveau_bo_unmap(src->bo);
+ nouveau_bo_unmap(dst->bo);
+}
+
void
nv04_surface_copy(GLcontext *ctx,
struct nouveau_surface *dst,
@@ -330,16 +404,22 @@ nv04_surface_copy(GLcontext *ctx,
int dx, int dy, int sx, int sy,
int w, int h)
{
- /* Setup transfer to swizzle the texture to vram if needed */
- if (src->layout != SWIZZLED &&
- dst->layout == SWIZZLED &&
- dst->width > 2 && dst->height > 1) {
- nv04_surface_copy_swizzle(ctx, dst, src,
- dx, dy, sx, sy, w, h);
+ /* Linear texture copy. */
+ if ((src->layout == LINEAR && dst->layout == LINEAR) ||
+ dst->width <= 2 || dst->height <= 1) {
+ nv04_surface_copy_m2mf(ctx, dst, src, dx, dy, sx, sy, w, h);
+ return;
+ }
+
+ /* Swizzle using sifm+swzsurf. */
+ if (src->layout == LINEAR && dst->layout == SWIZZLED &&
+ dst->cpp != 1 && !(dst->offset & 63)) {
+ nv04_surface_copy_swizzle(ctx, dst, src, dx, dy, sx, sy, w, h);
return;
}
- nv04_surface_copy_m2mf(ctx, dst, src, dx, dy, sx, sy, w, h);
+ /* Fallback to CPU copy. */
+ nv04_surface_copy_cpu(ctx, dst, src, dx, dy, sx, sy, w, h);
}
void
@@ -369,7 +449,7 @@ nv04_surface_fill(GLcontext *ctx,
BEGIN_RING(chan, patt, NV04_IMAGE_PATTERN_COLOR_FORMAT, 1);
OUT_RING (chan, rect_format(dst->format));
BEGIN_RING(chan, patt, NV04_IMAGE_PATTERN_MONOCHROME_COLOR1, 1);
- OUT_RING (chan, mask | ~0 << (8 * dst->cpp));
+ OUT_RING (chan, mask | ~0ll << (8 * dst->cpp));
BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT, 1);
OUT_RING (chan, rect_format(dst->format));
@@ -484,34 +564,20 @@ nv04_surface_init(GLcontext *ctx)
OUT_RING (chan, NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_LE);
/* Swizzled surface. */
- switch (context_chipset(ctx) & 0xf0) {
- case 0x00:
- case 0x10:
+ if (context_chipset(ctx) < 0x20)
class = NV04_SWIZZLED_SURFACE;
- break;
- case 0x20:
+ else
class = NV20_SWIZZLED_SURFACE;
- break;
- default:
- /* Famous last words: this really can't happen.. */
- assert(0);
- break;
- }
ret = nouveau_grobj_alloc(chan, handle++, class, &hw->swzsurf);
if (ret)
goto fail;
/* Scaled image from memory. */
- switch (context_chipset(ctx) & 0xf0) {
- case 0x00:
+ if (context_chipset(ctx) < 0x10)
class = NV04_SCALED_IMAGE_FROM_MEMORY;
- break;
- case 0x10:
- case 0x20:
+ else
class = NV10_SCALED_IMAGE_FROM_MEMORY;
- break;
- }
ret = nouveau_grobj_alloc(chan, handle++, class, &hw->sifm);
if (ret)
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
index d80d99caa80..860d0aeb8f5 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -32,6 +32,11 @@
#include "nv04_driver.h"
#include "nv10_driver.h"
+static const struct dri_extension nv10_extensions[] = {
+ { "GL_EXT_texture_rectangle", NULL },
+ { NULL, NULL }
+};
+
static void
nv10_clear(GLcontext *ctx, GLbitfield buffers)
{
@@ -301,6 +306,8 @@ nv10_context_create(struct nouveau_screen *screen, const GLvisual *visual,
if (!nouveau_context_init(ctx, screen, visual, share_ctx))
goto fail;
+ driInitExtensions(ctx, nv10_extensions, GL_FALSE);
+
/* GL constants. */
ctx->Const.MaxTextureLevels = 12;
ctx->Const.MaxTextureCoordUnits = NV10_TEXTURE_UNITS;
@@ -363,7 +370,6 @@ const struct nouveau_driver nv10_driver = {
nv10_emit_frag,
nv10_emit_framebuffer,
nv10_emit_fog,
- nv10_emit_index_mask,
nv10_emit_light_enable,
nv10_emit_light_model,
nv10_emit_light_source,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h b/src/mesa/drivers/dri/nouveau/nv10_driver.h
index 4c220b0373f..d662712533b 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h
@@ -100,9 +100,6 @@ void
nv10_emit_dither(GLcontext *ctx, int emit);
void
-nv10_emit_index_mask(GLcontext *ctx, int emit);
-
-void
nv10_emit_logic_opcode(GLcontext *ctx, int emit);
void
@@ -119,6 +116,14 @@ nv10_emit_stencil_op(GLcontext *ctx, int emit);
/* nv10_state_frag.c */
void
+nv10_get_general_combiner(GLcontext *ctx, int i,
+ uint32_t *a_in, uint32_t *a_out,
+ uint32_t *c_in, uint32_t *c_out, uint32_t *k);
+
+void
+nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n);
+
+void
nv10_emit_tex_env(GLcontext *ctx, int emit);
void
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index 05c36b4f8f5..6bd383ebcd3 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -111,7 +111,7 @@ nv10_emit_framebuffer(GLcontext *ctx, int emit)
}
/* Render target */
- if (fb->_NumColorDrawBuffers) {
+ if (fb->_ColorDrawBuffers[0]) {
s = &to_nouveau_renderbuffer(
fb->_ColorDrawBuffers[0])->surface;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
index c1df26ecce6..76b95fdd518 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Francisco Jerez.
+ * Copyright (C) 2009-2010 Francisco Jerez.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
@@ -90,11 +90,11 @@ struct combiner_state {
} while (0)
/* Get the RC input source for the specified EXT_texture_env_combine
- * argument. */
+ * source. */
static uint32_t
-get_input_source(struct combiner_state *rc, int arg)
+get_input_source(struct combiner_state *rc, int source)
{
- switch (rc->source[arg]) {
+ switch (source) {
case GL_TEXTURE:
return RC_IN_SOURCE(TEXTURE0) + rc->unit;
@@ -127,52 +127,76 @@ get_input_source(struct combiner_state *rc, int arg)
}
}
-/* Get the RC input mapping for the specified argument, possibly
- * inverted or biased. */
+/* Get the RC input mapping for the specified texture_env_combine
+ * operand, possibly inverted or biased. */
#define INVERT 0x1
#define HALF_BIAS 0x2
static uint32_t
-get_input_mapping(struct combiner_state *rc, int arg, int flags)
+get_input_mapping(struct combiner_state *rc, int operand, int flags)
{
int map = 0;
- switch (rc->operand[arg]) {
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
+ if (is_color_operand(operand))
map |= RC_IN_USAGE(RGB);
- break;
-
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
+ else
map |= RC_IN_USAGE(ALPHA);
- break;
- }
- switch (rc->operand[arg]) {
- case GL_SRC_COLOR:
- case GL_SRC_ALPHA:
- map |= (flags & INVERT ? RC_IN_MAPPING(UNSIGNED_INVERT) :
- flags & HALF_BIAS ? RC_IN_MAPPING(HALF_BIAS_NORMAL) :
- RC_IN_MAPPING(UNSIGNED_IDENTITY));
- break;
+ if (is_negative_operand(operand) == !(flags & INVERT))
+ map |= flags & HALF_BIAS ?
+ RC_IN_MAPPING(HALF_BIAS_NEGATE) :
+ RC_IN_MAPPING(UNSIGNED_INVERT);
+ else
+ map |= flags & HALF_BIAS ?
+ RC_IN_MAPPING(HALF_BIAS_NORMAL) :
+ RC_IN_MAPPING(UNSIGNED_IDENTITY);
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_ONE_MINUS_SRC_ALPHA:
- map |= (flags & INVERT ? RC_IN_MAPPING(UNSIGNED_IDENTITY) :
- flags & HALF_BIAS ? RC_IN_MAPPING(HALF_BIAS_NEGATE) :
- RC_IN_MAPPING(UNSIGNED_INVERT));
- break;
+ return map;
+}
+
+static uint32_t
+get_input_arg(struct combiner_state *rc, int arg, int flags)
+{
+ int source = rc->source[arg];
+ int operand = rc->operand[arg];
+
+ /* Fake several unsupported texture formats. */
+ if (is_texture_source(source)) {
+ int i = (source == GL_TEXTURE ?
+ rc->unit : source - GL_TEXTURE0);
+ struct gl_texture_object *t = rc->ctx->Texture.Unit[i]._Current;
+ gl_format format = t->Image[0][t->BaseLevel]->TexFormat;
+
+ if (format == MESA_FORMAT_A8) {
+ /* Emulated using I8. */
+ if (is_color_operand(operand))
+ return RC_IN_SOURCE(ZERO) |
+ get_input_mapping(rc, operand, flags);
+
+ } else if (format == MESA_FORMAT_L8) {
+ /* Sometimes emulated using I8. */
+ if (!is_color_operand(operand))
+ return RC_IN_SOURCE(ZERO) |
+ get_input_mapping(rc, operand,
+ flags ^ INVERT);
+
+ } else if (format == MESA_FORMAT_XRGB8888) {
+ /* Sometimes emulated using ARGB8888. */
+ if (!is_color_operand(operand))
+ return RC_IN_SOURCE(ZERO) |
+ get_input_mapping(rc, operand,
+ flags ^ INVERT);
+ }
}
- return map;
+ return get_input_source(rc, source) |
+ get_input_mapping(rc, operand, flags);
}
/* Bind the RC input variable <var> to the EXT_texture_env_combine
* argument <arg>, possibly inverted or biased. */
#define INPUT_ARG(rc, var, arg, flags) \
- (rc)->in |= (get_input_mapping(rc, arg, flags) | \
- get_input_source(rc, arg)) << RC_IN_SHIFT_##var
+ (rc)->in |= get_input_arg(rc, arg, flags) << RC_IN_SHIFT_##var
/* Bind the RC input variable <var> to the RC source <src>. */
#define INPUT_SRC(rc, var, src, chan) \
@@ -268,86 +292,13 @@ setup_combiner(struct combiner_state *rc)
}
}
-/* Write the register combiner state out to the hardware. */
-static void
-nv10_load_combiner(GLcontext *ctx, int i, struct combiner_state *rc_a,
- struct combiner_state *rc_c, uint32_t rc_const)
-{
- struct nouveau_channel *chan = context_chan(ctx);
- struct nouveau_grobj *celsius = context_eng3d(ctx);
-
- /* Enable the combiners we're going to need. */
- if (i == 1) {
- if (rc_c->out || rc_a->out)
- rc_c->out |= 0x5 << 27;
- else
- rc_c->out |= 0x3 << 27;
- }
-
- BEGIN_RING(chan, celsius, NV10TCL_RC_IN_ALPHA(i), 1);
- OUT_RING(chan, rc_a->in);
- BEGIN_RING(chan, celsius, NV10TCL_RC_IN_RGB(i), 1);
- OUT_RING(chan, rc_c->in);
- BEGIN_RING(chan, celsius, NV10TCL_RC_COLOR(i), 1);
- OUT_RING(chan, rc_const);
- BEGIN_RING(chan, celsius, NV10TCL_RC_OUT_ALPHA(i), 1);
- OUT_RING(chan, rc_a->out);
- BEGIN_RING(chan, celsius, NV10TCL_RC_OUT_RGB(i), 1);
- OUT_RING(chan, rc_c->out);
-}
-
-static void
-nv10_load_final(GLcontext *ctx, struct combiner_state *rc, int n)
-{
- struct nouveau_channel *chan = context_chan(ctx);
- struct nouveau_grobj *celsius = context_eng3d(ctx);
-
- BEGIN_RING(chan, celsius, NV10TCL_RC_FINAL0, 2);
- OUT_RING(chan, rc->in);
- OUT_RING(chan, rc->in >> 32);
-}
-
-static void
-nv20_load_combiner(GLcontext *ctx, int i, struct combiner_state *rc_a,
- struct combiner_state *rc_c, uint32_t rc_const)
-{
- struct nouveau_channel *chan = context_chan(ctx);
- struct nouveau_grobj *kelvin = context_eng3d(ctx);
-
- BEGIN_RING(chan, kelvin, NV20TCL_RC_IN_ALPHA(i), 1);
- OUT_RING(chan, rc_a->in);
- BEGIN_RING(chan, kelvin, NV20TCL_RC_OUT_ALPHA(i), 1);
- OUT_RING(chan, rc_a->out);
- BEGIN_RING(chan, kelvin, NV20TCL_RC_IN_RGB(i), 1);
- OUT_RING(chan, rc_c->in);
- BEGIN_RING(chan, kelvin, NV20TCL_RC_OUT_RGB(i), 1);
- OUT_RING(chan, rc_c->out);
- BEGIN_RING(chan, kelvin, NV20TCL_RC_CONSTANT_COLOR0(i), 1);
- OUT_RING(chan, rc_const);
-}
-
-static void
-nv20_load_final(GLcontext *ctx, struct combiner_state *rc, int n)
-{
- struct nouveau_channel *chan = context_chan(ctx);
- struct nouveau_grobj *kelvin = context_eng3d(ctx);
-
- BEGIN_RING(chan, kelvin, NV20TCL_RC_FINAL0, 2);
- OUT_RING(chan, rc->in);
- OUT_RING(chan, rc->in >> 32);
-
- BEGIN_RING(chan, kelvin, NV20TCL_RC_ENABLE, 1);
- OUT_RING(chan, n);
-}
-
void
-nv10_emit_tex_env(GLcontext *ctx, int emit)
+nv10_get_general_combiner(GLcontext *ctx, int i,
+ uint32_t *a_in, uint32_t *a_out,
+ uint32_t *c_in, uint32_t *c_out, uint32_t *k)
{
- const int i = emit - NOUVEAU_STATE_TEX_ENV0;
struct combiner_state rc_a, rc_c;
- uint32_t rc_const;
- /* Compute the new combiner state. */
if (ctx->Texture.Unit[i]._ReallyEnabled) {
INIT_COMBINER(RGB, ctx, &rc_c, i);
@@ -359,26 +310,22 @@ nv10_emit_tex_env(GLcontext *ctx, int emit)
setup_combiner(&rc_c);
setup_combiner(&rc_a);
- rc_const = pack_rgba_f(MESA_FORMAT_ARGB8888,
- ctx->Texture.Unit[i].EnvColor);
-
} else {
- rc_a.in = rc_a.out = rc_c.in = rc_c.out = rc_const = 0;
+ rc_a.in = rc_a.out = rc_c.in = rc_c.out = 0;
}
- if (context_chipset(ctx) >= 0x20)
- nv20_load_combiner(ctx, i, &rc_a, &rc_c, rc_const);
- else
- nv10_load_combiner(ctx, i, &rc_a, &rc_c, rc_const);
-
- context_dirty(ctx, FRAG);
+ *k = pack_rgba_f(MESA_FORMAT_ARGB8888,
+ ctx->Texture.Unit[i].EnvColor);
+ *a_in = rc_a.in;
+ *a_out = rc_a.out;
+ *c_in = rc_c.in;
+ *c_out = rc_c.out;
}
void
-nv10_emit_frag(GLcontext *ctx, int emit)
+nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n)
{
struct combiner_state rc = {};
- int n = log2i(ctx->Texture._EnabledUnits) + 1;
/*
* The final fragment value equation is something like:
@@ -409,8 +356,53 @@ nv10_emit_frag(GLcontext *ctx, int emit)
INPUT_SRC(&rc, G, PRIMARY_COLOR, ALPHA);
}
- if (context_chipset(ctx) >= 0x20)
- nv20_load_final(ctx, &rc, n);
- else
- nv10_load_final(ctx, &rc, n);
+ *in = rc.in;
+ *n = log2i(ctx->Texture._EnabledUnits) + 1;
+}
+
+void
+nv10_emit_tex_env(GLcontext *ctx, int emit)
+{
+ const int i = emit - NOUVEAU_STATE_TEX_ENV0;
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *celsius = context_eng3d(ctx);
+ uint32_t a_in, a_out, c_in, c_out, k;
+
+ nv10_get_general_combiner(ctx, i, &a_in, &a_out, &c_in, &c_out, &k);
+
+ /* Enable the combiners we're going to need. */
+ if (i == 1) {
+ if (c_out || a_out)
+ c_out |= 0x5 << 27;
+ else
+ c_out |= 0x3 << 27;
+ }
+
+ BEGIN_RING(chan, celsius, NV10TCL_RC_IN_ALPHA(i), 1);
+ OUT_RING(chan, a_in);
+ BEGIN_RING(chan, celsius, NV10TCL_RC_IN_RGB(i), 1);
+ OUT_RING(chan, c_in);
+ BEGIN_RING(chan, celsius, NV10TCL_RC_COLOR(i), 1);
+ OUT_RING(chan, k);
+ BEGIN_RING(chan, celsius, NV10TCL_RC_OUT_ALPHA(i), 1);
+ OUT_RING(chan, a_out);
+ BEGIN_RING(chan, celsius, NV10TCL_RC_OUT_RGB(i), 1);
+ OUT_RING(chan, c_out);
+
+ context_dirty(ctx, FRAG);
+}
+
+void
+nv10_emit_frag(GLcontext *ctx, int emit)
+{
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *celsius = context_eng3d(ctx);
+ uint64_t in;
+ int n;
+
+ nv10_get_final_combiner(ctx, &in, &n);
+
+ BEGIN_RING(chan, celsius, NV10TCL_RC_FINAL0, 2);
+ OUT_RING(chan, in);
+ OUT_RING(chan, in >> 32);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
index 68882ef05f2..a62cd807a91 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
@@ -119,11 +119,6 @@ nv10_emit_dither(GLcontext *ctx, int emit)
}
void
-nv10_emit_index_mask(GLcontext *ctx, int emit)
-{
-}
-
-void
nv10_emit_logic_opcode(GLcontext *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index e5d4f3d18d8..02a5ca797ae 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -38,12 +38,15 @@ nv10_emit_tex_gen(GLcontext *ctx, int emit)
}
static uint32_t
-get_tex_format(struct gl_texture_image *ti)
+get_tex_format_pot(struct gl_texture_image *ti)
{
switch (ti->TexFormat) {
case MESA_FORMAT_ARGB8888:
return NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8;
+ case MESA_FORMAT_XRGB8888:
+ return NV10TCL_TX_FORMAT_FORMAT_X8R8G8B8;
+
case MESA_FORMAT_ARGB1555:
return NV10TCL_TX_FORMAT_FORMAT_A1R5G5B5;
@@ -54,6 +57,7 @@ get_tex_format(struct gl_texture_image *ti)
return NV10TCL_TX_FORMAT_FORMAT_R5G6B5;
case MESA_FORMAT_A8:
+ case MESA_FORMAT_I8:
return NV10TCL_TX_FORMAT_FORMAT_A8;
case MESA_FORMAT_L8:
@@ -67,6 +71,30 @@ get_tex_format(struct gl_texture_image *ti)
}
}
+static uint32_t
+get_tex_format_rect(struct gl_texture_image *ti)
+{
+ switch (ti->TexFormat) {
+ case MESA_FORMAT_ARGB1555:
+ return NV10TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT;
+
+ case MESA_FORMAT_RGB565:
+ return NV10TCL_TX_FORMAT_FORMAT_R5G6B5_RECT;
+
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888:
+ return NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT;
+
+ case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
+ return NV10TCL_TX_FORMAT_FORMAT_A8_RECT;
+
+ default:
+ assert(0);
+ }
+}
+
void
nv10_emit_tex_obj(GLcontext *ctx, int emit)
{
@@ -90,14 +118,14 @@ nv10_emit_tex_obj(GLcontext *ctx, int emit)
s = &to_nouveau_texture(t)->surfaces[t->BaseLevel];
ti = t->Image[0][t->BaseLevel];
- nouveau_texture_validate(ctx, t);
+ if (!nouveau_texture_validate(ctx, t))
+ return;
/* Recompute the texturing registers. */
tx_format = nvgl_wrap_mode(t->WrapT) << 28
| nvgl_wrap_mode(t->WrapS) << 24
| ti->HeightLog2 << 20
| ti->WidthLog2 << 16
- | get_tex_format(ti)
| 5 << 4 | 1 << 12;
tx_filter = nvgl_filter_mode(t->MagFilter) << 28
@@ -106,6 +134,17 @@ nv10_emit_tex_obj(GLcontext *ctx, int emit)
tx_enable = NV10TCL_TX_ENABLE_ENABLE
| log2i(t->MaxAnisotropy) << 4;
+ if (t->Target == GL_TEXTURE_RECTANGLE) {
+ BEGIN_RING(chan, celsius, NV10TCL_TX_NPOT_PITCH(i), 1);
+ OUT_RING(chan, s->pitch << 16);
+ BEGIN_RING(chan, celsius, NV10TCL_TX_NPOT_SIZE(i), 1);
+ OUT_RING(chan, align(s->width, 2) << 16 | s->height);
+
+ tx_format |= get_tex_format_rect(ti);
+ } else {
+ tx_format |= get_tex_format_pot(ti);
+ }
+
if (t->MinFilter != GL_NEAREST &&
t->MinFilter != GL_LINEAR) {
int lod_min = t->MinLod;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
index 6db14d83b83..406e24c455d 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
@@ -201,8 +201,10 @@ nv10_emit_light_model(GLcontext *ctx, int emit)
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_MODEL, 1);
OUT_RING(chan, ((m->LocalViewer ?
NV10TCL_LIGHT_MODEL_LOCAL_VIEWER : 0) |
- (m->ColorControl == GL_SEPARATE_SPECULAR_COLOR ?
- NV10TCL_LIGHT_MODEL_SEPARATE_SPECULAR : 0)));
+ (NEED_SECONDARY_COLOR(ctx) ?
+ NV10TCL_LIGHT_MODEL_SEPARATE_SPECULAR : 0) |
+ (!ctx->Light.Enabled && ctx->Fog.ColorSumEnabled ?
+ NV10TCL_LIGHT_MODEL_VERTEX_SPECULAR : 0)));
}
static float
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 82a13fb6ff0..db39ef70750 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -31,6 +31,11 @@
#include "nv10_driver.h"
#include "nv20_driver.h"
+static const struct dri_extension nv20_extensions[] = {
+ { "GL_EXT_texture_rectangle", NULL },
+ { NULL, NULL }
+};
+
static void
nv20_hwctx_init(GLcontext *ctx)
{
@@ -394,6 +399,8 @@ nv20_context_create(struct nouveau_screen *screen, const GLvisual *visual,
if (!nouveau_context_init(ctx, screen, visual, share_ctx))
goto fail;
+ driInitExtensions(ctx, nv20_extensions, GL_FALSE);
+
/* GL constants. */
ctx->Const.MaxTextureCoordUnits = NV20_TEXTURE_UNITS;
ctx->Const.MaxTextureImageUnits = NV20_TEXTURE_UNITS;
@@ -449,10 +456,9 @@ const struct nouveau_driver nv20_driver = {
nv10_emit_front_face,
nv10_emit_depth,
nv10_emit_dither,
- nv10_emit_frag,
+ nv20_emit_frag,
nv20_emit_framebuffer,
nv20_emit_fog,
- nv10_emit_index_mask,
nv10_emit_light_enable,
nv20_emit_light_model,
nv20_emit_light_source,
@@ -487,10 +493,10 @@ const struct nouveau_driver nv20_driver = {
nv10_emit_stencil_func,
nv10_emit_stencil_mask,
nv10_emit_stencil_op,
- nv10_emit_tex_env,
- nv10_emit_tex_env,
- nv10_emit_tex_env,
- nv10_emit_tex_env,
+ nv20_emit_tex_env,
+ nv20_emit_tex_env,
+ nv20_emit_tex_env,
+ nv20_emit_tex_env,
nv10_emit_tex_gen,
nv10_emit_tex_gen,
nv10_emit_tex_gen,
diff --git a/src/mesa/drivers/dri/nouveau/nv20_driver.h b/src/mesa/drivers/dri/nouveau/nv20_driver.h
index f82a292cf7a..18574e9be64 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nv20_driver.h
@@ -59,6 +59,13 @@ nv20_emit_point_mode(GLcontext *ctx, int emit);
void
nv20_emit_logic_opcode(GLcontext *ctx, int emit);
+/* nv20_state_frag.c */
+void
+nv20_emit_tex_env(GLcontext *ctx, int emit);
+
+void
+nv20_emit_frag(GLcontext *ctx, int emit);
+
/* nv20_state_tex.c */
void
nv20_emit_tex_obj(GLcontext *ctx, int emit);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
index 869acd6e317..d638541df9e 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
@@ -67,7 +67,7 @@ nv20_emit_framebuffer(GLcontext *ctx, int emit)
return;
/* Render target */
- if (fb->_NumColorDrawBuffers) {
+ if (fb->_ColorDrawBuffers[0]) {
s = &to_nouveau_renderbuffer(
fb->_ColorDrawBuffers[0])->surface;
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_frag.c b/src/mesa/drivers/dri/nouveau/nv20_state_frag.c
new file mode 100644
index 00000000000..74803d2ae84
--- /dev/null
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_frag.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2009-2010 Francisco Jerez.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "nouveau_driver.h"
+#include "nouveau_context.h"
+#include "nouveau_class.h"
+#include "nv10_driver.h"
+#include "nv20_driver.h"
+
+void
+nv20_emit_tex_env(GLcontext *ctx, int emit)
+{
+ const int i = emit - NOUVEAU_STATE_TEX_ENV0;
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *kelvin = context_eng3d(ctx);
+ uint32_t a_in, a_out, c_in, c_out, k;
+
+ nv10_get_general_combiner(ctx, i, &a_in, &a_out, &c_in, &c_out, &k);
+
+ BEGIN_RING(chan, kelvin, NV20TCL_RC_IN_ALPHA(i), 1);
+ OUT_RING(chan, a_in);
+ BEGIN_RING(chan, kelvin, NV20TCL_RC_OUT_ALPHA(i), 1);
+ OUT_RING(chan, a_out);
+ BEGIN_RING(chan, kelvin, NV20TCL_RC_IN_RGB(i), 1);
+ OUT_RING(chan, c_in);
+ BEGIN_RING(chan, kelvin, NV20TCL_RC_OUT_RGB(i), 1);
+ OUT_RING(chan, c_out);
+ BEGIN_RING(chan, kelvin, NV20TCL_RC_CONSTANT_COLOR0(i), 1);
+ OUT_RING(chan, k);
+
+ context_dirty(ctx, FRAG);
+}
+
+void
+nv20_emit_frag(GLcontext *ctx, int emit)
+{
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *kelvin = context_eng3d(ctx);
+ uint64_t in;
+ int n;
+
+ nv10_get_final_combiner(ctx, &in, &n);
+
+ BEGIN_RING(chan, kelvin, NV20TCL_RC_FINAL0, 2);
+ OUT_RING(chan, in);
+ OUT_RING(chan, in >> 32);
+
+ BEGIN_RING(chan, kelvin, NV20TCL_RC_ENABLE, 1);
+ OUT_RING(chan, n);
+}
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index d01e91f8ee1..92870105f96 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -33,7 +33,7 @@
#include "nv20_driver.h"
static uint32_t
-get_tex_format(struct gl_texture_image *ti)
+get_tex_format_pot(struct gl_texture_image *ti)
{
switch (ti->TexFormat) {
case MESA_FORMAT_ARGB8888:
@@ -45,10 +45,14 @@ get_tex_format(struct gl_texture_image *ti)
case MESA_FORMAT_ARGB4444:
return NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4;
+ case MESA_FORMAT_XRGB8888:
+ return NV20TCL_TX_FORMAT_FORMAT_X8R8G8B8;
+
case MESA_FORMAT_RGB565:
return NV20TCL_TX_FORMAT_FORMAT_R5G6B5;
case MESA_FORMAT_A8:
+ case MESA_FORMAT_I8:
return NV20TCL_TX_FORMAT_FORMAT_A8;
case MESA_FORMAT_L8:
@@ -62,6 +66,37 @@ get_tex_format(struct gl_texture_image *ti)
}
}
+static uint32_t
+get_tex_format_rect(struct gl_texture_image *ti)
+{
+ switch (ti->TexFormat) {
+ case MESA_FORMAT_ARGB8888:
+ return NV20TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT;
+
+ case MESA_FORMAT_ARGB1555:
+ return NV20TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT;
+
+ case MESA_FORMAT_ARGB4444:
+ return NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4_RECT;
+
+ case MESA_FORMAT_XRGB8888:
+ return NV20TCL_TX_FORMAT_FORMAT_R8G8B8_RECT;
+
+ case MESA_FORMAT_RGB565:
+ return NV20TCL_TX_FORMAT_FORMAT_R5G6B5_RECT;
+
+ case MESA_FORMAT_L8:
+ return NV20TCL_TX_FORMAT_FORMAT_L8_RECT;
+
+ case MESA_FORMAT_A8:
+ case MESA_FORMAT_I8:
+ return NV20TCL_TX_FORMAT_FORMAT_A8_RECT;
+
+ default:
+ assert(0);
+ }
+}
+
void
nv20_emit_tex_obj(GLcontext *ctx, int emit)
{
@@ -87,13 +122,13 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit)
s = &to_nouveau_texture(t)->surfaces[t->BaseLevel];
ti = t->Image[0][t->BaseLevel];
- nouveau_texture_validate(ctx, t);
+ if (!nouveau_texture_validate(ctx, t))
+ return;
/* Recompute the texturing registers. */
tx_format = ti->DepthLog2 << 28
| ti->HeightLog2 << 24
| ti->WidthLog2 << 20
- | get_tex_format(ti)
| NV20TCL_TX_FORMAT_DIMS_2D
| NV20TCL_TX_FORMAT_NO_BORDER
| 1 << 16;
@@ -108,6 +143,17 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit)
tx_enable = NV20TCL_TX_ENABLE_ENABLE
| log2i(t->MaxAnisotropy) << 4;
+ if (t->Target == GL_TEXTURE_RECTANGLE) {
+ BEGIN_RING(chan, kelvin, NV20TCL_TX_NPOT_PITCH(i), 1);
+ OUT_RING(chan, s->pitch << 16);
+ BEGIN_RING(chan, kelvin, NV20TCL_TX_NPOT_SIZE(i), 1);
+ OUT_RING(chan, s->width << 16 | s->height);
+
+ tx_format |= get_tex_format_rect(ti);
+ } else {
+ tx_format |= get_tex_format_pot(ti);
+ }
+
if (t->MinFilter != GL_NEAREST &&
t->MinFilter != GL_LINEAR) {
int lod_min = t->MinLod;
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
index 0d566064f67..43f8c723122 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
@@ -158,7 +158,7 @@ nv20_emit_light_model(GLcontext *ctx, int emit)
OUT_RING(chan, ((m->LocalViewer ?
NV20TCL_LIGHT_MODEL_VIEWER_LOCAL :
NV20TCL_LIGHT_MODEL_VIEWER_NONLOCAL) |
- (m->ColorControl == GL_SEPARATE_SPECULAR_COLOR ?
+ (NEED_SECONDARY_COLOR(ctx) ?
NV20TCL_LIGHT_MODEL_SEPARATE_SPECULAR :
0)));
diff --git a/src/mesa/drivers/dri/r128/Makefile b/src/mesa/drivers/dri/r128/Makefile
index 52c5a38a705..8144c9b43ff 100644
--- a/src/mesa/drivers/dri/r128/Makefile
+++ b/src/mesa/drivers/dri/r128/Makefile
@@ -5,8 +5,6 @@ include $(TOP)/configs/current
LIBNAME = r128_dri.so
-MINIGLX_SOURCES = server/r128_dri.c
-
DRIVER_SOURCES = \
r128_context.c \
r128_lock.c \
diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c
index 42f6dd73888..4d773feaaa8 100644
--- a/src/mesa/drivers/dri/r128/r128_state.c
+++ b/src/mesa/drivers/dri/r128/r128_state.c
@@ -1407,13 +1407,11 @@ void r128DDInitStateFuncs( GLcontext *ctx )
{
ctx->Driver.UpdateState = r128DDInvalidateState;
- ctx->Driver.ClearIndex = NULL;
ctx->Driver.ClearColor = r128DDClearColor;
ctx->Driver.ClearStencil = r128DDClearStencil;
ctx->Driver.DrawBuffer = r128DDDrawBuffer;
ctx->Driver.ReadBuffer = r128DDReadBuffer;
- ctx->Driver.IndexMask = NULL;
ctx->Driver.ColorMask = r128DDColorMask;
ctx->Driver.AlphaFunc = r128DDAlphaFunc;
ctx->Driver.BlendEquationSeparate = r128DDBlendEquationSeparate;
diff --git a/src/mesa/drivers/dri/r128/r128_texmem.c b/src/mesa/drivers/dri/r128/r128_texmem.c
index 5eec8c08cd6..412f6d42551 100644
--- a/src/mesa/drivers/dri/r128/r128_texmem.c
+++ b/src/mesa/drivers/dri/r128/r128_texmem.c
@@ -260,6 +260,7 @@ void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t )
}
/* Set the base offset of the texture image */
+ assert(t->base.memBlock);
t->bufAddr = rmesa->r128Screen->texOffset[heap]
+ t->base.memBlock->ofs;
diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c
index 86d4717b050..9ea2a9d1624 100644
--- a/src/mesa/drivers/dri/r128/r128_tris.c
+++ b/src/mesa/drivers/dri/r128/r128_tris.c
@@ -158,7 +158,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
diff --git a/src/mesa/drivers/dri/r128/server/r128_dri.c b/src/mesa/drivers/dri/r128/server/r128_dri.c
deleted file mode 100644
index 6e3db948af7..00000000000
--- a/src/mesa/drivers/dri/r128/server/r128_dri.c
+++ /dev/null
@@ -1,1112 +0,0 @@
-/*
- * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
- * Precision Insight, Inc., Cedar Park, Texas, and
- * VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
- * SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Rickard E. Faith <faith@valinux.com>
- * Daryll Strauss <daryll@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-// Fix this to use kernel pci_ids.h when all of these IDs make it into the kernel
-#include "pci_ids.h"
-
-#include "driver.h"
-#include "drm.h"
-#include "memops.h"
-
-#include "r128.h"
-#include "r128_dri.h"
-#include "r128_macros.h"
-#include "r128_reg.h"
-#include "r128_version.h"
-#include "r128_drm.h"
-
-static size_t r128_drm_page_size;
-
-/* Compute log base 2 of val. */
-static int R128MinBits(int val)
-{
- int bits;
-
- if (!val) return 1;
- for (bits = 0; val; val >>= 1, ++bits);
- return bits;
-}
-
-/* Initialize the AGP state. Request memory for use in AGP space, and
- initialize the Rage 128 registers to point to that memory. */
-static GLboolean R128DRIAgpInit(const DRIDriverContext *ctx)
-{
- unsigned char *R128MMIO = ctx->MMIOAddress;
- R128InfoPtr info = ctx->driverPrivate;
- unsigned long mode;
- unsigned int vendor, device;
- int ret;
- unsigned long cntl, chunk;
- int s, l;
- int flags;
- unsigned long agpBase;
-
- if (drmAgpAcquire(ctx->drmFD) < 0) {
- fprintf(stderr, "[agp] AGP not available\n");
- return GL_FALSE;
- }
-
- /* Modify the mode if the default mode is
- not appropriate for this particular
- combination of graphics card and AGP
- chipset. */
-
- mode = drmAgpGetMode(ctx->drmFD); /* Default mode */
- vendor = drmAgpVendorId(ctx->drmFD);
- device = drmAgpDeviceId(ctx->drmFD);
-
- mode &= ~R128_AGP_MODE_MASK;
- switch (info->agpMode) {
- case 4: mode |= R128_AGP_4X_MODE;
- case 2: mode |= R128_AGP_2X_MODE;
- case 1: default: mode |= R128_AGP_1X_MODE;
- }
-
- fprintf(stderr,
- "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n",
- mode, vendor, device,
- 0x1002,
- info->Chipset);
-
- if (drmAgpEnable(ctx->drmFD, mode) < 0) {
- fprintf(stderr, "[agp] AGP not enabled\n");
- drmAgpRelease(ctx->drmFD);
- return GL_FALSE;
- }
-
- info->agpOffset = 0;
-
- if ((ret = drmAgpAlloc(ctx->drmFD, info->agpSize*1024*1024, 0, NULL,
- &info->agpMemHandle)) < 0) {
- fprintf(stderr, "[agp] Out of memory (%d)\n", ret);
- drmAgpRelease(ctx->drmFD);
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] %d kB allocated with handle 0x%08x\n",
- info->agpSize*1024, info->agpMemHandle);
-
- if (drmAgpBind(ctx->drmFD, info->agpMemHandle, info->agpOffset) < 0) {
- fprintf(stderr, "[agp] Could not bind\n");
- drmAgpFree(ctx->drmFD, info->agpMemHandle);
- drmAgpRelease(ctx->drmFD);
- return GL_FALSE;
- }
-
- /* Initialize the CCE ring buffer data */
- info->ringStart = info->agpOffset;
- info->ringMapSize = info->ringSize*1024*1024 + r128_drm_page_size;
- info->ringSizeLog2QW = R128MinBits(info->ringSize*1024*1024/8) - 1;
-
- info->ringReadOffset = info->ringStart + info->ringMapSize;
- info->ringReadMapSize = r128_drm_page_size;
-
- /* Reserve space for vertex/indirect buffers */
- info->bufStart = info->ringReadOffset + info->ringReadMapSize;
- info->bufMapSize = info->bufSize*1024*1024;
-
- /* Reserve the rest for AGP textures */
- info->agpTexStart = info->bufStart + info->bufMapSize;
- s = (info->agpSize*1024*1024 - info->agpTexStart);
- l = R128MinBits((s-1) / R128_NR_TEX_REGIONS);
- if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY;
- info->agpTexMapSize = (s >> l) << l;
- info->log2AGPTexGran = l;
-
- if (info->CCESecure) flags = DRM_READ_ONLY;
- else flags = 0;
-
- if (drmAddMap(ctx->drmFD, info->ringStart, info->ringMapSize,
- DRM_AGP, flags, &info->ringHandle) < 0) {
- fprintf(stderr,
- "[agp] Could not add ring mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] ring handle = 0x%08x\n", info->ringHandle);
-
- if (drmMap(ctx->drmFD, info->ringHandle, info->ringMapSize,
- (drmAddressPtr)&info->ring) < 0) {
- fprintf(stderr, "[agp] Could not map ring\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] Ring mapped at 0x%08lx\n",
- (unsigned long)info->ring);
-
- if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
- DRM_AGP, flags, &info->ringReadPtrHandle) < 0) {
- fprintf(stderr,
- "[agp] Could not add ring read ptr mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] ring read ptr handle = 0x%08x\n",
- info->ringReadPtrHandle);
-
- if (drmMap(ctx->drmFD, info->ringReadPtrHandle, info->ringReadMapSize,
- (drmAddressPtr)&info->ringReadPtr) < 0) {
- fprintf(stderr,
- "[agp] Could not map ring read ptr\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] Ring read ptr mapped at 0x%08lx\n",
- (unsigned long)info->ringReadPtr);
-
- if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
- DRM_AGP, 0, &info->bufHandle) < 0) {
- fprintf(stderr,
- "[agp] Could not add vertex/indirect buffers mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] vertex/indirect buffers handle = 0x%08lx\n",
- info->bufHandle);
-
- if (drmMap(ctx->drmFD, info->bufHandle, info->bufMapSize,
- (drmAddressPtr)&info->buf) < 0) {
- fprintf(stderr,
- "[agp] Could not map vertex/indirect buffers\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] Vertex/indirect buffers mapped at 0x%08lx\n",
- (unsigned long)info->buf);
-
- if (drmAddMap(ctx->drmFD, info->agpTexStart, info->agpTexMapSize,
- DRM_AGP, 0, &info->agpTexHandle) < 0) {
- fprintf(stderr,
- "[agp] Could not add AGP texture map mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] AGP texture map handle = 0x%08lx\n",
- info->agpTexHandle);
-
- if (drmMap(ctx->drmFD, info->agpTexHandle, info->agpTexMapSize,
- (drmAddressPtr)&info->agpTex) < 0) {
- fprintf(stderr,
- "[agp] Could not map AGP texture map\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] AGP Texture map mapped at 0x%08lx\n",
- (unsigned long)info->agpTex);
-
- /* Initialize Rage 128's AGP registers */
- cntl = INREG(R128_AGP_CNTL);
- cntl &= ~R128_AGP_APER_SIZE_MASK;
- switch (info->agpSize) {
- case 256: cntl |= R128_AGP_APER_SIZE_256MB; break;
- case 128: cntl |= R128_AGP_APER_SIZE_128MB; break;
- case 64: cntl |= R128_AGP_APER_SIZE_64MB; break;
- case 32: cntl |= R128_AGP_APER_SIZE_32MB; break;
- case 16: cntl |= R128_AGP_APER_SIZE_16MB; break;
- case 8: cntl |= R128_AGP_APER_SIZE_8MB; break;
- case 4: cntl |= R128_AGP_APER_SIZE_4MB; break;
- default:
- fprintf(stderr,
- "[agp] Illegal aperture size %d kB\n",
- info->agpSize*1024);
- return GL_FALSE;
- }
- agpBase = drmAgpBase(ctx->drmFD);
- OUTREG(R128_AGP_BASE, agpBase);
- OUTREG(R128_AGP_CNTL, cntl);
-
- /* Disable Rage 128's PCIGART registers */
- chunk = INREG(R128_BM_CHUNK_0_VAL);
- chunk &= ~(R128_BM_PTR_FORCE_TO_PCI |
- R128_BM_PM4_RD_FORCE_TO_PCI |
- R128_BM_GLOBAL_FORCE_TO_PCI);
- OUTREG(R128_BM_CHUNK_0_VAL, chunk);
-
- OUTREG(R128_PCI_GART_PAGE, 1); /* Ensure AGP GART is used (for now) */
-
- return GL_TRUE;
-}
-
-static GLboolean R128DRIPciInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- unsigned char *R128MMIO = ctx->MMIOAddress;
- uint32_t chunk;
- int ret;
- int flags;
-
- info->agpOffset = 0;
-
- ret = drmScatterGatherAlloc(ctx->drmFD, info->agpSize*1024*1024,
- &info->pciMemHandle);
- if (ret < 0) {
- fprintf(stderr, "[pci] Out of memory (%d)\n", ret);
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] %d kB allocated with handle 0x%08x\n",
- info->agpSize*1024, info->pciMemHandle);
-
- /* Initialize the CCE ring buffer data */
- info->ringStart = info->agpOffset;
- info->ringMapSize = info->ringSize*1024*1024 + r128_drm_page_size;
- info->ringSizeLog2QW = R128MinBits(info->ringSize*1024*1024/8) - 1;
-
- info->ringReadOffset = info->ringStart + info->ringMapSize;
- info->ringReadMapSize = r128_drm_page_size;
-
- /* Reserve space for vertex/indirect buffers */
- info->bufStart = info->ringReadOffset + info->ringReadMapSize;
- info->bufMapSize = info->bufSize*1024*1024;
-
- flags = DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL;
-
- if (drmAddMap(ctx->drmFD, info->ringStart, info->ringMapSize,
- DRM_SCATTER_GATHER, flags, &info->ringHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add ring mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] ring handle = 0x%08lx\n", info->ringHandle);
-
- if (drmMap(ctx->drmFD, info->ringHandle, info->ringMapSize,
- (drmAddressPtr)&info->ring) < 0) {
- fprintf(stderr, "[pci] Could not map ring\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] Ring mapped at 0x%08lx\n",
- (unsigned long)info->ring);
- fprintf(stderr,
- "[pci] Ring contents 0x%08lx\n",
- *(unsigned long *)info->ring);
-
- if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
- DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add ring read ptr mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] ring read ptr handle = 0x%08lx\n",
- info->ringReadPtrHandle);
-
- if (drmMap(ctx->drmFD, info->ringReadPtrHandle, info->ringReadMapSize,
- (drmAddressPtr)&info->ringReadPtr) < 0) {
- fprintf(stderr,
- "[pci] Could not map ring read ptr\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] Ring read ptr mapped at 0x%08lx\n",
- (unsigned long)info->ringReadPtr);
- fprintf(stderr,
- "[pci] Ring read ptr contents 0x%08lx\n",
- *(unsigned long *)info->ringReadPtr);
-
- if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
- DRM_SCATTER_GATHER, 0, &info->bufHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add vertex/indirect buffers mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] vertex/indirect buffers handle = 0x%08lx\n",
- info->bufHandle);
-
- if (drmMap(ctx->drmFD, info->bufHandle, info->bufMapSize,
- (drmAddressPtr)&info->buf) < 0) {
- fprintf(stderr,
- "[pci] Could not map vertex/indirect buffers\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] Vertex/indirect buffers mapped at 0x%08lx\n",
- (unsigned long)info->buf);
- fprintf(stderr,
- "[pci] Vertex/indirect buffers contents 0x%08lx\n",
- *(unsigned long *)info->buf);
-
- if (!info->IsPCI) {
- /* This is really an AGP card, force PCI GART mode */
- chunk = INREG(R128_BM_CHUNK_0_VAL);
- chunk |= (R128_BM_PTR_FORCE_TO_PCI |
- R128_BM_PM4_RD_FORCE_TO_PCI |
- R128_BM_GLOBAL_FORCE_TO_PCI);
- OUTREG(R128_BM_CHUNK_0_VAL, chunk);
- OUTREG(R128_PCI_GART_PAGE, 0); /* Ensure PCI GART is used */
- }
-
- return GL_TRUE;
-}
-
-/* Add a map for the MMIO registers that will be accessed by any
- DRI-based clients. */
-static GLboolean R128DRIMapInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- int flags;
-
- if (info->CCESecure) flags = DRM_READ_ONLY;
- else flags = 0;
-
- /* Map registers */
- if (drmAddMap(ctx->drmFD, ctx->MMIOStart, ctx->MMIOSize,
- DRM_REGISTERS, flags, &info->registerHandle) < 0) {
- return GL_FALSE;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08x\n", info->registerHandle);
-
- return GL_TRUE;
-}
-
-/* Initialize the kernel data structures. */
-static int R128DRIKernelInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- drm_r128_init_t drmInfo;
-
- memset( &drmInfo, 0, sizeof(&drmInfo) );
-
- drmInfo.func = R128_INIT_CCE;
- drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
- drmInfo.is_pci = info->IsPCI;
- drmInfo.cce_mode = info->CCEMode;
- drmInfo.cce_secure = info->CCESecure;
- drmInfo.ring_size = info->ringSize*1024*1024;
- drmInfo.usec_timeout = info->CCEusecTimeout;
-
- drmInfo.fb_bpp = ctx->bpp;
- drmInfo.depth_bpp = ctx->bpp;
-
- drmInfo.front_offset = info->frontOffset;
- drmInfo.front_pitch = info->frontPitch;
-
- drmInfo.back_offset = info->backOffset;
- drmInfo.back_pitch = info->backPitch;
-
- drmInfo.depth_offset = info->depthOffset;
- drmInfo.depth_pitch = info->depthPitch;
- drmInfo.span_offset = info->spanOffset;
-
- drmInfo.fb_offset = info->LinearAddr;
- drmInfo.mmio_offset = info->registerHandle;
- drmInfo.ring_offset = info->ringHandle;
- drmInfo.ring_rptr_offset = info->ringReadPtrHandle;
- drmInfo.buffers_offset = info->bufHandle;
- drmInfo.agp_textures_offset = info->agpTexHandle;
-
- if (drmCommandWrite(ctx->drmFD, DRM_R128_INIT,
- &drmInfo, sizeof(drmInfo)) < 0)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-/* Add a map for the vertex buffers that will be accessed by any
- DRI-based clients. */
-static GLboolean R128DRIBufInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- /* Initialize vertex buffers */
- if (info->IsPCI) {
- info->bufNumBufs = drmAddBufs(ctx->drmFD,
- info->bufMapSize / R128_BUFFER_SIZE,
- R128_BUFFER_SIZE,
- DRM_SG_BUFFER,
- info->bufStart);
- } else {
- info->bufNumBufs = drmAddBufs(ctx->drmFD,
- info->bufMapSize / R128_BUFFER_SIZE,
- R128_BUFFER_SIZE,
- DRM_AGP_BUFFER,
- info->bufStart);
- }
- if (info->bufNumBufs <= 0) {
- fprintf(stderr,
- "[drm] Could not create vertex/indirect buffers list\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[drm] Added %d %d byte vertex/indirect buffers\n",
- info->bufNumBufs, R128_BUFFER_SIZE);
-
- if (!(info->buffers = drmMapBufs(ctx->drmFD))) {
- fprintf(stderr,
- "[drm] Failed to map vertex/indirect buffers list\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[drm] Mapped %d vertex/indirect buffers\n",
- info->buffers->count);
-
- return GL_TRUE;
-}
-
-static void R128DRIIrqInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- unsigned char *R128MMIO = ctx->MMIOAddress;
-
- if (!info->irq) {
- info->irq = drmGetInterruptFromBusID(
- ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if((drmCtlInstHandler(ctx->drmFD, info->irq)) != 0) {
- fprintf(stderr,
- "[drm] failure adding irq handler, "
- "there is a device already using that irq\n"
- "[drm] falling back to irq-free operation\n");
- info->irq = 0;
- } else {
- info->gen_int_cntl = INREG( R128_GEN_INT_CNTL );
- }
- }
-
- if (info->irq)
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- info->irq);
-}
-
-static int R128CCEStop(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- drm_r128_cce_stop_t stop;
- int ret, i;
-
- stop.flush = 1;
- stop.idle = 1;
-
- ret = drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
- &stop, sizeof(stop) );
-
- if ( ret == 0 ) {
- return 0;
- } else if ( errno != EBUSY ) {
- return -errno;
- }
-
- stop.flush = 0;
-
- i = 0;
- do {
- ret = drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
- &stop, sizeof(stop) );
- } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY );
-
- if ( ret == 0 ) {
- return 0;
- } else if ( errno != EBUSY ) {
- return -errno;
- }
-
- stop.idle = 0;
-
- if ( drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
- &stop, sizeof(stop) )) {
- return -errno;
- } else {
- return 0;
- }
-}
-
-/* Initialize the CCE state, and start the CCE (if used by the X server) */
-static void R128DRICCEInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
-
- /* Turn on bus mastering */
- info->BusCntl &= ~R128_BUS_MASTER_DIS;
-
- /* CCEMode is initialized in r128_driver.c */
- switch (info->CCEMode) {
- case R128_PM4_NONPM4: info->CCEFifoSize = 0; break;
- case R128_PM4_192PIO: info->CCEFifoSize = 192; break;
- case R128_PM4_192BM: info->CCEFifoSize = 192; break;
- case R128_PM4_128PIO_64INDBM: info->CCEFifoSize = 128; break;
- case R128_PM4_128BM_64INDBM: info->CCEFifoSize = 128; break;
- case R128_PM4_64PIO_128INDBM: info->CCEFifoSize = 64; break;
- case R128_PM4_64BM_128INDBM: info->CCEFifoSize = 64; break;
- case R128_PM4_64PIO_64VCBM_64INDBM: info->CCEFifoSize = 64; break;
- case R128_PM4_64BM_64VCBM_64INDBM: info->CCEFifoSize = 64; break;
- case R128_PM4_64PIO_64VCPIO_64INDPIO: info->CCEFifoSize = 64; break;
- }
-
- /* Make sure the CCE is on for the X server */
- R128CCE_START(ctx, info);
-}
-
-
-static int R128MemoryInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int cpp = ctx->cpp;
- int bufferSize = ((ctx->shared.virtualHeight * width_bytes
- + R128_BUFFER_ALIGN)
- & ~R128_BUFFER_ALIGN);
- int depthSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes
- + R128_BUFFER_ALIGN)
- & ~R128_BUFFER_ALIGN);
- int l;
-
- info->frontOffset = 0;
- info->frontPitch = ctx->shared.virtualWidth;
-
- fprintf(stderr,
- "Using %d MB AGP aperture\n", info->agpSize);
- fprintf(stderr,
- "Using %d MB for the ring buffer\n", info->ringSize);
- fprintf(stderr,
- "Using %d MB for vertex/indirect buffers\n", info->bufSize);
- fprintf(stderr,
- "Using %d MB for AGP textures\n", info->agpTexSize);
-
- /* Front, back and depth buffers - everything else texture??
- */
- info->textureSize = ctx->shared.fbSize - 2 * bufferSize - depthSize;
-
- if (info->textureSize < 0)
- return 0;
-
- l = R128MinBits((info->textureSize-1) / R128_NR_TEX_REGIONS);
- if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY;
-
- /* Round the texture size up to the nearest whole number of
- * texture regions. Again, be greedy about this, don't
- * round down.
- */
- info->log2TexGran = l;
- info->textureSize = (info->textureSize >> l) << l;
-
- /* Set a minimum usable local texture heap size. This will fit
- * two 256x256x32bpp textures.
- */
- if (info->textureSize < 512 * 1024) {
- info->textureOffset = 0;
- info->textureSize = 0;
- }
-
- /* Reserve space for textures */
- info->textureOffset = ((ctx->shared.fbSize - info->textureSize +
- R128_BUFFER_ALIGN) &
- ~R128_BUFFER_ALIGN);
-
- /* Reserve space for the shared depth
- * buffer.
- */
- info->depthOffset = ((info->textureOffset - depthSize +
- R128_BUFFER_ALIGN) &
- ~R128_BUFFER_ALIGN);
- info->depthPitch = ctx->shared.virtualWidth;
-
- info->backOffset = ((info->depthOffset - bufferSize +
- R128_BUFFER_ALIGN) &
- ~R128_BUFFER_ALIGN);
- info->backPitch = ctx->shared.virtualWidth;
-
-
- fprintf(stderr,
- "Will use back buffer at offset 0x%x\n",
- info->backOffset);
- fprintf(stderr,
- "Will use depth buffer at offset 0x%x\n",
- info->depthOffset);
- fprintf(stderr,
- "Will use %d kb for textures at offset 0x%x\n",
- info->textureSize/1024, info->textureOffset);
-
- return 1;
-}
-
-
-/* Initialize the screen-specific data structures for the DRI and the
- Rage 128. This is the main entry point to the device-specific
- initialization code. It calls device-independent DRI functions to
- create the DRI data structures and initialize the DRI state. */
-static GLboolean R128DRIScreenInit(DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- R128DRIPtr pR128DRI;
- int err, major, minor, patch;
- drmVersionPtr version;
- drm_r128_sarea_t *pSAREAPriv;
-
- switch (ctx->bpp) {
- case 8:
- /* These modes are not supported (yet). */
- case 15:
- case 24:
- fprintf(stderr,
- "[dri] R128DRIScreenInit failed (depth %d not supported). "
- "[dri] Disabling DRI.\n", ctx->bpp);
- return GL_FALSE;
-
- /* Only 16 and 32 color depths are supports currently. */
- case 16:
- case 32:
- break;
- }
- r128_drm_page_size = getpagesize();
-
- info->registerSize = ctx->MMIOSize;
- ctx->shared.SAREASize = SAREA_MAX;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("r128", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- /* Check the r128 DRM version */
- version = drmGetVersion(ctx->drmFD);
- if (version) {
- if (version->version_major != 2 ||
- version->version_minor < 2) {
- /* incompatible drm version */
- fprintf(stderr,
- "[dri] R128DRIScreenInit failed because of a version mismatch.\n"
- "[dri] r128.o kernel module version is %d.%d.%d but version 2.2 or greater is needed.\n"
- "[dri] Disabling the DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel);
- drmFreeVersion(version);
- return GL_FALSE;
- }
- info->drmMinor = version->version_minor;
- drmFreeVersion(version);
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
- 0,
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
- if (!R128MemoryInit(ctx))
- return GL_FALSE;
-
- /* Initialize AGP */
- if (!info->IsPCI && !R128DRIAgpInit(ctx)) {
- info->IsPCI = GL_TRUE;
- fprintf(stderr,
- "[agp] AGP failed to initialize -- falling back to PCI mode.\n");
- fprintf(stderr,
- "[agp] Make sure you have the agpgart kernel module loaded.\n");
- }
-
- /* Initialize PCIGART */
- if (info->IsPCI && !R128DRIPciInit(ctx)) {
- return GL_FALSE;
- }
-
- /* DRIScreenInit doesn't add all the
- common mappings. Add additional
- mappings here. */
- if (!R128DRIMapInit(ctx)) {
- return GL_FALSE;
- }
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the kernel data structures */
- if (!R128DRIKernelInit(ctx)) {
- return GL_FALSE;
- }
-
- /* Initialize the vertex buffers list */
- if (!R128DRIBufInit(ctx)) {
- return GL_FALSE;
- }
-
- /* Initialize IRQ */
- R128DRIIrqInit(ctx);
-
- /* Initialize and start the CCE if required */
- R128DRICCEInit(ctx);
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
- drimemsetio((char *)ctx->FBAddress + info->frontOffset,
- 0,
- info->frontPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- drimemsetio((char *)ctx->FBAddress + info->backOffset,
- 0,
- info->backPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- pSAREAPriv = (drm_r128_sarea_t *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
-
- /* This is the struct passed to radeon_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(R128DRIRec));
- ctx->driverClientMsgSize = sizeof(R128DRIRec);
-
- pR128DRI = (R128DRIPtr)ctx->driverClientMsg;
- pR128DRI->deviceID = info->Chipset;
- pR128DRI->width = ctx->shared.virtualWidth;
- pR128DRI->height = ctx->shared.virtualHeight;
- pR128DRI->depth = ctx->bpp;
- pR128DRI->bpp = ctx->bpp;
-
- pR128DRI->IsPCI = info->IsPCI;
- pR128DRI->AGPMode = info->agpMode;
-
- pR128DRI->frontOffset = info->frontOffset;
- pR128DRI->frontPitch = info->frontPitch;
- pR128DRI->backOffset = info->backOffset;
- pR128DRI->backPitch = info->backPitch;
- pR128DRI->depthOffset = info->depthOffset;
- pR128DRI->depthPitch = info->depthPitch;
- pR128DRI->spanOffset = info->spanOffset;
- pR128DRI->textureOffset = info->textureOffset;
- pR128DRI->textureSize = info->textureSize;
- pR128DRI->log2TexGran = info->log2TexGran;
-
- pR128DRI->registerHandle = info->registerHandle;
- pR128DRI->registerSize = info->registerSize;
-
- pR128DRI->agpTexHandle = info->agpTexHandle;
- pR128DRI->agpTexMapSize = info->agpTexMapSize;
- pR128DRI->log2AGPTexGran = info->log2AGPTexGran;
- pR128DRI->agpTexOffset = info->agpTexStart;
- pR128DRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- return GL_TRUE;
-}
-
-/* The screen is being closed, so clean up any state and free any
- resources used by the DRI. */
-void R128DRICloseScreen(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- drm_r128_init_t drmInfo;
-
- /* Stop the CCE if it is still in use */
- R128CCE_STOP(ctx, info);
-
- if (info->irq) {
- drmCtlUninstHandler(ctx->drmFD);
- info->irq = 0;
- }
-
- /* De-allocate vertex buffers */
- if (info->buffers) {
- drmUnmapBufs(info->buffers);
- info->buffers = NULL;
- }
-
- /* De-allocate all kernel resources */
- memset(&drmInfo, 0, sizeof(drmInfo));
- drmInfo.func = R128_CLEANUP_CCE;
- drmCommandWrite(ctx->drmFD, DRM_R128_INIT,
- &drmInfo, sizeof(drmInfo));
-
- /* De-allocate all AGP resources */
- if (info->agpTex) {
- drmUnmap(info->agpTex, info->agpTexMapSize);
- info->agpTex = NULL;
- }
- if (info->buf) {
- drmUnmap(info->buf, info->bufMapSize);
- info->buf = NULL;
- }
- if (info->ringReadPtr) {
- drmUnmap(info->ringReadPtr, info->ringReadMapSize);
- info->ringReadPtr = NULL;
- }
- if (info->ring) {
- drmUnmap(info->ring, info->ringMapSize);
- info->ring = NULL;
- }
- if (info->agpMemHandle != DRM_AGP_NO_HANDLE) {
- drmAgpUnbind(ctx->drmFD, info->agpMemHandle);
- drmAgpFree(ctx->drmFD, info->agpMemHandle);
- info->agpMemHandle = 0;
- drmAgpRelease(ctx->drmFD);
- }
- if (info->pciMemHandle) {
- drmScatterGatherFree(ctx->drmFD, info->pciMemHandle);
- info->pciMemHandle = 0;
- }
-}
-
-static GLboolean R128PreInitDRI(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
-
- /*info->CCEMode = R128_DEFAULT_CCE_PIO_MODE;*/
- info->CCEMode = R128_DEFAULT_CCE_BM_MODE;
- info->CCESecure = GL_TRUE;
-
- info->agpMode = R128_DEFAULT_AGP_MODE;
- info->agpSize = R128_DEFAULT_AGP_SIZE;
- info->ringSize = R128_DEFAULT_RING_SIZE;
- info->bufSize = R128_DEFAULT_BUFFER_SIZE;
- info->agpTexSize = R128_DEFAULT_AGP_TEX_SIZE;
-
- info->CCEusecTimeout = R128_DEFAULT_CCE_TIMEOUT;
-
- return GL_TRUE;
-}
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls R128ScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int R128InitFBDev( DRIDriverContext *ctx )
-{
- R128InfoPtr info = calloc(1, sizeof(*info));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- }
-
- ctx->driverPrivate = (void *)info;
-
- info->Chipset = ctx->chipset;
-
- switch (info->Chipset) {
- case PCI_DEVICE_ID_ATI_RAGE128_LE:
- case PCI_DEVICE_ID_ATI_RAGE128_RE:
- case PCI_DEVICE_ID_ATI_RAGE128_RK:
- case PCI_DEVICE_ID_ATI_RAGE128_PD:
- case PCI_DEVICE_ID_ATI_RAGE128_PP:
- case PCI_DEVICE_ID_ATI_RAGE128_PR:
- /* This is a PCI card */
- info->IsPCI = GL_TRUE;
- break;
- default:
- /* This is an AGP card */
- info->IsPCI = GL_FALSE;
- break;
- }
-
- info->frontPitch = ctx->shared.virtualWidth;
- info->LinearAddr = ctx->FBStart & 0xfc000000;
-
- if (!R128PreInitDRI(ctx))
- return 0;
-
- if (!R128DRIScreenInit(ctx))
- return 0;
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void R128HaltFBDev( DRIDriverContext *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa R128PostValidateMode().
- */
-static int R128ValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa R128ValidateMode().
- */
-static int R128PostValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Shutdown the drawing engine.
- *
- * \param ctx display handle
- *
- * Turns off the command processor engine & restores the graphics card
- * to a state that fbdev understands.
- */
-static int R128EngineShutdown( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-/**
- * \brief Restore the drawing engine.
- *
- * \param ctx display handle
- *
- * Resets the graphics card and sets initial values for several registers of
- * the card's drawing engine.
- *
- * Turns on the R128 command processor engine (i.e., the ringbuffer).
- */
-static int R128EngineRestore( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-const struct DRIDriverRec __driDriver = {
- R128ValidateMode,
- R128PostValidateMode,
- R128InitFBDev,
- R128HaltFBDev,
- R128EngineShutdown,
- R128EngineRestore,
- 0,
-};
diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile
index 14eb96c1bab..9ea81fd5059 100644
--- a/src/mesa/drivers/dri/r200/Makefile
+++ b/src/mesa/drivers/dri/r200/Makefile
@@ -7,8 +7,6 @@ CFLAGS += $(RADEON_CFLAGS)
LIBNAME = r200_dri.so
-MINIGLX_SOURCES = server/radeon_dri.c
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
@@ -23,10 +21,13 @@ RADEON_COMMON_SOURCES = \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
+ radeon_pixel_read.c \
radeon_queryobj.c \
radeon_span.c \
radeon_texture.c \
- radeon_tex_copy.c
+ radeon_tex_copy.c \
+ radeon_tex_getimage.c \
+ radeon_tile.c
DRIVER_SOURCES = r200_context.c \
r200_ioctl.c \
diff --git a/src/mesa/drivers/dri/r200/r200_blit.c b/src/mesa/drivers/dri/r200/r200_blit.c
index e446d532cf7..30757600934 100644
--- a/src/mesa/drivers/dri/r200/r200_blit.c
+++ b/src/mesa/drivers/dri/r200/r200_blit.c
@@ -38,7 +38,7 @@ static inline uint32_t cmdpacket0(struct radeon_screen *rscrn,
}
/* common formats supported as both textures and render targets */
-static unsigned is_blit_supported(gl_format mesa_format)
+unsigned r200_check_blit(gl_format mesa_format)
{
/* XXX others? BE/LE? */
switch (mesa_format) {
@@ -211,15 +211,16 @@ static GLboolean validate_buffers(struct r200_context *r200,
struct radeon_bo *dst_bo)
{
int ret;
- radeon_cs_space_add_persistent_bo(r200->radeon.cmdbuf.cs,
- src_bo, RADEON_GEM_DOMAIN_VRAM, 0);
- radeon_cs_space_add_persistent_bo(r200->radeon.cmdbuf.cs,
- dst_bo, 0, RADEON_GEM_DOMAIN_VRAM);
+ radeon_cs_space_reset_bos(r200->radeon.cmdbuf.cs);
ret = radeon_cs_space_check_with_bo(r200->radeon.cmdbuf.cs,
- first_elem(&r200->radeon.dma.reserved)->bo,
- RADEON_GEM_DOMAIN_GTT, 0);
+ src_bo, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
+ if (ret)
+ return GL_FALSE;
+
+ ret = radeon_cs_space_check_with_bo(r200->radeon.cmdbuf.cs,
+ dst_bo, 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT);
if (ret)
return GL_FALSE;
@@ -333,7 +334,7 @@ unsigned r200_blit(GLcontext *ctx,
{
struct r200_context *r200 = R200_CONTEXT(ctx);
- if (!is_blit_supported(dst_mesaformat))
+ if (!r200_check_blit(dst_mesaformat))
return GL_FALSE;
/* Make sure that colorbuffer has even width - hw limitation */
diff --git a/src/mesa/drivers/dri/r200/r200_blit.h b/src/mesa/drivers/dri/r200/r200_blit.h
index 38487266ae1..53206f0b471 100644
--- a/src/mesa/drivers/dri/r200/r200_blit.h
+++ b/src/mesa/drivers/dri/r200/r200_blit.h
@@ -30,6 +30,8 @@
void r200_blit_init(struct r200_context *r200);
+unsigned r200_check_blit(gl_format mesa_format);
+
unsigned r200_blit(GLcontext *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 6ecd46ecd9e..4f1a56658cc 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -264,7 +264,9 @@ static void r200_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.fallback = r200Fallback;
radeon->vtbl.update_scissor = r200_vtbl_update_scissor;
radeon->vtbl.emit_query_finish = r200_emit_query_finish;
+ radeon->vtbl.check_blit = r200_check_blit;
radeon->vtbl.blit = r200_blit;
+ radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
}
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c
index a1b505707ea..b72f69b7f45 100644
--- a/src/mesa/drivers/dri/r200/r200_ioctl.c
+++ b/src/mesa/drivers/dri/r200/r200_ioctl.c
@@ -61,6 +61,8 @@ static void r200KernelClear(GLcontext *ctx, GLuint flags)
GLint cx, cy, cw, ch, ret;
GLuint i;
+ radeonEmitState(&rmesa->radeon);
+
LOCK_HARDWARE( &rmesa->radeon );
/* Throttle the number of clear ioctls we do.
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index b9ec6f428f0..050e5aa8770 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -2501,7 +2501,6 @@ void r200InitStateFuncs( struct dd_function_table *functions )
functions->BlendFuncSeparate = r200BlendFuncSeparate;
functions->ClearColor = r200ClearColor;
functions->ClearDepth = r200ClearDepth;
- functions->ClearIndex = NULL;
functions->ClearStencil = r200ClearStencil;
functions->ClipPlane = r200ClipPlane;
functions->ColorMask = r200ColorMask;
@@ -2513,7 +2512,6 @@ void r200InitStateFuncs( struct dd_function_table *functions )
functions->Fogfv = r200Fogfv;
functions->FrontFace = r200FrontFace;
functions->Hint = NULL;
- functions->IndexMask = NULL;
functions->LightModelfv = r200LightModelfv;
functions->Lightfv = r200Lightfv;
functions->LineStipple = r200LineStipple;
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index e220e40b015..262fe3cddee 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -420,7 +420,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
diff --git a/src/mesa/drivers/dri/r200/radeon_pixel_read.c b/src/mesa/drivers/dri/r200/radeon_pixel_read.c
new file mode 120000
index 00000000000..3b03803126f
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_pixel_read.c
@@ -0,0 +1 @@
+../radeon/radeon_pixel_read.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_tex_getimage.c b/src/mesa/drivers/dri/r200/radeon_tex_getimage.c
new file mode 120000
index 00000000000..d9836d7326e
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_tex_getimage.c
@@ -0,0 +1 @@
+../radeon/radeon_tex_getimage.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_tile.c b/src/mesa/drivers/dri/r200/radeon_tile.c
new file mode 120000
index 00000000000..d4bfe27da64
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_tile.c
@@ -0,0 +1 @@
+../radeon/radeon_tile.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_tile.h b/src/mesa/drivers/dri/r200/radeon_tile.h
new file mode 120000
index 00000000000..31074c581ea
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_tile.h
@@ -0,0 +1 @@
+../radeon/radeon_tile.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/server/radeon_dri.c b/src/mesa/drivers/dri/r200/server/radeon_dri.c
deleted file mode 120000
index d05847d650f..00000000000
--- a/src/mesa/drivers/dri/r200/server/radeon_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../radeon/server/radeon_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile
index 04459c2ddfa..2245998c952 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -7,8 +7,6 @@ CFLAGS += $(RADEON_CFLAGS)
LIBNAME = r300_dri.so
-MINIGLX_SOURCES = server/radeon_dri.c
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
@@ -33,10 +31,13 @@ RADEON_COMMON_SOURCES = \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
- radeon_span.c \
+ radeon_pixel_read.c \
radeon_queryobj.c \
+ radeon_span.c \
radeon_texture.c \
- radeon_tex_copy.c
+ radeon_tex_copy.c \
+ radeon_tex_getimage.c \
+ radeon_tile.c
DRIVER_SOURCES = \
radeon_screen.c \
diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
index 829f028950c..710cae727a1 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
@@ -469,6 +469,8 @@ void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi
if (compiler->Base.Error)
return;
+ assert(code->inst_end >= 0);
+
if ((code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) {
/* This may happen when dead-code elimination is disabled or
* when most of the fragment program logic is leading to a KIL */
diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c
index 54ac2510e7a..d870c7f852a 100644
--- a/src/mesa/drivers/dri/r300/r300_blit.c
+++ b/src/mesa/drivers/dri/r300/r300_blit.c
@@ -97,6 +97,7 @@ static void create_fragment_program(struct r300_context *r300)
struct r300_fragment_program_compiler compiler;
struct rc_instruction *inst;
+ memset(&compiler, 0, sizeof(struct r300_fragment_program_compiler));
rc_init(&compiler.Base);
inst = rc_insert_new_instruction(&compiler.Base, compiler.Base.Program.Instructions.Prev);
@@ -125,7 +126,8 @@ static void create_fragment_program(struct r300_context *r300)
void r300_blit_init(struct r300_context *r300)
{
- create_vertex_program(r300);
+ if (r300->options.hw_tcl_enabled)
+ create_vertex_program(r300);
create_fragment_program(r300);
}
@@ -340,8 +342,14 @@ static void emit_pvs_setup(struct r300_context *r300,
static void emit_vap_setup(struct r300_context *r300)
{
+ int tex_offset;
BATCH_LOCALS(&r300->radeon);
+ if (r300->options.hw_tcl_enabled)
+ tex_offset = 1;
+ else
+ tex_offset = 6;
+
BEGIN_BATCH(12);
OUT_BATCH_REGSEQ(R300_SE_VTE_CNTL, 2);
OUT_BATCH(R300_VTX_XY_FMT | R300_VTX_Z_FMT);
@@ -350,7 +358,7 @@ static void emit_vap_setup(struct r300_context *r300)
OUT_BATCH_REGVAL(R300_VAP_PSC_SGN_NORM_CNTL, 0xaaaaaaaa);
OUT_BATCH_REGVAL(R300_VAP_PROG_STREAM_CNTL_0,
((R300_DATA_TYPE_FLOAT_2 | (0 << R300_DST_VEC_LOC_SHIFT)) << 0) |
- (((1 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_2 | R300_LAST_VEC) << 16));
+ (((tex_offset << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_2 | R300_LAST_VEC) << 16));
OUT_BATCH_REGVAL(R300_VAP_PROG_STREAM_CNTL_EXT_0,
((((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) |
(R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) |
@@ -373,15 +381,16 @@ static GLboolean validate_buffers(struct r300_context *r300,
struct radeon_bo *dst_bo)
{
int ret;
- radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs,
- src_bo, RADEON_GEM_DOMAIN_VRAM, 0);
- radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs,
- dst_bo, 0, RADEON_GEM_DOMAIN_VRAM);
+ radeon_cs_space_reset_bos(r300->radeon.cmdbuf.cs);
ret = radeon_cs_space_check_with_bo(r300->radeon.cmdbuf.cs,
- first_elem(&r300->radeon.dma.reserved)->bo,
- RADEON_GEM_DOMAIN_GTT, 0);
+ src_bo, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
+ if (ret)
+ return GL_FALSE;
+
+ ret = radeon_cs_space_check_with_bo(r300->radeon.cmdbuf.cs,
+ dst_bo, 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT);
if (ret)
return GL_FALSE;
@@ -445,7 +454,7 @@ static void other_stuff(struct r300_context *r300)
{
BATCH_LOCALS(&r300->radeon);
- BEGIN_BATCH(15);
+ BEGIN_BATCH(13);
OUT_BATCH_REGVAL(R300_GA_POLY_MODE,
R300_GA_POLY_MODE_FRONT_PTYPE_TRI | R300_GA_POLY_MODE_BACK_PTYPE_TRI);
OUT_BATCH_REGVAL(R300_SU_CULL_MODE, R300_FRONT_FACE_CCW);
@@ -454,9 +463,13 @@ static void other_stuff(struct r300_context *r300)
OUT_BATCH_REGSEQ(R300_RB3D_CBLEND, 2);
OUT_BATCH(0x0);
OUT_BATCH(0x0);
- OUT_BATCH_REGVAL(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE);
OUT_BATCH_REGVAL(R300_ZB_CNTL, 0);
END_BATCH();
+ if (r300->options.hw_tcl_enabled) {
+ BEGIN_BATCH(2);
+ OUT_BATCH_REGVAL(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE);
+ END_BATCH();
+ }
}
static void emit_cb_setup(struct r300_context *r300,
@@ -494,7 +507,7 @@ static void emit_cb_setup(struct r300_context *r300,
END_BATCH();
}
-static unsigned is_blit_supported(gl_format dst_format)
+unsigned r300_check_blit(gl_format dst_format)
{
switch (dst_format) {
case MESA_FORMAT_RGB565:
@@ -562,7 +575,7 @@ unsigned r300_blit(GLcontext *ctx,
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
- if (!is_blit_supported(dst_mesaformat))
+ if (!r300_check_blit(dst_mesaformat))
return 0;
/* Make sure that colorbuffer has even width - hw limitation */
@@ -629,7 +642,9 @@ unsigned r300_blit(GLcontext *ctx,
r300_emit_rs_setup(r300);
}
- emit_pvs_setup(r300, r300->blit.vp_code.body.d, 2);
+ if (r300->options.hw_tcl_enabled)
+ emit_pvs_setup(r300, r300->blit.vp_code.body.d, 2);
+
emit_vap_setup(r300);
emit_cb_setup(r300, dst_bo, dst_offset, dst_mesaformat, dst_pitch, dst_width, dst_height);
diff --git a/src/mesa/drivers/dri/r300/r300_blit.h b/src/mesa/drivers/dri/r300/r300_blit.h
index 735acaddd70..39b157a57b8 100644
--- a/src/mesa/drivers/dri/r300/r300_blit.h
+++ b/src/mesa/drivers/dri/r300/r300_blit.h
@@ -30,6 +30,8 @@
void r300_blit_init(struct r300_context *r300);
+unsigned r300_check_blit(gl_format mesa_format);
+
unsigned r300_blit(GLcontext *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
@@ -51,4 +53,4 @@ unsigned r300_blit(GLcontext *ctx,
unsigned reg_height,
unsigned flip_y);
-#endif // R300_BLIT_H \ No newline at end of file
+#endif // R300_BLIT_H
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index 4787bafc66a..e2dbb1dbf40 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -90,8 +90,7 @@ void r300_emit_vpu(struct r300_context *r300,
{
BATCH_LOCALS(&r300->radeon);
- BEGIN_BATCH_NO_AUTOSTATE(5 + len);
- OUT_BATCH_REGVAL(R300_VAP_PVS_STATE_FLUSH_REG, 0);
+ BEGIN_BATCH_NO_AUTOSTATE(3 + len);
OUT_BATCH_REGVAL(R300_VAP_PVS_VECTOR_INDX_REG, addr);
OUT_BATCH(CP_PACKET0(R300_VAP_PVS_UPLOAD_DATA, len-1) | RADEON_ONE_REG_WR);
OUT_BATCH_TABLE(data, len);
@@ -333,36 +332,37 @@ void r300_emit_cb_setup(struct r300_context *r300,
assert(offset % 32 == 0);
switch (format) {
- case MESA_FORMAT_RGB565:
- assert(_mesa_little_endian());
- cbpitch |= R300_COLOR_FORMAT_RGB565;
+ case MESA_FORMAT_SL8:
+ case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
+ cbpitch |= R300_COLOR_FORMAT_I8;
break;
+ case MESA_FORMAT_RGB565:
case MESA_FORMAT_RGB565_REV:
- assert(!_mesa_little_endian());
cbpitch |= R300_COLOR_FORMAT_RGB565;
break;
case MESA_FORMAT_ARGB4444:
- assert(_mesa_little_endian());
- cbpitch |= R300_COLOR_FORMAT_ARGB4444;
- break;
case MESA_FORMAT_ARGB4444_REV:
- assert(!_mesa_little_endian());
cbpitch |= R300_COLOR_FORMAT_ARGB4444;
break;
+ case MESA_FORMAT_RGBA5551:
case MESA_FORMAT_ARGB1555:
- assert(_mesa_little_endian());
- cbpitch |= R300_COLOR_FORMAT_ARGB1555;
- break;
case MESA_FORMAT_ARGB1555_REV:
- assert(!_mesa_little_endian());
cbpitch |= R300_COLOR_FORMAT_ARGB1555;
break;
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888_REV:
+ case MESA_FORMAT_ARGB8888_REV:
+ case MESA_FORMAT_SRGBA8:
+ case MESA_FORMAT_SARGB8:
+ cbpitch |= R300_COLOR_FORMAT_ARGB8888;
+ break;
default:
- if (cpp == 4) {
- cbpitch |= R300_COLOR_FORMAT_ARGB8888;
- } else {
- _mesa_problem(r300->radeon.glCtx, "unexpected format in emit_cb_offset()");;
- }
+ _mesa_problem(r300->radeon.glCtx, "unexpected format in emit_cb_offset()");
break;
}
@@ -778,24 +778,6 @@ void r300InitCmdBuf(r300ContextPtr r300)
/* VPU only on TCL */
if (has_tcl) {
int i;
- if (r300->radeon.radeonScreen->kernel_mm) {
- ALLOC_STATE(vap_flush, always, 10, 0);
- /* flush processing vertices */
- r300->hw.vap_flush.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_SC_SCREENDOOR, 1);
- r300->hw.vap_flush.cmd[1] = 0;
- r300->hw.vap_flush.cmd[2] = cmdpacket0(r300->radeon.radeonScreen, R300_RB3D_DSTCACHE_CTLSTAT, 1);
- r300->hw.vap_flush.cmd[3] = R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D;
- r300->hw.vap_flush.cmd[4] = cmdpacket0(r300->radeon.radeonScreen, RADEON_WAIT_UNTIL, 1);
- r300->hw.vap_flush.cmd[5] = RADEON_WAIT_3D_IDLECLEAN;
- r300->hw.vap_flush.cmd[6] = cmdpacket0(r300->radeon.radeonScreen, R300_SC_SCREENDOOR, 1);
- r300->hw.vap_flush.cmd[7] = 0xffffff;
- r300->hw.vap_flush.cmd[8] = cmdpacket0(r300->radeon.radeonScreen, R300_VAP_PVS_STATE_FLUSH_REG, 1);
- r300->hw.vap_flush.cmd[9] = 0;
- } else {
- ALLOC_STATE(vap_flush, never, 10, 0);
- }
-
-
ALLOC_STATE(vpi, vpu, R300_VPI_CMDSIZE, 0);
r300->hw.vpi.cmd[0] =
cmdvpu(r300->radeon.radeonScreen, R300_PVS_CODE_START, 0);
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index fe2ed22dc24..364e0ba6b61 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -109,7 +109,6 @@ static const struct dri_extension card_extensions[] = {
{"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
{"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
{"GL_EXT_blend_subtract", NULL},
- {"GL_EXT_packed_depth_stencil", NULL},
{"GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
{"GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions},
{"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions },
@@ -320,7 +319,14 @@ static void r300_init_vtbl(radeonContextPtr radeon)
} else
radeon->vtbl.emit_query_finish = r300_emit_query_finish;
- radeon->vtbl.blit = r300_blit;
+ radeon->vtbl.check_blit = r300_check_blit;
+ radeon->vtbl.blit = r300_blit;
+
+ if (radeon->radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
+ radeon->vtbl.is_format_renderable = r500IsFormatRenderable;
+ } else {
+ radeon->vtbl.is_format_renderable = r300IsFormatRenderable;
+ }
}
static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
@@ -455,6 +461,9 @@ static void r300InitGLExtensions(GLcontext *ctx)
}
if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV350)
_mesa_enable_extension(ctx, "GL_ARB_half_float_vertex");
+
+ if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515)
+ _mesa_enable_extension(ctx, "GL_EXT_packed_depth_stencil");
}
static void r300InitIoctlFuncs(struct dd_function_table *functions)
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 78ab43a99f9..df7115e7dae 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -355,7 +355,6 @@ struct r300_hw_state {
struct radeon_state_atom zb_hiz_offset; /* (4F44) */
struct radeon_state_atom zb_hiz_pitch; /* (4F54) */
- struct radeon_state_atom vap_flush;
struct radeon_state_atom vpi; /* vp instructions */
struct radeon_state_atom vpp; /* vp parameters */
struct radeon_state_atom vps; /* vertex point size (?) */
diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
index 3efa0e3a163..282c0e18bca 100644
--- a/src/mesa/drivers/dri/r300/r300_draw.c
+++ b/src/mesa/drivers/dri/r300/r300_draw.c
@@ -177,7 +177,7 @@ static void r300SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
radeon_bo_map(r300->ind_buf.bo, 1);
assert(r300->ind_buf.bo->ptr != NULL);
dst_ptr = ADD_POINTERS(r300->ind_buf.bo->ptr, r300->ind_buf.bo_offset);
- _mesa_memcpy(dst_ptr, src_ptr, size);
+ memcpy(dst_ptr, src_ptr, size);
radeon_bo_unmap(r300->ind_buf.bo);
r300->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT);
@@ -314,7 +314,7 @@ static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *i
int i;
for (i = 0; i < count; ++i) {
- _mesa_memcpy(dst_ptr, src_ptr, input->StrideB);
+ memcpy(dst_ptr, src_ptr, input->StrideB);
src_ptr += input->StrideB;
dst_ptr += dst_stride;
}
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index a0e2dd3c09f..61ea5e4d9a3 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -72,7 +72,7 @@ static void build_state(
{
int unit;
- _mesa_bzero(state, sizeof(*state));
+ memset(state, 0, sizeof(*state));
for(unit = 0; unit < 16; ++unit) {
if (fp->Base.ShadowSamplers & (1 << unit)) {
@@ -227,7 +227,7 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog
if (compiler.Base.Debug) {
fflush(stderr);
- _mesa_printf("Fragment Program: Initial program:\n");
+ printf("Fragment Program: Initial program:\n");
_mesa_print_program(&cont->Base.Base);
fflush(stderr);
}
@@ -271,13 +271,13 @@ struct r300_fragment_program *r300SelectAndTranslateFragmentShader(GLcontext *ct
fp = fp_list->progs;
while (fp) {
- if (_mesa_memcmp(&fp->state, &state, sizeof(state)) == 0) {
+ if (memcmp(&fp->state, &state, sizeof(state)) == 0) {
return r300->selected_fp = fp;
}
fp = fp->next;
}
- fp = _mesa_calloc(sizeof(struct r300_fragment_program));
+ fp = calloc(1, sizeof(struct r300_fragment_program));
fp->state = state;
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index e3e62857840..95961314863 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -440,7 +440,7 @@ void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode)
if (mode) {
if ((fallback_warn & bit) == 0) {
if (RADEON_DEBUG & RADEON_FALLBACKS)
- _mesa_fprintf(stderr, "WARNING! Falling back to software for %s\n", getFallbackString(bit));
+ fprintf(stderr, "WARNING! Falling back to software for %s\n", getFallbackString(bit));
fallback_warn |= bit;
}
rmesa->fallback |= bit;
diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c
index 3638010e486..9c24166ec5b 100644
--- a/src/mesa/drivers/dri/r300/r300_shader.c
+++ b/src/mesa/drivers/dri/r300/r300_shader.c
@@ -39,7 +39,7 @@ static void freeFragProgCache(GLcontext *ctx, struct r300_fragment_program_cont
while (fp) {
tmp = fp->next;
rc_constants_destroy(&fp->code.constants);
- _mesa_free(fp);
+ free(fp);
fp = tmp;
}
}
@@ -52,7 +52,7 @@ static void freeVertProgCache(GLcontext *ctx, struct r300_vertex_program_cont *c
tmp = vp->next;
rc_constants_destroy(&vp->code.constants);
_mesa_reference_vertprog(ctx, &vp->Base, NULL);
- _mesa_free(vp);
+ free(vp);
vp = tmp;
}
}
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 017d45a5039..87489412419 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -46,6 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/simple_list.h"
#include "main/api_arrayelt.h"
+#include "drivers/common/meta.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "shader/prog_parameter.h"
@@ -366,7 +367,6 @@ static void r300ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq )
p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
ip = (GLint *)ctx->Transform._ClipUserPlane[p];
- R300_STATECHANGE( rmesa, vap_flush );
R300_STATECHANGE( rmesa, vpucp[p] );
rmesa->hw.vpucp[p].cmd[R300_VPUCP_X] = ip[0];
rmesa->hw.vpucp[p].cmd[R300_VPUCP_Y] = ip[1];
@@ -794,12 +794,14 @@ static void r300PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * pa
R300_STATECHANGE(r300, ga_point_minmax);
r300->hw.ga_point_minmax.cmd[1] &= ~R300_GA_POINT_MINMAX_MIN_MASK;
r300->hw.ga_point_minmax.cmd[1] |= (GLuint)(ctx->Point.MinSize * 6.0);
+ r300PointSize(ctx, ctx->Point.Size);
break;
case GL_POINT_SIZE_MAX:
R300_STATECHANGE(r300, ga_point_minmax);
r300->hw.ga_point_minmax.cmd[1] &= ~R300_GA_POINT_MINMAX_MAX_MASK;
r300->hw.ga_point_minmax.cmd[1] |= (GLuint)(ctx->Point.MaxSize * 6.0)
<< R300_GA_POINT_MINMAX_MAX_SHIFT;
+ r300PointSize(ctx, ctx->Point.Size);
break;
case GL_POINT_DISTANCE_ATTENUATION:
break;
@@ -1762,8 +1764,6 @@ static void r300ResetHwState(r300ContextPtr r300)
if (RADEON_DEBUG & RADEON_STATE)
fprintf(stderr, "%s\n", __FUNCTION__);
- radeon_firevertices(&r300->radeon);
-
r300ColorMask(ctx,
ctx->Color.ColorMask[0][RCOMP],
ctx->Color.ColorMask[0][GCOMP],
@@ -1970,7 +1970,7 @@ void r300UpdateShaders(r300ContextPtr rmesa)
/* should only happenen once, just after context is created */
/* TODO: shouldn't we fallback to sw here? */
if (!ctx->FragmentProgram._Current) {
- _mesa_fprintf(stderr, "No ctx->FragmentProgram._Current!!\n");
+ fprintf(stderr, "No ctx->FragmentProgram._Current!!\n");
return;
}
@@ -1985,23 +1985,6 @@ void r300UpdateShaders(r300ContextPtr rmesa)
if (rmesa->options.hw_tcl_enabled) {
struct r300_vertex_program *vp;
- if (rmesa->radeon.NewGLState) {
- int i;
- for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
- rmesa->temp_attrib[i] =
- TNL_CONTEXT(ctx)->vb.AttribPtr[i];
- TNL_CONTEXT(ctx)->vb.AttribPtr[i] =
- &rmesa->dummy_attrib[i];
- }
-
- _tnl_UpdateFixedFunctionProgram(ctx);
-
- for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
- TNL_CONTEXT(ctx)->vb.AttribPtr[i] =
- rmesa->temp_attrib[i];
- }
- }
-
vp = r300SelectAndTranslateVertexShader(ctx);
r300SwitchFallback(ctx, R300_FALLBACK_VERTEX_PROGRAM, vp->error);
@@ -2255,6 +2238,68 @@ void r300UpdateShaderStates(r300ContextPtr rmesa)
}
}
+#define EASY_US_OUT_FMT(comps, c0, c1, c2, c3) \
+ (R500_OUT_FMT_##comps | R500_C0_SEL_##c0 | R500_C1_SEL_##c1 | \
+ R500_C2_SEL_##c2 | R500_C3_SEL_##c3)
+static void r300SetupUsOutputFormat(GLcontext *ctx)
+{
+ r300ContextPtr rmesa = R300_CONTEXT(ctx);
+ uint32_t hw_format;
+ struct radeon_renderbuffer *rrb = radeon_get_colorbuffer(&rmesa->radeon);
+
+ if (!rrb) {
+ return;
+ }
+
+ switch (rrb->base.Format)
+ {
+ case MESA_FORMAT_RGBA5551:
+ case MESA_FORMAT_RGBA8888:
+ hw_format = EASY_US_OUT_FMT(C4_8, A, B, G, R);
+ break;
+ case MESA_FORMAT_RGB565_REV:
+ case MESA_FORMAT_RGBA8888_REV:
+ hw_format = EASY_US_OUT_FMT(C4_8, R, G, B, A);
+ break;
+ case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_ARGB8888:
+ hw_format = EASY_US_OUT_FMT(C4_8, B, G, R, A);
+ break;
+ case MESA_FORMAT_ARGB4444_REV:
+ case MESA_FORMAT_ARGB1555_REV:
+ case MESA_FORMAT_XRGB8888_REV:
+ case MESA_FORMAT_ARGB8888_REV:
+ hw_format = EASY_US_OUT_FMT(C4_8, A, R, G, B);
+ break;
+ case MESA_FORMAT_SRGBA8:
+ hw_format = EASY_US_OUT_FMT(C4_10_GAMMA, A, B, G, R);
+ break;
+ case MESA_FORMAT_SARGB8:
+ hw_format = EASY_US_OUT_FMT(C4_10_GAMMA, B, G, R, A);
+ break;
+ case MESA_FORMAT_SL8:
+ hw_format = EASY_US_OUT_FMT(C4_10_GAMMA, A, A, R, A);
+ break;
+ case MESA_FORMAT_A8:
+ hw_format = EASY_US_OUT_FMT(C4_8, A, A, A, A);
+ break;
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
+ hw_format = EASY_US_OUT_FMT(C4_8, A, A, R, A);
+ break;
+ default:
+ assert(!"Unsupported format");
+ break;
+ }
+
+ R300_STATECHANGE(rmesa, us_out_fmt);
+ rmesa->hw.us_out_fmt.cmd[1] = hw_format;
+}
+#undef EASY_US_OUT_FMT
+
/**
* Called by Mesa after an internal state update.
*/
@@ -2284,6 +2329,10 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
r300->hw.shade2.cmd[1] &= ~R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST;
}
+ if (new_state & _NEW_BUFFERS) {
+ r300SetupUsOutputFormat(ctx);
+ }
+
r300->radeon.NewGLState |= new_state;
}
@@ -2344,8 +2393,12 @@ void r300InitStateFuncs(struct dd_function_table *functions)
functions->ClipPlane = r300ClipPlane;
functions->Scissor = radeonScissor;
- functions->DrawBuffer = radeonDrawBuffer;
- functions->ReadBuffer = radeonReadBuffer;
+ functions->DrawBuffer = radeonDrawBuffer;
+ functions->ReadBuffer = radeonReadBuffer;
+
+ functions->CopyPixels = _mesa_meta_CopyPixels;
+ functions->DrawPixels = _mesa_meta_DrawPixels;
+ functions->ReadPixels = radeonReadPixels;
}
void r300InitShaderFunctions(r300ContextPtr r300)
diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c
index 93983cee205..4dcc7cb022a 100644
--- a/src/mesa/drivers/dri/r300/r300_swtcl.c
+++ b/src/mesa/drivers/dri/r300/r300_swtcl.c
@@ -364,7 +364,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index 8dd85073954..baef206bc26 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -308,6 +308,45 @@ static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx,
return &t->base;
}
+unsigned r300IsFormatRenderable(gl_format mesa_format)
+{
+ switch (mesa_format)
+ {
+ case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_RGBA5551:
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_RGB565_REV:
+ case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_ARGB4444_REV:
+ case MESA_FORMAT_ARGB1555_REV:
+ case MESA_FORMAT_XRGB8888_REV:
+ case MESA_FORMAT_ARGB8888_REV:
+ case MESA_FORMAT_SRGBA8:
+ case MESA_FORMAT_SARGB8:
+ case MESA_FORMAT_SL8:
+ case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
+ case MESA_FORMAT_Z16:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+unsigned r500IsFormatRenderable(gl_format mesa_format)
+{
+ if (mesa_format == MESA_FORMAT_S8_Z24) {
+ return 1;
+ } else {
+ return r300IsFormatRenderable(mesa_format);
+ }
+}
+
void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions)
{
/* Note: we only plug in the functions we implement in the driver
diff --git a/src/mesa/drivers/dri/r300/r300_tex.h b/src/mesa/drivers/dri/r300/r300_tex.h
index 9694e703b83..aca44cd7669 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.h
+++ b/src/mesa/drivers/dri/r300/r300_tex.h
@@ -53,4 +53,7 @@ extern void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_tab
int32_t r300TranslateTexFormat(gl_format mesaFormat);
+unsigned r300IsFormatRenderable(gl_format mesaFormat);
+unsigned r500IsFormatRenderable(gl_format mesaFormat);
+
#endif /* __r300_TEX_H__ */
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 3a8d5fb7454..129004fee78 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -79,6 +79,7 @@ static int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_progra
break;
}
+ assert(src);
dst[4*i] = src[0];
dst[4*i + 1] = src[1];
dst[4*i + 2] = src[2];
@@ -233,9 +234,9 @@ static struct r300_vertex_program *build_program(GLcontext *ctx,
struct r300_vertex_program *vp;
struct r300_vertex_program_compiler compiler;
- vp = _mesa_calloc(sizeof(*vp));
+ vp = calloc(1, sizeof(*vp));
vp->Base = _mesa_clone_vertex_program(ctx, mesa_vp);
- _mesa_memcpy(&vp->key, wanted_key, sizeof(vp->key));
+ memcpy(&vp->key, wanted_key, sizeof(vp->key));
rc_init(&compiler.Base);
compiler.Base.Debug = (RADEON_DEBUG & RADEON_VERTS) ? GL_TRUE : GL_FALSE;
@@ -311,13 +312,13 @@ struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx)
r300SelectAndTranslateFragmentShader(ctx);
}
+ assert(r300->selected_fp);
wanted_key.FpReads = r300->selected_fp->InputsRead;
wanted_key.FogAttr = r300->selected_fp->fog_attr;
wanted_key.WPosAttr = r300->selected_fp->wpos_attr;
for (vp = vpc->progs; vp; vp = vp->next) {
- if (_mesa_memcmp(&vp->key, &wanted_key, sizeof(wanted_key))
- == 0) {
+ if (memcmp(&vp->key, &wanted_key, sizeof(wanted_key)) == 0) {
return r300->selected_vp = vp;
}
}
@@ -341,8 +342,6 @@ static void r300EmitVertexProgram(r300ContextPtr r300, int dest, struct r300_ver
assert((code->length > 0) && (code->length % 4 == 0));
- R300_STATECHANGE( r300, vap_flush );
-
switch ((dest >> 8) & 0xf) {
case 0:
R300_STATECHANGE(r300, vpi);
@@ -380,7 +379,7 @@ void r300SetupVertexProgram(r300ContextPtr rmesa)
((drm_r300_cmd_header_t *) rmesa->hw.vpi.cmd)->vpu.count = 0;
((drm_r300_cmd_header_t *) rmesa->hw.vps.cmd)->vpu.count = 0;
- R300_STATECHANGE(rmesa, vap_flush);
+ R300_STATECHANGE(rmesa, vap_cntl);
R300_STATECHANGE(rmesa, vpp);
param_count = r300VertexProgUpdateParams(ctx, prog, (float *)&rmesa->hw.vpp.cmd[R300_VPP_PARAM_0]);
bump_vpu_count(rmesa->hw.vpp.cmd, param_count);
diff --git a/src/mesa/drivers/dri/r300/radeon_pixel_read.c b/src/mesa/drivers/dri/r300/radeon_pixel_read.c
new file mode 120000
index 00000000000..3b03803126f
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_pixel_read.c
@@ -0,0 +1 @@
+../radeon/radeon_pixel_read.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/radeon_tex_getimage.c b/src/mesa/drivers/dri/r300/radeon_tex_getimage.c
new file mode 120000
index 00000000000..d9836d7326e
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_tex_getimage.c
@@ -0,0 +1 @@
+../radeon/radeon_tex_getimage.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/radeon_tile.c b/src/mesa/drivers/dri/r300/radeon_tile.c
new file mode 120000
index 00000000000..d4bfe27da64
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_tile.c
@@ -0,0 +1 @@
+../radeon/radeon_tile.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/radeon_tile.h b/src/mesa/drivers/dri/r300/radeon_tile.h
new file mode 120000
index 00000000000..31074c581ea
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_tile.h
@@ -0,0 +1 @@
+../radeon/radeon_tile.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/server/radeon_dri.c b/src/mesa/drivers/dri/r300/server/radeon_dri.c
deleted file mode 120000
index d05847d650f..00000000000
--- a/src/mesa/drivers/dri/r300/server/radeon_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../radeon/server/radeon_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile
index 5d509415393..17915621ee4 100644
--- a/src/mesa/drivers/dri/r600/Makefile
+++ b/src/mesa/drivers/dri/r600/Makefile
@@ -7,8 +7,6 @@ CFLAGS += $(RADEON_CFLAGS)
LIBNAME = r600_dri.so
-MINIGLX_SOURCES = server/radeon_dri.c
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
@@ -33,10 +31,13 @@ RADEON_COMMON_SOURCES = \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
+ radeon_pixel_read.c \
+ radeon_queryobj.c \
radeon_span.c \
radeon_texture.c \
- radeon_queryobj.c \
- radeon_tex_copy.c
+ radeon_tex_copy.c \
+ radeon_tex_getimage.c \
+ radeon_tile.c
DRIVER_SOURCES = \
radeon_screen.c \
diff --git a/src/mesa/drivers/dri/r600/r600_blit.c b/src/mesa/drivers/dri/r600/r600_blit.c
index 4bb77a398f9..244fdc4ffbb 100644
--- a/src/mesa/drivers/dri/r600/r600_blit.c
+++ b/src/mesa/drivers/dri/r600/r600_blit.c
@@ -33,7 +33,7 @@
#include "r600_cmdbuf.h"
/* common formats supported as both textures and render targets */
-static unsigned is_blit_supported(gl_format mesa_format)
+unsigned r600_check_blit(gl_format mesa_format)
{
switch (mesa_format) {
case MESA_FORMAT_RGBA8888:
@@ -1532,24 +1532,22 @@ static GLboolean validate_buffers(context_t *rmesa,
struct radeon_bo *dst_bo)
{
int ret;
- radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs,
- src_bo, RADEON_GEM_DOMAIN_VRAM, 0);
- radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs,
- dst_bo, 0, RADEON_GEM_DOMAIN_VRAM);
+ radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs);
- radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs,
- rmesa->blit_bo, RADEON_GEM_DOMAIN_GTT, 0);
+ ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs,
+ src_bo, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
+ if (ret)
+ return GL_FALSE;
ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs,
- rmesa->blit_bo,
- RADEON_GEM_DOMAIN_GTT, 0);
+ dst_bo, 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT);
if (ret)
return GL_FALSE;
ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs,
- first_elem(&rmesa->radeon.dma.reserved)->bo,
- RADEON_GEM_DOMAIN_GTT, 0);
+ rmesa->blit_bo,
+ RADEON_GEM_DOMAIN_GTT, 0);
if (ret)
return GL_FALSE;
@@ -1580,7 +1578,7 @@ unsigned r600_blit(GLcontext *ctx,
context_t *context = R700_CONTEXT(ctx);
int id = 0;
- if (!is_blit_supported(dst_mesaformat))
+ if (!r600_check_blit(dst_mesaformat))
return GL_FALSE;
if (src_bo == dst_bo) {
diff --git a/src/mesa/drivers/dri/r600/r600_blit.h b/src/mesa/drivers/dri/r600/r600_blit.h
index f280e23489e..d56b21ba9b5 100644
--- a/src/mesa/drivers/dri/r600/r600_blit.h
+++ b/src/mesa/drivers/dri/r600/r600_blit.h
@@ -1,3 +1,35 @@
+/*
+ * Copyright (C) 2009 Advanced Micro Devices, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef R600_BLIT_H
+#define R600_BLIT_H
+
+unsigned r600_check_blit(gl_format mesa_format);
+
unsigned r600_blit(GLcontext *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
@@ -19,3 +51,4 @@ unsigned r600_blit(GLcontext *ctx,
unsigned h,
unsigned flip_y);
+#endif // R600_BLIT_H
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index f575e74c3ed..76d5027649e 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -140,6 +140,7 @@ static const struct dri_extension card_extensions[] = {
{"GL_NV_blend_square", NULL},
{"GL_NV_vertex_program", GL_NV_vertex_program_functions},
{"GL_SGIS_generate_mipmap", NULL},
+ {"GL_ARB_pixel_buffer_object", NULL},
{NULL, NULL}
/* *INDENT-ON* */
};
@@ -236,7 +237,9 @@ static void r600_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.pre_emit_atoms = r600_vtbl_pre_emit_atoms;
radeon->vtbl.fallback = r600_fallback;
radeon->vtbl.emit_query_finish = r600_emit_query_finish;
+ radeon->vtbl.check_blit = r600_check_blit;
radeon->vtbl.blit = r600_blit;
+ radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
}
static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
@@ -340,9 +343,12 @@ static void r600InitGLExtensions(GLcontext *ctx)
_mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
}
- /* XXX: RV740 only seems to report results from half of its DBs */
- if (r600->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV740)
- _mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
+ /* RV740 had a broken pipe config prior to drm 1.32 */
+ if (!r600->radeon.radeonScreen->kernel_mm) {
+ if ((r600->radeon.dri.drmMinor < 32) &&
+ (r600->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV740))
+ _mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
+ }
}
/* Create the device specific rendering context.
diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c
index dd33ef3c6a2..1600033b9bd 100644
--- a/src/mesa/drivers/dri/r600/r600_texstate.c
+++ b/src/mesa/drivers/dri/r600/r600_texstate.c
@@ -373,17 +373,11 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
break;
*/
case MESA_FORMAT_RGB_DXT1: /* not supported yet */
-
- break;
case MESA_FORMAT_RGBA_DXT1: /* not supported yet */
-
- break;
case MESA_FORMAT_RGBA_DXT3: /* not supported yet */
-
- break;
case MESA_FORMAT_RGBA_DXT5: /* not supported yet */
+ return GL_FALSE;
- break;
case MESA_FORMAT_RGBA_FLOAT32:
SETfield(t->SQ_TEX_RESOURCE1, FMT_32_32_32_32_FLOAT,
SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
@@ -701,8 +695,8 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj)
t = radeon_tex_obj(tObj);
- r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat);
-
+ if(!r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat))
+ t->validated = GL_FALSE;
}
/**
@@ -711,7 +705,7 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj)
* \param rmesa Context pointer
* \param t the r300 texture object
*/
-static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
+static GLboolean setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
{
context_t *rmesa = R700_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
@@ -721,15 +715,15 @@ static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texO
if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled &&
t->image_override &&
t->bo)
- return;
+ return GL_TRUE;
firstImage = t->base.Image[0][t->minLod];
if (!t->image_override) {
if (!r600GetTexFormat(texObj, firstImage->TexFormat)) {
- radeon_error("unexpected texture format in %s\n",
- __FUNCTION__);
- return;
+ radeon_warning("unsupported texture format in %s\n",
+ __FUNCTION__);
+ return GL_FALSE;
}
}
@@ -754,7 +748,7 @@ static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texO
break;
default:
radeon_error("unexpected texture target type in %s\n", __FUNCTION__);
- return;
+ return GL_FALSE;
}
row_align = rmesa->radeon.texture_row_align - 1;
@@ -799,6 +793,7 @@ static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texO
CLEARfield(t->SQ_TEX_SAMPLER0, DEPTH_COMPARE_FUNCTION_mask);
}
+ return GL_TRUE;
}
/**
@@ -815,7 +810,8 @@ static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object
/* Configure the hardware registers (more precisely, the cached version
* of the hardware registers). */
- setup_hardware_state(ctx, texObj, unit);
+ if (!setup_hardware_state(ctx, texObj, unit))
+ return GL_FALSE;
t->validated = GL_TRUE;
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index d0059fad2ea..834bcc63e31 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -1250,6 +1250,7 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm,
if(pAsm->aArgSubst[1+src] >= 0)
{
+ assert(fld >= 0);
setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE);
pAsm->S[fld].src.rtype = SRC_REG_TEMPORARY;
pAsm->S[fld].src.reg = pAsm->aArgSubst[1+src];
@@ -1745,18 +1746,21 @@ GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr,
switch (source_index)
{
case 0:
+ assert(alu_instruction_ptr);
alu_instruction_ptr->m_Word0.f.src0_sel = src_sel;
alu_instruction_ptr->m_Word0.f.src0_rel = src_rel;
alu_instruction_ptr->m_Word0.f.src0_chan = src_chan;
alu_instruction_ptr->m_Word0.f.src0_neg = src_neg;
break;
case 1:
+ assert(alu_instruction_ptr);
alu_instruction_ptr->m_Word0.f.src1_sel = src_sel;
alu_instruction_ptr->m_Word0.f.src1_rel = src_rel;
alu_instruction_ptr->m_Word0.f.src1_chan = src_chan;
alu_instruction_ptr->m_Word0.f.src1_neg = src_neg;
break;
case 2:
+ assert(alu_instruction_ptr);
alu_instruction_ptr->m_Word1_OP3.f.src2_sel = src_sel;
alu_instruction_ptr->m_Word1_OP3.f.src2_rel = src_rel;
alu_instruction_ptr->m_Word1_OP3.f.src2_chan = src_chan;
diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c
index a742dbcf129..63614b160cc 100644
--- a/src/mesa/drivers/dri/r600/r700_chip.c
+++ b/src/mesa/drivers/dri/r600/r700_chip.c
@@ -1349,7 +1349,7 @@ void r600InitAtoms(context_t *context)
ALLOC_STATE(poly, always, 10, r700SendPolyState);
ALLOC_STATE(cb, cb, 18, r700SendCBState);
ALLOC_STATE(clrcmp, always, 6, r700SendCBCLRCMPState);
- ALLOC_STATE(cb_target, always, 25, r700SendRenderTargetState);
+ ALLOC_STATE(cb_target, always, 29, r700SendRenderTargetState);
ALLOC_STATE(blnd, blnd, (6 + (R700_MAX_RENDER_TARGETS * 3)), r700SendCBBlendState);
ALLOC_STATE(blnd_clr, always, 6, r700SendCBBlendColorState);
ALLOC_STATE(sx, always, 9, r700SendSXState);
diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c
index 2a50361199b..b7124e644a3 100644
--- a/src/mesa/drivers/dri/r600/r700_oglprog.c
+++ b/src/mesa/drivers/dri/r600/r700_oglprog.c
@@ -53,7 +53,7 @@ static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *c
Clean_Up_Shader(&(vp->r700Shader));
_mesa_reference_vertprog(ctx, &vp->mesa_program, NULL);
- _mesa_free(vp);
+ free(vp);
vp = tmp;
}
}
diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c
index 8f14af7472c..1929b7cc129 100644
--- a/src/mesa/drivers/dri/r600/r700_render.c
+++ b/src/mesa/drivers/dri/r600/r700_render.c
@@ -419,7 +419,7 @@ static void r700RunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end,
}
/* start 3d, idle, cb/db flush */
-#define PRE_EMIT_STATE_BUFSZ 5 + 5 + 18
+#define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14
static GLuint r700PredictRenderSize(GLcontext* ctx,
const struct _mesa_prim *prim,
@@ -594,7 +594,7 @@ static void r700AlignDataToDword(GLcontext *ctx,
for (i = 0; i < count; ++i)
{
- _mesa_memcpy(dst_ptr, src_ptr, input->StrideB);
+ memcpy(dst_ptr, src_ptr, input->StrideB);
src_ptr += input->StrideB;
dst_ptr += dst_stride;
}
@@ -829,11 +829,10 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
#if MESA_BIG_ENDIAN
if (mesa_ind_buf->type == GL_UNSIGNED_INT)
- {
#else
if (mesa_ind_buf->type != GL_UNSIGNED_BYTE)
- {
#endif
+ {
const GLvoid *src_ptr;
GLvoid *dst_ptr;
GLboolean mapped_named_bo = GL_FALSE;
@@ -855,7 +854,7 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
assert(context->ind_buf.bo->ptr != NULL);
dst_ptr = ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset);
- _mesa_memcpy(dst_ptr, src_ptr, size);
+ memcpy(dst_ptr, src_ptr, size);
radeon_bo_unmap(context->ind_buf.bo);
context->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT);
@@ -872,6 +871,14 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer
}
}
+static GLboolean check_fallbacks(GLcontext *ctx)
+{
+ if (ctx->RenderMode != GL_RENDER)
+ return GL_TRUE;
+
+ return GL_FALSE;
+}
+
static GLboolean r700TryDrawPrims(GLcontext *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
@@ -888,6 +895,9 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx,
if (ctx->NewState)
_mesa_update_state( ctx );
+ if (check_fallbacks(ctx))
+ return GL_FALSE;
+
_tnl_UpdateFixedFunctionProgram(ctx);
r700SetVertexFormat(ctx, arrays, max_index + 1);
/* shaders need to be updated before buffers are validated */
@@ -983,8 +993,10 @@ static void r700DrawPrims(GLcontext *ctx,
retval = r700TryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
/* If failed run tnl pipeline - it should take care of fallbacks */
- if (!retval)
+ if (!retval) {
+ _swsetup_Wakeup(ctx);
_tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
+ }
}
void r700InitDraw(GLcontext *ctx)
diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c
index 0240eefd5c2..6f156b54096 100644
--- a/src/mesa/drivers/dri/r600/r700_state.c
+++ b/src/mesa/drivers/dri/r600/r700_state.c
@@ -65,7 +65,7 @@ void r700UpdateShaders(GLcontext * ctx)
/* should only happenen once, just after context is created */
/* TODO: shouldn't we fallback to sw here? */
if (!ctx->FragmentProgram._Current) {
- _mesa_fprintf(stderr, "No ctx->FragmentProgram._Current!!\n");
+ fprintf(stderr, "No ctx->FragmentProgram._Current!!\n");
return;
}
@@ -911,10 +911,12 @@ static void r700PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * pa
case GL_POINT_SIZE_MIN:
SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MinSize * 8.0),
MIN_SIZE_shift, MIN_SIZE_mask);
+ r700PointSize(ctx, ctx->Point.Size);
break;
case GL_POINT_SIZE_MAX:
SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MaxSize * 8.0),
MAX_SIZE_shift, MAX_SIZE_mask);
+ r700PointSize(ctx, ctx->Point.Size);
break;
case GL_POINT_DISTANCE_ATTENUATION:
break;
@@ -1626,8 +1628,6 @@ void r700InitState(GLcontext * ctx) //-------------------
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
int id = 0;
- radeon_firevertices(&context->radeon);
-
r700->TA_CNTL_AUX.u32All = 0;
SETfield(r700->TA_CNTL_AUX.u32All, 28, TD_FIFO_CREDIT_shift, TD_FIFO_CREDIT_mask);
r700->VC_ENHANCE.u32All = 0;
diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c
index 46481cdff4e..07e0adc8905 100644
--- a/src/mesa/drivers/dri/r600/r700_vertprog.c
+++ b/src/mesa/drivers/dri/r600/r700_vertprog.c
@@ -307,7 +307,7 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx,
struct r700_vertex_program *vp;
unsigned int i;
- vp = _mesa_calloc(sizeof(*vp));
+ vp = calloc(1, sizeof(*vp));
vp->mesa_program = _mesa_clone_vertex_program(ctx, mesa_vp);
if (mesa_vp->IsPositionInvariant)
diff --git a/src/mesa/drivers/dri/r600/radeon_pixel_read.c b/src/mesa/drivers/dri/r600/radeon_pixel_read.c
new file mode 120000
index 00000000000..3b03803126f
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_pixel_read.c
@@ -0,0 +1 @@
+../radeon/radeon_pixel_read.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/radeon_tex_getimage.c b/src/mesa/drivers/dri/r600/radeon_tex_getimage.c
new file mode 120000
index 00000000000..d9836d7326e
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_tex_getimage.c
@@ -0,0 +1 @@
+../radeon/radeon_tex_getimage.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/radeon_tile.c b/src/mesa/drivers/dri/r600/radeon_tile.c
new file mode 120000
index 00000000000..d4bfe27da64
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_tile.c
@@ -0,0 +1 @@
+../radeon/radeon_tile.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/radeon_tile.h b/src/mesa/drivers/dri/r600/radeon_tile.h
new file mode 120000
index 00000000000..31074c581ea
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_tile.h
@@ -0,0 +1 @@
+../radeon/radeon_tile.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/server/radeon_dri.c b/src/mesa/drivers/dri/r600/server/radeon_dri.c
deleted file mode 120000
index d05847d650f..00000000000
--- a/src/mesa/drivers/dri/r600/server/radeon_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../radeon/server/radeon_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile
index a54ea16ec63..19df62742ec 100644
--- a/src/mesa/drivers/dri/radeon/Makefile
+++ b/src/mesa/drivers/dri/radeon/Makefile
@@ -8,8 +8,6 @@ CFLAGS += $(RADEON_CFLAGS)
LIBNAME = radeon_dri.so
-MINIGLX_SOURCES = server/radeon_dri.c
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
@@ -24,10 +22,13 @@ RADEON_COMMON_SOURCES = \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
+ radeon_pixel_read.c \
radeon_queryobj.c \
radeon_span.c \
radeon_texture.c \
- radeon_tex_copy.c
+ radeon_tex_copy.c \
+ radeon_tex_getimage.c \
+ radeon_tile.c
DRIVER_SOURCES = \
radeon_context.c \
diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.c b/src/mesa/drivers/dri/radeon/radeon_blit.c
index 0df4fbb33c5..e1e1f215508 100644
--- a/src/mesa/drivers/dri/radeon/radeon_blit.c
+++ b/src/mesa/drivers/dri/radeon/radeon_blit.c
@@ -38,7 +38,7 @@ static inline uint32_t cmdpacket0(struct radeon_screen *rscrn,
}
/* common formats supported as both textures and render targets */
-static unsigned is_blit_supported(gl_format mesa_format)
+unsigned r100_check_blit(gl_format mesa_format)
{
/* XXX others? BE/LE? */
switch (mesa_format) {
@@ -204,15 +204,16 @@ static GLboolean validate_buffers(struct r100_context *r100,
struct radeon_bo *dst_bo)
{
int ret;
- radeon_cs_space_add_persistent_bo(r100->radeon.cmdbuf.cs,
- src_bo, RADEON_GEM_DOMAIN_VRAM, 0);
- radeon_cs_space_add_persistent_bo(r100->radeon.cmdbuf.cs,
- dst_bo, 0, RADEON_GEM_DOMAIN_VRAM);
+ radeon_cs_space_reset_bos(r100->radeon.cmdbuf.cs);
ret = radeon_cs_space_check_with_bo(r100->radeon.cmdbuf.cs,
- first_elem(&r100->radeon.dma.reserved)->bo,
- RADEON_GEM_DOMAIN_GTT, 0);
+ src_bo, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
+ if (ret)
+ return GL_FALSE;
+
+ ret = radeon_cs_space_check_with_bo(r100->radeon.cmdbuf.cs,
+ dst_bo, 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT);
if (ret)
return GL_FALSE;
@@ -329,7 +330,7 @@ unsigned r100_blit(GLcontext *ctx,
{
struct r100_context *r100 = R100_CONTEXT(ctx);
- if (!is_blit_supported(dst_mesaformat))
+ if (!r100_check_blit(dst_mesaformat))
return GL_FALSE;
/* Make sure that colorbuffer has even width - hw limitation */
diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.h b/src/mesa/drivers/dri/radeon/radeon_blit.h
index d36366ff791..d7d0b5554a6 100644
--- a/src/mesa/drivers/dri/radeon/radeon_blit.h
+++ b/src/mesa/drivers/dri/radeon/radeon_blit.h
@@ -30,6 +30,8 @@
void r100_blit_init(struct r100_context *r100);
+unsigned r100_check_blit(gl_format mesa_format);
+
unsigned r100_blit(GLcontext *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
index 99d3ec7005e..0897dafbd8b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
+++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
@@ -70,7 +70,7 @@ radeonDeleteBufferObject(GLcontext * ctx,
radeon_bo_unref(radeon_obj->bo);
}
- _mesa_free(radeon_obj);
+ free(radeon_obj);
}
@@ -114,7 +114,7 @@ radeonBufferData(GLcontext * ctx,
if (data != NULL) {
radeon_bo_map(radeon_obj->bo, GL_TRUE);
- _mesa_memcpy(radeon_obj->bo->ptr, data, size);
+ memcpy(radeon_obj->bo->ptr, data, size);
radeon_bo_unmap(radeon_obj->bo);
}
@@ -145,7 +145,7 @@ radeonBufferSubData(GLcontext * ctx,
radeon_bo_map(radeon_obj->bo, GL_TRUE);
- _mesa_memcpy(radeon_obj->bo->ptr + offset, data, size);
+ memcpy(radeon_obj->bo->ptr + offset, data, size);
radeon_bo_unmap(radeon_obj->bo);
}
@@ -165,7 +165,7 @@ radeonGetBufferSubData(GLcontext * ctx,
radeon_bo_map(radeon_obj->bo, GL_FALSE);
- _mesa_memcpy(data, radeon_obj->bo->ptr + offset, size);
+ memcpy(data, radeon_obj->bo->ptr + offset, size);
radeon_bo_unmap(radeon_obj->bo);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_chipset.h b/src/mesa/drivers/dri/radeon/radeon_chipset.h
index 46a9cd5ff84..f17a305bce8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_chipset.h
+++ b/src/mesa/drivers/dri/radeon/radeon_chipset.h
@@ -340,6 +340,7 @@
#define PCI_CHIP_RS880_9712 0x9712
#define PCI_CHIP_RS880_9713 0x9713
#define PCI_CHIP_RS880_9714 0x9714
+#define PCI_CHIP_RS880_9715 0x9715
#define PCI_CHIP_RV770_9440 0x9440
#define PCI_CHIP_RV770_9441 0x9441
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index 79f3ff7da65..13f1f0611b8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -1325,11 +1325,6 @@ void rcommonBeginBatch(radeonContextPtr rmesa, int n,
const char *function,
int line)
{
- if (!rmesa->cmdbuf.cs->cdw && dostate) {
- radeon_print(RADEON_STATE, RADEON_NORMAL,
- "Reemit state after flush (from %s)\n", function);
- radeonEmitState(rmesa);
- }
radeon_cs_begin(rmesa->cmdbuf.cs, n, file, function, line);
radeon_print(RADEON_CS, RADEON_VERBOSE, "BEGIN_BATCH(%d) at %d, from %s:%i\n",
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h
index cd01c9984e3..35b3f08fff9 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common.h
@@ -44,6 +44,12 @@ radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
struct radeon_renderbuffer *
radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv);
+void
+radeonReadPixels(GLcontext * ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *pack, GLvoid * pixels);
+
void radeon_check_front_buffer_rendering(GLcontext *ctx);
static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
{
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index e397ee8c226..5156c5d0d0a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -518,6 +518,7 @@ struct radeon_context {
void (*free_context)(GLcontext *ctx);
void (*emit_query_finish)(radeonContextPtr radeon);
void (*update_scissor)(GLcontext *ctx);
+ unsigned (*check_blit)(gl_format mesa_format);
unsigned (*blit)(GLcontext *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
@@ -538,6 +539,7 @@ struct radeon_context {
unsigned reg_width,
unsigned reg_height,
unsigned flip_y);
+ unsigned (*is_format_renderable)(gl_format mesa_format);
} vtbl;
};
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 4625af14ad8..56aba16e9e0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -198,7 +198,9 @@ static void r100_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.fallback = radeonFallback;
radeon->vtbl.free_context = r100_vtbl_free_context;
radeon->vtbl.emit_query_finish = r100_emit_query_finish;
+ radeon->vtbl.check_blit = r100_check_blit;
radeon->vtbl.blit = r100_blit;
+ radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
}
/* Create the device specific context.
diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c
index d31e4e47ddb..22499bc38d1 100644
--- a/src/mesa/drivers/dri/radeon/radeon_dma.c
+++ b/src/mesa/drivers/dri/radeon/radeon_dma.c
@@ -184,6 +184,8 @@ void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size)
radeon_print(RADEON_DMA, RADEON_NORMAL, "%s size %d minimum_size %d\n",
__FUNCTION__, size, rmesa->dma.minimum_size);
+ if (!is_empty_list(&rmesa->dma.reserved))
+ radeon_bo_unmap(first_elem(&rmesa->dma.reserved)->bo);
if (is_empty_list(&rmesa->dma.free)
|| last_elem(&rmesa->dma.free)->bo->size < size) {
@@ -211,7 +213,7 @@ again_alloc:
rmesa->dma.current_used = 0;
rmesa->dma.current_vertexptr = 0;
-
+
if (radeon_cs_space_check_with_bo(rmesa->cmdbuf.cs,
first_elem(&rmesa->dma.reserved)->bo,
RADEON_GEM_DOMAIN_GTT, 0))
@@ -221,6 +223,7 @@ again_alloc:
/* Cmd buff have been flushed in radeon_revalidate_bos */
goto again_alloc;
}
+ radeon_bo_map(first_elem(&rmesa->dma.reserved)->bo, 1);
}
/* Allocates a region from rmesa->dma.current. If there isn't enough
@@ -332,6 +335,10 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa)
/* request updated cs processing information from kernel */
legacy_track_pending(rmesa->radeonScreen->bom, 0);
}
+
+ if (!is_empty_list(&rmesa->dma.reserved))
+ radeon_bo_unmap(first_elem(&rmesa->dma.reserved)->bo);
+
/* move waiting bos to free list.
wait list provides gpu time to handle data before reuse */
foreach_s(dma_bo, temp, &rmesa->dma.wait) {
@@ -349,8 +356,11 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa)
FREE(dma_bo);
continue;
}
- if (!radeon_bo_is_idle(dma_bo->bo))
+ if (!radeon_bo_is_idle(dma_bo->bo)) {
+ if (rmesa->radeonScreen->driScreen->dri2.enabled)
+ break;
continue;
+ }
remove_from_list(dma_bo);
dma_bo->expire_counter = expire_at;
insert_at_tail(&rmesa->dma.free, dma_bo);
@@ -388,7 +398,7 @@ void rcommon_flush_last_swtcl_prim( GLcontext *ctx )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
struct radeon_dma *dma = &rmesa->dma;
-
+
if (RADEON_DEBUG & RADEON_IOCTL)
fprintf(stderr, "%s\n", __FUNCTION__);
dma->flush = NULL;
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index 56dcc50785c..63986058356 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -43,7 +43,7 @@
#define FILE_DEBUG_FLAG RADEON_TEXTURE
#define DBG(...) do { \
if (RADEON_DEBUG & FILE_DEBUG_FLAG) \
- _mesa_printf(__VA_ARGS__); \
+ printf(__VA_ARGS__); \
} while(0)
static struct gl_framebuffer *
@@ -66,7 +66,7 @@ radeon_delete_renderbuffer(struct gl_renderbuffer *rb)
if (rrb && rrb->bo) {
radeon_bo_unref(rrb->bo);
}
- _mesa_free(rrb);
+ free(rrb);
}
static void *
@@ -409,82 +409,51 @@ radeon_framebuffer_renderbuffer(GLcontext * ctx,
radeon_draw_buffer(ctx, fb);
}
-
-/* TODO: According to EXT_fbo spec internal format of texture image
- * once set during glTexImage call, should be preserved when
- * attaching image to renderbuffer. When HW doesn't support
- * rendering to format of attached image, set framebuffer
- * completeness accordingly in radeon_validate_framebuffer (issue #79).
- */
static GLboolean
radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb,
struct gl_texture_image *texImage)
{
- int retry = 0;
- gl_format texFormat;
-
radeon_print(RADEON_TEXTURE, RADEON_TRACE,
- "%s(%p, rrb %p, texImage %p) \n",
- __func__, ctx, rrb, texImage);
-
-restart:
- if (texImage->TexFormat == _dri_texformat_argb8888) {
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- DBG("Render to RGBA8 texture OK\n");
+ "%s(%p, rrb %p, texImage %p, texFormat %s) \n",
+ __func__, ctx, rrb, texImage, _mesa_get_format_name(texImage->TexFormat));
+
+ switch (texImage->TexFormat) {
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_ARGB8888_REV:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_XRGB8888_REV:
+ case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_RGB565_REV:
+ case MESA_FORMAT_RGBA5551:
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_ARGB1555_REV:
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB4444_REV:
+ rrb->base.DataType = GL_UNSIGNED_BYTE;
+ break;
+ case MESA_FORMAT_Z16:
+ rrb->base.DataType = GL_UNSIGNED_SHORT;
+ break;
+ case MESA_FORMAT_X8_Z24:
+ rrb->base.DataType = GL_UNSIGNED_INT;
+ break;
+ case MESA_FORMAT_S8_Z24:
+ rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT;
+ break;
}
- else if (texImage->TexFormat == _dri_texformat_rgb565) {
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- DBG("Render to RGB5 texture OK\n");
- }
- else if (texImage->TexFormat == _dri_texformat_argb1555) {
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- DBG("Render to ARGB1555 texture OK\n");
- }
- else if (texImage->TexFormat == _dri_texformat_argb4444) {
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- DBG("Render to ARGB4444 texture OK\n");
- }
- else if (texImage->TexFormat == MESA_FORMAT_Z16) {
- rrb->base.DataType = GL_UNSIGNED_SHORT;
- DBG("Render to DEPTH16 texture OK\n");
- }
- else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) {
- rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- DBG("Render to DEPTH_STENCIL texture OK\n");
- }
- else {
- /* try redoing the FBO */
- if (retry == 1) {
- DBG("Render to texture BAD FORMAT %d\n",
- texImage->TexFormat);
- return GL_FALSE;
- }
- /* XXX why is the tex format being set here?
- * I think this can be removed.
- */
- texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0,
- _mesa_get_format_datatype(texImage->TexFormat),
- 1);
-
- retry++;
- goto restart;
- }
-
- texFormat = texImage->TexFormat;
-
- rrb->base.Format = texFormat;
-
- rrb->cpp = _mesa_get_format_bytes(texFormat);
+
+ rrb->cpp = _mesa_get_format_bytes(texImage->TexFormat);
rrb->pitch = texImage->Width * rrb->cpp;
+ rrb->base.Format = texImage->TexFormat;
rrb->base.InternalFormat = texImage->InternalFormat;
- rrb->base._BaseFormat = _mesa_base_fbo_format(ctx, rrb->base.InternalFormat);
-
+ rrb->base._BaseFormat = _mesa_base_fbo_format(ctx, rrb->base.InternalFormat);
rrb->base.Width = texImage->Width;
rrb->base.Height = texImage->Height;
-
rrb->base.Delete = radeon_delete_renderbuffer;
rrb->base.AllocStorage = radeon_nop_alloc_storage;
-
+
return GL_TRUE;
}
@@ -511,7 +480,7 @@ radeon_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
rrb->base.ClassID = RADEON_RB_CLASS;
if (!radeon_update_wrapper(ctx, rrb, texImage)) {
- _mesa_free(rrb);
+ free(rrb);
return NULL;
}
@@ -564,7 +533,7 @@ radeon_render_texture(GLcontext * ctx,
return;
}
- DBG("Begin render texture tid %x tex=%u w=%d h=%d refcount=%d\n",
+ DBG("Begin render texture tid %lx tex=%u w=%d h=%d refcount=%d\n",
_glthread_GetID(),
att->Texture->Name, newImage->Width, newImage->Height,
rrb->base.RefCount);
@@ -607,6 +576,35 @@ radeon_finish_render_texture(GLcontext * ctx,
static void
radeon_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ gl_format mesa_format;
+ int i;
+
+ for (i = -2; i < (GLint) ctx->Const.MaxColorAttachments; i++) {
+ struct gl_renderbuffer_attachment *att;
+ if (i == -2) {
+ att = &fb->Attachment[BUFFER_DEPTH];
+ } else if (i == -1) {
+ att = &fb->Attachment[BUFFER_STENCIL];
+ } else {
+ att = &fb->Attachment[BUFFER_COLOR0 + i];
+ }
+
+ if (att->Type == GL_TEXTURE) {
+ mesa_format = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->TexFormat;
+ } else {
+ /* All renderbuffer formats are renderable, but not sampable */
+ continue;
+ }
+
+ if (!radeon->vtbl.is_format_renderable(mesa_format)){
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s: HW doesn't support format %s as output format of attachment %d\n",
+ __FUNCTION__, _mesa_get_format_name(mesa_format), i);
+ return;
+ }
+ }
}
void radeon_fbo_init(struct radeon_context *radeon)
diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
index c7ea4521568..5ac526c6deb 100644
--- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
@@ -442,6 +442,8 @@ static void radeonKernelClear(GLcontext *ctx, GLuint flags)
GLint ret, i;
GLint cx, cy, cw, ch;
+ radeonEmitState(&rmesa->radeon);
+
LOCK_HARDWARE( &rmesa->radeon );
/* compute region after locking: */
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index cd843d965e5..78c5f5dd572 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -36,6 +36,7 @@
#include "main/texobj.h"
#include "main/enums.h"
#include "radeon_texture.h"
+#include "radeon_tile.h"
static unsigned get_aligned_compressed_row_stride(
gl_format format,
@@ -69,16 +70,51 @@ static unsigned get_aligned_compressed_row_stride(
return stride;
}
-static unsigned get_compressed_image_size(
+unsigned get_texture_image_size(
gl_format format,
unsigned rowStride,
- unsigned height)
+ unsigned height,
+ unsigned depth,
+ unsigned tiling)
{
- unsigned blockWidth, blockHeight;
+ if (_mesa_is_format_compressed(format)) {
+ unsigned blockWidth, blockHeight;
- _mesa_get_format_block_size(format, &blockWidth, &blockHeight);
+ _mesa_get_format_block_size(format, &blockWidth, &blockHeight);
+
+ return rowStride * ((height + blockHeight - 1) / blockHeight) * depth;
+ } else if (tiling) {
+ /* Need to align height to tile height */
+ unsigned tileWidth, tileHeight;
- return rowStride * ((height + blockHeight - 1) / blockHeight);
+ get_tile_size(format, &tileWidth, &tileHeight);
+ tileHeight--;
+
+ height = (height + tileHeight) & ~tileHeight;
+ }
+
+ return rowStride * height * depth;
+}
+
+unsigned get_texture_image_row_stride(radeonContextPtr rmesa, gl_format format, unsigned width, unsigned tiling)
+{
+ if (_mesa_is_format_compressed(format)) {
+ return get_aligned_compressed_row_stride(format, width, rmesa->texture_compressed_row_align);
+ } else {
+ unsigned row_align;
+
+ if (!_mesa_is_pow_two(width)) {
+ row_align = rmesa->texture_rect_row_align - 1;
+ } else if (tiling) {
+ unsigned tileWidth, tileHeight;
+ get_tile_size(format, &tileWidth, &tileHeight);
+ row_align = tileWidth * _mesa_get_format_bytes(format) - 1;
+ } else {
+ row_align = rmesa->texture_row_align - 1;
+ }
+
+ return (_mesa_format_row_stride(format, width) + row_align) & ~row_align;
+ }
}
/**
@@ -92,34 +128,15 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree
GLuint face, GLuint level, GLuint* curOffset)
{
radeon_mipmap_level *lvl = &mt->levels[level];
- uint32_t row_align;
GLuint height;
height = _mesa_next_pow_two_32(lvl->height);
- /* Find image size in bytes */
- if (_mesa_is_format_compressed(mt->mesaFormat)) {
- lvl->rowstride = get_aligned_compressed_row_stride(mt->mesaFormat, lvl->width, rmesa->texture_compressed_row_align);
- lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, height);
- } else if (mt->target == GL_TEXTURE_RECTANGLE_NV) {
- row_align = rmesa->texture_rect_row_align - 1;
- lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
- lvl->size = lvl->rowstride * height;
- } else if (mt->tilebits & RADEON_TXO_MICRO_TILE) {
- /* tile pattern is 16 bytes x2. mipmaps stay 32 byte aligned,
- * though the actual offset may be different (if texture is less than
- * 32 bytes width) to the untiled case */
- lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) * 2 + 31) & ~31;
- lvl->size = lvl->rowstride * ((height + 1) / 2) * lvl->depth;
- } else {
- row_align = rmesa->texture_row_align - 1;
- lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
- lvl->size = lvl->rowstride * height * lvl->depth;
- }
+ lvl->rowstride = get_texture_image_row_stride(rmesa, mt->mesaFormat, lvl->width, mt->tilebits);
+ lvl->size = get_texture_image_size(mt->mesaFormat, lvl->rowstride, lvl->height, lvl->depth, mt->tilebits);
+
assert(lvl->size > 0);
- /* All images are aligned to a 32-byte offset */
- *curOffset = (*curOffset + 0x1f) & ~0x1f;
lvl->faces[face].offset = *curOffset;
*curOffset += lvl->size;
@@ -451,12 +468,9 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt,
radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel];
- /* TODO: bring back these assertions once the FBOs are fixed */
-#if 0
assert(image->mtlevel == level);
assert(srclvl->size == dstlvl->size);
assert(srclvl->rowstride == dstlvl->rowstride);
-#endif
radeon_bo_map(image->mt->bo, GL_FALSE);
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
index c911688c1a5..088f9701722 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
@@ -89,4 +89,13 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t);
GLuint radeon_miptree_image_offset(radeon_mipmap_tree *mt,
GLuint face, GLuint level);
uint32_t get_base_teximage_offset(radeonTexObj *texObj);
+
+unsigned get_texture_image_row_stride(radeonContextPtr rmesa, gl_format format, unsigned width, unsigned tiling);
+
+unsigned get_texture_image_size(
+ gl_format format,
+ unsigned rowStride,
+ unsigned height,
+ unsigned depth,
+ unsigned tiling);
#endif /* __RADEON_MIPMAP_TREE_H_ */
diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
new file mode 100644
index 00000000000..27841938e66
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2010 Maciej Cencora <m.cencora@gmail.com>
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "stdint.h"
+#include "main/bufferobj.h"
+#include "main/enums.h"
+#include "main/image.h"
+#include "main/state.h"
+#include "swrast/swrast.h"
+
+#include "radeon_common_context.h"
+#include "radeon_debug.h"
+#include "radeon_mipmap_tree.h"
+
+static gl_format gl_format_and_type_to_mesa_format(GLenum format, GLenum type)
+{
+ switch (format)
+ {
+ case GL_RGB:
+ switch (type) {
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return MESA_FORMAT_RGB565;
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ return MESA_FORMAT_RGB565_REV;
+ }
+ break;
+ case GL_RGBA:
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ return MESA_FORMAT_RGBA8888_REV;
+ case GL_FLOAT:
+ return MESA_FORMAT_RGBA_FLOAT32;
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ return MESA_FORMAT_ARGB4444;
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ return MESA_FORMAT_ARGB4444;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return MESA_FORMAT_RGBA5551;
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ return MESA_FORMAT_ARGB1555_REV;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ return MESA_FORMAT_ARGB8888;
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ return MESA_FORMAT_ARGB8888_REV;
+ }
+ break;
+ }
+
+ return MESA_FORMAT_NONE;
+}
+
+static GLboolean
+do_blit_readpixels(GLcontext * ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
+{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ const struct radeon_renderbuffer *rrb = radeon_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
+ const gl_format dst_format = gl_format_and_type_to_mesa_format(format, type);
+ unsigned dst_rowstride, dst_imagesize, aligned_rowstride, flip_y;
+ struct radeon_bo *dst_buffer;
+ GLint dst_x = 0, dst_y = 0;
+
+ /* It's not worth if number of pixels to copy is really small */
+ if (width * height < 100) {
+ return GL_FALSE;
+ }
+
+ if (dst_format == MESA_FORMAT_NONE ||
+ !radeon->vtbl.check_blit(dst_format) || !radeon->vtbl.blit) {
+ return GL_FALSE;
+ }
+
+ if (ctx->_ImageTransferState) {
+ return GL_FALSE;
+ }
+
+ if (pack->SwapBytes || pack->LsbFirst) {
+ return GL_FALSE;
+ }
+
+ if (pack->RowLength > 0) {
+ dst_rowstride = pack->RowLength;
+ } else {
+ dst_rowstride = width;
+ }
+
+ if (!_mesa_clip_copytexsubimage(ctx, &dst_x, &dst_y, &x, &y, &width, &height)) {
+ return GL_TRUE;
+ }
+ assert(x >= 0 && y >= 0);
+
+ aligned_rowstride = get_texture_image_row_stride(radeon, dst_format, dst_rowstride, 0);
+ dst_imagesize = get_texture_image_size(dst_format,
+ aligned_rowstride,
+ height, 1, 0);
+ dst_buffer = radeon_bo_open(radeon->radeonScreen->bom, 0, dst_imagesize, 1024, RADEON_GEM_DOMAIN_GTT, 0);
+
+ /* Disable source Y flipping for FBOs */
+ flip_y = (ctx->ReadBuffer->Name == 0);
+ if (pack->Invert) {
+ y = rrb->base.Height - height - y;
+ flip_y = !flip_y;
+ }
+
+ if (radeon->vtbl.blit(ctx,
+ rrb->bo,
+ rrb->draw_offset,
+ rrb->base.Format,
+ rrb->pitch / rrb->cpp,
+ rrb->base.Width,
+ rrb->base.Height,
+ x,
+ y,
+ dst_buffer,
+ 0, /* dst_offset */
+ dst_format,
+ aligned_rowstride / _mesa_get_format_bytes(dst_format),
+ width,
+ height,
+ 0, /* dst_x */
+ 0, /* dst_y */
+ width,
+ height,
+ flip_y))
+ {
+ radeon_bo_map(dst_buffer, 0);
+ dst_rowstride *= _mesa_get_format_bytes(dst_format);
+ copy_rows(pixels, dst_rowstride, dst_buffer->ptr,
+ aligned_rowstride, height, dst_rowstride);
+ radeon_bo_unmap(dst_buffer);
+ radeon_bo_unref(dst_buffer);
+ return GL_TRUE;
+ } else {
+ radeon_bo_unref(dst_buffer);
+ return GL_FALSE;
+ }
+}
+
+void
+radeonReadPixels(GLcontext * ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
+{
+ if (do_blit_readpixels(ctx, x, y, width, height, format, type, pack, pixels))
+ return;
+
+ /* Update Mesa state before calling down into _swrast_ReadPixels, as
+ * the spans code requires the computed buffer states to be up to date,
+ * but _swrast_ReadPixels only updates Mesa state after setting up
+ * the spans code.
+ */
+
+ radeon_print(RADEON_FALLBACKS, RADEON_NORMAL,
+ "Falling back to sw for ReadPixels (format %s, type %s)\n",
+ _mesa_lookup_enum_by_nr(format), _mesa_lookup_enum_by_nr(type));
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ _swrast_ReadPixels(ctx, x, y, width, height, format, type, pack, pixels);
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
index d0dcf0e431a..04ce12493e6 100644
--- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c
+++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
@@ -81,7 +81,7 @@ static struct gl_query_object * radeonNewQueryObject(GLcontext *ctx, GLuint id)
{
struct radeon_query_object *query;
- query = _mesa_calloc(sizeof(struct radeon_query_object));
+ query = calloc(1, sizeof(struct radeon_query_object));
query->Base.Id = id;
query->Base.Result = 0;
@@ -103,7 +103,7 @@ static void radeonDeleteQuery(GLcontext *ctx, struct gl_query_object *q)
radeon_bo_unref(query->bo);
}
- _mesa_free(query);
+ free(query);
}
static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q)
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 631f729048a..6415ec1239c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -826,6 +826,7 @@ static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id)
case PCI_CHIP_RS880_9712:
case PCI_CHIP_RS880_9713:
case PCI_CHIP_RS880_9714:
+ case PCI_CHIP_RS880_9715:
screen->chip_family = CHIP_FAMILY_RS880;
screen->chip_flags = RADEON_CHIPSET_TCL;
break;
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 7db745a1802..0ce97e86972 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -2254,7 +2254,6 @@ void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2 )
ctx->Driver.BlendFuncSeparate = radeonBlendFuncSeparate;
ctx->Driver.ClearColor = radeonClearColor;
ctx->Driver.ClearDepth = radeonClearDepth;
- ctx->Driver.ClearIndex = NULL;
ctx->Driver.ClearStencil = radeonClearStencil;
ctx->Driver.ClipPlane = radeonClipPlane;
ctx->Driver.ColorMask = radeonColorMask;
@@ -2266,7 +2265,6 @@ void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2 )
ctx->Driver.Fogfv = radeonFogfv;
ctx->Driver.FrontFace = radeonFrontFace;
ctx->Driver.Hint = NULL;
- ctx->Driver.IndexMask = NULL;
ctx->Driver.LightModelfv = radeonLightModelfv;
ctx->Driver.Lightfv = radeonLightfv;
ctx->Driver.LineStipple = radeonLineStipple;
diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
index 5a71b510fa9..f2fcb46688a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
@@ -524,7 +524,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
index d6aeb7049f4..a4bb03d5d39 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
@@ -46,6 +46,16 @@ do_copy_texsubimage(GLcontext *ctx,
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
+ unsigned src_bpp;
+ unsigned dst_bpp;
+ gl_format src_mesaformat;
+ gl_format dst_mesaformat;
+ unsigned src_width;
+ unsigned dst_width;
+
+ if (!radeon->vtbl.blit) {
+ return GL_FALSE;
+ }
if (_mesa_get_format_bits(timg->base.TexFormat, GL_DEPTH_BITS) > 0) {
rrb = radeon_get_depthbuffer(radeon);
@@ -58,6 +68,7 @@ do_copy_texsubimage(GLcontext *ctx,
}
assert(rrb && rrb->bo);
+ assert(timg->mt);
assert(timg->mt->bo);
assert(timg->base.Width >= dstx + width);
assert(timg->base.Height >= dsty + height);
@@ -75,12 +86,40 @@ do_copy_texsubimage(GLcontext *ctx,
}
+ src_mesaformat = rrb->base.Format;
+ dst_mesaformat = timg->base.TexFormat;
+ src_width = rrb->base.Width;
+ dst_width = timg->base.Width;
+ src_bpp = _mesa_get_format_bytes(src_mesaformat);
+ dst_bpp = _mesa_get_format_bytes(dst_mesaformat);
+ if (!radeon->vtbl.check_blit(dst_mesaformat)) {
+ if (src_bpp != dst_bpp)
+ return GL_FALSE;
+
+ switch (dst_bpp) {
+ case 2:
+ src_mesaformat = MESA_FORMAT_RGB565;
+ dst_mesaformat = MESA_FORMAT_RGB565;
+ break;
+ case 4:
+ src_mesaformat = MESA_FORMAT_ARGB8888;
+ dst_mesaformat = MESA_FORMAT_ARGB8888;
+ break;
+ case 1:
+ src_mesaformat = MESA_FORMAT_A8;
+ dst_mesaformat = MESA_FORMAT_A8;
+ break;
+ default:
+ return GL_FALSE;
+ }
+ }
+
/* blit from src buffer to texture */
- return radeon->vtbl.blit(ctx, rrb->bo, src_offset, rrb->base.Format, rrb->pitch/rrb->cpp,
- rrb->base.Width, rrb->base.Height, x, y,
- timg->mt->bo, dst_offset, timg->base.TexFormat,
- timg->mt->levels[level].rowstride / _mesa_get_format_bytes(timg->base.TexFormat),
- timg->base.Width, timg->base.Height,
+ return radeon->vtbl.blit(ctx, rrb->bo, src_offset, src_mesaformat, rrb->pitch/rrb->cpp,
+ src_width, rrb->base.Height, x, y,
+ timg->mt->bo, dst_offset, dst_mesaformat,
+ timg->mt->levels[level].rowstride / dst_bpp,
+ dst_width, timg->base.Height,
dstx, dsty, width, height, 1);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c b/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c
new file mode 100644
index 00000000000..7bf6dcc2e32
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2009 Maciej Cencora.
+ * Copyright (C) 2008 Nicolai Haehnle.
+ * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
+ *
+ * The Weather Channel (TM) funded Tungsten Graphics to develop the
+ * initial release of the Radeon 8500 driver under the XFree86 license.
+ * This notice must be preserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "radeon_common_context.h"
+#include "radeon_texture.h"
+#include "radeon_mipmap_tree.h"
+
+#include "main/texgetimage.h"
+
+/**
+ * Need to map texture image into memory before copying image data,
+ * then unmap it.
+ */
+static void
+radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
+ GLenum format, GLenum type, GLvoid * pixels,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage, int compressed)
+{
+ radeon_texture_image *image = get_radeon_texture_image(texImage);
+
+ radeon_print(RADEON_TEXTURE, RADEON_NORMAL,
+ "%s(%p, tex %p, image %p) compressed %d.\n",
+ __func__, ctx, texObj, image, compressed);
+
+ if (image->mt) {
+ /* Map the texture image read-only */
+ radeon_teximage_map(image, GL_FALSE);
+ } else {
+ /* Image hasn't been uploaded to a miptree yet */
+ assert(image->base.Data);
+ }
+
+ if (compressed) {
+ /* FIXME: this can't work for small textures (mips) which
+ use different hw stride */
+ _mesa_get_compressed_teximage(ctx, target, level, pixels,
+ texObj, texImage);
+ } else {
+ _mesa_get_teximage(ctx, target, level, format, type, pixels,
+ texObj, texImage);
+ }
+
+ if (image->mt) {
+ radeon_teximage_unmap(image);
+ }
+}
+
+void
+radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level,
+ GLenum format, GLenum type, GLvoid * pixels,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ radeon_get_tex_image(ctx, target, level, format, type, pixels,
+ texObj, texImage, 0);
+}
+
+void
+radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
+ GLvoid *pixels,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ radeon_get_tex_image(ctx, target, level, 0, 0, pixels,
+ texObj, texImage, 1);
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 9b9d90bdd02..2b655fbd953 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -39,7 +39,6 @@
#include "main/texstore.h"
#include "main/teximage.h"
#include "main/texobj.h"
-#include "main/texgetimage.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
@@ -559,6 +558,15 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx,
case GL_COMPRESSED_SLUMINANCE_ALPHA:
return MESA_FORMAT_SLA8;
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ return MESA_FORMAT_SRGB_DXT1;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ return MESA_FORMAT_SRGBA_DXT1;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ return MESA_FORMAT_SRGBA_DXT3;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ return MESA_FORMAT_SRGBA_DXT5;
+
default:
_mesa_problem(ctx,
"unexpected internalFormat 0x%x in %s",
@@ -637,7 +645,7 @@ static GLuint * allocate_image_offsets(GLcontext *ctx,
int i;
GLuint *offsets;
- offsets = _mesa_malloc(depth * sizeof(GLuint)) ;
+ offsets = malloc(depth * sizeof(GLuint)) ;
if (!offsets) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTex[Sub]Image");
return NULL;
@@ -664,6 +672,7 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
struct gl_texture_image *texImage,
int compressed)
{
+ radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
radeon_texture_image* image = get_radeon_texture_image(texImage);
@@ -678,8 +687,7 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
dstRowStride = image->mt->levels[image->mtlevel].rowstride;
} else if (t->bo) {
/* TFP case */
- /* TODO */
- assert(0);
+ dstRowStride = get_texture_image_row_stride(rmesa, texImage->TexFormat, width, 0);
} else {
dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
}
@@ -736,7 +744,7 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
}
if (dims == 3) {
- _mesa_free(dstImageOffsets);
+ free(dstImageOffsets);
}
radeon_teximage_unmap(image);
@@ -999,61 +1007,18 @@ void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
format, type, pixels, packing, texObj, texImage, 0);
}
-/**
- * Need to map texture image into memory before copying image data,
- * then unmap it.
- */
-static void
-radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid * pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage, int compressed)
+unsigned radeonIsFormatRenderable(gl_format mesa_format)
{
- radeon_texture_image *image = get_radeon_texture_image(texImage);
-
- radeon_print(RADEON_TEXTURE, RADEON_NORMAL,
- "%s(%p, tex %p, image %p) compressed %d.\n",
- __func__, ctx, texObj, image, compressed);
+ if (mesa_format == _dri_texformat_argb8888 || mesa_format == _dri_texformat_rgb565 ||
+ mesa_format == _dri_texformat_argb1555 || mesa_format == _dri_texformat_argb4444)
+ return 1;
- if (image->mt) {
- /* Map the texture image read-only */
- radeon_teximage_map(image, GL_FALSE);
- } else {
- /* Image hasn't been uploaded to a miptree yet */
- assert(image->base.Data);
- }
-
- if (compressed) {
- /* FIXME: this can't work for small textures (mips) which
- use different hw stride */
- _mesa_get_compressed_teximage(ctx, target, level, pixels,
- texObj, texImage);
- } else {
- _mesa_get_teximage(ctx, target, level, format, type, pixels,
- texObj, texImage);
- }
-
- if (image->mt) {
- radeon_teximage_unmap(image);
+ switch (mesa_format)
+ {
+ case MESA_FORMAT_Z16:
+ case MESA_FORMAT_S8_Z24:
+ return 1;
+ default:
+ return 0;
}
}
-
-void
-radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid * pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- radeon_get_tex_image(ctx, target, level, format, type, pixels,
- texObj, texImage, 0);
-}
-
-void
-radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
- GLvoid *pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- radeon_get_tex_image(ctx, target, level, 0, 0, pixels,
- texObj, texImage, 1);
-}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h
index f09dd652142..4ce639ea34e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.h
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.h
@@ -135,4 +135,6 @@ void radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
GLint x, GLint y,
GLsizei width, GLsizei height);
+unsigned radeonIsFormatRenderable(gl_format mesa_format);
+
#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_tile.c b/src/mesa/drivers/dri/radeon/radeon_tile.c
new file mode 100644
index 00000000000..403da110106
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_tile.c
@@ -0,0 +1,512 @@
+/*
+ * Copyright (C) 2010 Maciej Cencora <m.cencora@gmail.com>
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "radeon_tile.h"
+
+#include <stdint.h>
+#include <string.h>
+
+#include "main/macros.h"
+#include "radeon_debug.h"
+
+#define MICRO_TILE_SIZE 32
+
+static void micro_tile_8_x_4_8bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 8, tile_height = 4;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint8_t *src2 = (uint8_t *)src + src_pitch * row + col;
+ uint8_t *dst2 = (uint8_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint8_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint8_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_4_x_4_16bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 4, tile_height = 4;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint16_t *src2 = (uint16_t *)src + src_pitch * row + col;
+ uint16_t *dst2 = (uint16_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint16_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint16_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_8_x_2_16bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 8, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint16_t *src2 = (uint16_t *)src + src_pitch * row + col;
+ uint16_t *dst2 = (uint16_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint16_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint16_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_4_x_2_32bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 4, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint32_t *src2 = (uint32_t *)src + src_pitch * row + col;
+ uint32_t *dst2 = (uint32_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint32_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint32_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_2_x_2_64bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 2, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint64_t *src2 = (uint64_t *)src + src_pitch * row + col;
+ uint64_t *dst2 = (uint64_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint64_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint64_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_1_x_1_128bit(const void * src, unsigned src_pitch,
+ void * dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned i, j;
+ const unsigned elem_size = 16; /* sizeof(uint128_t) */
+
+ for (j = 0; j < height; ++j)
+ {
+ for (i = 0; i < width; ++i)
+ {
+ memcpy(dst, src, width * elem_size);
+ dst += dst_pitch * elem_size;
+ src += src_pitch * elem_size;
+ }
+ }
+}
+
+void tile_image(const void * src, unsigned src_pitch,
+ void *dst, unsigned dst_pitch,
+ gl_format format, unsigned width, unsigned height)
+{
+ assert(src_pitch >= width);
+ assert(dst_pitch >= width);
+
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "Software tiling: src_pitch %d, dst_pitch %d, width %d, height %d, bpp %d\n",
+ src_pitch, dst_pitch, width, height, _mesa_get_format_bytes(format));
+
+ switch (_mesa_get_format_bytes(format))
+ {
+ case 16:
+ micro_tile_1_x_1_128bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 8:
+ micro_tile_2_x_2_64bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 4:
+ micro_tile_4_x_2_32bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 2:
+ if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
+ {
+ micro_tile_4_x_4_16bit(src, src_pitch, dst, dst_pitch, width, height);
+ }
+ else
+ {
+ micro_tile_8_x_2_16bit(src, src_pitch, dst, dst_pitch, width, height);
+ }
+ break;
+ case 1:
+ micro_tile_8_x_4_8bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
+static void micro_untile_8_x_4_8bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 8, tile_height = 4;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint8_t *src2 = (uint8_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint8_t);
+ uint8_t *dst2 = (uint8_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint8_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_8_x_2_16bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 8, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint16_t *src2 = (uint16_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint16_t);
+ uint16_t *dst2 = (uint16_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint16_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_4_x_4_16bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 4, tile_height = 4;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint16_t *src2 = (uint16_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint16_t);
+ uint16_t *dst2 = (uint16_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint16_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_4_x_2_32bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 4, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint32_t *src2 = (uint32_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint32_t);
+ uint32_t *dst2 = (uint32_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint32_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_2_x_2_64bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 2, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint64_t *src2 = (uint64_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint64_t);
+ uint64_t *dst2 = (uint64_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint64_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_1_x_1_128bit(const void * src, unsigned src_pitch,
+ void * dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned i, j;
+ const unsigned elem_size = 16; /* sizeof(uint128_t) */
+
+ for (j = 0; j < height; ++j)
+ {
+ for (i = 0; i < width; ++i)
+ {
+ memcpy(dst, src, width * elem_size);
+ dst += dst_pitch * elem_size;
+ src += src_pitch * elem_size;
+ }
+ }
+}
+
+void untile_image(const void * src, unsigned src_pitch,
+ void *dst, unsigned dst_pitch,
+ gl_format format, unsigned width, unsigned height)
+{
+ assert(src_pitch >= width);
+ assert(dst_pitch >= width);
+
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "Software untiling: src_pitch %d, dst_pitch %d, width %d, height %d, bpp %d\n",
+ src_pitch, dst_pitch, width, height, _mesa_get_format_bytes(format));
+
+ switch (_mesa_get_format_bytes(format))
+ {
+ case 16:
+ micro_untile_1_x_1_128bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 8:
+ micro_untile_2_x_2_64bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 4:
+ micro_untile_4_x_2_32bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 2:
+ if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
+ {
+ micro_untile_4_x_4_16bit(src, src_pitch, dst, dst_pitch, width, height);
+ }
+ else
+ {
+ micro_untile_8_x_2_16bit(src, src_pitch, dst, dst_pitch, width, height);
+ }
+ break;
+ case 1:
+ micro_untile_8_x_4_8bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
+void get_tile_size(gl_format format, unsigned *block_width, unsigned *block_height)
+{
+ switch (_mesa_get_format_bytes(format))
+ {
+ case 16:
+ *block_width = 1;
+ *block_height = 1;
+ break;
+ case 8:
+ *block_width = 2;
+ *block_height = 2;
+ break;
+ case 4:
+ *block_width = 4;
+ *block_height = 2;
+ break;
+ case 2:
+ if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
+ {
+ *block_width = 4;
+ *block_height = 4;
+ }
+ else
+ {
+ *block_width = 8;
+ *block_height = 2;
+ }
+ break;
+ case 1:
+ *block_width = 8;
+ *block_height = 4;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_tile.h b/src/mesa/drivers/dri/radeon/radeon_tile.h
new file mode 100644
index 00000000000..31d9c5611c3
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_tile.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 Maciej Cencora <m.cencora@gmail.com>
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <main/formats.h>
+
+void tile_image(const void * src, unsigned src_pitch,
+ void *dst, unsigned dst_pitch,
+ gl_format format, unsigned width, unsigned height);
+
+void untile_image(const void * src, unsigned src_pitch,
+ void *dst, unsigned dst_pitch,
+ gl_format format, unsigned width, unsigned height);
+
+void get_tile_size(gl_format format, unsigned *block_width, unsigned *block_height);
diff --git a/src/mesa/drivers/dri/radeon/server/radeon_dri.c b/src/mesa/drivers/dri/radeon/server/radeon_dri.c
deleted file mode 100644
index 7ead588dac8..00000000000
--- a/src/mesa/drivers/dri/radeon/server/radeon_dri.c
+++ /dev/null
@@ -1,1337 +0,0 @@
-/**
- * \file server/radeon_dri.c
- * \brief File to perform the device-specific initialization tasks typically
- * done in the X server.
- *
- * Here they are converted to run in the client (or perhaps a standalone
- * process), and to work with the frame buffer device rather than the X
- * server infrastructure.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-#include "memops.h"
-
-#include "radeon.h"
-#include "radeon_dri.h"
-#include "radeon_macros.h"
-#include "radeon_reg.h"
-#include "drm_sarea.h"
-
-static size_t radeon_drm_page_size;
-
-static int RadeonSetParam(const DRIDriverContext *ctx, int param, int value)
-{
- drm_radeon_setparam_t sp;
-
- memset(&sp, 0, sizeof(sp));
- sp.param = param;
- sp.value = value;
-
- if (drmCommandWrite(ctx->drmFD, DRM_RADEON_SETPARAM, &sp, sizeof(sp))) {
- return -1;
- }
-
- return 0;
-}
-
-/**
- * \brief Wait for free FIFO entries.
- *
- * \param ctx display handle.
- * \param entries number of free entries to wait.
- *
- * It polls the free entries from the chip until it reaches the requested value
- * or a timeout (3000 tries) occurs. Aborts the program if the FIFO times out.
- */
-static void RADEONWaitForFifo( const DRIDriverContext *ctx,
- int entries )
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- int i;
-
- for (i = 0; i < 3000; i++) {
- int fifo_slots =
- INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK;
- if (fifo_slots >= entries) return;
- }
-
- /* There are recoveries possible, but I haven't seen them work
- * in practice:
- */
- fprintf(stderr, "FIFO timed out: %d entries, stat=0x%08x\n",
- INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK,
- INREG(RADEON_RBBM_STATUS));
- exit(1);
-}
-
-/**
- * \brief Read a PLL register.
- *
- * \param ctx display handle.
- * \param addr PLL register index.
- *
- * \return value of the PLL register.
- */
-static unsigned int RADEONINPLL( const DRIDriverContext *ctx, int addr)
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- unsigned int data;
-
- OUTREG8(RADEON_CLOCK_CNTL_INDEX, addr & 0x3f);
- data = INREG(RADEON_CLOCK_CNTL_DATA);
-
- return data;
-}
-
-/**
- * \brief Reset graphics card to known state.
- *
- * \param ctx display handle.
- *
- * Resets the values of several Radeon registers.
- */
-static void RADEONEngineReset( const DRIDriverContext *ctx )
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- unsigned int clock_cntl_index;
- unsigned int mclk_cntl;
- unsigned int rbbm_soft_reset;
- unsigned int host_path_cntl;
- int i;
-
- OUTREGP(RADEON_RB2D_DSTCACHE_CTLSTAT,
- RADEON_RB2D_DC_FLUSH_ALL,
- ~RADEON_RB2D_DC_FLUSH_ALL);
- for (i = 0; i < 512; i++) {
- if (!(INREG(RADEON_RB2D_DSTCACHE_CTLSTAT) & RADEON_RB2D_DC_BUSY))
- break;
- }
-
- clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX);
-
- mclk_cntl = INPLL(ctx, RADEON_MCLK_CNTL);
- OUTPLL(RADEON_MCLK_CNTL, (mclk_cntl |
- RADEON_FORCEON_MCLKA |
- RADEON_FORCEON_MCLKB |
- RADEON_FORCEON_YCLKA |
- RADEON_FORCEON_YCLKB |
- RADEON_FORCEON_MC |
- RADEON_FORCEON_AIC));
-
- /* Soft resetting HDP thru RBBM_SOFT_RESET register can cause some
- * unexpected behaviour on some machines. Here we use
- * RADEON_HOST_PATH_CNTL to reset it.
- */
- host_path_cntl = INREG(RADEON_HOST_PATH_CNTL);
- rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET);
-
- OUTREG(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset |
- RADEON_SOFT_RESET_CP |
- RADEON_SOFT_RESET_HI |
- RADEON_SOFT_RESET_SE |
- RADEON_SOFT_RESET_RE |
- RADEON_SOFT_RESET_PP |
- RADEON_SOFT_RESET_E2 |
- RADEON_SOFT_RESET_RB));
- INREG(RADEON_RBBM_SOFT_RESET);
- OUTREG(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset &
- (unsigned int) ~(RADEON_SOFT_RESET_CP |
- RADEON_SOFT_RESET_HI |
- RADEON_SOFT_RESET_SE |
- RADEON_SOFT_RESET_RE |
- RADEON_SOFT_RESET_PP |
- RADEON_SOFT_RESET_E2 |
- RADEON_SOFT_RESET_RB)));
- INREG(RADEON_RBBM_SOFT_RESET);
-
- OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl | RADEON_HDP_SOFT_RESET);
- INREG(RADEON_HOST_PATH_CNTL);
- OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl);
-
- OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset);
-
- OUTREG(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index);
- OUTPLL(RADEON_MCLK_CNTL, mclk_cntl);
-}
-
-/**
- * \brief Restore the drawing engine.
- *
- * \param ctx display handle
- *
- * Resets the graphics card and sets initial values for several registers of
- * the card's drawing engine.
- *
- * Turns on the radeon command processor engine (i.e., the ringbuffer).
- */
-static int RADEONEngineRestore( const DRIDriverContext *ctx )
-{
- RADEONInfoPtr info = ctx->driverPrivate;
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- int pitch64, datatype, dp_gui_master_cntl, err;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- OUTREG(RADEON_RB3D_CNTL, 0);
- RADEONEngineReset( ctx );
-
- switch (ctx->bpp) {
- case 16: datatype = 4; break;
- case 32: datatype = 6; break;
- default: return 0;
- }
-
- dp_gui_master_cntl =
- ((datatype << RADEON_GMC_DST_DATATYPE_SHIFT)
- | RADEON_GMC_CLR_CMP_CNTL_DIS);
-
- pitch64 = ((ctx->shared.virtualWidth * (ctx->bpp / 8) + 0x3f)) >> 6;
-
- RADEONWaitForFifo(ctx, 1);
- OUTREG(RADEON_DEFAULT_OFFSET, ((INREG(RADEON_DEFAULT_OFFSET) & 0xC0000000)
- | (pitch64 << 22)));
-
- RADEONWaitForFifo(ctx, 1);
- OUTREG(RADEON_SURFACE_CNTL, RADEON_SURF_TRANSLATION_DIS);
-
- RADEONWaitForFifo(ctx, 1);
- OUTREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX
- | RADEON_DEFAULT_SC_BOTTOM_MAX));
-
- RADEONWaitForFifo(ctx, 1);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (dp_gui_master_cntl
- | RADEON_GMC_BRUSH_SOLID_COLOR
- | RADEON_GMC_SRC_DATATYPE_COLOR));
-
- RADEONWaitForFifo(ctx, 7);
- OUTREG(RADEON_DST_LINE_START, 0);
- OUTREG(RADEON_DST_LINE_END, 0);
- OUTREG(RADEON_DP_BRUSH_FRGD_CLR, 0xffffffff);
- OUTREG(RADEON_DP_BRUSH_BKGD_CLR, 0);
- OUTREG(RADEON_DP_SRC_FRGD_CLR, 0xffffffff);
- OUTREG(RADEON_DP_SRC_BKGD_CLR, 0);
- OUTREG(RADEON_DP_WRITE_MASK, 0xffffffff);
- OUTREG(RADEON_AUX_SC_CNTL, 0);
-
-/* RADEONWaitForIdleMMIO(ctx); */
- usleep(100);
-
-
- OUTREG(RADEON_GEN_INT_CNTL, info->gen_int_cntl);
- if (info->colorTiling)
- info->crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
- OUTREG(RADEON_CRTC_OFFSET_CNTL, info->crtc_offset_cntl);
-
- /* Initialize and start the CP if required */
- if ((err = drmCommandNone(ctx->drmFD, DRM_RADEON_CP_START)) != 0) {
- fprintf(stderr, "%s: CP start %d\n", __FUNCTION__, err);
- return 0;
- }
-
- return 1;
-}
-
-
-/**
- * \brief Shutdown the drawing engine.
- *
- * \param ctx display handle
- *
- * Turns off the command processor engine & restores the graphics card
- * to a state that fbdev understands.
- */
-static int RADEONEngineShutdown( const DRIDriverContext *ctx )
-{
- drm_radeon_cp_stop_t stop;
- int ret, i;
-
- stop.flush = 1;
- stop.idle = 1;
-
- ret = drmCommandWrite(ctx->drmFD, DRM_RADEON_CP_STOP, &stop,
- sizeof(drm_radeon_cp_stop_t));
-
- if (ret == 0) {
- return 0;
- } else if (errno != EBUSY) {
- return -errno;
- }
-
- stop.flush = 0;
-
- i = 0;
- do {
- ret = drmCommandWrite(ctx->drmFD, DRM_RADEON_CP_STOP, &stop,
- sizeof(drm_radeon_cp_stop_t));
- } while (ret && errno == EBUSY && i++ < 10);
-
- if (ret == 0) {
- return 0;
- } else if (errno != EBUSY) {
- return -errno;
- }
-
- stop.idle = 0;
-
- if (drmCommandWrite(ctx->drmFD, DRM_RADEON_CP_STOP,
- &stop, sizeof(drm_radeon_cp_stop_t))) {
- return -errno;
- } else {
- return 0;
- }
-}
-
-/**
- * \brief Compute base 2 logarithm.
- *
- * \param val value.
- *
- * \return base 2 logarithm of \p val.
- */
-static int RADEONMinBits(int val)
-{
- int bits;
-
- if (!val) return 1;
- for (bits = 0; val; val >>= 1, ++bits);
- return bits;
-}
-
-/**
- * \brief Initialize the AGP state
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return one on success, or zero on failure.
- *
- * Acquires and enables the AGP device. Reserves memory in the AGP space for
- * the ring buffer, vertex buffers and textures. Initialize the Radeon
- * registers to point to that memory and add client mappings.
- */
-static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info)
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- unsigned long mode;
- int ret;
- int s, l;
-
- if (drmAgpAcquire(ctx->drmFD) < 0) {
- fprintf(stderr, "[gart] AGP not available\n");
- return 0;
- }
-
- /* Modify the mode if the default mode is not appropriate for this
- * particular combination of graphics card and AGP chipset.
- */
- mode = drmAgpGetMode(ctx->drmFD); /* Default mode */
-
- /* Disable fast write entirely - too many lockups.
- */
- mode &= ~RADEON_AGP_MODE_MASK;
- switch (ctx->agpmode) {
- case 4: mode |= RADEON_AGP_4X_MODE;
- case 2: mode |= RADEON_AGP_2X_MODE;
- case 1: default: mode |= RADEON_AGP_1X_MODE;
- }
-
- if (drmAgpEnable(ctx->drmFD, mode) < 0) {
- fprintf(stderr, "[gart] AGP not enabled\n");
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
- else
- fprintf(stderr, "[gart] AGP enabled at %dx\n", ctx->agpmode);
-
- /* Workaround for some hardware bugs */
- if (info->ChipFamily < CHIP_FAMILY_R200)
- OUTREG(RADEON_AGP_CNTL, INREG(RADEON_AGP_CNTL) | 0x000e0000);
-
- info->gartOffset = 0;
-
- if ((ret = drmAgpAlloc(ctx->drmFD, info->gartSize*1024*1024, 0, NULL,
- &info->gartMemHandle)) < 0) {
- fprintf(stderr, "[gart] Out of memory (%d)\n", ret);
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
- fprintf(stderr,
- "[gart] %d kB allocated with handle 0x%08x\n",
- info->gartSize*1024, (unsigned)info->gartMemHandle);
-
- if (drmAgpBind(ctx->drmFD,
- info->gartMemHandle, info->gartOffset) < 0) {
- fprintf(stderr, "[gart] Could not bind\n");
- drmAgpFree(ctx->drmFD, info->gartMemHandle);
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
-
- /* Initialize the CP ring buffer data */
- info->ringStart = info->gartOffset;
- info->ringMapSize = info->ringSize*1024*1024 + radeon_drm_page_size;
-
- info->ringReadOffset = info->ringStart + info->ringMapSize;
- info->ringReadMapSize = radeon_drm_page_size;
-
- /* Reserve space for vertex/indirect buffers */
- info->bufStart = info->ringReadOffset + info->ringReadMapSize;
- info->bufMapSize = info->bufSize*1024*1024;
-
- /* Reserve the rest for AGP textures */
- info->gartTexStart = info->bufStart + info->bufMapSize;
- s = (info->gartSize*1024*1024 - info->gartTexStart);
- l = RADEONMinBits((s-1) / RADEON_NR_TEX_REGIONS);
- if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
- info->gartTexMapSize = (s >> l) << l;
- info->log2GARTTexGran = l;
-
- if (drmAddMap(ctx->drmFD, info->ringStart, info->ringMapSize,
- DRM_AGP, DRM_READ_ONLY, &info->ringHandle) < 0) {
- fprintf(stderr, "[gart] Could not add ring mapping\n");
- return 0;
- }
- fprintf(stderr, "[gart] ring handle = 0x%08x\n", info->ringHandle);
-
-
- if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
- DRM_AGP, DRM_READ_ONLY, &info->ringReadPtrHandle) < 0) {
- fprintf(stderr,
- "[gart] Could not add ring read ptr mapping\n");
- return 0;
- }
-
- fprintf(stderr,
- "[gart] ring read ptr handle = 0x%08lx\n",
- info->ringReadPtrHandle);
-
- if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
- DRM_AGP, 0, &info->bufHandle) < 0) {
- fprintf(stderr,
- "[gart] Could not add vertex/indirect buffers mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[gart] vertex/indirect buffers handle = 0x%08x\n",
- info->bufHandle);
-
- if (drmAddMap(ctx->drmFD, info->gartTexStart, info->gartTexMapSize,
- DRM_AGP, 0, &info->gartTexHandle) < 0) {
- fprintf(stderr,
- "[gart] Could not add AGP texture map mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[gart] AGP texture map handle = 0x%08lx\n",
- info->gartTexHandle);
-
- /* Initialize Radeon's AGP registers */
- /* Ring buffer is at AGP offset 0 */
- OUTREG(RADEON_AGP_BASE, info->ringHandle);
-
- return 1;
-}
-
-/* Initialize the PCI GART state. Request memory for use in PCI space,
- * and initialize the Radeon registers to point to that memory.
- */
-static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info)
-{
- int ret;
- int flags = DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL;
- int s, l;
-
- ret = drmScatterGatherAlloc(ctx->drmFD, info->gartSize*1024*1024,
- &info->gartMemHandle);
- if (ret < 0) {
- fprintf(stderr, "[pci] Out of memory (%d)\n", ret);
- return 0;
- }
- fprintf(stderr,
- "[pci] %d kB allocated with handle 0x%08lx\n",
- info->gartSize*1024, info->gartMemHandle);
-
- info->gartOffset = 0;
-
- /* Initialize the CP ring buffer data */
- info->ringStart = info->gartOffset;
- info->ringMapSize = info->ringSize*1024*1024 + radeon_drm_page_size;
-
- info->ringReadOffset = info->ringStart + info->ringMapSize;
- info->ringReadMapSize = radeon_drm_page_size;
-
- /* Reserve space for vertex/indirect buffers */
- info->bufStart = info->ringReadOffset + info->ringReadMapSize;
- info->bufMapSize = info->bufSize*1024*1024;
-
- /* Reserve the rest for AGP textures */
- info->gartTexStart = info->bufStart + info->bufMapSize;
- s = (info->gartSize*1024*1024 - info->gartTexStart);
- l = RADEONMinBits((s-1) / RADEON_NR_TEX_REGIONS);
- if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
- info->gartTexMapSize = (s >> l) << l;
- info->log2GARTTexGran = l;
-
- if (drmAddMap(ctx->drmFD, info->ringStart, info->ringMapSize,
- DRM_SCATTER_GATHER, flags, &info->ringHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add ring mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[pci] ring handle = 0x%08x\n", info->ringHandle);
-
- if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
- DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add ring read ptr mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[pci] ring read ptr handle = 0x%08lx\n",
- info->ringReadPtrHandle);
-
- if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
- DRM_SCATTER_GATHER, 0, &info->bufHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add vertex/indirect buffers mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[pci] vertex/indirect buffers handle = 0x%08lx\n",
- info->bufHandle);
-
- if (drmAddMap(ctx->drmFD, info->gartTexStart, info->gartTexMapSize,
- DRM_SCATTER_GATHER, 0, &info->gartTexHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add GART texture map mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[pci] GART texture map handle = 0x%08x\n",
- info->gartTexHandle);
-
- return 1;
-}
-
-
-/**
- * \brief Initialize the kernel data structures and enable the CP engine.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * This function is a wrapper around the DRM_RADEON_CP_INIT command, passing
- * all the parameters in a drm_radeon_init_t structure.
- */
-static int RADEONDRIKernelInit( const DRIDriverContext *ctx,
- RADEONInfoPtr info)
-{
- int cpp = ctx->bpp / 8;
- drm_radeon_init_t drmInfo;
- int ret;
-
- memset(&drmInfo, 0, sizeof(drm_radeon_init_t));
-
- if ( (info->ChipFamily == CHIP_FAMILY_R200) ||
- (info->ChipFamily == CHIP_FAMILY_RV250) ||
- (info->ChipFamily == CHIP_FAMILY_M9) ||
- (info->ChipFamily == CHIP_FAMILY_RV280) )
- drmInfo.func = RADEON_INIT_R200_CP;
- else
- drmInfo.func = RADEON_INIT_CP;
-
- /* This is the struct passed to the kernel module for its initialization */
- drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
- drmInfo.is_pci = ctx->isPCI;
- drmInfo.cp_mode = RADEON_DEFAULT_CP_BM_MODE;
- drmInfo.gart_size = info->gartSize*1024*1024;
- drmInfo.ring_size = info->ringSize*1024*1024;
- drmInfo.usec_timeout = 1000;
- drmInfo.fb_bpp = ctx->bpp;
- drmInfo.depth_bpp = ctx->bpp;
- drmInfo.front_offset = info->frontOffset;
- drmInfo.front_pitch = info->frontPitch * cpp;
- drmInfo.back_offset = info->backOffset;
- drmInfo.back_pitch = info->backPitch * cpp;
- drmInfo.depth_offset = info->depthOffset;
- drmInfo.depth_pitch = info->depthPitch * cpp;
- drmInfo.fb_offset = info->LinearAddr;
- drmInfo.mmio_offset = info->registerHandle;
- drmInfo.ring_offset = info->ringHandle;
- drmInfo.ring_rptr_offset = info->ringReadPtrHandle;
- drmInfo.buffers_offset = info->bufHandle;
- drmInfo.gart_textures_offset = info->gartTexHandle;
-
- ret = drmCommandWrite(ctx->drmFD, DRM_RADEON_CP_INIT, &drmInfo,
- sizeof(drm_radeon_init_t));
-
- return ret >= 0;
-}
-
-
-/**
- * \brief Initialize the AGP heap.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * This function is a wrapper around the DRM_RADEON_INIT_HEAP command, passing
- * all the parameters in a drm_radeon_mem_init_heap structure.
- */
-static void RADEONDRIAgpHeapInit(const DRIDriverContext *ctx,
- RADEONInfoPtr info)
-{
- drm_radeon_mem_init_heap_t drmHeap;
-
- /* Start up the simple memory manager for gart space */
- drmHeap.region = RADEON_MEM_REGION_GART;
- drmHeap.start = 0;
- drmHeap.size = info->gartTexMapSize;
-
- if (drmCommandWrite(ctx->drmFD, DRM_RADEON_INIT_HEAP,
- &drmHeap, sizeof(drmHeap))) {
- fprintf(stderr,
- "[drm] Failed to initialized gart heap manager\n");
- } else {
- fprintf(stderr,
- "[drm] Initialized kernel gart heap manager, %d\n",
- info->gartTexMapSize);
- }
-}
-
-/**
- * \brief Add a map for the vertex buffers that will be accessed by any
- * DRI-based clients.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return one on success, or zero on failure.
- *
- * Calls drmAddBufs() with the previously allocated vertex buffers.
- */
-static int RADEONDRIBufInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
-{
- /* Initialize vertex buffers */
- info->bufNumBufs = drmAddBufs(ctx->drmFD,
- info->bufMapSize / RADEON_BUFFER_SIZE,
- RADEON_BUFFER_SIZE,
- ctx->isPCI ? DRM_SG_BUFFER : DRM_AGP_BUFFER,
- info->bufStart);
-
- if (info->bufNumBufs <= 0) {
- fprintf(stderr,
- "[drm] Could not create vertex/indirect buffers list\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] Added %d %d byte vertex/indirect buffers\n",
- info->bufNumBufs, RADEON_BUFFER_SIZE);
-
- return 1;
-}
-
-/**
- * \brief Install an IRQ handler.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * Attempts to install an IRQ handler via drmCtlInstHandler(), falling back to
- * IRQ-free operation on failure.
- */
-static void RADEONDRIIrqInit(const DRIDriverContext *ctx,
- RADEONInfoPtr info)
-{
- if (!info->irq) {
- info->irq = drmGetInterruptFromBusID(ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if ((drmCtlInstHandler(ctx->drmFD, info->irq)) != 0) {
- fprintf(stderr,
- "[drm] failure adding irq handler, "
- "there is a device already using that irq\n"
- "[drm] falling back to irq-free operation\n");
- info->irq = 0;
- }
- }
-
- if (info->irq)
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- info->irq);
-}
-
-static int RADEONCheckDRMVersion( const DRIDriverContext *ctx,
- RADEONInfoPtr info )
-{
- drmVersionPtr version;
-
- version = drmGetVersion(ctx->drmFD);
- if (version) {
- int req_minor, req_patch;
-
- /* Need 1.8.x for proper cleanup-on-client-exit behaviour.
- */
- req_minor = 8;
- req_patch = 0;
-
- if (version->version_major != 1 ||
- version->version_minor < req_minor ||
- (version->version_minor == req_minor &&
- version->version_patchlevel < req_patch)) {
- /* Incompatible drm version */
- fprintf(stderr,
- "[dri] RADEONDRIScreenInit failed because of a version "
- "mismatch.\n"
- "[dri] radeon.o kernel module version is %d.%d.%d "
- "but version 1.%d.%d or newer is needed.\n"
- "[dri] Disabling DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel,
- req_minor,
- req_patch);
- drmFreeVersion(version);
- return 0;
- }
-
- info->drmMinor = version->version_minor;
- drmFreeVersion(version);
- }
-
- return 1;
-}
-
-static int RADEONMemoryInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
-{
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int cpp = ctx->cpp;
- int bufferSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes + RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN);
- int depthSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes
- + RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN);
- int l;
-
- info->frontOffset = 0;
- info->frontPitch = ctx->shared.virtualWidth;
-
- fprintf(stderr,
- "Using %d MB AGP aperture\n", info->gartSize);
- fprintf(stderr,
- "Using %d MB for the ring buffer\n", info->ringSize);
- fprintf(stderr,
- "Using %d MB for vertex/indirect buffers\n", info->bufSize);
- fprintf(stderr,
- "Using %d MB for AGP textures\n", info->gartTexSize);
-
- /* Front, back and depth buffers - everything else texture??
- */
- info->textureSize = ctx->shared.fbSize - 2 * bufferSize - depthSize;
-
- if (ctx->colorTiling==1)
- {
- info->textureSize = ctx->shared.fbSize - ((ctx->shared.fbSize - info->textureSize + width_bytes * 16 - 1) / (width_bytes * 16)) * (width_bytes*16);
- }
-
- if (info->textureSize < 0)
- return 0;
-
- l = RADEONMinBits((info->textureSize-1) / RADEON_NR_TEX_REGIONS);
- if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
-
- /* Round the texture size up to the nearest whole number of
- * texture regions. Again, be greedy about this, don't
- * round down.
- */
- info->log2TexGran = l;
- info->textureSize = (info->textureSize >> l) << l;
-
- /* Set a minimum usable local texture heap size. This will fit
- * two 256x256x32bpp textures.
- */
- if (info->textureSize < 512 * 1024) {
- info->textureOffset = 0;
- info->textureSize = 0;
- }
-
- /* Reserve space for textures */
- if (ctx->colorTiling==1)
- {
- info->textureOffset = ((ctx->shared.fbSize - info->textureSize) /
- (width_bytes * 16)) * (width_bytes*16);
- }
- else
- {
- info->textureOffset = ((ctx->shared.fbSize - info->textureSize +
- RADEON_BUFFER_ALIGN) &
- ~RADEON_BUFFER_ALIGN);
- }
- /* Reserve space for the shared depth
- * buffer.
- */
- info->depthOffset = ((info->textureOffset - depthSize +
- RADEON_BUFFER_ALIGN) &
- ~RADEON_BUFFER_ALIGN);
- info->depthPitch = ctx->shared.virtualWidth;
-
- info->backOffset = ((info->depthOffset - bufferSize +
- RADEON_BUFFER_ALIGN) &
- ~RADEON_BUFFER_ALIGN);
- info->backPitch = ctx->shared.virtualWidth;
-
-
- fprintf(stderr,
- "Will use back buffer at offset 0x%x\n",
- info->backOffset);
- fprintf(stderr,
- "Will use depth buffer at offset 0x%x\n",
- info->depthOffset);
- fprintf(stderr,
- "Will use %d kb for textures at offset 0x%x\n",
- info->textureSize/1024, info->textureOffset);
-
- info->frontPitchOffset = (((info->frontPitch * cpp / 64) << 22) |
- (info->frontOffset >> 10));
-
- info->backPitchOffset = (((info->backPitch * cpp / 64) << 22) |
- (info->backOffset >> 10));
-
- info->depthPitchOffset = (((info->depthPitch * cpp / 64) << 22) |
- (info->depthOffset >> 10));
-
- return 1;
-}
-
-static int RADEONColorTilingInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
-{
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int bufferSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes + RADEON_BUFFER_ALIGN)
- & ~RADEON_BUFFER_ALIGN);
- /* Setup color tiling */
- if (info->drmMinor<14)
- info->colorTiling=0;
-
- if (info->colorTiling)
- {
-
- int colorTilingFlag;
- drm_radeon_surface_alloc_t front,back;
-
- RadeonSetParam(ctx, RADEON_SETPARAM_SWITCH_TILING, info->colorTiling ? 1 : 0);
-
- /* Setup the surfaces */
- if (info->ChipFamily < CHIP_FAMILY_R200)
- colorTilingFlag=RADEON_SURF_TILE_COLOR_MACRO;
- else
- colorTilingFlag=R200_SURF_TILE_COLOR_MACRO;
-
- front.address = info->frontOffset;
- front.size = bufferSize;
- front.flags = (width_bytes) | colorTilingFlag;
- drmCommandWrite(ctx->drmFD, DRM_RADEON_SURF_ALLOC, &front,sizeof(front));
-
- back.address = info->backOffset;
- back.size = bufferSize;
- back.flags = (width_bytes) | colorTilingFlag;
- drmCommandWrite(ctx->drmFD, DRM_RADEON_SURF_ALLOC, &back,sizeof(back));
-
- }
- return 1;
-}
-
-
-
-/**
- * Called at the start of each server generation.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * Performs static frame buffer allocation. Opens the DRM device and add maps
- * to the SAREA, framebuffer and MMIO regions. Fills in \p info with more
- * information. Creates a \e server context to grab the lock for the
- * initialization ioctls and calls the other initilization functions in this
- * file. Starts the CP engine via the DRM_RADEON_CP_START command.
- *
- * Setups a RADEONDRIRec structure to be passed to radeon_dri.so for its
- * initialization.
- */
-static int RADEONScreenInit( DRIDriverContext *ctx, RADEONInfoPtr info )
-{
- RADEONDRIPtr pRADEONDRI;
- int err;
-
- usleep(100);
- /*assert(!ctx->IsClient);*/
-
- {
- int width_bytes = (ctx->shared.virtualWidth * ctx->cpp);
- int maxy = ctx->shared.fbSize / width_bytes;
-
-
- if (maxy <= ctx->shared.virtualHeight * 3) {
- fprintf(stderr,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (ctx->shared.virtualWidth * ctx->shared.virtualHeight *
- ctx->cpp * 3 + 1023) / 1024,
- ctx->shared.fbSize / 1024);
- return 0;
- }
- }
-
-
- if (info->ChipFamily >= CHIP_FAMILY_R300) {
- fprintf(stderr,
- "Direct rendering not yet supported on "
- "Radeon 9700 and newer cards\n");
- return 0;
- }
-
- radeon_drm_page_size = getpagesize();
-
- info->registerSize = ctx->MMIOSize;
- ctx->shared.SAREASize = SAREA_MAX;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("radeon", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
-#ifndef _EMBEDDED
- 0,
-#else
- DRM_READ_ONLY,
-#endif
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
-
-
- if (drmAddMap(ctx->drmFD,
- ctx->MMIOStart,
- ctx->MMIOSize,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &info->registerHandle) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08lx\n", info->registerHandle);
-
- /* Check the radeon DRM version */
- if (!RADEONCheckDRMVersion(ctx, info)) {
- return 0;
- }
-
- if (ctx->isPCI) {
- /* Initialize PCI */
- if (!RADEONDRIPciInit(ctx, info))
- return 0;
- }
- else {
- /* Initialize AGP */
- if (!RADEONDRIAgpInit(ctx, info))
- return 0;
- }
-
- /* Memory manager setup */
- if (!RADEONMemoryInit(ctx, info)) {
- return 0;
- }
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the kernel data structures */
- if (!RADEONDRIKernelInit(ctx, info)) {
- fprintf(stderr, "RADEONDRIKernelInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize the vertex buffers list */
- if (!RADEONDRIBufInit(ctx, info)) {
- fprintf(stderr, "RADEONDRIBufInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- RADEONColorTilingInit(ctx, info);
-
- /* Initialize IRQ */
- RADEONDRIIrqInit(ctx, info);
-
- /* Initialize kernel gart memory manager */
- RADEONDRIAgpHeapInit(ctx, info);
-
- fprintf(stderr,"color tiling %sabled\n", info->colorTiling?"en":"dis");
- fprintf(stderr,"page flipping %sabled\n", info->page_flip_enable?"en":"dis");
- /* Initialize the SAREA private data structure */
- {
- drm_radeon_sarea_t *pSAREAPriv;
- pSAREAPriv = (drm_radeon_sarea_t *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
- pSAREAPriv->pfState = info->page_flip_enable;
- }
-
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
- drimemsetio((char *)ctx->FBAddress + info->frontOffset,
- 0,
- info->frontPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- drimemsetio((char *)ctx->FBAddress + info->backOffset,
- 0,
- info->backPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- /* This is the struct passed to radeon_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(RADEONDRIRec));
- ctx->driverClientMsgSize = sizeof(RADEONDRIRec);
- pRADEONDRI = (RADEONDRIPtr)ctx->driverClientMsg;
- pRADEONDRI->deviceID = info->Chipset;
- pRADEONDRI->width = ctx->shared.virtualWidth;
- pRADEONDRI->height = ctx->shared.virtualHeight;
- pRADEONDRI->depth = ctx->bpp; /* XXX: depth */
- pRADEONDRI->bpp = ctx->bpp;
- pRADEONDRI->IsPCI = ctx->isPCI;
- pRADEONDRI->AGPMode = ctx->agpmode;
- pRADEONDRI->frontOffset = info->frontOffset;
- pRADEONDRI->frontPitch = info->frontPitch;
- pRADEONDRI->backOffset = info->backOffset;
- pRADEONDRI->backPitch = info->backPitch;
- pRADEONDRI->depthOffset = info->depthOffset;
- pRADEONDRI->depthPitch = info->depthPitch;
- pRADEONDRI->textureOffset = info->textureOffset;
- pRADEONDRI->textureSize = info->textureSize;
- pRADEONDRI->log2TexGran = info->log2TexGran;
- pRADEONDRI->registerHandle = info->registerHandle;
- pRADEONDRI->registerSize = info->registerSize;
- pRADEONDRI->statusHandle = info->ringReadPtrHandle;
- pRADEONDRI->statusSize = info->ringReadMapSize;
- pRADEONDRI->gartTexHandle = info->gartTexHandle;
- pRADEONDRI->gartTexMapSize = info->gartTexMapSize;
- pRADEONDRI->log2GARTTexGran = info->log2GARTTexGran;
- pRADEONDRI->gartTexOffset = info->gartTexStart;
- pRADEONDRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- /* Don't release the lock now - let the VT switch handler do it. */
-
- return 1;
-}
-
-
-/**
- * \brief Get Radeon chip family from chipset number.
- *
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * Called by radeonInitFBDev() to set RADEONInfoRec::ChipFamily
- * according to the value of RADEONInfoRec::Chipset. Fails if the
- * chipset is unrecognized or not appropriate for this driver (i.e., not
- * an r100 style radeon)
- */
-static int get_chipfamily_from_chipset( RADEONInfoPtr info )
-{
- switch (info->Chipset) {
- case PCI_CHIP_RADEON_LY:
- case PCI_CHIP_RADEON_LZ:
- info->ChipFamily = CHIP_FAMILY_M6;
- break;
-
- case PCI_CHIP_RADEON_QY:
- case PCI_CHIP_RADEON_QZ:
- info->ChipFamily = CHIP_FAMILY_VE;
- break;
-
- case PCI_CHIP_R200_QL:
- case PCI_CHIP_R200_QN:
- case PCI_CHIP_R200_QO:
- case PCI_CHIP_R200_Ql:
- case PCI_CHIP_R200_BB:
- info->ChipFamily = CHIP_FAMILY_R200;
- break;
-
- case PCI_CHIP_RV200_QW: /* RV200 desktop */
- case PCI_CHIP_RV200_QX:
- info->ChipFamily = CHIP_FAMILY_RV200;
- break;
-
- case PCI_CHIP_RADEON_LW:
- case PCI_CHIP_RADEON_LX:
- info->ChipFamily = CHIP_FAMILY_M7;
- break;
-
- case PCI_CHIP_RV250_Id:
- case PCI_CHIP_RV250_Ie:
- case PCI_CHIP_RV250_If:
- case PCI_CHIP_RV250_Ig:
- info->ChipFamily = CHIP_FAMILY_RV250;
- break;
-
- case PCI_CHIP_RV250_Ld:
- case PCI_CHIP_RV250_Le:
- case PCI_CHIP_RV250_Lf:
- case PCI_CHIP_RV250_Lg:
- info->ChipFamily = CHIP_FAMILY_M9;
- break;
-
- case PCI_CHIP_RV280_Y_:
- case PCI_CHIP_RV280_Ya:
- case PCI_CHIP_RV280_Yb:
- case PCI_CHIP_RV280_Yc:
- info->ChipFamily = CHIP_FAMILY_RV280;
- break;
-
- case PCI_CHIP_R300_ND:
- case PCI_CHIP_R300_NE:
- case PCI_CHIP_R300_NF:
- case PCI_CHIP_R300_NG:
- info->ChipFamily = CHIP_FAMILY_R300;
- break;
-
- default:
- /* Original Radeon/7200 */
- info->ChipFamily = CHIP_FAMILY_RADEON;
- }
-
- return 1;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa radeonValidateMode().
- */
-static int radeonValidateMode( const DRIDriverContext *ctx )
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- RADEONInfoPtr info = ctx->driverPrivate;
-
- info->gen_int_cntl = INREG(RADEON_GEN_INT_CNTL);
- info->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL);
-
- if (info->colorTiling)
- info->crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa radeonValidateMode().
- */
-static int radeonPostValidateMode( const DRIDriverContext *ctx )
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- RADEONInfoPtr info = ctx->driverPrivate;
-
- RADEONColorTilingInit( ctx, info);
- OUTREG(RADEON_GEN_INT_CNTL, info->gen_int_cntl);
- if (info->colorTiling)
- info->crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
- OUTREG(RADEON_CRTC_OFFSET_CNTL, info->crtc_offset_cntl);
-
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls RADEONScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int radeonInitFBDev( DRIDriverContext *ctx )
-{
- RADEONInfoPtr info = calloc(1, sizeof(*info));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- if (ctx->colorTiling==1)
- {
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 255) & ~255; break;
- case 2: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 63) & ~63; break;
- }
- } else {
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
- }
-
- ctx->shared.virtualWidth = dummy;
- ctx->shared.Width = dummy;
- }
-
- fprintf(stderr,"shared virtual width is %d\n", ctx->shared.virtualWidth);
- ctx->driverPrivate = (void *)info;
-
- info->gartFastWrite = RADEON_DEFAULT_AGP_FAST_WRITE;
- info->gartSize = RADEON_DEFAULT_AGP_SIZE;
- info->gartTexSize = RADEON_DEFAULT_AGP_TEX_SIZE;
- info->bufSize = RADEON_DEFAULT_BUFFER_SIZE;
- info->ringSize = RADEON_DEFAULT_RING_SIZE;
- info->page_flip_enable = RADEON_DEFAULT_PAGE_FLIP;
- info->colorTiling = ctx->colorTiling;
-
- info->Chipset = ctx->chipset;
-
- if (!get_chipfamily_from_chipset( info )) {
- fprintf(stderr, "Unknown or non-radeon chipset -- cannot continue\n");
- fprintf(stderr, "==> Verify PCI BusID is correct in miniglx.conf\n");
- return 0;
- }
-
- info->frontPitch = ctx->shared.virtualWidth;
- info->LinearAddr = ctx->FBStart & 0xfc000000;
-
-
- if (!RADEONScreenInit( ctx, info ))
- return 0;
-
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void radeonHaltFBDev( DRIDriverContext *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-extern void radeonNotifyFocus( int );
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-const struct DRIDriverRec __driDriver = {
- radeonValidateMode,
- radeonPostValidateMode,
- radeonInitFBDev,
- radeonHaltFBDev,
- RADEONEngineShutdown,
- RADEONEngineRestore,
-#ifndef _EMBEDDED
- 0,
-#else
- radeonNotifyFocus,
-#endif
-};
diff --git a/src/mesa/drivers/dri/savage/Makefile b/src/mesa/drivers/dri/savage/Makefile
index 2e5c40802c1..53511552c6d 100644
--- a/src/mesa/drivers/dri/savage/Makefile
+++ b/src/mesa/drivers/dri/savage/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
LIBNAME = savage_dri.so
-# Doesn't exist yet.
-#MINIGLX_SOURCES = server/savage_dri.c
-
DRIVER_SOURCES = \
savage_xmesa.c \
savagedd.c \
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 74a001b7898..6f07ac275e8 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -179,7 +179,7 @@ savageInitDriver(__DRIscreen *sPriv)
}
/* Allocate the private area */
- savageScreen = (savageScreenPrivate *)_mesa_malloc(sizeof(savageScreenPrivate));
+ savageScreen = (savageScreenPrivate *)malloc(sizeof(savageScreenPrivate));
if (!savageScreen)
return GL_FALSE;
@@ -226,7 +226,7 @@ savageInitDriver(__DRIscreen *sPriv)
savageScreen->agpTextures.handle,
savageScreen->agpTextures.size,
(drmAddress *)&(savageScreen->agpTextures.map)) != 0) {
- _mesa_free(savageScreen);
+ free(savageScreen);
sPriv->private = NULL;
return GL_FALSE;
}
@@ -246,7 +246,7 @@ savageInitDriver(__DRIscreen *sPriv)
savageScreen->aperture.size,
(drmAddress *)&savageScreen->aperture.map) != 0)
{
- _mesa_free(savageScreen);
+ free(savageScreen);
sPriv->private = NULL;
return GL_FALSE;
}
@@ -282,7 +282,7 @@ savageDestroyScreen(__DRIscreen *sPriv)
/* free all option information */
driDestroyOptionInfo (&savageScreen->optionCache);
- _mesa_free(savageScreen);
+ free(savageScreen);
sPriv->private = NULL;
}
@@ -300,7 +300,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
savageScreen->sarea_priv_offset);
int textureSize[SAVAGE_NR_TEX_HEAPS];
int i;
- imesa = (savageContextPtr)_mesa_calloc(sizeof(savageContext));
+ imesa = (savageContextPtr)calloc(1, sizeof(savageContext));
if (!imesa) {
return GL_FALSE;
}
@@ -317,7 +317,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
shareCtx = NULL;
ctx = _mesa_create_context(mesaVis, shareCtx, &functions, imesa);
if (!ctx) {
- _mesa_free(imesa);
+ free(imesa);
return GL_FALSE;
}
driContextPriv->driverPrivate = imesa;
@@ -436,7 +436,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
if (ctx->Const.MaxTextureLevels <= 6) { /*spec requires at least 64x64*/
__driUtilMessage("Not enough texture memory. "
"Falling back to indirect rendering.");
- _mesa_free(imesa);
+ free(imesa);
return GL_FALSE;
}
@@ -574,7 +574,7 @@ savageDestroyContext(__DRIcontext *driContextPriv)
_mesa_destroy_context(imesa->glCtx);
/* no longer use vertex_dma_buf*/
- _mesa_free(imesa);
+ free(imesa);
}
}
diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c
index 394be44eac5..1523af4065f 100644
--- a/src/mesa/drivers/dri/savage/savagetex.c
+++ b/src/mesa/drivers/dri/savage/savagetex.c
@@ -603,7 +603,7 @@ _savage_texstore_a1114444(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
return GL_TRUE;
}
@@ -643,7 +643,7 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
return GL_TRUE;
}
@@ -1021,6 +1021,7 @@ static void savageUploadTexImages( savageContextPtr imesa, savageTexObjPtr t )
return;
}
+ assert(t->base.memBlock);
ofs = t->base.memBlock->ofs;
t->setup.physAddr = imesa->savageScreen->textureOffset[heap] + ofs;
t->bufAddr = (GLubyte *)imesa->savageScreen->texVirtual[heap] + ofs;
diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c
index a177a7d2b60..0050485e313 100644
--- a/src/mesa/drivers/dri/savage/savagetris.c
+++ b/src/mesa/drivers/dri/savage/savagetris.c
@@ -387,7 +387,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
diff --git a/src/mesa/drivers/dri/sis/Makefile b/src/mesa/drivers/dri/sis/Makefile
index ad009fc2398..6b4f938bab3 100644
--- a/src/mesa/drivers/dri/sis/Makefile
+++ b/src/mesa/drivers/dri/sis/Makefile
@@ -5,10 +5,6 @@ include $(TOP)/configs/current
LIBNAME = sis_dri.so
-
-# Not yet
-# MINIGLX_SOURCES = server/sis_dri.c
-
DRIVER_SOURCES = \
sis6326_state.c \
sis6326_clear.c \
diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c
index 4b41d78d82a..d109a8c41e9 100644
--- a/src/mesa/drivers/dri/sis/sis_tris.c
+++ b/src/mesa/drivers/dri/sis/sis_tris.c
@@ -375,7 +375,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
@@ -994,6 +993,7 @@ sisFlushPrimsLocked(sisContextPtr smesa)
MMIO(REG_3D_PrimitiveSet, smesa->dwPrimitiveSet);
}
while (smesa->vb_last < smesa->vb_cur) {
+ assert(sis_emit_func);
sis_emit_func(smesa, (char *)smesa->vb_last);
smesa->vb_last += incr;
}
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 40535b03b95..03c672ecf1b 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -155,7 +155,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
TRACE;
- psp = _mesa_calloc(sizeof(*psp));
+ psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
@@ -184,7 +184,7 @@ static void driDestroyScreen(__DRIscreen *psp)
TRACE;
if (psp) {
- _mesa_free(psp);
+ free(psp);
}
}
@@ -203,34 +203,28 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp)
static GLuint
choose_pixel_format(const GLvisual *v)
{
- if (v->rgbMode) {
- int depth = v->rgbBits;
-
- if (depth == 32
- && v->redMask == 0xff0000
- && v->greenMask == 0x00ff00
- && v->blueMask == 0x0000ff)
- return PF_A8R8G8B8;
- else if (depth == 24
- && v->redMask == 0xff0000
- && v->greenMask == 0x00ff00
- && v->blueMask == 0x0000ff)
- return PF_X8R8G8B8;
- else if (depth == 16
- && v->redMask == 0xf800
- && v->greenMask == 0x07e0
- && v->blueMask == 0x001f)
- return PF_R5G6B5;
- else if (depth == 8
- && v->redMask == 0x07
- && v->greenMask == 0x38
- && v->blueMask == 0xc0)
- return PF_R3G3B2;
- }
- else {
- if (v->indexBits == 8)
- return PF_CI8;
- }
+ int depth = v->rgbBits;
+
+ if (depth == 32
+ && v->redMask == 0xff0000
+ && v->greenMask == 0x00ff00
+ && v->blueMask == 0x0000ff)
+ return PF_A8R8G8B8;
+ else if (depth == 24
+ && v->redMask == 0xff0000
+ && v->greenMask == 0x00ff00
+ && v->blueMask == 0x0000ff)
+ return PF_X8R8G8B8;
+ else if (depth == 16
+ && v->redMask == 0xf800
+ && v->greenMask == 0x07e0
+ && v->blueMask == 0x001f)
+ return PF_R5G6B5;
+ else if (depth == 8
+ && v->redMask == 0x07
+ && v->greenMask == 0x38
+ && v->blueMask == 0xc0)
+ return PF_R3G3B2;
_mesa_problem( NULL, "unexpected format in %s", __FUNCTION__ );
return 0;
@@ -241,8 +235,8 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
{
TRACE;
- _mesa_free(rb->Data);
- _mesa_free(rb);
+ free(rb->Data);
+ free(rb);
}
static GLboolean
@@ -272,11 +266,11 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
TRACE;
- _mesa_free(rb->Data);
+ free(rb->Data);
swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
- rb->Data = _mesa_malloc(height * xrb->pitch);
+ rb->Data = malloc(height * xrb->pitch);
return GL_TRUE;
}
@@ -284,7 +278,7 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
static struct swrast_renderbuffer *
swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
{
- struct swrast_renderbuffer *xrb = _mesa_calloc(sizeof *xrb);
+ struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
GLuint pixel_format;
TRACE;
@@ -335,13 +329,6 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->bpp = 8;
break;
- case PF_CI8:
- xrb->Base.Format = MESA_FORMAT_CI8;
- xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT;
- xrb->Base._BaseFormat = GL_COLOR_INDEX;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
- xrb->bpp = 8;
- break;
default:
return NULL;
}
@@ -358,7 +345,7 @@ driCreateNewDrawable(__DRIscreen *screen,
TRACE;
- buf = _mesa_calloc(sizeof *buf);
+ buf = calloc(1, sizeof *buf);
if (!buf)
return NULL;
@@ -366,7 +353,7 @@ driCreateNewDrawable(__DRIscreen *screen,
buf->driScreenPriv = screen;
- buf->row = _mesa_malloc(MAX_WIDTH * 4);
+ buf->row = malloc(MAX_WIDTH * 4);
/* basic framebuffer setup */
_mesa_initialize_window_framebuffer(&buf->Base, &config->modes);
@@ -401,7 +388,7 @@ driDestroyDrawable(__DRIdrawable *buf)
if (buf) {
struct gl_framebuffer *fb = &buf->Base;
- _mesa_free(buf->row);
+ free(buf->row);
fb->DeletePending = GL_TRUE;
_mesa_reference_framebuffer(&fb, NULL);
@@ -525,7 +512,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
TRACE;
- ctx = _mesa_calloc(sizeof *ctx);
+ ctx = calloc(1, sizeof *ctx);
if (!ctx)
return NULL;
@@ -540,7 +527,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
if (!_mesa_initialize_context(&ctx->Base, &config->modes,
shared ? &shared->Base : NULL,
&functions, (void *) ctx)) {
- _mesa_free(ctx);
+ free(ctx);
return NULL;
}
diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h
index 1a5fb31d5a8..4722007f958 100644
--- a/src/mesa/drivers/dri/swrast/swrast_priv.h
+++ b/src/mesa/drivers/dri/swrast/swrast_priv.h
@@ -43,13 +43,13 @@
#define DEBUG_SPAN 0
#if DEBUG_CORE
-#define TRACE _mesa_printf("--> %s\n", __FUNCTION__)
+#define TRACE printf("--> %s\n", __FUNCTION__)
#else
#define TRACE
#endif
#if DEBUG_SPAN
-#define TRACE_SPAN _mesa_printf("--> %s\n", __FUNCTION__)
+#define TRACE_SPAN printf("--> %s\n", __FUNCTION__)
#else
#define TRACE_SPAN
#endif
@@ -116,11 +116,10 @@ swrast_renderbuffer(struct gl_renderbuffer *rb)
/**
* Pixel formats we support
*/
-#define PF_CI8 1 /**< Color Index mode */
-#define PF_A8R8G8B8 2 /**< 32bpp TrueColor: 8-A, 8-R, 8-G, 8-B bits */
-#define PF_R5G6B5 3 /**< 16bpp TrueColor: 5-R, 6-G, 5-B bits */
-#define PF_R3G3B2 4 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */
-#define PF_X8R8G8B8 5 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
+#define PF_A8R8G8B8 1 /**< 32bpp TrueColor: 8-A, 8-R, 8-G, 8-B bits */
+#define PF_R5G6B5 2 /**< 16bpp TrueColor: 5-R, 6-G, 5-B bits */
+#define PF_R3G3B2 3 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */
+#define PF_X8R8G8B8 4 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
/**
* Renderbuffer pitch alignment (in bits).
diff --git a/src/mesa/drivers/dri/swrast/swrast_span.c b/src/mesa/drivers/dri/swrast/swrast_span.c
index f8e503463fa..5290dc82b91 100644
--- a/src/mesa/drivers/dri/swrast/swrast_span.c
+++ b/src/mesa/drivers/dri/swrast/swrast_span.c
@@ -193,23 +193,6 @@ static const GLubyte kernel[16] = {
#include "swrast/s_spantemp.h"
-/* 8-bit color index */
-#define NAME(FUNC) FUNC##_CI8
-#define CI_MODE
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- *DST = VALUE[0]
-#define FETCH_PIXEL(DST, SRC) \
- DST = SRC[0]
-
-#include "swrast/s_spantemp.h"
-
-
/*
* Generate code for front-buffer span functions.
*/
@@ -282,23 +265,6 @@ static const GLubyte kernel[16] = {
#include "swrast_spantemp.h"
-/* 8-bit color index */
-#define NAME(FUNC) FUNC##_CI8_front
-#define CI_MODE
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)row;
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- *DST = VALUE[0]
-#define FETCH_PIXEL(DST, SRC) \
- DST = SRC[0]
-
-#include "swrast_spantemp.h"
-
-
/*
* Back-buffers are malloced memory and always private.
*
@@ -346,14 +312,6 @@ swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb,
xrb->Base.PutValues = put_values_R3G3B2;
xrb->Base.PutMonoValues = put_mono_values_R3G3B2;
break;
- case PF_CI8:
- xrb->Base.GetRow = get_row_CI8;
- xrb->Base.GetValues = get_values_CI8;
- xrb->Base.PutRow = put_row_CI8;
- xrb->Base.PutMonoRow = put_mono_row_CI8;
- xrb->Base.PutValues = put_values_CI8;
- xrb->Base.PutMonoValues = put_mono_values_CI8;
- break;
default:
assert(0);
return;
@@ -410,14 +368,6 @@ swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb,
xrb->Base.PutValues = put_values_R3G3B2_front;
xrb->Base.PutMonoValues = put_mono_values_R3G3B2_front;
break;
- case PF_CI8:
- xrb->Base.GetRow = get_row_CI8_front;
- xrb->Base.GetValues = get_values_CI8_front;
- xrb->Base.PutRow = put_row_CI8_front;
- xrb->Base.PutMonoRow = put_mono_row_CI8_front;
- xrb->Base.PutValues = put_values_CI8_front;
- xrb->Base.PutMonoValues = put_mono_values_CI8_front;
- break;
default:
assert(0);
return;
diff --git a/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/src/mesa/drivers/dri/swrast/swrast_spantemp.h
index e0cb2414294..879a0c12e76 100644
--- a/src/mesa/drivers/dri/swrast/swrast_spantemp.h
+++ b/src/mesa/drivers/dri/swrast/swrast_spantemp.h
@@ -98,7 +98,6 @@ GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
* Define the following macros before including this file:
* NAME(BASE) to generate the function name (i.e. add prefix or suffix)
* RB_TYPE the renderbuffer DataType
- * CI_MODE if set, color index mode, else RGBA
* SPAN_VARS to declare any local variables
* INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel
* INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel
@@ -113,9 +112,7 @@ GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
#include "main/macros.h"
-#ifdef CI_MODE
-#define RB_COMPONENTS 1
-#elif !defined(RB_COMPONENTS)
+#if !defined(RB_COMPONENTS)
#define RB_COMPONENTS 4
#endif
@@ -127,11 +124,7 @@ NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
#ifdef SPAN_VARS
SPAN_VARS
#endif
-#ifdef CI_MODE
- RB_TYPE *dest = (RB_TYPE *) values;
-#else
RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
-#endif
GLuint i;
char *row = swrast_drawable(ctx->ReadBuffer)->row;
INIT_PIXEL_PTR(pixel, x, y);
@@ -151,11 +144,7 @@ NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
#ifdef SPAN_VARS
SPAN_VARS
#endif
-#ifdef CI_MODE
- RB_TYPE *dest = (RB_TYPE *) values;
-#else
RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
-#endif
GLuint i;
for (i = 0; i < count; i++) {
RB_TYPE pixel[4];
@@ -198,7 +187,6 @@ NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
}
-#if !defined(CI_MODE)
static void
NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
@@ -237,7 +225,6 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
}
(void) rb;
}
-#endif
static void
@@ -319,7 +306,6 @@ NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
#undef NAME
#undef RB_TYPE
#undef RB_COMPONENTS
-#undef CI_MODE
#undef SPAN_VARS
#undef INIT_PIXEL_PTR
#undef INC_PIXEL_PTR
diff --git a/src/mesa/drivers/dri/tdfx/Makefile b/src/mesa/drivers/dri/tdfx/Makefile
index b9f25db4fe8..96bd8f8202f 100644
--- a/src/mesa/drivers/dri/tdfx/Makefile
+++ b/src/mesa/drivers/dri/tdfx/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
LIBNAME = tdfx_dri.so
-# not yet
-# MINIGLX_SOURCES = server/tdfx_dri.c
-
DRIVER_SOURCES = \
tdfx_context.c \
tdfx_dd.c \
diff --git a/src/mesa/drivers/dri/tdfx/server/tdfx_dri.c b/src/mesa/drivers/dri/tdfx/server/tdfx_dri.c
deleted file mode 100644
index 63fe875f59e..00000000000
--- a/src/mesa/drivers/dri/tdfx/server/tdfx_dri.c
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * Keith Whitwell
- * Daniel Borca
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-#include "imports.h"
-
-#include "dri_util.h"
-
-#include "tdfx_context.h"
-#include "tdfx_dri.h"
-#include "xf86drm.h"
-
-
-#define TILE_WIDTH 128
-#define TILE_HEIGHT 32
-
-#define CMDFIFO_PAGES 64
-
-
-static int
-calcBufferStride (int xres, int tiled, int cpp)
-{
- int strideInTiles;
-
- if (tiled) {
- /* Calculate tile width stuff */
- strideInTiles = (xres+TILE_WIDTH-1)/TILE_WIDTH;
-
- return strideInTiles*cpp*TILE_WIDTH;
- } else {
- return xres*cpp;
- }
-} /* calcBufferStride */
-
-
-static int
-calcBufferHeightInTiles (int yres)
-{
- int heightInTiles; /* Height of buffer in tiles */
-
- /* Calculate tile height stuff */
- heightInTiles = yres >> 5;
-
- if (yres & (TILE_HEIGHT - 1))
- heightInTiles++;
-
- return heightInTiles;
-
-} /* calcBufferHeightInTiles */
-
-
-static int
-calcBufferSize (int xres, int yres, int tiled, int cpp)
-{
- int stride, height, bufSize;
-
- if (tiled) {
- stride = calcBufferStride(xres, tiled, cpp);
- height = TILE_HEIGHT * calcBufferHeightInTiles(yres);
- } else {
- stride = xres*cpp;
- height = yres;
- }
-
- bufSize = stride * height;
-
- return bufSize;
-} /* calcBufferSize */
-
-
-static void allocateMemory (const DRIDriverContext *ctx, TDFXDRIPtr pTDFX)
-{
- int memRemaining, fifoSize, screenSizeInTiles;
- int fbSize;
- char *str;
- int pixmapCacheLinesMin;
- int cursorOffset, cursorSize;
-
- pTDFX->stride = calcBufferStride(pTDFX->width, !0, pTDFX->cpp);
-
- /* enough to do DVD */
- pixmapCacheLinesMin = ((720*480*pTDFX->cpp) +
- pTDFX->stride - 1)/pTDFX->stride;
-
- if (pTDFX->deviceID > PCI_CHIP_VOODOO3) {
- if ((pixmapCacheLinesMin + pTDFX->height) > 4095)
- pixmapCacheLinesMin = 4095 - pTDFX->height;
- } else {
- if ((pixmapCacheLinesMin + pTDFX->height) > 2047)
- pixmapCacheLinesMin = 2047 - pTDFX->height;
- }
-
- if (pTDFX->cpp!=3) {
- screenSizeInTiles=calcBufferSize(pTDFX->width, pTDFX->height,
- !0, pTDFX->cpp);
- }
- else {
- /* cpp==3 needs to bump up to 4 */
- screenSizeInTiles=calcBufferSize(pTDFX->width, pTDFX->height,
- !0, 4);
- }
-
- /*
- * Layout is:
- * cursor, fifo, fb, tex, bb, db
- */
-
- fbSize = (pTDFX->height + pixmapCacheLinesMin) * pTDFX->stride;
-
- memRemaining=(pTDFX->mem - 1) &~ 0xFFF;
- /* Note that a page is 4096 bytes, and a */
- /* tile is 32 x 128 = 4096 bytes. So, */
- /* page and tile boundaries are the same */
- /* Place the depth offset first, forcing */
- /* it to be on an *odd* page boundary. */
- pTDFX->depthOffset = (memRemaining - screenSizeInTiles) &~ 0xFFF;
- if ((pTDFX->depthOffset & (0x1 << 12)) == 0) {
- pTDFX->depthOffset -= (0x1 << 12);
- }
- /* Now, place the back buffer, forcing it */
- /* to be on an *even* page boundary. */
- pTDFX->backOffset = (pTDFX->depthOffset - screenSizeInTiles) &~ 0xFFF;
- if (pTDFX->backOffset & (0x1 << 12)) {
- pTDFX->backOffset -= (0x1 << 12);
- }
- /* Give the cmd fifo at least */
- /* CMDFIFO_PAGES pages, but no more than */
- /* 64. NOTE: Don't go higher than 64, as */
- /* there is suspect code in Glide3 ! */
- fifoSize = ((64 <= CMDFIFO_PAGES) ? 64 : CMDFIFO_PAGES) << 12;
-
- /* We give 4096 bytes to the cursor */
- cursorSize = 0/*4096*/;
- cursorOffset = 0;
-
- pTDFX->fifoOffset = cursorOffset + cursorSize;
- pTDFX->fifoSize = fifoSize;
- /* Now, place the front buffer, forcing */
- /* it to be on a page boundary too, just */
- /* for giggles. */
- pTDFX->fbOffset = pTDFX->fifoOffset + pTDFX->fifoSize;
- pTDFX->textureOffset = pTDFX->fbOffset + fbSize;
- if (pTDFX->depthOffset <= pTDFX->textureOffset ||
- pTDFX->backOffset <= pTDFX->textureOffset) {
- /*
- * pTDFX->textureSize < 0 means that the DRI is disabled. pTDFX->backOffset
- * is used to calculate the maximum amount of memory available for
- * 2D offscreen use. With DRI disabled, set this to the top of memory.
- */
-
- pTDFX->textureSize = -1;
- pTDFX->backOffset = pTDFX->mem;
- pTDFX->depthOffset = -1;
- fprintf(stderr,
- "Not enough video memory available for textures and depth buffer\n"
- "\tand/or back buffer. Disabling DRI. To use DRI try lower\n"
- "\tresolution modes and/or a smaller virtual screen size\n");
- } else {
- pTDFX->textureSize = pTDFX->backOffset - pTDFX->textureOffset;
- }
-}
-
-
-static int createScreen (DRIDriverContext *ctx, TDFXDRIPtr pTDFX)
-{
- int err;
-
- {
- int width_bytes = (ctx->shared.virtualWidth * ctx->cpp);
- int maxy = ctx->shared.fbSize / width_bytes;
-
-
- if (maxy <= ctx->shared.virtualHeight * 3) {
- fprintf(stderr,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (ctx->shared.virtualWidth * ctx->shared.virtualHeight *
- ctx->cpp * 3 + 1023) / 1024,
- ctx->shared.fbSize / 1024);
- return 0;
- }
- }
-
- ctx->shared.SAREASize = SAREA_MAX;
- pTDFX->regsSize = ctx->MMIOSize;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("tdfx", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
-#ifndef _EMBEDDED
- 0,
-#else
- DRM_READ_ONLY,
-#endif
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
-
- if (drmAddMap(ctx->drmFD,
- ctx->MMIOStart,
- ctx->MMIOSize,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &pTDFX->regs) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08lx\n", pTDFX->regs);
-
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the kernel data structures */
-
- /* Initialize kernel gart memory manager */
- allocateMemory(ctx, pTDFX);
-
- /* Initialize the SAREA private data structure */
-
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
-
-
- /* This is the struct passed to tdfx_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(TDFXDRIRec));
- ctx->driverClientMsgSize = sizeof(TDFXDRIRec);
- memcpy(ctx->driverClientMsg, pTDFX, ctx->driverClientMsgSize);
- pTDFX = (TDFXDRIPtr)ctx->driverClientMsg;
-
- /* Don't release the lock now - let the VT switch handler do it. */
-
- return 1;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa tdfxValidateMode().
- */
-static int tdfxValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa tdfxValidateMode().
- */
-static int tdfxPostValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int tdfxInitFBDev( DRIDriverContext *ctx )
-{
- TDFXDRIPtr pTDFX = calloc(1, sizeof(TDFXDRIRec));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- }
-
- ctx->driverPrivate = (void *)pTDFX;
-
- pTDFX->deviceID = ctx->chipset;
- pTDFX->width = ctx->shared.virtualWidth;
- pTDFX->height = ctx->shared.virtualHeight;
- pTDFX->cpp = ctx->cpp;
- pTDFX->mem = ctx->FBSize; /* ->shared.fbSize? mem probe? */
- pTDFX->sarea_priv_offset = sizeof(drm_sarea_t);
-
- if (!createScreen(ctx, pTDFX))
- return 0;
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void tdfxHaltFBDev( DRIDriverContext *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-/**
- * \brief Shutdown the drawing engine.
- *
- * \param ctx display handle
- *
- * Turns off the 3D engine & restores the graphics card
- * to a state that fbdev understands.
- */
-static int tdfxEngineShutdown( const DRIDriverContext *ctx )
-{
- fprintf(stderr, "%s: not implemented\n", __FUNCTION__);
- return 1;
-}
-
-
-/**
- * \brief Restore the drawing engine.
- *
- * \param ctx display handle
- *
- * Resets the graphics card and sets initial values for several registers of
- * the card's drawing engine.
- *
- * Turns on 3dfx
- */
-static int tdfxEngineRestore( const DRIDriverContext *ctx )
-{
- fprintf(stderr, "%s: not implemented\n", __FUNCTION__);
- return 1;
-}
-
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-struct DRIDriverRec __driDriver = {
- tdfxValidateMode,
- tdfxPostValidateMode,
- tdfxInitFBDev,
- tdfxHaltFBDev,
- tdfxEngineShutdown,
- tdfxEngineRestore,
- 0
-};
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
index 44496274188..5a7184056dc 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
@@ -519,7 +519,7 @@ tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y,
const GLint widthInBytes = width * 2;
GLint row;
for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
+ memcpy(dst, src, widthInBytes);
dst += dstStride;
src -= srcStride;
}
@@ -578,7 +578,7 @@ tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
{
GLint row;
for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
+ memcpy(dst, src, widthInBytes);
dst += dstStride;
src -= srcStride;
}
@@ -672,7 +672,7 @@ tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) {
GLint row;
for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
+ memcpy(dst, src, widthInBytes);
dst -= dstStride;
src += srcStride;
}
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
index d554bcdc92c..26de09503ad 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
@@ -295,6 +295,8 @@ tdfxSwapBuffers( __DRIdrawable *driDrawPriv )
}
#endif
+ assert(fxMesa);
+
if (fxMesa->scissoredClipRects) {
/* restore clip rects without scissor box */
fxMesa->Glide.grDRIPosition( driDrawPriv->x, driDrawPriv->y,
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c
index a17bcd952a1..3879d506ee1 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_span.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c
@@ -264,7 +264,7 @@ generate_vismask(const tdfxContextPtr fxMesa, GLint x, GLint y, GLint n,
GLint i, j;
/* Ensure we clear the visual mask */
- MEMSET(vismask, 0, n);
+ memset(vismask, 0, n);
/* turn on flags for all visible pixels */
for (i = 0; i < fxMesa->numClipRects; i++) {
@@ -273,14 +273,14 @@ generate_vismask(const tdfxContextPtr fxMesa, GLint x, GLint y, GLint n,
if (y >= rect->y1 && y < rect->y2) {
if (x >= rect->x1 && x + n <= rect->x2) {
/* common case, whole span inside cliprect */
- MEMSET(vismask, 1, n);
+ memset(vismask, 1, n);
return;
}
if (x < rect->x2 && x + n >= rect->x1) {
/* some of the span is inside the rect */
GLint start, end;
if (!initialized) {
- MEMSET(vismask, 0, n);
+ memset(vismask, 0, n);
initialized = GL_TRUE;
}
if (x < rect->x1)
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
index e31ae97b023..1c51452c104 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
@@ -1660,7 +1660,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target,
texImage->Data);
ti->padded = GL_TRUE;
} else {
- MEMCPY(texImage->Data, data, compressedSize);
+ memcpy(texImage->Data, data, compressedSize);
}
RevalidateTexture(ctx, texObj);
@@ -1707,7 +1707,7 @@ tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target,
rows = height / 4; /* [dBorca] hardcoded 4, but works for FXT1/DXTC */
for (i = 0; i < rows; i++) {
- MEMCPY(dest, data, srcRowStride);
+ memcpy(dest, data, srcRowStride);
dest += destRowStride;
data = (GLvoid *)((intptr_t)data + (intptr_t)srcRowStride);
}
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
index 6658b4d0c3e..b04f48c7a77 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
@@ -2142,11 +2142,13 @@ tdfxUpdateTextureBinding( GLcontext *ctx )
ctx->Texture.Unit[0]._ReallyEnabled == 0) {
/* Only unit 0 2D enabled */
if (shared->umaTexMemory) {
+ assert(ti0);
fxMesa->TexSource[0].StartAddress = ti0->tm[0]->startAddr;
fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[0].Info = &(ti0->info);
}
else {
+ assert(ti0);
if (ti0->LODblend && ti0->whichTMU == TDFX_TMU_SPLIT) {
fxMesa->TexSource[0].StartAddress = ti0->tm[TDFX_TMU0]->startAddr;
fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD;
@@ -2185,20 +2187,26 @@ tdfxUpdateTextureBinding( GLcontext *ctx )
/* Both 2D enabled */
if (shared->umaTexMemory) {
const FxU32 tmu0 = 0, tmu1 = 1;
+
+ assert(ti0);
fxMesa->TexSource[tmu0].StartAddress = ti0->tm[0]->startAddr;
fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[tmu0].Info = &(ti0->info);
+ assert(ti1);
fxMesa->TexSource[tmu1].StartAddress = ti1->tm[0]->startAddr;
fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[tmu1].Info = &(ti1->info);
}
else {
const FxU32 tmu0 = 0, tmu1 = 1;
+
+ assert(ti0);
fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr;
fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[tmu0].Info = &(ti0->info);
+ assert(ti1);
fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr;
fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
fxMesa->TexSource[tmu1].Info = &(ti1->info);
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c
index 88249888952..d65833c20b0 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c
@@ -320,7 +320,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 0
#define HAVE_HW_FLATSHADE 0
#define HAVE_BACK_COLORS 0
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.c b/src/mesa/drivers/dri/tdfx/tdfx_vb.c
index 0f3c877a3e7..546d89aa846 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_vb.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.c
@@ -331,7 +331,7 @@ void tdfxInitVB( GLcontext *ctx )
firsttime = 0;
}
- fxMesa->verts = ALIGN_MALLOC(size * sizeof(tdfxVertex), 32);
+ fxMesa->verts = _mesa_align_malloc(size * sizeof(tdfxVertex), 32);
fxMesa->vertexFormat = TDFX_LAYOUT_TINY;
fxMesa->SetupIndex = TDFX_XYZ_BIT|TDFX_RGBA_BIT;
}
@@ -341,7 +341,7 @@ void tdfxFreeVB( GLcontext *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
if (fxMesa->verts) {
- ALIGN_FREE(fxMesa->verts);
+ _mesa_align_free(fxMesa->verts);
fxMesa->verts = 0;
}
}
diff --git a/src/mesa/drivers/dri/unichrome/Makefile b/src/mesa/drivers/dri/unichrome/Makefile
index 344d34fce36..14cf9f30386 100644
--- a/src/mesa/drivers/dri/unichrome/Makefile
+++ b/src/mesa/drivers/dri/unichrome/Makefile
@@ -5,8 +5,6 @@ include $(TOP)/configs/current
LIBNAME = unichrome_dri.so
-MINIGLX_SOURCES = server/via_dri.c
-
DRIVER_SOURCES = \
via_context.c \
via_fb.c \
diff --git a/src/mesa/drivers/dri/unichrome/server/via_dri.c b/src/mesa/drivers/dri/unichrome/server/via_dri.c
deleted file mode 100644
index 74034485e28..00000000000
--- a/src/mesa/drivers/dri/unichrome/server/via_dri.c
+++ /dev/null
@@ -1,1251 +0,0 @@
-/*
- * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
- * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-#include "imports.h"
-
-#include "dri_util.h"
-
-#include "via_context.h"
-#include "via_dri.h"
-#include "via_driver.h"
-#include "xf86drm.h"
-
-static void VIAEnableMMIO(DRIDriverContext * ctx);
-static void VIADisableMMIO(DRIDriverContext * ctx);
-static void VIADisableExtendedFIFO(DRIDriverContext *ctx);
-static void VIAEnableExtendedFIFO(DRIDriverContext *ctx);
-static void VIAInitialize2DEngine(DRIDriverContext *ctx);
-static void VIAInitialize3DEngine(DRIDriverContext *ctx);
-
-static int VIADRIScreenInit(DRIDriverContext * ctx);
-static void VIADRICloseScreen(DRIDriverContext * ctx);
-static int VIADRIFinishScreenInit(DRIDriverContext * ctx);
-
-/* _SOLO : missing macros normally defined by X code */
-#define xf86DrvMsg(a, b, ...) fprintf(stderr, __VA_ARGS__)
-#define MMIO_IN8(base, addr) ((*(((volatile uint8_t*)base)+(addr)))+0)
-#define MMIO_OUT8(base, addr, val) ((*(((volatile uint8_t*)base)+(addr)))=((uint8_t)val))
-#define MMIO_OUT16(base, addr, val) ((*(volatile uint16_t*)(((uint8_t*)base)+(addr)))=((uint16_t)val))
-
-#define VIDEO 0
-#define AGP 1
-#define AGP_PAGE_SIZE 4096
-#define AGP_PAGES 8192
-#define AGP_SIZE (AGP_PAGE_SIZE * AGP_PAGES)
-#define AGP_CMDBUF_PAGES 512
-#define AGP_CMDBUF_SIZE (AGP_PAGE_SIZE * AGP_CMDBUF_PAGES)
-
-static char VIAKernelDriverName[] = "via";
-static char VIAClientDriverName[] = "unichrome";
-
-static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia);
-static int VIADRIPciInit(DRIDriverContext * ctx, VIAPtr pVia);
-static int VIADRIFBInit(DRIDriverContext * ctx, VIAPtr pVia);
-static int VIADRIKernelInit(DRIDriverContext * ctx, VIAPtr pVia);
-static int VIADRIMapInit(DRIDriverContext * ctx, VIAPtr pVia);
-
-static void VIADRIIrqInit( DRIDriverContext *ctx )
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI = pVia->devPrivate;
-
- pVIADRI->irqEnabled = drmGetInterruptFromBusID(pVia->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if ((drmCtlInstHandler(pVia->drmFD, pVIADRI->irqEnabled))) {
- xf86DrvMsg(pScreen->myNum, X_WARNING,
- "[drm] Failure adding irq handler. "
- "Falling back to irq-free operation.\n");
- pVIADRI->irqEnabled = 0;
- }
-
- if (pVIADRI->irqEnabled)
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] Irq handler installed, using IRQ %d.\n",
- pVIADRI->irqEnabled);
-}
-
-static void VIADRIIrqExit( DRIDriverContext *ctx ) {
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI = pVia->devPrivate;
-
- if (pVIADRI->irqEnabled) {
- if (drmCtlUninstHandler(pVia->drmFD)) {
- xf86DrvMsg(pScreen-myNum, X_INFO,"[drm] Irq handler uninstalled.\n");
- } else {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] Could not uninstall irq handler.\n");
- }
- }
-}
-
-static void VIADRIRingBufferCleanup(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI = pVia->devPrivate;
- drm_via_dma_init_t ringBufInit;
-
- if (pVIADRI->ringBufActive) {
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] Cleaning up DMA ring-buffer.\n");
- ringBufInit.func = VIA_CLEANUP_DMA;
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_DMA_INIT, &ringBufInit,
- sizeof(ringBufInit))) {
- xf86DrvMsg(pScreen->myNum, X_WARNING,
- "[drm] Failed to clean up DMA ring-buffer: %d\n", errno);
- }
- pVIADRI->ringBufActive = 0;
- }
-}
-
-static int VIADRIRingBufferInit(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI = pVia->devPrivate;
- drm_via_dma_init_t ringBufInit;
- drmVersionPtr drmVer;
-
- pVIADRI->ringBufActive = 0;
-
- if (NULL == (drmVer = drmGetVersion(pVia->drmFD))) {
- return GL_FALSE;
- }
-
- if (((drmVer->version_major <= 1) && (drmVer->version_minor <= 3))) {
- return GL_FALSE;
- }
-
- /*
- * Info frome code-snippet on DRI-DEVEL list; Erdi Chen.
- */
-
- switch (pVia->ChipId) {
- case PCI_CHIP_VT3259:
- ringBufInit.reg_pause_addr = 0x40c;
- break;
- default:
- ringBufInit.reg_pause_addr = 0x418;
- break;
- }
-
- ringBufInit.offset = pVia->agpSize;
- ringBufInit.size = AGP_CMDBUF_SIZE;
- ringBufInit.func = VIA_INIT_DMA;
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_DMA_INIT, &ringBufInit,
- sizeof(ringBufInit))) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] Failed to initialize DMA ring-buffer: %d\n", errno);
- return GL_FALSE;
- }
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] Initialized AGP ring-buffer, size 0x%lx at AGP offset 0x%lx.\n",
- ringBufInit.size, ringBufInit.offset);
-
- pVIADRI->ringBufActive = 1;
- return GL_TRUE;
-}
-
-static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia)
-{
- unsigned long agp_phys;
- drmAddress agpaddr;
- VIADRIPtr pVIADRI;
- pVIADRI = pVia->devPrivate;
- pVia->agpSize = 0;
-
- if (drmAgpAcquire(pVia->drmFD) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed %d\n", errno);
- return GL_FALSE;
- }
-
- if (drmAgpEnable(pVia->drmFD, drmAgpGetMode(pVia->drmFD)&~0x0) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n");
- return GL_FALSE;
- }
-
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] drmAgpEnabled succeeded\n");
-
- if (drmAgpAlloc(pVia->drmFD, AGP_SIZE, 0, &agp_phys, &pVia->agpHandle) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAgpAlloc failed\n");
- drmAgpRelease(pVia->drmFD);
- return GL_FALSE;
- }
-
- if (drmAgpBind(pVia->drmFD, pVia->agpHandle, 0) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAgpBind failed\n");
- drmAgpFree(pVia->drmFD, pVia->agpHandle);
- drmAgpRelease(pVia->drmFD);
-
- return GL_FALSE;
- }
-
- /*
- * Place the ring-buffer last in the AGP region, and restrict the
- * public map not to include the buffer for security reasons.
- */
-
- pVia->agpSize = AGP_SIZE - AGP_CMDBUF_SIZE;
- pVia->agpAddr = drmAgpBase(pVia->drmFD);
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agpAddr = 0x%08lx\n",pVia->agpAddr);
-
- pVIADRI->agp.size = pVia->agpSize;
- if (drmAddMap(pVia->drmFD, (drm_handle_t)0,
- pVIADRI->agp.size, DRM_AGP, 0,
- &pVIADRI->agp.handle) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] Failed to map public agp area\n");
- pVIADRI->agp.size = 0;
- return GL_FALSE;
- }
- /* Map AGP from kernel to Xserver - Not really needed */
- drmMap(pVia->drmFD, pVIADRI->agp.handle,pVIADRI->agp.size, &agpaddr);
-
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agpAddr = 0x%08lx\n", pVia->agpAddr);
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agpSize = 0x%08lx\n", pVia->agpSize);
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agp physical addr = 0x%08lx\n", agp_phys);
-
- {
- drm_via_agp_t agp;
- agp.offset = 0;
- agp.size = AGP_SIZE-AGP_CMDBUF_SIZE;
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_AGP_INIT, &agp,
- sizeof(drm_via_agp_t)) < 0) {
- drmUnmap(&agpaddr,pVia->agpSize);
- drmRmMap(pVia->drmFD,pVIADRI->agp.handle);
- drmAgpUnbind(pVia->drmFD, pVia->agpHandle);
- drmAgpFree(pVia->drmFD, pVia->agpHandle);
- drmAgpRelease(pVia->drmFD);
- return GL_FALSE;
- }
- }
-
- return GL_TRUE;
-}
-
-static int VIADRIFBInit(DRIDriverContext * ctx, VIAPtr pVia)
-{
- int FBSize = pVia->FBFreeEnd-pVia->FBFreeStart;
- int FBOffset = pVia->FBFreeStart;
- VIADRIPtr pVIADRI = pVia->devPrivate;
- pVIADRI->fbOffset = FBOffset;
- pVIADRI->fbSize = pVia->videoRambytes;
-
- {
- drm_via_fb_t fb;
- fb.offset = FBOffset;
- fb.size = FBSize;
-
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_FB_INIT, &fb,
- sizeof(drm_via_fb_t)) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] failed to init frame buffer area\n");
- return GL_FALSE;
- } else {
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] FBFreeStart= 0x%08x FBFreeEnd= 0x%08x "
- "FBSize= 0x%08x\n",
- pVia->FBFreeStart, pVia->FBFreeEnd, FBSize);
- return GL_TRUE;
- }
- }
-}
-
-static int VIADRIPciInit(DRIDriverContext * ctx, VIAPtr pVia)
-{
- return GL_TRUE;
-}
-
-static int VIADRIScreenInit(DRIDriverContext * ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI;
- int err;
-
-#if 0
- ctx->shared.SAREASize = ((sizeof(drm_sarea_t) + 0xfff) & 0x1000);
-#else
- if (sizeof(drm_sarea_t)+sizeof(drm_via_sarea_t) > SAREA_MAX) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Data does not fit in SAREA\n");
- return GL_FALSE;
- }
- ctx->shared.SAREASize = SAREA_MAX;
-#endif
-
- ctx->drmFD = drmOpen(VIAKernelDriverName, NULL);
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
- pVia->drmFD = ctx->drmFD;
-
- err = drmSetBusid(ctx->drmFD, ctx->pciBusID);
- if (err < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- err = drmAddMap(ctx->drmFD, 0, ctx->shared.SAREASize, DRM_SHM,
- DRM_CONTAINS_LOCK, &ctx->shared.hSAREA);
- if (err < 0) {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap(ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
-#ifndef _EMBEDDED
- 0,
-#else
- DRM_READ_ONLY,
-#endif
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
- pVIADRI = (VIADRIPtr) CALLOC(sizeof(VIADRIRec));
- if (!pVIADRI) {
- drmClose(ctx->drmFD);
- return GL_FALSE;
- }
- pVia->devPrivate = pVIADRI;
- ctx->driverClientMsg = pVIADRI;
- ctx->driverClientMsgSize = sizeof(*pVIADRI);
-
- /* DRIScreenInit doesn't add all the common mappings. Add additional mappings here. */
- if (!VIADRIMapInit(ctx, pVia)) {
- VIADRICloseScreen(ctx);
- return GL_FALSE;
- }
-
- pVIADRI->regs.size = VIA_MMIO_REGSIZE;
- pVIADRI->regs.handle = pVia->registerHandle;
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] mmio Registers = 0x%08lx\n",
- pVIADRI->regs.handle);
-
- if (drmMap(pVia->drmFD,
- pVIADRI->regs.handle,
- pVIADRI->regs.size,
- (drmAddress *)&pVia->MapBase) != 0)
- {
- VIADRICloseScreen(ctx);
- return GL_FALSE;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] mmio mapped.\n" );
-
- VIAEnableMMIO(ctx);
-
- /* Get video memory clock. */
- VGAOUT8(0x3D4, 0x3D);
- pVia->MemClk = (VGAIN8(0x3D5) & 0xF0) >> 4;
- xf86DrvMsg(0, X_INFO, "[dri] MemClk (0x%x)\n", pVia->MemClk);
-
- /* 3D rendering has noise if not enabled. */
- VIAEnableExtendedFIFO(ctx);
-
- VIAInitialize2DEngine(ctx);
-
- /* Must disable MMIO or 3D won't work. */
- VIADisableMMIO(ctx);
-
- VIAInitialize3DEngine(ctx);
-
- pVia->IsPCI = !VIADRIAgpInit(ctx, pVia);
-
- if (pVia->IsPCI) {
- VIADRIPciInit(ctx, pVia);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] use pci.\n" );
- }
- else
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] use agp.\n" );
-
- if (!(VIADRIFBInit(ctx, pVia))) {
- VIADRICloseScreen(ctx);
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[dri] frame buffer initialize fail .\n" );
- return GL_FALSE;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] frame buffer initialized.\n" );
-
- return VIADRIFinishScreenInit(ctx);
-}
-
-static void
-VIADRICloseScreen(DRIDriverContext * ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI=(VIADRIPtr)pVia->devPrivate;
-
- VIADRIRingBufferCleanup(ctx);
-
- if (pVia->MapBase) {
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Unmapping MMIO registers\n");
- drmUnmap(pVia->MapBase, pVIADRI->regs.size);
- }
-
- if (pVia->agpSize) {
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Freeing agp memory\n");
- drmAgpFree(pVia->drmFD, pVia->agpHandle);
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Releasing agp module\n");
- drmAgpRelease(pVia->drmFD);
- }
-
-#if 0
- if (pVia->DRIIrqEnable)
-#endif
- VIADRIIrqExit(ctx);
-}
-
-static int
-VIADRIFinishScreenInit(DRIDriverContext * ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI;
- int err;
-
- err = drmCreateContext(ctx->drmFD, &ctx->serverContext);
- if (err != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return GL_FALSE;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
-
- if (!VIADRIKernelInit(ctx, pVia)) {
- VIADRICloseScreen(ctx);
- return GL_FALSE;
- }
- xf86DrvMsg(pScreen->myNum, X_INFO, "[dri] kernel data initialized.\n");
-
- /* set SAREA value */
- {
- drm_via_sarea_t *saPriv;
-
- saPriv=(drm_via_sarea_t*)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- assert(saPriv);
- memset(saPriv, 0, sizeof(*saPriv));
- saPriv->ctxOwner = -1;
- }
- pVIADRI=(VIADRIPtr)pVia->devPrivate;
- pVIADRI->deviceID=pVia->Chipset;
- pVIADRI->width=ctx->shared.virtualWidth;
- pVIADRI->height=ctx->shared.virtualHeight;
- pVIADRI->mem=ctx->shared.fbSize;
- pVIADRI->bytesPerPixel= (ctx->bpp+7) / 8;
- pVIADRI->sarea_priv_offset = sizeof(drm_sarea_t);
- /* TODO */
- pVIADRI->scrnX=pVIADRI->width;
- pVIADRI->scrnY=pVIADRI->height;
-
- /* Initialize IRQ */
-#if 0
- if (pVia->DRIIrqEnable)
-#endif
- VIADRIIrqInit(ctx);
-
- pVIADRI->ringBufActive = 0;
- VIADRIRingBufferInit(ctx);
-
- return GL_TRUE;
-}
-
-/* Initialize the kernel data structures. */
-static int VIADRIKernelInit(DRIDriverContext * ctx, VIAPtr pVia)
-{
- drm_via_init_t drmInfo;
- memset(&drmInfo, 0, sizeof(drm_via_init_t));
- drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
- drmInfo.func = VIA_INIT_MAP;
- drmInfo.fb_offset = pVia->FrameBufferBase;
- drmInfo.mmio_offset = pVia->registerHandle;
- if (pVia->IsPCI)
- drmInfo.agpAddr = (uint32_t)NULL;
- else
- drmInfo.agpAddr = (uint32_t)pVia->agpAddr;
-
- if ((drmCommandWrite(pVia->drmFD, DRM_VIA_MAP_INIT,&drmInfo,
- sizeof(drm_via_init_t))) < 0)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-/* Add a map for the MMIO registers */
-static int VIADRIMapInit(DRIDriverContext * ctx, VIAPtr pVia)
-{
- int flags = 0;
-
- if (drmAddMap(pVia->drmFD, pVia->MmioBase, VIA_MMIO_REGSIZE,
- DRM_REGISTERS, flags, &pVia->registerHandle) < 0) {
- return GL_FALSE;
- }
-
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] register handle = 0x%08lx\n", pVia->registerHandle);
-
- return GL_TRUE;
-}
-
-static int viaValidateMode(const DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
-
- return 1;
-}
-
-static int viaPostValidateMode(const DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
-
- return 1;
-}
-
-static void VIAEnableMMIO(DRIDriverContext * ctx)
-{
- /*vgaHWPtr hwp = VGAHWPTR(ctx);*/
- VIAPtr pVia = VIAPTR(ctx);
- unsigned char val;
-
-#if 0
- if (xf86IsPrimaryPci(pVia->PciInfo)) {
- /* If we are primary card, we still use std vga port. If we use
- * MMIO, system will hang in vgaHWSave when our card used in
- * PLE and KLE (integrated Trident MVP4)
- */
- vgaHWSetStdFuncs(hwp);
- }
- else {
- vgaHWSetMmioFuncs(hwp, pVia->MapBase, 0x8000);
- }
-#endif
-
- val = VGAIN8(0x3c3);
- VGAOUT8(0x3c3, val | 0x01);
- val = VGAIN8(0x3cc);
- VGAOUT8(0x3c2, val | 0x01);
-
- /* Unlock Extended IO Space */
- VGAOUT8(0x3c4, 0x10);
- VGAOUT8(0x3c5, 0x01);
-
- /* Enable MMIO */
- if(!pVia->IsSecondary) {
- VGAOUT8(0x3c4, 0x1a);
- val = VGAIN8(0x3c5);
-#ifdef DEBUG
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "primary val = %x\n", val);
-#endif
- VGAOUT8(0x3c5, val | 0x68);
- }
- else {
- VGAOUT8(0x3c4, 0x1a);
- val = VGAIN8(0x3c5);
-#ifdef DEBUG
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "secondary val = %x\n", val);
-#endif
- VGAOUT8(0x3c5, val | 0x38);
- }
-
- /* Unlock CRTC registers */
- VGAOUT8(0x3d4, 0x47);
- VGAOUT8(0x3d5, 0x00);
-
- return;
-}
-
-static void VIADisableMMIO(DRIDriverContext * ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- unsigned char val;
-
- VGAOUT8(0x3c4, 0x1a);
- val = VGAIN8(0x3c5);
- VGAOUT8(0x3c5, val & 0x97);
-
- return;
-}
-
-static void VIADisableExtendedFIFO(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- uint32_t dwGE230, dwGE298;
-
- /* Cause of exit XWindow will dump back register value, others chipset no
- * need to set extended fifo value */
- if (pVia->Chipset == VIA_CLE266 && pVia->ChipRev < 15 &&
- (ctx->shared.virtualWidth > 1024 || pVia->HasSecondary)) {
- /* Turn off Extend FIFO */
- /* 0x298[29] */
- dwGE298 = VIAGETREG(0x298);
- VIASETREG(0x298, dwGE298 | 0x20000000);
- /* 0x230[21] */
- dwGE230 = VIAGETREG(0x230);
- VIASETREG(0x230, dwGE230 & ~0x00200000);
- /* 0x298[29] */
- dwGE298 = VIAGETREG(0x298);
- VIASETREG(0x298, dwGE298 & ~0x20000000);
- }
-}
-
-static void VIAEnableExtendedFIFO(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- uint8_t bRegTemp;
- uint32_t dwGE230, dwGE298;
-
- switch (pVia->Chipset) {
- case VIA_CLE266:
- if (pVia->ChipRev > 14) { /* For 3123Cx */
- if (pVia->HasSecondary) { /* SAMM or DuoView case */
- if (ctx->shared.virtualWidth >= 1024)
- {
- /* 3c5.16[0:5] */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x1C;
- VGAOUT8(0x3C5, bRegTemp);
- /* 3c5.17[0:6] */
- VGAOUT8(0x3C4, 0x17);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x7F;
- bRegTemp |= 0x3F;
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- }
- else /* Single view or Simultaneoue case */
- {
- if (ctx->shared.virtualWidth > 1024)
- {
- /* 3c5.16[0:5] */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- VGAOUT8(0x3C5, bRegTemp);
- /* 3c5.17[0:6] */
- VGAOUT8(0x3C4, 0x17);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x7F;
- bRegTemp |= 0x2F;
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- }
- /* 3c5.18[0:5] */
- VGAOUT8(0x3C4, 0x18);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- bRegTemp |= 0x40; /* force the preq always higher than treq */
- VGAOUT8(0x3C5, bRegTemp);
- }
- else { /* for 3123Ax */
- if (ctx->shared.virtualWidth > 1024 || pVia->HasSecondary) {
- /* Turn on Extend FIFO */
- /* 0x298[29] */
- dwGE298 = VIAGETREG(0x298);
- VIASETREG(0x298, dwGE298 | 0x20000000);
- /* 0x230[21] */
- dwGE230 = VIAGETREG(0x230);
- VIASETREG(0x230, dwGE230 | 0x00200000);
- /* 0x298[29] */
- dwGE298 = VIAGETREG(0x298);
- VIASETREG(0x298, dwGE298 & ~0x20000000);
-
- /* 3c5.16[0:5] */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- /* bRegTemp |= 0x10; */
- VGAOUT8(0x3C5, bRegTemp);
- /* 3c5.17[0:6] */
- VGAOUT8(0x3C4, 0x17);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x7F;
- bRegTemp |= 0x2F;
- /*bRegTemp |= 0x1F;*/
- VGAOUT8(0x3C5, bRegTemp);
- /* 3c5.18[0:5] */
- VGAOUT8(0x3C4, 0x18);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- bRegTemp |= 0x40; /* force the preq always higher than treq */
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- }
- break;
- case VIA_KM400:
- if (pVia->HasSecondary) { /* SAMM or DuoView case */
- if ((ctx->shared.virtualWidth >= 1600) &&
- (pVia->MemClk <= VIA_MEM_DDR200)) {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5, 0x1C);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x09);
- VGAOUT8(0x3C5, bRegTemp);
- }
- else {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5,0x3F);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x1C);
- VGAOUT8(0x3C5, bRegTemp);
- }
- /* 3c5.18[0:5] */
- VGAOUT8(0x3C4, 0x18);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- bRegTemp |= 0x40; /* force the preq always higher than treq */
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- else {
- if ( (ctx->shared.virtualWidth > 1024) && (ctx->shared.virtualWidth <= 1280) )
- {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5, 0x3F);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x17);
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- else if ((ctx->shared.virtualWidth > 1280))
- {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5, 0x3F);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x1C);
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- else
- {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5, 0x3F);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x10);
- VGAOUT8(0x3C5, bRegTemp);
- }
- /* 3c5.18[0:5] */
- VGAOUT8(0x3C4, 0x18);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- bRegTemp |= 0x40; /* force the preq always higher than treq */
- VGAOUT8(0x3C5, bRegTemp);
- }
- break;
- case VIA_K8M800:
- /*=* R1 Display FIFO depth (384 /8 -1 -> 0xbf) SR17[7:0] (8bits) *=*/
- VGAOUT8(0x3c4, 0x17);
- VGAOUT8(0x3c5, 0xbf);
-
- /*=* R2 Display fetch datum threshold value (328/4 -> 0x52)
- SR16[5:0], SR16[7] (7bits) *=*/
- VGAOUT8(0x3c4, 0x16);
- bRegTemp = VGAIN8(0x3c5) & ~0xBF;
- bRegTemp |= (0x52 & 0x3F);
- bRegTemp |= ((0x52 & 0x40) << 1);
- VGAOUT8(0x3c5, bRegTemp);
-
- /*=* R3 Switch to the highest agent threshold value (74 -> 0x4a)
- SR18[5:0], SR18[7] (7bits) *=*/
- VGAOUT8(0x3c4, 0x18);
- bRegTemp = VGAIN8(0x3c5) & ~0xBF;
- bRegTemp |= (0x4a & 0x3F);
- bRegTemp |= ((0x4a & 0x40) << 1);
- VGAOUT8(0x3c5, bRegTemp);
-#if 0
- /*=* R4 Fetch Number for a scan line (unit: 8 bytes)
- SR1C[7:0], SR1D[1:0] (10bits) *=*/
- wRegTemp = (pBIOSInfo->offsetWidthByQWord >> 1) + 4;
- VGAOUT8(0x3c4, 0x1c);
- VGAOUT8(0x3c5, (uint8_t)(wRegTemp & 0xFF));
- VGAOUT8(0x3c4, 0x1d);
- bRegTemp = VGAIN8(0x3c5) & ~0x03;
- VGAOUT8(0x3c5, bRegTemp | ((wRegTemp & 0x300) >> 8));
-#endif
- if (ctx->shared.virtualWidth >= 1400 && ctx->bpp == 32)
- {
- /*=* Max. length for a request SR22[4:0] (64/4 -> 0x10) *=*/
- VGAOUT8(0x3c4, 0x22);
- bRegTemp = VGAIN8(0x3c5) & ~0x1F;
- VGAOUT8(0x3c5, bRegTemp | 0x10);
- }
- else
- {
- /*=* Max. length for a request SR22[4:0]
- (128/4 -> over flow 0x0) *=*/
- VGAOUT8(0x3c4, 0x22);
- bRegTemp = VGAIN8(0x3c5) & ~0x1F;
- VGAOUT8(0x3c5, bRegTemp);
- }
- break;
- case VIA_PM800:
- /*=* R1 Display FIFO depth (96-1 -> 0x5f) SR17[7:0] (8bits) *=*/
- VGAOUT8(0x3c4, 0x17);
- VGAOUT8(0x3c5, 0x5f);
-
- /*=* R2 Display fetch datum threshold value (32 -> 0x20)
- SR16[5:0], SR16[7] (7bits) *=*/
- VGAOUT8(0x3c4, 0x16);
- bRegTemp = VGAIN8(0x3c5) & ~0xBF;
- bRegTemp |= (0x20 & 0x3F);
- bRegTemp |= ((0x20 & 0x40) << 1);
- VGAOUT8(0x3c5, bRegTemp);
-
- /*=* R3 Switch to the highest agent threshold value (16 -> 0x10)
- SR18[5:0], SR18[7] (7bits) *=*/
- VGAOUT8(0x3c4, 0x18);
- bRegTemp = VGAIN8(0x3c5) & ~0xBF;
- bRegTemp |= (0x10 & 0x3F);
- bRegTemp |= ((0x10 & 0x40) << 1);
- VGAOUT8(0x3c5, bRegTemp);
-#if 0
- /*=* R4 Fetch Number for a scan line (unit: 8 bytes)
- SR1C[7:0], SR1D[1:0] (10bits) *=*/
- wRegTemp = (pBIOSInfo->offsetWidthByQWord >> 1) + 4;
- VGAOUT8(0x3c4, 0x1c);
- VGAOUT8(0x3c5, (uint8_t)(wRegTemp & 0xFF));
- VGAOUT8(0x3c4, 0x1d);
- bRegTemp = VGAIN8(0x3c5) & ~0x03;
- VGAOUT8(0x3c5, bRegTemp | ((wRegTemp & 0x300) >> 8));
-#endif
- if (ctx->shared.virtualWidth >= 1400 && ctx->bpp == 32)
- {
- /*=* Max. length for a request SR22[4:0] (64/4 -> 0x10) *=*/
- VGAOUT8(0x3c4, 0x22);
- bRegTemp = VGAIN8(0x3c5) & ~0x1F;
- VGAOUT8(0x3c5, bRegTemp | 0x10);
- }
- else
- {
- /*=* Max. length for a request SR22[4:0] (0x1F) *=*/
- VGAOUT8(0x3c4, 0x22);
- bRegTemp = VGAIN8(0x3c5) & ~0x1F;
- VGAOUT8(0x3c5, bRegTemp | 0x1F);
- }
- break;
- default:
- break;
- }
-}
-
-static void VIAInitialize2DEngine(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- uint32_t dwVQStartAddr, dwVQEndAddr;
- uint32_t dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH;
- uint32_t dwGEMode;
-
- /* init 2D engine regs to reset 2D engine */
- VIASETREG(0x04, 0x0);
- VIASETREG(0x08, 0x0);
- VIASETREG(0x0c, 0x0);
- VIASETREG(0x10, 0x0);
- VIASETREG(0x14, 0x0);
- VIASETREG(0x18, 0x0);
- VIASETREG(0x1c, 0x0);
- VIASETREG(0x20, 0x0);
- VIASETREG(0x24, 0x0);
- VIASETREG(0x28, 0x0);
- VIASETREG(0x2c, 0x0);
- VIASETREG(0x30, 0x0);
- VIASETREG(0x34, 0x0);
- VIASETREG(0x38, 0x0);
- VIASETREG(0x3c, 0x0);
- VIASETREG(0x40, 0x0);
-
- VIADisableMMIO(ctx);
-
- /* Init AGP and VQ regs */
- VIASETREG(0x43c, 0x00100000);
- VIASETREG(0x440, 0x00000000);
- VIASETREG(0x440, 0x00333004);
- VIASETREG(0x440, 0x60000000);
- VIASETREG(0x440, 0x61000000);
- VIASETREG(0x440, 0x62000000);
- VIASETREG(0x440, 0x63000000);
- VIASETREG(0x440, 0x64000000);
- VIASETREG(0x440, 0x7D000000);
-
- VIASETREG(0x43c, 0xfe020000);
- VIASETREG(0x440, 0x00000000);
-
- if (pVia->VQStart != 0) {
- /* Enable VQ */
- dwVQStartAddr = pVia->VQStart;
- dwVQEndAddr = pVia->VQEnd;
- dwVQStartL = 0x50000000 | (dwVQStartAddr & 0xFFFFFF);
- dwVQEndL = 0x51000000 | (dwVQEndAddr & 0xFFFFFF);
- dwVQStartEndH = 0x52000000 | ((dwVQStartAddr & 0xFF000000) >> 24) |
- ((dwVQEndAddr & 0xFF000000) >> 16);
- dwVQLen = 0x53000000 | (VIA_VQ_SIZE >> 3);
-
- VIASETREG(0x43c, 0x00fe0000);
- VIASETREG(0x440, 0x080003fe);
- VIASETREG(0x440, 0x0a00027c);
- VIASETREG(0x440, 0x0b000260);
- VIASETREG(0x440, 0x0c000274);
- VIASETREG(0x440, 0x0d000264);
- VIASETREG(0x440, 0x0e000000);
- VIASETREG(0x440, 0x0f000020);
- VIASETREG(0x440, 0x1000027e);
- VIASETREG(0x440, 0x110002fe);
- VIASETREG(0x440, 0x200f0060);
-
- VIASETREG(0x440, 0x00000006);
- VIASETREG(0x440, 0x40008c0f);
- VIASETREG(0x440, 0x44000000);
- VIASETREG(0x440, 0x45080c04);
- VIASETREG(0x440, 0x46800408);
-
- VIASETREG(0x440, dwVQStartEndH);
- VIASETREG(0x440, dwVQStartL);
- VIASETREG(0x440, dwVQEndL);
- VIASETREG(0x440, dwVQLen);
- }
- else {
- /* Diable VQ */
- VIASETREG(0x43c, 0x00fe0000);
- VIASETREG(0x440, 0x00000004);
- VIASETREG(0x440, 0x40008c0f);
- VIASETREG(0x440, 0x44000000);
- VIASETREG(0x440, 0x45080c04);
- VIASETREG(0x440, 0x46800408);
- }
-
- dwGEMode = 0;
-
- switch (ctx->bpp) {
- case 16:
- dwGEMode |= VIA_GEM_16bpp;
- break;
- case 32:
- dwGEMode |= VIA_GEM_32bpp;
- break;
- default:
- dwGEMode |= VIA_GEM_8bpp;
- break;
- }
-
-#if 0
- switch (ctx->shared.virtualWidth) {
- case 800:
- dwGEMode |= VIA_GEM_800;
- break;
- case 1024:
- dwGEMode |= VIA_GEM_1024;
- break;
- case 1280:
- dwGEMode |= VIA_GEM_1280;
- break;
- case 1600:
- dwGEMode |= VIA_GEM_1600;
- break;
- case 2048:
- dwGEMode |= VIA_GEM_2048;
- break;
- default:
- dwGEMode |= VIA_GEM_640;
- break;
- }
-#endif
-
- VIAEnableMMIO(ctx);
-
- /* Set BPP and Pitch */
- VIASETREG(VIA_REG_GEMODE, dwGEMode);
-
- /* Set Src and Dst base address and pitch, pitch is qword */
- VIASETREG(VIA_REG_SRCBASE, 0x0);
- VIASETREG(VIA_REG_DSTBASE, 0x0);
- VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
- ((ctx->shared.virtualWidth * ctx->bpp >> 3) >> 3) |
- (((ctx->shared.virtualWidth * ctx->bpp >> 3) >> 3) << 16));
-}
-
-static int b3DRegsInitialized = 0;
-
-static void VIAInitialize3DEngine(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- int i;
-
- if (!b3DRegsInitialized)
- {
-
- VIASETREG(0x43C, 0x00010000);
-
- for (i = 0; i <= 0x7D; i++)
- {
- VIASETREG(0x440, (uint32_t) i << 24);
- }
-
- VIASETREG(0x43C, 0x00020000);
-
- for (i = 0; i <= 0x94; i++)
- {
- VIASETREG(0x440, (uint32_t) i << 24);
- }
-
- VIASETREG(0x440, 0x82400000);
-
- VIASETREG(0x43C, 0x01020000);
-
-
- for (i = 0; i <= 0x94; i++)
- {
- VIASETREG(0x440, (uint32_t) i << 24);
- }
-
- VIASETREG(0x440, 0x82400000);
- VIASETREG(0x43C, 0xfe020000);
-
- for (i = 0; i <= 0x03; i++)
- {
- VIASETREG(0x440, (uint32_t) i << 24);
- }
-
- VIASETREG(0x43C, 0x00030000);
-
- for (i = 0; i <= 0xff; i++)
- {
- VIASETREG(0x440, 0);
- }
- VIASETREG(0x43C, 0x00100000);
- VIASETREG(0x440, 0x00333004);
- VIASETREG(0x440, 0x10000002);
- VIASETREG(0x440, 0x60000000);
- VIASETREG(0x440, 0x61000000);
- VIASETREG(0x440, 0x62000000);
- VIASETREG(0x440, 0x63000000);
- VIASETREG(0x440, 0x64000000);
-
- VIASETREG(0x43C, 0x00fe0000);
-
- if (pVia->ChipRev >= 3 )
- VIASETREG(0x440,0x40008c0f);
- else
- VIASETREG(0x440,0x4000800f);
-
- VIASETREG(0x440,0x44000000);
- VIASETREG(0x440,0x45080C04);
- VIASETREG(0x440,0x46800408);
- VIASETREG(0x440,0x50000000);
- VIASETREG(0x440,0x51000000);
- VIASETREG(0x440,0x52000000);
- VIASETREG(0x440,0x53000000);
-
- b3DRegsInitialized = 1;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "3D Engine has been initialized.\n");
- }
-
- VIASETREG(0x43C,0x00fe0000);
- VIASETREG(0x440,0x08000001);
- VIASETREG(0x440,0x0A000183);
- VIASETREG(0x440,0x0B00019F);
- VIASETREG(0x440,0x0C00018B);
- VIASETREG(0x440,0x0D00019B);
- VIASETREG(0x440,0x0E000000);
- VIASETREG(0x440,0x0F000000);
- VIASETREG(0x440,0x10000000);
- VIASETREG(0x440,0x11000000);
- VIASETREG(0x440,0x20000000);
-}
-
-static int
-WaitIdleCLE266(VIAPtr pVia)
-{
- int loop = 0;
-
- /*mem_barrier();*/
-
- while (!(VIAGETREG(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && (loop++ < MAXLOOP))
- ;
-
- while ((VIAGETREG(VIA_REG_STATUS) &
- (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | VIA_3D_ENG_BUSY)) &&
- (loop++ < MAXLOOP))
- ;
-
- return loop >= MAXLOOP;
-}
-
-static int viaInitFBDev(DRIDriverContext *ctx)
-{
- VIAPtr pVia = CALLOC(sizeof(*pVia));
-
- ctx->driverPrivate = (void *)pVia;
-
- switch (ctx->chipset) {
- case PCI_CHIP_CLE3122:
- case PCI_CHIP_CLE3022:
- pVia->Chipset = VIA_CLE266;
- break;
- case PCI_CHIP_VT7205:
- case PCI_CHIP_VT3205:
- pVia->Chipset = VIA_KM400;
- break;
- case PCI_CHIP_VT3204:
- case PCI_CHIP_VT3344:
- pVia->Chipset = VIA_K8M800;
- break;
- case PCI_CHIP_VT3259:
- pVia->Chipset = VIA_PM800;
- break;
- default:
- xf86DrvMsg(0, X_ERROR, "VIA: Unknown device ID (0x%x)\n", ctx->chipset);
- }
-
- /* _SOLO TODO XXX need to read ChipRev too */
- pVia->ChipRev = 0;
-
- pVia->videoRambytes = ctx->shared.fbSize;
- pVia->MmioBase = ctx->MMIOStart;
- pVia->FrameBufferBase = ctx->FBStart & 0xfc000000;
-
- pVia->FBFreeStart = ctx->shared.virtualWidth * ctx->cpp *
- ctx->shared.virtualHeight;
-
-#if 1
- /* Alloc a second framebuffer for the second head */
- pVia->FBFreeStart += ctx->shared.virtualWidth * ctx->cpp *
- ctx->shared.virtualHeight;
-#endif
-
- pVia->VQStart = pVia->FBFreeStart;
- pVia->VQEnd = pVia->FBFreeStart + VIA_VQ_SIZE - 1;
-
- pVia->FBFreeStart += VIA_VQ_SIZE;
-
- pVia->FBFreeEnd = pVia->videoRambytes;
-
- if (!VIADRIScreenInit(ctx))
- return 0;
-
- return 1;
-}
-
-static void viaHaltFBDev(DRIDriverContext *ctx)
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-static int viaEngineShutdown(const DRIDriverContext *ctx)
-{
- return 1;
-}
-
-static int viaEngineRestore(const DRIDriverContext *ctx)
-{
- return 1;
-}
-
-const struct DRIDriverRec __driDriver =
-{
- viaValidateMode,
- viaPostValidateMode,
- viaInitFBDev,
- viaHaltFBDev,
- viaEngineShutdown,
- viaEngineRestore,
- 0,
-};
-
diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c
index e4fb29f6c60..bebf0619d0b 100644
--- a/src/mesa/drivers/dri/unichrome/via_fb.c
+++ b/src/mesa/drivers/dri/unichrome/via_fb.c
@@ -156,7 +156,7 @@ via_alloc_texture(struct via_context *vmesa,
}
else if (t->memType == VIA_MEM_SYSTEM) {
- t->bufAddr = _mesa_malloc(t->size);
+ t->bufAddr = malloc(t->size);
if (!t->bufAddr)
goto cleanup;
@@ -226,8 +226,8 @@ via_free_texture(struct via_context *vmesa, struct via_tex_buffer *t)
else if (t->memType == VIA_MEM_SYSTEM) {
remove_from_list(t);
vmesa->total_alloc[t->memType] -= t->size;
- _mesa_free(t->bufAddr);
- _mesa_free(t);
+ free(t->bufAddr);
+ free(t);
}
else if (t->index && viaCheckBreadcrumb(vmesa, t->lastUsed)) {
via_do_free_texture( vmesa, t );
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index c9a31f3383c..25aad1b204e 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -757,6 +757,8 @@ static void via_emit_cliprect(struct via_context *vmesa,
vb[0] = HC_HEADER2;
vb[1] = (HC_ParaType_NotTex << 16);
+ assert(vmesa->driDrawable);
+
if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) {
vb[2] = (HC_SubA_HClipTB << 24) | 0x0;
vb[3] = (HC_SubA_HClipLR << 24) | 0x0;
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c
index 917f9754669..a64f093326f 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -951,11 +951,11 @@ void viaInitTextureFuncs(struct dd_function_table * functions)
* Note that this function is currently disabled in via_tris.c too.
*/
if (getenv("VIA_NO_SSE"))
- functions->TextureMemCpy = _mesa_memcpy;
+ functions->TextureMemCpy = memcpy;
else
functions->TextureMemCpy = via_sse_memcpy;
#else
- functions->TextureMemCpy = _mesa_memcpy;
+ functions->TextureMemCpy = memcpy;
#endif
functions->UpdateTexturePalette = 0;
diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c
index 01359d51ea6..be3c9a770ff 100644
--- a/src/mesa/drivers/dri/unichrome/via_tris.c
+++ b/src/mesa/drivers/dri/unichrome/via_tris.c
@@ -257,7 +257,6 @@ static struct {
#define DO_POINTS 1
#define DO_FULL_QUAD 1
-#define HAVE_RGBA 1
#define HAVE_SPEC 1
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c
index 1a56b2395fa..0ea2796eaab 100644
--- a/src/mesa/drivers/fbdev/glfbdev.c
+++ b/src/mesa/drivers/fbdev/glfbdev.c
@@ -70,7 +70,6 @@
#define PF_B8G8R8A8 2
#define PF_B5G6R5 3
#define PF_B5G5R5 4
-#define PF_CI8 5
/**
@@ -264,25 +263,6 @@ viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
#include "swrast/s_spantemp.h"
-/* 8-bit color index */
-#define NAME(PREFIX) PREFIX##_CI8
-#define CI_MODE
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = frb->bottom - (Y) * frb->rowStride + (X)
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- *DST = VALUE[0]
-#define FETCH_PIXEL(DST, SRC) \
- DST = SRC[0]
-
-#include "swrast/s_spantemp.h"
-
-
-
-
/**********************************************************************/
/* Public API functions */
/**********************************************************************/
@@ -330,7 +310,7 @@ glFBDevGetProcAddress( const char *procName )
};
const struct name_address *entry;
for (entry = functions; entry->name; entry++) {
- if (_mesa_strcmp(entry->name, procName) == 0) {
+ if (strcmp(entry->name, procName) == 0) {
return entry->func;
}
}
@@ -345,9 +325,9 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
{
GLFBDevVisualPtr vis;
const int *attrib;
- GLboolean rgbFlag = GL_TRUE, dbFlag = GL_FALSE, stereoFlag = GL_FALSE;
+ GLboolean dbFlag = GL_FALSE, stereoFlag = GL_FALSE;
GLint redBits = 0, greenBits = 0, blueBits = 0, alphaBits = 0;
- GLint indexBits = 0, depthBits = 0, stencilBits = 0;
+ GLint depthBits = 0, stencilBits = 0;
GLint accumRedBits = 0, accumGreenBits = 0;
GLint accumBlueBits = 0, accumAlphaBits = 0;
GLint numSamples = 0;
@@ -367,9 +347,6 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
case GLFBDEV_DOUBLE_BUFFER:
dbFlag = GL_TRUE;
break;
- case GLFBDEV_COLOR_INDEX:
- rgbFlag = GL_FALSE;
- break;
case GLFBDEV_DEPTH_SIZE:
depthBits = attrib[1];
attrib++;
@@ -390,74 +367,61 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
numSamples = attrib[1];
attrib++;
break;
+ case GLFBDEV_COLOR_INDEX:
+ /* Mesa no longer supports color-index rendering. */
default:
/* unexpected token */
- _mesa_free(vis);
+ free(vis);
return NULL;
}
}
- if (rgbFlag) {
- redBits = varInfo->red.length;
- greenBits = varInfo->green.length;
- blueBits = varInfo->blue.length;
- alphaBits = varInfo->transp.length;
-
- if (fixInfo->visual == FB_VISUAL_TRUECOLOR ||
- fixInfo->visual == FB_VISUAL_DIRECTCOLOR) {
- if (varInfo->bits_per_pixel == 24
- && varInfo->red.offset == 16
- && varInfo->green.offset == 8
- && varInfo->blue.offset == 0) {
- vis->pixelFormat = PF_B8G8R8;
- }
- else if (varInfo->bits_per_pixel == 32
- && varInfo->red.offset == 16
- && varInfo->green.offset == 8
- && varInfo->blue.offset == 0) {
- vis->pixelFormat = PF_B8G8R8A8;
- }
- else if (varInfo->bits_per_pixel == 16
- && varInfo->red.offset == 11
- && varInfo->green.offset == 5
- && varInfo->blue.offset == 0) {
- vis->pixelFormat = PF_B5G6R5;
- }
- else if (varInfo->bits_per_pixel == 16
- && varInfo->red.offset == 10
- && varInfo->green.offset == 5
- && varInfo->blue.offset == 0) {
- vis->pixelFormat = PF_B5G5R5;
- }
- else {
- _mesa_problem(NULL, "Unsupported fbdev RGB visual/bitdepth!\n");
- _mesa_free(vis);
- return NULL;
- }
+ redBits = varInfo->red.length;
+ greenBits = varInfo->green.length;
+ blueBits = varInfo->blue.length;
+ alphaBits = varInfo->transp.length;
+
+ if (fixInfo->visual == FB_VISUAL_TRUECOLOR ||
+ fixInfo->visual == FB_VISUAL_DIRECTCOLOR) {
+ if (varInfo->bits_per_pixel == 24
+ && varInfo->red.offset == 16
+ && varInfo->green.offset == 8
+ && varInfo->blue.offset == 0) {
+ vis->pixelFormat = PF_B8G8R8;
}
- }
- else {
- indexBits = varInfo->bits_per_pixel;
- if ((fixInfo->visual == FB_VISUAL_PSEUDOCOLOR ||
- fixInfo->visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
- && varInfo->bits_per_pixel == 8) {
- vis->pixelFormat = PF_CI8;
+ else if (varInfo->bits_per_pixel == 32
+ && varInfo->red.offset == 16
+ && varInfo->green.offset == 8
+ && varInfo->blue.offset == 0) {
+ vis->pixelFormat = PF_B8G8R8A8;
+ }
+ else if (varInfo->bits_per_pixel == 16
+ && varInfo->red.offset == 11
+ && varInfo->green.offset == 5
+ && varInfo->blue.offset == 0) {
+ vis->pixelFormat = PF_B5G6R5;
+ }
+ else if (varInfo->bits_per_pixel == 16
+ && varInfo->red.offset == 10
+ && varInfo->green.offset == 5
+ && varInfo->blue.offset == 0) {
+ vis->pixelFormat = PF_B5G5R5;
}
else {
- _mesa_problem(NULL, "Unsupported fbdev CI visual/bitdepth!\n");
- _mesa_free(vis);
+ _mesa_problem(NULL, "Unsupported fbdev RGB visual/bitdepth!\n");
+ free(vis);
return NULL;
}
}
- if (!_mesa_initialize_visual(&vis->glvisual, rgbFlag, dbFlag, stereoFlag,
+ if (!_mesa_initialize_visual(&vis->glvisual, dbFlag, stereoFlag,
redBits, greenBits, blueBits, alphaBits,
- indexBits, depthBits, stencilBits,
+ depthBits, stencilBits,
accumRedBits, accumGreenBits,
accumBlueBits, accumAlphaBits,
numSamples)) {
/* something was invalid */
- _mesa_free(vis);
+ free(vis);
return NULL;
}
@@ -469,7 +433,7 @@ void
glFBDevDestroyVisual( GLFBDevVisualPtr visual )
{
if (visual)
- _mesa_free(visual);
+ free(visual);
}
@@ -488,9 +452,9 @@ delete_renderbuffer(struct gl_renderbuffer *rb)
{
struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
if (frb->mallocedBuffer) {
- _mesa_free(frb->Base.Data);
+ free(frb->Base.Data);
}
- _mesa_free(frb);
+ free(frb);
}
@@ -554,23 +518,9 @@ new_glfbdev_renderbuffer(void *bufferStart, const GLFBDevVisualPtr visual)
rb->Base.PutValues = put_values_B5G5R5;
rb->Base.PutMonoValues = put_mono_values_B5G5R5;
}
- else if (pixelFormat == PF_CI8) {
- rb->Base.GetRow = get_row_CI8;
- rb->Base.GetValues = get_values_CI8;
- rb->Base.PutRow = put_row_CI8;
- rb->Base.PutMonoRow = put_mono_row_CI8;
- rb->Base.PutValues = put_values_CI8;
- rb->Base.PutMonoValues = put_mono_values_CI8;
- }
- if (pixelFormat == PF_CI8) {
- rb->Base.InternalFormat = GL_COLOR_INDEX8_EXT;
- rb->Base._BaseFormat = GL_COLOR_INDEX;
- }
- else {
- rb->Base.InternalFormat = GL_RGBA;
- rb->Base._BaseFormat = GL_RGBA;
- }
+ rb->Base.InternalFormat = GL_RGBA;
+ rb->Base._BaseFormat = GL_RGBA;
rb->Base.DataType = GL_UNSIGNED_BYTE;
rb->Base.Data = bufferStart;
@@ -636,10 +586,10 @@ glFBDevCreateBuffer( const struct fb_fix_screeninfo *fixInfo,
const int malloced = !backBuffer;
if (malloced) {
/* malloc a back buffer */
- backBuffer = _mesa_malloc(size);
+ backBuffer = malloc(size);
if (!backBuffer) {
_mesa_free_framebuffer_data(&buf->glframebuffer);
- _mesa_free(buf);
+ free(buf);
return NULL;
}
}
@@ -742,7 +692,7 @@ glFBDevSwapBuffers( GLFBDevBufferPtr buffer )
ASSERT(frontrb->Base.Data);
ASSERT(backrb->Base.Data);
- _mesa_memcpy(frontrb->Base.Data, backrb->Base.Data, buffer->size);
+ memcpy(frontrb->Base.Data, backrb->Base.Data, buffer->size);
}
@@ -769,7 +719,7 @@ glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share )
if (!_mesa_initialize_context(&ctx->glcontext, &visual->glvisual,
share ? &share->glcontext : NULL,
&functions, (void *) ctx)) {
- _mesa_free(ctx);
+ free(ctx);
return NULL;
}
@@ -818,7 +768,7 @@ glFBDevDestroyContext( GLFBDevContextPtr context )
_mesa_make_current(NULL, NULL, NULL);
}
_mesa_free_context_data(&context->glcontext);
- _mesa_free(context);
+ free(context);
}
}
diff --git a/src/mesa/drivers/ggi/default/.gitignore b/src/mesa/drivers/ggi/default/.gitignore
deleted file mode 100644
index c8a526b14d7..00000000000
--- a/src/mesa/drivers/ggi/default/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-genkgi.conf
diff --git a/src/mesa/drivers/ggi/default/genkgi.conf.in b/src/mesa/drivers/ggi/default/genkgi.conf.in
deleted file mode 100644
index 02acad2a191..00000000000
--- a/src/mesa/drivers/ggi/default/genkgi.conf.in
+++ /dev/null
@@ -1,4 +0,0 @@
-# GGIMesa genkgi helper configuration
-.root: @ggi_libdir@/ggi/mesa/default
-
-tgt-fbdev-kgicon-d3dim-mesa d3dim.so
diff --git a/src/mesa/drivers/ggi/default/genkgi.h b/src/mesa/drivers/ggi/default/genkgi.h
deleted file mode 100644
index 6d0963416f9..00000000000
--- a/src/mesa/drivers/ggi/default/genkgi.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-******************************************************************************
-
- GGIMesa - KGIcon specific overrides for fbcon-mesa
- API header
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************************
-*/
-
-#ifndef _GENKGI_MESA_H
-#define _GENKGI_MESA_H
-
-#undef KGI_USE_PPBUFS
-
-#include <unistd.h>
-#include <sys/mman.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/display_fbdev.h>
-#include <kgi/kgi.h>
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-/* FIXME: LibGGI needs to export its genkgi.h */
-struct genkgi_priv
-{
- ggi_gc *mapped_gc;
- unsigned int gc_size;
- ggifunc_drawline *drawline;
- ggifunc_drawbox *drawbox;
- ggifunc_fillscreen *fillscreen;
- int fd_gc;
- int close_gc;
- int fd_kgicommand;
- uint8 *mapped_kgicommand;
- uint8 *kgicommand_ptr;
- unsigned int kgicommand_buffersize;
-};
-
-#define GENKGI_PRIV(vis) ((struct genkgi_priv *)FBDEV_PRIV(vis)->accelpriv)
-
-extern ggifunc_getapi GGIMesa_genkgi_getapi;
-extern ggifunc_flush GGIMesa_genkgi_flush;
-
-struct genkgi_priv_mesa
-{
- char accel[100];
- int have_accel;
- void *accelpriv; /* Private data of subdrivers */
- struct genkgi_priv *oldpriv; /* LibGGI's private data */
-};
-
-#define GENKGI_PRIV_MESA(vis) ((struct genkgi_priv_mesa *)FBDEV_PRIV_MESA(vis)->accelpriv)
-
-#endif /* _GENKHI_MESA_H */
diff --git a/src/mesa/drivers/ggi/default/genkgi_mode.c b/src/mesa/drivers/ggi/default/genkgi_mode.c
deleted file mode 100644
index f81d6a45bd6..00000000000
--- a/src/mesa/drivers/ggi/default/genkgi_mode.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-******************************************************************************
-
- display-fbdev-kgicon-generic-mesa
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************************
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-#include "genkgi.h"
-
-int GGIMesa_genkgi_getapi(ggi_visual *vis, int num, char *apiname, char *arguments)
-{
- struct genkgi_priv_mesa *priv = GENKGI_PRIV_MESA(vis);
-
- GGIMESADPRINT_CORE("Entered mesa_genkgi_getapi, num=%d\n", num);
-
- strcpy(arguments, "");
-
- switch(num)
- {
- case 0:
- if (priv->have_accel)
- {
- strcpy(apiname, priv->accel);
- return 0;
- }
- break;
- }
- return -1;
-}
-
-int GGIMesa_genkgi_flush(ggi_visual *vis, int x, int y, int w, int h, int tryflag)
-{
- struct genkgi_priv_mesa *priv = GENKGI_PRIV_MESA(vis);
- int junkval;
-
- priv->oldpriv->kgicommand_ptr += getpagesize();
- (kgiu32)(priv->oldpriv->kgicommand_ptr) &= 0xfffff000;
- junkval = *((int *)(priv->oldpriv->kgicommand_ptr));
-
- /* Check if we are now in the last page, and reset the
- * FIFO if so. We can't use the last page to send
- * more commands, since there's no page after it that
- * we can touch to fault in the last page's commands.
- *
- * FIXME: This will be replaced with a flush-and-reset handler
- * on the end-of-buffer pagefault at some point....
- *
- */
- if ((priv->oldpriv->kgicommand_ptr - priv->oldpriv->mapped_kgicommand)
- >= (priv->oldpriv->kgicommand_buffersize - getpagesize()))
- {
- munmap(priv->oldpriv->mapped_kgicommand, priv->oldpriv->kgicommand_buffersize);
- if ((priv->oldpriv->mapped_kgicommand =
- mmap(NULL,
- priv->oldpriv->kgicommand_buffersize,
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
- priv->oldpriv->fd_kgicommand,
- 0)) == MAP_FAILED)
- {
- ggiPanic("Failed to remap kgicommand!");
- }
- priv->oldpriv->kgicommand_ptr = priv->oldpriv->mapped_kgicommand;
- }
- return 0;
-}
diff --git a/src/mesa/drivers/ggi/default/genkgi_visual.c b/src/mesa/drivers/ggi/default/genkgi_visual.c
deleted file mode 100644
index d7838cae6e0..00000000000
--- a/src/mesa/drivers/ggi/default/genkgi_visual.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
-******************************************************************************
-
- genkgi_visual.c: visual handling for the generic KGI helper
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************************
-*/
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/display_fbdev.h>
-#include <ggi/mesa/debug.h>
-#include "genkgi.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_SYS_VT_H
-#include <sys/vt.h>
-#else
-#include <linux/vt.h>
-#endif
-#ifdef HAVE_LINUX_KDEV_T_H
-#include <linux/kdev_t.h>
-#endif
-#include <linux/tty.h>
-
-#define DEFAULT_FBNUM 0
-
-static char accel_prefix[] = "tgt-fbdev-kgicon-";
-#define PREFIX_LEN (sizeof(accel_prefix))
-
-typedef struct {
- int async;
- char *str;
-} accel_info;
-
-static accel_info accel_strings[] =
-{
- { 0, "d3dim" }, /* Direct3D Immediate Mode */
-};
-
-#define NUM_ACCELS (sizeof(accel_strings)/sizeof(accel_info))
-
-/* FIXME: These should be defined in the makefile system */
-#define CONF_FILE "/usr/local/etc/ggi/mesa/targets/genkgi.conf"
-void *_configHandle;
-char confstub[512] = CONF_FILE;
-char *conffile = confstub;
-
-static int changed(ggi_visual_t vis, int whatchanged)
-{
- GGIMESADPRINT_CORE("Entered ggimesa_genkgi_changed\n");
-
- switch (whatchanged)
- {
- case GGI_CHG_APILIST:
- {
- char api[256];
- char args[256];
- int i;
- const char *fname;
- ggi_dlhandle *lib;
-
- for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++)
- {
- strcat(api, "-mesa");
- GGIMESADPRINT_CORE("ggimesa_genkgi_changed: api=%s, i=%d\n", api, i);
- fname = ggMatchConfig(_configHandle, api, NULL);
- if (fname == NULL)
- {
- /* No special implementation for this sublib */
- continue;
- }
-
- lib = ggiExtensionLoadDL(vis, fname, args, NULL);
- }
- }
- break;
- }
- return 0;
-}
-
-static int GGIdlinit(ggi_visual *vis, struct ggi_dlhandle *dlh,
- const char *args, void *argptr, uint32 *dlret)
-{
- struct genkgi_priv_mesa *priv;
- char libname[256], libargs[256];
- int id, err;
- struct stat junk;
- ggifunc_getapi *oldgetapi;
-
- GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: GGIdlinit start\n");
-
- GENKGI_PRIV_MESA(vis) = priv = malloc(sizeof(struct genkgi_priv_mesa));
- if (priv == NULL)
- {
- fprintf(stderr, "Failed to allocate genkgi private data\n");
- return GGI_DL_ERROR;
- }
-
- priv->oldpriv = GENKGI_PRIV(vis);
-#if 0
- err = ggLoadConfig(conffile, &_configHandle);
- if (err != GGI_OK)
- {
- gl_ggiPrint("display-fbdev-kgicon-mesa: Couldn't open %s\n", conffile);
- return err;
- }
-
- /* Hack city here. We need to probe the KGI driver properly for
- * suggest-strings to discover the acceleration type(s).
- */
- priv->have_accel = 0;
-
- if (stat("/proc/gfx0", &junk) == 0)
- {
- sprintf(priv->accel, "%s%s", accel_prefix, "d3dim");
- priv->have_accel = 1;
- GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: Using accel: \"%s\"\n", priv->accel);
- }
-
- /* Mode management */
- vis->opdisplay->getapi = GGIMesa_genkgi_getapi;
- ggiIndicateChange(vis, GGI_CHG_APILIST);
-
- /* Give the accel sublibs a chance to set up a driver */
- if (priv->have_accel == 1)
- {
- oldgetapi = vis->opdisplay->getapi;
- vis->opdisplay->getapi = GGIMesa_genkgi_getapi;
- changed(vis, GGI_CHG_APILIST);
- /* If the accel sublibs didn't produce, back up
- * and keep looking */
- if ((LIBGGI_MESAEXT(vis)->update_state == NULL) ||
- (LIBGGI_MESAEXT(vis)->setup_driver == NULL))
- vis->opdisplay->getapi = oldgetapi;
- }
-
- LIBGGI_MESAEXT(vis)->update_state = genkgi_update_state;
- LIBGGI_MESAEXT(vis)->setup_driver = genkgi_setup_driver;
-#endif
- GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: GGIdlinit finished\n");
-
- *dlret = GGI_DL_OPDRAW;
- return 0;
-}
-
-int MesaGGIdl_fbdev(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- case GGIFUNC_close:
- *funcptr = NULL;
- return 0;
- default:
- *funcptr = NULL;
- }
- return GGI_ENOTFOUND;
-}
-
-#include <ggi/internal/ggidlinit.h>
diff --git a/src/mesa/drivers/ggi/default/linear.c b/src/mesa/drivers/ggi/default/linear.c
deleted file mode 100644
index 9d29761ad5b..00000000000
--- a/src/mesa/drivers/ggi/default/linear.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-#include "swrast/swrast.h"
-
-#define RMASK ((1<<R)-1)
-#define GMASK ((1<<G)-1)
-#define BMASK ((1<<B)-1)
-
-#define RS (8-R)
-#define GS (8-G)
-#define BS (8-B)
-
-#define PACK(color) (((color[RCOMP]>>RS) << (G+B)) | \
- ((color[GCOMP]>>GS) << B) | \
- ((color[BCOMP]>>BS)))
-
-#define FLIP(coord) (LIBGGI_VIRTY(ggi_ctx->ggi_visual) - (coord) - 1)
-
-
-/**********************************************************************/
-/***** Write spans of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = *ci;
- fb++;
- ci++;
- }
- } else {
- while (n--) *fb++ = *ci++;
- }
-}
-
-void GGIwrite_ci8_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLubyte ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = *ci;
- fb++;
- ci++;
- }
- } else {
- while (n--) *fb++ = *ci++;
- }
-}
-
-
-void GGIwrite_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan rgba[][4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = PACK(rgba[0]);
- fb++;
- rgba++;
- }
- } else {
- while (n--) {
- *fb++ = PACK(rgba[0]);
- rgba++;
- }
- }
-}
-
-void GGIwrite_rgb_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan rgba[][3], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = PACK(rgba[0]);
- fb++;
- rgba++;
- }
- } else {
- while (n--) {
- *fb++ = PACK(rgba[0]);
- rgba++;
- }
- }
-}
-
-
-void GGIwrite_mono_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--){
- if (*mask++)
- *fb = PACK(color);
- ++fb;
- }
- } else {
- while (n--)
- *fb++ = PACK(color);
-
- /* Alternatively we could write a potentialy faster HLine
- ggiSetGCForeground(ggi_ctx->ggi_visual, color);
- ggiDrawHLine(ggi_ctx->ggi_visual,x,FLIP(y),n);
- */
- }
-}
-
-void GGIwrite_mono_ci_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask){
- while (n--){
- if (*mask++)
- *fb = ci;
- ++fb;
- }
- } else {
- while (n--)
- *fb++ = ci;
-
- /* Alternatively we could write a potentialy faster HLine
- ggiSetGCForeground(ggi_ctx->ggi_visual, ci);
- ggiDrawHLine(ggi_ctx->ggi_visual, x, FLIP(y), n);
- */
- }
-}
-
-
-/**********************************************************************/
-/***** Read spans of pixels *****/
-/**********************************************************************/
-
-
-void GGIread_ci32_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLuint ci[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- while (n--)
- *ci++ = (GLuint)*fb++;
-}
-
-void GGIread_rgba_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLchan rgba[][4])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE color;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- while (n--) {
- color = *fb++;
- rgba[0][RCOMP] = (GLubyte) (color>>(G+B))<<RS;
- rgba[0][GCOMP] = (GLubyte) ((color>>B)& ((1<<G)-1))<<GS;
- rgba[0][BCOMP] = (GLubyte) (color & ((1<<B)-1))<<BS;
- rgba[0][ACOMP] = 0;
- rgba++;
- }
-}
-
-/**********************************************************************/
-/***** Write arrays of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = *ci;
- }
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIwrite_mono_ci_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = ci;
- }
- x++;
- y++;
- }
-}
-
-void GGIwrite_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan rgba[][4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = PACK(rgba[0]);
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-void GGIwrite_mono_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan rgba[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = PACK(rgba);
- }
-
- x++;
- y++;
- }
-}
-
-/**********************************************************************/
-/***** Read arrays of pixels *****/
-/**********************************************************************/
-
-void GGIread_ci32_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *src = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *ci = *src;
- }
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIread_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
- FB_TYPE color;
-
- while (n--) {
- if (*mask++) {
- FB_TYPE *src = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- color = *src;
-
- rgba[0][RCOMP] = (GLubyte)(color>>(G+B))<<RS;
- rgba[0][GCOMP] = (GLubyte)((color>>B)& ((1<<G)-1))<<GS;
- rgba[0][BCOMP] = (GLubyte) (color & ((1<<B)-1))<<BS;
- rgba[0][ACOMP] = 0;
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-void GGIset_buffer(GLcontext *ctx, GLframebuffer *buffer, GLenum mode)
-{
-}
-
-int GGIsetup_driver(ggi_mesa_context_t ggi_ctx)
-{
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ggi_ctx->gl_ctx);
-
- GGIMESADPRINT_LIBS("linear_%d: GGIsetup_driver\n", sizeof(FB_TYPE)*8);
-
- swdd->WriteRGBASpan = GGIwrite_rgba_span;
- swdd->WriteRGBSpan = GGIwrite_rgb_span;
- swdd->WriteMonoRGBASpan = GGIwrite_mono_rgba_span;
- swdd->WriteRGBAPixels = GGIwrite_rgba_pixels;
- swdd->WriteMonoRGBAPixels = GGIwrite_mono_rgba_pixels;
-
- swdd->WriteCI32Span = GGIwrite_ci32_span;
- swdd->WriteCI8Span = GGIwrite_ci8_span;
- swdd->WriteMonoCISpan = GGIwrite_mono_ci_span;
- swdd->WriteCI32Pixels = GGIwrite_ci32_pixels;
- swdd->WriteMonoCIPixels = GGIwrite_mono_ci_pixels;
-
- swdd->ReadCI32Span = GGIread_ci32_span;
- swdd->ReadRGBASpan = GGIread_rgba_span;
- swdd->ReadCI32Pixels = GGIread_ci32_pixels;
- swdd->ReadRGBAPixels = GGIread_rgba_pixels;
-
- swdd->SetBuffer = GGIset_buffer;
-
- return 0;
-}
-
-static int GGIopen(ggi_visual_t vis,struct ggi_dlhandle *dlh,
- const char *args,void *argptr, uint32 *dlret)
-{
- GGIMESADPRINT_CORE("linear_%d: GGIOpen\n", sizeof(FB_TYPE)*8);
- LIBGGI_MESAEXT(vis)->setup_driver = GGIsetup_driver;
-
- *dlret = GGI_DL_OPDRAW;
- return 0;
-}
-
-int DLOPENFUNC(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- case GGIFUNC_close:
- *funcptr = NULL;
- return 0;
- default:
- *funcptr = NULL;
- }
- return GGI_ENOTFOUND;
-}
-
diff --git a/src/mesa/drivers/ggi/default/linear_15.c b/src/mesa/drivers/ggi/default/linear_15.c
deleted file mode 100644
index ead7cc58475..00000000000
--- a/src/mesa/drivers/ggi/default/linear_15.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 5
-#define G 5
-#define B 5
-
-#define FB_TYPE uint16
-#define FB_BITS 15
-#define DLOPENFUNC MesaGGIdl_linear_15
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/linear_16.c b/src/mesa/drivers/ggi/default/linear_16.c
deleted file mode 100644
index 6028699bbc9..00000000000
--- a/src/mesa/drivers/ggi/default/linear_16.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 5
-#define G 6
-#define B 5
-
-#define FB_TYPE uint16
-#define FB_BITS 16
-#define DLOPENFUNC MesaGGIdl_linear_16
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/linear_24.c b/src/mesa/drivers/ggi/default/linear_24.c
deleted file mode 100644
index 7a2236f1241..00000000000
--- a/src/mesa/drivers/ggi/default/linear_24.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 8
-#define G 8
-#define B 8
-
-#define FB_TYPE uint32
-#define FB_BITS 24
-#define DLOPENFUNC MesaGGIdl_linear_24
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/linear_32.c b/src/mesa/drivers/ggi/default/linear_32.c
deleted file mode 100644
index 7cbf945f359..00000000000
--- a/src/mesa/drivers/ggi/default/linear_32.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 8
-#define G 8
-#define B 8
-
-#define FB_TYPE uint32
-#define FB_BITS 32
-#define DLOPENFUNC MesaGGIdl_linear_32
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/linear_8.c b/src/mesa/drivers/ggi/default/linear_8.c
deleted file mode 100644
index 9c7b5d712f0..00000000000
--- a/src/mesa/drivers/ggi/default/linear_8.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 3
-#define G 3
-#define B 2
-
-#define FB_TYPE uint8
-#define FB_BITS 8
-#define DLOPENFUNC MesaGGIdl_linear_8
-
-#include "linear.c"
-
diff --git a/src/mesa/drivers/ggi/default/stubs.c b/src/mesa/drivers/ggi/default/stubs.c
deleted file mode 100644
index 62722972b2a..00000000000
--- a/src/mesa/drivers/ggi/default/stubs.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <stdio.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-
-#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"
-
-#define FLIP(coord) (LIBGGI_MODE(ggi_ctx->ggi_visual)->visible.y-(coord)-1)
-
-/**********************************************************************/
-/***** Write spans of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLuint ci[],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, *ci);
- x++;
- ci++;
- }
- }
- else
- {
- while (n--)
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, *ci++);
- }
-}
-
-void GGIwrite_ci8_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte ci[],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, *ci);
- x++;
- ci++;
- }
- }
- else
- {
- while (n--)
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, *ci++);
- }
-}
-
-void GGIwrite_mono_ci_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, ci);
- x++;
- }
- }
- else
- {
- while (n--)
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, ci);
- }
-}
-
-void GGIwrite_mono_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan rgba[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- y = FLIP(y);
-
- rgb.r = (uint16)(rgba[RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
-
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, col);
- x++;
- }
- }
- else
- {
- ggiDrawHLine(ggi_ctx->ggi_visual, x, y, n);
- }
-}
-
-void GGIwrite_rgba_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
- y = FLIP(y);
-
- if (mask)
- {
- while (n--) {
- if (*mask++)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, col);
- }
- x++;
- rgba++;
- }
- }
- else
- {
- while (n--)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, col);
- rgba++;
- }
- }
-}
-
-void GGIwrite_rgb_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][3],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
- y = FLIP(y);
-
- if (mask)
- {
- while (n--) {
- if (*mask++)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, col);
- }
- x++;
- rgba++;
- }
- }
- else
- {
- while (n--)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, col);
- rgba++;
- }
- }
-}
-
-
-
-/**********************************************************************/
-/***** Read spans of pixels *****/
-/**********************************************************************/
-
-
-void GGIread_ci32_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLuint ci[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- while (n--)
- ggiGetPixel(ggi_ctx->ggi_visual, x++, y, ci++);
-}
-
-void GGIread_rgba_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- y = FLIP(y);
-
- while (n--)
- {
- ggiGetPixel(ggi_ctx->ggi_visual, x++, y, &col);
- ggiUnmapPixel(ggi_ctx->ggi_visual, col, &rgb);
- rgba[0][RCOMP] = (GLubyte) (rgb.r >> SHIFT);
- rgba[0][GCOMP] = (GLubyte) (rgb.g >> SHIFT);
- rgba[0][BCOMP] = (GLubyte) (rgb.b >> SHIFT);
- rgba[0][ACOMP] = 0;
- rgba++;
- }
-}
-
-/**********************************************************************/
-/***** Write arrays of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint ci[], const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), *ci);
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIwrite_mono_ci_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), ci);
- x++;
- y++;
- }
-}
-
-void GGIwrite_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_pixel col;
- ggi_color rgb;
- while (n--) {
- if (*mask++) {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), col);
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-void GGIwrite_mono_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan rgba[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- rgb.r = (uint16)(rgba[RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
-
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), col);
- x++;
- y++;
- }
-}
-
-/**********************************************************************/
-/***** Read arrays of pixels *****/
-/**********************************************************************/
-
-void GGIread_ci32_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- while (n--) {
- if (*mask++)
- ggiGetPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), ci);
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIread_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- while (n--)
- {
- if (*mask++)
- {
- ggiGetPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), &col);
- ggiUnmapPixel(ggi_ctx->ggi_visual, col, &rgb);
- rgba[0][RCOMP] = rgb.r >> SHIFT;
- rgba[0][GCOMP] = rgb.g >> SHIFT;
- rgba[0][BCOMP] = rgb.b >> SHIFT;
- rgba[0][ACOMP] = 0;
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-int GGIextend_visual(ggi_visual_t vis)
-{
- return 0;
-}
-
-//static swrast_tri_func ggimesa_stubs_get_triangle_func(GLcontext *ctx);
-
-int GGIsetup_driver(ggi_mesa_context_t ggi_ctx)
-{
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ggi_ctx->gl_ctx);
-
- GGIMESADPRINT_CORE("stubs: setup_driver\n");
-
- swdd->WriteRGBASpan = GGIwrite_rgba_span;
- swdd->WriteRGBSpan = GGIwrite_rgb_span;
- swdd->WriteMonoRGBASpan = GGIwrite_mono_rgba_span;
- swdd->WriteRGBAPixels = GGIwrite_rgba_pixels;
- swdd->WriteMonoRGBAPixels = GGIwrite_mono_rgba_pixels;
-
- swdd->WriteCI32Span = GGIwrite_ci32_span;
- swdd->WriteCI8Span = GGIwrite_ci8_span;
- swdd->WriteMonoCISpan = GGIwrite_mono_ci_span;
- swdd->WriteCI32Pixels = GGIwrite_ci32_pixels;
- swdd->WriteMonoCIPixels = GGIwrite_mono_ci_pixels;
-
- swdd->ReadCI32Span = GGIread_ci32_span;
- swdd->ReadRGBASpan = GGIread_rgba_span;
- swdd->ReadCI32Pixels = GGIread_ci32_pixels;
- swdd->ReadRGBAPixels = GGIread_rgba_pixels;
-
- return 0;
-}
-
-void GGIupdate_state(ggi_mesa_context_t *ctx)
-{
- //ctx->Driver.TriangleFunc = _swsetup_Triangle;
-}
-
-/*
-void GGItriangle_flat(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 \
- 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 "swrast/s_tritemp.h"
-}
-
-
-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 \
- 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) \
- { \
- GLint i,xx=LEFT,yy=FLIP(Y),n=RIGHT-LEFT,length=0; \
- GLint startx=xx; \
- for (i=0;i<n;i++){ \
- GLdepth z=FixedToDepth(ffz); \
- if (z<zRow[i]) \
- { \
- zRow[i]=z; \
- length++; \
- } \
- else \
- { \
- if (length) \
- { \
- ggiDrawHLine(VIS,startx,yy,length); \
- length=0; \
- } \
- startx=xx+i+1; \
- } \
- ffz+=fdzdx; \
- } \
- if (length) ggiDrawHLine(VIS,startx,yy,length); \
- }
-
-#include "swrast/s_tritemp.h"
-}
-
-
-static swrast_tri_func ggimesa_stubs_get_triangle_func(GLcontext *ctx)
-{
- if (ctx->Stencil._Enabled) return NULL;
- if (ctx->Polygon.SmoothFlag) return NULL;
- if (ctx->Polygon.StippleFlag) return NULL;
- if (ctx->Texture._ReallyEnabled) return NULL;
- if (ctx->Light.ShadeModel==GL_SMOOTH) return NULL;
- if (ctx->Depth.Test && ctx->Depth.Func != GL_LESS) return NULL;
-
- if (ctx->Depth.Test)
- return GGItriangle_flat_depth;
-
- return GGItriangle_flat;
-}
-*/
-static int GGIopen(ggi_visual_t vis, struct ggi_dlhandle *dlh,
- const char *args, void *argptr, uint32 *dlret)
-{
- LIBGGI_MESAEXT(vis)->update_state = GGIupdate_state;
- LIBGGI_MESAEXT(vis)->setup_driver = GGIsetup_driver;
-
- *dlret = GGI_DL_OPDRAW;
- return 0;
-}
-
-int MesaGGIdl_stubs(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- case GGIFUNC_close:
- *funcptr = NULL;
- return 0;
- default:
- *funcptr = NULL;
- }
- return GGI_ENOTFOUND;
-}
diff --git a/src/mesa/drivers/ggi/display/.gitignore b/src/mesa/drivers/ggi/display/.gitignore
deleted file mode 100644
index 98858db2c0e..00000000000
--- a/src/mesa/drivers/ggi/display/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-fbdev.conf
diff --git a/src/mesa/drivers/ggi/display/fbdev.conf.in b/src/mesa/drivers/ggi/display/fbdev.conf.in
deleted file mode 100644
index 2acb89426f6..00000000000
--- a/src/mesa/drivers/ggi/display/fbdev.conf.in
+++ /dev/null
@@ -1,4 +0,0 @@
-# GGIMesa fbdev target configuration
-.root: @ggi_libdir@/ggi/mesa/default
-
-tgt-fbdev-kgicon-generic-mesa genkgi.so
diff --git a/src/mesa/drivers/ggi/display/fbdev_mode.c b/src/mesa/drivers/ggi/display/fbdev_mode.c
deleted file mode 100644
index 85c35ffe0e0..00000000000
--- a/src/mesa/drivers/ggi/display/fbdev_mode.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/******************************************************************************
-
- display-fbdev-mesa
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************************
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-
-#include <linux/fb.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/display_fbdev.h>
-#include <ggi/mesa/debug.h>
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void*)-1)
-#endif
-
-#define FB_KLUDGE_FONTX 8
-#define FB_KLUDGE_FONTY 16
-#define FB_KLUDGE_TEXTMODE 13
-#define TIMINGFILE "/etc/fb.modes"
-
-int GGIMesa_fbdev_getapi(ggi_visual *vis, int num, char *apiname, char *arguments)
-{
- struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis);
-
- arguments = '\0';
-
- switch(num) {
- case 0:
- if (priv->oldpriv->have_accel) {
- strcpy(apiname, priv->oldpriv->accel);
- return 0;
- }
- break;
- }
-
- return -1;
-}
-
-static int do_setmode(ggi_visual *vis)
-{
- struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis);
- int err, id;
- char libname[GGI_API_MAXLEN], libargs[GGI_API_MAXLEN];
- ggi_graphtype gt;
-
- _ggiZapMode(vis, ~GGI_DL_OPDISPLAY);
- priv->have_accel = 0;
-
- for (id = 1; GGIMesa_fbdev_getapi(vis, id, libname, libargs) == 0; id++) {
- if (_ggiOpenDL(vis, libname, libargs, NULL) == 0) {
- GGIMESADPRINT_LIBS(stderr, "display-fbdev-mesa: Error opening the "
- "%s (%s) library.\n", libname, libargs);
- return GGI_EFATAL;
- }
-
- GGIMESADPRINT_CORE("Success in loading %s (%s)\n",
- libname, libargs);
- }
-
- if (priv->oldpriv->accel &&
- _ggiOpenDL(vis, priv->accel, NULL, NULL) != 0) {
- priv->have_accel = 1;
- } else {
- priv->have_accel = 0;
- }
- vis->accelactive = 0;
-
- ggiIndicateChange(vis, GGI_CHG_APILIST);
-
- GGIMESADPRINT_CORE("display-fbdev-mesa: do_setmode SUCCESS\n");
-
- return 0;
-}
-
-
-int GGIMesa_fbdev_setmode(ggi_visual *vis, ggi_mode *mode)
-{
- int err;
-
- if ((err = ggiCheckMode(vis, mode)) != 0) {
- return err;
- }
-
- GGIMESADPRINT_CORE("display-fbdev-mesa: setmode %dx%d#%dx%dF%d[0x%02x]\n",
- mode->visible.x, mode->visible.y,
- mode->virt.x, mode->virt.y,
- mode->frames, mode->graphtype);
-
- memcpy(LIBGGI_MODE(vis), mode, sizeof(ggi_mode));
-
- /* Now actually set the mode */
- err = do_setmode(vis);
- if (err != 0) {
- return err;
- }
-
- GGIMESADPRINT_CORE("display-fbdev-mesa: setmode success.\n");
-
- return 0;
-}
diff --git a/src/mesa/drivers/ggi/display/fbdev_visual.c b/src/mesa/drivers/ggi/display/fbdev_visual.c
deleted file mode 100644
index f0c1771c778..00000000000
--- a/src/mesa/drivers/ggi/display/fbdev_visual.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/******************************************************************************
-
- display-fbdev-mesa: visual handling
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************************
-*/
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/display_fbdev.h>
-#include <ggi/mesa/debug.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-
-#ifdef HAVE_SYS_VT_H
-#include <sys/vt.h>
-#else
-#include <linux/vt.h>
-#endif
-#ifdef HAVE_LINUX_KDEV_T_H
-#include <linux/kdev_t.h>
-#endif
-#include <linux/tty.h>
-
-#define MAX_DEV_LEN 63
-#define DEFAULT_FBNUM 0
-
-static char accel_prefix[] = "tgt-fbdev-";
-#define PREFIX_LEN (sizeof(accel_prefix))
-
-typedef struct {
- int async;
- char *str;
-} accel_info;
-
-static accel_info accel_strings[] = {
- { 0, "kgicon-generic",}, /* no accel - check for KGIcon */
- { 0, NULL }, /* Atari Blitter */
-};
-
-#define NUM_ACCELS (sizeof(accel_strings)/sizeof(accel_info))
-
-
-
-static int GGIopen(ggi_visual *vis, struct ggi_dlhandle *dlh,
- const char *args, void *argptr, uint32 *dlret)
-{
- int err;
- struct fbdev_priv_mesa *priv;
- ggifunc_getapi *oldgetapi;
-
-
- priv->oldpriv = LIBGGI_PRIVATE(vis); /* Hook back */
-
- GGIMESA_PRIV(vis) = priv = malloc(sizeof(struct fbdev_priv_mesa));
- if (priv == NULL) {
- fprintf(stderr, "GGIMesa: Failed to allocate fbdev private data\n");
- return GGI_ENOMEM;
- }
-
- oldgetapi = vis->opdisplay->getapi;
- vis->opdisplay->getapi = GGIMesa_fbdev_getapi;
- changed(vis, GGI_CHG_APILIST);
-
- /* If the accel sublibs didn't sucessfuly hook a driver,
- * back up and keep looking */
- if ((LIBGGI_MESAEXT(vis)->update_state == NULL) ||
- (LIBGGI_MESAEXT(vis)->setup_driver == NULL))
- {
- vis->opdisplay->getapi = oldgetapi;
- }
-
- *dlret = GGI_DL_EXTENSION;
- return 0;
-}
-
-
-static int GGIclose(ggi_visual *vis, struct ggi_dlhandle *dlh)
-{
- struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis);
-
- if (priv) {
- LIBGGI_PRIVATE(vis) = priv->oldpriv;
- free(priv);
- }
-
- return 0;
-}
-
-
-int MesaGGIdl_fbdev_mesa(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- *funcptr = NULL;
- return 0;
- case GGIFUNC_close:
- *funcptr = GGIclose;
- return 0;
- default:
- *funcptr = NULL;
- }
-
- return GGI_ENOTFOUND;
-}
-
-
-#include <ggi/internal/ggidlinit.h>
diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c
deleted file mode 100644
index bc08144d663..00000000000
--- a/src/mesa/drivers/ggi/ggimesa.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997-1998 Uwe Maurer - uwe_maurer@t-online.de
- * 2002 Filip Spacek
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-#include "main/extensions.h"
-#include "main/buffers.h"
-#include "main/colormac.h"
-#include "main/imports.h"
-#include "main/matrix.h"
-#include "main/teximage.h"
-#include "main/texformat.h"
-#include "main/texstore.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "vbo/vbo.h"
-
-/* We use LibGG to manage config files */
-#include <ggi/gg.h>
-
-
-/* XXX: Those #defines should be provided via
- * config.h
- */
-#define GGIMESAPATHTAG "pAtHTAg"
-#define GGIMESACONFDIR "pAtHTAg/usr/local/etc/ggi"
-#define GGIMESATAGLEN 7
-#define GGIMESACONFFILE "ggimesa.conf"
-
-
-/* Static variables
- */
-static int _ggimesaLibIsUp = 0;
-static void *_ggimesaConfigHandle;
-static char _ggimesaconfstub[512] = GGIMESACONFDIR;
-static char *_ggimesaconfdir = _ggimesaconfstub+GGIMESATAGLEN;
-
-int _ggimesaDebugSync = 0;
-uint32 _ggimesaDebugState = 0;
-
-
-
-/* Extension ID. Defaulting to -1 should make segfault on abuse more likely...
- */
-ggi_extid _ggiMesaID = -1;
-
-
-#define SUBLIB_PREFIX "MesaGGIdl_"
-
-
-/*
- * Returns the directory where global config files are kept
- */
-
-const char *ggiMesaGetConfDir(void)
-{
-#ifdef __WIN32__
- /* On Win32 we allow overriding of the compiled in path. */
- const char *envdir = getenv("GGI_CONFDIR");
- if (envdir) return envdir;
-#endif
- return _ggimesaconfdir;
-}
-
-
-/* Dummy function which returns -1
- We use this to reset the function pointers */
-static int _ggi_error(void)
-{
- GGIMESADPRINT_CORE("_ggi_error() called\n");
-
- return -1;
-}
-
-
-static int changed(ggi_visual_t vis, int whatchanged)
-{
- GLcontext *ctx;
- ctx = _mesa_get_current_context();
-
- GGIMESADPRINT_CORE("changed() called\n");
-
- switch (whatchanged) {
- case GGI_CHG_APILIST:
- {
- char api[GGI_MAX_APILEN];
- char args[GGI_MAX_APILEN];
- int i;
- const char *fname;
- ggi_dlhandle *lib;
-
- GLvisual *gl_vis = &(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual);
- GLframebuffer *gl_fb = &(LIBGGI_MESAEXT(vis)->mesa_buffer);
-
- /* Initialize the framebuffer to provide all necessary
- buffers in software. The target libraries that are loaded
- next are free to modify this according to their
- capabilities.
- */
- /* FIXME: if the target changes capabilities we'll leak
- swrast's memory !!! Need to deallocate first */
- _mesa_initialize_framebuffer(gl_fb, gl_vis,
- gl_vis->depthBits > 0,
- gl_vis->stencilBits > 0,
- gl_vis->accumRedBits > 0,
- gl_vis->alphaBits > 0);
-
- for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++) {
- strcat(api, "-mesa");
- GGIMESADPRINT_CORE("GGIMesa: looking for"
- "a sublib named %s\n", api);
- fname = ggMatchConfig(_ggimesaConfigHandle, api, NULL);
- if (fname == NULL) {
- /* No special implementation for this sublib */
- continue;
- }
- lib = ggiExtensionLoadDL(vis, fname, args, NULL,
- SUBLIB_PREFIX);
- }
-
- /* The targets have cleared everything they can do from
- the framebuffer structure so we provide the rest in sw
- */
- /*_swrast_alloc_buffers(gl_fb);*/
-
- break;
- }
- }
- return 0;
-}
-
-
-int ggiMesaInit()
-{
- int err;
- char *str;
- char *conffile;
-
- GGIMESADPRINT_CORE("ggiMesaInit() called\n");
-
- _ggimesaLibIsUp++;
- if (_ggimesaLibIsUp > 1) return 0; /* Initialize only at first call */
-
- str = getenv("GGIMESA_DEBUGSYNC");
- if (str != NULL) {
- _ggimesaDebugSync = 1;
- }
-
- str = getenv("GGIMESA_DEBUG");
- if (str != NULL) {
- _ggimesaDebugState = atoi(str);
- GGIMESADPRINT_CORE("%s Debugging=%d\n",
- _ggimesaDebugSync ? "sync" : "async",
- _ggimesaDebugState);
- }
-
-
- conffile = malloc(strlen(ggiMesaGetConfDir()) + 1
- + strlen(GGIMESACONFFILE) +1);
- if (conffile == NULL) {
- fprintf(stderr, "GGIMesa: unable to allocate memory for config filename.\n");
- return GGI_ENOMEM;
- }
- sprintf(conffile, "%s%c%s",
- ggiMesaGetConfDir(), '/', GGIMESACONFFILE);
- err = ggLoadConfig(conffile, &_ggimesaConfigHandle);
- if (err != GGI_OK) {
- fprintf(stderr, "GGIMesa: Couldn't open %s\n",
- conffile);
- free(conffile);
- _ggimesaLibIsUp--;
- return err;
- }
- free(conffile);
-
- _ggiMesaID = ggiExtensionRegister("GGIMesa",
- sizeof(struct ggi_mesa_ext), changed);
- if (_ggiMesaID < 0) {
- fprintf(stderr, "GGIMesa: failed to register as extension\n");
- _ggimesaLibIsUp--;
- ggFreeConfig(_ggimesaConfigHandle);
- return _ggiMesaID;
- }
-
- return 0;
-}
-
-int ggiMesaExit(void)
-{
- int rc;
-
- GGIMESADPRINT_CORE("ggiMesaExit() called\n");
-
- if (!_ggimesaLibIsUp) return -1;
-
- if (_ggimesaLibIsUp > 1) {
- /* Exit only at last call */
- _ggimesaLibIsUp--;
- return 0;
- }
-
- rc = ggiExtensionUnregister(_ggiMesaID);
- ggFreeConfig(_ggimesaConfigHandle);
-
- _ggimesaLibIsUp = 0;
-
- return rc;
-}
-
-
-
-
-static void gl_ggiUpdateState(GLcontext *ctx, GLuint new_state);
-
-
-static void gl_ggiGetSize(GLframebuffer *fb, GLuint *width, GLuint *height)
-{
- /* FIXME: this is a hack to work around the new interface */
- GLcontext *ctx;
- ggi_mesa_context_t ggi_ctx;
- ctx = _mesa_get_current_context();
- ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiGetSize() called\n");
-
- *width = LIBGGI_VIRTX(ggi_ctx->ggi_visual);
- *height = LIBGGI_VIRTY(ggi_ctx->ggi_visual);
- printf("returning %d, %d\n", *width, *height);
-}
-
-/**
- * We only implement this function as a mechanism to check if the
- * framebuffer size has changed (and update corresponding state).
- */
-static void gl_ggiViewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- GLuint newWidth, newHeight;
- GLframebuffer *buffer = ctx->WinSysDrawBuffer;
- gl_ggiGetSize( buffer, &newWidth, &newHeight );
- if (buffer->Width != newWidth || buffer->Height != newHeight) {
- _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight );
- }
-}
-
-
-static void gl_ggiSetIndex(GLcontext *ctx, GLuint ci)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiSetIndex() called\n");
-
- ggiSetGCForeground(ggi_ctx->ggi_visual, ci);
- ggi_ctx->color = (ggi_pixel)ci;
-}
-
-static void gl_ggiSetClearIndex(GLcontext *ctx, GLuint ci)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiSetClearIndex() called\n");
-
- ggiSetGCForeground(ggi_ctx->ggi_visual, ci);
- ggi_ctx->clearcolor = (ggi_pixel)ci;
-}
-
-static void gl_ggiSetClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
- GLubyte byteColor[3];
-
- GGIMESADPRINT_CORE("gl_ggiSetClearColor() called\n");
-
- CLAMPED_FLOAT_TO_UBYTE(byteColor[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(byteColor[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(byteColor[2], color[2]);
-
- rgb.r = (uint16)byteColor[0] << SHIFT;
- rgb.g = (uint16)byteColor[1] << SHIFT;
- rgb.b = (uint16)byteColor[2] << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiSetGCForeground(ggi_ctx->ggi_visual, col);
- ggi_ctx->clearcolor = col;
-}
-
-static void gl_ggiClear(GLcontext *ctx, GLbitfield mask)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int x = ctx->DrawBuffer->_Xmin;
- int y = ctx->DrawBuffer->_Ymin;
- int w = ctx->DrawBuffer->_Xmax - x;
- int h = ctx->DrawBuffer->_Ymax - y;
- GLboolean all = (w == ctx->DrawBuffer->Width && h == ctx->DrawBuffer->height)
-
- GGIMESADPRINT_CORE("gl_ggiClear() called\n");
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- ggiSetGCForeground(ggi_ctx->ggi_visual, ggi_ctx->clearcolor);
-
- if (all) {
- int w, h;
- w = LIBGGI_VIRTX(ggi_ctx->ggi_visual);
- h = LIBGGI_VIRTX(ggi_ctx->ggi_visual);
- ggiDrawBox(ggi_ctx->ggi_visual, 0, 0, w, h);
- } else {
- ggiDrawBox(ggi_ctx->ggi_visual, x, y, //FLIP(y),
- width, height);
- }
- ggiSetGCForeground(ggi_ctx->ggi_visual, ggi_ctx->color);
-
- mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
- }
- _swrast_Clear(ctx, mask);
-
-}
-
-
-/* Set the buffer used for reading */
-/* XXX support for separate read/draw buffers hasn't been tested */
-static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- printf("set read %d\n", bufferBit);
- GGIMESADPRINT_CORE("gl_ggiSetBuffer() called\n");
-
- if (bufferBit == DD_FRONT_LEFT_BIT)
- {
- ggiSetReadFrame(ggi_ctx->ggi_visual,
- ggiGetDisplayFrame(ggi_ctx->ggi_visual));
- ggiSetWriteFrame(ggi_ctx->ggi_visual,
- ggiGetDisplayFrame(ggi_ctx->ggi_visual));
- return GL_TRUE;
- }
- else if (bufferBit == DD_BACK_LEFT_BIT)
- {
- ggiSetReadFrame(ggi_ctx->ggi_visual,
- ggiGetDisplayFrame(ggi_ctx->ggi_visual)?0 : 1);
- ggiSetWriteFrame(ggi_ctx->ggi_visual,
- ggiGetDisplayFrame(ggi_ctx->ggi_visual)?0 : 1);
- return GL_TRUE;
- }
- else
- return GL_FALSE;
-}
-
-
-static const GLubyte * gl_ggiGetString(GLcontext *ctx, GLenum name)
-{
- GGIMESADPRINT_CORE("gl_ggiGetString() called\n");
-
- if (name == GL_RENDERER) {
- return (GLubyte *) "Mesa GGI";
- } else {
- return NULL;
- }
-}
-
-static void gl_ggiFlush(GLcontext *ctx)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiFlush() called\n");
-
- ggiFlush(ggi_ctx->ggi_visual);
-}
-
-static void gl_ggiIndexMask(GLcontext *ctx, GLuint mask)
-{
- GGIMESADPRINT_CORE("gl_ggiIndexMask() called\n");
-}
-
-static void gl_ggiColorMask(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
- GLboolean bmask, GLboolean amask)
-{
- GGIMESADPRINT_CORE("gl_ggiColorMask() called\n");
-}
-
-static void gl_ggiEnable(GLcontext *ctx, GLenum pname, GLboolean state)
-{
- GGIMESADPRINT_CORE("gl_ggiEnable() called\n");
-}
-
-static void gl_ggiSetupPointers(GLcontext *ctx)
-{
- TNLcontext *tnl;
-
- GGIMESADPRINT_CORE("gl_ggiSetupPointers() called\n");
-
- /* Plug in default driver functions */
- _mesa_init_driver_functions(&ctx->Driver);
-
- /* Plug in ggi-specific functions */
- ctx->Driver.GetString = gl_ggiGetString;
- ctx->Driver.GetBufferSize = gl_ggiGetSize;
- ctx->Driver.Viewport = gl_ggiViewport;
- ctx->Driver.Finish = gl_ggiFlush;
- ctx->Driver.Flush = gl_ggiFlush;
- ctx->Driver.Clear = gl_ggiClear;
- ctx->Driver.ClearIndex = gl_ggiSetClearIndex;
- ctx->Driver.ClearColor = gl_ggiSetClearColor;
- ctx->Driver.IndexMask = gl_ggiIndexMask;
- ctx->Driver.ColorMask = gl_ggiColorMask;
- ctx->Driver.Enable = gl_ggiEnable;
- ctx->Driver.UpdateState = gl_ggiUpdateState;
-
- /* Initialize TNL driver interface */
- tnl = TNL_CONTEXT(ctx);
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
-
- /* Install setup for tnl */
- _swsetup_Wakeup(ctx);
-}
-
-static void get_mode_info(ggi_visual_t vis, int *r, int *g, int *b,
- GLboolean *rgb, GLboolean *db, int *ci)
-{
- unsigned int i;
-
- *r = 0;
- *g = 0;
- *b = 0;
-
- for(i = 0; i < sizeof(ggi_pixel)*8; ++i) {
- int mask = 1 << i;
- if (LIBGGI_PIXFMT(vis)->red_mask & mask)
- ++(*r);
- if (LIBGGI_PIXFMT(vis)->green_mask & mask)
- ++(*g);
- if (LIBGGI_PIXFMT(vis)->blue_mask & mask)
- ++(*b);
- }
-
- *rgb = GT_SCHEME(LIBGGI_MODE(vis)->graphtype) == GT_TRUECOLOR;
- *db = LIBGGI_MODE(vis)->frames > 1;
- *ci = GT_SIZE(LIBGGI_MODE(vis)->graphtype);
-
- printf("rgb (%d, %d, %d) db %d, rgb %d ci %d\n",*r,*g,*b,*db,*rgb,*ci);
-}
-
-
-int ggiMesaAttach(ggi_visual_t vis)
-{
- int rc;
-
- GGIMESADPRINT_CORE("ggiMesaAttach() called\n");
-
- rc = ggiExtensionAttach(vis, _ggiMesaID);
- if (rc == 0)
- {
- int r, g, b, ci;
- GLboolean rgb, db;
- GLvisual *gl_visual;
-
- /* We are creating the primary instance */
- memset(LIBGGI_MESAEXT(vis), 0, sizeof(struct ggi_mesa_ext));
- LIBGGI_MESAEXT(vis)->update_state = (void *)_ggi_error;
- LIBGGI_MESAEXT(vis)->setup_driver = (void *)_ggi_error;
-
- /* Initialize default mesa visual */
- get_mode_info(vis, &r, &g, &b, &rgb, &db, &ci);
- gl_visual = &(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual);
- _mesa_initialize_visual(gl_visual,
- rgb, db, 0 /* No stereo */,
- r, g, b, 0 /* No alpha */, ci,
- 0 /* No depth */, 0 /* No stencil */,
- 0, 0, 0, 0 /* No accum */, 0);
-
- /* Now fake an "API change" so the right libs get loaded */
- changed(vis, GGI_CHG_APILIST);
- }
-
- return rc;
-}
-
-int ggiMesaDetach(ggi_visual_t vis)
-{
- GGIMESADPRINT_CORE("ggiMesaDetach() called\n");
-
- return ggiExtensionDetach(vis, _ggiMesaID);
-}
-
-int ggiMesaExtendVisual(ggi_visual_t vis, GLboolean alpha_flag,
- GLboolean stereo_flag, GLint depth_size,
- GLint stencil_size, GLint accum_red_size,
- GLint accum_green_size, GLint accum_blue_size,
- GLint accum_alpha_size, GLint num_samples)
-{
- GLvisual *gl_vis = &(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual);
- int r, g, b, ci;
- GLboolean db, rgb;
-
- get_mode_info(vis, &r, &g, &b, &rgb, &db, &ci);
-
- /* Initialize the visual with the provided information */
- _mesa_initialize_visual(gl_vis,
- rgb, db, stereo_flag,
- r, g, b, 0 /* FIXME */, ci,
- depth_size, stencil_size,
- accum_red_size, accum_green_size,
- accum_blue_size, accum_alpha_size, 0);
-
- /* Now fake an "API change" so the right libs get loaded. After all,
- extending the visual by all these new buffers could be considered
- a "mode change" which requires an "API change".
- */
- changed(vis, GGI_CHG_APILIST);
-
- return 0;
-}
-
-
-ggi_mesa_context_t ggiMesaCreateContext(ggi_visual_t vis)
-{
- ggi_mesa_context_t ctx;
- int err;
-
- GGIMESADPRINT_CORE("ggiMesaCreateContext() called\n");
-
- ctx = (ggi_mesa_context_t)malloc(sizeof(struct ggi_mesa_context));
- if (!ctx)
- return NULL;
-
- ctx->ggi_visual = vis;
- ctx->color = 0;
-
- ctx->gl_ctx =
- _mesa_create_context(&(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual),
- NULL, (void *) ctx, GL_FALSE);
- if (!ctx->gl_ctx)
- goto free_context;
-
- _mesa_enable_sw_extensions(ctx->gl_ctx);
-
- _swrast_CreateContext(ctx->gl_ctx);
- _vbo_CreateContext(ctx->gl_ctx);
- _tnl_CreateContext(ctx->gl_ctx);
- _swsetup_CreateContext(ctx->gl_ctx);
-
- gl_ggiSetupPointers(ctx->gl_ctx);
-
- /* Make sure that an appropriate sublib has been loaded */
- if (!LIBGGI_MESAEXT(ctx->ggi_visual)->setup_driver){
- GGIMESADPRINT_CORE("setup_driver==NULL!\n");
- GGIMESADPRINT_CORE("Please check your config files!\n");
- goto free_context;
- }
-
- /* Set up the sublib driver */
- err = LIBGGI_MESAEXT(ctx->ggi_visual)->setup_driver(ctx);
- if (err){
- GGIMESADPRINT_CORE("setup_driver failed (err = %d)", err);
- goto free_gl_context;
- }
-
- return ctx;
-
-free_gl_context:
- _mesa_destroy_context(ctx->gl_ctx);
-free_context:
- free(ctx);
-
- return NULL;
-}
-
-void ggiMesaDestroyContext(ggi_mesa_context_t ctx)
-{
- GGIMESADPRINT_CORE("ggiMesaDestroyContext() called\n");
-
- if(!ctx)
- return;
-
- _mesa_destroy_context(ctx->gl_ctx);
- free(ctx);
-}
-
-void ggiMesaMakeCurrent(ggi_mesa_context_t ctx, ggi_visual_t vis)
-{
- GGIMESADPRINT_CORE("ggiMesaMakeCurrent(ctx = %p) called\n", ctx);
-
- /* FIXME: clean up where are ggi_vis */
- if (ctx->ggi_visual != vis) {
- GGIMESADPRINT_CORE("Cannot migrate GL contexts\n");
- return;
- }
-
- _mesa_make_current(ctx->gl_ctx, &LIBGGI_MESAEXT(vis)->mesa_buffer);
-}
-
-
-/*
- * Swap front/back buffers for current context if double buffered.
- */
-void ggiMesaSwapBuffers(void)
-{
- GLcontext *ctx;
- ggi_mesa_context_t ggi_ctx;
- ctx = _mesa_get_current_context();
- ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("ggiMesaSwapBuffers() called\n");
-
- _mesa_notifySwapBuffers(ctx);
- gl_ggiFlush(ctx);
-
- ggiSetDisplayFrame(ggi_ctx->ggi_visual,
- !ggiGetDisplayFrame(ggi_ctx->ggi_visual));
- ggiSetWriteFrame(ggi_ctx->ggi_visual,
- !ggiGetWriteFrame(ggi_ctx->ggi_visual));
- ggiSetReadFrame(ggi_ctx->ggi_visual,
- !ggiGetReadFrame(ggi_ctx->ggi_visual));
-
- GGIMESADPRINT_CORE("swap disp: %d, write %d\n",
- ggiGetDisplayFrame(ggi_ctx->ggi_visual),
- ggiGetWriteFrame(ggi_ctx->ggi_visual));
-}
-
-static void gl_ggiUpdateState(GLcontext *ctx, GLuint new_state)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiUpdateState() called\n");
-
- /* Propogate statechange information to swrast and swrast_setup
- * modules. The GGI driver has no internal GL-dependent state.
- */
- _swrast_InvalidateState(ctx, new_state);
- _swsetup_InvalidateState(ctx, new_state);
- _tnl_InvalidateState(ctx, new_state);
-
- /* XXX: Better use an assertion that bails out here on failure */
- if (!LIBGGI_MESAEXT(ggi_ctx->ggi_visual)->update_state) {
- GGIMESADPRINT_CORE("update_state == NULL!\n");
- GGIMESADPRINT_CORE("Please check your config files!\n");
- ggiPanic("");
- }
-
- LIBGGI_MESAEXT(ggi_ctx->ggi_visual)->update_state(ggi_ctx);
-}
-
diff --git a/src/mesa/drivers/ggi/ggimesa.conf.in b/src/mesa/drivers/ggi/ggimesa.conf.in
deleted file mode 100644
index 72132334fd0..00000000000
--- a/src/mesa/drivers/ggi/ggimesa.conf.in
+++ /dev/null
@@ -1,13 +0,0 @@
-# GGIMesa global configuration
-.root: @ggi_libdir@/ggi/mesa
-
-generic-stubs-mesa default/stubs.so
-generic-linear-8-mesa default/linear_8.so
-generic-linear-15-mesa default/linear_15.so
-generic-linear-16-mesa default/linear_16.so
-generic-linear-24-mesa default/linear_24.so
-generic-linear-32-mesa default/linear_32.so
-
-display-fbdev-mesa display/fbdev.so
-
-# .include @ggi_confdir@/ggi/mesa/targets/fbdev.conf
diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/debug.h b/src/mesa/drivers/ggi/include/ggi/mesa/debug.h
deleted file mode 100644
index f461fee72c6..00000000000
--- a/src/mesa/drivers/ggi/include/ggi/mesa/debug.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
-******************************************************************************
-
- GGIMesa debugging macros
-
- Copyright (C) 1998-1999 Marcus Sundberg [marcus@ggi-project.org]
- Copyright (C) 1999-2000 Jon Taylor [taylorj@ggi-project.org]
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************************
-*/
-
-#ifndef _GGI_MESA_INTERNAL_DEBUG_H
-#define _GGI_MESA_INTERNAL_DEBUG_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <ggi/types.h>
-#include <ggi/gg.h>
-
-#ifndef DEBUG
-#define DEBUG
-#endif
-
-__BEGIN_DECLS
-
-/* Exported variables */
-#ifdef BUILDING_GGIMESA
-extern uint32 _ggimesaDebugState;
-extern int _ggimesaDebugSync;
-#else
-IMPORTVAR uint32 _ggimesaDebugState;
-IMPORTVAR int _ggimesaDebugSync;
-#endif
-
-__END_DECLS
-
-
-/* Debugging types
- * bit 0 is reserved! */
-
-#define GGIMESADEBUG_CORE (1<<1) /* 2 */
-#define GGIMESADEBUG_MODE (1<<2) /* 4 */
-#define GGIMESADEBUG_COLOR (1<<3) /* 8 */
-#define GGIMESADEBUG_DRAW (1<<4) /* 16 */
-#define GGIMESADEBUG_MISC (1<<5) /* 32 */
-#define GGIMESADEBUG_LIBS (1<<6) /* 64 */
-#define GGIMESADEBUG_EVENTS (1<<7) /* 128 */
-
-#define GGIMESADEBUG_ALL 0xffffffff
-
-#ifdef __GNUC__
-
-#ifdef DEBUG
-#define GGIMESADPRINT(args...) if (_ggimesaDebugState) { ggDPrintf(_ggimesaDebugSync, "GGIMesa",args); }
-#define GGIMESADPRINT_CORE(args...) if (_ggimesaDebugState & GGIMESADEBUG_CORE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_MODE(args...) if (_ggimesaDebugState & GGIMESADEBUG_MODE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_COLOR(args...) if (_ggimesaDebugState & GGIMESADEBUG_COLOR) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_DRAW(args...) if (_ggimesaDebugState & GGIMESADEBUG_DRAW) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_MISC(args...) if (_ggimesaDebugState & GGIMESADEBUG_MISC) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_LIBS(args...) if (_ggimesaDebugState & GGIMESADEBUG_LIBS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_EVENTS(args...) if (_ggimesaDebugState & GGIMESADEBUG_EVENTS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#else /* DEBUG */
-#define GGIMESADPRINT(args...) do{}while(0)
-#define GGIMESADPRINT_CORE(args...) do{}while(0)
-#define GGIMESADPRINT_MODE(args...) do{}while(0)
-#define GGIMESADPRINT_COLOR(args...) do{}while(0)
-#define GGIMESADPRINT_DRAW(args...) do{}while(0)
-#define GGIMESADPRINT_MISC(args...) do{}while(0)
-#define GGIMESADPRINT_LIBS(args...) do{}while(0)
-#define GGIMESADPRINT_EVENTS(args...) do{}while(0)
-#endif /* DEBUG */
-
-#else /* __GNUC__ */
-
-__BEGIN_DECLS
-
-static inline void GGIMESADPRINT(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_CORE(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_CORE) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_MODE(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_MODE) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_COLOR(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_COLOR) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_DRAW(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_DRAW) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_MISC(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_MISC) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_LIBS(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_LIBS) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_EVENTS(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_EVENTS) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-__END_DECLS
-
-#endif /* __GNUC__ */
-
-#ifdef DEBUG
-#define GGIMESA_ASSERT(x,str) \
-{ if (!(x)) { \
- fprintf(stderr,"GGIMESA:%s:%d: INTERNAL ERROR: %s\n",__FILE__,__LINE__,str); \
- exit(1); \
-} }
-#define GGIMESA_APPASSERT(x,str) \
-{ if (!(x)) { \
- fprintf(stderr,"GGIMESA:%s:%d: APPLICATION ERROR: %s\n",__FILE__,__LINE__,str); \
- exit(1); \
-} }
-#else /* DEBUG */
-#define GGIMESA_ASSERT(x,str) do{}while(0)
-#define GGIMESA_APPASSERT(x,str) do{}while(0)
-#endif /* DEBUG */
-
-#ifdef DEBUG
-# define GGIMESAD0(x) x
-#else
-# define GGIMESAD0(x) /* empty */
-#endif
-
-#ifdef GGIMESADLEV
-# if GGIMESADLEV == 1
-# define GGIMESAD1(x) x
-# define GGIMESAD2(x) /* empty */
-# define GGIMESAD3(x) /* empty */
-# elif GGIMESADLEV == 2
-# define GGIMESAD1(x) x
-# define GGIMESAD2(x) x
-# define GGIMESAD3(x) /* empty */
-# elif GGIMESADLEV > 2
-# define GGIMESAD1(x) x
-# define GGIMESAD2(x) x
-# define GGIMESAD3(x) x
-# endif
-#else
-# define GGIMESAD1(x) /* empty */
-# define GGIMESAD2(x) /* empty */
-# define GGIMESAD3(x) /* empty */
-#endif
-
-#endif /* _GGI_MESA_INTERNAL_DEBUG_H */
diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h b/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h
deleted file mode 100644
index 5c3c1e290c9..00000000000
--- a/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _GGIMESA_DISPLAY_FBDEV_H
-#define _GGIMESA_DISPLAY_FBDEV_H
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/display/fbdev.h>
-
-ggifunc_setmode GGIMesa_fbdev_setmode;
-ggifunc_getapi GGIMesa_fbdev_getapi;
-
-#define FBDEV_PRIV_MESA(vis) ((struct fbdev_priv_mesa *)(FBDEV_PRIV(vis)->accelpriv))
-
-struct fbdev_priv_mesa
-{
- char *accel;
- int have_accel;
- void *accelpriv;
- ggi_fbdev_priv *oldpriv; /* Hooks back to the LibGGI fbdev target's private data */
-};
-
-#endif /* _GGIMESA_DISPLAY_FBDEV_H */
diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h
deleted file mode 100644
index ecdbe414f8a..00000000000
--- a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#ifndef _GGIMESA_H
-#define _GGIMESA_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include "config.h"
-#include "context.h"
-#include "drawpix.h"
-#include "imports.h"
-#include "matrix.h"
-#include "state.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "depth.h"
-
-#undef ASSERT /* ASSERT is redefined */
-
-#include <ggi/internal/internal.h>
-#include <ggi/ggi_ext.h>
-#include <ggi/ggi.h>
-#include "GL/ggimesa.h"
-
-/*
- * GGIMesa visual configuration.
- *
- * This structure "derives" from Mesa's GLvisual and extends it by
- * GGI's visual. Combination of these two structures is enough to fully
- * describe the mode the application is currently running in. GGI
- * visual provides information about color configuration and buffering
- * method, GLvisual fills the rest.
- */
-struct ggi_mesa_visual {
- GLvisual gl_visual;
- ggi_visual_t ggi_visual;
-};
-
-/*
- * GGIMesa context.
- *
- * GGIMesa context expands the Mesa's context (it doesn't actualy derive
- * from it, but this ability isn't needed, and it is best if GL context
- * creation is left up to Mesa). It also contains a reference to the GGI
- * visual it is attached to, which is very useful for all Mesa callbacks.
- */
-struct ggi_mesa_context
-{
- GLcontext *gl_ctx;
- ggi_visual_t ggi_visual;
-
- ggi_pixel color; /* Current color or index*/
- ggi_pixel clearcolor;
-
- void *priv;
-};
-
-#define SHIFT (GGI_COLOR_PRECISION - 8)
-
-#endif
-
diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h
deleted file mode 100644
index faafc779e64..00000000000
--- a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _GGI_MESA_INT_H
-#define _GGI_MESA_INT_H
-
-#include <ggi/internal/internal.h>
-#include "ggimesa.h"
-
-
-extern ggi_extid _ggiMesaID;
-
-ggifunc_setmode GGIMesa_setmode;
-ggifunc_getapi GGIMesa_getapi;
-
-typedef struct ggi_mesa_ext
-{
- /*
- * How mesa extends this visual; i.e., size of the depth buffer etc.
- *
- * By default (upon attaching) this structure is initialized to what
- * libggi is guaranteed to handle without any help: single buffered
- * visual without any ancilary buffers.
- */
- struct ggi_mesa_visual mesa_visual;
-
- /*
- * Mesa framebuffer is a collection of all ancilary buffers required.
- *
- * This structure contains the ancilary buffers provided in in
- * software. On each mode change it is loaded with the list of
- * required buffers and the target is expected to clear the ones
- * it can provide in hw. The remaining ones are then provided in sw.
- *
- */
- GLframebuffer mesa_buffer;
-
- void (*update_state)(ggi_mesa_context_t ctx);
- int (*setup_driver)(ggi_mesa_context_t ctx);
-
- void *private;
-} ggi_mesa_ext_t;
-
-#define LIBGGI_MESAEXT(vis) ((ggi_mesa_ext_t *)LIBGGI_EXT(vis,_ggiMesaID))
-#define GGIMESA_PRIV(vis) ((LIBGGI_MESAEXT(vis)->priv))
-
-#endif /* _GGI_MISC_INT_H */
diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c
deleted file mode 100644
index 238f4915995..00000000000
--- a/src/mesa/drivers/glide/fxapi.c
+++ /dev/null
@@ -1,951 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-
-/* fxapi.c - public interface to FX/Mesa functions (fxmesa.h) */
-
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#if defined(FX)
-#include "fxdrv.h"
-
-#include "drivers/common/driverfuncs.h"
-#include "main/framebuffer.h"
-
-#ifndef TDFX_DEBUG
-int TDFX_DEBUG = (0
-/* | VERBOSE_VARRAY */
-/* | VERBOSE_TEXTURE */
-/* | VERBOSE_IMMEDIATE */
-/* | VERBOSE_PIPELINE */
-/* | VERBOSE_DRIVER */
-/* | VERBOSE_STATE */
-/* | VERBOSE_API */
-/* | VERBOSE_DISPLAY_LIST */
-/* | VERBOSE_LIGHTING */
-/* | VERBOSE_PRIMS */
-/* | VERBOSE_VERTS */
- );
-#endif
-
-static fxMesaContext fxMesaCurrentCtx = NULL;
-
-/*
- * Status of 3Dfx hardware initialization
- */
-
-static int glbGlideInitialized = 0;
-static int glb3DfxPresent = 0;
-static int glbTotNumCtx = 0;
-
-static GrHwConfiguration glbHWConfig;
-static int glbCurrentBoard = 0;
-
-
-#if defined(__WIN32__)
-static int
-cleangraphics(void)
-{
- glbTotNumCtx = 1;
- fxMesaDestroyContext(fxMesaCurrentCtx);
-
- return 0;
-}
-#elif defined(__linux__)
-static void
-cleangraphics(void)
-{
- glbTotNumCtx = 1;
- fxMesaDestroyContext(fxMesaCurrentCtx);
-}
-
-static void
-cleangraphics_handler(int s)
-{
- fprintf(stderr, "fxmesa: ERROR: received a not handled signal %d\n", s);
-
- cleangraphics();
-/* abort(); */
- exit(1);
-}
-#endif
-
-
-/*
- * Query 3Dfx hardware presence/kind
- */
-static GLboolean GLAPIENTRY fxQueryHardware (void)
-{
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxQueryHardware()\n");
- }
-
- if (!glbGlideInitialized) {
- grGlideInit();
- glb3DfxPresent = FX_grSstQueryHardware(&glbHWConfig);
-
- glbGlideInitialized = 1;
-
-#if defined(__WIN32__)
- _onexit((_onexit_t) cleangraphics);
-#elif defined(__linux__)
- /* Only register handler if environment variable is not defined. */
- if (!getenv("MESA_FX_NO_SIGNALS")) {
- atexit(cleangraphics);
- }
-#endif
- }
-
- return glb3DfxPresent;
-}
-
-
-/*
- * Select the Voodoo board to use when creating
- * a new context.
- */
-GLint GLAPIENTRY fxMesaSelectCurrentBoard (int n)
-{
- fxQueryHardware();
-
- if ((n < 0) || (n >= glbHWConfig.num_sst))
- return -1;
-
- return glbHWConfig.SSTs[glbCurrentBoard = n].type;
-}
-
-
-fxMesaContext GLAPIENTRY fxMesaGetCurrentContext (void)
-{
- return fxMesaCurrentCtx;
-}
-
-
-void GLAPIENTRY fxGetScreenGeometry (GLint *w, GLint *h)
-{
- GLint width = 0;
- GLint height = 0;
-
- if (fxMesaCurrentCtx != NULL) {
- width = fxMesaCurrentCtx->screen_width;
- height = fxMesaCurrentCtx->screen_height;
- }
-
- if (w != NULL) {
- *w = width;
- }
- if (h != NULL) {
- *h = height;
- }
-}
-
-
-/*
- * The 3Dfx Global Palette extension for GLQuake.
- * More a trick than a real extesion, use the shared global
- * palette extension.
- */
-extern void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint * pal); /* silence warning */
-void GLAPIENTRY
-gl3DfxSetPaletteEXT(GLuint * pal)
-{
- fxMesaContext fxMesa = fxMesaCurrentCtx;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- int i;
-
- fprintf(stderr, "gl3DfxSetPaletteEXT(...)\n");
-
- for (i = 0; i < 256; i++) {
- fprintf(stderr, "\t%x\n", pal[i]);
- }
- }
-
- if (fxMesa) {
- fxMesa->haveGlobalPaletteTexture = 1;
-
- grTexDownloadTable(GR_TEXTABLE_PALETTE, (GuTexPalette *) pal);
- }
-}
-
-
-static GrScreenResolution_t fxBestResolution (int width, int height)
-{
- static int resolutions[][3] = {
- { GR_RESOLUTION_320x200, 320, 200 },
- { GR_RESOLUTION_320x240, 320, 240 },
- { GR_RESOLUTION_400x256, 400, 256 },
- { GR_RESOLUTION_512x384, 512, 384 },
- { GR_RESOLUTION_640x200, 640, 200 },
- { GR_RESOLUTION_640x350, 640, 350 },
- { GR_RESOLUTION_640x400, 640, 400 },
- { GR_RESOLUTION_640x480, 640, 480 },
- { GR_RESOLUTION_800x600, 800, 600 },
- { GR_RESOLUTION_960x720, 960, 720 },
- { GR_RESOLUTION_856x480, 856, 480 },
- { GR_RESOLUTION_512x256, 512, 256 },
- { GR_RESOLUTION_1024x768, 1024, 768 },
- { GR_RESOLUTION_1280x1024, 1280, 1024 },
- { GR_RESOLUTION_1600x1200, 1600, 1200 },
- { GR_RESOLUTION_400x300, 400, 300 },
- { GR_RESOLUTION_1152x864, 1152, 864 },
- { GR_RESOLUTION_1280x960, 1280, 960 },
- { GR_RESOLUTION_1600x1024, 1600, 1024 },
- { GR_RESOLUTION_1792x1344, 1792, 1344 },
- { GR_RESOLUTION_1856x1392, 1856, 1392 },
- { GR_RESOLUTION_1920x1440, 1920, 1440 },
- { GR_RESOLUTION_2048x1536, 2048, 1536 },
- { GR_RESOLUTION_2048x2048, 2048, 2048 }
- };
-
- int i, size;
- int lastvalidres = GR_RESOLUTION_640x480;
- int min = 2048 * 2048; /* max is GR_RESOLUTION_2048x2048 */
- GrResolution resTemplate = {
- GR_QUERY_ANY,
- GR_QUERY_ANY,
- 2 /*GR_QUERY_ANY */,
- GR_QUERY_ANY
- };
- GrResolution *presSupported;
-
- fxQueryHardware();
-
- size = grQueryResolutions(&resTemplate, NULL);
- presSupported = malloc(size);
-
- size /= sizeof(GrResolution);
- grQueryResolutions(&resTemplate, presSupported);
-
- for (i = 0; i < size; i++) {
- int r = presSupported[i].resolution;
- if ((width <= resolutions[r][1]) && (height <= resolutions[r][2])) {
- if (min > (resolutions[r][1] * resolutions[r][2])) {
- min = resolutions[r][1] * resolutions[r][2];
- lastvalidres = r;
- }
- }
- }
-
- free(presSupported);
-
- return resolutions[lastvalidres][0];
-}
-
-
-fxMesaContext GLAPIENTRY
-fxMesaCreateBestContext(GLuint win, GLint width, GLint height,
- const GLint attribList[])
-{
- int res = fxBestResolution(width, height);
-
- if (res == -1) {
- return NULL;
- }
-
- return fxMesaCreateContext(win, res, GR_REFRESH_60Hz, attribList);
-}
-
-
-/*
- * Create a new FX/Mesa context and return a handle to it.
- */
-fxMesaContext GLAPIENTRY
-fxMesaCreateContext(GLuint win,
- GrScreenResolution_t res,
- GrScreenRefresh_t ref, const GLint attribList[])
-{
- fxMesaContext fxMesa = NULL;
- GLcontext *ctx = NULL, *shareCtx = NULL;
- struct dd_function_table functions;
-
- int i;
- const char *str;
- int sliaa, numSLI, samplesPerChip;
- struct SstCard_St *voodoo;
- struct tdfx_glide *Glide;
-
- GLboolean aux;
- GLboolean doubleBuffer;
- GLuint colDepth;
- GLuint depthSize, alphaSize, stencilSize, accumSize;
- GLuint redBits, greenBits, blueBits, alphaBits;
- GrPixelFormat_t pixFmt;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxMesaCreateContext(...)\n");
- }
-
- /* Okay, first process the user flags */
- aux = GL_FALSE;
- doubleBuffer = GL_FALSE;
- colDepth = 16;
- depthSize = alphaSize = stencilSize = accumSize = 0;
-
- i = 0;
- while (attribList[i] != FXMESA_NONE) {
- switch (attribList[i]) {
- case FXMESA_COLORDEPTH:
- colDepth = attribList[++i];
- break;
- case FXMESA_DOUBLEBUFFER:
- doubleBuffer = GL_TRUE;
- break;
- case FXMESA_ALPHA_SIZE:
- if ((alphaSize = attribList[++i])) {
- aux = GL_TRUE;
- }
- break;
- case FXMESA_DEPTH_SIZE:
- if ((depthSize = attribList[++i])) {
- aux = GL_TRUE;
- }
- break;
- case FXMESA_STENCIL_SIZE:
- stencilSize = attribList[++i];
- break;
- case FXMESA_ACCUM_SIZE:
- accumSize = attribList[++i];
- break;
- /* XXX ugly hack here for sharing display lists */
- case FXMESA_SHARE_CONTEXT:
- shareCtx = (GLcontext *)attribList[++i];
- break;
- default:
- fprintf(stderr, "fxMesaCreateContext: ERROR: wrong parameter (%d) passed\n", attribList[i]);
- return NULL;
- }
- i++;
- }
-
- if (!fxQueryHardware()) {
- str = "no Voodoo hardware!";
- goto errorhandler;
- }
-
- grSstSelect(glbCurrentBoard);
- /*grEnable(GR_OPENGL_MODE_EXT);*/ /* [koolsmoky] */
- voodoo = &glbHWConfig.SSTs[glbCurrentBoard];
-
- fxMesa = (fxMesaContext)CALLOC_STRUCT(tfxMesaContext);
- if (!fxMesa) {
- str = "private context";
- goto errorhandler;
- }
-
- if (getenv("MESA_FX_INFO")) {
- fxMesa->verbose = GL_TRUE;
- }
-
- fxMesa->type = voodoo->type;
- fxMesa->HavePalExt = voodoo->HavePalExt && !getenv("MESA_FX_IGNORE_PALEXT");
- fxMesa->HavePixExt = voodoo->HavePixExt && !getenv("MESA_FX_IGNORE_PIXEXT");
- fxMesa->HaveTexFmt = voodoo->HaveTexFmt && !getenv("MESA_FX_IGNORE_TEXFMT");
- fxMesa->HaveCmbExt = voodoo->HaveCmbExt && !getenv("MESA_FX_IGNORE_CMBEXT");
- fxMesa->HaveMirExt = voodoo->HaveMirExt && !getenv("MESA_FX_IGNORE_MIREXT");
- fxMesa->HaveTexUma = voodoo->HaveTexUma && !getenv("MESA_FX_IGNORE_TEXUMA");
- fxMesa->Glide = glbHWConfig.Glide;
- Glide = &fxMesa->Glide;
- fxMesa->HaveTexus2 = Glide->txImgQuantize &&
- Glide->txMipQuantize &&
- Glide->txPalToNcc && !getenv("MESA_FX_IGNORE_TEXUS2");
-
- /* Determine if we need vertex swapping, RGB order and SLI/AA */
- sliaa = 0;
- switch (fxMesa->type) {
- case GR_SSTTYPE_VOODOO:
- case GR_SSTTYPE_SST96:
- case GR_SSTTYPE_Banshee:
- fxMesa->bgrOrder = GL_TRUE;
- fxMesa->snapVertices = (getenv("MESA_FX_NOSNAP") == NULL);
- break;
- case GR_SSTTYPE_Voodoo2:
- fxMesa->bgrOrder = GL_TRUE;
- fxMesa->snapVertices = GL_FALSE;
- break;
- case GR_SSTTYPE_Voodoo4:
- case GR_SSTTYPE_Voodoo5:
- /* number of SLI units and AA Samples per chip */
- if ((str = Glide->grGetRegistryOrEnvironmentStringExt("SSTH3_SLI_AA_CONFIGURATION")) != NULL) {
- sliaa = atoi(str);
- }
- case GR_SSTTYPE_Voodoo3:
- default:
- fxMesa->bgrOrder = GL_FALSE;
- fxMesa->snapVertices = GL_FALSE;
- break;
- }
- /* XXX todo - Add the old SLI/AA settings for Napalm. */
- switch(voodoo->numChips) {
- case 4: /* 4 chips */
- switch(sliaa) {
- case 8: /* 8 Sample AA */
- numSLI = 1;
- samplesPerChip = 2;
- break;
- case 7: /* 4 Sample AA */
- numSLI = 1;
- samplesPerChip = 1;
- break;
- case 6: /* 2 Sample AA */
- numSLI = 2;
- samplesPerChip = 1;
- break;
- default:
- numSLI = 4;
- samplesPerChip = 1;
- }
- break;
- case 2: /* 2 chips */
- switch(sliaa) {
- case 4: /* 4 Sample AA */
- numSLI = 1;
- samplesPerChip = 2;
- break;
- case 3: /* 2 Sample AA */
- numSLI = 1;
- samplesPerChip = 1;
- break;
- default:
- numSLI = 2;
- samplesPerChip = 1;
- }
- break;
- default: /* 1 chip */
- switch(sliaa) {
- case 1: /* 2 Sample AA */
- numSLI = 1;
- samplesPerChip = 2;
- break;
- default:
- numSLI = 1;
- samplesPerChip = 1;
- }
- }
-
- fxMesa->fsaa = samplesPerChip * voodoo->numChips / numSLI; /* 1:noFSAA, 2:2xFSAA, 4:4xFSAA, 8:8xFSAA */
-
- switch (fxMesa->colDepth = colDepth) {
- case 15:
- redBits = 5;
- greenBits = 5;
- blueBits = 5;
- alphaBits = depthSize ? 1 : 8;
- switch(fxMesa->fsaa) {
- case 8:
- pixFmt = GR_PIXFMT_AA_8_ARGB_1555;
- break;
- case 4:
- pixFmt = GR_PIXFMT_AA_4_ARGB_1555;
- break;
- case 2:
- pixFmt = GR_PIXFMT_AA_2_ARGB_1555;
- break;
- default:
- pixFmt = GR_PIXFMT_ARGB_1555;
- }
- break;
- case 16:
- redBits = 5;
- greenBits = 6;
- blueBits = 5;
- alphaBits = depthSize ? 0 : 8;
- switch(fxMesa->fsaa) {
- case 8:
- pixFmt = GR_PIXFMT_AA_8_RGB_565;
- break;
- case 4:
- pixFmt = GR_PIXFMT_AA_4_RGB_565;
- break;
- case 2:
- pixFmt = GR_PIXFMT_AA_2_RGB_565;
- break;
- default:
- pixFmt = GR_PIXFMT_RGB_565;
- }
- break;
- case 24:
- fxMesa->colDepth = 32;
- case 32:
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
- alphaBits = 8;
- switch(fxMesa->fsaa) {
- case 8:
- pixFmt = GR_PIXFMT_AA_8_ARGB_8888;
- break;
- case 4:
- pixFmt = GR_PIXFMT_AA_4_ARGB_8888;
- break;
- case 2:
- pixFmt = GR_PIXFMT_AA_2_ARGB_8888;
- break;
- default:
- pixFmt = GR_PIXFMT_ARGB_8888;
- }
- break;
- default:
- str = "pixelFormat";
- goto errorhandler;
- }
-
- /* Tips:
- * 1. we don't bother setting/checking AUX for stencil, because we'll decide
- * later whether we have HW stencil, based on depth buffer (thus AUX is
- * properly set)
- * 2. when both DEPTH and ALPHA are enabled, depth should win. However, it is
- * not clear whether 15bpp and 32bpp require AUX alpha buffer. Furthermore,
- * alpha buffering is required only if destination alpha is used in alpha
- * blending; alpha blending modes that do not use destination alpha can be
- * used w/o alpha buffer.
- * 3. `alphaBits' is what we can provide
- * `alphaSize' is what app requests
- * if we cannot provide enough bits for alpha buffer, we should fallback to
- * SW alpha. However, setting `alphaBits' to `alphaSize' might confuse some
- * of the span functions...
- */
-
- fxMesa->haveHwAlpha = GL_FALSE;
- if (alphaSize && (alphaSize <= alphaBits)) {
- alphaSize = alphaBits;
- fxMesa->haveHwAlpha = GL_TRUE;
- }
-
- fxMesa->haveHwStencil = (fxMesa->HavePixExt && stencilSize && depthSize == 24);
-
- fxMesa->haveZBuffer = depthSize > 0;
- fxMesa->haveDoubleBuffer = doubleBuffer;
- fxMesa->haveGlobalPaletteTexture = GL_FALSE;
- fxMesa->board = glbCurrentBoard;
-
- fxMesa->haveTwoTMUs = (voodoo->nTexelfx > 1);
-
- if ((str = Glide->grGetRegistryOrEnvironmentStringExt("FX_GLIDE_NUM_TMU"))) {
- if (atoi(str) <= 1) {
- fxMesa->haveTwoTMUs = GL_FALSE;
- }
- }
-
- if ((str = Glide->grGetRegistryOrEnvironmentStringExt("FX_GLIDE_SWAPPENDINGCOUNT"))) {
- fxMesa->maxPendingSwapBuffers = atoi(str);
- if (fxMesa->maxPendingSwapBuffers > 6) {
- fxMesa->maxPendingSwapBuffers = 6;
- } else if (fxMesa->maxPendingSwapBuffers < 0) {
- fxMesa->maxPendingSwapBuffers = 0;
- }
- } else {
- fxMesa->maxPendingSwapBuffers = 2;
- }
-
- if ((str = Glide->grGetRegistryOrEnvironmentStringExt("FX_GLIDE_SWAPINTERVAL"))) {
- fxMesa->swapInterval = atoi(str);
- } else {
- fxMesa->swapInterval = 0;
- }
-
- BEGIN_BOARD_LOCK();
- if (fxMesa->HavePixExt) {
- fxMesa->glideContext = Glide->grSstWinOpenExt((FxU32)win, res, ref,
- GR_COLORFORMAT_ABGR, GR_ORIGIN_LOWER_LEFT,
- pixFmt,
- 2, aux);
- } else if (pixFmt == GR_PIXFMT_RGB_565) {
- fxMesa->glideContext = grSstWinOpen((FxU32)win, res, ref,
- GR_COLORFORMAT_ABGR, GR_ORIGIN_LOWER_LEFT,
- 2, aux);
- } else {
- fxMesa->glideContext = 0;
- }
- END_BOARD_LOCK();
- if (!fxMesa->glideContext) {
- str = "grSstWinOpen";
- goto errorhandler;
- }
-
- /* screen */
- fxMesa->screen_width = FX_grSstScreenWidth();
- fxMesa->screen_height = FX_grSstScreenHeight();
-
- /* window inside screen */
- fxMesa->width = fxMesa->screen_width;
- fxMesa->height = fxMesa->screen_height;
-
- /* scissor inside window */
- fxMesa->clipMinX = 0;
- fxMesa->clipMaxX = fxMesa->width;
- fxMesa->clipMinY = 0;
- fxMesa->clipMaxY = fxMesa->height;
-
- if (fxMesa->verbose) {
- FxI32 tmuRam, fbRam;
-
- /* Not that it matters, but tmuRam and fbRam change after grSstWinOpen. */
- tmuRam = voodoo->tmuConfig[GR_TMU0].tmuRam;
- fbRam = voodoo->fbRam;
- BEGIN_BOARD_LOCK();
- grGet(GR_MEMORY_TMU, 4, &tmuRam);
- grGet(GR_MEMORY_FB, 4, &fbRam);
- END_BOARD_LOCK();
-
- fprintf(stderr, "Voodoo Using Glide %s\n", grGetString(GR_VERSION));
- fprintf(stderr, "Voodoo Board: %d/%d, %s, %d GPU\n",
- fxMesa->board + 1,
- glbHWConfig.num_sst,
- grGetString(GR_HARDWARE),
- voodoo->numChips);
- fprintf(stderr, "Voodoo Memory: FB = %ld, TM = %d x %ld\n",
- fbRam,
- voodoo->nTexelfx,
- tmuRam);
- fprintf(stderr, "Voodoo Screen: %dx%d:%d %s, %svertex snapping\n",
- fxMesa->screen_width,
- fxMesa->screen_height,
- colDepth,
- fxMesa->bgrOrder ? "BGR" : "RGB",
- fxMesa->snapVertices ? "" : "no ");
- }
-
- sprintf(fxMesa->rendererString, "Mesa %s v0.63 %s%s",
- grGetString(GR_RENDERER),
- grGetString(GR_HARDWARE),
- ((fxMesa->type < GR_SSTTYPE_Voodoo4) && (voodoo->numChips > 1)) ? " SLI" : "");
-
- fxMesa->glVis = _mesa_create_visual(GL_TRUE, /* RGB mode */
- doubleBuffer,
- GL_FALSE, /* stereo */
- redBits, /* RGBA.R bits */
- greenBits, /* RGBA.G bits */
- blueBits, /* RGBA.B bits */
- alphaSize, /* RGBA.A bits */
- 0, /* index bits */
- depthSize, /* depth_size */
- stencilSize, /* stencil_size */
- accumSize,
- accumSize,
- accumSize,
- alphaSize ? accumSize : 0,
- 1);
- if (!fxMesa->glVis) {
- str = "_mesa_create_visual";
- goto errorhandler;
- }
-
- _mesa_init_driver_functions(&functions);
- ctx = fxMesa->glCtx = _mesa_create_context(fxMesa->glVis, shareCtx,
- &functions, (void *) fxMesa);
- if (!ctx) {
- str = "_mesa_create_context";
- goto errorhandler;
- }
-
-
- if (!fxDDInitFxMesaContext(fxMesa)) {
- str = "fxDDInitFxMesaContext";
- goto errorhandler;
- }
-
-
- fxMesa->glBuffer = _mesa_create_framebuffer(fxMesa->glVis);
-#if 0
-/* XXX this is a complete mess :(
- * _mesa_add_soft_renderbuffers
- * driNewRenderbuffer
- */
- GL_FALSE, /* no software depth */
- stencilSize && !fxMesa->haveHwStencil,
- fxMesa->glVis->accumRedBits > 0,
- alphaSize && !fxMesa->haveHwAlpha);
-#endif
- if (!fxMesa->glBuffer) {
- str = "_mesa_create_framebuffer";
- goto errorhandler;
- }
-
- glbTotNumCtx++;
-
- /* install signal handlers */
-#if defined(__linux__)
- /* Only install if environment var. is not set. */
- if (!getenv("MESA_FX_NO_SIGNALS")) {
- signal(SIGINT, cleangraphics_handler);
- signal(SIGHUP, cleangraphics_handler);
- signal(SIGPIPE, cleangraphics_handler);
- signal(SIGFPE, cleangraphics_handler);
- signal(SIGBUS, cleangraphics_handler);
- signal(SIGILL, cleangraphics_handler);
- signal(SIGSEGV, cleangraphics_handler);
- signal(SIGTERM, cleangraphics_handler);
- }
-#endif
-
- return fxMesa;
-
-errorhandler:
- if (fxMesa) {
- if (fxMesa->glideContext) {
- grSstWinClose(fxMesa->glideContext);
- fxMesa->glideContext = 0;
- }
-
- if (fxMesa->state) {
- FREE(fxMesa->state);
- }
- if (fxMesa->fogTable) {
- FREE(fxMesa->fogTable);
- }
- if (fxMesa->glBuffer) {
- _mesa_reference_framebuffer(&fxMesa->glBuffer, NULL);
- }
- if (fxMesa->glVis) {
- _mesa_destroy_visual(fxMesa->glVis);
- }
- if (fxMesa->glCtx) {
- _mesa_destroy_context(fxMesa->glCtx);
- }
- FREE(fxMesa);
- }
-
- fprintf(stderr, "fxMesaCreateContext: ERROR: %s\n", str);
- return NULL;
-}
-
-
-/*
- * Function to set the new window size in the context (mainly for the Voodoo Rush)
- */
-void GLAPIENTRY
-fxMesaUpdateScreenSize(fxMesaContext fxMesa)
-{
- fxMesa->width = FX_grSstScreenWidth();
- fxMesa->height = FX_grSstScreenHeight();
-}
-
-
-/*
- * Destroy the given FX/Mesa context.
- */
-void GLAPIENTRY
-fxMesaDestroyContext(fxMesaContext fxMesa)
-{
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxMesaDestroyContext(...)\n");
- }
-
- if (!fxMesa)
- return;
-
- if (fxMesa->verbose) {
- fprintf(stderr, "Misc Stats:\n");
- fprintf(stderr, " # swap buffer: %u\n", fxMesa->stats.swapBuffer);
-
- if (!fxMesa->stats.swapBuffer)
- fxMesa->stats.swapBuffer = 1;
-
- fprintf(stderr, "Textures Stats:\n");
- fprintf(stderr, " Free texture memory on TMU0: %d\n",
- fxMesa->freeTexMem[FX_TMU0]);
- if (fxMesa->haveTwoTMUs)
- fprintf(stderr, " Free texture memory on TMU1: %d\n",
- fxMesa->freeTexMem[FX_TMU1]);
- fprintf(stderr, " # request to TMM to upload a texture objects: %u\n",
- fxMesa->stats.reqTexUpload);
- fprintf(stderr,
- " # request to TMM to upload a texture objects per swapbuffer: %.2f\n",
- fxMesa->stats.reqTexUpload / (float) fxMesa->stats.swapBuffer);
- fprintf(stderr, " # texture objects uploaded: %u\n",
- fxMesa->stats.texUpload);
- fprintf(stderr, " # texture objects uploaded per swapbuffer: %.2f\n",
- fxMesa->stats.texUpload / (float) fxMesa->stats.swapBuffer);
- fprintf(stderr, " # MBs uploaded to texture memory: %.2f\n",
- fxMesa->stats.memTexUpload / (float) (1 << 20));
- fprintf(stderr,
- " # MBs uploaded to texture memory per swapbuffer: %.2f\n",
- (fxMesa->stats.memTexUpload /
- (float) fxMesa->stats.swapBuffer) / (float) (1 << 20));
- }
-
- glbTotNumCtx--;
-
- if (!glbTotNumCtx && getenv("MESA_FX_INFO")) {
- GrSstPerfStats_t st;
-
- FX_grSstPerfStats(&st);
-
- fprintf(stderr, "Pixels Stats:\n");
- fprintf(stderr, " # pixels processed (minus buffer clears): %u\n",
- (unsigned) st.pixelsIn);
- fprintf(stderr, " # pixels not drawn due to chroma key test failure: %u\n",
- (unsigned) st.chromaFail);
- fprintf(stderr, " # pixels not drawn due to depth test failure: %u\n",
- (unsigned) st.zFuncFail);
- fprintf(stderr,
- " # pixels not drawn due to alpha test failure: %u\n",
- (unsigned) st.aFuncFail);
- fprintf(stderr, " # pixels drawn (including buffer clears and LFB writes): %u\n",
- (unsigned) st.pixelsOut);
- }
-
- /* close the hardware first,
- * so we can debug atexit problems (memory leaks, etc).
- */
- grSstWinClose(fxMesa->glideContext);
- fxCloseHardware();
-
- fxDDDestroyFxMesaContext(fxMesa); /* must be before _mesa_destroy_context */
- _mesa_destroy_visual(fxMesa->glVis);
- _mesa_destroy_context(fxMesa->glCtx);
- _mesa_reference_framebuffer(&fxMesa->glBuffer, NULL);
- fxTMClose(fxMesa); /* must be after _mesa_destroy_context */
-
- FREE(fxMesa);
-
- if (fxMesa == fxMesaCurrentCtx)
- fxMesaCurrentCtx = NULL;
-}
-
-
-/*
- * Make the specified FX/Mesa context the current one.
- */
-void GLAPIENTRY
-fxMesaMakeCurrent(fxMesaContext fxMesa)
-{
- if (!fxMesa) {
- _mesa_make_current(NULL, NULL, NULL);
- fxMesaCurrentCtx = NULL;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxMesaMakeCurrent(NULL)\n");
- }
-
- return;
- }
-
- /* if this context is already the current one, we can return early */
- if (fxMesaCurrentCtx == fxMesa
- && fxMesaCurrentCtx->glCtx == _mesa_get_current_context()) {
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxMesaMakeCurrent(NOP)\n");
- }
-
- return;
- }
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxMesaMakeCurrent(...)\n");
- }
-
- if (fxMesaCurrentCtx)
- grGlideGetState((GrState *) fxMesaCurrentCtx->state);
-
- fxMesaCurrentCtx = fxMesa;
-
- grSstSelect(fxMesa->board);
- grGlideSetState((GrState *) fxMesa->state);
-
- _mesa_make_current(fxMesa->glCtx, fxMesa->glBuffer, fxMesa->glBuffer);
-
- fxSetupDDPointers(fxMesa->glCtx);
-}
-
-
-/*
- * Swap front/back buffers for current context if double buffered.
- */
-void GLAPIENTRY
-fxMesaSwapBuffers(void)
-{
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxMesaSwapBuffers()\n");
- }
-
- if (fxMesaCurrentCtx) {
- _mesa_notifySwapBuffers(fxMesaCurrentCtx->glCtx);
-
- if (fxMesaCurrentCtx->haveDoubleBuffer) {
-
- grBufferSwap(fxMesaCurrentCtx->swapInterval);
-
-#if 0
- /*
- * Don't allow swap buffer commands to build up!
- */
- while (FX_grGetInteger(GR_PENDING_BUFFERSWAPS) >
- fxMesaCurrentCtx->maxPendingSwapBuffers)
- /* The driver is able to sleep when waiting for the completation
- of multiple swapbuffer operations instead of wasting
- CPU time (NOTE: you must uncomment the following line in the
- in order to enable this option) */
- /* usleep(10000); */
- ;
-#endif
-
- fxMesaCurrentCtx->stats.swapBuffer++;
- }
- }
-}
-
-
-/*
- * Shutdown Glide library
- */
-void GLAPIENTRY
-fxCloseHardware(void)
-{
- if (glbGlideInitialized) {
- if (glbTotNumCtx == 0) {
- grGlideShutdown();
- glbGlideInitialized = 0;
- }
- }
-}
-
-
-#else
-
-
-/*
- * Need this to provide at least one external definition.
- */
-extern int gl_fx_dummy_function_api(void);
-int
-gl_fx_dummy_function_api(void)
-{
- return 0;
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
deleted file mode 100644
index 2bc60399ea2..00000000000
--- a/src/mesa/drivers/glide/fxdd.c
+++ /dev/null
@@ -1,2197 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-/* fxdd.c - 3Dfx VooDoo Mesa device driver functions */
-
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#if defined(FX)
-
-#include "main/image.h"
-#include "main/mtypes.h"
-#include "fxdrv.h"
-#include "main/buffers.h"
-#include "main/enums.h"
-#include "main/extensions.h"
-#include "main/macros.h"
-#include "main/texstore.h"
-#include "main/teximage.h"
-#include "swrast/swrast.h"
-#include "swrast/s_context.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "vbo/vbo.h"
-
-
-
-/* lookup table for scaling 4 bit colors up to 8 bits */
-GLuint FX_rgb_scale_4[16] = {
- 0, 17, 34, 51, 68, 85, 102, 119,
- 136, 153, 170, 187, 204, 221, 238, 255
-};
-
-/* lookup table for scaling 5 bit colors up to 8 bits */
-GLuint FX_rgb_scale_5[32] = {
- 0, 8, 16, 25, 33, 41, 49, 58,
- 66, 74, 82, 90, 99, 107, 115, 123,
- 132, 140, 148, 156, 165, 173, 181, 189,
- 197, 206, 214, 222, 230, 239, 247, 255
-};
-
-/* lookup table for scaling 6 bit colors up to 8 bits */
-GLuint FX_rgb_scale_6[64] = {
- 0, 4, 8, 12, 16, 20, 24, 28,
- 32, 36, 40, 45, 49, 53, 57, 61,
- 65, 69, 73, 77, 81, 85, 89, 93,
- 97, 101, 105, 109, 113, 117, 121, 125,
- 130, 134, 138, 142, 146, 150, 154, 158,
- 162, 166, 170, 174, 178, 182, 186, 190,
- 194, 198, 202, 206, 210, 215, 219, 223,
- 227, 231, 235, 239, 243, 247, 251, 255
-};
-
-
-/*
- * Disable color by masking out R, G, B, A
- */
-static void fxDisableColor (fxMesaContext fxMesa)
-{
- if (fxMesa->colDepth == 32) {
- /* 32bpp mode */
- fxMesa->Glide.grColorMaskExt(FXFALSE, FXFALSE, FXFALSE, FXFALSE);
- } else {
- /* 15/16 bpp mode */
- grColorMask(FXFALSE, FXFALSE);
- }
-}
-
-
-/**********************************************************************/
-/***** Miscellaneous functions *****/
-/**********************************************************************/
-
-/* Return buffer size information */
-static void
-fxDDGetBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (ctx && FX_CONTEXT(ctx)) {
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDGetBufferSize(...)\n");
- }
-
- *width = fxMesa->width;
- *height = fxMesa->height;
- }
-}
-
-
-/**
- * We only implement this function as a mechanism to check if the
- * framebuffer size has changed (and update corresponding state).
- */
-static void
-fxDDViewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- GLuint newWidth, newHeight;
- GLframebuffer *buffer = ctx->WinSysDrawBuffer;
- fxDDGetBufferSize( buffer, &newWidth, &newHeight );
- if (buffer->Width != newWidth || buffer->Height != newHeight) {
- _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight );
- }
-}
-
-
-/* Implements glClearColor() */
-static void
-fxDDClearColor(GLcontext * ctx, const GLfloat color[4])
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLubyte col[4];
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDClearColor(%f, %f, %f, %f)\n",
- color[0], color[1], color[2], color[3]);
- }
-
- CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(col[3], color[3]);
-
- fxMesa->clearC = FXCOLOR4(col);
- fxMesa->clearA = col[3];
-}
-
-
-/* Clear the color and/or depth buffers */
-static void fxDDClear( GLcontext *ctx, GLbitfield mask )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLbitfield softwareMask = mask & (BUFFER_BIT_ACCUM);
- const GLuint stencil_size = fxMesa->haveHwStencil ? ctx->Visual.stencilBits : 0;
- const FxU32 clearD = (FxU32) (ctx->DrawBuffer->_DepthMaxF * ctx->Depth.Clear);
- const FxU8 clearS = (FxU8) (ctx->Stencil.Clear & 0xff);
-
- if ( TDFX_DEBUG & MESA_VERBOSE ) {
- fprintf( stderr, "fxDDClear\n");
- }
-
- /* we can't clear accum buffers nor stereo */
- mask &= ~(BUFFER_BIT_ACCUM | BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT);
-
- /* Need this check to respond to certain HW updates */
- if (fxMesa->new_state & (FX_NEW_SCISSOR | FX_NEW_COLOR_MASK)) {
- fxSetupScissor(ctx);
- fxSetupColorMask(ctx);
- fxMesa->new_state &= ~(FX_NEW_SCISSOR | FX_NEW_COLOR_MASK);
- }
-
- /*
- * As per GL spec, color masking should be obeyed when clearing
- */
- if (ctx->Visual.greenBits != 8) {
- /* can only do color masking if running in 24/32bpp on Napalm */
- if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] ||
- ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]) {
- softwareMask |= (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT));
- mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
- }
- }
-
- if (fxMesa->haveHwStencil) {
- /*
- * If we want to clear stencil, it must be enabled
- * in the HW, even if the stencil test is not enabled
- * in the OGL state.
- */
- BEGIN_BOARD_LOCK();
- if (mask & BUFFER_BIT_STENCIL) {
- fxMesa->Glide.grStencilMaskExt(fxMesa->unitsState.stencilWriteMask);
- /* set stencil ref value = desired clear value */
- fxMesa->Glide.grStencilFuncExt(GR_CMP_ALWAYS, clearS, 0xff);
- fxMesa->Glide.grStencilOpExt(GR_STENCILOP_REPLACE,
- GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE);
- grEnable(GR_STENCIL_MODE_EXT);
- }
- else {
- grDisable(GR_STENCIL_MODE_EXT);
- }
- END_BOARD_LOCK();
- } else if (mask & BUFFER_BIT_STENCIL) {
- softwareMask |= (mask & (BUFFER_BIT_STENCIL));
- mask &= ~(BUFFER_BIT_STENCIL);
- }
-
- /*
- * This may be ugly, but it's needed in order to work around a number
- * of Glide bugs.
- */
- BEGIN_CLIP_LOOP();
- {
- /*
- * This could probably be done fancier but doing each possible case
- * explicitly is less error prone.
- */
- switch (mask & ~BUFFER_BIT_STENCIL) {
- case BUFFER_BIT_BACK_LEFT | BUFFER_BIT_DEPTH:
- /* back buffer & depth */
- grDepthMask(FXTRUE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0) {
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- }
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- break;
- case BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_DEPTH:
- /* XXX it appears that the depth buffer isn't cleared when
- * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set.
- * This is a work-around/
- */
- /* clear depth */
- grDepthMask(FXTRUE);
- fxDisableColor(fxMesa);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- fxSetupColorMask(ctx);
- grDepthMask(FXFALSE);
- /* clear front */
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- break;
- case BUFFER_BIT_BACK_LEFT:
- /* back buffer only */
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- break;
- case BUFFER_BIT_FRONT_LEFT:
- /* front buffer only */
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- break;
- case BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT:
- /* front and back */
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- break;
- case BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT | BUFFER_BIT_DEPTH:
- /* clear back and depth */
- grDepthMask(FXTRUE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- /* clear front */
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- break;
- case BUFFER_BIT_DEPTH:
- /* just the depth buffer */
- grDepthMask(FXTRUE);
- fxDisableColor(fxMesa);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- else
- grBufferClear(fxMesa->clearC,
- fxMesa->clearA,
- clearD);
- fxSetupColorMask(ctx);
- break;
- default:
- /* clear no color buffers or depth buffer but might clear stencil */
- if ((stencil_size > 0) && (mask & BUFFER_BIT_STENCIL)) {
- /* XXX need this RenderBuffer call to work around Glide bug */
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- fxDisableColor(fxMesa);
- fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
- fxMesa->clearA,
- clearD, clearS);
- fxSetupColorMask(ctx);
- }
- }
- }
- END_CLIP_LOOP();
-
- if (fxMesa->haveHwStencil) {
- /* We changed the stencil state above. Restore it! */
- fxSetupStencil(ctx);
- }
- fxSetupDepthTest(ctx);
- grRenderBuffer(fxMesa->currentFB);
-
- if (softwareMask)
- _swrast_Clear( ctx, softwareMask );
-}
-
-
-/* Set the buffer used for drawing */
-/* XXX support for separate read/draw buffers hasn't been tested */
-/* XXX GL_NONE disables color, but fails to correctly maintain state */
-static void
-fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDSetDrawBuffer(%x)\n", (int)mode);
- }
-
- if (mode == GL_FRONT_LEFT) {
- fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
- grRenderBuffer(fxMesa->currentFB);
- }
- else if (mode == GL_BACK_LEFT) {
- fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
- grRenderBuffer(fxMesa->currentFB);
- }
- else if (mode == GL_NONE) {
- fxDisableColor(fxMesa);
- }
- else {
- /* we'll need a software fallback */
- /* XXX not implemented */
- }
-
- /* update s/w fallback state */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-
-static void
-fxDDDrawBitmap2 (GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GrLfbInfo_t info;
- GrLfbWriteMode_t mode;
- FxU16 color;
- const struct gl_pixelstore_attrib *finalUnpack;
- struct gl_pixelstore_attrib scissoredUnpack;
-
- /* check if there's any raster operations enabled which we can't handle */
- if (swrast->_RasterMask & (ALPHATEST_BIT |
- /*BLEND_BIT |*/ /* blending ok, through pixpipe */
- DEPTH_BIT | /* could be done with RGB:DEPTH */
- FOG_BIT | /* could be done with RGB:DEPTH */
- LOGIC_OP_BIT |
- /*CLIP_BIT |*/ /* clipping ok, below */
- STENCIL_BIT |
- MASKING_BIT |
- MULTI_DRAW_BIT |
- OCCLUSION_BIT | /* nope! at least not yet */
- TEXTURE_BIT |
- FRAGPROG_BIT)) {
- _swrast_Bitmap(ctx, px, py, width, height, unpack, bitmap);
- return;
- }
-
- /* make sure the pixelpipe is configured correctly */
- fxSetupFXUnits(ctx);
-
- /* FIXME! _RasterMask & CLIP_BIT gets set if we're out of Viewport, also! */
- if (ctx->Scissor.Enabled) {
- /* This is a bit tricky, but by carefully adjusting the px, py,
- * width, height, skipPixels and skipRows values we can do
- * scissoring without special code in the rendering loop.
- */
-
- /* we'll construct a new pixelstore struct */
- finalUnpack = &scissoredUnpack;
- scissoredUnpack = *unpack;
- if (scissoredUnpack.RowLength == 0)
- scissoredUnpack.RowLength = width;
-
- /* clip left */
- if (px < ctx->Scissor.X) {
- scissoredUnpack.SkipPixels += (ctx->Scissor.X - px);
- width -= (ctx->Scissor.X - px);
- px = ctx->Scissor.X;
- }
- /* clip right */
- if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) {
- width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width));
- }
- /* clip bottom */
- if (py < ctx->Scissor.Y) {
- scissoredUnpack.SkipRows += (ctx->Scissor.Y - py);
- height -= (ctx->Scissor.Y - py);
- py = ctx->Scissor.Y;
- }
- /* clip top */
- if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) {
- height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height));
- }
-
- if (width <= 0 || height <= 0)
- return;
- }
- else {
- finalUnpack = unpack;
- }
-
- /* compute pixel value */
- {
- GLint r = (GLint) (ctx->Current.RasterColor[RCOMP] * 255.0f);
- GLint g = (GLint) (ctx->Current.RasterColor[GCOMP] * 255.0f);
- GLint b = (GLint) (ctx->Current.RasterColor[BCOMP] * 255.0f);
- GLint a = (GLint) (ctx->Current.RasterColor[ACOMP] * 255.0f);
- if (fxMesa->colDepth == 15) {
- color = TDFXPACKCOLOR1555(b, g, r, a);
- mode = GR_LFBWRITEMODE_1555;
- } else {
- color = fxMesa->bgrOrder ? TDFXPACKCOLOR565(r, g, b) : TDFXPACKCOLOR565(b, g, r);
- mode = GR_LFBWRITEMODE_565;
- }
- }
-
- info.size = sizeof(info);
- if (!grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->currentFB,
- mode,
- GR_ORIGIN_LOWER_LEFT, FXTRUE, &info)) {
- _swrast_Bitmap(ctx, px, py, width, height, finalUnpack, bitmap);
- return;
- }
-
- {
- const GLint winX = 0;
- const GLint winY = 0;
- /* The dest stride depends on the hardware and whether we're drawing
- * to the front or back buffer. This compile-time test seems to do
- * the job for now.
- */
- const GLint dstStride = info.strideInBytes / 2; /* stride in GLushorts */
-
- GLint row;
- /* compute dest address of bottom-left pixel in bitmap */
- GLushort *dst = (GLushort *) info.lfbPtr
- + (winY + py) * dstStride + (winX + px);
-
- for (row = 0; row < height; row++) {
- const GLubyte *src =
- (const GLubyte *) _mesa_image_address2d(finalUnpack,
- bitmap, width, height,
- GL_COLOR_INDEX, GL_BITMAP,
- row, 0);
- if (finalUnpack->LsbFirst) {
- /* least significan bit first */
- GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7);
- GLint col;
- for (col = 0; col < width; col++) {
- if (*src & mask) {
- dst[col] = color;
- }
- if (mask == 128U) {
- src++;
- mask = 1U;
- }
- else {
- mask = mask << 1;
- }
- }
- if (mask != 1)
- src++;
- }
- else {
- /* most significan bit first */
- GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7);
- GLint col;
- for (col = 0; col < width; col++) {
- if (*src & mask) {
- dst[col] = color;
- }
- if (mask == 1U) {
- src++;
- mask = 128U;
- }
- else {
- mask = mask >> 1;
- }
- }
- if (mask != 128)
- src++;
- }
- dst += dstStride;
- }
- }
-
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
-}
-
-static void
-fxDDDrawBitmap4 (GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GrLfbInfo_t info;
- FxU32 color;
- const struct gl_pixelstore_attrib *finalUnpack;
- struct gl_pixelstore_attrib scissoredUnpack;
-
- /* check if there's any raster operations enabled which we can't handle */
- if ((swrast->_RasterMask & (/*ALPHATEST_BIT |*/
- /*BLEND_BIT |*/ /* blending ok, through pixpipe */
- DEPTH_BIT | /* could be done with RGB:DEPTH */
- FOG_BIT | /* could be done with RGB:DEPTH */
- LOGIC_OP_BIT |
- /*CLIP_BIT |*/ /* clipping ok, below */
- STENCIL_BIT |
- /*MASKING_BIT |*/ /* masking ok, we're in 32bpp */
- MULTI_DRAW_BIT |
- OCCLUSION_BIT | /* nope! at least not yet */
- TEXTURE_BIT |
- FRAGPROG_BIT))
- ) {
- _swrast_Bitmap(ctx, px, py, width, height, unpack, bitmap);
- return;
- }
-
- /* make sure the pixelpipe is configured correctly */
- fxSetupFXUnits(ctx);
-
- /* FIXME! _RasterMask & CLIP_BIT gets set if we're out of Viewport, also! */
- if (ctx->Scissor.Enabled) {
- /* This is a bit tricky, but by carefully adjusting the px, py,
- * width, height, skipPixels and skipRows values we can do
- * scissoring without special code in the rendering loop.
- */
-
- /* we'll construct a new pixelstore struct */
- finalUnpack = &scissoredUnpack;
- scissoredUnpack = *unpack;
- if (scissoredUnpack.RowLength == 0)
- scissoredUnpack.RowLength = width;
-
- /* clip left */
- if (px < ctx->Scissor.X) {
- scissoredUnpack.SkipPixels += (ctx->Scissor.X - px);
- width -= (ctx->Scissor.X - px);
- px = ctx->Scissor.X;
- }
- /* clip right */
- if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) {
- width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width));
- }
- /* clip bottom */
- if (py < ctx->Scissor.Y) {
- scissoredUnpack.SkipRows += (ctx->Scissor.Y - py);
- height -= (ctx->Scissor.Y - py);
- py = ctx->Scissor.Y;
- }
- /* clip top */
- if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) {
- height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height));
- }
-
- if (width <= 0 || height <= 0)
- return;
- }
- else {
- finalUnpack = unpack;
- }
-
- /* compute pixel value */
- {
- GLint r = (GLint) (ctx->Current.RasterColor[RCOMP] * 255.0f);
- GLint g = (GLint) (ctx->Current.RasterColor[GCOMP] * 255.0f);
- GLint b = (GLint) (ctx->Current.RasterColor[BCOMP] * 255.0f);
- GLint a = (GLint) (ctx->Current.RasterColor[ACOMP] * 255.0f);
- color = TDFXPACKCOLOR8888(b, g, r, a);
- }
-
- info.size = sizeof(info);
- if (!grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_8888,
- GR_ORIGIN_LOWER_LEFT, FXTRUE, &info)) {
- _swrast_Bitmap(ctx, px, py, width, height, finalUnpack, bitmap);
- return;
- }
-
- {
- const GLint winX = 0;
- const GLint winY = 0;
- /* The dest stride depends on the hardware and whether we're drawing
- * to the front or back buffer. This compile-time test seems to do
- * the job for now.
- */
- const GLint dstStride = info.strideInBytes / 4; /* stride in GLuints */
-
- GLint row;
- /* compute dest address of bottom-left pixel in bitmap */
- GLuint *dst = (GLuint *) info.lfbPtr
- + (winY + py) * dstStride + (winX + px);
-
- for (row = 0; row < height; row++) {
- const GLubyte *src =
- (const GLubyte *) _mesa_image_address2d(finalUnpack,
- bitmap, width, height,
- GL_COLOR_INDEX, GL_BITMAP,
- row, 0);
- if (finalUnpack->LsbFirst) {
- /* least significan bit first */
- GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7);
- GLint col;
- for (col = 0; col < width; col++) {
- if (*src & mask) {
- dst[col] = color;
- }
- if (mask == 128U) {
- src++;
- mask = 1U;
- }
- else {
- mask = mask << 1;
- }
- }
- if (mask != 1)
- src++;
- }
- else {
- /* most significan bit first */
- GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7);
- GLint col;
- for (col = 0; col < width; col++) {
- if (*src & mask) {
- dst[col] = color;
- }
- if (mask == 1U) {
- src++;
- mask = 128U;
- }
- else {
- mask = mask >> 1;
- }
- }
- if (mask != 128)
- src++;
- }
- dst += dstStride;
- }
- }
-
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
-}
-
-
-static void
-fxDDReadPixels565 (GLcontext * ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid *dstImage)
-{
- if (ctx->_ImageTransferState/* & (IMAGE_SCALE_BIAS_BIT|IMAGE_MAP_COLOR_BIT)*/) {
- _swrast_ReadPixels(ctx, x, y, width, height, format, type,
- packing, dstImage);
- return;
- }
- else {
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrLfbInfo_t info;
-
- BEGIN_BOARD_LOCK();
- info.size = sizeof(info);
- if (grLfbLock(GR_LFB_READ_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_ANY,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
- const GLint winX = 0;
- const GLint winY = fxMesa->height - 1;
- const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
- const GLushort *src = (const GLushort *) info.lfbPtr
- + (winY - y) * srcStride + (winX + x);
- GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing, dstImage,
- width, height, format,
- type, 0, 0);
- GLint dstStride =
- _mesa_image_row_stride(packing, width, format, type);
-
- if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
- /* convert 5R6G5B into 8R8G8B */
- GLint row, col;
- const GLint halfWidth = width >> 1;
- const GLint extraPixel = (width & 1);
- for (row = 0; row < height; row++) {
- GLubyte *d = dst;
- for (col = 0; col < halfWidth; col++) {
- const GLuint pixel = ((const GLuint *) src)[col];
- *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f];
- *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 27) & 0x1f];
- *d++ = FX_rgb_scale_6[(pixel >> 21) & 0x3f];
- *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
- }
- if (extraPixel) {
- GLushort pixel = src[width - 1];
- *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f];
- *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- }
- dst += dstStride;
- src -= srcStride;
- }
- }
- else if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
- /* convert 5R6G5B into 8R8G8B8A */
- GLint row, col;
- const GLint halfWidth = width >> 1;
- const GLint extraPixel = (width & 1);
- for (row = 0; row < height; row++) {
- GLubyte *d = dst;
- for (col = 0; col < halfWidth; col++) {
- const GLuint pixel = ((const GLuint *) src)[col];
- *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f];
- *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = 255;
- *d++ = FX_rgb_scale_5[(pixel >> 27) & 0x1f];
- *d++ = FX_rgb_scale_6[(pixel >> 21) & 0x3f];
- *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
- *d++ = 255;
- }
- if (extraPixel) {
- const GLushort pixel = src[width - 1];
- *d++ = FX_rgb_scale_5[(pixel >> 11) & 0x1f];
- *d++ = FX_rgb_scale_6[(pixel >> 5) & 0x3f];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = 255;
- }
- dst += dstStride;
- src -= srcStride;
- }
- }
- else if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
- /* directly memcpy 5R6G5B pixels into client's buffer */
- const GLint widthInBytes = width * 2;
- GLint row;
- for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
- dst += dstStride;
- src -= srcStride;
- }
- }
- else {
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
- END_BOARD_LOCK();
- _swrast_ReadPixels(ctx, x, y, width, height, format, type,
- packing, dstImage);
- return;
- }
-
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
- }
- END_BOARD_LOCK();
- }
-}
-
-static void
-fxDDReadPixels555 (GLcontext * ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid *dstImage)
-{
- if (ctx->_ImageTransferState/* & (IMAGE_SCALE_BIAS_BIT|IMAGE_MAP_COLOR_BIT)*/) {
- _swrast_ReadPixels(ctx, x, y, width, height, format, type,
- packing, dstImage);
- return;
- }
- else {
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrLfbInfo_t info;
-
- BEGIN_BOARD_LOCK();
- info.size = sizeof(info);
- if (grLfbLock(GR_LFB_READ_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_ANY,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
- const GLint winX = 0;
- const GLint winY = fxMesa->height - 1;
- const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
- const GLushort *src = (const GLushort *) info.lfbPtr
- + (winY - y) * srcStride + (winX + x);
- GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing, dstImage,
- width, height, format,
- type, 0, 0);
- GLint dstStride =
- _mesa_image_row_stride(packing, width, format, type);
-
- if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
- /* convert 5R5G5B into 8R8G8B */
- GLint row, col;
- const GLint halfWidth = width >> 1;
- const GLint extraPixel = (width & 1);
- for (row = 0; row < height; row++) {
- GLubyte *d = dst;
- for (col = 0; col < halfWidth; col++) {
- const GLuint pixel = ((const GLuint *) src)[col];
- *d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 26) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
- }
- if (extraPixel) {
- GLushort pixel = src[width - 1];
- *d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- }
- dst += dstStride;
- src -= srcStride;
- }
- }
- else if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
- /* convert 5R6G5B into 8R8G8B8A */
- GLint row, col;
- const GLint halfWidth = width >> 1;
- const GLint extraPixel = (width & 1);
- for (row = 0; row < height; row++) {
- GLubyte *d = dst;
- for (col = 0; col < halfWidth; col++) {
- const GLuint pixel = ((const GLuint *) src)[col];
- *d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = (pixel & 0x8000) ? 255 : 0;
- *d++ = FX_rgb_scale_5[(pixel >> 26) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 21) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 16) & 0x1f];
- *d++ = (pixel & 0x80000000) ? 255 : 0;
- }
- if (extraPixel) {
- const GLushort pixel = src[width - 1];
- *d++ = FX_rgb_scale_5[(pixel >> 10) & 0x1f];
- *d++ = FX_rgb_scale_5[(pixel >> 5) & 0x1f];
- *d++ = FX_rgb_scale_5[ pixel & 0x1f];
- *d++ = (pixel & 0x8000) ? 255 : 0;
- }
- dst += dstStride;
- src -= srcStride;
- }
- }
- else if (format == GL_BGRA && type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
- /* directly memcpy 5R5G5B pixels into client's buffer */
- const GLint widthInBytes = width * 2;
- GLint row;
- for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
- dst += dstStride;
- src -= srcStride;
- }
- }
- else {
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
- END_BOARD_LOCK();
- _swrast_ReadPixels(ctx, x, y, width, height, format, type,
- packing, dstImage);
- return;
- }
-
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
- }
- END_BOARD_LOCK();
- }
-}
-
-static void
-fxDDReadPixels8888 (GLcontext * ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid *dstImage)
-{
- if (ctx->_ImageTransferState/* & (IMAGE_SCALE_BIAS_BIT|IMAGE_MAP_COLOR_BIT)*/) {
- _swrast_ReadPixels(ctx, x, y, width, height, format, type,
- packing, dstImage);
- return;
- }
- else {
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrLfbInfo_t info;
-
- BEGIN_BOARD_LOCK();
- info.size = sizeof(info);
- if (grLfbLock(GR_LFB_READ_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_ANY,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
- const GLint winX = 0;
- const GLint winY = fxMesa->height - 1;
- const GLint srcStride = info.strideInBytes / 4; /* stride in GLuints */
- const GLuint *src = (const GLuint *) info.lfbPtr
- + (winY - y) * srcStride + (winX + x);
- GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing, dstImage,
- width, height, format,
- type, 0, 0);
- GLint dstStride =
- _mesa_image_row_stride(packing, width, format, type);
-
- if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
- /* convert 8A8R8G8B into 8R8G8B */
- GLint row, col;
- for (row = 0; row < height; row++) {
- GLubyte *d = dst;
- for (col = 0; col < width; col++) {
- const GLuint pixel = ((const GLuint *) src)[col];
- *d++ = pixel >> 16;
- *d++ = pixel >> 8;
- *d++ = pixel;
- }
- dst += dstStride;
- src -= srcStride;
- }
- }
- else if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
- /* 8A8R8G8B pixels into client's buffer */
- GLint row, col;
- for (row = 0; row < height; row++) {
- GLubyte *d = dst;
- for (col = 0; col < width; col++) {
- const GLuint pixel = ((const GLuint *) src)[col];
- *d++ = pixel >> 16;
- *d++ = pixel >> 8;
- *d++ = pixel;
- *d++ = pixel >> 24;
- }
- dst += dstStride;
- src -= srcStride;
- }
- }
- else if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
- /* convert 8A8R8G8B into 5R6G5B */
- GLint row, col;
- for (row = 0; row < height; row++) {
- GLushort *d = (GLushort *)dst;
- for (col = 0; col < width; col++) {
- const GLuint pixel = ((const GLuint *) src)[col];
- *d++ = (((pixel >> 16) & 0xf8) << 8) |
- (((pixel >> 8) & 0xfc) << 3) |
- ((pixel & 0xf8) >> 3);
- }
- dst += dstStride;
- src -= srcStride;
- }
- }
- else {
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
- END_BOARD_LOCK();
- _swrast_ReadPixels(ctx, x, y, width, height, format, type,
- packing, dstImage);
- return;
- }
-
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
- }
- END_BOARD_LOCK();
- }
-}
-
-
-static void
-fxDDDrawPixels555 (GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid * pixels)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GrLfbInfo_t info;
- const struct gl_pixelstore_attrib *finalUnpack;
- struct gl_pixelstore_attrib scissoredUnpack;
-
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != 1.0F ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)) ||
- (swrast->_RasterMask & (ALPHATEST_BIT |
- /*BLEND_BIT |*/ /* blending ok, through pixpipe */
- DEPTH_BIT | /* could be done with RGB:DEPTH */
- FOG_BIT | /* could be done with RGB:DEPTH */
- LOGIC_OP_BIT |
- /*CLIP_BIT |*/ /* clipping ok, below */
- STENCIL_BIT |
- MASKING_BIT |
- MULTI_DRAW_BIT |
- OCCLUSION_BIT | /* nope! at least not yet */
- TEXTURE_BIT |
- FRAGPROG_BIT)) ||
- fxMesa->fallback)
- {
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- return;
- }
-
- /* make sure the pixelpipe is configured correctly */
- fxSetupFXUnits(ctx);
-
- /* FIXME! _RasterMask & CLIP_BIT gets set if we're out of Viewport, also! */
- if (ctx->Scissor.Enabled) {
- /* This is a bit tricky, but by carefully adjusting the px, py,
- * width, height, skipPixels and skipRows values we can do
- * scissoring without special code in the rendering loop.
- */
-
- /* we'll construct a new pixelstore struct */
- finalUnpack = &scissoredUnpack;
- scissoredUnpack = *unpack;
- if (scissoredUnpack.RowLength == 0)
- scissoredUnpack.RowLength = width;
-
- /* clip left */
- if (x < ctx->Scissor.X) {
- scissoredUnpack.SkipPixels += (ctx->Scissor.X - x);
- width -= (ctx->Scissor.X - x);
- x = ctx->Scissor.X;
- }
- /* clip right */
- if (x + width >= ctx->Scissor.X + ctx->Scissor.Width) {
- width -= (x + width - (ctx->Scissor.X + ctx->Scissor.Width));
- }
- /* clip bottom */
- if (y < ctx->Scissor.Y) {
- scissoredUnpack.SkipRows += (ctx->Scissor.Y - y);
- height -= (ctx->Scissor.Y - y);
- y = ctx->Scissor.Y;
- }
- /* clip top */
- if (y + height >= ctx->Scissor.Y + ctx->Scissor.Height) {
- height -= (y + height - (ctx->Scissor.Y + ctx->Scissor.Height));
- }
-
- if (width <= 0 || height <= 0)
- return;
- }
- else {
- finalUnpack = unpack;
- }
-
- info.size = sizeof(info);
- if (!grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_1555,
- GR_ORIGIN_LOWER_LEFT, FXTRUE, &info)) {
- _swrast_DrawPixels(ctx, x, y, width, height, format, type, finalUnpack, pixels);
- return;
- }
-
- {
- const GLint winX = 0;
- const GLint winY = 0;
-
- const GLint dstStride = info.strideInBytes / 2; /* stride in GLushorts */
- GLushort *dst = (GLushort *) info.lfbPtr + (winY + y) * dstStride + (winX + x);
-
- if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
- GLint row;
- for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
- pixels, width, height, format, type, row, 0);
- GLint col;
- for (col = 0; col < width; col++) {
- dst[col] = TDFXPACKCOLOR1555(src[2], src[1], src[0], src[3]);
- src += 4;
- }
- dst += dstStride;
- }
- }
- else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
- GLint row;
- for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
- pixels, width, height, format, type, row, 0);
- GLint col;
- for (col = 0; col < width; col++) {
- dst[col] = TDFXPACKCOLOR1555(src[2], src[1], src[0], 255);
- src += 3;
- }
- dst += dstStride;
- }
- }
- else {
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
- _swrast_DrawPixels(ctx, x, y, width, height, format, type, finalUnpack, pixels);
- return;
- }
-
- }
-
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
-}
-
-
-static void
-fxDDDrawPixels565 (GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid * pixels)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GrLfbInfo_t info;
- const struct gl_pixelstore_attrib *finalUnpack;
- struct gl_pixelstore_attrib scissoredUnpack;
-
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != 1.0F ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)) ||
- (swrast->_RasterMask & (ALPHATEST_BIT |
- /*BLEND_BIT |*/ /* blending ok, through pixpipe */
- DEPTH_BIT | /* could be done with RGB:DEPTH */
- FOG_BIT | /* could be done with RGB:DEPTH */
- LOGIC_OP_BIT |
- /*CLIP_BIT |*/ /* clipping ok, below */
- STENCIL_BIT |
- MASKING_BIT |
- MULTI_DRAW_BIT |
- OCCLUSION_BIT | /* nope! at least not yet */
- TEXTURE_BIT |
- FRAGPROG_BIT)) ||
- fxMesa->fallback)
- {
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- return;
- }
-
- /* make sure the pixelpipe is configured correctly */
- fxSetupFXUnits(ctx);
-
- /* FIXME! _RasterMask & CLIP_BIT gets set if we're out of Viewport, also! */
- if (ctx->Scissor.Enabled) {
- /* This is a bit tricky, but by carefully adjusting the px, py,
- * width, height, skipPixels and skipRows values we can do
- * scissoring without special code in the rendering loop.
- */
-
- /* we'll construct a new pixelstore struct */
- finalUnpack = &scissoredUnpack;
- scissoredUnpack = *unpack;
- if (scissoredUnpack.RowLength == 0)
- scissoredUnpack.RowLength = width;
-
- /* clip left */
- if (x < ctx->Scissor.X) {
- scissoredUnpack.SkipPixels += (ctx->Scissor.X - x);
- width -= (ctx->Scissor.X - x);
- x = ctx->Scissor.X;
- }
- /* clip right */
- if (x + width >= ctx->Scissor.X + ctx->Scissor.Width) {
- width -= (x + width - (ctx->Scissor.X + ctx->Scissor.Width));
- }
- /* clip bottom */
- if (y < ctx->Scissor.Y) {
- scissoredUnpack.SkipRows += (ctx->Scissor.Y - y);
- height -= (ctx->Scissor.Y - y);
- y = ctx->Scissor.Y;
- }
- /* clip top */
- if (y + height >= ctx->Scissor.Y + ctx->Scissor.Height) {
- height -= (y + height - (ctx->Scissor.Y + ctx->Scissor.Height));
- }
-
- if (width <= 0 || height <= 0)
- return;
- }
- else {
- finalUnpack = unpack;
- }
-
- info.size = sizeof(info);
- if (!grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_565,
- GR_ORIGIN_LOWER_LEFT, FXTRUE, &info)) {
- _swrast_DrawPixels(ctx, x, y, width, height, format, type, finalUnpack, pixels);
- return;
- }
-
- {
- const GLint winX = 0;
- const GLint winY = 0;
-
- const GLint dstStride = info.strideInBytes / 2; /* stride in GLushorts */
- GLushort *dst = (GLushort *) info.lfbPtr + (winY + y) * dstStride + (winX + x);
-
- if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
- GLint row;
- for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
- pixels, width, height, format, type, row, 0);
- GLint col;
- for (col = 0; col < width; col++) {
- dst[col] = TDFXPACKCOLOR565(src[2], src[1], src[0]);
- src += 4;
- }
- dst += dstStride;
- }
- }
- else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
- GLint row;
- for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
- pixels, width, height, format, type, row, 0);
- GLint col;
- for (col = 0; col < width; col++) {
- dst[col] = TDFXPACKCOLOR565(src[2], src[1], src[0]);
- src += 3;
- }
- dst += dstStride;
- }
- }
- else {
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
- _swrast_DrawPixels(ctx, x, y, width, height, format, type, finalUnpack, pixels);
- return;
- }
-
- }
-
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
-}
-
-
-static void
-fxDDDrawPixels565_rev (GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid * pixels)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GrLfbInfo_t info;
- const struct gl_pixelstore_attrib *finalUnpack;
- struct gl_pixelstore_attrib scissoredUnpack;
-
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != 1.0F ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)) ||
- (swrast->_RasterMask & (ALPHATEST_BIT |
- /*BLEND_BIT |*/ /* blending ok, through pixpipe */
- DEPTH_BIT | /* could be done with RGB:DEPTH */
- FOG_BIT | /* could be done with RGB:DEPTH */
- LOGIC_OP_BIT |
- /*CLIP_BIT |*/ /* clipping ok, below */
- STENCIL_BIT |
- MASKING_BIT |
- MULTI_DRAW_BIT |
- OCCLUSION_BIT | /* nope! at least not yet */
- TEXTURE_BIT |
- FRAGPROG_BIT)) ||
- fxMesa->fallback)
- {
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- return;
- }
-
- /* make sure the pixelpipe is configured correctly */
- fxSetupFXUnits(ctx);
-
- /* FIXME! _RasterMask & CLIP_BIT gets set if we're out of Viewport, also! */
- if (ctx->Scissor.Enabled) {
- /* This is a bit tricky, but by carefully adjusting the px, py,
- * width, height, skipPixels and skipRows values we can do
- * scissoring without special code in the rendering loop.
- */
-
- /* we'll construct a new pixelstore struct */
- finalUnpack = &scissoredUnpack;
- scissoredUnpack = *unpack;
- if (scissoredUnpack.RowLength == 0)
- scissoredUnpack.RowLength = width;
-
- /* clip left */
- if (x < ctx->Scissor.X) {
- scissoredUnpack.SkipPixels += (ctx->Scissor.X - x);
- width -= (ctx->Scissor.X - x);
- x = ctx->Scissor.X;
- }
- /* clip right */
- if (x + width >= ctx->Scissor.X + ctx->Scissor.Width) {
- width -= (x + width - (ctx->Scissor.X + ctx->Scissor.Width));
- }
- /* clip bottom */
- if (y < ctx->Scissor.Y) {
- scissoredUnpack.SkipRows += (ctx->Scissor.Y - y);
- height -= (ctx->Scissor.Y - y);
- y = ctx->Scissor.Y;
- }
- /* clip top */
- if (y + height >= ctx->Scissor.Y + ctx->Scissor.Height) {
- height -= (y + height - (ctx->Scissor.Y + ctx->Scissor.Height));
- }
-
- if (width <= 0 || height <= 0)
- return;
- }
- else {
- finalUnpack = unpack;
- }
-
- info.size = sizeof(info);
- if (!grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_565,
- GR_ORIGIN_LOWER_LEFT, FXTRUE, &info)) {
- _swrast_DrawPixels(ctx, x, y, width, height, format, type, finalUnpack, pixels);
- return;
- }
-
- {
- const GLint winX = 0;
- const GLint winY = 0;
-
- const GLint dstStride = info.strideInBytes / 2; /* stride in GLushorts */
- GLushort *dst = (GLushort *) info.lfbPtr + (winY + y) * dstStride + (winX + x);
-
- if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
- GLint row;
- for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
- pixels, width, height, format, type, row, 0);
- GLint col;
- for (col = 0; col < width; col++) {
- dst[col] = TDFXPACKCOLOR565(src[0], src[1], src[2]);
- src += 4;
- }
- dst += dstStride;
- }
- }
- else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
- GLint row;
- for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
- pixels, width, height, format, type, row, 0);
- GLint col;
- for (col = 0; col < width; col++) {
- dst[col] = TDFXPACKCOLOR565(src[0], src[1], src[2]);
- src += 3;
- }
- dst += dstStride;
- }
- }
- else {
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
- _swrast_DrawPixels(ctx, x, y, width, height, format, type, finalUnpack, pixels);
- return;
- }
-
- }
-
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
-}
-
-
-static void
-fxDDDrawPixels8888 (GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid * pixels)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
- GrLfbInfo_t info;
- const struct gl_pixelstore_attrib *finalUnpack;
- struct gl_pixelstore_attrib scissoredUnpack;
-
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != 1.0F ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)) ||
- (swrast->_RasterMask & (/*ALPHATEST_BIT |*/
- /*BLEND_BIT |*/ /* blending ok, through pixpipe */
- DEPTH_BIT | /* could be done with RGB:DEPTH */
- FOG_BIT | /* could be done with RGB:DEPTH */
- LOGIC_OP_BIT |
- /*CLIP_BIT |*/ /* clipping ok, below */
- STENCIL_BIT |
- /*MASKING_BIT |*/ /* masking ok, we're in 32bpp */
- MULTI_DRAW_BIT |
- OCCLUSION_BIT | /* nope! at least not yet */
- TEXTURE_BIT |
- FRAGPROG_BIT)) ||
- fxMesa->fallback)
- {
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- return;
- }
-
- /* make sure the pixelpipe is configured correctly */
- fxSetupFXUnits(ctx);
-
- /* FIXME! _RasterMask & CLIP_BIT gets set if we're out of Viewport, also! */
- if (ctx->Scissor.Enabled) {
- /* This is a bit tricky, but by carefully adjusting the px, py,
- * width, height, skipPixels and skipRows values we can do
- * scissoring without special code in the rendering loop.
- */
-
- /* we'll construct a new pixelstore struct */
- finalUnpack = &scissoredUnpack;
- scissoredUnpack = *unpack;
- if (scissoredUnpack.RowLength == 0)
- scissoredUnpack.RowLength = width;
-
- /* clip left */
- if (x < ctx->Scissor.X) {
- scissoredUnpack.SkipPixels += (ctx->Scissor.X - x);
- width -= (ctx->Scissor.X - x);
- x = ctx->Scissor.X;
- }
- /* clip right */
- if (x + width >= ctx->Scissor.X + ctx->Scissor.Width) {
- width -= (x + width - (ctx->Scissor.X + ctx->Scissor.Width));
- }
- /* clip bottom */
- if (y < ctx->Scissor.Y) {
- scissoredUnpack.SkipRows += (ctx->Scissor.Y - y);
- height -= (ctx->Scissor.Y - y);
- y = ctx->Scissor.Y;
- }
- /* clip top */
- if (y + height >= ctx->Scissor.Y + ctx->Scissor.Height) {
- height -= (y + height - (ctx->Scissor.Y + ctx->Scissor.Height));
- }
-
- if (width <= 0 || height <= 0)
- return;
- }
- else {
- finalUnpack = unpack;
- }
-
- info.size = sizeof(info);
- if (!grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_8888,
- GR_ORIGIN_LOWER_LEFT, FXTRUE, &info)) {
- _swrast_DrawPixels(ctx, x, y, width, height, format, type, finalUnpack, pixels);
- return;
- }
-
- {
- const GLint winX = 0;
- const GLint winY = 0;
-
- const GLint dstStride = info.strideInBytes / 4; /* stride in GLuints */
- GLuint *dst = (GLuint *) info.lfbPtr + (winY + y) * dstStride + (winX + x);
-
- if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
- /* directly memcpy 8A8R8G8B pixels to screen */
- const GLint widthInBytes = width * 4;
- GLint row;
- for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
- pixels, width, height, format, type, row, 0);
- MEMCPY(dst, src, widthInBytes);
- dst += dstStride;
- }
- }
- else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
- GLint row;
- for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
- pixels, width, height, format, type, row, 0);
- GLint col;
- for (col = 0; col < width; col++) {
- dst[col] = TDFXPACKCOLOR8888(src[2], src[1], src[0], 255);
- src += 3;
- }
- dst += dstStride;
- }
- }
- else {
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
- _swrast_DrawPixels(ctx, x, y, width, height, format, type, finalUnpack, pixels);
- return;
- }
-
- }
-
- grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB);
-}
-
-
-static void
-fxDDFinish(GLcontext * ctx)
-{
- grFlush();
-}
-
-
-
-
-
-/* KW: Put the word Mesa in the render string because quakeworld
- * checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE).
- * Why?
- */
-static const GLubyte *
-fxDDGetString(GLcontext * ctx, GLenum name)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- switch (name) {
- case GL_RENDERER:
- return (GLubyte *)fxMesa->rendererString;
-#if __WIN32__ /* hack to advertise vanilla extension names */
- case GL_EXTENSIONS:
- if (ctx->Extensions.String == NULL) {
- GLubyte *ext = _mesa_make_extension_string(ctx);
- if (ext != NULL) {
- ctx->Extensions.String = _mesa_malloc(strlen((char *)ext) + 256);
- if (ctx->Extensions.String != NULL) {
- strcpy((char *)ctx->Extensions.String, (char *)ext);
- /* put any additional extension names here */
-#if 0
- strcat((char *)ctx->Extensions.String, " 3DFX_set_global_palette");
-#endif
-#if __WIN32__
- strcat((char *)ctx->Extensions.String, " WGL_3DFX_gamma_control");
- strcat((char *)ctx->Extensions.String, " WGL_EXT_swap_control");
- strcat((char *)ctx->Extensions.String, " WGL_EXT_extensions_string WGL_ARB_extensions_string");
-#endif
- /* put any additional extension names here */
- _mesa_free(ext);
- } else {
- ctx->Extensions.String = ext;
- }
- }
- }
- return ctx->Extensions.String;
-#endif
- default:
- return NULL;
- }
-}
-
-static const struct tnl_pipeline_stage *fx_pipeline[] = {
- &_tnl_vertex_transform_stage, /* XXX todo - Add the fastpath here */
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
-#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_ARB_vertex_program)
- &_tnl_vertex_program_stage,
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-
-
-
-int
-fxDDInitFxMesaContext(fxMesaContext fxMesa)
-{
- GLcontext *ctx = fxMesa->glCtx;
-
- FX_setupGrVertexLayout();
-
- fxMesa->color = 0xffffffff;
- fxMesa->clearC = 0;
- fxMesa->clearA = 0;
-
- fxMesa->stats.swapBuffer = 0;
- fxMesa->stats.reqTexUpload = 0;
- fxMesa->stats.texUpload = 0;
- fxMesa->stats.memTexUpload = 0;
-
- fxMesa->tmuSrc = FX_TMU_NONE;
- fxMesa->lastUnitsMode = FX_UM_NONE;
- fxTMInit(fxMesa);
-
- /* FX units setup */
-
- fxMesa->unitsState.alphaTestEnabled = GL_FALSE;
- fxMesa->unitsState.alphaTestFunc = GL_ALWAYS;
- fxMesa->unitsState.alphaTestRefValue = 0.0;
-
- fxMesa->unitsState.blendEnabled = GL_FALSE;
- fxMesa->unitsState.blendSrcFuncRGB = GR_BLEND_ONE;
- fxMesa->unitsState.blendDstFuncRGB = GR_BLEND_ZERO;
- fxMesa->unitsState.blendSrcFuncAlpha = GR_BLEND_ONE;
- fxMesa->unitsState.blendDstFuncAlpha = GR_BLEND_ZERO;
- fxMesa->unitsState.blendEqRGB = GR_BLEND_OP_ADD;
- fxMesa->unitsState.blendEqAlpha = GR_BLEND_OP_ADD;
-
- fxMesa->unitsState.depthTestEnabled = GL_FALSE;
- fxMesa->unitsState.depthMask = GL_TRUE;
- fxMesa->unitsState.depthTestFunc = GL_LESS;
- fxMesa->unitsState.depthBias = 0;
-
- fxMesa->unitsState.stencilWriteMask = 0xff;
-
- if (fxMesa->colDepth == 32) {
- /* 32bpp */
- fxMesa->Glide.grColorMaskExt(FXTRUE, FXTRUE, FXTRUE, fxMesa->haveHwAlpha);
- } else {
- /* 15/16 bpp mode */
- grColorMask(FXTRUE, fxMesa->haveHwAlpha);
- }
-
- fxMesa->currentFB = fxMesa->haveDoubleBuffer ? GR_BUFFER_BACKBUFFER : GR_BUFFER_FRONTBUFFER;
- grRenderBuffer(fxMesa->currentFB);
-
- fxMesa->state = MALLOC(FX_grGetInteger(GR_GLIDE_STATE_SIZE));
- fxMesa->fogTable = (GrFog_t *) MALLOC(FX_grGetInteger(GR_FOG_TABLE_ENTRIES) *
- sizeof(GrFog_t));
-
- if (!fxMesa->state || !fxMesa->fogTable) {
- if (fxMesa->state)
- FREE(fxMesa->state);
- if (fxMesa->fogTable)
- FREE(fxMesa->fogTable);
- return 0;
- }
-
- if (fxMesa->haveZBuffer) {
- grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
- }
-
- if (!fxMesa->bgrOrder) {
- grLfbWriteColorFormat(GR_COLORFORMAT_ABGR);
- }
-
- if (fxMesa->Glide.grSetNumPendingBuffers != NULL) {
- fxMesa->Glide.grSetNumPendingBuffers(fxMesa->maxPendingSwapBuffers);
- }
-
- fxMesa->textureAlign = FX_grGetInteger(GR_TEXTURE_ALIGN);
- /* [koolsmoky] */
- {
- char *env;
- int textureLevels = 0;
- int textureSize = FX_grGetInteger(GR_MAX_TEXTURE_SIZE);
- do {
- textureLevels++;
- } while ((textureSize >>= 0x1) & 0x7ff);
- ctx->Const.MaxTextureLevels = textureLevels;
- ctx->Const.MaxTextureLodBias = /*textureLevels - 1*/8; /* Glide bug */
-#if FX_RESCALE_BIG_TEXURES_HACK
- fxMesa->textureMaxLod = textureLevels - 1;
- if ((env = getenv("MESA_FX_MAXLOD")) != NULL) {
- int maxLevels = atoi(env) + 1;
- if ((maxLevels <= MAX_TEXTURE_LEVELS) && (maxLevels > textureLevels)) {
- ctx->Const.MaxTextureLevels = maxLevels;
- }
- }
-#endif
- }
- ctx->Const.MaxTextureCoordUnits =
- ctx->Const.MaxTextureImageUnits = fxMesa->haveTwoTMUs ? 2 : 1;
- ctx->Const.MaxTextureUnits = MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits);
-
- ctx->Const.MaxDrawBuffers = 1;
-
- fxMesa->new_state = _NEW_ALL;
- if (!fxMesa->haveHwStencil) {
- /* don't touch stencil if there is none */
- fxMesa->new_state &= ~FX_NEW_STENCIL;
- }
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext(ctx);
- _vbo_CreateContext(ctx);
- _tnl_CreateContext(ctx);
- _swsetup_CreateContext(ctx);
-
- /* Install customized pipeline */
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, fx_pipeline);
-
- fxAllocVB(ctx);
-
- fxSetupDDPointers(ctx);
- fxDDInitTriFuncs(ctx);
-
- /* Tell the software rasterizer to use pixel fog always.
- */
- _swrast_allow_vertex_fog(ctx, GL_FALSE);
- _swrast_allow_pixel_fog(ctx, GL_TRUE);
- _tnl_allow_vertex_fog( ctx, GL_FALSE );
- _tnl_allow_pixel_fog( ctx, GL_TRUE );
-
- /* Tell tnl not to calculate or use vertex fog factors. (Needed to
- * tell render stage not to clip fog coords).
- */
-/* _tnl_calculate_vertex_fog( ctx, GL_FALSE ); */
-
- fxDDInitExtensions(ctx);
-
-#if 0
- /* do we want dither? It just looks bad... */
- grEnable(GR_ALLOW_MIPMAP_DITHER);
-#endif
- grGlideGetState((GrState *) fxMesa->state);
-
- return 1;
-}
-
-/* Undo the above.
- */
-void
-fxDDDestroyFxMesaContext(fxMesaContext fxMesa)
-{
- _swsetup_DestroyContext(fxMesa->glCtx);
- _tnl_DestroyContext(fxMesa->glCtx);
- _vbo_DestroyContext(fxMesa->glCtx);
- _swrast_DestroyContext(fxMesa->glCtx);
-
- if (fxMesa->state)
- FREE(fxMesa->state);
- if (fxMesa->fogTable)
- FREE(fxMesa->fogTable);
- fxFreeVB(fxMesa->glCtx);
-}
-
-
-
-
-void
-fxDDInitExtensions(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
-#if 1 /* multipass ColorSum stage */
- _mesa_enable_extension(ctx, "GL_EXT_secondary_color");
-#endif
-
- _mesa_enable_extension(ctx, "GL_ARB_point_sprite");
- _mesa_enable_extension(ctx, "GL_EXT_point_parameters");
- _mesa_enable_extension(ctx, "GL_EXT_paletted_texture");
- _mesa_enable_extension(ctx, "GL_EXT_texture_lod_bias");
- _mesa_enable_extension(ctx, "GL_EXT_shared_texture_palette");
- _mesa_enable_extension(ctx, "GL_EXT_blend_func_separate");
- _mesa_enable_extension(ctx, "GL_EXT_texture_env_add");
- _mesa_enable_extension(ctx, "GL_EXT_stencil_wrap");
- _mesa_enable_extension(ctx, "GL_EXT_stencil_two_side");
-
- if (fxMesa->haveTwoTMUs) {
- _mesa_enable_extension(ctx, "GL_ARB_multitexture");
- }
-
- if (fxMesa->type >= GR_SSTTYPE_Voodoo4) {
- _mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
- _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
- _mesa_enable_extension(ctx, "GL_S3_s3tc");
- _mesa_enable_extension(ctx, "GL_NV_blend_square");
- } else {
- /* [dBorca]
- * We should enable generic texture compression functions,
- * but some poorly written apps automatically assume S3TC.
- * Binding NCC to GL_COMPRESSED_RGB[A] is an unnecessary hassle,
- * since it's slow and ugly (better with palette textures, then).
- * Moreover, NCC is not an OpenGL standard, so we can't use
- * precompressed textures. Last, but not least, NCC runs amok
- * when multitexturing on a Voodoo3 and up (see POINTCAST vs UMA).
- * Note: this is also a problem with palette textures, but
- * faking multitex by multipass is evil...
- * Implementing NCC requires three stages:
- * fxDDChooseTextureFormat:
- * bind GL_COMPRESSED_RGB[A] to _mesa_texformat_argb8888,
- * so we can quantize properly, at a later time
- * fxDDTexImage:
- * if GL_COMPRESSED_RGB
- * use _mesa_texformat_l8 to get 1bpt and set GR_TEXFMT_YIQ_422
- * if GL_COMPRESSED_RGBA
- * use _mesa_texformat_al88 to get 2bpt and set GR_TEXFMT_AYIQ_8422
- * txMipQuantize(...);
- * if (level == 0) {
- * txPalToNcc((GuNccTable *)(&(ti->palette)), pxMip.pal);
- * }
- * fxSetupSingleTMU_NoLock/fxSetupDoubleTMU_NoLock:
- * grTexDownloadTable(GR_TEXTABLE_NCC0, &(ti->palette));
- */
- _mesa_enable_extension(ctx, "GL_SGIS_generate_mipmap");
- }
-
- if (fxMesa->HaveCmbExt) {
- _mesa_enable_extension(ctx, "GL_ARB_texture_env_combine");
- _mesa_enable_extension(ctx, "GL_EXT_texture_env_combine");
- }
-
- if (fxMesa->HavePixExt) {
- _mesa_enable_extension(ctx, "GL_EXT_blend_subtract");
- _mesa_enable_extension(ctx, "GL_EXT_blend_equation_separate");
- }
-
- if (fxMesa->HaveMirExt) {
- _mesa_enable_extension(ctx, "GL_ARB_texture_mirrored_repeat");
- }
-
- if (fxMesa->type >= GR_SSTTYPE_Voodoo2) {
- _mesa_enable_extension(ctx, "GL_EXT_fog_coord");
- }
-
- /* core-level extensions */
- /* dangerous */
- if (getenv("MESA_FX_ALLOW_VP")) {
- _mesa_enable_extension(ctx, "GL_ARB_vertex_program");
- _mesa_enable_extension(ctx, "GL_NV_vertex_program");
- _mesa_enable_extension(ctx, "GL_NV_vertex_program1_1");
- }
-#if 0
- /* this requires _tnl_vertex_cull_stage in the pipeline */
- _mesa_enable_extension(ctx, "EXT_cull_vertex");
-#endif
-}
-
-
-/************************************************************************/
-/************************************************************************/
-/************************************************************************/
-
-/* Check if the hardware supports the current context
- *
- * Performs similar work to fxDDChooseRenderState() - should be merged.
- */
-GLuint
-fx_check_IsInHardware(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (ctx->RenderMode != GL_RENDER) {
- return FX_FALLBACK_RENDER_MODE;
- }
-
- if (ctx->Stencil._Enabled && !fxMesa->haveHwStencil) {
- return FX_FALLBACK_STENCIL;
- }
-
- if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) &&
- (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_BACK_LEFT)) {
- return FX_FALLBACK_DRAW_BUFFER;
- }
-
- if (ctx->Color.BlendEnabled) {
- if (ctx->Color.BlendEquationRGB != GL_FUNC_ADD) {
- if (!fxMesa->HavePixExt ||
- ((ctx->Color.BlendEquationRGB != GL_FUNC_SUBTRACT) &&
- (ctx->Color.BlendEquationRGB != GL_FUNC_REVERSE_SUBTRACT))) {
- return FX_FALLBACK_BLEND;
- }
- }
-
- if (ctx->Color.BlendEquationA != GL_FUNC_ADD) {
- if (!fxMesa->HavePixExt ||
- ((ctx->Color.BlendEquationA != GL_FUNC_SUBTRACT) &&
- (ctx->Color.BlendEquationA != GL_FUNC_REVERSE_SUBTRACT))) {
- return FX_FALLBACK_BLEND;
- }
- }
-
-#if 0
- /* [dBorca]
- * We fail the spec here, unless certain blending modes:
- * RGB: (GL_ONE + GL_*) or (GL_ZERO + GL_*) or ...
- */
- if (NEED_SECONDARY_COLOR(ctx)) {
- if ((ctx->Color.BlendEquationRGB != GL_FUNC_ADD) &&
- (ctx->Color.BlendSrcRGB != GL_ONE)) {
- /* Can't use multipass to blend ColorSum stage */
- return FX_FALLBACK_SPECULAR;
- }
- }
-#endif
- }
-
- /* [dBorca]
- * We could avoid this for certain `sfactor/dfactor'
- * I do not think that is even worthwhile to check
- * because if someone is using blending they use more
- * interesting settings and also it would add more
- * state tracking to a lot of the code.
- */
- if (ctx->Color.ColorLogicOpEnabled && (ctx->Color.LogicOp != GL_COPY)) {
- return FX_FALLBACK_LOGICOP;
- }
-
- if ((fxMesa->colDepth != 32) &&
- ((ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP]) ||
- (ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]))) {
- return FX_FALLBACK_COLORMASK;
- }
-
- /* Unsupported texture/multitexture cases */
-
- /* we can only do 1D/2D textures */
- if (ctx->Texture.Unit[0]._ReallyEnabled & ~(TEXTURE_1D_BIT|TEXTURE_2D_BIT))
- return FX_FALLBACK_TEXTURE_MAP;
-
- if (fxMesa->haveTwoTMUs) {
- if (ctx->Texture.Unit[1]._ReallyEnabled & ~(TEXTURE_1D_BIT|TEXTURE_2D_BIT))
- return FX_FALLBACK_TEXTURE_MAP;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- if (fxMesa->type < GR_SSTTYPE_Voodoo2)
- if (ctx->Texture.Unit[0].EnvMode == GL_BLEND &&
- (ctx->Texture.Unit[1]._ReallyEnabled ||
- ctx->Texture.Unit[0].EnvColor[0] != 0 ||
- ctx->Texture.Unit[0].EnvColor[1] != 0 ||
- ctx->Texture.Unit[0].EnvColor[2] != 0 ||
- ctx->Texture.Unit[0].EnvColor[3] != 1)) {
- return FX_FALLBACK_TEXTURE_ENV;
- }
- if (ctx->Texture.Unit[0]._Current->Image[0][0]->Border > 0)
- return FX_FALLBACK_TEXTURE_BORDER;
- }
-
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
- if (fxMesa->type < GR_SSTTYPE_Voodoo2)
- if (ctx->Texture.Unit[1].EnvMode == GL_BLEND)
- return FX_FALLBACK_TEXTURE_ENV;
- if (ctx->Texture.Unit[1]._Current->Image[0][0]->Border > 0)
- return FX_FALLBACK_TEXTURE_BORDER;
- }
-
- if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "fx_check_IsInHardware: envmode is %s/%s\n",
- _mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
- _mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
-
- /* KW: This was wrong (I think) and I changed it... which doesn't mean
- * it is now correct...
- * BP: The old condition just seemed to test if both texture units
- * were enabled. That's easy!
- */
- if (ctx->Texture._EnabledUnits == 0x3) {
-#if 0
- /* Can't use multipass to blend a multitextured triangle - fall
- * back to software.
- */
- if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled) {
- return FX_FALLBACK_TEXTURE_MULTI;
- }
-#endif
-
- if (!fxMesa->HaveCmbExt &&
- (ctx->Texture.Unit[0].EnvMode != ctx->Texture.Unit[1].EnvMode) &&
- (ctx->Texture.Unit[0].EnvMode != GL_MODULATE) &&
- (ctx->Texture.Unit[0].EnvMode != GL_REPLACE)) { /* q2, seems ok... */
- if (TDFX_DEBUG & VERBOSE_DRIVER)
- fprintf(stderr, "fx_check_IsInHardware: unsupported multitex env mode\n");
- return FX_FALLBACK_TEXTURE_MULTI;
- }
- }
- }
- else {
- /* we have just one texture unit */
- if (ctx->Texture._EnabledUnits > 0x1) {
- return FX_FALLBACK_TEXTURE_MULTI;
- }
-
- if (fxMesa->type < GR_SSTTYPE_Voodoo2)
- if (ctx->Texture.Unit[0]._ReallyEnabled &&
- (ctx->Texture.Unit[0].EnvMode == GL_BLEND)) {
- return FX_FALLBACK_TEXTURE_ENV;
- }
- }
-
- return 0;
-}
-
-
-
-static void
-fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state)
-{
- /* TNLcontext *tnl = TNL_CONTEXT(ctx); */
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDUpdateDDPointers(%08x)\n", new_state);
- }
-
- _swrast_InvalidateState(ctx, new_state);
- _vbo_InvalidateState(ctx, new_state);
- _tnl_InvalidateState(ctx, new_state);
- _swsetup_InvalidateState(ctx, new_state);
-
- fxMesa->new_gl_state |= new_state;
-}
-
-
-
-
-void
-fxSetupDDPointers(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- /* TNLcontext *tnl = TNL_CONTEXT(ctx); */
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupDDPointers()\n");
- }
-
- ctx->Driver.UpdateState = fxDDUpdateDDPointers;
- ctx->Driver.GetString = fxDDGetString;
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearColor = fxDDClearColor;
- ctx->Driver.Clear = fxDDClear;
- ctx->Driver.DrawBuffer = fxDDSetDrawBuffer;
- ctx->Driver.GetBufferSize = fxDDGetBufferSize;
- ctx->Driver.Viewport = fxDDViewport;
- switch (fxMesa->colDepth) {
- case 15:
- ctx->Driver.DrawPixels = fxDDDrawPixels555;
- ctx->Driver.ReadPixels = fxDDReadPixels555;
- ctx->Driver.Bitmap = fxDDDrawBitmap2;
- break;
- case 16:
- ctx->Driver.DrawPixels = !fxMesa->bgrOrder ? fxDDDrawPixels565 : fxDDDrawPixels565_rev;
- ctx->Driver.ReadPixels = fxDDReadPixels565;
- ctx->Driver.Bitmap = fxDDDrawBitmap2;
- break;
- case 32:
- ctx->Driver.DrawPixels = fxDDDrawPixels8888;
- ctx->Driver.ReadPixels = fxDDReadPixels8888;
- ctx->Driver.Bitmap = fxDDDrawBitmap4;
- break;
- }
- ctx->Driver.Finish = fxDDFinish;
- ctx->Driver.Flush = NULL;
- ctx->Driver.ChooseTextureFormat = fxDDChooseTextureFormat;
- ctx->Driver.TexImage1D = fxDDTexImage1D;
- ctx->Driver.TexImage2D = fxDDTexImage2D;
- ctx->Driver.TexSubImage1D = fxDDTexSubImage1D;
- ctx->Driver.TexSubImage2D = fxDDTexSubImage2D;
- ctx->Driver.CompressedTexImage2D = fxDDCompressedTexImage2D;
- ctx->Driver.CompressedTexSubImage2D = fxDDCompressedTexSubImage2D;
- ctx->Driver.TestProxyTexImage = fxDDTestProxyTexImage;
- ctx->Driver.TexEnv = fxDDTexEnv;
- ctx->Driver.TexParameter = fxDDTexParam;
- ctx->Driver.BindTexture = fxDDTexBind;
- ctx->Driver.DeleteTexture = fxDDTexDel;
- ctx->Driver.IsTextureResident = fxDDIsTextureResident;
- ctx->Driver.UpdateTexturePalette = fxDDTexPalette;
- ctx->Driver.AlphaFunc = fxDDAlphaFunc;
- ctx->Driver.BlendFuncSeparate = fxDDBlendFuncSeparate;
- ctx->Driver.BlendEquationSeparate = fxDDBlendEquationSeparate;
- ctx->Driver.DepthFunc = fxDDDepthFunc;
- ctx->Driver.DepthMask = fxDDDepthMask;
- ctx->Driver.ColorMask = fxDDColorMask;
- ctx->Driver.Fogfv = fxDDFogfv;
- ctx->Driver.Scissor = fxDDScissor;
- ctx->Driver.FrontFace = fxDDFrontFace;
- ctx->Driver.CullFace = fxDDCullFace;
- ctx->Driver.ShadeModel = fxDDShadeModel;
- ctx->Driver.Enable = fxDDEnable;
- if (fxMesa->haveHwStencil) {
- ctx->Driver.StencilFuncSeparate = fxDDStencilFuncSeparate;
- ctx->Driver.StencilMaskSeparate = fxDDStencilMaskSeparate;
- ctx->Driver.StencilOpSeparate = fxDDStencilOpSeparate;
- }
-
- fxSetupDDSpanPointers(ctx);
- fxDDUpdateDDPointers(ctx, ~0);
-}
-
-
-#else
-
-
-/*
- * Need this to provide at least one external definition.
- */
-
-extern int gl_fx_dummy_function_dd(void);
-int
-gl_fx_dummy_function_dd(void)
-{
- return 0;
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c
deleted file mode 100644
index d3a58a301c2..00000000000
--- a/src/mesa/drivers/glide/fxddspan.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-
-/* fxdd.c - 3Dfx VooDoo Mesa span and pixel functions */
-
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#if defined(FX)
-
-#include "fxdrv.h"
-#include "fxglidew.h"
-#include "swrast/swrast.h"
-
-
-/************************************************************************/
-/***** Span functions *****/
-/************************************************************************/
-
-#define DBG 0
-
-
-#define LOCAL_VARS \
- GrBuffer_t currentFB = GR_BUFFER_BACKBUFFER; \
- GLuint pitch = info.strideInBytes; \
- GLuint height = fxMesa->height; \
- char *buf = (char *)((char *)info.lfbPtr + 0 /* x, y offset */); \
- GLuint p; \
- (void) buf; (void) p;
-
-#define CLIPPIXEL( _x, _y ) ( _x >= minx && _x < maxx && \
- _y >= miny && _y < maxy )
-
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy ) { \
- _n1 = 0, _x1 = x; \
- } else { \
- _n1 = _n; \
- _x1 = _x; \
- if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx;\
- if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
- }
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-#define HW_WRITE_LOCK() \
- fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GrLfbInfo_t info; \
- info.size = sizeof(GrLfbInfo_t); \
- if ( grLfbLock( GR_LFB_WRITE_ONLY, \
- currentFB, LFB_MODE, \
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) {
-
-#define HW_WRITE_UNLOCK() \
- grLfbUnlock( GR_LFB_WRITE_ONLY, currentFB ); \
- }
-
-#define HW_READ_LOCK() \
- fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GrLfbInfo_t info; \
- info.size = sizeof(GrLfbInfo_t); \
- if ( grLfbLock( GR_LFB_READ_ONLY, currentFB, \
- LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) {
-
-#define HW_READ_UNLOCK() \
- grLfbUnlock( GR_LFB_READ_ONLY, currentFB ); \
- }
-
-#define HW_WRITE_CLIPLOOP() \
- do { \
- /* remember, we need to flip the scissor, too */ \
- /* is it better to do it inside fxDDScissor? */ \
- const int minx = fxMesa->clipMinX; \
- const int maxy = Y_FLIP(fxMesa->clipMinY); \
- const int maxx = fxMesa->clipMaxX; \
- const int miny = Y_FLIP(fxMesa->clipMaxY);
-
-#define HW_READ_CLIPLOOP() \
- do { \
- /* remember, we need to flip the scissor, too */ \
- /* is it better to do it inside fxDDScissor? */ \
- const int minx = fxMesa->clipMinX; \
- const int maxy = Y_FLIP(fxMesa->clipMinY); \
- const int maxx = fxMesa->clipMaxX; \
- const int miny = Y_FLIP(fxMesa->clipMaxY);
-
-#define HW_ENDCLIPLOOP() \
- } while (0)
-
-
-/* 16 bit, ARGB1555 color spanline and pixel functions */
-
-#undef LFB_MODE
-#define LFB_MODE GR_LFBWRITEMODE_1555
-
-#undef BYTESPERPIXEL
-#define BYTESPERPIXEL 2
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = TDFXPACKCOLOR1555( color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = \
- TDFXPACKCOLOR1555( r, g, b, a )
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch); \
- rgba[0] = FX_rgb_scale_5[(p >> 10) & 0x1F]; \
- rgba[1] = FX_rgb_scale_5[(p >> 5) & 0x1F]; \
- rgba[2] = FX_rgb_scale_5[ p & 0x1F]; \
- rgba[3] = (p & 0x8000) ? 255 : 0; \
- } while (0)
-
-#define TAG(x) tdfx##x##_ARGB1555
-#include "../dri/common/spantmp.h"
-
-
-/* 16 bit, RGB565 color spanline and pixel functions */
-/* [dBorca] Hack alert:
- * This is wrong. The alpha value is lost, even when we provide
- * HW alpha (565 w/o depth buffering). To really update alpha buffer,
- * we would need to do the 565 writings via 8888 colorformat and rely
- * on the Voodoo to perform color scaling. In which case our 565 span
- * would look nicer! But this violates FSAA rules...
- */
-
-#undef LFB_MODE
-#define LFB_MODE GR_LFBWRITEMODE_565
-
-#undef BYTESPERPIXEL
-#define BYTESPERPIXEL 2
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = TDFXPACKCOLOR565( color[RCOMP], color[GCOMP], color[BCOMP] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = \
- TDFXPACKCOLOR565( r, g, b )
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch); \
- rgba[0] = FX_rgb_scale_5[(p >> 11) & 0x1F]; \
- rgba[1] = FX_rgb_scale_6[(p >> 5) & 0x3F]; \
- rgba[2] = FX_rgb_scale_5[ p & 0x1F]; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) tdfx##x##_RGB565
-#include "../dri/common/spantmp.h"
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions */
-
-#undef LFB_MODE
-#define LFB_MODE GR_LFBWRITEMODE_8888
-
-#undef BYTESPERPIXEL
-#define BYTESPERPIXEL 4
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = TDFXPACKCOLOR8888( color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch) = \
- TDFXPACKCOLOR8888( r, g, b, a )
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLuint p = *(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
- } while (0)
-
-#define TAG(x) tdfx##x##_ARGB8888
-#include "../dri/common/spantmp.h"
-
-
-/************************************************************************/
-/***** Depth functions *****/
-/************************************************************************/
-
-#define DBG 0
-
-#undef HW_WRITE_LOCK
-#undef HW_WRITE_UNLOCK
-#undef HW_READ_LOCK
-#undef HW_READ_UNLOCK
-
-#define HW_CLIPLOOP HW_WRITE_CLIPLOOP
-
-#define LOCAL_DEPTH_VARS \
- GLuint pitch = info.strideInBytes; \
- GLuint height = fxMesa->height; \
- char *buf = (char *)((char *)info.lfbPtr + 0 /* x, y offset */); \
- (void) buf;
-
-#define HW_WRITE_LOCK() \
- fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GrLfbInfo_t info; \
- info.size = sizeof(GrLfbInfo_t); \
- if ( grLfbLock( GR_LFB_WRITE_ONLY, \
- GR_BUFFER_AUXBUFFER, LFB_MODE, \
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) {
-
-#define HW_WRITE_UNLOCK() \
- grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_AUXBUFFER); \
- }
-
-#define HW_READ_LOCK() \
- fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GrLfbInfo_t info; \
- info.size = sizeof(GrLfbInfo_t); \
- if ( grLfbLock( GR_LFB_READ_ONLY, GR_BUFFER_AUXBUFFER, \
- LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) {
-
-#define HW_READ_UNLOCK() \
- grLfbUnlock( GR_LFB_READ_ONLY, GR_BUFFER_AUXBUFFER); \
- }
-
-
-/* 16 bit, depth spanline and pixel functions */
-
-#undef LFB_MODE
-#define LFB_MODE GR_LFBWRITEMODE_ZA16
-
-#undef BYTESPERPIXEL
-#define BYTESPERPIXEL 2
-
-#define VALUE_TYPE GLushort
-
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = d
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch)
-
-#define TAG(x) tdfx##x##_Z16
-#include "../dri/common/depthtmp.h"
-
-
-/* 24 bit, depth spanline and pixel functions (for use w/ stencil) */
-/* [dBorca] Hack alert:
- * This is evil. The incoming Mesa's 24bit depth value
- * is shifted left 8 bits, to obtain a full 32bit value,
- * which will be thrown into the framebuffer. We rely on
- * the fact that Voodoo hardware transforms a 32bit value
- * into 24bit value automatically and, MOST IMPORTANT, won't
- * alter the upper 8bits of the value already existing in the
- * framebuffer (where stencil resides).
- */
-
-#undef LFB_MODE
-#define LFB_MODE GR_LFBWRITEMODE_Z32
-
-#undef BYTESPERPIXEL
-#define BYTESPERPIXEL 4
-
-#define VALUE_TYPE GLuint
-
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch) = d << 8
-
-#define READ_DEPTH( d, _x, _y ) \
- d = (*(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch)) & 0xffffff
-
-#define TAG(x) tdfx##x##_Z24
-#include "../dri/common/depthtmp.h"
-
-
-/* 32 bit, depth spanline and pixel functions (for use w/o stencil) */
-/* [dBorca] Hack alert:
- * This is more evil. We make Mesa run in 32bit depth, but
- * tha Voodoo HW can only handle 24bit depth. Well, exploiting
- * the pixel pipeline, we can achieve 24:8 format for greater
- * precision...
- * If anyone tells me how to really store 32bit values into the
- * depth buffer, I'll write the *_Z32 routines. Howver, bear in
- * mind that means running without stencil!
- */
-
-/************************************************************************/
-/***** Span functions (optimized) *****/
-/************************************************************************/
-
-/*
- * Read a span of 15-bit RGB pixels. Note, we don't worry about cliprects
- * since OpenGL says obscured pixels have undefined values.
- */
-static void fxReadRGBASpan_ARGB1555 (const GLcontext * ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- GLint x, GLint y,
- GLubyte rgba[][4])
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrBuffer_t currentFB = GR_BUFFER_BACKBUFFER;
- GrLfbInfo_t info;
- info.size = sizeof(GrLfbInfo_t);
- if (grLfbLock(GR_LFB_READ_ONLY, currentFB,
- GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
- const GLint winX = 0;
- const GLint winY = fxMesa->height - 1;
- const GLushort *data16 = (const GLushort *)((const GLubyte *)info.lfbPtr +
- (winY - y) * info.strideInBytes +
- (winX + x) * 2);
- const GLuint *data32 = (const GLuint *) data16;
- GLuint i, j;
- GLuint extraPixel = (n & 1);
- n -= extraPixel;
-
- for (i = j = 0; i < n; i += 2, j++) {
- GLuint pixel = data32[j];
- rgba[i][0] = FX_rgb_scale_5[(pixel >> 10) & 0x1F];
- rgba[i][1] = FX_rgb_scale_5[(pixel >> 5) & 0x1F];
- rgba[i][2] = FX_rgb_scale_5[ pixel & 0x1F];
- rgba[i][3] = (pixel & 0x8000) ? 255 : 0;
- rgba[i+1][0] = FX_rgb_scale_5[(pixel >> 26) & 0x1F];
- rgba[i+1][1] = FX_rgb_scale_5[(pixel >> 21) & 0x1F];
- rgba[i+1][2] = FX_rgb_scale_5[(pixel >> 16) & 0x1F];
- rgba[i+1][3] = (pixel & 0x80000000) ? 255 : 0;
- }
- if (extraPixel) {
- GLushort pixel = data16[n];
- rgba[n][0] = FX_rgb_scale_5[(pixel >> 10) & 0x1F];
- rgba[n][1] = FX_rgb_scale_5[(pixel >> 5) & 0x1F];
- rgba[n][2] = FX_rgb_scale_5[ pixel & 0x1F];
- rgba[n][3] = (pixel & 0x8000) ? 255 : 0;
- }
-
- grLfbUnlock(GR_LFB_READ_ONLY, currentFB);
- }
-}
-
-/*
- * Read a span of 16-bit RGB pixels. Note, we don't worry about cliprects
- * since OpenGL says obscured pixels have undefined values.
- */
-static void fxReadRGBASpan_RGB565 (const GLcontext * ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- GLint x, GLint y,
- GLubyte rgba[][4])
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrBuffer_t currentFB = GR_BUFFER_BACKBUFFER;
- GrLfbInfo_t info;
- info.size = sizeof(GrLfbInfo_t);
- if (grLfbLock(GR_LFB_READ_ONLY, currentFB,
- GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
- const GLint winX = 0;
- const GLint winY = fxMesa->height - 1;
- const GLushort *data16 = (const GLushort *)((const GLubyte *)info.lfbPtr +
- (winY - y) * info.strideInBytes +
- (winX + x) * 2);
- const GLuint *data32 = (const GLuint *) data16;
- GLuint i, j;
- GLuint extraPixel = (n & 1);
- n -= extraPixel;
-
- for (i = j = 0; i < n; i += 2, j++) {
- GLuint pixel = data32[j];
- rgba[i][0] = FX_rgb_scale_5[(pixel >> 11) & 0x1F];
- rgba[i][1] = FX_rgb_scale_6[(pixel >> 5) & 0x3F];
- rgba[i][2] = FX_rgb_scale_5[ pixel & 0x1F];
- rgba[i][3] = 255;
- rgba[i+1][0] = FX_rgb_scale_5[(pixel >> 27) & 0x1F];
- rgba[i+1][1] = FX_rgb_scale_6[(pixel >> 21) & 0x3F];
- rgba[i+1][2] = FX_rgb_scale_5[(pixel >> 16) & 0x1F];
- rgba[i+1][3] = 255;
- }
- if (extraPixel) {
- GLushort pixel = data16[n];
- rgba[n][0] = FX_rgb_scale_5[(pixel >> 11) & 0x1F];
- rgba[n][1] = FX_rgb_scale_6[(pixel >> 5) & 0x3F];
- rgba[n][2] = FX_rgb_scale_5[ pixel & 0x1F];
- rgba[n][3] = 255;
- }
-
- grLfbUnlock(GR_LFB_READ_ONLY, currentFB);
- }
-}
-
-/*
- * Read a span of 32-bit RGB pixels. Note, we don't worry about cliprects
- * since OpenGL says obscured pixels have undefined values.
- */
-static void fxReadRGBASpan_ARGB8888 (const GLcontext * ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- GLint x, GLint y,
- GLubyte rgba[][4])
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrBuffer_t currentFB = GR_BUFFER_BACKBUFFER;
- GLuint i;
- grLfbReadRegion(currentFB, x, fxMesa->height - 1 - y, n, 1, n * 4, rgba);
- for (i = 0; i < n; i++) {
- GLubyte c = rgba[i][0];
- rgba[i][0] = rgba[i][2];
- rgba[i][2] = c;
- }
-}
-
-
-/************************************************************************/
-/***** Depth functions (optimized) *****/
-/************************************************************************/
-
-static void
-fxReadDepthSpan_Z16(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, GLuint depth[])
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLint bottom = fxMesa->height - 1;
- GLushort depth16[MAX_WIDTH];
- GLuint i;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxReadDepthSpan_Z16(...)\n");
- }
-
- grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16);
- for (i = 0; i < n; i++) {
- depth[i] = depth16[i];
- }
-}
-
-
-static void
-fxReadDepthSpan_Z24(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, GLuint depth[])
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLint bottom = fxMesa->height - 1;
- GLuint i;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxReadDepthSpan_Z24(...)\n");
- }
-
- grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth);
- for (i = 0; i < n; i++) {
- depth[i] &= 0xffffff;
- }
-}
-
-
-/************************************************************************/
-/***** Stencil functions (optimized) *****/
-/************************************************************************/
-
-static void
-fxWriteStencilSpan (GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const GLstencil stencil[], const GLubyte mask[])
-{
- /*
- * XXX todo
- */
-}
-
-static void
-fxReadStencilSpan(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, GLstencil stencil[])
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLint bottom = fxMesa->height - 1;
- GLuint zs32[MAX_WIDTH];
- GLuint i;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxReadStencilSpan(...)\n");
- }
-
- grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, zs32);
- for (i = 0; i < n; i++) {
- stencil[i] = zs32[i] >> 24;
- }
-}
-
-static void
-fxWriteStencilPixels (GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n,
- const GLint x[], const GLint y[],
- const GLstencil stencil[],
- const GLubyte mask[])
-{
- /*
- * XXX todo
- */
-}
-
-static void
-fxReadStencilPixels (GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n,
- const GLint x[], const GLint y[],
- GLstencil stencil[])
-{
- /*
- * XXX todo
- */
-}
-
-
-void
-fxSetupDDSpanPointers(GLcontext * ctx)
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- switch (fxMesa->colDepth) {
- case 15:
- swdd->WriteRGBASpan = tdfxWriteRGBASpan_ARGB1555;
- swdd->WriteRGBSpan = tdfxWriteRGBSpan_ARGB1555;
- swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_ARGB1555;
- swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_ARGB1555;
- swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_ARGB1555;
- swdd->ReadRGBASpan = /*td*/fxReadRGBASpan_ARGB1555;
- swdd->ReadRGBAPixels = tdfxReadRGBAPixels_ARGB1555;
-
- swdd->WriteDepthSpan = tdfxWriteDepthSpan_Z16;
- swdd->WriteDepthPixels = tdfxWriteDepthPixels_Z16;
- swdd->ReadDepthSpan = /*td*/fxReadDepthSpan_Z16;
- swdd->ReadDepthPixels = tdfxReadDepthPixels_Z16;
- break;
- case 16:
- swdd->WriteRGBASpan = tdfxWriteRGBASpan_RGB565;
- swdd->WriteRGBSpan = tdfxWriteRGBSpan_RGB565;
- swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_RGB565;
- swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB565;
- swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB565;
- swdd->ReadRGBASpan = /*td*/fxReadRGBASpan_RGB565;
- swdd->ReadRGBAPixels = tdfxReadRGBAPixels_RGB565;
-
- swdd->WriteDepthSpan = tdfxWriteDepthSpan_Z16;
- swdd->WriteDepthPixels = tdfxWriteDepthPixels_Z16;
- swdd->ReadDepthSpan = /*td*/fxReadDepthSpan_Z16;
- swdd->ReadDepthPixels = tdfxReadDepthPixels_Z16;
- break;
- case 32:
- swdd->WriteRGBASpan = tdfxWriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = tdfxWriteRGBSpan_ARGB8888;
- swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_ARGB8888;
- swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_ARGB8888;
- swdd->ReadRGBASpan = /*td*/fxReadRGBASpan_ARGB8888;
- swdd->ReadRGBAPixels = tdfxReadRGBAPixels_ARGB8888;
-
- swdd->WriteDepthSpan = tdfxWriteDepthSpan_Z24;
- swdd->WriteDepthPixels = tdfxWriteDepthPixels_Z24;
- swdd->ReadDepthSpan = /*td*/fxReadDepthSpan_Z24;
- swdd->ReadDepthPixels = tdfxReadDepthPixels_Z24;
- break;
- }
-
- if (fxMesa->haveHwStencil) {
- swdd->WriteStencilSpan = fxWriteStencilSpan;
- swdd->ReadStencilSpan = fxReadStencilSpan;
- swdd->WriteStencilPixels = fxWriteStencilPixels;
- swdd->ReadStencilPixels = fxReadStencilPixels;
- }
-#if 0
- swdd->WriteCI8Span = NULL;
- swdd->WriteCI32Span = NULL;
- swdd->WriteMonoCISpan = NULL;
- swdd->WriteCI32Pixels = NULL;
- swdd->WriteMonoCIPixels = NULL;
- swdd->ReadCI32Span = NULL;
- swdd->ReadCI32Pixels = NULL;
-
- swdd->SpanRenderStart = tdfxSpanRenderStart; /* BEGIN_BOARD_LOCK */
- swdd->SpanRenderFinish = tdfxSpanRenderFinish; /* END_BOARD_LOCK */
-#endif
-}
-
-
-#else
-
-
-/*
- * Need this to provide at least one external definition.
- */
-
-extern int gl_fx_dummy_function_span(void);
-int
-gl_fx_dummy_function_span(void)
-{
- return 0;
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
deleted file mode 100644
index 9dd4f1e9c37..00000000000
--- a/src/mesa/drivers/glide/fxddtex.c
+++ /dev/null
@@ -1,1836 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#if defined(FX)
-
-#include "fxdrv.h"
-#include "main/enums.h"
-#include "main/formats.h"
-#include "main/image.h"
-#include "main/teximage.h"
-#include "main/texstore.h"
-#include "main/texformat.h"
-#include "main/texcompress.h"
-#include "main/texobj.h"
-#include "main/texstore.h"
-
-
-/* no borders! can't halve 1x1! (stride > width * comp) not allowed */
-static void
-_mesa_halve2x2_teximage2d ( GLcontext *ctx,
- struct gl_texture_image *texImage,
- GLuint bytesPerPixel,
- GLint srcWidth, GLint srcHeight,
- const GLvoid *srcImage, GLvoid *dstImage )
-{
- GLint i, j, k;
- GLint dstWidth = srcWidth / 2;
- GLint dstHeight = srcHeight / 2;
- GLint srcRowStride = srcWidth * bytesPerPixel;
- GLubyte *src = (GLubyte *)srcImage;
- GLubyte *dst = dstImage;
-
- GLuint bpt = 0;
- GLubyte *_s = NULL;
- GLubyte *_d = NULL;
- GLenum _t = 0;
-
- if (texImage->TexFormat->MesaFormat == MESA_FORMAT_RGB565) {
- _t = GL_UNSIGNED_SHORT_5_6_5_REV;
- bpt = bytesPerPixel;
- } else if (texImage->TexFormat->MesaFormat == MESA_FORMAT_ARGB4444) {
- _t = GL_UNSIGNED_SHORT_4_4_4_4_REV;
- bpt = bytesPerPixel;
- } else if (texImage->TexFormat->MesaFormat == MESA_FORMAT_ARGB1555) {
- _t = GL_UNSIGNED_SHORT_1_5_5_5_REV;
- bpt = bytesPerPixel;
- }
- if (bpt) {
- bytesPerPixel = 4;
- srcRowStride = srcWidth * bytesPerPixel;
- if (dstWidth == 0) {
- dstWidth = 1;
- }
- if (dstHeight == 0) {
- dstHeight = 1;
- }
- _s = src = MALLOC(srcRowStride * srcHeight);
- _d = dst = MALLOC(dstWidth * bytesPerPixel * dstHeight);
- _mesa_texstore(ctx, 2, GL_RGBA,
- &_mesa_texformat_rgba8888_rev, src,
- 0, 0, 0, /* dstX/Y/Zoffset */
- srcRowStride, /* dstRowStride */
- 0, /* dstImageStride */
- srcWidth, srcHeight, 1,
- texImage->_BaseFormat, _t,
- srcImage, &ctx->DefaultPacking);
- }
-
- if (srcHeight == 1) {
- for (i = 0; i < dstWidth; i++) {
- for (k = 0; k < bytesPerPixel; k++) {
- dst[0] = (src[0] + src[bytesPerPixel] + 1) / 2;
- src++;
- dst++;
- }
- src += bytesPerPixel;
- }
- } else if (srcWidth == 1) {
- for (j = 0; j < dstHeight; j++) {
- for (k = 0; k < bytesPerPixel; k++) {
- dst[0] = (src[0] + src[srcRowStride] + 1) / 2;
- src++;
- dst++;
- }
- src += srcRowStride;
- }
- } else {
- for (j = 0; j < dstHeight; j++) {
- for (i = 0; i < dstWidth; i++) {
- for (k = 0; k < bytesPerPixel; k++) {
- dst[0] = (src[0] +
- src[bytesPerPixel] +
- src[srcRowStride] +
- src[srcRowStride + bytesPerPixel] + 2) / 4;
- src++;
- dst++;
- }
- src += bytesPerPixel;
- }
- src += srcRowStride;
- }
- }
-
- if (bpt) {
- src = _s;
- dst = _d;
- _mesa_texstore(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat, dstImage,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstWidth * bpt,
- 0, /* dstImageStride */
- dstWidth, dstHeight, 1,
- GL_BGRA, CHAN_TYPE, dst, &ctx->DefaultPacking);
- FREE(dst);
- FREE(src);
- }
-}
-
-
-void
-fxPrintTextureData(tfxTexInfo * ti)
-{
- fprintf(stderr, "Texture Data:\n");
- if (ti->tObj) {
- fprintf(stderr, "\tName: %d\n", ti->tObj->Name);
- fprintf(stderr, "\tBaseLevel: %d\n", ti->tObj->BaseLevel);
- fprintf(stderr, "\tSize: %d x %d\n",
- ti->tObj->Image[0][ti->tObj->BaseLevel]->Width,
- ti->tObj->Image[0][ti->tObj->BaseLevel]->Height);
- }
- else
- fprintf(stderr, "\tName: UNNAMED\n");
- fprintf(stderr, "\tLast used: %d\n", ti->lastTimeUsed);
- fprintf(stderr, "\tTMU: %ld\n", ti->whichTMU);
- fprintf(stderr, "\t%s\n", (ti->isInTM) ? "In TMU" : "Not in TMU");
- if (ti->tm[0])
- fprintf(stderr, "\tMem0: %x-%x\n", (unsigned) ti->tm[0]->startAddr,
- (unsigned) ti->tm[0]->endAddr);
- if (ti->tm[1])
- fprintf(stderr, "\tMem1: %x-%x\n", (unsigned) ti->tm[1]->startAddr,
- (unsigned) ti->tm[1]->endAddr);
- fprintf(stderr, "\tMipmaps: %d-%d\n", ti->minLevel, ti->maxLevel);
- fprintf(stderr, "\tFilters: min %d max %d\n",
- (int) ti->minFilt, (int) ti->maxFilt);
- fprintf(stderr, "\tClamps: s %d t %d\n", (int) ti->sClamp,
- (int) ti->tClamp);
- fprintf(stderr, "\tScales: s %f t %f\n", ti->sScale, ti->tScale);
- fprintf(stderr, "\t%s\n",
- (ti->fixedPalette) ? "Fixed palette" : "Non fixed palette");
- fprintf(stderr, "\t%s\n", (ti->validated) ? "Validated" : "Not validated");
-}
-
-
-/************************************************************************/
-/*************************** Texture Mapping ****************************/
-/************************************************************************/
-
-static void
-fxTexInvalidate(GLcontext * ctx, struct gl_texture_object *tObj)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxTexInfo *ti;
-
- ti = fxTMGetTexInfo(tObj);
- if (ti->isInTM)
- fxTMMoveOutTM(fxMesa, tObj); /* TO DO: SLOW but easy to write */
-
- ti->validated = GL_FALSE;
- fxMesa->new_state |= FX_NEW_TEXTURING;
-}
-
-static tfxTexInfo *
-fxAllocTexObjData(fxMesaContext fxMesa)
-{
- tfxTexInfo *ti;
-
- if (!(ti = CALLOC(sizeof(tfxTexInfo)))) {
- fprintf(stderr, "fxAllocTexObjData: ERROR: out of memory !\n");
- fxCloseHardware();
- exit(-1);
- }
-
- ti->validated = GL_FALSE;
- ti->isInTM = GL_FALSE;
-
- ti->whichTMU = FX_TMU_NONE;
-
- ti->tm[FX_TMU0] = NULL;
- ti->tm[FX_TMU1] = NULL;
-
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- ti->maxFilt = GR_TEXTUREFILTER_BILINEAR;
-
- ti->sClamp = GR_TEXTURECLAMP_WRAP;
- ti->tClamp = GR_TEXTURECLAMP_WRAP;
-
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->LODblend = FXFALSE;
-
- return ti;
-}
-
-void
-fxDDTexBind(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxTexInfo *ti;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDTexBind(%d, %x)\n", tObj->Name, (GLuint)tObj->DriverData);
- }
-
- if ((target != GL_TEXTURE_1D) && (target != GL_TEXTURE_2D))
- return;
-
- if (!tObj->DriverData) {
- tObj->DriverData = fxAllocTexObjData(fxMesa);
- }
- ti = fxTMGetTexInfo(tObj);
-
- fxMesa->texBindNumber++;
- ti->lastTimeUsed = fxMesa->texBindNumber;
-
- fxMesa->new_state |= FX_NEW_TEXTURING;
-}
-
-void
-fxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname,
- const GLfloat * param)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- if (param)
- fprintf(stderr, "fxDDTexEnv(%x, %x)\n", pname, (GLint) (*param));
- else
- fprintf(stderr, "fxDDTexEnv(%x)\n", pname);
- }
-
- /* apply any lod biasing right now */
- if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
- GLfloat bias = *param;
- bias = CLAMP(bias,
- -ctx->Const.MaxTextureLodBias,
- ctx->Const.MaxTextureLodBias - 0.25);
-
- grTexLodBiasValue(GR_TMU0, bias);
-
- if (fxMesa->haveTwoTMUs) {
- grTexLodBiasValue(GR_TMU1, bias);
- }
-
- }
-
- fxMesa->new_state |= FX_NEW_TEXTURING;
-}
-
-void
-fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
- GLenum pname, const GLfloat * params)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLenum param = (GLenum) (GLint) params[0];
- tfxTexInfo *ti;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDTexParam(%d, %x, %s, %s)\n",
- tObj->Name, (GLuint) tObj->DriverData,
- _mesa_lookup_enum_by_nr(pname),
- _mesa_lookup_enum_by_nr(param));
- }
-
- if ((target != GL_TEXTURE_1D) && (target != GL_TEXTURE_2D))
- return;
-
- if (!tObj->DriverData)
- tObj->DriverData = fxAllocTexObjData(fxMesa);
- ti = fxTMGetTexInfo(tObj);
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- switch (param) {
- case GL_NEAREST:
- ti->mmMode = GR_MIPMAP_DISABLE;
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- ti->LODblend = FXFALSE;
- break;
- case GL_LINEAR:
- ti->mmMode = GR_MIPMAP_DISABLE;
- ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
- ti->LODblend = FXFALSE;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- /* [dBorca]
- * currently Napalm can't do single-pass trilinear,
- * because the way its combiners are set. So we fall back
- * to GL_NEAREST_MIPMAP_NEAREST. We'll let true trilinear
- * enabled for V2, V3.
- */
- if (!fxMesa->HaveCmbExt) {
- if (fxMesa->haveTwoTMUs) {
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->LODblend = FXTRUE;
- } else {
- ti->mmMode = GR_MIPMAP_NEAREST_DITHER;
- ti->LODblend = FXFALSE;
- }
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- break;
- }
- case GL_NEAREST_MIPMAP_NEAREST:
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- ti->LODblend = FXFALSE;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- /* [dBorca]
- * currently Napalm can't do single-pass trilinear,
- * because the way its combiners are set. So we fall back
- * to GL_LINEAR_MIPMAP_NEAREST. We'll let true trilinear
- * enabled for V2, V3.
- */
- if (!fxMesa->HaveCmbExt) {
- if (fxMesa->haveTwoTMUs) {
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->LODblend = FXTRUE;
- } else {
- ti->mmMode = GR_MIPMAP_NEAREST_DITHER;
- ti->LODblend = FXFALSE;
- }
- ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
- break;
- }
- case GL_LINEAR_MIPMAP_NEAREST:
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
- ti->LODblend = FXFALSE;
- break;
- default:
- break;
- }
- fxTexInvalidate(ctx, tObj);
- break;
-
- case GL_TEXTURE_MAG_FILTER:
- switch (param) {
- case GL_NEAREST:
- ti->maxFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- break;
- case GL_LINEAR:
- ti->maxFilt = GR_TEXTUREFILTER_BILINEAR;
- break;
- default:
- break;
- }
- fxMesa->new_state |= FX_NEW_TEXTURING;
- break;
-
- case GL_TEXTURE_WRAP_S:
- switch (param) {
- case GL_MIRRORED_REPEAT:
- ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT;
- break;
- case GL_CLAMP_TO_BORDER: /* no-no, but don't REPEAT, either */
- case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */
- case GL_CLAMP:
- ti->sClamp = GR_TEXTURECLAMP_CLAMP;
- break;
- case GL_REPEAT:
- ti->sClamp = GR_TEXTURECLAMP_WRAP;
- break;
- default:
- break;
- }
- fxMesa->new_state |= FX_NEW_TEXTURING;
- break;
-
- case GL_TEXTURE_WRAP_T:
- switch (param) {
- case GL_MIRRORED_REPEAT:
- ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT;
- break;
- case GL_CLAMP_TO_BORDER: /* no-no, but don't REPEAT, either */
- case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */
- case GL_CLAMP:
- ti->tClamp = GR_TEXTURECLAMP_CLAMP;
- break;
- case GL_REPEAT:
- ti->tClamp = GR_TEXTURECLAMP_WRAP;
- break;
- default:
- break;
- }
- fxMesa->new_state |= FX_NEW_TEXTURING;
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- /* TO DO */
- break;
-
- case GL_TEXTURE_MIN_LOD:
- /* TO DO */
- break;
- case GL_TEXTURE_MAX_LOD:
- /* TO DO */
- break;
- case GL_TEXTURE_BASE_LEVEL:
- fxTexInvalidate(ctx, tObj);
- break;
- case GL_TEXTURE_MAX_LEVEL:
- fxTexInvalidate(ctx, tObj);
- break;
-
- default:
- break;
- }
-}
-
-void
-fxDDTexDel(GLcontext * ctx, struct gl_texture_object *tObj)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDTexDel(%d, %p)\n", tObj->Name, (void *) ti);
- }
-
- if (!ti)
- return;
-
- fxTMFreeTexture(fxMesa, tObj);
-
- FREE(ti);
- tObj->DriverData = NULL;
-
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, tObj);
-}
-
-
-/**
- * Allocate a new texture object.
- * Called via ctx->Driver.NewTextureObject.
- * Note: this function will be called during context creation to
- * allocate the default texture objects.
- */
-struct gl_texture_object *
-fxDDNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- return obj;
-}
-
-
-/*
- * Return true if texture is resident, false otherwise.
- */
-GLboolean
-fxDDIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj)
-{
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- return (ti && ti->isInTM);
-}
-
-
-
-/*
- * Convert a gl_color_table texture palette to Glide's format.
- */
-static GrTexTable_t
-convertPalette(const fxMesaContext fxMesa, FxU32 data[256], const struct gl_color_table *table)
-{
- const GLubyte *tableUB = (const GLubyte *) table->Table;
- GLint width = table->Size;
- FxU32 r, g, b, a;
- GLint i;
-
- ASSERT(table->Type == GL_UNSIGNED_BYTE);
-
- switch (table->_BaseFormat) {
- case GL_INTENSITY:
- for (i = 0; i < width; i++) {
- r = tableUB[i];
- g = tableUB[i];
- b = tableUB[i];
- a = tableUB[i];
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- return fxMesa->HavePalExt ? GR_TEXTABLE_PALETTE_6666_EXT : GR_TEXTABLE_PALETTE;
- case GL_LUMINANCE:
- for (i = 0; i < width; i++) {
- r = tableUB[i];
- g = tableUB[i];
- b = tableUB[i];
- a = 255;
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- return GR_TEXTABLE_PALETTE;
- case GL_ALPHA:
- for (i = 0; i < width; i++) {
- r = g = b = 255;
- a = tableUB[i];
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- return fxMesa->HavePalExt ? GR_TEXTABLE_PALETTE_6666_EXT : GR_TEXTABLE_PALETTE;
- case GL_LUMINANCE_ALPHA:
- for (i = 0; i < width; i++) {
- r = g = b = tableUB[i * 2 + 0];
- a = tableUB[i * 2 + 1];
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- return fxMesa->HavePalExt ? GR_TEXTABLE_PALETTE_6666_EXT : GR_TEXTABLE_PALETTE;
- default:
- case GL_RGB:
- for (i = 0; i < width; i++) {
- r = tableUB[i * 3 + 0];
- g = tableUB[i * 3 + 1];
- b = tableUB[i * 3 + 2];
- a = 255;
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- return GR_TEXTABLE_PALETTE;
- case GL_RGBA:
- for (i = 0; i < width; i++) {
- r = tableUB[i * 4 + 0];
- g = tableUB[i * 4 + 1];
- b = tableUB[i * 4 + 2];
- a = tableUB[i * 4 + 3];
- data[i] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- return fxMesa->HavePalExt ? GR_TEXTABLE_PALETTE_6666_EXT : GR_TEXTABLE_PALETTE;
- }
-}
-
-
-void
-fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (tObj) {
- /* per-texture palette */
- tfxTexInfo *ti;
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDTexPalette(%d, %x)\n",
- tObj->Name, (GLuint) tObj->DriverData);
- }
- /* This might be a proxy texture. */
- if (!tObj->Palette.Table)
- return;
- if (!tObj->DriverData)
- tObj->DriverData = fxAllocTexObjData(fxMesa);
- ti = fxTMGetTexInfo(tObj);
- ti->paltype = convertPalette(fxMesa, ti->palette.data, &tObj->Palette);
- fxTexInvalidate(ctx, tObj);
- }
- else {
- /* global texture palette */
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDTexPalette(global)\n");
- }
- fxMesa->glbPalType = convertPalette(fxMesa, fxMesa->glbPalette.data, &ctx->Texture.Palette);
- fxMesa->new_state |= FX_NEW_TEXTURING;
-
- grTexDownloadTable(fxMesa->glbPalType, &(fxMesa->glbPalette));
- }
-}
-
-
-void
-fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDTexUseGlbPalette(%d)\n", state);
- }
-
- fxMesa->haveGlobalPaletteTexture = state;
- fxMesa->new_state |= FX_NEW_TEXTURING;
-}
-
-
-static int
-logbase2(int n)
-{
- GLint i = 1;
- GLint log2 = 0;
-
- if (n < 0) {
- return -1;
- }
-
- while (n > i) {
- i *= 2;
- log2++;
- }
- if (i != n) {
- return -1;
- }
- else {
- return log2;
- }
-}
-
-
-/* fxTexGetInfo
- * w, h - source texture width and height
- * lodlevel - Glide lod level token for the larger texture dimension
- * ar - Glide aspect ratio token
- * sscale - S scale factor used during triangle setup
- * tscale - T scale factor used during triangle setup
- * wscale - OpenGL -> Glide image width scale factor
- * hscale - OpenGL -> Glide image height scale factor
- */
-int
-fxTexGetInfo(int w, int h, GrLOD_t * lodlevel, GrAspectRatio_t * ar,
- float *sscale, float *tscale,
- int *wscale, int *hscale)
-{
- int logw, logh, ws, hs;
- GrLOD_t l;
- GrAspectRatio_t aspectratio;
- float s, t;
-
- logw = logbase2(w);
- logh = logbase2(h);
-
- l = MAX2(logw, logh);
- aspectratio = logw - logh;
- ws = hs = 1;
- s = t = 256.0f;
-
- /* hardware only allows a maximum aspect ratio of 8x1, so handle
- * |aspectratio| > 3 by scaling the image and using an 8x1 aspect
- * ratio
- */
- switch (aspectratio) {
- case 0:
- break;
- case 1:
- t = 128.0f;
- break;
- case 2:
- t = 64.0f;
- break;
- case 3:
- t = 32.0f;
- break;
- case -1:
- s = 128.0f;
- break;
- case -2:
- s = 64.0f;
- break;
- case -3:
- s = 32.0f;
- break;
- default:
- if (aspectratio > 3) {
- t = 32.0f;
- hs = 1 << (aspectratio - 3);
- aspectratio = GR_ASPECT_LOG2_8x1;
- } else /*if (aspectratio < -3)*/ {
- s = 32.0f;
- ws = 1 << (-aspectratio - 3);
- aspectratio = GR_ASPECT_LOG2_1x8;
- }
- }
-
- if (lodlevel)
- (*lodlevel) = l;
-
- if (ar)
- (*ar) = aspectratio;
-
- if (sscale)
- (*sscale) = s;
-
- if (tscale)
- (*tscale) = t;
-
- if (wscale)
- (*wscale) = ws;
-
- if (hscale)
- (*hscale) = hs;
-
-
- return 1;
-}
-
-static GLboolean
-fxIsTexSupported(GLenum target, GLint internalFormat,
- const struct gl_texture_image *image)
-{
- if ((target != GL_TEXTURE_1D) && (target != GL_TEXTURE_2D))
- return GL_FALSE;
-
-#if 0
- if (!fxTexGetInfo(image->Width, image->Height, NULL, NULL, NULL, NULL, NULL, NULL))
- return GL_FALSE;
-#endif
-
- if (image->Border > 0)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-/**********************************************************************/
-/**** NEW TEXTURE IMAGE FUNCTIONS ****/
-/**********************************************************************/
-extern void
-fxt1_decode_1 (const void *texture, int width,
- int i, int j, unsigned char *rgba);
-
-/* Texel-fetch functions for software texturing and glGetTexImage().
- * We should have been able to use some "standard" fetch functions (which
- * may get defined in texutil.c) but we have to account for scaled texture
- * images on tdfx hardware (the 8:1 aspect ratio limit).
- * Hence, we need special functions here.
- */
-
-static void
-fetch_intensity8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- const GLubyte *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLubyte *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = *texel;
- rgba[GCOMP] = *texel;
- rgba[BCOMP] = *texel;
- rgba[ACOMP] = *texel;
-}
-
-
-static void
-fetch_luminance8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- const GLubyte *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLubyte *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = *texel;
- rgba[GCOMP] = *texel;
- rgba[BCOMP] = *texel;
- rgba[ACOMP] = 255;
-}
-
-
-static void
-fetch_alpha8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- const GLubyte *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLubyte *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = 255;
- rgba[GCOMP] = 255;
- rgba[BCOMP] = 255;
- rgba[ACOMP] = *texel;
-}
-
-
-static void
-fetch_index8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *indexOut)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- const GLubyte *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLubyte *) texImage->Data) + j * mml->width + i;
- *indexOut = *texel;
-}
-
-
-static void
-fetch_luminance8_alpha8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- const GLubyte *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLubyte *) texImage->Data) + (j * mml->width + i) * 2;
- rgba[RCOMP] = texel[0];
- rgba[GCOMP] = texel[0];
- rgba[BCOMP] = texel[0];
- rgba[ACOMP] = texel[1];
-}
-
-
-static void
-fetch_r5g6b5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- const GLushort *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = FX_rgb_scale_5[(*texel >> 11) & 0x1F];
- rgba[GCOMP] = FX_rgb_scale_6[(*texel >> 5) & 0x3F];
- rgba[BCOMP] = FX_rgb_scale_5[ *texel & 0x1F];
- rgba[ACOMP] = 255;
-}
-
-
-static void
-fetch_r4g4b4a4(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- const GLushort *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = FX_rgb_scale_4[(*texel >> 8) & 0xF];
- rgba[GCOMP] = FX_rgb_scale_4[(*texel >> 4) & 0xF];
- rgba[BCOMP] = FX_rgb_scale_4[ *texel & 0xF];
- rgba[ACOMP] = FX_rgb_scale_4[(*texel >> 12) & 0xF];
-}
-
-
-static void
-fetch_r5g5b5a1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- const GLushort *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = FX_rgb_scale_5[(*texel >> 10) & 0x1F];
- rgba[GCOMP] = FX_rgb_scale_5[(*texel >> 5) & 0x1F];
- rgba[BCOMP] = FX_rgb_scale_5[ *texel & 0x1F];
- rgba[ACOMP] = (*texel >> 15) * 255;
-}
-
-
-static void
-fetch_a8r8g8b8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- const GLuint *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLuint *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 16) & 0xff);
- rgba[GCOMP] = (((*texel) >> 8) & 0xff);
- rgba[BCOMP] = (((*texel) ) & 0xff);
- rgba[ACOMP] = (((*texel) >> 24) & 0xff);
-}
-
-
-static void
-fetch_rgb_fxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- fxt1_decode_1(texImage->Data, mml->width, i, j, rgba);
- rgba[ACOMP] = 255;
-}
-
-
-static void
-fetch_rgba_fxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- fxt1_decode_1(texImage->Data, mml->width, i, j, rgba);
-}
-
-
-static void
-fetch_rgb_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- _mesa_texformat_rgb_dxt1.FetchTexel2D(texImage, i, j, k, rgba);
-}
-
-
-static void
-fetch_rgba_dxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- _mesa_texformat_rgba_dxt1.FetchTexel2D(texImage, i, j, k, rgba);
-}
-
-
-static void
-fetch_rgba_dxt3(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- _mesa_texformat_rgba_dxt3.FetchTexel2D(texImage, i, j, k, rgba);
-}
-
-
-static void
-fetch_rgba_dxt5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *rgba)
-{
- const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- _mesa_texformat_rgba_dxt5.FetchTexel2D(texImage, i, j, k, rgba);
-}
-
-
-#if 0 /* break glass in case of emergency */
-static void
-PrintTexture(int w, int h, int c, const GLubyte * data)
-{
- int i, j;
- for (i = 0; i < h; i++) {
- for (j = 0; j < w; j++) {
- if (c == 2)
- fprintf(stderr, "%02x %02x ", data[0], data[1]);
- else if (c == 3)
- fprintf(stderr, "%02x %02x %02x ", data[0], data[1], data[2]);
- data += c;
- }
- fprintf(stderr, "\n");
- }
-}
-#endif
-
-
-gl_format
-fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum srcFormat, GLenum srcType )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLboolean allow32bpt = fxMesa->HaveTexFmt;
-
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxDDChooseTextureFormat(...)\n");
- }
-
- switch (internalFormat) {
- case GL_COMPRESSED_RGB:
- /* intentional fall through */
- case 3:
- case GL_RGB:
- if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) {
- return MESA_FORMAT_RGB565;
- }
- /* intentional fall through */
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return (allow32bpt) ? MESA_FORMAT_ARGB8888
- : MESA_FORMAT_RGB565;
- case GL_RGBA2:
- case GL_RGBA4:
- return MESA_FORMAT_ARGB4444;
- case GL_COMPRESSED_RGBA:
- /* intentional fall through */
- case 4:
- case GL_RGBA:
- if ( srcFormat == GL_BGRA ) {
- if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- return MESA_FORMAT_ARGB8888;
- }
- else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return MESA_FORMAT_ARGB4444;
- }
- else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return MESA_FORMAT_ARGB1555;
- }
- }
- /* intentional fall through */
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return (allow32bpt) ? MESA_FORMAT_ARGB8888
- : MESA_FORMAT_ARGB4444;
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return MESA_FORMAT_I8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return MESA_FORMAT_L8;
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return MESA_FORMAT_A8;
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return MESA_FORMAT_CI8;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- return MESA_FORMAT_AL88;
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- return MESA_FORMAT_RGB565;
- case GL_RGB5_A1:
- return MESA_FORMAT_ARGB1555;
- /* GL_EXT_texture_compression_s3tc */
- /* GL_S3_s3tc */
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- return MESA_FORMAT_RGB_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return MESA_FORMAT_RGBA_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- return MESA_FORMAT_RGBA_DXT3;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return MESA_FORMAT_RGBA_DXT5;
- /* GL_3DFX_texture_compression_FXT1 */
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return MESA_FORMAT_RGB_FXT1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return MESA_FORMAT_RGBA_FXT1;
- default:
- _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
- return MESA_FORMAT_NONE;
- }
-}
-
-
-static GrTextureFormat_t
-fxGlideFormat(GLint mesaFormat)
-{
- switch (mesaFormat) {
- case MESA_FORMAT_I8:
- return GR_TEXFMT_ALPHA_8;
- case MESA_FORMAT_A8:
- return GR_TEXFMT_ALPHA_8;
- case MESA_FORMAT_L8:
- return GR_TEXFMT_INTENSITY_8;
- case MESA_FORMAT_CI8:
- return GR_TEXFMT_P_8;
- case MESA_FORMAT_AL88:
- return GR_TEXFMT_ALPHA_INTENSITY_88;
- case MESA_FORMAT_RGB565:
- return GR_TEXFMT_RGB_565;
- case MESA_FORMAT_ARGB4444:
- return GR_TEXFMT_ARGB_4444;
- case MESA_FORMAT_ARGB1555:
- return GR_TEXFMT_ARGB_1555;
- case MESA_FORMAT_ARGB8888:
- return GR_TEXFMT_ARGB_8888;
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
- return GR_TEXFMT_ARGB_CMP_FXT1;
- case MESA_FORMAT_RGB_DXT1:
- case MESA_FORMAT_RGBA_DXT1:
- return GR_TEXFMT_ARGB_CMP_DXT1;
- case MESA_FORMAT_RGBA_DXT3:
- return GR_TEXFMT_ARGB_CMP_DXT3;
- case MESA_FORMAT_RGBA_DXT5:
- return GR_TEXFMT_ARGB_CMP_DXT5;
- default:
- _mesa_problem(NULL, "Unexpected format in fxGlideFormat");
- return 0;
- }
-}
-
-
-static FetchTexelFuncC
-fxFetchFunction(GLint mesaFormat)
-{
- switch (mesaFormat) {
- case MESA_FORMAT_I8:
- return &fetch_intensity8;
- case MESA_FORMAT_A8:
- return &fetch_alpha8;
- case MESA_FORMAT_L8:
- return &fetch_luminance8;
- case MESA_FORMAT_CI8:
- return &fetch_index8;
- case MESA_FORMAT_AL88:
- return &fetch_luminance8_alpha8;
- case MESA_FORMAT_RGB565:
- return &fetch_r5g6b5;
- case MESA_FORMAT_ARGB4444:
- return &fetch_r4g4b4a4;
- case MESA_FORMAT_ARGB1555:
- return &fetch_r5g5b5a1;
- case MESA_FORMAT_ARGB8888:
- return &fetch_a8r8g8b8;
- case MESA_FORMAT_RGB_FXT1:
- return &fetch_rgb_fxt1;
- case MESA_FORMAT_RGBA_FXT1:
- return &fetch_rgba_fxt1;
- case MESA_FORMAT_RGB_DXT1:
- return &fetch_rgb_dxt1;
- case MESA_FORMAT_RGBA_DXT1:
- return &fetch_rgba_dxt1;
- case MESA_FORMAT_RGBA_DXT3:
- return &fetch_rgba_dxt3;
- case MESA_FORMAT_RGBA_DXT5:
- return &fetch_rgba_dxt5;
- default:
- _mesa_problem(NULL, "Unexpected format in fxFetchFunction");
- return NULL;
- }
-}
-
-
-static GLboolean
-adjust2DRatio (GLcontext *ctx,
- GLint xoffset, GLint yoffset,
- GLint width, GLint height,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- tfxMipMapLevel *mml,
- struct gl_texture_image *texImage,
- GLint texelBytes,
- GLint dstRowStride)
-{
- const GLint newWidth = width * mml->wScale;
- const GLint newHeight = height * mml->hScale;
- GLvoid *tempImage;
-
- if (!_mesa_is_format_compressed(texImage->TexFormat)) {
- GLubyte *destAddr;
-
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- return GL_FALSE;
- }
-
- _mesa_texstore(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat, tempImage,
- 0, 0, 0, /* dstX/Y/Zoffset */
- width * texelBytes, /* dstRowStride */
- 0, /* dstImageStride */
- width, height, 1,
- format, type, pixels, packing);
-
- /* now rescale */
- /* compute address of dest subimage within the overal tex image */
- destAddr = (GLubyte *) texImage->Data
- + (yoffset * mml->hScale * mml->width
- + xoffset * mml->wScale) * texelBytes;
-
- _mesa_rescale_teximage2d(texelBytes,
- width,
- dstRowStride, /* dst stride */
- width, height,
- newWidth, newHeight,
- tempImage, destAddr);
- } else {
- const GLint rawBytes = 4;
- GLvoid *rawImage = MALLOC(width * height * rawBytes);
-
- if (!rawImage) {
- return GL_FALSE;
- }
- tempImage = MALLOC(newWidth * newHeight * rawBytes);
- if (!tempImage) {
- return GL_FALSE;
- }
- /* unpack image, apply transfer ops and store in rawImage */
- _mesa_texstore(ctx, 2, GL_RGBA,
- &_mesa_texformat_rgba8888_rev, rawImage,
- 0, 0, 0, /* dstX/Y/Zoffset */
- width * rawBytes, /* dstRowStride */
- 0, /* dstImageStride */
- width, height, 1,
- format, type, pixels, packing);
- _mesa_rescale_teximage2d(rawBytes,
- width,
- newWidth * rawBytes, /* dst stride */
- width, height, /* src */
- newWidth, newHeight, /* dst */
- rawImage /*src*/, tempImage /*dst*/ );
- _mesa_texstore(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat, texImage->Data,
- xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- 0, /* dstImageStride */
- newWidth, newHeight, 1,
- GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking);
- FREE(rawImage);
- }
-
- FREE(tempImage);
-
- return GL_TRUE;
-}
-
-
-void
-fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
- GLint internalFormat, GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxTexInfo *ti;
- tfxMipMapLevel *mml;
- GLint texelBytes, dstRowStride;
-
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxDDTexImage2D: id=%d int 0x%x format 0x%x type 0x%x %dx%d\n",
- texObj->Name, texImage->InternalFormat, format, type,
- texImage->Width, texImage->Height);
- }
-
- if (!fxIsTexSupported(target, internalFormat, texImage)) {
- _mesa_problem(NULL, "fx Driver: unsupported texture in fxDDTexImg()\n");
- return;
- }
-
- if (!texObj->DriverData) {
- texObj->DriverData = fxAllocTexObjData(fxMesa);
- if (!texObj->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
- ti = fxTMGetTexInfo(texObj);
-
- if (!texImage->DriverData) {
- texImage->DriverData = CALLOC(sizeof(tfxMipMapLevel));
- if (!texImage->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
- mml = FX_MIPMAP_DATA(texImage);
-
- fxTexGetInfo(width, height, NULL, NULL, NULL, NULL,
- &mml->wScale, &mml->hScale);
-
- mml->width = width * mml->wScale;
- mml->height = height * mml->hScale;
-
-#if FX_COMPRESS_S3TC_AS_FXT1_HACK
- /* [koolsmoky] substitute FXT1 for DXTn and Legacy S3TC */
- if (!ctx->Mesa_DXTn && _mesa_is_format_compressed(texImage->TexFormat)) {
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- internalFormat = GL_COMPRESSED_RGB_FXT1_3DFX;
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- internalFormat = GL_COMPRESSED_RGBA_FXT1_3DFX;
- }
- texImage->InternalFormat = internalFormat;
- }
-#endif
-#if FX_TC_NAPALM
- if (fxMesa->type >= GR_SSTTYPE_Voodoo4) {
- GLenum texNapalm = 0;
- if (internalFormat == GL_COMPRESSED_RGB) {
- texNapalm = GL_COMPRESSED_RGB_FXT1_3DFX;
- } else if (internalFormat == GL_COMPRESSED_RGBA) {
- texNapalm = GL_COMPRESSED_RGBA_FXT1_3DFX;
- }
- if (texNapalm) {
- texImage->InternalFormat = internalFormat = texNapalm;
- }
- }
-#endif
-
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
- /*if (!fxMesa->HaveTexFmt) assert(texelBytes == 1 || texelBytes == 2);*/
-
- mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat);
-
- /* allocate mipmap buffer */
- assert(!texImage->Data);
- if (_mesa_is_format_compressed(texImage->TexFormat)) {
- texImage->CompressedSize = _mesa_format_image_size(texImage->TexFormat,
- mml->width,
- mml->height, 1);
- dstRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width);
- texImage->Data = _mesa_malloc(texImage->CompressedSize);
- } else {
- dstRowStride = mml->width * texelBytes;
- texImage->Data = _mesa_malloc(mml->width * mml->height * texelBytes);
- }
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
-
- if (pixels != NULL) {
- if (mml->wScale != 1 || mml->hScale != 1) {
- /* rescale image to overcome 1:8 aspect limitation */
- if (!adjust2DRatio(ctx,
- 0, 0,
- width, height,
- format, type, pixels,
- packing,
- mml,
- texImage,
- texelBytes,
- dstRowStride)
- ) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
- else {
- /* no rescaling needed */
- /* unpack image, apply transfer ops and store in texImage->Data */
- _mesa_texstore(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat, texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- 0, /* dstImageStride */
- width, height, 1,
- format, type, pixels, packing);
- }
-
- /* GL_SGIS_generate_mipmap */
- if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- GLint mipWidth, mipHeight;
- tfxMipMapLevel *mip;
- struct gl_texture_image *mipImage;
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- const GLint maxLevels = _mesa_max_texture_levels(ctx, texObj->Target);
-
- assert(!_mesa_is_format_compressed(texImage->TexFormat));
-
- while (level < texObj->MaxLevel && level < maxLevels - 1) {
- mipWidth = width / 2;
- if (!mipWidth) {
- mipWidth = 1;
- }
- mipHeight = height / 2;
- if (!mipHeight) {
- mipHeight = 1;
- }
- if ((mipWidth == width) && (mipHeight == height)) {
- break;
- }
- _mesa_TexImage2D(target, ++level, internalFormat,
- mipWidth, mipHeight, border,
- format, type,
- NULL);
- mipImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- mip = FX_MIPMAP_DATA(mipImage);
- _mesa_halve2x2_teximage2d(ctx,
- texImage,
- texelBytes,
- mml->width, mml->height,
- texImage->Data, mipImage->Data);
- texImage = mipImage;
- mml = mip;
- width = mipWidth;
- height = mipHeight;
- }
- }
- }
-
- ti->info.format = mml->glideFormat;
- texImage->FetchTexelc = fxFetchFunction(texImage->TexFormat->MesaFormat);
-
- fxTexInvalidate(ctx, texObj);
-}
-
-
-void
-fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxTexInfo *ti;
- tfxMipMapLevel *mml;
- GLint texelBytes, dstRowStride;
-
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxDDTexSubImage2D: id=%d\n", texObj->Name);
- }
-
- if (!texObj->DriverData) {
- _mesa_problem(ctx, "problem in fxDDTexSubImage2D");
- return;
- }
-
- ti = fxTMGetTexInfo(texObj);
- assert(ti);
- mml = FX_MIPMAP_DATA(texImage);
- assert(mml);
-
- assert(texImage->Data); /* must have an existing texture image! */
- assert(texImage->_BaseFormat);
-
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
- if (_mesa_is_format_compressed(texImage->TexFormat)) {
- dstRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width);
- } else {
- dstRowStride = mml->width * texelBytes;
- }
-
- if (mml->wScale != 1 || mml->hScale != 1) {
- /* need to rescale subimage to match mipmap level's rescale factors */
- if (!adjust2DRatio(ctx,
- xoffset, yoffset,
- width, height,
- format, type, pixels,
- packing,
- mml,
- texImage,
- texelBytes,
- dstRowStride)
- ) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
- }
- else {
- /* no rescaling needed */
- _mesa_texstore(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat, (GLubyte *) texImage->Data,
- xoffset, yoffset, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- 0, /* dstImageStride */
- width, height, 1,
- format, type, pixels, packing);
- }
-
- /* GL_SGIS_generate_mipmap */
- if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- GLint mipWidth, mipHeight;
- tfxMipMapLevel *mip;
- struct gl_texture_image *mipImage;
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- const GLint maxLevels = _mesa_max_texture_levels(ctx, texObj->Target);
-
- assert(!_mesa_is_format_compressed(texImage->TexFormat));
-
- width = texImage->Width;
- height = texImage->Height;
- while (level < texObj->MaxLevel && level < maxLevels - 1) {
- mipWidth = width / 2;
- if (!mipWidth) {
- mipWidth = 1;
- }
- mipHeight = height / 2;
- if (!mipHeight) {
- mipHeight = 1;
- }
- if ((mipWidth == width) && (mipHeight == height)) {
- break;
- }
- ++level;
- mipImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- mip = FX_MIPMAP_DATA(mipImage);
- _mesa_halve2x2_teximage2d(ctx,
- texImage,
- texelBytes,
- mml->width, mml->height,
- texImage->Data, mipImage->Data);
- texImage = mipImage;
- mml = mip;
- width = mipWidth;
- height = mipHeight;
- }
- }
-
- if (ti->validated && ti->isInTM && !texObj->GenerateMipmap)
- fxTMReloadMipMapLevel(fxMesa, texObj, level);
- else
- fxTexInvalidate(ctx, texObj);
-}
-
-
-void
-fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLsizei width, GLsizei height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxTexInfo *ti;
- tfxMipMapLevel *mml;
-
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxDDCompressedTexImage2D: id=%d int 0x%x %dx%d\n",
- texObj->Name, internalFormat,
- width, height);
- }
-
- assert(_mesa_is_format_compressed(texImage->TexFormat));
-
- if (!fxIsTexSupported(target, internalFormat, texImage)) {
- _mesa_problem(NULL, "fx Driver: unsupported texture in fxDDCompressedTexImg()\n");
- return;
- }
-
- if (!texObj->DriverData) {
- texObj->DriverData = fxAllocTexObjData(fxMesa);
- if (!texObj->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
- return;
- }
- }
- ti = fxTMGetTexInfo(texObj);
-
- if (!texImage->DriverData) {
- texImage->DriverData = CALLOC(sizeof(tfxMipMapLevel));
- if (!texImage->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
- return;
- }
- }
- mml = FX_MIPMAP_DATA(texImage);
-
- fxTexGetInfo(width, height, NULL, NULL, NULL, NULL,
- &mml->wScale, &mml->hScale);
-
- mml->width = width * mml->wScale;
- mml->height = height * mml->hScale;
-
- /* Determine the appropriate Glide texel format,
- * given the user's internal texture format hint.
- */
- mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat);
-
- /* allocate new storage for texture image, if needed */
- if (!texImage->Data) {
- texImage->CompressedSize = _mesa_format_image_size(texImage->TexFormat,
- mml->width,
- mml->height, 1);
- texImage->Data = _mesa_malloc(texImage->CompressedSize);
- if (!texImage->Data) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
- return;
- }
- }
-
- /* save the texture data */
- if (mml->wScale != 1 || mml->hScale != 1) {
- /* [dBorca] Hack alert:
- * now we're screwed. We can't decompress,
- * unless we do it in HW (via textureBuffer).
- * We still have some chances:
- * 1) we got FXT1 textures - we CAN decompress, rescale for
- * aspectratio, then compress back.
- * 2) there is a chance that MIN("s", "t") won't be overflowed.
- * Thus, we don't care about textureclamp and we could lower
- * MIN("uscale", "vscale") below 32. We still have to have
- * our data aligned inside a 8:1 rectangle.
- * 3) just in case if MIN("s", "t") gets overflowed with GL_REPEAT,
- * we replicate the data over the padded area.
- * For now, we take 2) + 3) but texelfetchers will be wrong!
- */
- GLuint srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
-
- GLuint destRowStride = _mesa_format_row_stride(texImage->TexFormat,
- mml->width);
-
- _mesa_upscale_teximage2d(srcRowStride, (height+3) / 4,
- destRowStride, (mml->height+3) / 4,
- 1, data, srcRowStride,
- texImage->Data);
- ti->padded = GL_TRUE;
- } else {
- MEMCPY(texImage->Data, data, texImage->CompressedSize);
- }
-
- ti->info.format = mml->glideFormat;
- texImage->FetchTexelc = fxFetchFunction(texImage->TexFormat->MesaFormat);
-
- /* GL_SGIS_generate_mipmap */
- if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- assert(!_mesa_is_format_compressed(texImage->TexFormat));
- }
-
- fxTexInvalidate(ctx, texObj);
-}
-
-
-void
-fxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target,
- GLint level, GLint xoffset,
- GLint yoffset, GLsizei width,
- GLint height, GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxTexInfo *ti;
- tfxMipMapLevel *mml;
- GLint destRowStride, srcRowStride;
- GLint i, rows;
- GLubyte *dest;
-
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxDDCompressedTexSubImage2D: id=%d\n", texObj->Name);
- }
-
- ti = fxTMGetTexInfo(texObj);
- assert(ti);
- mml = FX_MIPMAP_DATA(texImage);
- assert(mml);
-
- srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
-
- destRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width);
- dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
- texImage->InternalFormat,
- mml->width,
- (GLubyte*) texImage->Data);
-
- rows = height / 4; /* hardcoded 4, but works for FXT1/DXTC */
-
- for (i = 0; i < rows; i++) {
- MEMCPY(dest, data, srcRowStride);
- dest += destRowStride;
- data = (GLvoid *)((GLuint)data + (GLuint)srcRowStride);
- }
-
- /* [dBorca] Hack alert:
- * see fxDDCompressedTexImage2D for caveats
- */
- if (mml->wScale != 1 || mml->hScale != 1) {
- srcRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
-
- destRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width);
- _mesa_upscale_teximage2d(srcRowStride, texImage->Height / 4,
- destRowStride, mml->height / 4,
- 1, texImage->Data, destRowStride,
- texImage->Data);
- }
-
- /* GL_SGIS_generate_mipmap */
- if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- assert(!_mesa_is_format_compressed(texImage->TexFormat));
- }
-
- if (ti->validated && ti->isInTM)
- fxTMReloadMipMapLevel(fxMesa, texObj, level);
- else
- fxTexInvalidate(ctx, texObj);
-}
-
-
-void
-fxDDTexImage1D (GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat, GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- fxDDTexImage2D(ctx, target, level,
- internalFormat, width, 1, border,
- format, type, pixels,
- packing,
- texObj,
- texImage);
-}
-
-
-void
-fxDDTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- fxDDTexSubImage2D(ctx, target, level,
- xoffset, 0, width, 1,
- format, type, pixels,
- packing,
- texObj,
- texImage);
-}
-
-
-GLboolean
-fxDDTestProxyTexImage (GLcontext *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLenum format, GLenum type,
- GLint width, GLint height,
- GLint depth, GLint border)
-{
- /* XXX todo - maybe through fxTexValidate() */
- return _mesa_test_proxy_teximage(ctx, target,
- level, internalFormat,
- format, type,
- width, height,
- depth, border);
-}
-
-
-#else /* FX */
-
-/*
- * Need this to provide at least one external definition.
- */
-
-extern int gl_fx_dummy_function_ddtex(void);
-int
-gl_fx_dummy_function_ddtex(void)
-{
- return 0;
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
deleted file mode 100644
index bee10de2f49..00000000000
--- a/src/mesa/drivers/glide/fxdrv.h
+++ /dev/null
@@ -1,773 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
-
-
-#ifndef FXDRV_H
-#define FXDRV_H
-
-/* If you comment out this define, a variable takes its place, letting
- * you turn debugging on/off from the debugger.
- */
-
-#include "glheader.h"
-
-
-#if defined(__linux__)
-#include <signal.h>
-#endif
-
-#include "main/context.h"
-#include "main/imports.h"
-#include "main/macros.h"
-#include "main/matrix.h"
-#include "main/mtypes.h"
-
-#include "GL/fxmesa.h"
-#include "fxglidew.h"
-
-#include "math/m_vector.h"
-
-
-#define COPY_FLOAT(dst, src) (dst) = (src)
-
-/* Define some shorter names for these things.
- */
-#define XCOORD GR_VERTEX_X_OFFSET
-#define YCOORD GR_VERTEX_Y_OFFSET
-#define ZCOORD GR_VERTEX_OOZ_OFFSET
-#define OOWCOORD GR_VERTEX_OOW_OFFSET
-
-#define S0COORD GR_VERTEX_SOW_TMU0_OFFSET
-#define T0COORD GR_VERTEX_TOW_TMU0_OFFSET
-#define S1COORD GR_VERTEX_SOW_TMU1_OFFSET
-#define T1COORD GR_VERTEX_TOW_TMU1_OFFSET
-
-
-
-#ifdef __i386__
-#define FXCOLOR4( c ) (* (int *)c)
-#else
-#define FXCOLOR4( c ) ( \
- ( ((unsigned int)(c[3]))<<24 ) | \
- ( ((unsigned int)(c[2]))<<16 ) | \
- ( ((unsigned int)(c[1]))<<8 ) | \
- ( (unsigned int)(c[0])) )
-#endif
-
-#define TDFXPACKCOLOR1555( r, g, b, a ) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-#define TDFXPACKCOLOR565( r, g, b ) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-#define TDFXPACKCOLOR8888( r, g, b, a ) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-
-
-/* fastpath flags first
- */
-#define SETUP_TMU0 0x1
-#define SETUP_TMU1 0x2
-#define SETUP_RGBA 0x4
-#define SETUP_SNAP 0x8
-#define SETUP_XYZW 0x10
-#define SETUP_PTEX 0x20
-#define SETUP_PSIZ 0x40
-#define SETUP_SPEC 0x80
-#define SETUP_FOGC 0x100
-#define MAX_SETUP 0x200
-
-
-#define FX_NUM_TMU 2
-
-#define FX_TMU0 GR_TMU0
-#define FX_TMU1 GR_TMU1
-#define FX_TMU_SPLIT 98
-#define FX_TMU_BOTH 99
-#define FX_TMU_NONE 100
-
-/* Used for fxMesa->lastUnitsMode */
-
-#define FX_UM_NONE 0x00000000
-
-#define FX_UM_E0_REPLACE 0x00000001
-#define FX_UM_E0_MODULATE 0x00000002
-#define FX_UM_E0_DECAL 0x00000004
-#define FX_UM_E0_BLEND 0x00000008
-#define FX_UM_E0_ADD 0x00000010
-
-#define FX_UM_E1_REPLACE 0x00000020
-#define FX_UM_E1_MODULATE 0x00000040
-#define FX_UM_E1_DECAL 0x00000080
-#define FX_UM_E1_BLEND 0x00000100
-#define FX_UM_E1_ADD 0x00000200
-
-#define FX_UM_E_ENVMODE 0x000003ff
-
-#define FX_UM_E0_ALPHA 0x00001000
-#define FX_UM_E0_LUMINANCE 0x00002000
-#define FX_UM_E0_LUMINANCE_ALPHA 0x00004000
-#define FX_UM_E0_INTENSITY 0x00008000
-#define FX_UM_E0_RGB 0x00010000
-#define FX_UM_E0_RGBA 0x00020000
-
-#define FX_UM_E1_ALPHA 0x00040000
-#define FX_UM_E1_LUMINANCE 0x00080000
-#define FX_UM_E1_LUMINANCE_ALPHA 0x00100000
-#define FX_UM_E1_INTENSITY 0x00200000
-#define FX_UM_E1_RGB 0x00400000
-#define FX_UM_E1_RGBA 0x00800000
-
-#define FX_UM_E_IFMT 0x00fff000
-
-#define FX_UM_COLOR_ITERATED 0x01000000
-#define FX_UM_COLOR_CONSTANT 0x02000000
-#define FX_UM_ALPHA_ITERATED 0x04000000
-#define FX_UM_ALPHA_CONSTANT 0x08000000
-
-
-/* for Voodoo3/Banshee's grColorCombine() and grAlphaCombine() */
-struct tdfx_combine {
- GrCombineFunction_t Function; /* Combine function */
- GrCombineFactor_t Factor; /* Combine scale factor */
- GrCombineLocal_t Local; /* Local combine source */
- GrCombineOther_t Other; /* Other combine source */
- FxBool Invert; /* Combine result inversion flag */
-};
-
-/* for Voodoo3's grTexCombine() */
-struct tdfx_texcombine {
- GrCombineFunction_t FunctionRGB;
- GrCombineFactor_t FactorRGB;
- GrCombineFunction_t FunctionAlpha;
- GrCombineFactor_t FactorAlpha;
- FxBool InvertRGB;
- FxBool InvertAlpha;
-};
-
-
-/* for Voodoo5's grColorCombineExt() */
-struct tdfx_combine_color_ext {
- GrCCUColor_t SourceA;
- GrCombineMode_t ModeA;
- GrCCUColor_t SourceB;
- GrCombineMode_t ModeB;
- GrCCUColor_t SourceC;
- FxBool InvertC;
- GrCCUColor_t SourceD;
- FxBool InvertD;
- FxU32 Shift;
- FxBool Invert;
-};
-
-/* for Voodoo5's grAlphaCombineExt() */
-struct tdfx_combine_alpha_ext {
- GrACUColor_t SourceA;
- GrCombineMode_t ModeA;
- GrACUColor_t SourceB;
- GrCombineMode_t ModeB;
- GrACUColor_t SourceC;
- FxBool InvertC;
- GrACUColor_t SourceD;
- FxBool InvertD;
- FxU32 Shift;
- FxBool Invert;
-};
-
-/* for Voodoo5's grTexColorCombineExt() */
-struct tdfx_color_texenv {
- GrTCCUColor_t SourceA;
- GrCombineMode_t ModeA;
- GrTCCUColor_t SourceB;
- GrCombineMode_t ModeB;
- GrTCCUColor_t SourceC;
- FxBool InvertC;
- GrTCCUColor_t SourceD;
- FxBool InvertD;
- FxU32 Shift;
- FxBool Invert;
-};
-
-/* for Voodoo5's grTexAlphaCombineExt() */
-struct tdfx_alpha_texenv {
- GrTACUColor_t SourceA;
- GrCombineMode_t ModeA;
- GrTACUColor_t SourceB;
- GrCombineMode_t ModeB;
- GrTACUColor_t SourceC;
- FxBool InvertC;
- GrTCCUColor_t SourceD;
- FxBool InvertD;
- FxU32 Shift;
- FxBool Invert;
-};
-
-/* Voodoo5's texture combine environment */
-struct tdfx_texcombine_ext {
- struct tdfx_alpha_texenv Alpha;
- struct tdfx_color_texenv Color;
- GrColor_t EnvColor;
-};
-
-
-/*
- Memory range from startAddr to endAddr-1
-*/
-typedef struct MemRange_t
-{
- struct MemRange_t *next;
- FxU32 startAddr, endAddr;
-}
-MemRange;
-
-typedef struct
-{
- GLsizei width, height; /* image size */
- GLint wScale, hScale; /* image scale factor */
- GrTextureFormat_t glideFormat; /* Glide image format */
-}
-tfxMipMapLevel;
-
-/*
- * TDFX-specific texture object data. This hangs off of the
- * struct gl_texture_object DriverData pointer.
- */
-typedef struct tfxTexInfo_t
-{
- struct tfxTexInfo_t *next;
- struct gl_texture_object *tObj;
-
- GLuint lastTimeUsed;
- FxU32 whichTMU;
- GLboolean isInTM;
-
- MemRange *tm[FX_NUM_TMU];
-
- GLint minLevel, maxLevel;
- GLint baseLevelInternalFormat;
-
- GrTexInfo info;
-
- GrTextureFilterMode_t minFilt;
- GrTextureFilterMode_t maxFilt;
- FxBool LODblend;
-
- GrTextureClampMode_t sClamp;
- GrTextureClampMode_t tClamp;
-
- GrMipMapMode_t mmMode;
-
- GLfloat sScale, tScale;
-
- GrTexTable_t paltype;
- GuTexPalette palette;
-
- GLboolean fixedPalette;
- GLboolean validated;
-
- GLboolean padded;
-}
-tfxTexInfo;
-
-typedef struct
-{
- GLuint swapBuffer;
- GLuint reqTexUpload;
- GLuint texUpload;
- GLuint memTexUpload;
-}
-tfxStats;
-
-
-
-typedef struct
-{
- /* Alpha test */
-
- GLboolean alphaTestEnabled;
- GrCmpFnc_t alphaTestFunc;
- GLfloat alphaTestRefValue;
-
- /* Blend function */
-
- GLboolean blendEnabled;
- GrAlphaBlendFnc_t blendSrcFuncRGB;
- GrAlphaBlendFnc_t blendDstFuncRGB;
- GrAlphaBlendFnc_t blendSrcFuncAlpha;
- GrAlphaBlendFnc_t blendDstFuncAlpha;
- GrAlphaBlendOp_t blendEqRGB;
- GrAlphaBlendOp_t blendEqAlpha;
-
- /* Depth test */
-
- GLboolean depthTestEnabled;
- GLboolean depthMask;
- GrCmpFnc_t depthTestFunc;
- FxI32 depthBias;
-
- /* Stencil */
-
- GLboolean stencilEnabled;
- GrCmpFnc_t stencilFunction; /* Stencil function */
- GrStencil_t stencilRefValue; /* Stencil reference value */
- GrStencil_t stencilValueMask; /* Value mask */
- GrStencil_t stencilWriteMask; /* Write mask */
- GrCmpFnc_t stencilFailFunc; /* Stencil fail function */
- GrCmpFnc_t stencilZFailFunc; /* Stencil pass, depth fail function */
- GrCmpFnc_t stencilZPassFunc; /* Stencil pass, depth pass function */
- GrStencil_t stencilClear; /* Buffer clear value */
-}
-tfxUnitsState;
-
-
-
-
-/* Flags for fxMesa->new_state
- */
-#define FX_NEW_TEXTURING 0x1
-#define FX_NEW_BLEND 0x2
-#define FX_NEW_ALPHA 0x4
-#define FX_NEW_DEPTH 0x8
-#define FX_NEW_FOG 0x10
-#define FX_NEW_SCISSOR 0x20
-#define FX_NEW_COLOR_MASK 0x40
-#define FX_NEW_CULL 0x80
-#define FX_NEW_STENCIL 0x100
-
-
-#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
-
-#define FX_TEXTURE_DATA(texUnit) fxTMGetTexInfo((texUnit)->_Current)
-
-#define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
-
-#define FX_MIPMAP_DATA(img) ((tfxMipMapLevel *) (img)->DriverData)
-
-#define BEGIN_BOARD_LOCK()
-#define END_BOARD_LOCK()
-#define BEGIN_CLIP_LOOP()
-#define END_CLIP_LOOP()
-
-
-
-
-/* Covers the state referenced by IsInHardware:
- */
-#define _FX_NEW_IS_IN_HARDWARE (_NEW_TEXTURE| \
- _NEW_HINT| \
- _NEW_STENCIL| \
- _NEW_BUFFERS| \
- _NEW_COLOR| \
- _NEW_LIGHT)
-
-/* Covers the state referenced by fxDDChooseRenderState
- */
-#define _FX_NEW_RENDERSTATE (_FX_NEW_IS_IN_HARDWARE | \
- _DD_NEW_FLATSHADE | \
- _DD_NEW_TRI_LIGHT_TWOSIDE| \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_TRI_STIPPLE | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_LINE_STIPPLE | \
- _DD_NEW_LINE_WIDTH | \
- _DD_NEW_POINT_SMOOTH | \
- _DD_NEW_POINT_SIZE | \
- _NEW_LINE)
-
-
-/* Covers the state referenced by fxDDChooseSetupFunction.
- */
-#define _FX_NEW_SETUP_FUNCTION (_NEW_LIGHT| \
- _NEW_FOG| \
- _NEW_TEXTURE| \
- _NEW_COLOR) \
-
-
-/* lookup table for scaling y bit colors up to 8 bits */
-extern GLuint FX_rgb_scale_4[16];
-extern GLuint FX_rgb_scale_5[32];
-extern GLuint FX_rgb_scale_6[64];
-
-typedef void (*fx_tri_func) (fxMesaContext, GrVertex *, GrVertex *, GrVertex *);
-typedef void (*fx_line_func) (fxMesaContext, GrVertex *, GrVertex *);
-typedef void (*fx_point_func) (fxMesaContext, GrVertex *);
-
-struct tfxMesaContext
-{
- GrTexTable_t glbPalType;
- GuTexPalette glbPalette;
-
- GLcontext *glCtx; /* the core Mesa context */
- GLvisual *glVis; /* describes the color buffer */
- GLframebuffer *glBuffer; /* the ancillary buffers */
-
- GLint board; /* the board used for this context */
- GLint width, height; /* size of color buffer */
-
- GrBuffer_t currentFB;
-
- GLboolean bgrOrder;
- GrColor_t color;
- GrColor_t clearC;
- GrAlpha_t clearA;
- GLuint constColor;
- GrCullMode_t cullMode;
-
- tfxUnitsState unitsState;
- tfxUnitsState restoreUnitsState; /* saved during multipass */
- GLboolean multipass; /* true when drawing intermediate pass */
-
- GLuint new_state;
- GLuint new_gl_state;
-
- /* Texture Memory Manager Data
- */
- GLuint texBindNumber;
- GLint tmuSrc;
- GLuint lastUnitsMode;
- GLuint freeTexMem[FX_NUM_TMU];
- MemRange *tmPool;
- MemRange *tmFree[FX_NUM_TMU];
-
- GLenum fogTableMode;
- GLfloat fogDensity;
- GLfloat fogStart, fogEnd;
- GrFog_t *fogTable;
- GLint textureAlign;
- GLint textureMaxLod;
-
- /* Vertex building and storage:
- */
- GLuint tmu_source[FX_NUM_TMU];
- GLuint SetupIndex;
- GLuint stw_hint_state; /* for grHints */
- GrVertex *verts;
- GLboolean snapVertices; /* needed for older Voodoo hardware */
-
- /* Rasterization:
- */
- GLuint render_index;
- GLuint fallback;
- GLenum render_primitive;
- GLenum raster_primitive;
-
- /* Current rasterization functions
- */
- fx_point_func draw_point;
- fx_line_func draw_line;
- fx_tri_func draw_tri;
-
-
- /* Keep texture scales somewhere handy:
- */
- GLfloat s0scale;
- GLfloat s1scale;
- GLfloat t0scale;
- GLfloat t1scale;
-
- GLfloat inv_s0scale;
- GLfloat inv_s1scale;
- GLfloat inv_t0scale;
- GLfloat inv_t1scale;
-
- /* Glide stuff
- */
- tfxStats stats;
- void *state;
-
- /* Options */
-
- GLboolean verbose;
- GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
- GLboolean haveHwAlpha;
- GLboolean haveHwStencil;
- GLboolean haveZBuffer;
- GLboolean haveDoubleBuffer;
- GLboolean haveGlobalPaletteTexture;
- GLint swapInterval;
- GLint maxPendingSwapBuffers;
-
- GrContext_t glideContext;
-
- int screen_width;
- int screen_height;
- int clipMinX;
- int clipMaxX;
- int clipMinY;
- int clipMaxY;
-
- int colDepth;
- GLboolean fsaa;
-
- /* Glide (per card) capabilities. These get mirrored
- * from `glbHWConfig' when creating a new context...
- */
- GrSstType type;
- FxBool HavePalExt; /* PALETTE6666 */
- FxBool HavePixExt; /* PIXEXT */
- FxBool HaveTexFmt; /* TEXFMT */
- FxBool HaveCmbExt; /* COMBINE */
- FxBool HaveMirExt; /* TEXMIRROR */
- FxBool HaveTexUma; /* TEXUMA */
- FxBool HaveTexus2; /* Texus 2 - FXT1 */
- struct tdfx_glide Glide;
- char rendererString[64];
-};
-
-
-extern void fxSetupFXUnits(GLcontext *);
-extern void fxSetupDDPointers(GLcontext *);
-
-/* fxvb.c:
- */
-extern void fxAllocVB(GLcontext * ctx);
-extern void fxFreeVB(GLcontext * ctx);
-extern void fxPrintSetupFlags(char *msg, GLuint flags );
-extern void fxCheckTexSizes( GLcontext *ctx );
-extern void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint end,
- GLuint newinputs );
-extern void fxChooseVertexState( GLcontext *ctx );
-
-
-
-
-
-
-/* fxtrifuncs:
- */
-extern void fxDDInitTriFuncs(GLcontext *);
-extern void fxDDChooseRenderState(GLcontext * ctx);
-
-
-extern void fxUpdateDDSpanPointers(GLcontext *);
-extern void fxSetupDDSpanPointers(GLcontext *);
-
-extern void fxPrintTextureData(tfxTexInfo * ti);
-
-extern const struct gl_texture_format *
-fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum srcFormat, GLenum srcType );
-extern void fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
- GLint internalFormat, GLint width, GLint height,
- GLint border, GLenum format, GLenum type,
- const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-extern void fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-extern void fxDDCompressedTexImage2D(GLcontext *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLsizei width, GLsizei height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-extern void fxDDCompressedTexSubImage2D(GLcontext *ctx, GLenum target,
- GLint level, GLint xoffset,
- GLint yoffset, GLsizei width,
- GLint height, GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-extern void fxDDTexImage1D(GLcontext * ctx, GLenum target, GLint level,
- GLint internalFormat, GLint width,
- GLint border, GLenum format, GLenum type,
- const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-extern void fxDDTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
- GLint xoffset, GLint width,
- GLenum format, GLenum type,
- const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-extern GLboolean fxDDTestProxyTexImage (GLcontext *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLenum format, GLenum type,
- GLint width, GLint height,
- GLint depth, GLint border);
-extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *);
-extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *,
- GLenum, const GLfloat *);
-extern void fxDDTexBind(GLcontext *, GLenum, struct gl_texture_object *);
-extern struct gl_texture_object *fxDDNewTextureObject( GLcontext *ctx, GLuint name, GLenum target );
-extern void fxDDTexDel(GLcontext *, struct gl_texture_object *);
-extern GLboolean fxDDIsTextureResident(GLcontext *, struct gl_texture_object *);
-extern void fxDDTexPalette(GLcontext *, struct gl_texture_object *);
-extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean);
-
-extern void fxDDEnable(GLcontext *, GLenum, GLboolean);
-extern void fxDDAlphaFunc(GLcontext *, GLenum, GLfloat);
-extern void fxDDBlendFuncSeparate(GLcontext *, GLenum, GLenum, GLenum, GLenum);
-extern void fxDDBlendEquationSeparate(GLcontext *, GLenum, GLenum);
-extern void fxDDDepthMask(GLcontext *, GLboolean);
-extern void fxDDDepthFunc(GLcontext *, GLenum);
-extern void fxDDStencilFuncSeparate (GLcontext *ctx, GLenum face, GLenum func, GLint ref, GLuint mask);
-extern void fxDDStencilMaskSeparate (GLcontext *ctx, GLenum face, GLuint mask);
-extern void fxDDStencilOpSeparate (GLcontext *ctx, GLenum face, GLenum sfail, GLenum zfail, GLenum zpass);
-
-extern void fxDDInitExtensions(GLcontext * ctx);
-
-extern void fxTMInit(fxMesaContext ctx);
-extern void fxTMClose(fxMesaContext ctx);
-extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx);
-extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
-extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *);
-#define fxTMMoveOutTM_NoLock fxTMMoveOutTM
-extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *);
-extern void fxTMReloadMipMapLevel(fxMesaContext, struct gl_texture_object *,
- GLint);
-extern void fxTMReloadSubMipMapLevel(fxMesaContext,
- struct gl_texture_object *, GLint, GLint,
- GLint);
-extern int fxTMCheckStartAddr (fxMesaContext fxMesa, GLint tmu, tfxTexInfo *ti);
-
-extern void fxTexGetFormat(GLcontext *, GLenum, GrTextureFormat_t *, GLint *); /* [koolsmoky] */
-
-extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *,
- float *, float *, int *, int *);
-
-extern void fxDDScissor(GLcontext * ctx,
- GLint x, GLint y, GLsizei w, GLsizei h);
-extern void fxDDFogfv(GLcontext * ctx, GLenum pname, const GLfloat * params);
-extern void fxDDColorMask(GLcontext * ctx,
- GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-
-extern void fxDDWriteDepthSpan(GLcontext * ctx, GLuint n, GLint x, GLint y,
- const GLuint depth[], const GLubyte mask[]);
-
-extern void fxDDReadDepthSpan(GLcontext * ctx, GLuint n, GLint x, GLint y,
- GLuint depth[]);
-
-extern void fxDDWriteDepthPixels(GLcontext * ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLuint depth[], const GLubyte mask[]);
-
-extern void fxDDReadDepthPixels(GLcontext * ctx, GLuint n,
- const GLint x[], const GLint y[],
- GLuint depth[]);
-
-extern void fxDDShadeModel(GLcontext * ctx, GLenum mode);
-
-extern void fxDDCullFace(GLcontext * ctx, GLenum mode);
-extern void fxDDFrontFace(GLcontext * ctx, GLenum mode);
-
-extern void fxPrintRenderState(const char *msg, GLuint state);
-extern void fxPrintHintState(const char *msg, GLuint state);
-
-extern int fxDDInitFxMesaContext(fxMesaContext fxMesa);
-extern void fxDDDestroyFxMesaContext(fxMesaContext fxMesa);
-
-
-extern void fxSetScissorValues(GLcontext * ctx);
-extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
- struct gl_texture_object *tObj, GLint where);
-
-extern void fxCheckIsInHardware(GLcontext *ctx);
-
-/* fxsetup:
- * semi-private functions
- */
-void fxSetupCull (GLcontext * ctx);
-void fxSetupScissor (GLcontext * ctx);
-void fxSetupColorMask (GLcontext * ctx);
-void fxSetupBlend (GLcontext *ctx);
-void fxSetupDepthTest (GLcontext *ctx);
-void fxSetupTexture (GLcontext *ctx);
-void fxSetupStencil (GLcontext *ctx);
-void fxSetupStencilFace (GLcontext *ctx, GLint face);
-
-/* Flags for software fallback cases */
-#define FX_FALLBACK_TEXTURE_MAP 0x0001
-#define FX_FALLBACK_DRAW_BUFFER 0x0002
-#define FX_FALLBACK_SPECULAR 0x0004
-#define FX_FALLBACK_STENCIL 0x0008
-#define FX_FALLBACK_RENDER_MODE 0x0010
-#define FX_FALLBACK_LOGICOP 0x0020
-#define FX_FALLBACK_TEXTURE_ENV 0x0040
-#define FX_FALLBACK_TEXTURE_BORDER 0x0080
-#define FX_FALLBACK_COLORMASK 0x0100
-#define FX_FALLBACK_BLEND 0x0200
-#define FX_FALLBACK_TEXTURE_MULTI 0x0400
-
-extern GLuint fx_check_IsInHardware(GLcontext *ctx);
-
-/***
- *** CNORM: clamp float to [0,1] and map to float in [0,255]
- ***/
-#if defined(USE_IEEE) && !defined(DEBUG)
-#define IEEE_0996 0x3f7f0000 /* 0.996 or so */
-#define CNORM(N, F) \
- do { \
- fi_type __tmp; \
- __tmp.f = (F); \
- if (__tmp.i < 0) \
- N = 0; \
- else if (__tmp.i >= IEEE_0996) \
- N = 255.0f; \
- else { \
- N = (F) * 255.0f; \
- } \
- } while (0)
-#else
-#define CNORM(n, f) \
- n = (CLAMP((f), 0.0F, 1.0F) * 255.0F)
-#endif
-
-/* run-time debugging */
-#ifndef FX_DEBUG
-#define FX_DEBUG 0
-#endif
-#if FX_DEBUG
-extern int TDFX_DEBUG;
-#else
-#define TDFX_DEBUG 0
-#endif
-
-/* dirty hacks */
-#define FX_RESCALE_BIG_TEXURES_HACK 1
-#define FX_COMPRESS_S3TC_AS_FXT1_HACK 1
-
-#endif
diff --git a/src/mesa/drivers/glide/fxg.c b/src/mesa/drivers/glide/fxg.c
deleted file mode 100644
index afb9441aded..00000000000
--- a/src/mesa/drivers/glide/fxg.c
+++ /dev/null
@@ -1,2309 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.0.1
- *
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Mesa/FX device driver. Interface to Glide3.
- *
- * Copyright (c) 2003 - Daniel Borca
- * Email : dborca@users.sourceforge.net
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifdef FX
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <assert.h>
-
-#define FX_TRAP_GLIDE_internal
-#include "fxg.h"
-
-
-
-/****************************************************************************\
-* logging *
-\****************************************************************************/
-#if FX_TRAP_GLIDE
-#define TRAP_LOG trp_printf
-#ifdef __GNUC__
-__attribute__ ((format(printf, 1, 2)))
-#endif /* __GNUC__ */
-int trp_printf (const char *format, ...)
-{
- va_list arg;
- int n;
- FILE *trap_file;
- va_start(arg, format);
- trap_file = fopen("trap.log", "a");
- if (trap_file == NULL) {
- trap_file = stderr;
- }
- n = vfprintf(trap_file, format, arg);
- fclose(trap_file);
- va_end(arg);
- return n;
-}
-#else /* FX_TRAP_GLIDE */
-#ifdef __GNUC__
-#define TRAP_LOG(format, ...) do {} while (0)
-#else /* __GNUC__ */
-#define TRAP_LOG 0 && (unsigned long)
-#endif /* __GNUC__ */
-#endif /* FX_TRAP_GLIDE */
-
-
-
-#if FX_TRAP_GLIDE
-/****************************************************************************\
-* helpers *
-\****************************************************************************/
-
-#define GOT "\t"
-
-const char *TRP_BOOL (FxBool b)
-{
- return b ? "FXTRUE" : "FXFALSE";
-}
-
-#define TRAP_CASE_STRING(name) case name: return #name
-#define TRAP_NODEFAULT default: assert(0)
-
-const char *TRP_PARAM (FxU32 mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_PARAM_DISABLE);
- TRAP_CASE_STRING(GR_PARAM_ENABLE);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_VTX (FxU32 param)
-{
- switch (param) {
- TRAP_CASE_STRING(GR_PARAM_XY);
- TRAP_CASE_STRING(GR_PARAM_Z);
- TRAP_CASE_STRING(GR_PARAM_W);
- TRAP_CASE_STRING(GR_PARAM_Q);
- TRAP_CASE_STRING(GR_PARAM_FOG_EXT);
- TRAP_CASE_STRING(GR_PARAM_A);
- TRAP_CASE_STRING(GR_PARAM_RGB);
- TRAP_CASE_STRING(GR_PARAM_PARGB);
- TRAP_CASE_STRING(GR_PARAM_ST0);
- TRAP_CASE_STRING(GR_PARAM_ST1);
- TRAP_CASE_STRING(GR_PARAM_ST2);
- TRAP_CASE_STRING(GR_PARAM_Q0);
- TRAP_CASE_STRING(GR_PARAM_Q1);
- TRAP_CASE_STRING(GR_PARAM_Q2);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_ARRAY (FxU32 mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_POINTS);
- TRAP_CASE_STRING(GR_LINE_STRIP);
- TRAP_CASE_STRING(GR_LINES);
- TRAP_CASE_STRING(GR_POLYGON);
- TRAP_CASE_STRING(GR_TRIANGLE_STRIP);
- TRAP_CASE_STRING(GR_TRIANGLE_FAN);
- TRAP_CASE_STRING(GR_TRIANGLES);
- TRAP_CASE_STRING(GR_TRIANGLE_STRIP_CONTINUE);
- TRAP_CASE_STRING(GR_TRIANGLE_FAN_CONTINUE);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_BUFFER (GrBuffer_t buffer)
-{
- switch (buffer) {
- TRAP_CASE_STRING(GR_BUFFER_FRONTBUFFER);
- TRAP_CASE_STRING(GR_BUFFER_BACKBUFFER);
- TRAP_CASE_STRING(GR_BUFFER_AUXBUFFER);
- TRAP_CASE_STRING(GR_BUFFER_DEPTHBUFFER);
- TRAP_CASE_STRING(GR_BUFFER_ALPHABUFFER);
- TRAP_CASE_STRING(GR_BUFFER_TRIPLEBUFFER);
- TRAP_CASE_STRING(GR_BUFFER_TEXTUREBUFFER_EXT);
- TRAP_CASE_STRING(GR_BUFFER_TEXTUREAUXBUFFER_EXT);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_ORIGIN (GrOriginLocation_t origin_location)
-{
- switch (origin_location) {
- TRAP_CASE_STRING(GR_ORIGIN_UPPER_LEFT);
- TRAP_CASE_STRING(GR_ORIGIN_LOWER_LEFT);
- TRAP_CASE_STRING(GR_ORIGIN_ANY);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_REFRESH (GrScreenRefresh_t refresh_rate)
-{
- switch (refresh_rate) {
- TRAP_CASE_STRING(GR_REFRESH_60Hz);
- TRAP_CASE_STRING(GR_REFRESH_70Hz);
- TRAP_CASE_STRING(GR_REFRESH_72Hz);
- TRAP_CASE_STRING(GR_REFRESH_75Hz);
- TRAP_CASE_STRING(GR_REFRESH_80Hz);
- TRAP_CASE_STRING(GR_REFRESH_90Hz);
- TRAP_CASE_STRING(GR_REFRESH_100Hz);
- TRAP_CASE_STRING(GR_REFRESH_85Hz);
- TRAP_CASE_STRING(GR_REFRESH_120Hz);
- TRAP_CASE_STRING(GR_REFRESH_NONE);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_COLFMT (GrColorFormat_t color_format)
-{
- switch (color_format) {
- TRAP_CASE_STRING(GR_COLORFORMAT_ARGB);
- TRAP_CASE_STRING(GR_COLORFORMAT_ABGR);
- TRAP_CASE_STRING(GR_COLORFORMAT_RGBA);
- TRAP_CASE_STRING(GR_COLORFORMAT_BGRA);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_RESOLUTION (GrScreenResolution_t screen_resolution)
-{
- switch (screen_resolution) {
- TRAP_CASE_STRING(GR_RESOLUTION_320x200);
- TRAP_CASE_STRING(GR_RESOLUTION_320x240);
- TRAP_CASE_STRING(GR_RESOLUTION_400x256);
- TRAP_CASE_STRING(GR_RESOLUTION_512x384);
- TRAP_CASE_STRING(GR_RESOLUTION_640x200);
- TRAP_CASE_STRING(GR_RESOLUTION_640x350);
- TRAP_CASE_STRING(GR_RESOLUTION_640x400);
- TRAP_CASE_STRING(GR_RESOLUTION_640x480);
- TRAP_CASE_STRING(GR_RESOLUTION_800x600);
- TRAP_CASE_STRING(GR_RESOLUTION_960x720);
- TRAP_CASE_STRING(GR_RESOLUTION_856x480);
- TRAP_CASE_STRING(GR_RESOLUTION_512x256);
- TRAP_CASE_STRING(GR_RESOLUTION_1024x768);
- TRAP_CASE_STRING(GR_RESOLUTION_1280x1024);
- TRAP_CASE_STRING(GR_RESOLUTION_1600x1200);
- TRAP_CASE_STRING(GR_RESOLUTION_400x300);
- TRAP_CASE_STRING(GR_RESOLUTION_1152x864);
- TRAP_CASE_STRING(GR_RESOLUTION_1280x960);
- TRAP_CASE_STRING(GR_RESOLUTION_1600x1024);
- TRAP_CASE_STRING(GR_RESOLUTION_1792x1344);
- TRAP_CASE_STRING(GR_RESOLUTION_1856x1392);
- TRAP_CASE_STRING(GR_RESOLUTION_1920x1440);
- TRAP_CASE_STRING(GR_RESOLUTION_2048x1536);
- TRAP_CASE_STRING(GR_RESOLUTION_2048x2048);
- TRAP_CASE_STRING(GR_RESOLUTION_NONE);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_BLEND (GrAlphaBlendFnc_t func)
-{
- switch (func) {
- TRAP_CASE_STRING(GR_BLEND_ZERO);
- TRAP_CASE_STRING(GR_BLEND_SRC_ALPHA);
- TRAP_CASE_STRING(GR_BLEND_SRC_COLOR);
- /*TRAP_CASE_STRING(GR_BLEND_DST_COLOR); ==GR_BLEND_SRC_COLOR*/
- TRAP_CASE_STRING(GR_BLEND_DST_ALPHA);
- TRAP_CASE_STRING(GR_BLEND_ONE);
- TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_SRC_ALPHA);
- TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_SRC_COLOR);
- /*TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_DST_COLOR); ==GR_BLEND_ONE_MINUS_SRC_COLOR*/
- TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_DST_ALPHA);
- TRAP_CASE_STRING(GR_BLEND_SAME_COLOR_EXT);
- /*TRAP_CASE_STRING(GR_BLEND_RESERVED_8); ==GR_BLEND_SAME_COLOR_EXT*/
- TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_SAME_COLOR_EXT);
- /*TRAP_CASE_STRING(GR_BLEND_RESERVED_9); ==GR_BLEND_ONE_MINUS_SAME_COLOR_EXT*/
- TRAP_CASE_STRING(GR_BLEND_RESERVED_A);
- TRAP_CASE_STRING(GR_BLEND_RESERVED_B);
- TRAP_CASE_STRING(GR_BLEND_RESERVED_C);
- TRAP_CASE_STRING(GR_BLEND_RESERVED_D);
- TRAP_CASE_STRING(GR_BLEND_RESERVED_E);
- TRAP_CASE_STRING(GR_BLEND_ALPHA_SATURATE);
- /*TRAP_CASE_STRING(GR_BLEND_PREFOG_COLOR); ==GR_BLEND_ALPHA_SATURATE*/
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CMBFUNC (GrCombineFunction_t cfunc)
-{
- switch (cfunc) {
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_ZERO);
- /*TRAP_CASE_STRING(GR_COMBINE_FUNCTION_NONE); ==GR_COMBINE_FUNCTION_ZERO*/
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_LOCAL);
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_LOCAL_ALPHA);
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER);
- /*TRAP_CASE_STRING(GR_COMBINE_FUNCTION_BLEND_OTHER); ==GR_COMBINE_FUNCTION_SCALE_OTHER*/
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL);
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA);
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL);
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL);
- /*TRAP_CASE_STRING(GR_COMBINE_FUNCTION_BLEND); ==GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL*/
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA);
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL);
- /*TRAP_CASE_STRING(GR_COMBINE_FUNCTION_BLEND_LOCAL); ==GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL*/
- TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CMBFACT (GrCombineFactor_t cfactor)
-{
- switch (cfactor) {
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_ZERO);
- /*TRAP_CASE_STRING(GR_COMBINE_FACTOR_NONE); ==GR_COMBINE_FACTOR_ZERO*/
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_LOCAL);
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_OTHER_ALPHA);
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_LOCAL_ALPHA);
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_TEXTURE_ALPHA);
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_TEXTURE_RGB);
- /*TRAP_CASE_STRING(GR_COMBINE_FACTOR_DETAIL_FACTOR); ==GR_COMBINE_FACTOR_TEXTURE_ALPHA*/
- /*TRAP_CASE_STRING(GR_COMBINE_FACTOR_LOD_FRACTION); ==GR_COMBINE_FACTOR_TEXTURE_RGB ???*/
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE);
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_LOCAL);
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA);
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA);
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA);
- /*TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR); ==GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA*/
- TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CMBLOCAL (GrCombineLocal_t clocal)
-{
- switch (clocal) {
- TRAP_CASE_STRING(GR_COMBINE_LOCAL_ITERATED);
- TRAP_CASE_STRING(GR_COMBINE_LOCAL_CONSTANT);
- /*TRAP_CASE_STRING(GR_COMBINE_LOCAL_NONE); ==GR_COMBINE_LOCAL_CONSTANT*/
- TRAP_CASE_STRING(GR_COMBINE_LOCAL_DEPTH);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CMBOTHER (GrCombineOther_t cother)
-{
- switch (cother) {
- TRAP_CASE_STRING(GR_COMBINE_OTHER_ITERATED);
- TRAP_CASE_STRING(GR_COMBINE_OTHER_TEXTURE);
- TRAP_CASE_STRING(GR_COMBINE_OTHER_CONSTANT);
- /*TRAP_CASE_STRING(GR_COMBINE_OTHER_NONE); ==GR_COMBINE_OTHER_CONSTANT*/
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CMPFUNC (GrCmpFnc_t function)
-{
- switch (function) {
- TRAP_CASE_STRING(GR_CMP_NEVER);
- TRAP_CASE_STRING(GR_CMP_LESS);
- TRAP_CASE_STRING(GR_CMP_EQUAL);
- TRAP_CASE_STRING(GR_CMP_LEQUAL);
- TRAP_CASE_STRING(GR_CMP_GREATER);
- TRAP_CASE_STRING(GR_CMP_NOTEQUAL);
- TRAP_CASE_STRING(GR_CMP_GEQUAL);
- TRAP_CASE_STRING(GR_CMP_ALWAYS);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CKMODE (GrChromakeyMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_CHROMAKEY_DISABLE);
- TRAP_CASE_STRING(GR_CHROMAKEY_ENABLE);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CULLMODE (GrCullMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_CULL_DISABLE);
- TRAP_CASE_STRING(GR_CULL_NEGATIVE);
- TRAP_CASE_STRING(GR_CULL_POSITIVE);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_DEPTHMODE (GrDepthBufferMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_DEPTHBUFFER_DISABLE);
- TRAP_CASE_STRING(GR_DEPTHBUFFER_ZBUFFER);
- TRAP_CASE_STRING(GR_DEPTHBUFFER_WBUFFER);
- TRAP_CASE_STRING(GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS);
- TRAP_CASE_STRING(GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_DITHERMODE (GrDitherMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_DITHER_DISABLE);
- TRAP_CASE_STRING(GR_DITHER_2x2);
- TRAP_CASE_STRING(GR_DITHER_4x4);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_FOGMODE (GrFogMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_FOG_DISABLE);
- TRAP_CASE_STRING(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
- TRAP_CASE_STRING(GR_FOG_WITH_TABLE_ON_Q);
- /*TRAP_CASE_STRING(GR_FOG_WITH_TABLE_ON_W); ==GR_FOG_WITH_TABLE_ON_Q*/
- TRAP_CASE_STRING(GR_FOG_WITH_ITERATED_Z);
- TRAP_CASE_STRING(GR_FOG_WITH_ITERATED_ALPHA_EXT);
- TRAP_CASE_STRING(GR_FOG_MULT2);
- TRAP_CASE_STRING(GR_FOG_ADD2);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_GETNAME (FxU32 pname)
-{
- switch (pname) {
- TRAP_CASE_STRING(GR_BITS_DEPTH);
- TRAP_CASE_STRING(GR_BITS_RGBA);
- TRAP_CASE_STRING(GR_FIFO_FULLNESS);
- TRAP_CASE_STRING(GR_FOG_TABLE_ENTRIES);
- TRAP_CASE_STRING(GR_GAMMA_TABLE_ENTRIES);
- TRAP_CASE_STRING(GR_GLIDE_STATE_SIZE);
- TRAP_CASE_STRING(GR_GLIDE_VERTEXLAYOUT_SIZE);
- TRAP_CASE_STRING(GR_IS_BUSY);
- TRAP_CASE_STRING(GR_LFB_PIXEL_PIPE);
- TRAP_CASE_STRING(GR_MAX_TEXTURE_SIZE);
- TRAP_CASE_STRING(GR_MAX_TEXTURE_ASPECT_RATIO);
- TRAP_CASE_STRING(GR_MEMORY_FB);
- TRAP_CASE_STRING(GR_MEMORY_TMU);
- TRAP_CASE_STRING(GR_MEMORY_UMA);
- TRAP_CASE_STRING(GR_NUM_BOARDS);
- TRAP_CASE_STRING(GR_NON_POWER_OF_TWO_TEXTURES);
- TRAP_CASE_STRING(GR_NUM_FB);
- TRAP_CASE_STRING(GR_NUM_SWAP_HISTORY_BUFFER);
- TRAP_CASE_STRING(GR_NUM_TMU);
- TRAP_CASE_STRING(GR_PENDING_BUFFERSWAPS);
- TRAP_CASE_STRING(GR_REVISION_FB);
- TRAP_CASE_STRING(GR_REVISION_TMU);
- TRAP_CASE_STRING(GR_STATS_LINES);
- TRAP_CASE_STRING(GR_STATS_PIXELS_AFUNC_FAIL);
- TRAP_CASE_STRING(GR_STATS_PIXELS_CHROMA_FAIL);
- TRAP_CASE_STRING(GR_STATS_PIXELS_DEPTHFUNC_FAIL);
- TRAP_CASE_STRING(GR_STATS_PIXELS_IN);
- TRAP_CASE_STRING(GR_STATS_PIXELS_OUT);
- TRAP_CASE_STRING(GR_STATS_PIXELS);
- TRAP_CASE_STRING(GR_STATS_POINTS);
- TRAP_CASE_STRING(GR_STATS_TRIANGLES_IN);
- TRAP_CASE_STRING(GR_STATS_TRIANGLES_OUT);
- TRAP_CASE_STRING(GR_STATS_TRIANGLES);
- TRAP_CASE_STRING(GR_SWAP_HISTORY);
- TRAP_CASE_STRING(GR_SUPPORTS_PASSTHRU);
- TRAP_CASE_STRING(GR_TEXTURE_ALIGN);
- TRAP_CASE_STRING(GR_VIDEO_POSITION);
- TRAP_CASE_STRING(GR_VIEWPORT);
- TRAP_CASE_STRING(GR_WDEPTH_MIN_MAX);
- TRAP_CASE_STRING(GR_ZDEPTH_MIN_MAX);
- TRAP_CASE_STRING(GR_VERTEX_PARAMETER);
- TRAP_CASE_STRING(GR_BITS_GAMMA);
- TRAP_CASE_STRING(GR_GET_RESERVED_1);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_GETSTRING (FxU32 pname)
-{
- switch (pname) {
- TRAP_CASE_STRING(GR_EXTENSION);
- TRAP_CASE_STRING(GR_HARDWARE);
- TRAP_CASE_STRING(GR_RENDERER);
- TRAP_CASE_STRING(GR_VENDOR);
- TRAP_CASE_STRING(GR_VERSION);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_ENABLE (GrEnableMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_AA_ORDERED);
- TRAP_CASE_STRING(GR_ALLOW_MIPMAP_DITHER);
- TRAP_CASE_STRING(GR_PASSTHRU);
- TRAP_CASE_STRING(GR_SHAMELESS_PLUG);
- TRAP_CASE_STRING(GR_VIDEO_SMOOTHING);
- TRAP_CASE_STRING(GR_TEXTURE_UMA_EXT);
- TRAP_CASE_STRING(GR_STENCIL_MODE_EXT);
- TRAP_CASE_STRING(GR_OPENGL_MODE_EXT);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_COORD (GrCoordinateSpaceMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_WINDOW_COORDS);
- TRAP_CASE_STRING(GR_CLIP_COORDS);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_STIPPLEMODE (GrStippleMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_STIPPLE_DISABLE);
- TRAP_CASE_STRING(GR_STIPPLE_PATTERN);
- TRAP_CASE_STRING(GR_STIPPLE_ROTATE);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_LODLEVEL (GrLOD_t lod)
-{
- switch (lod) {
- TRAP_CASE_STRING(GR_LOD_LOG2_2048);
- TRAP_CASE_STRING(GR_LOD_LOG2_1024);
- TRAP_CASE_STRING(GR_LOD_LOG2_512);
- TRAP_CASE_STRING(GR_LOD_LOG2_256);
- TRAP_CASE_STRING(GR_LOD_LOG2_128);
- TRAP_CASE_STRING(GR_LOD_LOG2_64);
- TRAP_CASE_STRING(GR_LOD_LOG2_32);
- TRAP_CASE_STRING(GR_LOD_LOG2_16);
- TRAP_CASE_STRING(GR_LOD_LOG2_8);
- TRAP_CASE_STRING(GR_LOD_LOG2_4);
- TRAP_CASE_STRING(GR_LOD_LOG2_2);
- TRAP_CASE_STRING(GR_LOD_LOG2_1);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_ASPECTRATIO (GrAspectRatio_t aspect)
-{
- switch (aspect) {
- TRAP_CASE_STRING(GR_ASPECT_LOG2_8x1);
- TRAP_CASE_STRING(GR_ASPECT_LOG2_4x1);
- TRAP_CASE_STRING(GR_ASPECT_LOG2_2x1);
- TRAP_CASE_STRING(GR_ASPECT_LOG2_1x1);
- TRAP_CASE_STRING(GR_ASPECT_LOG2_1x2);
- TRAP_CASE_STRING(GR_ASPECT_LOG2_1x4);
- TRAP_CASE_STRING(GR_ASPECT_LOG2_1x8);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_TEXFMT (GrTextureFormat_t fmt)
-{
- switch (fmt) {
- TRAP_CASE_STRING(GR_TEXFMT_8BIT);
- /*TRAP_CASE_STRING(GR_TEXFMT_RGB_332); ==GR_TEXFMT_8BIT*/
- TRAP_CASE_STRING(GR_TEXFMT_YIQ_422);
- TRAP_CASE_STRING(GR_TEXFMT_ALPHA_8);
- TRAP_CASE_STRING(GR_TEXFMT_INTENSITY_8);
- TRAP_CASE_STRING(GR_TEXFMT_ALPHA_INTENSITY_44);
- TRAP_CASE_STRING(GR_TEXFMT_P_8);
- TRAP_CASE_STRING(GR_TEXFMT_RSVD0);
- /*TRAP_CASE_STRING(GR_TEXFMT_P_8_6666); ==GR_TEXFMT_RSVD0*/
- /*TRAP_CASE_STRING(GR_TEXFMT_P_8_6666_EXT); ==GR_TEXFMT_RSVD0*/
- TRAP_CASE_STRING(GR_TEXFMT_RSVD1);
- TRAP_CASE_STRING(GR_TEXFMT_16BIT);
- /*TRAP_CASE_STRING(GR_TEXFMT_ARGB_8332); ==GR_TEXFMT_16BIT*/
- TRAP_CASE_STRING(GR_TEXFMT_AYIQ_8422);
- TRAP_CASE_STRING(GR_TEXFMT_RGB_565);
- TRAP_CASE_STRING(GR_TEXFMT_ARGB_1555);
- TRAP_CASE_STRING(GR_TEXFMT_ARGB_4444);
- TRAP_CASE_STRING(GR_TEXFMT_ALPHA_INTENSITY_88);
- TRAP_CASE_STRING(GR_TEXFMT_AP_88);
- TRAP_CASE_STRING(GR_TEXFMT_RSVD2);
- /*TRAP_CASE_STRING(GR_TEXFMT_RSVD4); ==GR_TEXFMT_RSVD2*/
- TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_FXT1);
- TRAP_CASE_STRING(GR_TEXFMT_ARGB_8888);
- TRAP_CASE_STRING(GR_TEXFMT_YUYV_422);
- TRAP_CASE_STRING(GR_TEXFMT_UYVY_422);
- TRAP_CASE_STRING(GR_TEXFMT_AYUV_444);
- TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT1);
- TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT2);
- TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT3);
- TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT4);
- TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT5);
- TRAP_CASE_STRING(GR_TEXTFMT_RGB_888);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_EVENODD (FxU32 evenOdd)
-{
- switch (evenOdd) {
- TRAP_CASE_STRING(GR_MIPMAPLEVELMASK_EVEN);
- TRAP_CASE_STRING(GR_MIPMAPLEVELMASK_ODD);
- TRAP_CASE_STRING(GR_MIPMAPLEVELMASK_BOTH);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_NCC (GrNCCTable_t table)
-{
- switch (table) {
- TRAP_CASE_STRING(GR_NCCTABLE_NCC0);
- TRAP_CASE_STRING(GR_NCCTABLE_NCC1);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CLAMPMODE (GrTextureClampMode_t clampmode)
-{
- switch (clampmode) {
- TRAP_CASE_STRING(GR_TEXTURECLAMP_WRAP);
- TRAP_CASE_STRING(GR_TEXTURECLAMP_CLAMP);
- TRAP_CASE_STRING(GR_TEXTURECLAMP_MIRROR_EXT);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_TEXFILTER (GrTextureFilterMode_t filter_mode)
-{
- switch (filter_mode) {
- TRAP_CASE_STRING(GR_TEXTUREFILTER_POINT_SAMPLED);
- TRAP_CASE_STRING(GR_TEXTUREFILTER_BILINEAR);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_TABLE (GrTexTable_t type)
-{
- switch (type) {
- TRAP_CASE_STRING(GR_TEXTABLE_NCC0);
- TRAP_CASE_STRING(GR_TEXTABLE_NCC1);
- TRAP_CASE_STRING(GR_TEXTABLE_PALETTE);
- TRAP_CASE_STRING(GR_TEXTABLE_PALETTE_6666_EXT);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_MIPMODE (GrMipMapMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_MIPMAP_DISABLE);
- TRAP_CASE_STRING(GR_MIPMAP_NEAREST);
- TRAP_CASE_STRING(GR_MIPMAP_NEAREST_DITHER);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_TEXBASERANGE (GrTexBaseRange_t range)
-{
- switch (range) {
- TRAP_CASE_STRING(GR_TEXBASE_2048);
- TRAP_CASE_STRING(GR_TEXBASE_1024);
- TRAP_CASE_STRING(GR_TEXBASE_512);
- TRAP_CASE_STRING(GR_TEXBASE_256_TO_1);
- TRAP_CASE_STRING(GR_TEXBASE_256);
- TRAP_CASE_STRING(GR_TEXBASE_128);
- TRAP_CASE_STRING(GR_TEXBASE_64);
- TRAP_CASE_STRING(GR_TEXBASE_32_TO_1);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_LOCKTYPE (GrLock_t type)
-{
- switch (type) {
- TRAP_CASE_STRING(GR_LFB_READ_ONLY);
- TRAP_CASE_STRING(GR_LFB_WRITE_ONLY);
- /*TRAP_CASE_STRING(GR_LFB_IDLE); ==GR_LFB_READ_ONLY*/
- TRAP_CASE_STRING(GR_LFB_NOIDLE);
- TRAP_CASE_STRING(GR_LFB_WRITE_ONLY_EXPLICIT_EXT);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_WRITEMODE (GrLfbWriteMode_t writeMode)
-{
- switch (writeMode) {
- TRAP_CASE_STRING(GR_LFBWRITEMODE_565);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_555);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_1555);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED1);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_888);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_8888);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED2);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED3);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_Z32);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED5);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED6);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED7);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_565_DEPTH);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_555_DEPTH);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_1555_DEPTH);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_ZA16);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_ANY);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_SRCFMT (GrLfbSrcFmt_t src_format)
-{
- switch (src_format) {
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_565);
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_555);
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_1555);
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_888);
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_8888);
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_565_DEPTH);
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_555_DEPTH);
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_1555_DEPTH);
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_ZA16);
- TRAP_CASE_STRING(GR_LFB_SRC_FMT_RLE16);
- TRAP_CASE_STRING(GR_LFBWRITEMODE_Z32); /*???*/
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CRMODE (GrChromaRangeMode_t mode)
-{
- switch (mode) {
- TRAP_CASE_STRING(GR_CHROMARANGE_DISABLE_EXT);
- /*TRAP_CASE_STRING(GR_CHROMARANGE_RGB_ALL_EXT); ==GR_CHROMARANGE_DISABLE_EXT*/
- TRAP_CASE_STRING(GR_CHROMARANGE_ENABLE_EXT);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_PIXFMT (GrPixelFormat_t pixelformat)
-{
- switch (pixelformat) {
- TRAP_CASE_STRING(GR_PIXFMT_I_8);
- TRAP_CASE_STRING(GR_PIXFMT_AI_88);
- TRAP_CASE_STRING(GR_PIXFMT_RGB_565);
- TRAP_CASE_STRING(GR_PIXFMT_ARGB_1555);
- TRAP_CASE_STRING(GR_PIXFMT_ARGB_8888);
- TRAP_CASE_STRING(GR_PIXFMT_AA_2_RGB_565);
- TRAP_CASE_STRING(GR_PIXFMT_AA_2_ARGB_1555);
- TRAP_CASE_STRING(GR_PIXFMT_AA_2_ARGB_8888);
- TRAP_CASE_STRING(GR_PIXFMT_AA_4_RGB_565);
- TRAP_CASE_STRING(GR_PIXFMT_AA_4_ARGB_1555);
- TRAP_CASE_STRING(GR_PIXFMT_AA_4_ARGB_8888);
- TRAP_CASE_STRING(GR_PIXFMT_AA_8_RGB_565);
- TRAP_CASE_STRING(GR_PIXFMT_AA_8_ARGB_1555);
- TRAP_CASE_STRING(GR_PIXFMT_AA_8_ARGB_8888);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_STENCILOP (GrStencilOp_t op)
-{
- switch (op) {
- TRAP_CASE_STRING(GR_STENCILOP_KEEP);
- TRAP_CASE_STRING(GR_STENCILOP_ZERO);
- TRAP_CASE_STRING(GR_STENCILOP_REPLACE);
- TRAP_CASE_STRING(GR_STENCILOP_INCR_CLAMP);
- TRAP_CASE_STRING(GR_STENCILOP_DECR_CLAMP);
- TRAP_CASE_STRING(GR_STENCILOP_INVERT);
- TRAP_CASE_STRING(GR_STENCILOP_INCR_WRAP);
- TRAP_CASE_STRING(GR_STENCILOP_DECR_WRAP);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_BLENDOP (GrAlphaBlendOp_t op)
-{
- switch (op) {
- TRAP_CASE_STRING(GR_BLEND_OP_ADD);
- TRAP_CASE_STRING(GR_BLEND_OP_SUB);
- TRAP_CASE_STRING(GR_BLEND_OP_REVSUB);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CU (GrCCUColor_t a)
-{
- switch (a) {
- TRAP_CASE_STRING(GR_CMBX_ZERO);
- TRAP_CASE_STRING(GR_CMBX_TEXTURE_ALPHA);
- TRAP_CASE_STRING(GR_CMBX_ALOCAL);
- TRAP_CASE_STRING(GR_CMBX_AOTHER);
- TRAP_CASE_STRING(GR_CMBX_B);
- TRAP_CASE_STRING(GR_CMBX_CONSTANT_ALPHA);
- TRAP_CASE_STRING(GR_CMBX_CONSTANT_COLOR);
- TRAP_CASE_STRING(GR_CMBX_DETAIL_FACTOR);
- TRAP_CASE_STRING(GR_CMBX_ITALPHA);
- TRAP_CASE_STRING(GR_CMBX_ITRGB);
- TRAP_CASE_STRING(GR_CMBX_LOCAL_TEXTURE_ALPHA);
- TRAP_CASE_STRING(GR_CMBX_LOCAL_TEXTURE_RGB);
- TRAP_CASE_STRING(GR_CMBX_LOD_FRAC);
- TRAP_CASE_STRING(GR_CMBX_OTHER_TEXTURE_ALPHA);
- TRAP_CASE_STRING(GR_CMBX_OTHER_TEXTURE_RGB);
- TRAP_CASE_STRING(GR_CMBX_TEXTURE_RGB);
- TRAP_CASE_STRING(GR_CMBX_TMU_CALPHA);
- TRAP_CASE_STRING(GR_CMBX_TMU_CCOLOR);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_CMBMODE (GrCombineMode_t a_mode)
-{
- switch (a_mode) {
- TRAP_CASE_STRING(GR_FUNC_MODE_ZERO);
- TRAP_CASE_STRING(GR_FUNC_MODE_X);
- TRAP_CASE_STRING(GR_FUNC_MODE_ONE_MINUS_X);
- TRAP_CASE_STRING(GR_FUNC_MODE_NEGATIVE_X);
- TRAP_CASE_STRING(GR_FUNC_MODE_X_MINUS_HALF);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_TMU (GrChipID_t tmu)
-{
- switch (tmu) {
- TRAP_CASE_STRING(GR_TMU0);
- TRAP_CASE_STRING(GR_TMU1);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_TXDITHER (FxU32 dither)
-{
- switch (dither) {
- TRAP_CASE_STRING(TX_DITHER_NONE);
- TRAP_CASE_STRING(TX_DITHER_4x4);
- TRAP_CASE_STRING(TX_DITHER_ERR);
- TRAP_NODEFAULT;
- }
-}
-
-const char *TRP_TXCOMPRESS (FxU32 compress)
-{
- switch (compress) {
- TRAP_CASE_STRING(TX_COMPRESSION_STATISTICAL);
- TRAP_CASE_STRING(TX_COMPRESSION_HEURISTIC);
- TRAP_NODEFAULT;
- }
-}
-
-
-
-/****************************************************************************\
-* REAL POINTERS *
-\****************************************************************************/
-
-/*
-** glide extensions
-*/
-void (FX_CALL *real_grSetNumPendingBuffers) (FxI32 NumPendingBuffers);
-char * (FX_CALL *real_grGetRegistryOrEnvironmentStringExt) (char *theEntry);
-void (FX_CALL *real_grGetGammaTableExt) (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
-void (FX_CALL *real_grChromaRangeModeExt) (GrChromakeyMode_t mode);
-void (FX_CALL *real_grChromaRangeExt) (GrColor_t color, GrColor_t range, GrChromaRangeMode_t match_mode);
-void (FX_CALL *real_grTexChromaModeExt) (GrChipID_t tmu, GrChromakeyMode_t mode);
-void (FX_CALL *real_grTexChromaRangeExt) (GrChipID_t tmu, GrColor_t min, GrColor_t max, GrTexChromakeyMode_t mode);
-
-/* pointcast */
-void (FX_CALL *real_grTexDownloadTableExt) (GrChipID_t tmu, GrTexTable_t type, void *data);
-void (FX_CALL *real_grTexDownloadTablePartialExt) (GrChipID_t tmu, GrTexTable_t type, void *data, int start, int end);
-void (FX_CALL *real_grTexNCCTableExt) (GrChipID_t tmu, GrNCCTable_t table);
-
-/* tbext */
-void (FX_CALL *real_grTextureBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
-void (FX_CALL *real_grTextureAuxBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
-void (FX_CALL *real_grAuxBufferExt) (GrBuffer_t buffer);
-
-/* napalm */
-GrContext_t (FX_CALL *real_grSstWinOpenExt) (FxU32 hWnd, GrScreenResolution_t resolution, GrScreenRefresh_t refresh, GrColorFormat_t format, GrOriginLocation_t origin, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers);
-void (FX_CALL *real_grStencilFuncExt) (GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask);
-void (FX_CALL *real_grStencilMaskExt) (GrStencil_t value);
-void (FX_CALL *real_grStencilOpExt) (GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass);
-void (FX_CALL *real_grLfbConstantStencilExt) (GrStencil_t value);
-void (FX_CALL *real_grBufferClearExt) (GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil);
-void (FX_CALL *real_grColorCombineExt) (GrCCUColor_t a, GrCombineMode_t a_mode, GrCCUColor_t b, GrCombineMode_t b_mode, GrCCUColor_t c, FxBool c_invert, GrCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
-void (FX_CALL *real_grAlphaCombineExt) (GrACUColor_t a, GrCombineMode_t a_mode, GrACUColor_t b, GrCombineMode_t b_mode, GrACUColor_t c, FxBool c_invert, GrACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
-void (FX_CALL *real_grTexColorCombineExt) (GrChipID_t tmu, GrTCCUColor_t a, GrCombineMode_t a_mode, GrTCCUColor_t b, GrCombineMode_t b_mode, GrTCCUColor_t c, FxBool c_invert, GrTCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
-void (FX_CALL *real_grTexAlphaCombineExt) (GrChipID_t tmu, GrTACUColor_t a, GrCombineMode_t a_mode, GrTACUColor_t b, GrCombineMode_t b_mode, GrTACUColor_t c, FxBool c_invert, GrTACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
-void (FX_CALL *real_grConstantColorValueExt) (GrChipID_t tmu, GrColor_t value);
-void (FX_CALL *real_grColorMaskExt) (FxBool r, FxBool g, FxBool b, FxBool a);
-void (FX_CALL *real_grAlphaBlendFunctionExt) (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendOp_t rgb_op, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df, GrAlphaBlendOp_t alpha_op);
-void (FX_CALL *real_grTBufferWriteMaskExt) (FxU32 tmask);
-
-/*
-** texus
-*/
-void (FX_CALL *real_txImgQuantize) (char *dst, char *src, int w, int h, FxU32 format, FxU32 dither);
-void (FX_CALL *real_txMipQuantize) (TxMip *pxMip, TxMip *txMip, int fmt, FxU32 d, FxU32 comp);
-void (FX_CALL *real_txPalToNcc) (GuNccTable *ncc_table, const FxU32 *pal);
-
-
-
-/****************************************************************************\
-* DEBUG HOOKS *
-\****************************************************************************/
-
-/*
-** rendering functions
-*/
-void FX_CALL trap_grDrawPoint (const void *pt)
-{
-#define FN_NAME "grDrawPoint"
- TRAP_LOG("%s(%p)\n", FN_NAME, pt);
- grDrawPoint(pt);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDrawLine (const void *v1,
- const void *v2)
-{
-#define FN_NAME "grDrawLine"
- TRAP_LOG("%s(%p, %p)\n", FN_NAME, v1, v2);
- grDrawLine(v1, v2);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDrawTriangle (const void *a,
- const void *b,
- const void *c)
-{
-#define FN_NAME "grDrawTriangle"
- TRAP_LOG("%s(%p, %p, %p)\n", FN_NAME, a, b, c);
- grDrawTriangle(a, b, c);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grVertexLayout (FxU32 param,
- FxI32 offset,
- FxU32 mode)
-{
-#define FN_NAME "grVertexLayout"
- TRAP_LOG("%s(%s, %ld, %s)\n", FN_NAME, TRP_VTX(param), offset, TRP_PARAM(mode));
- grVertexLayout(param, offset, mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDrawVertexArray (FxU32 mode,
- FxU32 Count,
- void *pointers)
-{
-#define FN_NAME "grDrawVertexArray"
- TRAP_LOG("%s(%s, %lu, %p)\n", FN_NAME, TRP_ARRAY(mode), Count, pointers);
- grDrawVertexArray(mode, Count, pointers);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDrawVertexArrayContiguous (FxU32 mode,
- FxU32 Count,
- void *pointers,
- FxU32 stride)
-{
-#define FN_NAME "grDrawVertexArrayContiguous"
- TRAP_LOG("%s(%s, %lu, %p, %lu)\n", FN_NAME, TRP_ARRAY(mode), Count, pointers, stride);
- grDrawVertexArrayContiguous(mode, Count, pointers, stride);
-#undef FN_NAME
-}
-
-/*
-** Antialiasing Functions
-*/
-void FX_CALL trap_grAADrawTriangle (const void *a,
- const void *b,
- const void *c,
- FxBool ab_antialias,
- FxBool bc_antialias,
- FxBool ca_antialias)
-{
-#define FN_NAME "grAADrawTriangle"
- TRAP_LOG("%s(%p, %p, %p, %s, %s, %s)\n", FN_NAME, a, b, c, TRP_BOOL(ab_antialias), TRP_BOOL(bc_antialias), TRP_BOOL(ca_antialias));
- grAADrawTriangle(a, b, c, ab_antialias, bc_antialias, ca_antialias);
-#undef FN_NAME
-}
-
-/*
-** buffer management
-*/
-void FX_CALL trap_grBufferClear (GrColor_t color,
- GrAlpha_t alpha,
- FxU32 depth)
-{
-#define FN_NAME "grBufferClear"
- TRAP_LOG("%s(%08lx, %02x, %08lx)\n", FN_NAME, color, alpha, depth);
- grBufferClear(color, alpha, depth);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grBufferSwap (FxU32 swap_interval)
-{
-#define FN_NAME "grBufferSwap"
- TRAP_LOG("%s(%lu)\n", FN_NAME, swap_interval);
- grBufferSwap(swap_interval);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grRenderBuffer (GrBuffer_t buffer)
-{
-#define FN_NAME "grRenderBuffer"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_BUFFER(buffer));
- grRenderBuffer(buffer);
-#undef FN_NAME
-}
-
-/*
-** error management
-*/
-void FX_CALL trap_grErrorSetCallback (GrErrorCallbackFnc_t fnc)
-{
-#define FN_NAME "grErrorSetCallback"
- TRAP_LOG("%s(%p)\n", FN_NAME, (void *)fnc);
- grErrorSetCallback(fnc);
-#undef FN_NAME
-}
-
-/*
-** SST routines
-*/
-void FX_CALL trap_grFinish (void)
-{
-#define FN_NAME "grFinish"
- TRAP_LOG("%s()\n", FN_NAME);
- grFinish();
-#undef FN_NAME
-}
-
-void FX_CALL trap_grFlush (void)
-{
-#define FN_NAME "grFlush"
- TRAP_LOG("%s()\n", FN_NAME);
- grFlush();
-#undef FN_NAME
-}
-
-GrContext_t FX_CALL trap_grSstWinOpen (FxU32 hWnd,
- GrScreenResolution_t screen_resolution,
- GrScreenRefresh_t refresh_rate,
- GrColorFormat_t color_format,
- GrOriginLocation_t origin_location,
- int nColBuffers,
- int nAuxBuffers)
-{
-#define FN_NAME "grSstWinOpen"
- GrContext_t rv;
- TRAP_LOG("%s(%08lx, %s, %s, %s, %s, %d, %d)\n", FN_NAME, hWnd, TRP_RESOLUTION(screen_resolution), TRP_REFRESH(refresh_rate), TRP_COLFMT(color_format), TRP_ORIGIN(origin_location), nColBuffers, nAuxBuffers);
- rv = grSstWinOpen(hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
- TRAP_LOG(GOT "%p\n", (void *)rv);
- return rv;
-#undef FN_NAME
-}
-
-FxBool FX_CALL trap_grSstWinClose (GrContext_t context)
-{
-#define FN_NAME "grSstWinClose"
- FxBool rv;
- TRAP_LOG("%s(%p)\n", FN_NAME, (void *)context);
- rv = grSstWinClose(context);
- TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
- return rv;
-#undef FN_NAME
-}
-
-FxBool FX_CALL trap_grSelectContext (GrContext_t context)
-{
-#define FN_NAME "grSelectContext"
- FxBool rv;
- TRAP_LOG("%s(%p)\n", FN_NAME, (void *)context);
- rv = grSelectContext(context);
- TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
- return rv;
-#undef FN_NAME
-}
-
-void FX_CALL trap_grSstOrigin (GrOriginLocation_t origin)
-{
-#define FN_NAME "grSstOrigin"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_ORIGIN(origin));
- grSstOrigin(origin);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grSstSelect (int which_sst)
-{
-#define FN_NAME "grSstSelect"
- TRAP_LOG("%s(%d)\n", FN_NAME, which_sst);
- grSstSelect(which_sst);
-#undef FN_NAME
-}
-
-/*
-** Glide configuration and special effect maintenance functions
-*/
-void FX_CALL trap_grAlphaBlendFunction (GrAlphaBlendFnc_t rgb_sf,
- GrAlphaBlendFnc_t rgb_df,
- GrAlphaBlendFnc_t alpha_sf,
- GrAlphaBlendFnc_t alpha_df)
-{
-#define FN_NAME "grAlphaBlendFunction"
- TRAP_LOG("%s(%s, %s, %s, %s)\n", FN_NAME, TRP_BLEND(rgb_sf), TRP_BLEND(rgb_df), TRP_BLEND(alpha_sf), TRP_BLEND(alpha_df));
- grAlphaBlendFunction(rgb_sf, rgb_df, alpha_sf, alpha_df);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grAlphaCombine (GrCombineFunction_t function,
- GrCombineFactor_t factor,
- GrCombineLocal_t local,
- GrCombineOther_t other,
- FxBool invert)
-{
-#define FN_NAME "grAlphaCombine"
- TRAP_LOG("%s(%s, %s, %s, %s, %s)\n", FN_NAME, TRP_CMBFUNC(function), TRP_CMBFACT(factor), TRP_CMBLOCAL(local), TRP_CMBOTHER(other), TRP_BOOL(invert));
- grAlphaCombine(function, factor, local, other, invert);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grAlphaControlsITRGBLighting (FxBool enable)
-{
-#define FN_NAME "grAlphaControlsITRGBLighting"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_BOOL(enable));
- grAlphaControlsITRGBLighting(enable);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grAlphaTestFunction (GrCmpFnc_t function)
-{
-#define FN_NAME "grAlphaTestFunction"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CMPFUNC(function));
- grAlphaTestFunction(function);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grAlphaTestReferenceValue (GrAlpha_t value)
-{
-#define FN_NAME "grAlphaTestReferenceValue"
- TRAP_LOG("%s(%02x)\n", FN_NAME, value);
- grAlphaTestReferenceValue(value);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grChromakeyMode (GrChromakeyMode_t mode)
-{
-#define FN_NAME "grChromakeyMode"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CKMODE(mode));
- grChromakeyMode(mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grChromakeyValue (GrColor_t value)
-{
-#define FN_NAME "grChromakeyValue"
- TRAP_LOG("%s(%08lx)\n", FN_NAME, value);
- grChromakeyValue(value);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grClipWindow (FxU32 minx,
- FxU32 miny,
- FxU32 maxx,
- FxU32 maxy)
-{
-#define FN_NAME "grClipWindow"
- TRAP_LOG("%s(%lu, %lu, %lu, %lu)\n", FN_NAME, minx, miny, maxx, maxy);
- grClipWindow(minx, miny, maxx, maxy);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grColorCombine (GrCombineFunction_t function,
- GrCombineFactor_t factor,
- GrCombineLocal_t local,
- GrCombineOther_t other,
- FxBool invert)
-{
-#define FN_NAME "grColorCombine"
- TRAP_LOG("%s(%s, %s, %s, %s, %s)\n", FN_NAME, TRP_CMBFUNC(function), TRP_CMBFACT(factor), TRP_CMBLOCAL(local), TRP_CMBOTHER(other), TRP_BOOL(invert));
- grColorCombine(function, factor, local, other, invert);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grColorMask (FxBool rgb,
- FxBool a)
-{
-#define FN_NAME "grColorMask"
- TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_BOOL(rgb), TRP_BOOL(a));
- grColorMask(rgb, a);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grCullMode (GrCullMode_t mode)
-{
-#define FN_NAME "grCullMode"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CULLMODE(mode));
- grCullMode(mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grConstantColorValue (GrColor_t value)
-{
-#define FN_NAME "grConstantColorValue"
- TRAP_LOG("%s(%08lx)\n", FN_NAME, value);
- grConstantColorValue(value);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDepthBiasLevel (FxI32 level)
-{
-#define FN_NAME "grDepthBiasLevel"
- TRAP_LOG("%s(%ld)\n", FN_NAME, level);
- grDepthBiasLevel(level);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDepthBufferFunction (GrCmpFnc_t function)
-{
-#define FN_NAME "grDepthBufferFunction"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CMPFUNC(function));
- grDepthBufferFunction(function);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDepthBufferMode (GrDepthBufferMode_t mode)
-{
-#define FN_NAME "grDepthBufferMode"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_DEPTHMODE(mode));
- grDepthBufferMode(mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDepthMask (FxBool mask)
-{
-#define FN_NAME "grDepthMask"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_BOOL(mask));
- grDepthMask(mask);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDisableAllEffects (void)
-{
-#define FN_NAME "grDisableAllEffects"
- TRAP_LOG("%s()\n", FN_NAME);
- grDisableAllEffects();
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDitherMode (GrDitherMode_t mode)
-{
-#define FN_NAME "grDitherMode"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_DITHERMODE(mode));
- grDitherMode(mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grFogColorValue (GrColor_t fogcolor)
-{
-#define FN_NAME "grFogColorValue"
- TRAP_LOG("%s(%08lx)\n", FN_NAME, fogcolor);
- grFogColorValue(fogcolor);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grFogMode (GrFogMode_t mode)
-{
-#define FN_NAME "grFogMode"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_FOGMODE(mode));
- grFogMode(mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grFogTable (const GrFog_t ft[])
-{
-#define FN_NAME "grFogTable"
- TRAP_LOG("%s(%p)\n", FN_NAME, ft);
- grFogTable(ft);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grLoadGammaTable (FxU32 nentries,
- FxU32 *red,
- FxU32 *green,
- FxU32 *blue)
-{
-#define FN_NAME "grLoadGammaTable"
- TRAP_LOG("%s(%lu, %p, %p, %p)\n", FN_NAME, nentries, (void *)red, (void *)green, (void *)blue);
- grLoadGammaTable(nentries, red, green, blue);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grSplash (float x,
- float y,
- float width,
- float height,
- FxU32 frame)
-{
-#define FN_NAME "grSplash"
- TRAP_LOG("%s(%f, %f, %f, %f, %lu)\n", FN_NAME, x, y, width, height, frame);
- grSplash(x, y, width, height, frame);
-#undef FN_NAME
-}
-
-FxU32 FX_CALL trap_grGet (FxU32 pname,
- FxU32 plength,
- FxI32 *params)
-{
-#define FN_NAME "grGet"
- FxU32 rv, i;
- TRAP_LOG("%s(%s, %lu, %p)\n", FN_NAME, TRP_GETNAME(pname), plength, (void *)params);
- rv = grGet(pname, plength, params);
- TRAP_LOG(GOT "[");
- for (i = 0; i < (rv/sizeof(FxI32)); i++) {
- TRAP_LOG("%s%ld", i ? ", " : "", params[i]);
- }
- TRAP_LOG("]\n");
- return rv;
-#undef FN_NAME
-}
-
-const char *FX_CALL trap_grGetString (FxU32 pname)
-{
-#define FN_NAME "grGetString"
- const char *rv;
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_GETSTRING(pname));
- rv = grGetString(pname);
- if (rv) {
- TRAP_LOG(GOT "\"%s\"\n", rv);
- } else {
- TRAP_LOG(GOT "NULL\n");
- }
- return rv;
-#undef FN_NAME
-}
-
-FxI32 FX_CALL trap_grQueryResolutions (const GrResolution *resTemplate,
- GrResolution *output)
-{
-#define FN_NAME "grQueryResolutions"
- FxI32 rv;
- TRAP_LOG("%s(%p, %p)\n", FN_NAME, (void *)resTemplate, (void *)output);
- rv = grQueryResolutions(resTemplate, output);
- TRAP_LOG(GOT "%ld\n", rv);
- return rv;
-#undef FN_NAME
-}
-
-FxBool FX_CALL trap_grReset (FxU32 what)
-{
-#define FN_NAME "grReset"
- FxBool rv;
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_GETNAME(what));
- rv = grReset(what);
- TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
- return rv;
-#undef FN_NAME
-}
-
-GrProc FX_CALL trap_grGetProcAddress (char *procName)
-{
-#define FN_NAME "grGetProcAddress"
- GrProc rv;
- TRAP_LOG("%s(%s)\n", FN_NAME, procName);
- rv = grGetProcAddress(procName);
- TRAP_LOG(GOT "%p\n", (void *)rv);
- return rv;
-#undef FN_NAME
-}
-
-void FX_CALL trap_grEnable (GrEnableMode_t mode)
-{
-#define FN_NAME "grEnable"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_ENABLE(mode));
- grEnable(mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDisable (GrEnableMode_t mode)
-{
-#define FN_NAME "grDisable"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_ENABLE(mode));
- grDisable(mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grCoordinateSpace (GrCoordinateSpaceMode_t mode)
-{
-#define FN_NAME "grCoordinateSpace"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_COORD(mode));
- grCoordinateSpace(mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grDepthRange (FxFloat n,
- FxFloat f)
-{
-#define FN_NAME "grDepthRange"
- TRAP_LOG("%s(%f, %f)\n", FN_NAME, n, f);
- grDepthRange(n, f);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grStippleMode (GrStippleMode_t mode)
-{
-#define FN_NAME "grStippleMode"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_STIPPLEMODE(mode));
- grStippleMode(mode); /* some Glide libs don't have it; not used anyway */
-#undef FN_NAME
-}
-
-void FX_CALL trap_grStipplePattern (GrStipplePattern_t mode)
-{
-#define FN_NAME "grStipplePattern"
- TRAP_LOG("%s(%08lx)\n", FN_NAME, mode);
- grStipplePattern(mode); /* some Glide libs don't have it; not used anyway */
-#undef FN_NAME
-}
-
-void FX_CALL trap_grViewport (FxI32 x,
- FxI32 y,
- FxI32 width,
- FxI32 height)
-{
-#define FN_NAME "grViewport"
- TRAP_LOG("%s(%ld, %ld, %ld, %ld)\n", FN_NAME, x, y, width, height);
- grViewport(x, y, width, height);
-#undef FN_NAME
-}
-
-/*
-** texture mapping control functions
-*/
-FxU32 FX_CALL trap_grTexCalcMemRequired (GrLOD_t lodmin,
- GrLOD_t lodmax,
- GrAspectRatio_t aspect,
- GrTextureFormat_t fmt)
-{
-#define FN_NAME "grTexCalcMemRequired"
- FxU32 rv;
- TRAP_LOG("%s(%s, %s, %s, %s)\n", FN_NAME, TRP_LODLEVEL(lodmin), TRP_LODLEVEL(lodmax), TRP_ASPECTRATIO(aspect), TRP_TEXFMT(fmt));
- rv = grTexCalcMemRequired(lodmin, lodmax, aspect, fmt);
- TRAP_LOG(GOT "%lu\n", rv);
- return rv;
-#undef FN_NAME
-}
-
-FxU32 FX_CALL trap_grTexTextureMemRequired (FxU32 evenOdd,
- GrTexInfo *info)
-{
-#define FN_NAME "grTexTextureMemRequired"
- FxU32 rv;
- TRAP_LOG("%s(%s, %p)\n", FN_NAME, TRP_EVENODD(evenOdd), (void *)info);
- rv = grTexTextureMemRequired(evenOdd, info);
- TRAP_LOG(GOT "%lu\n", rv);
- return rv;
-#undef FN_NAME
-}
-
-FxU32 FX_CALL trap_grTexMinAddress (GrChipID_t tmu)
-{
-#define FN_NAME "grTexMinAddress"
- FxU32 rv;
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_TMU(tmu));
- rv = grTexMinAddress(tmu);
- TRAP_LOG(GOT "%lu\n", rv);
- return rv;
-#undef FN_NAME
-}
-
-FxU32 FX_CALL trap_grTexMaxAddress (GrChipID_t tmu)
-{
-#define FN_NAME "grTexMaxAddress"
- FxU32 rv;
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_TMU(tmu));
- rv = grTexMaxAddress(tmu);
- TRAP_LOG(GOT "%lu\n", rv);
- return rv;
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexNCCTable (GrNCCTable_t table)
-{
-#define FN_NAME "grTexNCCTable"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_NCC(table));
- grTexNCCTable(table);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexSource (GrChipID_t tmu,
- FxU32 startAddress,
- FxU32 evenOdd,
- GrTexInfo *info)
-{
-#define FN_NAME "grTexSource"
- TRAP_LOG("%s(%s, %08lx, %s, %p)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_EVENODD(evenOdd), (void *)info);
- grTexSource(tmu, startAddress, evenOdd, info);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexClampMode (GrChipID_t tmu,
- GrTextureClampMode_t s_clampmode,
- GrTextureClampMode_t t_clampmode)
-{
-#define FN_NAME "grTexClampMode"
- TRAP_LOG("%s(%s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CLAMPMODE(s_clampmode), TRP_CLAMPMODE(t_clampmode));
- grTexClampMode(tmu, s_clampmode, t_clampmode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexCombine (GrChipID_t tmu,
- GrCombineFunction_t rgb_function,
- GrCombineFactor_t rgb_factor,
- GrCombineFunction_t alpha_function,
- GrCombineFactor_t alpha_factor,
- FxBool rgb_invert,
- FxBool alpha_invert)
-{
-#define FN_NAME "grTexCombine"
- TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CMBFUNC(rgb_function), TRP_CMBFACT(rgb_factor), TRP_CMBFUNC(alpha_function), TRP_CMBFACT(alpha_factor), TRP_BOOL(rgb_invert), TRP_BOOL(alpha_invert));
- grTexCombine(tmu, rgb_function, rgb_factor, alpha_function, alpha_factor, rgb_invert, alpha_invert);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexDetailControl (GrChipID_t tmu,
- int lod_bias,
- FxU8 detail_scale,
- float detail_max)
-{
-#define FN_NAME "grTexDetailControl"
- TRAP_LOG("%s(%s, %u, %d, %f)\n", FN_NAME, TRP_TMU(tmu), lod_bias, detail_scale, detail_max);
- grTexDetailControl(tmu, lod_bias, detail_scale, detail_max);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexFilterMode (GrChipID_t tmu,
- GrTextureFilterMode_t minfilter_mode,
- GrTextureFilterMode_t magfilter_mode)
-{
-#define FN_NAME "grTexFilterMode"
- TRAP_LOG("%s(%s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_TEXFILTER(minfilter_mode), TRP_TEXFILTER(magfilter_mode));
- grTexFilterMode(tmu, minfilter_mode, magfilter_mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexLodBiasValue (GrChipID_t tmu,
- float bias)
-{
-#define FN_NAME "grTexLodBiasValue"
- TRAP_LOG("%s(%s, %f)\n", FN_NAME, TRP_TMU(tmu), bias);
- grTexLodBiasValue(tmu, bias);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexDownloadMipMap (GrChipID_t tmu,
- FxU32 startAddress,
- FxU32 evenOdd,
- GrTexInfo *info)
-{
-#define FN_NAME "grTexDownloadMipMap"
- TRAP_LOG("%s(%s, %08lx, %s, %p)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_EVENODD(evenOdd), (void *)info);
- grTexDownloadMipMap(tmu, startAddress, evenOdd, info);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexDownloadMipMapLevel (GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLod,
- GrLOD_t largeLod,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 evenOdd,
- void *data)
-{
-#define FN_NAME "grTexDownloadMipMapLevel"
- TRAP_LOG("%s(%s, %08lx, %s, %s, %s, %s, %s, %p)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_LODLEVEL(thisLod), TRP_LODLEVEL(largeLod), TRP_ASPECTRATIO(aspectRatio), TRP_TEXFMT(format), TRP_EVENODD(evenOdd), data);
- grTexDownloadMipMapLevel(tmu, startAddress, thisLod, largeLod, aspectRatio, format, evenOdd, data);
-#undef FN_NAME
-}
-
-FxBool FX_CALL trap_grTexDownloadMipMapLevelPartial (GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLod,
- GrLOD_t largeLod,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 evenOdd,
- void *data,
- int start,
- int end)
-{
-#define FN_NAME "grTexDownloadMipMapLevelPartial"
- FxBool rv;
- TRAP_LOG("%s(%s, %08lx, %s, %s, %s, %s, %s, %p, %d, %d)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_LODLEVEL(thisLod), TRP_LODLEVEL(largeLod), TRP_ASPECTRATIO(aspectRatio), TRP_TEXFMT(format), TRP_EVENODD(evenOdd), data, start, end);
- rv = grTexDownloadMipMapLevelPartial(tmu, startAddress, thisLod, largeLod, aspectRatio, format, evenOdd, data, start, end);
- TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
- return rv;
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexDownloadTable (GrTexTable_t type,
- void *data)
-{
-#define FN_NAME "grTexDownloadTable"
- TRAP_LOG("%s(%s, %p)\n", FN_NAME, TRP_TABLE(type), data);
- grTexDownloadTable(type, data);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexDownloadTablePartial (GrTexTable_t type,
- void *data,
- int start,
- int end)
-{
-#define FN_NAME "grTexDownloadTablePartial"
- TRAP_LOG("%s(%s, %p, %d, %d)\n", FN_NAME, TRP_TABLE(type), data, start, end);
- grTexDownloadTablePartial(type, data, start, end);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexMipMapMode (GrChipID_t tmu,
- GrMipMapMode_t mode,
- FxBool lodBlend)
-{
-#define FN_NAME "grTexMipMapMode"
- TRAP_LOG("%s(%s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_MIPMODE(mode), TRP_BOOL(lodBlend));
- grTexMipMapMode(tmu, mode, lodBlend);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexMultibase (GrChipID_t tmu,
- FxBool enable)
-{
-#define FN_NAME "grTexMultibase"
- TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_BOOL(enable));
- grTexMultibase(tmu, enable);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexMultibaseAddress (GrChipID_t tmu,
- GrTexBaseRange_t range,
- FxU32 startAddress,
- FxU32 evenOdd,
- GrTexInfo *info)
-{
-#define FN_NAME "grTexMultibaseAddress"
- TRAP_LOG("%s(%s, %s, %08lx, %s, %p)\n", FN_NAME, TRP_TMU(tmu), TRP_TEXBASERANGE(range), startAddress, TRP_EVENODD(evenOdd), (void *)info);
- grTexMultibaseAddress(tmu, range, startAddress, evenOdd, info);
-#undef FN_NAME
-}
-
-/*
-** linear frame buffer functions
-*/
-FxBool FX_CALL trap_grLfbLock (GrLock_t type,
- GrBuffer_t buffer,
- GrLfbWriteMode_t writeMode,
- GrOriginLocation_t origin,
- FxBool pixelPipeline,
- GrLfbInfo_t *info)
-{
-#define FN_NAME "grLfbLock"
- FxBool rv;
- TRAP_LOG("%s(%s, %s, %s, %s, %s, %p)\n", FN_NAME, TRP_LOCKTYPE(type), TRP_BUFFER(buffer), TRP_WRITEMODE(writeMode), TRP_ORIGIN(origin), TRP_BOOL(pixelPipeline), (void *)info);
- rv = grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
- TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
- return rv;
-#undef FN_NAME
-}
-
-FxBool FX_CALL trap_grLfbUnlock (GrLock_t type,
- GrBuffer_t buffer)
-{
-#define FN_NAME "grLfbUnlock"
- FxBool rv;
- TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_LOCKTYPE(type), TRP_BUFFER(buffer));
- rv = grLfbUnlock(type, buffer);
- TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
- return rv;
-#undef FN_NAME
-}
-
-void FX_CALL trap_grLfbConstantAlpha (GrAlpha_t alpha)
-{
-#define FN_NAME "grLfbConstantAlpha"
- TRAP_LOG("%s(%02x)\n", FN_NAME, alpha);
- grLfbConstantAlpha(alpha);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grLfbConstantDepth (FxU32 depth)
-{
-#define FN_NAME "grLfbConstantDepth"
- TRAP_LOG("%s(%08lx)\n", FN_NAME, depth);
- grLfbConstantDepth(depth);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grLfbWriteColorSwizzle (FxBool swizzleBytes,
- FxBool swapWords)
-{
-#define FN_NAME "grLfbWriteColorSwizzle"
- TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_BOOL(swizzleBytes), TRP_BOOL(swapWords));
- grLfbWriteColorSwizzle(swizzleBytes, swapWords);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grLfbWriteColorFormat (GrColorFormat_t colorFormat)
-{
-#define FN_NAME "grLfbWriteColorFormat"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_COLFMT(colorFormat));
- grLfbWriteColorFormat(colorFormat);
-#undef FN_NAME
-}
-
-FxBool FX_CALL trap_grLfbWriteRegion (GrBuffer_t dst_buffer,
- FxU32 dst_x,
- FxU32 dst_y,
- GrLfbSrcFmt_t src_format,
- FxU32 src_width,
- FxU32 src_height,
- FxBool pixelPipeline,
- FxI32 src_stride,
- void *src_data)
-{
-#define FN_NAME "grLfbWriteRegion"
- FxBool rv;
- TRAP_LOG("%s(%s, %lu, %lu, %s, %lu, %lu, %s, %ld, %p)\n", FN_NAME, TRP_BUFFER(dst_buffer), dst_x, dst_y, TRP_SRCFMT(src_format), src_width, src_height, TRP_BOOL(pixelPipeline), src_stride, src_data);
- rv = grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format, src_width, src_height, pixelPipeline, src_stride, src_data);
- TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
- return rv;
-#undef FN_NAME
-}
-
-FxBool FX_CALL trap_grLfbReadRegion (GrBuffer_t src_buffer,
- FxU32 src_x,
- FxU32 src_y,
- FxU32 src_width,
- FxU32 src_height,
- FxU32 dst_stride,
- void *dst_data)
-{
-#define FN_NAME "grLfbReadRegion"
- FxBool rv;
- TRAP_LOG("%s(%s, %lu, %lu, %lu, %lu, %ld, %p)\n", FN_NAME, TRP_BUFFER(src_buffer), src_x, src_y, src_width, src_height, dst_stride, dst_data);
- rv = grLfbReadRegion(src_buffer, src_x, src_y, src_width, src_height, dst_stride, dst_data);
- TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
- return rv;
-#undef FN_NAME
-}
-
-/*
-** glide management functions
-*/
-void FX_CALL trap_grGlideInit (void)
-{
-#define FN_NAME "grGlideInit"
- TRAP_LOG("%s()\n", FN_NAME);
- grGlideInit();
-#undef FN_NAME
-}
-
-void FX_CALL trap_grGlideShutdown (void)
-{
-#define FN_NAME "grGlideShutdown"
- TRAP_LOG("%s()\n", FN_NAME);
- grGlideShutdown();
-#undef FN_NAME
-}
-
-void FX_CALL trap_grGlideGetState (void *state)
-{
-#define FN_NAME "grGlideGetState"
- TRAP_LOG("%s(%p)\n", FN_NAME, state);
- grGlideGetState(state);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grGlideSetState (const void *state)
-{
-#define FN_NAME "grGlideSetState"
- TRAP_LOG("%s(%p)\n", FN_NAME, state);
- grGlideSetState(state);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grGlideGetVertexLayout (void *layout)
-{
-#define FN_NAME "grGlideGetVertexLayout"
- TRAP_LOG("%s(%p)\n", FN_NAME, layout);
- grGlideGetVertexLayout(layout);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grGlideSetVertexLayout (const void *layout)
-{
-#define FN_NAME "grGlideSetVertexLayout"
- TRAP_LOG("%s(%p)\n", FN_NAME, layout);
- grGlideSetVertexLayout(layout);
-#undef FN_NAME
-}
-
-/*
-** glide utility functions
-*/
-void FX_CALL trap_guGammaCorrectionRGB (FxFloat red,
- FxFloat green,
- FxFloat blue)
-{
-#define FN_NAME "guGammaCorrectionRGB"
- TRAP_LOG("%s(%f, %f, %f)\n", FN_NAME, red, green, blue);
- guGammaCorrectionRGB(red, green, blue);
-#undef FN_NAME
-}
-
-float FX_CALL trap_guFogTableIndexToW (int i)
-{
-#define FN_NAME "guFogTableIndexToW"
- float rv;
- TRAP_LOG("%s(%d)\n", FN_NAME, i);
- rv = guFogTableIndexToW(i);
- TRAP_LOG(GOT "%f\n", rv);
- return rv;
-#undef FN_NAME
-}
-
-void FX_CALL trap_guFogGenerateExp (GrFog_t *fogtable,
- float density)
-{
-#define FN_NAME "guFogGenerateExp"
- TRAP_LOG("%s(%p, %f)\n", FN_NAME, fogtable, density);
- guFogGenerateExp(fogtable, density);
-#undef FN_NAME
-}
-
-void FX_CALL trap_guFogGenerateExp2 (GrFog_t *fogtable,
- float density)
-{
-#define FN_NAME "guFogGenerateExp2"
- TRAP_LOG("%s(%p, %f)\n", FN_NAME, fogtable, density);
- guFogGenerateExp2(fogtable, density);
-#undef FN_NAME
-}
-
-void FX_CALL trap_guFogGenerateLinear (GrFog_t *fogtable,
- float nearZ,
- float farZ)
-{
-#define FN_NAME "guFogGenerateLinear"
- TRAP_LOG("%s(%p, %f, %f)\n", FN_NAME, fogtable, nearZ, farZ);
- guFogGenerateLinear(fogtable, nearZ, farZ);
-#undef FN_NAME
-}
-
-/*
-** glide extensions
-*/
-void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers)
-{
-#define FN_NAME "grSetNumPendingBuffers"
- TRAP_LOG("%s(%ld)\n", FN_NAME, NumPendingBuffers);
- assert(real_grSetNumPendingBuffers);
- (*real_grSetNumPendingBuffers)(NumPendingBuffers);
-#undef FN_NAME
-}
-
-char *FX_CALL trap_grGetRegistryOrEnvironmentStringExt (char *theEntry)
-{
-#define FN_NAME "grGetRegistryOrEnvironmentStringExt"
- char *rv;
- TRAP_LOG("%s(\"%s\")\n", FN_NAME, theEntry);
- assert(real_grGetRegistryOrEnvironmentStringExt);
- rv = (*real_grGetRegistryOrEnvironmentStringExt)(theEntry);
- if (rv) {
- TRAP_LOG(GOT "\"%s\"\n", rv);
- } else {
- TRAP_LOG(GOT "NULL\n");
- }
- return rv;
-#undef FN_NAME
-}
-
-void FX_CALL trap_grGetGammaTableExt (FxU32 nentries,
- FxU32 *red,
- FxU32 *green,
- FxU32 *blue)
-{
-#define FN_NAME "grGetGammaTableExt"
- TRAP_LOG("%s(%lu, %p, %p, %p)\n", FN_NAME, nentries, (void *)red, (void *)green, (void *)blue);
- assert(real_grGetGammaTableExt);
- (*real_grGetGammaTableExt)(nentries, red, green, blue);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grChromaRangeModeExt (GrChromakeyMode_t mode)
-{
-#define FN_NAME "grChromaRangeModeExt"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CKMODE(mode));
- assert(real_grChromaRangeModeExt);
- (*real_grChromaRangeModeExt)(mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grChromaRangeExt (GrColor_t color,
- GrColor_t range,
- GrChromaRangeMode_t match_mode)
-{
-#define FN_NAME "grChromaRangeExt"
- TRAP_LOG("%s(%08lx, %08lx, %s)\n", FN_NAME, color, range, TRP_CRMODE(match_mode));
- assert(real_grChromaRangeExt);
- (*real_grChromaRangeExt)(color, range, match_mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexChromaModeExt (GrChipID_t tmu,
- GrChromakeyMode_t mode)
-{
-#define FN_NAME "grTexChromaModeExt"
- TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CKMODE(mode));
- assert(real_grTexChromaModeExt);
- (*real_grTexChromaModeExt)(tmu, mode);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexChromaRangeExt (GrChipID_t tmu,
- GrColor_t min,
- GrColor_t max,
- GrTexChromakeyMode_t mode)
-{
-#define FN_NAME "grTexChromaRangeExt"
- TRAP_LOG("%s(%s, %08lx, %08lx, %s)\n", FN_NAME, TRP_TMU(tmu), min, max, TRP_CRMODE(mode));
- assert(real_grTexChromaRangeExt);
- (*real_grTexChromaRangeExt)(tmu, min, max, mode);
-#undef FN_NAME
-}
-
- /* pointcast */
-void FX_CALL trap_grTexDownloadTableExt (GrChipID_t tmu,
- GrTexTable_t type,
- void *data)
-{
-#define FN_NAME "grTexDownloadTableExt"
- TRAP_LOG("%s(%s, %s, %p)\n", FN_NAME, TRP_TMU(tmu), TRP_TABLE(type), data);
- assert(real_grTexDownloadTableExt);
- (*real_grTexDownloadTableExt)(tmu, type, data);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexDownloadTablePartialExt (GrChipID_t tmu,
- GrTexTable_t type,
- void *data,
- int start,
- int end)
-{
-#define FN_NAME "grTexDownloadTablePartialExt"
- TRAP_LOG("%s(%s, %s, %p, %d, %d)\n", FN_NAME, TRP_TMU(tmu), TRP_TABLE(type), data, start, end);
- assert(real_grTexDownloadTablePartialExt);
- (*real_grTexDownloadTablePartialExt)(tmu, type, data, start, end);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexNCCTableExt (GrChipID_t tmu,
- GrNCCTable_t table)
-{
-#define FN_NAME "grTexNCCTableExt"
- TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_NCC(table));
- assert(real_grTexNCCTableExt);
- (*real_grTexNCCTableExt)(tmu, table);
-#undef FN_NAME
-}
-
- /* tbext */
-void FX_CALL trap_grTextureBufferExt (GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLOD,
- GrLOD_t largeLOD,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 odd_even_mask)
-{
-#define FN_NAME "grTextureBufferExt"
- TRAP_LOG("%s(%s, %08lx, %s, %s, %s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_LODLEVEL(thisLOD), TRP_LODLEVEL(largeLOD), TRP_ASPECTRATIO(aspectRatio), TRP_TEXFMT(format), TRP_EVENODD(odd_even_mask));
- assert(real_grTextureBufferExt);
- (*real_grTextureBufferExt)(tmu, startAddress, thisLOD, largeLOD, aspectRatio, format, odd_even_mask);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTextureAuxBufferExt (GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLOD,
- GrLOD_t largeLOD,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 odd_even_mask)
-{
-#define FN_NAME "grTextureAuxBufferExt"
- TRAP_LOG("%s(%s, %08lx, %s, %s, %s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_LODLEVEL(thisLOD), TRP_LODLEVEL(largeLOD), TRP_ASPECTRATIO(aspectRatio), TRP_TEXFMT(format), TRP_EVENODD(odd_even_mask));
- assert(real_grTextureAuxBufferExt);
- (*real_grTextureAuxBufferExt)(tmu, startAddress, thisLOD, largeLOD, aspectRatio, format, odd_even_mask);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grAuxBufferExt (GrBuffer_t buffer)
-{
-#define FN_NAME "grAuxBufferExt"
- TRAP_LOG("%s(%s)\n", FN_NAME, TRP_BUFFER(buffer));
- assert(real_grAuxBufferExt);
- (*real_grAuxBufferExt)(buffer);
-#undef FN_NAME
-}
-
- /* napalm */
-GrContext_t FX_CALL trap_grSstWinOpenExt (FxU32 hWnd,
- GrScreenResolution_t resolution,
- GrScreenRefresh_t refresh,
- GrColorFormat_t format,
- GrOriginLocation_t origin,
- GrPixelFormat_t pixelformat,
- int nColBuffers,
- int nAuxBuffers)
-{
-#define FN_NAME "grSstWinOpenExt"
- GrContext_t rv;
- TRAP_LOG("%s(%08lx, %s, %s, %s, %s, %s, %d, %d)\n", FN_NAME, hWnd, TRP_RESOLUTION(resolution), TRP_REFRESH(refresh), TRP_COLFMT(format), TRP_ORIGIN(origin), TRP_PIXFMT(pixelformat), nColBuffers, nAuxBuffers);
- assert(real_grSstWinOpenExt);
- rv = (*real_grSstWinOpenExt)(hWnd, resolution, refresh, format, origin, pixelformat, nColBuffers, nAuxBuffers);
- TRAP_LOG(GOT "%p\n", (void *)rv);
- return rv;
-#undef FN_NAME
-}
-
-void FX_CALL trap_grStencilFuncExt (GrCmpFnc_t fnc,
- GrStencil_t ref,
- GrStencil_t mask)
-{
-#define FN_NAME "grStencilFuncExt"
- TRAP_LOG("%s(%s, %02x, %02x)\n", FN_NAME, TRP_CMPFUNC(fnc), ref, mask);
- assert(real_grStencilFuncExt);
- (*real_grStencilFuncExt)(fnc, ref, mask);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grStencilMaskExt (GrStencil_t value)
-{
-#define FN_NAME "grStencilMaskExt"
- TRAP_LOG("%s(%02x)\n", FN_NAME, value);
- assert(real_grStencilMaskExt);
- (*real_grStencilMaskExt)(value);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grStencilOpExt (GrStencilOp_t stencil_fail,
- GrStencilOp_t depth_fail,
- GrStencilOp_t depth_pass)
-{
-#define FN_NAME "grStencilOpExt"
- TRAP_LOG("%s(%s, %s, %s)\n", FN_NAME, TRP_STENCILOP(stencil_fail), TRP_STENCILOP(depth_fail), TRP_STENCILOP(depth_pass));
- assert(real_grStencilOpExt);
- (*real_grStencilOpExt)(stencil_fail, depth_fail, depth_pass);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grLfbConstantStencilExt (GrStencil_t value)
-{
-#define FN_NAME "grLfbConstantStencilExt"
- TRAP_LOG("%s(%02x)\n", FN_NAME, value);
- assert(real_grLfbConstantStencilExt);
- (*real_grLfbConstantStencilExt)(value);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grBufferClearExt (GrColor_t color,
- GrAlpha_t alpha,
- FxU32 depth,
- GrStencil_t stencil)
-{
-#define FN_NAME "grBufferClearExt"
- TRAP_LOG("%s(%08lx, %02x, %08lx, %02x)\n", FN_NAME, color, alpha, depth, stencil);
- assert(real_grBufferClearExt);
- (*real_grBufferClearExt)(color, alpha, depth, stencil);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grColorCombineExt (GrCCUColor_t a,
- GrCombineMode_t a_mode,
- GrCCUColor_t b,
- GrCombineMode_t b_mode,
- GrCCUColor_t c,
- FxBool c_invert,
- GrCCUColor_t d,
- FxBool d_invert,
- FxU32 shift,
- FxBool invert)
-{
-#define FN_NAME "grColorCombineExt"
- TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s, %s, %lu, %s)\n", FN_NAME, TRP_CU(a), TRP_CMBMODE(a_mode), TRP_CU(b), TRP_CMBMODE(b_mode), TRP_CU(c), TRP_BOOL(c_invert), TRP_CU(d), TRP_BOOL(d_invert), shift, TRP_BOOL(invert));
- assert(real_grColorCombineExt);
- (*real_grColorCombineExt)(a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grAlphaCombineExt (GrACUColor_t a,
- GrCombineMode_t a_mode,
- GrACUColor_t b,
- GrCombineMode_t b_mode,
- GrACUColor_t c,
- FxBool c_invert,
- GrACUColor_t d,
- FxBool d_invert,
- FxU32 shift,
- FxBool invert)
-{
-#define FN_NAME "grAlphaCombineExt"
- TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s, %s, %lu, %s)\n", FN_NAME, TRP_CU(a), TRP_CMBMODE(a_mode), TRP_CU(b), TRP_CMBMODE(b_mode), TRP_CU(c), TRP_BOOL(c_invert), TRP_CU(d), TRP_BOOL(d_invert), shift, TRP_BOOL(invert));
- assert(real_grAlphaCombineExt);
- (*real_grAlphaCombineExt)(a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexColorCombineExt (GrChipID_t tmu,
- GrTCCUColor_t a,
- GrCombineMode_t a_mode,
- GrTCCUColor_t b,
- GrCombineMode_t b_mode,
- GrTCCUColor_t c,
- FxBool c_invert,
- GrTCCUColor_t d,
- FxBool d_invert,
- FxU32 shift,
- FxBool invert)
-{
-#define FN_NAME "grTexColorCombineExt"
- TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s, %s, %s, %lu, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CU(a), TRP_CMBMODE(a_mode), TRP_CU(b), TRP_CMBMODE(b_mode), TRP_CU(c), TRP_BOOL(c_invert), TRP_CU(d), TRP_BOOL(d_invert), shift, TRP_BOOL(invert));
- assert(real_grTexColorCombineExt);
- (*real_grTexColorCombineExt)(tmu, a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTexAlphaCombineExt (GrChipID_t tmu,
- GrTACUColor_t a,
- GrCombineMode_t a_mode,
- GrTACUColor_t b,
- GrCombineMode_t b_mode,
- GrTACUColor_t c,
- FxBool c_invert,
- GrTACUColor_t d,
- FxBool d_invert,
- FxU32 shift,
- FxBool invert)
-{
-#define FN_NAME "grTexAlphaCombineExt"
- TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s, %s, %s, %lu, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CU(a), TRP_CMBMODE(a_mode), TRP_CU(b), TRP_CMBMODE(b_mode), TRP_CU(c), TRP_BOOL(c_invert), TRP_CU(d), TRP_BOOL(d_invert), shift, TRP_BOOL(invert));
- assert(real_grTexAlphaCombineExt);
- (*real_grTexAlphaCombineExt)(tmu, a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grConstantColorValueExt (GrChipID_t tmu,
- GrColor_t value)
-{
-#define FN_NAME "grConstantColorValueExt"
- TRAP_LOG("%s(%s, %08lx)\n", FN_NAME, TRP_TMU(tmu), value);
- assert(real_grConstantColorValueExt);
- (*real_grConstantColorValueExt)(tmu, value);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grColorMaskExt (FxBool r,
- FxBool g,
- FxBool b,
- FxBool a)
-{
-#define FN_NAME "grColorMaskExt"
- TRAP_LOG("%s(%s, %s, %s, %s)\n", FN_NAME, TRP_BOOL(r), TRP_BOOL(g), TRP_BOOL(b), TRP_BOOL(a));
- assert(real_grColorMaskExt);
- (*real_grColorMaskExt)(r, g, b, a);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grAlphaBlendFunctionExt (GrAlphaBlendFnc_t rgb_sf,
- GrAlphaBlendFnc_t rgb_df,
- GrAlphaBlendOp_t rgb_op,
- GrAlphaBlendFnc_t alpha_sf,
- GrAlphaBlendFnc_t alpha_df,
- GrAlphaBlendOp_t alpha_op)
-{
-#define FN_NAME "grAlphaBlendFunctionExt"
- TRAP_LOG("%s(%s, %s, %s, %s, %s, %s)\n", FN_NAME, TRP_BLEND(rgb_sf), TRP_BLEND(rgb_df), TRP_BLENDOP(rgb_op), TRP_BLEND(alpha_sf), TRP_BLEND(alpha_df), TRP_BLENDOP(alpha_op));
- assert(real_grAlphaBlendFunctionExt);
- (*real_grAlphaBlendFunctionExt)(rgb_sf, rgb_df, rgb_op, alpha_sf, alpha_df, alpha_op);
-#undef FN_NAME
-}
-
-void FX_CALL trap_grTBufferWriteMaskExt (FxU32 tmask)
-{
-#define FN_NAME "grTBufferWriteMaskExt"
- TRAP_LOG("%s(%08lx)\n", FN_NAME, tmask);
- assert(real_grTBufferWriteMaskExt);
- (*real_grTBufferWriteMaskExt)(tmask);
-#undef FN_NAME
-}
-
-/*
-** texus functions
-*/
-void FX_CALL trap_txImgQuantize (char *dst,
- char *src,
- int w,
- int h,
- FxU32 format,
- FxU32 dither)
-{
-#define FN_NAME "txImgQuantize"
- TRAP_LOG("%s(%p, %p, %d, %d, %s, %s)\n", FN_NAME, dst, src, w, h, TRP_TEXFMT(format), TRP_TXDITHER(dither));
- assert(real_txImgQuantize);
- (*real_txImgQuantize)(dst, src, w, h, format, dither);
-#undef FN_NAME
-}
-
-void FX_CALL trap_txMipQuantize (TxMip *pxMip,
- TxMip *txMip,
- int fmt,
- FxU32 d,
- FxU32 comp)
-{
-#define FN_NAME "txMipQuantize"
- TRAP_LOG("%s(%p, %p, %s, %s, %s)\n", FN_NAME, (void *)pxMip, (void *)txMip, TRP_TEXFMT(fmt), TRP_TXDITHER(d), TRP_TXCOMPRESS(comp));
- assert(real_txMipQuantize);
- (*real_txMipQuantize)(pxMip, txMip, fmt, d, comp);
-#undef FN_NAME
-}
-
-void FX_CALL trap_txPalToNcc (GuNccTable *ncc_table,
- const FxU32 *pal)
-{
-#define FN_NAME "txPalToNcc"
- TRAP_LOG("%s(%p, %p)\n", FN_NAME, (void *)ncc_table, (void *)pal);
- assert(real_txPalToNcc);
- (*real_txPalToNcc)(ncc_table, pal);
-#undef FN_NAME
-}
-#endif
-
-
-
-/****************************************************************************\
-* housekeeping (fake pointers) *
-\****************************************************************************/
-char *FX_CALL fake_grGetRegistryOrEnvironmentStringExt (char *theEntry)
-{
- return getenv(theEntry);
-}
-
-void FX_CALL fake_grTexDownloadTableExt (GrChipID_t tmu,
- GrTexTable_t type,
- void *data)
-{
- (void)tmu;
- grTexDownloadTable(type, data);
-}
-
-void FX_CALL fake_grTexDownloadTablePartialExt (GrChipID_t tmu,
- GrTexTable_t type,
- void *data,
- int start,
- int end)
-{
- (void)tmu;
- grTexDownloadTablePartial(type, data, start, end);
-}
-
-void FX_CALL fake_grTexNCCTableExt (GrChipID_t tmu,
- GrNCCTable_t table)
-{
- (void)tmu;
- grTexNCCTable(table);
-}
-
-
-
-/****************************************************************************\
-* interface *
-\****************************************************************************/
-void tdfx_hook_glide (struct tdfx_glide *Glide, int pointcast)
-{
-/* GET_EXT_ADDR: get function pointer
- * GET_EXT_FAKE: get function pointer if possible, else use a fake function
- * GET_EXT_NULL: get function pointer if possible, else leave NULL pointer
- */
-#if FX_TRAP_GLIDE
-#define GET_EXT_ADDR(name) *(GrProc *)&real_##name = grGetProcAddress(#name), Glide->name = trap_##name
-#define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (real_##name == NULL) real_##name = fake_##name
-#define GET_EXT_NULL(name) GET_EXT_ADDR(name); if (real_##name == NULL) Glide->name = NULL
-#else /* FX_TRAP_GLIDE */
-#define GET_EXT_ADDR(name) *(GrProc *)&Glide->name = grGetProcAddress(#name)
-#define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (Glide->name == NULL) Glide->name = fake_##name
-#define GET_EXT_NULL(name) GET_EXT_ADDR(name)
-#endif /* FX_TRAP_GLIDE */
-
- /*
- ** glide extensions
- */
- GET_EXT_NULL(grSetNumPendingBuffers);
- GET_EXT_FAKE(grGetRegistryOrEnvironmentStringExt);
- GET_EXT_ADDR(grGetGammaTableExt);
- GET_EXT_ADDR(grChromaRangeModeExt);
- GET_EXT_ADDR(grChromaRangeExt);
- GET_EXT_ADDR(grTexChromaModeExt);
- GET_EXT_ADDR(grTexChromaRangeExt);
- /* pointcast */
- if (pointcast) {
- GET_EXT_FAKE(grTexDownloadTableExt);
- GET_EXT_FAKE(grTexDownloadTablePartialExt);
- GET_EXT_FAKE(grTexNCCTableExt);
- } else {
- Glide->grTexDownloadTableExt = fake_grTexDownloadTableExt;
- Glide->grTexDownloadTablePartialExt = fake_grTexDownloadTablePartialExt;
- Glide->grTexNCCTableExt = fake_grTexNCCTableExt;
- }
- /* tbext */
- GET_EXT_ADDR(grTextureBufferExt);
- GET_EXT_ADDR(grTextureAuxBufferExt);
- GET_EXT_ADDR(grAuxBufferExt);
- /* napalm */
- GET_EXT_ADDR(grSstWinOpenExt);
- GET_EXT_ADDR(grStencilFuncExt);
- GET_EXT_ADDR(grStencilMaskExt);
- GET_EXT_ADDR(grStencilOpExt);
- GET_EXT_ADDR(grLfbConstantStencilExt);
- GET_EXT_ADDR(grBufferClearExt);
- GET_EXT_ADDR(grColorCombineExt);
- GET_EXT_ADDR(grAlphaCombineExt);
- GET_EXT_ADDR(grTexColorCombineExt);
- GET_EXT_ADDR(grTexAlphaCombineExt);
- GET_EXT_ADDR(grConstantColorValueExt);
- GET_EXT_ADDR(grColorMaskExt);
- GET_EXT_ADDR(grAlphaBlendFunctionExt);
- GET_EXT_ADDR(grTBufferWriteMaskExt);
-
- /*
- ** texus
- */
- GET_EXT_NULL(txImgQuantize);
- GET_EXT_NULL(txMipQuantize);
- GET_EXT_NULL(txPalToNcc);
-
-#undef GET_EXT_ADDR
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxg.h b/src/mesa/drivers/glide/fxg.h
deleted file mode 100644
index e7120111683..00000000000
--- a/src/mesa/drivers/glide/fxg.h
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.0.1
- *
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Mesa/FX device driver. Interface to Glide3.
- *
- * Copyright (c) 2003 - Daniel Borca
- * Email : dborca@users.sourceforge.net
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifndef TDFX_GLIDE_H_included
-#define TDFX_GLIDE_H_included
-
-#include <glide.h>
-#include <g3ext.h>
-
-#ifndef FX_TRAP_GLIDE
-#define FX_TRAP_GLIDE 0
-#endif
-
-#if FX_TRAP_GLIDE
-/*
-** rendering functions
-*/
-void FX_CALL trap_grDrawPoint (const void *pt);
-void FX_CALL trap_grDrawLine (const void *v1, const void *v2);
-void FX_CALL trap_grDrawTriangle (const void *a, const void *b, const void *c);
-void FX_CALL trap_grVertexLayout (FxU32 param, FxI32 offset, FxU32 mode);
-void FX_CALL trap_grDrawVertexArray (FxU32 mode, FxU32 Count, void *pointers);
-void FX_CALL trap_grDrawVertexArrayContiguous (FxU32 mode, FxU32 Count, void *pointers, FxU32 stride);
-
-/*
-** Antialiasing Functions
-*/
-void FX_CALL trap_grAADrawTriangle (const void *a, const void *b, const void *c, FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias);
-
-/*
-** buffer management
-*/
-void FX_CALL trap_grBufferClear (GrColor_t color, GrAlpha_t alpha, FxU32 depth);
-void FX_CALL trap_grBufferSwap (FxU32 swap_interval);
-void FX_CALL trap_grRenderBuffer (GrBuffer_t buffer);
-
-/*
-** error management
-*/
-void FX_CALL trap_grErrorSetCallback (GrErrorCallbackFnc_t fnc);
-
-/*
-** SST routines
-*/
-void FX_CALL trap_grFinish (void);
-void FX_CALL trap_grFlush (void);
-GrContext_t FX_CALL trap_grSstWinOpen (FxU32 hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers);
-FxBool FX_CALL trap_grSstWinClose (GrContext_t context);
-FxBool FX_CALL trap_grSelectContext (GrContext_t context);
-void FX_CALL trap_grSstOrigin (GrOriginLocation_t origin);
-void FX_CALL trap_grSstSelect (int which_sst);
-
-/*
-** Glide configuration and special effect maintenance functions
-*/
-void FX_CALL trap_grAlphaBlendFunction (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df);
-void FX_CALL trap_grAlphaCombine (GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, FxBool invert);
-void FX_CALL trap_grAlphaControlsITRGBLighting (FxBool enable);
-void FX_CALL trap_grAlphaTestFunction (GrCmpFnc_t function);
-void FX_CALL trap_grAlphaTestReferenceValue (GrAlpha_t value);
-void FX_CALL trap_grChromakeyMode (GrChromakeyMode_t mode);
-void FX_CALL trap_grChromakeyValue (GrColor_t value);
-void FX_CALL trap_grClipWindow (FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy);
-void FX_CALL trap_grColorCombine (GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, FxBool invert);
-void FX_CALL trap_grColorMask (FxBool rgb, FxBool a);
-void FX_CALL trap_grCullMode (GrCullMode_t mode);
-void FX_CALL trap_grConstantColorValue (GrColor_t value);
-void FX_CALL trap_grDepthBiasLevel (FxI32 level);
-void FX_CALL trap_grDepthBufferFunction (GrCmpFnc_t function);
-void FX_CALL trap_grDepthBufferMode (GrDepthBufferMode_t mode);
-void FX_CALL trap_grDepthMask (FxBool mask);
-void FX_CALL trap_grDisableAllEffects (void);
-void FX_CALL trap_grDitherMode (GrDitherMode_t mode);
-void FX_CALL trap_grFogColorValue (GrColor_t fogcolor);
-void FX_CALL trap_grFogMode (GrFogMode_t mode);
-void FX_CALL trap_grFogTable (const GrFog_t ft[]);
-void FX_CALL trap_grLoadGammaTable (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
-void FX_CALL trap_grSplash (float x, float y, float width, float height, FxU32 frame);
-FxU32 FX_CALL trap_grGet (FxU32 pname, FxU32 plength, FxI32 *params);
-const char * FX_CALL trap_grGetString (FxU32 pname);
-FxI32 FX_CALL trap_grQueryResolutions (const GrResolution *resTemplate, GrResolution *output);
-FxBool FX_CALL trap_grReset (FxU32 what);
-GrProc FX_CALL trap_grGetProcAddress (char *procName);
-void FX_CALL trap_grEnable (GrEnableMode_t mode);
-void FX_CALL trap_grDisable (GrEnableMode_t mode);
-void FX_CALL trap_grCoordinateSpace (GrCoordinateSpaceMode_t mode);
-void FX_CALL trap_grDepthRange (FxFloat n, FxFloat f);
-void FX_CALL trap_grStippleMode (GrStippleMode_t mode);
-void FX_CALL trap_grStipplePattern (GrStipplePattern_t mode);
-void FX_CALL trap_grViewport (FxI32 x, FxI32 y, FxI32 width, FxI32 height);
-
-/*
-** texture mapping control functions
-*/
-FxU32 FX_CALL trap_grTexCalcMemRequired (GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt);
-FxU32 FX_CALL trap_grTexTextureMemRequired (FxU32 evenOdd, GrTexInfo *info);
-FxU32 FX_CALL trap_grTexMinAddress (GrChipID_t tmu);
-FxU32 FX_CALL trap_grTexMaxAddress (GrChipID_t tmu);
-void FX_CALL trap_grTexNCCTable (GrNCCTable_t table);
-void FX_CALL trap_grTexSource (GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info);
-void FX_CALL trap_grTexClampMode (GrChipID_t tmu, GrTextureClampMode_t s_clampmode, GrTextureClampMode_t t_clampmode);
-void FX_CALL trap_grTexCombine (GrChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, FxBool rgb_invert, FxBool alpha_invert);
-void FX_CALL trap_grTexDetailControl (GrChipID_t tmu, int lod_bias, FxU8 detail_scale, float detail_max);
-void FX_CALL trap_grTexFilterMode (GrChipID_t tmu, GrTextureFilterMode_t minfilter_mode, GrTextureFilterMode_t magfilter_mode);
-void FX_CALL trap_grTexLodBiasValue (GrChipID_t tmu, float bias);
-void FX_CALL trap_grTexDownloadMipMap (GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info);
-void FX_CALL trap_grTexDownloadMipMapLevel (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, GrLOD_t largeLod, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 evenOdd, void *data);
-FxBool FX_CALL trap_grTexDownloadMipMapLevelPartial (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, GrLOD_t largeLod, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 evenOdd, void *data, int start, int end);
-void FX_CALL trap_grTexDownloadTable (GrTexTable_t type, void *data);
-void FX_CALL trap_grTexDownloadTablePartial (GrTexTable_t type, void *data, int start, int end);
-void FX_CALL trap_grTexMipMapMode (GrChipID_t tmu, GrMipMapMode_t mode, FxBool lodBlend);
-void FX_CALL trap_grTexMultibase (GrChipID_t tmu, FxBool enable);
-void FX_CALL trap_grTexMultibaseAddress (GrChipID_t tmu, GrTexBaseRange_t range, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info);
-
-/*
-** linear frame buffer functions
-*/
-FxBool FX_CALL trap_grLfbLock (GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, FxBool pixelPipeline, GrLfbInfo_t *info);
-FxBool FX_CALL trap_grLfbUnlock (GrLock_t type, GrBuffer_t buffer);
-void FX_CALL trap_grLfbConstantAlpha (GrAlpha_t alpha);
-void FX_CALL trap_grLfbConstantDepth (FxU32 depth);
-void FX_CALL trap_grLfbWriteColorSwizzle (FxBool swizzleBytes, FxBool swapWords);
-void FX_CALL trap_grLfbWriteColorFormat (GrColorFormat_t colorFormat);
-FxBool FX_CALL trap_grLfbWriteRegion (GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, FxU32 src_width, FxU32 src_height, FxBool pixelPipeline, FxI32 src_stride, void *src_data);
-FxBool FX_CALL trap_grLfbReadRegion (GrBuffer_t src_buffer, FxU32 src_x, FxU32 src_y, FxU32 src_width, FxU32 src_height, FxU32 dst_stride, void *dst_data);
-
-/*
-** glide management functions
-*/
-void FX_CALL trap_grGlideInit (void);
-void FX_CALL trap_grGlideShutdown (void);
-void FX_CALL trap_grGlideGetState (void *state);
-void FX_CALL trap_grGlideSetState (const void *state);
-void FX_CALL trap_grGlideGetVertexLayout (void *layout);
-void FX_CALL trap_grGlideSetVertexLayout (const void *layout);
-
-/*
-** glide utility functions
-*/
-void FX_CALL trap_guGammaCorrectionRGB (FxFloat red, FxFloat green, FxFloat blue);
-float FX_CALL trap_guFogTableIndexToW (int i);
-void FX_CALL trap_guFogGenerateExp (GrFog_t *fogtable, float density);
-void FX_CALL trap_guFogGenerateExp2 (GrFog_t *fogtable, float density);
-void FX_CALL trap_guFogGenerateLinear (GrFog_t *fogtable, float nearZ, float farZ);
-
-#ifndef FX_TRAP_GLIDE_internal
-/*
-** rendering functions
-*/
-#define grDrawPoint trap_grDrawPoint
-#define grDrawLine trap_grDrawLine
-#define grDrawTriangle trap_grDrawTriangle
-#define grVertexLayout trap_grVertexLayout
-#define grDrawVertexArray trap_grDrawVertexArray
-#define grDrawVertexArrayContiguous trap_grDrawVertexArrayContiguous
-
-/*
-** Antialiasing Functions
-*/
-#define grAADrawTriangle trap_grAADrawTriangle
-
-/*
-** buffer management
-*/
-#define grBufferClear trap_grBufferClear
-#define grBufferSwap trap_grBufferSwap
-#define grRenderBuffer trap_grRenderBuffer
-
-/*
-** error management
-*/
-#define grErrorSetCallback trap_grErrorSetCallback
-
-/*
-** SST routines
-*/
-#define grFinish trap_grFinish
-#define grFlush trap_grFlush
-#define grSstWinOpen trap_grSstWinOpen
-#define grSstWinClose trap_grSstWinClose
-#define grSelectContext trap_grSelectContext
-#define grSstOrigin trap_grSstOrigin
-#define grSstSelect trap_grSstSelect
-
-/*
-** Glide configuration and special effect maintenance functions
-*/
-#define grAlphaBlendFunction trap_grAlphaBlendFunction
-#define grAlphaCombine trap_grAlphaCombine
-#define grAlphaControlsITRGBLighting trap_grAlphaControlsITRGBLighting
-#define grAlphaTestFunction trap_grAlphaTestFunction
-#define grAlphaTestReferenceValue trap_grAlphaTestReferenceValue
-#define grChromakeyMode trap_grChromakeyMode
-#define grChromakeyValue trap_grChromakeyValue
-#define grClipWindow trap_grClipWindow
-#define grColorCombine trap_grColorCombine
-#define grColorMask trap_grColorMask
-#define grCullMode trap_grCullMode
-#define grConstantColorValue trap_grConstantColorValue
-#define grDepthBiasLevel trap_grDepthBiasLevel
-#define grDepthBufferFunction trap_grDepthBufferFunction
-#define grDepthBufferMode trap_grDepthBufferMode
-#define grDepthMask trap_grDepthMask
-#define grDisableAllEffects trap_grDisableAllEffects
-#define grDitherMode trap_grDitherMode
-#define grFogColorValue trap_grFogColorValue
-#define grFogMode trap_grFogMode
-#define grFogTable trap_grFogTable
-#define grLoadGammaTable trap_grLoadGammaTable
-#define grSplash trap_grSplash
-#define grGet trap_grGet
-#define grGetString trap_grGetString
-#define grQueryResolutions trap_grQueryResolutions
-#define grReset trap_grReset
-#define grGetProcAddress trap_grGetProcAddress
-#define grEnable trap_grEnable
-#define grDisable trap_grDisable
-#define grCoordinateSpace trap_grCoordinateSpace
-#define grDepthRange trap_grDepthRange
-#define grStippleMode trap_grStippleMode
-#define grStipplePattern trap_grStipplePattern
-#define grViewport trap_grViewport
-
-/*
-** texture mapping control functions
-*/
-#define grTexCalcMemRequired trap_grTexCalcMemRequired
-#define grTexTextureMemRequired trap_grTexTextureMemRequired
-#define grTexMinAddress trap_grTexMinAddress
-#define grTexMaxAddress trap_grTexMaxAddress
-#define grTexNCCTable trap_grTexNCCTable
-#define grTexSource trap_grTexSource
-#define grTexClampMode trap_grTexClampMode
-#define grTexCombine trap_grTexCombine
-#define grTexDetailControl trap_grTexDetailControl
-#define grTexFilterMode trap_grTexFilterMode
-#define grTexLodBiasValue trap_grTexLodBiasValue
-#define grTexDownloadMipMap trap_grTexDownloadMipMap
-#define grTexDownloadMipMapLevel trap_grTexDownloadMipMapLevel
-#define grTexDownloadMipMapLevelPartial trap_grTexDownloadMipMapLevelPartial
-#define grTexDownloadTable trap_grTexDownloadTable
-#define grTexDownloadTablePartial trap_grTexDownloadTablePartial
-#define grTexMipMapMode trap_grTexMipMapMode
-#define grTexMultibase trap_grTexMultibase
-#define grTexMultibaseAddress trap_grTexMultibaseAddress
-
-/*
-** linear frame buffer functions
-*/
-#define grLfbLock trap_grLfbLock
-#define grLfbUnlock trap_grLfbUnlock
-#define grLfbConstantAlpha trap_grLfbConstantAlpha
-#define grLfbConstantDepth trap_grLfbConstantDepth
-#define grLfbWriteColorSwizzle trap_grLfbWriteColorSwizzle
-#define grLfbWriteColorFormat trap_grLfbWriteColorFormat
-#define grLfbWriteRegion trap_grLfbWriteRegion
-#define grLfbReadRegion trap_grLfbReadRegion
-
-/*
-** glide management functions
-*/
-#define grGlideInit trap_grGlideInit
-#define grGlideShutdown trap_grGlideShutdown
-#define grGlideGetState trap_grGlideGetState
-#define grGlideSetState trap_grGlideSetState
-#define grGlideGetVertexLayout trap_grGlideGetVertexLayout
-#define grGlideSetVertexLayout trap_grGlideSetVertexLayout
-
-/*
-** glide utility functions
-*/
-#define guGammaCorrectionRGB trap_guGammaCorrectionRGB
-#define guFogTableIndexToW trap_guFogTableIndexToW
-#define guFogGenerateExp trap_guFogGenerateExp
-#define guFogGenerateExp2 trap_guFogGenerateExp2
-#define guFogGenerateLinear trap_guFogGenerateLinear
-#endif /* FX_TRAP_GLIDE_internal */
-#endif /* FX_TRAP_GLIDE */
-
-
-
-/* <texus.h> */
-#define TX_MAX_LEVEL 16
-typedef struct _TxMip {
- int format;
- int width;
- int height;
- int depth;
- int size;
- void *data[TX_MAX_LEVEL];
- FxU32 pal[256];
-} TxMip;
-
-#define TX_DITHER_NONE 0x00000000
-#define TX_DITHER_4x4 0x00000001
-#define TX_DITHER_ERR 0x00000002
-
-#define TX_COMPRESSION_STATISTICAL 0x00000000
-#define TX_COMPRESSION_HEURISTIC 0x00000010
-/* <texus.h> */
-
-
-
-struct tdfx_glide {
- /*
- ** glide extensions
- */
- void (FX_CALL *grSetNumPendingBuffers) (FxI32 NumPendingBuffers);
- char * (FX_CALL *grGetRegistryOrEnvironmentStringExt) (char *theEntry);
- void (FX_CALL *grGetGammaTableExt) (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
- void (FX_CALL *grChromaRangeModeExt) (GrChromakeyMode_t mode);
- void (FX_CALL *grChromaRangeExt) (GrColor_t color, GrColor_t range, GrChromaRangeMode_t match_mode);
- void (FX_CALL *grTexChromaModeExt) (GrChipID_t tmu, GrChromakeyMode_t mode);
- void (FX_CALL *grTexChromaRangeExt) (GrChipID_t tmu, GrColor_t min, GrColor_t max, GrTexChromakeyMode_t mode);
-
- /* pointcast */
- void (FX_CALL *grTexDownloadTableExt) (GrChipID_t tmu, GrTexTable_t type, void *data);
- void (FX_CALL *grTexDownloadTablePartialExt) (GrChipID_t tmu, GrTexTable_t type, void *data, int start, int end);
- void (FX_CALL *grTexNCCTableExt) (GrChipID_t tmu, GrNCCTable_t table);
-
- /* tbext */
- void (FX_CALL *grTextureBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
- void (FX_CALL *grTextureAuxBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
- void (FX_CALL *grAuxBufferExt) (GrBuffer_t buffer);
-
- /* napalm */
- GrContext_t (FX_CALL *grSstWinOpenExt) (FxU32 hWnd, GrScreenResolution_t resolution, GrScreenRefresh_t refresh, GrColorFormat_t format, GrOriginLocation_t origin, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers);
- void (FX_CALL *grStencilFuncExt) (GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask);
- void (FX_CALL *grStencilMaskExt) (GrStencil_t value);
- void (FX_CALL *grStencilOpExt) (GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass);
- void (FX_CALL *grLfbConstantStencilExt) (GrStencil_t value);
- void (FX_CALL *grBufferClearExt) (GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil);
- void (FX_CALL *grColorCombineExt) (GrCCUColor_t a, GrCombineMode_t a_mode, GrCCUColor_t b, GrCombineMode_t b_mode, GrCCUColor_t c, FxBool c_invert, GrCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
- void (FX_CALL *grAlphaCombineExt) (GrACUColor_t a, GrCombineMode_t a_mode, GrACUColor_t b, GrCombineMode_t b_mode, GrACUColor_t c, FxBool c_invert, GrACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
- void (FX_CALL *grTexColorCombineExt) (GrChipID_t tmu, GrTCCUColor_t a, GrCombineMode_t a_mode, GrTCCUColor_t b, GrCombineMode_t b_mode, GrTCCUColor_t c, FxBool c_invert, GrTCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
- void (FX_CALL *grTexAlphaCombineExt) (GrChipID_t tmu, GrTACUColor_t a, GrCombineMode_t a_mode, GrTACUColor_t b, GrCombineMode_t b_mode, GrTACUColor_t c, FxBool c_invert, GrTACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
- void (FX_CALL *grConstantColorValueExt) (GrChipID_t tmu, GrColor_t value);
- void (FX_CALL *grColorMaskExt) (FxBool r, FxBool g, FxBool b, FxBool a);
- void (FX_CALL *grAlphaBlendFunctionExt) (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendOp_t rgb_op, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df, GrAlphaBlendOp_t alpha_op);
- void (FX_CALL *grTBufferWriteMaskExt) (FxU32 tmask);
-
- /*
- ** Texus2 functions
- */
- void (FX_CALL *txImgQuantize) (char *dst, char *src, int w, int h, FxU32 format, FxU32 dither);
- void (FX_CALL *txMipQuantize) (TxMip *pxMip, TxMip *txMip, int fmt, FxU32 d, FxU32 comp);
- void (FX_CALL *txPalToNcc) (GuNccTable *ncc_table, const FxU32 *pal);
-};
-
-void tdfx_hook_glide (struct tdfx_glide *Glide, int pointcast);
-
-#endif
diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c
deleted file mode 100644
index 1fedf2ab969..00000000000
--- a/src/mesa/drivers/glide/fxglidew.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
-
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#if defined(FX)
-#include "fxglidew.h"
-#include "fxdrv.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-FxI32
-FX_grGetInteger_NoLock(FxU32 pname)
-{
- FxI32 result;
-
- if (grGet(pname, 4, &result)) {
- return result;
- }
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "FX_grGetInteger_NoLock: wrong parameter (%lx)\n", pname);
- }
- return -1;
-}
-
-FxBool
-FX_grSstControl(FxU32 code)
-{
- /* The glide 3 sources call for grEnable/grDisable to be called in exchange
- * for grSstControl. */
- switch (code) {
- case GR_CONTROL_ACTIVATE:
- grEnable(GR_PASSTHRU);
- break;
- case GR_CONTROL_DEACTIVATE:
- grDisable(GR_PASSTHRU);
- break;
- }
- /* Appearently GR_CONTROL_RESIZE can be ignored. */
- return 1; /* OK? */
-}
-
-
-int
-FX_grSstScreenWidth()
-{
- FxI32 result[4];
-
- BEGIN_BOARD_LOCK();
- grGet(GR_VIEWPORT, sizeof(FxI32) * 4, result);
- END_BOARD_LOCK();
-
- return result[2];
-}
-
-int
-FX_grSstScreenHeight()
-{
- FxI32 result[4];
-
- BEGIN_BOARD_LOCK();
- grGet(GR_VIEWPORT, sizeof(FxI32) * 4, result);
- END_BOARD_LOCK();
-
- return result[3];
-}
-
-void
-FX_grSstPerfStats(GrSstPerfStats_t * st)
-{
- FxI32 n;
- grGet(GR_STATS_PIXELS_IN, 4, &n);
- st->pixelsIn = n;
- grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n);
- st->chromaFail = n;
- grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n);
- st->zFuncFail = n;
- grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n);
- st->aFuncFail = n;
- grGet(GR_STATS_PIXELS_OUT, 4, &n);
- st->pixelsOut = n;
-}
-
-void
-FX_setupGrVertexLayout(void)
-{
- BEGIN_BOARD_LOCK();
- grReset(GR_VERTEX_PARAMETER);
-
- grCoordinateSpace(GR_WINDOW_COORDS);
- grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
-#if FX_PACKEDCOLOR
- grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
-#else /* !FX_PACKEDCOLOR */
- grVertexLayout(GR_PARAM_RGB, GR_VERTEX_RGB_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
-#endif /* !FX_PACKEDCOLOR */
- grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2,
- GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
- GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
- END_BOARD_LOCK();
-}
-
-void
-FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask)
-{
- switch (hintType) {
- case GR_HINT_STWHINT:
- {
- if (hintMask & GR_STWHINT_W_DIFF_TMU0)
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
- GR_PARAM_ENABLE);
- else
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
- GR_PARAM_DISABLE);
-
- if (hintMask & GR_STWHINT_ST_DIFF_TMU1)
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
- GR_PARAM_ENABLE);
- else
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
-
- if (hintMask & GR_STWHINT_W_DIFF_TMU1)
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
- GR_PARAM_ENABLE);
- else
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
-
- }
- }
-}
-
-/*
- * Glide3 doesn't have the grSstQueryHardware function anymore.
- * Instead, we call grGet() and fill in the data structures ourselves.
- */
-int
-FX_grSstQueryHardware(GrHwConfiguration * config)
-{
- int i, j;
- int numFB;
-
- BEGIN_BOARD_LOCK();
-
- grGet(GR_NUM_BOARDS, 4, (void *) &(config->num_sst));
- if (config->num_sst == 0)
- return 0;
-
- for (i = 0; i < config->num_sst; i++) {
- FxI32 result;
- const char *extension;
-
- grSstSelect(i);
-
- extension = grGetString(GR_HARDWARE);
- if (strstr(extension, "Rush")) {
- config->SSTs[i].type = GR_SSTTYPE_SST96;
- } else if (strstr(extension, "Voodoo2")) {
- config->SSTs[i].type = GR_SSTTYPE_Voodoo2;
- } else if (strstr(extension, "Voodoo Banshee")) {
- config->SSTs[i].type = GR_SSTTYPE_Banshee;
- } else if (strstr(extension, "Voodoo3")) {
- config->SSTs[i].type = GR_SSTTYPE_Voodoo3;
- } else if (strstr(extension, "Voodoo4")) {
- config->SSTs[i].type = GR_SSTTYPE_Voodoo4;
- } else if (strstr(extension, "Voodoo5")) {
- config->SSTs[i].type = GR_SSTTYPE_Voodoo5;
- } else {
- config->SSTs[i].type = GR_SSTTYPE_VOODOO;
- }
-
- grGet(GR_MEMORY_FB, 4, &result);
- config->SSTs[i].fbRam = result / (1024 * 1024);
-
- grGet(GR_NUM_TMU, 4, &result);
- config->SSTs[i].nTexelfx = result;
-
- grGet(GR_REVISION_FB, 4, &result);
- config->SSTs[i].fbiRev = result;
-
- for (j = 0; j < config->SSTs[i].nTexelfx; j++) {
- grGet(GR_MEMORY_TMU, 4, &result);
- config->SSTs[i].tmuConfig[j].tmuRam = result / (1024 * 1024);
- grGet(GR_REVISION_TMU, 4, &result);
- config->SSTs[i].tmuConfig[j].tmuRev = result;
- }
-
- extension = grGetString(GR_EXTENSION);
- config->SSTs[i].HavePalExt = (strstr(extension, " PALETTE6666 ") != NULL);
- config->SSTs[i].HavePixExt = (strstr(extension, " PIXEXT ") != NULL);
- config->SSTs[i].HaveTexFmt = (strstr(extension, " TEXFMT ") != NULL);
- config->SSTs[i].HaveCmbExt = (strstr(extension, " COMBINE ") != NULL);
- config->SSTs[i].HaveMirExt = (strstr(extension, " TEXMIRROR ") != NULL);
- config->SSTs[i].HaveTexUma = (strstr(extension, " TEXUMA ") != NULL);
-
- /* number of Voodoo chips */
- grGet(GR_NUM_FB, 4, (void *) &numFB);
- config->SSTs[i].numChips = numFB;
-
- }
-
- tdfx_hook_glide(&config->Glide, getenv("MESA_FX_POINTCAST") != NULL);
-
- END_BOARD_LOCK();
- return 1;
-}
-
-
-
-#else
-
-/*
- * Need this to provide at least one external definition.
- */
-
-extern int gl_fx_dummy_function_glidew(void);
-int
-gl_fx_dummy_function_glidew(void)
-{
- return 0;
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxglidew.h b/src/mesa/drivers/glide/fxglidew.h
deleted file mode 100644
index a19d0b58c73..00000000000
--- a/src/mesa/drivers/glide/fxglidew.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-
-#ifndef __FX_GLIDE_WARPER__
-#define __FX_GLIDE_WARPER__
-
-
-#include "fxg.h"
-
-#ifndef FX_PACKEDCOLOR
-#define FX_PACKEDCOLOR 1
-#endif
-
-#define MAX_NUM_SST 4
-
-enum {
- GR_SSTTYPE_VOODOO = 0,
- GR_SSTTYPE_SST96 = 1,
- GR_SSTTYPE_AT3D = 2,
- GR_SSTTYPE_Voodoo2 = 3,
- GR_SSTTYPE_Banshee = 4,
- GR_SSTTYPE_Voodoo3 = 5,
- GR_SSTTYPE_Voodoo4 = 6,
- GR_SSTTYPE_Voodoo5 = 7
-};
-
-#define GrState void
-
-typedef int GrSstType;
-
-typedef struct GrTMUConfig_St {
- int tmuRev; /* Rev of Texelfx chip */
- int tmuRam; /* 1, 2, or 4 MB */
-} GrTMUConfig_t;
-
-typedef struct {
- int num_sst; /* # of HW units in the system */
- struct SstCard_St {
- GrSstType type; /* Which hardware is it? */
- int fbRam; /* 1, 2, or 4 MB */
- int fbiRev; /* Rev of Pixelfx chip */
- int nTexelfx; /* How many texelFX chips are there? */
- int numChips; /* Number of Voodoo chips */
- GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
- /* Glide3 extensions */
- FxBool HavePalExt; /* PALETTE6666 */
- FxBool HavePixExt; /* PIXEXT */
- FxBool HaveTexFmt; /* TEXFMT */
- FxBool HaveCmbExt; /* COMBINE */
- FxBool HaveMirExt; /* TEXMIRROR */
- FxBool HaveTexUma; /* TEXUMA */
- }
- SSTs[MAX_NUM_SST]; /* configuration for each board */
- struct tdfx_glide Glide;
-} GrHwConfiguration;
-
-
-
-typedef FxU32 GrHint_t;
-#define GR_HINTTYPE_MIN 0
-#define GR_HINT_STWHINT 0
-
-typedef FxU32 GrSTWHint_t;
-#define GR_STWHINT_W_DIFF_FBI FXBIT(0)
-#define GR_STWHINT_W_DIFF_TMU0 FXBIT(1)
-#define GR_STWHINT_ST_DIFF_TMU0 FXBIT(2)
-#define GR_STWHINT_W_DIFF_TMU1 FXBIT(3)
-#define GR_STWHINT_ST_DIFF_TMU1 FXBIT(4)
-#define GR_STWHINT_W_DIFF_TMU2 FXBIT(5)
-#define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6)
-
-#define GR_CONTROL_ACTIVATE 1
-#define GR_CONTROL_DEACTIVATE 0
-
-
-
-/*
-** move the vertex layout defintion to application
-*/
-typedef struct {
- float sow; /* s texture ordinate (s over w) */
- float tow; /* t texture ordinate (t over w) */
- float oow; /* 1/w (used mipmapping - really 0xfff/w) */
-} GrTmuVertex;
-
-#if FX_PACKEDCOLOR
-typedef struct {
- float x, y; /* X and Y in screen space */
- float ooz; /* 65535/Z (used for Z-buffering) */
- float oow; /* 1/W (used for W-buffering, texturing) */
- unsigned char pargb[4]; /* B, G, R, A [0..255] */
- GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
- float fog; /* fog coordinate */
- unsigned char pspec[4]; /* B, G, R, A [0..255] */
- float psize; /* point size */
- long pad[16 - 14]; /* ensure 64b structure */
-} GrVertex;
-
-#define GR_VERTEX_X_OFFSET 0
-#define GR_VERTEX_Y_OFFSET 1
-#define GR_VERTEX_OOZ_OFFSET 2
-#define GR_VERTEX_OOW_OFFSET 3
-#define GR_VERTEX_PARGB_OFFSET 4
-#define GR_VERTEX_SOW_TMU0_OFFSET 5
-#define GR_VERTEX_TOW_TMU0_OFFSET 6
-#define GR_VERTEX_OOW_TMU0_OFFSET 7
-#define GR_VERTEX_SOW_TMU1_OFFSET 8
-#define GR_VERTEX_TOW_TMU1_OFFSET 9
-#define GR_VERTEX_OOW_TMU1_OFFSET 10
-#define GR_VERTEX_FOG_OFFSET 11
-#define GR_VERTEX_PSPEC_OFFSET 12
-#else /* !FX_PACKEDCOLOR */
-typedef struct {
- float x, y; /* X and Y in screen space */
- float ooz; /* 65535/Z (used for Z-buffering) */
- float oow; /* 1/W (used for W-buffering, texturing) */
- float r, g, b, a; /* R, G, B, A [0..255] */
- GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
- float fog; /* fog coordinate */
- float r1, g1, b1; /* R, G, B [0..255] */
- float psize; /* point size */
- long pad[20 - 19]; /* ensure multiple of 16 */
-} GrVertex;
-
-#define GR_VERTEX_X_OFFSET 0
-#define GR_VERTEX_Y_OFFSET 1
-#define GR_VERTEX_OOZ_OFFSET 2
-#define GR_VERTEX_OOW_OFFSET 3
-#define GR_VERTEX_RGB_OFFSET 4
-#define GR_VERTEX_A_OFFSET 7
-#define GR_VERTEX_SOW_TMU0_OFFSET 8
-#define GR_VERTEX_TOW_TMU0_OFFSET 9
-#define GR_VERTEX_OOW_TMU0_OFFSET 10
-#define GR_VERTEX_SOW_TMU1_OFFSET 11
-#define GR_VERTEX_TOW_TMU1_OFFSET 12
-#define GR_VERTEX_OOW_TMU1_OFFSET 13
-#define GR_VERTEX_FOG_OFFSET 14
-#define GR_VERTEX_SPEC_OFFSET 15
-#endif /* !FX_PACKEDCOLOR */
-
-
-
-/*
- * For Lod/LodLog2 conversion.
- */
-#define FX_largeLodLog2(info) (info).largeLodLog2
-#define FX_aspectRatioLog2(info) (info).aspectRatioLog2
-#define FX_smallLodLog2(info) (info).smallLodLog2
-#define FX_lodToValue(val) ((int)(GR_LOD_LOG2_256-val))
-#define FX_largeLodValue(info) ((int)(GR_LOD_LOG2_256-(info).largeLodLog2))
-#define FX_smallLodValue(info) ((int)(GR_LOD_LOG2_256-(info).smallLodLog2))
-#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_LOG2_256-val))
-
-
-
-/*
- * Query
- */
-extern int FX_grSstScreenWidth(void);
-extern int FX_grSstScreenHeight(void);
-extern void FX_grSstPerfStats(GrSstPerfStats_t *st);
-extern int FX_grSstQueryHardware(GrHwConfiguration *config);
-#define FX_grGetInteger FX_grGetInteger_NoLock
-extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
-
-
-
-/*
- * GrHints
- */
-#define FX_grHints FX_grHints_NoLock
-extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
-
-
-
-/*
- * Needed for Glide3 only, to set up Glide2 compatible vertex layout.
- */
-extern void FX_setupGrVertexLayout(void);
-
-
-
-/*
- * grSstControl stuff
- */
-extern FxBool FX_grSstControl(FxU32 code);
-
-#define FX_grBufferClear(c, a, d) \
- do { \
- BEGIN_CLIP_LOOP(); \
- grBufferClear(c, a, d); \
- END_CLIP_LOOP(); \
- } while (0)
-
-
-
-#endif /* __FX_GLIDE_WARPER__ */
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
deleted file mode 100644
index 9bf37967cd7..00000000000
--- a/src/mesa/drivers/glide/fxsetup.c
+++ /dev/null
@@ -1,2220 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
-
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#if defined(FX)
-
-#include "fxdrv.h"
-#include "main/enums.h"
-#include "main/formats.h"
-#include "main/texstore.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "swrast/swrast.h"
-
-
-static void
-fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
-{
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- GLint minl, maxl;
-
- if (ti->validated) {
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxTexValidate(NOP)\n");
- }
- return;
- }
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxTexValidate(%p (%d))\n", (void *)tObj, tObj->Name);
- }
-
- ti->tObj = tObj;
- minl = ti->minLevel = tObj->BaseLevel;
- maxl = ti->maxLevel = MIN2(tObj->MaxLevel, tObj->Image[0][0]->MaxLog2);
-
-#if FX_RESCALE_BIG_TEXURES_HACK
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- /* [dBorca]
- * Fake textures larger than HW supports:
- * 1) we have mipmaps. Then we just push up to the first supported
- * LOD. A possible drawback is that Mesa will ignore the skipped
- * LODs on further texture handling.
- * Will this interfere with GL_TEXTURE_[MIN|BASE]_LEVEL? How?
- * 2) we don't have mipmaps. We need to rescale the big LOD in place.
- * The above approach is somehow dumb! we might have rescaled
- * once in TexImage2D to accomodate aspect ratio, and now we
- * are rescaling again. The thing is, in TexImage2D we don't
- * know whether we'll hit 1) or 2) by the time of validation.
- */
- if ((tObj->MinFilter == GL_NEAREST) || (tObj->MinFilter == GL_LINEAR)) {
- /* no mipmaps! */
- struct gl_texture_image *texImage = tObj->Image[0][minl];
- tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- GLint _w, _h, maxSize = 1 << fxMesa->textureMaxLod;
- if ((mml->width > maxSize) || (mml->height > maxSize)) {
- /* need to rescale */
- GLint texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
- GLvoid *texImage_Data = texImage->Data;
- _w = MIN2(texImage->Width, maxSize);
- _h = MIN2(texImage->Height, maxSize);
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxTexValidate: rescaling %d x %d -> %d x %d\n",
- texImage->Width, texImage->Height, _w, _h);
- }
- /* we should leave these as is and... (!) */
- texImage->Width = _w;
- texImage->Height = _h;
- fxTexGetInfo(_w, _h, NULL, NULL, NULL, NULL,
- &(mml->wScale), &(mml->hScale));
- _w *= mml->wScale;
- _h *= mml->hScale;
- texImage->Data = _mesa_malloc(_w * _h * texelBytes);
- _mesa_rescale_teximage2d(texelBytes,
- mml->width,
- _w * texelBytes, /* dst stride */
- mml->width, mml->height, /* src */
- _w, _h, /* dst */
- texImage_Data /*src*/, texImage->Data /*dst*/ );
- _mesa_free(texImage_Data);
- mml->width = _w;
- mml->height = _h;
- /* (!) ... and set mml->wScale = _w / texImage->Width */
- }
- } else {
- /* mipmapping */
- if (maxl - minl > fxMesa->textureMaxLod) {
- /* skip a certain number of LODs */
- minl += maxl - fxMesa->textureMaxLod;
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxTexValidate: skipping %d LODs\n", minl - ti->minLevel);
- }
- ti->minLevel = tObj->BaseLevel = minl;
- }
- }
-}
-#endif
-
- fxTexGetInfo(tObj->Image[0][minl]->Width, tObj->Image[0][minl]->Height,
- &(FX_largeLodLog2(ti->info)), &(FX_aspectRatioLog2(ti->info)),
- &(ti->sScale), &(ti->tScale),
- NULL, NULL);
-
- if ((tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR))
- fxTexGetInfo(tObj->Image[0][maxl]->Width, tObj->Image[0][maxl]->Height,
- &(FX_smallLodLog2(ti->info)), NULL,
- NULL, NULL, NULL, NULL);
- else
- FX_smallLodLog2(ti->info) = FX_largeLodLog2(ti->info);
-
- /* [dBorca] this is necessary because of fxDDCompressedTexImage2D */
- if (ti->padded) {
- struct gl_texture_image *texImage = tObj->Image[0][minl];
- tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
- if (mml->wScale != 1 || mml->hScale != 1) {
- ti->sScale /= mml->wScale;
- ti->tScale /= mml->hScale;
- }
- }
-
- ti->baseLevelInternalFormat = tObj->Image[0][minl]->Format;
-
- ti->validated = GL_TRUE;
-
- ti->info.data = NULL;
-}
-
-static void
-fxPrintUnitsMode(const char *msg, GLuint mode)
-{
- fprintf(stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
- msg,
- mode,
- (mode & FX_UM_E0_REPLACE) ? "E0_REPLACE, " : "",
- (mode & FX_UM_E0_MODULATE) ? "E0_MODULATE, " : "",
- (mode & FX_UM_E0_DECAL) ? "E0_DECAL, " : "",
- (mode & FX_UM_E0_BLEND) ? "E0_BLEND, " : "",
- (mode & FX_UM_E1_REPLACE) ? "E1_REPLACE, " : "",
- (mode & FX_UM_E1_MODULATE) ? "E1_MODULATE, " : "",
- (mode & FX_UM_E1_DECAL) ? "E1_DECAL, " : "",
- (mode & FX_UM_E1_BLEND) ? "E1_BLEND, " : "",
- (mode & FX_UM_E0_ALPHA) ? "E0_ALPHA, " : "",
- (mode & FX_UM_E0_LUMINANCE) ? "E0_LUMINANCE, " : "",
- (mode & FX_UM_E0_LUMINANCE_ALPHA) ? "E0_LUMINANCE_ALPHA, " : "",
- (mode & FX_UM_E0_INTENSITY) ? "E0_INTENSITY, " : "",
- (mode & FX_UM_E0_RGB) ? "E0_RGB, " : "",
- (mode & FX_UM_E0_RGBA) ? "E0_RGBA, " : "",
- (mode & FX_UM_E1_ALPHA) ? "E1_ALPHA, " : "",
- (mode & FX_UM_E1_LUMINANCE) ? "E1_LUMINANCE, " : "",
- (mode & FX_UM_E1_LUMINANCE_ALPHA) ? "E1_LUMINANCE_ALPHA, " : "",
- (mode & FX_UM_E1_INTENSITY) ? "E1_INTENSITY, " : "",
- (mode & FX_UM_E1_RGB) ? "E1_RGB, " : "",
- (mode & FX_UM_E1_RGBA) ? "E1_RGBA, " : "",
- (mode & FX_UM_COLOR_ITERATED) ? "COLOR_ITERATED, " : "",
- (mode & FX_UM_COLOR_CONSTANT) ? "COLOR_CONSTANT, " : "",
- (mode & FX_UM_ALPHA_ITERATED) ? "ALPHA_ITERATED, " : "",
- (mode & FX_UM_ALPHA_CONSTANT) ? "ALPHA_CONSTANT, " : "");
-}
-
-static GLuint
-fxGetTexSetConfiguration(GLcontext * ctx,
- struct gl_texture_object *tObj0,
- struct gl_texture_object *tObj1)
-{
- GLuint unitsmode = 0;
- GLuint envmode = 0;
- GLuint ifmt = 0;
-
- if ((ctx->Light.ShadeModel == GL_SMOOTH) || 1 ||
- (ctx->Point.SmoothFlag) ||
- (ctx->Line.SmoothFlag) ||
- (ctx->Polygon.SmoothFlag)) unitsmode |= FX_UM_ALPHA_ITERATED;
- else
- unitsmode |= FX_UM_ALPHA_CONSTANT;
-
- if (ctx->Light.ShadeModel == GL_SMOOTH || 1)
- unitsmode |= FX_UM_COLOR_ITERATED;
- else
- unitsmode |= FX_UM_COLOR_CONSTANT;
-
-
-
- /*
- OpenGL Feeds Texture 0 into Texture 1
- Glide Feeds Texture 1 into Texture 0
- */
- if (tObj0) {
- tfxTexInfo *ti0 = fxTMGetTexInfo(tObj0);
-
- switch (ti0->baseLevelInternalFormat) {
- case GL_ALPHA:
- ifmt |= FX_UM_E0_ALPHA;
- break;
- case GL_LUMINANCE:
- ifmt |= FX_UM_E0_LUMINANCE;
- break;
- case GL_LUMINANCE_ALPHA:
- ifmt |= FX_UM_E0_LUMINANCE_ALPHA;
- break;
- case GL_INTENSITY:
- ifmt |= FX_UM_E0_INTENSITY;
- break;
- case GL_RGB:
- ifmt |= FX_UM_E0_RGB;
- break;
- case GL_RGBA:
- ifmt |= FX_UM_E0_RGBA;
- break;
- }
-
- switch (ctx->Texture.Unit[0].EnvMode) {
- case GL_DECAL:
- envmode |= FX_UM_E0_DECAL;
- break;
- case GL_MODULATE:
- envmode |= FX_UM_E0_MODULATE;
- break;
- case GL_REPLACE:
- envmode |= FX_UM_E0_REPLACE;
- break;
- case GL_BLEND:
- envmode |= FX_UM_E0_BLEND;
- break;
- case GL_ADD:
- envmode |= FX_UM_E0_ADD;
- break;
- default:
- /* do nothing */
- break;
- }
- }
-
- if (tObj1) {
- tfxTexInfo *ti1 = fxTMGetTexInfo(tObj1);
-
- switch (ti1->baseLevelInternalFormat) {
- case GL_ALPHA:
- ifmt |= FX_UM_E1_ALPHA;
- break;
- case GL_LUMINANCE:
- ifmt |= FX_UM_E1_LUMINANCE;
- break;
- case GL_LUMINANCE_ALPHA:
- ifmt |= FX_UM_E1_LUMINANCE_ALPHA;
- break;
- case GL_INTENSITY:
- ifmt |= FX_UM_E1_INTENSITY;
- break;
- case GL_RGB:
- ifmt |= FX_UM_E1_RGB;
- break;
- case GL_RGBA:
- ifmt |= FX_UM_E1_RGBA;
- break;
- default:
- /* do nothing */
- break;
- }
-
- switch (ctx->Texture.Unit[1].EnvMode) {
- case GL_DECAL:
- envmode |= FX_UM_E1_DECAL;
- break;
- case GL_MODULATE:
- envmode |= FX_UM_E1_MODULATE;
- break;
- case GL_REPLACE:
- envmode |= FX_UM_E1_REPLACE;
- break;
- case GL_BLEND:
- envmode |= FX_UM_E1_BLEND;
- break;
- case GL_ADD:
- envmode |= FX_UM_E1_ADD;
- break;
- default:
- /* do nothing */
- break;
- }
- }
-
- unitsmode |= (ifmt | envmode);
-
- if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fxPrintUnitsMode("fxGetTexSetConfiguration", unitsmode);
-
- return unitsmode;
-}
-
-/************************************************************************/
-/************************* Rendering Mode SetUp *************************/
-/************************************************************************/
-
-/************************* Single Texture Set ***************************/
-
-static void
-fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
-{
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- int tmu;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupSingleTMU_NoLock(%p (%d))\n", (void *)tObj, tObj->Name);
- }
-
- ti->lastTimeUsed = fxMesa->texBindNumber;
-
- /* Make sure we're not loaded incorrectly */
- if (ti->isInTM) {
- if (ti->LODblend) {
- if (ti->whichTMU != FX_TMU_SPLIT)
- fxTMMoveOutTM(fxMesa, tObj);
- }
- else {
- if (ti->whichTMU == FX_TMU_SPLIT)
- fxTMMoveOutTM(fxMesa, tObj);
- }
- }
-
- /* Make sure we're loaded correctly */
- if (!ti->isInTM) {
- if (ti->LODblend)
- fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU_SPLIT);
- else {
- if (fxMesa->haveTwoTMUs) {
- if (fxTMCheckStartAddr(fxMesa, FX_TMU0, ti)) {
- fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0);
- }
- else {
- fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU1);
- }
- }
- else
- fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0);
- }
- }
-
- if (ti->LODblend && ti->whichTMU == FX_TMU_SPLIT) {
- /* broadcast */
- if ((ti->info.format == GR_TEXFMT_P_8)
- && (!fxMesa->haveGlobalPaletteTexture)) {
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupSingleTMU_NoLock: uploading texture palette\n");
- }
- grTexDownloadTable(ti->paltype, &(ti->palette));
- }
-
- grTexClampMode(GR_TMU0, ti->sClamp, ti->tClamp);
- grTexClampMode(GR_TMU1, ti->sClamp, ti->tClamp);
- grTexFilterMode(GR_TMU0, ti->minFilt, ti->maxFilt);
- grTexFilterMode(GR_TMU1, ti->minFilt, ti->maxFilt);
- grTexMipMapMode(GR_TMU0, ti->mmMode, ti->LODblend);
- grTexMipMapMode(GR_TMU1, ti->mmMode, ti->LODblend);
-
- grTexSource(GR_TMU0, ti->tm[FX_TMU0]->startAddr,
- GR_MIPMAPLEVELMASK_ODD, &(ti->info));
- grTexSource(GR_TMU1, ti->tm[FX_TMU1]->startAddr,
- GR_MIPMAPLEVELMASK_EVEN, &(ti->info));
- }
- else {
- if (ti->whichTMU == FX_TMU_BOTH)
- tmu = FX_TMU0;
- else
- tmu = ti->whichTMU;
-
- /* pointcast */
- if ((ti->info.format == GR_TEXFMT_P_8)
- && (!fxMesa->haveGlobalPaletteTexture)) {
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupSingleTMU_NoLock: uploading texture palette\n");
- }
- fxMesa->Glide.grTexDownloadTableExt(tmu, ti->paltype, &(ti->palette));
- }
-
- /* KW: The alternative is to do the download to the other tmu. If
- * we get to this point, I think it means we are thrashing the
- * texture memory, so perhaps it's not a good idea.
- */
- if (ti->LODblend && (TDFX_DEBUG & VERBOSE_DRIVER)) {
- fprintf(stderr, "fxSetupSingleTMU_NoLock: not blending texture - only one tmu\n");
- }
-
- grTexClampMode(tmu, ti->sClamp, ti->tClamp);
- grTexFilterMode(tmu, ti->minFilt, ti->maxFilt);
- grTexMipMapMode(tmu, ti->mmMode, FXFALSE);
-
- grTexSource(tmu, ti->tm[tmu]->startAddr, GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
- }
-}
-
-static void
-fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
-{
- struct tdfx_texcombine tex0, tex1;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSelectSingleTMUSrc_NoLock(%d, %d)\n", tmu, LODblend);
- }
-
- tex0.InvertRGB = FXFALSE;
- tex0.InvertAlpha = FXFALSE;
- tex1.InvertRGB = FXFALSE;
- tex1.InvertAlpha = FXFALSE;
-
- if (LODblend) {
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND;
- tex0.FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION;
-
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
-
- fxMesa->tmuSrc = FX_TMU_SPLIT;
- }
- else {
- if (tmu != FX_TMU1) {
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex0.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_NONE;
-
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_ZERO;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
-
- fxMesa->tmuSrc = FX_TMU0;
- }
- else {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
-
- /* correct values to set TMU0 in passthrough mode */
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND;
- tex0.FactorRGB = GR_COMBINE_FACTOR_ONE;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE;
-
- fxMesa->tmuSrc = FX_TMU1;
- }
- }
-
- grTexCombine(GR_TMU0,
- tex0.FunctionRGB,
- tex0.FactorRGB,
- tex0.FunctionAlpha,
- tex0.FactorAlpha,
- tex0.InvertRGB,
- tex0.InvertAlpha);
- if (fxMesa->haveTwoTMUs) {
- grTexCombine(GR_TMU1,
- tex1.FunctionRGB,
- tex1.FactorRGB,
- tex1.FunctionAlpha,
- tex1.FactorAlpha,
- tex1.InvertRGB,
- tex1.InvertAlpha);
- }
-}
-
-static void
-fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- struct tdfx_combine alphaComb, colorComb;
- GrCombineLocal_t localc, locala;
- GLuint unitsmode;
- GLint ifmt;
- tfxTexInfo *ti;
- struct gl_texture_object *tObj = ctx->Texture.Unit[textureset]._Current;
- int tmu;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTextureSingleTMU_NoLock(%d)\n", textureset);
- }
-
- ti = fxTMGetTexInfo(tObj);
-
- fxTexValidate(ctx, tObj);
-
- fxSetupSingleTMU_NoLock(fxMesa, tObj);
-
- if (ti->whichTMU == FX_TMU_BOTH)
- tmu = FX_TMU0;
- else
- tmu = ti->whichTMU;
- if (fxMesa->tmuSrc != tmu)
- fxSelectSingleTMUSrc_NoLock(fxMesa, tmu, ti->LODblend);
-
- if (textureset == 0 || !fxMesa->haveTwoTMUs)
- unitsmode = fxGetTexSetConfiguration(ctx, tObj, NULL);
- else
- unitsmode = fxGetTexSetConfiguration(ctx, NULL, tObj);
-
-/* if(fxMesa->lastUnitsMode==unitsmode) */
-/* return; */
-
- fxMesa->lastUnitsMode = unitsmode;
-
- fxMesa->stw_hint_state = 0;
- FX_grHints_NoLock(GR_HINT_STWHINT, 0);
-
- ifmt = ti->baseLevelInternalFormat;
-
- if (unitsmode & FX_UM_ALPHA_ITERATED)
- locala = GR_COMBINE_LOCAL_ITERATED;
- else
- locala = GR_COMBINE_LOCAL_CONSTANT;
-
- if (unitsmode & FX_UM_COLOR_ITERATED)
- localc = GR_COMBINE_LOCAL_ITERATED;
- else
- localc = GR_COMBINE_LOCAL_CONSTANT;
-
- if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "fxSetupTextureSingleTMU_NoLock: envmode is %s\n",
- _mesa_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode));
-
- alphaComb.Local = locala;
- alphaComb.Invert = FXFALSE;
- colorComb.Local = localc;
- colorComb.Invert = FXFALSE;
-
- switch (ctx->Texture.Unit[textureset].EnvMode) {
- case GL_DECAL:
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
-
- colorComb.Function = GR_COMBINE_FUNCTION_BLEND;
- colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- break;
- case GL_MODULATE:
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
-
- if (ifmt == GL_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- } else {
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- }
- break;
- case GL_BLEND:
- if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) {
- /* Av = Af */
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- }
- else if (ifmt == GL_INTENSITY) {
- /* Av = Af * (1 - It) + Ac * It */
- alphaComb.Function = GR_COMBINE_FUNCTION_BLEND;
- alphaComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA;
- alphaComb.Other = GR_COMBINE_OTHER_CONSTANT;
- }
- else {
- /* Av = Af * At */
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- }
-
- if (ifmt == GL_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- } else {
- if (fxMesa->type >= GR_SSTTYPE_Voodoo2) {
- colorComb.Function = GR_COMBINE_FUNCTION_BLEND;
- colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_RGB;
- colorComb.Other = GR_COMBINE_OTHER_CONSTANT;
- } else if (ifmt == GL_INTENSITY) {
- /* just a hack: RGB == ALPHA */
- colorComb.Function = GR_COMBINE_FUNCTION_BLEND;
- colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA;
- colorComb.Other = GR_COMBINE_OTHER_CONSTANT;
- } else {
- /* Only Voodoo^2 can GL_BLEND (GR_COMBINE_FACTOR_TEXTURE_RGB)
- * These settings assume that the TexEnv color is black and
- * incoming fragment color is white.
- */
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXTRUE;
- _mesa_problem(NULL, "can't GL_BLEND with SST1");
- }
- }
-
- grConstantColorValue(
- (((GLuint)(ctx->Texture.Unit[textureset].EnvColor[0] * 255.0f)) ) |
- (((GLuint)(ctx->Texture.Unit[textureset].EnvColor[1] * 255.0f)) << 8) |
- (((GLuint)(ctx->Texture.Unit[textureset].EnvColor[2] * 255.0f)) << 16) |
- (((GLuint)(ctx->Texture.Unit[textureset].EnvColor[3] * 255.0f)) << 24));
- break;
- case GL_REPLACE:
- if ((ifmt == GL_RGB) || (ifmt == GL_LUMINANCE)) {
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- } else {
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_ONE;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- }
-
- if (ifmt == GL_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- } else {
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- }
- break;
- case GL_ADD:
- if (ifmt == GL_ALPHA ||
- ifmt == GL_LUMINANCE_ALPHA ||
- ifmt == GL_RGBA) {
- /* product of texel and fragment alpha */
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- }
- else if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) {
- /* fragment alpha is unchanged */
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- }
- else {
- /* sum of texel and fragment alpha */
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_ONE;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- }
-
- if (ifmt == GL_ALPHA) {
- /* rgb unchanged */
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- }
- else {
- /* sum of texel and fragment rgb */
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- }
- break;
- default:
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTextureSingleTMU_NoLock: %x Texture.EnvMode not yet supported\n",
- ctx->Texture.Unit[textureset].EnvMode);
- }
- return;
- }
-
- grAlphaCombine(alphaComb.Function,
- alphaComb.Factor,
- alphaComb.Local,
- alphaComb.Other,
- alphaComb.Invert);
- grColorCombine(colorComb.Function,
- colorComb.Factor,
- colorComb.Local,
- colorComb.Other,
- colorComb.Invert);
-}
-
-#if 00
-static void
-fxSetupTextureSingleTMU(GLcontext * ctx, GLuint textureset)
-{
- BEGIN_BOARD_LOCK();
- fxSetupTextureSingleTMU_NoLock(ctx, textureset);
- END_BOARD_LOCK();
-}
-#endif
-
-
-/************************* Double Texture Set ***************************/
-
-static void
-fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
- struct gl_texture_object *tObj0,
- struct gl_texture_object *tObj1)
-{
-#define T0_NOT_IN_TMU 0x01
-#define T1_NOT_IN_TMU 0x02
-#define T0_IN_TMU0 0x04
-#define T1_IN_TMU0 0x08
-#define T0_IN_TMU1 0x10
-#define T1_IN_TMU1 0x20
-
- tfxTexInfo *ti0 = fxTMGetTexInfo(tObj0);
- tfxTexInfo *ti1 = fxTMGetTexInfo(tObj1);
- GLuint tstate = 0;
- int tmu0 = 0, tmu1 = 1;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupDoubleTMU_NoLock(...)\n");
- }
-
- /* We shouldn't need to do this. There is something wrong with
- mutlitexturing when the TMUs are swapped. So, we're forcing
- them to always be loaded correctly. !!! */
- if (ti0->whichTMU == FX_TMU1)
- fxTMMoveOutTM_NoLock(fxMesa, tObj0);
- if (ti1->whichTMU == FX_TMU0)
- fxTMMoveOutTM_NoLock(fxMesa, tObj1);
-
- if (ti0->isInTM) {
- switch (ti0->whichTMU) {
- case FX_TMU0:
- tstate |= T0_IN_TMU0;
- break;
- case FX_TMU1:
- tstate |= T0_IN_TMU1;
- break;
- case FX_TMU_BOTH:
- tstate |= T0_IN_TMU0 | T0_IN_TMU1;
- break;
- case FX_TMU_SPLIT:
- tstate |= T0_NOT_IN_TMU;
- break;
- }
- }
- else
- tstate |= T0_NOT_IN_TMU;
-
- if (ti1->isInTM) {
- switch (ti1->whichTMU) {
- case FX_TMU0:
- tstate |= T1_IN_TMU0;
- break;
- case FX_TMU1:
- tstate |= T1_IN_TMU1;
- break;
- case FX_TMU_BOTH:
- tstate |= T1_IN_TMU0 | T1_IN_TMU1;
- break;
- case FX_TMU_SPLIT:
- tstate |= T1_NOT_IN_TMU;
- break;
- }
- }
- else
- tstate |= T1_NOT_IN_TMU;
-
- ti0->lastTimeUsed = fxMesa->texBindNumber;
- ti1->lastTimeUsed = fxMesa->texBindNumber;
-
- /* Move texture maps into TMUs */
-
- if (!(((tstate & T0_IN_TMU0) && (tstate & T1_IN_TMU1)) ||
- ((tstate & T0_IN_TMU1) && (tstate & T1_IN_TMU0)))) {
- if (tObj0 == tObj1)
- fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU_BOTH);
- else {
- /* Find the minimal way to correct the situation */
- if ((tstate & T0_IN_TMU0) || (tstate & T1_IN_TMU1)) {
- /* We have one in the standard order, setup the other */
- if (tstate & T0_IN_TMU0) { /* T0 is in TMU0, put T1 in TMU1 */
- fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1);
- }
- else {
- fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0);
- }
- /* tmu0 and tmu1 are setup */
- }
- else if ((tstate & T0_IN_TMU1) || (tstate & T1_IN_TMU0)) {
- /* we have one in the reverse order, setup the other */
- if (tstate & T1_IN_TMU0) { /* T1 is in TMU0, put T0 in TMU1 */
- fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU1);
- }
- else {
- fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0);
- }
- tmu0 = 1;
- tmu1 = 0;
- }
- else { /* Nothing is loaded */
- fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0);
- fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1);
- /* tmu0 and tmu1 are setup */
- }
- }
- }
-
- /* [dBorca] Hack alert:
- * we put these in reverse order, so that if we can't
- * do _REAL_ pointcast, the TMU0 table gets broadcasted
- */
- if (!fxMesa->haveGlobalPaletteTexture) {
- /* pointcast */
- if (ti1->info.format == GR_TEXFMT_P_8) {
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupDoubleTMU_NoLock: uploading texture palette for TMU1\n");
- }
- fxMesa->Glide.grTexDownloadTableExt(ti1->whichTMU, ti1->paltype, &(ti1->palette));
- }
- if (ti0->info.format == GR_TEXFMT_P_8) {
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupDoubleTMU_NoLock: uploading texture palette for TMU0\n");
- }
- fxMesa->Glide.grTexDownloadTableExt(ti0->whichTMU, ti0->paltype, &(ti0->palette));
- }
- }
-
- grTexSource(tmu0, ti0->tm[tmu0]->startAddr,
- GR_MIPMAPLEVELMASK_BOTH, &(ti0->info));
- grTexClampMode(tmu0, ti0->sClamp, ti0->tClamp);
- grTexFilterMode(tmu0, ti0->minFilt, ti0->maxFilt);
- grTexMipMapMode(tmu0, ti0->mmMode, FXFALSE);
-
- grTexSource(tmu1, ti1->tm[tmu1]->startAddr,
- GR_MIPMAPLEVELMASK_BOTH, &(ti1->info));
- grTexClampMode(tmu1, ti1->sClamp, ti1->tClamp);
- grTexFilterMode(tmu1, ti1->minFilt, ti1->maxFilt);
- grTexMipMapMode(tmu1, ti1->mmMode, FXFALSE);
-
-#undef T0_NOT_IN_TMU
-#undef T1_NOT_IN_TMU
-#undef T0_IN_TMU0
-#undef T1_IN_TMU0
-#undef T0_IN_TMU1
-#undef T1_IN_TMU1
-}
-
-static void
-fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- struct tdfx_combine alphaComb, colorComb;
- struct tdfx_texcombine tex0, tex1;
- GrCombineLocal_t localc, locala;
- tfxTexInfo *ti0, *ti1;
- struct gl_texture_object *tObj0 = ctx->Texture.Unit[1]._Current;
- struct gl_texture_object *tObj1 = ctx->Texture.Unit[0]._Current;
- GLuint envmode, ifmt, unitsmode;
- int tmu0 = 0, tmu1 = 1;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTextureDoubleTMU_NoLock(...)\n");
- }
-
- ti0 = fxTMGetTexInfo(tObj0);
- fxTexValidate(ctx, tObj0);
-
- ti1 = fxTMGetTexInfo(tObj1);
- fxTexValidate(ctx, tObj1);
-
- fxSetupDoubleTMU_NoLock(fxMesa, tObj0, tObj1);
-
- unitsmode = fxGetTexSetConfiguration(ctx, tObj0, tObj1);
-
-/* if(fxMesa->lastUnitsMode==unitsmode) */
-/* return; */
-
- fxMesa->lastUnitsMode = unitsmode;
-
- fxMesa->stw_hint_state |= GR_STWHINT_ST_DIFF_TMU1;
- FX_grHints_NoLock(GR_HINT_STWHINT, fxMesa->stw_hint_state);
-
- envmode = unitsmode & FX_UM_E_ENVMODE;
- ifmt = unitsmode & FX_UM_E_IFMT;
-
- if (unitsmode & FX_UM_ALPHA_ITERATED)
- locala = GR_COMBINE_LOCAL_ITERATED;
- else
- locala = GR_COMBINE_LOCAL_CONSTANT;
-
- if (unitsmode & FX_UM_COLOR_ITERATED)
- localc = GR_COMBINE_LOCAL_ITERATED;
- else
- localc = GR_COMBINE_LOCAL_CONSTANT;
-
-
- if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "fxSetupTextureDoubleTMU_NoLock: envmode is %s/%s\n",
- _mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
- _mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
-
-
- if ((ti0->whichTMU == FX_TMU1) || (ti1->whichTMU == FX_TMU0)) {
- tmu0 = 1;
- tmu1 = 0;
- }
- fxMesa->tmuSrc = FX_TMU_BOTH;
-
- tex0.InvertRGB = FXFALSE;
- tex0.InvertAlpha = FXFALSE;
- tex1.InvertRGB = FXFALSE;
- tex1.InvertAlpha = FXFALSE;
- alphaComb.Local = locala;
- alphaComb.Invert = FXFALSE;
- colorComb.Local = localc;
- colorComb.Invert = FXFALSE;
-
- switch (envmode) {
- case (FX_UM_E0_MODULATE | FX_UM_E1_MODULATE):
- {
- GLboolean isalpha[FX_NUM_TMU];
-
- isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA);
- isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA);
-
- if (isalpha[FX_TMU1]) {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
- tex1.InvertRGB = FXTRUE;
- } else {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
- }
-
- if (isalpha[FX_TMU0]) {
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorRGB = GR_COMBINE_FACTOR_ONE;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- } else {
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- }
-
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
-
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- break;
- }
- case (FX_UM_E0_REPLACE | FX_UM_E1_BLEND): /* Only for GLQuake */
- if (tmu0 == FX_TMU1) {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
- tex1.InvertRGB = FXTRUE;
-
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- }
- else {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
-
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL;
- }
-
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
-
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- break;
- case (FX_UM_E0_REPLACE | FX_UM_E1_MODULATE): /* Quake 2 and 3 */
- if (tmu1 == FX_TMU1) {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_ZERO;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
- tex1.InvertAlpha = FXTRUE;
-
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- }
- else {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
-
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE;
- }
-
- if (ti0->baseLevelInternalFormat == GL_RGB) {
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- } else {
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_ONE;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- }
-
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- break;
-
-
- case (FX_UM_E0_MODULATE | FX_UM_E1_ADD): /* Quake 3 Sky */
- {
- GLboolean isalpha[FX_NUM_TMU];
-
- isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA);
- isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA);
-
- if (isalpha[FX_TMU1]) {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
- tex1.InvertRGB = FXTRUE;
- } else {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
- }
-
- if (isalpha[FX_TMU0]) {
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER;
- tex0.FactorRGB = GR_COMBINE_FACTOR_ONE;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE;
- } else {
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- tex0.FactorRGB = GR_COMBINE_FACTOR_ONE;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE;
- }
-
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
-
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- break;
- }
-
- case (FX_UM_E0_REPLACE | FX_UM_E1_ADD): /* Vulpine Sky */
- {
- GLboolean isalpha[FX_NUM_TMU];
-
- isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA);
- isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA);
-
- if (isalpha[FX_TMU1]) {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
- tex1.InvertRGB = FXTRUE;
- } else {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
- }
-
- if (isalpha[FX_TMU0]) {
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER;
- tex0.FactorRGB = GR_COMBINE_FACTOR_ONE;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE;
- } else {
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- tex0.FactorRGB = GR_COMBINE_FACTOR_ONE;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_ONE;
- }
-
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
-
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_ONE;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- break;
- }
-
- case (FX_UM_E0_MODULATE | FX_UM_E1_REPLACE): /* Homeworld2 */
- {
- tex1.FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- tex1.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex1.FunctionAlpha = GR_COMBINE_FUNCTION_ZERO;
- tex1.FactorAlpha = GR_COMBINE_FACTOR_NONE;
-
- tex0.FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- tex0.FactorRGB = GR_COMBINE_FACTOR_NONE;
- tex0.FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- tex0.FactorAlpha = GR_COMBINE_FACTOR_NONE;
-
- if (ifmt & (FX_UM_E0_RGB | FX_UM_E0_LUMINANCE)) {
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- } else {
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_ONE;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- }
-
- if (ifmt & FX_UM_E0_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- } else {
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- }
- break;
- }
- default:
- fprintf(stderr, "fxSetupTextureDoubleTMU_NoLock: Unexpected dual texture mode encountered\n");
- return;
- }
-
- grAlphaCombine(alphaComb.Function,
- alphaComb.Factor,
- alphaComb.Local,
- alphaComb.Other,
- alphaComb.Invert);
- grColorCombine(colorComb.Function,
- colorComb.Factor,
- colorComb.Local,
- colorComb.Other,
- colorComb.Invert);
- grTexCombine(GR_TMU0,
- tex0.FunctionRGB,
- tex0.FactorRGB,
- tex0.FunctionAlpha,
- tex0.FactorAlpha,
- tex0.InvertRGB,
- tex0.InvertAlpha);
- grTexCombine(GR_TMU1,
- tex1.FunctionRGB,
- tex1.FactorRGB,
- tex1.FunctionAlpha,
- tex1.FactorAlpha,
- tex1.InvertRGB,
- tex1.InvertAlpha);
-}
-
-/************************* No Texture ***************************/
-
-static void
-fxSetupTextureNone_NoLock(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrCombineLocal_t localc, locala;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTextureNone_NoLock(...)\n");
- }
-
- if ((ctx->Light.ShadeModel == GL_SMOOTH) || 1 ||
- (ctx->Point.SmoothFlag) ||
- (ctx->Line.SmoothFlag) ||
- (ctx->Polygon.SmoothFlag)) locala = GR_COMBINE_LOCAL_ITERATED;
- else
- locala = GR_COMBINE_LOCAL_CONSTANT;
-
- if (ctx->Light.ShadeModel == GL_SMOOTH || 1)
- localc = GR_COMBINE_LOCAL_ITERATED;
- else
- localc = GR_COMBINE_LOCAL_CONSTANT;
-
- grAlphaCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- locala,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
-
- grColorCombine(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- localc,
- GR_COMBINE_OTHER_NONE,
- FXFALSE);
-
- fxMesa->lastUnitsMode = FX_UM_NONE;
-}
-
-#include "fxsetup.h"
-
-/************************************************************************/
-/************************** Texture Mode SetUp **************************/
-/************************************************************************/
-
-static void
-fxSetupTexture_NoLock(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTexture_NoLock(...)\n");
- }
-
- if (fxMesa->HaveCmbExt) {
- /* Texture Combine, Color Combine and Alpha Combine. */
- if ((ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) &&
- (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) &&
- fxMesa->haveTwoTMUs) {
- fxSetupTextureDoubleTMUNapalm_NoLock(ctx);
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
- fxSetupTextureSingleTMUNapalm_NoLock(ctx, 0);
- }
- else if (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
- fxSetupTextureSingleTMUNapalm_NoLock(ctx, 1);
- }
- else {
- fxSetupTextureNoneNapalm_NoLock(ctx);
- }
- } else {
- /* Texture Combine, Color Combine and Alpha Combine. */
- if ((ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) &&
- (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) &&
- fxMesa->haveTwoTMUs) {
- fxSetupTextureDoubleTMU_NoLock(ctx);
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
- fxSetupTextureSingleTMU_NoLock(ctx, 0);
- }
- else if (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
- fxSetupTextureSingleTMU_NoLock(ctx, 1);
- }
- else {
- fxSetupTextureNone_NoLock(ctx);
- }
- }
-}
-
-void
-fxSetupTexture(GLcontext * ctx)
-{
- BEGIN_BOARD_LOCK();
- fxSetupTexture_NoLock(ctx);
- END_BOARD_LOCK();
-}
-
-/************************************************************************/
-/**************************** Blend SetUp *******************************/
-/************************************************************************/
-
-void
-fxDDBlendFuncSeparate(GLcontext * ctx, GLenum sfactor, GLenum dfactor, GLenum asfactor, GLenum adfactor)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
- GLboolean isNapalm = (fxMesa->type >= GR_SSTTYPE_Voodoo4);
- GLboolean have32bpp = (fxMesa->colDepth == 32);
- GLboolean haveAlpha = fxMesa->haveHwAlpha;
- GrAlphaBlendFnc_t sfact, dfact, asfact, adfact;
-
- /*
- * 15/16 BPP alpha channel alpha blending modes
- * 0x0 AZERO Zero
- * 0x4 AONE One
- *
- * 32 BPP alpha channel alpha blending modes
- * 0x0 AZERO Zero
- * 0x1 ASRC_ALPHA Source alpha
- * 0x3 ADST_ALPHA Destination alpha
- * 0x4 AONE One
- * 0x5 AOMSRC_ALPHA 1 - Source alpha
- * 0x7 AOMDST_ALPHA 1 - Destination alpha
- *
- * If we don't have HW alpha buffer:
- * DST_ALPHA == 1
- * ONE_MINUS_DST_ALPHA == 0
- * Unsupported modes are:
- * 1 if used as src blending factor
- * 0 if used as dst blending factor
- */
-
- switch (sfactor) {
- case GL_ZERO:
- sfact = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- sfact = GR_BLEND_ONE;
- break;
- case GL_DST_COLOR:
- sfact = GR_BLEND_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- sfact = GR_BLEND_ONE_MINUS_DST_COLOR;
- break;
- case GL_SRC_ALPHA:
- sfact = GR_BLEND_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- sfact = GR_BLEND_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- sfact = haveAlpha ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE/*bad*/;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- sfact = haveAlpha ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO/*bad*/;
- break;
- case GL_SRC_ALPHA_SATURATE:
- sfact = GR_BLEND_ALPHA_SATURATE;
- break;
- case GL_SRC_COLOR:
- if (isNapalm) {
- sfact = GR_BLEND_SAME_COLOR_EXT;
- break;
- }
- case GL_ONE_MINUS_SRC_COLOR:
- if (isNapalm) {
- sfact = GR_BLEND_ONE_MINUS_SAME_COLOR_EXT;
- break;
- }
- default:
- sfact = GR_BLEND_ONE;
- break;
- }
-
- switch (asfactor) {
- case GL_ZERO:
- asfact = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- asfact = GR_BLEND_ONE;
- break;
- case GL_SRC_COLOR:
- case GL_SRC_ALPHA:
- asfact = have32bpp ? GR_BLEND_SRC_ALPHA : GR_BLEND_ONE/*bad*/;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_ONE_MINUS_SRC_ALPHA:
- asfact = have32bpp ? GR_BLEND_ONE_MINUS_SRC_ALPHA : GR_BLEND_ONE/*bad*/;
- break;
- case GL_DST_COLOR:
- case GL_DST_ALPHA:
- asfact = (have32bpp && haveAlpha) ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE/*bad*/;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- case GL_ONE_MINUS_DST_ALPHA:
- asfact = (have32bpp && haveAlpha) ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO/*bad*/;
- break;
- case GL_SRC_ALPHA_SATURATE:
- asfact = GR_BLEND_ONE;
- break;
- default:
- asfact = GR_BLEND_ONE;
- break;
- }
-
- switch (dfactor) {
- case GL_ZERO:
- dfact = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- dfact = GR_BLEND_ONE;
- break;
- case GL_SRC_COLOR:
- dfact = GR_BLEND_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- dfact = GR_BLEND_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- dfact = GR_BLEND_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dfact = GR_BLEND_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- dfact = haveAlpha ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE/*bad*/;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dfact = haveAlpha ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO/*bad*/;
- break;
- case GL_DST_COLOR:
- if (isNapalm) {
- dfact = GR_BLEND_SAME_COLOR_EXT;
- break;
- }
- case GL_ONE_MINUS_DST_COLOR:
- if (isNapalm) {
- dfact = GR_BLEND_ONE_MINUS_SAME_COLOR_EXT;
- break;
- }
- default:
- dfact = GR_BLEND_ZERO;
- break;
- }
-
- switch (adfactor) {
- case GL_ZERO:
- adfact = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- adfact = GR_BLEND_ONE;
- break;
- case GL_SRC_COLOR:
- case GL_SRC_ALPHA:
- adfact = have32bpp ? GR_BLEND_SRC_ALPHA : GR_BLEND_ZERO/*bad*/;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_ONE_MINUS_SRC_ALPHA:
- adfact = have32bpp ? GR_BLEND_ONE_MINUS_SRC_ALPHA : GR_BLEND_ZERO/*bad*/;
- break;
- case GL_DST_COLOR:
- case GL_DST_ALPHA:
- adfact = (have32bpp && haveAlpha) ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE/*bad*/;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- case GL_ONE_MINUS_DST_ALPHA:
- adfact = (have32bpp && haveAlpha) ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO/*bad*/;
- break;
- default:
- adfact = GR_BLEND_ZERO;
- break;
- }
-
- if ((sfact != us->blendSrcFuncRGB) || (asfact != us->blendSrcFuncAlpha)) {
- us->blendSrcFuncRGB = sfact;
- us->blendSrcFuncAlpha = asfact;
- fxMesa->new_state |= FX_NEW_BLEND;
- }
-
- if ((dfact != us->blendDstFuncRGB) || (adfact != us->blendDstFuncAlpha)) {
- us->blendDstFuncRGB = dfact;
- us->blendDstFuncAlpha = adfact;
- fxMesa->new_state |= FX_NEW_BLEND;
- }
-}
-
-void
-fxDDBlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
- GrAlphaBlendOp_t q;
-
- switch (modeRGB) {
- case GL_FUNC_ADD:
- q = GR_BLEND_OP_ADD;
- break;
- case GL_FUNC_SUBTRACT:
- q = GR_BLEND_OP_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- q = GR_BLEND_OP_REVSUB;
- break;
- default:
- q = us->blendEqRGB;
- }
- if (q != us->blendEqRGB) {
- us->blendEqRGB = q;
- fxMesa->new_state |= FX_NEW_BLEND;
- }
-
- switch (modeA) {
- case GL_FUNC_ADD:
- q = GR_BLEND_OP_ADD;
- break;
- case GL_FUNC_SUBTRACT:
- q = GR_BLEND_OP_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- q = GR_BLEND_OP_REVSUB;
- break;
- default:
- q = us->blendEqAlpha;
- }
- if (q != us->blendEqAlpha) {
- us->blendEqAlpha = q;
- fxMesa->new_state |= FX_NEW_BLEND;
- }
-}
-
-void
-fxSetupBlend(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (fxMesa->HavePixExt) {
- if (us->blendEnabled) {
- fxMesa->Glide.grAlphaBlendFunctionExt(us->blendSrcFuncRGB, us->blendDstFuncRGB,
- us->blendEqRGB,
- us->blendSrcFuncAlpha, us->blendDstFuncAlpha,
- us->blendEqAlpha);
- } else {
- fxMesa->Glide.grAlphaBlendFunctionExt(GR_BLEND_ONE, GR_BLEND_ZERO,
- GR_BLEND_OP_ADD,
- GR_BLEND_ONE, GR_BLEND_ZERO,
- GR_BLEND_OP_ADD);
- }
- } else {
- if (us->blendEnabled) {
- grAlphaBlendFunction(us->blendSrcFuncRGB, us->blendDstFuncRGB,
- us->blendSrcFuncAlpha, us->blendDstFuncAlpha);
- } else {
- grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO,
- GR_BLEND_ONE, GR_BLEND_ZERO);
- }
- }
-}
-
-/************************************************************************/
-/************************** Alpha Test SetUp ****************************/
-/************************************************************************/
-
-void
-fxDDAlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (
- (us->alphaTestFunc != func)
- ||
- (us->alphaTestRefValue != ref)
- ) {
- us->alphaTestFunc = func;
- us->alphaTestRefValue = ref;
- fxMesa->new_state |= FX_NEW_ALPHA;
- }
-}
-
-static void
-fxSetupAlphaTest(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (us->alphaTestEnabled) {
- GrAlpha_t ref = (GLint) (us->alphaTestRefValue * 255.0);
- grAlphaTestFunction(us->alphaTestFunc - GL_NEVER + GR_CMP_NEVER);
- grAlphaTestReferenceValue(ref);
- }
- else
- grAlphaTestFunction(GR_CMP_ALWAYS);
-}
-
-/************************************************************************/
-/************************** Depth Test SetUp ****************************/
-/************************************************************************/
-
-void
-fxDDDepthFunc(GLcontext * ctx, GLenum func)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (us->depthTestFunc != func) {
- us->depthTestFunc = func;
- fxMesa->new_state |= FX_NEW_DEPTH;
- }
-}
-
-void
-fxDDDepthMask(GLcontext * ctx, GLboolean flag)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (flag != us->depthMask) {
- us->depthMask = flag;
- fxMesa->new_state |= FX_NEW_DEPTH;
- }
-}
-
-void
-fxSetupDepthTest(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (us->depthTestEnabled) {
- grDepthBufferFunction(us->depthTestFunc - GL_NEVER + GR_CMP_NEVER);
- grDepthMask(us->depthMask);
- }
- else {
- grDepthBufferFunction(GR_CMP_ALWAYS);
- grDepthMask(FXFALSE);
- }
-}
-
-/************************************************************************/
-/************************** Stencil SetUp *******************************/
-/************************************************************************/
-
-static GrStencil_t convertGLStencilOp( GLenum op )
-{
- switch ( op ) {
- case GL_KEEP:
- return GR_STENCILOP_KEEP;
- case GL_ZERO:
- return GR_STENCILOP_ZERO;
- case GL_REPLACE:
- return GR_STENCILOP_REPLACE;
- case GL_INCR:
- return GR_STENCILOP_INCR_CLAMP;
- case GL_DECR:
- return GR_STENCILOP_DECR_CLAMP;
- case GL_INVERT:
- return GR_STENCILOP_INVERT;
- case GL_INCR_WRAP_EXT:
- return GR_STENCILOP_INCR_WRAP;
- case GL_DECR_WRAP_EXT:
- return GR_STENCILOP_DECR_WRAP;
- default:
- _mesa_problem( NULL, "bad stencil op in convertGLStencilOp" );
- }
- return GR_STENCILOP_KEEP; /* never get, silence compiler warning */
-}
-
-void
-fxDDStencilFuncSeparate (GLcontext *ctx, GLenum face, GLenum func,
- GLint ref, GLuint mask)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (ctx->Stencil.ActiveFace) {
- return;
- }
-
- if (
- (us->stencilFunction != func)
- ||
- (us->stencilRefValue != ref)
- ||
- (us->stencilValueMask != mask)
- ) {
- us->stencilFunction = func;
- us->stencilRefValue = ref;
- us->stencilValueMask = mask;
- fxMesa->new_state |= FX_NEW_STENCIL;
- }
-}
-
-void
-fxDDStencilMaskSeparate (GLcontext *ctx, GLenum face, GLuint mask)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (ctx->Stencil.ActiveFace) {
- return;
- }
-
- if (us->stencilWriteMask != mask) {
- us->stencilWriteMask = mask;
- fxMesa->new_state |= FX_NEW_STENCIL;
- }
-}
-
-void
-fxDDStencilOpSeparate (GLcontext *ctx, GLenum face, GLenum sfail,
- GLenum zfail, GLenum zpass)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (ctx->Stencil.ActiveFace) {
- return;
- }
-
- if (
- (us->stencilFailFunc != sfail)
- ||
- (us->stencilZFailFunc != zfail)
- ||
- (us->stencilZPassFunc != zpass)
- ) {
- us->stencilFailFunc = sfail;
- us->stencilZFailFunc = zfail;
- us->stencilZPassFunc = zpass;
- fxMesa->new_state |= FX_NEW_STENCIL;
- }
-}
-
-void
-fxSetupStencil (GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (us->stencilEnabled) {
- GrCmpFnc_t stencilFailFunc = GR_STENCILOP_KEEP;
- GrCmpFnc_t stencilZFailFunc = GR_STENCILOP_KEEP;
- GrCmpFnc_t stencilZPassFunc = GR_STENCILOP_KEEP;
- if (!fxMesa->multipass) {
- stencilFailFunc = convertGLStencilOp(us->stencilFailFunc);
- stencilZFailFunc = convertGLStencilOp(us->stencilZFailFunc);
- stencilZPassFunc = convertGLStencilOp(us->stencilZPassFunc);
- }
- grEnable(GR_STENCIL_MODE_EXT);
- fxMesa->Glide.grStencilOpExt(stencilFailFunc,
- stencilZFailFunc,
- stencilZPassFunc);
- fxMesa->Glide.grStencilFuncExt(us->stencilFunction - GL_NEVER + GR_CMP_NEVER,
- us->stencilRefValue,
- us->stencilValueMask);
- fxMesa->Glide.grStencilMaskExt(us->stencilWriteMask);
- } else {
- grDisable(GR_STENCIL_MODE_EXT);
- }
-}
-
-void
-fxSetupStencilFace (GLcontext * ctx, GLint face)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (us->stencilEnabled) {
- GrCmpFnc_t stencilFailFunc = GR_STENCILOP_KEEP;
- GrCmpFnc_t stencilZFailFunc = GR_STENCILOP_KEEP;
- GrCmpFnc_t stencilZPassFunc = GR_STENCILOP_KEEP;
- if (!fxMesa->multipass) {
- stencilFailFunc = convertGLStencilOp(ctx->Stencil.FailFunc[face]);
- stencilZFailFunc = convertGLStencilOp(ctx->Stencil.ZFailFunc[face]);
- stencilZPassFunc = convertGLStencilOp(ctx->Stencil.ZPassFunc[face]);
- }
- grEnable(GR_STENCIL_MODE_EXT);
- fxMesa->Glide.grStencilOpExt(stencilFailFunc,
- stencilZFailFunc,
- stencilZPassFunc);
- fxMesa->Glide.grStencilFuncExt(ctx->Stencil.Function[face] - GL_NEVER + GR_CMP_NEVER,
- ctx->Stencil.Ref[face],
- ctx->Stencil.ValueMask[face]);
- fxMesa->Glide.grStencilMaskExt(ctx->Stencil.WriteMask[face]);
- } else {
- grDisable(GR_STENCIL_MODE_EXT);
- }
-}
-
-/************************************************************************/
-/**************************** Color Mask SetUp **************************/
-/************************************************************************/
-
-void
-fxDDColorMask(GLcontext * ctx,
- GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- fxMesa->new_state |= FX_NEW_COLOR_MASK;
- (void) r;
- (void) g;
- (void) b;
- (void) a;
-}
-
-void
-fxSetupColorMask(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (fxMesa->colDepth == 32) {
- /* 32bpp mode */
- fxMesa->Glide.grColorMaskExt(ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] && fxMesa->haveHwAlpha);
- }
- else {
- /* 15/16 bpp mode */
- grColorMask(ctx->Color.ColorMask[RCOMP] |
- ctx->Color.ColorMask[GCOMP] |
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] && fxMesa->haveHwAlpha);
- }
-}
-
-
-
-
-/************************************************************************/
-/**************************** Fog Mode SetUp ****************************/
-/************************************************************************/
-
-/*
- * This is called during state update in order to update the Glide fog state.
- */
-static void
-fxSetupFog(GLcontext * ctx)
-{
- if (ctx->Fog.Enabled /*&& ctx->FogMode==FOG_FRAGMENT */ ) {
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- /* update fog color */
- GLubyte col[4];
- col[0] = (unsigned int) (255 * ctx->Fog.Color[0]);
- col[1] = (unsigned int) (255 * ctx->Fog.Color[1]);
- col[2] = (unsigned int) (255 * ctx->Fog.Color[2]);
- col[3] = (unsigned int) (255 * ctx->Fog.Color[3]);
- grFogColorValue(FXCOLOR4(col));
-
- if (fxMesa->fogTableMode != ctx->Fog.Mode ||
- fxMesa->fogDensity != ctx->Fog.Density ||
- fxMesa->fogStart != ctx->Fog.Start ||
- fxMesa->fogEnd != ctx->Fog.End) {
- /* reload the fog table */
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- guFogGenerateLinear(fxMesa->fogTable, ctx->Fog.Start,
- ctx->Fog.End);
- if (fxMesa->fogTable[0] > 63) {
- /* [dBorca] Hack alert:
- * As per Glide3 Programming Guide:
- * The difference between consecutive fog values
- * must be less than 64.
- */
- fxMesa->fogTable[0] = 63;
- }
- break;
- case GL_EXP:
- guFogGenerateExp(fxMesa->fogTable, ctx->Fog.Density);
- break;
- case GL_EXP2:
- guFogGenerateExp2(fxMesa->fogTable, ctx->Fog.Density);
- break;
- default:
- ;
- }
- fxMesa->fogTableMode = ctx->Fog.Mode;
- fxMesa->fogDensity = ctx->Fog.Density;
- fxMesa->fogStart = ctx->Fog.Start;
- fxMesa->fogEnd = ctx->Fog.End;
- }
-
- grFogTable(fxMesa->fogTable);
- if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) {
- grVertexLayout(GR_PARAM_FOG_EXT, GR_VERTEX_FOG_OFFSET << 2,
- GR_PARAM_ENABLE);
- grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
- } else {
- grVertexLayout(GR_PARAM_FOG_EXT, GR_VERTEX_FOG_OFFSET << 2,
- GR_PARAM_DISABLE);
- grFogMode(GR_FOG_WITH_TABLE_ON_Q);
- }
- }
- else {
- grFogMode(GR_FOG_DISABLE);
- }
-}
-
-void
-fxDDFogfv(GLcontext * ctx, GLenum pname, const GLfloat * params)
-{
- FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
- switch (pname) {
- case GL_FOG_COORDINATE_SOURCE_EXT: {
- GLenum p = (GLenum)*params;
- if (p == GL_FOG_COORDINATE_EXT) {
- _swrast_allow_vertex_fog(ctx, GL_TRUE);
- _swrast_allow_pixel_fog(ctx, GL_FALSE);
- _tnl_allow_vertex_fog( ctx, GL_TRUE);
- _tnl_allow_pixel_fog( ctx, GL_FALSE);
- } else {
- _swrast_allow_vertex_fog(ctx, GL_FALSE);
- _swrast_allow_pixel_fog(ctx, GL_TRUE);
- _tnl_allow_vertex_fog( ctx, GL_FALSE);
- _tnl_allow_pixel_fog( ctx, GL_TRUE);
- }
- break;
- }
- default:
- ;
- }
-}
-
-/************************************************************************/
-/************************** Scissor Test SetUp **************************/
-/************************************************************************/
-
-/* This routine is used in managing the lock state, and therefore can't lock */
-void
-fxSetScissorValues(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- int xmin, xmax;
- int ymin, ymax;
-
- if (ctx->Scissor.Enabled) {
- xmin = ctx->Scissor.X;
- xmax = ctx->Scissor.X + ctx->Scissor.Width;
- ymin = ctx->Scissor.Y;
- ymax = ctx->Scissor.Y + ctx->Scissor.Height;
-
- if (xmin < 0)
- xmin = 0;
- if (xmax > fxMesa->width)
- xmax = fxMesa->width;
- if (ymin < fxMesa->screen_height - fxMesa->height)
- ymin = fxMesa->screen_height - fxMesa->height;
- if (ymax > fxMesa->screen_height - 0)
- ymax = fxMesa->screen_height - 0;
- }
- else {
- xmin = 0;
- ymin = 0;
- xmax = fxMesa->width;
- ymax = fxMesa->height;
- }
-
- fxMesa->clipMinX = xmin;
- fxMesa->clipMinY = ymin;
- fxMesa->clipMaxX = xmax;
- fxMesa->clipMaxY = ymax;
- grClipWindow(xmin, ymin, xmax, ymax);
-}
-
-void
-fxSetupScissor(GLcontext * ctx)
-{
- BEGIN_BOARD_LOCK();
- fxSetScissorValues(ctx);
- END_BOARD_LOCK();
-}
-
-void
-fxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- FX_CONTEXT(ctx)->new_state |= FX_NEW_SCISSOR;
-}
-
-/************************************************************************/
-/*************************** Cull mode setup ****************************/
-/************************************************************************/
-
-
-void
-fxDDCullFace(GLcontext * ctx, GLenum mode)
-{
- (void) mode;
- FX_CONTEXT(ctx)->new_state |= FX_NEW_CULL;
-}
-
-void
-fxDDFrontFace(GLcontext * ctx, GLenum mode)
-{
- (void) mode;
- FX_CONTEXT(ctx)->new_state |= FX_NEW_CULL;
-}
-
-
-void
-fxSetupCull(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrCullMode_t mode = GR_CULL_DISABLE;
-
- if (ctx->Polygon.CullFlag && (fxMesa->raster_primitive == GL_TRIANGLES)) {
- switch (ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CCW)
- mode = GR_CULL_NEGATIVE;
- else
- mode = GR_CULL_POSITIVE;
- break;
- case GL_FRONT:
- if (ctx->Polygon.FrontFace == GL_CCW)
- mode = GR_CULL_POSITIVE;
- else
- mode = GR_CULL_NEGATIVE;
- break;
- case GL_FRONT_AND_BACK:
- /* Handled as a fallback on triangles in tdfx_tris.c */
- return;
- default:
- ASSERT(0);
- break;
- }
- }
-
- if (fxMesa->cullMode != mode) {
- fxMesa->cullMode = mode;
- grCullMode(mode);
- }
-}
-
-
-/************************************************************************/
-/****************************** DD Enable ******************************/
-/************************************************************************/
-
-void
-fxDDEnable(GLcontext * ctx, GLenum cap, GLboolean state)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "%s(%s)\n", state ? "fxDDEnable" : "fxDDDisable",
- _mesa_lookup_enum_by_nr(cap));
- }
-
- switch (cap) {
- case GL_ALPHA_TEST:
- if (state != us->alphaTestEnabled) {
- us->alphaTestEnabled = state;
- fxMesa->new_state |= FX_NEW_ALPHA;
- }
- break;
- case GL_BLEND:
- if (state != us->blendEnabled) {
- us->blendEnabled = state;
- fxMesa->new_state |= FX_NEW_BLEND;
- }
- break;
- case GL_DEPTH_TEST:
- if (state != us->depthTestEnabled) {
- us->depthTestEnabled = state;
- fxMesa->new_state |= FX_NEW_DEPTH;
- }
- break;
- case GL_STENCIL_TEST:
- if (fxMesa->haveHwStencil && state != us->stencilEnabled) {
- us->stencilEnabled = state;
- fxMesa->new_state |= FX_NEW_STENCIL;
- }
- break;
- case GL_DITHER:
- if (state) {
- grDitherMode(GR_DITHER_4x4);
- }
- else {
- grDitherMode(GR_DITHER_DISABLE);
- }
- break;
- case GL_SCISSOR_TEST:
- fxMesa->new_state |= FX_NEW_SCISSOR;
- break;
- case GL_SHARED_TEXTURE_PALETTE_EXT:
- fxDDTexUseGlbPalette(ctx, state);
- break;
- case GL_FOG:
- fxMesa->new_state |= FX_NEW_FOG;
- break;
- case GL_CULL_FACE:
- fxMesa->new_state |= FX_NEW_CULL;
- break;
- case GL_LINE_SMOOTH:
- case GL_LINE_STIPPLE:
- case GL_POINT_SMOOTH:
- case GL_POLYGON_SMOOTH:
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- fxMesa->new_state |= FX_NEW_TEXTURING;
- break;
- default:
- ; /* XXX no-op? */
- }
-}
-
-
-
-
-/************************************************************************/
-/************************** Changes to units state **********************/
-/************************************************************************/
-
-
-/* All units setup is handled under texture setup.
- */
-void
-fxDDShadeModel(GLcontext * ctx, GLenum mode)
-{
- FX_CONTEXT(ctx)->new_state |= FX_NEW_TEXTURING;
-}
-
-
-
-/************************************************************************/
-/****************************** Units SetUp *****************************/
-/************************************************************************/
-static void
-fx_print_state_flags(const char *msg, GLuint flags)
-{
- fprintf(stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s\n",
- msg,
- flags,
- (flags & FX_NEW_TEXTURING) ? "texture, " : "",
- (flags & FX_NEW_BLEND) ? "blend, " : "",
- (flags & FX_NEW_ALPHA) ? "alpha, " : "",
- (flags & FX_NEW_FOG) ? "fog, " : "",
- (flags & FX_NEW_SCISSOR) ? "scissor, " : "",
- (flags & FX_NEW_COLOR_MASK) ? "colormask, " : "",
- (flags & FX_NEW_CULL) ? "cull, " : "",
- (flags & FX_NEW_STENCIL) ? "stencil, " : "");
-}
-
-void
-fxSetupFXUnits(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLuint newstate = fxMesa->new_state;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER)
- fx_print_state_flags("fxSetupFXUnits", newstate);
-
- if (newstate) {
- if (newstate & FX_NEW_TEXTURING)
- fxSetupTexture(ctx);
-
- if (newstate & FX_NEW_BLEND)
- fxSetupBlend(ctx);
-
- if (newstate & FX_NEW_ALPHA)
- fxSetupAlphaTest(ctx);
-
- if (newstate & FX_NEW_DEPTH)
- fxSetupDepthTest(ctx);
-
- if (newstate & FX_NEW_STENCIL)
- fxSetupStencil(ctx);
-
- if (newstate & FX_NEW_FOG)
- fxSetupFog(ctx);
-
- if (newstate & FX_NEW_SCISSOR)
- fxSetupScissor(ctx);
-
- if (newstate & FX_NEW_COLOR_MASK)
- fxSetupColorMask(ctx);
-
- if (newstate & FX_NEW_CULL)
- fxSetupCull(ctx);
-
- fxMesa->new_state = 0;
- }
-}
-
-
-
-#else
-
-
-/*
- * Need this to provide at least one external definition.
- */
-
-extern int gl_fx_dummy_function_setup(void);
-int
-gl_fx_dummy_function_setup(void)
-{
- return 0;
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxsetup.h b/src/mesa/drivers/glide/fxsetup.h
deleted file mode 100644
index 9d337d4b0db..00000000000
--- a/src/mesa/drivers/glide/fxsetup.h
+++ /dev/null
@@ -1,850 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
-/* This code belongs to fxsetup.c, but I didn't want to clutter
- * the original code with Napalm specifics, in order to keep things
- * clear -- especially for backward compatibility. I should have
- * put it into another .c file, but I didn't want to export so many
- * things...
- * The point is, Napalm uses a different technique for texture env.
- * SST1 Single texturing:
- * setup standard grTexCombine
- * fiddle with grColorCombine/grAlphaCombine
- * SST1 Multi texturing:
- * fiddle with grTexCombine/grColorCombine/grAlphaCombine
- * Napalm Single texturing:
- * setup standard grColorCombineExt/grAlphaCombineExt
- * fiddle with grTexColorCombine/grTexAlphaCombine
- * Napalm Multi texturing:
- * setup standard grColorCombineExt/grAlphaCombineExt
- * fiddle with grTexColorCombine/grTexAlphaCombine
- */
-
-/*
- * These macros are used below when handling COMBINE_EXT.
- */
-#define TEXENV_OPERAND_INVERTED(operand) \
- (((operand) == GL_ONE_MINUS_SRC_ALPHA) \
- || ((operand) == GL_ONE_MINUS_SRC_COLOR))
-#define TEXENV_OPERAND_ALPHA(operand) \
- (((operand) == GL_SRC_ALPHA) || ((operand) == GL_ONE_MINUS_SRC_ALPHA))
-#define TEXENV_SETUP_ARG_A(param, source, operand, iteratedAlpha) \
- switch (source) { \
- case GL_TEXTURE: \
- param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \
- break; \
- case GL_CONSTANT_EXT: \
- param = GR_CMBX_TMU_CALPHA; \
- break; \
- case GL_PRIMARY_COLOR_EXT: \
- param = GR_CMBX_ITALPHA; \
- break; \
- case GL_PREVIOUS_EXT: \
- param = iteratedAlpha; \
- break; \
- default: \
- /* \
- * This is here just to keep from getting \
- * compiler warnings. \
- */ \
- param = GR_CMBX_ZERO; \
- break; \
- }
-
-#define TEXENV_SETUP_ARG_RGB(param, source, operand, iteratedColor, iteratedAlpha) \
- if (!TEXENV_OPERAND_ALPHA(operand)) { \
- switch (source) { \
- case GL_TEXTURE: \
- param = GR_CMBX_LOCAL_TEXTURE_RGB; \
- break; \
- case GL_CONSTANT_EXT: \
- param = GR_CMBX_TMU_CCOLOR; \
- break; \
- case GL_PRIMARY_COLOR_EXT: \
- param = GR_CMBX_ITRGB; \
- break; \
- case GL_PREVIOUS_EXT: \
- param = iteratedColor; \
- break; \
- default: \
- /* \
- * This is here just to keep from getting \
- * compiler warnings. \
- */ \
- param = GR_CMBX_ZERO; \
- break; \
- } \
- } else { \
- switch (source) { \
- case GL_TEXTURE: \
- param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \
- break; \
- case GL_CONSTANT_EXT: \
- param = GR_CMBX_TMU_CALPHA; \
- break; \
- case GL_PRIMARY_COLOR_EXT: \
- param = GR_CMBX_ITALPHA; \
- break; \
- case GL_PREVIOUS_EXT: \
- param = iteratedAlpha; \
- break; \
- default: \
- /* \
- * This is here just to keep from getting \
- * compiler warnings. \
- */ \
- param = GR_CMBX_ZERO; \
- break; \
- } \
- }
-
-#define TEXENV_SETUP_MODE_RGB(param, operand) \
- switch (operand) { \
- case GL_SRC_COLOR: \
- case GL_SRC_ALPHA: \
- param = GR_FUNC_MODE_X; \
- break; \
- case GL_ONE_MINUS_SRC_ALPHA: \
- case GL_ONE_MINUS_SRC_COLOR: \
- param = GR_FUNC_MODE_ONE_MINUS_X; \
- break; \
- default: \
- param = GR_FUNC_MODE_ZERO; \
- break; \
- }
-
-#define TEXENV_SETUP_MODE_A(param, operand) \
- switch (operand) { \
- case GL_SRC_ALPHA: \
- param = GR_FUNC_MODE_X; \
- break; \
- case GL_ONE_MINUS_SRC_ALPHA: \
- param = GR_FUNC_MODE_ONE_MINUS_X; \
- break; \
- default: \
- param = GR_FUNC_MODE_ZERO; \
- break; \
- }
-
-static void
-fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, GLboolean iterated)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[textureset];
- struct tdfx_combine_alpha_ext alphaComb;
- struct tdfx_combine_color_ext colorComb;
- const GLfloat *envColor = texUnit->EnvColor;
- GrCombineLocal_t localc, locala; /* fragmentColor/Alpha */
- GLint ifmt;
- tfxTexInfo *ti;
- struct gl_texture_object *tObj = texUnit->_Current;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTextureEnvNapalm_NoLock(unit %u, TMU %u, iterated %d)\n",
- textureset, tmu, iterated);
- }
-
- ti = fxTMGetTexInfo(tObj);
-
- ifmt = ti->baseLevelInternalFormat;
-
- if (iterated) {
- /* we don't have upstream TMU */
- locala = GR_CMBX_ITALPHA;
- localc = GR_CMBX_ITRGB;
- } else {
- /* we have upstream TMU */
- locala = GR_CMBX_OTHER_TEXTURE_ALPHA;
- localc = GR_CMBX_OTHER_TEXTURE_RGB;
- }
-
- alphaComb.InvertD = FXFALSE;
- alphaComb.Shift = 0;
- alphaComb.Invert = FXFALSE;
- colorComb.InvertD = FXFALSE;
- colorComb.Shift = 0;
- colorComb.Invert = FXFALSE;
-
- switch (texUnit->EnvMode) {
- case GL_DECAL:
- alphaComb.SourceA = locala;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_ZERO;
- alphaComb.InvertC = FXTRUE;
- alphaComb.SourceD = GR_CMBX_ZERO;
-
- colorComb.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB;
- colorComb.ModeA = GR_FUNC_MODE_X;
- colorComb.SourceB = localc;
- colorComb.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- colorComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- colorComb.InvertC = FXFALSE;
- colorComb.SourceD = GR_CMBX_B;
- break;
- case GL_MODULATE:
- if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) {
- alphaComb.SourceA = locala;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_ZERO;
- alphaComb.InvertC = FXTRUE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- } else {
- alphaComb.SourceA = locala;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- alphaComb.InvertC = FXFALSE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- }
-
- if (ifmt == GL_ALPHA) {
- colorComb.SourceA = localc;
- colorComb.ModeA = GR_FUNC_MODE_X;
- colorComb.SourceB = GR_CMBX_ZERO;
- colorComb.ModeB = GR_FUNC_MODE_X;
- colorComb.SourceC = GR_CMBX_ZERO;
- colorComb.InvertC = FXTRUE;
- colorComb.SourceD = GR_CMBX_ZERO;
- } else {
- colorComb.SourceA = localc;
- colorComb.ModeA = GR_FUNC_MODE_X;
- colorComb.SourceB = GR_CMBX_ZERO;
- colorComb.ModeB = GR_FUNC_MODE_X;
- colorComb.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB;
- colorComb.InvertC = FXFALSE;
- colorComb.SourceD = GR_CMBX_ZERO;
- }
- break;
- case GL_BLEND:
- if (ifmt == GL_INTENSITY) {
- alphaComb.SourceA = GR_CMBX_TMU_CALPHA;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = locala;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- alphaComb.InvertC = FXFALSE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- } else {
- alphaComb.SourceA = locala;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- alphaComb.InvertC = FXFALSE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- }
-
- if (ifmt == GL_ALPHA) {
- colorComb.SourceA = localc;
- colorComb.ModeA = GR_FUNC_MODE_X;
- colorComb.SourceB = GR_CMBX_ZERO;
- colorComb.ModeB = GR_FUNC_MODE_X;
- colorComb.SourceC = GR_CMBX_ZERO;
- colorComb.InvertC = FXTRUE;
- colorComb.SourceD = GR_CMBX_ZERO;
- } else {
- colorComb.SourceA = GR_CMBX_TMU_CCOLOR;
- colorComb.ModeA = GR_FUNC_MODE_X;
- colorComb.SourceB = localc;
- colorComb.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- colorComb.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB;
- colorComb.InvertC = FXFALSE;
- colorComb.SourceD = GR_CMBX_B;
- }
-
- fxMesa->Glide.grConstantColorValueExt(tmu,
- (((GLuint)(envColor[0] * 255.0f)) ) |
- (((GLuint)(envColor[1] * 255.0f)) << 8) |
- (((GLuint)(envColor[2] * 255.0f)) << 16) |
- (((GLuint)(envColor[3] * 255.0f)) << 24));
- break;
- case GL_REPLACE:
- if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) {
- alphaComb.SourceA = locala;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_ZERO;
- alphaComb.InvertC = FXTRUE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- } else {
- alphaComb.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_ZERO;
- alphaComb.InvertC = FXTRUE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- }
-
- if (ifmt == GL_ALPHA) {
- colorComb.SourceA = localc;
- colorComb.ModeA = GR_FUNC_MODE_X;
- colorComb.SourceB = GR_CMBX_ZERO;
- colorComb.ModeB = GR_FUNC_MODE_X;
- colorComb.SourceC = GR_CMBX_ZERO;
- colorComb.InvertC = FXTRUE;
- colorComb.SourceD = GR_CMBX_ZERO;
- } else {
- colorComb.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB;
- colorComb.ModeA = GR_FUNC_MODE_X;
- colorComb.SourceB = GR_CMBX_ZERO;
- colorComb.ModeB = GR_FUNC_MODE_X;
- colorComb.SourceC = GR_CMBX_ZERO;
- colorComb.InvertC = FXTRUE;
- colorComb.SourceD = GR_CMBX_ZERO;
- }
- break;
- case GL_ADD:
- if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) {
- alphaComb.SourceA = locala;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_ZERO;
- alphaComb.InvertC = FXTRUE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- } else if (ifmt == GL_INTENSITY) {
- alphaComb.SourceA = locala;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_ZERO;
- alphaComb.InvertC = FXTRUE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- } else {
- alphaComb.SourceA = locala;
- alphaComb.ModeA = GR_FUNC_MODE_X;
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_X;
- alphaComb.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- alphaComb.InvertC = FXFALSE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- }
-
- if (ifmt == GL_ALPHA) {
- colorComb.SourceA = localc;
- colorComb.ModeA = GR_FUNC_MODE_X;
- colorComb.SourceB = GR_CMBX_ZERO;
- colorComb.ModeB = GR_FUNC_MODE_X;
- colorComb.SourceC = GR_CMBX_ZERO;
- colorComb.InvertC = FXTRUE;
- colorComb.SourceD = GR_CMBX_ZERO;
- } else {
- colorComb.SourceA = localc;
- colorComb.ModeA = GR_FUNC_MODE_X;
- colorComb.SourceB = GR_CMBX_LOCAL_TEXTURE_RGB;
- colorComb.ModeB = GR_FUNC_MODE_X;
- colorComb.SourceC = GR_CMBX_ZERO;
- colorComb.InvertC = FXTRUE;
- colorComb.SourceD = GR_CMBX_ZERO;
- }
- break;
- /* COMBINE_EXT */
- case GL_COMBINE_EXT:
- /* XXX todo - INCOMPLETE!!! */
- if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) {
-#if 1
- fprintf(stderr, "COMBINE_EXT: %s + %s\n",
- _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB),
- _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA));
-#else
- fprintf(stderr, "Texture Unit %d\n", textureset);
- fprintf(stderr, " GL_TEXTURE_ENV_MODE = %s\n", _mesa_lookup_enum_by_nr(texUnit->EnvMode));
- fprintf(stderr, " GL_COMBINE_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB));
- fprintf(stderr, " GL_COMBINE_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA));
- fprintf(stderr, " GL_SOURCE0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[0]));
- fprintf(stderr, " GL_SOURCE1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[1]));
- fprintf(stderr, " GL_SOURCE2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[2]));
- fprintf(stderr, " GL_SOURCE0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[0]));
- fprintf(stderr, " GL_SOURCE1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[1]));
- fprintf(stderr, " GL_SOURCE2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[2]));
- fprintf(stderr, " GL_OPERAND0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[0]));
- fprintf(stderr, " GL_OPERAND1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[1]));
- fprintf(stderr, " GL_OPERAND2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[2]));
- fprintf(stderr, " GL_OPERAND0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[0]));
- fprintf(stderr, " GL_OPERAND1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[1]));
- fprintf(stderr, " GL_OPERAND2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[2]));
- fprintf(stderr, " GL_RGB_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftRGB);
- fprintf(stderr, " GL_ALPHA_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftA);
- fprintf(stderr, " GL_TEXTURE_ENV_COLOR = (%f, %f, %f, %f)\n", envColor[0], envColor[1], envColor[2], envColor[3]);
-#endif
- }
-
- alphaComb.Shift = texUnit->Combine.ScaleShiftA;
- colorComb.Shift = texUnit->Combine.ScaleShiftRGB;
-
- switch (texUnit->Combine.ModeRGB) {
- case GL_MODULATE:
- /* Arg0 * Arg1 == (A + 0) * C + 0 */
- TEXENV_SETUP_ARG_RGB(colorComb.SourceA,
- texUnit->Combine.SourceRGB[0],
- texUnit->Combine.OperandRGB[0],
- localc, locala);
- TEXENV_SETUP_MODE_RGB(colorComb.ModeA,
- texUnit->Combine.OperandRGB[0]);
- colorComb.SourceB = GR_CMBX_ZERO;
- colorComb.ModeB = GR_FUNC_MODE_ZERO;
- TEXENV_SETUP_ARG_RGB(colorComb.SourceC,
- texUnit->Combine.SourceRGB[1],
- texUnit->Combine.OperandRGB[1],
- localc, locala);
- colorComb.InvertC = TEXENV_OPERAND_INVERTED(
- texUnit->Combine.OperandRGB[1]);
- colorComb.SourceD = GR_CMBX_ZERO;
- break;
- case GL_REPLACE:
- /* Arg0 == (A + 0) * 1 + 0 */
- TEXENV_SETUP_ARG_RGB(colorComb.SourceA,
- texUnit->Combine.SourceRGB[0],
- texUnit->Combine.OperandRGB[0],
- localc, locala);
- TEXENV_SETUP_MODE_RGB(colorComb.ModeA,
- texUnit->Combine.OperandRGB[0]);
- colorComb.SourceB = GR_CMBX_ZERO;
- colorComb.ModeB = GR_FUNC_MODE_ZERO;
- colorComb.SourceC = GR_CMBX_ZERO;
- colorComb.InvertC = FXTRUE;
- colorComb.SourceD = GR_CMBX_ZERO;
- break;
- case GL_ADD:
- /* Arg0 + Arg1 = (A + B) * 1 + 0 */
- TEXENV_SETUP_ARG_RGB(colorComb.SourceA,
- texUnit->Combine.SourceRGB[0],
- texUnit->Combine.OperandRGB[0],
- localc, locala);
- TEXENV_SETUP_MODE_RGB(colorComb.ModeA,
- texUnit->Combine.OperandRGB[0]);
- TEXENV_SETUP_ARG_RGB(colorComb.SourceB,
- texUnit->Combine.SourceRGB[1],
- texUnit->Combine.OperandRGB[1],
- localc, locala);
- TEXENV_SETUP_MODE_RGB(colorComb.ModeB,
- texUnit->Combine.OperandRGB[1]);
- colorComb.SourceC = GR_CMBX_ZERO;
- colorComb.InvertC = FXTRUE;
- colorComb.SourceD = GR_CMBX_ZERO;
- break;
- case GL_INTERPOLATE_EXT:
- /* Arg0 * Arg2 + Arg1 * (1 - Arg2) ==
- * (Arg0 - Arg1) * Arg2 + Arg1 == (A - B) * C + D
- */
- TEXENV_SETUP_ARG_RGB(colorComb.SourceA,
- texUnit->Combine.SourceRGB[0],
- texUnit->Combine.OperandRGB[0],
- localc, locala);
- TEXENV_SETUP_MODE_RGB(colorComb.ModeA,
- texUnit->Combine.OperandRGB[0]);
- TEXENV_SETUP_ARG_RGB(colorComb.SourceB,
- texUnit->Combine.SourceRGB[1],
- texUnit->Combine.OperandRGB[1],
- localc, locala);
- if (TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandRGB[1])) {
- /* Hack alert!!! This case is wrong!!! */
- fprintf(stderr, "COMBINE_EXT_color: WRONG!!!\n");
- colorComb.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- } else {
- colorComb.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- }
- /*
- * The Source/Operand for the C value must
- * specify some kind of alpha value.
- */
- TEXENV_SETUP_ARG_A(colorComb.SourceC,
- texUnit->Combine.SourceRGB[2],
- texUnit->Combine.OperandRGB[2],
- locala);
- colorComb.InvertC = FXFALSE;
- colorComb.SourceD = GR_CMBX_B;
- break;
- default:
- fprintf(stderr, "COMBINE_EXT_color: %s\n",
- _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB));
- }
-
- switch (texUnit->Combine.ModeA) {
- case GL_MODULATE:
- /* Arg0 * Arg1 == (A + 0) * C + 0 */
- TEXENV_SETUP_ARG_A(alphaComb.SourceA,
- texUnit->Combine.SourceA[0],
- texUnit->Combine.OperandA[0],
- locala);
- TEXENV_SETUP_MODE_A(alphaComb.ModeA,
- texUnit->Combine.OperandA[0]);
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_ZERO;
- TEXENV_SETUP_ARG_A(alphaComb.SourceC,
- texUnit->Combine.SourceA[1],
- texUnit->Combine.OperandA[1],
- locala);
- alphaComb.InvertC = TEXENV_OPERAND_INVERTED(
- texUnit->Combine.OperandA[1]);
- alphaComb.SourceD = GR_CMBX_ZERO;
- break;
- case GL_REPLACE:
- /* Arg0 == (A + 0) * 1 + 0 */
- TEXENV_SETUP_ARG_A(alphaComb.SourceA,
- texUnit->Combine.SourceA[0],
- texUnit->Combine.OperandA[0],
- locala);
- TEXENV_SETUP_MODE_A(alphaComb.ModeA,
- texUnit->Combine.OperandA[0]);
- alphaComb.SourceB = GR_CMBX_ZERO;
- alphaComb.ModeB = GR_FUNC_MODE_ZERO;
- alphaComb.SourceC = GR_CMBX_ZERO;
- alphaComb.InvertC = FXTRUE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- break;
- case GL_ADD:
- /* Arg0 + Arg1 = (A + B) * 1 + 0 */
- TEXENV_SETUP_ARG_A(alphaComb.SourceA,
- texUnit->Combine.SourceA[0],
- texUnit->Combine.OperandA[0],
- locala);
- TEXENV_SETUP_MODE_A(alphaComb.ModeA,
- texUnit->Combine.OperandA[0]);
- TEXENV_SETUP_ARG_A(alphaComb.SourceB,
- texUnit->Combine.SourceA[1],
- texUnit->Combine.OperandA[1],
- locala);
- TEXENV_SETUP_MODE_A(alphaComb.ModeB,
- texUnit->Combine.OperandA[1]);
- alphaComb.SourceC = GR_CMBX_ZERO;
- alphaComb.InvertC = FXTRUE;
- alphaComb.SourceD = GR_CMBX_ZERO;
- break;
- default:
- fprintf(stderr, "COMBINE_EXT_alpha: %s\n",
- _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA));
- }
-
- fxMesa->Glide.grConstantColorValueExt(tmu,
- (((GLuint)(envColor[0] * 255.0f)) ) |
- (((GLuint)(envColor[1] * 255.0f)) << 8) |
- (((GLuint)(envColor[2] * 255.0f)) << 16) |
- (((GLuint)(envColor[3] * 255.0f)) << 24));
- break;
-
- default:
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTextureEnvNapalm_NoLock: %x Texture.EnvMode not yet supported\n",
- texUnit->EnvMode);
- }
- return;
- }
-
- /* On Napalm we simply put the color combine unit into passthrough mode
- * and do everything we need with the texture combine units. */
- fxMesa->Glide.grColorCombineExt(GR_CMBX_TEXTURE_RGB,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- FXTRUE,
- GR_CMBX_ZERO,
- FXFALSE,
- 0,
- FXFALSE);
- fxMesa->Glide.grAlphaCombineExt(GR_CMBX_TEXTURE_ALPHA,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- FXTRUE,
- GR_CMBX_ZERO,
- FXFALSE,
- 0,
- FXFALSE);
-
- fxMesa->Glide.grTexAlphaCombineExt(tmu,
- alphaComb.SourceA,
- alphaComb.ModeA,
- alphaComb.SourceB,
- alphaComb.ModeB,
- alphaComb.SourceC,
- alphaComb.InvertC,
- alphaComb.SourceD,
- alphaComb.InvertD,
- alphaComb.Shift,
- alphaComb.Invert);
- fxMesa->Glide.grTexColorCombineExt(tmu,
- colorComb.SourceA,
- colorComb.ModeA,
- colorComb.SourceB,
- colorComb.ModeB,
- colorComb.SourceC,
- colorComb.InvertC,
- colorComb.SourceD,
- colorComb.InvertD,
- colorComb.Shift,
- colorComb.Invert);
-}
-
-
-/************************* Single Texture Set ***************************/
-
-static void
-fxSelectSingleTMUSrcNapalm_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
-{
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSelectSingleTMUSrcNapalm_NoLock(%d, %d)\n", tmu, LODblend);
- }
-
- if (LODblend) {
- /* XXX todo - GR_CMBX_LOD_FRAC? */
- fxMesa->tmuSrc = FX_TMU_SPLIT;
- }
- else {
- if (tmu != FX_TMU1) {
- /* disable tex1 */
- if (fxMesa->haveTwoTMUs) {
- fxMesa->Glide.grTexAlphaCombineExt(FX_TMU1,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_ZERO,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_ZERO,
- GR_CMBX_ZERO,
- FXTRUE,
- GR_CMBX_ZERO,
- FXFALSE,
- 0,
- FXFALSE);
- fxMesa->Glide.grTexColorCombineExt(FX_TMU1,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_ZERO,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_ZERO,
- GR_CMBX_ZERO,
- FXTRUE,
- GR_CMBX_ZERO,
- FXFALSE,
- 0,
- FXFALSE);
- }
-
- fxMesa->tmuSrc = FX_TMU0;
- }
- else {
-#if 1
- grTexCombine(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND,
- GR_COMBINE_FACTOR_ONE,
- GR_COMBINE_FUNCTION_BLEND,
- GR_COMBINE_FACTOR_ONE,
- FXFALSE,
- FXFALSE);
-#else
- /* [dBorca] why, oh why? doesn't work! stupid Glide? */
- fxMesa->Glide.grTexAlphaCombineExt(FX_TMU0,
- GR_CMBX_OTHER_TEXTURE_ALPHA,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- FXTRUE,
- GR_CMBX_ZERO,
- FXFALSE,
- 0,
- FXFALSE);
- fxMesa->Glide.grTexColorCombineExt(FX_TMU0,
- GR_CMBX_OTHER_TEXTURE_RGB,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- FXTRUE,
- GR_CMBX_ZERO,
- FXFALSE,
- 0,
- FXFALSE);
-#endif
-
- fxMesa->tmuSrc = FX_TMU1;
- }
- }
-}
-
-static void
-fxSetupTextureSingleTMUNapalm_NoLock(GLcontext * ctx, GLuint textureset)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLuint unitsmode;
- tfxTexInfo *ti;
- struct gl_texture_object *tObj = ctx->Texture.Unit[textureset]._Current;
- int tmu;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTextureSingleTMUNapalm_NoLock(%d)\n", textureset);
- }
-
- ti = fxTMGetTexInfo(tObj);
-
- fxTexValidate(ctx, tObj);
-
- fxSetupSingleTMU_NoLock(fxMesa, tObj);
-
- if (ti->whichTMU == FX_TMU_BOTH)
- tmu = FX_TMU0;
- else
- tmu = ti->whichTMU;
- if (fxMesa->tmuSrc != tmu)
- fxSelectSingleTMUSrcNapalm_NoLock(fxMesa, tmu, ti->LODblend);
-
- if (textureset == 0 || !fxMesa->haveTwoTMUs)
- unitsmode = fxGetTexSetConfiguration(ctx, tObj, NULL);
- else
- unitsmode = fxGetTexSetConfiguration(ctx, NULL, tObj);
-
-/* if(fxMesa->lastUnitsMode==unitsmode) */
-/* return; */
-
- fxMesa->lastUnitsMode = unitsmode;
-
- fxMesa->stw_hint_state = 0;
- FX_grHints_NoLock(GR_HINT_STWHINT, 0);
-
- if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "fxSetupTextureSingleTMUNapalm_NoLock: envmode is %s\n",
- _mesa_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode));
-
- /* [dBorca] Hack alert:
- * what if we're in split mode? (LODBlend)
- * also should we update BOTH TMUs in FX_TMU_BOTH mode?
- */
- fxSetupTextureEnvNapalm_NoLock(ctx, textureset, tmu, GL_TRUE);
-}
-
-
-/************************* Double Texture Set ***************************/
-
-static void
-fxSetupTextureDoubleTMUNapalm_NoLock(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxTexInfo *ti0, *ti1;
- struct gl_texture_object *tObj0 = ctx->Texture.Unit[1]._Current;
- struct gl_texture_object *tObj1 = ctx->Texture.Unit[0]._Current;
- GLuint unitsmode;
- int tmu0 = 0, tmu1 = 1;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTextureDoubleTMUNapalm_NoLock(...)\n");
- }
-
- ti0 = fxTMGetTexInfo(tObj0);
- fxTexValidate(ctx, tObj0);
-
- ti1 = fxTMGetTexInfo(tObj1);
- fxTexValidate(ctx, tObj1);
-
- fxSetupDoubleTMU_NoLock(fxMesa, tObj0, tObj1);
-
- unitsmode = fxGetTexSetConfiguration(ctx, tObj0, tObj1);
-
-/* if(fxMesa->lastUnitsMode==unitsmode) */
-/* return; */
-
- fxMesa->lastUnitsMode = unitsmode;
-
- fxMesa->stw_hint_state |= GR_STWHINT_ST_DIFF_TMU1;
- FX_grHints_NoLock(GR_HINT_STWHINT, fxMesa->stw_hint_state);
-
- if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "fxSetupTextureDoubleTMUNapalm_NoLock: envmode is %s/%s\n",
- _mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
- _mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
-
-
- if ((ti0->whichTMU == FX_TMU1) || (ti1->whichTMU == FX_TMU0)) {
- tmu0 = 1;
- tmu1 = 0;
- }
- fxMesa->tmuSrc = FX_TMU_BOTH;
-
- /* OpenGL vs Glide texture pipeline */
- fxSetupTextureEnvNapalm_NoLock(ctx, 0, 1, GL_TRUE);
- fxSetupTextureEnvNapalm_NoLock(ctx, 1, 0, GL_FALSE);
-}
-
-/************************* No Texture ***************************/
-
-static void
-fxSetupTextureNoneNapalm_NoLock(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxSetupTextureNoneNapalm_NoLock(...)\n");
- }
-
- /* the combiner formula is: (A + B) * C + D
- **
- ** a = tc_otherselect
- ** a_mode = tc_invert_other
- ** b = tc_localselect
- ** b_mode = tc_invert_local
- ** c = (tc_mselect, tc_mselect_7)
- ** d = (tc_add_clocal, tc_add_alocal)
- ** shift = tc_outshift
- ** invert = tc_invert_output
- */
-
- fxMesa->Glide.grColorCombineExt(GR_CMBX_ITRGB,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_ZERO,
- GR_CMBX_ZERO,
- FXTRUE,
- GR_CMBX_ZERO,
- FXFALSE,
- 0,
- FXFALSE);
- fxMesa->Glide.grAlphaCombineExt(GR_CMBX_ITALPHA,
- GR_FUNC_MODE_X,
- GR_CMBX_ZERO,
- GR_FUNC_MODE_ZERO,
- GR_CMBX_ZERO,
- FXTRUE,
- GR_CMBX_ZERO,
- FXFALSE,
- 0,
- FXFALSE);
-
- fxMesa->lastUnitsMode = FX_UM_NONE;
-}
diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c
deleted file mode 100644
index 940c8fd0b97..00000000000
--- a/src/mesa/drivers/glide/fxtexman.c
+++ /dev/null
@@ -1,874 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * David Bucciarelli
- * Brian Paul
- * Daryll Strauss
- * Keith Whitwell
- * Daniel Borca
- * Hiroshi Morii
- */
-
-/* fxtexman.c - 3Dfx VooDoo texture memory functions */
-
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#if defined(FX)
-
-#include "hash.h"
-#include "fxdrv.h"
-
-int texSwaps = 0;
-static FxU32 texBoundMask;
-
-#define FX_2MB_SPLIT 0x200000
-
-static struct gl_texture_object *fxTMFindOldestObject(fxMesaContext fxMesa,
- int tmu);
-
-
-#ifdef TEXSANITY
-static void
-fubar()
-{
-}
-
- /* Sanity Check */
-static void
-sanity(fxMesaContext fxMesa)
-{
- MemRange *tmp, *prev, *pos;
-
- prev = 0;
- tmp = fxMesa->tmFree[0];
- while (tmp) {
- if (!tmp->startAddr && !tmp->endAddr) {
- fprintf(stderr, "Textures fubar\n");
- fubar();
- }
- if (tmp->startAddr >= tmp->endAddr) {
- fprintf(stderr, "Node fubar\n");
- fubar();
- }
- if (prev && (prev->startAddr >= tmp->startAddr ||
- prev->endAddr > tmp->startAddr)) {
- fprintf(stderr, "Sorting fubar\n");
- fubar();
- }
- prev = tmp;
- tmp = tmp->next;
- }
- prev = 0;
- tmp = fxMesa->tmFree[1];
- while (tmp) {
- if (!tmp->startAddr && !tmp->endAddr) {
- fprintf(stderr, "Textures fubar\n");
- fubar();
- }
- if (tmp->startAddr >= tmp->endAddr) {
- fprintf(stderr, "Node fubar\n");
- fubar();
- }
- if (prev && (prev->startAddr >= tmp->startAddr ||
- prev->endAddr > tmp->startAddr)) {
- fprintf(stderr, "Sorting fubar\n");
- fubar();
- }
- prev = tmp;
- tmp = tmp->next;
- }
-}
-#endif
-
-static MemRange *
-fxTMNewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end)
-{
- MemRange *result = 0;
-
- if (fxMesa->tmPool) {
- result = fxMesa->tmPool;
- fxMesa->tmPool = fxMesa->tmPool->next;
- }
- else {
- if (!(result = MALLOC(sizeof(MemRange)))) {
- fprintf(stderr, "fxTMNewRangeNode: ERROR: out of memory!\n");
- fxCloseHardware();
- exit(-1);
- }
- }
- result->startAddr = start;
- result->endAddr = end;
- return result;
-}
-
-#if 1
-#define fxTMDeleteRangeNode(fxMesa, range) \
- do { \
- range->next = fxMesa->tmPool; \
- fxMesa->tmPool = range; \
- } while (0);
-#else
-static void
-fxTMDeleteRangeNode(fxMesaContext fxMesa, MemRange * range)
-{
- range->next = fxMesa->tmPool;
- fxMesa->tmPool = range;
-}
-#endif
-
-static void
-fxTMUInit(fxMesaContext fxMesa, int tmu)
-{
- MemRange *tmn, *last;
- FxU32 start, end, blockstart, blockend, chunk;
-
- start = grTexMinAddress(tmu);
- end = grTexMaxAddress(tmu);
-
- chunk = (fxMesa->type >= GR_SSTTYPE_Banshee) ? (end - start) : FX_2MB_SPLIT;
-
- if (fxMesa->verbose) {
- fprintf(stderr, "Voodoo TMU%d configuration:\n", tmu);
- }
-
- fxMesa->freeTexMem[tmu] = end - start;
- fxMesa->tmFree[tmu] = NULL;
-
- last = 0;
- blockstart = start;
- while (blockstart < end) {
- if (blockstart + chunk > end)
- blockend = end;
- else
- blockend = blockstart + chunk;
-
- if (fxMesa->verbose)
- fprintf(stderr, "Voodoo %08u-%08u\n",
- (unsigned int) blockstart, (unsigned int) blockend);
-
- tmn = fxTMNewRangeNode(fxMesa, blockstart, blockend);
- tmn->next = NULL;
-
-
- if (last)
- last->next = tmn;
- else
- fxMesa->tmFree[tmu] = tmn;
- last = tmn;
-
- blockstart += chunk;
- }
-}
-
-static int
-fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size)
-{
- MemRange *prev, *tmp;
- int result;
- struct gl_texture_object *obj;
-
- if (fxMesa->HaveTexUma) {
- tmu = FX_TMU0;
- }
-
- while (1) {
- prev = 0;
- tmp = fxMesa->tmFree[tmu];
- while (tmp) {
- if (tmp->endAddr - tmp->startAddr >= size) { /* Fits here */
- result = tmp->startAddr;
- tmp->startAddr += size;
- if (tmp->startAddr == tmp->endAddr) { /* Empty */
- if (prev) {
- prev->next = tmp->next;
- }
- else {
- fxMesa->tmFree[tmu] = tmp->next;
- }
- fxTMDeleteRangeNode(fxMesa, tmp);
- }
- fxMesa->freeTexMem[tmu] -= size;
- return result;
- }
- prev = tmp;
- tmp = tmp->next;
- }
- /* No free space. Discard oldest */
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxTMFindStartAddr: No free space. Discard oldest\n");
- }
- obj = fxTMFindOldestObject(fxMesa, tmu);
- if (!obj) {
- fprintf(stderr, "fxTMFindStartAddr: ERROR: No space for texture\n");
- return -1;
- }
- fxTMMoveOutTM(fxMesa, obj);
- texSwaps++;
- }
-}
-
-int fxTMCheckStartAddr (fxMesaContext fxMesa, GLint tmu, tfxTexInfo *ti)
-{
- MemRange *tmp;
- int size;
-
- if (fxMesa->HaveTexUma) {
- return FXTRUE;
- }
-
- size = grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
-
- tmp = fxMesa->tmFree[tmu];
- while (tmp) {
- if (tmp->endAddr - tmp->startAddr >= size) { /* Fits here */
- return FXTRUE;
- }
- tmp = tmp->next;
- }
-
- return FXFALSE;
-}
-
-static void
-fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range)
-{
- MemRange *tmp, *prev;
-
- if (fxMesa->HaveTexUma) {
- tmu = FX_TMU0;
- }
-
- if (range->startAddr == range->endAddr) {
- fxTMDeleteRangeNode(fxMesa, range);
- return;
- }
- fxMesa->freeTexMem[tmu] += range->endAddr - range->startAddr;
- prev = 0;
- tmp = fxMesa->tmFree[tmu];
- while (tmp) {
- if (range->startAddr > tmp->startAddr) {
- prev = tmp;
- tmp = tmp->next;
- }
- else
- break;
- }
- /* When we create the regions, we make a split at the 2MB boundary.
- Now we have to make sure we don't join those 2MB boundary regions
- back together again. */
- range->next = tmp;
- if (tmp) {
- if (range->endAddr == tmp->startAddr
- && tmp->startAddr & texBoundMask) {
- /* Combine */
- tmp->startAddr = range->startAddr;
- fxTMDeleteRangeNode(fxMesa, range);
- range = tmp;
- }
- }
- if (prev) {
- if (prev->endAddr == range->startAddr
- && range->startAddr & texBoundMask) {
- /* Combine */
- prev->endAddr = range->endAddr;
- prev->next = range->next;
- fxTMDeleteRangeNode(fxMesa, range);
- }
- else
- prev->next = range;
- }
- else {
- fxMesa->tmFree[tmu] = range;
- }
-}
-
-static struct gl_texture_object *
-fxTMFindOldestObject(fxMesaContext fxMesa, int tmu)
-{
- GLuint age, old, lasttime, bindnumber;
- GLfloat lowestPriority;
- struct gl_texture_object *obj, *lowestPriorityObj;
- struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
- GLuint id;
-
- if (!_mesa_HashFirstEntry(textures))
- return 0;
-
- obj = NULL;
- old = 0;
-
- lowestPriorityObj = NULL;
- lowestPriority = 1.0F;
-
- bindnumber = fxMesa->texBindNumber;
-
- for (id = _mesa_HashFirstEntry(textures);
- id;
- id = _mesa_HashNextEntry(textures, id)) {
- struct gl_texture_object *tmp
- = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
- tfxTexInfo *info = fxTMGetTexInfo(tmp);
-
- if (info && info->isInTM &&
- ((info->whichTMU == tmu) ||
- (info->whichTMU == FX_TMU_BOTH) ||
- (info->whichTMU == FX_TMU_SPLIT) ||
- fxMesa->HaveTexUma
- )
- ) {
- lasttime = info->lastTimeUsed;
-
- if (lasttime > bindnumber)
- age = bindnumber + (UINT_MAX - lasttime + 1); /* TO DO: check wrap around */
- else
- age = bindnumber - lasttime;
-
- if (age >= old) {
- old = age;
- obj = tmp;
- }
-
- /* examine priority */
- if (tmp->Priority < lowestPriority) {
- lowestPriority = tmp->Priority;
- lowestPriorityObj = tmp;
- }
- }
- }
-
- if (lowestPriorityObj != NULL) {
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxTMFindOldestObject: %d pri=%f\n", lowestPriorityObj->Name, lowestPriority);
- }
- return lowestPriorityObj;
- }
- else {
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- if (obj != NULL) {
- fprintf(stderr, "fxTMFindOldestObject: %d age=%d\n", obj->Name, old);
- }
- }
- return obj;
- }
-}
-
-static MemRange *
-fxTMAddObj(fxMesaContext fxMesa,
- struct gl_texture_object *tObj, GLint tmu, int texmemsize)
-{
- FxI32 startAddr;
- MemRange *range;
-
- startAddr = fxTMFindStartAddr(fxMesa, tmu, texmemsize);
- if (startAddr < 0)
- return 0;
- range = fxTMNewRangeNode(fxMesa, startAddr, startAddr + texmemsize);
- return range;
-}
-
-/* External Functions */
-
-void
-fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
- GLint where)
-{
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- int i, l;
- int texmemsize;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxTMMoveInTM_NoLock(%d)\n", tObj->Name);
- }
-
- fxMesa->stats.reqTexUpload++;
-
- if (!ti->validated) {
- fprintf(stderr, "fxTMMoveInTM_NoLock: INTERNAL ERROR: not validated\n");
- fxCloseHardware();
- exit(-1);
- }
-
- if (ti->isInTM) {
- if (ti->whichTMU == where)
- return;
- if (where == FX_TMU_SPLIT || ti->whichTMU == FX_TMU_SPLIT)
- fxTMMoveOutTM_NoLock(fxMesa, tObj);
- else {
- if (ti->whichTMU == FX_TMU_BOTH)
- return;
- where = FX_TMU_BOTH;
- }
- }
-
- if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) {
- fprintf(stderr, "fxTMMoveInTM_NoLock: downloading %p (%d) in texture memory in %d\n",
- (void *)tObj, tObj->Name, where);
- }
-
- ti->whichTMU = (FxU32) where;
-
- switch (where) {
- case FX_TMU0:
- case FX_TMU1:
- texmemsize = (int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
- ti->tm[where] = fxTMAddObj(fxMesa, tObj, where, texmemsize);
- fxMesa->stats.memTexUpload += texmemsize;
-
- for (i = FX_largeLodValue(ti->info), l = ti->minLevel;
- i <= FX_smallLodValue(ti->info); i++, l++) {
- struct gl_texture_image *texImage = tObj->Image[0][l];
- grTexDownloadMipMapLevel(where,
- ti->tm[where]->startAddr,
- FX_valueToLod(i),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- texImage->Data);
- }
- break;
- case FX_TMU_SPLIT:
- texmemsize = (int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_ODD, &(ti->info));
- ti->tm[FX_TMU0] = fxTMAddObj(fxMesa, tObj, FX_TMU0, texmemsize);
- fxMesa->stats.memTexUpload += texmemsize;
-
- texmemsize = (int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_EVEN, &(ti->info));
- ti->tm[FX_TMU1] = fxTMAddObj(fxMesa, tObj, FX_TMU1, texmemsize);
- fxMesa->stats.memTexUpload += texmemsize;
-
- for (i = FX_largeLodValue(ti->info), l = ti->minLevel;
- i <= FX_smallLodValue(ti->info); i++, l++) {
- struct gl_texture_image *texImage = tObj->Image[0][l];
-
- grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[FX_TMU0]->startAddr,
- FX_valueToLod(i),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_ODD,
- texImage->Data);
-
- grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[FX_TMU1]->startAddr,
- FX_valueToLod(i),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_EVEN,
- texImage->Data);
- }
- break;
- case FX_TMU_BOTH:
- texmemsize = (int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
- ti->tm[FX_TMU0] = fxTMAddObj(fxMesa, tObj, FX_TMU0, texmemsize);
- fxMesa->stats.memTexUpload += texmemsize;
-
- /*texmemsize = (int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &(ti->info));*/
- ti->tm[FX_TMU1] = fxTMAddObj(fxMesa, tObj, FX_TMU1, texmemsize);
- fxMesa->stats.memTexUpload += texmemsize;
-
- for (i = FX_largeLodValue(ti->info), l = ti->minLevel;
- i <= FX_smallLodValue(ti->info); i++, l++) {
- struct gl_texture_image *texImage = tObj->Image[0][l];
- grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[FX_TMU0]->startAddr,
- FX_valueToLod(i),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- texImage->Data);
-
- grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[FX_TMU1]->startAddr,
- FX_valueToLod(i),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- texImage->Data);
- }
- break;
- default:
- fprintf(stderr, "fxTMMoveInTM_NoLock: INTERNAL ERROR: wrong tmu (%d)\n", where);
- fxCloseHardware();
- exit(-1);
- }
-
- fxMesa->stats.texUpload++;
-
- ti->isInTM = GL_TRUE;
-}
-
-
-void
-fxTMMoveInTM(fxMesaContext fxMesa, struct gl_texture_object *tObj,
- GLint where)
-{
- BEGIN_BOARD_LOCK();
- fxTMMoveInTM_NoLock(fxMesa, tObj, where);
- END_BOARD_LOCK();
-}
-
-
-void
-fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
- GLint level)
-{
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- GrLOD_t lodlevel;
- GLint tmu;
- struct gl_texture_image *texImage = tObj->Image[0][level];
- tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
-
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxTMReloadMipMapLevel(%p (%d), %d)\n", (void *)tObj, tObj->Name, level);
- }
-
- assert(mml);
- assert(mml->width > 0);
- assert(mml->height > 0);
- assert(mml->glideFormat > 0);
- assert(ti->isInTM);
-
- if (!ti->validated) {
- fprintf(stderr, "fxTMReloadMipMapLevel: INTERNAL ERROR: not validated\n");
- fxCloseHardware();
- exit(-1);
- }
-
- tmu = (int) ti->whichTMU;
- fxMesa->stats.reqTexUpload++;
- fxMesa->stats.texUpload++;
-
- lodlevel = ti->info.largeLodLog2 - (level - ti->minLevel);
-
- switch (tmu) {
- case FX_TMU0:
- case FX_TMU1:
- grTexDownloadMipMapLevel(tmu,
- ti->tm[tmu]->startAddr,
- lodlevel,
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH, texImage->Data);
- break;
- case FX_TMU_SPLIT:
- grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[GR_TMU0]->startAddr,
- lodlevel,
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_ODD, texImage->Data);
-
- grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[GR_TMU1]->startAddr,
- lodlevel,
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_EVEN, texImage->Data);
- break;
- case FX_TMU_BOTH:
- grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[GR_TMU0]->startAddr,
- lodlevel,
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH, texImage->Data);
-
- grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[GR_TMU1]->startAddr,
- lodlevel,
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH, texImage->Data);
- break;
-
- default:
- fprintf(stderr, "fxTMReloadMipMapLevel: INTERNAL ERROR: wrong tmu (%d)\n", tmu);
- fxCloseHardware();
- exit(-1);
- }
-}
-
-void
-fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
- struct gl_texture_object *tObj,
- GLint level, GLint yoffset, GLint height)
-{
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- GrLOD_t lodlevel;
- unsigned short *data;
- GLint tmu;
- struct gl_texture_image *texImage = tObj->Image[0][level];
- tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
-
- assert(mml);
-
- if (!ti->validated) {
- fprintf(stderr, "fxTMReloadSubMipMapLevel: INTERNAL ERROR: not validated\n");
- fxCloseHardware();
- exit(-1);
- }
-
- tmu = (int) ti->whichTMU;
- fxTMMoveInTM(fxMesa, tObj, tmu);
-
- fxTexGetInfo(mml->width, mml->height,
- &lodlevel, NULL, NULL, NULL, NULL, NULL);
-
- if ((ti->info.format == GR_TEXFMT_INTENSITY_8) ||
- (ti->info.format == GR_TEXFMT_P_8) ||
- (ti->info.format == GR_TEXFMT_ALPHA_8))
- data = (GLushort *) texImage->Data + ((yoffset * mml->width) >> 1);
- else
- data = (GLushort *) texImage->Data + yoffset * mml->width;
-
- switch (tmu) {
- case FX_TMU0:
- case FX_TMU1:
- grTexDownloadMipMapLevelPartial(tmu,
- ti->tm[tmu]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)
- + level),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH, data,
- yoffset, yoffset + height - 1);
- break;
- case FX_TMU_SPLIT:
- grTexDownloadMipMapLevelPartial(GR_TMU0,
- ti->tm[FX_TMU0]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)
- + level),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_ODD, data,
- yoffset, yoffset + height - 1);
-
- grTexDownloadMipMapLevelPartial(GR_TMU1,
- ti->tm[FX_TMU1]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)
- + level),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_EVEN, data,
- yoffset, yoffset + height - 1);
- break;
- case FX_TMU_BOTH:
- grTexDownloadMipMapLevelPartial(GR_TMU0,
- ti->tm[FX_TMU0]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)
- + level),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH, data,
- yoffset, yoffset + height - 1);
-
- grTexDownloadMipMapLevelPartial(GR_TMU1,
- ti->tm[FX_TMU1]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)
- + level),
- FX_largeLodLog2(ti->info),
- FX_aspectRatioLog2(ti->info),
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH, data,
- yoffset, yoffset + height - 1);
- break;
- default:
- fprintf(stderr, "fxTMReloadSubMipMapLevel: INTERNAL ERROR: wrong tmu (%d)\n", tmu);
- fxCloseHardware();
- exit(-1);
- }
-}
-
-void
-fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
-{
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxTMMoveOutTM(%p (%d))\n", (void *)tObj, tObj->Name);
- }
-
- if (!ti->isInTM)
- return;
-
- switch (ti->whichTMU) {
- case FX_TMU0:
- case FX_TMU1:
- fxTMRemoveRange(fxMesa, (int) ti->whichTMU, ti->tm[ti->whichTMU]);
- break;
- case FX_TMU_SPLIT:
- case FX_TMU_BOTH:
- fxTMRemoveRange(fxMesa, FX_TMU0, ti->tm[FX_TMU0]);
- fxTMRemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]);
- break;
- default:
- fprintf(stderr, "fxTMMoveOutTM: INTERNAL ERROR: bad TMU (%ld)\n", ti->whichTMU);
- fxCloseHardware();
- exit(-1);
- }
-
- ti->isInTM = GL_FALSE;
- ti->whichTMU = FX_TMU_NONE;
-}
-
-void
-fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
-{
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- int i;
-
- if (TDFX_DEBUG & VERBOSE_TEXTURE) {
- fprintf(stderr, "fxTMFreeTexture(%p (%d))\n", (void *)tObj, tObj->Name);
- }
-
- fxTMMoveOutTM(fxMesa, tObj);
-
- for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
- struct gl_texture_image *texImage = tObj->Image[0][i];
- if (texImage) {
- if (texImage->DriverData) {
- FREE(texImage->DriverData);
- texImage->DriverData = NULL;
- }
- }
- }
- switch (ti->whichTMU) {
- case FX_TMU0:
- case FX_TMU1:
- fxTMDeleteRangeNode(fxMesa, ti->tm[ti->whichTMU]);
- break;
- case FX_TMU_SPLIT:
- case FX_TMU_BOTH:
- fxTMDeleteRangeNode(fxMesa, ti->tm[FX_TMU0]);
- fxTMDeleteRangeNode(fxMesa, ti->tm[FX_TMU1]);
- break;
- }
-}
-
-void
-fxTMInit(fxMesaContext fxMesa)
-{
- fxMesa->texBindNumber = 0;
- fxMesa->tmPool = 0;
-
- if (fxMesa->HaveTexUma) {
- grEnable(GR_TEXTURE_UMA_EXT);
- }
-
- fxTMUInit(fxMesa, FX_TMU0);
-
- if (!fxMesa->HaveTexUma && fxMesa->haveTwoTMUs)
- fxTMUInit(fxMesa, FX_TMU1);
-
- texBoundMask = (fxMesa->type >= GR_SSTTYPE_Banshee) ? -1 : (FX_2MB_SPLIT - 1);
-}
-
-void
-fxTMClose(fxMesaContext fxMesa)
-{
- MemRange *tmp, *next;
-
- tmp = fxMesa->tmPool;
- while (tmp) {
- next = tmp->next;
- FREE(tmp);
- tmp = next;
- }
- tmp = fxMesa->tmFree[FX_TMU0];
- while (tmp) {
- next = tmp->next;
- FREE(tmp);
- tmp = next;
- }
- if (fxMesa->haveTwoTMUs) {
- tmp = fxMesa->tmFree[FX_TMU1];
- while (tmp) {
- next = tmp->next;
- FREE(tmp);
- tmp = next;
- }
- }
-}
-
-void
-fxTMRestoreTextures_NoLock(fxMesaContext ctx)
-{
- struct _mesa_HashTable *textures = ctx->glCtx->Shared->TexObjects;
- GLuint id;
-
- for (id = _mesa_HashFirstEntry(textures);
- id;
- id = _mesa_HashNextEntry(textures, id)) {
- struct gl_texture_object *tObj
- = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
- tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- if (ti && ti->isInTM) {
- int i;
- for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
- if (ctx->glCtx->Texture.Unit[i]._Current == tObj) {
- /* Force the texture onto the board, as it could be in use */
- int where = ti->whichTMU;
- fxTMMoveOutTM_NoLock(ctx, tObj);
- fxTMMoveInTM_NoLock(ctx, tObj, where);
- break;
- }
- }
- if (i == MAX_TEXTURE_UNITS) /* Mark the texture as off the board */
- fxTMMoveOutTM_NoLock(ctx, tObj);
- }
- }
-}
-
-#else
-
-
-/*
- * Need this to provide at least one external definition.
- */
-
-extern int gl_fx_dummy_function_texman(void);
-int
-gl_fx_dummy_function_texman(void)
-{
- return 0;
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c
deleted file mode 100644
index aff91fe7d4c..00000000000
--- a/src/mesa/drivers/glide/fxtris.c
+++ /dev/null
@@ -1,1832 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Daniel Borca <dborca@users.sourceforge.net>
- */
-
-#include "glheader.h"
-
-#ifdef FX
-
-#include "main/imports.h"
-#include "main/mtypes.h"
-#include "main/macros.h"
-#include "main/colormac.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "fxdrv.h"
-
-
-static GLboolean fxMultipass_ColorSum (GLcontext *ctx, GLuint pass);
-
-
-/*
- * Subpixel offsets to adjust Mesa's (true) window coordinates to
- * Glide coordinates. We need these to ensure precise rasterization.
- * Otherwise, we'll fail a bunch of conformance tests.
- */
-#define TRI_X_OFFSET ( 0.0F)
-#define TRI_Y_OFFSET ( 0.0F)
-#define LINE_X_OFFSET ( 0.0F)
-#define LINE_Y_OFFSET ( 0.125F)
-#define PNT_X_OFFSET ( 0.375F)
-#define PNT_Y_OFFSET ( 0.375F)
-
-static void fxRasterPrimitive( GLcontext *ctx, GLenum prim );
-static void fxRenderPrimitive( GLcontext *ctx, GLenum prim );
-
-static GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- fxMesa->draw_tri( fxMesa, a, b, c ); \
- else \
- grDrawTriangle( a, b, c ); \
-} while (0) \
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- fxMesa->draw_tri( fxMesa, a, b, d ); \
- fxMesa->draw_tri( fxMesa, b, c, d ); \
- } else { \
- GrVertex *_v_[4]; \
- _v_[0] = d; \
- _v_[1] = a; \
- _v_[2] = b; \
- _v_[3] = c; \
- grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);\
- /*grDrawTriangle( a, b, d );*/ \
- /*grDrawTriangle( b, c, d );*/ \
- } \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- fxMesa->draw_line( fxMesa, v0, v1 ); \
- else { \
- v0->x += LINE_X_OFFSET - TRI_X_OFFSET; \
- v0->y += LINE_Y_OFFSET - TRI_Y_OFFSET; \
- v1->x += LINE_X_OFFSET - TRI_X_OFFSET; \
- v1->y += LINE_Y_OFFSET - TRI_Y_OFFSET; \
- grDrawLine( v0, v1 ); \
- v0->x -= LINE_X_OFFSET - TRI_X_OFFSET; \
- v0->y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \
- v1->x -= LINE_X_OFFSET - TRI_X_OFFSET; \
- v1->y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \
- } \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- fxMesa->draw_point( fxMesa, v0 ); \
- else { \
- v0->x += PNT_X_OFFSET - TRI_X_OFFSET; \
- v0->y += PNT_Y_OFFSET - TRI_Y_OFFSET; \
- grDrawPoint( v0 ); \
- v0->x -= PNT_X_OFFSET - TRI_X_OFFSET; \
- v0->y -= PNT_Y_OFFSET - TRI_Y_OFFSET; \
- } \
-} while (0)
-
-
-/***********************************************************************
- * Fallback to swrast for basic primitives *
- ***********************************************************************/
-
-/* Build an SWvertex from a hardware vertex.
- *
- * This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-static void
-fx_translate_vertex( GLcontext *ctx, const GrVertex *src, SWvertex *dst)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLuint ts0 = fxMesa->tmu_source[0];
- GLuint ts1 = fxMesa->tmu_source[1];
- GLfloat w = 1.0F / src->oow;
-
- dst->win[0] = src->x;
- dst->win[1] = src->y;
- dst->win[2] = src->ooz;
- dst->win[3] = src->oow;
-
-#if FX_PACKEDCOLOR
- dst->color[0] = src->pargb[2];
- dst->color[1] = src->pargb[1];
- dst->color[2] = src->pargb[0];
- dst->color[3] = src->pargb[3];
-
- dst->specular[0] = src->pspec[2];
- dst->specular[1] = src->pspec[1];
- dst->specular[2] = src->pspec[0];
-#else /* !FX_PACKEDCOLOR */
- dst->color[0] = src->r;
- dst->color[1] = src->g;
- dst->color[2] = src->b;
- dst->color[3] = src->a;
-
- dst->specular[0] = src->r1;
- dst->specular[1] = src->g1;
- dst->specular[2] = src->g1;
-#endif /* !FX_PACKEDCOLOR */
-
- dst->texcoord[ts0][0] = fxMesa->inv_s0scale * src->tmuvtx[0].sow * w;
- dst->texcoord[ts0][1] = fxMesa->inv_t0scale * src->tmuvtx[0].tow * w;
-
- if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU0)
- dst->texcoord[ts0][3] = src->tmuvtx[0].oow * w;
- else
- dst->texcoord[ts0][3] = 1.0F;
-
- if (fxMesa->SetupIndex & SETUP_TMU1) {
- dst->texcoord[ts1][0] = fxMesa->inv_s1scale * src->tmuvtx[1].sow * w;
- dst->texcoord[ts1][1] = fxMesa->inv_t1scale * src->tmuvtx[1].tow * w;
-
- if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU1)
- dst->texcoord[ts1][3] = src->tmuvtx[1].oow * w;
- else
- dst->texcoord[ts1][3] = 1.0F;
- }
-
- dst->pointSize = src->psize;
-}
-
-
-static void
-fx_fallback_tri( fxMesaContext fxMesa,
- GrVertex *v0,
- GrVertex *v1,
- GrVertex *v2 )
-{
- GLcontext *ctx = fxMesa->glCtx;
- SWvertex v[3];
-
- fx_translate_vertex( ctx, v0, &v[0] );
- fx_translate_vertex( ctx, v1, &v[1] );
- fx_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-fx_fallback_line( fxMesaContext fxMesa,
- GrVertex *v0,
- GrVertex *v1 )
-{
- GLcontext *ctx = fxMesa->glCtx;
- SWvertex v[2];
- fx_translate_vertex( ctx, v0, &v[0] );
- fx_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-fx_fallback_point( fxMesaContext fxMesa,
- GrVertex *v0 )
-{
- GLcontext *ctx = fxMesa->glCtx;
- SWvertex v[1];
- fx_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-/***********************************************************************
- * Functions to draw basic primitives *
- ***********************************************************************/
-
-static void fx_print_vertex( GLcontext *ctx, const GrVertex *v )
-{
- fprintf(stderr, "fx_print_vertex:\n");
-
- fprintf(stderr, "\tvertex at %p\n", (void *) v);
-
- fprintf(stderr, "\tx %f y %f z %f oow %f\n", v->x, v->y, v->ooz, v->oow);
-#if FX_PACKEDCOLOR
- fprintf(stderr, "\tr %d g %d b %d a %d\n", v->pargb[2], v->pargb[1], v->pargb[0], v->pargb[3]);
-#else /* !FX_PACKEDCOLOR */
- fprintf(stderr, "\tr %f g %f b %f a %f\n", v->r, v->g, v->b, v->a);
-#endif /* !FX_PACKEDCOLOR */
-
- fprintf(stderr, "\n");
-}
-
-#define DO_FALLBACK 0
-
-/* Need to do clip loop at each triangle when mixing swrast and hw
- * rendering. These functions are only used when mixed-mode rendering
- * is occurring.
- */
-static void fx_draw_triangle( fxMesaContext fxMesa,
- GrVertex *v0,
- GrVertex *v1,
- GrVertex *v2 )
-{
- BEGIN_CLIP_LOOP();
- TRI( v0, v1, v2 );
- END_CLIP_LOOP();
-}
-
-static void fx_draw_line( fxMesaContext fxMesa,
- GrVertex *v0,
- GrVertex *v1 )
-{
- /* No support for wide lines (avoid wide/aa line fallback).
- */
- BEGIN_CLIP_LOOP();
- LINE(v0, v1);
- END_CLIP_LOOP();
-}
-
-static void fx_draw_point( fxMesaContext fxMesa,
- GrVertex *v0 )
-{
- /* No support for wide points.
- */
- BEGIN_CLIP_LOOP();
- POINT( v0 );
- END_CLIP_LOOP();
-}
-
-#ifndef M_2PI
-#define M_2PI 6.28318530717958647692528676655901
-#endif
-#define __GL_COSF cos
-#define __GL_SINF sin
-static void fx_draw_point_sprite ( fxMesaContext fxMesa,
- GrVertex *v0, GLfloat psize )
-{
- const GLcontext *ctx = fxMesa->glCtx;
-
- GLfloat radius;
- GrVertex _v_[4];
- GLuint ts0 = fxMesa->tmu_source[0];
- GLuint ts1 = fxMesa->tmu_source[1];
- GLfloat w = v0->oow;
- GLfloat u0scale = fxMesa->s0scale * w;
- GLfloat v0scale = fxMesa->t0scale * w;
- GLfloat u1scale = fxMesa->s1scale * w;
- GLfloat v1scale = fxMesa->t1scale * w;
-
- radius = psize / 2.0F;
- _v_[0] = *v0;
- _v_[1] = *v0;
- _v_[2] = *v0;
- _v_[3] = *v0;
- /* CLIP_LOOP ?!? */
- /* point coverage? */
- /* we don't care about culling here (see fxSetupCull) */
-
- if (ctx->Point.SpriteOrigin == GL_UPPER_LEFT) {
- _v_[0].x -= radius;
- _v_[0].y += radius;
- _v_[1].x += radius;
- _v_[1].y += radius;
- _v_[2].x += radius;
- _v_[2].y -= radius;
- _v_[3].x -= radius;
- _v_[3].y -= radius;
- } else {
- _v_[0].x -= radius;
- _v_[0].y -= radius;
- _v_[1].x += radius;
- _v_[1].y -= radius;
- _v_[2].x += radius;
- _v_[2].y += radius;
- _v_[3].x -= radius;
- _v_[3].y += radius;
- }
-
- if (ctx->Point.CoordReplace[ts0]) {
- _v_[0].tmuvtx[0].sow = 0;
- _v_[0].tmuvtx[0].tow = 0;
- _v_[1].tmuvtx[0].sow = u0scale;
- _v_[1].tmuvtx[0].tow = 0;
- _v_[2].tmuvtx[0].sow = u0scale;
- _v_[2].tmuvtx[0].tow = v0scale;
- _v_[3].tmuvtx[0].sow = 0;
- _v_[3].tmuvtx[0].tow = v0scale;
- }
- if (ctx->Point.CoordReplace[ts1]) {
- _v_[0].tmuvtx[1].sow = 0;
- _v_[0].tmuvtx[1].tow = 0;
- _v_[1].tmuvtx[1].sow = u1scale;
- _v_[1].tmuvtx[1].tow = 0;
- _v_[2].tmuvtx[1].sow = u1scale;
- _v_[2].tmuvtx[1].tow = v1scale;
- _v_[3].tmuvtx[1].sow = 0;
- _v_[3].tmuvtx[1].tow = v1scale;
- }
-
- grDrawVertexArrayContiguous(GR_TRIANGLE_FAN, 4, _v_, sizeof(GrVertex));
-}
-
-static void fx_draw_point_wide ( fxMesaContext fxMesa,
- GrVertex *v0 )
-{
- GLint i, n;
- GLfloat ang, radius, oon;
- GrVertex vtxB, vtxC;
- GrVertex *_v_[3];
-
- const GLcontext *ctx = fxMesa->glCtx;
- const GLfloat psize = (ctx->_TriangleCaps & DD_POINT_ATTEN)
- ? CLAMP(v0->psize, ctx->Point.MinSize, ctx->Point.MaxSize)
- : ctx->Point._Size; /* clamped */
-
- if (ctx->Point.PointSprite) {
- fx_draw_point_sprite(fxMesa, v0, psize);
- return;
- }
-
- _v_[0] = v0;
- _v_[1] = &vtxB;
- _v_[2] = &vtxC;
-
- radius = psize / 2.0F;
- n = IROUND(psize * 2); /* radius x 4 */
- if (n < 4) n = 4;
- oon = 1.0F / (GLfloat)n;
-
- /* CLIP_LOOP ?!? */
- /* point coverage? */
- /* we don't care about culling here (see fxSetupCull) */
-
- vtxB = *v0;
- vtxC = *v0;
-
- vtxB.x += radius;
- ang = M_2PI * oon;
- vtxC.x += radius * __GL_COSF(ang);
- vtxC.y += radius * __GL_SINF(ang);
- grDrawVertexArray(GR_TRIANGLE_FAN, 3, _v_);
- for (i = 2; i <= n; i++) {
- ang = M_2PI * i * oon;
- vtxC.x = v0->x + radius * __GL_COSF(ang);
- vtxC.y = v0->y + radius * __GL_SINF(ang);
- grDrawVertexArray(GR_TRIANGLE_FAN_CONTINUE, 1, &_v_[2]);
- }
-}
-
-static void fx_render_pw_verts( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- (void) flags;
-
- fxRenderPrimitive( ctx, GL_POINTS );
-
- for ( ; start < count ; start++)
- fx_draw_point_wide(fxMesa, fxVB + start);
-}
-
-static void fx_render_pw_elts ( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;
- (void) flags;
-
- fxRenderPrimitive( ctx, GL_POINTS );
-
- for ( ; start < count ; start++)
- fx_draw_point_wide(fxMesa, fxVB + elt[start]);
-}
-
-static void fx_draw_point_wide_aa ( fxMesaContext fxMesa,
- GrVertex *v0 )
-{
- GLint i, n;
- GLfloat ang, radius, oon;
- GrVertex vtxB, vtxC;
-
- const GLcontext *ctx = fxMesa->glCtx;
- const GLfloat psize = (ctx->_TriangleCaps & DD_POINT_ATTEN)
- ? CLAMP(v0->psize, ctx->Point.MinSize, ctx->Point.MaxSize)
- : ctx->Point._Size; /* clamped */
-
- if (ctx->Point.PointSprite) {
- fx_draw_point_sprite(fxMesa, v0, psize);
- return;
- }
-
- radius = psize / 2.0F;
- n = IROUND(psize * 2); /* radius x 4 */
- if (n < 4) n = 4;
- oon = 1.0F / (GLfloat)n;
-
- /* CLIP_LOOP ?!? */
- /* point coverage? */
- /* we don't care about culling here (see fxSetupCull) */
-
- vtxB = *v0;
- vtxC = *v0;
-
- vtxB.x += radius;
- for (i = 1; i <= n; i++) {
- ang = M_2PI * i * oon;
- vtxC.x = v0->x + radius * __GL_COSF(ang);
- vtxC.y = v0->y + radius * __GL_SINF(ang);
- grAADrawTriangle( v0, &vtxB, &vtxC, FXFALSE, FXTRUE, FXFALSE);
- /*grDrawTriangle( v0, &vtxB, &vtxC);*/
- vtxB.x = vtxC.x;
- vtxB.y = vtxC.y;
- }
-}
-#undef __GLCOSF
-#undef __GLSINF
-#undef M_2PI
-
-#undef DO_FALLBACK
-
-
-#define FX_UNFILLED_BIT 0x1
-#define FX_OFFSET_BIT 0x2
-#define FX_TWOSIDE_BIT 0x4
-#define FX_FLAT_BIT 0x8
-#define FX_TWOSTENCIL_BIT 0x10
-#define FX_FALLBACK_BIT 0x20
-#define FX_MAX_TRIFUNC 0x40
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[FX_MAX_TRIFUNC];
-
-#define DO_FALLBACK (IND & FX_FALLBACK_BIT)
-#define DO_OFFSET (IND & FX_OFFSET_BIT)
-#define DO_UNFILLED (IND & FX_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & FX_TWOSIDE_BIT)
-#define DO_FLAT (IND & FX_FLAT_BIT)
-#define DO_TWOSTENCIL (IND & FX_TWOSTENCIL_BIT)
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 1
-#define HAVE_HW_FLATSHADE 0
-#define HAVE_BACK_COLORS 0
-#define VERTEX GrVertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE 1.0
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->x
-#define VERT_Y(_v) _v->y
-#define VERT_Z(_v) _v->ooz
-#define AREA_IS_CCW( a ) IS_NEGATIVE( a )
-#define GET_VERTEX(e) (fxMesa->verts + e)
-
-
-#if FX_PACKEDCOLOR
-#define VERT_SET_RGBA( dst, f ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[2], f[0]);\
- UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[1], f[1]);\
- UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[0], f[2]);\
- UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[3], f[3]);\
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) \
- *(GLuint *)&v0->pargb = *(GLuint *)&v1->pargb
-
-#define VERT_SAVE_RGBA( idx ) \
- *(GLuint *)&color[idx] = *(GLuint *)&v[idx]->pargb
-
-#define VERT_RESTORE_RGBA( idx ) \
- *(GLuint *)&v[idx]->pargb = *(GLuint *)&color[idx]
-
-
-#define VERT_SET_SPEC( dst, f ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE(dst->pspec[2], f[0]);\
- UNCLAMPED_FLOAT_TO_UBYTE(dst->pspec[1], f[1]);\
- UNCLAMPED_FLOAT_TO_UBYTE(dst->pspec[0], f[2]);\
-} while (0)
-
-#define VERT_COPY_SPEC( v0, v1 ) \
- *(GLuint *)&v0->pspec = *(GLuint *)&v1->pspec
-
-#define VERT_SAVE_SPEC( idx ) \
- *(GLuint *)&spec[idx] = *(GLuint *)&v[idx]->pspec
-
-#define VERT_RESTORE_SPEC( idx ) \
- *(GLuint *)&v[idx]->pspec = *(GLuint *)&spec[idx]
-
-
-#define LOCAL_VARS(n) \
- fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GLubyte color[n][4], spec[n][4]; \
- (void) color; (void) spec;
-#else /* !FX_PACKEDCOLOR */
-#define VERT_SET_RGBA( dst, f ) \
-do { \
- CNORM(dst->r, f[0]); \
- CNORM(dst->g, f[1]); \
- CNORM(dst->b, f[2]); \
- CNORM(dst->a, f[3]); \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) \
-do { \
- COPY_FLOAT(v0->r, v1->r); \
- COPY_FLOAT(v0->g, v1->g); \
- COPY_FLOAT(v0->b, v1->b); \
- COPY_FLOAT(v0->a, v1->a); \
-} while (0)
-
-#define VERT_SAVE_RGBA( idx ) \
-do { \
- COPY_FLOAT(color[idx][0], v[idx]->r); \
- COPY_FLOAT(color[idx][1], v[idx]->g); \
- COPY_FLOAT(color[idx][2], v[idx]->b); \
- COPY_FLOAT(color[idx][3], v[idx]->a); \
-} while (0)
-
-#define VERT_RESTORE_RGBA( idx ) \
-do { \
- COPY_FLOAT(v[idx]->r, color[idx][0]); \
- COPY_FLOAT(v[idx]->g, color[idx][1]); \
- COPY_FLOAT(v[idx]->b, color[idx][2]); \
- COPY_FLOAT(v[idx]->a, color[idx][3]); \
-} while (0)
-
-
-#define VERT_SET_SPEC( dst, f ) \
-do { \
- CNORM(dst->r1, f[0]); \
- CNORM(dst->g1, f[1]); \
- CNORM(dst->b1, f[2]); \
-} while (0)
-
-#define VERT_COPY_SPEC( v0, v1 ) \
-do { \
- COPY_FLOAT(v0->r1, v1->r1); \
- COPY_FLOAT(v0->g1, v1->g1); \
- COPY_FLOAT(v0->b1, v1->b1); \
-} while (0)
-
-#define VERT_SAVE_SPEC( idx ) \
-do { \
- COPY_FLOAT(spec[idx][0], v[idx]->r1); \
- COPY_FLOAT(spec[idx][1], v[idx]->g1); \
- COPY_FLOAT(spec[idx][2], v[idx]->b1); \
-} while (0)
-
-#define VERT_RESTORE_SPEC( idx ) \
-do { \
- COPY_FLOAT(v[idx]->r1, spec[idx][0]); \
- COPY_FLOAT(v[idx]->g1, spec[idx][1]); \
- COPY_FLOAT(v[idx]->b1, spec[idx][2]); \
-} while (0)
-
-
-#define LOCAL_VARS(n) \
- fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GLfloat color[n][4], spec[n][4]; \
- (void) color; (void) spec;
-#endif /* !FX_PACKEDCOLOR */
-
-
-/***********************************************************************
- * Twoside stencil *
- ***********************************************************************/
-#define SETUP_STENCIL(f) if (f) fxSetupStencilFace(ctx, f)
-#define UNSET_STENCIL(f) if (f) fxSetupStencil(ctx)
-
-
-/***********************************************************************
- * Functions to draw basic unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (fxMesa->raster_primitive != reduced_prim[x]) \
- fxRasterPrimitive( ctx, reduced_prim[x] )
-#define RENDER_PRIMITIVE fxMesa->render_primitive
-#define IND FX_FALLBACK_BIT
-#define TAG(x) x
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Functions to draw GL primitives *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \
- FX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-/* Fx doesn't support provoking-vertex flat-shading?
- */
-#define IND (FX_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_twoside_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_UNFILLED_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_FALLBACK_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_twoside_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \
- FX_FALLBACK_BIT|FX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-/* 2-sided stencil begin */
-#define IND (FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_offset_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_offset_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_UNFILLED_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_unfilled_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_offset_unfilled_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_unfilled_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_fallback_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_offset_fallback_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_fallback_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_offset_fallback_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_unfilled_fallback_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_offset_unfilled_fallback_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \
- FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-/* Fx doesn't support provoking-vertex flat-shading?
- */
-#define IND (FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_offset_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_offset_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_UNFILLED_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_unfilled_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_offset_unfilled_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_unfilled_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_fallback_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_offset_fallback_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_fallback_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_offset_fallback_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_unfilled_fallback_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_offset_unfilled_fallback_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \
- FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback_flat_twostencil
-#include "tnl_dd/t_dd_tritmp.h"
-/* 2-sided stencil end */
-
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
- init_fallback();
- init_offset_fallback();
- init_twoside_fallback();
- init_twoside_offset_fallback();
- init_unfilled_fallback();
- init_offset_unfilled_fallback();
- init_twoside_unfilled_fallback();
- init_twoside_offset_unfilled_fallback();
-
- init_flat();
- init_offset_flat();
- init_twoside_flat();
- init_twoside_offset_flat();
- init_unfilled_flat();
- init_offset_unfilled_flat();
- init_twoside_unfilled_flat();
- init_twoside_offset_unfilled_flat();
- init_fallback_flat();
- init_offset_fallback_flat();
- init_twoside_fallback_flat();
- init_twoside_offset_fallback_flat();
- init_unfilled_fallback_flat();
- init_offset_unfilled_fallback_flat();
- init_twoside_unfilled_fallback_flat();
- init_twoside_offset_unfilled_fallback_flat();
-
- /* 2-sided stencil begin */
- init_twostencil();
- init_offset_twostencil();
- init_twoside_twostencil();
- init_twoside_offset_twostencil();
- init_unfilled_twostencil();
- init_offset_unfilled_twostencil();
- init_twoside_unfilled_twostencil();
- init_twoside_offset_unfilled_twostencil();
- init_fallback_twostencil();
- init_offset_fallback_twostencil();
- init_twoside_fallback_twostencil();
- init_twoside_offset_fallback_twostencil();
- init_unfilled_fallback_twostencil();
- init_offset_unfilled_fallback_twostencil();
- init_twoside_unfilled_fallback_twostencil();
- init_twoside_offset_unfilled_fallback_twostencil();
-
- init_flat_twostencil();
- init_offset_flat_twostencil();
- init_twoside_flat_twostencil();
- init_twoside_offset_flat_twostencil();
- init_unfilled_flat_twostencil();
- init_offset_unfilled_flat_twostencil();
- init_twoside_unfilled_flat_twostencil();
- init_twoside_offset_unfilled_flat_twostencil();
- init_fallback_flat_twostencil();
- init_offset_fallback_flat_twostencil();
- init_twoside_fallback_flat_twostencil();
- init_twoside_offset_fallback_flat_twostencil();
- init_unfilled_fallback_flat_twostencil();
- init_offset_unfilled_fallback_flat_twostencil();
- init_twoside_unfilled_fallback_flat_twostencil();
- init_twoside_offset_unfilled_fallback_flat_twostencil();
- /* 2-sided stencil end */
-}
-
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-
-/* Accelerate vertex buffer rendering when renderindex == 0 and
- * there is no clipping.
- */
-#define INIT(x) fxRenderPrimitive( ctx, x )
-
-static void fx_render_vb_points( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- GLint i;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_points\n");
- }
-
- INIT(GL_POINTS);
-
- /* Adjust point coords */
- for (i = start; i < count; i++) {
- fxVB[i].x += PNT_X_OFFSET - TRI_X_OFFSET;
- fxVB[i].y += PNT_Y_OFFSET - TRI_Y_OFFSET;
- }
-
- grDrawVertexArrayContiguous( GR_POINTS, count-start,
- fxVB + start, sizeof(GrVertex));
- /* restore point coords */
- for (i = start; i < count; i++) {
- fxVB[i].x -= PNT_X_OFFSET - TRI_X_OFFSET;
- fxVB[i].y -= PNT_Y_OFFSET - TRI_Y_OFFSET;
- }
-}
-
-static void fx_render_vb_line_strip( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- GLint i;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_line_strip\n");
- }
-
- INIT(GL_LINE_STRIP);
-
- /* adjust line coords */
- for (i = start; i < count; i++) {
- fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;
- fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-
- grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start,
- fxVB + start, sizeof(GrVertex));
-
- /* restore line coords */
- for (i = start; i < count; i++) {
- fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;
- fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-}
-
-static void fx_render_vb_line_loop( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- GLint i;
- GLint j = start;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_line_loop\n");
- }
-
- INIT(GL_LINE_LOOP);
-
- if (!(flags & PRIM_BEGIN)) {
- j++;
- }
-
- /* adjust line coords */
- for (i = start; i < count; i++) {
- fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;
- fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-
- grDrawVertexArrayContiguous( GR_LINE_STRIP, count-j,
- fxVB + j, sizeof(GrVertex));
-
- if (flags & PRIM_END)
- grDrawLine( fxVB + (count - 1),
- fxVB + start );
-
- /* restore line coords */
- for (i = start; i < count; i++) {
- fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;
- fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-}
-
-static void fx_render_vb_lines( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- GLint i;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_lines\n");
- }
-
- INIT(GL_LINES);
-
- /* adjust line coords */
- for (i = start; i < count; i++) {
- fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;
- fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-
- grDrawVertexArrayContiguous( GR_LINES, count-start,
- fxVB + start, sizeof(GrVertex));
-
- /* restore line coords */
- for (i = start; i < count; i++) {
- fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;
- fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
- }
-}
-
-static void fx_render_vb_triangles( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- GLuint j;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_triangles\n");
- }
-
- INIT(GL_TRIANGLES);
-
- for (j=start+2; j<count; j+=3) {
- grDrawTriangle(fxVB + (j-2), fxVB + (j-1), fxVB + j);
- }
-}
-
-
-static void fx_render_vb_tri_strip( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_tri_strip\n");
- }
-
- INIT(GL_TRIANGLE_STRIP);
-
- /* no GR_TRIANGLE_STRIP_CONTINUE?!? */
-
- grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP, count-start,
- fxVB + start, sizeof(GrVertex));
-}
-
-
-static void fx_render_vb_tri_fan( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_tri_fan\n");
- }
-
- INIT(GL_TRIANGLE_FAN);
-
- grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start,
- fxVB + start, sizeof(GrVertex) );
-}
-
-static void fx_render_vb_quads( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- GLuint i;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_quads\n");
- }
-
- INIT(GL_QUADS);
-
- for (i = start + 3 ; i < count ; i += 4 ) {
-#define VERT(x) (fxVB + (x))
- GrVertex *_v_[4];
- _v_[0] = VERT(i);
- _v_[1] = VERT(i-3);
- _v_[2] = VERT(i-2);
- _v_[3] = VERT(i-1);
- grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);
- /*grDrawTriangle( VERT(i-3), VERT(i-2), VERT(i) );*/
- /*grDrawTriangle( VERT(i-2), VERT(i-1), VERT(i) );*/
-#undef VERT
- }
-}
-
-static void fx_render_vb_quad_strip( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_quad_strip\n");
- }
-
- INIT(GL_QUAD_STRIP);
-
- count -= (count-start)&1;
-
- grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP,
- count-start, fxVB + start, sizeof(GrVertex));
-}
-
-static void fx_render_vb_poly( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GrVertex *fxVB = fxMesa->verts;
- (void) flags;
-
- if (TDFX_DEBUG & VERBOSE_VARRAY) {
- fprintf(stderr, "fx_render_vb_poly\n");
- }
-
- INIT(GL_POLYGON);
-
- grDrawVertexArrayContiguous( GR_POLYGON, count-start,
- fxVB + start, sizeof(GrVertex));
-}
-
-static void fx_render_vb_noop( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- (void) (ctx && start && count && flags);
-}
-
-static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
- GLuint,
- GLuint,
- GLuint) =
-{
- fx_render_vb_points,
- fx_render_vb_lines,
- fx_render_vb_line_loop,
- fx_render_vb_line_strip,
- fx_render_vb_triangles,
- fx_render_vb_tri_strip,
- fx_render_vb_tri_fan,
- fx_render_vb_quads,
- fx_render_vb_quad_strip,
- fx_render_vb_poly,
- fx_render_vb_noop,
-};
-#undef INIT
-
-
-/**********************************************************************/
-/* Render whole (indexed) begin/end objects */
-/**********************************************************************/
-
-
-#define VERT(x) (vertptr + x)
-
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- grDrawPoint( VERT(ELT(start)) );
-
-#define RENDER_LINE( v0, v1 ) \
- grDrawLine( VERT(v0), VERT(v1) )
-
-#define RENDER_TRI( v0, v1, v2 ) \
- grDrawTriangle( VERT(v0), VERT(v1), VERT(v2) )
-
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- do { \
- GrVertex *_v_[4]; \
- _v_[0] = VERT(v3);\
- _v_[1] = VERT(v0);\
- _v_[2] = VERT(v1);\
- _v_[3] = VERT(v2);\
- grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);\
- /*grDrawTriangle( VERT(v0), VERT(v1), VERT(v3) );*/\
- /*grDrawTriangle( VERT(v1), VERT(v2), VERT(v3) );*/\
- } while (0)
-
-#define INIT(x) fxRenderPrimitive( ctx, x )
-
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GrVertex *vertptr = fxMesa->verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-
-/* Elts, no clipping.
- */
-#undef ELT
-#undef TAG
-#define TAG(x) fx_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl_dd/t_dd_rendertmp.h"
-
-/* Verts, no clipping.
- */
-#undef ELT
-#undef TAG
-#define TAG(x) fx_##x##_verts
-#define ELT(x) x
-/*#include "tnl_dd/t_dd_rendertmp.h"*/ /* we have fx_render_vb_* now */
-
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void fxRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint prim = fxMesa->render_primitive;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n,
- PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-
-static void fxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- int i;
- fxMesaContext fxMesa = FX_CONTEXT( ctx );
- GrVertex *vertptr = fxMesa->verts;
- if (n == 3) {
- grDrawTriangle( VERT(elts[0]), VERT(elts[1]), VERT(elts[2]) );
- } else if (n <= 32) {
- GrVertex *newvptr[32];
- for (i = 0 ; i < n ; i++) {
- newvptr[i] = VERT(elts[i]);
- }
- grDrawVertexArray(GR_TRIANGLE_FAN, n, newvptr);
- } else {
- const GrVertex *start = VERT(elts[0]);
- for (i = 2 ; i < n ; i++) {
- grDrawTriangle( start, VERT(elts[i-1]), VERT(elts[i]) );
- }
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_STIPPLE)
-#define TRI_FALLBACK (DD_TRI_SMOOTH | DD_TRI_STIPPLE)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK | LINE_FALLBACK | TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_FLATSHADE | DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET \
- | DD_TRI_UNFILLED | DD_TRI_TWOSTENCIL)
-
-
-
-void fxDDChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_TWOSTENCIL) index |= FX_TWOSTENCIL_BIT;
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= FX_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= FX_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= FX_UNFILLED_BIT;
- if (flags & DD_FLATSHADE) index |= FX_FLAT_BIT;
- }
-
- fxMesa->draw_point = fx_draw_point;
- fxMesa->draw_line = fx_draw_line;
- fxMesa->draw_tri = fx_draw_triangle;
-
- /* Hook in fallbacks for specific primitives. */
- if (flags & (POINT_FALLBACK|
- LINE_FALLBACK|
- TRI_FALLBACK))
- {
- if (fxMesa->verbose) {
- fprintf(stderr, "Voodoo ! fallback (%x), raster (%x)\n",
- flags & ANY_FALLBACK_FLAGS, flags & ANY_RASTER_FLAGS);
- }
-
- if (flags & POINT_FALLBACK)
- fxMesa->draw_point = fx_fallback_point;
-
- if (flags & LINE_FALLBACK)
- fxMesa->draw_line = fx_fallback_line;
-
- if (flags & TRI_FALLBACK)
- fxMesa->draw_tri = fx_fallback_tri;
-
- index |= FX_FALLBACK_BIT;
- }
- }
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.ClippedLine = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = fx_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = fx_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = fxFastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = fxRenderClippedPoly;
- }
-
- fxMesa->render_index = index;
-
- /* [dBorca] Hack alert: more a trick than a real plug-in!!! */
- if (flags & (DD_POINT_SIZE | DD_POINT_ATTEN)) {
- /* We need to set the point primitive to go through "rast_tab",
- * to make sure "POINT" calls "fxMesa->draw_point" instead of
- * "grDrawPoint". We can achieve this by using FX_FALLBACK_BIT
- * (not really a total rasterization fallback, so we don't alter
- * "fxMesa->render_index"). If we get here with DD_POINT_SMOOTH,
- * we're done, cos we've already set _tnl_render_tab_{verts|elts}
- * above. Otherwise, the T&L engine can optimize point rendering
- * by using fx_render_tab_{verts|elts} hence the extra work.
- */
- if (flags & DD_POINT_SMOOTH) {
- fxMesa->draw_point = fx_draw_point_wide_aa;
- } else {
- fxMesa->draw_point = fx_draw_point_wide;
- fx_render_tab_verts[0] = fx_render_pw_verts;
- fx_render_tab_elts[0] = fx_render_pw_elts;
- }
- tnl->Driver.Render.Points = rast_tab[index|FX_FALLBACK_BIT].points;
- } else {
- fx_render_tab_verts[0] = fx_render_vb_points;
- fx_render_tab_elts[0] = fx_render_points_elts;
- }
-}
-
-
-/**********************************************************************/
-/* Runtime render state and callbacks */
-/**********************************************************************/
-
-static void fxRunPipeline( GLcontext *ctx )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLuint new_gl_state = fxMesa->new_gl_state;
-
- if (TDFX_DEBUG & VERBOSE_PIPELINE) {
- fprintf(stderr, "fxRunPipeline()\n");
- }
-
-#if 0
- /* Recalculate fog table on projection matrix changes. This used to
- * be triggered by the NearFar callback.
- */
- if (new_gl_state & _NEW_PROJECTION)
- fxMesa->new_state |= FX_NEW_FOG;
-#endif
-
- if (new_gl_state & _FX_NEW_IS_IN_HARDWARE)
- fxCheckIsInHardware(ctx);
-
- if (fxMesa->new_state)
- fxSetupFXUnits(ctx);
-
- if (!fxMesa->fallback) {
- if (new_gl_state & _FX_NEW_RENDERSTATE)
- fxDDChooseRenderState(ctx);
-
- if (new_gl_state & _FX_NEW_SETUP_FUNCTION)
- fxChooseVertexState(ctx);
- }
-
- if (new_gl_state & _NEW_TEXTURE) {
- struct gl_texture_unit *t0 = &ctx->Texture.Unit[fxMesa->tmu_source[0]];
- struct gl_texture_unit *t1 = &ctx->Texture.Unit[fxMesa->tmu_source[1]];
-
- if (t0->_Current && FX_TEXTURE_DATA(t0)) {
- fxMesa->s0scale = FX_TEXTURE_DATA(t0)->sScale;
- fxMesa->t0scale = FX_TEXTURE_DATA(t0)->tScale;
- fxMesa->inv_s0scale = 1.0F / fxMesa->s0scale;
- fxMesa->inv_t0scale = 1.0F / fxMesa->t0scale;
- }
-
- if (t1->_Current && FX_TEXTURE_DATA(t1)) {
- fxMesa->s1scale = FX_TEXTURE_DATA(t1)->sScale;
- fxMesa->t1scale = FX_TEXTURE_DATA(t1)->tScale;
- fxMesa->inv_s1scale = 1.0F / fxMesa->s1scale;
- fxMesa->inv_t1scale = 1.0F / fxMesa->t1scale;
- }
- }
-
- fxMesa->new_gl_state = 0;
-
- _tnl_run_pipeline( ctx );
-}
-
-
-
-/* Always called between RenderStart and RenderFinish --> We already
- * hold the lock.
- */
-static void fxRasterPrimitive( GLcontext *ctx, GLenum prim )
-{
- fxMesaContext fxMesa = FX_CONTEXT( ctx );
-
- fxMesa->raster_primitive = prim;
-
- fxSetupCull(ctx);
-}
-
-
-
-/* Determine the rasterized primitive when not drawing unfilled
- * polygons.
- */
-static void fxRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- fxMesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (fxMesa->raster_primitive != rprim) {
- fxRasterPrimitive( ctx, rprim );
- }
-}
-
-static void fxRenderFinish( GLcontext *ctx )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- if (fxMesa->render_index & FX_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-
-/**********************************************************************/
-/* Manage total rasterization fallbacks */
-/**********************************************************************/
-
-static char *fallbackStrings[] = {
- "3D/Rect/Cube Texture map",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "Separate specular color",
- "glEnable/Disable(GL_STENCIL_TEST)",
- "glRenderMode(selection or feedback)",
- "glLogicOp()",
- "Texture env mode",
- "Texture border",
- "glColorMask",
- "blend mode",
- "multitex"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-void fxCheckIsInHardware( GLcontext *ctx )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = fxMesa->fallback;
- GLuint newfallback = fxMesa->fallback = fx_check_IsInHardware( ctx );
-
- if (newfallback) {
- if (oldfallback == 0) {
- if (fxMesa->verbose) {
- fprintf(stderr, "Voodoo ! enter SW 0x%08x %s\n", newfallback, getFallbackString(newfallback));
- }
- _swsetup_Wakeup( ctx );
- }
- }
- else {
- if (oldfallback) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = fxCheckTexSizes;
- tnl->Driver.Render.Finish = fxRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = fxRenderPrimitive;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = fxBuildVertices;
- fxChooseVertexState(ctx);
- fxDDChooseRenderState(ctx);
- if (fxMesa->verbose) {
- fprintf(stderr, "Voodoo ! leave SW 0x%08x %s\n", oldfallback, getFallbackString(oldfallback));
- }
- }
- tnl->Driver.Render.Multipass = NULL;
- if (HAVE_SPEC && NEED_SECONDARY_COLOR(ctx)) {
- tnl->Driver.Render.Multipass = fxMultipass_ColorSum;
- /* obey stencil, but do not change it */
- fxMesa->multipass = GL_TRUE;
- if (fxMesa->unitsState.stencilEnabled) {
- fxMesa->new_state |= FX_NEW_STENCIL;
- }
- }
- }
-}
-
-void fxDDInitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = fxRunPipeline;
- tnl->Driver.Render.Start = fxCheckTexSizes;
- tnl->Driver.Render.Finish = fxRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = fxRenderPrimitive;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = fxBuildVertices;
- tnl->Driver.Render.Multipass = NULL;
-
- (void) fx_print_vertex;
-}
-
-
-/* [dBorca] Hack alert:
- * doesn't work with blending.
- */
-static GLboolean
-fxMultipass_ColorSum (GLcontext *ctx, GLuint pass)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- tfxUnitsState *us = &fxMesa->unitsState;
-
- static int t0 = 0;
- static int t1 = 0;
-
- switch (pass) {
- case 1: /* first pass: the TEXTURED triangles are drawn */
- /* set stencil's real values */
- fxMesa->multipass = GL_FALSE;
- if (us->stencilEnabled) {
- fxSetupStencil(ctx);
- }
- /* save per-pass data */
- fxMesa->restoreUnitsState = *us;
- /* turn off texturing */
- t0 = ctx->Texture.Unit[0]._ReallyEnabled;
- t1 = ctx->Texture.Unit[1]._ReallyEnabled;
- ctx->Texture.Unit[0]._ReallyEnabled = 0;
- ctx->Texture.Unit[1]._ReallyEnabled = 0;
- /* SUM the colors */
- fxDDBlendEquationSeparate(ctx, GL_FUNC_ADD, GL_FUNC_ADD);
- fxDDBlendFuncSeparate(ctx, GL_ONE, GL_ONE, GL_ZERO, GL_ONE);
- fxDDEnable(ctx, GL_BLEND, GL_TRUE);
- /* make sure we draw only where we want to */
- if (us->depthTestEnabled) {
- switch (us->depthTestFunc) {
- default:
- fxDDDepthFunc(ctx, GL_EQUAL);
- case GL_NEVER:
- case GL_ALWAYS:
- ;
- }
- fxDDDepthMask(ctx, GL_FALSE);
- }
- /* switch to secondary colors */
-#if FX_PACKEDCOLOR
- grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PSPEC_OFFSET << 2, GR_PARAM_ENABLE);
-#else /* !FX_PACKEDCOLOR */
- grVertexLayout(GR_PARAM_RGB, GR_VERTEX_SPEC_OFFSET << 2, GR_PARAM_ENABLE);
-#endif /* !FX_PACKEDCOLOR */
- /* don't advertise new state */
- fxMesa->new_state = 0;
- break;
- case 2: /* 2nd pass (last): the secondary color is summed over texture */
- /* restore original state */
- *us = fxMesa->restoreUnitsState;
- /* restore texturing */
- ctx->Texture.Unit[0]._ReallyEnabled = t0;
- ctx->Texture.Unit[1]._ReallyEnabled = t1;
- /* revert to primary colors */
-#if FX_PACKEDCOLOR
- grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
-#else /* !FX_PACKEDCOLOR */
- grVertexLayout(GR_PARAM_RGB, GR_VERTEX_RGB_OFFSET << 2, GR_PARAM_ENABLE);
-#endif /* !FX_PACKEDCOLOR */
- break;
- default:
- assert(0); /* NOTREACHED */
- }
-
- /* update HW state */
- fxSetupBlend(ctx);
- fxSetupDepthTest(ctx);
- fxSetupTexture(ctx);
-
- return (pass == 1);
-}
-
-
-#else
-
-
-/*
- * Need this to provide at least one external definition.
- */
-
-extern int gl_fx_dummy_function_tris(void);
-int
-gl_fx_dummy_function_tris(void)
-{
- return 0;
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c
deleted file mode 100644
index cc9ad0e8b83..00000000000
--- a/src/mesa/drivers/glide/fxvb.c
+++ /dev/null
@@ -1,838 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Daniel Borca <dborca@users.sourceforge.net>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#ifdef FX
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/imports.h"
-#include "main/macros.h"
-#include "main/colormac.h"
-
-#include "math/m_translate.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-#include "fxdrv.h"
-
-
-static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
-{
- fxMesaContext fxMesa = FX_CONTEXT( ctx );
- GrVertex *dst = fxMesa->verts + edst;
- GrVertex *src = fxMesa->verts + esrc;
-
-#if FX_PACKEDCOLOR
- *(GLuint *)&dst->pargb = *(GLuint *)&src->pargb;
-#else /* !FX_PACKEDCOLOR */
- COPY_FLOAT(dst->r, src->r);
- COPY_FLOAT(dst->g, src->g);
- COPY_FLOAT(dst->b, src->b);
- COPY_FLOAT(dst->a, src->a);
-#endif /* !FX_PACKEDCOLOR */
-}
-
-static void copy_pv2( GLcontext *ctx, GLuint edst, GLuint esrc )
-{
- fxMesaContext fxMesa = FX_CONTEXT( ctx );
- GrVertex *dst = fxMesa->verts + edst;
- GrVertex *src = fxMesa->verts + esrc;
-
-#if FX_PACKEDCOLOR
- *(GLuint *)&dst->pargb = *(GLuint *)&src->pargb;
- *(GLuint *)&dst->pspec = *(GLuint *)&src->pspec;
-#else /* !FX_PACKEDCOLOR */
- COPY_FLOAT(dst->r, src->r);
- COPY_FLOAT(dst->g, src->g);
- COPY_FLOAT(dst->b, src->b);
- COPY_FLOAT(dst->a, src->a);
- COPY_FLOAT(dst->r1, src->r1);
- COPY_FLOAT(dst->g1, src->g1);
- COPY_FLOAT(dst->b1, src->b1);
-#endif /* !FX_PACKEDCOLOR */
-}
-
-static struct {
- void (*emit) (GLcontext *ctx, GLuint start, GLuint end, void *dest);
- tnl_copy_pv_func copy_pv;
- tnl_interp_func interp;
- GLboolean (*check_tex_sizes) (GLcontext *ctx);
- GLuint vertex_format;
-} setup_tab[MAX_SETUP];
-
-
-#define GET_COLOR(ptr, idx) ((ptr)->data[idx])
-
-
-static void interp_extras( GLcontext *ctx,
- GLfloat t,
- GLuint dst, GLuint out, GLuint in,
- GLboolean force_boundary )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- if (VB->BackfaceColorPtr) {
- /* If stride is zero, BackfaceColorPtr is constant across the VB, so
- * there is no point interpolating between two values as they will
- * be identical. This case is handled in t_dd_tritmp.h
- */
- if (VB->BackfaceColorPtr->stride) {
- assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat));
- INTERP_4F( t,
- GET_COLOR(VB->BackfaceColorPtr, dst),
- GET_COLOR(VB->BackfaceColorPtr, out),
- GET_COLOR(VB->BackfaceColorPtr, in) );
- }
-
- if (VB->BackfaceSecondaryColorPtr) {
- INTERP_3F( t,
- GET_COLOR(VB->BackfaceSecondaryColorPtr, dst),
- GET_COLOR(VB->BackfaceSecondaryColorPtr, out),
- GET_COLOR(VB->BackfaceSecondaryColorPtr, in) );
- }
- }
-
- if (VB->EdgeFlag) {
- VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
- }
-
- setup_tab[FX_CONTEXT(ctx)->SetupIndex].interp(ctx, t, dst, out, in,
- force_boundary);
-}
-
-static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- if (VB->BackfaceColorPtr) {
- COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst),
- GET_COLOR(VB->BackfaceColorPtr, src) );
-
- if (VB->BackfaceSecondaryColorPtr) {
- COPY_3FV( GET_COLOR(VB->BackfaceSecondaryColorPtr, dst),
- GET_COLOR(VB->BackfaceSecondaryColorPtr, src) );
- }
- }
-
- setup_tab[FX_CONTEXT(ctx)->SetupIndex].copy_pv(ctx, dst, src);
-}
-
-
-#define IND (SETUP_XYZW|SETUP_RGBA)
-#define TAG(x) x##_wg
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0)
-#define TAG(x) x##_wgt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_wgt0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX)
-#define TAG(x) x##_wgpt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\
- SETUP_PTEX)
-#define TAG(x) x##_wgpt0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_PSIZ)
-#define TAG(x) x##_wga
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ)
-#define TAG(x) x##_wgt0a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ)
-#define TAG(x) x##_wgt0t1a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ)
-#define TAG(x) x##_wgpt0a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\
- SETUP_PTEX|SETUP_PSIZ)
-#define TAG(x) x##_wgpt0t1a
-#include "fxvbtmp.h"
-
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC)
-#define TAG(x) x##_2wg
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0)
-#define TAG(x) x##_2wgt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_2wgt0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX)
-#define TAG(x) x##_2wgpt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\
- SETUP_PTEX)
-#define TAG(x) x##_2wgpt0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ)
-#define TAG(x) x##_2wga
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ)
-#define TAG(x) x##_2wgt0a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ)
-#define TAG(x) x##_2wgt0t1a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ)
-#define TAG(x) x##_2wgpt0a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\
- SETUP_PTEX|SETUP_PSIZ)
-#define TAG(x) x##_2wgpt0t1a
-#include "fxvbtmp.h"
-
-/* fog { */
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_FOGC)
-#define TAG(x) x##_wgf
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_FOGC)
-#define TAG(x) x##_wgt0f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|SETUP_FOGC)
-#define TAG(x) x##_wgt0t1f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX|SETUP_FOGC)
-#define TAG(x) x##_wgpt0f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\
- SETUP_PTEX|SETUP_FOGC)
-#define TAG(x) x##_wgpt0t1f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wgaf
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wgt0af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wgt0t1af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wgpt0af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\
- SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wgpt0t1af
-#include "fxvbtmp.h"
-
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_FOGC)
-#define TAG(x) x##_2wgf
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_FOGC)
-#define TAG(x) x##_2wgt0f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|SETUP_FOGC)
-#define TAG(x) x##_2wgt0t1f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX|SETUP_FOGC)
-#define TAG(x) x##_2wgpt0f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\
- SETUP_PTEX|SETUP_FOGC)
-#define TAG(x) x##_2wgpt0t1f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wgaf
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wgt0af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wgt0t1af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wgpt0af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\
- SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wgpt0t1af
-#include "fxvbtmp.h"
-/* fog } */
-
-
-/* Snapping for voodoo-1
- */
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA)
-#define TAG(x) x##_wsg
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0)
-#define TAG(x) x##_wsgt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_TMU1)
-#define TAG(x) x##_wsgt0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_PTEX)
-#define TAG(x) x##_wsgpt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PTEX)
-#define TAG(x) x##_wsgpt0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_PSIZ)
-#define TAG(x) x##_wsga
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ)
-#define TAG(x) x##_wsgt0a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PSIZ)
-#define TAG(x) x##_wsgt0t1a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_PTEX|SETUP_PSIZ)
-#define TAG(x) x##_wsgpt0a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ)
-#define TAG(x) x##_wsgpt0t1a
-#include "fxvbtmp.h"
-
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC)
-#define TAG(x) x##_2wsg
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0)
-#define TAG(x) x##_2wsgt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_TMU1)
-#define TAG(x) x##_2wsgt0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_PTEX)
-#define TAG(x) x##_2wsgpt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PTEX)
-#define TAG(x) x##_2wsgpt0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ)
-#define TAG(x) x##_2wsga
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ)
-#define TAG(x) x##_2wsgt0a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PSIZ)
-#define TAG(x) x##_2wsgt0t1a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_PTEX|SETUP_PSIZ)
-#define TAG(x) x##_2wsgpt0a
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ)
-#define TAG(x) x##_2wsgpt0t1a
-#include "fxvbtmp.h"
-
-/* fog { */
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_FOGC)
-#define TAG(x) x##_wsgf
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|SETUP_FOGC)
-#define TAG(x) x##_wsgt0f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_TMU1|SETUP_FOGC)
-#define TAG(x) x##_wsgt0t1f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_PTEX|SETUP_FOGC)
-#define TAG(x) x##_wsgpt0f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PTEX|SETUP_FOGC)
-#define TAG(x) x##_wsgpt0t1f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wsgaf
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wsgt0af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wsgt0t1af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wsgpt0af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_wsgpt0t1af
-#include "fxvbtmp.h"
-
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_FOGC)
-#define TAG(x) x##_2wsgf
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_FOGC)
-#define TAG(x) x##_2wsgt0f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_TMU1|SETUP_FOGC)
-#define TAG(x) x##_2wsgt0t1f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_PTEX|SETUP_FOGC)
-#define TAG(x) x##_2wsgpt0f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PTEX|SETUP_FOGC)
-#define TAG(x) x##_2wsgpt0t1f
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wsgaf
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wsgt0af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wsgt0t1af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wsgpt0af
-#include "fxvbtmp.h"
-
-#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
- SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
-#define TAG(x) x##_2wsgpt0t1af
-#include "fxvbtmp.h"
-/* fog } */
-
-
-/* Vertex repair (multipass rendering)
- */
-#define IND (SETUP_RGBA)
-#define TAG(x) x##_g
-#include "fxvbtmp.h"
-
-#define IND (SETUP_TMU0)
-#define TAG(x) x##_t0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_t0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_RGBA|SETUP_TMU0)
-#define TAG(x) x##_gt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_RGBA|SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_gt0t1
-#include "fxvbtmp.h"
-
-
-#define IND (SETUP_RGBA|SETUP_SPEC)
-#define TAG(x) x##_2g
-#include "fxvbtmp.h"
-
-#define IND (SETUP_TMU0|SETUP_SPEC)
-#define TAG(x) x##_2t0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_TMU0|SETUP_SPEC|SETUP_TMU1)
-#define TAG(x) x##_2t0t1
-#include "fxvbtmp.h"
-
-#define IND (SETUP_RGBA|SETUP_SPEC|SETUP_TMU0)
-#define TAG(x) x##_2gt0
-#include "fxvbtmp.h"
-
-#define IND (SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_2gt0t1
-#include "fxvbtmp.h"
-
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgpt0t1();
- init_wga();
- init_wgt0a();
- init_wgt0t1a();
- init_wgpt0a();
- init_wgpt0t1a();
- init_2wg();
- init_2wgt0();
- init_2wgt0t1();
- init_2wgpt0();
- init_2wgpt0t1();
- init_2wga();
- init_2wgt0a();
- init_2wgt0t1a();
- init_2wgpt0a();
- init_2wgpt0t1a();
- init_wgf();
- init_wgt0f();
- init_wgt0t1f();
- init_wgpt0f();
- init_wgpt0t1f();
- init_wgaf();
- init_wgt0af();
- init_wgt0t1af();
- init_wgpt0af();
- init_wgpt0t1af();
- init_2wgf();
- init_2wgt0f();
- init_2wgt0t1f();
- init_2wgpt0f();
- init_2wgpt0t1f();
- init_2wgaf();
- init_2wgt0af();
- init_2wgt0t1af();
- init_2wgpt0af();
- init_2wgpt0t1af();
-
- init_wsg();
- init_wsgt0();
- init_wsgt0t1();
- init_wsgpt0();
- init_wsgpt0t1();
- init_wsga();
- init_wsgt0a();
- init_wsgt0t1a();
- init_wsgpt0a();
- init_wsgpt0t1a();
- init_2wsg();
- init_2wsgt0();
- init_2wsgt0t1();
- init_2wsgpt0();
- init_2wsgpt0t1();
- init_2wsga();
- init_2wsgt0a();
- init_2wsgt0t1a();
- init_2wsgpt0a();
- init_2wsgpt0t1a();
- init_wsgf();
- init_wsgt0f();
- init_wsgt0t1f();
- init_wsgpt0f();
- init_wsgpt0t1f();
- init_wsgaf();
- init_wsgt0af();
- init_wsgt0t1af();
- init_wsgpt0af();
- init_wsgpt0t1af();
- init_2wsgf();
- init_2wsgt0f();
- init_2wsgt0t1f();
- init_2wsgpt0f();
- init_2wsgpt0t1f();
- init_2wsgaf();
- init_2wsgt0af();
- init_2wsgt0t1af();
- init_2wsgpt0af();
- init_2wsgpt0t1af();
-
- init_g();
- init_t0();
- init_t0t1();
- init_gt0();
- init_gt0t1();
- init_2g();
- init_2t0();
- init_2t0t1();
- init_2gt0();
- init_2gt0t1();
-}
-
-
-void fxPrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & SETUP_XYZW) ? " xyzw," : "",
- (flags & SETUP_SNAP) ? " snap," : "",
- (flags & SETUP_RGBA) ? " rgba," : "",
- (flags & SETUP_TMU0) ? " tex-0," : "",
- (flags & SETUP_TMU1) ? " tex-1," : "",
- (flags & SETUP_PSIZ) ? " psiz," : "",
- (flags & SETUP_SPEC) ? " spec," : "",
- (flags & SETUP_FOGC) ? " fog," : "");
-}
-
-
-
-void fxCheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- fxMesaContext fxMesa = FX_CONTEXT( ctx );
-
- if (!setup_tab[fxMesa->SetupIndex].check_tex_sizes(ctx)) {
- GLuint ind = fxMesa->SetupIndex |= (SETUP_PTEX|SETUP_RGBA);
-
- /* Tdfx handles projective textures nicely; just have to change
- * up to the new vertex format.
- */
- if (setup_tab[ind].vertex_format != fxMesa->stw_hint_state) {
-
- fxMesa->stw_hint_state = setup_tab[ind].vertex_format;
- FX_grHints(GR_HINT_STWHINT, fxMesa->stw_hint_state);
-
- /* This is required as we have just changed the vertex
- * format, so the interp routines must also change.
- * In the unfilled and twosided cases we are using the
- * Extras ones anyway, so leave them in place.
- */
- if (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[fxMesa->SetupIndex].interp;
- }
- }
- }
-}
-
-
-void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint end,
- GLuint newinputs )
-{
- fxMesaContext fxMesa = FX_CONTEXT( ctx );
- GrVertex *v = (fxMesa->verts + start);
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_POS) {
- setup_tab[fxMesa->SetupIndex].emit( ctx, start, end, v );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= SETUP_RGBA;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= SETUP_SPEC;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= SETUP_FOGC;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= SETUP_TMU0;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= SETUP_TMU0|SETUP_TMU1;
-
- if (fxMesa->SetupIndex & SETUP_PTEX)
- ind = ~0;
-
- ind &= fxMesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, end, v );
- }
- }
-}
-
-
-void fxChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- fxMesaContext fxMesa = FX_CONTEXT( ctx );
- GLuint ind = SETUP_XYZW|SETUP_RGBA;
-
- if (fxMesa->snapVertices)
- ind |= SETUP_SNAP;
-
- fxMesa->tmu_source[0] = 0;
- fxMesa->tmu_source[1] = 1;
-
- if (ctx->Texture._EnabledUnits & 0x2) {
- if (ctx->Texture._EnabledUnits & 0x1) {
- ind |= SETUP_TMU1;
- }
- ind |= SETUP_TMU0;
- fxMesa->tmu_source[0] = 1;
- fxMesa->tmu_source[1] = 0;
- }
- else if (ctx->Texture._EnabledUnits & 0x1) {
- ind |= SETUP_TMU0;
- }
-
- if (ctx->_TriangleCaps & DD_POINT_ATTEN) {
- ind |= SETUP_PSIZ;
- }
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- ind |= SETUP_SPEC;
- }
-
- if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) {
- ind |= SETUP_FOGC;
- }
-
- fxMesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = interp_extras;
- tnl->Driver.Render.CopyPV = copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
- if (setup_tab[ind].vertex_format != fxMesa->stw_hint_state) {
- fxMesa->stw_hint_state = setup_tab[ind].vertex_format;
- FX_grHints(GR_HINT_STWHINT, fxMesa->stw_hint_state);
- }
-}
-
-
-
-void fxAllocVB( GLcontext *ctx )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
-
- fxMesa->verts = (GrVertex *)ALIGN_MALLOC(size * sizeof(GrVertex), 32);
- fxMesa->SetupIndex = SETUP_XYZW|SETUP_RGBA;
-}
-
-
-void fxFreeVB( GLcontext *ctx )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- if (fxMesa->verts) {
- ALIGN_FREE(fxMesa->verts);
- fxMesa->verts = 0;
- }
-}
-#else
-
-
-/*
- * Need this to provide at least one external definition.
- */
-
-extern int gl_fx_dummy_function_vb(void);
-int
-gl_fx_dummy_function_vb(void)
-{
- return 0;
-}
-
-#endif /* FX */
diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h
deleted file mode 100644
index f7893c1573f..00000000000
--- a/src/mesa/drivers/glide/fxvbtmp.h
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Daniel Borca <dborca@users.sourceforge.net>
- */
-
-
-#define VIEWPORT_X(dst,x) dst = s[0] * x + s[12]
-#define VIEWPORT_Y(dst,y) dst = s[5] * y + s[13]
-#define VIEWPORT_Z(dst,z) dst = s[10] * z + s[14]
-
-static void TAG(emit)( GLcontext *ctx,
- GLuint start, GLuint end,
- void *dest )
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint tmu0_source = fxMesa->tmu_source[0];
- GLuint tmu1_source = fxMesa->tmu_source[1];
- GLfloat (*tc0)[4], (*tc1)[4];
- GLfloat (*col)[4], (*spec)[4];
- GLuint tc0_stride, tc1_stride, col_stride, spec_stride;
- GLuint tc0_size, tc1_size, col_size;
- GLfloat (*proj)[4] = VB->NdcPtr->data;
- GLuint proj_stride = VB->NdcPtr->stride;
- GLfloat (*psize)[4];
- GLuint psize_stride;
- GLfloat (*fog)[4];
- GLuint fog_stride;
- GrVertex *v = (GrVertex *)dest;
- GLfloat u0scale,v0scale,u1scale,v1scale;
- const GLubyte *mask = VB->ClipMask;
- const GLfloat *const s = ctx->Viewport._WindowMap.m;
- int i;
-
- if (IND & SETUP_PSIZ) {
- psize = VB->PointSizePtr->data;
- psize_stride = VB->PointSizePtr->stride;
- }
-
- if (IND & SETUP_TMU0) {
- tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->data;
- tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->stride;
- u0scale = fxMesa->s0scale;
- v0scale = fxMesa->t0scale;
- if (IND & SETUP_PTEX)
- tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->size;
- }
-
- if (IND & SETUP_TMU1) {
- tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->data;
- tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->stride;
- u1scale = fxMesa->s1scale; /* wrong if tmu1_source == 0, possible? */
- v1scale = fxMesa->t1scale;
- if (IND & SETUP_PTEX)
- tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->size;
- }
-
- if (IND & SETUP_RGBA) {
- col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data;
- col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride;
- col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size;
- }
-
- if (IND & SETUP_SPEC) {
- spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data;
- spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride;
- }
-
- if (IND & SETUP_FOGC) {
- fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data;
- fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride;
- }
-
- if (start) {
- proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride);
- if (IND & SETUP_PSIZ)
- psize = (GLfloat (*)[4])((GLubyte *)psize + start * psize_stride);
- if (IND & SETUP_TMU0)
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- if (IND & SETUP_TMU1)
- tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + start * tc1_stride);
- if (IND & SETUP_RGBA)
- STRIDE_4F(col, start * col_stride);
- if (IND & SETUP_SPEC)
- STRIDE_4F(spec, start * spec_stride);
- if (IND & SETUP_FOGC)
- fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride);
- }
-
- for (i=start; i < end; i++, v++) {
- if (IND & SETUP_PSIZ) {
- v->psize = psize[0][0];
- psize = (GLfloat (*)[4])((GLubyte *)psize + psize_stride);
- }
-
- if (IND & SETUP_XYZW) {
- if (mask[i] == 0) {
- /* unclipped */
- VIEWPORT_X(v->x, proj[0][0]);
- VIEWPORT_Y(v->y, proj[0][1]);
- VIEWPORT_Z(v->ooz, proj[0][2]);
- v->oow = proj[0][3];
-
- if (IND & SETUP_SNAP) {
-#if defined(USE_IEEE)
- const float snapper = (3L << 18);
- v->x += snapper;
- v->x -= snapper;
- v->y += snapper;
- v->y -= snapper;
-#else
- v->x = ((int) (v->x * 16.0f)) * (1.0f / 16.0f);
- v->y = ((int) (v->y * 16.0f)) * (1.0f / 16.0f);
-#endif
- }
- } else {
- /* clipped */
- v->oow = 1.0;
- }
-
- proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
- }
- if (IND & SETUP_RGBA) {
-#if FX_PACKEDCOLOR
- UNCLAMPED_FLOAT_TO_UBYTE(v->pargb[2], col[0][0]);
- UNCLAMPED_FLOAT_TO_UBYTE(v->pargb[1], col[0][1]);
- UNCLAMPED_FLOAT_TO_UBYTE(v->pargb[0], col[0][2]);
- if (col_size == 4) {
- UNCLAMPED_FLOAT_TO_UBYTE(v->pargb[3], col[0][3]);
- } else {
- v->pargb[3] = 255;
- }
-#else /* !FX_PACKEDCOLOR */
- CNORM(v->r, col[0][0]);
- CNORM(v->g, col[0][1]);
- CNORM(v->b, col[0][2]);
- if (col_size == 4) {
- CNORM(v->a, col[0][3]);
- } else {
- v->a = 255.0f;
- }
-#endif /* !FX_PACKEDCOLOR */
- STRIDE_4F(col, col_stride);
- }
- if (IND & SETUP_SPEC) {
-#if FX_PACKEDCOLOR
- UNCLAMPED_FLOAT_TO_UBYTE(v->pspec[2], spec[0][0]);
- UNCLAMPED_FLOAT_TO_UBYTE(v->pspec[1], spec[0][1]);
- UNCLAMPED_FLOAT_TO_UBYTE(v->pspec[0], spec[0][2]);
-#else /* !FX_PACKEDCOLOR */
- CNORM(v->r1, spec[0][0]);
- CNORM(v->g1, spec[0][1]);
- CNORM(v->b1, spec[0][2]);
-#endif /* !FX_PACKEDCOLOR */
- STRIDE_4F(spec, spec_stride);
- }
- if (IND & SETUP_FOGC) {
- v->fog = CLAMP(fog[0][0], 0.0f, 1.0f);
- fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride);
- }
- if (IND & SETUP_TMU0) {
- GLfloat w = v->oow;
- v->tmuvtx[0].sow = tc0[0][0] * u0scale * w;
- v->tmuvtx[0].tow = tc0[0][1] * v0scale * w;
- if (IND & SETUP_PTEX) {
- v->tmuvtx[0].oow = w;
- if (tc0_size == 4)
- v->tmuvtx[0].oow *= tc0[0][3];
- }
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride);
- }
- if (IND & SETUP_TMU1) {
- GLfloat w = v->oow;
- v->tmuvtx[1].sow = tc1[0][0] * u1scale * w;
- v->tmuvtx[1].tow = tc1[0][1] * v1scale * w;
- if (IND & SETUP_PTEX) {
- v->tmuvtx[1].oow = w;
- if (tc1_size == 4)
- v->tmuvtx[1].oow *= tc1[0][3];
- }
- tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + tc1_stride);
- }
- }
-}
-
-#if (IND & SETUP_XYZW) && (IND & SETUP_RGBA)
-
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (IND & SETUP_PTEX)
- return GL_TRUE;
-
- if (IND & SETUP_TMU0) {
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- if (IND & SETUP_TMU1) {
- if (VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0)
- VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1];
-
- if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4)
- return GL_FALSE;
- }
-
- if (VB->AttribPtr[_TNL_ATTRIB_TEX0] &&
- VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4)
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static void TAG(interp)( GLcontext *ctx,
- GLfloat t,
- GLuint edst, GLuint eout, GLuint ein,
- GLboolean force_boundary )
-{
- fxMesaContext fxMesa = FX_CONTEXT( ctx );
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- const GLfloat *dstclip = VB->ClipPtr->data[edst];
- const GLfloat oow = (dstclip[3] == 0.0F) ? 1.0F : (1.0F / dstclip[3]);
- const GLfloat *const s = ctx->Viewport._WindowMap.m;
- GrVertex *fxverts = fxMesa->verts;
- GrVertex *dst = (GrVertex *) (fxverts + edst);
- const GrVertex *out = (const GrVertex *) (fxverts + eout);
- const GrVertex *in = (const GrVertex *) (fxverts + ein);
- const GLfloat wout = oow / out->oow;
- const GLfloat win = oow / in->oow;
-
- VIEWPORT_X(dst->x, dstclip[0] * oow);
- VIEWPORT_Y(dst->y, dstclip[1] * oow);
- VIEWPORT_Z(dst->ooz, dstclip[2] * oow);
- dst->oow = oow;
-
- if (IND & SETUP_SNAP) {
-#if defined(USE_IEEE)
- const float snapper = (3L << 18);
- dst->x += snapper;
- dst->x -= snapper;
- dst->y += snapper;
- dst->y -= snapper;
-#else
- dst->x = ((int) (dst->x * 16.0f)) * (1.0f / 16.0f);
- dst->y = ((int) (dst->y * 16.0f)) * (1.0f / 16.0f);
-#endif
- }
-
-
-#if FX_PACKEDCOLOR
- INTERP_UB( t, dst->pargb[0], out->pargb[0], in->pargb[0] );
- INTERP_UB( t, dst->pargb[1], out->pargb[1], in->pargb[1] );
- INTERP_UB( t, dst->pargb[2], out->pargb[2], in->pargb[2] );
- INTERP_UB( t, dst->pargb[3], out->pargb[3], in->pargb[3] );
-#else /* !FX_PACKEDCOLOR */
- INTERP_F( t, dst->r, out->r, in->r );
- INTERP_F( t, dst->g, out->g, in->g );
- INTERP_F( t, dst->b, out->b, in->b );
- INTERP_F( t, dst->a, out->a, in->a );
-#endif /* !FX_PACKEDCOLOR */
-
- if (IND & SETUP_SPEC) {
-#if FX_PACKEDCOLOR
- INTERP_UB( t, dst->pspec[0], out->pspec[0], in->pspec[0] );
- INTERP_UB( t, dst->pspec[1], out->pspec[1], in->pspec[1] );
- INTERP_UB( t, dst->pspec[2], out->pspec[2], in->pspec[2] );
-#else /* !FX_PACKEDCOLOR */
- INTERP_F( t, dst->r1, out->r1, in->r1 );
- INTERP_F( t, dst->g1, out->g1, in->g1 );
- INTERP_F( t, dst->b1, out->b1, in->b1 );
-#endif /* !FX_PACKEDCOLOR */
- }
-
- if (IND & SETUP_FOGC) {
- INTERP_F( t, dst->fog, out->fog, in->fog );
- }
-
- if (IND & SETUP_TMU0) {
- INTERP_F( t,
- dst->tmuvtx[0].sow,
- out->tmuvtx[0].sow * wout,
- in->tmuvtx[0].sow * win );
- INTERP_F( t,
- dst->tmuvtx[0].tow,
- out->tmuvtx[0].tow * wout,
- in->tmuvtx[0].tow * win );
- if (IND & SETUP_PTEX) {
- INTERP_F( t,
- dst->tmuvtx[0].oow,
- out->tmuvtx[0].oow * wout,
- in->tmuvtx[0].oow * win );
- }
- }
-
- if (IND & SETUP_TMU1) {
- INTERP_F( t,
- dst->tmuvtx[1].sow,
- out->tmuvtx[1].sow * wout,
- in->tmuvtx[1].sow * win );
- INTERP_F( t,
- dst->tmuvtx[1].tow,
- out->tmuvtx[1].tow * wout,
- in->tmuvtx[1].tow * win );
- if (IND & SETUP_PTEX) {
- INTERP_F( t,
- dst->tmuvtx[1].oow,
- out->tmuvtx[1].oow * wout,
- in->tmuvtx[1].oow * win );
- }
- }
-}
-#endif
-
-
-static void TAG(init)( void )
-{
- setup_tab[IND].emit = TAG(emit);
-
- if (IND & SETUP_SPEC) {
- setup_tab[IND].copy_pv = copy_pv2;
- } else {
- setup_tab[IND].copy_pv = copy_pv;
- }
-
-#if ((IND & SETUP_XYZW) && (IND & SETUP_RGBA))
- setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes);
- setup_tab[IND].interp = TAG(interp);
-
- setup_tab[IND].vertex_format = 0;
- if (IND & SETUP_PTEX) {
- setup_tab[IND].vertex_format |= GR_STWHINT_W_DIFF_TMU0;
- }
-
-#if (IND & SETUP_TMU1)
- setup_tab[IND].vertex_format |= GR_STWHINT_ST_DIFF_TMU1;
- if (IND & SETUP_PTEX) {
- setup_tab[IND].vertex_format |= GR_STWHINT_W_DIFF_TMU1;
- }
-#endif
-
-#endif
-}
-
-
-#undef IND
-#undef TAG
diff --git a/src/mesa/drivers/glslcompiler/glslcompiler.c b/src/mesa/drivers/glslcompiler/glslcompiler.c
index e4527abdeca..66035a4a43c 100644
--- a/src/mesa/drivers/glslcompiler/glslcompiler.c
+++ b/src/mesa/drivers/glslcompiler/glslcompiler.c
@@ -113,13 +113,13 @@ CreateContext(void)
GLcontext *ctx;
CompilerContext *cc;
- vis = _mesa_create_visual(GL_TRUE, GL_FALSE, GL_FALSE, /* RGB */
+ vis = _mesa_create_visual(GL_FALSE, GL_FALSE, /* RGB */
8, 8, 8, 8, /* color */
- 0, 0, 0, /* z, stencil */
+ 0, 0, /* z, stencil */
0, 0, 0, 0, 1); /* accum */
buf = _mesa_create_framebuffer(vis);
- cc = _mesa_calloc(sizeof(*cc));
+ cc = calloc(1, sizeof(*cc));
if (!vis || !buf || !cc) {
if (vis)
_mesa_destroy_visual(vis);
@@ -143,7 +143,7 @@ CreateContext(void)
!_swsetup_CreateContext( ctx )) {
_mesa_destroy_visual(vis);
_mesa_free_context_data(ctx);
- _mesa_free(cc);
+ free(cc);
return GL_FALSE;
}
TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index bac8a9ef142..e20507ae92f 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -484,24 +484,6 @@ osmesa_update_state( GLcontext *ctx, GLuint new_state )
#include "swrast/s_spantemp.h"
-/* color index */
-#define NAME(PREFIX) PREFIX##_CI
-#define CI_MODE
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *) osmesa->rowaddr[Y] + (X)
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- *DST = VALUE[0]
-#define FETCH_PIXEL(DST, SRC) \
- DST = SRC[0]
-#include "swrast/s_spantemp.h"
-
-
-
-
/**
* Macros for optimized line/triangle rendering.
* Only for 8-bit channel, RGBA, BGRA, ARGB formats.
@@ -776,11 +758,7 @@ compute_row_addresses( OSMesaContext osmesa )
return;
}
- if (osmesa->format == OSMESA_COLOR_INDEX) {
- /* CI mode */
- bytesPerPixel = 1 * sizeof(GLubyte);
- }
- else if ((osmesa->format == OSMESA_RGB) || (osmesa->format == OSMESA_BGR)) {
+ if ((osmesa->format == OSMESA_RGB) || (osmesa->format == OSMESA_BGR)) {
/* RGB mode */
bytesPerPixel = 3 * bpc;
}
@@ -818,7 +796,7 @@ compute_row_addresses( OSMesaContext osmesa )
static void
osmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
- _mesa_free(rb);
+ free(rb);
}
@@ -999,14 +977,6 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutValues = put_values_RGB_565;
rb->PutMonoValues = put_mono_values_RGB_565;
}
- else if (osmesa->format == OSMESA_COLOR_INDEX) {
- rb->GetRow = get_row_CI;
- rb->GetValues = get_values_CI;
- rb->PutRow = put_row_CI;
- rb->PutMonoRow = put_mono_row_CI;
- rb->PutValues = put_values_CI;
- rb->PutMonoValues = put_mono_values_CI;
- }
else {
_mesa_problem(ctx, "bad pixel format in osmesa renderbuffer_storage");
}
@@ -1033,18 +1003,10 @@ new_osmesa_renderbuffer(GLcontext *ctx, GLenum format, GLenum type)
rb->Delete = osmesa_delete_renderbuffer;
rb->AllocStorage = osmesa_renderbuffer_storage;
- if (format == OSMESA_COLOR_INDEX) {
- rb->InternalFormat = GL_COLOR_INDEX;
- rb->Format = MESA_FORMAT_CI8;
- rb->_BaseFormat = GL_COLOR_INDEX;
- rb->DataType = GL_UNSIGNED_BYTE;
- }
- else {
- rb->InternalFormat = GL_RGBA;
- rb->Format = MESA_FORMAT_RGBA8888;
- rb->_BaseFormat = GL_RGBA;
- rb->DataType = type;
- }
+ rb->InternalFormat = GL_RGBA;
+ rb->Format = MESA_FORMAT_RGBA8888;
+ rb->_BaseFormat = GL_RGBA;
+ rb->DataType = type;
}
return rb;
}
@@ -1059,7 +1021,7 @@ new_osmesa_renderbuffer(GLcontext *ctx, GLenum format, GLenum type)
* Create an Off-Screen Mesa rendering context. The only attribute needed is
* an RGBA vs Color-Index mode flag.
*
- * Input: format - either GL_RGBA or GL_COLOR_INDEX
+ * Input: format - Must be GL_RGBA
* sharelist - specifies another OSMesaContext with which to share
* display lists. NULL indicates no sharing.
* Return: an OSMesaContext or 0 if error
@@ -1067,9 +1029,8 @@ new_osmesa_renderbuffer(GLcontext *ctx, GLenum format, GLenum type)
GLAPI OSMesaContext GLAPIENTRY
OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
{
- const GLint accumBits = (format == OSMESA_COLOR_INDEX) ? 0 : 16;
return OSMesaCreateContextExt(format, DEFAULT_SOFTWARE_DEPTH_BITS,
- 8, accumBits, sharelist);
+ 8, 0, sharelist);
}
@@ -1086,17 +1047,11 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
OSMesaContext osmesa;
struct dd_function_table functions;
GLint rind, gind, bind, aind;
- GLint indexBits = 0, redBits = 0, greenBits = 0, blueBits = 0, alphaBits =0;
- GLboolean rgbmode;
+ GLint redBits = 0, greenBits = 0, blueBits = 0, alphaBits =0;
GLenum type = CHAN_TYPE;
rind = gind = bind = aind = 0;
- if (format==OSMESA_COLOR_INDEX) {
- indexBits = 8;
- rgbmode = GL_FALSE;
- }
- else if (format==OSMESA_RGBA) {
- indexBits = 0;
+ if (format==OSMESA_RGBA) {
redBits = CHAN_BITS;
greenBits = CHAN_BITS;
blueBits = CHAN_BITS;
@@ -1105,10 +1060,8 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
gind = 1;
bind = 2;
aind = 3;
- rgbmode = GL_TRUE;
}
else if (format==OSMESA_BGRA) {
- indexBits = 0;
redBits = CHAN_BITS;
greenBits = CHAN_BITS;
blueBits = CHAN_BITS;
@@ -1117,10 +1070,8 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
gind = 1;
rind = 2;
aind = 3;
- rgbmode = GL_TRUE;
}
else if (format==OSMESA_ARGB) {
- indexBits = 0;
redBits = CHAN_BITS;
greenBits = CHAN_BITS;
blueBits = CHAN_BITS;
@@ -1129,10 +1080,8 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
rind = 1;
gind = 2;
bind = 3;
- rgbmode = GL_TRUE;
}
else if (format==OSMESA_RGB) {
- indexBits = 0;
redBits = CHAN_BITS;
greenBits = CHAN_BITS;
blueBits = CHAN_BITS;
@@ -1140,10 +1089,8 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
rind = 0;
gind = 1;
bind = 2;
- rgbmode = GL_TRUE;
}
else if (format==OSMESA_BGR) {
- indexBits = 0;
redBits = CHAN_BITS;
greenBits = CHAN_BITS;
blueBits = CHAN_BITS;
@@ -1151,11 +1098,9 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
rind = 2;
gind = 1;
bind = 0;
- rgbmode = GL_TRUE;
}
#if CHAN_TYPE == GL_UNSIGNED_BYTE
else if (format==OSMESA_RGB_565) {
- indexBits = 0;
redBits = 5;
greenBits = 6;
blueBits = 5;
@@ -1163,7 +1108,6 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
rind = 0; /* not used */
gind = 0;
bind = 0;
- rgbmode = GL_TRUE;
}
#endif
else {
@@ -1172,14 +1116,12 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context);
if (osmesa) {
- osmesa->gl_visual = _mesa_create_visual( rgbmode,
- GL_FALSE, /* double buffer */
+ osmesa->gl_visual = _mesa_create_visual( GL_FALSE, /* double buffer */
GL_FALSE, /* stereo */
redBits,
greenBits,
blueBits,
alphaBits,
- indexBits,
depthBits,
stencilBits,
accumBits,
@@ -1189,7 +1131,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
1 /* num samples */
);
if (!osmesa->gl_visual) {
- _mesa_free(osmesa);
+ free(osmesa);
return NULL;
}
@@ -1206,7 +1148,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
: (GLcontext *) NULL,
&functions, (void *) osmesa)) {
_mesa_destroy_visual( osmesa->gl_visual );
- _mesa_free(osmesa);
+ free(osmesa);
return NULL;
}
@@ -1221,7 +1163,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
if (!osmesa->gl_buffer) {
_mesa_destroy_visual( osmesa->gl_visual );
_mesa_free_context_data( &osmesa->mesa );
- _mesa_free(osmesa);
+ free(osmesa);
return NULL;
}
@@ -1260,7 +1202,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
!_swsetup_CreateContext( ctx )) {
_mesa_destroy_visual(osmesa->gl_visual);
_mesa_free_context_data(ctx);
- _mesa_free(osmesa);
+ free(osmesa);
return NULL;
}
@@ -1305,7 +1247,7 @@ OSMesaDestroyContext( OSMesaContext osmesa )
_mesa_reference_framebuffer( &osmesa->gl_buffer, NULL );
_mesa_free_context_data( &osmesa->mesa );
- _mesa_free( osmesa );
+ free( osmesa );
}
}
@@ -1579,7 +1521,7 @@ OSMesaGetProcAddress( const char *funcName )
{
int i;
for (i = 0; functions[i].Name; i++) {
- if (_mesa_strcmp(functions[i].Name, funcName) == 0)
+ if (strcmp(functions[i].Name, funcName) == 0)
return functions[i].Function;
}
return _glapi_get_proc_address(funcName);
diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c
deleted file mode 100644
index 5afa8e188bb..00000000000
--- a/src/mesa/drivers/svga/svgamesa.c
+++ /dev/null
@@ -1,516 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#ifdef SVGA
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <vga.h>
-#include "GL/svgamesa.h"
-#include "main/buffers.h"
-#include "main/context.h"
-#include "main/extensions.h"
-#include "main/imports.h"
-#include "main/matrix.h"
-#include "main/mtypes.h"
-#include "swrast/swrast.h"
-#include "svgapix.h"
-#include "svgamesa8.h"
-#include "svgamesa15.h"
-#include "svgamesa16.h"
-#include "svgamesa24.h"
-#include "svgamesa32.h"
-
-struct svga_buffer SVGABuffer;
-vga_modeinfo * SVGAInfo;
-SVGAMesaContext SVGAMesa; /* the current context */
-
-#ifdef SVGA_DEBUG
-
-#include <sys/types.h>
-#include <signal.h>
-
-FILE * logfile;
-char cbuf[1024]={0};
-
-void SVGAlog(char * what)
-{
- logfile=fopen("svgamesa.log","a");
- if (!logfile) return;
- fprintf(logfile,"%s\n",what);
- fclose(logfile);
-}
-#endif
-
-/**********************************************************************/
-/***** Init stuff... *****/
-/**********************************************************************/
-
-int SVGAMesaInit( int GraphMode )
-{
- vga_init();
- if (!vga_hasmode(GraphMode))
- {
- fprintf(stderr,"GraphMode %d unavailable...",GraphMode);
-#ifdef SVGA_DEBUG
- SVGAlog("SVGAMesaInit: invalid GraphMode (doesn't exist)");
-#endif
- return(1);
- }
- SVGAInfo=vga_getmodeinfo(GraphMode);
- if (SVGAInfo->flags & IS_MODEX)
- {
- fprintf(stderr,"ModeX not implemented...");
-#ifdef SVGA_DEBUG
- SVGAlog("SVGAMesaInit: invalid GraphMode (ModeX)");
-#endif
- return(2);
- }
- if (!SVGAInfo->bytesperpixel)
- {
- fprintf(stderr,"1 / 4 bit color not implemented...");
-#ifdef SVGA_DEBUG
- SVGAlog("SVGAMesaInit: invalid GraphMode (1 or 4 bit)");
-#endif
- return(3);
- }
- switch (SVGAInfo->colors) {
- case 256: SVGABuffer.Depth = 8; break;
- case 32768: SVGABuffer.Depth = 15; break;
- case 65536: SVGABuffer.Depth = 16; break;
- default: SVGABuffer.Depth = SVGAInfo->bytesperpixel<<3; break;
- }
- SVGABuffer.BufferSize=SVGAInfo->linewidth*SVGAInfo->height;
-#ifdef SVGA_DEBUG
- sprintf(cbuf,"SVGAMesaInit: double buffer info.\n" \
- " depth : %d\n" \
- " mode : %d\n" \
- " width : %d\n" \
- " height : %d\n" \
- " bufsize: %d\n", \
- SVGABuffer.Depth,GraphMode,SVGAInfo->linewidth, \
- SVGAInfo->height,SVGABuffer.BufferSize);
- SVGAlog(cbuf);
-#endif
- SVGABuffer.FrontBuffer=(void*)malloc(SVGABuffer.BufferSize + 4);
- if (!SVGABuffer.FrontBuffer) {
- {
- fprintf(stderr,"Not enough RAM for FRONT_LEFT_BUFFER...");
-#ifdef SVGA_DEBUG
- SVGAlog("SVGAMesaInit: Not enough RAM (front buffer)");
-#endif
- return(4);
- }
- }
-#ifdef SVGA_DEBUG
- sprintf(cbuf,"SVGAMesaInit: FrontBuffer - %p",SVGABuffer.FrontBuffer);
- SVGAlog(cbuf);
-#endif
- SVGABuffer.BackBuffer=(void*)malloc(SVGABuffer.BufferSize + 4);
- if (!SVGABuffer.BackBuffer) {
- {
- free(SVGABuffer.FrontBuffer);
- fprintf(stderr,"Not enough RAM for BACK_LEFT_BUFFER...");
-#ifdef SVGA_DEBUG
- SVGAlog("SVGAMesaInit: Not enough RAM (back buffer)");
-#endif
- return(5);
- }
- }
-#ifdef SVGA_DEBUG
- sprintf(cbuf,"SVGAMesaInit: BackBuffer - %p",SVGABuffer.BackBuffer);
- SVGAlog(cbuf);
-#endif
-
- vga_setmode(GraphMode);
- SVGABuffer.VideoRam=vga_getgraphmem();
-#ifdef SVGA_DEBUG
- sprintf(cbuf,"SVGAMesaInit: VRAM - %p",SVGABuffer.VideoRam);
- SVGAlog(cbuf);
- sprintf(cbuf,"SVGAMesaInit: done. (Mode %d)",GraphMode);
- SVGAlog(cbuf);
-#endif
-
- SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
- SVGABuffer.ReadBuffer = SVGABuffer.BackBuffer;
-
- return 0;
-}
-
-int SVGAMesaClose( void )
-{
- vga_setmode(TEXT);
- free(SVGABuffer.FrontBuffer);
- free(SVGABuffer.BackBuffer);
- return 0;
-}
-
-void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue)
-{
- if (ndx<256)
- vga_setpalette(ndx, red>>2, green>>2, blue>>2);
-}
-
-/**********************************************************************/
-/***** Miscellaneous functions *****/
-/**********************************************************************/
-
-static void copy_buffer( const GLubyte * buffer) {
- int size = SVGABuffer.BufferSize, page = 0;
-
-#ifdef SVGA_DEBUG
- sprintf(cbuf,"copy_buffer: copy %p to %p",buffer,SVGABuffer.VideoRam);
- SVGAlog(cbuf);
-#endif
-
- while(size>0) {
- vga_setpage(page++);
- if (size>>16) {
- memcpy(SVGABuffer.VideoRam,buffer,0x10000);
- buffer+=0x10000;
- }else{
- memcpy(SVGABuffer.VideoRam,buffer,size & 0xffff);
- }
- size-=0xffff;
- }
-}
-
-static void get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
-{
- *width = SVGAMesa->width = vga_getxdim();
- *height = SVGAMesa->height = vga_getydim();
-}
-
-/**
- * We only implement this function as a mechanism to check if the
- * framebuffer size has changed (and update corresponding state).
- */
-static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- GLuint newWidth, newHeight;
- GLframebuffer *buffer = ctx->WinSysDrawBuffer;
- get_buffer_size( buffer, &newWidth, &newHeight );
- if (buffer->Width != newWidth || buffer->Height != newHeight) {
- _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight );
- }
-}
-
-static void set_buffer( GLcontext *ctx, GLframebuffer *colorBuffer,
- GLenum buffer )
-{
- /* We can ignore colorBuffer since we don't support a MakeCurrentRead()
- * function.
- */
- (void) colorBuffer;
-
- if (buffer == GL_FRONT_LEFT) {
- SVGABuffer.ReadBuffer = SVGABuffer.FrontBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
-#if 0
- void * tmpptr;
- /* vga_waitretrace(); */
- copy_buffer(SVGABuffer.FrontBuffer);
- tmpptr=SVGABuffer.BackBuffer;
- SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
- SVGABuffer.FrontBuffer=tmpptr;
-#endif
- }
- else if (buffer == GL_BACK_LEFT) {
- SVGABuffer.ReadBuffer = SVGABuffer.BackBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
-#if 0
- /* vga_waitretrace(); */
- copy_buffer(SVGABuffer.BackBuffer);
-#endif
- }
-}
-
-/**********************************************************************/
-/***** *****/
-/**********************************************************************/
-
-static void svgamesa_update_state( GLcontext *ctx, GLuint new_state )
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
-
- /* Initialize all the pointers in the DD struct. Do this whenever */
- /* a new context is made current or we change buffers via set_buffer! */
-
- ctx->Driver.UpdateState = svgamesa_update_state;
-
- ctx->Driver.GetBufferSize = get_buffer_size;
- ctx->Driver.Viewport = viewport;
-
- /* Fill in the swrast driver interface:
- */
- swdd->SetBuffer = set_buffer;
-
- switch (SVGABuffer.Depth) {
- case 8: ctx->Driver.ClearIndex = __clear_index8;
- ctx->Driver.Clear = __clear8;
-
- swdd->ReadCI32Span = __read_ci32_span8;
- swdd->ReadCI32Pixels = __read_ci32_pixels8;
- swdd->WriteCI8Span = __write_ci8_span8;
- swdd->WriteCI32Span = __write_ci32_span8;
- swdd->WriteCI32Pixels = __write_ci32_pixels8;
- swdd->WriteMonoCISpan = __write_mono_ci_span8;
- swdd->WriteMonoCIPixels = __write_mono_ci_pixels8;
-#ifdef SVGA_DEBUG
- SVGAlog("SVGAUpdateState: 8 bit mode.");
-#endif
-
- break;
- case 15: ctx->Driver.ClearColor = __clear_color15;
- ctx->Driver.Clear = __clear15;
-
- swdd->ReadRGBASpan = __read_rgba_span15;
- swdd->ReadRGBAPixels = __read_rgba_pixels15;
- swdd->WriteRGBASpan = __write_rgba_span15;
- swdd->WriteRGBAPixels = __write_rgba_pixels15;
- swdd->WriteMonoRGBASpan = __write_mono_rgba_span15;
- swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels15;
-#ifdef SVGA_DEBUG
- SVGAlog("SVGAUpdateState: 15 bit mode.");
-#endif
- break;
- case 16: ctx->Driver.ClearColor = __clear_color16;
- ctx->Driver.Clear = __clear16;
-
- swdd->ReadRGBASpan = __read_rgba_span16;
- swdd->ReadRGBAPixels = __read_rgba_pixels16;
- swdd->WriteRGBASpan = __write_rgba_span16;
- swdd->WriteRGBAPixels = __write_rgba_pixels16;
- swdd->WriteMonoRGBASpan = __write_mono_rgba_span16;
- swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels16;
- break;
-#ifdef SVGA_DEBUG
- SVGAlog("SVGAUpdateState: 16 bit mode.");
-#endif
- case 24: ctx->Driver.ClearColor = __clear_color24;
- ctx->Driver.Clear = __clear24;
-
- swdd->ReadRGBASpan = __read_rgba_span24;
- swdd->ReadRGBAPixels = __read_rgba_pixels24;
- swdd->WriteRGBASpan = __write_rgba_span24;
- swdd->WriteRGBAPixels = __write_rgba_pixels24;
- swdd->WriteMonoRGBASpan = __write_mono_rgba_span24;
- swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels24;
- break;
-#ifdef SVGA_DEBUG
- SVGAlog("SVGAUpdateState: 32 bit mode.");
-#endif
- case 32: ctx->Driver.ClearColor = __clear_color32;
- ctx->Driver.Clear = __clear32;
-
- swdd->ReadRGBASpan = __read_rgba_span32;
- swdd->ReadRGBAPixels = __read_rgba_pixels32;
- swdd->WriteRGBASpan = __write_rgba_span32;
- swdd->WriteRGBAPixels = __write_rgba_pixels32;
- swdd->WriteMonoRGBASpan = __write_mono_rgba_span32;
- swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels32;
- }
-}
-
-/*
- * Create a new VGA/Mesa context and return a handle to it.
- */
-SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer )
-{
- SVGAMesaContext ctx;
-#ifndef DEV
- GLboolean rgb_flag;
- GLfloat redscale, greenscale, bluescale, alphascale;
- GLint index_bits;
- GLint redbits, greenbits, bluebits, alphabits;
-
- /* determine if we're in RGB or color index mode */
- if ((SVGABuffer.Depth==32) || (SVGABuffer.Depth==24)) {
- rgb_flag = GL_TRUE;
- redscale = greenscale = bluescale = alphascale = 255.0;
- redbits = greenbits = bluebits = 8;
- alphabits = 0;
- index_bits = 0;
- }
- else if (SVGABuffer.Depth==8) {
- rgb_flag = GL_FALSE;
- redscale = greenscale = bluescale = alphascale = 0.0;
- redbits = greenbits = bluebits = alphabits = 0;
- index_bits = 8;
- }
- else if (SVGABuffer.Depth==15) {
- rgb_flag = GL_TRUE;
- redscale = greenscale = bluescale = alphascale = 31.0;
- redbits = greenbits = bluebits = 5;
- alphabits = 0;
- index_bits = 0;
- }
- else if (SVGABuffer.Depth==16) {
- rgb_flag = GL_TRUE;
- redscale = bluescale = alphascale = 31.0;
- greenscale = 63.0;
- redbits = bluebits = 5;
- greenbits = 6;
- alphabits = 0;
- index_bits = 0;
- }
-
- ctx = (SVGAMesaContext) calloc( 1, sizeof(struct svgamesa_context) );
- if (!ctx) {
- return NULL;
- }
-
- ctx->gl_vis = _mesa_create_visual( rgb_flag,
- doubleBuffer,
- GL_FALSE, /* stereo */
- redbits, greenbits,
- bluebits, alphabits,
- index_bits,
- 16, /* depth_size */
- 8, /* stencil_size */
- 16, 16, 16, 16, /* accum_size */
- 1 /* samples */
- );
-
- ctx->gl_ctx = _mesa_create_context( ctx->gl_vis,
- NULL, /* share list context */
- (void *) ctx, GL_FALSE );
-
- _mesa_enable_sw_extensions(ctx->gl_ctx);
- _mesa_enable_1_3_extensions(ctx->gl_ctx);
-
- _mesa_init_driver_functions(&ctx->Driver);
-
- ctx->gl_buffer = _mesa_create_framebuffer( ctx->gl_vis,
- ctx->gl_vis->depthBits > 0,
- ctx->gl_vis->stencilBits > 0,
- ctx->gl_vis->accumRedBits > 0,
- ctx->gl_vis->alphaBits > 0 );
-
- ctx->width = ctx->height = 0; /* temporary until first "make-current" */
-#endif
- return ctx;
-}
-
-/*
- * Destroy the given VGA/Mesa context.
- */
-void SVGAMesaDestroyContext( SVGAMesaContext ctx )
-{
-#ifndef DEV
- if (ctx) {
- _mesa_destroy_visual( ctx->gl_vis );
- _mesa_destroy_context( ctx->gl_ctx );
- free( ctx );
- if (ctx==SVGAMesa) {
- SVGAMesa = NULL;
- }
- }
-#endif
-}
-
-/*
- * Make the specified VGA/Mesa context the current one.
- */
-void SVGAMesaMakeCurrent( SVGAMesaContext ctx )
-{
-#ifndef DEV
- SVGAMesa = ctx;
- svgamesa_update_state( ctx->gl_ctx, ~0 );
- _mesa_make_current( ctx->gl_ctx, ctx->gl_buffer );
-
- if (ctx->width==0 || ctx->height==0) {
- ctx->width = vga_getxdim();
- ctx->height = vga_getydim();
- }
-#endif
-}
-
-/*
- * Return a handle to the current VGA/Mesa context.
- */
-SVGAMesaContext SVGAMesaGetCurrentContext( void )
-{
- return SVGAMesa;
-}
-
-/*
- * Swap front/back buffers for current context if double buffered.
- */
-void SVGAMesaSwapBuffers( void )
-{
-#if 000
- void * tmpptr;
-#endif
-
- /* vga_waitretrace(); */
- copy_buffer(SVGABuffer.BackBuffer);
-
-#ifndef DEV
- _mesa_notifySwapBuffers( SVGAMesa->gl_ctx );
- if (SVGAMesa->gl_vis->doubleBufferMode)
-#endif /* DEV */
- {
-#ifdef SVGA_DEBUG
- sprintf(cbuf,"SVGAMesaSwapBuffers : Swapping...");
- SVGAlog(cbuf);
-#endif /* SVGA_DEBUG */
-#if 000
- tmpptr=SVGABuffer.BackBuffer;
- SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer;
- SVGABuffer.FrontBuffer=tmpptr;
-#endif
-#ifdef SVGA_DEBUG
- sprintf(cbuf,"SVGAMesaSwapBuffers : WriteBuffer : %p\n"
- " Readbuffer : %p", \
- SVGABuffer.BackBuffer, SVGABuffer.FrontBuffer );
- SVGAlog(cbuf);
-#endif /* SVGA_DEBUG */
- }
-}
-
-#else /*SVGA*/
-
-/*
- * Need this to provide at least one external definition when SVGA is
- * not defined on the compiler command line.
- */
-extern int gl_svga_dummy_function(void);
-int gl_svga_dummy_function(void)
-{
- return 0;
-}
-
-#endif /*SVGA*/
-
diff --git a/src/mesa/drivers/svga/svgamesa15.c b/src/mesa/drivers/svga/svgamesa15.c
deleted file mode 100644
index 934aaa33fb3..00000000000
--- a/src/mesa/drivers/svga/svgamesa15.c
+++ /dev/null
@@ -1,220 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#ifdef SVGA
-
-#include "svgapix.h"
-#include "svgamesa15.h"
-#include "swrast/swrast.h"
-
-
-static void __svga_drawpixel15(int x, int y, unsigned long c)
-{
- unsigned long offset;
- GLshort *shortBuffer=(void *)SVGABuffer.DrawBuffer;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->width + x;
- shortBuffer[offset]=c;
-}
-
-static unsigned long __svga_getpixel15(int x, int y)
-{
- unsigned long offset;
- GLshort *shortBuffer=(void *)SVGABuffer.ReadBuffer;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->width + x;
- return shortBuffer[offset];
-}
-
-void __clear_color15( GLcontext *ctx, const GLfloat color[4] )
-{
- GLubyte col[3];
- CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
- SVGAMesa->clear_hicolor=(col[0]>>3)<<10 | (col[1]>>3)<<5 | (col[2]>>3);
-/* SVGAMesa->clear_hicolor=(red)<<10 | (green)<<5 | (blue);*/
-}
-
-void __clear15( GLcontext *ctx, GLbitfield mask )
-{
- int i, j;
- int x = ctx->DrawBuffer->_Xmin;
- int y = ctx->DrawBuffer->_Ymin;
- int width = ctx->DrawBuffer->_Xmax - x;
- int height = ctx->DrawBuffer->_Ymax - y;
- GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height)
-
- if (mask & DD_FRONT_LEFT_BIT) {
- GLshort *shortBuffer=(void *)SVGABuffer.FrontBuffer;
- if (all) {
- for (i=0;i<SVGABuffer.BufferSize / 2;i++)
- shortBuffer[i]=SVGAMesa->clear_hicolor;
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel15(i,j,SVGAMesa->clear_hicolor);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_FRONT_LEFT_BIT;
- }
- if (mask & DD_BACK_LEFT_BIT) {
- GLshort *shortBuffer=(void *)SVGABuffer.BackBuffer;
- if (all) {
- for (i=0;i<SVGABuffer.BufferSize / 2;i++)
- shortBuffer[i]=SVGAMesa->clear_hicolor;
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel15(i,j,SVGAMesa->clear_hicolor);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask );
-}
-
-void __write_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- if (mask) {
- /* draw some pixels */
- for (i=0; i<n; i++, x++) {
- if (mask[i]) {
- __svga_drawpixel15( x, y, (rgba[i][RCOMP]>>3)<<10 | \
- (rgba[i][GCOMP]>>3)<<5 | \
- (rgba[i][BCOMP]>>3));
- }
- }
- }
- else {
- /* draw all pixels */
- for (i=0; i<n; i++, x++) {
- __svga_drawpixel15( x, y, (rgba[i][RCOMP]>>3)<<10 | \
- (rgba[i][GCOMP]>>3)<<5 | \
- (rgba[i][BCOMP]>>3));
- }
- }
-}
-
-void __write_mono_rgba_span15( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[])
-{
- GLushort hicolor = (color[RCOMP] >> 3) << 10 |
- (color[GCOMP] >> 3) << 5 |
- (color[BCOMP] >> 3);
- int i;
- for (i=0; i<n; i++, x++) {
- if (mask[i]) {
- __svga_drawpixel15( x, y, hicolor);
- }
- }
-}
-
-void __read_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
-{
- int i,pix;
- for (i=0; i<n; i++, x++) {
- pix = __svga_getpixel15( x, y);
- rgba[i][RCOMP] = ((pix>>10)<<3) & 0xff;
- rgba[i][GCOMP] = ((pix>> 5)<<3) & 0xff;
- rgba[i][BCOMP] = ((pix )<<3) & 0xff;
- }
-}
-
-void __write_rgba_pixels15( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel15( x[i], y[i], (rgba[i][RCOMP]>>3)<<10 | \
- (rgba[i][GCOMP]>>3)<<5 | \
- (rgba[i][BCOMP]>>3));
- }
- }
-}
-
-
-void __write_mono_rgba_pixels15( const GLcontext *ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- const GLchan color[4], const GLubyte mask[] )
-{
- GLushort hicolor = (color[RCOMP] >> 3) << 10 |
- (color[GCOMP] >> 3) << 5 |
- (color[BCOMP] >> 3);
- int i;
- /* use current rgb color */
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel15( x[i], y[i], hicolor );
- }
- }
-}
-
-void __read_rgba_pixels15( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i,pix;
- for (i=0; i<n; i++,x++) {
- pix = __svga_getpixel15( x[i], y[i] );
- rgba[i][RCOMP] = ((pix>>10)<<3) & 0xff;
- rgba[i][GCOMP] = ((pix>> 5)<<3) & 0xff;
- rgba[i][BCOMP] = ((pix )<<3) & 0xff;
- }
-}
-
-#else
-
-
-/* silence compiler warning */
-extern void _mesa_svga15_dummy_function(void);
-void _mesa_svga15_dummy_function(void)
-{
-}
-
-
-#endif
diff --git a/src/mesa/drivers/svga/svgamesa15.h b/src/mesa/drivers/svga/svgamesa15.h
deleted file mode 100644
index d453fb8d355..00000000000
--- a/src/mesa/drivers/svga/svgamesa15.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-
-#ifndef SVGA_MESA_15_H
-#define SVGA_MESA_15_H
-
-extern void __clear_color15( GLcontext *ctx, const GLfloat color[4] );
-extern void __clear15( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-extern void __write_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
-extern void __write_mono_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]);
-extern void __read_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
-extern void __write_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
-extern void __write_mono_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] );
-extern void __read_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
-
-#endif /* SVGA_MESA_15_H */
diff --git a/src/mesa/drivers/svga/svgamesa16.c b/src/mesa/drivers/svga/svgamesa16.c
deleted file mode 100644
index 9fc8c786e8d..00000000000
--- a/src/mesa/drivers/svga/svgamesa16.c
+++ /dev/null
@@ -1,218 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#ifdef SVGA
-
-#include "svgapix.h"
-#include "svgamesa16.h"
-#include "swrast/swrast.h"
-
-
-static void __svga_drawpixel16(int x, int y, unsigned long c)
-{
- unsigned long offset;
- GLshort *shortBuffer=(void *)SVGABuffer.DrawBuffer;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->width + x;
- shortBuffer[offset]=c;
-}
-
-static unsigned long __svga_getpixel16(int x, int y)
-{
- unsigned long offset;
-
- GLshort *shortBuffer=(void *)SVGABuffer.ReadBuffer;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->width + x;
- return shortBuffer[offset];
-}
-
-void __clear_color16( GLcontext *ctx, const GLfloat color[4] )
-{
- GLubyte col[3];
- CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
- SVGAMesa->clear_hicolor = (col[0] >> 3) << 11 |
- (col[1] >> 2) << 5 |
- (col[2] >> 3);
-/* SVGAMesa->clear_hicolor=(red)<<11 | (green)<<5 | (blue); */
-}
-
-void __clear16( GLcontext *ctx, GLbitfield mask )
-{
- int i,j;
- int x = ctx->DrawBuffer->_Xmin;
- int y = ctx->DrawBuffer->_Ymin;
- int width = ctx->DrawBuffer->_Xmax - x;
- int height = ctx->DrawBuffer->_Ymax - y;
- GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height)
-
- if (mask & DD_FRONT_LEFT_BIT) {
- if (all) {
- GLshort *shortBuffer=(void *)SVGABuffer.FrontBuffer;
- for (i=0;i<SVGABuffer.BufferSize / 2;i++)
- shortBuffer[i]=SVGAMesa->clear_hicolor;
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_FRONT_LEFT_BIT;
- }
- if (mask & DD_BACK_LEFT_BIT) {
- if (all) {
- GLshort *shortBuffer=(void *)SVGABuffer.BackBuffer;
- for (i=0;i<SVGABuffer.BufferSize / 2;i++)
- shortBuffer[i]=SVGAMesa->clear_hicolor;
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask );
-}
-
-void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- if (mask) {
- /* draw some pixels */
- for (i=0; i<n; i++, x++) {
- if (mask[i]) {
- __svga_drawpixel16( x, y, (rgba[i][RCOMP]>>3)<<11 | \
- (rgba[i][GCOMP]>>2)<<5 | \
- (rgba[i][BCOMP]>>3));
- }
- }
- }
- else {
- /* draw all pixels */
- for (i=0; i<n; i++, x++) {
- __svga_drawpixel16( x, y, (rgba[i][RCOMP]>>3)<<11 | \
- (rgba[i][GCOMP]>>2)<<5 | \
- (rgba[i][BCOMP]>>3));
- }
- }
-}
-
-void __write_mono_rgba_span16( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[])
-{
- GLushort hicolor=(color[RCOMP]>>3)<<11 | (color[GCOMP]>>2)<<5 | (color[BCOMP]>>3);
- int i;
- for (i=0; i<n; i++, x++) {
- if (mask[i]) {
- __svga_drawpixel16( x, y, hicolor);
- }
- }
-}
-
-void __read_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
-{
- int i,pix;
- for (i=0; i<n; i++, x++) {
- pix = __svga_getpixel16( x, y );
- rgba[i][RCOMP] = ((pix>>11)<<3) & 0xff;
- rgba[i][GCOMP] = ((pix>> 5)<<2) & 0xff;
- rgba[i][BCOMP] = ((pix )<<3) & 0xff;
- }
-}
-
-void __write_rgba_pixels16( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel16( x[i], y[i], (rgba[i][RCOMP]>>3)<<11 | \
- (rgba[i][GCOMP]>>2)<<5 | \
- (rgba[i][BCOMP]>>3));
- }
- }
-}
-
-
-void __write_mono_rgba_pixels16( const GLcontext *ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- const GLchan color[4], const GLubyte mask[] )
-{
- GLushort hicolor=(color[RCOMP]>>3)<<11 | (color[GCOMP]>>2)<<5 | (color[BCOMP]>>3);
- int i;
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel16( x[i], y[i], hicolor );
- }
- }
-}
-
-void __read_rgba_pixels16( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i,pix;
- for (i=0; i<n; i++,x++) {
- pix = __svga_getpixel16( x[i], y[i] );
- rgba[i][RCOMP] = ((pix>>11)<<3) & 0xff;
- rgba[i][GCOMP] = ((pix>> 5)<<2) & 0xff;
- rgba[i][BCOMP] = ((pix )<<3) & 0xff;
- }
-}
-
-#else
-
-
-/* silence compiler warning */
-extern void _mesa_svga16_dummy_function(void);
-void _mesa_svga16_dummy_function(void)
-{
-}
-
-
-#endif
diff --git a/src/mesa/drivers/svga/svgamesa16.h b/src/mesa/drivers/svga/svgamesa16.h
deleted file mode 100644
index b80cd3dd7e4..00000000000
--- a/src/mesa/drivers/svga/svgamesa16.h
+++ /dev/null
@@ -1,43 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-
-#ifndef SVGA_MESA_16_H
-#define SVGA_MESA_16_H
-
-extern void __clear_color16( GLcontext *ctx, const GLfloat color[4] );
-extern void __clear16( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-extern void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
-extern void __write_mono_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]);
-extern void __read_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
-extern void __write_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
-extern void __write_mono_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] );
-extern void __read_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
-
-#endif /* SVGA_MESA_16_H */
-
diff --git a/src/mesa/drivers/svga/svgamesa24.c b/src/mesa/drivers/svga/svgamesa24.c
deleted file mode 100644
index f2ec9c0364a..00000000000
--- a/src/mesa/drivers/svga/svgamesa24.c
+++ /dev/null
@@ -1,242 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#ifdef SVGA
-
-#include "svgapix.h"
-#include "svgamesa24.h"
-#include "swrast/swrast.h"
-
-
-#if 0
-/* this doesn't compile with GCC on RedHat 6.1 */
-static INLINE int RGB2BGR24(int c)
-{
- asm("rorw $8, %0\n"
- "rorl $16, %0\n"
- "rorw $8, %0\n"
- "shrl $8, %0\n"
- : "=q"(c):"0"(c));
- return c;
-}
-#else
-static unsigned long RGB2BGR24(unsigned long color)
-{
- return (color & 0xff00)|(color>>16)|((color & 0xff)<<16);
-}
-#endif
-
-static void __svga_drawpixel24(int x, int y, GLubyte r, GLubyte g, GLubyte b)
-{
- unsigned long offset;
-
- _RGB *rgbBuffer=(void *)SVGABuffer.DrawBuffer;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->width + x;
-
- rgbBuffer[offset].r=r;
- rgbBuffer[offset].g=g;
- rgbBuffer[offset].b=b;
-}
-
-static unsigned long __svga_getpixel24(int x, int y)
-{
- unsigned long offset;
-
- _RGB *rgbBuffer=(void *)SVGABuffer.ReadBuffer;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->width + x;
- return rgbBuffer[offset].r<<16 | rgbBuffer[offset].g<<8 | rgbBuffer[offset].b;
-}
-
-void __clear_color24( GLcontext *ctx, const GLfloat color[4] )
-{
- GLubyte col[3];
- CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
- SVGAMesa->clear_red = col[0];
- SVGAMesa->clear_green = col[1];
- SVGAMesa->clear_blue = col[2];
-/* SVGAMesa->clear_truecolor = red<<16 | green<<8 | blue; */
-}
-
-void __clear24( GLcontext *ctx, GLbitfield mask )
-{
- int i,j;
- int x = ctx->DrawBuffer->_Xmin;
- int y = ctx->DrawBuffer->_Ymin;
- int width = ctx->DrawBuffer->_Xmax - x;
- int height = ctx->DrawBuffer->_Ymax - y;
- GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height)
-
- if (mask & DD_FRONT_LEFT_BIT) {
- if (all) {
- _RGB *rgbBuffer=(void *)SVGABuffer.FrontBuffer;
- for (i=0;i<SVGABuffer.BufferSize / 3;i++) {
- rgbBuffer[i].r=SVGAMesa->clear_red;
- rgbBuffer[i].g=SVGAMesa->clear_green;
- rgbBuffer[i].b=SVGAMesa->clear_blue;
- }
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel24( i, j, SVGAMesa->clear_red,
- SVGAMesa->clear_green,
- SVGAMesa->clear_blue);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_FRONT_LEFT_BIT;
- }
- if (mask & DD_BACK_LEFT_BIT) {
- if (all) {
- _RGB *rgbBuffer=(void *)SVGABuffer.BackBuffer;
- for (i=0;i<SVGABuffer.BufferSize / 3;i++) {
- rgbBuffer[i].r=SVGAMesa->clear_red;
- rgbBuffer[i].g=SVGAMesa->clear_green;
- rgbBuffer[i].b=SVGAMesa->clear_blue;
- }
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel24( i, j, SVGAMesa->clear_red,
- SVGAMesa->clear_green,
- SVGAMesa->clear_blue);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask );
-}
-
-void __write_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- if (mask) {
- /* draw some pixels */
- for (i=0; i<n; i++, x++) {
- if (mask[i]) {
- __svga_drawpixel24( x, y, rgba[i][RCOMP],
- rgba[i][GCOMP],
- rgba[i][BCOMP]);
- }
- }
- }
- else {
- /* draw all pixels */
- for (i=0; i<n; i++, x++) {
- __svga_drawpixel24( x, y, rgba[i][RCOMP],
- rgba[i][GCOMP],
- rgba[i][BCOMP]);
- }
- }
-}
-
-void __write_mono_rgba_span24( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[])
-{
- int i;
- for (i=0; i<n; i++, x++) {
- if (mask[i]) {
- __svga_drawpixel24( x, y, color[RCOMP], color[GCOMP], color[BCOMP]);
- }
- }
-}
-
-void __read_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
-{
- int i;
- for (i=0; i<n; i++, x++) {
- *((GLint*)rgba[i]) = RGB2BGR24(__svga_getpixel24( x, y));
- }
-}
-
-void __write_rgba_pixels24( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel24( x[i], y[i], rgba[i][RCOMP],
- rgba[i][GCOMP],
- rgba[i][BCOMP]);
- }
- }
-}
-
-void __write_mono_rgba_pixels24( const GLcontext *ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- const GLchan color[4], const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel24( x[i], y[i],
- color[RCOMP], color[GCOMP], color[BCOMP] );
- }
- }
-}
-
-void __read_rgba_pixels24( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++,x++) {
- *((GLint*)rgba[i]) = RGB2BGR24(__svga_getpixel24( x[i], y[i]));
- }
-}
-
-#else
-
-
-/* silence compiler warning */
-extern void _mesa_svga24_dummy_function(void);
-void _mesa_svga24_dummy_function(void)
-{
-}
-
-
-#endif
diff --git a/src/mesa/drivers/svga/svgamesa24.h b/src/mesa/drivers/svga/svgamesa24.h
deleted file mode 100644
index df5fa68c44e..00000000000
--- a/src/mesa/drivers/svga/svgamesa24.h
+++ /dev/null
@@ -1,43 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-
-#ifndef SVGA_MESA_24_H
-#define SVGA_MESA_24_H
-
-extern void __clear_color24( GLcontext *ctx, const GLfloat color[4] );
-extern void __clear24( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-extern void __write_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
-extern void __write_mono_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]);
-extern void __read_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
-extern void __write_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
-extern void __write_mono_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] );
-extern void __read_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
-
-#endif /* SVGA_MESA_24_H */
-
diff --git a/src/mesa/drivers/svga/svgamesa32.c b/src/mesa/drivers/svga/svgamesa32.c
deleted file mode 100644
index 8eea3cbe648..00000000000
--- a/src/mesa/drivers/svga/svgamesa32.c
+++ /dev/null
@@ -1,223 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#ifdef SVGA
-
-#include "svgapix.h"
-#include "svgamesa32.h"
-#include "swrast/swrast.h"
-
-
-#if 0
-/* this doesn't compile with GCC on RedHat 6.1 */
-static INLINE int RGB2BGR32(int c)
-{
- asm("rorw $8, %0\n"
- "rorl $16, %0\n"
- "rorw $8, %0\n"
- "shrl $8, %0\n"
- : "=q"(c):"0"(c));
- return c;
-}
-#else
-static unsigned long RGB2BGR32(unsigned long color)
-{
- return (color & 0xff00)|(color>>16)|((color & 0xff)<<16);
-}
-#endif
-
-static void __svga_drawpixel32(int x, int y, unsigned long c)
-{
- unsigned long offset;
-
- GLint *intBuffer=(void *)SVGABuffer.DrawBuffer;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->width + x;
- intBuffer[offset]=c;
-}
-
-static unsigned long __svga_getpixel32(int x, int y)
-{
- unsigned long offset;
-
- const GLint *intBuffer=(void *)SVGABuffer.ReadBuffer;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->width + x;
- return intBuffer[offset];
-}
-
-void __clear_color32( GLcontext *ctx, const GLfloat color[4] )
-{
- GLubyte col[3];
- CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
- SVGAMesa->clear_truecolor = (col[0] << 16) | (col[1] << 8) | col[2];
-}
-
-void __clear32( GLcontext *ctx, GLbitfield mask )
-{
- int i,j;
- int x = ctx->DrawBuffer->_Xmin;
- int y = ctx->DrawBuffer->_Ymin;
- int width = ctx->DrawBuffer->_Xmax - x;
- int height = ctx->DrawBuffer->_Ymax - y;
- GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height)
-
- if (mask & DD_FRONT_LEFT_BIT) {
- if (all) {
- GLint *intBuffer=(void *)SVGABuffer.FrontBuffer;
- for (i=0;i<SVGABuffer.BufferSize / 4;i++)
- intBuffer[i]=SVGAMesa->clear_truecolor;
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel32(i,j,SVGAMesa->clear_truecolor);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_FRONT_LEFT_BIT;
- }
- if (mask & DD_BACK_LEFT_BIT) {
- if (all) {
- GLint *intBuffer=(void *)SVGABuffer.BackBuffer;
- for (i=0;i<SVGABuffer.BufferSize / 4;i++)
- intBuffer[i]=SVGAMesa->clear_truecolor;
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel32(i,j,SVGAMesa->clear_truecolor);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask );
-}
-
-void __write_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- if (mask) {
- /* draw some pixels */
- for (i=0; i<n; i++, x++) {
- if (mask[i]) {
- __svga_drawpixel32( x, y, RGB2BGR32(*((GLint*)rgba[i])));
- }
- }
- }
- else {
- /* draw all pixels */
- for (i=0; i<n; i++, x++) {
- __svga_drawpixel32( x, y, RGB2BGR32(*((GLint*)rgba[i])));
- }
- }
-}
-
-void __write_mono_rgba_span32( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[])
-{
- int i;
- GLuint truecolor = color[RCOMP]<<16 | color[GCOMP]<<8 | color[BCOMP];
- for (i=0; i<n; i++, x++) {
- if (mask[i]) {
- __svga_drawpixel32( x, y, truecolor);
- }
- }
-}
-
-void __read_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
-{
- int i;
- for (i=0; i<n; i++, x++) {
- *((GLint*)rgba[i]) = RGB2BGR32(__svga_getpixel32( x, y ));
- }
-}
-
-void __write_rgba_pixels32( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel32( x[i], y[i], RGB2BGR32(*((GLint*)rgba[i])));
- }
- }
-}
-
-void __write_mono_rgba_pixels32( const GLcontext *ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- const GLchan color[4], const GLubyte mask[] )
-{
- GLuint truecolor = color[RCOMP]<<16 | color[GCOMP]<<8 | color[BCOMP];
- int i;
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel32( x[i], y[i], truecolor );
- }
- }
-}
-
-void __read_rgba_pixels32( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++,x++) {
- *((GLint*)rgba[i]) = RGB2BGR32(__svga_getpixel32( x[i], y[i] ));
- }
-}
-
-
-#else
-
-
-/* silence compiler warning */
-extern void _mesa_svga32_dummy_function(void);
-void _mesa_svga32_dummy_function(void)
-{
-}
-
-
-#endif
-
diff --git a/src/mesa/drivers/svga/svgamesa32.h b/src/mesa/drivers/svga/svgamesa32.h
deleted file mode 100644
index 6cf8315300b..00000000000
--- a/src/mesa/drivers/svga/svgamesa32.h
+++ /dev/null
@@ -1,43 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-
-#ifndef SVGA_MESA_32_H
-#define SVGA_MESA_32_H
-
-extern void __clear_color32( GLcontext *ctx, const GLfloat color[4] );
-extern void __clear32( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-extern void __write_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
-extern void __write_mono_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]);
-extern void __read_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
-extern void __write_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
-extern void __write_mono_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] );
-extern void __read_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
-
-#endif /* SVGA_MESA_32_H */
-
diff --git a/src/mesa/drivers/svga/svgamesa8.c b/src/mesa/drivers/svga/svgamesa8.c
deleted file mode 100644
index 2f7048a9301..00000000000
--- a/src/mesa/drivers/svga/svgamesa8.c
+++ /dev/null
@@ -1,196 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#ifdef SVGA
-
-
-#include "svgapix.h"
-#include "svgamesa8.h"
-#include "swrast/swrast.h"
-
-
-static void __svga_drawpixel8(int x, int y, unsigned long c)
-{
- unsigned long offset;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->linewidth + x;
- SVGABuffer.DrawBuffer[offset]=c;
-}
-
-static unsigned long __svga_getpixel8(int x, int y)
-{
- unsigned long offset;
- y = SVGAInfo->height-y-1;
- offset = y * SVGAInfo->linewidth + x;
- return SVGABuffer.ReadBuffer[offset];
-}
-
-void __clear_index8( GLcontext *ctx, GLuint index )
-{
- SVGAMesa->clear_index = index;
-}
-
-void __clear8( GLcontext *ctx, GLbitfield mask )
-{
- int i,j;
- int x = ctx->DrawBuffer->_Xmin;
- int y = ctx->DrawBuffer->_Ymin;
- int width = ctx->DrawBuffer->_Xmax - x;
- int height = ctx->DrawBuffer->_Ymax - y;
- GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height)
-
- if (mask & DD_FRONT_LEFT_BIT) {
- if (all) {
- memset(SVGABuffer.FrontBuffer, SVGAMesa->clear_index, SVGABuffer.BufferSize);
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel8(i,j,SVGAMesa->clear_index);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_FRONT_LEFT_BIT;
- }
- if (mask & DD_BACK_LEFT_BIT) {
- if (all) {
- memset(SVGABuffer.BackBuffer, SVGAMesa->clear_index, SVGABuffer.BufferSize);
- }
- else {
- GLubyte *tmp = SVGABuffer.DrawBuffer;
- SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer;
- for (i=x;i<width;i++)
- for (j=y;j<height;j++)
- __svga_drawpixel8(i,j,SVGAMesa->clear_index);
- SVGABuffer.DrawBuffer = tmp;
- }
- mask &= ~DD_BACK_LEFT_BIT;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask );
-}
-
-void __write_ci32_span8( const GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const GLuint index[], const GLubyte mask[] )
-{
- int i;
- for (i=0;i<n;i++,x++) {
- if (mask[i]) {
- __svga_drawpixel8( x, y, index[i]);
- }
- }
-}
-
-void __write_ci8_span8( const GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const GLubyte index[], const GLubyte mask[] )
-{
- int i;
-
- for (i=0;i<n;i++,x++) {
- if (mask[i]) {
- __svga_drawpixel8( x, y, index[i]);
- }
- }
-}
-
-void __write_mono_ci_span8( const GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- GLuint colorIndex, const GLubyte mask[] )
-{
- int i;
- for (i=0;i<n;i++,x++) {
- if (mask[i]) {
- __svga_drawpixel8( x, y, colorIndex);
- }
- }
-}
-
-void __read_ci32_span8( const GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, GLuint index[])
-{
- int i;
- for (i=0; i<n; i++,x++) {
- index[i] = __svga_getpixel8( x, y);
- }
-}
-
-void __write_ci32_pixels8( const GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint index[], const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel8( x[i], y[i], index[i]);
- }
- }
-}
-
-
-void __write_mono_ci_pixels8( const GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- GLuint colorIndex, const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++) {
- if (mask[i]) {
- __svga_drawpixel8( x[i], y[i], colorIndex);
- }
- }
-}
-
-void __read_ci32_pixels8( const GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- GLuint index[], const GLubyte mask[] )
-{
- int i;
- for (i=0; i<n; i++,x++) {
- index[i] = __svga_getpixel8( x[i], y[i]);
- }
-}
-
-
-#else
-
-
-/* silence compiler warning */
-extern void _mesa_svga8_dummy_function(void);
-void _mesa_svga8_dummy_function(void)
-{
-}
-
-
-#endif
diff --git a/src/mesa/drivers/svga/svgamesa8.h b/src/mesa/drivers/svga/svgamesa8.h
deleted file mode 100644
index d2b0509480f..00000000000
--- a/src/mesa/drivers/svga/svgamesa8.h
+++ /dev/null
@@ -1,43 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.2
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-
-#ifndef SVGA_MESA_8_H
-#define SVGA_MESA_8_H
-
-extern void __clear_index8( GLcontext *ctx, GLuint index );
-extern void __clear8( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-extern void __write_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] );
-extern void __write_ci8_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] );
-extern void __write_mono_ci_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[] );
-extern void __read_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint index[]);
-extern void __write_ci32_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] );
-extern void __write_mono_ci_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[] );
-extern void __read_ci32_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLuint index[], const GLubyte mask[] );
-
-#endif /* SVGA_MESA_15_H */
diff --git a/src/mesa/drivers/svga/svgapix.h b/src/mesa/drivers/svga/svgapix.h
deleted file mode 100644
index c8cee37ca68..00000000000
--- a/src/mesa/drivers/svga/svgapix.h
+++ /dev/null
@@ -1,70 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- * Copyright (C) 1995-2002 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * SVGA driver for Mesa.
- * Original author: Brian Paul
- * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2)
- */
-
-
-#ifndef SVGAPIX_H
-#define SVGAPIX_H
-
-#include "GL/gl.h"
-#include "GL/svgamesa.h"
-#include "main/context.h"
-#include "main/colormac.h"
-#include "vga.h"
-
-struct svgamesa_context {
- GLcontext *gl_ctx; /* the core Mesa context */
- GLvisual *gl_vis; /* describes the color buffer */
- GLframebuffer *gl_buffer; /* the ancillary buffers */
- GLuint clear_index; /* current clear index */
- GLint clear_red,
- clear_green,
- clear_blue; /* current clear rgb color */
- GLuint clear_truecolor; /* current clear rgb color */
- GLushort hicolor; /* current hicolor */
- GLushort clear_hicolor; /* current clear hicolor */
- GLint width, height; /* size of color buffer */
- GLint depth; /* bits per pixel (8,16,24 or 32) */
-};
-
-typedef struct { GLubyte b,g,r; } _RGB;
-
-struct svga_buffer {
- GLint Depth;
- GLint BufferSize;
- GLubyte * FrontBuffer;
- GLubyte * BackBuffer;
- GLubyte * VideoRam;
- GLubyte * DrawBuffer; /* == FrontBuffer or BackBuffer */
- GLubyte * ReadBuffer; /* == FrontBuffer or BackBuffer */
-};
-
-extern struct svga_buffer SVGABuffer;
-extern vga_modeinfo * SVGAInfo;
-extern SVGAMesaContext SVGAMesa; /* the current context */
-
-#endif /* SVGAPIX_H */
diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def
index a31dc55e3fa..b537b3460c5 100644
--- a/src/mesa/drivers/windows/gdi/mesa.def
+++ b/src/mesa/drivers/windows/gdi/mesa.def
@@ -867,8 +867,6 @@ EXPORTS
_glapi_get_proc_address
_mesa_add_soft_renderbuffers
_mesa_add_renderbuffer
- _mesa_bzero
- _mesa_calloc
_mesa_check_conditional_render
_mesa_choose_tex_format
_mesa_create_framebuffer
@@ -887,7 +885,6 @@ EXPORTS
_mesa_error
_mesa_finish_render_texture
_mesa_framebuffer_renderbuffer
- _mesa_free
_mesa_free_context_data
_mesa_free_texture_image_data
_mesa_generate_mipmap
@@ -899,8 +896,6 @@ EXPORTS
_mesa_init_renderbuffer
_mesa_initialize_context
_mesa_make_current
- _mesa_memcpy
- _mesa_memset
_mesa_new_array_object
_mesa_new_framebuffer
_mesa_new_program
@@ -926,7 +921,6 @@ EXPORTS
_mesa_store_texsubimage1d
_mesa_store_texsubimage2d
_mesa_store_texsubimage3d
- _mesa_strcmp
_mesa_test_proxy_teximage
_mesa_reference_framebuffer
_mesa_update_framebuffer_visual
@@ -966,4 +960,4 @@ EXPORTS
_tnl_InvalidateState
_tnl_run_pipeline
_tnl_program_string
- _tnl_RasterPos \ No newline at end of file
+ _tnl_RasterPos
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index b24b758cfb2..91ddc3615a1 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -1245,7 +1245,7 @@ static void read_rgba_pixels_16(const GLcontext *ctx,
static void
wmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
- _mesa_free(rb);
+ free(rb);
}
@@ -1461,12 +1461,10 @@ WMesaContext WMesaCreateContext(HDC hDC,
break;
}
/* Create visual based on flags */
- visual = _mesa_create_visual(rgb_flag,
- db_flag, /* db_flag */
+ visual = _mesa_create_visual(db_flag, /* db_flag */
GL_FALSE, /* stereo */
red_bits, green_bits, blue_bits, /* color RGB */
alpha_flag ? alpha_bits : 0, /* color A */
- 0, /* index bits */
DEFAULT_SOFTWARE_DEPTH_BITS, /* depth_bits */
8, /* stencil_bits */
16,16,16, /* accum RGB */
@@ -1474,7 +1472,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
1); /* num samples */
if (!visual) {
- _mesa_free(c);
+ free(c);
return NULL;
}
@@ -1512,7 +1510,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
!_tnl_CreateContext(ctx) ||
!_swsetup_CreateContext(ctx)) {
_mesa_free_context_data(ctx);
- _mesa_free(c);
+ free(c);
return NULL;
}
_swsetup_Wakeup(ctx);
@@ -1557,7 +1555,7 @@ void WMesaDestroyContext( WMesaContext pwc )
_swrast_DestroyContext(ctx);
_mesa_free_context_data(ctx);
- _mesa_free(pwc);
+ free(pwc);
}
diff --git a/src/mesa/drivers/windows/gldirect/dglcontext.c b/src/mesa/drivers/windows/gldirect/dglcontext.c
index e9c23d1ccb0..a420b36ffb4 100644
--- a/src/mesa/drivers/windows/gldirect/dglcontext.c
+++ b/src/mesa/drivers/windows/gldirect/dglcontext.c
@@ -1377,14 +1377,12 @@ SkipPrimaryCreate:
#ifdef _USE_GLD3_WGL
lpCtx->glVis = _mesa_create_visual(
- GL_TRUE, // RGB mode
bDouble, /* double buffer */
GL_FALSE, // stereo
lpPFD->cRedBits,
lpPFD->cGreenBits,
lpPFD->cBlueBits,
dwAlphaBits,
- 0, // index bits
dwDepthBits,
dwStencilBits,
lpPFD->cAccumRedBits, // accum bits
diff --git a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c
index 7ac425a1092..f927abfa115 100644
--- a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c
+++ b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c
@@ -631,21 +631,6 @@ static void flush(GLcontext* ctx)
//---------------------------------------------------------------------------
-
-/*
- * Set the color index used to clear the color buffer.
- */
-static void clear_index(GLcontext* ctx, GLuint index)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- Current->clearpixel = index;
-}
-
-
-
-//---------------------------------------------------------------------------
-
/*
* Set the color used to clear the color buffer.
*/
@@ -1367,7 +1352,6 @@ static void wmesa_update_state_first_time(
ctx->Driver.Clear = clear;
ctx->Driver.Flush = flush;
- ctx->Driver.ClearIndex = clear_index;
ctx->Driver.ClearColor = clear_color;
ctx->Driver.Enable = enable;
diff --git a/src/mesa/drivers/windows/icd/mesa.def b/src/mesa/drivers/windows/icd/mesa.def
index 25ac08a2f0f..6f33d170ffe 100644
--- a/src/mesa/drivers/windows/icd/mesa.def
+++ b/src/mesa/drivers/windows/icd/mesa.def
@@ -32,8 +32,6 @@ EXPORTS
_mesa_buffer_data
_mesa_buffer_map
_mesa_buffer_subdata
- _mesa_bzero
- _mesa_calloc
_mesa_choose_tex_format
_mesa_compressed_texture_size
_mesa_create_framebuffer
@@ -47,15 +45,12 @@ EXPORTS
_mesa_enable_1_5_extensions
_mesa_enable_sw_extensions
_mesa_error
- _mesa_free
_mesa_free_context_data
_mesa_get_current_context
_mesa_init_default_imports
_mesa_init_driver_functions
_mesa_initialize_context
_mesa_make_current
- _mesa_memcpy
- _mesa_memset
_mesa_new_buffer_object
_mesa_new_texture_object
_mesa_problem
@@ -72,7 +67,6 @@ EXPORTS
_mesa_store_texsubimage1d
_mesa_store_texsubimage2d
_mesa_store_texsubimage3d
- _mesa_strcmp
_mesa_test_proxy_teximage
_mesa_Viewport
_mesa_meta_CopyColorSubTable
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 5c0084f37aa..f1e62b6bd4f 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -53,7 +53,7 @@
#include "xmesaP.h"
#ifdef __VMS
-#define _mesa_sprintf sprintf
+#define sprintf sprintf
#endif
/* This indicates the client-side GLX API and GLX encoder version. */
@@ -152,13 +152,8 @@ is_usable_visual( XVisualInfo *vinfo )
return GL_TRUE;
case StaticColor:
case PseudoColor:
- /* Any StaticColor/PseudoColor visual of at least 4 bits */
- if (vinfo->depth>=4) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
+ /* Color-index rendering is not supported. */
+ return GL_FALSE;
case TrueColor:
case DirectColor:
/* Any depth of TrueColor or DirectColor works in RGB mode */
@@ -268,7 +263,7 @@ level_of_visual( Display *dpy, XVisualInfo *vinfo )
*/
static XMesaVisual
save_glx_visual( Display *dpy, XVisualInfo *vinfo,
- GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag,
+ GLboolean alphaFlag, GLboolean dbFlag,
GLboolean stereoFlag,
GLint depth_size, GLint stencil_size,
GLint accumRedSize, GLint accumGreenSize,
@@ -309,7 +304,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
comparePointers = GL_FALSE;
/* Force the visual to have an alpha channel */
- if (rgbFlag && _mesa_getenv("MESA_GLX_FORCE_ALPHA"))
+ if (_mesa_getenv("MESA_GLX_FORCE_ALPHA"))
alphaFlag = GL_TRUE;
/* First check if a matching visual is already in the list */
@@ -319,7 +314,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
&& v->mesa_visual.level == level
&& v->mesa_visual.numAuxBuffers == numAuxBuffers
&& v->ximage_flag == ximageFlag
- && v->mesa_visual.rgbMode == rgbFlag
&& v->mesa_visual.doubleBufferMode == dbFlag
&& v->mesa_visual.stereoMode == stereoFlag
&& (v->mesa_visual.alphaBits > 0) == alphaFlag
@@ -339,7 +333,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
/* Create a new visual and add it to the list. */
- xmvis = XMesaCreateVisual( dpy, vinfo, rgbFlag, alphaFlag, dbFlag,
+ xmvis = XMesaCreateVisual( dpy, vinfo, GL_TRUE, alphaFlag, dbFlag,
stereoFlag, ximageFlag,
depth_size, stencil_size,
accumRedSize, accumBlueSize,
@@ -378,7 +372,7 @@ default_depth_bits(void)
int zBits;
const char *zEnv = _mesa_getenv("MESA_GLX_DEPTH_BITS");
if (zEnv)
- zBits = _mesa_atoi(zEnv);
+ zBits = atoi(zEnv);
else
zBits = DEFAULT_SOFTWARE_DEPTH_BITS;
return zBits;
@@ -390,7 +384,7 @@ default_alpha_bits(void)
int aBits;
const char *aEnv = _mesa_getenv("MESA_GLX_ALPHA_BITS");
if (aEnv)
- aBits = _mesa_atoi(aEnv);
+ aBits = atoi(aEnv);
else
aBits = 0;
return aBits;
@@ -422,53 +416,26 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
vislevel = level_of_visual( dpy, visinfo );
if (vislevel) {
- /* Configure this visual as a CI, single-buffered overlay */
- return save_glx_visual( dpy, visinfo,
- GL_FALSE, /* rgb */
- GL_FALSE, /* alpha */
- GL_FALSE, /* double */
- GL_FALSE, /* stereo */
- 0, /* depth bits */
- 0, /* stencil bits */
- 0,0,0,0, /* accum bits */
- vislevel, /* level */
- 0 /* numAux */
- );
+ /* Color-index rendering to overlays is not supported. */
+ return NULL;
}
else if (is_usable_visual( visinfo )) {
- if (_mesa_getenv("MESA_GLX_FORCE_CI")) {
- /* Configure this visual as a COLOR INDEX visual. */
- return save_glx_visual( dpy, visinfo,
- GL_FALSE, /* rgb */
- GL_FALSE, /* alpha */
- GL_TRUE, /* double */
- GL_FALSE, /* stereo */
- zBits,
- STENCIL_BITS,
- 0, 0, 0, 0, /* accum bits */
- 0, /* level */
- 0 /* numAux */
- );
- }
- else {
- /* Configure this visual as RGB, double-buffered, depth-buffered. */
- /* This is surely wrong for some people's needs but what else */
- /* can be done? They should use glXChooseVisual(). */
- return save_glx_visual( dpy, visinfo,
- GL_TRUE, /* rgb */
- alphaFlag, /* alpha */
- GL_TRUE, /* double */
- GL_FALSE, /* stereo */
- zBits,
- STENCIL_BITS,
- accBits, /* r */
- accBits, /* g */
- accBits, /* b */
- accBits, /* a */
- 0, /* level */
- 0 /* numAux */
- );
- }
+ /* Configure this visual as RGB, double-buffered, depth-buffered. */
+ /* This is surely wrong for some people's needs but what else */
+ /* can be done? They should use glXChooseVisual(). */
+ return save_glx_visual( dpy, visinfo,
+ alphaFlag, /* alpha */
+ GL_TRUE, /* double */
+ GL_FALSE, /* stereo */
+ zBits,
+ STENCIL_BITS,
+ accBits, /* r */
+ accBits, /* g */
+ accBits, /* b */
+ accBits, /* a */
+ 0, /* level */
+ 0 /* numAux */
+ );
}
else {
_mesa_warning(NULL, "Mesa: error in glXCreateContext: bad visual\n");
@@ -616,17 +583,15 @@ get_env_visual(Display *dpy, int scr, const char *varname)
return NULL;
}
- _mesa_strncpy( value, _mesa_getenv(varname), 100 );
+ strncpy( value, _mesa_getenv(varname), 100 );
value[99] = 0;
sscanf( value, "%s %d", type, &depth );
- if (_mesa_strcmp(type,"TrueColor")==0) xclass = TrueColor;
- else if (_mesa_strcmp(type,"DirectColor")==0) xclass = DirectColor;
- else if (_mesa_strcmp(type,"PseudoColor")==0) xclass = PseudoColor;
- else if (_mesa_strcmp(type,"StaticColor")==0) xclass = StaticColor;
- else if (_mesa_strcmp(type,"GrayScale")==0) xclass = GrayScale;
- else if (_mesa_strcmp(type,"StaticGray")==0) xclass = StaticGray;
+ if (strcmp(type,"TrueColor")==0) xclass = TrueColor;
+ else if (strcmp(type,"DirectColor")==0) xclass = DirectColor;
+ else if (strcmp(type,"GrayScale")==0) xclass = GrayScale;
+ else if (strcmp(type,"StaticGray")==0) xclass = StaticGray;
if (xclass>-1 && depth>0) {
vis = get_visual( dpy, scr, depth, xclass );
@@ -646,160 +611,79 @@ get_env_visual(Display *dpy, int scr, const char *varname)
/*
* Select an X visual which satisfies the RGBA/CI flag and minimum depth.
* Input: dpy, screen - X display and screen number
- * rgba - GL_TRUE = RGBA mode, GL_FALSE = CI mode
* min_depth - minimum visual depth
* preferred_class - preferred GLX visual class or DONT_CARE
* Return: pointer to an XVisualInfo or NULL.
*/
static XVisualInfo *
-choose_x_visual( Display *dpy, int screen, GLboolean rgba, int min_depth,
- int preferred_class )
+choose_x_visual(Display *dpy, int screen, int min_depth, int preferred_class)
{
XVisualInfo *vis;
int xclass, visclass = 0;
int depth;
- if (rgba) {
- Atom hp_cr_maps = XInternAtom(dpy, "_HP_RGB_SMOOTH_MAP_LIST", True);
- /* First see if the MESA_RGB_VISUAL env var is defined */
- vis = get_env_visual( dpy, screen, "MESA_RGB_VISUAL" );
- if (vis) {
- return vis;
- }
- /* Otherwise, search for a suitable visual */
- if (preferred_class==DONT_CARE) {
- for (xclass=0;xclass<6;xclass++) {
- switch (xclass) {
- case 0: visclass = TrueColor; break;
- case 1: visclass = DirectColor; break;
- case 2: visclass = PseudoColor; break;
- case 3: visclass = StaticColor; break;
- case 4: visclass = GrayScale; break;
- case 5: visclass = StaticGray; break;
- }
- if (min_depth==0) {
- /* start with shallowest */
- for (depth=0;depth<=32;depth++) {
- if (visclass==TrueColor && depth==8 && !hp_cr_maps) {
- /* Special case: try to get 8-bit PseudoColor before */
- /* 8-bit TrueColor */
- vis = get_visual( dpy, screen, 8, PseudoColor );
- if (vis) {
- return vis;
- }
- }
- vis = get_visual( dpy, screen, depth, visclass );
- if (vis) {
- return vis;
- }
- }
- }
- else {
- /* start with deepest */
- for (depth=32;depth>=min_depth;depth--) {
- if (visclass==TrueColor && depth==8 && !hp_cr_maps) {
- /* Special case: try to get 8-bit PseudoColor before */
- /* 8-bit TrueColor */
- vis = get_visual( dpy, screen, 8, PseudoColor );
- if (vis) {
- return vis;
- }
- }
- vis = get_visual( dpy, screen, depth, visclass );
- if (vis) {
- return vis;
- }
- }
- }
- }
- }
- else {
- /* search for a specific visual class */
- switch (preferred_class) {
- case GLX_TRUE_COLOR_EXT: visclass = TrueColor; break;
- case GLX_DIRECT_COLOR_EXT: visclass = DirectColor; break;
- case GLX_PSEUDO_COLOR_EXT: visclass = PseudoColor; break;
- case GLX_STATIC_COLOR_EXT: visclass = StaticColor; break;
- case GLX_GRAY_SCALE_EXT: visclass = GrayScale; break;
- case GLX_STATIC_GRAY_EXT: visclass = StaticGray; break;
- default: return NULL;
- }
- if (min_depth==0) {
- /* start with shallowest */
- for (depth=0;depth<=32;depth++) {
- vis = get_visual( dpy, screen, depth, visclass );
- if (vis) {
- return vis;
- }
- }
- }
- else {
- /* start with deepest */
- for (depth=32;depth>=min_depth;depth--) {
- vis = get_visual( dpy, screen, depth, visclass );
- if (vis) {
- return vis;
- }
- }
- }
+ /* First see if the MESA_RGB_VISUAL env var is defined */
+ vis = get_env_visual( dpy, screen, "MESA_RGB_VISUAL" );
+ if (vis) {
+ return vis;
+ }
+ /* Otherwise, search for a suitable visual */
+ if (preferred_class==DONT_CARE) {
+ for (xclass=0;xclass<4;xclass++) {
+ switch (xclass) {
+ case 0: visclass = TrueColor; break;
+ case 1: visclass = DirectColor; break;
+ case 2: visclass = GrayScale; break;
+ case 3: visclass = StaticGray; break;
+ }
+ if (min_depth==0) {
+ /* start with shallowest */
+ for (depth=0;depth<=32;depth++) {
+ vis = get_visual( dpy, screen, depth, visclass );
+ if (vis) {
+ return vis;
+ }
+ }
+ }
+ else {
+ /* start with deepest */
+ for (depth=32;depth>=min_depth;depth--) {
+ vis = get_visual( dpy, screen, depth, visclass );
+ if (vis) {
+ return vis;
+ }
+ }
+ }
}
}
else {
- /* First see if the MESA_CI_VISUAL env var is defined */
- vis = get_env_visual( dpy, screen, "MESA_CI_VISUAL" );
- if (vis) {
- return vis;
+ /* search for a specific visual class */
+ switch (preferred_class) {
+ case GLX_TRUE_COLOR_EXT: visclass = TrueColor; break;
+ case GLX_DIRECT_COLOR_EXT: visclass = DirectColor; break;
+ case GLX_GRAY_SCALE_EXT: visclass = GrayScale; break;
+ case GLX_STATIC_GRAY_EXT: visclass = StaticGray; break;
+ case GLX_PSEUDO_COLOR_EXT:
+ case GLX_STATIC_COLOR_EXT:
+ default: return NULL;
}
- /* Otherwise, search for a suitable visual, starting with shallowest */
- if (preferred_class==DONT_CARE) {
- for (xclass=0;xclass<4;xclass++) {
- switch (xclass) {
- case 0: visclass = PseudoColor; break;
- case 1: visclass = StaticColor; break;
- case 2: visclass = GrayScale; break;
- case 3: visclass = StaticGray; break;
- }
- /* try 8-bit up through 16-bit */
- for (depth=8;depth<=16;depth++) {
- vis = get_visual( dpy, screen, depth, visclass );
- if (vis) {
- return vis;
- }
- }
- /* try min_depth up to 8-bit */
- for (depth=min_depth;depth<8;depth++) {
- vis = get_visual( dpy, screen, depth, visclass );
- if (vis) {
- return vis;
- }
- }
- }
+ if (min_depth==0) {
+ /* start with shallowest */
+ for (depth=0;depth<=32;depth++) {
+ vis = get_visual( dpy, screen, depth, visclass );
+ if (vis) {
+ return vis;
+ }
+ }
}
else {
- /* search for a specific visual class */
- switch (preferred_class) {
- case GLX_TRUE_COLOR_EXT: visclass = TrueColor; break;
- case GLX_DIRECT_COLOR_EXT: visclass = DirectColor; break;
- case GLX_PSEUDO_COLOR_EXT: visclass = PseudoColor; break;
- case GLX_STATIC_COLOR_EXT: visclass = StaticColor; break;
- case GLX_GRAY_SCALE_EXT: visclass = GrayScale; break;
- case GLX_STATIC_GRAY_EXT: visclass = StaticGray; break;
- default: return NULL;
- }
- /* try 8-bit up through 16-bit */
- for (depth=8;depth<=16;depth++) {
- vis = get_visual( dpy, screen, depth, visclass );
- if (vis) {
- return vis;
- }
- }
- /* try min_depth up to 8-bit */
- for (depth=min_depth;depth<8;depth++) {
- vis = get_visual( dpy, screen, depth, visclass );
- if (vis) {
- return vis;
- }
- }
+ /* start with deepest */
+ for (depth=32;depth>=min_depth;depth--) {
+ vis = get_visual( dpy, screen, depth, visclass );
+ if (vis) {
+ return vis;
+ }
+ }
}
}
@@ -822,7 +706,7 @@ choose_x_visual( Display *dpy, int screen, GLboolean rgba, int min_depth,
* Return: pointer to an XVisualInfo or NULL.
*/
static XVisualInfo *
-choose_x_overlay_visual( Display *dpy, int scr, GLboolean rgbFlag,
+choose_x_overlay_visual( Display *dpy, int scr,
int level, int trans_type, int trans_value,
int min_depth, int preferred_class )
{
@@ -889,14 +773,8 @@ choose_x_overlay_visual( Display *dpy, int scr, GLboolean rgbFlag,
continue;
}
- /* if RGB was requested, make sure we have True/DirectColor */
- if (rgbFlag && vislist->CLASS != TrueColor
- && vislist->CLASS != DirectColor)
- continue;
-
- /* if CI was requested, make sure we have a color indexed visual */
- if (!rgbFlag
- && (vislist->CLASS == TrueColor || vislist->CLASS == DirectColor))
+ /* Color-index rendering is not supported. Make sure we have True/DirectColor */
+ if (vislist->CLASS != TrueColor && vislist->CLASS != DirectColor)
continue;
if (deepvis==NULL || vislist->depth > deepest) {
@@ -1266,6 +1144,9 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
}
}
+ if (!rgb_flag)
+ return NULL;
+
(void) caveat;
/*
@@ -1285,46 +1166,27 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
if (vis) {
/* give the visual some useful GLX attributes */
double_flag = GL_TRUE;
- if (vis->depth > 8)
- rgb_flag = GL_TRUE;
+ if (vis->depth <= 8)
+ return NULL;
depth_size = default_depth_bits();
stencil_size = STENCIL_BITS;
/* XXX accum??? */
}
}
- else if (level==0) {
- /* normal color planes */
- if (rgb_flag) {
- /* Get an RGB visual */
- int min_rgb = min_red + min_green + min_blue;
- if (min_rgb>1 && min_rgb<8) {
- /* a special case to be sure we can get a monochrome visual */
- min_rgb = 1;
- }
- vis = choose_x_visual( dpy, screen, rgb_flag, min_rgb, visual_type );
- }
- else {
- /* Get a color index visual */
- vis = choose_x_visual( dpy, screen, rgb_flag, min_ci, visual_type );
- accumRedSize = accumGreenSize = accumBlueSize = accumAlphaSize = 0;
- }
- }
else {
- /* over/underlay planes */
- if (rgb_flag) {
- /* rgba overlay */
- int min_rgb = min_red + min_green + min_blue;
- if (min_rgb>1 && min_rgb<8) {
- /* a special case to be sure we can get a monochrome visual */
- min_rgb = 1;
- }
- vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level,
- trans_type, trans_value, min_rgb, visual_type );
+ /* RGB visual */
+ int min_rgb = min_red + min_green + min_blue;
+ if (min_rgb>1 && min_rgb<8) {
+ /* a special case to be sure we can get a monochrome visual */
+ min_rgb = 1;
+ }
+
+ if (level==0) {
+ vis = choose_x_visual(dpy, screen, min_rgb, visual_type);
}
else {
- /* color index overlay */
- vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level,
- trans_type, trans_value, min_ci, visual_type );
+ vis = choose_x_overlay_visual(dpy, screen, level,
+ trans_type, trans_value, min_rgb, visual_type);
}
}
@@ -1357,7 +1219,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
accumAlphaSize = alpha_flag ? accumRedSize : 0;
}
- xmvis = save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag,
+ xmvis = save_glx_visual( dpy, vis, alpha_flag, double_flag,
stereo_flag, depth_size, stencil_size,
accumRedSize, accumGreenSize,
accumBlueSize, accumAlphaSize, level, numAux );
@@ -1381,9 +1243,9 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
return xmvis->vishandle;
#else
/* create a new vishandle - the cached one may be stale */
- xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
+ xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
if (xmvis->vishandle) {
- _mesa_memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
+ memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
}
return xmvis->vishandle;
#endif
@@ -1438,7 +1300,7 @@ Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
xmvis = create_glx_visual( dpy, visinfo );
if (!xmvis) {
/* unusable visual */
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
}
@@ -1446,7 +1308,7 @@ Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
@@ -1671,7 +1533,7 @@ Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
MakeCurrent_PrevReadBuffer = 0;
XMesaDestroyContext( glxCtx->xmesaContext );
XMesaGarbageCollect();
- _mesa_free(glxCtx);
+ free(glxCtx);
}
@@ -2032,8 +1894,8 @@ static const char *
Fake_glXQueryServerString( Display *dpy, int screen, int name )
{
static char version[1000];
- _mesa_sprintf(version, "%d.%d %s",
- SERVER_MAJOR_VERSION, SERVER_MINOR_VERSION, MESA_GLX_VERSION);
+ sprintf(version, "%d.%d %s",
+ SERVER_MAJOR_VERSION, SERVER_MINOR_VERSION, MESA_GLX_VERSION);
(void) dpy;
(void) screen;
@@ -2057,8 +1919,8 @@ static const char *
Fake_glXGetClientString( Display *dpy, int name )
{
static char version[1000];
- _mesa_sprintf(version, "%d.%d %s", CLIENT_MAJOR_VERSION,
- CLIENT_MINOR_VERSION, MESA_GLX_VERSION);
+ sprintf(version, "%d.%d %s", CLIENT_MAJOR_VERSION,
+ CLIENT_MINOR_VERSION, MESA_GLX_VERSION);
(void) dpy;
@@ -2108,7 +1970,7 @@ Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements )
visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements);
if (*nelements > 0) {
XMesaVisual *results;
- results = (XMesaVisual *) _mesa_malloc(*nelements * sizeof(XMesaVisual));
+ results = (XMesaVisual *) malloc(*nelements * sizeof(XMesaVisual));
if (!results) {
*nelements = 0;
return NULL;
@@ -2135,7 +1997,7 @@ Fake_glXChooseFBConfig( Display *dpy, int screen,
xmvis = choose_visual(dpy, screen, attribList, GL_TRUE);
if (xmvis) {
- GLXFBConfig *config = (GLXFBConfig *) _mesa_malloc(sizeof(XMesaVisual));
+ GLXFBConfig *config = (GLXFBConfig *) malloc(sizeof(XMesaVisual));
if (!config) {
*nitems = 0;
return NULL;
@@ -2160,9 +2022,9 @@ Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
return xmvis->vishandle;
#else
/* create a new vishandle - the cached one may be stale */
- xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
+ xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
if (xmvis->vishandle) {
- _mesa_memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
+ memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
}
return xmvis->vishandle;
#endif
@@ -2469,7 +2331,7 @@ Fake_glXCreateNewContext( Display *dpy, GLXFBConfig config,
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
@@ -2493,10 +2355,7 @@ Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value )
*value = xmctx->xm_visual->visinfo->visualid;
break;
case GLX_RENDER_TYPE:
- if (xmctx->xm_visual->mesa_visual.rgbMode)
- *value = GLX_RGBA_TYPE;
- else
- *value = GLX_COLOR_INDEX_TYPE;
+ *value = GLX_RGBA_TYPE;
break;
case GLX_SCREEN:
*value = 0;
@@ -2687,7 +2546,7 @@ Fake_glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int re
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
diff --git a/src/mesa/drivers/x11/xfonts.c b/src/mesa/drivers/x11/xfonts.c
index f732c945865..91f819b8df2 100644
--- a/src/mesa/drivers/x11/xfonts.c
+++ b/src/mesa/drivers/x11/xfonts.c
@@ -345,7 +345,7 @@ Fake_glXUseXFont(Font font, int first, int count, int listbase)
glNewList(list, GL_COMPILE);
if (valid && (bm_width > 0) && (bm_height > 0)) {
- MEMSET(bm, '\0', bm_width * bm_height);
+ memset(bm, '\0', bm_width * bm_height);
fill_bitmap(dpy, win, gc, bm_width, bm_height, x, y, c, bm);
glBitmap(width, height, x0, y0, dx, dy, bm);
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 1a5456e1be2..a1723fa37b1 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -253,7 +253,7 @@ bits_per_pixel( XMesaVisual xmv )
/* grab the bits/pixel value */
bitsPerPixel = img->bits_per_pixel;
/* free the XImage */
- _mesa_free( img->data );
+ free( img->data );
img->data = NULL;
XMesaDestroyImage( img );
return bitsPerPixel;
@@ -383,7 +383,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
*/
b->frontxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_FALSE);
if (!b->frontxrb) {
- _mesa_free(b);
+ free(b);
return NULL;
}
b->frontxrb->Parent = b;
@@ -399,7 +399,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
b->backxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_TRUE);
if (!b->backxrb) {
/* XXX free front xrb too */
- _mesa_free(b);
+ free(b);
return NULL;
}
b->backxrb->Parent = b;
@@ -511,12 +511,12 @@ xmesa_free_buffer(XMesaBuffer buffer)
static void
copy_colortable_info(XMesaBuffer dst, const XMesaBuffer src)
{
- MEMCPY(dst->color_table, src->color_table, sizeof(src->color_table));
- MEMCPY(dst->pixel_to_r, src->pixel_to_r, sizeof(src->pixel_to_r));
- MEMCPY(dst->pixel_to_g, src->pixel_to_g, sizeof(src->pixel_to_g));
- MEMCPY(dst->pixel_to_b, src->pixel_to_b, sizeof(src->pixel_to_b));
+ memcpy(dst->color_table, src->color_table, sizeof(src->color_table));
+ memcpy(dst->pixel_to_r, src->pixel_to_r, sizeof(src->pixel_to_r));
+ memcpy(dst->pixel_to_g, src->pixel_to_g, sizeof(src->pixel_to_g));
+ memcpy(dst->pixel_to_b, src->pixel_to_b, sizeof(src->pixel_to_b));
dst->num_alloced = src->num_alloced;
- MEMCPY(dst->alloced_colors, src->alloced_colors,
+ memcpy(dst->alloced_colors, src->alloced_colors,
sizeof(src->alloced_colors));
}
@@ -596,7 +596,7 @@ noFaultXAllocColor( int client,
|| prevCmapSize != cmapSize || !ctable) {
/* free previously cached color table */
if (ctable)
- _mesa_free(ctable);
+ free(ctable);
/* Get the color table from X */
ctable = (XMesaColor *) MALLOC(cmapSize * sizeof(XMesaColor));
assert(ctable);
@@ -652,8 +652,8 @@ noFaultXAllocColor( int client,
*alloced = 0;
}
#ifdef XFree86Server
- _mesa_free(ppixIn);
- _mesa_free(ctable);
+ free(ppixIn);
+ free(ctable);
#else
/* don't free table, save it for next time */
#endif
@@ -684,9 +684,7 @@ setup_grayscale(int client, XMesaVisual v,
}
prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
- if (prevBuffer &&
- (buffer->xm_visual->mesa_visual.rgbMode ==
- prevBuffer->xm_visual->mesa_visual.rgbMode)) {
+ if (prevBuffer) {
/* Copy colormap stuff from previous XMesaBuffer which uses same
* X colormap. Do this to avoid time spent in noFaultXAllocColor.
*/
@@ -773,9 +771,7 @@ setup_dithered_color(int client, XMesaVisual v,
}
prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
- if (prevBuffer &&
- (buffer->xm_visual->mesa_visual.rgbMode ==
- prevBuffer->xm_visual->mesa_visual.rgbMode)) {
+ if (prevBuffer) {
/* Copy colormap stuff from previous, matching XMesaBuffer.
* Do this to avoid time spent in noFaultXAllocColor.
*/
@@ -1047,10 +1043,11 @@ setup_monochrome( XMesaVisual v, XMesaBuffer b )
*/
static GLboolean
initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
- GLboolean rgb_flag, XMesaDrawable window,
+ XMesaDrawable window,
XMesaColormap cmap)
{
int client = 0;
+ const int xclass = v->mesa_visual.visualType;
#ifdef XFree86Server
client = (window) ? CLIENT_ID(window->id) : 0;
@@ -1062,45 +1059,34 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
v->BitsPerPixel = bits_per_pixel(v);
assert(v->BitsPerPixel > 0);
- if (rgb_flag == GL_FALSE) {
- /* COLOR-INDEXED WINDOW:
- * Even if the visual is TrueColor or DirectColor we treat it as
- * being color indexed. This is weird but might be useful to someone.
- */
- v->dithered_pf = v->undithered_pf = PF_Index;
- v->mesa_visual.indexBits = GET_VISUAL_DEPTH(v);
+ /* RGB WINDOW:
+ * We support RGB rendering into almost any kind of visual.
+ */
+ if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) {
+ setup_truecolor( v, b, cmap );
}
- else {
- /* RGB WINDOW:
- * We support RGB rendering into almost any kind of visual.
- */
- const int xclass = v->mesa_visual.visualType;
- if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) {
- setup_truecolor( v, b, cmap );
- }
- else if (xclass == GLX_STATIC_GRAY && GET_VISUAL_DEPTH(v) == 1) {
- setup_monochrome( v, b );
- }
- else if (xclass == GLX_GRAY_SCALE || xclass == GLX_STATIC_GRAY) {
- if (!setup_grayscale( client, v, b, cmap )) {
- return GL_FALSE;
- }
- }
- else if ((xclass == GLX_PSEUDO_COLOR || xclass == GLX_STATIC_COLOR)
- && GET_VISUAL_DEPTH(v)>=4 && GET_VISUAL_DEPTH(v)<=16) {
- if (!setup_dithered_color( client, v, b, cmap )) {
- return GL_FALSE;
- }
+ else if (xclass == GLX_STATIC_GRAY && GET_VISUAL_DEPTH(v) == 1) {
+ setup_monochrome( v, b );
+ }
+ else if (xclass == GLX_GRAY_SCALE || xclass == GLX_STATIC_GRAY) {
+ if (!setup_grayscale( client, v, b, cmap )) {
+ return GL_FALSE;
}
- else {
- _mesa_warning(NULL, "XMesa: RGB mode rendering not supported in given visual.\n");
+ }
+ else if ((xclass == GLX_PSEUDO_COLOR || xclass == GLX_STATIC_COLOR)
+ && GET_VISUAL_DEPTH(v)>=4 && GET_VISUAL_DEPTH(v)<=16) {
+ if (!setup_dithered_color( client, v, b, cmap )) {
return GL_FALSE;
}
- v->mesa_visual.indexBits = 0;
+ }
+ else {
+ _mesa_warning(NULL, "XMesa: RGB mode rendering not supported in given visual.\n");
+ return GL_FALSE;
+ }
+ v->mesa_visual.indexBits = 0;
- if (_mesa_getenv("MESA_NO_DITHER")) {
- v->dithered_pf = v->undithered_pf;
- }
+ if (_mesa_getenv("MESA_NO_DITHER")) {
+ v->dithered_pf = v->undithered_pf;
}
@@ -1110,12 +1096,12 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
* reports bugs.
*/
if (_mesa_getenv("MESA_INFO")) {
- _mesa_printf("X/Mesa visual = %p\n", (void *) v);
- _mesa_printf("X/Mesa dithered pf = %u\n", v->dithered_pf);
- _mesa_printf("X/Mesa undithered pf = %u\n", v->undithered_pf);
- _mesa_printf("X/Mesa level = %d\n", v->mesa_visual.level);
- _mesa_printf("X/Mesa depth = %d\n", GET_VISUAL_DEPTH(v));
- _mesa_printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel);
+ printf("X/Mesa visual = %p\n", (void *) v);
+ printf("X/Mesa dithered pf = %u\n", v->dithered_pf);
+ printf("X/Mesa undithered pf = %u\n", v->undithered_pf);
+ printf("X/Mesa level = %d\n", v->mesa_visual.level);
+ printf("X/Mesa depth = %d\n", GET_VISUAL_DEPTH(v));
+ printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel);
}
if (b && window) {
@@ -1359,6 +1345,10 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
}
#endif
+ /* Color-index rendering not supported. */
+ if (!rgb_flag)
+ return NULL;
+
v = (XMesaVisual) CALLOC_STRUCT(xmesa_visual);
if (!v) {
return NULL;
@@ -1366,17 +1356,17 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
v->display = display;
- /* Save a copy of the XVisualInfo struct because the user may X_mesa_free()
+ /* Save a copy of the XVisualInfo struct because the user may Xfree()
* the struct but we may need some of the information contained in it
* at a later time.
*/
#ifndef XFree86Server
v->visinfo = (XVisualInfo *) MALLOC(sizeof(*visinfo));
if(!v->visinfo) {
- _mesa_free(v);
+ free(v);
return NULL;
}
- MEMCPY(v->visinfo, visinfo, sizeof(*visinfo));
+ memcpy(v->visinfo, visinfo, sizeof(*visinfo));
#endif
/* check for MESA_GAMMA environment variable */
@@ -1428,7 +1418,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
if (alpha_flag)
v->mesa_visual.alphaBits = 8;
- (void) initialize_visual_and_buffer( v, NULL, rgb_flag, 0, 0 );
+ (void) initialize_visual_and_buffer( v, NULL, 0, 0 );
{
const int xclass = v->mesa_visual.visualType;
@@ -1453,10 +1443,9 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
}
_mesa_initialize_visual( &v->mesa_visual,
- rgb_flag, db_flag, stereo_flag,
+ db_flag, stereo_flag,
red_bits, green_bits,
blue_bits, alpha_bits,
- v->mesa_visual.indexBits,
depth_size,
stencil_size,
accum_red_size, accum_green_size,
@@ -1473,9 +1462,9 @@ PUBLIC
void XMesaDestroyVisual( XMesaVisual v )
{
#ifndef XFree86Server
- _mesa_free(v->visinfo);
+ free(v->visinfo);
#endif
- _mesa_free(v);
+ free(v);
}
@@ -1514,7 +1503,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
if (!_mesa_initialize_context(mesaCtx, &v->mesa_visual,
share_list ? &(share_list->mesa) : (GLcontext *) NULL,
&functions, (void *) c)) {
- _mesa_free(c);
+ free(c);
return NULL;
}
@@ -1564,7 +1553,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
!_tnl_CreateContext( mesaCtx ) ||
!_swsetup_CreateContext( mesaCtx )) {
_mesa_free_context_data(&c->mesa);
- _mesa_free(c);
+ free(c);
return NULL;
}
@@ -1598,7 +1587,7 @@ void XMesaDestroyContext( XMesaContext c )
_tnl_DestroyContext( mesaCtx );
_vbo_DestroyContext( mesaCtx );
_mesa_free_context_data( mesaCtx );
- _mesa_free( c );
+ free( c );
}
@@ -1655,8 +1644,7 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
if (!b)
return NULL;
- if (!initialize_visual_and_buffer( v, b, v->mesa_visual.rgbMode,
- (XMesaDrawable) w, cmap )) {
+ if (!initialize_visual_and_buffer( v, b, (XMesaDrawable) w, cmap )) {
xmesa_free_buffer(b);
return NULL;
}
@@ -1686,8 +1674,7 @@ XMesaCreatePixmapBuffer(XMesaVisual v, XMesaPixmap p, XMesaColormap cmap)
if (!b)
return NULL;
- if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
- (XMesaDrawable) p, cmap)) {
+ if (!initialize_visual_and_buffer(v, b, (XMesaDrawable) p, cmap)) {
xmesa_free_buffer(b);
return NULL;
}
@@ -1747,8 +1734,7 @@ XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p,
b->TextureFormat = format;
b->TextureMipmap = mipmap;
- if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
- (XMesaDrawable) p, cmap)) {
+ if (!initialize_visual_and_buffer(v, b, (XMesaDrawable) p, cmap)) {
xmesa_free_buffer(b);
return NULL;
}
@@ -1778,8 +1764,7 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
if (!b)
return NULL;
- if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
- drawable, cmap)) {
+ if (!initialize_visual_and_buffer(v, b, drawable, cmap)) {
xmesa_free_buffer(b);
return NULL;
}
@@ -1874,19 +1859,17 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
&drawBuffer->mesa_buffer,
&readBuffer->mesa_buffer);
- if (c->xm_visual->mesa_visual.rgbMode) {
- /*
- * Must recompute and set these pixel values because colormap
- * can be different for different windows.
- */
- c->clearpixel = xmesa_color_to_pixel( &c->mesa,
- c->clearcolor[0],
- c->clearcolor[1],
- c->clearcolor[2],
- c->clearcolor[3],
- c->xm_visual->undithered_pf);
- XMesaSetForeground(c->display, drawBuffer->cleargc, c->clearpixel);
- }
+ /*
+ * Must recompute and set these pixel values because colormap
+ * can be different for different windows.
+ */
+ c->clearpixel = xmesa_color_to_pixel( &c->mesa,
+ c->clearcolor[0],
+ c->clearcolor[1],
+ c->clearcolor[2],
+ c->clearcolor[3],
+ c->xm_visual->undithered_pf);
+ XMesaSetForeground(c->display, drawBuffer->cleargc, c->clearpixel);
/* Solution to Stephane Rehel's problem with glXReleaseBuffersMESA(): */
drawBuffer->wasCurrent = GL_TRUE;
diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c
index bf386292895..e47949750ab 100644
--- a/src/mesa/drivers/x11/xm_buffer.c
+++ b/src/mesa/drivers/x11/xm_buffer.c
@@ -242,7 +242,7 @@ xmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
* should probably get freed here, but that's currently done in
* XMesaDestroyBuffer().
*/
- _mesa_free(rb);
+ free(rb);
}
@@ -337,18 +337,10 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual,
else
xrb->Base.AllocStorage = xmesa_alloc_front_storage;
- if (visual->rgbMode) {
- xrb->Base.InternalFormat = GL_RGBA;
- xrb->Base.Format = MESA_FORMAT_RGBA8888;
- xrb->Base._BaseFormat = GL_RGBA;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
- }
- else {
- xrb->Base.InternalFormat = GL_COLOR_INDEX;
- xrb->Base.Format = MESA_FORMAT_CI8;
- xrb->Base._BaseFormat = GL_COLOR_INDEX;
- xrb->Base.DataType = GL_UNSIGNED_INT;
- }
+ xrb->Base.InternalFormat = GL_RGBA;
+ xrb->Base.Format = MESA_FORMAT_RGBA8888;
+ xrb->Base._BaseFormat = GL_RGBA;
+ xrb->Base.DataType = GL_UNSIGNED_BYTE;
/* only need to set Red/Green/EtcBits fields for user-created RBs */
}
return xrb;
@@ -412,11 +404,11 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb)
}
if (b->rowimage) {
- _mesa_free( b->rowimage->data );
+ free( b->rowimage->data );
b->rowimage->data = NULL;
XMesaDestroyImage( b->rowimage );
}
_mesa_free_framebuffer_data(fb);
- _mesa_free(fb);
+ free(fb);
}
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index df04e3a1011..5edafb890b1 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -107,18 +107,6 @@ finish_or_flush( GLcontext *ctx )
static void
-clear_index( GLcontext *ctx, GLuint index )
-{
- if (ctx->DrawBuffer->Name == 0) {
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer);
- xmesa->clearpixel = (unsigned long) index;
- XMesaSetForeground( xmesa->display, xmbuf->cleargc, (unsigned long) index );
- }
-}
-
-
-static void
clear_color( GLcontext *ctx, const GLfloat color[4] )
{
if (ctx->DrawBuffer->Name == 0) {
@@ -144,26 +132,6 @@ clear_color( GLcontext *ctx, const GLfloat color[4] )
-/* Set index mask ala glIndexMask */
-static void
-index_mask( GLcontext *ctx, GLuint mask )
-{
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer);
- /* not sure this conditional is really needed */
- if (xmbuf->backxrb && xmbuf->backxrb->pixmap) {
- unsigned long m;
- if (mask==0xffffffff) {
- m = ((unsigned long)~0L);
- }
- else {
- m = (unsigned long) mask;
- }
- XMesaSetPlaneMask( xmesa->display, xmbuf->cleargc, m );
- }
-}
-
-
/* Implements glColorMask() */
static void
color_mask(GLcontext *ctx,
@@ -232,7 +200,7 @@ clear_8bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
GLint i;
for (i = 0; i < height; i++) {
GLubyte *ptr = PIXEL_ADDR1(xrb, x, y + i);
- MEMSET( ptr, xmesa->clearpixel, width );
+ memset( ptr, xmesa->clearpixel, width );
}
}
@@ -294,7 +262,7 @@ clear_24bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
GLint j;
for (j = 0; j < height; j++) {
bgr_t *ptr3 = PIXEL_ADDR3(xrb, x, y + j);
- MEMSET(ptr3, r, 3 * width);
+ memset(ptr3, r, 3 * width);
}
}
else {
@@ -336,7 +304,7 @@ clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
GLuint *ptr4 = (GLuint *) xrb->ximage->data;
if (pixel == 0) {
/* common case */
- _mesa_memset(ptr4, pixel, 4 * n);
+ memset(ptr4, pixel, 4 * n);
}
else {
GLuint i;
@@ -524,7 +492,7 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx,
* been in the OpenGL bottom-to-top orientation. X is top-to-bottom
* so we have to carefully compute the Y coordinates/addresses here.
*/
- MEMSET(&ximage, 0, sizeof(XMesaImage));
+ memset(&ximage, 0, sizeof(XMesaImage));
ximage.width = width;
ximage.height = height;
ximage.format = ZPixmap;
@@ -658,7 +626,7 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx,
* been in the OpenGL bottom-to-top orientation. X is top-to-bottom
* so we have to carefully compute the Y coordinates/addresses here.
*/
- MEMSET(&ximage, 0, sizeof(XMesaImage));
+ memset(&ximage, 0, sizeof(XMesaImage));
ximage.width = width;
ximage.height = height;
ximage.format = ZPixmap;
@@ -829,7 +797,7 @@ clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] )
if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) {
/* black is black */
- MEMSET( xmesa->xm_visual->hpcr_clear_ximage_pattern, 0x0 ,
+ memset( xmesa->xm_visual->hpcr_clear_ximage_pattern, 0x0 ,
sizeof(xmesa->xm_visual->hpcr_clear_ximage_pattern));
}
else {
@@ -1143,9 +1111,7 @@ xmesa_init_driver_functions( XMesaVisual xmvisual,
driver->GetBufferSize = NULL; /* OBSOLETE */
driver->Flush = finish_or_flush;
driver->Finish = finish_or_flush;
- driver->ClearIndex = clear_index;
driver->ClearColor = clear_color;
- driver->IndexMask = index_mask;
driver->ColorMask = color_mask;
driver->Enable = enable;
driver->Viewport = xmesa_viewport;
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index 3a0cf801397..a6efb35e3c3 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -1330,97 +1330,97 @@
extern void _xmesa_print_triangle_func( swrast_tri_func triFunc );
void _xmesa_print_triangle_func( swrast_tri_func triFunc )
{
- _mesa_printf("XMesa tri func = ");
+ printf("XMesa tri func = ");
if (triFunc ==smooth_TRUECOLOR_z_triangle)
- _mesa_printf("smooth_TRUECOLOR_z_triangle\n");
+ printf("smooth_TRUECOLOR_z_triangle\n");
else if (triFunc ==smooth_8A8B8G8R_z_triangle)
- _mesa_printf("smooth_8A8B8G8R_z_triangle\n");
+ printf("smooth_8A8B8G8R_z_triangle\n");
else if (triFunc ==smooth_8A8R8G8B_z_triangle)
- _mesa_printf("smooth_8A8R8G8B_z_triangle\n");
+ printf("smooth_8A8R8G8B_z_triangle\n");
else if (triFunc ==smooth_8R8G8B_z_triangle)
- _mesa_printf("smooth_8R8G8B_z_triangle\n");
+ printf("smooth_8R8G8B_z_triangle\n");
else if (triFunc ==smooth_8R8G8B24_z_triangle)
- _mesa_printf("smooth_8R8G8B24_z_triangle\n");
+ printf("smooth_8R8G8B24_z_triangle\n");
else if (triFunc ==smooth_TRUEDITHER_z_triangle)
- _mesa_printf("smooth_TRUEDITHER_z_triangle\n");
+ printf("smooth_TRUEDITHER_z_triangle\n");
else if (triFunc ==smooth_5R6G5B_z_triangle)
- _mesa_printf("smooth_5R6G5B_z_triangle\n");
+ printf("smooth_5R6G5B_z_triangle\n");
else if (triFunc ==smooth_DITHER_5R6G5B_z_triangle)
- _mesa_printf("smooth_DITHER_5R6G5B_z_triangle\n");
+ printf("smooth_DITHER_5R6G5B_z_triangle\n");
else if (triFunc ==smooth_HPCR_z_triangle)
- _mesa_printf("smooth_HPCR_z_triangle\n");
+ printf("smooth_HPCR_z_triangle\n");
else if (triFunc ==smooth_DITHER8_z_triangle)
- _mesa_printf("smooth_DITHER8_z_triangle\n");
+ printf("smooth_DITHER8_z_triangle\n");
else if (triFunc ==smooth_LOOKUP8_z_triangle)
- _mesa_printf("smooth_LOOKUP8_z_triangle\n");
+ printf("smooth_LOOKUP8_z_triangle\n");
else if (triFunc ==flat_TRUECOLOR_z_triangle)
- _mesa_printf("flat_TRUECOLOR_z_triangle\n");
+ printf("flat_TRUECOLOR_z_triangle\n");
else if (triFunc ==flat_8A8B8G8R_z_triangle)
- _mesa_printf("flat_8A8B8G8R_z_triangle\n");
+ printf("flat_8A8B8G8R_z_triangle\n");
else if (triFunc ==flat_8A8R8G8B_z_triangle)
- _mesa_printf("flat_8A8R8G8B_z_triangle\n");
+ printf("flat_8A8R8G8B_z_triangle\n");
else if (triFunc ==flat_8R8G8B_z_triangle)
- _mesa_printf("flat_8R8G8B_z_triangle\n");
+ printf("flat_8R8G8B_z_triangle\n");
else if (triFunc ==flat_8R8G8B24_z_triangle)
- _mesa_printf("flat_8R8G8B24_z_triangle\n");
+ printf("flat_8R8G8B24_z_triangle\n");
else if (triFunc ==flat_TRUEDITHER_z_triangle)
- _mesa_printf("flat_TRUEDITHER_z_triangle\n");
+ printf("flat_TRUEDITHER_z_triangle\n");
else if (triFunc ==flat_5R6G5B_z_triangle)
- _mesa_printf("flat_5R6G5B_z_triangle\n");
+ printf("flat_5R6G5B_z_triangle\n");
else if (triFunc ==flat_DITHER_5R6G5B_z_triangle)
- _mesa_printf("flat_DITHER_5R6G5B_z_triangle\n");
+ printf("flat_DITHER_5R6G5B_z_triangle\n");
else if (triFunc ==flat_HPCR_z_triangle)
- _mesa_printf("flat_HPCR_z_triangle\n");
+ printf("flat_HPCR_z_triangle\n");
else if (triFunc ==flat_DITHER8_z_triangle)
- _mesa_printf("flat_DITHER8_z_triangle\n");
+ printf("flat_DITHER8_z_triangle\n");
else if (triFunc ==flat_LOOKUP8_z_triangle)
- _mesa_printf("flat_LOOKUP8_z_triangle\n");
+ printf("flat_LOOKUP8_z_triangle\n");
else if (triFunc ==smooth_TRUECOLOR_triangle)
- _mesa_printf("smooth_TRUECOLOR_triangle\n");
+ printf("smooth_TRUECOLOR_triangle\n");
else if (triFunc ==smooth_8A8B8G8R_triangle)
- _mesa_printf("smooth_8A8B8G8R_triangle\n");
+ printf("smooth_8A8B8G8R_triangle\n");
else if (triFunc ==smooth_8A8R8G8B_triangle)
- _mesa_printf("smooth_8A8R8G8B_triangle\n");
+ printf("smooth_8A8R8G8B_triangle\n");
else if (triFunc ==smooth_8R8G8B_triangle)
- _mesa_printf("smooth_8R8G8B_triangle\n");
+ printf("smooth_8R8G8B_triangle\n");
else if (triFunc ==smooth_8R8G8B24_triangle)
- _mesa_printf("smooth_8R8G8B24_triangle\n");
+ printf("smooth_8R8G8B24_triangle\n");
else if (triFunc ==smooth_TRUEDITHER_triangle)
- _mesa_printf("smooth_TRUEDITHER_triangle\n");
+ printf("smooth_TRUEDITHER_triangle\n");
else if (triFunc ==smooth_5R6G5B_triangle)
- _mesa_printf("smooth_5R6G5B_triangle\n");
+ printf("smooth_5R6G5B_triangle\n");
else if (triFunc ==smooth_DITHER_5R6G5B_triangle)
- _mesa_printf("smooth_DITHER_5R6G5B_triangle\n");
+ printf("smooth_DITHER_5R6G5B_triangle\n");
else if (triFunc ==smooth_HPCR_triangle)
- _mesa_printf("smooth_HPCR_triangle\n");
+ printf("smooth_HPCR_triangle\n");
else if (triFunc ==smooth_DITHER8_triangle)
- _mesa_printf("smooth_DITHER8_triangle\n");
+ printf("smooth_DITHER8_triangle\n");
else if (triFunc ==smooth_LOOKUP8_triangle)
- _mesa_printf("smooth_LOOKUP8_triangle\n");
+ printf("smooth_LOOKUP8_triangle\n");
else if (triFunc ==flat_TRUECOLOR_triangle)
- _mesa_printf("flat_TRUECOLOR_triangle\n");
+ printf("flat_TRUECOLOR_triangle\n");
else if (triFunc ==flat_TRUEDITHER_triangle)
- _mesa_printf("flat_TRUEDITHER_triangle\n");
+ printf("flat_TRUEDITHER_triangle\n");
else if (triFunc ==flat_8A8B8G8R_triangle)
- _mesa_printf("flat_8A8B8G8R_triangle\n");
+ printf("flat_8A8B8G8R_triangle\n");
else if (triFunc ==flat_8A8R8G8B_triangle)
- _mesa_printf("flat_8A8R8G8B_triangle\n");
+ printf("flat_8A8R8G8B_triangle\n");
else if (triFunc ==flat_8R8G8B_triangle)
- _mesa_printf("flat_8R8G8B_triangle\n");
+ printf("flat_8R8G8B_triangle\n");
else if (triFunc ==flat_8R8G8B24_triangle)
- _mesa_printf("flat_8R8G8B24_triangle\n");
+ printf("flat_8R8G8B24_triangle\n");
else if (triFunc ==flat_5R6G5B_triangle)
- _mesa_printf("flat_5R6G5B_triangle\n");
+ printf("flat_5R6G5B_triangle\n");
else if (triFunc ==flat_DITHER_5R6G5B_triangle)
- _mesa_printf("flat_DITHER_5R6G5B_triangle\n");
+ printf("flat_DITHER_5R6G5B_triangle\n");
else if (triFunc ==flat_HPCR_triangle)
- _mesa_printf("flat_HPCR_triangle\n");
+ printf("flat_HPCR_triangle\n");
else if (triFunc ==flat_DITHER8_triangle)
- _mesa_printf("flat_DITHER8_triangle\n");
+ printf("flat_DITHER8_triangle\n");
else if (triFunc ==flat_LOOKUP8_triangle)
- _mesa_printf("flat_LOOKUP8_triangle\n");
+ printf("flat_LOOKUP8_triangle\n");
else
- _mesa_printf("???\n");
+ printf("???\n");
}
#endif